aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/00-INDEX2
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/uio-howto.tmpl90
-rw-r--r--Documentation/namespaces/compatibility-list.txt39
-rw-r--r--Documentation/tty.txt8
-rw-r--r--Documentation/usb/power-management.txt8
-rw-r--r--Documentation/x86_64/uefi.txt29
-rw-r--r--MAINTAINERS111
-rw-r--r--arch/arm/common/uengine.c6
-rw-r--r--arch/arm/kernel/entry-armv.S96
-rw-r--r--arch/arm/kernel/traps.c5
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c41
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c42
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c43
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c11
-rw-r--r--arch/arm/mach-at91/board-csb637.c2
-rw-r--r--arch/arm/mach-at91/board-dk.c15
-rw-r--r--arch/arm/mach-at91/board-eb9200.c10
-rw-r--r--arch/arm/mach-at91/board-ek.c2
-rw-r--r--arch/arm/mach-at91/board-kafa.c2
-rw-r--r--arch/arm/mach-at91/board-kb9202.c2
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c18
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/clock.c9
-rw-r--r--arch/arm/mach-imx/irq.c51
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-pxa/pxa320.c7
-rw-r--r--arch/arm/mach-pxa/ssp.c1
-rw-r--r--arch/frv/kernel/break.S2
-rw-r--r--arch/frv/kernel/entry.S2
-rw-r--r--arch/frv/kernel/vmlinux.lds.S27
-rw-r--r--arch/frv/mm/tlb-miss.S2
-rw-r--r--arch/m32r/kernel/signal.c17
-rw-r--r--arch/m32r/kernel/syscall_table.S40
-rw-r--r--arch/mips/kernel/csrc-r4k.c6
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c19
-rw-r--r--arch/powerpc/Kconfig5
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/drivers/ubd_kern.c1
-rw-r--r--arch/um/os-Linux/time.c54
-rw-r--r--arch/x86/boot/header.S41
-rw-r--r--arch/x86/kernel/paravirt_32.c4
-rw-r--r--arch/x86/lguest/Kconfig1
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/xen/mmu.c4
-rw-r--r--drivers/acpi/processor_core.c14
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/base/power/Makefile3
-rw-r--r--drivers/base/power/main.c8
-rw-r--r--drivers/base/power/power.h28
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/tpm/tpm_tis.c10
-rw-r--r--drivers/dma/Kconfig8
-rw-r--r--drivers/isdn/hisax/hfcscard.c3
-rw-r--r--drivers/mfd/sm501.c2
-rw-r--r--drivers/mmc/card/sdio_uart.c2
-rw-r--r--drivers/pci/hotplug/acpiphp.h8
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c29
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c36
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c47
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c41
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c96
-rw-r--r--drivers/pci/hotplug/fakephp.c14
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c16
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c19
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c15
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c1
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c16
-rw-r--r--drivers/pci/pci-sysfs.c4
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c29
-rw-r--r--drivers/pci/pcie/portdrv_pci.c2
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c15
-rw-r--r--drivers/pnp/resource.c4
-rw-r--r--drivers/ps3/Makefile4
-rw-r--r--drivers/ps3/ps3-sys-manager.c (renamed from drivers/ps3/sys-manager.c)0
-rw-r--r--drivers/ps3/ps3-vuart.c (renamed from drivers/ps3/vuart.c)0
-rw-r--r--drivers/rtc/interface.c4
-rw-r--r--drivers/rtc/rtc-dev.c12
-rw-r--r--drivers/scsi/zorro7xx.c3
-rw-r--r--drivers/serial/ip22zilog.c247
-rw-r--r--drivers/serial/pxa.c4
-rw-r--r--drivers/spi/atmel_spi.c2
-rw-r--r--drivers/spi/spi_s3c24xx_gpio.c21
-rw-r--r--drivers/usb/README6
-rw-r--r--drivers/usb/core/driver.c11
-rw-r--r--drivers/usb/core/hcd.c3
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/core/message.c36
-rw-r--r--drivers/usb/core/sysfs.c6
-rw-r--r--drivers/usb/core/usb.c25
-rw-r--r--drivers/usb/gadget/omap_udc.c6
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c16
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/ehci-hcd.c5
-rw-r--r--drivers/usb/image/microtek.c2
-rw-r--r--drivers/usb/misc/adutux.c262
-rw-r--r--drivers/usb/misc/usbled.c4
-rw-r--r--drivers/usb/serial/generic.c5
-rw-r--r--drivers/usb/serial/keyspan.c32
-rw-r--r--drivers/usb/serial/mos7840.c2
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/pl2303.h3
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--drivers/usb/storage/unusual_devs.h17
-rw-r--r--drivers/video/Kconfig11
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/atmel_lcdfb.c4
-rw-r--r--drivers/video/efifb.c232
-rw-r--r--drivers/video/fb_ddc.c8
-rw-r--r--drivers/video/imacfb.c4
-rw-r--r--drivers/video/ps3fb.c11
-rw-r--r--fs/Kconfig9
-rw-r--r--fs/compat_ioctl.c6
-rw-r--r--fs/exec.c6
-rw-r--r--fs/ext2/ext2.h7
-rw-r--r--fs/fuse/dir.c81
-rw-r--r--fs/fuse/file.c47
-rw-r--r--fs/fuse/fuse_i.h5
-rw-r--r--fs/fuse/inode.c4
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/ocfs2/cluster/masklog.h2
-rw-r--r--fs/ocfs2/dcache.c20
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c4
-rw-r--r--fs/ocfs2/file.c19
-rw-r--r--fs/ocfs2/inode.c6
-rw-r--r--fs/ocfs2/localalloc.c5
-rw-r--r--fs/ocfs2/super.c6
-rw-r--r--fs/proc/base.c51
-rw-r--r--fs/proc/generic.c37
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/root.c2
-rw-r--r--fs/sysfs/file.c6
-rw-r--r--include/asm-arm/arch-at91/board.h3
-rw-r--r--include/asm-arm/arch-ixp23xx/irqs.h2
-rw-r--r--include/asm-arm/arch-omap/board-innovator.h2
-rw-r--r--include/asm-arm/arch-pxa/irqs.h20
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa300.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp-pxa320.h2
-rw-r--r--include/asm-arm/arch-pxa/mfp.h18
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h5
-rw-r--r--include/asm-arm/arch-s3c2410/spi-gpio.h2
-rw-r--r--include/asm-m32r/thread_info.h11
-rw-r--r--include/asm-m32r/unistd.h66
-rw-r--r--include/asm-mips/cpu-features.h6
-rw-r--r--include/asm-mips/system.h2
-rw-r--r--include/linux/ext2_fs.h7
-rw-r--r--include/linux/fuse.h5
-rw-r--r--include/linux/kd.h2
-rw-r--r--include/linux/pnp.h4
-rw-r--r--include/linux/rtc.h5
-rw-r--r--include/linux/sched.h4
-rw-r--r--include/linux/screen_info.h2
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/usbdevice_fs.h3
-rw-r--r--ipc/mqueue.c6
-rw-r--r--kernel/exit.c11
-rw-r--r--kernel/kallsyms.c7
-rw-r--r--kernel/sched.c5
-rw-r--r--kernel/sched_debug.c8
-rw-r--r--kernel/sched_stats.h3
-rw-r--r--kernel/time/tick-sched.c2
-rw-r--r--kernel/utsname_sysctl.c4
-rw-r--r--lib/hexdump.c3
-rw-r--r--lib/kobject.c4
-rw-r--r--mm/page_alloc.c24
-rw-r--r--mm/shmem.c5
-rw-r--r--mm/slab.c4
-rw-r--r--mm/sparse-vmemmap.c12
-rwxr-xr-xscripts/checkpatch.pl395
-rw-r--r--security/commoncap.c9
178 files changed, 2281 insertions, 1197 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 299615d821ac..c3014df066c4 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -262,6 +262,8 @@ mtrr.txt
262 - how to use PPro Memory Type Range Registers to increase performance. 262 - how to use PPro Memory Type Range Registers to increase performance.
263mutex-design.txt 263mutex-design.txt
264 - info on the generic mutex subsystem. 264 - info on the generic mutex subsystem.
265namespaces/
266 - directory with various information about namespaces
265nbd.txt 267nbd.txt
266 - info on a TCP implementation of a network block device. 268 - info on a TCP implementation of a network block device.
267netlabel/ 269netlabel/
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 054a7ecf64c6..4953bc258729 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -11,7 +11,7 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
11 procfs-guide.xml writing_usb_driver.xml \ 11 procfs-guide.xml writing_usb_driver.xml \
12 kernel-api.xml filesystems.xml lsm.xml usb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml usb.xml \
13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ 13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
14 genericirq.xml s390-drivers.xml 14 genericirq.xml s390-drivers.xml uio-howto.xml
15 15
16### 16###
17# The build process is as follows (targets): 17# The build process is as follows (targets):
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl
index c119484258b8..fdd7f4f887b7 100644
--- a/Documentation/DocBook/uio-howto.tmpl
+++ b/Documentation/DocBook/uio-howto.tmpl
@@ -30,6 +30,12 @@
30 30
31<revhistory> 31<revhistory>
32 <revision> 32 <revision>
33 <revnumber>0.4</revnumber>
34 <date>2007-11-26</date>
35 <authorinitials>hjk</authorinitials>
36 <revremark>Removed section about uio_dummy.</revremark>
37 </revision>
38 <revision>
33 <revnumber>0.3</revnumber> 39 <revnumber>0.3</revnumber>
34 <date>2007-04-29</date> 40 <date>2007-04-29</date>
35 <authorinitials>hjk</authorinitials> 41 <authorinitials>hjk</authorinitials>
@@ -94,6 +100,26 @@ interested in translating it, please email me
94 user space. This simplifies development and reduces the risk of 100 user space. This simplifies development and reduces the risk of
95 serious bugs within a kernel module. 101 serious bugs within a kernel module.
96 </para> 102 </para>
103 <para>
104 Please note that UIO is not an universal driver interface. Devices
105 that are already handled well by other kernel subsystems (like
106 networking or serial or USB) are no candidates for an UIO driver.
107 Hardware that is ideally suited for an UIO driver fulfills all of
108 the following:
109 </para>
110<itemizedlist>
111<listitem>
112 <para>The device has memory that can be mapped. The device can be
113 controlled completely by writing to this memory.</para>
114</listitem>
115<listitem>
116 <para>The device usually generates interrupts.</para>
117</listitem>
118<listitem>
119 <para>The device does not fit into one of the standard kernel
120 subsystems.</para>
121</listitem>
122</itemizedlist>
97</sect1> 123</sect1>
98 124
99<sect1 id="thanks"> 125<sect1 id="thanks">
@@ -174,8 +200,9 @@ interested in translating it, please email me
174 For cards that don't generate interrupts but need to be 200 For cards that don't generate interrupts but need to be
175 polled, there is the possibility to set up a timer that 201 polled, there is the possibility to set up a timer that
176 triggers the interrupt handler at configurable time intervals. 202 triggers the interrupt handler at configurable time intervals.
177 See <filename>drivers/uio/uio_dummy.c</filename> for an 203 This interrupt simulation is done by calling
178 example of this technique. 204 <function>uio_event_notify()</function>
205 from the timer's event handler.
179 </para> 206 </para>
180 207
181 <para> 208 <para>
@@ -263,63 +290,11 @@ offset = N * getpagesize();
263</sect1> 290</sect1>
264</chapter> 291</chapter>
265 292
266<chapter id="using-uio_dummy" xreflabel="Using uio_dummy">
267<?dbhtml filename="using-uio_dummy.html"?>
268<title>Using uio_dummy</title>
269 <para>
270 Well, there is no real use for uio_dummy. Its only purpose is
271 to test most parts of the UIO system (everything except
272 hardware interrupts), and to serve as an example for the
273 kernel module that you will have to write yourself.
274 </para>
275
276<sect1 id="what_uio_dummy_does">
277<title>What uio_dummy does</title>
278 <para>
279 The kernel module <filename>uio_dummy.ko</filename> creates a
280 device that uses a timer to generate periodic interrupts. The
281 interrupt handler does nothing but increment a counter. The
282 driver adds two custom attributes, <varname>count</varname>
283 and <varname>freq</varname>, that appear under
284 <filename>/sys/devices/platform/uio_dummy/</filename>.
285 </para>
286
287 <para>
288 The attribute <varname>count</varname> can be read and
289 written. The associated file
290 <filename>/sys/devices/platform/uio_dummy/count</filename>
291 appears as a normal text file and contains the total number of
292 timer interrupts. If you look at it (e.g. using
293 <function>cat</function>), you'll notice it is slowly counting
294 up.
295 </para>
296
297 <para>
298 The attribute <varname>freq</varname> can be read and written.
299 The content of
300 <filename>/sys/devices/platform/uio_dummy/freq</filename>
301 represents the number of system timer ticks between two timer
302 interrupts. The default value of <varname>freq</varname> is
303 the value of the kernel variable <varname>HZ</varname>, which
304 gives you an interval of one second. Lower values will
305 increase the frequency. Try the following:
306 </para>
307<programlisting format="linespecific">
308cd /sys/devices/platform/uio_dummy/
309echo 100 > freq
310</programlisting>
311 <para>
312 Use <function>cat count</function> to see how the interrupt
313 frequency changes.
314 </para>
315</sect1>
316</chapter>
317
318<chapter id="custom_kernel_module" xreflabel="Writing your own kernel module"> 293<chapter id="custom_kernel_module" xreflabel="Writing your own kernel module">
319<?dbhtml filename="custom_kernel_module.html"?> 294<?dbhtml filename="custom_kernel_module.html"?>
320<title>Writing your own kernel module</title> 295<title>Writing your own kernel module</title>
321 <para> 296 <para>
322 Please have a look at <filename>uio_dummy.c</filename> as an 297 Please have a look at <filename>uio_cif.c</filename> as an
323 example. The following paragraphs explain the different 298 example. The following paragraphs explain the different
324 sections of this file. 299 sections of this file.
325 </para> 300 </para>
@@ -354,9 +329,8 @@ See the description below for details.
354interrupt, it's your modules task to determine the irq number during 329interrupt, it's your modules task to determine the irq number during
355initialization. If you don't have a hardware generated interrupt but 330initialization. If you don't have a hardware generated interrupt but
356want to trigger the interrupt handler in some other way, set 331want to trigger the interrupt handler in some other way, set
357<varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>. The 332<varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>.
358uio_dummy module does this as it triggers the event mechanism in a timer 333If you had no interrupt at all, you could set
359routine. If you had no interrupt at all, you could set
360<varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this 334<varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this
361rarely makes sense. 335rarely makes sense.
362</para></listitem> 336</para></listitem>
diff --git a/Documentation/namespaces/compatibility-list.txt b/Documentation/namespaces/compatibility-list.txt
new file mode 100644
index 000000000000..defc5589bfcd
--- /dev/null
+++ b/Documentation/namespaces/compatibility-list.txt
@@ -0,0 +1,39 @@
1 Namespaces compatibility list
2
3This document contains the information about the problems user
4may have when creating tasks living in different namespaces.
5
6Here's the summary. This matrix shows the known problems, that
7occur when tasks share some namespace (the columns) while living
8in different other namespaces (the rows):
9
10 UTS IPC VFS PID User Net
11UTS X
12IPC X 1
13VFS X
14PID 1 1 X
15User 2 2 X
16Net X
17
181. Both the IPC and the PID namespaces provide IDs to address
19 object inside the kernel. E.g. semaphore with IPCID or
20 process group with pid.
21
22 In both cases, tasks shouldn't try exposing this ID to some
23 other task living in a different namespace via a shared filesystem
24 or IPC shmem/message. The fact is that this ID is only valid
25 within the namespace it was obtained in and may refer to some
26 other object in another namespace.
27
282. Intentionally, two equal user IDs in different user namespaces
29 should not be equal from the VFS point of view. In other
30 words, user 10 in one user namespace shouldn't have the same
31 access permissions to files, belonging to user 10 in another
32 namespace.
33
34 The same is true for the IPC namespaces being shared - two users
35 from different user namespaces should not access the same IPC objects
36 even having equal UIDs.
37
38 But currently this is not so.
39
diff --git a/Documentation/tty.txt b/Documentation/tty.txt
index 048a8762cfb5..8e65c4498c52 100644
--- a/Documentation/tty.txt
+++ b/Documentation/tty.txt
@@ -132,6 +132,14 @@ set_termios() Notify the tty driver that the device's termios
132 tty->termios. Previous settings should be passed in 132 tty->termios. Previous settings should be passed in
133 the "old" argument. 133 the "old" argument.
134 134
135 The API is defined such that the driver should return
136 the actual modes selected. This means that the
137 driver function is responsible for modifying any
138 bits in the request it cannot fulfill to indicate
139 the actual modes being used. A device with no
140 hardware capability for change (eg a USB dongle or
141 virtual port) can provide NULL for this method.
142
135throttle() Notify the tty driver that input buffers for the 143throttle() Notify the tty driver that input buffers for the
136 line discipline are close to full, and it should 144 line discipline are close to full, and it should
137 somehow signal that no more characters should be 145 somehow signal that no more characters should be
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt
index 97842deec471..b2fc4d4a9917 100644
--- a/Documentation/usb/power-management.txt
+++ b/Documentation/usb/power-management.txt
@@ -278,6 +278,14 @@ optional. The methods' jobs are quite simple:
278 (although the interfaces will be in the same altsettings as 278 (although the interfaces will be in the same altsettings as
279 before the suspend). 279 before the suspend).
280 280
281If the device is disconnected or powered down while it is suspended,
282the disconnect method will be called instead of the resume or
283reset_resume method. This is also quite likely to happen when
284waking up from hibernation, as many systems do not maintain suspend
285current to the USB host controllers during hibernation. (It's
286possible to work around the hibernation-forces-disconnect problem by
287using the USB Persist facility.)
288
281The reset_resume method is used by the USB Persist facility (see 289The reset_resume method is used by the USB Persist facility (see
282Documentation/usb/persist.txt) and it can also be used under certain 290Documentation/usb/persist.txt) and it can also be used under certain
283circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a 291circumstances when CONFIG_USB_PERSIST is not enabled. Currently, if a
diff --git a/Documentation/x86_64/uefi.txt b/Documentation/x86_64/uefi.txt
new file mode 100644
index 000000000000..91a98edfb588
--- /dev/null
+++ b/Documentation/x86_64/uefi.txt
@@ -0,0 +1,29 @@
1General note on [U]EFI x86_64 support
2-------------------------------------
3
4The nomenclature EFI and UEFI are used interchangeably in this document.
5
6Although the tools below are _not_ needed for building the kernel,
7the needed bootloader support and associated tools for x86_64 platforms
8with EFI firmware and specifications are listed below.
9
101. UEFI specification: http://www.uefi.org
11
122. Booting Linux kernel on UEFI x86_64 platform requires bootloader
13 support. Elilo with x86_64 support can be used.
14
153. x86_64 platform with EFI/UEFI firmware.
16
17Mechanics:
18---------
19- Build the kernel with the following configuration.
20 CONFIG_FB_EFI=y
21 CONFIG_FRAMEBUFFER_CONSOLE=y
22- Create a VFAT partition on the disk
23- Copy the following to the VFAT partition:
24 elilo bootloader with x86_64 support, elilo configuration file,
25 kernel image built in first step and corresponding
26 initrd. Instructions on building elilo and its dependencies
27 can be found in the elilo sourceforge project.
28- Boot to EFI shell and invoke elilo choosing the kernel image built
29 in first step.
diff --git a/MAINTAINERS b/MAINTAINERS
index f5bd9bab7ed6..7c8392e1797d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -323,8 +323,7 @@ S: Maintained
323ALCATEL SPEEDTOUCH USB DRIVER 323ALCATEL SPEEDTOUCH USB DRIVER
324P: Duncan Sands 324P: Duncan Sands
325M: duncan.sands@free.fr 325M: duncan.sands@free.fr
326L: linux-usb-users@lists.sourceforge.net 326L: linux-usb@vger.kernel.org
327L: linux-usb-devel@lists.sourceforge.net
328W: http://www.linux-usb.org/SpeedTouch/ 327W: http://www.linux-usb.org/SpeedTouch/
329S: Maintained 328S: Maintained
330 329
@@ -440,7 +439,7 @@ S: Maintained
440 439
441ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 440ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
442P: Andrew Victor 441P: Andrew Victor
443M: andrew@sanpeople.com 442M: linux@maxim.org.za
444L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 443L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
445W: http://maxim.org.za/at91_26.html 444W: http://maxim.org.za/at91_26.html
446S: Maintained 445S: Maintained
@@ -1043,7 +1042,7 @@ S: Maintained
1043CIRRUS LOGIC EP93XX OHCI USB HOST DRIVER 1042CIRRUS LOGIC EP93XX OHCI USB HOST DRIVER
1044P: Lennert Buytenhek 1043P: Lennert Buytenhek
1045M: kernel@wantstofly.org 1044M: kernel@wantstofly.org
1046L: linux-usb-devel@lists.sourceforge.net 1045L: linux-usb@vger.kernel.org
1047S: Maintained 1046S: Maintained
1048 1047
1049CIRRUS LOGIC CS4280/CS461x SOUNDDRIVER 1048CIRRUS LOGIC CS4280/CS461x SOUNDDRIVER
@@ -1552,7 +1551,7 @@ S: Maintained
1552FREESCALE HIGHSPEED USB DEVICE DRIVER 1551FREESCALE HIGHSPEED USB DEVICE DRIVER
1553P: Li Yang 1552P: Li Yang
1554M: leoli@freescale.com 1553M: leoli@freescale.com
1555L: linux-usb-devel@lists.sourceforge.net 1554L: linux-usb@vger.kernel.org
1556L: linuxppc-dev@ozlabs.org 1555L: linuxppc-dev@ozlabs.org
1557S: Maintained 1556S: Maintained
1558 1557
@@ -2111,6 +2110,14 @@ L: irda-users@lists.sourceforge.net (subscribers-only)
2111W: http://irda.sourceforge.net/ 2110W: http://irda.sourceforge.net/
2112S: Maintained 2111S: Maintained
2113 2112
2113ISCSI
2114P: Mike Christie
2115M: michaelc@cs.wisc.edu
2116L: open-iscsi@googlegroups.com
2117W: www.open-iscsi.org
2118T: git kernel.org:/pub/scm/linux/kernel/mnc/linux-2.6-iscsi.git
2119S: Maintained
2120
2114ISAPNP 2121ISAPNP
2115P: Jaroslav Kysela 2122P: Jaroslav Kysela
2116M: perex@perex.cz 2123M: perex@perex.cz
@@ -3810,22 +3817,20 @@ S: Maintained
3810USB ACM DRIVER 3817USB ACM DRIVER
3811P: Oliver Neukum 3818P: Oliver Neukum
3812M: oliver@neukum.name 3819M: oliver@neukum.name
3813L: linux-usb-users@lists.sourceforge.net 3820L: linux-usb@vger.kernel.org
3814L: linux-usb-devel@lists.sourceforge.net
3815S: Maintained 3821S: Maintained
3816 3822
3817USB BLOCK DRIVER (UB ub) 3823USB BLOCK DRIVER (UB ub)
3818P: Pete Zaitcev 3824P: Pete Zaitcev
3819M: zaitcev@redhat.com 3825M: zaitcev@redhat.com
3820L: linux-kernel@vger.kernel.org 3826L: linux-kernel@vger.kernel.org
3821L: linux-usb-devel@lists.sourceforge.net 3827L: linux-usb@vger.kernel.org
3822S: Supported 3828S: Supported
3823 3829
3824USB CDC ETHERNET DRIVER 3830USB CDC ETHERNET DRIVER
3825P: Greg Kroah-Hartman 3831P: Greg Kroah-Hartman
3826M: greg@kroah.com 3832M: greg@kroah.com
3827L: linux-usb-users@lists.sourceforge.net 3833L: linux-usb@vger.kernel.org
3828L: linux-usb-devel@lists.sourceforge.net
3829S: Maintained 3834S: Maintained
3830W: http://www.kroah.com/linux-usb/ 3835W: http://www.kroah.com/linux-usb/
3831 3836
@@ -3839,13 +3844,13 @@ S: Maintained
3839USB EHCI DRIVER 3844USB EHCI DRIVER
3840P: David Brownell 3845P: David Brownell
3841M: dbrownell@users.sourceforge.net 3846M: dbrownell@users.sourceforge.net
3842L: linux-usb-devel@lists.sourceforge.net 3847L: linux-usb@vger.kernel.org
3843S: Odd Fixes 3848S: Odd Fixes
3844 3849
3845USB ET61X[12]51 DRIVER 3850USB ET61X[12]51 DRIVER
3846P: Luca Risolia 3851P: Luca Risolia
3847M: luca.risolia@studio.unibo.it 3852M: luca.risolia@studio.unibo.it
3848L: linux-usb-devel@lists.sourceforge.net 3853L: linux-usb@vger.kernel.org
3849L: video4linux-list@redhat.com 3854L: video4linux-list@redhat.com
3850W: http://www.linux-projects.org 3855W: http://www.linux-projects.org
3851S: Maintained 3856S: Maintained
@@ -3853,41 +3858,33 @@ S: Maintained
3853USB GADGET/PERIPHERAL SUBSYSTEM 3858USB GADGET/PERIPHERAL SUBSYSTEM
3854P: David Brownell 3859P: David Brownell
3855M: dbrownell@users.sourceforge.net 3860M: dbrownell@users.sourceforge.net
3856L: linux-usb-devel@lists.sourceforge.net 3861L: linux-usb@vger.kernel.org
3857W: http://www.linux-usb.org/gadget 3862W: http://www.linux-usb.org/gadget
3858S: Maintained 3863S: Maintained
3859 3864
3860USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) 3865USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
3861P: Jiri Kosina 3866P: Jiri Kosina
3862M: jkosina@suse.cz 3867M: jkosina@suse.cz
3863L: linux-usb-devel@lists.sourceforge.net 3868L: linux-usb@vger.kernel.org
3864T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git 3869T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git
3865S: Maintained 3870S: Maintained
3866 3871
3867USB HUB DRIVER
3868P: Johannes Erdfelt
3869M: johannes@erdfelt.com
3870L: linux-usb-users@lists.sourceforge.net
3871L: linux-usb-devel@lists.sourceforge.net
3872S: Maintained
3873
3874USB ISP116X DRIVER 3872USB ISP116X DRIVER
3875P: Olav Kongas 3873P: Olav Kongas
3876M: ok@artecdesign.ee 3874M: ok@artecdesign.ee
3877L: linux-usb-devel@lists.sourceforge.net 3875L: linux-usb@vger.kernel.org
3878S: Maintained 3876S: Maintained
3879 3877
3880USB KAWASAKI LSI DRIVER 3878USB KAWASAKI LSI DRIVER
3881P: Oliver Neukum 3879P: Oliver Neukum
3882M: oliver@neukum.name 3880M: oliver@neukum.name
3883L: linux-usb-users@lists.sourceforge.net 3881L: linux-usb@vger.kernel.org
3884L: linux-usb-devel@lists.sourceforge.net
3885S: Maintained 3882S: Maintained
3886 3883
3887USB MASS STORAGE DRIVER 3884USB MASS STORAGE DRIVER
3888P: Matthew Dharm 3885P: Matthew Dharm
3889M: mdharm-usb@one-eyed-alien.net 3886M: mdharm-usb@one-eyed-alien.net
3890L: linux-usb-users@lists.sourceforge.net 3887L: linux-usb@vger.kernel.org
3891L: usb-storage@lists.one-eyed-alien.net 3888L: usb-storage@lists.one-eyed-alien.net
3892S: Maintained 3889S: Maintained
3893W: http://www.one-eyed-alien.net/~mdharm/linux-usb/ 3890W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
@@ -3895,28 +3892,26 @@ W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
3895USB OHCI DRIVER 3892USB OHCI DRIVER
3896P: David Brownell 3893P: David Brownell
3897M: dbrownell@users.sourceforge.net 3894M: dbrownell@users.sourceforge.net
3898L: linux-usb-users@lists.sourceforge.net 3895L: linux-usb@vger.kernel.org
3899L: linux-usb-devel@lists.sourceforge.net
3900S: Odd Fixes 3896S: Odd Fixes
3901 3897
3902USB OPTION-CARD DRIVER 3898USB OPTION-CARD DRIVER
3903P: Matthias Urlichs 3899P: Matthias Urlichs
3904M: smurf@smurf.noris.de 3900M: smurf@smurf.noris.de
3905L: linux-usb-devel@lists.sourceforge.net 3901L: linux-usb@vger.kernel.org
3906S: Maintained 3902S: Maintained
3907 3903
3908USB OV511 DRIVER 3904USB OV511 DRIVER
3909P: Mark McClelland 3905P: Mark McClelland
3910M: mmcclell@bigfoot.com 3906M: mmcclell@bigfoot.com
3911L: linux-usb-users@lists.sourceforge.net 3907L: linux-usb@vger.kernel.org
3912L: linux-usb-devel@lists.sourceforge.net
3913W: http://alpha.dyndns.org/ov511/ 3908W: http://alpha.dyndns.org/ov511/
3914S: Maintained 3909S: Maintained
3915 3910
3916USB PEGASUS DRIVER 3911USB PEGASUS DRIVER
3917P: Petko Manolov 3912P: Petko Manolov
3918M: petkan@users.sourceforge.net 3913M: petkan@users.sourceforge.net
3919L: linux-usb-devel@lists.sourceforge.net 3914L: linux-usb@vger.kernel.org
3920L: netdev@vger.kernel.org 3915L: netdev@vger.kernel.org
3921W: http://pegasus2.sourceforge.net/ 3916W: http://pegasus2.sourceforge.net/
3922S: Maintained 3917S: Maintained
@@ -3924,14 +3919,13 @@ S: Maintained
3924USB PRINTER DRIVER (usblp) 3919USB PRINTER DRIVER (usblp)
3925P: Pete Zaitcev 3920P: Pete Zaitcev
3926M: zaitcev@redhat.com 3921M: zaitcev@redhat.com
3927L: linux-usb-users@lists.sourceforge.net 3922L: linux-usb@vger.kernel.org
3928L: linux-usb-devel@lists.sourceforge.net
3929S: Supported 3923S: Supported
3930 3924
3931USB RTL8150 DRIVER 3925USB RTL8150 DRIVER
3932P: Petko Manolov 3926P: Petko Manolov
3933M: petkan@users.sourceforge.net 3927M: petkan@users.sourceforge.net
3934L: linux-usb-devel@lists.sourceforge.net 3928L: linux-usb@vger.kernel.org
3935L: netdev@vger.kernel.org 3929L: netdev@vger.kernel.org
3936W: http://pegasus2.sourceforge.net/ 3930W: http://pegasus2.sourceforge.net/
3937S: Maintained 3931S: Maintained
@@ -3939,8 +3933,7 @@ S: Maintained
3939USB SE401 DRIVER 3933USB SE401 DRIVER
3940P: Jeroen Vreeken 3934P: Jeroen Vreeken
3941M: pe1rxq@amsat.org 3935M: pe1rxq@amsat.org
3942L: linux-usb-users@lists.sourceforge.net 3936L: linux-usb@vger.kernel.org
3943L: linux-usb-devel@lists.sourceforge.net
3944W: http://www.chello.nl/~j.vreeken/se401/ 3937W: http://www.chello.nl/~j.vreeken/se401/
3945S: Maintained 3938S: Maintained
3946 3939
@@ -3954,72 +3947,59 @@ USB SERIAL DIGI ACCELEPORT DRIVER
3954P: Peter Berger and Al Borchers 3947P: Peter Berger and Al Borchers
3955M: pberger@brimson.com 3948M: pberger@brimson.com
3956M: alborchers@steinerpoint.com 3949M: alborchers@steinerpoint.com
3957L: linux-usb-users@lists.sourceforge.net 3950L: linux-usb@vger.kernel.org
3958L: linux-usb-devel@lists.sourceforge.net
3959S: Maintained 3951S: Maintained
3960 3952
3961USB SERIAL DRIVER 3953USB SERIAL DRIVER
3962P: Greg Kroah-Hartman 3954P: Greg Kroah-Hartman
3963M: gregkh@suse.de 3955M: gregkh@suse.de
3964L: linux-usb-users@lists.sourceforge.net 3956L: linux-usb@vger.kernel.org
3965L: linux-usb-devel@lists.sourceforge.net
3966S: Supported 3957S: Supported
3967 3958
3968USB SERIAL BELKIN F5U103 DRIVER 3959USB SERIAL BELKIN F5U103 DRIVER
3969P: William Greathouse 3960P: William Greathouse
3970M: wgreathouse@smva.com 3961M: wgreathouse@smva.com
3971L: linux-usb-users@lists.sourceforge.net 3962L: linux-usb@vger.kernel.org
3972L: linux-usb-devel@lists.sourceforge.net
3973S: Maintained 3963S: Maintained
3974 3964
3975USB SERIAL CYPRESS M8 DRIVER 3965USB SERIAL CYPRESS M8 DRIVER
3976P: Lonnie Mendez 3966P: Lonnie Mendez
3977M: dignome@gmail.com 3967M: dignome@gmail.com
3978L: linux-usb-users@lists.sourceforge.net 3968L: linux-usb@vger.kernel.org
3979L: linux-usb-devel@lists.sourceforge.net
3980S: Maintained 3969S: Maintained
3981W: http://geocities.com/i0xox0i 3970W: http://geocities.com/i0xox0i
3982W: http://firstlight.net/cvs 3971W: http://firstlight.net/cvs
3983 3972
3984USB SERIAL CYBERJACK PINPAD/E-COM DRIVER
3985L: linux-usb-users@lists.sourceforge.net
3986L: linux-usb-devel@lists.sourceforge.net
3987S: Maintained
3988
3989USB AUERSWALD DRIVER 3973USB AUERSWALD DRIVER
3990P: Wolfgang Muees 3974P: Wolfgang Muees
3991M: wolfgang@iksw-muees.de 3975M: wolfgang@iksw-muees.de
3992L: linux-usb-users@lists.sourceforge.net 3976L: linux-usb@vger.kernel.org
3993L: linux-usb-devel@lists.sourceforge.net
3994S: Maintained 3977S: Maintained
3995 3978
3996USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER 3979USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER
3997P: Gary Brubaker 3980P: Gary Brubaker
3998M: xavyer@ix.netcom.com 3981M: xavyer@ix.netcom.com
3999L: linux-usb-users@lists.sourceforge.net 3982L: linux-usb@vger.kernel.org
4000L: linux-usb-devel@lists.sourceforge.net
4001S: Maintained 3983S: Maintained
4002 3984
4003USB SERIAL KEYSPAN DRIVER 3985USB SERIAL KEYSPAN DRIVER
4004P: Greg Kroah-Hartman 3986P: Greg Kroah-Hartman
4005M: greg@kroah.com 3987M: greg@kroah.com
4006L: linux-usb-users@lists.sourceforge.net 3988L: linux-usb@vger.kernel.org
4007L: linux-usb-devel@lists.sourceforge.net
4008W: http://www.kroah.com/linux/ 3989W: http://www.kroah.com/linux/
4009S: Maintained 3990S: Maintained
4010 3991
4011USB SERIAL WHITEHEAT DRIVER 3992USB SERIAL WHITEHEAT DRIVER
4012P: Support Department 3993P: Support Department
4013M: support@connecttech.com 3994M: support@connecttech.com
4014L: linux-usb-users@lists.sourceforge.net 3995L: linux-usb@vger.kernel.org
4015L: linux-usb-devel@lists.sourceforge.net
4016W: http://www.connecttech.com 3996W: http://www.connecttech.com
4017S: Supported 3997S: Supported
4018 3998
4019USB SN9C1xx DRIVER 3999USB SN9C1xx DRIVER
4020P: Luca Risolia 4000P: Luca Risolia
4021M: luca.risolia@studio.unibo.it 4001M: luca.risolia@studio.unibo.it
4022L: linux-usb-devel@lists.sourceforge.net 4002L: linux-usb@vger.kernel.org
4023L: video4linux-list@redhat.com 4003L: video4linux-list@redhat.com
4024W: http://www.linux-projects.org 4004W: http://www.linux-projects.org
4025S: Maintained 4005S: Maintained
@@ -4027,8 +4007,7 @@ S: Maintained
4027USB SUBSYSTEM 4007USB SUBSYSTEM
4028P: Greg Kroah-Hartman 4008P: Greg Kroah-Hartman
4029M: gregkh@suse.de 4009M: gregkh@suse.de
4030L: linux-usb-users@lists.sourceforge.net 4010L: linux-usb@vger.kernel.org
4031L: linux-usb-devel@lists.sourceforge.net
4032W: http://www.linux-usb.org 4011W: http://www.linux-usb.org
4033T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ 4012T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
4034S: Supported 4013S: Supported
@@ -4036,8 +4015,7 @@ S: Supported
4036USB UHCI DRIVER 4015USB UHCI DRIVER
4037P: Alan Stern 4016P: Alan Stern
4038M: stern@rowland.harvard.edu 4017M: stern@rowland.harvard.edu
4039L: linux-usb-users@lists.sourceforge.net 4018L: linux-usb@vger.kernel.org
4040L: linux-usb-devel@lists.sourceforge.net
4041S: Maintained 4019S: Maintained
4042 4020
4043USB "USBNET" DRIVER FRAMEWORK 4021USB "USBNET" DRIVER FRAMEWORK
@@ -4050,7 +4028,7 @@ S: Maintained
4050USB W996[87]CF DRIVER 4028USB W996[87]CF DRIVER
4051P: Luca Risolia 4029P: Luca Risolia
4052M: luca.risolia@studio.unibo.it 4030M: luca.risolia@studio.unibo.it
4053L: linux-usb-devel@lists.sourceforge.net 4031L: linux-usb@vger.kernel.org
4054L: video4linux-list@redhat.com 4032L: video4linux-list@redhat.com
4055W: http://www.linux-projects.org 4033W: http://www.linux-projects.org
4056S: Maintained 4034S: Maintained
@@ -4058,7 +4036,7 @@ S: Maintained
4058USB ZC0301 DRIVER 4036USB ZC0301 DRIVER
4059P: Luca Risolia 4037P: Luca Risolia
4060M: luca.risolia@studio.unibo.it 4038M: luca.risolia@studio.unibo.it
4061L: linux-usb-devel@lists.sourceforge.net 4039L: linux-usb@vger.kernel.org
4062L: video4linux-list@redhat.com 4040L: video4linux-list@redhat.com
4063W: http://www.linux-projects.org 4041W: http://www.linux-projects.org
4064S: Maintained 4042S: Maintained
@@ -4066,15 +4044,14 @@ S: Maintained
4066USB ZD1201 DRIVER 4044USB ZD1201 DRIVER
4067P: Jeroen Vreeken 4045P: Jeroen Vreeken
4068M: pe1rxq@amsat.org 4046M: pe1rxq@amsat.org
4069L: linux-usb-users@lists.sourceforge.net 4047L: linux-usb@vger.kernel.org
4070L: linux-usb-devel@lists.sourceforge.net
4071W: http://linux-lc100020.sourceforge.net 4048W: http://linux-lc100020.sourceforge.net
4072S: Maintained 4049S: Maintained
4073 4050
4074USB ZR364XX DRIVER 4051USB ZR364XX DRIVER
4075P: Antoine Jacquet 4052P: Antoine Jacquet
4076M: royale@zerezo.com 4053M: royale@zerezo.com
4077L: linux-usb-devel@lists.sourceforge.net 4054L: linux-usb@vger.kernel.org
4078L: video4linux-list@redhat.com 4055L: video4linux-list@redhat.com
4079W: http://royale.zerezo.com/zr364xx/ 4056W: http://royale.zerezo.com/zr364xx/
4080S: Maintained 4057S: Maintained
diff --git a/arch/arm/common/uengine.c b/arch/arm/common/uengine.c
index 95c8508c29b7..117cab30bd36 100644
--- a/arch/arm/common/uengine.c
+++ b/arch/arm/common/uengine.c
@@ -374,8 +374,8 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
374 u8 *ucode; 374 u8 *ucode;
375 int i; 375 int i;
376 376
377 gpr_a = kmalloc(128 * sizeof(u32), GFP_KERNEL); 377 gpr_a = kzalloc(128 * sizeof(u32), GFP_KERNEL);
378 gpr_b = kmalloc(128 * sizeof(u32), GFP_KERNEL); 378 gpr_b = kzalloc(128 * sizeof(u32), GFP_KERNEL);
379 ucode = kmalloc(513 * 5, GFP_KERNEL); 379 ucode = kmalloc(513 * 5, GFP_KERNEL);
380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) { 380 if (gpr_a == NULL || gpr_b == NULL || ucode == NULL) {
381 kfree(ucode); 381 kfree(ucode);
@@ -388,8 +388,6 @@ static int set_initial_registers(int uengine, struct ixp2000_uengine_code *c)
388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS) 388 if (c->uengine_parameters & IXP2000_UENGINE_4_CONTEXTS)
389 per_ctx_regs = 32; 389 per_ctx_regs = 32;
390 390
391 memset(gpr_a, 0, sizeof(gpr_a));
392 memset(gpr_b, 0, sizeof(gpr_b));
393 for (i = 0; i < 256; i++) { 391 for (i = 0; i < 256; i++) {
394 struct ixp2000_reg_value *r = c->initial_reg_values + i; 392 struct ixp2000_reg_value *r = c->initial_reg_values + i;
395 u32 *bank; 393 u32 *bank;
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d645897652c2..29dec080a604 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -339,16 +339,6 @@ __pabt_svc:
339 str r1, [sp] @ save the "real" r0 copied 339 str r1, [sp] @ save the "real" r0 copied
340 @ from the exception stack 340 @ from the exception stack
341 341
342#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
343#ifndef CONFIG_MMU
344#warning "NPTL on non MMU needs fixing"
345#else
346 @ make sure our user space atomic helper is aborted
347 cmp r2, #TASK_SIZE
348 bichs r3, r3, #PSR_Z_BIT
349#endif
350#endif
351
352 @ 342 @
353 @ We are now ready to fill in the remaining blanks on the stack: 343 @ We are now ready to fill in the remaining blanks on the stack:
354 @ 344 @
@@ -372,9 +362,25 @@ __pabt_svc:
372 zero_fp 362 zero_fp
373 .endm 363 .endm
374 364
365 .macro kuser_cmpxchg_check
366#if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
367#ifndef CONFIG_MMU
368#warning "NPTL on non MMU needs fixing"
369#else
370 @ Make sure our user space atomic helper is restarted
371 @ if it was interrupted in a critical region. Here we
372 @ perform a quick test inline since it should be false
373 @ 99.9999% of the time. The rest is done out of line.
374 cmp r2, #TASK_SIZE
375 blhs kuser_cmpxchg_fixup
376#endif
377#endif
378 .endm
379
375 .align 5 380 .align 5
376__dabt_usr: 381__dabt_usr:
377 usr_entry 382 usr_entry
383 kuser_cmpxchg_check
378 384
379 @ 385 @
380 @ Call the processor-specific abort handler: 386 @ Call the processor-specific abort handler:
@@ -404,6 +410,7 @@ __dabt_usr:
404 .align 5 410 .align 5
405__irq_usr: 411__irq_usr:
406 usr_entry 412 usr_entry
413 kuser_cmpxchg_check
407 414
408#ifdef CONFIG_TRACE_IRQFLAGS 415#ifdef CONFIG_TRACE_IRQFLAGS
409 bl trace_hardirqs_off 416 bl trace_hardirqs_off
@@ -446,9 +453,9 @@ __und_usr:
446 @ 453 @
447 @ r0 - instruction 454 @ r0 - instruction
448 @ 455 @
4491: ldrt r0, [r4]
450 adr r9, ret_from_exception 456 adr r9, ret_from_exception
451 adr lr, __und_usr_unknown 457 adr lr, __und_usr_unknown
4581: ldrt r0, [r4]
452 @ 459 @
453 @ fallthrough to call_fpe 460 @ fallthrough to call_fpe
454 @ 461 @
@@ -669,7 +676,7 @@ __kuser_helper_start:
669 * 676 *
670 * Clobbered: 677 * Clobbered:
671 * 678 *
672 * the Z flag might be lost 679 * none
673 * 680 *
674 * Definition and user space usage example: 681 * Definition and user space usage example:
675 * 682 *
@@ -730,9 +737,6 @@ __kuser_memory_barrier: @ 0xffff0fa0
730 * 737 *
731 * - This routine already includes memory barriers as needed. 738 * - This routine already includes memory barriers as needed.
732 * 739 *
733 * - A failure might be transient, i.e. it is possible, although unlikely,
734 * that "failure" be returned even if *ptr == oldval.
735 *
736 * For example, a user space atomic_add implementation could look like this: 740 * For example, a user space atomic_add implementation could look like this:
737 * 741 *
738 * #define atomic_add(ptr, val) \ 742 * #define atomic_add(ptr, val) \
@@ -769,46 +773,62 @@ __kuser_cmpxchg: @ 0xffff0fc0
769 773
770#elif __LINUX_ARM_ARCH__ < 6 774#elif __LINUX_ARM_ARCH__ < 6
771 775
776#ifdef CONFIG_MMU
777
772 /* 778 /*
773 * Theory of operation: 779 * The only thing that can break atomicity in this cmpxchg
774 * 780 * implementation is either an IRQ or a data abort exception
775 * We set the Z flag before loading oldval. If ever an exception 781 * causing another process/thread to be scheduled in the middle
776 * occurs we can not be sure the loaded value will still be the same 782 * of the critical sequence. To prevent this, code is added to
777 * when the exception returns, therefore the user exception handler 783 * the IRQ and data abort exception handlers to set the pc back
778 * will clear the Z flag whenever the interrupted user code was 784 * to the beginning of the critical section if it is found to be
779 * actually from the kernel address space (see the usr_entry macro). 785 * within that critical section (see kuser_cmpxchg_fixup).
780 *
781 * The post-increment on the str is used to prevent a race with an
782 * exception happening just after the str instruction which would
783 * clear the Z flag although the exchange was done.
784 */ 786 */
785#ifdef CONFIG_MMU 7871: ldr r3, [r2] @ load current val
786 teq ip, ip @ set Z flag 788 subs r3, r3, r0 @ compare with oldval
787 ldr ip, [r2] @ load current val 7892: streq r1, [r2] @ store newval if eq
788 add r3, r2, #1 @ prepare store ptr 790 rsbs r0, r3, #0 @ set return val and C flag
789 teqeq ip, r0 @ compare with oldval if still allowed 791 usr_ret lr
790 streq r1, [r3, #-1]! @ store newval if still allowed 792
791 subs r0, r2, r3 @ if r2 == r3 the str occured 793 .text
794kuser_cmpxchg_fixup:
795 @ Called from kuser_cmpxchg_check macro.
796 @ r2 = address of interrupted insn (must be preserved).
797 @ sp = saved regs. r7 and r8 are clobbered.
798 @ 1b = first critical insn, 2b = last critical insn.
799 @ If r2 >= 1b and r2 <= 2b then saved pc_usr is set to 1b.
800 mov r7, #0xffff0fff
801 sub r7, r7, #(0xffff0fff - (0xffff0fc0 + (1b - __kuser_cmpxchg)))
802 subs r8, r2, r7
803 rsbcss r8, r8, #(2b - 1b)
804 strcs r7, [sp, #S_PC]
805 mov pc, lr
806 .previous
807
792#else 808#else
793#warning "NPTL on non MMU needs fixing" 809#warning "NPTL on non MMU needs fixing"
794 mov r0, #-1 810 mov r0, #-1
795 adds r0, r0, #0 811 adds r0, r0, #0
796#endif
797 usr_ret lr 812 usr_ret lr
813#endif
798 814
799#else 815#else
800 816
801#ifdef CONFIG_SMP 817#ifdef CONFIG_SMP
802 mcr p15, 0, r0, c7, c10, 5 @ dmb 818 mcr p15, 0, r0, c7, c10, 5 @ dmb
803#endif 819#endif
804 ldrex r3, [r2] 8201: ldrex r3, [r2]
805 subs r3, r3, r0 821 subs r3, r3, r0
806 strexeq r3, r1, [r2] 822 strexeq r3, r1, [r2]
823 teqeq r3, #1
824 beq 1b
807 rsbs r0, r3, #0 825 rsbs r0, r3, #0
826 /* beware -- each __kuser slot must be 8 instructions max */
808#ifdef CONFIG_SMP 827#ifdef CONFIG_SMP
809 mcr p15, 0, r0, c7, c10, 5 @ dmb 828 b __kuser_memory_barrier
810#endif 829#else
811 usr_ret lr 830 usr_ret lr
831#endif
812 832
813#endif 833#endif
814 834
@@ -829,7 +849,7 @@ __kuser_cmpxchg: @ 0xffff0fc0
829 * 849 *
830 * Clobbered: 850 * Clobbered:
831 * 851 *
832 * the Z flag might be lost 852 * none
833 * 853 *
834 * Definition and user space usage example: 854 * Definition and user space usage example:
835 * 855 *
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 4764bd9ccee8..c34db4e868fa 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -327,7 +327,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
327 if ((instr & hook->instr_mask) == hook->instr_val && 327 if ((instr & hook->instr_mask) == hook->instr_val &&
328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) { 328 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) {
329 if (hook->fn(regs, instr) == 0) { 329 if (hook->fn(regs, instr) == 0) {
330 spin_unlock_irq(&undef_lock); 330 spin_unlock_irqrestore(&undef_lock, flags);
331 return; 331 return;
332 } 332 }
333 } 333 }
@@ -509,7 +509,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
509 * existence. Don't ever use this from user code. 509 * existence. Don't ever use this from user code.
510 */ 510 */
511 case 0xfff0: 511 case 0xfff0:
512 { 512 for (;;) {
513 extern void do_DataAbort(unsigned long addr, unsigned int fsr, 513 extern void do_DataAbort(unsigned long addr, unsigned int fsr,
514 struct pt_regs *regs); 514 struct pt_regs *regs);
515 unsigned long val; 515 unsigned long val;
@@ -545,7 +545,6 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
545 up_read(&mm->mmap_sem); 545 up_read(&mm->mmap_sem);
546 /* simulate a write access fault */ 546 /* simulate a write access fault */
547 do_DataAbort(addr, 15 + (1 << 11), regs); 547 do_DataAbort(addr, 15 + (1 << 11), regs);
548 return -1;
549 } 548 }
550#endif 549#endif
551 550
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 0417c165d50d..9296833f91cc 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -14,6 +14,7 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
18#include <asm/arch/board.h> 19#include <asm/arch/board.h>
19#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
@@ -435,7 +436,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
435 * TWI (i2c) 436 * TWI (i2c)
436 * -------------------------------------------------------------------- */ 437 * -------------------------------------------------------------------- */
437 438
438#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 439/*
440 * Prefer the GPIO code since the TWI controller isn't robust
441 * (gets overruns and underruns under load) and can only issue
442 * repeated STARTs in one scenario (the driver doesn't yet handle them).
443 */
444#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
445
446static struct i2c_gpio_platform_data pdata = {
447 .sda_pin = AT91_PIN_PA25,
448 .sda_is_open_drain = 1,
449 .scl_pin = AT91_PIN_PA26,
450 .scl_is_open_drain = 1,
451 .udelay = 2, /* ~100 kHz */
452};
453
454static struct platform_device at91rm9200_twi_device = {
455 .name = "i2c-gpio",
456 .id = -1,
457 .dev.platform_data = &pdata,
458};
459
460void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{
462 at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */
463 at91_set_multi_drive(AT91_PIN_PA25, 1);
464
465 at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */
466 at91_set_multi_drive(AT91_PIN_PA26, 1);
467
468 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device);
470}
471
472#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
439 473
440static struct resource twi_resources[] = { 474static struct resource twi_resources[] = {
441 [0] = { 475 [0] = {
@@ -457,7 +491,7 @@ static struct platform_device at91rm9200_twi_device = {
457 .num_resources = ARRAY_SIZE(twi_resources), 491 .num_resources = ARRAY_SIZE(twi_resources),
458}; 492};
459 493
460void __init at91_add_device_i2c(void) 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
461{ 495{
462 /* pins used for TWI interface */ 496 /* pins used for TWI interface */
463 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */ 497 at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
@@ -466,10 +500,11 @@ void __init at91_add_device_i2c(void)
466 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */ 500 at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
467 at91_set_multi_drive(AT91_PIN_PA26, 1); 501 at91_set_multi_drive(AT91_PIN_PA26, 1);
468 502
503 i2c_register_board_info(0, devices, nr_devices);
469 platform_device_register(&at91rm9200_twi_device); 504 platform_device_register(&at91rm9200_twi_device);
470} 505}
471#else 506#else
472void __init at91_add_device_i2c(void) {} 507void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
473#endif 508#endif
474 509
475 510
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index ffd3154c1e54..3091bf47d8c9 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
18#include <asm/arch/gpio.h> 19#include <asm/arch/gpio.h>
@@ -352,7 +353,41 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
352 * TWI (i2c) 353 * TWI (i2c)
353 * -------------------------------------------------------------------- */ 354 * -------------------------------------------------------------------- */
354 355
355#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 356/*
357 * Prefer the GPIO code since the TWI controller isn't robust
358 * (gets overruns and underruns under load) and can only issue
359 * repeated STARTs in one scenario (the driver doesn't yet handle them).
360 */
361
362#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
363
364static struct i2c_gpio_platform_data pdata = {
365 .sda_pin = AT91_PIN_PA23,
366 .sda_is_open_drain = 1,
367 .scl_pin = AT91_PIN_PA24,
368 .scl_is_open_drain = 1,
369 .udelay = 2, /* ~100 kHz */
370};
371
372static struct platform_device at91sam9260_twi_device = {
373 .name = "i2c-gpio",
374 .id = -1,
375 .dev.platform_data = &pdata,
376};
377
378void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
379{
380 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
381 at91_set_multi_drive(AT91_PIN_PA23, 1);
382
383 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
384 at91_set_multi_drive(AT91_PIN_PA24, 1);
385
386 i2c_register_board_info(0, devices, nr_devices);
387 platform_device_register(&at91sam9260_twi_device);
388}
389
390#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
356 391
357static struct resource twi_resources[] = { 392static struct resource twi_resources[] = {
358 [0] = { 393 [0] = {
@@ -374,7 +409,7 @@ static struct platform_device at91sam9260_twi_device = {
374 .num_resources = ARRAY_SIZE(twi_resources), 409 .num_resources = ARRAY_SIZE(twi_resources),
375}; 410};
376 411
377void __init at91_add_device_i2c(void) 412void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
378{ 413{
379 /* pins used for TWI interface */ 414 /* pins used for TWI interface */
380 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 415 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -383,10 +418,11 @@ void __init at91_add_device_i2c(void)
383 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 418 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
384 at91_set_multi_drive(AT91_PIN_PA24, 1); 419 at91_set_multi_drive(AT91_PIN_PA24, 1);
385 420
421 i2c_register_board_info(0, devices, nr_devices);
386 platform_device_register(&at91sam9260_twi_device); 422 platform_device_register(&at91sam9260_twi_device);
387} 423}
388#else 424#else
389void __init at91_add_device_i2c(void) {} 425void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
390#endif 426#endif
391 427
392 428
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 3576595b4941..64979a9023c2 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -14,7 +14,9 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h>
17 18
19#include <linux/fb.h>
18#include <video/atmel_lcdc.h> 20#include <video/atmel_lcdc.h>
19 21
20#include <asm/arch/board.h> 22#include <asm/arch/board.h>
@@ -275,7 +277,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
275 * TWI (i2c) 277 * TWI (i2c)
276 * -------------------------------------------------------------------- */ 278 * -------------------------------------------------------------------- */
277 279
278#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 280/*
281 * Prefer the GPIO code since the TWI controller isn't robust
282 * (gets overruns and underruns under load) and can only issue
283 * repeated STARTs in one scenario (the driver doesn't yet handle them).
284 */
285#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
286
287static struct i2c_gpio_platform_data pdata = {
288 .sda_pin = AT91_PIN_PA7,
289 .sda_is_open_drain = 1,
290 .scl_pin = AT91_PIN_PA8,
291 .scl_is_open_drain = 1,
292 .udelay = 2, /* ~100 kHz */
293};
294
295static struct platform_device at91sam9261_twi_device = {
296 .name = "i2c-gpio",
297 .id = -1,
298 .dev.platform_data = &pdata,
299};
300
301void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
302{
303 at91_set_GPIO_periph(AT91_PIN_PA7, 1); /* TWD (SDA) */
304 at91_set_multi_drive(AT91_PIN_PA7, 1);
305
306 at91_set_GPIO_periph(AT91_PIN_PA8, 1); /* TWCK (SCL) */
307 at91_set_multi_drive(AT91_PIN_PA8, 1);
308
309 i2c_register_board_info(0, devices, nr_devices);
310 platform_device_register(&at91sam9261_twi_device);
311}
312
313#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
279 314
280static struct resource twi_resources[] = { 315static struct resource twi_resources[] = {
281 [0] = { 316 [0] = {
@@ -297,7 +332,7 @@ static struct platform_device at91sam9261_twi_device = {
297 .num_resources = ARRAY_SIZE(twi_resources), 332 .num_resources = ARRAY_SIZE(twi_resources),
298}; 333};
299 334
300void __init at91_add_device_i2c(void) 335void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
301{ 336{
302 /* pins used for TWI interface */ 337 /* pins used for TWI interface */
303 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */ 338 at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */
@@ -306,10 +341,11 @@ void __init at91_add_device_i2c(void)
306 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */ 341 at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */
307 at91_set_multi_drive(AT91_PIN_PA8, 1); 342 at91_set_multi_drive(AT91_PIN_PA8, 1);
308 343
344 i2c_register_board_info(0, devices, nr_devices);
309 platform_device_register(&at91sam9261_twi_device); 345 platform_device_register(&at91sam9261_twi_device);
310} 346}
311#else 347#else
312void __init at91_add_device_i2c(void) {} 348void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
313#endif 349#endif
314 350
315 351
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index f924bd5017de..ac329a98e959 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -13,7 +13,9 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h>
16 17
18#include <linux/fb.h>
17#include <video/atmel_lcdc.h> 19#include <video/atmel_lcdc.h>
18 20
19#include <asm/arch/board.h> 21#include <asm/arch/board.h>
@@ -421,7 +423,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
421 * TWI (i2c) 423 * TWI (i2c)
422 * -------------------------------------------------------------------- */ 424 * -------------------------------------------------------------------- */
423 425
424#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 426/*
427 * Prefer the GPIO code since the TWI controller isn't robust
428 * (gets overruns and underruns under load) and can only issue
429 * repeated STARTs in one scenario (the driver doesn't yet handle them).
430 */
431#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
432
433static struct i2c_gpio_platform_data pdata = {
434 .sda_pin = AT91_PIN_PB4,
435 .sda_is_open_drain = 1,
436 .scl_pin = AT91_PIN_PB5,
437 .scl_is_open_drain = 1,
438 .udelay = 2, /* ~100 kHz */
439};
440
441static struct platform_device at91sam9263_twi_device = {
442 .name = "i2c-gpio",
443 .id = -1,
444 .dev.platform_data = &pdata,
445};
446
447void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
448{
449 at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */
450 at91_set_multi_drive(AT91_PIN_PB4, 1);
451
452 at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */
453 at91_set_multi_drive(AT91_PIN_PB5, 1);
454
455 i2c_register_board_info(0, devices, nr_devices);
456 platform_device_register(&at91sam9263_twi_device);
457}
458
459#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
425 460
426static struct resource twi_resources[] = { 461static struct resource twi_resources[] = {
427 [0] = { 462 [0] = {
@@ -443,7 +478,7 @@ static struct platform_device at91sam9263_twi_device = {
443 .num_resources = ARRAY_SIZE(twi_resources), 478 .num_resources = ARRAY_SIZE(twi_resources),
444}; 479};
445 480
446void __init at91_add_device_i2c(void) 481void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
447{ 482{
448 /* pins used for TWI interface */ 483 /* pins used for TWI interface */
449 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */ 484 at91_set_A_periph(AT91_PIN_PB4, 0); /* TWD */
@@ -452,10 +487,11 @@ void __init at91_add_device_i2c(void)
452 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */ 487 at91_set_A_periph(AT91_PIN_PB5, 0); /* TWCK */
453 at91_set_multi_drive(AT91_PIN_PB5, 1); 488 at91_set_multi_drive(AT91_PIN_PB5, 1);
454 489
490 i2c_register_board_info(0, devices, nr_devices);
455 platform_device_register(&at91sam9263_twi_device); 491 platform_device_register(&at91sam9263_twi_device);
456} 492}
457#else 493#else
458void __init at91_add_device_i2c(void) {} 494void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
459#endif 495#endif
460 496
461 497
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index cd7532bcd4e5..2bd60a3dc623 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -10,8 +10,9 @@
10#include <asm/mach/map.h> 10#include <asm/mach/map.h>
11 11
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/fb.h> 13#include <linux/i2c-gpio.h>
14 14
15#include <linux/fb.h>
15#include <video/atmel_lcdc.h> 16#include <video/atmel_lcdc.h>
16 17
17#include <asm/arch/board.h> 18#include <asm/arch/board.h>
@@ -169,7 +170,40 @@ void __init at91_add_device_nand(struct at91_nand_data *data) {}
169 * TWI (i2c) 170 * TWI (i2c)
170 * -------------------------------------------------------------------- */ 171 * -------------------------------------------------------------------- */
171 172
172#if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE) 173/*
174 * Prefer the GPIO code since the TWI controller isn't robust
175 * (gets overruns and underruns under load) and can only issue
176 * repeated STARTs in one scenario (the driver doesn't yet handle them).
177 */
178#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
179
180static struct i2c_gpio_platform_data pdata = {
181 .sda_pin = AT91_PIN_PA23,
182 .sda_is_open_drain = 1,
183 .scl_pin = AT91_PIN_PA24,
184 .scl_is_open_drain = 1,
185 .udelay = 2, /* ~100 kHz */
186};
187
188static struct platform_device at91sam9rl_twi_device = {
189 .name = "i2c-gpio",
190 .id = -1,
191 .dev.platform_data = &pdata,
192};
193
194void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{
196 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
197 at91_set_multi_drive(AT91_PIN_PA23, 1);
198
199 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
200 at91_set_multi_drive(AT91_PIN_PA24, 1);
201
202 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device);
204}
205
206#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
173 207
174static struct resource twi_resources[] = { 208static struct resource twi_resources[] = {
175 [0] = { 209 [0] = {
@@ -191,7 +225,7 @@ static struct platform_device at91sam9rl_twi_device = {
191 .num_resources = ARRAY_SIZE(twi_resources), 225 .num_resources = ARRAY_SIZE(twi_resources),
192}; 226};
193 227
194void __init at91_add_device_i2c(void) 228void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
195{ 229{
196 /* pins used for TWI interface */ 230 /* pins used for TWI interface */
197 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */ 231 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
@@ -200,10 +234,11 @@ void __init at91_add_device_i2c(void)
200 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */ 234 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
201 at91_set_multi_drive(AT91_PIN_PA24, 1); 235 at91_set_multi_drive(AT91_PIN_PA24, 1);
202 236
237 i2c_register_board_info(0, devices, nr_devices);
203 platform_device_register(&at91sam9rl_twi_device); 238 platform_device_register(&at91sam9rl_twi_device);
204} 239}
205#else 240#else
206void __init at91_add_device_i2c(void) {} 241void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
207#endif 242#endif
208 243
209 244
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 76ec856cd4f9..0f0878294a67 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -128,7 +128,7 @@ static void __init carmeva_board_init(void)
128 /* USB Device */ 128 /* USB Device */
129 at91_add_device_udc(&carmeva_udc_data); 129 at91_add_device_udc(&carmeva_udc_data);
130 /* I2C */ 130 /* I2C */
131 at91_add_device_i2c(); 131 at91_add_device_i2c(NULL, 0);
132 /* SPI */ 132 /* SPI */
133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices)); 133 at91_add_device_spi(carmeva_spi_devices, ARRAY_SIZE(carmeva_spi_devices));
134 /* Compact Flash */ 134 /* Compact Flash */
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index dde089922e3b..d0aa20c9383e 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -23,7 +23,6 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/i2c.h>
27#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
28#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
29 28
@@ -85,12 +84,12 @@ static struct at91_udc_data __initdata csb337_udc_data = {
85}; 84};
86 85
87static struct i2c_board_info __initdata csb337_i2c_devices[] = { 86static struct i2c_board_info __initdata csb337_i2c_devices[] = {
88 { I2C_BOARD_INFO("rtc-ds1307", 0x68), 87 {
89 .type = "ds1307", 88 I2C_BOARD_INFO("rtc-ds1307", 0x68),
89 .type = "ds1307",
90 }, 90 },
91}; 91};
92 92
93
94static struct at91_cf_data __initdata csb337_cf_data = { 93static struct at91_cf_data __initdata csb337_cf_data = {
95 /* 94 /*
96 * connector P4 on the CSB 337 mates to 95 * connector P4 on the CSB 337 mates to
@@ -168,9 +167,7 @@ static void __init csb337_board_init(void)
168 /* USB Device */ 167 /* USB Device */
169 at91_add_device_udc(&csb337_udc_data); 168 at91_add_device_udc(&csb337_udc_data);
170 /* I2C */ 169 /* I2C */
171 at91_add_device_i2c(); 170 at91_add_device_i2c(csb337_i2c_devices, ARRAY_SIZE(csb337_i2c_devices));
172 i2c_register_board_info(0, csb337_i2c_devices,
173 ARRAY_SIZE(csb337_i2c_devices));
174 /* Compact Flash */ 171 /* Compact Flash */
175 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */ 172 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
176 at91_add_device_cf(&csb337_cf_data); 173 at91_add_device_cf(&csb337_cf_data);
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 77f04b935b3a..c5c721d27f42 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -129,7 +129,7 @@ static void __init csb637_board_init(void)
129 /* USB Device */ 129 /* USB Device */
130 at91_add_device_udc(&csb637_udc_data); 130 at91_add_device_udc(&csb637_udc_data);
131 /* I2C */ 131 /* I2C */
132 at91_add_device_i2c(); 132 at91_add_device_i2c(NULL, 0);
133 /* SPI */ 133 /* SPI */
134 at91_add_device_spi(NULL, 0); 134 at91_add_device_spi(NULL, 0);
135 /* NOR flash */ 135 /* NOR flash */
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index af497896a96c..40c9e4331706 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -124,6 +124,19 @@ static struct spi_board_info dk_spi_devices[] = {
124#endif 124#endif
125}; 125};
126 126
127static struct i2c_board_info __initdata dk_i2c_devices[] = {
128 {
129 I2C_BOARD_INFO("ics1523", 0x26),
130 },
131 {
132 I2C_BOARD_INFO("x9429", 0x28),
133 },
134 {
135 I2C_BOARD_INFO("at24c", 0x50),
136 .type = "24c1024",
137 }
138};
139
127static struct mtd_partition __initdata dk_nand_partition[] = { 140static struct mtd_partition __initdata dk_nand_partition[] = {
128 { 141 {
129 .name = "NAND Partition 1", 142 .name = "NAND Partition 1",
@@ -185,7 +198,7 @@ static void __init dk_board_init(void)
185 /* Compact Flash */ 198 /* Compact Flash */
186 at91_add_device_cf(&dk_cf_data); 199 at91_add_device_cf(&dk_cf_data);
187 /* I2C */ 200 /* I2C */
188 at91_add_device_i2c(); 201 at91_add_device_i2c(dk_i2c_devices, ARRAY_SIZE(dk_i2c_devices));
189 /* SPI */ 202 /* SPI */
190 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices)); 203 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices));
191#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 204#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 20458b5548f0..b7b79bb9d6c4 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -91,6 +91,14 @@ static struct at91_mmc_data __initdata eb9200_mmc_data = {
91 .wire4 = 1, 91 .wire4 = 1,
92}; 92};
93 93
94static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
95 {
96 I2C_BOARD_INFO("at24c", 0x50),
97 .type = "24c512",
98 },
99};
100
101
94static void __init eb9200_board_init(void) 102static void __init eb9200_board_init(void)
95{ 103{
96 /* Serial */ 104 /* Serial */
@@ -102,7 +110,7 @@ static void __init eb9200_board_init(void)
102 /* USB Device */ 110 /* USB Device */
103 at91_add_device_udc(&eb9200_udc_data); 111 at91_add_device_udc(&eb9200_udc_data);
104 /* I2C */ 112 /* I2C */
105 at91_add_device_i2c(); 113 at91_add_device_i2c(eb9200_i2c_devices, ARRAY_SIZE(eb9200_i2c_devices));
106 /* Compact Flash */ 114 /* Compact Flash */
107 at91_add_device_cf(&eb9200_cf_data); 115 at91_add_device_cf(&eb9200_cf_data);
108 /* SPI */ 116 /* SPI */
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 322fdd75a1e4..d05b1b2be9fb 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -145,7 +145,7 @@ static void __init ek_board_init(void)
145 at91_add_device_udc(&ek_udc_data); 145 at91_add_device_udc(&ek_udc_data);
146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 146 at91_set_multi_drive(ek_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
147 /* I2C */ 147 /* I2C */
148 at91_add_device_i2c(); 148 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
149 /* SPI */ 149 /* SPI */
150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 150 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 151#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index c77d84ce9cae..cf1b7b2f76fb 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -92,7 +92,7 @@ static void __init kafa_board_init(void)
92 /* USB Device */ 92 /* USB Device */
93 at91_add_device_udc(&kafa_udc_data); 93 at91_add_device_udc(&kafa_udc_data);
94 /* I2C */ 94 /* I2C */
95 at91_add_device_i2c(); 95 at91_add_device_i2c(NULL, 0);
96 /* SPI */ 96 /* SPI */
97 at91_add_device_spi(NULL, 0); 97 at91_add_device_spi(NULL, 0);
98} 98}
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 7d9b1a278fd6..4b39b9cda75b 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -124,7 +124,7 @@ static void __init kb9202_board_init(void)
124 /* MMC */ 124 /* MMC */
125 at91_add_device_mmc(0, &kb9202_mmc_data); 125 at91_add_device_mmc(0, &kb9202_mmc_data);
126 /* I2C */ 126 /* I2C */
127 at91_add_device_i2c(); 127 at91_add_device_i2c(NULL, 0);
128 /* SPI */ 128 /* SPI */
129 at91_add_device_spi(NULL, 0); 129 at91_add_device_spi(NULL, 0);
130 /* NAND */ 130 /* NAND */
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index 49cfe7ab4a85..6acb55c09ae5 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -139,7 +139,7 @@ static void __init picotux200_board_init(void)
139 // at91_add_device_udc(&picotux200_udc_data); 139 // at91_add_device_udc(&picotux200_udc_data);
140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */ 140 // at91_set_multi_drive(picotux200_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
141 /* I2C */ 141 /* I2C */
142 at91_add_device_i2c(); 142 at91_add_device_i2c(NULL, 0);
143 /* SPI */ 143 /* SPI */
144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices)); 144 // at91_add_device_spi(picotux200_spi_devices, ARRAY_SIZE(picotux200_spi_devices));
145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD 145#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 65fa532bb4ac..b343a6c28120 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -189,7 +189,7 @@ static void __init ek_board_init(void)
189 /* MMC */ 189 /* MMC */
190 at91_add_device_mmc(0, &ek_mmc_data); 190 at91_add_device_mmc(0, &ek_mmc_data);
191 /* I2C */ 191 /* I2C */
192 at91_add_device_i2c(); 192 at91_add_device_i2c(NULL, 0);
193} 193}
194 194
195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK") 195MACHINE_START(AT91SAM9260EK, "Atmel AT91SAM9260-EK")
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 42e172cb0f49..550ae59a3aca 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -382,14 +382,14 @@ static struct platform_device ek_button_device = {
382 382
383static void __init ek_add_device_buttons(void) 383static void __init ek_add_device_buttons(void)
384{ 384{
385 at91_set_gpio_input(AT91_PIN_PB27, 0); /* btn0 */ 385 at91_set_gpio_input(AT91_PIN_PA27, 0); /* btn0 */
386 at91_set_deglitch(AT91_PIN_PB27, 1); 386 at91_set_deglitch(AT91_PIN_PA27, 1);
387 at91_set_gpio_input(AT91_PIN_PB26, 0); /* btn1 */ 387 at91_set_gpio_input(AT91_PIN_PA26, 0); /* btn1 */
388 at91_set_deglitch(AT91_PIN_PB26, 1); 388 at91_set_deglitch(AT91_PIN_PA26, 1);
389 at91_set_gpio_input(AT91_PIN_PB25, 0); /* btn2 */ 389 at91_set_gpio_input(AT91_PIN_PA25, 0); /* btn2 */
390 at91_set_deglitch(AT91_PIN_PB25, 1); 390 at91_set_deglitch(AT91_PIN_PA25, 1);
391 at91_set_gpio_input(AT91_PIN_PB24, 0); /* btn3 */ 391 at91_set_gpio_input(AT91_PIN_PA24, 0); /* btn3 */
392 at91_set_deglitch(AT91_PIN_PB24, 1); 392 at91_set_deglitch(AT91_PIN_PA24, 1);
393 393
394 platform_device_register(&ek_button_device); 394 platform_device_register(&ek_button_device);
395} 395}
@@ -406,7 +406,7 @@ static void __init ek_board_init(void)
406 /* USB Device */ 406 /* USB Device */
407 at91_add_device_udc(&ek_udc_data); 407 at91_add_device_udc(&ek_udc_data);
408 /* I2C */ 408 /* I2C */
409 at91_add_device_i2c(); 409 at91_add_device_i2c(NULL, 0);
410 /* NAND */ 410 /* NAND */
411 at91_add_device_nand(&ek_nand_data); 411 at91_add_device_nand(&ek_nand_data);
412 /* DM9000 ethernet */ 412 /* DM9000 ethernet */
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 2a1cc73390b7..ab9dcc075454 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -291,7 +291,7 @@ static void __init ek_board_init(void)
291 /* NAND */ 291 /* NAND */
292 at91_add_device_nand(&ek_nand_data); 292 at91_add_device_nand(&ek_nand_data);
293 /* I2C */ 293 /* I2C */
294 at91_add_device_i2c(); 294 at91_add_device_i2c(NULL, 0);
295 /* LCD Controller */ 295 /* LCD Controller */
296 at91_add_device_lcdc(&ek_lcdc_data); 296 at91_add_device_lcdc(&ek_lcdc_data);
297 /* AC97 */ 297 /* AC97 */
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 9b61320f295a..bc0546d7245f 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -181,7 +181,7 @@ static void __init ek_board_init(void)
181 /* Serial */ 181 /* Serial */
182 at91_add_device_serial(); 182 at91_add_device_serial();
183 /* I2C */ 183 /* I2C */
184 at91_add_device_i2c(); 184 at91_add_device_i2c(NULL, 0);
185 /* NAND */ 185 /* NAND */
186 at91_add_device_nand(&ek_nand_data); 186 at91_add_device_nand(&ek_nand_data);
187 /* SPI */ 187 /* SPI */
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 848efb2a4ebf..57c3b647ce83 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -351,7 +351,7 @@ static void init_programmable_clock(struct clk *clk)
351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id)); 351 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS); 352 parent = at91_css_to_clk(pckr & AT91_PMC_CSS);
353 clk->parent = parent; 353 clk->parent = parent;
354 clk->rate_hz = parent->rate_hz / (1 << ((pckr >> 2) & 3)); 354 clk->rate_hz = parent->rate_hz / (1 << ((pckr & AT91_PMC_PRES) >> 2));
355} 355}
356 356
357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */ 357#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
@@ -587,8 +587,11 @@ int __init at91_clock_init(unsigned long main_clock)
587 mckr = at91_sys_read(AT91_PMC_MCKR); 587 mckr = at91_sys_read(AT91_PMC_MCKR);
588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS); 588 mck.parent = at91_css_to_clk(mckr & AT91_PMC_CSS);
589 freq = mck.parent->rate_hz; 589 freq = mck.parent->rate_hz;
590 freq /= (1 << ((mckr >> 2) & 3)); /* prescale */ 590 freq /= (1 << ((mckr & AT91_PMC_PRES) >> 2)); /* prescale */
591 mck.rate_hz = freq / (1 + ((mckr >> 8) & 3)); /* mdiv */ 591 if (cpu_is_at91rm9200())
592 mck.rate_hz = freq / (1 + ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
593 else
594 mck.rate_hz = freq / (1 << ((mckr & AT91_PMC_MDIV) >> 8)); /* mdiv */
592 595
593 /* Register the PMC's standard clocks */ 596 /* Register the PMC's standard clocks */
594 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++) 597 for (i = 0; i < ARRAY_SIZE(standard_pmc_clocks); i++)
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c
index 0791b56caecc..a7465db84893 100644
--- a/arch/arm/mach-imx/irq.c
+++ b/arch/arm/mach-imx/irq.c
@@ -43,12 +43,46 @@
43 * 43 *
44 */ 44 */
45 45
46#define INTENNUM_OFF 0x8 46#define INTCNTL_OFF 0x00
47#define INTDISNUM_OFF 0xC 47#define NIMASK_OFF 0x04
48#define INTENNUM_OFF 0x08
49#define INTDISNUM_OFF 0x0C
50#define INTENABLEH_OFF 0x10
51#define INTENABLEL_OFF 0x14
52#define INTTYPEH_OFF 0x18
53#define INTTYPEL_OFF 0x1C
54#define NIPRIORITY_OFF(x) (0x20+4*(7-(x)))
55#define NIVECSR_OFF 0x40
56#define FIVECSR_OFF 0x44
57#define INTSRCH_OFF 0x48
58#define INTSRCL_OFF 0x4C
59#define INTFRCH_OFF 0x50
60#define INTFRCL_OFF 0x54
61#define NIPNDH_OFF 0x58
62#define NIPNDL_OFF 0x5C
63#define FIPNDH_OFF 0x60
64#define FIPNDL_OFF 0x64
48 65
49#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE) 66#define VA_AITC_BASE IO_ADDRESS(IMX_AITC_BASE)
50#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF) 67#define IMX_AITC_INTCNTL (VA_AITC_BASE + INTCNTL_OFF)
68#define IMX_AITC_NIMASK (VA_AITC_BASE + NIMASK_OFF)
51#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF) 69#define IMX_AITC_INTENNUM (VA_AITC_BASE + INTENNUM_OFF)
70#define IMX_AITC_INTDISNUM (VA_AITC_BASE + INTDISNUM_OFF)
71#define IMX_AITC_INTENABLEH (VA_AITC_BASE + INTENABLEH_OFF)
72#define IMX_AITC_INTENABLEL (VA_AITC_BASE + INTENABLEL_OFF)
73#define IMX_AITC_INTTYPEH (VA_AITC_BASE + INTTYPEH_OFF)
74#define IMX_AITC_INTTYPEL (VA_AITC_BASE + INTTYPEL_OFF)
75#define IMX_AITC_NIPRIORITY(x) (VA_AITC_BASE + NIPRIORITY_OFF(x))
76#define IMX_AITC_NIVECSR (VA_AITC_BASE + NIVECSR_OFF)
77#define IMX_AITC_FIVECSR (VA_AITC_BASE + FIVECSR_OFF)
78#define IMX_AITC_INTSRCH (VA_AITC_BASE + INTSRCH_OFF)
79#define IMX_AITC_INTSRCL (VA_AITC_BASE + INTSRCL_OFF)
80#define IMX_AITC_INTFRCH (VA_AITC_BASE + INTFRCH_OFF)
81#define IMX_AITC_INTFRCL (VA_AITC_BASE + INTFRCL_OFF)
82#define IMX_AITC_NIPNDH (VA_AITC_BASE + NIPNDH_OFF)
83#define IMX_AITC_NIPNDL (VA_AITC_BASE + NIPNDL_OFF)
84#define IMX_AITC_FIPNDH (VA_AITC_BASE + FIPNDH_OFF)
85#define IMX_AITC_FIPNDL (VA_AITC_BASE + FIPNDL_OFF)
52 86
53#if 0 87#if 0
54#define DEBUG_IRQ(fmt...) printk(fmt) 88#define DEBUG_IRQ(fmt...) printk(fmt)
@@ -222,7 +256,12 @@ imx_init_irq(void)
222 256
223 DEBUG_IRQ("Initializing imx interrupts\n"); 257 DEBUG_IRQ("Initializing imx interrupts\n");
224 258
225 /* Mask all interrupts initially */ 259 /* Disable all interrupts initially. */
260 /* Do not rely on the bootloader. */
261 __raw_writel(0, IMX_AITC_INTENABLEH);
262 __raw_writel(0, IMX_AITC_INTENABLEL);
263
264 /* Mask all GPIO interrupts as well */
226 IMR(0) = 0; 265 IMR(0) = 0;
227 IMR(1) = 0; 266 IMR(1) = 0;
228 IMR(2) = 0; 267 IMR(2) = 0;
@@ -245,6 +284,6 @@ imx_init_irq(void)
245 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler); 284 set_irq_chained_handler(GPIO_INT_PORTC, imx_gpioc_demux_handler);
246 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler); 285 set_irq_chained_handler(GPIO_INT_PORTD, imx_gpiod_demux_handler);
247 286
248 /* Disable all interrupts initially. */ 287 /* Release masking of interrupts according to priority */
249 /* In IMX this is done in the bootloader. */ 288 __raw_writel(-1, IMX_AITC_NIMASK);
250} 289}
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index d0f2b597db12..8e126e6b74c3 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -146,7 +146,7 @@ static struct clk pxa27x_clks[] = {
146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev), 146 INIT_CKEN("MMCCLK", MMC, 19500000, 0, &pxa_device_mci.dev),
147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev), 147 INIT_CKEN("FICPCLK", FICP, 48000000, 0, &pxa_device_ficp.dev),
148 148
149 INIT_CKEN("USBCLK", USB, 48000000, 0, &pxa27x_device_ohci.dev), 149 INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev),
150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev), 150 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev),
151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL), 151 INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL),
152 152
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 1010f77d977a..74128eb8f8d0 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -23,8 +23,11 @@
23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = { 23static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
24 24
25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124), 25 MFP_ADDR_X(GPIO0, GPIO4, 0x0124),
26 MFP_ADDR_X(GPIO5, GPIO26, 0x028C), 26 MFP_ADDR_X(GPIO5, GPIO9, 0x028C),
27 MFP_ADDR_X(GPIO27, GPIO62, 0x0400), 27 MFP_ADDR(GPIO10, 0x0458),
28 MFP_ADDR_X(GPIO11, GPIO26, 0x02A0),
29 MFP_ADDR_X(GPIO27, GPIO48, 0x0400),
30 MFP_ADDR_X(GPIO49, GPIO62, 0x045C),
28 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4), 31 MFP_ADDR_X(GPIO63, GPIO73, 0x04B4),
29 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0), 32 MFP_ADDR_X(GPIO74, GPIO98, 0x04F0),
30 MFP_ADDR_X(GPIO99, GPIO127, 0x0600), 33 MFP_ADDR_X(GPIO99, GPIO127, 0x0600),
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 71766ac0328b..422afee88169 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -309,6 +309,7 @@ void ssp_exit(struct ssp_dev *dev)
309 309
310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) { 310 if (dev->port > PXA_SSP_PORTS || dev->port == 0) {
311 printk(KERN_WARNING "SSP: tried to close invalid port\n"); 311 printk(KERN_WARNING "SSP: tried to close invalid port\n");
312 mutex_unlock(&mutex);
312 return; 313 return;
313 } 314 }
314 315
diff --git a/arch/frv/kernel/break.S b/arch/frv/kernel/break.S
index dac4a5f68c2e..bd0bdf908d93 100644
--- a/arch/frv/kernel/break.S
+++ b/arch/frv/kernel/break.S
@@ -63,7 +63,7 @@ __break_trace_through_exceptions:
63# entry point for Break Exceptions/Interrupts 63# entry point for Break Exceptions/Interrupts
64# 64#
65############################################################################### 65###############################################################################
66 .text 66 .section .text.break
67 .balign 4 67 .balign 4
68 .globl __entry_break 68 .globl __entry_break
69__entry_break: 69__entry_break:
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 1e74f3c5cee2..f926c7094776 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -38,7 +38,7 @@
38 38
39#define nr_syscalls ((syscall_table_size)/4) 39#define nr_syscalls ((syscall_table_size)/4)
40 40
41 .text 41 .section .text.entry
42 .balign 4 42 .balign 4
43 43
44.macro LEDS val 44.macro LEDS val
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index 3b71e0c86399..a17a81d58bf6 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -76,6 +76,12 @@ SECTIONS
76 *(.data.init_task) 76 *(.data.init_task)
77 } 77 }
78 78
79 . = ALIGN(4096);
80 .data.page_aligned : { *(.data.idt) }
81
82 . = ALIGN(L1_CACHE_BYTES);
83 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
84
79 .trap : { 85 .trap : {
80 /* trap table management - read entry-table.S before modifying */ 86 /* trap table management - read entry-table.S before modifying */
81 . = ALIGN(8192); 87 . = ALIGN(8192);
@@ -86,28 +92,25 @@ SECTIONS
86 *(.trap.break) 92 *(.trap.break)
87 } 93 }
88 94
89 . = ALIGN(4096);
90 .data.page_aligned : { *(.data.idt) }
91
92 . = ALIGN(L1_CACHE_BYTES);
93 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
94
95 /* Text and read-only data */ 95 /* Text and read-only data */
96 . = ALIGN(4); 96 . = ALIGN(4);
97 _text = .; 97 _text = .;
98 _stext = .; 98 _stext = .;
99 .text : { 99 .text : {
100 *( 100 *(.text.start)
101 .text.start .text.* 101 *(.text.entry)
102 *(.text.break)
103 *(.text.tlbmiss)
104 TEXT_TEXT
105 SCHED_TEXT
106 LOCK_TEXT
102#ifdef CONFIG_DEBUG_INFO 107#ifdef CONFIG_DEBUG_INFO
108 *(
103 .init.text 109 .init.text
104 .exit.text 110 .exit.text
105 .exitcall.exit 111 .exitcall.exit
106#endif
107 ) 112 )
108 TEXT_TEXT 113#endif
109 SCHED_TEXT
110 LOCK_TEXT
111 *(.fixup) 114 *(.fixup)
112 *(.gnu.warning) 115 *(.gnu.warning)
113 *(.exitcall.exit) 116 *(.exitcall.exit)
diff --git a/arch/frv/mm/tlb-miss.S b/arch/frv/mm/tlb-miss.S
index 04da67468378..07643482cad2 100644
--- a/arch/frv/mm/tlb-miss.S
+++ b/arch/frv/mm/tlb-miss.S
@@ -16,7 +16,7 @@
16#include <asm/highmem.h> 16#include <asm/highmem.h>
17#include <asm/spr-regs.h> 17#include <asm/spr-regs.h>
18 18
19 .section .text 19 .section .text.tlbmiss
20 .balign 4 20 .balign 4
21 21
22 .globl __entry_insn_mmu_miss 22 .globl __entry_insn_mmu_miss
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index a753d79c4e89..18124542a6eb 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -36,7 +36,7 @@ sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
36 unsigned long r2, unsigned long r3, unsigned long r4, 36 unsigned long r2, unsigned long r3, unsigned long r4,
37 unsigned long r5, unsigned long r6, struct pt_regs *regs) 37 unsigned long r5, unsigned long r6, struct pt_regs *regs)
38{ 38{
39 sigset_t saveset, newset; 39 sigset_t newset;
40 40
41 /* XXX: Don't preclude handling different sized sigset_t's. */ 41 /* XXX: Don't preclude handling different sized sigset_t's. */
42 if (sigsetsize != sizeof(sigset_t)) 42 if (sigsetsize != sizeof(sigset_t))
@@ -44,21 +44,18 @@ sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
44 44
45 if (copy_from_user(&newset, unewset, sizeof(newset))) 45 if (copy_from_user(&newset, unewset, sizeof(newset)))
46 return -EFAULT; 46 return -EFAULT;
47 sigdelsetmask(&newset, ~_BLOCKABLE); 47 sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP));
48 48
49 spin_lock_irq(&current->sighand->siglock); 49 spin_lock_irq(&current->sighand->siglock);
50 saveset = current->blocked; 50 current->saved_sigmask = current->blocked;
51 current->blocked = newset; 51 current->blocked = newset;
52 recalc_sigpending(); 52 recalc_sigpending();
53 spin_unlock_irq(&current->sighand->siglock); 53 spin_unlock_irq(&current->sighand->siglock);
54 54
55 regs->r0 = -EINTR; 55 current->state = TASK_INTERRUPTIBLE;
56 while (1) { 56 schedule();
57 current->state = TASK_INTERRUPTIBLE; 57 set_thread_flag(TIF_RESTORE_SIGMASK);
58 schedule(); 58 return -ERESTARTNOHAND;
59 if (do_signal(regs, &saveset))
60 return regs->r0;
61 }
62} 59}
63 60
64asmlinkage int 61asmlinkage int
diff --git a/arch/m32r/kernel/syscall_table.S b/arch/m32r/kernel/syscall_table.S
index 751ac2a3d120..95aa79874847 100644
--- a/arch/m32r/kernel/syscall_table.S
+++ b/arch/m32r/kernel/syscall_table.S
@@ -284,3 +284,43 @@ ENTRY(sys_call_table)
284 .long sys_mq_getsetattr 284 .long sys_mq_getsetattr
285 .long sys_ni_syscall /* reserved for kexec */ 285 .long sys_ni_syscall /* reserved for kexec */
286 .long sys_waitid 286 .long sys_waitid
287 .long sys_ni_syscall /* 285 */ /* available */
288 .long sys_add_key
289 .long sys_request_key
290 .long sys_keyctl
291 .long sys_ioprio_set
292 .long sys_ioprio_get /* 290 */
293 .long sys_inotify_init
294 .long sys_inotify_add_watch
295 .long sys_inotify_rm_watch
296 .long sys_migrate_pages
297 .long sys_openat /* 295 */
298 .long sys_mkdirat
299 .long sys_mknodat
300 .long sys_fchownat
301 .long sys_futimesat
302 .long sys_fstatat64 /* 300 */
303 .long sys_unlinkat
304 .long sys_renameat
305 .long sys_linkat
306 .long sys_symlinkat
307 .long sys_readlinkat /* 305 */
308 .long sys_fchmodat
309 .long sys_faccessat
310 .long sys_pselect6
311 .long sys_ppoll
312 .long sys_unshare /* 310 */
313 .long sys_set_robust_list
314 .long sys_get_robust_list
315 .long sys_splice
316 .long sys_sync_file_range
317 .long sys_tee /* 315 */
318 .long sys_vmsplice
319 .long sys_move_pages
320 .long sys_getcpu
321 .long sys_epoll_pwait
322 .long sys_utimensat /* 320 */
323 .long sys_signalfd
324 .long sys_timerfd
325 .long sys_eventfd
326 .long sys_fallocate
diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index 74c5c62365a8..0e2b5cd81f67 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -5,6 +5,10 @@
5 * 5 *
6 * Copyright (C) 2007 by Ralf Baechle 6 * Copyright (C) 2007 by Ralf Baechle
7 */ 7 */
8#include <linux/clocksource.h>
9#include <linux/init.h>
10
11#include <asm/time.h>
8 12
9static cycle_t c0_hpt_read(void) 13static cycle_t c0_hpt_read(void)
10{ 14{
@@ -18,7 +22,7 @@ static struct clocksource clocksource_mips = {
18 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 22 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
19}; 23};
20 24
21static void __init init_mips_clocksource(void) 25void __init init_mips_clocksource(void)
22{ 26{
23 /* Calclate a somewhat reasonable rating value */ 27 /* Calclate a somewhat reasonable rating value */
24 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; 28 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index 174f09e42f6b..5f389ee26fca 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -31,25 +31,6 @@
31unsigned long sgi_gfxaddr; 31unsigned long sgi_gfxaddr;
32EXPORT_SYMBOL_GPL(sgi_gfxaddr); 32EXPORT_SYMBOL_GPL(sgi_gfxaddr);
33 33
34/*
35 * Stop-A is originally a Sun thing that isn't standard on IP22 so to avoid
36 * accidents it's disabled by default on IP22.
37 *
38 * FIXME: provide a mechanism to change the value of stop_a_enabled.
39 */
40int stop_a_enabled;
41
42void ip22_do_break(void)
43{
44 if (!stop_a_enabled)
45 return;
46
47 printk("\n");
48 ArcEnterInteractiveMode();
49}
50
51EXPORT_SYMBOL(ip22_do_break);
52
53extern void ip22_be_init(void) __init; 34extern void ip22_be_init(void) __init;
54 35
55void __init plat_mem_setup(void) 36void __init plat_mem_setup(void)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 18f397ca05ef..232c298c933f 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -187,6 +187,11 @@ config FORCE_MAX_ZONEORDER
187 default "9" if PPC_64K_PAGES 187 default "9" if PPC_64K_PAGES
188 default "13" 188 default "13"
189 189
190config HUGETLB_PAGE_SIZE_VARIABLE
191 bool
192 depends on HUGETLB_PAGE
193 default y
194
190config MATH_EMULATION 195config MATH_EMULATION
191 bool "Math emulation" 196 bool "Math emulation"
192 depends on 4xx || 8xx || E200 || PPC_MPC832x || E500 197 depends on 4xx || 8xx || E200 || PPC_MPC832x || E500
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 31999bc1c8a4..ba6813a4aa37 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -168,7 +168,7 @@ ifneq ($(KBUILD_SRC),)
168 $(Q)mkdir -p $(objtree)/include/asm-um 168 $(Q)mkdir -p $(objtree)/include/asm-um
169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch 169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
170else 170else
171 $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(SUBARCH) arch 171 $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(HEADER_ARCH) arch
172endif 172endif
173 173
174$(objtree)/$(ARCH_DIR)/include: 174$(objtree)/$(ARCH_DIR)/include:
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 7e6cdde62ead..b1a77b11f089 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1128,6 +1128,7 @@ static void do_ubd_request(struct request_queue *q)
1128 "errno = %d\n", -n); 1128 "errno = %d\n", -n);
1129 else if(list_empty(&dev->restart)) 1129 else if(list_empty(&dev->restart))
1130 list_add(&dev->restart, &restart); 1130 list_add(&dev->restart, &restart);
1131 kfree(io_req);
1131 return; 1132 return;
1132 } 1133 }
1133 1134
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index e34e1effe0f5..ef02d941c2ad 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -59,7 +59,7 @@ long long disable_timer(void)
59{ 59{
60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); 60 struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } });
61 61
62 if(setitimer(ITIMER_VIRTUAL, &time, &time) < 0) 62 if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0)
63 printk(UM_KERN_ERR "disable_timer - setitimer failed, " 63 printk(UM_KERN_ERR "disable_timer - setitimer failed, "
64 "errno = %d\n", errno); 64 "errno = %d\n", errno);
65 65
@@ -74,13 +74,61 @@ long long os_nsecs(void)
74 return timeval_to_ns(&tv); 74 return timeval_to_ns(&tv);
75} 75}
76 76
77#ifdef UML_CONFIG_NO_HZ
78static int after_sleep_interval(struct timespec *ts)
79{
80}
81#else
82static inline long long timespec_to_us(const struct timespec *ts)
83{
84 return ((long long) ts->tv_sec * UM_USEC_PER_SEC) +
85 ts->tv_nsec / UM_NSEC_PER_USEC;
86}
87
88static int after_sleep_interval(struct timespec *ts)
89{
90 int usec = UM_USEC_PER_SEC / UM_HZ;
91 long long start_usecs = timespec_to_us(ts);
92 struct timeval tv;
93 struct itimerval interval;
94
95 /*
96 * It seems that rounding can increase the value returned from
97 * setitimer to larger than the one passed in. Over time,
98 * this will cause the remaining time to be greater than the
99 * tick interval. If this happens, then just reduce the first
100 * tick to the interval value.
101 */
102 if (start_usecs > usec)
103 start_usecs = usec;
104 tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC,
105 .tv_usec = start_usecs % UM_USEC_PER_SEC });
106 interval = ((struct itimerval) { { 0, usec }, tv });
107
108 if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1)
109 return -errno;
110
111 return 0;
112}
113#endif
114
77extern void alarm_handler(int sig, struct sigcontext *sc); 115extern void alarm_handler(int sig, struct sigcontext *sc);
78 116
79void idle_sleep(unsigned long long nsecs) 117void idle_sleep(unsigned long long nsecs)
80{ 118{
81 struct timespec ts = { .tv_sec = nsecs / UM_NSEC_PER_SEC, 119 struct timespec ts;
82 .tv_nsec = nsecs % UM_NSEC_PER_SEC }; 120
121 /*
122 * nsecs can come in as zero, in which case, this starts a
123 * busy loop. To prevent this, reset nsecs to the tick
124 * interval if it is zero.
125 */
126 if (nsecs == 0)
127 nsecs = UM_NSEC_PER_SEC / UM_HZ;
128 ts = ((struct timespec) { .tv_sec = nsecs / UM_NSEC_PER_SEC,
129 .tv_nsec = nsecs % UM_NSEC_PER_SEC });
83 130
84 if (nanosleep(&ts, &ts) == 0) 131 if (nanosleep(&ts, &ts) == 0)
85 alarm_handler(SIGVTALRM, NULL); 132 alarm_handler(SIGVTALRM, NULL);
133 after_sleep_interval(&ts);
86} 134}
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 6ef5a060fa11..4cc5b0411db5 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -236,39 +236,30 @@ start_of_setup:
236 movw %ax, %es 236 movw %ax, %es
237 cld 237 cld
238 238
239# Apparently some ancient versions of LILO invoked the kernel 239# Apparently some ancient versions of LILO invoked the kernel with %ss != %ds,
240# with %ss != %ds, which happened to work by accident for the 240# which happened to work by accident for the old code. Recalculate the stack
241# old code. If the CAN_USE_HEAP flag is set in loadflags, or 241# pointer if %ss is invalid. Otherwise leave it alone, LOADLIN sets up the
242# %ss != %ds, then adjust the stack pointer. 242# stack behind its own code, so we can't blindly put it directly past the heap.
243 243
244 # Smallest possible stack we can tolerate
245 movw $(_end+STACK_SIZE), %cx
246
247 movw heap_end_ptr, %dx
248 addw $512, %dx
249 jnc 1f
250 xorw %dx, %dx # Wraparound - whole segment available
2511: testb $CAN_USE_HEAP, loadflags
252 jnz 2f
253
254 # No CAN_USE_HEAP
255 movw %ss, %dx 244 movw %ss, %dx
256 cmpw %ax, %dx # %ds == %ss? 245 cmpw %ax, %dx # %ds == %ss?
257 movw %sp, %dx 246 movw %sp, %dx
258 # If so, assume %sp is reasonably set, otherwise use 247 je 2f # -> assume %sp is reasonably set
259 # the smallest possible stack. 248
260 jne 4f # -> Smallest possible stack... 249 # Invalid %ss, make up a new stack
250 movw $_end, %dx
251 testb $CAN_USE_HEAP, loadflags
252 jz 1f
253 movw heap_end_ptr, %dx
2541: addw $STACK_SIZE, %dx
255 jnc 2f
256 xorw %dx, %dx # Prevent wraparound
261 257
262 # Make sure the stack is at least minimum size. Take a value 2582: # Now %dx should point to the end of our stack space
263 # of zero to mean "full segment."
2642:
265 andw $~3, %dx # dword align (might as well...) 259 andw $~3, %dx # dword align (might as well...)
266 jnz 3f 260 jnz 3f
267 movw $0xfffc, %dx # Make sure we're not zero 261 movw $0xfffc, %dx # Make sure we're not zero
2683: cmpw %cx, %dx 2623: movw %ax, %ss
269 jnb 5f
2704: movw %cx, %dx # Minimum value we can possibly use
2715: movw %ax, %ss
272 movzwl %dx, %esp # Clear upper half of %esp 263 movzwl %dx, %esp # Clear upper half of %esp
273 sti # Now we should have a working stack 264 sti # Now we should have a working stack
274 265
diff --git a/arch/x86/kernel/paravirt_32.c b/arch/x86/kernel/paravirt_32.c
index 6a80d67c2121..f5000799f8ef 100644
--- a/arch/x86/kernel/paravirt_32.c
+++ b/arch/x86/kernel/paravirt_32.c
@@ -465,8 +465,8 @@ struct pv_mmu_ops pv_mmu_ops = {
465}; 465};
466 466
467EXPORT_SYMBOL_GPL(pv_time_ops); 467EXPORT_SYMBOL_GPL(pv_time_ops);
468EXPORT_SYMBOL_GPL(pv_cpu_ops); 468EXPORT_SYMBOL (pv_cpu_ops);
469EXPORT_SYMBOL_GPL(pv_mmu_ops); 469EXPORT_SYMBOL (pv_mmu_ops);
470EXPORT_SYMBOL_GPL(pv_apic_ops); 470EXPORT_SYMBOL_GPL(pv_apic_ops);
471EXPORT_SYMBOL_GPL(pv_info); 471EXPORT_SYMBOL_GPL(pv_info);
472EXPORT_SYMBOL (pv_irq_ops); 472EXPORT_SYMBOL (pv_irq_ops);
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index c4dffbeea5e1..19626ace0f50 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -2,6 +2,7 @@ config LGUEST_GUEST
2 bool "Lguest guest support" 2 bool "Lguest guest support"
3 select PARAVIRT 3 select PARAVIRT
4 depends on !X86_PAE 4 depends on !X86_PAE
5 depends on !(X86_VISWS || X86_VOYAGER)
5 select VIRTIO 6 select VIRTIO
6 select VIRTIO_RING 7 select VIRTIO_RING
7 select VIRTIO_CONSOLE 8 select VIRTIO_CONSOLE
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index a7308b2cd058..0f9c8c890658 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -345,7 +345,7 @@ static void __init find_early_table_space(unsigned long end)
345/* Setup the direct mapping of the physical memory at PAGE_OFFSET. 345/* Setup the direct mapping of the physical memory at PAGE_OFFSET.
346 This runs before bootmem is initialized and gets pages directly from the 346 This runs before bootmem is initialized and gets pages directly from the
347 physical memory. To access them they are temporarily mapped. */ 347 physical memory. To access them they are temporarily mapped. */
348void __meminit init_memory_mapping(unsigned long start, unsigned long end) 348void __init_refok init_memory_mapping(unsigned long start, unsigned long end)
349{ 349{
350 unsigned long next; 350 unsigned long next;
351 351
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index b2e32f9d0071..0ac6c5dc49ba 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -244,6 +244,8 @@ pte_t xen_make_pte(unsigned long long pte)
244 if (pte & 1) 244 if (pte & 1)
245 pte = phys_to_machine(XPADDR(pte)).maddr; 245 pte = phys_to_machine(XPADDR(pte)).maddr;
246 246
247 pte &= ~_PAGE_PCD;
248
247 return (pte_t){ pte, pte >> 32 }; 249 return (pte_t){ pte, pte >> 32 };
248} 250}
249 251
@@ -291,6 +293,8 @@ pte_t xen_make_pte(unsigned long pte)
291 if (pte & _PAGE_PRESENT) 293 if (pte & _PAGE_PRESENT)
292 pte = phys_to_machine(XPADDR(pte)).maddr; 294 pte = phys_to_machine(XPADDR(pte)).maddr;
293 295
296 pte &= ~_PAGE_PCD;
297
294 return (pte_t){ pte }; 298 return (pte_t){ pte };
295} 299}
296 300
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 015689d295c7..e48ee4f8749f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -494,7 +494,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id)
494 if (apic_id == -1) 494 if (apic_id == -1)
495 return apic_id; 495 return apic_id;
496 496
497 for (i = 0; i < NR_CPUS; ++i) { 497 for_each_possible_cpu(i) {
498 if (cpu_physical_id(i) == apic_id) 498 if (cpu_physical_id(i) == apic_id)
499 return i; 499 return i;
500 } 500 }
@@ -632,7 +632,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
632 return 0; 632 return 0;
633 } 633 }
634 634
635 BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); 635 BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
636 636
637 /* 637 /*
638 * Buggy BIOS check 638 * Buggy BIOS check
@@ -774,7 +774,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
774 774
775 pr = acpi_driver_data(device); 775 pr = acpi_driver_data(device);
776 776
777 if (pr->id >= NR_CPUS) { 777 if (pr->id >= nr_cpu_ids) {
778 kfree(pr); 778 kfree(pr);
779 return 0; 779 return 0;
780 } 780 }
@@ -845,7 +845,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
845 if (!pr) 845 if (!pr)
846 return -ENODEV; 846 return -ENODEV;
847 847
848 if ((pr->id >= 0) && (pr->id < NR_CPUS)) { 848 if ((pr->id >= 0) && (pr->id < nr_cpu_ids)) {
849 kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE); 849 kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE);
850 } 850 }
851 return 0; 851 return 0;
@@ -883,13 +883,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
883 break; 883 break;
884 } 884 }
885 885
886 if (pr->id >= 0 && (pr->id < NR_CPUS)) { 886 if (pr->id >= 0 && (pr->id < nr_cpu_ids)) {
887 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 887 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
888 break; 888 break;
889 } 889 }
890 890
891 result = acpi_processor_start(device); 891 result = acpi_processor_start(device);
892 if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { 892 if ((!result) && ((pr->id >= 0) && (pr->id < nr_cpu_ids))) {
893 kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); 893 kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
894 } else { 894 } else {
895 printk(KERN_ERR PREFIX "Device [%s] failed to start\n", 895 printk(KERN_ERR PREFIX "Device [%s] failed to start\n",
@@ -912,7 +912,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data)
912 return; 912 return;
913 } 913 }
914 914
915 if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) 915 if ((pr->id < nr_cpu_ids) && (cpu_present(pr->id)))
916 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 916 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
917 break; 917 break;
918 default: 918 default:
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 3f4d6aa13990..2683eac30c68 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -770,9 +770,10 @@ int device_add(struct device *dev)
770 error = device_add_attrs(dev); 770 error = device_add_attrs(dev);
771 if (error) 771 if (error)
772 goto AttrsError; 772 goto AttrsError;
773 error = device_pm_add(dev); 773 error = dpm_sysfs_add(dev);
774 if (error) 774 if (error)
775 goto PMError; 775 goto PMError;
776 device_pm_add(dev);
776 error = bus_add_device(dev); 777 error = bus_add_device(dev);
777 if (error) 778 if (error)
778 goto BusError; 779 goto BusError;
@@ -797,6 +798,7 @@ int device_add(struct device *dev)
797 return error; 798 return error;
798 BusError: 799 BusError:
799 device_pm_remove(dev); 800 device_pm_remove(dev);
801 dpm_sysfs_remove(dev);
800 PMError: 802 PMError:
801 if (dev->bus) 803 if (dev->bus)
802 blocking_notifier_call_chain(&dev->bus->bus_notifier, 804 blocking_notifier_call_chain(&dev->bus->bus_notifier,
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile
index a803733c839e..44504e6618fb 100644
--- a/drivers/base/power/Makefile
+++ b/drivers/base/power/Makefile
@@ -1,5 +1,6 @@
1obj-y := shutdown.o 1obj-y := shutdown.o
2obj-$(CONFIG_PM_SLEEP) += main.o sysfs.o 2obj-$(CONFIG_PM) += sysfs.o
3obj-$(CONFIG_PM_SLEEP) += main.o
3obj-$(CONFIG_PM_TRACE) += trace.o 4obj-$(CONFIG_PM_TRACE) += trace.o
4 5
5ifeq ($(CONFIG_DEBUG_DRIVER),y) 6ifeq ($(CONFIG_DEBUG_DRIVER),y)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 0ab4ab21f564..691ffb64cc37 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -38,20 +38,14 @@ static DEFINE_MUTEX(dpm_list_mtx);
38int (*platform_enable_wakeup)(struct device *dev, int is_on); 38int (*platform_enable_wakeup)(struct device *dev, int is_on);
39 39
40 40
41int device_pm_add(struct device *dev) 41void device_pm_add(struct device *dev)
42{ 42{
43 int error;
44
45 pr_debug("PM: Adding info for %s:%s\n", 43 pr_debug("PM: Adding info for %s:%s\n",
46 dev->bus ? dev->bus->name : "No Bus", 44 dev->bus ? dev->bus->name : "No Bus",
47 kobject_name(&dev->kobj)); 45 kobject_name(&dev->kobj));
48 mutex_lock(&dpm_list_mtx); 46 mutex_lock(&dpm_list_mtx);
49 list_add_tail(&dev->power.entry, &dpm_active); 47 list_add_tail(&dev->power.entry, &dpm_active);
50 error = dpm_sysfs_add(dev);
51 if (error)
52 list_del(&dev->power.entry);
53 mutex_unlock(&dpm_list_mtx); 48 mutex_unlock(&dpm_list_mtx);
54 return error;
55} 49}
56 50
57void device_pm_remove(struct device *dev) 51void device_pm_remove(struct device *dev)
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 5c4efd493fa5..379da4e958e0 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -13,14 +13,29 @@ extern void device_shutdown(void);
13 13
14extern struct list_head dpm_active; /* The active device list */ 14extern struct list_head dpm_active; /* The active device list */
15 15
16static inline struct device * to_device(struct list_head * entry) 16static inline struct device *to_device(struct list_head *entry)
17{ 17{
18 return container_of(entry, struct device, power.entry); 18 return container_of(entry, struct device, power.entry);
19} 19}
20 20
21extern int device_pm_add(struct device *); 21extern void device_pm_add(struct device *);
22extern void device_pm_remove(struct device *); 22extern void device_pm_remove(struct device *);
23 23
24#else /* CONFIG_PM_SLEEP */
25
26
27static inline void device_pm_add(struct device *dev)
28{
29}
30
31static inline void device_pm_remove(struct device *dev)
32{
33}
34
35#endif
36
37#ifdef CONFIG_PM
38
24/* 39/*
25 * sysfs.c 40 * sysfs.c
26 */ 41 */
@@ -28,16 +43,15 @@ extern void device_pm_remove(struct device *);
28extern int dpm_sysfs_add(struct device *); 43extern int dpm_sysfs_add(struct device *);
29extern void dpm_sysfs_remove(struct device *); 44extern void dpm_sysfs_remove(struct device *);
30 45
31#else /* CONFIG_PM_SLEEP */ 46#else /* CONFIG_PM */
32
33 47
34static inline int device_pm_add(struct device * dev) 48static inline int dpm_sysfs_add(struct device *dev)
35{ 49{
36 return 0; 50 return 0;
37} 51}
38static inline void device_pm_remove(struct device * dev)
39{
40 52
53static inline void dpm_sysfs_remove(struct device *dev)
54{
41} 55}
42 56
43#endif 57#endif
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index bf18d757b876..a509b8d79781 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -457,7 +457,7 @@ config LEGACY_PTYS
457config LEGACY_PTY_COUNT 457config LEGACY_PTY_COUNT
458 int "Maximum number of legacy PTY in use" 458 int "Maximum number of legacy PTY in use"
459 depends on LEGACY_PTYS 459 depends on LEGACY_PTYS
460 range 1 256 460 range 0 256
461 default "256" 461 default "256"
462 ---help--- 462 ---help---
463 The maximum number of legacy PTYs that can be used at any one time. 463 The maximum number of legacy PTYs that can be used at any one time.
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index fd771a4d6d18..81503d94fecc 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -450,6 +450,11 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
450 goto out_err; 450 goto out_err;
451 } 451 }
452 452
453 if (request_locality(chip, 0) != 0) {
454 rc = -ENODEV;
455 goto out_err;
456 }
457
453 vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); 458 vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0));
454 459
455 /* Default timeouts */ 460 /* Default timeouts */
@@ -487,11 +492,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
487 if (intfcaps & TPM_INTF_DATA_AVAIL_INT) 492 if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
488 dev_dbg(dev, "\tData Avail Int Support\n"); 493 dev_dbg(dev, "\tData Avail Int Support\n");
489 494
490 if (request_locality(chip, 0) != 0) {
491 rc = -ENODEV;
492 goto out_err;
493 }
494
495 /* INTERRUPT Setup */ 495 /* INTERRUPT Setup */
496 init_waitqueue_head(&chip->vendor.read_queue); 496 init_waitqueue_head(&chip->vendor.read_queue);
497 init_waitqueue_head(&chip->vendor.int_queue); 497 init_waitqueue_head(&chip->vendor.int_queue);
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 6a7d25fc2470..c46b7c219ee9 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -3,11 +3,13 @@
3# 3#
4 4
5menuconfig DMADEVICES 5menuconfig DMADEVICES
6 bool "DMA Offload Engine support" 6 bool "DMA Engine support"
7 depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX 7 depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX
8 help 8 help
9 Intel(R) offload engines enable offloading memory copies in the 9 DMA engines can do asynchronous data transfers without
10 network stack and RAID operations in the MD driver. 10 involving the host CPU. Currently, this framework can be
11 used to offload memory copies in the network stack and
12 RAID operations in the MD driver.
11 13
12if DMADEVICES 14if DMADEVICES
13 15
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c
index 57670dc5034d..909d6709ec16 100644
--- a/drivers/isdn/hisax/hfcscard.c
+++ b/drivers/isdn/hisax/hfcscard.c
@@ -118,8 +118,7 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg)
118 return(0); 118 return(0);
119 case CARD_INIT: 119 case CARD_INIT:
120 delay = (75*HZ)/100 +1; 120 delay = (75*HZ)/100 +1;
121 cs->hw.hfcD.timer.expires = jiffies + delay; 121 mod_timer(&cs->hw.hfcD.timer, jiffies + delay);
122 add_timer(&cs->hw.hfcD.timer);
123 spin_lock_irqsave(&cs->lock, flags); 122 spin_lock_irqsave(&cs->lock, flags);
124 reset_hfcs(cs); 123 reset_hfcs(cs);
125 init2bds0(cs); 124 init2bds0(cs);
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 8135e4c3bf47..afd82966f9a0 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -156,7 +156,7 @@ static void sm501_dump_clk(struct sm501_devdata *sm)
156 156
157 dev_dbg(sm->dev, "PM0[%c]: " 157 dev_dbg(sm->dev, "PM0[%c]: "
158 "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " 158 "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), "
159x "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", 159 "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n",
160 (pmc & 3 ) == 0 ? '*' : '-', 160 (pmc & 3 ) == 0 ? '*' : '-',
161 fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)), 161 fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)),
162 fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)), 162 fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)),
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c
index d552de683110..eeea84c309e6 100644
--- a/drivers/mmc/card/sdio_uart.c
+++ b/drivers/mmc/card/sdio_uart.c
@@ -386,7 +386,7 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port)
386 sdio_out(port, UART_IER, port->ier); 386 sdio_out(port, UART_IER, port->ier);
387} 387}
388 388
389static void sdio_uart_receive_chars(struct sdio_uart_port *port, int *status) 389static void sdio_uart_receive_chars(struct sdio_uart_port *port, unsigned int *status)
390{ 390{
391 struct tty_struct *tty = port->tty; 391 struct tty_struct *tty = port->tty;
392 unsigned int ch, flag; 392 unsigned int ch, flag;
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
index f6cc0c5b5657..1ef417cca2db 100644
--- a/drivers/pci/hotplug/acpiphp.h
+++ b/drivers/pci/hotplug/acpiphp.h
@@ -66,7 +66,7 @@ struct slot {
66 char name[SLOT_NAME_SIZE]; 66 char name[SLOT_NAME_SIZE];
67}; 67};
68 68
69/** 69/*
70 * struct acpiphp_bridge - PCI bridge information 70 * struct acpiphp_bridge - PCI bridge information
71 * 71 *
72 * for each bridge device in ACPI namespace 72 * for each bridge device in ACPI namespace
@@ -97,7 +97,7 @@ struct acpiphp_bridge {
97}; 97};
98 98
99 99
100/** 100/*
101 * struct acpiphp_slot - PCI slot information 101 * struct acpiphp_slot - PCI slot information
102 * 102 *
103 * PCI slot information for each *physical* PCI slot 103 * PCI slot information for each *physical* PCI slot
@@ -118,7 +118,7 @@ struct acpiphp_slot {
118}; 118};
119 119
120 120
121/** 121/*
122 * struct acpiphp_func - PCI function information 122 * struct acpiphp_func - PCI function information
123 * 123 *
124 * PCI function information for each object in ACPI namespace 124 * PCI function information for each object in ACPI namespace
@@ -137,7 +137,7 @@ struct acpiphp_func {
137 u32 flags; /* see below */ 137 u32 flags; /* see below */
138}; 138};
139 139
140/** 140/*
141 * struct acpiphp_attention_info - device specific attention registration 141 * struct acpiphp_attention_info - device specific attention registration
142 * 142 *
143 * ACPI has no generic method of setting/getting attention status 143 * ACPI has no generic method of setting/getting attention status
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index a0ca63adad5a..c8c263875c21 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -91,10 +91,10 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = {
91 * acpiphp_register_attention - set attention LED callback 91 * acpiphp_register_attention - set attention LED callback
92 * @info: must be completely filled with LED callbacks 92 * @info: must be completely filled with LED callbacks
93 * 93 *
94 * Description: this is used to register a hardware specific ACPI 94 * Description: This is used to register a hardware specific ACPI
95 * driver that manipulates the attention LED. All the fields in 95 * driver that manipulates the attention LED. All the fields in
96 * info must be set. 96 * info must be set.
97 **/ 97 */
98int acpiphp_register_attention(struct acpiphp_attention_info *info) 98int acpiphp_register_attention(struct acpiphp_attention_info *info)
99{ 99{
100 int retval = -EINVAL; 100 int retval = -EINVAL;
@@ -112,10 +112,10 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info)
112 * acpiphp_unregister_attention - unset attention LED callback 112 * acpiphp_unregister_attention - unset attention LED callback
113 * @info: must match the pointer used to register 113 * @info: must match the pointer used to register
114 * 114 *
115 * Description: this is used to un-register a hardware specific acpi 115 * Description: This is used to un-register a hardware specific acpi
116 * driver that manipulates the attention LED. The pointer to the 116 * driver that manipulates the attention LED. The pointer to the
117 * info struct must be the same as the one used to set it. 117 * info struct must be the same as the one used to set it.
118 **/ 118 */
119int acpiphp_unregister_attention(struct acpiphp_attention_info *info) 119int acpiphp_unregister_attention(struct acpiphp_attention_info *info)
120{ 120{
121 int retval = -EINVAL; 121 int retval = -EINVAL;
@@ -133,7 +133,6 @@ int acpiphp_unregister_attention(struct acpiphp_attention_info *info)
133 * @hotplug_slot: slot to enable 133 * @hotplug_slot: slot to enable
134 * 134 *
135 * Actual tasks are done in acpiphp_enable_slot() 135 * Actual tasks are done in acpiphp_enable_slot()
136 *
137 */ 136 */
138static int enable_slot(struct hotplug_slot *hotplug_slot) 137static int enable_slot(struct hotplug_slot *hotplug_slot)
139{ 138{
@@ -151,7 +150,6 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
151 * @hotplug_slot: slot to disable 150 * @hotplug_slot: slot to disable
152 * 151 *
153 * Actual tasks are done in acpiphp_disable_slot() 152 * Actual tasks are done in acpiphp_disable_slot()
154 *
155 */ 153 */
156static int disable_slot(struct hotplug_slot *hotplug_slot) 154static int disable_slot(struct hotplug_slot *hotplug_slot)
157{ 155{
@@ -168,15 +166,15 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
168} 166}
169 167
170 168
171 /** 169/**
172 * set_attention_status - set attention LED 170 * set_attention_status - set attention LED
173 * @hotplug_slot: slot to set attention LED on 171 * @hotplug_slot: slot to set attention LED on
174 * @status: value to set attention LED to (0 or 1) 172 * @status: value to set attention LED to (0 or 1)
175 * 173 *
176 * attention status LED, so we use a callback that 174 * attention status LED, so we use a callback that
177 * was registered with us. This allows hardware specific 175 * was registered with us. This allows hardware specific
178 * ACPI implementations to blink the light for us. 176 * ACPI implementations to blink the light for us.
179 **/ 177 */
180 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) 178 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
181 { 179 {
182 int retval = -ENODEV; 180 int retval = -ENODEV;
@@ -199,7 +197,6 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
199 * 197 *
200 * Some platforms may not implement _STA method properly. 198 * Some platforms may not implement _STA method properly.
201 * In that case, the value returned may not be reliable. 199 * In that case, the value returned may not be reliable.
202 *
203 */ 200 */
204static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) 201static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
205{ 202{
@@ -213,7 +210,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
213} 210}
214 211
215 212
216 /** 213/**
217 * get_attention_status - get attention LED status 214 * get_attention_status - get attention LED status
218 * @hotplug_slot: slot to get status from 215 * @hotplug_slot: slot to get status from
219 * @value: returns with value of attention LED 216 * @value: returns with value of attention LED
@@ -221,8 +218,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
221 * ACPI doesn't have known method to determine the state 218 * ACPI doesn't have known method to determine the state
222 * of the attention status LED, so we use a callback that 219 * of the attention status LED, so we use a callback that
223 * was registered with us. This allows hardware specific 220 * was registered with us. This allows hardware specific
224 * ACPI implementations to determine its state 221 * ACPI implementations to determine its state.
225 **/ 222 */
226static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) 223static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
227{ 224{
228 int retval = -EINVAL; 225 int retval = -EINVAL;
@@ -244,8 +241,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
244 * @value: pointer to store status 241 * @value: pointer to store status
245 * 242 *
246 * ACPI doesn't provide any formal means to access latch status. 243 * ACPI doesn't provide any formal means to access latch status.
247 * Instead, we fake latch status from _STA 244 * Instead, we fake latch status from _STA.
248 *
249 */ 245 */
250static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) 246static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
251{ 247{
@@ -265,8 +261,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
265 * @value: pointer to store status 261 * @value: pointer to store status
266 * 262 *
267 * ACPI doesn't provide any formal means to access adapter status. 263 * ACPI doesn't provide any formal means to access adapter status.
268 * Instead, we fake adapter status from _STA 264 * Instead, we fake adapter status from _STA.
269 *
270 */ 265 */
271static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) 266static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
272{ 267{
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 1e125b56c9a9..ff1b1c71291a 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -82,7 +82,6 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex
82 * 2. has _PS0 method 82 * 2. has _PS0 method
83 * 3. has _PS3 method 83 * 3. has _PS3 method
84 * 4. .. 84 * 4. ..
85 *
86 */ 85 */
87static int is_ejectable(acpi_handle handle) 86static int is_ejectable(acpi_handle handle)
88{ 87{
@@ -986,10 +985,8 @@ static int power_off_slot(struct acpiphp_slot *slot)
986 985
987 986
988/** 987/**
989 * acpiphp_max_busnr - return the highest reserved bus number under 988 * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
990 * the given bus.
991 * @bus: bus to start search with 989 * @bus: bus to start search with
992 *
993 */ 990 */
994static unsigned char acpiphp_max_busnr(struct pci_bus *bus) 991static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
995{ 992{
@@ -1018,7 +1015,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
1018/** 1015/**
1019 * acpiphp_bus_add - add a new bus to acpi subsystem 1016 * acpiphp_bus_add - add a new bus to acpi subsystem
1020 * @func: acpiphp_func of the bridge 1017 * @func: acpiphp_func of the bridge
1021 *
1022 */ 1018 */
1023static int acpiphp_bus_add(struct acpiphp_func *func) 1019static int acpiphp_bus_add(struct acpiphp_func *func)
1024{ 1020{
@@ -1063,7 +1059,6 @@ acpiphp_bus_add_out:
1063/** 1059/**
1064 * acpiphp_bus_trim - trim a bus from acpi subsystem 1060 * acpiphp_bus_trim - trim a bus from acpi subsystem
1065 * @handle: handle to acpi namespace 1061 * @handle: handle to acpi namespace
1066 *
1067 */ 1062 */
1068static int acpiphp_bus_trim(acpi_handle handle) 1063static int acpiphp_bus_trim(acpi_handle handle)
1069{ 1064{
@@ -1089,7 +1084,6 @@ static int acpiphp_bus_trim(acpi_handle handle)
1089 * 1084 *
1090 * This function should be called per *physical slot*, 1085 * This function should be called per *physical slot*,
1091 * not per each slot object in ACPI namespace. 1086 * not per each slot object in ACPI namespace.
1092 *
1093 */ 1087 */
1094static int enable_device(struct acpiphp_slot *slot) 1088static int enable_device(struct acpiphp_slot *slot)
1095{ 1089{
@@ -1185,6 +1179,7 @@ static void disable_bridges(struct pci_bus *bus)
1185 1179
1186/** 1180/**
1187 * disable_device - disable a slot 1181 * disable_device - disable a slot
1182 * @slot: ACPI PHP slot
1188 */ 1183 */
1189static int disable_device(struct acpiphp_slot *slot) 1184static int disable_device(struct acpiphp_slot *slot)
1190{ 1185{
@@ -1240,14 +1235,15 @@ static int disable_device(struct acpiphp_slot *slot)
1240 1235
1241/** 1236/**
1242 * get_slot_status - get ACPI slot status 1237 * get_slot_status - get ACPI slot status
1238 * @slot: ACPI PHP slot
1243 * 1239 *
1244 * if a slot has _STA for each function and if any one of them 1240 * If a slot has _STA for each function and if any one of them
1245 * returned non-zero status, return it 1241 * returned non-zero status, return it.
1246 * 1242 *
1247 * if a slot doesn't have _STA and if any one of its functions' 1243 * If a slot doesn't have _STA and if any one of its functions'
1248 * configuration space is configured, return 0x0f as a _STA 1244 * configuration space is configured, return 0x0f as a _STA.
1249 * 1245 *
1250 * otherwise return 0 1246 * Otherwise return 0.
1251 */ 1247 */
1252static unsigned int get_slot_status(struct acpiphp_slot *slot) 1248static unsigned int get_slot_status(struct acpiphp_slot *slot)
1253{ 1249{
@@ -1281,6 +1277,7 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
1281 1277
1282/** 1278/**
1283 * acpiphp_eject_slot - physically eject the slot 1279 * acpiphp_eject_slot - physically eject the slot
1280 * @slot: ACPI PHP slot
1284 */ 1281 */
1285int acpiphp_eject_slot(struct acpiphp_slot *slot) 1282int acpiphp_eject_slot(struct acpiphp_slot *slot)
1286{ 1283{
@@ -1314,6 +1311,7 @@ int acpiphp_eject_slot(struct acpiphp_slot *slot)
1314 1311
1315/** 1312/**
1316 * acpiphp_check_bridge - re-enumerate devices 1313 * acpiphp_check_bridge - re-enumerate devices
1314 * @bridge: where to begin re-enumeration
1317 * 1315 *
1318 * Iterate over all slots under this bridge and make sure that if a 1316 * Iterate over all slots under this bridge and make sure that if a
1319 * card is present they are enabled, and if not they are disabled. 1317 * card is present they are enabled, and if not they are disabled.
@@ -1538,13 +1536,11 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
1538 1536
1539/** 1537/**
1540 * handle_hotplug_event_bridge - handle ACPI event on bridges 1538 * handle_hotplug_event_bridge - handle ACPI event on bridges
1541 *
1542 * @handle: Notify()'ed acpi_handle 1539 * @handle: Notify()'ed acpi_handle
1543 * @type: Notify code 1540 * @type: Notify code
1544 * @context: pointer to acpiphp_bridge structure 1541 * @context: pointer to acpiphp_bridge structure
1545 * 1542 *
1546 * handles ACPI event notification on {host,p2p} bridges 1543 * Handles ACPI event notification on {host,p2p} bridges.
1547 *
1548 */ 1544 */
1549static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context) 1545static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context)
1550{ 1546{
@@ -1634,13 +1630,11 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
1634 1630
1635/** 1631/**
1636 * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) 1632 * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots)
1637 *
1638 * @handle: Notify()'ed acpi_handle 1633 * @handle: Notify()'ed acpi_handle
1639 * @type: Notify code 1634 * @type: Notify code
1640 * @context: pointer to acpiphp_func structure 1635 * @context: pointer to acpiphp_func structure
1641 * 1636 *
1642 * handles ACPI event notification on slots 1637 * Handles ACPI event notification on slots.
1643 *
1644 */ 1638 */
1645static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) 1639static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context)
1646{ 1640{
@@ -1705,7 +1699,6 @@ static struct acpi_pci_driver acpi_pci_hp_driver = {
1705 1699
1706/** 1700/**
1707 * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures 1701 * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures
1708 *
1709 */ 1702 */
1710int __init acpiphp_glue_init(void) 1703int __init acpiphp_glue_init(void)
1711{ 1704{
@@ -1726,7 +1719,7 @@ int __init acpiphp_glue_init(void)
1726/** 1719/**
1727 * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures 1720 * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures
1728 * 1721 *
1729 * This function frees all data allocated in acpiphp_glue_init() 1722 * This function frees all data allocated in acpiphp_glue_init().
1730 */ 1723 */
1731void acpiphp_glue_exit(void) 1724void acpiphp_glue_exit(void)
1732{ 1725{
@@ -1760,7 +1753,6 @@ int __init acpiphp_get_num_slots(void)
1760 * acpiphp_for_each_slot - call function for each slot 1753 * acpiphp_for_each_slot - call function for each slot
1761 * @fn: callback function 1754 * @fn: callback function
1762 * @data: context to be passed to callback function 1755 * @data: context to be passed to callback function
1763 *
1764 */ 1756 */
1765static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) 1757static int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
1766{ 1758{
@@ -1786,6 +1778,7 @@ static int acpiphp_for_each_slot(acpiphp_callback fn, void *data)
1786 1778
1787/** 1779/**
1788 * acpiphp_enable_slot - power on slot 1780 * acpiphp_enable_slot - power on slot
1781 * @slot: ACPI PHP slot
1789 */ 1782 */
1790int acpiphp_enable_slot(struct acpiphp_slot *slot) 1783int acpiphp_enable_slot(struct acpiphp_slot *slot)
1791{ 1784{
@@ -1815,6 +1808,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot)
1815 1808
1816/** 1809/**
1817 * acpiphp_disable_slot - power off slot 1810 * acpiphp_disable_slot - power off slot
1811 * @slot: ACPI PHP slot
1818 */ 1812 */
1819int acpiphp_disable_slot(struct acpiphp_slot *slot) 1813int acpiphp_disable_slot(struct acpiphp_slot *slot)
1820{ 1814{
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 56829f82be4a..47d26b65e99a 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -134,11 +134,11 @@ static struct acpiphp_attention_info ibm_attention_info =
134 * ibm_slot_from_id - workaround for bad ibm hardware 134 * ibm_slot_from_id - workaround for bad ibm hardware
135 * @id: the slot number that linux refers to the slot by 135 * @id: the slot number that linux refers to the slot by
136 * 136 *
137 * Description: this method returns the aCPI slot descriptor 137 * Description: This method returns the aCPI slot descriptor
138 * corresponding to the Linux slot number. This descriptor 138 * corresponding to the Linux slot number. This descriptor
139 * has info about the aPCI slot id and attention status. 139 * has info about the aPCI slot id and attention status.
140 * This descriptor must be freed using kfree when done. 140 * This descriptor must be freed using kfree when done.
141 **/ 141 */
142static union apci_descriptor *ibm_slot_from_id(int id) 142static union apci_descriptor *ibm_slot_from_id(int id)
143{ 143{
144 int ind = 0, size; 144 int ind = 0, size;
@@ -173,9 +173,9 @@ ibm_slot_done:
173 * @slot: the hotplug_slot to work with 173 * @slot: the hotplug_slot to work with
174 * @status: what to set the LED to (0 or 1) 174 * @status: what to set the LED to (0 or 1)
175 * 175 *
176 * Description: this method is registered with the acpiphp module as a 176 * Description: This method is registered with the acpiphp module as a
177 * callback to do the device specific task of setting the LED status 177 * callback to do the device specific task of setting the LED status.
178 **/ 178 */
179static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) 179static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
180{ 180{
181 union acpi_object args[2]; 181 union acpi_object args[2];
@@ -213,13 +213,13 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status)
213 * @slot: the hotplug_slot to work with 213 * @slot: the hotplug_slot to work with
214 * @status: returns what the LED is set to (0 or 1) 214 * @status: returns what the LED is set to (0 or 1)
215 * 215 *
216 * Description: this method is registered with the acpiphp module as a 216 * Description: This method is registered with the acpiphp module as a
217 * callback to do the device specific task of getting the LED status 217 * callback to do the device specific task of getting the LED status.
218 * 218 *
219 * Because there is no direct method of getting the LED status directly 219 * Because there is no direct method of getting the LED status directly
220 * from an ACPI call, we read the aPCI table and parse out our 220 * from an ACPI call, we read the aPCI table and parse out our
221 * slot descriptor to read the status from that. 221 * slot descriptor to read the status from that.
222 **/ 222 */
223static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) 223static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
224{ 224{
225 union apci_descriptor *ibm_slot; 225 union apci_descriptor *ibm_slot;
@@ -245,8 +245,8 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
245 * @event: the event info (device specific) 245 * @event: the event info (device specific)
246 * @context: passed context (our notification struct) 246 * @context: passed context (our notification struct)
247 * 247 *
248 * Description: this method is registered as a callback with the ACPI 248 * Description: This method is registered as a callback with the ACPI
249 * subsystem it is called when this device has an event to notify the OS of 249 * subsystem it is called when this device has an event to notify the OS of.
250 * 250 *
251 * The events actually come from the device as two events that get 251 * The events actually come from the device as two events that get
252 * synthesized into one event with data by this function. The event 252 * synthesized into one event with data by this function. The event
@@ -256,7 +256,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status)
256 * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will 256 * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will
257 * only re-enable the interrupt that causes this event AFTER this method 257 * only re-enable the interrupt that causes this event AFTER this method
258 * has returned, thereby enforcing serial access for the notification struct. 258 * has returned, thereby enforcing serial access for the notification struct.
259 **/ 259 */
260static void ibm_handle_events(acpi_handle handle, u32 event, void *context) 260static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
261{ 261{
262 u8 detail = event & 0x0f; 262 u8 detail = event & 0x0f;
@@ -279,16 +279,16 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
279 * ibm_get_table_from_acpi - reads the APLS buffer from ACPI 279 * ibm_get_table_from_acpi - reads the APLS buffer from ACPI
280 * @bufp: address to pointer to allocate for the table 280 * @bufp: address to pointer to allocate for the table
281 * 281 *
282 * Description: this method reads the APLS buffer in from ACPI and 282 * Description: This method reads the APLS buffer in from ACPI and
283 * stores the "stripped" table into a single buffer 283 * stores the "stripped" table into a single buffer
284 * it allocates and passes the address back in bufp 284 * it allocates and passes the address back in bufp.
285 * 285 *
286 * If NULL is passed in as buffer, this method only calculates 286 * If NULL is passed in as buffer, this method only calculates
287 * the size of the table and returns that without filling 287 * the size of the table and returns that without filling
288 * in the buffer 288 * in the buffer.
289 * 289 *
290 * returns < 0 on error or the size of the table on success 290 * Returns < 0 on error or the size of the table on success.
291 **/ 291 */
292static int ibm_get_table_from_acpi(char **bufp) 292static int ibm_get_table_from_acpi(char **bufp)
293{ 293{
294 union acpi_object *package; 294 union acpi_object *package;
@@ -349,17 +349,18 @@ read_table_done:
349/** 349/**
350 * ibm_read_apci_table - callback for the sysfs apci_table file 350 * ibm_read_apci_table - callback for the sysfs apci_table file
351 * @kobj: the kobject this binary attribute is a part of 351 * @kobj: the kobject this binary attribute is a part of
352 * @bin_attr: struct bin_attribute for this file
352 * @buffer: the kernel space buffer to fill 353 * @buffer: the kernel space buffer to fill
353 * @pos: the offset into the file 354 * @pos: the offset into the file
354 * @size: the number of bytes requested 355 * @size: the number of bytes requested
355 * 356 *
356 * Description: gets registered with sysfs as the reader callback 357 * Description: Gets registered with sysfs as the reader callback
357 * to be executed when /sys/bus/pci/slots/apci_table gets read 358 * to be executed when /sys/bus/pci/slots/apci_table gets read.
358 * 359 *
359 * Since we don't get notified on open and close for this file, 360 * Since we don't get notified on open and close for this file,
360 * things get really tricky here... 361 * things get really tricky here...
361 * our solution is to only allow reading the table in all at once 362 * our solution is to only allow reading the table in all at once.
362 **/ 363 */
363static ssize_t ibm_read_apci_table(struct kobject *kobj, 364static ssize_t ibm_read_apci_table(struct kobject *kobj,
364 struct bin_attribute *bin_attr, 365 struct bin_attribute *bin_attr,
365 char *buffer, loff_t pos, size_t size) 366 char *buffer, loff_t pos, size_t size)
@@ -385,10 +386,10 @@ static ssize_t ibm_read_apci_table(struct kobject *kobj,
385 * @context: a pointer to our handle to fill when we find the device 386 * @context: a pointer to our handle to fill when we find the device
386 * @rv: a return value to fill if desired 387 * @rv: a return value to fill if desired
387 * 388 *
388 * Description: used as a callback when calling acpi_walk_namespace 389 * Description: Used as a callback when calling acpi_walk_namespace
389 * to find our device. When this method returns non-zero 390 * to find our device. When this method returns non-zero
390 * acpi_walk_namespace quits its search and returns our value 391 * acpi_walk_namespace quits its search and returns our value.
391 **/ 392 */
392static acpi_status __init ibm_find_acpi_device(acpi_handle handle, 393static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
393 u32 lvl, void *context, void **rv) 394 u32 lvl, void *context, void **rv)
394{ 395{
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index a96b739b2d35..74178875b949 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -117,12 +117,10 @@ static inline int is_slot66mhz(struct slot *slot)
117 117
118/** 118/**
119 * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region. 119 * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region.
120 *
121 * @begin: begin pointer for region to be scanned. 120 * @begin: begin pointer for region to be scanned.
122 * @end: end pointer for region to be scanned. 121 * @end: end pointer for region to be scanned.
123 * 122 *
124 * Returns pointer to the head of the SMBIOS tables (or NULL) 123 * Returns pointer to the head of the SMBIOS tables (or %NULL).
125 *
126 */ 124 */
127static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) 125static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end)
128{ 126{
@@ -157,9 +155,9 @@ static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *e
157 155
158/** 156/**
159 * init_SERR - Initializes the per slot SERR generation. 157 * init_SERR - Initializes the per slot SERR generation.
158 * @ctrl: controller to use
160 * 159 *
161 * For unexpected switch opens 160 * For unexpected switch opens
162 *
163 */ 161 */
164static int init_SERR(struct controller * ctrl) 162static int init_SERR(struct controller * ctrl)
165{ 163{
@@ -224,14 +222,15 @@ static int pci_print_IRQ_route (void)
224 222
225/** 223/**
226 * get_subsequent_smbios_entry: get the next entry from bios table. 224 * get_subsequent_smbios_entry: get the next entry from bios table.
227 * 225 * @smbios_start: where to start in the SMBIOS table
228 * Gets the first entry if previous == NULL 226 * @smbios_table: location of the SMBIOS table
229 * Otherwise, returns the next entry
230 * Uses global SMBIOS Table pointer
231 *
232 * @curr: %NULL or pointer to previously returned structure 227 * @curr: %NULL or pointer to previously returned structure
233 * 228 *
234 * returns a pointer to an SMBIOS structure or NULL if none found 229 * Gets the first entry if previous == NULL;
230 * otherwise, returns the next entry.
231 * Uses global SMBIOS Table pointer.
232 *
233 * Returns a pointer to an SMBIOS structure or NULL if none found.
235 */ 234 */
236static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, 235static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start,
237 void __iomem *smbios_table, 236 void __iomem *smbios_table,
@@ -272,17 +271,18 @@ static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start,
272 271
273 272
274/** 273/**
275 * get_SMBIOS_entry 274 * get_SMBIOS_entry - return the requested SMBIOS entry or %NULL
276 * 275 * @smbios_start: where to start in the SMBIOS table
277 * @type:SMBIOS structure type to be returned 276 * @smbios_table: location of the SMBIOS table
277 * @type: SMBIOS structure type to be returned
278 * @previous: %NULL or pointer to previously returned structure 278 * @previous: %NULL or pointer to previously returned structure
279 * 279 *
280 * Gets the first entry of the specified type if previous == NULL 280 * Gets the first entry of the specified type if previous == %NULL;
281 * Otherwise, returns the next entry of the given type. 281 * Otherwise, returns the next entry of the given type.
282 * Uses global SMBIOS Table pointer 282 * Uses global SMBIOS Table pointer.
283 * Uses get_subsequent_smbios_entry 283 * Uses get_subsequent_smbios_entry.
284 * 284 *
285 * returns a pointer to an SMBIOS structure or %NULL if none found 285 * Returns a pointer to an SMBIOS structure or %NULL if none found.
286 */ 286 */
287static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start, 287static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start,
288 void __iomem *smbios_table, 288 void __iomem *smbios_table,
@@ -581,7 +581,9 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
581 581
582/** 582/**
583 * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off 583 * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off
584 * 584 * @ctrl: struct controller to use
585 * @func: PCI device/function info
586 * @status: LED control flag: 1 = LED on, 0 = LED off
585 */ 587 */
586static int 588static int
587cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, 589cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func,
@@ -621,7 +623,8 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func,
621 623
622/** 624/**
623 * set_attention_status - Turns the Amber LED for a slot on or off 625 * set_attention_status - Turns the Amber LED for a slot on or off
624 * 626 * @hotplug_slot: slot to change LED on
627 * @status: LED control flag
625 */ 628 */
626static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) 629static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
627{ 630{
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 856d57b4d604..4018420c6f95 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -123,7 +123,7 @@ static u8 handle_switch_change(u8 change, struct controller * ctrl)
123} 123}
124 124
125/** 125/**
126 * cpqhp_find_slot: find the struct slot of given device 126 * cpqhp_find_slot - find the struct slot of given device
127 * @ctrl: scan lots of this controller 127 * @ctrl: scan lots of this controller
128 * @device: the device id to find 128 * @device: the device id to find
129 */ 129 */
@@ -305,9 +305,8 @@ static u8 handle_power_fault(u8 change, struct controller * ctrl)
305 305
306 306
307/** 307/**
308 * sort_by_size: sort nodes on the list by their length, smallest first. 308 * sort_by_size - sort nodes on the list by their length, smallest first.
309 * @head: list to sort 309 * @head: list to sort
310 *
311 */ 310 */
312static int sort_by_size(struct pci_resource **head) 311static int sort_by_size(struct pci_resource **head)
313{ 312{
@@ -354,9 +353,8 @@ static int sort_by_size(struct pci_resource **head)
354 353
355 354
356/** 355/**
357 * sort_by_max_size: sort nodes on the list by their length, largest first. 356 * sort_by_max_size - sort nodes on the list by their length, largest first.
358 * @head: list to sort 357 * @head: list to sort
359 *
360 */ 358 */
361static int sort_by_max_size(struct pci_resource **head) 359static int sort_by_max_size(struct pci_resource **head)
362{ 360{
@@ -403,8 +401,10 @@ static int sort_by_max_size(struct pci_resource **head)
403 401
404 402
405/** 403/**
406 * do_pre_bridge_resource_split: find node of resources that are unused 404 * do_pre_bridge_resource_split - find node of resources that are unused
407 * 405 * @head: new list head
406 * @orig_head: original list head
407 * @alignment: max node size (?)
408 */ 408 */
409static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head, 409static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head,
410 struct pci_resource **orig_head, u32 alignment) 410 struct pci_resource **orig_head, u32 alignment)
@@ -477,8 +477,9 @@ static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **h
477 477
478 478
479/** 479/**
480 * do_bridge_resource_split: find one node of resources that aren't in use 480 * do_bridge_resource_split - find one node of resources that aren't in use
481 * 481 * @head: list head
482 * @alignment: max node size (?)
482 */ 483 */
483static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment) 484static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment)
484{ 485{
@@ -525,14 +526,13 @@ error:
525 526
526 527
527/** 528/**
528 * get_io_resource: find first node of given size not in ISA aliasing window. 529 * get_io_resource - find first node of given size not in ISA aliasing window.
529 * @head: list to search 530 * @head: list to search
530 * @size: size of node to find, must be a power of two. 531 * @size: size of node to find, must be a power of two.
531 * 532 *
532 * Description: this function sorts the resource list by size and then returns 533 * Description: This function sorts the resource list by size and then returns
533 * returns the first node of "size" length that is not in the ISA aliasing 534 * returns the first node of "size" length that is not in the ISA aliasing
534 * window. If it finds a node larger than "size" it will split it up. 535 * window. If it finds a node larger than "size" it will split it up.
535 *
536 */ 536 */
537static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) 537static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size)
538{ 538{
@@ -620,7 +620,7 @@ static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size
620 620
621 621
622/** 622/**
623 * get_max_resource: get largest node which has at least the given size. 623 * get_max_resource - get largest node which has at least the given size.
624 * @head: the list to search the node in 624 * @head: the list to search the node in
625 * @size: the minimum size of the node to find 625 * @size: the minimum size of the node to find
626 * 626 *
@@ -712,7 +712,7 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz
712 712
713 713
714/** 714/**
715 * get_resource: find resource of given size and split up larger ones. 715 * get_resource - find resource of given size and split up larger ones.
716 * @head: the list to search for resources 716 * @head: the list to search for resources
717 * @size: the size limit to use 717 * @size: the size limit to use
718 * 718 *
@@ -804,14 +804,14 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size)
804 804
805 805
806/** 806/**
807 * cpqhp_resource_sort_and_combine: sort nodes by base addresses and clean up. 807 * cpqhp_resource_sort_and_combine - sort nodes by base addresses and clean up
808 * @head: the list to sort and clean up 808 * @head: the list to sort and clean up
809 * 809 *
810 * Description: Sorts all of the nodes in the list in ascending order by 810 * Description: Sorts all of the nodes in the list in ascending order by
811 * their base addresses. Also does garbage collection by 811 * their base addresses. Also does garbage collection by
812 * combining adjacent nodes. 812 * combining adjacent nodes.
813 * 813 *
814 * returns 0 if success 814 * Returns %0 if success.
815 */ 815 */
816int cpqhp_resource_sort_and_combine(struct pci_resource **head) 816int cpqhp_resource_sort_and_combine(struct pci_resource **head)
817{ 817{
@@ -951,9 +951,9 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data)
951 951
952/** 952/**
953 * cpqhp_slot_create - Creates a node and adds it to the proper bus. 953 * cpqhp_slot_create - Creates a node and adds it to the proper bus.
954 * @busnumber - bus where new node is to be located 954 * @busnumber: bus where new node is to be located
955 * 955 *
956 * Returns pointer to the new node or NULL if unsuccessful 956 * Returns pointer to the new node or %NULL if unsuccessful.
957 */ 957 */
958struct pci_func *cpqhp_slot_create(u8 busnumber) 958struct pci_func *cpqhp_slot_create(u8 busnumber)
959{ 959{
@@ -986,7 +986,7 @@ struct pci_func *cpqhp_slot_create(u8 busnumber)
986 * slot_remove - Removes a node from the linked list of slots. 986 * slot_remove - Removes a node from the linked list of slots.
987 * @old_slot: slot to remove 987 * @old_slot: slot to remove
988 * 988 *
989 * Returns 0 if successful, !0 otherwise. 989 * Returns %0 if successful, !0 otherwise.
990 */ 990 */
991static int slot_remove(struct pci_func * old_slot) 991static int slot_remove(struct pci_func * old_slot)
992{ 992{
@@ -1026,7 +1026,7 @@ static int slot_remove(struct pci_func * old_slot)
1026 * bridge_slot_remove - Removes a node from the linked list of slots. 1026 * bridge_slot_remove - Removes a node from the linked list of slots.
1027 * @bridge: bridge to remove 1027 * @bridge: bridge to remove
1028 * 1028 *
1029 * Returns 0 if successful, !0 otherwise. 1029 * Returns %0 if successful, !0 otherwise.
1030 */ 1030 */
1031static int bridge_slot_remove(struct pci_func *bridge) 1031static int bridge_slot_remove(struct pci_func *bridge)
1032{ 1032{
@@ -1071,7 +1071,7 @@ out:
1071 * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed 1071 * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed
1072 * @bus: bus to find 1072 * @bus: bus to find
1073 * @device: device to find 1073 * @device: device to find
1074 * @index: is 0 for first function found, 1 for the second... 1074 * @index: is %0 for first function found, %1 for the second...
1075 * 1075 *
1076 * Returns pointer to the node if successful, %NULL otherwise. 1076 * Returns pointer to the node if successful, %NULL otherwise.
1077 */ 1077 */
@@ -1115,16 +1115,13 @@ static int is_bridge(struct pci_func * func)
1115 1115
1116 1116
1117/** 1117/**
1118 * set_controller_speed - set the frequency and/or mode of a specific 1118 * set_controller_speed - set the frequency and/or mode of a specific controller segment.
1119 * controller segment.
1120 *
1121 * @ctrl: controller to change frequency/mode for. 1119 * @ctrl: controller to change frequency/mode for.
1122 * @adapter_speed: the speed of the adapter we want to match. 1120 * @adapter_speed: the speed of the adapter we want to match.
1123 * @hp_slot: the slot number where the adapter is installed. 1121 * @hp_slot: the slot number where the adapter is installed.
1124 * 1122 *
1125 * Returns 0 if we successfully change frequency and/or mode to match the 1123 * Returns %0 if we successfully change frequency and/or mode to match the
1126 * adapter speed. 1124 * adapter speed.
1127 *
1128 */ 1125 */
1129static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot) 1126static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot)
1130{ 1127{
@@ -1253,13 +1250,14 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_
1253 1250
1254/** 1251/**
1255 * board_replaced - Called after a board has been replaced in the system. 1252 * board_replaced - Called after a board has been replaced in the system.
1253 * @func: PCI device/function information
1254 * @ctrl: hotplug controller
1256 * 1255 *
1257 * This is only used if we don't have resources for hot add 1256 * This is only used if we don't have resources for hot add.
1258 * Turns power on for the board 1257 * Turns power on for the board.
1259 * Checks to see if board is the same 1258 * Checks to see if board is the same.
1260 * If board is same, reconfigures it 1259 * If board is same, reconfigures it.
1261 * If board isn't same, turns it back off. 1260 * If board isn't same, turns it back off.
1262 *
1263 */ 1261 */
1264static u32 board_replaced(struct pci_func *func, struct controller *ctrl) 1262static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
1265{ 1263{
@@ -1403,10 +1401,11 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl)
1403 1401
1404/** 1402/**
1405 * board_added - Called after a board has been added to the system. 1403 * board_added - Called after a board has been added to the system.
1404 * @func: PCI device/function info
1405 * @ctrl: hotplug controller
1406 * 1406 *
1407 * Turns power on for the board 1407 * Turns power on for the board.
1408 * Configures board 1408 * Configures board.
1409 *
1410 */ 1409 */
1411static u32 board_added(struct pci_func *func, struct controller *ctrl) 1410static u32 board_added(struct pci_func *func, struct controller *ctrl)
1412{ 1411{
@@ -1607,8 +1606,10 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl)
1607 1606
1608 1607
1609/** 1608/**
1610 * remove_board - Turns off slot and LED's 1609 * remove_board - Turns off slot and LEDs
1611 * 1610 * @func: PCI device/function info
1611 * @replace_flag: whether replacing or adding a new device
1612 * @ctrl: target controller
1612 */ 1613 */
1613static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) 1614static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl)
1614{ 1615{
@@ -1902,11 +1903,11 @@ static void interrupt_event_handler(struct controller *ctrl)
1902 1903
1903 1904
1904/** 1905/**
1905 * cpqhp_pushbutton_thread 1906 * cpqhp_pushbutton_thread - handle pushbutton events
1907 * @slot: target slot (struct)
1906 * 1908 *
1907 * Scheduled procedure to handle blocking stuff for the pushbuttons 1909 * Scheduled procedure to handle blocking stuff for the pushbuttons.
1908 * Handles all pending events and exits. 1910 * Handles all pending events and exits.
1909 *
1910 */ 1911 */
1911void cpqhp_pushbutton_thread(unsigned long slot) 1912void cpqhp_pushbutton_thread(unsigned long slot)
1912{ 1913{
@@ -2137,9 +2138,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func)
2137} 2138}
2138 2139
2139/** 2140/**
2140 * switch_leds: switch the leds, go from one site to the other. 2141 * switch_leds - switch the leds, go from one site to the other.
2141 * @ctrl: controller to use 2142 * @ctrl: controller to use
2142 * @num_of_slots: number of slots to use 2143 * @num_of_slots: number of slots to use
2144 * @work_LED: LED control value
2143 * @direction: 1 to start from the left side, 0 to start right. 2145 * @direction: 1 to start from the left side, 0 to start right.
2144 */ 2146 */
2145static void switch_leds(struct controller *ctrl, const int num_of_slots, 2147static void switch_leds(struct controller *ctrl, const int num_of_slots,
@@ -2165,11 +2167,11 @@ static void switch_leds(struct controller *ctrl, const int num_of_slots,
2165} 2167}
2166 2168
2167/** 2169/**
2168 * hardware_test - runs hardware tests 2170 * cpqhp_hardware_test - runs hardware tests
2171 * @ctrl: target controller
2172 * @test_num: the number written to the "test" file in sysfs.
2169 * 2173 *
2170 * For hot plug ctrl folks to play with. 2174 * For hot plug ctrl folks to play with.
2171 * test_num is the number written to the "test" file in sysfs
2172 *
2173 */ 2175 */
2174int cpqhp_hardware_test(struct controller *ctrl, int test_num) 2176int cpqhp_hardware_test(struct controller *ctrl, int test_num)
2175{ 2177{
@@ -2249,14 +2251,12 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num)
2249 2251
2250/** 2252/**
2251 * configure_new_device - Configures the PCI header information of one board. 2253 * configure_new_device - Configures the PCI header information of one board.
2252 *
2253 * @ctrl: pointer to controller structure 2254 * @ctrl: pointer to controller structure
2254 * @func: pointer to function structure 2255 * @func: pointer to function structure
2255 * @behind_bridge: 1 if this is a recursive call, 0 if not 2256 * @behind_bridge: 1 if this is a recursive call, 0 if not
2256 * @resources: pointer to set of resource lists 2257 * @resources: pointer to set of resource lists
2257 * 2258 *
2258 * Returns 0 if success 2259 * Returns 0 if success.
2259 *
2260 */ 2260 */
2261static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, 2261static u32 configure_new_device(struct controller * ctrl, struct pci_func * func,
2262 u8 behind_bridge, struct resource_lists * resources) 2262 u8 behind_bridge, struct resource_lists * resources)
@@ -2346,15 +2346,13 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func
2346 2346
2347/** 2347/**
2348 * configure_new_function - Configures the PCI header information of one device 2348 * configure_new_function - Configures the PCI header information of one device
2349 *
2350 * @ctrl: pointer to controller structure 2349 * @ctrl: pointer to controller structure
2351 * @func: pointer to function structure 2350 * @func: pointer to function structure
2352 * @behind_bridge: 1 if this is a recursive call, 0 if not 2351 * @behind_bridge: 1 if this is a recursive call, 0 if not
2353 * @resources: pointer to set of resource lists 2352 * @resources: pointer to set of resource lists
2354 * 2353 *
2355 * Calls itself recursively for bridged devices. 2354 * Calls itself recursively for bridged devices.
2356 * Returns 0 if success 2355 * Returns 0 if success.
2357 *
2358 */ 2356 */
2359static int configure_new_function(struct controller *ctrl, struct pci_func *func, 2357static int configure_new_function(struct controller *ctrl, struct pci_func *func,
2360 u8 behind_bridge, 2358 u8 behind_bridge,
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 027f6865d7e3..d7a293e3faf5 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -165,11 +165,11 @@ static void remove_slot(struct dummy_slot *dslot)
165} 165}
166 166
167/** 167/**
168 * Rescan slot. 168 * pci_rescan_slot - Rescan slot
169 * Tries hard not to re-enable already existing devices 169 * @temp: Device template. Should be set: bus and devfn.
170 * also handles scanning of subfunctions
171 * 170 *
172 * @param temp Device template. Should be set: bus and devfn. 171 * Tries hard not to re-enable already existing devices;
172 * also handles scanning of subfunctions.
173 */ 173 */
174static void pci_rescan_slot(struct pci_dev *temp) 174static void pci_rescan_slot(struct pci_dev *temp)
175{ 175{
@@ -229,10 +229,10 @@ static void pci_rescan_slot(struct pci_dev *temp)
229 229
230 230
231/** 231/**
232 * Rescan PCI bus. 232 * pci_rescan_bus - Rescan PCI bus
233 * call pci_rescan_slot for each possible function of the bus 233 * @bus: the PCI bus to rescan
234 * 234 *
235 * @param bus 235 * Call pci_rescan_slot for each possible function of the bus.
236 */ 236 */
237static void pci_rescan_bus(const struct pci_bus *bus) 237static void pci_rescan_bus(const struct pci_bus *bus)
238{ 238{
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index c8cb49c5a752..f1e0966cee95 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -208,10 +208,10 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
208 208
209/** 209/**
210 * board_added - Called after a board has been added to the system. 210 * board_added - Called after a board has been added to the system.
211 * @p_slot: &slot where board is added
211 * 212 *
212 * Turns power on for the board 213 * Turns power on for the board.
213 * Configures board 214 * Configures board.
214 *
215 */ 215 */
216static int board_added(struct slot *p_slot) 216static int board_added(struct slot *p_slot)
217{ 217{
@@ -276,8 +276,8 @@ err_exit:
276} 276}
277 277
278/** 278/**
279 * remove_board - Turns off slot and LED's 279 * remove_board - Turns off slot and LEDs
280 * 280 * @p_slot: slot where board is being removed
281 */ 281 */
282static int remove_board(struct slot *p_slot) 282static int remove_board(struct slot *p_slot)
283{ 283{
@@ -319,11 +319,11 @@ struct power_work_info {
319}; 319};
320 320
321/** 321/**
322 * pciehp_pushbutton_thread 322 * pciehp_power_thread - handle pushbutton events
323 * @work: &struct work_struct describing work to be done
323 * 324 *
324 * Scheduled procedure to handle blocking stuff for the pushbuttons 325 * Scheduled procedure to handle blocking stuff for the pushbuttons.
325 * Handles all pending events and exits. 326 * Handles all pending events and exits.
326 *
327 */ 327 */
328static void pciehp_power_thread(struct work_struct *work) 328static void pciehp_power_thread(struct work_struct *work)
329{ 329{
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index deb6b5e35feb..b169b0e2647f 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -100,6 +100,7 @@ static struct device_node *find_dlpar_node(char *drc_name, int *node_type)
100 100
101/** 101/**
102 * find_php_slot - return hotplug slot structure for device node 102 * find_php_slot - return hotplug slot structure for device node
103 * @dn: target &device_node
103 * 104 *
104 * This routine will return the hotplug slot structure 105 * This routine will return the hotplug slot structure
105 * for a given device node. Note that built-in PCI slots 106 * for a given device node. Note that built-in PCI slots
@@ -293,9 +294,8 @@ static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn)
293 * dlpar_add_slot - DLPAR add an I/O Slot 294 * dlpar_add_slot - DLPAR add an I/O Slot
294 * @drc_name: drc-name of newly added slot 295 * @drc_name: drc-name of newly added slot
295 * 296 *
296 * Make the hotplug module and the kernel aware 297 * Make the hotplug module and the kernel aware of a newly added I/O Slot.
297 * of a newly added I/O Slot. 298 * Return Codes:
298 * Return Codes -
299 * 0 Success 299 * 0 Success
300 * -ENODEV Not a valid drc_name 300 * -ENODEV Not a valid drc_name
301 * -EINVAL Slot already added 301 * -EINVAL Slot already added
@@ -339,9 +339,9 @@ exit:
339/** 339/**
340 * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot 340 * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot
341 * @drc_name: drc-name of newly added slot 341 * @drc_name: drc-name of newly added slot
342 * @dn: &device_node
342 * 343 *
343 * Remove the kernel and hotplug representations 344 * Remove the kernel and hotplug representations of an I/O Slot.
344 * of an I/O Slot.
345 * Return Codes: 345 * Return Codes:
346 * 0 Success 346 * 0 Success
347 * -EINVAL Vio dev doesn't exist 347 * -EINVAL Vio dev doesn't exist
@@ -359,11 +359,11 @@ static int dlpar_remove_vio_slot(char *drc_name, struct device_node *dn)
359} 359}
360 360
361/** 361/**
362 * dlpar_remove_slot - DLPAR remove a PCI I/O Slot 362 * dlpar_remove_pci_slot - DLPAR remove a PCI I/O Slot
363 * @drc_name: drc-name of newly added slot 363 * @drc_name: drc-name of newly added slot
364 * @dn: &device_node
364 * 365 *
365 * Remove the kernel and hotplug representations 366 * Remove the kernel and hotplug representations of a PCI I/O Slot.
366 * of a PCI I/O Slot.
367 * Return Codes: 367 * Return Codes:
368 * 0 Success 368 * 0 Success
369 * -ENODEV Not a valid drc_name 369 * -ENODEV Not a valid drc_name
@@ -405,8 +405,7 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn)
405 * dlpar_remove_slot - DLPAR remove an I/O Slot 405 * dlpar_remove_slot - DLPAR remove an I/O Slot
406 * @drc_name: drc-name of newly added slot 406 * @drc_name: drc-name of newly added slot
407 * 407 *
408 * Remove the kernel and hotplug representations 408 * Remove the kernel and hotplug representations of an I/O Slot.
409 * of an I/O Slot.
410 * Return Codes: 409 * Return Codes:
411 * 0 Success 410 * 0 Success
412 * -ENODEV Not a valid drc_name 411 * -ENODEV Not a valid drc_name
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 458c08ef2654..58f1a9927709 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -54,10 +54,12 @@ module_param(debug, bool, 0644);
54 54
55/** 55/**
56 * set_attention_status - set attention LED 56 * set_attention_status - set attention LED
57 * @hotplug_slot: target &hotplug_slot
58 * @value: LED control value
59 *
57 * echo 0 > attention -- set LED OFF 60 * echo 0 > attention -- set LED OFF
58 * echo 1 > attention -- set LED ON 61 * echo 1 > attention -- set LED ON
59 * echo 2 > attention -- set LED ID(identify, light is blinking) 62 * echo 2 > attention -- set LED ID(identify, light is blinking)
60 *
61 */ 63 */
62static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) 64static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
63{ 65{
@@ -99,6 +101,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value)
99 101
100/** 102/**
101 * get_attention_status - get attention LED status 103 * get_attention_status - get attention LED status
104 * @hotplug_slot: slot to get status
105 * @value: pointer to store status
102 */ 106 */
103static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) 107static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value)
104{ 108{
@@ -254,6 +258,11 @@ static int is_php_type(char *drc_type)
254 258
255/** 259/**
256 * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 260 * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0
261 * @dn: target &device_node
262 * @indexes: passed to get_children_props()
263 * @names: passed to get_children_props()
264 * @types: returned from get_children_props()
265 * @power_domains:
257 * 266 *
258 * This routine will return true only if the device node is 267 * This routine will return true only if the device node is
259 * a hotpluggable slot. This routine will return false 268 * a hotpluggable slot. This routine will return false
@@ -279,7 +288,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes,
279 288
280/** 289/**
281 * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. 290 * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem.
282 * @dn device node of slot 291 * @dn: device node of slot
283 * 292 *
284 * This subroutine will register a hotplugable slot with the 293 * This subroutine will register a hotplugable slot with the
285 * PCI hotplug infrastructure. This routine is typicaly called 294 * PCI hotplug infrastructure. This routine is typicaly called
@@ -291,7 +300,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes,
291 * routine will just return without doing anything, since embedded 300 * routine will just return without doing anything, since embedded
292 * slots cannot be hotplugged. 301 * slots cannot be hotplugged.
293 * 302 *
294 * To remove a slot, it suffices to call rpaphp_deregister_slot() 303 * To remove a slot, it suffices to call rpaphp_deregister_slot().
295 */ 304 */
296int rpaphp_add_slot(struct device_node *dn) 305int rpaphp_add_slot(struct device_node *dn)
297{ 306{
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 54ca8650d511..0de84533cd80 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -79,6 +79,7 @@ static void set_slot_name(struct slot *slot)
79 79
80/** 80/**
81 * rpaphp_enable_slot - record slot state, config pci device 81 * rpaphp_enable_slot - record slot state, config pci device
82 * @slot: target &slot
82 * 83 *
83 * Initialize values in the slot, and the hotplug_slot info 84 * Initialize values in the slot, and the hotplug_slot info
84 * structures to indicate if there is a pci card plugged into 85 * structures to indicate if there is a pci card plugged into
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index d2fc35598cdd..eb5cac6f08ae 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -231,10 +231,10 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot,
231 231
232/** 232/**
233 * board_added - Called after a board has been added to the system. 233 * board_added - Called after a board has been added to the system.
234 * @p_slot: target &slot
234 * 235 *
235 * Turns power on for the board 236 * Turns power on for the board.
236 * Configures board 237 * Configures board.
237 *
238 */ 238 */
239static int board_added(struct slot *p_slot) 239static int board_added(struct slot *p_slot)
240{ 240{
@@ -350,8 +350,8 @@ err_exit:
350 350
351 351
352/** 352/**
353 * remove_board - Turns off slot and LED's 353 * remove_board - Turns off slot and LEDs
354 * 354 * @p_slot: target &slot
355 */ 355 */
356static int remove_board(struct slot *p_slot) 356static int remove_board(struct slot *p_slot)
357{ 357{
@@ -397,11 +397,11 @@ struct pushbutton_work_info {
397}; 397};
398 398
399/** 399/**
400 * shpchp_pushbutton_thread 400 * shpchp_pushbutton_thread - handle pushbutton events
401 * @work: &struct work_struct to be handled
401 * 402 *
402 * Scheduled procedure to handle blocking stuff for the pushbuttons 403 * Scheduled procedure to handle blocking stuff for the pushbuttons.
403 * Handles all pending events and exits. 404 * Handles all pending events and exits.
404 *
405 */ 405 */
406static void shpchp_pushbutton_thread(struct work_struct *work) 406static void shpchp_pushbutton_thread(struct work_struct *work)
407{ 407{
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 1b7b2812bf2d..7d1877341aad 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -702,8 +702,10 @@ static int __init pci_sysfs_init(void)
702 sysfs_initialized = 1; 702 sysfs_initialized = 1;
703 for_each_pci_dev(pdev) { 703 for_each_pci_dev(pdev) {
704 retval = pci_create_sysfs_dev_files(pdev); 704 retval = pci_create_sysfs_dev_files(pdev);
705 if (retval) 705 if (retval) {
706 pci_dev_put(pdev);
706 return retval; 707 return retval;
708 }
707 } 709 }
708 710
709 return 0; 711 return 0;
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 92a8469b21ba..3c0d8d138f5a 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -168,11 +168,11 @@ static int find_device_iter(struct device *device, void *data)
168 168
169/** 169/**
170 * find_source_device - search through device hierarchy for source device 170 * find_source_device - search through device hierarchy for source device
171 * @p_dev: pointer to Root Port pci_dev data structure 171 * @parent: pointer to Root Port pci_dev data structure
172 * @id: device ID of agent who sends an error message to this Root Port 172 * @id: device ID of agent who sends an error message to this Root Port
173 * 173 *
174 * Invoked when error is detected at the Root Port. 174 * Invoked when error is detected at the Root Port.
175 **/ 175 */
176static struct device* find_source_device(struct pci_dev *parent, u16 id) 176static struct device* find_source_device(struct pci_dev *parent, u16 id)
177{ 177{
178 struct pci_dev *dev = parent; 178 struct pci_dev *dev = parent;
@@ -286,14 +286,15 @@ static void report_resume(struct pci_dev *dev, void *data)
286 286
287/** 287/**
288 * broadcast_error_message - handle message broadcast to downstream drivers 288 * broadcast_error_message - handle message broadcast to downstream drivers
289 * @device: pointer to from where in a hierarchy message is broadcasted down 289 * @dev: pointer to from where in a hierarchy message is broadcasted down
290 * @api: callback to be broadcasted
291 * @state: error state 290 * @state: error state
291 * @error_mesg: message to print
292 * @cb: callback to be broadcasted
292 * 293 *
293 * Invoked during error recovery process. Once being invoked, the content 294 * Invoked during error recovery process. Once being invoked, the content
294 * of error severity will be broadcasted to all downstream drivers in a 295 * of error severity will be broadcasted to all downstream drivers in a
295 * hierarchy in question. 296 * hierarchy in question.
296 **/ 297 */
297static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, 298static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,
298 enum pci_channel_state state, 299 enum pci_channel_state state,
299 char *error_mesg, 300 char *error_mesg,
@@ -428,7 +429,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev,
428 * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast 429 * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast
429 * error detected message to all downstream drivers within a hierarchy in 430 * error detected message to all downstream drivers within a hierarchy in
430 * question and return the returned code. 431 * question and return the returned code.
431 **/ 432 */
432static pci_ers_result_t do_recovery(struct pcie_device *aerdev, 433static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
433 struct pci_dev *dev, 434 struct pci_dev *dev,
434 int severity) 435 int severity)
@@ -488,7 +489,7 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev,
488 * @info: comprehensive error information 489 * @info: comprehensive error information
489 * 490 *
490 * Invoked when an error being detected by Root Port. 491 * Invoked when an error being detected by Root Port.
491 **/ 492 */
492static void handle_error_source(struct pcie_device * aerdev, 493static void handle_error_source(struct pcie_device * aerdev,
493 struct pci_dev *dev, 494 struct pci_dev *dev,
494 struct aer_err_info info) 495 struct aer_err_info info)
@@ -521,7 +522,7 @@ static void handle_error_source(struct pcie_device * aerdev,
521 * @rpc: pointer to a Root Port data structure 522 * @rpc: pointer to a Root Port data structure
522 * 523 *
523 * Invoked when PCIE bus loads AER service driver. 524 * Invoked when PCIE bus loads AER service driver.
524 **/ 525 */
525void aer_enable_rootport(struct aer_rpc *rpc) 526void aer_enable_rootport(struct aer_rpc *rpc)
526{ 527{
527 struct pci_dev *pdev = rpc->rpd->port; 528 struct pci_dev *pdev = rpc->rpd->port;
@@ -569,7 +570,7 @@ void aer_enable_rootport(struct aer_rpc *rpc)
569 * @rpc: pointer to a Root Port data structure 570 * @rpc: pointer to a Root Port data structure
570 * 571 *
571 * Invoked when PCIE bus unloads AER service driver. 572 * Invoked when PCIE bus unloads AER service driver.
572 **/ 573 */
573static void disable_root_aer(struct aer_rpc *rpc) 574static void disable_root_aer(struct aer_rpc *rpc)
574{ 575{
575 struct pci_dev *pdev = rpc->rpd->port; 576 struct pci_dev *pdev = rpc->rpd->port;
@@ -590,7 +591,7 @@ static void disable_root_aer(struct aer_rpc *rpc)
590 * @rpc: pointer to the root port which holds an error 591 * @rpc: pointer to the root port which holds an error
591 * 592 *
592 * Invoked by DPC handler to consume an error. 593 * Invoked by DPC handler to consume an error.
593 **/ 594 */
594static struct aer_err_source* get_e_source(struct aer_rpc *rpc) 595static struct aer_err_source* get_e_source(struct aer_rpc *rpc)
595{ 596{
596 struct aer_err_source *e_source; 597 struct aer_err_source *e_source;
@@ -655,7 +656,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
655 * aer_isr_one_error - consume an error detected by root port 656 * aer_isr_one_error - consume an error detected by root port
656 * @p_device: pointer to error root port service device 657 * @p_device: pointer to error root port service device
657 * @e_src: pointer to an error source 658 * @e_src: pointer to an error source
658 **/ 659 */
659static void aer_isr_one_error(struct pcie_device *p_device, 660static void aer_isr_one_error(struct pcie_device *p_device,
660 struct aer_err_source *e_src) 661 struct aer_err_source *e_src)
661{ 662{
@@ -706,7 +707,7 @@ static void aer_isr_one_error(struct pcie_device *p_device,
706 * @work: definition of this work item 707 * @work: definition of this work item
707 * 708 *
708 * Invoked, as DPC, when root port records new detected error 709 * Invoked, as DPC, when root port records new detected error
709 **/ 710 */
710void aer_isr(struct work_struct *work) 711void aer_isr(struct work_struct *work)
711{ 712{
712 struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler); 713 struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler);
@@ -729,7 +730,7 @@ void aer_isr(struct work_struct *work)
729 * @rpc: pointer to a root port device being deleted 730 * @rpc: pointer to a root port device being deleted
730 * 731 *
731 * Invoked when AER service unloaded on a specific Root Port 732 * Invoked when AER service unloaded on a specific Root Port
732 **/ 733 */
733void aer_delete_rootport(struct aer_rpc *rpc) 734void aer_delete_rootport(struct aer_rpc *rpc)
734{ 735{
735 /* Disable root port AER itself */ 736 /* Disable root port AER itself */
@@ -743,7 +744,7 @@ void aer_delete_rootport(struct aer_rpc *rpc)
743 * @dev: pointer to AER pcie device 744 * @dev: pointer to AER pcie device
744 * 745 *
745 * Invoked when AER service driver is loaded. 746 * Invoked when AER service driver is loaded.
746 **/ 747 */
747int aer_init(struct pcie_device *dev) 748int aer_init(struct pcie_device *dev)
748{ 749{
749 if (aer_osc_setup(dev) && !forceload) 750 if (aer_osc_setup(dev) && !forceload)
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index df383645e366..26057f98f72e 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -217,7 +217,7 @@ static int slot_reset_iter(struct device *device, void *data)
217 217
218static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) 218static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev)
219{ 219{
220 pci_ers_result_t status; 220 pci_ers_result_t status = PCI_ERS_RESULT_NONE;
221 int retval; 221 int retval;
222 222
223 /* If fatal, restore cfg space for possible link reset at upstream */ 223 /* If fatal, restore cfg space for possible link reset at upstream */
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 11adab13f2b7..3c5eb374adf8 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -83,9 +83,11 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
83 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && 83 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
84 i < PNP_MAX_IRQ) 84 i < PNP_MAX_IRQ)
85 i++; 85 i++;
86 if (i >= PNP_MAX_IRQ) 86 if (i >= PNP_MAX_IRQ) {
87 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
88 "resources: %d \n", PNP_MAX_IRQ);
87 return; 89 return;
88 90 }
89 /* 91 /*
90 * in IO-APIC mode, use overrided attribute. Two reasons: 92 * in IO-APIC mode, use overrided attribute. Two reasons:
91 * 1. BIOS bug in DSDT 93 * 1. BIOS bug in DSDT
@@ -181,6 +183,9 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
181 } 183 }
182 res->dma_resource[i].start = dma; 184 res->dma_resource[i].start = dma;
183 res->dma_resource[i].end = dma; 185 res->dma_resource[i].end = dma;
186 } else {
187 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
188 "resources: %d \n", PNP_MAX_DMA);
184 } 189 }
185} 190}
186 191
@@ -202,6 +207,9 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
202 } 207 }
203 res->port_resource[i].start = io; 208 res->port_resource[i].start = io;
204 res->port_resource[i].end = io + len - 1; 209 res->port_resource[i].end = io + len - 1;
210 } else {
211 printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
212 "resources: %d \n", PNP_MAX_PORT);
205 } 213 }
206} 214}
207 215
@@ -225,6 +233,9 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
225 233
226 res->mem_resource[i].start = mem; 234 res->mem_resource[i].start = mem;
227 res->mem_resource[i].end = mem + len - 1; 235 res->mem_resource[i].end = mem + len - 1;
236 } else {
237 printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
238 "resources: %d\n", PNP_MAX_MEM);
228 } 239 }
229} 240}
230 241
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 41d73a5e9312..e50ebcffb962 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -367,8 +367,10 @@ int pnp_check_irq(struct pnp_dev *dev, int idx)
367 { 367 {
368 struct pci_dev *pci = NULL; 368 struct pci_dev *pci = NULL;
369 for_each_pci_dev(pci) { 369 for_each_pci_dev(pci) {
370 if (pci->irq == *irq) 370 if (pci->irq == *irq) {
371 pci_dev_put(pci);
371 return 0; 372 return 0;
373 }
372 } 374 }
373 } 375 }
374#endif 376#endif
diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile
index 746031de2195..1f5a2d33bf5b 100644
--- a/drivers/ps3/Makefile
+++ b/drivers/ps3/Makefile
@@ -1,6 +1,6 @@
1obj-$(CONFIG_PS3_VUART) += vuart.o 1obj-$(CONFIG_PS3_VUART) += ps3-vuart.o
2obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o 2obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o
3ps3av_mod-objs += ps3av.o ps3av_cmd.o 3ps3av_mod-objs += ps3av.o ps3av_cmd.o
4obj-$(CONFIG_PPC_PS3) += sys-manager-core.o 4obj-$(CONFIG_PPC_PS3) += sys-manager-core.o
5obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o 5obj-$(CONFIG_PS3_SYS_MANAGER) += ps3-sys-manager.o
6obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o 6obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o
diff --git a/drivers/ps3/sys-manager.c b/drivers/ps3/ps3-sys-manager.c
index 8461b08ab9fb..8461b08ab9fb 100644
--- a/drivers/ps3/sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/ps3-vuart.c
index 9dea585ef806..9dea585ef806 100644
--- a/drivers/ps3/vuart.c
+++ b/drivers/ps3/ps3-vuart.c
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index de0da545c7a1..a4f56e95cf96 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -293,7 +293,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
293 return -EINVAL; 293 return -EINVAL;
294 294
295 /* Cannot register while the char dev is in use */ 295 /* Cannot register while the char dev is in use */
296 if (!(mutex_trylock(&rtc->char_lock))) 296 if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags))
297 return -EBUSY; 297 return -EBUSY;
298 298
299 spin_lock_irq(&rtc->irq_task_lock); 299 spin_lock_irq(&rtc->irq_task_lock);
@@ -303,7 +303,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
303 } 303 }
304 spin_unlock_irq(&rtc->irq_task_lock); 304 spin_unlock_irq(&rtc->irq_task_lock);
305 305
306 mutex_unlock(&rtc->char_lock); 306 clear_bit(RTC_DEV_BUSY, &rtc->flags);
307 307
308 return retval; 308 return retval;
309} 309}
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 814583bd2fe7..ae1bf177d625 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -26,10 +26,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
26 struct rtc_device, char_dev); 26 struct rtc_device, char_dev);
27 const struct rtc_class_ops *ops = rtc->ops; 27 const struct rtc_class_ops *ops = rtc->ops;
28 28
29 /* We keep the lock as long as the device is in use 29 if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags))
30 * and return immediately if busy
31 */
32 if (!(mutex_trylock(&rtc->char_lock)))
33 return -EBUSY; 30 return -EBUSY;
34 31
35 file->private_data = rtc; 32 file->private_data = rtc;
@@ -43,8 +40,8 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
43 return 0; 40 return 0;
44 } 41 }
45 42
46 /* something has gone wrong, release the lock */ 43 /* something has gone wrong */
47 mutex_unlock(&rtc->char_lock); 44 clear_bit(RTC_DEV_BUSY, &rtc->flags);
48 return err; 45 return err;
49} 46}
50 47
@@ -405,7 +402,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
405 if (rtc->ops->release) 402 if (rtc->ops->release)
406 rtc->ops->release(rtc->dev.parent); 403 rtc->ops->release(rtc->dev.parent);
407 404
408 mutex_unlock(&rtc->char_lock); 405 clear_bit(RTC_DEV_BUSY, &rtc->flags);
409 return 0; 406 return 0;
410} 407}
411 408
@@ -440,7 +437,6 @@ void rtc_dev_prepare(struct rtc_device *rtc)
440 437
441 rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); 438 rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id);
442 439
443 mutex_init(&rtc->char_lock);
444#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 440#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
445 INIT_WORK(&rtc->uie_task, rtc_uie_task); 441 INIT_WORK(&rtc->uie_task, rtc_uie_task);
446 setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc); 442 setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc);
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index ac67394c7373..64d40a2d4d4d 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -13,7 +13,10 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/zorro.h> 15#include <linux/zorro.h>
16
17#include <asm/amigahw.h>
16#include <asm/amigaints.h> 18#include <asm/amigaints.h>
19
17#include <scsi/scsi_host.h> 20#include <scsi/scsi_host.h>
18#include <scsi/scsi_transport_spi.h> 21#include <scsi/scsi_transport_spi.h>
19 22
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index f3257f708ef9..9c95bc0398ad 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -45,8 +45,6 @@
45 45
46#include "ip22zilog.h" 46#include "ip22zilog.h"
47 47
48void ip22_do_break(void);
49
50/* 48/*
51 * On IP22 we need to delay after register accesses but we do not need to 49 * On IP22 we need to delay after register accesses but we do not need to
52 * flush writes. 50 * flush writes.
@@ -81,12 +79,9 @@ struct uart_ip22zilog_port {
81#define IP22ZILOG_FLAG_REGS_HELD 0x00000040 79#define IP22ZILOG_FLAG_REGS_HELD 0x00000040
82#define IP22ZILOG_FLAG_TX_STOPPED 0x00000080 80#define IP22ZILOG_FLAG_TX_STOPPED 0x00000080
83#define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100 81#define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100
82#define IP22ZILOG_FLAG_RESET_DONE 0x00000200
84 83
85 unsigned int cflag; 84 unsigned int tty_break;
86
87 /* L1-A keyboard break state. */
88 int kbd_id;
89 int l1_down;
90 85
91 unsigned char parity_mask; 86 unsigned char parity_mask;
92 unsigned char prev_status; 87 unsigned char prev_status;
@@ -250,13 +245,26 @@ static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up,
250 } 245 }
251} 246}
252 247
253static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, 248#define Rx_BRK 0x0100 /* BREAK event software flag. */
254 struct zilog_channel *channel) 249#define Rx_SYS 0x0200 /* SysRq event software flag. */
250
251static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
252 struct zilog_channel *channel)
255{ 253{
256 struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */ 254 struct tty_struct *tty;
255 unsigned char ch, flag;
256 unsigned int r1;
257
258 tty = NULL;
259 if (up->port.info != NULL &&
260 up->port.info->tty != NULL)
261 tty = up->port.info->tty;
257 262
258 while (1) { 263 for (;;) {
259 unsigned char ch, r1, flag; 264 ch = readb(&channel->control);
265 ZSDELAY();
266 if (!(ch & Rx_CH_AV))
267 break;
260 268
261 r1 = read_zsreg(channel, R1); 269 r1 = read_zsreg(channel, R1);
262 if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { 270 if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
@@ -265,43 +273,26 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
265 ZS_WSYNC(channel); 273 ZS_WSYNC(channel);
266 } 274 }
267 275
268 ch = readb(&channel->control);
269 ZSDELAY();
270
271 /* This funny hack depends upon BRK_ABRT not interfering
272 * with the other bits we care about in R1.
273 */
274 if (ch & BRK_ABRT)
275 r1 |= BRK_ABRT;
276
277 ch = readb(&channel->data); 276 ch = readb(&channel->data);
278 ZSDELAY(); 277 ZSDELAY();
279 278
280 ch &= up->parity_mask; 279 ch &= up->parity_mask;
281 280
282 if (ZS_IS_CONS(up) && (r1 & BRK_ABRT)) { 281 /* Handle the null char got when BREAK is removed. */
283 /* Wait for BREAK to deassert to avoid potentially 282 if (!ch)
284 * confusing the PROM. 283 r1 |= up->tty_break;
285 */
286 while (1) {
287 ch = readb(&channel->control);
288 ZSDELAY();
289 if (!(ch & BRK_ABRT))
290 break;
291 }
292 ip22_do_break();
293 return;
294 }
295 284
296 /* A real serial line, record the character and status. */ 285 /* A real serial line, record the character and status. */
297 flag = TTY_NORMAL; 286 flag = TTY_NORMAL;
298 up->port.icount.rx++; 287 up->port.icount.rx++;
299 if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { 288 if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | Rx_SYS | Rx_BRK)) {
300 if (r1 & BRK_ABRT) { 289 up->tty_break = 0;
301 r1 &= ~(PAR_ERR | CRC_ERR); 290
291 if (r1 & (Rx_SYS | Rx_BRK)) {
302 up->port.icount.brk++; 292 up->port.icount.brk++;
303 if (uart_handle_break(&up->port)) 293 if (r1 & Rx_SYS)
304 goto next_char; 294 continue;
295 r1 &= ~(PAR_ERR | CRC_ERR);
305 } 296 }
306 else if (r1 & PAR_ERR) 297 else if (r1 & PAR_ERR)
307 up->port.icount.parity++; 298 up->port.icount.parity++;
@@ -310,30 +301,21 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up,
310 if (r1 & Rx_OVR) 301 if (r1 & Rx_OVR)
311 up->port.icount.overrun++; 302 up->port.icount.overrun++;
312 r1 &= up->port.read_status_mask; 303 r1 &= up->port.read_status_mask;
313 if (r1 & BRK_ABRT) 304 if (r1 & Rx_BRK)
314 flag = TTY_BREAK; 305 flag = TTY_BREAK;
315 else if (r1 & PAR_ERR) 306 else if (r1 & PAR_ERR)
316 flag = TTY_PARITY; 307 flag = TTY_PARITY;
317 else if (r1 & CRC_ERR) 308 else if (r1 & CRC_ERR)
318 flag = TTY_FRAME; 309 flag = TTY_FRAME;
319 } 310 }
320 if (uart_handle_sysrq_char(&up->port, ch))
321 goto next_char;
322 311
323 if (up->port.ignore_status_mask == 0xff || 312 if (uart_handle_sysrq_char(&up->port, ch))
324 (r1 & up->port.ignore_status_mask) == 0) 313 continue;
325 tty_insert_flip_char(tty, ch, flag);
326 314
327 if (r1 & Rx_OVR) 315 if (tty)
328 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 316 uart_insert_char(&up->port, r1, Rx_OVR, ch, flag);
329 next_char:
330 ch = readb(&channel->control);
331 ZSDELAY();
332 if (!(ch & Rx_CH_AV))
333 break;
334 } 317 }
335 318 return tty;
336 tty_flip_buffer_push(tty);
337} 319}
338 320
339static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, 321static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
@@ -348,6 +330,15 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
348 ZSDELAY(); 330 ZSDELAY();
349 ZS_WSYNC(channel); 331 ZS_WSYNC(channel);
350 332
333 if (up->curregs[R15] & BRKIE) {
334 if ((status & BRK_ABRT) && !(up->prev_status & BRK_ABRT)) {
335 if (uart_handle_break(&up->port))
336 up->tty_break = Rx_SYS;
337 else
338 up->tty_break = Rx_BRK;
339 }
340 }
341
351 if (ZS_WANTS_MODEM_STATUS(up)) { 342 if (ZS_WANTS_MODEM_STATUS(up)) {
352 if (status & SYNC) 343 if (status & SYNC)
353 up->port.icount.dsr++; 344 up->port.icount.dsr++;
@@ -356,10 +347,10 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up,
356 * But it does not tell us which bit has changed, we have to keep 347 * But it does not tell us which bit has changed, we have to keep
357 * track of this ourselves. 348 * track of this ourselves.
358 */ 349 */
359 if ((status & DCD) ^ up->prev_status) 350 if ((status ^ up->prev_status) ^ DCD)
360 uart_handle_dcd_change(&up->port, 351 uart_handle_dcd_change(&up->port,
361 (status & DCD)); 352 (status & DCD));
362 if ((status & CTS) ^ up->prev_status) 353 if ((status ^ up->prev_status) ^ CTS)
363 uart_handle_cts_change(&up->port, 354 uart_handle_cts_change(&up->port,
364 (status & CTS)); 355 (status & CTS));
365 356
@@ -447,19 +438,21 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
447 while (up) { 438 while (up) {
448 struct zilog_channel *channel 439 struct zilog_channel *channel
449 = ZILOG_CHANNEL_FROM_PORT(&up->port); 440 = ZILOG_CHANNEL_FROM_PORT(&up->port);
441 struct tty_struct *tty;
450 unsigned char r3; 442 unsigned char r3;
451 443
452 spin_lock(&up->port.lock); 444 spin_lock(&up->port.lock);
453 r3 = read_zsreg(channel, R3); 445 r3 = read_zsreg(channel, R3);
454 446
455 /* Channel A */ 447 /* Channel A */
448 tty = NULL;
456 if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { 449 if (r3 & (CHAEXT | CHATxIP | CHARxIP)) {
457 writeb(RES_H_IUS, &channel->control); 450 writeb(RES_H_IUS, &channel->control);
458 ZSDELAY(); 451 ZSDELAY();
459 ZS_WSYNC(channel); 452 ZS_WSYNC(channel);
460 453
461 if (r3 & CHARxIP) 454 if (r3 & CHARxIP)
462 ip22zilog_receive_chars(up, channel); 455 tty = ip22zilog_receive_chars(up, channel);
463 if (r3 & CHAEXT) 456 if (r3 & CHAEXT)
464 ip22zilog_status_handle(up, channel); 457 ip22zilog_status_handle(up, channel);
465 if (r3 & CHATxIP) 458 if (r3 & CHATxIP)
@@ -467,18 +460,22 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
467 } 460 }
468 spin_unlock(&up->port.lock); 461 spin_unlock(&up->port.lock);
469 462
463 if (tty)
464 tty_flip_buffer_push(tty);
465
470 /* Channel B */ 466 /* Channel B */
471 up = up->next; 467 up = up->next;
472 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); 468 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
473 469
474 spin_lock(&up->port.lock); 470 spin_lock(&up->port.lock);
471 tty = NULL;
475 if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { 472 if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) {
476 writeb(RES_H_IUS, &channel->control); 473 writeb(RES_H_IUS, &channel->control);
477 ZSDELAY(); 474 ZSDELAY();
478 ZS_WSYNC(channel); 475 ZS_WSYNC(channel);
479 476
480 if (r3 & CHBRxIP) 477 if (r3 & CHBRxIP)
481 ip22zilog_receive_chars(up, channel); 478 tty = ip22zilog_receive_chars(up, channel);
482 if (r3 & CHBEXT) 479 if (r3 & CHBEXT)
483 ip22zilog_status_handle(up, channel); 480 ip22zilog_status_handle(up, channel);
484 if (r3 & CHBTxIP) 481 if (r3 & CHBTxIP)
@@ -486,6 +483,9 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id)
486 } 483 }
487 spin_unlock(&up->port.lock); 484 spin_unlock(&up->port.lock);
488 485
486 if (tty)
487 tty_flip_buffer_push(tty);
488
489 up = up->next; 489 up = up->next;
490 } 490 }
491 491
@@ -681,11 +681,46 @@ static void ip22zilog_break_ctl(struct uart_port *port, int break_state)
681 spin_unlock_irqrestore(&port->lock, flags); 681 spin_unlock_irqrestore(&port->lock, flags);
682} 682}
683 683
684static void __ip22zilog_reset(struct uart_ip22zilog_port *up)
685{
686 struct zilog_channel *channel;
687 int i;
688
689 if (up->flags & IP22ZILOG_FLAG_RESET_DONE)
690 return;
691
692 /* Let pending transmits finish. */
693 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
694 for (i = 0; i < 1000; i++) {
695 unsigned char stat = read_zsreg(channel, R1);
696 if (stat & ALL_SNT)
697 break;
698 udelay(100);
699 }
700
701 if (!ZS_IS_CHANNEL_A(up)) {
702 up++;
703 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
704 }
705 write_zsreg(channel, R9, FHWRES);
706 ZSDELAY_LONG();
707 (void) read_zsreg(channel, R0);
708
709 up->flags |= IP22ZILOG_FLAG_RESET_DONE;
710 up->next->flags |= IP22ZILOG_FLAG_RESET_DONE;
711}
712
684static void __ip22zilog_startup(struct uart_ip22zilog_port *up) 713static void __ip22zilog_startup(struct uart_ip22zilog_port *up)
685{ 714{
686 struct zilog_channel *channel; 715 struct zilog_channel *channel;
687 716
688 channel = ZILOG_CHANNEL_FROM_PORT(&up->port); 717 channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
718
719 __ip22zilog_reset(up);
720
721 __load_zsregs(channel, up->curregs);
722 /* set master interrupt enable */
723 write_zsreg(channel, R9, up->curregs[R9]);
689 up->prev_status = readb(&channel->control); 724 up->prev_status = readb(&channel->control);
690 725
691 /* Enable receiver and transmitter. */ 726 /* Enable receiver and transmitter. */
@@ -859,8 +894,6 @@ ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios,
859 else 894 else
860 up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS; 895 up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS;
861 896
862 up->cflag = termios->c_cflag;
863
864 ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); 897 ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port));
865 uart_update_timeout(port, termios->c_cflag, baud); 898 uart_update_timeout(port, termios->c_cflag, baud);
866 899
@@ -992,74 +1025,29 @@ ip22zilog_console_write(struct console *con, const char *s, unsigned int count)
992 spin_unlock_irqrestore(&up->port.lock, flags); 1025 spin_unlock_irqrestore(&up->port.lock, flags);
993} 1026}
994 1027
995void
996ip22serial_console_termios(struct console *con, char *options)
997{
998 int baud = 9600, bits = 8, cflag;
999 int parity = 'n';
1000 int flow = 'n';
1001
1002 if (options)
1003 uart_parse_options(options, &baud, &parity, &bits, &flow);
1004
1005 cflag = CREAD | HUPCL | CLOCAL;
1006
1007 switch (baud) {
1008 case 150: cflag |= B150; break;
1009 case 300: cflag |= B300; break;
1010 case 600: cflag |= B600; break;
1011 case 1200: cflag |= B1200; break;
1012 case 2400: cflag |= B2400; break;
1013 case 4800: cflag |= B4800; break;
1014 case 9600: cflag |= B9600; break;
1015 case 19200: cflag |= B19200; break;
1016 case 38400: cflag |= B38400; break;
1017 default: baud = 9600; cflag |= B9600; break;
1018 }
1019
1020 con->cflag = cflag | CS8; /* 8N1 */
1021
1022 uart_update_timeout(&ip22zilog_port_table[con->index].port, cflag, baud);
1023}
1024
1025static int __init ip22zilog_console_setup(struct console *con, char *options) 1028static int __init ip22zilog_console_setup(struct console *con, char *options)
1026{ 1029{
1027 struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; 1030 struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index];
1028 unsigned long flags; 1031 unsigned long flags;
1029 int baud, brg; 1032 int baud = 9600, bits = 8;
1030 1033 int parity = 'n';
1031 printk("Console: ttyS%d (IP22-Zilog)\n", con->index); 1034 int flow = 'n';
1032 1035
1033 /* Get firmware console settings. */ 1036 up->flags |= IP22ZILOG_FLAG_IS_CONS;
1034 ip22serial_console_termios(con, options);
1035 1037
1036 /* Firmware console speed is limited to 150-->38400 baud so 1038 printk(KERN_INFO "Console: ttyS%d (IP22-Zilog)\n", con->index);
1037 * this hackish cflag thing is OK.
1038 */
1039 switch (con->cflag & CBAUD) {
1040 case B150: baud = 150; break;
1041 case B300: baud = 300; break;
1042 case B600: baud = 600; break;
1043 case B1200: baud = 1200; break;
1044 case B2400: baud = 2400; break;
1045 case B4800: baud = 4800; break;
1046 default: case B9600: baud = 9600; break;
1047 case B19200: baud = 19200; break;
1048 case B38400: baud = 38400; break;
1049 };
1050
1051 brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
1052 1039
1053 spin_lock_irqsave(&up->port.lock, flags); 1040 spin_lock_irqsave(&up->port.lock, flags);
1054 1041
1055 up->curregs[R15] = BRKIE; 1042 up->curregs[R15] |= BRKIE;
1056 ip22zilog_convert_to_zs(up, con->cflag, 0, brg);
1057 1043
1058 __ip22zilog_startup(up); 1044 __ip22zilog_startup(up);
1059 1045
1060 spin_unlock_irqrestore(&up->port.lock, flags); 1046 spin_unlock_irqrestore(&up->port.lock, flags);
1061 1047
1062 return 0; 1048 if (options)
1049 uart_parse_options(options, &baud, &parity, &bits, &flow);
1050 return uart_set_options(&up->port, con, baud, parity, bits, flow);
1063} 1051}
1064 1052
1065static struct uart_driver ip22zilog_reg; 1053static struct uart_driver ip22zilog_reg;
@@ -1140,25 +1128,10 @@ static void __init ip22zilog_prepare(void)
1140 up[(chip * 2) + 1].port.line = (chip * 2) + 1; 1128 up[(chip * 2) + 1].port.line = (chip * 2) + 1;
1141 up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; 1129 up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A;
1142 } 1130 }
1143}
1144
1145static void __init ip22zilog_init_hw(void)
1146{
1147 int i;
1148
1149 for (i = 0; i < NUM_CHANNELS; i++) {
1150 struct uart_ip22zilog_port *up = &ip22zilog_port_table[i];
1151 struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(&up->port);
1152 unsigned long flags;
1153 int baud, brg;
1154 1131
1155 spin_lock_irqsave(&up->port.lock, flags); 1132 for (channel = 0; channel < NUM_CHANNELS; channel++) {
1156 1133 struct uart_ip22zilog_port *up = &ip22zilog_port_table[channel];
1157 if (ZS_IS_CHANNEL_A(up)) { 1134 int brg;
1158 write_zsreg(channel, R9, FHWRES);
1159 ZSDELAY_LONG();
1160 (void) read_zsreg(channel, R0);
1161 }
1162 1135
1163 /* Normal serial TTY. */ 1136 /* Normal serial TTY. */
1164 up->parity_mask = 0xff; 1137 up->parity_mask = 0xff;
@@ -1169,16 +1142,10 @@ static void __init ip22zilog_init_hw(void)
1169 up->curregs[R9] = NV | MIE; 1142 up->curregs[R9] = NV | MIE;
1170 up->curregs[R10] = NRZ; 1143 up->curregs[R10] = NRZ;
1171 up->curregs[R11] = TCBR | RCBR; 1144 up->curregs[R11] = TCBR | RCBR;
1172 baud = 9600; 1145 brg = BPS_TO_BRG(9600, ZS_CLOCK / ZS_CLOCK_DIVISOR);
1173 brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR);
1174 up->curregs[R12] = (brg & 0xff); 1146 up->curregs[R12] = (brg & 0xff);
1175 up->curregs[R13] = (brg >> 8) & 0xff; 1147 up->curregs[R13] = (brg >> 8) & 0xff;
1176 up->curregs[R14] = BRENAB; 1148 up->curregs[R14] = BRENAB;
1177 __load_zsregs(channel, up->curregs);
1178 /* set master interrupt enable */
1179 write_zsreg(channel, R9, up->curregs[R9]);
1180
1181 spin_unlock_irqrestore(&up->port.lock, flags);
1182 } 1149 }
1183} 1150}
1184 1151
@@ -1195,8 +1162,6 @@ static int __init ip22zilog_ports_init(void)
1195 panic("IP22-Zilog: Unable to register zs interrupt handler.\n"); 1162 panic("IP22-Zilog: Unable to register zs interrupt handler.\n");
1196 } 1163 }
1197 1164
1198 ip22zilog_init_hw();
1199
1200 ret = uart_register_driver(&ip22zilog_reg); 1165 ret = uart_register_driver(&ip22zilog_reg);
1201 if (ret == 0) { 1166 if (ret == 0) {
1202 int i; 1167 int i;
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index af3a011b2b24..352fcb8926a6 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -585,11 +585,11 @@ serial_pxa_type(struct uart_port *port)
585 return up->name; 585 return up->name;
586} 586}
587 587
588#ifdef CONFIG_SERIAL_PXA_CONSOLE
589
590static struct uart_pxa_port *serial_pxa_ports[4]; 588static struct uart_pxa_port *serial_pxa_ports[4];
591static struct uart_driver serial_pxa_reg; 589static struct uart_driver serial_pxa_reg;
592 590
591#ifdef CONFIG_SERIAL_PXA_CONSOLE
592
593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) 593#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
594 594
595/* 595/*
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 0d342dcdd302..ff6a14bf1280 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -497,7 +497,7 @@ static int atmel_spi_setup(struct spi_device *spi)
497 /* chipselect must have been muxed as GPIO (e.g. in board setup) */ 497 /* chipselect must have been muxed as GPIO (e.g. in board setup) */
498 npcs_pin = (unsigned int)spi->controller_data; 498 npcs_pin = (unsigned int)spi->controller_data;
499 if (!spi->controller_state) { 499 if (!spi->controller_state) {
500 ret = gpio_request(npcs_pin, "spi_npcs"); 500 ret = gpio_request(npcs_pin, spi->dev.bus_id);
501 if (ret) 501 if (ret)
502 return ret; 502 return ret;
503 spi->controller_state = (void *)npcs_pin; 503 spi->controller_state = (void *)npcs_pin;
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
index 0fa25e2e80fe..109d82c1abc0 100644
--- a/drivers/spi/spi_s3c24xx_gpio.c
+++ b/drivers/spi/spi_s3c24xx_gpio.c
@@ -96,6 +96,7 @@ static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value)
96 96
97static int s3c2410_spigpio_probe(struct platform_device *dev) 97static int s3c2410_spigpio_probe(struct platform_device *dev)
98{ 98{
99 struct s3c2410_spigpio_info *info;
99 struct spi_master *master; 100 struct spi_master *master;
100 struct s3c2410_spigpio *sp; 101 struct s3c2410_spigpio *sp;
101 int ret; 102 int ret;
@@ -113,10 +114,11 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
113 platform_set_drvdata(dev, sp); 114 platform_set_drvdata(dev, sp);
114 115
115 /* copy in the plkatform data */ 116 /* copy in the plkatform data */
116 sp->info = dev->dev.platform_data; 117 info = sp->info = dev->dev.platform_data;
117 118
118 /* setup spi bitbang adaptor */ 119 /* setup spi bitbang adaptor */
119 sp->bitbang.master = spi_master_get(master); 120 sp->bitbang.master = spi_master_get(master);
121 sp->bitbang.master->bus_num = info->bus_num;
120 sp->bitbang.chipselect = s3c2410_spigpio_chipselect; 122 sp->bitbang.chipselect = s3c2410_spigpio_chipselect;
121 123
122 sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; 124 sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0;
@@ -124,13 +126,18 @@ static int s3c2410_spigpio_probe(struct platform_device *dev)
124 sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2; 126 sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2;
125 sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3; 127 sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3;
126 128
127 /* set state of spi pins */ 129 /* set state of spi pins, always assume that the clock is
128 s3c2410_gpio_setpin(sp->info->pin_clk, 0); 130 * available, but do check the MOSI and MISO. */
129 s3c2410_gpio_setpin(sp->info->pin_mosi, 0); 131 s3c2410_gpio_setpin(info->pin_clk, 0);
132 s3c2410_gpio_cfgpin(info->pin_clk, S3C2410_GPIO_OUTPUT);
130 133
131 s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT); 134 if (info->pin_mosi < S3C2410_GPH10) {
132 s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT); 135 s3c2410_gpio_setpin(info->pin_mosi, 0);
133 s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT); 136 s3c2410_gpio_cfgpin(info->pin_mosi, S3C2410_GPIO_OUTPUT);
137 }
138
139 if (info->pin_miso != S3C2410_GPA0 && info->pin_miso < S3C2410_GPH10)
140 s3c2410_gpio_cfgpin(info->pin_miso, S3C2410_GPIO_INPUT);
134 141
135 ret = spi_bitbang_start(&sp->bitbang); 142 ret = spi_bitbang_start(&sp->bitbang);
136 if (ret) 143 if (ret)
diff --git a/drivers/usb/README b/drivers/usb/README
index 3c8434128554..284f46b3e1cc 100644
--- a/drivers/usb/README
+++ b/drivers/usb/README
@@ -39,12 +39,12 @@ first subdirectory in the list below that it fits into.
39 39
40image/ - This is for still image drivers, like scanners or 40image/ - This is for still image drivers, like scanners or
41 digital cameras. 41 digital cameras.
42input/ - This is for any driver that uses the input subsystem, 42../input/ - This is for any driver that uses the input subsystem,
43 like keyboard, mice, touchscreens, tablets, etc. 43 like keyboard, mice, touchscreens, tablets, etc.
44media/ - This is for multimedia drivers, like video cameras, 44../media/ - This is for multimedia drivers, like video cameras,
45 radios, and any other drivers that talk to the v4l 45 radios, and any other drivers that talk to the v4l
46 subsystem. 46 subsystem.
47net/ - This is for network drivers. 47../net/ - This is for network drivers.
48serial/ - This is for USB to serial drivers. 48serial/ - This is for USB to serial drivers.
49storage/ - This is for USB mass-storage drivers. 49storage/ - This is for USB mass-storage drivers.
50class/ - This is for all USB device drivers that do not fit 50class/ - This is for all USB device drivers that do not fit
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 8586817698ad..c51f8e9312e0 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -585,9 +585,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
585{ 585{
586 struct usb_device *usb_dev; 586 struct usb_device *usb_dev;
587 587
588 if (!dev)
589 return -ENODEV;
590
591 /* driver is often null here; dev_dbg() would oops */ 588 /* driver is often null here; dev_dbg() would oops */
592 pr_debug ("usb %s: uevent\n", dev->bus_id); 589 pr_debug ("usb %s: uevent\n", dev->bus_id);
593 590
@@ -631,14 +628,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
631 usb_dev->descriptor.bDeviceProtocol)) 628 usb_dev->descriptor.bDeviceProtocol))
632 return -ENOMEM; 629 return -ENOMEM;
633 630
634 if (add_uevent_var(env, "BUSNUM=%03d",
635 usb_dev->bus->busnum))
636 return -ENOMEM;
637
638 if (add_uevent_var(env, "DEVNUM=%03d",
639 usb_dev->devnum))
640 return -ENOMEM;
641
642 return 0; 631 return 0;
643} 632}
644 633
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fea8256a18d6..d5ed3fa9e304 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1311,8 +1311,8 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,
1311 hcd = bus_to_hcd(udev->bus); 1311 hcd = bus_to_hcd(udev->bus);
1312 1312
1313 /* No more submits can occur */ 1313 /* No more submits can occur */
1314rescan:
1315 spin_lock_irq(&hcd_urb_list_lock); 1314 spin_lock_irq(&hcd_urb_list_lock);
1315rescan:
1316 list_for_each_entry (urb, &ep->urb_list, urb_list) { 1316 list_for_each_entry (urb, &ep->urb_list, urb_list) {
1317 int is_in; 1317 int is_in;
1318 1318
@@ -1345,6 +1345,7 @@ rescan:
1345 usb_put_urb (urb); 1345 usb_put_urb (urb);
1346 1346
1347 /* list contents may have changed */ 1347 /* list contents may have changed */
1348 spin_lock(&hcd_urb_list_lock);
1348 goto rescan; 1349 goto rescan;
1349 } 1350 }
1350 spin_unlock_irq(&hcd_urb_list_lock); 1351 spin_unlock_irq(&hcd_urb_list_lock);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 036c3dea855e..13b326a13377 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -335,7 +335,7 @@ static void kick_khubd(struct usb_hub *hub)
335 to_usb_interface(hub->intfdev)->pm_usage_cnt = 1; 335 to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
336 336
337 spin_lock_irqsave(&hub_event_lock, flags); 337 spin_lock_irqsave(&hub_event_lock, flags);
338 if (!hub->disconnected & list_empty(&hub->event_list)) { 338 if (!hub->disconnected && list_empty(&hub->event_list)) {
339 list_add_tail(&hub->event_list, &hub_event_list); 339 list_add_tail(&hub->event_list, &hub_event_list);
340 wake_up(&khubd_wait); 340 wake_up(&khubd_wait);
341 } 341 }
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 316a746e0080..fcd40ecbeecc 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1172,7 +1172,6 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1172 struct usb_host_interface *alt; 1172 struct usb_host_interface *alt;
1173 int ret; 1173 int ret;
1174 int manual = 0; 1174 int manual = 0;
1175 int changed;
1176 1175
1177 if (dev->state == USB_STATE_SUSPENDED) 1176 if (dev->state == USB_STATE_SUSPENDED)
1178 return -EHOSTUNREACH; 1177 return -EHOSTUNREACH;
@@ -1212,8 +1211,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1212 */ 1211 */
1213 1212
1214 /* prevent submissions using previous endpoint settings */ 1213 /* prevent submissions using previous endpoint settings */
1215 changed = (iface->cur_altsetting != alt); 1214 if (iface->cur_altsetting != alt && device_is_registered(&iface->dev))
1216 if (changed && device_is_registered(&iface->dev))
1217 usb_remove_sysfs_intf_files(iface); 1215 usb_remove_sysfs_intf_files(iface);
1218 usb_disable_interface(dev, iface); 1216 usb_disable_interface(dev, iface);
1219 1217
@@ -1250,7 +1248,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1250 * (Likewise, EP0 never "halts" on well designed devices.) 1248 * (Likewise, EP0 never "halts" on well designed devices.)
1251 */ 1249 */
1252 usb_enable_interface(dev, iface); 1250 usb_enable_interface(dev, iface);
1253 if (changed && device_is_registered(&iface->dev)) 1251 if (device_is_registered(&iface->dev))
1254 usb_create_sysfs_intf_files(iface); 1252 usb_create_sysfs_intf_files(iface);
1255 1253
1256 return 0; 1254 return 0;
@@ -1348,34 +1346,10 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env)
1348 struct usb_interface *intf; 1346 struct usb_interface *intf;
1349 struct usb_host_interface *alt; 1347 struct usb_host_interface *alt;
1350 1348
1351 if (!dev)
1352 return -ENODEV;
1353
1354 /* driver is often null here; dev_dbg() would oops */
1355 pr_debug ("usb %s: uevent\n", dev->bus_id);
1356
1357 intf = to_usb_interface(dev); 1349 intf = to_usb_interface(dev);
1358 usb_dev = interface_to_usbdev(intf); 1350 usb_dev = interface_to_usbdev(intf);
1359 alt = intf->cur_altsetting; 1351 alt = intf->cur_altsetting;
1360 1352
1361#ifdef CONFIG_USB_DEVICEFS
1362 if (add_uevent_var(env, "DEVICE=/proc/bus/usb/%03d/%03d",
1363 usb_dev->bus->busnum, usb_dev->devnum))
1364 return -ENOMEM;
1365#endif
1366
1367 if (add_uevent_var(env, "PRODUCT=%x/%x/%x",
1368 le16_to_cpu(usb_dev->descriptor.idVendor),
1369 le16_to_cpu(usb_dev->descriptor.idProduct),
1370 le16_to_cpu(usb_dev->descriptor.bcdDevice)))
1371 return -ENOMEM;
1372
1373 if (add_uevent_var(env, "TYPE=%d/%d/%d",
1374 usb_dev->descriptor.bDeviceClass,
1375 usb_dev->descriptor.bDeviceSubClass,
1376 usb_dev->descriptor.bDeviceProtocol))
1377 return -ENOMEM;
1378
1379 if (add_uevent_var(env, "INTERFACE=%d/%d/%d", 1353 if (add_uevent_var(env, "INTERFACE=%d/%d/%d",
1380 alt->desc.bInterfaceClass, 1354 alt->desc.bInterfaceClass,
1381 alt->desc.bInterfaceSubClass, 1355 alt->desc.bInterfaceSubClass,
@@ -1641,12 +1615,6 @@ free_interfaces:
1641 intf->dev.bus_id, ret); 1615 intf->dev.bus_id, ret);
1642 continue; 1616 continue;
1643 } 1617 }
1644
1645 /* The driver's probe method can call usb_set_interface(),
1646 * which would mean the interface's sysfs files are already
1647 * created. Just in case, we'll remove them first.
1648 */
1649 usb_remove_sysfs_intf_files(intf);
1650 usb_create_sysfs_intf_files(intf); 1618 usb_create_sysfs_intf_files(intf);
1651 } 1619 }
1652 1620
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index b04afd06e502..32bd130b1eed 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -735,6 +735,8 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
735 struct usb_host_interface *alt = intf->cur_altsetting; 735 struct usb_host_interface *alt = intf->cur_altsetting;
736 int retval; 736 int retval;
737 737
738 if (intf->sysfs_files_created)
739 return 0;
738 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); 740 retval = sysfs_create_group(&dev->kobj, &intf_attr_grp);
739 if (retval) 741 if (retval)
740 return retval; 742 return retval;
@@ -746,6 +748,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf)
746 if (intf->intf_assoc) 748 if (intf->intf_assoc)
747 retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); 749 retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp);
748 usb_create_intf_ep_files(intf, udev); 750 usb_create_intf_ep_files(intf, udev);
751 intf->sysfs_files_created = 1;
749 return 0; 752 return 0;
750} 753}
751 754
@@ -753,8 +756,11 @@ void usb_remove_sysfs_intf_files(struct usb_interface *intf)
753{ 756{
754 struct device *dev = &intf->dev; 757 struct device *dev = &intf->dev;
755 758
759 if (!intf->sysfs_files_created)
760 return;
756 usb_remove_intf_ep_files(intf); 761 usb_remove_intf_ep_files(intf);
757 device_remove_file(dev, &dev_attr_interface); 762 device_remove_file(dev, &dev_attr_interface);
758 sysfs_remove_group(&dev->kobj, &intf_attr_grp); 763 sysfs_remove_group(&dev->kobj, &intf_attr_grp);
759 sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); 764 sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp);
765 intf->sysfs_files_created = 0;
760} 766}
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c4a6f1095b8b..8f142370103d 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -192,9 +192,34 @@ static void usb_release_dev(struct device *dev)
192 kfree(udev); 192 kfree(udev);
193} 193}
194 194
195#ifdef CONFIG_HOTPLUG
196static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
197{
198 struct usb_device *usb_dev;
199
200 usb_dev = to_usb_device(dev);
201
202 if (add_uevent_var(env, "BUSNUM=%03d", usb_dev->bus->busnum))
203 return -ENOMEM;
204
205 if (add_uevent_var(env, "DEVNUM=%03d", usb_dev->devnum))
206 return -ENOMEM;
207
208 return 0;
209}
210
211#else
212
213static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
214{
215 return -ENODEV;
216}
217#endif /* CONFIG_HOTPLUG */
218
195struct device_type usb_device_type = { 219struct device_type usb_device_type = {
196 .name = "usb_device", 220 .name = "usb_device",
197 .release = usb_release_dev, 221 .release = usb_release_dev,
222 .uevent = usb_dev_uevent,
198}; 223};
199 224
200#ifdef CONFIG_PM 225#ifdef CONFIG_PM
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 87c4f50dfb61..d377154658b5 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -1241,14 +1241,14 @@ static void pullup_enable(struct omap_udc *udc)
1241 udc->gadget.dev.parent->power.power_state = PMSG_ON; 1241 udc->gadget.dev.parent->power.power_state = PMSG_ON;
1242 udc->gadget.dev.power.power_state = PMSG_ON; 1242 udc->gadget.dev.power.power_state = PMSG_ON;
1243 UDC_SYSCON1_REG |= UDC_PULLUP_EN; 1243 UDC_SYSCON1_REG |= UDC_PULLUP_EN;
1244 if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) 1244 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx())
1245 OTG_CTRL_REG |= OTG_BSESSVLD; 1245 OTG_CTRL_REG |= OTG_BSESSVLD;
1246 UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1246 UDC_IRQ_EN_REG = UDC_DS_CHG_IE;
1247} 1247}
1248 1248
1249static void pullup_disable(struct omap_udc *udc) 1249static void pullup_disable(struct omap_udc *udc)
1250{ 1250{
1251 if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) 1251 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx())
1252 OTG_CTRL_REG &= ~OTG_BSESSVLD; 1252 OTG_CTRL_REG &= ~OTG_BSESSVLD;
1253 UDC_IRQ_EN_REG = UDC_DS_CHG_IE; 1253 UDC_IRQ_EN_REG = UDC_DS_CHG_IE;
1254 UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; 1254 UDC_SYSCON1_REG &= ~UDC_PULLUP_EN;
@@ -1386,7 +1386,7 @@ static void update_otg(struct omap_udc *udc)
1386{ 1386{
1387 u16 devstat; 1387 u16 devstat;
1388 1388
1389 if (!gadget_is_otg(udc->gadget)) 1389 if (!gadget_is_otg(&udc->gadget))
1390 return; 1390 return;
1391 1391
1392 if (OTG_CTRL_REG & OTG_ID) 1392 if (OTG_CTRL_REG & OTG_ID)
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index e3e90f8a75e7..4ce050c3d13f 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -52,10 +52,10 @@
52#include <asm/arch/irqs.h> 52#include <asm/arch/irqs.h>
53 53
54#include <asm/arch/hardware.h> 54#include <asm/arch/hardware.h>
55#include <asm/arch/regs-clock.h>
56#include <asm/arch/regs-gpio.h> 55#include <asm/arch/regs-gpio.h>
57#include <asm/arch/regs-udc.h> 56
58#include <asm/arch/udc.h> 57#include <asm/plat-s3c24xx/regs-udc.h>
58#include <asm/plat-s3c24xx/udc.h>
59 59
60#include <asm/mach-types.h> 60#include <asm/mach-types.h>
61 61
@@ -1511,7 +1511,11 @@ static irqreturn_t s3c2410_udc_vbus_irq(int irq, void *_dev)
1511 unsigned int value; 1511 unsigned int value;
1512 1512
1513 dprintk(DEBUG_NORMAL, "%s()\n", __func__); 1513 dprintk(DEBUG_NORMAL, "%s()\n", __func__);
1514
1515 /* some cpus cannot read from an line configured to IRQ! */
1516 s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT);
1514 value = s3c2410_gpio_getpin(udc_info->vbus_pin); 1517 value = s3c2410_gpio_getpin(udc_info->vbus_pin);
1518 s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2);
1515 1519
1516 if (udc_info->vbus_pin_inverted) 1520 if (udc_info->vbus_pin_inverted)
1517 value = !value; 1521 value = !value;
@@ -1872,9 +1876,9 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1872 if (udc_info && udc_info->vbus_pin > 0) { 1876 if (udc_info && udc_info->vbus_pin > 0) {
1873 irq = s3c2410_gpio_getirq(udc_info->vbus_pin); 1877 irq = s3c2410_gpio_getirq(udc_info->vbus_pin);
1874 retval = request_irq(irq, s3c2410_udc_vbus_irq, 1878 retval = request_irq(irq, s3c2410_udc_vbus_irq,
1875 IRQF_DISABLED | IRQF_TRIGGER_RISING 1879 IRQF_DISABLED | IRQF_TRIGGER_RISING
1876 | IRQF_TRIGGER_FALLING, 1880 | IRQF_TRIGGER_FALLING | IRQF_SHARED,
1877 gadget_name, udc); 1881 gadget_name, udc);
1878 1882
1879 if (retval != 0) { 1883 if (retval != 0) {
1880 dev_err(dev, "can't get vbus irq %i, err %d\n", 1884 dev_err(dev, "can't get vbus irq %i, err %d\n",
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 177e78ed241b..49a91c5ee51b 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -156,7 +156,7 @@ config USB_OHCI_HCD_PCI
156 156
157config USB_OHCI_HCD_SSB 157config USB_OHCI_HCD_SSB
158 bool "OHCI support for Broadcom SSB OHCI core" 158 bool "OHCI support for Broadcom SSB OHCI core"
159 depends on USB_OHCI_HCD && (SSB = y || SSB = CONFIG_USB_OHCI_HCD) && EXPERIMENTAL 159 depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL
160 default n 160 default n
161 ---help--- 161 ---help---
162 Support for the Sonics Silicon Backplane (SSB) attached 162 Support for the Sonics Silicon Backplane (SSB) attached
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c1514442883e..5f2d74ed5ad7 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -575,12 +575,15 @@ static int ehci_run (struct usb_hcd *hcd)
575 * from the companions to the EHCI controller. If any of the 575 * from the companions to the EHCI controller. If any of the
576 * companions are in the middle of a port reset at the time, it 576 * companions are in the middle of a port reset at the time, it
577 * could cause trouble. Write-locking ehci_cf_port_reset_rwsem 577 * could cause trouble. Write-locking ehci_cf_port_reset_rwsem
578 * guarantees that no resets are in progress. 578 * guarantees that no resets are in progress. After we set CF,
579 * a short delay lets the hardware catch up; new resets shouldn't
580 * be started before the port switching actions could complete.
579 */ 581 */
580 down_write(&ehci_cf_port_reset_rwsem); 582 down_write(&ehci_cf_port_reset_rwsem);
581 hcd->state = HC_STATE_RUNNING; 583 hcd->state = HC_STATE_RUNNING;
582 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); 584 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
583 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ 585 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
586 msleep(5);
584 up_write(&ehci_cf_port_reset_rwsem); 587 up_write(&ehci_cf_port_reset_rwsem);
585 588
586 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); 589 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 91e999c9f680..bc207e3c21f5 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -819,7 +819,7 @@ static int mts_usb_probe(struct usb_interface *intf,
819 goto out_kfree2; 819 goto out_kfree2;
820 820
821 new_desc->host->hostdata[0] = (unsigned long)new_desc; 821 new_desc->host->hostdata[0] = (unsigned long)new_desc;
822 if (scsi_add_host(new_desc->host, NULL)) { 822 if (scsi_add_host(new_desc->host, &dev->dev)) {
823 err_retval = -EIO; 823 err_retval = -EIO;
824 goto out_host_put; 824 goto out_host_put;
825 } 825 }
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index c567aa7a41ea..5a2c44e4c1f7 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -79,12 +79,22 @@ MODULE_DEVICE_TABLE(usb, device_table);
79 79
80#define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */ 80#define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */
81 81
82/*
83 * The locking scheme is a vanilla 3-lock:
84 * adu_device.buflock: A spinlock, covers what IRQs touch.
85 * adutux_mutex: A Static lock to cover open_count. It would also cover
86 * any globals, but we don't have them in 2.6.
87 * adu_device.mtx: A mutex to hold across sleepers like copy_from_user.
88 * It covers all of adu_device, except the open_count
89 * and what .buflock covers.
90 */
91
82/* Structure to hold all of our device specific stuff */ 92/* Structure to hold all of our device specific stuff */
83struct adu_device { 93struct adu_device {
84 struct mutex mtx; /* locks this structure */ 94 struct mutex mtx;
85 struct usb_device* udev; /* save off the usb device pointer */ 95 struct usb_device* udev; /* save off the usb device pointer */
86 struct usb_interface* interface; 96 struct usb_interface* interface;
87 unsigned char minor; /* the starting minor number for this device */ 97 unsigned int minor; /* the starting minor number for this device */
88 char serial_number[8]; 98 char serial_number[8];
89 99
90 int open_count; /* number of times this port has been opened */ 100 int open_count; /* number of times this port has been opened */
@@ -107,8 +117,11 @@ struct adu_device {
107 char* interrupt_out_buffer; 117 char* interrupt_out_buffer;
108 struct usb_endpoint_descriptor* interrupt_out_endpoint; 118 struct usb_endpoint_descriptor* interrupt_out_endpoint;
109 struct urb* interrupt_out_urb; 119 struct urb* interrupt_out_urb;
120 int out_urb_finished;
110}; 121};
111 122
123static DEFINE_MUTEX(adutux_mutex);
124
112static struct usb_driver adu_driver; 125static struct usb_driver adu_driver;
113 126
114static void adu_debug_data(int level, const char *function, int size, 127static void adu_debug_data(int level, const char *function, int size,
@@ -132,27 +145,31 @@ static void adu_debug_data(int level, const char *function, int size,
132 */ 145 */
133static void adu_abort_transfers(struct adu_device *dev) 146static void adu_abort_transfers(struct adu_device *dev)
134{ 147{
135 dbg(2," %s : enter", __FUNCTION__); 148 unsigned long flags;
136 149
137 if (dev == NULL) { 150 dbg(2," %s : enter", __FUNCTION__);
138 dbg(1," %s : dev is null", __FUNCTION__);
139 goto exit;
140 }
141 151
142 if (dev->udev == NULL) { 152 if (dev->udev == NULL) {
143 dbg(1," %s : udev is null", __FUNCTION__); 153 dbg(1," %s : udev is null", __FUNCTION__);
144 goto exit; 154 goto exit;
145 } 155 }
146 156
147 dbg(2," %s : udev state %d", __FUNCTION__, dev->udev->state);
148 if (dev->udev->state == USB_STATE_NOTATTACHED) {
149 dbg(1," %s : udev is not attached", __FUNCTION__);
150 goto exit;
151 }
152
153 /* shutdown transfer */ 157 /* shutdown transfer */
154 usb_unlink_urb(dev->interrupt_in_urb); 158
155 usb_unlink_urb(dev->interrupt_out_urb); 159 /* XXX Anchor these instead */
160 spin_lock_irqsave(&dev->buflock, flags);
161 if (!dev->read_urb_finished) {
162 spin_unlock_irqrestore(&dev->buflock, flags);
163 usb_kill_urb(dev->interrupt_in_urb);
164 } else
165 spin_unlock_irqrestore(&dev->buflock, flags);
166
167 spin_lock_irqsave(&dev->buflock, flags);
168 if (!dev->out_urb_finished) {
169 spin_unlock_irqrestore(&dev->buflock, flags);
170 usb_kill_urb(dev->interrupt_out_urb);
171 } else
172 spin_unlock_irqrestore(&dev->buflock, flags);
156 173
157exit: 174exit:
158 dbg(2," %s : leave", __FUNCTION__); 175 dbg(2," %s : leave", __FUNCTION__);
@@ -162,8 +179,6 @@ static void adu_delete(struct adu_device *dev)
162{ 179{
163 dbg(2, "%s enter", __FUNCTION__); 180 dbg(2, "%s enter", __FUNCTION__);
164 181
165 adu_abort_transfers(dev);
166
167 /* free data structures */ 182 /* free data structures */
168 usb_free_urb(dev->interrupt_in_urb); 183 usb_free_urb(dev->interrupt_in_urb);
169 usb_free_urb(dev->interrupt_out_urb); 184 usb_free_urb(dev->interrupt_out_urb);
@@ -239,7 +254,10 @@ static void adu_interrupt_out_callback(struct urb *urb)
239 goto exit; 254 goto exit;
240 } 255 }
241 256
242 wake_up_interruptible(&dev->write_wait); 257 spin_lock(&dev->buflock);
258 dev->out_urb_finished = 1;
259 wake_up(&dev->write_wait);
260 spin_unlock(&dev->buflock);
243exit: 261exit:
244 262
245 adu_debug_data(5, __FUNCTION__, urb->actual_length, 263 adu_debug_data(5, __FUNCTION__, urb->actual_length,
@@ -252,12 +270,17 @@ static int adu_open(struct inode *inode, struct file *file)
252 struct adu_device *dev = NULL; 270 struct adu_device *dev = NULL;
253 struct usb_interface *interface; 271 struct usb_interface *interface;
254 int subminor; 272 int subminor;
255 int retval = 0; 273 int retval;
256 274
257 dbg(2,"%s : enter", __FUNCTION__); 275 dbg(2,"%s : enter", __FUNCTION__);
258 276
259 subminor = iminor(inode); 277 subminor = iminor(inode);
260 278
279 if ((retval = mutex_lock_interruptible(&adutux_mutex))) {
280 dbg(2, "%s : mutex lock failed", __FUNCTION__);
281 goto exit_no_lock;
282 }
283
261 interface = usb_find_interface(&adu_driver, subminor); 284 interface = usb_find_interface(&adu_driver, subminor);
262 if (!interface) { 285 if (!interface) {
263 err("%s - error, can't find device for minor %d", 286 err("%s - error, can't find device for minor %d",
@@ -267,54 +290,54 @@ static int adu_open(struct inode *inode, struct file *file)
267 } 290 }
268 291
269 dev = usb_get_intfdata(interface); 292 dev = usb_get_intfdata(interface);
270 if (!dev) { 293 if (!dev || !dev->udev) {
271 retval = -ENODEV; 294 retval = -ENODEV;
272 goto exit_no_device; 295 goto exit_no_device;
273 } 296 }
274 297
275 /* lock this device */ 298 /* check that nobody else is using the device */
276 if ((retval = mutex_lock_interruptible(&dev->mtx))) { 299 if (dev->open_count) {
277 dbg(2, "%s : mutex lock failed", __FUNCTION__); 300 retval = -EBUSY;
278 goto exit_no_device; 301 goto exit_no_device;
279 } 302 }
280 303
281 /* increment our usage count for the device */
282 ++dev->open_count; 304 ++dev->open_count;
283 dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count); 305 dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count);
284 306
285 /* save device in the file's private structure */ 307 /* save device in the file's private structure */
286 file->private_data = dev; 308 file->private_data = dev;
287 309
288 if (dev->open_count == 1) { 310 /* initialize in direction */
289 /* initialize in direction */ 311 dev->read_buffer_length = 0;
290 dev->read_buffer_length = 0;
291 312
292 /* fixup first read by having urb waiting for it */ 313 /* fixup first read by having urb waiting for it */
293 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, 314 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
294 usb_rcvintpipe(dev->udev, 315 usb_rcvintpipe(dev->udev,
295 dev->interrupt_in_endpoint->bEndpointAddress), 316 dev->interrupt_in_endpoint->bEndpointAddress),
296 dev->interrupt_in_buffer, 317 dev->interrupt_in_buffer,
297 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), 318 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize),
298 adu_interrupt_in_callback, dev, 319 adu_interrupt_in_callback, dev,
299 dev->interrupt_in_endpoint->bInterval); 320 dev->interrupt_in_endpoint->bInterval);
300 /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ 321 dev->read_urb_finished = 0;
301 dev->read_urb_finished = 0; 322 if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL))
302 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); 323 dev->read_urb_finished = 1;
303 if (retval) 324 /* we ignore failure */
304 --dev->open_count; 325 /* end of fixup for first read */
305 } 326
306 mutex_unlock(&dev->mtx); 327 /* initialize out direction */
328 dev->out_urb_finished = 1;
329
330 retval = 0;
307 331
308exit_no_device: 332exit_no_device:
333 mutex_unlock(&adutux_mutex);
334exit_no_lock:
309 dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); 335 dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval);
310
311 return retval; 336 return retval;
312} 337}
313 338
314static int adu_release_internal(struct adu_device *dev) 339static void adu_release_internal(struct adu_device *dev)
315{ 340{
316 int retval = 0;
317
318 dbg(2," %s : enter", __FUNCTION__); 341 dbg(2," %s : enter", __FUNCTION__);
319 342
320 /* decrement our usage count for the device */ 343 /* decrement our usage count for the device */
@@ -326,12 +349,11 @@ static int adu_release_internal(struct adu_device *dev)
326 } 349 }
327 350
328 dbg(2," %s : leave", __FUNCTION__); 351 dbg(2," %s : leave", __FUNCTION__);
329 return retval;
330} 352}
331 353
332static int adu_release(struct inode *inode, struct file *file) 354static int adu_release(struct inode *inode, struct file *file)
333{ 355{
334 struct adu_device *dev = NULL; 356 struct adu_device *dev;
335 int retval = 0; 357 int retval = 0;
336 358
337 dbg(2," %s : enter", __FUNCTION__); 359 dbg(2," %s : enter", __FUNCTION__);
@@ -343,15 +365,13 @@ static int adu_release(struct inode *inode, struct file *file)
343 } 365 }
344 366
345 dev = file->private_data; 367 dev = file->private_data;
346
347 if (dev == NULL) { 368 if (dev == NULL) {
348 dbg(1," %s : object is NULL", __FUNCTION__); 369 dbg(1," %s : object is NULL", __FUNCTION__);
349 retval = -ENODEV; 370 retval = -ENODEV;
350 goto exit; 371 goto exit;
351 } 372 }
352 373
353 /* lock our device */ 374 mutex_lock(&adutux_mutex); /* not interruptible */
354 mutex_lock(&dev->mtx); /* not interruptible */
355 375
356 if (dev->open_count <= 0) { 376 if (dev->open_count <= 0) {
357 dbg(1," %s : device not opened", __FUNCTION__); 377 dbg(1," %s : device not opened", __FUNCTION__);
@@ -359,19 +379,15 @@ static int adu_release(struct inode *inode, struct file *file)
359 goto exit; 379 goto exit;
360 } 380 }
361 381
382 adu_release_internal(dev);
362 if (dev->udev == NULL) { 383 if (dev->udev == NULL) {
363 /* the device was unplugged before the file was released */ 384 /* the device was unplugged before the file was released */
364 mutex_unlock(&dev->mtx); 385 if (!dev->open_count) /* ... and we're the last user */
365 adu_delete(dev); 386 adu_delete(dev);
366 dev = NULL;
367 } else {
368 /* do the work */
369 retval = adu_release_internal(dev);
370 } 387 }
371 388
372exit: 389exit:
373 if (dev) 390 mutex_unlock(&adutux_mutex);
374 mutex_unlock(&dev->mtx);
375 dbg(2," %s : leave, return value %d", __FUNCTION__, retval); 391 dbg(2," %s : leave, return value %d", __FUNCTION__, retval);
376 return retval; 392 return retval;
377} 393}
@@ -393,12 +409,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
393 409
394 dev = file->private_data; 410 dev = file->private_data;
395 dbg(2," %s : dev=%p", __FUNCTION__, dev); 411 dbg(2," %s : dev=%p", __FUNCTION__, dev);
396 /* lock this object */ 412
397 if (mutex_lock_interruptible(&dev->mtx)) 413 if (mutex_lock_interruptible(&dev->mtx))
398 return -ERESTARTSYS; 414 return -ERESTARTSYS;
399 415
400 /* verify that the device wasn't unplugged */ 416 /* verify that the device wasn't unplugged */
401 if (dev->udev == NULL || dev->minor == 0) { 417 if (dev->udev == NULL) {
402 retval = -ENODEV; 418 retval = -ENODEV;
403 err("No device or device unplugged %d", retval); 419 err("No device or device unplugged %d", retval);
404 goto exit; 420 goto exit;
@@ -452,7 +468,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
452 should_submit = 1; 468 should_submit = 1;
453 } else { 469 } else {
454 /* even the primary was empty - we may need to do IO */ 470 /* even the primary was empty - we may need to do IO */
455 if (dev->interrupt_in_urb->status == -EINPROGRESS) { 471 if (!dev->read_urb_finished) {
456 /* somebody is doing IO */ 472 /* somebody is doing IO */
457 spin_unlock_irqrestore(&dev->buflock, flags); 473 spin_unlock_irqrestore(&dev->buflock, flags);
458 dbg(2," %s : submitted already", __FUNCTION__); 474 dbg(2," %s : submitted already", __FUNCTION__);
@@ -460,6 +476,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
460 /* we must initiate input */ 476 /* we must initiate input */
461 dbg(2," %s : initiate input", __FUNCTION__); 477 dbg(2," %s : initiate input", __FUNCTION__);
462 dev->read_urb_finished = 0; 478 dev->read_urb_finished = 0;
479 spin_unlock_irqrestore(&dev->buflock, flags);
463 480
464 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, 481 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
465 usb_rcvintpipe(dev->udev, 482 usb_rcvintpipe(dev->udev,
@@ -469,15 +486,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
469 adu_interrupt_in_callback, 486 adu_interrupt_in_callback,
470 dev, 487 dev,
471 dev->interrupt_in_endpoint->bInterval); 488 dev->interrupt_in_endpoint->bInterval);
472 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); 489 retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL);
473 if (!retval) { 490 if (retval) {
474 spin_unlock_irqrestore(&dev->buflock, flags); 491 dev->read_urb_finished = 1;
475 dbg(2," %s : submitted OK", __FUNCTION__);
476 } else {
477 if (retval == -ENOMEM) { 492 if (retval == -ENOMEM) {
478 retval = bytes_read ? bytes_read : -ENOMEM; 493 retval = bytes_read ? bytes_read : -ENOMEM;
479 } 494 }
480 spin_unlock_irqrestore(&dev->buflock, flags);
481 dbg(2," %s : submit failed", __FUNCTION__); 495 dbg(2," %s : submit failed", __FUNCTION__);
482 goto exit; 496 goto exit;
483 } 497 }
@@ -486,10 +500,14 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
486 /* we wait for I/O to complete */ 500 /* we wait for I/O to complete */
487 set_current_state(TASK_INTERRUPTIBLE); 501 set_current_state(TASK_INTERRUPTIBLE);
488 add_wait_queue(&dev->read_wait, &wait); 502 add_wait_queue(&dev->read_wait, &wait);
489 if (!dev->read_urb_finished) 503 spin_lock_irqsave(&dev->buflock, flags);
504 if (!dev->read_urb_finished) {
505 spin_unlock_irqrestore(&dev->buflock, flags);
490 timeout = schedule_timeout(COMMAND_TIMEOUT); 506 timeout = schedule_timeout(COMMAND_TIMEOUT);
491 else 507 } else {
508 spin_unlock_irqrestore(&dev->buflock, flags);
492 set_current_state(TASK_RUNNING); 509 set_current_state(TASK_RUNNING);
510 }
493 remove_wait_queue(&dev->read_wait, &wait); 511 remove_wait_queue(&dev->read_wait, &wait);
494 512
495 if (timeout <= 0) { 513 if (timeout <= 0) {
@@ -509,19 +527,23 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
509 527
510 retval = bytes_read; 528 retval = bytes_read;
511 /* if the primary buffer is empty then use it */ 529 /* if the primary buffer is empty then use it */
512 if (should_submit && !dev->interrupt_in_urb->status==-EINPROGRESS) { 530 spin_lock_irqsave(&dev->buflock, flags);
531 if (should_submit && dev->read_urb_finished) {
532 dev->read_urb_finished = 0;
533 spin_unlock_irqrestore(&dev->buflock, flags);
513 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, 534 usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
514 usb_rcvintpipe(dev->udev, 535 usb_rcvintpipe(dev->udev,
515 dev->interrupt_in_endpoint->bEndpointAddress), 536 dev->interrupt_in_endpoint->bEndpointAddress),
516 dev->interrupt_in_buffer, 537 dev->interrupt_in_buffer,
517 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), 538 le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize),
518 adu_interrupt_in_callback, 539 adu_interrupt_in_callback,
519 dev, 540 dev,
520 dev->interrupt_in_endpoint->bInterval); 541 dev->interrupt_in_endpoint->bInterval);
521 /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ 542 if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL) != 0)
522 dev->read_urb_finished = 0; 543 dev->read_urb_finished = 1;
523 usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL);
524 /* we ignore failure */ 544 /* we ignore failure */
545 } else {
546 spin_unlock_irqrestore(&dev->buflock, flags);
525 } 547 }
526 548
527exit: 549exit:
@@ -535,24 +557,24 @@ exit:
535static ssize_t adu_write(struct file *file, const __user char *buffer, 557static ssize_t adu_write(struct file *file, const __user char *buffer,
536 size_t count, loff_t *ppos) 558 size_t count, loff_t *ppos)
537{ 559{
560 DECLARE_WAITQUEUE(waita, current);
538 struct adu_device *dev; 561 struct adu_device *dev;
539 size_t bytes_written = 0; 562 size_t bytes_written = 0;
540 size_t bytes_to_write; 563 size_t bytes_to_write;
541 size_t buffer_size; 564 size_t buffer_size;
565 unsigned long flags;
542 int retval; 566 int retval;
543 int timeout = 0;
544 567
545 dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); 568 dbg(2," %s : enter, count = %Zd", __FUNCTION__, count);
546 569
547 dev = file->private_data; 570 dev = file->private_data;
548 571
549 /* lock this object */
550 retval = mutex_lock_interruptible(&dev->mtx); 572 retval = mutex_lock_interruptible(&dev->mtx);
551 if (retval) 573 if (retval)
552 goto exit_nolock; 574 goto exit_nolock;
553 575
554 /* verify that the device wasn't unplugged */ 576 /* verify that the device wasn't unplugged */
555 if (dev->udev == NULL || dev->minor == 0) { 577 if (dev->udev == NULL) {
556 retval = -ENODEV; 578 retval = -ENODEV;
557 err("No device or device unplugged %d", retval); 579 err("No device or device unplugged %d", retval);
558 goto exit; 580 goto exit;
@@ -564,42 +586,37 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
564 goto exit; 586 goto exit;
565 } 587 }
566 588
567
568 while (count > 0) { 589 while (count > 0) {
569 if (dev->interrupt_out_urb->status == -EINPROGRESS) { 590 add_wait_queue(&dev->write_wait, &waita);
570 timeout = COMMAND_TIMEOUT; 591 set_current_state(TASK_INTERRUPTIBLE);
592 spin_lock_irqsave(&dev->buflock, flags);
593 if (!dev->out_urb_finished) {
594 spin_unlock_irqrestore(&dev->buflock, flags);
571 595
572 while (timeout > 0) { 596 mutex_unlock(&dev->mtx);
573 if (signal_pending(current)) { 597 if (signal_pending(current)) {
574 dbg(1," %s : interrupted", __FUNCTION__); 598 dbg(1," %s : interrupted", __FUNCTION__);
599 set_current_state(TASK_RUNNING);
575 retval = -EINTR; 600 retval = -EINTR;
576 goto exit; 601 goto exit_onqueue;
577 } 602 }
578 mutex_unlock(&dev->mtx); 603 if (schedule_timeout(COMMAND_TIMEOUT) == 0) {
579 timeout = interruptible_sleep_on_timeout(&dev->write_wait, timeout); 604 dbg(1, "%s - command timed out.", __FUNCTION__);
605 retval = -ETIMEDOUT;
606 goto exit_onqueue;
607 }
608 remove_wait_queue(&dev->write_wait, &waita);
580 retval = mutex_lock_interruptible(&dev->mtx); 609 retval = mutex_lock_interruptible(&dev->mtx);
581 if (retval) { 610 if (retval) {
582 retval = bytes_written ? bytes_written : retval; 611 retval = bytes_written ? bytes_written : retval;
583 goto exit_nolock; 612 goto exit_nolock;
584 } 613 }
585 if (timeout > 0) {
586 break;
587 }
588 dbg(1," %s : interrupted timeout: %d", __FUNCTION__, timeout);
589 }
590
591
592 dbg(1," %s : final timeout: %d", __FUNCTION__, timeout);
593
594 if (timeout == 0) {
595 dbg(1, "%s - command timed out.", __FUNCTION__);
596 retval = -ETIMEDOUT;
597 goto exit;
598 }
599
600 dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count);
601 614
615 dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count);
602 } else { 616 } else {
617 spin_unlock_irqrestore(&dev->buflock, flags);
618 set_current_state(TASK_RUNNING);
619 remove_wait_queue(&dev->write_wait, &waita);
603 dbg(4," %s : sending, count = %Zd", __FUNCTION__, count); 620 dbg(4," %s : sending, count = %Zd", __FUNCTION__, count);
604 621
605 /* write the data into interrupt_out_buffer from userspace */ 622 /* write the data into interrupt_out_buffer from userspace */
@@ -622,11 +639,12 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
622 bytes_to_write, 639 bytes_to_write,
623 adu_interrupt_out_callback, 640 adu_interrupt_out_callback,
624 dev, 641 dev,
625 dev->interrupt_in_endpoint->bInterval); 642 dev->interrupt_out_endpoint->bInterval);
626 /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */
627 dev->interrupt_out_urb->actual_length = bytes_to_write; 643 dev->interrupt_out_urb->actual_length = bytes_to_write;
644 dev->out_urb_finished = 0;
628 retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); 645 retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL);
629 if (retval < 0) { 646 if (retval < 0) {
647 dev->out_urb_finished = 1;
630 err("Couldn't submit interrupt_out_urb %d", retval); 648 err("Couldn't submit interrupt_out_urb %d", retval);
631 goto exit; 649 goto exit;
632 } 650 }
@@ -637,16 +655,17 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
637 bytes_written += bytes_to_write; 655 bytes_written += bytes_to_write;
638 } 656 }
639 } 657 }
640 658 mutex_unlock(&dev->mtx);
641 retval = bytes_written; 659 return bytes_written;
642 660
643exit: 661exit:
644 /* unlock the device */
645 mutex_unlock(&dev->mtx); 662 mutex_unlock(&dev->mtx);
646exit_nolock: 663exit_nolock:
647
648 dbg(2," %s : leave, return value %d", __FUNCTION__, retval); 664 dbg(2," %s : leave, return value %d", __FUNCTION__, retval);
665 return retval;
649 666
667exit_onqueue:
668 remove_wait_queue(&dev->write_wait, &waita);
650 return retval; 669 return retval;
651} 670}
652 671
@@ -831,25 +850,22 @@ static void adu_disconnect(struct usb_interface *interface)
831 dbg(2," %s : enter", __FUNCTION__); 850 dbg(2," %s : enter", __FUNCTION__);
832 851
833 dev = usb_get_intfdata(interface); 852 dev = usb_get_intfdata(interface);
834 usb_set_intfdata(interface, NULL);
835 853
854 mutex_lock(&dev->mtx); /* not interruptible */
855 dev->udev = NULL; /* poison */
836 minor = dev->minor; 856 minor = dev->minor;
837
838 /* give back our minor */
839 usb_deregister_dev(interface, &adu_class); 857 usb_deregister_dev(interface, &adu_class);
840 dev->minor = 0; 858 mutex_unlock(&dev->mtx);
841 859
842 mutex_lock(&dev->mtx); /* not interruptible */ 860 mutex_lock(&adutux_mutex);
861 usb_set_intfdata(interface, NULL);
843 862
844 /* if the device is not opened, then we clean up right now */ 863 /* if the device is not opened, then we clean up right now */
845 dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); 864 dbg(2," %s : open count %d", __FUNCTION__, dev->open_count);
846 if (!dev->open_count) { 865 if (!dev->open_count)
847 mutex_unlock(&dev->mtx);
848 adu_delete(dev); 866 adu_delete(dev);
849 } else { 867
850 dev->udev = NULL; 868 mutex_unlock(&adutux_mutex);
851 mutex_unlock(&dev->mtx);
852 }
853 869
854 dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", 870 dev_info(&interface->dev, "ADU device adutux%d now disconnected\n",
855 (minor - ADU_MINOR_BASE)); 871 (minor - ADU_MINOR_BASE));
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 49c5c5c4c431..06cb71942dc7 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -144,12 +144,14 @@ static void led_disconnect(struct usb_interface *interface)
144 struct usb_led *dev; 144 struct usb_led *dev;
145 145
146 dev = usb_get_intfdata (interface); 146 dev = usb_get_intfdata (interface);
147 usb_set_intfdata (interface, NULL);
148 147
149 device_remove_file(&interface->dev, &dev_attr_blue); 148 device_remove_file(&interface->dev, &dev_attr_blue);
150 device_remove_file(&interface->dev, &dev_attr_red); 149 device_remove_file(&interface->dev, &dev_attr_red);
151 device_remove_file(&interface->dev, &dev_attr_green); 150 device_remove_file(&interface->dev, &dev_attr_green);
152 151
152 /* first remove the files, then set the pointer to NULL */
153 usb_set_intfdata (interface, NULL);
154
153 usb_put_dev(dev->udev); 155 usb_put_dev(dev->udev);
154 156
155 kfree(dev); 157 kfree(dev);
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 9eb4a65ee4d9..d41531139c55 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -327,6 +327,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb)
327 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 327 struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
328 unsigned char *data = urb->transfer_buffer; 328 unsigned char *data = urb->transfer_buffer;
329 int status = urb->status; 329 int status = urb->status;
330 unsigned long flags;
330 331
331 dbg("%s - port %d", __FUNCTION__, port->number); 332 dbg("%s - port %d", __FUNCTION__, port->number);
332 333
@@ -339,11 +340,11 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb)
339 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); 340 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
340 341
341 /* Throttle the device if requested by tty */ 342 /* Throttle the device if requested by tty */
342 spin_lock(&port->lock); 343 spin_lock_irqsave(&port->lock, flags);
343 if (!(port->throttled = port->throttle_req)) 344 if (!(port->throttled = port->throttle_req))
344 /* Handle data and continue reading from device */ 345 /* Handle data and continue reading from device */
345 flush_and_resubmit_read_urb(port); 346 flush_and_resubmit_read_urb(port);
346 spin_unlock(&port->lock); 347 spin_unlock_irqrestore(&port->lock, flags);
347} 348}
348EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); 349EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback);
349 350
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 1f7ab15df36d..feba9679ace8 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -1215,12 +1215,14 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port)
1215 1215
1216static int keyspan_open (struct usb_serial_port *port, struct file *filp) 1216static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1217{ 1217{
1218 struct keyspan_port_private *p_priv; 1218 struct keyspan_port_private *p_priv;
1219 struct keyspan_serial_private *s_priv; 1219 struct keyspan_serial_private *s_priv;
1220 struct usb_serial *serial = port->serial; 1220 struct usb_serial *serial = port->serial;
1221 const struct keyspan_device_details *d_details; 1221 const struct keyspan_device_details *d_details;
1222 int i, err; 1222 int i, err;
1223 int baud_rate, device_port;
1223 struct urb *urb; 1224 struct urb *urb;
1225 unsigned int cflag;
1224 1226
1225 s_priv = usb_get_serial_data(serial); 1227 s_priv = usb_get_serial_data(serial);
1226 p_priv = usb_get_serial_port_data(port); 1228 p_priv = usb_get_serial_port_data(port);
@@ -1263,6 +1265,30 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
1263 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ 1265 /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */
1264 } 1266 }
1265 1267
1268 /* get the terminal config for the setup message now so we don't
1269 * need to send 2 of them */
1270
1271 cflag = port->tty->termios->c_cflag;
1272 device_port = port->number - port->serial->minor;
1273
1274 /* Baud rate calculation takes baud rate as an integer
1275 so other rates can be generated if desired. */
1276 baud_rate = tty_get_baud_rate(port->tty);
1277 /* If no match or invalid, leave as default */
1278 if (baud_rate >= 0
1279 && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
1280 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
1281 p_priv->baud = baud_rate;
1282 }
1283
1284 /* set CTS/RTS handshake etc. */
1285 p_priv->cflag = cflag;
1286 p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
1287
1288 keyspan_send_setup(port, 1);
1289 //mdelay(100);
1290 //keyspan_set_termios(port, NULL);
1291
1266 return (0); 1292 return (0);
1267} 1293}
1268 1294
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index a5ced7e08cbf..c29c91271133 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2711,7 +2711,7 @@ static int mos7840_startup(struct usb_serial *serial)
2711 status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); 2711 status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data);
2712 if (status < 0) { 2712 if (status < 0) {
2713 dbg("Writing ZLP_REG5 failed status-0x%x\n", status); 2713 dbg("Writing ZLP_REG5 failed status-0x%x\n", status);
2714 return -1; 2714 goto error;
2715 } else 2715 } else
2716 dbg("ZLP_REG5 Writing success status%d\n", status); 2716 dbg("ZLP_REG5 Writing success status%d\n", status);
2717 2717
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 2cd3f1d4b687..cf8add91de05 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -86,6 +86,7 @@ static struct usb_device_id id_table [] = {
86 { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) }, 86 { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) },
87 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) }, 87 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) },
88 { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, 88 { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) },
89 { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) },
89 { } /* Terminating entry */ 90 { } /* Terminating entry */
90}; 91};
91 92
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index ed603e3decd6..d31f5d299989 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -104,3 +104,6 @@
104#define WS002IN_VENDOR_ID 0x11f6 104#define WS002IN_VENDOR_ID 0x11f6
105#define WS002IN_PRODUCT_ID 0x2001 105#define WS002IN_PRODUCT_ID 0x2001
106 106
107/* Corega CG-USBRS232R Serial Adapter */
108#define COREGA_VENDOR_ID 0x07aa
109#define COREGA_PRODUCT_ID 0x002a
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 833f6e1e3721..605ebccdcd51 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -136,6 +136,8 @@ static struct usb_device_id id_table_3port [] = {
136 { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ 136 { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
137 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 137 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
138 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 138 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
139 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
140 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
139 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 141 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
140 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ 142 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
141 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/ 143 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 1ba19eaa1970..836a34ae6ec6 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -177,6 +177,10 @@ static int slave_configure(struct scsi_device *sdev)
177 * is an occasional series of retries that will all fail. */ 177 * is an occasional series of retries that will all fail. */
178 sdev->retry_hwerror = 1; 178 sdev->retry_hwerror = 1;
179 179
180 /* USB disks should allow restart. Some drives spin down
181 * automatically, requiring a START-STOP UNIT command. */
182 sdev->allow_restart = 1;
183
180 } else { 184 } else {
181 185
182 /* Non-disk-type devices don't need to blacklist any pages 186 /* Non-disk-type devices don't need to blacklist any pages
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 22ab2380367d..2c27721bd259 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -342,11 +342,11 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
342 US_FL_FIX_CAPACITY), 342 US_FL_FIX_CAPACITY),
343 343
344/* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */ 344/* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */
345UNUSUAL_DEV( 0x04b0, 0x040f, 0x0200, 0x0200, 345UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200,
346 "NIKON", 346 "NIKON",
347 "NIKON DSC D200", 347 "NIKON DSC D200",
348 US_SC_DEVICE, US_PR_DEVICE, NULL, 348 US_SC_DEVICE, US_PR_DEVICE, NULL,
349 US_FL_FIX_CAPACITY), 349 US_FL_FIX_CAPACITY),
350 350
351/* Reported by Emil Larsson <emil@swip.net> */ 351/* Reported by Emil Larsson <emil@swip.net> */
352UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, 352UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101,
@@ -731,6 +731,13 @@ UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
731 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ), 731 US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ),
732#endif 732#endif
733 733
734/* Reported by RTE <raszilki@yandex.ru> */
735UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141,
736 "JetFlash",
737 "TS1GJF2A/120",
738 US_SC_DEVICE, US_PR_DEVICE, NULL,
739 US_FL_MAX_SECTORS_64 ),
740
734/* Fabrizio Fellini <fello@libero.it> */ 741/* Fabrizio Fellini <fello@libero.it> */
735UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, 742UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
736 "Fujifilm", 743 "Fujifilm",
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7d86e9eae915..5b3dbcfcda48 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -641,6 +641,17 @@ config FB_VESA
641 You will get a boot time penguin logo at no additional cost. Please 641 You will get a boot time penguin logo at no additional cost. Please
642 read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. 642 read <file:Documentation/fb/vesafb.txt>. If unsure, say Y.
643 643
644config FB_EFI
645 bool "EFI-based Framebuffer Support"
646 depends on (FB = y) && X86
647 select FB_CFB_FILLRECT
648 select FB_CFB_COPYAREA
649 select FB_CFB_IMAGEBLIT
650 help
651 This is the EFI frame buffer device driver. If the firmware on
652 your platform is UEFI2.0, select Y to add support for
653 Graphics Output Protocol for early console messages to appear.
654
644config FB_IMAC 655config FB_IMAC
645 bool "Intel-based Macintosh Framebuffer Support" 656 bool "Intel-based Macintosh Framebuffer Support"
646 depends on (FB = y) && X86 && EFI 657 depends on (FB = y) && X86 && EFI
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 59d6c45a910d..83e02b3429b6 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_FB_OMAP) += omap/
118obj-$(CONFIG_FB_UVESA) += uvesafb.o 118obj-$(CONFIG_FB_UVESA) += uvesafb.o
119obj-$(CONFIG_FB_VESA) += vesafb.o 119obj-$(CONFIG_FB_VESA) += vesafb.o
120obj-$(CONFIG_FB_IMAC) += imacfb.o 120obj-$(CONFIG_FB_IMAC) += imacfb.o
121obj-$(CONFIG_FB_EFI) += efifb.o
121obj-$(CONFIG_FB_VGA16) += vga16fb.o 122obj-$(CONFIG_FB_VGA16) += vga16fb.o
122obj-$(CONFIG_FB_OF) += offb.o 123obj-$(CONFIG_FB_OF) += offb.o
123obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o 124obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 235b618b4117..11a3a222dfc3 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -268,6 +268,10 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
268 /* Turn off the LCD controller and the DMA controller */ 268 /* Turn off the LCD controller and the DMA controller */
269 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); 269 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
270 270
271 /* Wait for the LCDC core to become idle */
272 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
273 msleep(10);
274
271 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); 275 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
272 276
273 if (info->var.bits_per_pixel == 1) 277 if (info->var.bits_per_pixel == 1)
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
new file mode 100644
index 000000000000..bd779ae44b1e
--- /dev/null
+++ b/drivers/video/efifb.c
@@ -0,0 +1,232 @@
1/*
2 * Framebuffer driver for EFI/UEFI based system
3 *
4 * (c) 2006 Edgar Hucek <gimli@dark-green.com>
5 * Original efi driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de>
6 *
7 */
8
9#include <linux/module.h>
10#include <linux/kernel.h>
11#include <linux/errno.h>
12#include <linux/fb.h>
13#include <linux/platform_device.h>
14#include <linux/screen_info.h>
15
16#include <video/vga.h>
17
18static struct fb_var_screeninfo efifb_defined __initdata = {
19 .activate = FB_ACTIVATE_NOW,
20 .height = -1,
21 .width = -1,
22 .right_margin = 32,
23 .upper_margin = 16,
24 .lower_margin = 4,
25 .vsync_len = 4,
26 .vmode = FB_VMODE_NONINTERLACED,
27};
28
29static struct fb_fix_screeninfo efifb_fix __initdata = {
30 .id = "EFI VGA",
31 .type = FB_TYPE_PACKED_PIXELS,
32 .accel = FB_ACCEL_NONE,
33 .visual = FB_VISUAL_TRUECOLOR,
34};
35
36static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green,
37 unsigned blue, unsigned transp,
38 struct fb_info *info)
39{
40 /*
41 * Set a single color register. The values supplied are
42 * already rounded down to the hardware's capabilities
43 * (according to the entries in the `var' structure). Return
44 * != 0 for invalid regno.
45 */
46
47 if (regno >= info->cmap.len)
48 return 1;
49
50 if (regno < 16) {
51 red >>= 8;
52 green >>= 8;
53 blue >>= 8;
54 ((u32 *)(info->pseudo_palette))[regno] =
55 (red << info->var.red.offset) |
56 (green << info->var.green.offset) |
57 (blue << info->var.blue.offset);
58 }
59 return 0;
60}
61
62static struct fb_ops efifb_ops = {
63 .owner = THIS_MODULE,
64 .fb_setcolreg = efifb_setcolreg,
65 .fb_fillrect = cfb_fillrect,
66 .fb_copyarea = cfb_copyarea,
67 .fb_imageblit = cfb_imageblit,
68};
69
70static int __init efifb_probe(struct platform_device *dev)
71{
72 struct fb_info *info;
73 int err;
74 unsigned int size_vmode;
75 unsigned int size_remap;
76 unsigned int size_total;
77
78 efifb_fix.smem_start = screen_info.lfb_base;
79 efifb_defined.bits_per_pixel = screen_info.lfb_depth;
80 efifb_defined.xres = screen_info.lfb_width;
81 efifb_defined.yres = screen_info.lfb_height;
82 efifb_fix.line_length = screen_info.lfb_linelength;
83
84 /* size_vmode -- that is the amount of memory needed for the
85 * used video mode, i.e. the minimum amount of
86 * memory we need. */
87 size_vmode = efifb_defined.yres * efifb_fix.line_length;
88
89 /* size_total -- all video memory we have. Used for
90 * entries, ressource allocation and bounds
91 * checking. */
92 size_total = screen_info.lfb_size;
93 if (size_total < size_vmode)
94 size_total = size_vmode;
95
96 /* size_remap -- the amount of video memory we are going to
97 * use for efifb. With modern cards it is no
98 * option to simply use size_total as that
99 * wastes plenty of kernel address space. */
100 size_remap = size_vmode * 2;
101 if (size_remap < size_vmode)
102 size_remap = size_vmode;
103 if (size_remap > size_total)
104 size_remap = size_total;
105 efifb_fix.smem_len = size_remap;
106
107 if (!request_mem_region(efifb_fix.smem_start, size_total, "efifb"))
108 /* We cannot make this fatal. Sometimes this comes from magic
109 spaces our resource handlers simply don't know about */
110 printk(KERN_WARNING
111 "efifb: cannot reserve video memory at 0x%lx\n",
112 efifb_fix.smem_start);
113
114 info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev);
115 if (!info) {
116 err = -ENOMEM;
117 goto err_release_mem;
118 }
119 info->pseudo_palette = info->par;
120 info->par = NULL;
121
122 info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len);
123 if (!info->screen_base) {
124 printk(KERN_ERR "efifb: abort, cannot ioremap video memory "
125 "0x%x @ 0x%lx\n",
126 efifb_fix.smem_len, efifb_fix.smem_start);
127 err = -EIO;
128 goto err_unmap;
129 }
130
131 printk(KERN_INFO "efifb: framebuffer at 0x%lx, mapped to 0x%p, "
132 "using %dk, total %dk\n",
133 efifb_fix.smem_start, info->screen_base,
134 size_remap/1024, size_total/1024);
135 printk(KERN_INFO "efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
136 efifb_defined.xres, efifb_defined.yres,
137 efifb_defined.bits_per_pixel, efifb_fix.line_length,
138 screen_info.pages);
139
140 efifb_defined.xres_virtual = efifb_defined.xres;
141 efifb_defined.yres_virtual = efifb_fix.smem_len /
142 efifb_fix.line_length;
143 printk(KERN_INFO "efifb: scrolling: redraw\n");
144 efifb_defined.yres_virtual = efifb_defined.yres;
145
146 /* some dummy values for timing to make fbset happy */
147 efifb_defined.pixclock = 10000000 / efifb_defined.xres *
148 1000 / efifb_defined.yres;
149 efifb_defined.left_margin = (efifb_defined.xres / 8) & 0xf8;
150 efifb_defined.hsync_len = (efifb_defined.xres / 8) & 0xf8;
151
152 efifb_defined.red.offset = screen_info.red_pos;
153 efifb_defined.red.length = screen_info.red_size;
154 efifb_defined.green.offset = screen_info.green_pos;
155 efifb_defined.green.length = screen_info.green_size;
156 efifb_defined.blue.offset = screen_info.blue_pos;
157 efifb_defined.blue.length = screen_info.blue_size;
158 efifb_defined.transp.offset = screen_info.rsvd_pos;
159 efifb_defined.transp.length = screen_info.rsvd_size;
160
161 printk(KERN_INFO "efifb: %s: "
162 "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
163 "Truecolor",
164 screen_info.rsvd_size,
165 screen_info.red_size,
166 screen_info.green_size,
167 screen_info.blue_size,
168 screen_info.rsvd_pos,
169 screen_info.red_pos,
170 screen_info.green_pos,
171 screen_info.blue_pos);
172
173 efifb_fix.ypanstep = 0;
174 efifb_fix.ywrapstep = 0;
175
176 info->fbops = &efifb_ops;
177 info->var = efifb_defined;
178 info->fix = efifb_fix;
179 info->flags = FBINFO_FLAG_DEFAULT;
180
181 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
182 err = -ENOMEM;
183 goto err_unmap;
184 }
185 if (register_framebuffer(info) < 0) {
186 err = -EINVAL;
187 goto err_fb_dealoc;
188 }
189 printk(KERN_INFO "fb%d: %s frame buffer device\n",
190 info->node, info->fix.id);
191 return 0;
192
193err_fb_dealoc:
194 fb_dealloc_cmap(&info->cmap);
195err_unmap:
196 iounmap(info->screen_base);
197 framebuffer_release(info);
198err_release_mem:
199 release_mem_region(efifb_fix.smem_start, size_total);
200 return err;
201}
202
203static struct platform_driver efifb_driver = {
204 .probe = efifb_probe,
205 .driver = {
206 .name = "efifb",
207 },
208};
209
210static struct platform_device efifb_device = {
211 .name = "efifb",
212};
213
214static int __init efifb_init(void)
215{
216 int ret;
217
218 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
219 return -ENODEV;
220
221 ret = platform_driver_register(&efifb_driver);
222
223 if (!ret) {
224 ret = platform_device_register(&efifb_device);
225 if (ret)
226 platform_driver_unregister(&efifb_driver);
227 }
228 return ret;
229}
230module_init(efifb_init);
231
232MODULE_LICENSE("GPL");
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c
index f836137a0eda..a0df63289b5f 100644
--- a/drivers/video/fb_ddc.c
+++ b/drivers/video/fb_ddc.c
@@ -56,13 +56,12 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
56 int i, j; 56 int i, j;
57 57
58 algo_data->setscl(algo_data->data, 1); 58 algo_data->setscl(algo_data->data, 1);
59 algo_data->setscl(algo_data->data, 0);
60 59
61 for (i = 0; i < 3; i++) { 60 for (i = 0; i < 3; i++) {
62 /* For some old monitors we need the 61 /* For some old monitors we need the
63 * following process to initialize/stop DDC 62 * following process to initialize/stop DDC
64 */ 63 */
65 algo_data->setsda(algo_data->data, 0); 64 algo_data->setsda(algo_data->data, 1);
66 msleep(13); 65 msleep(13);
67 66
68 algo_data->setscl(algo_data->data, 1); 67 algo_data->setscl(algo_data->data, 1);
@@ -97,14 +96,15 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
97 algo_data->setsda(algo_data->data, 1); 96 algo_data->setsda(algo_data->data, 1);
98 msleep(15); 97 msleep(15);
99 algo_data->setscl(algo_data->data, 0); 98 algo_data->setscl(algo_data->data, 0);
99 algo_data->setsda(algo_data->data, 0);
100 if (edid) 100 if (edid)
101 break; 101 break;
102 } 102 }
103 /* Release the DDC lines when done or the Apple Cinema HD display 103 /* Release the DDC lines when done or the Apple Cinema HD display
104 * will switch off 104 * will switch off
105 */ 105 */
106 algo_data->setsda(algo_data->data, 0); 106 algo_data->setsda(algo_data->data, 1);
107 algo_data->setscl(algo_data->data, 0); 107 algo_data->setscl(algo_data->data, 1);
108 108
109 return edid; 109 return edid;
110} 110}
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c
index 6455fd2a39f2..9366ef2bb5f7 100644
--- a/drivers/video/imacfb.c
+++ b/drivers/video/imacfb.c
@@ -234,10 +234,6 @@ static int __init imacfb_probe(struct platform_device *dev)
234 size_remap = size_total; 234 size_remap = size_total;
235 imacfb_fix.smem_len = size_remap; 235 imacfb_fix.smem_len = size_remap;
236 236
237#ifndef __i386__
238 screen_info.imacpm_seg = 0;
239#endif
240
241 if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { 237 if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) {
242 printk(KERN_WARNING 238 printk(KERN_WARNING
243 "imacfb: cannot reserve video memory at 0x%lx\n", 239 "imacfb: cannot reserve video memory at 0x%lx\n",
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 75836aa83191..9c56c492a693 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -51,7 +51,6 @@
51#define L1GPU_DISPLAY_SYNC_HSYNC 1 51#define L1GPU_DISPLAY_SYNC_HSYNC 1
52#define L1GPU_DISPLAY_SYNC_VSYNC 2 52#define L1GPU_DISPLAY_SYNC_VSYNC 2
53 53
54#define DDR_SIZE (0) /* used no ddr */
55#define GPU_CMD_BUF_SIZE (64 * 1024) 54#define GPU_CMD_BUF_SIZE (64 * 1024)
56#define GPU_IOIF (0x0d000000UL) 55#define GPU_IOIF (0x0d000000UL)
57#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) 56#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64)
@@ -1060,6 +1059,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1060 u64 xdr_lpar; 1059 u64 xdr_lpar;
1061 int status, res_index; 1060 int status, res_index;
1062 struct task_struct *task; 1061 struct task_struct *task;
1062 unsigned long max_ps3fb_size;
1063 1063
1064 status = ps3_open_hv_device(dev); 1064 status = ps3_open_hv_device(dev);
1065 if (status) { 1065 if (status) {
@@ -1085,8 +1085,15 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1085 1085
1086 ps3fb_set_sync(&dev->core); 1086 ps3fb_set_sync(&dev->core);
1087 1087
1088 max_ps3fb_size = _ALIGN_UP(GPU_IOIF, 256*1024*1024) - GPU_IOIF;
1089 if (ps3fb_videomemory.size > max_ps3fb_size) {
1090 dev_info(&dev->core, "Limiting ps3fb mem size to %lu bytes\n",
1091 max_ps3fb_size);
1092 ps3fb_videomemory.size = max_ps3fb_size;
1093 }
1094
1088 /* get gpu context handle */ 1095 /* get gpu context handle */
1089 status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0, 1096 status = lv1_gpu_memory_allocate(ps3fb_videomemory.size, 0, 0, 0, 0,
1090 &ps3fb.memory_handle, &ddr_lpar); 1097 &ps3fb.memory_handle, &ddr_lpar);
1091 if (status) { 1098 if (status) {
1092 dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n", 1099 dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n",
diff --git a/fs/Kconfig b/fs/Kconfig
index 429a00228507..635f3e286ad8 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -459,6 +459,15 @@ config OCFS2_DEBUG_MASKLOG
459 This option will enlarge your kernel, but it allows debugging of 459 This option will enlarge your kernel, but it allows debugging of
460 ocfs2 filesystem issues. 460 ocfs2 filesystem issues.
461 461
462config OCFS2_DEBUG_FS
463 bool "OCFS2 expensive checks"
464 depends on OCFS2_FS
465 default n
466 help
467 This option will enable expensive consistency checks. Enable
468 this option for debugging only as it is likely to decrease
469 performance of the filesystem.
470
462config MINIX_FS 471config MINIX_FS
463 tristate "Minix fs support" 472 tristate "Minix fs support"
464 help 473 help
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index bd26e4cbb994..e8b7c3a98a54 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1954,6 +1954,12 @@ ULONG_IOCTL(TIOCSCTTY)
1954COMPATIBLE_IOCTL(TIOCGPTN) 1954COMPATIBLE_IOCTL(TIOCGPTN)
1955COMPATIBLE_IOCTL(TIOCSPTLCK) 1955COMPATIBLE_IOCTL(TIOCSPTLCK)
1956COMPATIBLE_IOCTL(TIOCSERGETLSR) 1956COMPATIBLE_IOCTL(TIOCSERGETLSR)
1957#ifdef TCGETS2
1958COMPATIBLE_IOCTL(TCGETS2)
1959COMPATIBLE_IOCTL(TCSETS2)
1960COMPATIBLE_IOCTL(TCSETSW2)
1961COMPATIBLE_IOCTL(TCSETSF2)
1962#endif
1957/* Little f */ 1963/* Little f */
1958COMPATIBLE_IOCTL(FIOCLEX) 1964COMPATIBLE_IOCTL(FIOCLEX)
1959COMPATIBLE_IOCTL(FIONCLEX) 1965COMPATIBLE_IOCTL(FIONCLEX)
diff --git a/fs/exec.c b/fs/exec.c
index 4ccaaa4b13b2..282240afe99e 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1780,6 +1780,12 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
1780 but keep the previous behaviour for now. */ 1780 but keep the previous behaviour for now. */
1781 if (!ispipe && !S_ISREG(inode->i_mode)) 1781 if (!ispipe && !S_ISREG(inode->i_mode))
1782 goto close_fail; 1782 goto close_fail;
1783 /*
1784 * Dont allow local users get cute and trick others to coredump
1785 * into their pre-created files:
1786 */
1787 if (inode->i_uid != current->fsuid)
1788 goto close_fail;
1783 if (!file->f_op) 1789 if (!file->f_op)
1784 goto close_fail; 1790 goto close_fail;
1785 if (!file->f_op->write) 1791 if (!file->f_op->write)
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 7730388c4931..c87ae29c19cb 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -178,3 +178,10 @@ extern const struct inode_operations ext2_special_inode_operations;
178/* symlink.c */ 178/* symlink.c */
179extern const struct inode_operations ext2_fast_symlink_inode_operations; 179extern const struct inode_operations ext2_fast_symlink_inode_operations;
180extern const struct inode_operations ext2_symlink_inode_operations; 180extern const struct inode_operations ext2_symlink_inode_operations;
181
182static inline ext2_fsblk_t
183ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
184{
185 return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
186 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
187}
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 3763757f9fe7..80d2f5292cf9 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -132,6 +132,21 @@ static void fuse_lookup_init(struct fuse_req *req, struct inode *dir,
132 req->out.args[0].value = outarg; 132 req->out.args[0].value = outarg;
133} 133}
134 134
135static u64 fuse_get_attr_version(struct fuse_conn *fc)
136{
137 u64 curr_version;
138
139 /*
140 * The spin lock isn't actually needed on 64bit archs, but we
141 * don't yet care too much about such optimizations.
142 */
143 spin_lock(&fc->lock);
144 curr_version = fc->attr_version;
145 spin_unlock(&fc->lock);
146
147 return curr_version;
148}
149
135/* 150/*
136 * Check whether the dentry is still valid 151 * Check whether the dentry is still valid
137 * 152 *
@@ -171,9 +186,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
171 return 0; 186 return 0;
172 } 187 }
173 188
174 spin_lock(&fc->lock); 189 attr_version = fuse_get_attr_version(fc);
175 attr_version = fc->attr_version;
176 spin_unlock(&fc->lock);
177 190
178 parent = dget_parent(entry); 191 parent = dget_parent(entry);
179 fuse_lookup_init(req, parent->d_inode, entry, &outarg); 192 fuse_lookup_init(req, parent->d_inode, entry, &outarg);
@@ -264,9 +277,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
264 return ERR_PTR(PTR_ERR(forget_req)); 277 return ERR_PTR(PTR_ERR(forget_req));
265 } 278 }
266 279
267 spin_lock(&fc->lock); 280 attr_version = fuse_get_attr_version(fc);
268 attr_version = fc->attr_version;
269 spin_unlock(&fc->lock);
270 281
271 fuse_lookup_init(req, dir, entry, &outarg); 282 fuse_lookup_init(req, dir, entry, &outarg);
272 request_send(fc, req); 283 request_send(fc, req);
@@ -646,6 +657,9 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent,
646 err = req->out.h.error; 657 err = req->out.h.error;
647 fuse_put_request(fc, req); 658 fuse_put_request(fc, req);
648 if (!err) { 659 if (!err) {
660 /* ctime changes */
661 fuse_invalidate_attr(oldent->d_inode);
662
649 fuse_invalidate_attr(olddir); 663 fuse_invalidate_attr(olddir);
650 if (olddir != newdir) 664 if (olddir != newdir)
651 fuse_invalidate_attr(newdir); 665 fuse_invalidate_attr(newdir);
@@ -733,9 +747,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
733 if (IS_ERR(req)) 747 if (IS_ERR(req))
734 return PTR_ERR(req); 748 return PTR_ERR(req);
735 749
736 spin_lock(&fc->lock); 750 attr_version = fuse_get_attr_version(fc);
737 attr_version = fc->attr_version;
738 spin_unlock(&fc->lock);
739 751
740 memset(&inarg, 0, sizeof(inarg)); 752 memset(&inarg, 0, sizeof(inarg));
741 memset(&outarg, 0, sizeof(outarg)); 753 memset(&outarg, 0, sizeof(outarg));
@@ -775,6 +787,31 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
775 return err; 787 return err;
776} 788}
777 789
790int fuse_update_attributes(struct inode *inode, struct kstat *stat,
791 struct file *file, bool *refreshed)
792{
793 struct fuse_inode *fi = get_fuse_inode(inode);
794 int err;
795 bool r;
796
797 if (fi->i_time < get_jiffies_64()) {
798 r = true;
799 err = fuse_do_getattr(inode, stat, file);
800 } else {
801 r = false;
802 err = 0;
803 if (stat) {
804 generic_fillattr(inode, stat);
805 stat->mode = fi->orig_i_mode;
806 }
807 }
808
809 if (refreshed != NULL)
810 *refreshed = r;
811
812 return err;
813}
814
778/* 815/*
779 * Calling into a user-controlled filesystem gives the filesystem 816 * Calling into a user-controlled filesystem gives the filesystem
780 * daemon ptrace-like capabilities over the requester process. This 817 * daemon ptrace-like capabilities over the requester process. This
@@ -862,14 +899,9 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
862 */ 899 */
863 if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) || 900 if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) ||
864 ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) { 901 ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
865 struct fuse_inode *fi = get_fuse_inode(inode); 902 err = fuse_update_attributes(inode, NULL, NULL, &refreshed);
866 if (fi->i_time < get_jiffies_64()) { 903 if (err)
867 err = fuse_do_getattr(inode, NULL, NULL); 904 return err;
868 if (err)
869 return err;
870
871 refreshed = true;
872 }
873 } 905 }
874 906
875 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 907 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
@@ -935,7 +967,6 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
935 struct page *page; 967 struct page *page;
936 struct inode *inode = file->f_path.dentry->d_inode; 968 struct inode *inode = file->f_path.dentry->d_inode;
937 struct fuse_conn *fc = get_fuse_conn(inode); 969 struct fuse_conn *fc = get_fuse_conn(inode);
938 struct fuse_file *ff = file->private_data;
939 struct fuse_req *req; 970 struct fuse_req *req;
940 971
941 if (is_bad_inode(inode)) 972 if (is_bad_inode(inode))
@@ -952,7 +983,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
952 } 983 }
953 req->num_pages = 1; 984 req->num_pages = 1;
954 req->pages[0] = page; 985 req->pages[0] = page;
955 fuse_read_fill(req, ff, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR); 986 fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
956 request_send(fc, req); 987 request_send(fc, req);
957 nbytes = req->out.args[0].size; 988 nbytes = req->out.args[0].size;
958 err = req->out.h.error; 989 err = req->out.h.error;
@@ -1173,22 +1204,12 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1173 struct kstat *stat) 1204 struct kstat *stat)
1174{ 1205{
1175 struct inode *inode = entry->d_inode; 1206 struct inode *inode = entry->d_inode;
1176 struct fuse_inode *fi = get_fuse_inode(inode);
1177 struct fuse_conn *fc = get_fuse_conn(inode); 1207 struct fuse_conn *fc = get_fuse_conn(inode);
1178 int err;
1179 1208
1180 if (!fuse_allow_task(fc, current)) 1209 if (!fuse_allow_task(fc, current))
1181 return -EACCES; 1210 return -EACCES;
1182 1211
1183 if (fi->i_time < get_jiffies_64()) 1212 return fuse_update_attributes(inode, stat, NULL, NULL);
1184 err = fuse_do_getattr(inode, stat, NULL);
1185 else {
1186 err = 0;
1187 generic_fillattr(inode, stat);
1188 stat->mode = fi->orig_i_mode;
1189 }
1190
1191 return err;
1192} 1213}
1193 1214
1194static int fuse_setxattr(struct dentry *entry, const char *name, 1215static int fuse_setxattr(struct dentry *entry, const char *name,
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 535b37399009..bb05d227cf30 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -289,14 +289,16 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync)
289 return fuse_fsync_common(file, de, datasync, 0); 289 return fuse_fsync_common(file, de, datasync, 0);
290} 290}
291 291
292void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff, 292void fuse_read_fill(struct fuse_req *req, struct file *file,
293 struct inode *inode, loff_t pos, size_t count, int opcode) 293 struct inode *inode, loff_t pos, size_t count, int opcode)
294{ 294{
295 struct fuse_read_in *inarg = &req->misc.read_in; 295 struct fuse_read_in *inarg = &req->misc.read_in;
296 struct fuse_file *ff = file->private_data;
296 297
297 inarg->fh = ff->fh; 298 inarg->fh = ff->fh;
298 inarg->offset = pos; 299 inarg->offset = pos;
299 inarg->size = count; 300 inarg->size = count;
301 inarg->flags = file->f_flags;
300 req->in.h.opcode = opcode; 302 req->in.h.opcode = opcode;
301 req->in.h.nodeid = get_node_id(inode); 303 req->in.h.nodeid = get_node_id(inode);
302 req->in.numargs = 1; 304 req->in.numargs = 1;
@@ -313,9 +315,8 @@ static size_t fuse_send_read(struct fuse_req *req, struct file *file,
313 fl_owner_t owner) 315 fl_owner_t owner)
314{ 316{
315 struct fuse_conn *fc = get_fuse_conn(inode); 317 struct fuse_conn *fc = get_fuse_conn(inode);
316 struct fuse_file *ff = file->private_data;
317 318
318 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ); 319 fuse_read_fill(req, file, inode, pos, count, FUSE_READ);
319 if (owner != NULL) { 320 if (owner != NULL) {
320 struct fuse_read_in *inarg = &req->misc.read_in; 321 struct fuse_read_in *inarg = &req->misc.read_in;
321 322
@@ -376,15 +377,16 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req)
376 fuse_put_request(fc, req); 377 fuse_put_request(fc, req);
377} 378}
378 379
379static void fuse_send_readpages(struct fuse_req *req, struct fuse_file *ff, 380static void fuse_send_readpages(struct fuse_req *req, struct file *file,
380 struct inode *inode) 381 struct inode *inode)
381{ 382{
382 struct fuse_conn *fc = get_fuse_conn(inode); 383 struct fuse_conn *fc = get_fuse_conn(inode);
383 loff_t pos = page_offset(req->pages[0]); 384 loff_t pos = page_offset(req->pages[0]);
384 size_t count = req->num_pages << PAGE_CACHE_SHIFT; 385 size_t count = req->num_pages << PAGE_CACHE_SHIFT;
385 req->out.page_zeroing = 1; 386 req->out.page_zeroing = 1;
386 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ); 387 fuse_read_fill(req, file, inode, pos, count, FUSE_READ);
387 if (fc->async_read) { 388 if (fc->async_read) {
389 struct fuse_file *ff = file->private_data;
388 req->ff = fuse_file_get(ff); 390 req->ff = fuse_file_get(ff);
389 req->end = fuse_readpages_end; 391 req->end = fuse_readpages_end;
390 request_send_background(fc, req); 392 request_send_background(fc, req);
@@ -396,7 +398,7 @@ static void fuse_send_readpages(struct fuse_req *req, struct fuse_file *ff,
396 398
397struct fuse_fill_data { 399struct fuse_fill_data {
398 struct fuse_req *req; 400 struct fuse_req *req;
399 struct fuse_file *ff; 401 struct file *file;
400 struct inode *inode; 402 struct inode *inode;
401}; 403};
402 404
@@ -411,7 +413,7 @@ static int fuse_readpages_fill(void *_data, struct page *page)
411 (req->num_pages == FUSE_MAX_PAGES_PER_REQ || 413 (req->num_pages == FUSE_MAX_PAGES_PER_REQ ||
412 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read || 414 (req->num_pages + 1) * PAGE_CACHE_SIZE > fc->max_read ||
413 req->pages[req->num_pages - 1]->index + 1 != page->index)) { 415 req->pages[req->num_pages - 1]->index + 1 != page->index)) {
414 fuse_send_readpages(req, data->ff, inode); 416 fuse_send_readpages(req, data->file, inode);
415 data->req = req = fuse_get_req(fc); 417 data->req = req = fuse_get_req(fc);
416 if (IS_ERR(req)) { 418 if (IS_ERR(req)) {
417 unlock_page(page); 419 unlock_page(page);
@@ -435,7 +437,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
435 if (is_bad_inode(inode)) 437 if (is_bad_inode(inode))
436 goto out; 438 goto out;
437 439
438 data.ff = file->private_data; 440 data.file = file;
439 data.inode = inode; 441 data.inode = inode;
440 data.req = fuse_get_req(fc); 442 data.req = fuse_get_req(fc);
441 err = PTR_ERR(data.req); 443 err = PTR_ERR(data.req);
@@ -445,7 +447,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
445 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); 447 err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
446 if (!err) { 448 if (!err) {
447 if (data.req->num_pages) 449 if (data.req->num_pages)
448 fuse_send_readpages(data.req, data.ff, inode); 450 fuse_send_readpages(data.req, file, inode);
449 else 451 else
450 fuse_put_request(fc, data.req); 452 fuse_put_request(fc, data.req);
451 } 453 }
@@ -453,11 +455,31 @@ out:
453 return err; 455 return err;
454} 456}
455 457
456static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff, 458static ssize_t fuse_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
459 unsigned long nr_segs, loff_t pos)
460{
461 struct inode *inode = iocb->ki_filp->f_mapping->host;
462
463 if (pos + iov_length(iov, nr_segs) > i_size_read(inode)) {
464 int err;
465 /*
466 * If trying to read past EOF, make sure the i_size
467 * attribute is up-to-date.
468 */
469 err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL);
470 if (err)
471 return err;
472 }
473
474 return generic_file_aio_read(iocb, iov, nr_segs, pos);
475}
476
477static void fuse_write_fill(struct fuse_req *req, struct file *file,
457 struct inode *inode, loff_t pos, size_t count, 478 struct inode *inode, loff_t pos, size_t count,
458 int writepage) 479 int writepage)
459{ 480{
460 struct fuse_conn *fc = get_fuse_conn(inode); 481 struct fuse_conn *fc = get_fuse_conn(inode);
482 struct fuse_file *ff = file->private_data;
461 struct fuse_write_in *inarg = &req->misc.write.in; 483 struct fuse_write_in *inarg = &req->misc.write.in;
462 struct fuse_write_out *outarg = &req->misc.write.out; 484 struct fuse_write_out *outarg = &req->misc.write.out;
463 485
@@ -466,6 +488,7 @@ static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff,
466 inarg->offset = pos; 488 inarg->offset = pos;
467 inarg->size = count; 489 inarg->size = count;
468 inarg->write_flags = writepage ? FUSE_WRITE_CACHE : 0; 490 inarg->write_flags = writepage ? FUSE_WRITE_CACHE : 0;
491 inarg->flags = file->f_flags;
469 req->in.h.opcode = FUSE_WRITE; 492 req->in.h.opcode = FUSE_WRITE;
470 req->in.h.nodeid = get_node_id(inode); 493 req->in.h.nodeid = get_node_id(inode);
471 req->in.argpages = 1; 494 req->in.argpages = 1;
@@ -486,7 +509,7 @@ static size_t fuse_send_write(struct fuse_req *req, struct file *file,
486 fl_owner_t owner) 509 fl_owner_t owner)
487{ 510{
488 struct fuse_conn *fc = get_fuse_conn(inode); 511 struct fuse_conn *fc = get_fuse_conn(inode);
489 fuse_write_fill(req, file->private_data, inode, pos, count, 0); 512 fuse_write_fill(req, file, inode, pos, count, 0);
490 if (owner != NULL) { 513 if (owner != NULL) {
491 struct fuse_write_in *inarg = &req->misc.write.in; 514 struct fuse_write_in *inarg = &req->misc.write.in;
492 inarg->write_flags |= FUSE_WRITE_LOCKOWNER; 515 inarg->write_flags |= FUSE_WRITE_LOCKOWNER;
@@ -887,7 +910,7 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block)
887static const struct file_operations fuse_file_operations = { 910static const struct file_operations fuse_file_operations = {
888 .llseek = generic_file_llseek, 911 .llseek = generic_file_llseek,
889 .read = do_sync_read, 912 .read = do_sync_read,
890 .aio_read = generic_file_aio_read, 913 .aio_read = fuse_file_aio_read,
891 .write = do_sync_write, 914 .write = do_sync_write,
892 .aio_write = generic_file_aio_write, 915 .aio_write = generic_file_aio_write,
893 .mmap = fuse_file_mmap, 916 .mmap = fuse_file_mmap,
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 6c5461de1a5f..3ab8a3048e8b 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -447,7 +447,7 @@ void fuse_send_forget(struct fuse_conn *fc, struct fuse_req *req,
447/** 447/**
448 * Initialize READ or READDIR request 448 * Initialize READ or READDIR request
449 */ 449 */
450void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff, 450void fuse_read_fill(struct fuse_req *req, struct file *file,
451 struct inode *inode, loff_t pos, size_t count, int opcode); 451 struct inode *inode, loff_t pos, size_t count, int opcode);
452 452
453/** 453/**
@@ -593,3 +593,6 @@ int fuse_valid_type(int m);
593int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task); 593int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);
594 594
595u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id); 595u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
596
597int fuse_update_attributes(struct inode *inode, struct kstat *stat,
598 struct file *file, bool *refreshed);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 9a68d6970845..84f9f7dfdf5b 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -56,6 +56,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
56 fi->i_time = 0; 56 fi->i_time = 0;
57 fi->nodeid = 0; 57 fi->nodeid = 0;
58 fi->nlookup = 0; 58 fi->nlookup = 0;
59 fi->attr_version = 0;
59 INIT_LIST_HEAD(&fi->write_files); 60 INIT_LIST_HEAD(&fi->write_files);
60 fi->forget_req = fuse_request_alloc(); 61 fi->forget_req = fuse_request_alloc();
61 if (!fi->forget_req) { 62 if (!fi->forget_req) {
@@ -562,8 +563,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
562 arg->major = FUSE_KERNEL_VERSION; 563 arg->major = FUSE_KERNEL_VERSION;
563 arg->minor = FUSE_KERNEL_MINOR_VERSION; 564 arg->minor = FUSE_KERNEL_MINOR_VERSION;
564 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; 565 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
565 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_FILE_OPS | 566 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC;
566 FUSE_ATOMIC_O_TRUNC;
567 req->in.h.opcode = FUSE_INIT; 567 req->in.h.opcode = FUSE_INIT;
568 req->in.numargs = 1; 568 req->in.numargs = 1;
569 req->in.args[0].size = sizeof(*arg); 569 req->in.args[0].size = sizeof(*arg);
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 556e34ccb005..56f7790cad46 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -1514,7 +1514,7 @@ int ocfs2_size_fits_inline_data(struct buffer_head *di_bh, u64 new_size)
1514{ 1514{
1515 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 1515 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
1516 1516
1517 if (new_size < le16_to_cpu(di->id2.i_data.id_count)) 1517 if (new_size <= le16_to_cpu(di->id2.i_data.id_count))
1518 return 1; 1518 return 1;
1519 return 0; 1519 return 0;
1520} 1520}
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index cd046060114e..597e064bb94f 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -212,7 +212,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
212#define mlog_errno(st) do { \ 212#define mlog_errno(st) do { \
213 int _st = (st); \ 213 int _st = (st); \
214 if (_st != -ERESTARTSYS && _st != -EINTR && \ 214 if (_st != -ERESTARTSYS && _st != -EINTR && \
215 _st != AOP_TRUNCATED_PAGE) \ 215 _st != AOP_TRUNCATED_PAGE && _st != -ENOSPC) \
216 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ 216 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
217} while (0) 217} while (0)
218 218
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 1957a5ed219e..9923278ea6d4 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -344,12 +344,24 @@ static void ocfs2_dentry_iput(struct dentry *dentry, struct inode *inode)
344{ 344{
345 struct ocfs2_dentry_lock *dl = dentry->d_fsdata; 345 struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
346 346
347 mlog_bug_on_msg(!dl && !(dentry->d_flags & DCACHE_DISCONNECTED), 347 if (!dl) {
348 "dentry: %.*s\n", dentry->d_name.len, 348 /*
349 dentry->d_name.name); 349 * No dentry lock is ok if we're disconnected or
350 * unhashed.
351 */
352 if (!(dentry->d_flags & DCACHE_DISCONNECTED) &&
353 !d_unhashed(dentry)) {
354 unsigned long long ino = 0ULL;
355 if (inode)
356 ino = (unsigned long long)OCFS2_I(inode)->ip_blkno;
357 mlog(ML_ERROR, "Dentry is missing cluster lock. "
358 "inode: %llu, d_flags: 0x%x, d_name: %.*s\n",
359 ino, dentry->d_flags, dentry->d_name.len,
360 dentry->d_name.name);
361 }
350 362
351 if (!dl)
352 goto out; 363 goto out;
364 }
353 365
354 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %.*s, count: %u\n", 366 mlog_bug_on_msg(dl->dl_count == 0, "dentry: %.*s, count: %u\n",
355 dentry->d_name.len, dentry->d_name.name, 367 dentry->d_name.len, dentry->d_name.name,
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 62e4a7daa286..a54d33d95ada 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -908,7 +908,7 @@ lookup:
908 * but they might own this lockres. wait on them. */ 908 * but they might own this lockres. wait on them. */
909 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); 909 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0);
910 if (bit < O2NM_MAX_NODES) { 910 if (bit < O2NM_MAX_NODES) {
911 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to" 911 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to "
912 "recover before lock mastery can begin\n", 912 "recover before lock mastery can begin\n",
913 dlm->name, namelen, (char *)lockid, bit); 913 dlm->name, namelen, (char *)lockid, bit);
914 wait_on_recovery = 1; 914 wait_on_recovery = 1;
@@ -962,7 +962,7 @@ redo_request:
962 spin_lock(&dlm->spinlock); 962 spin_lock(&dlm->spinlock);
963 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0); 963 bit = find_next_bit(dlm->recovery_map, O2NM_MAX_NODES, 0);
964 if (bit < O2NM_MAX_NODES) { 964 if (bit < O2NM_MAX_NODES) {
965 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to" 965 mlog(ML_NOTICE, "%s:%.*s: at least one node (%d) to "
966 "recover before lock mastery can begin\n", 966 "recover before lock mastery can begin\n",
967 dlm->name, namelen, (char *)lockid, bit); 967 dlm->name, namelen, (char *)lockid, bit);
968 wait_on_recovery = 1; 968 wait_on_recovery = 1;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index bbac7cd33e0b..b75b2e1f0e42 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -399,7 +399,7 @@ static int ocfs2_truncate_file(struct inode *inode,
399 399
400 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 400 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
401 status = ocfs2_truncate_inline(inode, di_bh, new_i_size, 401 status = ocfs2_truncate_inline(inode, di_bh, new_i_size,
402 i_size_read(inode), 0); 402 i_size_read(inode), 1);
403 if (status) 403 if (status)
404 mlog_errno(status); 404 mlog_errno(status);
405 405
@@ -1521,6 +1521,7 @@ static int ocfs2_remove_inode_range(struct inode *inode,
1521 u32 trunc_start, trunc_len, cpos, phys_cpos, alloc_size; 1521 u32 trunc_start, trunc_len, cpos, phys_cpos, alloc_size;
1522 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1522 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1523 struct ocfs2_cached_dealloc_ctxt dealloc; 1523 struct ocfs2_cached_dealloc_ctxt dealloc;
1524 struct address_space *mapping = inode->i_mapping;
1524 1525
1525 ocfs2_init_dealloc_ctxt(&dealloc); 1526 ocfs2_init_dealloc_ctxt(&dealloc);
1526 1527
@@ -1529,10 +1530,20 @@ static int ocfs2_remove_inode_range(struct inode *inode,
1529 1530
1530 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 1531 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
1531 ret = ocfs2_truncate_inline(inode, di_bh, byte_start, 1532 ret = ocfs2_truncate_inline(inode, di_bh, byte_start,
1532 byte_start + byte_len, 1); 1533 byte_start + byte_len, 0);
1533 if (ret) 1534 if (ret) {
1534 mlog_errno(ret); 1535 mlog_errno(ret);
1535 return ret; 1536 goto out;
1537 }
1538 /*
1539 * There's no need to get fancy with the page cache
1540 * truncate of an inline-data inode. We're talking
1541 * about less than a page here, which will be cached
1542 * in the dinode buffer anyway.
1543 */
1544 unmap_mapping_range(mapping, 0, 0, 0);
1545 truncate_inode_pages(mapping, 0);
1546 goto out;
1536 } 1547 }
1537 1548
1538 trunc_start = ocfs2_clusters_for_bytes(osb->sb, byte_start); 1549 trunc_start = ocfs2_clusters_for_bytes(osb->sb, byte_start);
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 1d5e0cb0fda1..ebb2bbe30f35 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -455,8 +455,8 @@ static int ocfs2_read_locked_inode(struct inode *inode,
455 status = -EINVAL; 455 status = -EINVAL;
456 fe = (struct ocfs2_dinode *) bh->b_data; 456 fe = (struct ocfs2_dinode *) bh->b_data;
457 if (!OCFS2_IS_VALID_DINODE(fe)) { 457 if (!OCFS2_IS_VALID_DINODE(fe)) {
458 mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n", 458 mlog(0, "Invalid dinode #%llu: signature = %.*s\n",
459 (unsigned long long)le64_to_cpu(fe->i_blkno), 7, 459 (unsigned long long)args->fi_blkno, 7,
460 fe->i_signature); 460 fe->i_signature);
461 goto bail; 461 goto bail;
462 } 462 }
@@ -863,7 +863,7 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
863 status = ocfs2_try_open_lock(inode, 1); 863 status = ocfs2_try_open_lock(inode, 1);
864 if (status == -EAGAIN) { 864 if (status == -EAGAIN) {
865 status = 0; 865 status = 0;
866 mlog(0, "Skipping delete of %llu because it is in use on" 866 mlog(0, "Skipping delete of %llu because it is in use on "
867 "other nodes\n", (unsigned long long)oi->ip_blkno); 867 "other nodes\n", (unsigned long long)oi->ip_blkno);
868 goto bail; 868 goto bail;
869 } 869 }
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index d272847d5a07..58ea88b5af36 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -484,6 +484,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
484 484
485 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; 485 alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data;
486 486
487#ifdef OCFS2_DEBUG_FS
487 if (le32_to_cpu(alloc->id1.bitmap1.i_used) != 488 if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
488 ocfs2_local_alloc_count_bits(alloc)) { 489 ocfs2_local_alloc_count_bits(alloc)) {
489 ocfs2_error(osb->sb, "local alloc inode %llu says it has " 490 ocfs2_error(osb->sb, "local alloc inode %llu says it has "
@@ -494,6 +495,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
494 status = -EIO; 495 status = -EIO;
495 goto bail; 496 goto bail;
496 } 497 }
498#endif
497 499
498 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) - 500 free_bits = le32_to_cpu(alloc->id1.bitmap1.i_total) -
499 le32_to_cpu(alloc->id1.bitmap1.i_used); 501 le32_to_cpu(alloc->id1.bitmap1.i_used);
@@ -712,9 +714,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
712 void *bitmap; 714 void *bitmap;
713 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); 715 struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
714 716
715 mlog_entry("total = %u, COUNT = %u, used = %u\n", 717 mlog_entry("total = %u, used = %u\n",
716 le32_to_cpu(alloc->id1.bitmap1.i_total), 718 le32_to_cpu(alloc->id1.bitmap1.i_total),
717 ocfs2_local_alloc_count_bits(alloc),
718 le32_to_cpu(alloc->id1.bitmap1.i_used)); 719 le32_to_cpu(alloc->id1.bitmap1.i_used));
719 720
720 if (!alloc->id1.bitmap1.i_total) { 721 if (!alloc->id1.bitmap1.i_total) {
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index be562ac3e89c..5ee775420665 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -438,14 +438,14 @@ unlock_osb:
438 } 438 }
439 439
440 if (!ret) { 440 if (!ret) {
441 if (!ocfs2_is_hard_readonly(osb))
442 ocfs2_set_journal_params(osb);
443
444 /* Only save off the new mount options in case of a successful 441 /* Only save off the new mount options in case of a successful
445 * remount. */ 442 * remount. */
446 osb->s_mount_opt = parsed_options.mount_opt; 443 osb->s_mount_opt = parsed_options.mount_opt;
447 osb->s_atime_quantum = parsed_options.atime_quantum; 444 osb->s_atime_quantum = parsed_options.atime_quantum;
448 osb->preferred_slot = parsed_options.slot; 445 osb->preferred_slot = parsed_options.slot;
446
447 if (!ocfs2_is_hard_readonly(osb))
448 ocfs2_set_journal_params(osb);
449 } 449 }
450out: 450out:
451 return ret; 451 return ret;
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a17c26859074..02a63ac04178 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2411,19 +2411,23 @@ out:
2411 * Find the first task with tgid >= tgid 2411 * Find the first task with tgid >= tgid
2412 * 2412 *
2413 */ 2413 */
2414static struct task_struct *next_tgid(unsigned int tgid, 2414struct tgid_iter {
2415 struct pid_namespace *ns) 2415 unsigned int tgid;
2416{
2417 struct task_struct *task; 2416 struct task_struct *task;
2417};
2418static struct tgid_iter next_tgid(struct pid_namespace *ns, struct tgid_iter iter)
2419{
2418 struct pid *pid; 2420 struct pid *pid;
2419 2421
2422 if (iter.task)
2423 put_task_struct(iter.task);
2420 rcu_read_lock(); 2424 rcu_read_lock();
2421retry: 2425retry:
2422 task = NULL; 2426 iter.task = NULL;
2423 pid = find_ge_pid(tgid, ns); 2427 pid = find_ge_pid(iter.tgid, ns);
2424 if (pid) { 2428 if (pid) {
2425 tgid = pid_nr_ns(pid, ns) + 1; 2429 iter.tgid = pid_nr_ns(pid, ns);
2426 task = pid_task(pid, PIDTYPE_PID); 2430 iter.task = pid_task(pid, PIDTYPE_PID);
2427 /* What we to know is if the pid we have find is the 2431 /* What we to know is if the pid we have find is the
2428 * pid of a thread_group_leader. Testing for task 2432 * pid of a thread_group_leader. Testing for task
2429 * being a thread_group_leader is the obvious thing 2433 * being a thread_group_leader is the obvious thing
@@ -2436,23 +2440,25 @@ retry:
2436 * found doesn't happen to be a thread group leader. 2440 * found doesn't happen to be a thread group leader.
2437 * As we don't care in the case of readdir. 2441 * As we don't care in the case of readdir.
2438 */ 2442 */
2439 if (!task || !has_group_leader_pid(task)) 2443 if (!iter.task || !has_group_leader_pid(iter.task)) {
2444 iter.tgid += 1;
2440 goto retry; 2445 goto retry;
2441 get_task_struct(task); 2446 }
2447 get_task_struct(iter.task);
2442 } 2448 }
2443 rcu_read_unlock(); 2449 rcu_read_unlock();
2444 return task; 2450 return iter;
2445} 2451}
2446 2452
2447#define TGID_OFFSET (FIRST_PROCESS_ENTRY + ARRAY_SIZE(proc_base_stuff)) 2453#define TGID_OFFSET (FIRST_PROCESS_ENTRY + ARRAY_SIZE(proc_base_stuff))
2448 2454
2449static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir, 2455static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
2450 struct task_struct *task, int tgid) 2456 struct tgid_iter iter)
2451{ 2457{
2452 char name[PROC_NUMBUF]; 2458 char name[PROC_NUMBUF];
2453 int len = snprintf(name, sizeof(name), "%d", tgid); 2459 int len = snprintf(name, sizeof(name), "%d", iter.tgid);
2454 return proc_fill_cache(filp, dirent, filldir, name, len, 2460 return proc_fill_cache(filp, dirent, filldir, name, len,
2455 proc_pid_instantiate, task, NULL); 2461 proc_pid_instantiate, iter.task, NULL);
2456} 2462}
2457 2463
2458/* for the /proc/ directory itself, after non-process stuff has been done */ 2464/* for the /proc/ directory itself, after non-process stuff has been done */
@@ -2460,8 +2466,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2460{ 2466{
2461 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY; 2467 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
2462 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode); 2468 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
2463 struct task_struct *task; 2469 struct tgid_iter iter;
2464 int tgid;
2465 struct pid_namespace *ns; 2470 struct pid_namespace *ns;
2466 2471
2467 if (!reaper) 2472 if (!reaper)
@@ -2474,14 +2479,14 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2474 } 2479 }
2475 2480
2476 ns = filp->f_dentry->d_sb->s_fs_info; 2481 ns = filp->f_dentry->d_sb->s_fs_info;
2477 tgid = filp->f_pos - TGID_OFFSET; 2482 iter.task = NULL;
2478 for (task = next_tgid(tgid, ns); 2483 iter.tgid = filp->f_pos - TGID_OFFSET;
2479 task; 2484 for (iter = next_tgid(ns, iter);
2480 put_task_struct(task), task = next_tgid(tgid + 1, ns)) { 2485 iter.task;
2481 tgid = task_pid_nr_ns(task, ns); 2486 iter.tgid += 1, iter = next_tgid(ns, iter)) {
2482 filp->f_pos = tgid + TGID_OFFSET; 2487 filp->f_pos = iter.tgid + TGID_OFFSET;
2483 if (proc_pid_fill_cache(filp, dirent, filldir, task, tgid) < 0) { 2488 if (proc_pid_fill_cache(filp, dirent, filldir, iter) < 0) {
2484 put_task_struct(task); 2489 put_task_struct(iter.task);
2485 goto out; 2490 goto out;
2486 } 2491 }
2487 } 2492 }
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index a9806bc21ec3..39f3d6519035 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -555,41 +555,6 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
555 return 0; 555 return 0;
556} 556}
557 557
558/*
559 * Kill an inode that got unregistered..
560 */
561static void proc_kill_inodes(struct proc_dir_entry *de)
562{
563 struct list_head *p;
564 struct super_block *sb;
565
566 /*
567 * Actually it's a partial revoke().
568 */
569 spin_lock(&sb_lock);
570 list_for_each_entry(sb, &proc_fs_type.fs_supers, s_instances) {
571 file_list_lock();
572 list_for_each(p, &sb->s_files) {
573 struct file *filp = list_entry(p, struct file,
574 f_u.fu_list);
575 struct dentry *dentry = filp->f_path.dentry;
576 struct inode *inode;
577 const struct file_operations *fops;
578
579 if (dentry->d_op != &proc_dentry_operations)
580 continue;
581 inode = dentry->d_inode;
582 if (PDE(inode) != de)
583 continue;
584 fops = filp->f_op;
585 filp->f_op = NULL;
586 fops_put(fops);
587 }
588 file_list_unlock();
589 }
590 spin_unlock(&sb_lock);
591}
592
593static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent, 558static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
594 const char *name, 559 const char *name,
595 mode_t mode, 560 mode_t mode,
@@ -764,8 +729,6 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
764continue_removing: 729continue_removing:
765 if (S_ISDIR(de->mode)) 730 if (S_ISDIR(de->mode))
766 parent->nlink--; 731 parent->nlink--;
767 if (!S_ISREG(de->mode))
768 proc_kill_inodes(de);
769 de->nlink = 0; 732 de->nlink = 0;
770 WARN_ON(de->subdir); 733 WARN_ON(de->subdir);
771 if (!atomic_read(&de->count)) 734 if (!atomic_read(&de->count))
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 1b2b6c6bb475..1820eb2ef762 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -78,5 +78,3 @@ static inline int proc_fd(struct inode *inode)
78{ 78{
79 return PROC_I(inode)->fd; 79 return PROC_I(inode)->fd;
80} 80}
81
82extern struct file_system_type proc_fs_type;
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 1f86bb860e04..ec9cb3b6c93b 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -98,7 +98,7 @@ static void proc_kill_sb(struct super_block *sb)
98 put_pid_ns(ns); 98 put_pid_ns(ns);
99} 99}
100 100
101struct file_system_type proc_fs_type = { 101static struct file_system_type proc_fs_type = {
102 .name = "proc", 102 .name = "proc",
103 .get_sb = proc_get_sb, 103 .get_sb = proc_get_sb,
104 .kill_sb = proc_kill_sb, 104 .kill_sb = proc_kill_sb,
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 27d1785b7644..4045bdcc4b33 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -119,7 +119,11 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
119 119
120 sysfs_put_active_two(attr_sd); 120 sysfs_put_active_two(attr_sd);
121 121
122 BUG_ON(count > (ssize_t)PAGE_SIZE); 122 /*
123 * The code works fine with PAGE_SIZE return but it's likely to
124 * indicate truncated result or overflow in normal use cases.
125 */
126 BUG_ON(count >= (ssize_t)PAGE_SIZE);
123 if (count >= 0) { 127 if (count >= 0) {
124 buffer->needs_read_fill = 0; 128 buffer->needs_read_fill = 0;
125 buffer->count = count; 129 buffer->count = count;
diff --git a/include/asm-arm/arch-at91/board.h b/include/asm-arm/arch-at91/board.h
index c0d7075982c1..79054965baa6 100644
--- a/include/asm-arm/arch-at91/board.h
+++ b/include/asm-arm/arch-at91/board.h
@@ -33,6 +33,7 @@
33 33
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/i2c.h>
36#include <linux/spi/spi.h> 37#include <linux/spi/spi.h>
37 38
38 /* USB Device */ 39 /* USB Device */
@@ -94,7 +95,7 @@ struct at91_nand_data {
94extern void __init at91_add_device_nand(struct at91_nand_data *data); 95extern void __init at91_add_device_nand(struct at91_nand_data *data);
95 96
96 /* I2C*/ 97 /* I2C*/
97extern void __init at91_add_device_i2c(void); 98extern void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices);
98 99
99 /* SPI */ 100 /* SPI */
100extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices); 101extern void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices);
diff --git a/include/asm-arm/arch-ixp23xx/irqs.h b/include/asm-arm/arch-ixp23xx/irqs.h
index e69639585721..27c580898958 100644
--- a/include/asm-arm/arch-ixp23xx/irqs.h
+++ b/include/asm-arm/arch-ixp23xx/irqs.h
@@ -153,7 +153,7 @@
153 */ 153 */
154#define NR_IXP23XX_MACH_IRQS 32 154#define NR_IXP23XX_MACH_IRQS 32
155 155
156#define NR_IRQS NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS 156#define NR_IRQS (NR_IXP23XX_IRQS + NR_IXP23XX_MACH_IRQS)
157 157
158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq)) 158#define IXP23XX_MACH_IRQ(irq) (NR_IXP23XX_IRQ + (irq))
159 159
diff --git a/include/asm-arm/arch-omap/board-innovator.h b/include/asm-arm/arch-omap/board-innovator.h
index b3cf33441f6e..56d2c98e143c 100644
--- a/include/asm-arm/arch-omap/board-innovator.h
+++ b/include/asm-arm/arch-omap/board-innovator.h
@@ -37,7 +37,7 @@
37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00 37#define OMAP1510P1_EMIFF_PRI_VALUE 0x00
38 38
39#define NR_FPGA_IRQS 24 39#define NR_FPGA_IRQS 24
40#define NR_IRQS IH_BOARD_BASE + NR_FPGA_IRQS 40#define NR_IRQS (IH_BOARD_BASE + NR_FPGA_IRQS)
41 41
42#ifndef __ASSEMBLY__ 42#ifndef __ASSEMBLY__
43void fpga_write(unsigned char val, int reg); 43void fpga_write(unsigned char val, int reg);
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index 6238dbf7a236..b76ee6d1f5b4 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -13,7 +13,7 @@
13 13
14#define PXA_IRQ(x) (x) 14#define PXA_IRQ(x) (x)
15 15
16#ifdef CONFIG_PXA27x 16#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */ 17#define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */
18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */ 18#define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */
19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */ 19#define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */
@@ -52,11 +52,27 @@
52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */ 52#define IRQ_RTC1Hz PXA_IRQ(30) /* RTC HZ Clock Tick */
53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */ 53#define IRQ_RTCAlrm PXA_IRQ(31) /* RTC Alarm */
54 54
55#ifdef CONFIG_PXA27x 55#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */ 56#define IRQ_TPM PXA_IRQ(32) /* TPM interrupt */
57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */ 57#define IRQ_CAMERA PXA_IRQ(33) /* Camera Interface */
58#endif 58#endif
59 59
60#ifdef CONFIG_PXA3xx
61#define IRQ_SSP4 PXA_IRQ(13) /* SSP4 service request */
62#define IRQ_CIR PXA_IRQ(34) /* Consumer IR */
63#define IRQ_TSI PXA_IRQ(36) /* Touch Screen Interface (PXA320) */
64#define IRQ_USIM2 PXA_IRQ(38) /* USIM2 Controller */
65#define IRQ_GRPHICS PXA_IRQ(39) /* Graphics Controller */
66#define IRQ_MMC2 PXA_IRQ(41) /* MMC2 Controller */
67#define IRQ_1WIRE PXA_IRQ(44) /* 1-Wire Controller */
68#define IRQ_NAND PXA_IRQ(45) /* NAND Controller */
69#define IRQ_USB2 PXA_IRQ(46) /* USB 2.0 Device Controller */
70#define IRQ_WAKEUP0 PXA_IRQ(49) /* EXT_WAKEUP0 */
71#define IRQ_WAKEUP1 PXA_IRQ(50) /* EXT_WAKEUP1 */
72#define IRQ_DMEMC PXA_IRQ(51) /* Dynamic Memory Controller */
73#define IRQ_MMC3 PXA_IRQ(55) /* MMC3 Controller (PXA310) */
74#endif
75
60#define PXA_GPIO_IRQ_BASE (64) 76#define PXA_GPIO_IRQ_BASE (64)
61#define PXA_GPIO_IRQ_NUM (128) 77#define PXA_GPIO_IRQ_NUM (128)
62 78
diff --git a/include/asm-arm/arch-pxa/mfp-pxa300.h b/include/asm-arm/arch-pxa/mfp-pxa300.h
index 822a27cd7864..a20996649889 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa300.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa300.h
@@ -179,7 +179,7 @@
179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X) 179#define GPIO62_LCD_CS_N MFP_CFG_DRV(GPIO62, AF2, DS01X)
180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X) 180#define GPIO72_LCD_FCLK MFP_CFG_DRV(GPIO72, AF1, DS01X)
181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X) 181#define GPIO73_LCD_LCLK MFP_CFG_DRV(GPIO73, AF1, DS01X)
182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS01X) 182#define GPIO74_LCD_PCLK MFP_CFG_DRV(GPIO74, AF1, DS02X)
183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X) 183#define GPIO75_LCD_BIAS MFP_CFG_DRV(GPIO75, AF1, DS01X)
184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X) 184#define GPIO76_LCD_VSYNC MFP_CFG_DRV(GPIO76, AF2, DS01X)
185 185
diff --git a/include/asm-arm/arch-pxa/mfp-pxa320.h b/include/asm-arm/arch-pxa/mfp-pxa320.h
index 488a5bbc49e9..52deedcaf3bd 100644
--- a/include/asm-arm/arch-pxa/mfp-pxa320.h
+++ b/include/asm-arm/arch-pxa/mfp-pxa320.h
@@ -18,7 +18,7 @@
18#include <asm/arch/mfp.h> 18#include <asm/arch/mfp.h>
19 19
20/* GPIO */ 20/* GPIO */
21#define GPIO46_GPIO MFP_CFG(GPIO6, AF0) 21#define GPIO46_GPIO MFP_CFG(GPIO46, AF0)
22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0) 22#define GPIO49_GPIO MFP_CFG(GPIO49, AF0)
23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0) 23#define GPIO50_GPIO MFP_CFG(GPIO50, AF0)
24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0) 24#define GPIO51_GPIO MFP_CFG(GPIO51, AF0)
diff --git a/include/asm-arm/arch-pxa/mfp.h b/include/asm-arm/arch-pxa/mfp.h
index ac4157af5a8e..03c508d94f0e 100644
--- a/include/asm-arm/arch-pxa/mfp.h
+++ b/include/asm-arm/arch-pxa/mfp.h
@@ -346,23 +346,31 @@ typedef uint32_t mfp_cfg_t;
346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff) 346#define MFP_CFG_PIN(mfp_cfg) (((mfp_cfg) >> 16) & 0xffff)
347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff) 347#define MFP_CFG_VAL(mfp_cfg) ((mfp_cfg) & 0xffff)
348 348
349#define MFPR_DEFAULT (0x0000) 349/*
350 * MFP register defaults to
351 * drive strength fast 3mA (010'b)
352 * edge detection logic disabled
353 * alternate function 0
354 */
355#define MFPR_DEFAULT (0x0840)
350 356
351#define MFP_CFG(pin, af) \ 357#define MFP_CFG(pin, af) \
352 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af)) 358 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af))
353 359
354#define MFP_CFG_DRV(pin, af, drv) \ 360#define MFP_CFG_DRV(pin, af, drv) \
355 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 361 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_DRV_MASK) |\
356 ((MFP_##drv) << 10) | (MFP_##af)) 362 ((MFP_##drv) << 10) | (MFP_##af))
357 363
358#define MFP_CFG_LPM(pin, af, lpm) \ 364#define MFP_CFG_LPM(pin, af, lpm) \
359 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT | (MFP_##af) |\ 365 ((MFP_PIN_##pin << 16) | (MFPR_DEFAULT & ~MFPR_LPM_MASK) |\
360 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 366 (((MFP_LPM_##lpm) & 0x3) << 7) |\
361 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 367 (((MFP_LPM_##lpm) & 0x4) << 12) |\
362 (((MFP_LPM_##lpm) & 0x8) << 10)) 368 (((MFP_LPM_##lpm) & 0x8) << 10) |\
369 (MFP_##af))
363 370
364#define MFP_CFG_X(pin, af, drv, lpm) \ 371#define MFP_CFG_X(pin, af, drv, lpm) \
365 ((MFP_PIN_##pin << 16) | MFPR_DEFAULT |\ 372 ((MFP_PIN_##pin << 16) |\
373 (MFPR_DEFAULT & ~(MFPR_DRV_MASK | MFPR_LPM_MASK)) |\
366 ((MFP_##drv) << 10) | (MFP_##af) |\ 374 ((MFP_##drv) << 10) | (MFP_##af) |\
367 (((MFP_LPM_##lpm) & 0x3) << 7) |\ 375 (((MFP_LPM_##lpm) & 0x3) << 7) |\
368 (((MFP_LPM_##lpm) & 0x4) << 12) |\ 376 (((MFP_LPM_##lpm) & 0x4) << 12) |\
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index bb68b598c436..6b33df6f1995 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -110,7 +110,10 @@
110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */ 110#define DALGN __REG(0x400000a0) /* DMA Alignment Register */
111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */ 111#define DINT __REG(0x400000f0) /* DMA Interrupt Register */
112 112
113#define DRCMR(n) __REG2(0x40000100, (n)<<2) 113#define DRCMR(n) (*(((n) < 64) ? \
114 &__REG2(0x40000100, ((n) & 0x3f) << 2) : \
115 &__REG2(0x40001100, ((n) & 0x3f) << 2)))
116
114#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */ 117#define DRCMR0 __REG(0x40000100) /* Request to Channel Map Register for DREQ 0 */
115#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */ 118#define DRCMR1 __REG(0x40000104) /* Request to Channel Map Register for DREQ 1 */
116#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */ 119#define DRCMR2 __REG(0x40000108) /* Request to Channel Map Register for I2S receive Request */
diff --git a/include/asm-arm/arch-s3c2410/spi-gpio.h b/include/asm-arm/arch-s3c2410/spi-gpio.h
index c1e4db7c9710..ba1dca88d480 100644
--- a/include/asm-arm/arch-s3c2410/spi-gpio.h
+++ b/include/asm-arm/arch-s3c2410/spi-gpio.h
@@ -21,6 +21,8 @@ struct s3c2410_spigpio_info {
21 unsigned long pin_mosi; 21 unsigned long pin_mosi;
22 unsigned long pin_miso; 22 unsigned long pin_miso;
23 23
24 int bus_num;
25
24 unsigned long board_size; 26 unsigned long board_size;
25 struct spi_board_info *board_info; 27 struct spi_board_info *board_info;
26 28
diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h
index c039820dba7c..1effcd0f5e63 100644
--- a/include/asm-m32r/thread_info.h
+++ b/include/asm-m32r/thread_info.h
@@ -149,16 +149,21 @@ static inline unsigned int get_thread_fault_code(void)
149#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 149#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
150#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ 150#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
151#define TIF_IRET 4 /* return with iret */ 151#define TIF_IRET 4 /* return with iret */
152#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 152#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */
153 /* 31..28 fault code */ 153#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
154#define TIF_MEMDIE 17 154#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
155#define TIF_MEMDIE 18 /* OOM killer killed process */
156#define TIF_FREEZE 19 /* is freezing for suspend */
155 157
156#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 158#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
157#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 159#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
158#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 160#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
159#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) 161#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
160#define _TIF_IRET (1<<TIF_IRET) 162#define _TIF_IRET (1<<TIF_IRET)
163#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
164#define _TIF_USEDFPU (1<<TIF_USEDFPU)
161#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 165#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
166#define _TIF_FREEZE (1<<TIF_FREEZE)
162 167
163#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ 168#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
164#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ 169#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
diff --git a/include/asm-m32r/unistd.h b/include/asm-m32r/unistd.h
index cbbd53762ea6..f467eac9ba70 100644
--- a/include/asm-m32r/unistd.h
+++ b/include/asm-m32r/unistd.h
@@ -290,10 +290,50 @@
290#define __NR_mq_getsetattr (__NR_mq_open+5) 290#define __NR_mq_getsetattr (__NR_mq_open+5)
291#define __NR_kexec_load 283 291#define __NR_kexec_load 283
292#define __NR_waitid 284 292#define __NR_waitid 284
293/* 285 is unused */
294#define __NR_add_key 286
295#define __NR_request_key 287
296#define __NR_keyctl 288
297#define __NR_ioprio_set 289
298#define __NR_ioprio_get 290
299#define __NR_inotify_init 291
300#define __NR_inotify_add_watch 292
301#define __NR_inotify_rm_watch 293
302#define __NR_migrate_pages 294
303#define __NR_openat 295
304#define __NR_mkdirat 296
305#define __NR_mknodat 297
306#define __NR_fchownat 298
307#define __NR_futimesat 299
308#define __NR_fstatat64 300
309#define __NR_unlinkat 301
310#define __NR_renameat 302
311#define __NR_linkat 303
312#define __NR_symlinkat 304
313#define __NR_readlinkat 305
314#define __NR_fchmodat 306
315#define __NR_faccessat 307
316#define __NR_pselect6 308
317#define __NR_ppoll 309
318#define __NR_unshare 310
319#define __NR_set_robust_list 311
320#define __NR_get_robust_list 312
321#define __NR_splice 313
322#define __NR_sync_file_range 314
323#define __NR_tee 315
324#define __NR_vmsplice 316
325#define __NR_move_pages 317
326#define __NR_getcpu 318
327#define __NR_epoll_pwait 319
328#define __NR_utimensat 320
329#define __NR_signalfd 321
330#define __NR_timerfd 322
331#define __NR_eventfd 323
332#define __NR_fallocate 324
293 333
294#ifdef __KERNEL__ 334#ifdef __KERNEL__
295 335
296#define NR_syscalls 285 336#define NR_syscalls 325
297 337
298#define __ARCH_WANT_IPC_PARSE_VERSION 338#define __ARCH_WANT_IPC_PARSE_VERSION
299#define __ARCH_WANT_STAT64 339#define __ARCH_WANT_STAT64
@@ -311,6 +351,30 @@
311#define __ARCH_WANT_SYS_OLDUMOUNT 351#define __ARCH_WANT_SYS_OLDUMOUNT
312#define __ARCH_WANT_SYS_RT_SIGACTION 352#define __ARCH_WANT_SYS_RT_SIGACTION
313 353
354#define __IGNORE_lchown
355#define __IGNORE_setuid
356#define __IGNORE_getuid
357#define __IGNORE_setgid
358#define __IGNORE_getgid
359#define __IGNORE_geteuid
360#define __IGNORE_getegid
361#define __IGNORE_fcntl
362#define __IGNORE_setreuid
363#define __IGNORE_setregid
364#define __IGNORE_getrlimit
365#define __IGNORE_getgroups
366#define __IGNORE_setgroups
367#define __IGNORE_select
368#define __IGNORE_mmap
369#define __IGNORE_fchown
370#define __IGNORE_setfsuid
371#define __IGNORE_setfsgid
372#define __IGNORE_setresuid
373#define __IGNORE_getresuid
374#define __IGNORE_setresgid
375#define __IGNORE_getresgid
376#define __IGNORE_chown
377
314/* 378/*
315 * "Conditional" syscalls 379 * "Conditional" syscalls
316 * 380 *
diff --git a/include/asm-mips/cpu-features.h b/include/asm-mips/cpu-features.h
index f6bd308f047f..5ea701fc3425 100644
--- a/include/asm-mips/cpu-features.h
+++ b/include/asm-mips/cpu-features.h
@@ -207,13 +207,13 @@
207#endif 207#endif
208 208
209#ifndef cpu_dcache_line_size 209#ifndef cpu_dcache_line_size
210#define cpu_dcache_line_size() current_cpu_data.dcache.linesz 210#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
211#endif 211#endif
212#ifndef cpu_icache_line_size 212#ifndef cpu_icache_line_size
213#define cpu_icache_line_size() current_cpu_data.icache.linesz 213#define cpu_icache_line_size() cpu_data[0].icache.linesz
214#endif 214#endif
215#ifndef cpu_scache_line_size 215#ifndef cpu_scache_line_size
216#define cpu_scache_line_size() current_cpu_data.scache.linesz 216#define cpu_scache_line_size() cpu_data[0].scache.linesz
217#endif 217#endif
218 218
219#endif /* __ASM_CPU_FEATURES_H */ 219#endif /* __ASM_CPU_FEATURES_H */
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 1030562d6ea6..a944eda4faf5 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -209,8 +209,6 @@ extern void *set_except_vector(int n, void *addr);
209extern unsigned long ebase; 209extern unsigned long ebase;
210extern void per_cpu_trap_init(void); 210extern void per_cpu_trap_init(void);
211 211
212extern int stop_a_enabled;
213
214/* 212/*
215 * See include/asm-ia64/system.h; prevents deadlock on SMP 213 * See include/asm-ia64/system.h; prevents deadlock on SMP
216 * systems. 214 * systems.
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 0f6c86c634fd..84cec2aa9f1e 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -563,11 +563,4 @@ enum {
563 ~EXT2_DIR_ROUND) 563 ~EXT2_DIR_ROUND)
564#define EXT2_MAX_REC_LEN ((1<<16)-1) 564#define EXT2_MAX_REC_LEN ((1<<16)-1)
565 565
566static inline ext2_fsblk_t
567ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
568{
569 return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
570 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
571}
572
573#endif /* _LINUX_EXT2_FS_H */ 566#endif /* _LINUX_EXT2_FS_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index d0c437028c80..5c86f1196c3a 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -16,6 +16,7 @@
16 * - add lk_flags in fuse_lk_in 16 * - add lk_flags in fuse_lk_in
17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
18 * - add blksize field to fuse_attr 18 * - add blksize field to fuse_attr
19 * - add file flags field to fuse_read_in and fuse_write_in
19 */ 20 */
20 21
21#include <asm/types.h> 22#include <asm/types.h>
@@ -280,6 +281,8 @@ struct fuse_read_in {
280 __u32 size; 281 __u32 size;
281 __u32 read_flags; 282 __u32 read_flags;
282 __u64 lock_owner; 283 __u64 lock_owner;
284 __u32 flags;
285 __u32 padding;
283}; 286};
284 287
285#define FUSE_COMPAT_WRITE_IN_SIZE 24 288#define FUSE_COMPAT_WRITE_IN_SIZE 24
@@ -290,6 +293,8 @@ struct fuse_write_in {
290 __u32 size; 293 __u32 size;
291 __u32 write_flags; 294 __u32 write_flags;
292 __u64 lock_owner; 295 __u64 lock_owner;
296 __u32 flags;
297 __u32 padding;
293}; 298};
294 299
295struct fuse_write_out { 300struct fuse_write_out {
diff --git a/include/linux/kd.h b/include/linux/kd.h
index c91fc0c9c495..15f2853ea58f 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -126,7 +126,7 @@ struct kbdiacrs {
126#define KDSKBDIACR 0x4B4B /* write kernel accent table */ 126#define KDSKBDIACR 0x4B4B /* write kernel accent table */
127 127
128struct kbdiacruc { 128struct kbdiacruc {
129 __u32 diacr, base, result; 129 unsigned int diacr, base, result;
130}; 130};
131struct kbdiacrsuc { 131struct kbdiacrsuc {
132 unsigned int kb_cnt; /* number of entries in following array */ 132 unsigned int kb_cnt; /* number of entries in following array */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 664d68cb1fbd..0a0426c2867d 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -13,8 +13,8 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/mod_devicetable.h> 14#include <linux/mod_devicetable.h>
15 15
16#define PNP_MAX_PORT 8 16#define PNP_MAX_PORT 24
17#define PNP_MAX_MEM 4 17#define PNP_MAX_MEM 12
18#define PNP_MAX_IRQ 2 18#define PNP_MAX_IRQ 2
19#define PNP_MAX_DMA 2 19#define PNP_MAX_DMA 2
20#define PNP_NAME_LEN 50 20#define PNP_NAME_LEN 50
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 6d5e4a46781e..f2d0d1527721 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -133,6 +133,9 @@ struct rtc_class_ops {
133#define RTC_DEVICE_NAME_SIZE 20 133#define RTC_DEVICE_NAME_SIZE 20
134struct rtc_task; 134struct rtc_task;
135 135
136/* flags */
137#define RTC_DEV_BUSY 0
138
136struct rtc_device 139struct rtc_device
137{ 140{
138 struct device dev; 141 struct device dev;
@@ -145,7 +148,7 @@ struct rtc_device
145 struct mutex ops_lock; 148 struct mutex ops_lock;
146 149
147 struct cdev char_dev; 150 struct cdev char_dev;
148 struct mutex char_lock; 151 unsigned long flags;
149 152
150 unsigned long irq_data; 153 unsigned long irq_data;
151 spinlock_t irq_lock; 154 spinlock_t irq_lock;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ee800e7a70de..ac3d496fbd20 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -282,6 +282,10 @@ static inline void touch_all_softlockup_watchdogs(void)
282 282
283/* Attach to any functions which should be ignored in wchan output. */ 283/* Attach to any functions which should be ignored in wchan output. */
284#define __sched __attribute__((__section__(".sched.text"))) 284#define __sched __attribute__((__section__(".sched.text")))
285
286/* Linker adds these: start and end of __sched functions */
287extern char __sched_text_start[], __sched_text_end[];
288
285/* Is this address in the __sched functions? */ 289/* Is this address in the __sched functions? */
286extern int in_sched_functions(unsigned long addr); 290extern int in_sched_functions(unsigned long addr);
287 291
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 827b85bbf388..1ee2c05142f6 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -63,6 +63,8 @@ struct screen_info {
63 63
64#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ 64#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
65 65
66#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */
67
66#ifdef __KERNEL__ 68#ifdef __KERNEL__
67extern struct screen_info screen_info; 69extern struct screen_info screen_info;
68 70
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 6a5203fb9cf1..9963f81fea9a 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -437,7 +437,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
437#ifdef SUPPORT_SYSRQ 437#ifdef SUPPORT_SYSRQ
438 if (port->sysrq) { 438 if (port->sysrq) {
439 if (ch && time_before(jiffies, port->sysrq)) { 439 if (ch && time_before(jiffies, port->sysrq)) {
440 handle_sysrq(ch, port->info->tty); 440 handle_sysrq(ch, port->info ? port->info->tty : NULL);
441 port->sysrq = 0; 441 port->sysrq = 0;
442 return 1; 442 return 1;
443 } 443 }
diff --git a/include/linux/usb.h b/include/linux/usb.h
index c5c8f169d3cf..416ee7617d9e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -157,6 +157,7 @@ struct usb_interface {
157 * bound to */ 157 * bound to */
158 enum usb_interface_condition condition; /* state of binding */ 158 enum usb_interface_condition condition; /* state of binding */
159 unsigned is_active:1; /* the interface is not suspended */ 159 unsigned is_active:1; /* the interface is not suspended */
160 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
160 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 161 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
161 162
162 struct device dev; /* interface specific device info */ 163 struct device dev; /* interface specific device info */
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 342dd5a7e8bb..8ca5a7fbc9ec 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -102,7 +102,8 @@ struct usbdevfs_urb {
102 int start_frame; 102 int start_frame;
103 int number_of_packets; 103 int number_of_packets;
104 int error_count; 104 int error_count;
105 unsigned int signr; /* signal to be sent on error, -1 if none should be sent */ 105 unsigned int signr; /* signal to be sent on completion,
106 or 0 if none should be sent. */
106 void *usercontext; 107 void *usercontext;
107 struct usbdevfs_iso_packet_desc iso_frame_desc[0]; 108 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
108}; 109};
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 1e04cd464af9..6ca7b97114f3 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1138,8 +1138,10 @@ asmlinkage long sys_mq_getsetattr(mqd_t mqdes,
1138 omqstat.mq_flags = filp->f_flags & O_NONBLOCK; 1138 omqstat.mq_flags = filp->f_flags & O_NONBLOCK;
1139 if (u_mqstat) { 1139 if (u_mqstat) {
1140 ret = audit_mq_getsetattr(mqdes, &mqstat); 1140 ret = audit_mq_getsetattr(mqdes, &mqstat);
1141 if (ret != 0) 1141 if (ret != 0) {
1142 goto out; 1142 spin_unlock(&info->lock);
1143 goto out_fput;
1144 }
1143 if (mqstat.mq_flags & O_NONBLOCK) 1145 if (mqstat.mq_flags & O_NONBLOCK)
1144 filp->f_flags |= O_NONBLOCK; 1146 filp->f_flags |= O_NONBLOCK;
1145 else 1147 else
diff --git a/kernel/exit.c b/kernel/exit.c
index cd0f1d4137a7..549c0558ba68 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1357,7 +1357,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1357 int __user *stat_addr, struct rusage __user *ru) 1357 int __user *stat_addr, struct rusage __user *ru)
1358{ 1358{
1359 int retval, exit_code; 1359 int retval, exit_code;
1360 struct pid_namespace *ns; 1360 pid_t pid;
1361 1361
1362 if (!p->exit_code) 1362 if (!p->exit_code)
1363 return 0; 1363 return 0;
@@ -1376,12 +1376,11 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1376 * keep holding onto the tasklist_lock while we call getrusage and 1376 * keep holding onto the tasklist_lock while we call getrusage and
1377 * possibly take page faults for user memory. 1377 * possibly take page faults for user memory.
1378 */ 1378 */
1379 ns = current->nsproxy->pid_ns; 1379 pid = task_pid_nr_ns(p, current->nsproxy->pid_ns);
1380 get_task_struct(p); 1380 get_task_struct(p);
1381 read_unlock(&tasklist_lock); 1381 read_unlock(&tasklist_lock);
1382 1382
1383 if (unlikely(noreap)) { 1383 if (unlikely(noreap)) {
1384 pid_t pid = task_pid_nr_ns(p, ns);
1385 uid_t uid = p->uid; 1384 uid_t uid = p->uid;
1386 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; 1385 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;
1387 1386
@@ -1389,7 +1388,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1389 if (unlikely(!exit_code) || unlikely(p->exit_state)) 1388 if (unlikely(!exit_code) || unlikely(p->exit_state))
1390 goto bail_ref; 1389 goto bail_ref;
1391 return wait_noreap_copyout(p, pid, uid, 1390 return wait_noreap_copyout(p, pid, uid,
1392 why, (exit_code << 8) | 0x7f, 1391 why, exit_code,
1393 infop, ru); 1392 infop, ru);
1394 } 1393 }
1395 1394
@@ -1451,11 +1450,11 @@ bail_ref:
1451 if (!retval && infop) 1450 if (!retval && infop)
1452 retval = put_user(exit_code, &infop->si_status); 1451 retval = put_user(exit_code, &infop->si_status);
1453 if (!retval && infop) 1452 if (!retval && infop)
1454 retval = put_user(task_pid_nr_ns(p, ns), &infop->si_pid); 1453 retval = put_user(pid, &infop->si_pid);
1455 if (!retval && infop) 1454 if (!retval && infop)
1456 retval = put_user(p->uid, &infop->si_uid); 1455 retval = put_user(p->uid, &infop->si_uid);
1457 if (!retval) 1456 if (!retval)
1458 retval = task_pid_nr_ns(p, ns); 1457 retval = pid;
1459 put_task_struct(p); 1458 put_task_struct(p);
1460 1459
1461 BUG_ON(!retval); 1460 BUG_ON(!retval);
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 474219a41929..2fc25810509e 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -32,9 +32,14 @@
32 32
33/* These will be re-linked against their real values during the second link stage */ 33/* These will be re-linked against their real values during the second link stage */
34extern const unsigned long kallsyms_addresses[] __attribute__((weak)); 34extern const unsigned long kallsyms_addresses[] __attribute__((weak));
35extern const unsigned long kallsyms_num_syms __attribute__((weak));
36extern const u8 kallsyms_names[] __attribute__((weak)); 35extern const u8 kallsyms_names[] __attribute__((weak));
37 36
37/* tell the compiler that the count isn't in the small data section if the arch
38 * has one (eg: FRV)
39 */
40extern const unsigned long kallsyms_num_syms
41__attribute__((weak, section(".rodata")));
42
38extern const u8 kallsyms_token_table[] __attribute__((weak)); 43extern const u8 kallsyms_token_table[] __attribute__((weak));
39extern const u16 kallsyms_token_index[] __attribute__((weak)); 44extern const u16 kallsyms_token_index[] __attribute__((weak));
40 45
diff --git a/kernel/sched.c b/kernel/sched.c
index 38933cafea8a..98dcdf272db3 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5466,7 +5466,7 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
5466 return table; 5466 return table;
5467} 5467}
5468 5468
5469static ctl_table * sd_alloc_ctl_cpu_table(int cpu) 5469static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
5470{ 5470{
5471 struct ctl_table *entry, *table; 5471 struct ctl_table *entry, *table;
5472 struct sched_domain *sd; 5472 struct sched_domain *sd;
@@ -6708,9 +6708,6 @@ void __init sched_init_smp(void)
6708 6708
6709int in_sched_functions(unsigned long addr) 6709int in_sched_functions(unsigned long addr)
6710{ 6710{
6711 /* Linker adds these: start and end of __sched functions */
6712 extern char __sched_text_start[], __sched_text_end[];
6713
6714 return in_lock_functions(addr) || 6711 return in_lock_functions(addr) ||
6715 (addr >= (unsigned long)__sched_text_start 6712 (addr >= (unsigned long)__sched_text_start
6716 && addr < (unsigned long)__sched_text_end); 6713 && addr < (unsigned long)__sched_text_end);
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 5d0d623a5465..d30467b47ddd 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -327,10 +327,12 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
327 avg_atom = -1LL; 327 avg_atom = -1LL;
328 328
329 avg_per_cpu = p->se.sum_exec_runtime; 329 avg_per_cpu = p->se.sum_exec_runtime;
330 if (p->se.nr_migrations) 330 if (p->se.nr_migrations) {
331 avg_per_cpu = div64_64(avg_per_cpu, p->se.nr_migrations); 331 avg_per_cpu = div64_64(avg_per_cpu,
332 else 332 p->se.nr_migrations);
333 } else {
333 avg_per_cpu = -1LL; 334 avg_per_cpu = -1LL;
335 }
334 336
335 __PN(avg_atom); 337 __PN(avg_atom);
336 __PN(avg_per_cpu); 338 __PN(avg_per_cpu);
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 630178e53bb6..5b32433e7ee5 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -52,7 +52,8 @@ static int show_schedstat(struct seq_file *seq, void *v)
52 sd->lb_nobusyq[itype], 52 sd->lb_nobusyq[itype],
53 sd->lb_nobusyg[itype]); 53 sd->lb_nobusyg[itype]);
54 } 54 }
55 seq_printf(seq, " %u %u %u %u %u %u %u %u %u %u %u %u\n", 55 seq_printf(seq,
56 " %u %u %u %u %u %u %u %u %u %u %u %u\n",
56 sd->alb_count, sd->alb_failed, sd->alb_pushed, 57 sd->alb_count, sd->alb_failed, sd->alb_pushed,
57 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed, 58 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed,
58 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed, 59 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed,
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 27a2338deb4a..cb89fa8db110 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -133,6 +133,8 @@ void tick_nohz_update_jiffies(void)
133 if (!ts->tick_stopped) 133 if (!ts->tick_stopped)
134 return; 134 return;
135 135
136 touch_softlockup_watchdog();
137
136 cpu_clear(cpu, nohz_cpu_mask); 138 cpu_clear(cpu, nohz_cpu_mask);
137 now = ktime_get(); 139 now = ktime_get();
138 140
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index c76c06466bfd..fe3a56c2256d 100644
--- a/kernel/utsname_sysctl.c
+++ b/kernel/utsname_sysctl.c
@@ -18,6 +18,10 @@
18static void *get_uts(ctl_table *table, int write) 18static void *get_uts(ctl_table *table, int write)
19{ 19{
20 char *which = table->data; 20 char *which = table->data;
21 struct uts_namespace *uts_ns;
22
23 uts_ns = current->nsproxy->uts_ns;
24 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
21 25
22 if (!write) 26 if (!write)
23 down_read(&uts_sem); 27 down_read(&uts_sem);
diff --git a/lib/hexdump.c b/lib/hexdump.c
index bd5edaeaa80b..343546550dc9 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -106,7 +106,8 @@ void hex_dump_to_buffer(const void *buf, size_t len, int rowsize,
106 while (lx < (linebuflen - 1) && lx < (ascii_column - 1)) 106 while (lx < (linebuflen - 1) && lx < (ascii_column - 1))
107 linebuf[lx++] = ' '; 107 linebuf[lx++] = ' ';
108 for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++) 108 for (j = 0; (j < rowsize) && (j < len) && (lx + 2) < linebuflen; j++)
109 linebuf[lx++] = isprint(ptr[j]) ? ptr[j] : '.'; 109 linebuf[lx++] = (isascii(ptr[j]) && isprint(ptr[j])) ? ptr[j]
110 : '.';
110nil: 111nil:
111 linebuf[lx++] = '\0'; 112 linebuf[lx++] = '\0';
112} 113}
diff --git a/lib/kobject.c b/lib/kobject.c
index a7e3bf4d3c70..b52e9f4ef371 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -313,8 +313,8 @@ int kobject_rename(struct kobject * kobj, const char *new_name)
313 struct kobject *temp_kobj; 313 struct kobject *temp_kobj;
314 temp_kobj = kset_find_obj(kobj->kset, new_name); 314 temp_kobj = kset_find_obj(kobj->kset, new_name);
315 if (temp_kobj) { 315 if (temp_kobj) {
316 printk(KERN_WARNING "kobject '%s' can not be renamed " 316 printk(KERN_WARNING "kobject '%s' cannot be renamed "
317 "to '%s' as '%s' is already in existance.\n", 317 "to '%s' as '%s' is already in existence.\n",
318 kobject_name(kobj), new_name, new_name); 318 kobject_name(kobj), new_name, new_name);
319 kobject_put(temp_kobj); 319 kobject_put(temp_kobj);
320 return -EINVAL; 320 return -EINVAL;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 12376ae3f733..b5a58d476c1a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -305,7 +305,6 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags)
305{ 305{
306 int i; 306 int i;
307 307
308 VM_BUG_ON((gfp_flags & (__GFP_WAIT | __GFP_HIGHMEM)) == __GFP_HIGHMEM);
309 /* 308 /*
310 * clear_highpage() will use KM_USER0, so it's a bug to use __GFP_ZERO 309 * clear_highpage() will use KM_USER0, so it's a bug to use __GFP_ZERO
311 * and __GFP_HIGHMEM from hard or soft interrupt context. 310 * and __GFP_HIGHMEM from hard or soft interrupt context.
@@ -3266,6 +3265,16 @@ static void inline setup_usemap(struct pglist_data *pgdat,
3266#endif /* CONFIG_SPARSEMEM */ 3265#endif /* CONFIG_SPARSEMEM */
3267 3266
3268#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE 3267#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
3268
3269/* Return a sensible default order for the pageblock size. */
3270static inline int pageblock_default_order(void)
3271{
3272 if (HPAGE_SHIFT > PAGE_SHIFT)
3273 return HUGETLB_PAGE_ORDER;
3274
3275 return MAX_ORDER-1;
3276}
3277
3269/* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */ 3278/* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */
3270static inline void __init set_pageblock_order(unsigned int order) 3279static inline void __init set_pageblock_order(unsigned int order)
3271{ 3280{
@@ -3281,7 +3290,16 @@ static inline void __init set_pageblock_order(unsigned int order)
3281} 3290}
3282#else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ 3291#else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
3283 3292
3284/* Defined this way to avoid accidently referencing HUGETLB_PAGE_ORDER */ 3293/*
3294 * When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not set, set_pageblock_order()
3295 * and pageblock_default_order() are unused as pageblock_order is set
3296 * at compile-time. See include/linux/pageblock-flags.h for the values of
3297 * pageblock_order based on the kernel config
3298 */
3299static inline int pageblock_default_order(unsigned int order)
3300{
3301 return MAX_ORDER-1;
3302}
3285#define set_pageblock_order(x) do {} while (0) 3303#define set_pageblock_order(x) do {} while (0)
3286 3304
3287#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ 3305#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
@@ -3366,7 +3384,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
3366 if (!size) 3384 if (!size)
3367 continue; 3385 continue;
3368 3386
3369 set_pageblock_order(HUGETLB_PAGE_ORDER); 3387 set_pageblock_order(pageblock_default_order());
3370 setup_usemap(pgdat, zone, size); 3388 setup_usemap(pgdat, zone, size);
3371 ret = init_currently_empty_zone(zone, zone_start_pfn, 3389 ret = init_currently_empty_zone(zone, zone_start_pfn,
3372 size, MEMMAP_EARLY); 3390 size, MEMMAP_EARLY);
diff --git a/mm/shmem.c b/mm/shmem.c
index 253d205914ba..51b3d6ccddab 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1072,7 +1072,7 @@ shmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,
1072 pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx); 1072 pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);
1073 pvma.vm_pgoff = idx; 1073 pvma.vm_pgoff = idx;
1074 pvma.vm_end = PAGE_SIZE; 1074 pvma.vm_end = PAGE_SIZE;
1075 page = alloc_page_vma(gfp | __GFP_ZERO, &pvma, 0); 1075 page = alloc_page_vma(gfp, &pvma, 0);
1076 mpol_free(pvma.vm_policy); 1076 mpol_free(pvma.vm_policy);
1077 return page; 1077 return page;
1078} 1078}
@@ -1093,7 +1093,7 @@ shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx)
1093static inline struct page * 1093static inline struct page *
1094shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx) 1094shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)
1095{ 1095{
1096 return alloc_page(gfp | __GFP_ZERO); 1096 return alloc_page(gfp);
1097} 1097}
1098#endif 1098#endif
1099 1099
@@ -1306,6 +1306,7 @@ repeat:
1306 1306
1307 info->alloced++; 1307 info->alloced++;
1308 spin_unlock(&info->lock); 1308 spin_unlock(&info->lock);
1309 clear_highpage(filepage);
1309 flush_dcache_page(filepage); 1310 flush_dcache_page(filepage);
1310 SetPageUptodate(filepage); 1311 SetPageUptodate(filepage);
1311 } 1312 }
diff --git a/mm/slab.c b/mm/slab.c
index c31cd3682a0b..202465a193c1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2881,6 +2881,8 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp,
2881 unsigned int objnr; 2881 unsigned int objnr;
2882 struct slab *slabp; 2882 struct slab *slabp;
2883 2883
2884 BUG_ON(virt_to_cache(objp) != cachep);
2885
2884 objp -= obj_offset(cachep); 2886 objp -= obj_offset(cachep);
2885 kfree_debugcheck(objp); 2887 kfree_debugcheck(objp);
2886 page = virt_to_head_page(objp); 2888 page = virt_to_head_page(objp);
@@ -3759,8 +3761,6 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp)
3759{ 3761{
3760 unsigned long flags; 3762 unsigned long flags;
3761 3763
3762 BUG_ON(virt_to_cache(objp) != cachep);
3763
3764 local_irq_save(flags); 3764 local_irq_save(flags);
3765 debug_check_no_locks_freed(objp, obj_size(cachep)); 3765 debug_check_no_locks_freed(objp, obj_size(cachep));
3766 __cache_free(cachep, objp); 3766 __cache_free(cachep, objp);
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index 22620f6a976b..cd75b21dd4c3 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -34,6 +34,16 @@
34 * or to back the page tables that are used to create the mapping. 34 * or to back the page tables that are used to create the mapping.
35 * Uses the main allocators if they are available, else bootmem. 35 * Uses the main allocators if they are available, else bootmem.
36 */ 36 */
37
38static void * __init_refok __earlyonly_bootmem_alloc(int node,
39 unsigned long size,
40 unsigned long align,
41 unsigned long goal)
42{
43 return __alloc_bootmem_node(NODE_DATA(node), size, align, goal);
44}
45
46
37void * __meminit vmemmap_alloc_block(unsigned long size, int node) 47void * __meminit vmemmap_alloc_block(unsigned long size, int node)
38{ 48{
39 /* If the main allocator is up use that, fallback to bootmem. */ 49 /* If the main allocator is up use that, fallback to bootmem. */
@@ -44,7 +54,7 @@ void * __meminit vmemmap_alloc_block(unsigned long size, int node)
44 return page_address(page); 54 return page_address(page);
45 return NULL; 55 return NULL;
46 } else 56 } else
47 return __alloc_bootmem_node(NODE_DATA(node), size, size, 57 return __earlyonly_bootmem_alloc(node, size, size,
48 __pa(MAX_DMA_ADDRESS)); 58 __pa(MAX_DMA_ADDRESS));
49} 59}
50 60
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cbb42580a81d..579f50fa838c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.11'; 12my $V = '0.12';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -19,8 +19,11 @@ my $chk_signoff = 1;
19my $chk_patch = 1; 19my $chk_patch = 1;
20my $tst_type = 0; 20my $tst_type = 0;
21my $emacs = 0; 21my $emacs = 0;
22my $terse = 0;
22my $file = 0; 23my $file = 0;
23my $check = 0; 24my $check = 0;
25my $summary = 1;
26my $mailback = 0;
24my $root; 27my $root;
25GetOptions( 28GetOptions(
26 'q|quiet+' => \$quiet, 29 'q|quiet+' => \$quiet,
@@ -29,10 +32,13 @@ GetOptions(
29 'patch!' => \$chk_patch, 32 'patch!' => \$chk_patch,
30 'test-type!' => \$tst_type, 33 'test-type!' => \$tst_type,
31 'emacs!' => \$emacs, 34 'emacs!' => \$emacs,
35 'terse!' => \$terse,
32 'file!' => \$file, 36 'file!' => \$file,
33 'subjective!' => \$check, 37 'subjective!' => \$check,
34 'strict!' => \$check, 38 'strict!' => \$check,
35 'root=s' => \$root, 39 'root=s' => \$root,
40 'summary!' => \$summary,
41 'mailback!' => \$mailback,
36) or exit; 42) or exit;
37 43
38my $exit = 0; 44my $exit = 0;
@@ -42,6 +48,7 @@ if ($#ARGV < 0) {
42 print "version: $V\n"; 48 print "version: $V\n";
43 print "options: -q => quiet\n"; 49 print "options: -q => quiet\n";
44 print " --no-tree => run without a kernel tree\n"; 50 print " --no-tree => run without a kernel tree\n";
51 print " --terse => one line per report\n";
45 print " --emacs => emacs compile window format\n"; 52 print " --emacs => emacs compile window format\n";
46 print " --file => check a source file\n"; 53 print " --file => check a source file\n";
47 print " --strict => enable more subjective tests\n"; 54 print " --strict => enable more subjective tests\n";
@@ -49,6 +56,11 @@ if ($#ARGV < 0) {
49 exit(1); 56 exit(1);
50} 57}
51 58
59if ($terse) {
60 $emacs = 1;
61 $quiet++;
62}
63
52if ($tree) { 64if ($tree) {
53 if (defined $root) { 65 if (defined $root) {
54 if (!top_of_kernel_tree($root)) { 66 if (!top_of_kernel_tree($root)) {
@@ -90,41 +102,6 @@ our $Attribute = qr{
90 __(?:mem|cpu|dev|)(?:initdata|init) 102 __(?:mem|cpu|dev|)(?:initdata|init)
91 }x; 103 }x;
92our $Inline = qr{inline|__always_inline|noinline}; 104our $Inline = qr{inline|__always_inline|noinline};
93our $NonptrType = qr{
94 \b
95 (?:const\s+)?
96 (?:unsigned\s+)?
97 (?:
98 void|
99 char|
100 short|
101 int|
102 long|
103 unsigned|
104 float|
105 double|
106 bool|
107 long\s+int|
108 long\s+long|
109 long\s+long\s+int|
110 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
111 struct\s+$Ident|
112 union\s+$Ident|
113 enum\s+$Ident|
114 ${Ident}_t|
115 ${Ident}_handler|
116 ${Ident}_handler_fn
117 )
118 (?:\s+$Sparse)*
119 \b
120 }x;
121
122our $Type = qr{
123 \b$NonptrType\b
124 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
125 (?:\s+$Sparse|\s+$Attribute)*
126 }x;
127our $Declare = qr{(?:$Storage\s+)?$Type};
128our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]}; 105our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
129our $Lval = qr{$Ident(?:$Member)*}; 106our $Lval = qr{$Ident(?:$Member)*};
130 107
@@ -136,7 +113,50 @@ our $Operators = qr{
136 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/ 113 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/
137 }x; 114 }x;
138 115
139our $Bare = ''; 116our $NonptrType;
117our $Type;
118our $Declare;
119
120our @typeList = (
121 qr{void},
122 qr{char},
123 qr{short},
124 qr{int},
125 qr{long},
126 qr{unsigned},
127 qr{float},
128 qr{double},
129 qr{bool},
130 qr{long\s+int},
131 qr{long\s+long},
132 qr{long\s+long\s+int},
133 qr{(?:__)?(?:u|s|be|le)(?:8|16|32|64)},
134 qr{struct\s+$Ident},
135 qr{union\s+$Ident},
136 qr{enum\s+$Ident},
137 qr{${Ident}_t},
138 qr{${Ident}_handler},
139 qr{${Ident}_handler_fn},
140);
141
142sub build_types {
143 my $all = "(?: \n" . join("|\n ", @typeList) . "\n)";
144 $NonptrType = qr{
145 \b
146 (?:const\s+)?
147 (?:unsigned\s+)?
148 $all
149 (?:\s+$Sparse|\s+const)*
150 \b
151 }x;
152 $Type = qr{
153 \b$NonptrType\b
154 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
155 (?:\s+$Sparse|\s+$Attribute)*
156 }x;
157 $Declare = qr{(?:$Storage\s+)?$Type};
158}
159build_types();
140 160
141$chk_signoff = 0 if ($file); 161$chk_signoff = 0 if ($file);
142 162
@@ -278,6 +298,81 @@ sub sanitise_line {
278 return $res; 298 return $res;
279} 299}
280 300
301sub ctx_statement_block {
302 my ($linenr, $remain, $off) = @_;
303 my $line = $linenr - 1;
304 my $blk = '';
305 my $soff = $off;
306 my $coff = $off - 1;
307
308 my $type = '';
309 my $level = 0;
310 my $c;
311 my $len = 0;
312 while (1) {
313 #warn "CSB: blk<$blk>\n";
314 # If we are about to drop off the end, pull in more
315 # context.
316 if ($off >= $len) {
317 for (; $remain > 0; $line++) {
318 next if ($rawlines[$line] =~ /^-/);
319 $remain--;
320 $blk .= sanitise_line($rawlines[$line]) . "\n";
321 $len = length($blk);
322 $line++;
323 last;
324 }
325 # Bail if there is no further context.
326 #warn "CSB: blk<$blk> off<$off> len<$len>\n";
327 if ($off == $len) {
328 last;
329 }
330 }
331 $c = substr($blk, $off, 1);
332
333 #warn "CSB: c<$c> type<$type> level<$level>\n";
334 # Statement ends at the ';' or a close '}' at the
335 # outermost level.
336 if ($level == 0 && $c eq ';') {
337 last;
338 }
339
340 if (($type eq '' || $type eq '(') && $c eq '(') {
341 $level++;
342 $type = '(';
343 }
344 if ($type eq '(' && $c eq ')') {
345 $level--;
346 $type = ($level != 0)? '(' : '';
347
348 if ($level == 0 && $coff < $soff) {
349 $coff = $off;
350 }
351 }
352 if (($type eq '' || $type eq '{') && $c eq '{') {
353 $level++;
354 $type = '{';
355 }
356 if ($type eq '{' && $c eq '}') {
357 $level--;
358 $type = ($level != 0)? '{' : '';
359
360 if ($level == 0) {
361 last;
362 }
363 }
364 $off++;
365 }
366
367 my $statement = substr($blk, $soff, $off - $soff + 1);
368 my $condition = substr($blk, $soff, $coff - $soff + 1);
369
370 #warn "STATEMENT<$statement>\n";
371 #warn "CONDITION<$condition>\n";
372
373 return ($statement, $condition);
374}
375
281sub ctx_block_get { 376sub ctx_block_get {
282 my ($linenr, $remain, $outer, $open, $close, $off) = @_; 377 my ($linenr, $remain, $outer, $open, $close, $off) = @_;
283 my $line; 378 my $line;
@@ -421,9 +516,6 @@ sub annotate_values {
421 my $paren = 0; 516 my $paren = 0;
422 my @paren_type; 517 my @paren_type;
423 518
424 # Include any user defined types we may have found as we went.
425 my $type_match = "(?:$Type$Bare)";
426
427 while (length($cur)) { 519 while (length($cur)) {
428 print " <$type> " if ($debug); 520 print " <$type> " if ($debug);
429 if ($cur =~ /^(\s+)/o) { 521 if ($cur =~ /^(\s+)/o) {
@@ -433,7 +525,7 @@ sub annotate_values {
433 $type = 'N'; 525 $type = 'N';
434 } 526 }
435 527
436 } elsif ($cur =~ /^($type_match)/) { 528 } elsif ($cur =~ /^($Type)/) {
437 print "DECLARE($1)\n" if ($debug); 529 print "DECLARE($1)\n" if ($debug);
438 $type = 'T'; 530 $type = 'T';
439 531
@@ -457,7 +549,7 @@ sub annotate_values {
457 } 549 }
458 $type = 'N'; 550 $type = 'N';
459 551
460 } elsif ($cur =~ /^(if|while|typeof)\b/o) { 552 } elsif ($cur =~ /^(if|while|typeof|for)\b/o) {
461 print "COND($1)\n" if ($debug); 553 print "COND($1)\n" if ($debug);
462 $paren_type[$paren] = 'N'; 554 $paren_type[$paren] = 'N';
463 $type = 'N'; 555 $type = 'N';
@@ -515,11 +607,30 @@ sub annotate_values {
515 return $res; 607 return $res;
516} 608}
517 609
610sub possible {
611 my ($possible) = @_;
612
613 #print "CHECK<$possible>\n";
614 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
615 $possible ne 'goto' && $possible ne 'return' &&
616 $possible ne 'struct' && $possible ne 'enum' &&
617 $possible ne 'case' && $possible ne 'else' &&
618 $possible ne 'typedef') {
619 #print "POSSIBLE<$possible>\n";
620 push(@typeList, $possible);
621 build_types();
622 }
623}
624
518my $prefix = ''; 625my $prefix = '';
519 626
520my @report = (); 627my @report = ();
521sub report { 628sub report {
522 push(@report, $prefix . $_[0]); 629 my $line = $prefix . $_[0];
630
631 $line = (split('\n', $line))[0] . "\n" if ($terse);
632
633 push(@report, $line);
523} 634}
524sub report_dump { 635sub report_dump {
525 @report; 636 @report;
@@ -574,9 +685,6 @@ sub process {
574 685
575 my $prev_values = 'N'; 686 my $prev_values = 'N';
576 687
577 # Possible bare types.
578 my @bare = ();
579
580 # Pre-scan the patch looking for any __setup documentation. 688 # Pre-scan the patch looking for any __setup documentation.
581 my @setup_docs = (); 689 my @setup_docs = ();
582 my $setup_docs = 0; 690 my $setup_docs = 0;
@@ -631,21 +739,35 @@ sub process {
631 $realline++; 739 $realline++;
632 $realcnt-- if ($realcnt != 0); 740 $realcnt-- if ($realcnt != 0);
633 741
634 # track any sort of multi-line comment. Obviously if 742 # Guestimate if this is a continuing comment. Run
635 # the added text or context do not include the whole 743 # the context looking for a comment "edge". If this
636 # comment we will not see it. Such is life. 744 # edge is a close comment then we must be in a comment
637 # 745 # at context start.
746 if ($linenr == $first_line) {
747 my $edge;
748 for (my $ln = $first_line; $ln < ($linenr + $realcnt); $ln++) {
749 ($edge) = ($lines[$ln - 1] =~ m@(/\*|\*/)@);
750 last if (defined $edge);
751 }
752 if (defined $edge && $edge eq '*/') {
753 $in_comment = 1;
754 }
755 }
756
638 # Guestimate if this is a continuing comment. If this 757 # Guestimate if this is a continuing comment. If this
639 # is the start of a diff block and this line starts 758 # is the start of a diff block and this line starts
640 # ' *' then it is very likely a comment. 759 # ' *' then it is very likely a comment.
641 if ($linenr == $first_line and $line =~ m@^.\s*\*@) { 760 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
642 $in_comment = 1; 761 $in_comment = 1;
643 } 762 }
644 if ($line =~ m@/\*@) { 763
645 $in_comment = 1; 764 # Find the last comment edge on _this_ line.
646 } 765 while (($line =~ m@(/\*|\*/)@g)) {
647 if ($line =~ m@\*/@) { 766 if ($1 eq '/*') {
648 $in_comment = 0; 767 $in_comment = 1;
768 } else {
769 $in_comment = 0;
770 }
649 } 771 }
650 772
651 # Measure the line length and indent. 773 # Measure the line length and indent.
@@ -687,7 +809,7 @@ sub process {
687 } 809 }
688 810
689# Check for wrappage within a valid hunk of the file 811# Check for wrappage within a valid hunk of the file
690 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |$)}) { 812 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
691 ERROR("patch seems to be corrupt (line wrapped?)\n" . 813 ERROR("patch seems to be corrupt (line wrapped?)\n" .
692 $herecurr) if (!$emitted_corrupt++); 814 $herecurr) if (!$emitted_corrupt++);
693 } 815 }
@@ -727,6 +849,11 @@ sub process {
727 WARN("line over 80 characters\n" . $herecurr); 849 WARN("line over 80 characters\n" . $herecurr);
728 } 850 }
729 851
852# check for adding lines without a newline.
853 if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
854 WARN("adding a line without newline at end of file\n" . $herecurr);
855 }
856
730# check we are in a valid source file *.[hc] if not then ignore this hunk 857# check we are in a valid source file *.[hc] if not then ignore this hunk
731 next if ($realfile !~ /\.[hc]$/); 858 next if ($realfile !~ /\.[hc]$/);
732 859
@@ -752,30 +879,41 @@ sub process {
752 879
753# Check for potential 'bare' types 880# Check for potential 'bare' types
754 if ($realcnt && 881 if ($realcnt &&
755 $line !~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?$Type\b/ &&
756 $line !~ /$Ident:\s*$/ && 882 $line !~ /$Ident:\s*$/ &&
757 $line !~ /^.\s*$Ident\s*\(/ && 883 ($line =~ /^.\s*$Ident\s*\(\*+\s*$Ident\)\s*\(/ ||
758 # definitions in global scope can only start with types 884 $line !~ /^.\s*$Ident\s*\(/)) {
759 ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?($Ident)\b/ || 885 # definitions in global scope can only start with types
760 # declarations always start with types 886 if ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b/) {
761 $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/) || 887 possible($1);
762 # any (foo ... *) is a pointer cast, and foo is a type 888
763 $line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/) { 889 # declarations always start with types
764 my $possible = $1; 890 } elsif ($prev_values eq 'N' && $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/) {
765 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ && 891 possible($1);
766 $possible ne 'goto' && $possible ne 'return' && 892
767 $possible ne 'struct' && $possible ne 'enum' && 893 # any (foo ... *) is a pointer cast, and foo is a type
768 $possible ne 'case' && $possible ne 'else' && 894 } elsif ($line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/) {
769 $possible ne 'typedef') { 895 possible($1);
770 #print "POSSIBLE<$possible>\n"; 896 }
771 push(@bare, $possible); 897
772 my $bare = join("|", @bare); 898 # Check for any sort of function declaration.
773 $Bare = '|' . qr{ 899 # int foo(something bar, other baz);
774 \b(?:$bare)\b 900 # void (*store_gdt)(x86_descr_ptr *);
775 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)? 901 if ($prev_values eq 'N' && $line =~ /^(.(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/) {
776 (?:\s+$Sparse)* 902 my ($name_len) = length($1);
777 }x; 903 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, $name_len);
904 my $ctx = join("\n", @ctx);
905
906 $ctx =~ s/\n.//;
907 substr($ctx, 0, $name_len + 1) = '';
908 $ctx =~ s/\)[^\)]*$//;
909 for my $arg (split(/\s*,\s*/, $ctx)) {
910 if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/ || $arg =~ /^($Ident)$/) {
911
912 possible($1);
913 }
914 }
778 } 915 }
916
779 } 917 }
780 918
781# 919#
@@ -935,6 +1073,10 @@ sub process {
935# $clean = 0; 1073# $clean = 0;
936# } 1074# }
937 1075
1076 if ($line =~ /\bLINUX_VERSION_CODE\b/) {
1077 WARN("LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged" . $herecurr);
1078 }
1079
938# printk should use KERN_* levels. Note that follow on printk's on the 1080# printk should use KERN_* levels. Note that follow on printk's on the
939# same line do not need a level, so we use the current block context 1081# same line do not need a level, so we use the current block context
940# to try and find and validate the current printk. In summary the current 1082# to try and find and validate the current printk. In summary the current
@@ -965,6 +1107,12 @@ sub process {
965 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr); 1107 ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
966 } 1108 }
967 1109
1110# open braces for enum, union and struct go on the same line.
1111 if ($line =~ /^.\s*{/ &&
1112 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
1113 ERROR("open brace '{' following $1 go on the same line\n" . $hereprev);
1114 }
1115
968# check for spaces between functions and their parentheses. 1116# check for spaces between functions and their parentheses.
969 while ($line =~ /($Ident)\s+\(/g) { 1117 while ($line =~ /($Ident)\s+\(/g) {
970 if ($1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case)$/ && 1118 if ($1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case)$/ &&
@@ -1172,9 +1320,27 @@ sub process {
1172 } 1320 }
1173 1321
1174# Check for illegal assignment in if conditional. 1322# Check for illegal assignment in if conditional.
1175 if ($line=~/\bif\s*\(.*[^<>!=]=[^=]/) { 1323 if ($line =~ /\bif\s*\(/) {
1176 #next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/); 1324 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0);
1177 ERROR("do not use assignment in if condition\n" . $herecurr); 1325
1326 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/) {
1327 ERROR("do not use assignment in if condition ($c)\n" . $herecurr);
1328 }
1329
1330 # Find out what is on the end of the line after the
1331 # conditional.
1332 substr($s, 0, length($c)) = '';
1333 $s =~ s/\n.*//g;
1334
1335 if (length($c) && $s !~ /^\s*({|;|\/\*.*\*\/)?\s*\\*\s*$/) {
1336 ERROR("trailing statements should be on next line\n" . $herecurr);
1337 }
1338 }
1339
1340# if and else should not have general statements after it
1341 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ &&
1342 $1 !~ /^\s*(?:\sif|{|\\|$)/) {
1343 ERROR("trailing statements should be on next line\n" . $herecurr);
1178 } 1344 }
1179 1345
1180 # Check for }<nl>else {, these must be at the same 1346 # Check for }<nl>else {, these must be at the same
@@ -1205,12 +1371,6 @@ sub process {
1205 } 1371 }
1206 } 1372 }
1207 1373
1208# if and else should not have general statements after it
1209 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/ &&
1210 $1 !~ /^\s*(?:\sif|{|\\|$)/) {
1211 ERROR("trailing statements should be on next line\n" . $herecurr);
1212 }
1213
1214# multi-statement macros should be enclosed in a do while loop, grab the 1374# multi-statement macros should be enclosed in a do while loop, grab the
1215# first statement and ensure its the whole macro if its not enclosed 1375# first statement and ensure its the whole macro if its not enclosed
1216# in a known goot container 1376# in a known goot container
@@ -1233,6 +1393,10 @@ sub process {
1233 $off = length($1); 1393 $off = length($1);
1234 $ln--; 1394 $ln--;
1235 $cnt++; 1395 $cnt++;
1396 while ($lines[$ln - 1] =~ /^-/) {
1397 $ln--;
1398 $cnt++;
1399 }
1236 } 1400 }
1237 my @ctx = ctx_statement($ln, $cnt, $off); 1401 my @ctx = ctx_statement($ln, $cnt, $off);
1238 my $ctx_ln = $ln + $#ctx + 1; 1402 my $ctx_ln = $ln + $#ctx + 1;
@@ -1268,25 +1432,23 @@ sub process {
1268 if ($lines[$nr - 1] =~ /{\s*$/) { 1432 if ($lines[$nr - 1] =~ /{\s*$/) {
1269 my ($lvl, @block) = ctx_block_level($nr, $cnt); 1433 my ($lvl, @block) = ctx_block_level($nr, $cnt);
1270 1434
1271 my $stmt = join(' ', @block); 1435 my $stmt = join("\n", @block);
1272 $stmt =~ s/(^[^{]*){//; 1436 # Drop the diff line leader.
1437 $stmt =~ s/\n./\n/g;
1438 # Drop the code outside the block.
1439 $stmt =~ s/(^[^{]*){\s*//;
1273 my $before = $1; 1440 my $before = $1;
1274 $stmt =~ s/}([^}]*$)//; 1441 $stmt =~ s/\s*}([^}]*$)//;
1275 my $after = $1; 1442 my $after = $1;
1276 1443
1277 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n"; 1444 #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n";
1278 #print "stmt<$stmt>\n\n"; 1445 #print "stmt<$stmt>\n\n";
1279 1446
1280 # Count the ;'s if there is fewer than two 1447 # Count the newlines, if there is only one
1281 # then there can only be one statement, 1448 # then the block should not have {}'s.
1282 # if there is a brace inside we cannot 1449 my @lines = ($stmt =~ /\n/g);
1283 # trivially detect if its one statement. 1450 #print "lines<" . scalar(@lines) . ">\n";
1284 # Also nested if's often require braces to 1451 if ($lvl == 0 && scalar(@lines) == 0 &&
1285 # disambiguate the else binding so shhh there.
1286 my @semi = ($stmt =~ /;/g);
1287 push(@semi, "/**/") if ($stmt =~ m@/\*@);
1288 ##print "semi<" . scalar(@semi) . ">\n";
1289 if ($lvl == 0 && scalar(@semi) < 2 &&
1290 $stmt !~ /{/ && $stmt !~ /\bif\b/ && 1452 $stmt !~ /{/ && $stmt !~ /\bif\b/ &&
1291 $before !~ /}/ && $after !~ /{/) { 1453 $before !~ /}/ && $after !~ /{/) {
1292 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n"; 1454 my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n";
@@ -1372,6 +1534,11 @@ sub process {
1372 ERROR("inline keyword should sit between storage class and type\n" . $herecurr); 1534 ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
1373 } 1535 }
1374 1536
1537# Check for __inline__ and __inline, prefer inline
1538 if ($line =~ /\b(__inline__|__inline)\b/) {
1539 WARN("plain inline is preferred over $1\n" . $herecurr);
1540 }
1541
1375# check for new externs in .c files. 1542# check for new externs in .c files.
1376 if ($line =~ /^.\s*extern\s/ && ($realfile =~ /\.c$/)) { 1543 if ($line =~ /^.\s*extern\s/ && ($realfile =~ /\.c$/)) {
1377 WARN("externs should be avoided in .c files\n" . $herecurr); 1544 WARN("externs should be avoided in .c files\n" . $herecurr);
@@ -1392,21 +1559,33 @@ sub process {
1392 } 1559 }
1393 } 1560 }
1394 1561
1395 if ($chk_patch && !$is_patch) { 1562 # In mailback mode only produce a report in the negative, for
1563 # things that appear to be patches.
1564 if ($mailback && ($clean == 1 || !$is_patch)) {
1565 exit(0);
1566 }
1567
1568 # This is not a patch, and we are are in 'no-patch' mode so
1569 # just keep quiet.
1570 if (!$chk_patch && !$is_patch) {
1571 exit(0);
1572 }
1573
1574 if (!$is_patch) {
1396 ERROR("Does not appear to be a unified-diff format patch\n"); 1575 ERROR("Does not appear to be a unified-diff format patch\n");
1397 } 1576 }
1398 if ($is_patch && $chk_signoff && $signoff == 0) { 1577 if ($is_patch && $chk_signoff && $signoff == 0) {
1399 ERROR("Missing Signed-off-by: line(s)\n"); 1578 ERROR("Missing Signed-off-by: line(s)\n");
1400 } 1579 }
1401 1580
1402 if ($clean == 0 && ($chk_patch || $is_patch)) { 1581 print report_dump();
1403 print report_dump(); 1582 if ($summary) {
1404 if ($quiet < 2) { 1583 print "total: $cnt_error errors, $cnt_warn warnings, " .
1405 print "total: $cnt_error errors, $cnt_warn warnings, " . 1584 (($check)? "$cnt_chk checks, " : "") .
1406 (($check)? "$cnt_chk checks, " : "") . 1585 "$cnt_lines lines checked\n";
1407 "$cnt_lines lines checked\n"; 1586 print "\n" if ($quiet == 0);
1408 }
1409 } 1587 }
1588
1410 if ($clean == 1 && $quiet == 0) { 1589 if ($clean == 1 && $quiet == 0) {
1411 print "Your patch has no obvious style problems and is ready for submission.\n" 1590 print "Your patch has no obvious style problems and is ready for submission.\n"
1412 } 1591 }
diff --git a/security/commoncap.c b/security/commoncap.c
index 302e8d0839a9..5bc1895f3f9c 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -526,6 +526,15 @@ int cap_task_kill(struct task_struct *p, struct siginfo *info,
526 if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info))) 526 if (info != SEND_SIG_NOINFO && (is_si_special(info) || SI_FROMKERNEL(info)))
527 return 0; 527 return 0;
528 528
529 /*
530 * Running a setuid root program raises your capabilities.
531 * Killing your own setuid root processes was previously
532 * allowed.
533 * We must preserve legacy signal behavior in this case.
534 */
535 if (p->euid == 0 && p->uid == current->uid)
536 return 0;
537
529 /* sigcont is permitted within same session */ 538 /* sigcont is permitted within same session */
530 if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p))) 539 if (sig == SIGCONT && (task_session_nr(current) == task_session_nr(p)))
531 return 0; 540 return 0;