aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/SubmitChecklist4
-rw-r--r--Documentation/cpu-load.txt113
-rw-r--r--Documentation/networking/ip-sysctl.txt26
-rw-r--r--MAINTAINERS8
-rw-r--r--arch/arm26/kernel/entry.S10
-rw-r--r--arch/cris/arch-v32/drivers/pci/dma.c2
-rw-r--r--arch/frv/mm/init.c3
-rw-r--r--arch/i386/kernel/io_apic.c2
-rw-r--r--arch/i386/kernel/pci-dma.c2
-rw-r--r--arch/powerpc/platforms/ps3/Kconfig28
-rw-r--r--arch/sparc64/defconfig5
-rw-r--r--arch/um/Kconfig.char19
-rw-r--r--arch/um/os-Linux/elf_aux.c3
-rw-r--r--arch/um/os-Linux/sigio.c5
-rw-r--r--arch/um/sys-i386/ldt.c36
-rw-r--r--arch/x86_64/kernel/io_apic.c4
-rw-r--r--drivers/acpi/Kconfig1
-rw-r--r--drivers/block/umem.c5
-rw-r--r--drivers/char/tty_io.c14
-rw-r--r--drivers/isdn/capi/Kconfig16
-rw-r--r--drivers/isdn/capi/capidrv.c28
-rw-r--r--drivers/isdn/capi/capiutil.c254
-rw-r--r--drivers/isdn/capi/kcapi.c77
-rw-r--r--drivers/isdn/gigaset/Makefile9
-rw-r--r--drivers/isdn/gigaset/asyncdata.c5
-rw-r--r--drivers/md/md.c140
-rw-r--r--drivers/md/raid10.c38
-rw-r--r--drivers/md/raid5.c159
-rw-r--r--drivers/md/raid6mmx.c16
-rw-r--r--drivers/md/raid6sse1.c17
-rw-r--r--drivers/md/raid6sse2.c22
-rw-r--r--drivers/md/raid6x86.h218
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c4
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c2
-rw-r--r--drivers/media/video/cafe_ccic.c4
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c6
-rw-r--r--drivers/media/video/cx25840/cx25840-firmware.c2
-rw-r--r--drivers/media/video/cx88/cx88-video.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c11
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.h7
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c4
-rw-r--r--drivers/media/video/saa7115.c2
-rw-r--r--drivers/media/video/saa7127.c2
-rw-r--r--drivers/media/video/tvp5150.c2
-rw-r--r--drivers/media/video/upd64031a.c2
-rw-r--r--drivers/media/video/upd64083.c2
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c4
-rw-r--r--drivers/media/video/v4l2-common.c43
-rw-r--r--drivers/media/video/videodev.c36
-rw-r--r--drivers/rtc/class.c14
-rw-r--r--drivers/rtc/interface.c3
-rw-r--r--drivers/video/Kconfig3
-rw-r--r--drivers/video/sm501fb.c10
-rw-r--r--fs/ecryptfs/file.c1
-rw-r--r--fs/ecryptfs/inode.c3
-rw-r--r--fs/ecryptfs/main.c2
-rw-r--r--fs/ecryptfs/mmap.c29
-rw-r--r--fs/ext3/xattr.c42
-rw-r--r--fs/ext4/xattr.c41
-rw-r--r--include/asm-frv/pgtable.h6
-rw-r--r--include/asm-sparc64/dma.h4
-rw-r--r--include/asm-sparc64/parport.h22
-rw-r--r--include/asm-um/pgtable.h2
-rw-r--r--include/linux/hrtimer.h1
-rw-r--r--include/linux/hugetlb.h8
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/isdn/capiutil.h21
-rw-r--r--include/linux/mm.h5
-rw-r--r--include/linux/page-flags.h4
-rw-r--r--include/linux/shm.h5
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/stat.h2
-rw-r--r--include/linux/sysfs.h3
-rw-r--r--include/linux/videodev2.h71
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/media/v4l2-common.h8
-rw-r--r--include/media/v4l2-dev.h6
-rw-r--r--include/net/sock.h2
-rw-r--r--ipc/shm.c36
-rw-r--r--kernel/lockdep.c2
-rw-r--r--kernel/relay.c3
-rw-r--r--kernel/sched.c4
-rw-r--r--kernel/sysctl.c3
-rw-r--r--kernel/timer.c3
-rw-r--r--lib/bitmap.c16
-rw-r--r--mm/mmap.c2
-rw-r--r--mm/page-writeback.c13
-rw-r--r--mm/page_alloc.c2
-rw-r--r--mm/rmap.c17
-rw-r--r--mm/shmem.c5
-rw-r--r--mm/slab.c2
-rw-r--r--mm/tiny-shmem.c2
-rw-r--r--mm/truncate.c4
-rw-r--r--mm/vmscan.c2
-rw-r--r--net/bridge/br_ioctl.c3
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/dccp/output.c2
-rw-r--r--net/ipv4/tcp_minisocks.c2
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/anycast.c1
-rw-r--r--net/ipx/ChangeLog101
-rw-r--r--net/ipx/Kconfig6
-rw-r--r--net/netfilter/nfnetlink.c3
-rw-r--r--net/netlabel/netlabel_unlabeled.c2
-rw-r--r--net/xfrm/xfrm_user.c8
-rwxr-xr-xscripts/kernel-doc2
106 files changed, 1251 insertions, 748 deletions
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index bfbb2718a279..bd23dc0bc0c7 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -76,3 +76,7 @@ kernel patches.
7622: Newly-added code has been compiled with `gcc -W'. This will generate 7622: Newly-added code has been compiled with `gcc -W'. This will generate
77 lots of noise, but is good for finding bugs like "warning: comparison 77 lots of noise, but is good for finding bugs like "warning: comparison
78 between signed and unsigned". 78 between signed and unsigned".
79
8023: Tested after it has been merged into the -mm patchset to make sure
81 that it still works with all of the other queued patches and various
82 changes in the VM, VFS, and other subsystems.
diff --git a/Documentation/cpu-load.txt b/Documentation/cpu-load.txt
new file mode 100644
index 000000000000..287224e57cfc
--- /dev/null
+++ b/Documentation/cpu-load.txt
@@ -0,0 +1,113 @@
1CPU load
2--------
3
4Linux exports various bits of information via `/proc/stat' and
5`/proc/uptime' that userland tools, such as top(1), use to calculate
6the average time system spent in a particular state, for example:
7
8 $ iostat
9 Linux 2.6.18.3-exp (linmac) 02/20/2007
10
11 avg-cpu: %user %nice %system %iowait %steal %idle
12 10.01 0.00 2.92 5.44 0.00 81.63
13
14 ...
15
16Here the system thinks that over the default sampling period the
17system spent 10.01% of the time doing work in user space, 2.92% in the
18kernel, and was overall 81.63% of the time idle.
19
20In most cases the `/proc/stat' information reflects the reality quite
21closely, however due to the nature of how/when the kernel collects
22this data sometimes it can not be trusted at all.
23
24So how is this information collected? Whenever timer interrupt is
25signalled the kernel looks what kind of task was running at this
26moment and increments the counter that corresponds to this tasks
27kind/state. The problem with this is that the system could have
28switched between various states multiple times between two timer
29interrupts yet the counter is incremented only for the last state.
30
31
32Example
33-------
34
35If we imagine the system with one task that periodically burns cycles
36in the following manner:
37
38 time line between two timer interrupts
39|--------------------------------------|
40 ^ ^
41 |_ something begins working |
42 |_ something goes to sleep
43 (only to be awaken quite soon)
44
45In the above situation the system will be 0% loaded according to the
46`/proc/stat' (since the timer interrupt will always happen when the
47system is executing the idle handler), but in reality the load is
48closer to 99%.
49
50One can imagine many more situations where this behavior of the kernel
51will lead to quite erratic information inside `/proc/stat'.
52
53
54/* gcc -o hog smallhog.c */
55#include <time.h>
56#include <limits.h>
57#include <signal.h>
58#include <sys/time.h>
59#define HIST 10
60
61static volatile sig_atomic_t stop;
62
63static void sighandler (int signr)
64{
65 (void) signr;
66 stop = 1;
67}
68static unsigned long hog (unsigned long niters)
69{
70 stop = 0;
71 while (!stop && --niters);
72 return niters;
73}
74int main (void)
75{
76 int i;
77 struct itimerval it = { .it_interval = { .tv_sec = 0, .tv_usec = 1 },
78 .it_value = { .tv_sec = 0, .tv_usec = 1 } };
79 sigset_t set;
80 unsigned long v[HIST];
81 double tmp = 0.0;
82 unsigned long n;
83 signal (SIGALRM, &sighandler);
84 setitimer (ITIMER_REAL, &it, NULL);
85
86 hog (ULONG_MAX);
87 for (i = 0; i < HIST; ++i) v[i] = ULONG_MAX - hog (ULONG_MAX);
88 for (i = 0; i < HIST; ++i) tmp += v[i];
89 tmp /= HIST;
90 n = tmp - (tmp / 3.0);
91
92 sigemptyset (&set);
93 sigaddset (&set, SIGALRM);
94
95 for (;;) {
96 hog (n);
97 sigwait (&set, &i);
98 }
99 return 0;
100}
101
102
103References
104----------
105
106http://lkml.org/lkml/2007/2/12/6
107Documentation/filesystems/proc.txt (1.8)
108
109
110Thanks
111------
112
113Con Kolivas, Pavel Machek
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index a0f6842368c3..d3aae1f9b4c1 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -147,6 +147,11 @@ tcp_available_congestion_control - STRING
147 More congestion control algorithms may be available as modules, 147 More congestion control algorithms may be available as modules,
148 but not loaded. 148 but not loaded.
149 149
150tcp_base_mss - INTEGER
151 The initial value of search_low to be used by Packetization Layer
152 Path MTU Discovery (MTU probing). If MTU probing is enabled,
153 this is the inital MSS used by the connection.
154
150tcp_congestion_control - STRING 155tcp_congestion_control - STRING
151 Set the congestion control algorithm to be used for new 156 Set the congestion control algorithm to be used for new
152 connections. The algorithm "reno" is always available, but 157 connections. The algorithm "reno" is always available, but
@@ -243,6 +248,27 @@ tcp_mem - vector of 3 INTEGERs: min, pressure, max
243 Defaults are calculated at boot time from amount of available 248 Defaults are calculated at boot time from amount of available
244 memory. 249 memory.
245 250
251tcp_moderate_rcvbuf - BOOLEAN
252 If set, TCP performs receive buffer autotuning, attempting to
253 automatically size the buffer (no greater than tcp_rmem[2]) to
254 match the size required by the path for full throughput. Enabled by
255 default.
256
257tcp_mtu_probing - INTEGER
258 Controls TCP Packetization-Layer Path MTU Discovery. Takes three
259 values:
260 0 - Disabled
261 1 - Disabled by default, enabled when an ICMP black hole detected
262 2 - Always enabled, use initial MSS of tcp_base_mss.
263
264tcp_no_metrics_save - BOOLEAN
265 By default, TCP saves various connection metrics in the route cache
266 when the connection closes, so that connections established in the
267 near future can use these to set initial conditions. Usually, this
268 increases overall performance, but may sometimes cause performance
269 degredation. If set, TCP will not cache metrics on closing
270 connections.
271
246tcp_orphan_retries - INTEGER 272tcp_orphan_retries - INTEGER
247 How may times to retry before killing TCP connection, closed 273 How may times to retry before killing TCP connection, closed
248 by our side. Default value 7 corresponds to ~50sec-16min 274 by our side. Default value 7 corresponds to ~50sec-16min
diff --git a/MAINTAINERS b/MAINTAINERS
index ebc1c289bed2..1dfba85ca7b5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1345,7 +1345,7 @@ S: Supported
1345 1345
1346FRAMEBUFFER LAYER 1346FRAMEBUFFER LAYER
1347P: Antonino Daplas 1347P: Antonino Daplas
1348M: adaplas@pol.net 1348M: adaplas@gmail.com
1349L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1349L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
1350W: http://linux-fbdev.sourceforge.net/ 1350W: http://linux-fbdev.sourceforge.net/
1351S: Maintained 1351S: Maintained
@@ -1757,7 +1757,7 @@ S: Maintained
1757 1757
1758INTEL 810/815 FRAMEBUFFER DRIVER 1758INTEL 810/815 FRAMEBUFFER DRIVER
1759P: Antonino Daplas 1759P: Antonino Daplas
1760M: adaplas@pol.net 1760M: adaplas@gmail.com
1761L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1761L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
1762S: Maintained 1762S: Maintained
1763 1763
@@ -2472,7 +2472,7 @@ S: Maintained
2472 2472
2473NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER 2473NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER
2474P: Antonino Daplas 2474P: Antonino Daplas
2475M: adaplas@pol.net 2475M: adaplas@gmail.com
2476L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 2476L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
2477S: Maintained 2477S: Maintained
2478 2478
@@ -2856,7 +2856,7 @@ S: Orphan
2856 2856
2857S3 SAVAGE FRAMEBUFFER DRIVER 2857S3 SAVAGE FRAMEBUFFER DRIVER
2858P: Antonino Daplas 2858P: Antonino Daplas
2859M: adaplas@pol.net 2859M: adaplas@gmail.com
2860L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 2860L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
2861S: Maintained 2861S: Maintained
2862 2862
diff --git a/arch/arm26/kernel/entry.S b/arch/arm26/kernel/entry.S
index 6d910ea43d34..91496cc687b1 100644
--- a/arch/arm26/kernel/entry.S
+++ b/arch/arm26/kernel/entry.S
@@ -245,11 +245,6 @@ ENTRY(vector_swi)
245 zero_fp 245 zero_fp
246 get_scno 246 get_scno
247 247
248#ifdef CONFIG_ALIGNMENT_TRAP
249 ldr ip, __cr_alignment
250 ldr ip, [ip]
251 mcr p15, 0, ip, c1, c0 @ update control register
252#endif
253 enable_irqs ip 248 enable_irqs ip
254 249
255 str r4, [sp, #-S_OFF]! @ push fifth arg 250 str r4, [sp, #-S_OFF]! @ push fifth arg
@@ -299,11 +294,6 @@ __sys_trace_return:
299 b ret_slow_syscall 294 b ret_slow_syscall
300 295
301 .align 5 296 .align 5
302#ifdef CONFIG_ALIGNMENT_TRAP
303 .type __cr_alignment, #object
304__cr_alignment:
305 .word cr_alignment
306#endif
307 297
308 .type sys_call_table, #object 298 .type sys_call_table, #object
309ENTRY(sys_call_table) 299ENTRY(sys_call_table)
diff --git a/arch/cris/arch-v32/drivers/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c
index 426b09878a05..70d3bf0c92e8 100644
--- a/arch/cris/arch-v32/drivers/pci/dma.c
+++ b/arch/cris/arch-v32/drivers/pci/dma.c
@@ -111,7 +111,7 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
111 return DMA_MEMORY_IO; 111 return DMA_MEMORY_IO;
112 112
113 free1_out: 113 free1_out:
114 kfree(dev->dma_mem->bitmap); 114 kfree(dev->dma_mem);
115 out: 115 out:
116 return 0; 116 return 0;
117} 117}
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 3f3a0ed3539b..4103c2c487f3 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -126,8 +126,7 @@ void __init paging_init(void)
126 126
127 /* distribute the allocatable pages across the various zones and pass them to the allocator 127 /* distribute the allocatable pages across the various zones and pass them to the allocator
128 */ 128 */
129 zones_size[ZONE_DMA] = max_low_pfn - min_low_pfn; 129 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
130 zones_size[ZONE_NORMAL] = 0;
131#ifdef CONFIG_HIGHMEM 130#ifdef CONFIG_HIGHMEM
132 zones_size[ZONE_HIGHMEM] = num_physpages - num_mappedpages; 131 zones_size[ZONE_HIGHMEM] = num_physpages - num_mappedpages;
133#endif 132#endif
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 6fec4dab70bb..e4408ff4e674 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -1354,7 +1354,6 @@ static void __init setup_IO_APIC_irqs(void)
1354 } 1354 }
1355 spin_lock_irqsave(&ioapic_lock, flags); 1355 spin_lock_irqsave(&ioapic_lock, flags);
1356 __ioapic_write_entry(apic, pin, entry); 1356 __ioapic_write_entry(apic, pin, entry);
1357 irq_desc[irq].affinity = TARGET_CPUS;
1358 spin_unlock_irqrestore(&ioapic_lock, flags); 1357 spin_unlock_irqrestore(&ioapic_lock, flags);
1359 } 1358 }
1360 } 1359 }
@@ -2875,7 +2874,6 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2875 2874
2876 spin_lock_irqsave(&ioapic_lock, flags); 2875 spin_lock_irqsave(&ioapic_lock, flags);
2877 __ioapic_write_entry(ioapic, pin, entry); 2876 __ioapic_write_entry(ioapic, pin, entry);
2878 irq_desc[irq].affinity = TARGET_CPUS;
2879 spin_unlock_irqrestore(&ioapic_lock, flags); 2877 spin_unlock_irqrestore(&ioapic_lock, flags);
2880 2878
2881 return 0; 2879 return 0;
diff --git a/arch/i386/kernel/pci-dma.c b/arch/i386/kernel/pci-dma.c
index 41af692c1584..3ebcea033623 100644
--- a/arch/i386/kernel/pci-dma.c
+++ b/arch/i386/kernel/pci-dma.c
@@ -110,7 +110,7 @@ int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
110 return DMA_MEMORY_IO; 110 return DMA_MEMORY_IO;
111 111
112 free1_out: 112 free1_out:
113 kfree(dev->dma_mem->bitmap); 113 kfree(dev->dma_mem);
114 out: 114 out:
115 if (mem_base) 115 if (mem_base)
116 iounmap(mem_base); 116 iounmap(mem_base);
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig
index d270a1e374d5..1a481a60a883 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -1,9 +1,24 @@
1menu "PS3 Platform Options" 1menu "PS3 Platform Options"
2 depends on PPC_PS3 2 depends on PPC_PS3
3 3
4config PS3_ADVANCED
5 depends on PPC_PS3
6 bool "PS3 Advanced configuration options"
7 help
8 This gives you access to some advanced options for the PS3. The
9 defaults should be fine for most users, but these options may make
10 it possible to better control the kernel configuration if you know
11 what you are doing.
12
13 Note that the answer to this question won't directly affect the
14 kernel: saying N will just cause the configurator to skip all
15 the questions about these options.
16
17 Most users should say N to this question.
18
4config PS3_HTAB_SIZE 19config PS3_HTAB_SIZE
5 depends on PPC_PS3 20 depends on PPC_PS3
6 int "PS3 Platform pagetable size" 21 int "PS3 Platform pagetable size" if PS3_ADVANCED
7 range 18 20 22 range 18 20
8 default 20 23 default 20
9 help 24 help
@@ -42,7 +57,7 @@ config PS3_USE_LPAR_ADDR
42 57
43config PS3_VUART 58config PS3_VUART
44 depends on PPC_PS3 59 depends on PPC_PS3
45 bool "PS3 Virtual UART support" 60 bool "PS3 Virtual UART support" if PS3_ADVANCED
46 default y 61 default y
47 help 62 help
48 Include support for the PS3 Virtual UART. 63 Include support for the PS3 Virtual UART.
@@ -52,9 +67,8 @@ config PS3_VUART
52 general, all users will say Y. 67 general, all users will say Y.
53 68
54config PS3_PS3AV 69config PS3_PS3AV
55 tristate "PS3 AV settings driver" 70 tristate "PS3 AV settings driver" if PS3_ADVANCED
56 depends on PPC_PS3 71 depends on PS3_VUART
57 select PS3_VUART
58 default y 72 default y
59 help 73 help
60 Include support for the PS3 AV Settings driver. 74 Include support for the PS3 AV Settings driver.
@@ -63,8 +77,8 @@ config PS3_PS3AV
63 general, all users will say Y or M. 77 general, all users will say Y or M.
64 78
65config PS3_SYS_MANAGER 79config PS3_SYS_MANAGER
66 bool "PS3 System Manager driver" 80 bool "PS3 System Manager driver" if PS3_ADVANCED
67 select PS3_VUART 81 depends on PS3_VUART
68 default y 82 default y
69 help 83 help
70 Include support for the PS3 System Manager. 84 Include support for the PS3 System Manager.
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 59eef403c60a..860b8b60526c 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc1 3# Linux kernel version: 2.6.21-rc2
4# Mon Feb 26 10:45:21 2007 4# Wed Feb 28 09:50:51 2007
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -1219,6 +1219,7 @@ CONFIG_USB_HIDDEV=y
1219# CONFIG_USB_SISUSBVGA is not set 1219# CONFIG_USB_SISUSBVGA is not set
1220# CONFIG_USB_LD is not set 1220# CONFIG_USB_LD is not set
1221# CONFIG_USB_TRANCEVIBRATOR is not set 1221# CONFIG_USB_TRANCEVIBRATOR is not set
1222# CONFIG_USB_IOWARRIOR is not set
1222# CONFIG_USB_TEST is not set 1223# CONFIG_USB_TEST is not set
1223 1224
1224# 1225#
diff --git a/arch/um/Kconfig.char b/arch/um/Kconfig.char
index e03e40c7aac3..a5b079d5e865 100644
--- a/arch/um/Kconfig.char
+++ b/arch/um/Kconfig.char
@@ -146,6 +146,25 @@ config LEGACY_PTYS
146 security. This option enables these legacy devices; on most 146 security. This option enables these legacy devices; on most
147 systems, it is safe to say N. 147 systems, it is safe to say N.
148 148
149config RAW_DRIVER
150 tristate "RAW driver (/dev/raw/rawN) (OBSOLETE)"
151 help
152 The raw driver permits block devices to be bound to /dev/raw/rawN.
153 Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O.
154 See the raw(8) manpage for more details.
155
156 The raw driver is deprecated and will be removed soon.
157 Applications should simply open the device (eg /dev/hda1)
158 with the O_DIRECT flag.
159
160config MAX_RAW_DEVS
161 int "Maximum number of RAW devices to support (1-8192)"
162 depends on RAW_DRIVER
163 default "256"
164 help
165 The maximum number of RAW devices that are supported.
166 Default is 256. Increase this number in case you need lots of
167 raw devices.
149 168
150config LEGACY_PTY_COUNT 169config LEGACY_PTY_COUNT
151 int "Maximum number of legacy PTY in use" 170 int "Maximum number of legacy PTY in use"
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c
index 3a8d7e3aae0a..608784d4ec57 100644
--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -39,6 +39,9 @@ __init void scan_elf_aux( char **envp)
39 switch ( auxv->a_type ) { 39 switch ( auxv->a_type ) {
40 case AT_SYSINFO: 40 case AT_SYSINFO:
41 __kernel_vsyscall = auxv->a_un.a_val; 41 __kernel_vsyscall = auxv->a_un.a_val;
42 /* See if the page is under TASK_SIZE */
43 if (__kernel_vsyscall < (unsigned long) envp)
44 __kernel_vsyscall = 0;
42 break; 45 break;
43 case AT_SYSINFO_EHDR: 46 case AT_SYSINFO_EHDR:
44 vsyscall_ehdr = auxv->a_un.a_val; 47 vsyscall_ehdr = auxv->a_un.a_val;
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c
index b2e1fd8e3571..3fc43b33db66 100644
--- a/arch/um/os-Linux/sigio.c
+++ b/arch/um/os-Linux/sigio.c
@@ -334,8 +334,11 @@ void maybe_sigio_broken(int fd, int read)
334 334
335 sigio_lock(); 335 sigio_lock();
336 err = need_poll(&all_sigio_fds, all_sigio_fds.used + 1); 336 err = need_poll(&all_sigio_fds, all_sigio_fds.used + 1);
337 if(err) 337 if(err){
338 printk("maybe_sigio_broken - failed to add pollfd for "
339 "descriptor %d\n", fd);
338 goto out; 340 goto out;
341 }
339 342
340 all_sigio_fds.poll[all_sigio_fds.used++] = 343 all_sigio_fds.poll[all_sigio_fds.used++] =
341 ((struct pollfd) { .fd = fd, 344 ((struct pollfd) { .fd = fd,
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 5db7737df0ff..4a8b4202ef9e 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -7,6 +7,7 @@
7#include "linux/slab.h" 7#include "linux/slab.h"
8#include "linux/types.h" 8#include "linux/types.h"
9#include "linux/errno.h" 9#include "linux/errno.h"
10#include "linux/spinlock.h"
10#include "asm/uaccess.h" 11#include "asm/uaccess.h"
11#include "asm/smp.h" 12#include "asm/smp.h"
12#include "asm/ldt.h" 13#include "asm/ldt.h"
@@ -386,23 +387,33 @@ static long do_modify_ldt_skas(int func, void __user *ptr,
386 return ret; 387 return ret;
387} 388}
388 389
389short dummy_list[9] = {0, -1}; 390static DEFINE_SPINLOCK(host_ldt_lock);
390short * host_ldt_entries = NULL; 391static short dummy_list[9] = {0, -1};
392static short * host_ldt_entries = NULL;
391 393
392void ldt_get_host_info(void) 394static void ldt_get_host_info(void)
393{ 395{
394 long ret; 396 long ret;
395 struct ldt_entry * ldt; 397 struct ldt_entry * ldt, *tmp;
396 int i, size, k, order; 398 int i, size, k, order;
397 399
400 spin_lock(&host_ldt_lock);
401
402 if(host_ldt_entries != NULL){
403 spin_unlock(&host_ldt_lock);
404 return;
405 }
398 host_ldt_entries = dummy_list+1; 406 host_ldt_entries = dummy_list+1;
399 407
408 spin_unlock(&host_ldt_lock);
409
400 for(i = LDT_PAGES_MAX-1, order=0; i; i>>=1, order++); 410 for(i = LDT_PAGES_MAX-1, order=0; i; i>>=1, order++);
401 411
402 ldt = (struct ldt_entry *) 412 ldt = (struct ldt_entry *)
403 __get_free_pages(GFP_KERNEL|__GFP_ZERO, order); 413 __get_free_pages(GFP_KERNEL|__GFP_ZERO, order);
404 if(ldt == NULL) { 414 if(ldt == NULL) {
405 printk("ldt_get_host_info: couldn't allocate buffer for host ldt\n"); 415 printk("ldt_get_host_info: couldn't allocate buffer for host "
416 "ldt\n");
406 return; 417 return;
407 } 418 }
408 419
@@ -426,11 +437,13 @@ void ldt_get_host_info(void)
426 host_ldt_entries = dummy_list; 437 host_ldt_entries = dummy_list;
427 else { 438 else {
428 size = (size + 1) * sizeof(dummy_list[0]); 439 size = (size + 1) * sizeof(dummy_list[0]);
429 host_ldt_entries = kmalloc(size, GFP_KERNEL); 440 tmp = kmalloc(size, GFP_KERNEL);
430 if(host_ldt_entries == NULL) { 441 if(tmp == NULL) {
431 printk("ldt_get_host_info: couldn't allocate host ldt list\n"); 442 printk("ldt_get_host_info: couldn't allocate host ldt "
443 "list\n");
432 goto out_free; 444 goto out_free;
433 } 445 }
446 host_ldt_entries = tmp;
434 } 447 }
435 448
436 for(i=0, k=0; i<ret/LDT_ENTRY_SIZE; i++){ 449 for(i=0, k=0; i<ret/LDT_ENTRY_SIZE; i++){
@@ -480,8 +493,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
480 * inherited from the host. All ldt-entries found 493 * inherited from the host. All ldt-entries found
481 * will be reset in the following loop 494 * will be reset in the following loop
482 */ 495 */
483 if(host_ldt_entries == NULL) 496 ldt_get_host_info();
484 ldt_get_host_info();
485 for(num_p=host_ldt_entries; *num_p != -1; num_p++){ 497 for(num_p=host_ldt_entries; *num_p != -1; num_p++){
486 desc.entry_number = *num_p; 498 desc.entry_number = *num_p;
487 err = write_ldt_entry(&new_mm->id, 1, &desc, 499 err = write_ldt_entry(&new_mm->id, 1, &desc,
@@ -560,6 +572,6 @@ void free_ldt(struct mmu_context_skas * mm)
560 572
561int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount) 573int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount)
562{ 574{
563 return(CHOOSE_MODE_PROC(do_modify_ldt_tt, do_modify_ldt_skas, func, 575 return CHOOSE_MODE_PROC(do_modify_ldt_tt, do_modify_ldt_skas, func,
564 ptr, bytecount)); 576 ptr, bytecount);
565} 577}
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 48593f6b708f..0a91368f8b60 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -830,10 +830,6 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
830 disable_8259A_irq(irq); 830 disable_8259A_irq(irq);
831 831
832 ioapic_write_entry(apic, pin, entry); 832 ioapic_write_entry(apic, pin, entry);
833
834 spin_lock_irqsave(&ioapic_lock, flags);
835 irq_desc[irq].affinity = TARGET_CPUS;
836 spin_unlock_irqrestore(&ioapic_lock, flags);
837} 833}
838 834
839static void __init setup_IO_APIC_irqs(void) 835static void __init setup_IO_APIC_irqs(void)
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e942ffe8b57e..7c49e103cf8f 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -149,6 +149,7 @@ config ACPI_DOCK
149config ACPI_BAY 149config ACPI_BAY
150 tristate "Removable Drive Bay (EXPERIMENTAL)" 150 tristate "Removable Drive Bay (EXPERIMENTAL)"
151 depends on EXPERIMENTAL 151 depends on EXPERIMENTAL
152 depends on ACPI_DOCK
152 help 153 help
153 This driver adds support for ACPI controlled removable drive 154 This driver adds support for ACPI controlled removable drive
154 bays such as the IBM ultrabay or the Dell Module Bay. 155 bays such as the IBM ultrabay or the Dell Module Bay.
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index dff3766f117f..5872036e8ae6 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -1179,8 +1179,10 @@ static int __init mm_init(void)
1179 return -ENOMEM; 1179 return -ENOMEM;
1180 1180
1181 err = major_nr = register_blkdev(0, "umem"); 1181 err = major_nr = register_blkdev(0, "umem");
1182 if (err < 0) 1182 if (err < 0) {
1183 pci_unregister_driver(&mm_pci_driver);
1183 return -EIO; 1184 return -EIO;
1185 }
1184 1186
1185 for (i = 0; i < num_cards; i++) { 1187 for (i = 0; i < num_cards; i++) {
1186 mm_gendisk[i] = alloc_disk(1 << MM_SHIFT); 1188 mm_gendisk[i] = alloc_disk(1 << MM_SHIFT);
@@ -1207,6 +1209,7 @@ static int __init mm_init(void)
1207 return 0; 1209 return 0;
1208 1210
1209out: 1211out:
1212 pci_unregister_driver(&mm_pci_driver);
1210 unregister_blkdev(major_nr, "umem"); 1213 unregister_blkdev(major_nr, "umem");
1211 while (i--) 1214 while (i--)
1212 put_disk(mm_gendisk[i]); 1215 put_disk(mm_gendisk[i]);
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index f24c26d2dba1..e45326856680 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1901,6 +1901,20 @@ static int init_dev(struct tty_driver *driver, int idx,
1901 /* check whether we're reopening an existing tty */ 1901 /* check whether we're reopening an existing tty */
1902 if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { 1902 if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
1903 tty = devpts_get_tty(idx); 1903 tty = devpts_get_tty(idx);
1904 /*
1905 * If we don't have a tty here on a slave open, it's because
1906 * the master already started the close process and there's
1907 * no relation between devpts file and tty anymore.
1908 */
1909 if (!tty && driver->subtype == PTY_TYPE_SLAVE) {
1910 retval = -EIO;
1911 goto end_init;
1912 }
1913 /*
1914 * It's safe from now on because init_dev() is called with
1915 * tty_mutex held and release_dev() won't change tty->count
1916 * or tty->flags without having to grab tty_mutex
1917 */
1904 if (tty && driver->subtype == PTY_TYPE_MASTER) 1918 if (tty && driver->subtype == PTY_TYPE_MASTER)
1905 tty = tty->link; 1919 tty = tty->link;
1906 } else { 1920 } else {
diff --git a/drivers/isdn/capi/Kconfig b/drivers/isdn/capi/Kconfig
index 8b6c9a431ffa..c921d6c522f5 100644
--- a/drivers/isdn/capi/Kconfig
+++ b/drivers/isdn/capi/Kconfig
@@ -2,13 +2,25 @@
2# Config.in for the CAPI subsystem 2# Config.in for the CAPI subsystem
3# 3#
4config ISDN_DRV_AVMB1_VERBOSE_REASON 4config ISDN_DRV_AVMB1_VERBOSE_REASON
5 bool "Verbose reason code reporting (kernel size +=7K)" 5 bool "Verbose reason code reporting"
6 depends on ISDN_CAPI 6 depends on ISDN_CAPI
7 default y
7 help 8 help
8 If you say Y here, the AVM B1 driver will give verbose reasons for 9 If you say Y here, the CAPI drivers will give verbose reasons for
9 disconnecting. This will increase the size of the kernel by 7 KB. If 10 disconnecting. This will increase the size of the kernel by 7 KB. If
10 unsure, say Y. 11 unsure, say Y.
11 12
13config CAPI_TRACE
14 bool "CAPI trace support"
15 depends on ISDN_CAPI
16 default y
17 help
18 If you say Y here, the kernelcapi driver can make verbose traces
19 of CAPI messages. This feature can be enabled/disabled via IOCTL for
20 every controler (default disabled).
21 This will increase the size of the kernelcapi module by 20 KB.
22 If unsure, say Y.
23
12config ISDN_CAPI_MIDDLEWARE 24config ISDN_CAPI_MIDDLEWARE
13 bool "CAPI2.0 Middleware support (EXPERIMENTAL)" 25 bool "CAPI2.0 Middleware support (EXPERIMENTAL)"
14 depends on ISDN_CAPI && EXPERIMENTAL 26 depends on ISDN_CAPI && EXPERIMENTAL
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 2a49cea0a223..23b6f7bc16b7 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -990,6 +990,7 @@ static void handle_plci(_cmsg * cmsg)
990 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f); 990 capidrv_contr *card = findcontrbynumber(cmsg->adr.adrController & 0x7f);
991 capidrv_plci *plcip; 991 capidrv_plci *plcip;
992 isdn_ctrl cmd; 992 isdn_ctrl cmd;
993 _cdebbuf *cdb;
993 994
994 if (!card) { 995 if (!card) {
995 printk(KERN_ERR "capidrv: %s from unknown controller 0x%x\n", 996 printk(KERN_ERR "capidrv: %s from unknown controller 0x%x\n",
@@ -1122,8 +1123,15 @@ static void handle_plci(_cmsg * cmsg)
1122 break; 1123 break;
1123 } 1124 }
1124 } 1125 }
1125 printk(KERN_ERR "capidrv-%d: %s\n", 1126 cdb = capi_cmsg2str(cmsg);
1126 card->contrnr, capi_cmsg2str(cmsg)); 1127 if (cdb) {
1128 printk(KERN_WARNING "capidrv-%d: %s\n",
1129 card->contrnr, cdb->buf);
1130 cdebbuf_free(cdb);
1131 } else
1132 printk(KERN_WARNING "capidrv-%d: CAPI_INFO_IND InfoNumber %x not handled\n",
1133 card->contrnr, cmsg->InfoNumber);
1134
1127 break; 1135 break;
1128 1136
1129 case CAPI_CONNECT_ACTIVE_CONF: /* plci */ 1137 case CAPI_CONNECT_ACTIVE_CONF: /* plci */
@@ -1371,10 +1379,18 @@ static _cmsg s_cmsg;
1371static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb) 1379static void capidrv_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
1372{ 1380{
1373 capi_message2cmsg(&s_cmsg, skb->data); 1381 capi_message2cmsg(&s_cmsg, skb->data);
1374 if (debugmode > 3) 1382 if (debugmode > 3) {
1375 printk(KERN_DEBUG "capidrv_signal: applid=%d %s\n", 1383 _cdebbuf *cdb = capi_cmsg2str(&s_cmsg);
1376 ap->applid, capi_cmsg2str(&s_cmsg)); 1384
1377 1385 if (cdb) {
1386 printk(KERN_DEBUG "%s: applid=%d %s\n", __FUNCTION__,
1387 ap->applid, cdb->buf);
1388 cdebbuf_free(cdb);
1389 } else
1390 printk(KERN_DEBUG "%s: applid=%d %s not traced\n",
1391 __FUNCTION__, ap->applid,
1392 capi_cmd2str(s_cmsg.Command, s_cmsg.Subcommand));
1393 }
1378 if (s_cmsg.Command == CAPI_DATA_B3 1394 if (s_cmsg.Command == CAPI_DATA_B3
1379 && s_cmsg.Subcommand == CAPI_IND) { 1395 && s_cmsg.Subcommand == CAPI_IND) {
1380 handle_data(&s_cmsg, skb); 1396 handle_data(&s_cmsg, skb);
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index c1b21552fc03..ad1e2702c2d1 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -648,6 +648,9 @@ char *capi_cmd2str(u8 cmd, u8 subcmd)
648 648
649 649
650/*-------------------------------------------------------*/ 650/*-------------------------------------------------------*/
651
652#ifdef CONFIG_CAPI_TRACE
653
651/*-------------------------------------------------------*/ 654/*-------------------------------------------------------*/
652 655
653static char *pnames[] = 656static char *pnames[] =
@@ -703,44 +706,77 @@ static char *pnames[] =
703}; 706};
704 707
705 708
706static char buf[8192];
707static char *p = NULL;
708 709
709#include <stdarg.h> 710#include <stdarg.h>
710 711
711/*-------------------------------------------------------*/ 712/*-------------------------------------------------------*/
712static void bufprint(char *fmt,...) 713static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt,...)
713{ 714{
714 va_list f; 715 va_list f;
716 size_t n,r;
717
718 if (!cdb)
719 return NULL;
715 va_start(f, fmt); 720 va_start(f, fmt);
716 vsprintf(p, fmt, f); 721 r = cdb->size - cdb->pos;
722 n = vsnprintf(cdb->p, r, fmt, f);
717 va_end(f); 723 va_end(f);
718 p += strlen(p); 724 if (n >= r) {
725 /* truncated, need bigger buffer */
726 size_t ns = 2 * cdb->size;
727 u_char *nb;
728
729 while ((ns - cdb->pos) <= n)
730 ns *= 2;
731 nb = kmalloc(ns, GFP_ATOMIC);
732 if (!nb) {
733 cdebbuf_free(cdb);
734 return NULL;
735 }
736 memcpy(nb, cdb->buf, cdb->pos);
737 kfree(cdb->buf);
738 nb[cdb->pos] = 0;
739 cdb->buf = nb;
740 cdb->p = cdb->buf + cdb->pos;
741 cdb->size = ns;
742 va_start(f, fmt);
743 r = cdb->size - cdb->pos;
744 n = vsnprintf(cdb->p, r, fmt, f);
745 va_end(f);
746 }
747 cdb->p += n;
748 cdb->pos += n;
749 return cdb;
719} 750}
720 751
721static void printstructlen(u8 * m, unsigned len) 752static _cdebbuf *printstructlen(_cdebbuf *cdb, u8 * m, unsigned len)
722{ 753{
723 unsigned hex = 0; 754 unsigned hex = 0;
755
756 if (!cdb)
757 return NULL;
724 for (; len; len--, m++) 758 for (; len; len--, m++)
725 if (isalnum(*m) || *m == ' ') { 759 if (isalnum(*m) || *m == ' ') {
726 if (hex) 760 if (hex)
727 bufprint(">"); 761 cdb = bufprint(cdb, ">");
728 bufprint("%c", *m); 762 cdb = bufprint(cdb, "%c", *m);
729 hex = 0; 763 hex = 0;
730 } else { 764 } else {
731 if (!hex) 765 if (!hex)
732 bufprint("<%02x", *m); 766 cdb = bufprint(cdb, "<%02x", *m);
733 else 767 else
734 bufprint(" %02x", *m); 768 cdb = bufprint(cdb, " %02x", *m);
735 hex = 1; 769 hex = 1;
736 } 770 }
737 if (hex) 771 if (hex)
738 bufprint(">"); 772 cdb = bufprint(cdb, ">");
773 return cdb;
739} 774}
740 775
741static void printstruct(u8 * m) 776static _cdebbuf *printstruct(_cdebbuf *cdb, u8 * m)
742{ 777{
743 unsigned len; 778 unsigned len;
779
744 if (m[0] != 0xff) { 780 if (m[0] != 0xff) {
745 len = m[0]; 781 len = m[0];
746 m += 1; 782 m += 1;
@@ -748,42 +784,45 @@ static void printstruct(u8 * m)
748 len = ((u16 *) (m + 1))[0]; 784 len = ((u16 *) (m + 1))[0];
749 m += 3; 785 m += 3;
750 } 786 }
751 printstructlen(m, len); 787 cdb = printstructlen(cdb, m, len);
788 return cdb;
752} 789}
753 790
754/*-------------------------------------------------------*/ 791/*-------------------------------------------------------*/
755#define NAME (pnames[cmsg->par[cmsg->p]]) 792#define NAME (pnames[cmsg->par[cmsg->p]])
756 793
757static void protocol_message_2_pars(_cmsg * cmsg, int level) 794static _cdebbuf *protocol_message_2_pars(_cdebbuf *cdb, _cmsg *cmsg, int level)
758{ 795{
759 for (; TYP != _CEND; cmsg->p++) { 796 for (; TYP != _CEND; cmsg->p++) {
760 int slen = 29 + 3 - level; 797 int slen = 29 + 3 - level;
761 int i; 798 int i;
762 799
763 bufprint(" "); 800 if (!cdb)
801 return NULL;
802 cdb = bufprint(cdb, " ");
764 for (i = 0; i < level - 1; i++) 803 for (i = 0; i < level - 1; i++)
765 bufprint(" "); 804 cdb = bufprint(cdb, " ");
766 805
767 switch (TYP) { 806 switch (TYP) {
768 case _CBYTE: 807 case _CBYTE:
769 bufprint("%-*s = 0x%x\n", slen, NAME, *(u8 *) (cmsg->m + cmsg->l)); 808 cdb = bufprint(cdb, "%-*s = 0x%x\n", slen, NAME, *(u8 *) (cmsg->m + cmsg->l));
770 cmsg->l++; 809 cmsg->l++;
771 break; 810 break;
772 case _CWORD: 811 case _CWORD:
773 bufprint("%-*s = 0x%x\n", slen, NAME, *(u16 *) (cmsg->m + cmsg->l)); 812 cdb = bufprint(cdb, "%-*s = 0x%x\n", slen, NAME, *(u16 *) (cmsg->m + cmsg->l));
774 cmsg->l += 2; 813 cmsg->l += 2;
775 break; 814 break;
776 case _CDWORD: 815 case _CDWORD:
777 bufprint("%-*s = 0x%lx\n", slen, NAME, *(u32 *) (cmsg->m + cmsg->l)); 816 cdb = bufprint(cdb, "%-*s = 0x%lx\n", slen, NAME, *(u32 *) (cmsg->m + cmsg->l));
778 cmsg->l += 4; 817 cmsg->l += 4;
779 break; 818 break;
780 case _CSTRUCT: 819 case _CSTRUCT:
781 bufprint("%-*s = ", slen, NAME); 820 cdb = bufprint(cdb, "%-*s = ", slen, NAME);
782 if (cmsg->m[cmsg->l] == '\0') 821 if (cmsg->m[cmsg->l] == '\0')
783 bufprint("default"); 822 cdb = bufprint(cdb, "default");
784 else 823 else
785 printstruct(cmsg->m + cmsg->l); 824 cdb = printstruct(cdb, cmsg->m + cmsg->l);
786 bufprint("\n"); 825 cdb = bufprint(cdb, "\n");
787 if (cmsg->m[cmsg->l] != 0xff) 826 if (cmsg->m[cmsg->l] != 0xff)
788 cmsg->l += 1 + cmsg->m[cmsg->l]; 827 cmsg->l += 1 + cmsg->m[cmsg->l];
789 else 828 else
@@ -794,61 +833,184 @@ static void protocol_message_2_pars(_cmsg * cmsg, int level)
794 case _CMSTRUCT: 833 case _CMSTRUCT:
795/*----- Metastruktur 0 -----*/ 834/*----- Metastruktur 0 -----*/
796 if (cmsg->m[cmsg->l] == '\0') { 835 if (cmsg->m[cmsg->l] == '\0') {
797 bufprint("%-*s = default\n", slen, NAME); 836 cdb = bufprint(cdb, "%-*s = default\n", slen, NAME);
798 cmsg->l++; 837 cmsg->l++;
799 jumpcstruct(cmsg); 838 jumpcstruct(cmsg);
800 } else { 839 } else {
801 char *name = NAME; 840 char *name = NAME;
802 unsigned _l = cmsg->l; 841 unsigned _l = cmsg->l;
803 bufprint("%-*s\n", slen, name); 842 cdb = bufprint(cdb, "%-*s\n", slen, name);
804 cmsg->l = (cmsg->m + _l)[0] == 255 ? cmsg->l + 3 : cmsg->l + 1; 843 cmsg->l = (cmsg->m + _l)[0] == 255 ? cmsg->l + 3 : cmsg->l + 1;
805 cmsg->p++; 844 cmsg->p++;
806 protocol_message_2_pars(cmsg, level + 1); 845 cdb = protocol_message_2_pars(cdb, cmsg, level + 1);
807 } 846 }
808 break; 847 break;
809 } 848 }
810 } 849 }
850 return cdb;
811} 851}
812/*-------------------------------------------------------*/ 852/*-------------------------------------------------------*/
813char *capi_message2str(u8 * msg) 853
854static _cdebbuf *g_debbuf;
855static u_long g_debbuf_lock;
856static _cmsg *g_cmsg;
857
858_cdebbuf *cdebbuf_alloc(void)
814{ 859{
860 _cdebbuf *cdb;
861
862 if (likely(!test_and_set_bit(1, &g_debbuf_lock))) {
863 cdb = g_debbuf;
864 goto init;
865 } else
866 cdb = kmalloc(sizeof(_cdebbuf), GFP_ATOMIC);
867 if (!cdb)
868 return NULL;
869 cdb->buf = kmalloc(CDEBUG_SIZE, GFP_ATOMIC);
870 if (!cdb->buf) {
871 kfree(cdb);
872 return NULL;
873 }
874 cdb->size = CDEBUG_SIZE;
875init:
876 cdb->buf[0] = 0;
877 cdb->p = cdb->buf;
878 cdb->pos = 0;
879 return cdb;
880}
815 881
816 _cmsg cmsg; 882void cdebbuf_free(_cdebbuf *cdb)
817 p = buf; 883{
818 p[0] = 0; 884 if (likely(cdb == g_debbuf)) {
885 test_and_clear_bit(1, &g_debbuf_lock);
886 return;
887 }
888 if (likely(cdb))
889 kfree(cdb->buf);
890 kfree(cdb);
891}
819 892
820 cmsg.m = msg;
821 cmsg.l = 8;
822 cmsg.p = 0;
823 byteTRcpy(cmsg.m + 4, &cmsg.Command);
824 byteTRcpy(cmsg.m + 5, &cmsg.Subcommand);
825 cmsg.par = cpars[command_2_index(cmsg.Command, cmsg.Subcommand)];
826 893
827 bufprint("%-26s ID=%03d #0x%04x LEN=%04d\n", 894_cdebbuf *capi_message2str(u8 * msg)
828 mnames[command_2_index(cmsg.Command, cmsg.Subcommand)], 895{
896 _cdebbuf *cdb;
897 _cmsg *cmsg;
898
899 cdb = cdebbuf_alloc();
900 if (unlikely(!cdb))
901 return NULL;
902 if (likely(cdb == g_debbuf))
903 cmsg = g_cmsg;
904 else
905 cmsg = kmalloc(sizeof(_cmsg), GFP_ATOMIC);
906 if (unlikely(!cmsg)) {
907 cdebbuf_free(cdb);
908 return NULL;
909 }
910 cmsg->m = msg;
911 cmsg->l = 8;
912 cmsg->p = 0;
913 byteTRcpy(cmsg->m + 4, &cmsg->Command);
914 byteTRcpy(cmsg->m + 5, &cmsg->Subcommand);
915 cmsg->par = cpars[command_2_index(cmsg->Command, cmsg->Subcommand)];
916
917 cdb = bufprint(cdb, "%-26s ID=%03d #0x%04x LEN=%04d\n",
918 mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
829 ((unsigned short *) msg)[1], 919 ((unsigned short *) msg)[1],
830 ((unsigned short *) msg)[3], 920 ((unsigned short *) msg)[3],
831 ((unsigned short *) msg)[0]); 921 ((unsigned short *) msg)[0]);
832 922
833 protocol_message_2_pars(&cmsg, 1); 923 cdb = protocol_message_2_pars(cdb, cmsg, 1);
834 return buf; 924 if (unlikely(cmsg != g_cmsg))
925 kfree(cmsg);
926 return cdb;
835} 927}
836 928
837char *capi_cmsg2str(_cmsg * cmsg) 929_cdebbuf *capi_cmsg2str(_cmsg * cmsg)
838{ 930{
839 p = buf; 931 _cdebbuf *cdb;
840 p[0] = 0; 932
933 cdb = cdebbuf_alloc();
934 if (!cdb)
935 return NULL;
841 cmsg->l = 8; 936 cmsg->l = 8;
842 cmsg->p = 0; 937 cmsg->p = 0;
843 bufprint("%s ID=%03d #0x%04x LEN=%04d\n", 938 cdb = bufprint(cdb, "%s ID=%03d #0x%04x LEN=%04d\n",
844 mnames[command_2_index(cmsg->Command, cmsg->Subcommand)], 939 mnames[command_2_index(cmsg->Command, cmsg->Subcommand)],
845 ((u16 *) cmsg->m)[1], 940 ((u16 *) cmsg->m)[1],
846 ((u16 *) cmsg->m)[3], 941 ((u16 *) cmsg->m)[3],
847 ((u16 *) cmsg->m)[0]); 942 ((u16 *) cmsg->m)[0]);
848 protocol_message_2_pars(cmsg, 1); 943 cdb = protocol_message_2_pars(cdb, cmsg, 1);
849 return buf; 944 return cdb;
850} 945}
851 946
947int __init cdebug_init(void)
948{
949 g_cmsg= kmalloc(sizeof(_cmsg), GFP_KERNEL);
950 if (!g_cmsg)
951 return ENOMEM;
952 g_debbuf = kmalloc(sizeof(_cdebbuf), GFP_KERNEL);
953 if (!g_debbuf) {
954 kfree(g_cmsg);
955 return ENOMEM;
956 }
957 g_debbuf->buf = kmalloc(CDEBUG_GSIZE, GFP_KERNEL);
958 if (!g_debbuf->buf) {
959 kfree(g_cmsg);
960 kfree(g_debbuf);
961 return ENOMEM;;
962 }
963 g_debbuf->size = CDEBUG_GSIZE;
964 g_debbuf->buf[0] = 0;
965 g_debbuf->p = g_debbuf->buf;
966 g_debbuf->pos = 0;
967 return 0;
968}
969
970void __exit cdebug_exit(void)
971{
972 if (g_debbuf)
973 kfree(g_debbuf->buf);
974 kfree(g_debbuf);
975 kfree(g_cmsg);
976}
977
978#else /* !CONFIG_CAPI_TRACE */
979
980static _cdebbuf g_debbuf = {"CONFIG_CAPI_TRACE not enabled", NULL, 0, 0};
981
982_cdebbuf *capi_message2str(u8 * msg)
983{
984 return &g_debbuf;
985}
986
987_cdebbuf *capi_cmsg2str(_cmsg * cmsg)
988{
989 return &g_debbuf;
990}
991
992_cdebbuf *cdebbuf_alloc(void)
993{
994 return &g_debbuf;
995}
996
997void cdebbuf_free(_cdebbuf *cdb)
998{
999}
1000
1001int __init cdebug_init(void)
1002{
1003 return 0;
1004}
1005
1006void __exit cdebug_exit(void)
1007{
1008}
1009
1010#endif
1011
1012EXPORT_SYMBOL(cdebbuf_alloc);
1013EXPORT_SYMBOL(cdebbuf_free);
852EXPORT_SYMBOL(capi_cmsg2message); 1014EXPORT_SYMBOL(capi_cmsg2message);
853EXPORT_SYMBOL(capi_message2cmsg); 1015EXPORT_SYMBOL(capi_message2cmsg);
854EXPORT_SYMBOL(capi_cmsg_header); 1016EXPORT_SYMBOL(capi_cmsg_header);
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 783a25526315..3ed34f7a1c4f 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -276,10 +276,17 @@ void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *s
276 int showctl = 0; 276 int showctl = 0;
277 u8 cmd, subcmd; 277 u8 cmd, subcmd;
278 unsigned long flags; 278 unsigned long flags;
279 _cdebbuf *cdb;
279 280
280 if (card->cardstate != CARD_RUNNING) { 281 if (card->cardstate != CARD_RUNNING) {
281 printk(KERN_INFO "kcapi: controller %d not active, got: %s", 282 cdb = capi_message2str(skb->data);
282 card->cnr, capi_message2str(skb->data)); 283 if (cdb) {
284 printk(KERN_INFO "kcapi: controller [%03d] not active, got: %s",
285 card->cnr, cdb->buf);
286 cdebbuf_free(cdb);
287 } else
288 printk(KERN_INFO "kcapi: controller [%03d] not active, cannot trace\n",
289 card->cnr);
283 goto error; 290 goto error;
284 } 291 }
285 292
@@ -295,15 +302,21 @@ void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *s
295 showctl |= (card->traceflag & 1); 302 showctl |= (card->traceflag & 1);
296 if (showctl & 2) { 303 if (showctl & 2) {
297 if (showctl & 1) { 304 if (showctl & 1) {
298 printk(KERN_DEBUG "kcapi: got [0x%lx] id#%d %s len=%u\n", 305 printk(KERN_DEBUG "kcapi: got [%03d] id#%d %s len=%u\n",
299 (unsigned long) card->cnr, 306 card->cnr, CAPIMSG_APPID(skb->data),
300 CAPIMSG_APPID(skb->data),
301 capi_cmd2str(cmd, subcmd), 307 capi_cmd2str(cmd, subcmd),
302 CAPIMSG_LEN(skb->data)); 308 CAPIMSG_LEN(skb->data));
303 } else { 309 } else {
304 printk(KERN_DEBUG "kcapi: got [0x%lx] %s\n", 310 cdb = capi_message2str(skb->data);
305 (unsigned long) card->cnr, 311 if (cdb) {
306 capi_message2str(skb->data)); 312 printk(KERN_DEBUG "kcapi: got [%03d] %s\n",
313 card->cnr, cdb->buf);
314 cdebbuf_free(cdb);
315 } else
316 printk(KERN_DEBUG "kcapi: got [%03d] id#%d %s len=%u, cannot trace\n",
317 card->cnr, CAPIMSG_APPID(skb->data),
318 capi_cmd2str(cmd, subcmd),
319 CAPIMSG_LEN(skb->data));
307 } 320 }
308 321
309 } 322 }
@@ -312,8 +325,15 @@ void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *s
312 ap = get_capi_appl_by_nr(CAPIMSG_APPID(skb->data)); 325 ap = get_capi_appl_by_nr(CAPIMSG_APPID(skb->data));
313 if ((!ap) || (ap->release_in_progress)) { 326 if ((!ap) || (ap->release_in_progress)) {
314 read_unlock_irqrestore(&application_lock, flags); 327 read_unlock_irqrestore(&application_lock, flags);
315 printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s)\n", 328 cdb = capi_message2str(skb->data);
316 CAPIMSG_APPID(skb->data), capi_message2str(skb->data)); 329 if (cdb) {
330 printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s)\n",
331 CAPIMSG_APPID(skb->data), cdb->buf);
332 cdebbuf_free(cdb);
333 } else
334 printk(KERN_ERR "kcapi: handle_message: applid %d state released (%s) cannot trace\n",
335 CAPIMSG_APPID(skb->data),
336 capi_cmd2str(cmd, subcmd));
317 goto error; 337 goto error;
318 } 338 }
319 skb_queue_tail(&ap->recv_queue, skb); 339 skb_queue_tail(&ap->recv_queue, skb);
@@ -332,7 +352,7 @@ void capi_ctr_ready(struct capi_ctr * card)
332{ 352{
333 card->cardstate = CARD_RUNNING; 353 card->cardstate = CARD_RUNNING;
334 354
335 printk(KERN_NOTICE "kcapi: card %d \"%s\" ready.\n", 355 printk(KERN_NOTICE "kcapi: card [%03d] \"%s\" ready.\n",
336 card->cnr, card->name); 356 card->cnr, card->name);
337 357
338 notify_push(KCI_CONTRUP, card->cnr, 0, 0); 358 notify_push(KCI_CONTRUP, card->cnr, 0, 0);
@@ -364,7 +384,7 @@ void capi_ctr_reseted(struct capi_ctr * card)
364 capi_ctr_put(card); 384 capi_ctr_put(card);
365 } 385 }
366 386
367 printk(KERN_NOTICE "kcapi: card %d down.\n", card->cnr); 387 printk(KERN_NOTICE "kcapi: card [%03d] down.\n", card->cnr);
368 388
369 notify_push(KCI_CONTRDOWN, card->cnr, 0, 0); 389 notify_push(KCI_CONTRDOWN, card->cnr, 0, 0);
370} 390}
@@ -374,7 +394,7 @@ EXPORT_SYMBOL(capi_ctr_reseted);
374void capi_ctr_suspend_output(struct capi_ctr *card) 394void capi_ctr_suspend_output(struct capi_ctr *card)
375{ 395{
376 if (!card->blocked) { 396 if (!card->blocked) {
377 printk(KERN_DEBUG "kcapi: card %d suspend\n", card->cnr); 397 printk(KERN_DEBUG "kcapi: card [%03d] suspend\n", card->cnr);
378 card->blocked = 1; 398 card->blocked = 1;
379 } 399 }
380} 400}
@@ -384,7 +404,7 @@ EXPORT_SYMBOL(capi_ctr_suspend_output);
384void capi_ctr_resume_output(struct capi_ctr *card) 404void capi_ctr_resume_output(struct capi_ctr *card)
385{ 405{
386 if (card->blocked) { 406 if (card->blocked) {
387 printk(KERN_DEBUG "kcapi: card %d resume\n", card->cnr); 407 printk(KERN_DEBUG "kcapi: card [%03d] resume\n", card->cnr);
388 card->blocked = 0; 408 card->blocked = 0;
389 } 409 }
390} 410}
@@ -432,7 +452,7 @@ attach_capi_ctr(struct capi_ctr *card)
432 } 452 }
433 453
434 ncards++; 454 ncards++;
435 printk(KERN_NOTICE "kcapi: Controller %d: %s attached\n", 455 printk(KERN_NOTICE "kcapi: Controller [%03d]: %s attached\n",
436 card->cnr, card->name); 456 card->cnr, card->name);
437 return 0; 457 return 0;
438} 458}
@@ -451,7 +471,7 @@ int detach_capi_ctr(struct capi_ctr *card)
451 card->procent = NULL; 471 card->procent = NULL;
452 } 472 }
453 capi_cards[card->cnr - 1] = NULL; 473 capi_cards[card->cnr - 1] = NULL;
454 printk(KERN_NOTICE "kcapi: Controller %d: %s unregistered\n", 474 printk(KERN_NOTICE "kcapi: Controller [%03d]: %s unregistered\n",
455 card->cnr, card->name); 475 card->cnr, card->name);
456 476
457 return 0; 477 return 0;
@@ -623,17 +643,25 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
623 showctl |= (card->traceflag & 1); 643 showctl |= (card->traceflag & 1);
624 if (showctl & 2) { 644 if (showctl & 2) {
625 if (showctl & 1) { 645 if (showctl & 1) {
626 printk(KERN_DEBUG "kcapi: put [%#x] id#%d %s len=%u\n", 646 printk(KERN_DEBUG "kcapi: put [%03d] id#%d %s len=%u\n",
627 CAPIMSG_CONTROLLER(skb->data), 647 CAPIMSG_CONTROLLER(skb->data),
628 CAPIMSG_APPID(skb->data), 648 CAPIMSG_APPID(skb->data),
629 capi_cmd2str(cmd, subcmd), 649 capi_cmd2str(cmd, subcmd),
630 CAPIMSG_LEN(skb->data)); 650 CAPIMSG_LEN(skb->data));
631 } else { 651 } else {
632 printk(KERN_DEBUG "kcapi: put [%#x] %s\n", 652 _cdebbuf *cdb = capi_message2str(skb->data);
633 CAPIMSG_CONTROLLER(skb->data), 653 if (cdb) {
634 capi_message2str(skb->data)); 654 printk(KERN_DEBUG "kcapi: put [%03d] %s\n",
655 CAPIMSG_CONTROLLER(skb->data),
656 cdb->buf);
657 cdebbuf_free(cdb);
658 } else
659 printk(KERN_DEBUG "kcapi: put [%03d] id#%d %s len=%u cannot trace\n",
660 CAPIMSG_CONTROLLER(skb->data),
661 CAPIMSG_APPID(skb->data),
662 capi_cmd2str(cmd, subcmd),
663 CAPIMSG_LEN(skb->data));
635 } 664 }
636
637 } 665 }
638 return card->send_message(card, skb); 666 return card->send_message(card, skb);
639} 667}
@@ -894,7 +922,7 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
894 return -ESRCH; 922 return -ESRCH;
895 923
896 card->traceflag = fdef.flag; 924 card->traceflag = fdef.flag;
897 printk(KERN_INFO "kcapi: contr %d set trace=%d\n", 925 printk(KERN_INFO "kcapi: contr [%03d] set trace=%d\n",
898 card->cnr, card->traceflag); 926 card->cnr, card->traceflag);
899 return 0; 927 return 0;
900 } 928 }
@@ -967,7 +995,11 @@ static int __init kcapi_init(void)
967{ 995{
968 char *p; 996 char *p;
969 char rev[32]; 997 char rev[32];
998 int ret;
970 999
1000 ret = cdebug_init();
1001 if (ret)
1002 return ret;
971 kcapi_proc_init(); 1003 kcapi_proc_init();
972 1004
973 if ((p = strchr(revision, ':')) != 0 && p[1]) { 1005 if ((p = strchr(revision, ':')) != 0 && p[1]) {
@@ -988,6 +1020,7 @@ static void __exit kcapi_exit(void)
988 1020
989 /* make sure all notifiers are finished */ 1021 /* make sure all notifiers are finished */
990 flush_scheduled_work(); 1022 flush_scheduled_work();
1023 cdebug_exit();
991} 1024}
992 1025
993module_init(kcapi_init); 1026module_init(kcapi_init);
diff --git a/drivers/isdn/gigaset/Makefile b/drivers/isdn/gigaset/Makefile
index 5158be0b7ab4..e9d3189f56b7 100644
--- a/drivers/isdn/gigaset/Makefile
+++ b/drivers/isdn/gigaset/Makefile
@@ -1,8 +1,9 @@
1gigaset-y := common.o interface.o proc.o ev-layer.o i4l.o asyncdata.o 1gigaset-y := common.o interface.o proc.o ev-layer.o i4l.o asyncdata.o
2usb_gigaset-y := usb-gigaset.o 2usb_gigaset-y := usb-gigaset.o
3bas_gigaset-y := bas-gigaset.o isocdata.o
4ser_gigaset-y := ser-gigaset.o 3ser_gigaset-y := ser-gigaset.o
4bas_gigaset-y := bas-gigaset.o isocdata.o
5 5
6obj-$(CONFIG_GIGASET_M105) += usb_gigaset.o gigaset.o 6obj-$(CONFIG_ISDN_DRV_GIGASET) += gigaset.o
7obj-$(CONFIG_GIGASET_BASE) += bas_gigaset.o gigaset.o 7obj-$(CONFIG_GIGASET_M105) += usb_gigaset.o
8obj-$(CONFIG_GIGASET_M101) += ser_gigaset.o gigaset.o 8obj-$(CONFIG_GIGASET_BASE) += bas_gigaset.o
9obj-$(CONFIG_GIGASET_M101) += ser_gigaset.o
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
index f2f108fcec4d..00a3be5b862b 100644
--- a/drivers/isdn/gigaset/asyncdata.c
+++ b/drivers/isdn/gigaset/asyncdata.c
@@ -13,11 +13,6 @@
13 * ===================================================================== 13 * =====================================================================
14 */ 14 */
15 15
16/* not set by Kbuild when building both ser_gigaset and usb_gigaset */
17#ifndef KBUILD_MODNAME
18#define KBUILD_MODNAME "asy_gigaset"
19#endif
20
21#include "gigaset.h" 16#include "gigaset.h"
22#include <linux/crc-ccitt.h> 17#include <linux/crc-ccitt.h>
23#include <linux/bitrev.h> 18#include <linux/bitrev.h>
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 05febfd9f071..6c06e825cff5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1296,27 +1296,17 @@ static struct super_type super_types[] = {
1296 .sync_super = super_1_sync, 1296 .sync_super = super_1_sync,
1297 }, 1297 },
1298}; 1298};
1299
1300static mdk_rdev_t * match_dev_unit(mddev_t *mddev, mdk_rdev_t *dev)
1301{
1302 struct list_head *tmp;
1303 mdk_rdev_t *rdev;
1304
1305 ITERATE_RDEV(mddev,rdev,tmp)
1306 if (rdev->bdev->bd_contains == dev->bdev->bd_contains)
1307 return rdev;
1308
1309 return NULL;
1310}
1311 1299
1312static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) 1300static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2)
1313{ 1301{
1314 struct list_head *tmp; 1302 struct list_head *tmp, *tmp2;
1315 mdk_rdev_t *rdev; 1303 mdk_rdev_t *rdev, *rdev2;
1316 1304
1317 ITERATE_RDEV(mddev1,rdev,tmp) 1305 ITERATE_RDEV(mddev1,rdev,tmp)
1318 if (match_dev_unit(mddev2, rdev)) 1306 ITERATE_RDEV(mddev2, rdev2, tmp2)
1319 return 1; 1307 if (rdev->bdev->bd_contains ==
1308 rdev2->bdev->bd_contains)
1309 return 1;
1320 1310
1321 return 0; 1311 return 0;
1322} 1312}
@@ -1325,8 +1315,7 @@ static LIST_HEAD(pending_raid_disks);
1325 1315
1326static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) 1316static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1327{ 1317{
1328 mdk_rdev_t *same_pdev; 1318 char b[BDEVNAME_SIZE];
1329 char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
1330 struct kobject *ko; 1319 struct kobject *ko;
1331 char *s; 1320 char *s;
1332 1321
@@ -1342,14 +1331,6 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1342 else 1331 else
1343 mddev->size = rdev->size; 1332 mddev->size = rdev->size;
1344 } 1333 }
1345 same_pdev = match_dev_unit(mddev, rdev);
1346 if (same_pdev)
1347 printk(KERN_WARNING
1348 "%s: WARNING: %s appears to be on the same physical"
1349 " disk as %s. True\n protection against single-disk"
1350 " failure might be compromised.\n",
1351 mdname(mddev), bdevname(rdev->bdev,b),
1352 bdevname(same_pdev->bdev,b2));
1353 1334
1354 /* Verify rdev->desc_nr is unique. 1335 /* Verify rdev->desc_nr is unique.
1355 * If it is -1, assign a free number, else 1336 * If it is -1, assign a free number, else
@@ -3109,6 +3090,36 @@ static int do_md_run(mddev_t * mddev)
3109 return -EINVAL; 3090 return -EINVAL;
3110 } 3091 }
3111 3092
3093 if (pers->sync_request) {
3094 /* Warn if this is a potentially silly
3095 * configuration.
3096 */
3097 char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
3098 mdk_rdev_t *rdev2;
3099 struct list_head *tmp2;
3100 int warned = 0;
3101 ITERATE_RDEV(mddev, rdev, tmp) {
3102 ITERATE_RDEV(mddev, rdev2, tmp2) {
3103 if (rdev < rdev2 &&
3104 rdev->bdev->bd_contains ==
3105 rdev2->bdev->bd_contains) {
3106 printk(KERN_WARNING
3107 "%s: WARNING: %s appears to be"
3108 " on the same physical disk as"
3109 " %s.\n",
3110 mdname(mddev),
3111 bdevname(rdev->bdev,b),
3112 bdevname(rdev2->bdev,b2));
3113 warned = 1;
3114 }
3115 }
3116 }
3117 if (warned)
3118 printk(KERN_WARNING
3119 "True protection against single-disk"
3120 " failure might be compromised.\n");
3121 }
3122
3112 mddev->recovery = 0; 3123 mddev->recovery = 0;
3113 mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */ 3124 mddev->resync_max_sectors = mddev->size << 1; /* may be over-ridden by personality */
3114 mddev->barriers_work = 1; 3125 mddev->barriers_work = 1;
@@ -3311,6 +3322,9 @@ static int do_md_stop(mddev_t * mddev, int mode)
3311 set_disk_ro(disk, 0); 3322 set_disk_ro(disk, 0);
3312 blk_queue_make_request(mddev->queue, md_fail_request); 3323 blk_queue_make_request(mddev->queue, md_fail_request);
3313 mddev->pers->stop(mddev); 3324 mddev->pers->stop(mddev);
3325 mddev->queue->merge_bvec_fn = NULL;
3326 mddev->queue->unplug_fn = NULL;
3327 mddev->queue->issue_flush_fn = NULL;
3314 if (mddev->pers->sync_request) 3328 if (mddev->pers->sync_request)
3315 sysfs_remove_group(&mddev->kobj, &md_redundancy_group); 3329 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
3316 3330
@@ -5343,6 +5357,44 @@ void md_do_sync(mddev_t *mddev)
5343EXPORT_SYMBOL_GPL(md_do_sync); 5357EXPORT_SYMBOL_GPL(md_do_sync);
5344 5358
5345 5359
5360static int remove_and_add_spares(mddev_t *mddev)
5361{
5362 mdk_rdev_t *rdev;
5363 struct list_head *rtmp;
5364 int spares = 0;
5365
5366 ITERATE_RDEV(mddev,rdev,rtmp)
5367 if (rdev->raid_disk >= 0 &&
5368 (test_bit(Faulty, &rdev->flags) ||
5369 ! test_bit(In_sync, &rdev->flags)) &&
5370 atomic_read(&rdev->nr_pending)==0) {
5371 if (mddev->pers->hot_remove_disk(
5372 mddev, rdev->raid_disk)==0) {
5373 char nm[20];
5374 sprintf(nm,"rd%d", rdev->raid_disk);
5375 sysfs_remove_link(&mddev->kobj, nm);
5376 rdev->raid_disk = -1;
5377 }
5378 }
5379
5380 if (mddev->degraded) {
5381 ITERATE_RDEV(mddev,rdev,rtmp)
5382 if (rdev->raid_disk < 0
5383 && !test_bit(Faulty, &rdev->flags)) {
5384 rdev->recovery_offset = 0;
5385 if (mddev->pers->hot_add_disk(mddev,rdev)) {
5386 char nm[20];
5387 sprintf(nm, "rd%d", rdev->raid_disk);
5388 sysfs_create_link(&mddev->kobj,
5389 &rdev->kobj, nm);
5390 spares++;
5391 md_new_event(mddev);
5392 } else
5393 break;
5394 }
5395 }
5396 return spares;
5397}
5346/* 5398/*
5347 * This routine is regularly called by all per-raid-array threads to 5399 * This routine is regularly called by all per-raid-array threads to
5348 * deal with generic issues like resync and super-block update. 5400 * deal with generic issues like resync and super-block update.
@@ -5397,7 +5449,7 @@ void md_check_recovery(mddev_t *mddev)
5397 return; 5449 return;
5398 5450
5399 if (mddev_trylock(mddev)) { 5451 if (mddev_trylock(mddev)) {
5400 int spares =0; 5452 int spares = 0;
5401 5453
5402 spin_lock_irq(&mddev->write_lock); 5454 spin_lock_irq(&mddev->write_lock);
5403 if (mddev->safemode && !atomic_read(&mddev->writes_pending) && 5455 if (mddev->safemode && !atomic_read(&mddev->writes_pending) &&
@@ -5460,35 +5512,13 @@ void md_check_recovery(mddev_t *mddev)
5460 * Spare are also removed and re-added, to allow 5512 * Spare are also removed and re-added, to allow
5461 * the personality to fail the re-add. 5513 * the personality to fail the re-add.
5462 */ 5514 */
5463 ITERATE_RDEV(mddev,rdev,rtmp)
5464 if (rdev->raid_disk >= 0 &&
5465 (test_bit(Faulty, &rdev->flags) || ! test_bit(In_sync, &rdev->flags)) &&
5466 atomic_read(&rdev->nr_pending)==0) {
5467 if (mddev->pers->hot_remove_disk(mddev, rdev->raid_disk)==0) {
5468 char nm[20];
5469 sprintf(nm,"rd%d", rdev->raid_disk);
5470 sysfs_remove_link(&mddev->kobj, nm);
5471 rdev->raid_disk = -1;
5472 }
5473 }
5474
5475 if (mddev->degraded) {
5476 ITERATE_RDEV(mddev,rdev,rtmp)
5477 if (rdev->raid_disk < 0
5478 && !test_bit(Faulty, &rdev->flags)) {
5479 rdev->recovery_offset = 0;
5480 if (mddev->pers->hot_add_disk(mddev,rdev)) {
5481 char nm[20];
5482 sprintf(nm, "rd%d", rdev->raid_disk);
5483 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
5484 spares++;
5485 md_new_event(mddev);
5486 } else
5487 break;
5488 }
5489 }
5490 5515
5491 if (spares) { 5516 if (mddev->reshape_position != MaxSector) {
5517 if (mddev->pers->check_reshape(mddev) != 0)
5518 /* Cannot proceed */
5519 goto unlock;
5520 set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery);
5521 } else if ((spares = remove_and_add_spares(mddev))) {
5492 clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); 5522 clear_bit(MD_RECOVERY_SYNC, &mddev->recovery);
5493 clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); 5523 clear_bit(MD_RECOVERY_CHECK, &mddev->recovery);
5494 } else if (mddev->recovery_cp < MaxSector) { 5524 } else if (mddev->recovery_cp < MaxSector) {
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index a9401c017e35..82249a69014f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -429,7 +429,7 @@ static sector_t raid10_find_virt(conf_t *conf, sector_t sector, int dev)
429 if (dev < 0) 429 if (dev < 0)
430 dev += conf->raid_disks; 430 dev += conf->raid_disks;
431 } else { 431 } else {
432 while (sector > conf->stride) { 432 while (sector >= conf->stride) {
433 sector -= conf->stride; 433 sector -= conf->stride;
434 if (dev < conf->near_copies) 434 if (dev < conf->near_copies)
435 dev += conf->raid_disks - conf->near_copies; 435 dev += conf->raid_disks - conf->near_copies;
@@ -1801,6 +1801,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i
1801 for (k=0; k<conf->copies; k++) 1801 for (k=0; k<conf->copies; k++)
1802 if (r10_bio->devs[k].devnum == i) 1802 if (r10_bio->devs[k].devnum == i)
1803 break; 1803 break;
1804 BUG_ON(k == conf->copies);
1804 bio = r10_bio->devs[1].bio; 1805 bio = r10_bio->devs[1].bio;
1805 bio->bi_next = biolist; 1806 bio->bi_next = biolist;
1806 biolist = bio; 1807 biolist = bio;
@@ -2021,19 +2022,30 @@ static int run(mddev_t *mddev)
2021 if (!conf->tmppage) 2022 if (!conf->tmppage)
2022 goto out_free_conf; 2023 goto out_free_conf;
2023 2024
2025 conf->mddev = mddev;
2026 conf->raid_disks = mddev->raid_disks;
2024 conf->near_copies = nc; 2027 conf->near_copies = nc;
2025 conf->far_copies = fc; 2028 conf->far_copies = fc;
2026 conf->copies = nc*fc; 2029 conf->copies = nc*fc;
2027 conf->far_offset = fo; 2030 conf->far_offset = fo;
2028 conf->chunk_mask = (sector_t)(mddev->chunk_size>>9)-1; 2031 conf->chunk_mask = (sector_t)(mddev->chunk_size>>9)-1;
2029 conf->chunk_shift = ffz(~mddev->chunk_size) - 9; 2032 conf->chunk_shift = ffz(~mddev->chunk_size) - 9;
2033 size = mddev->size >> (conf->chunk_shift-1);
2034 sector_div(size, fc);
2035 size = size * conf->raid_disks;
2036 sector_div(size, nc);
2037 /* 'size' is now the number of chunks in the array */
2038 /* calculate "used chunks per device" in 'stride' */
2039 stride = size * conf->copies;
2040 sector_div(stride, conf->raid_disks);
2041 mddev->size = stride << (conf->chunk_shift-1);
2042
2030 if (fo) 2043 if (fo)
2031 conf->stride = 1 << conf->chunk_shift; 2044 stride = 1;
2032 else { 2045 else
2033 stride = mddev->size >> (conf->chunk_shift-1);
2034 sector_div(stride, fc); 2046 sector_div(stride, fc);
2035 conf->stride = stride << conf->chunk_shift; 2047 conf->stride = stride << conf->chunk_shift;
2036 } 2048
2037 conf->r10bio_pool = mempool_create(NR_RAID10_BIOS, r10bio_pool_alloc, 2049 conf->r10bio_pool = mempool_create(NR_RAID10_BIOS, r10bio_pool_alloc,
2038 r10bio_pool_free, conf); 2050 r10bio_pool_free, conf);
2039 if (!conf->r10bio_pool) { 2051 if (!conf->r10bio_pool) {
@@ -2063,8 +2075,6 @@ static int run(mddev_t *mddev)
2063 2075
2064 disk->head_position = 0; 2076 disk->head_position = 0;
2065 } 2077 }
2066 conf->raid_disks = mddev->raid_disks;
2067 conf->mddev = mddev;
2068 spin_lock_init(&conf->device_lock); 2078 spin_lock_init(&conf->device_lock);
2069 INIT_LIST_HEAD(&conf->retry_list); 2079 INIT_LIST_HEAD(&conf->retry_list);
2070 2080
@@ -2106,16 +2116,8 @@ static int run(mddev_t *mddev)
2106 /* 2116 /*
2107 * Ok, everything is just fine now 2117 * Ok, everything is just fine now
2108 */ 2118 */
2109 if (conf->far_offset) { 2119 mddev->array_size = size << (conf->chunk_shift-1);
2110 size = mddev->size >> (conf->chunk_shift-1); 2120 mddev->resync_max_sectors = size << conf->chunk_shift;
2111 size *= conf->raid_disks;
2112 size <<= conf->chunk_shift;
2113 sector_div(size, conf->far_copies);
2114 } else
2115 size = conf->stride * conf->raid_disks;
2116 sector_div(size, conf->near_copies);
2117 mddev->array_size = size/2;
2118 mddev->resync_max_sectors = size;
2119 2121
2120 mddev->queue->unplug_fn = raid10_unplug; 2122 mddev->queue->unplug_fn = raid10_unplug;
2121 mddev->queue->issue_flush_fn = raid10_issue_flush; 2123 mddev->queue->issue_flush_fn = raid10_issue_flush;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 11c3d7bfa797..d247429ee5ef 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1050,7 +1050,7 @@ static void compute_parity5(struct stripe_head *sh, int method)
1050static void compute_parity6(struct stripe_head *sh, int method) 1050static void compute_parity6(struct stripe_head *sh, int method)
1051{ 1051{
1052 raid6_conf_t *conf = sh->raid_conf; 1052 raid6_conf_t *conf = sh->raid_conf;
1053 int i, pd_idx = sh->pd_idx, qd_idx, d0_idx, disks = conf->raid_disks, count; 1053 int i, pd_idx = sh->pd_idx, qd_idx, d0_idx, disks = sh->disks, count;
1054 struct bio *chosen; 1054 struct bio *chosen;
1055 /**** FIX THIS: This could be very bad if disks is close to 256 ****/ 1055 /**** FIX THIS: This could be very bad if disks is close to 256 ****/
1056 void *ptrs[disks]; 1056 void *ptrs[disks];
@@ -1131,8 +1131,7 @@ static void compute_parity6(struct stripe_head *sh, int method)
1131/* Compute one missing block */ 1131/* Compute one missing block */
1132static void compute_block_1(struct stripe_head *sh, int dd_idx, int nozero) 1132static void compute_block_1(struct stripe_head *sh, int dd_idx, int nozero)
1133{ 1133{
1134 raid6_conf_t *conf = sh->raid_conf; 1134 int i, count, disks = sh->disks;
1135 int i, count, disks = conf->raid_disks;
1136 void *ptr[MAX_XOR_BLOCKS], *p; 1135 void *ptr[MAX_XOR_BLOCKS], *p;
1137 int pd_idx = sh->pd_idx; 1136 int pd_idx = sh->pd_idx;
1138 int qd_idx = raid6_next_disk(pd_idx, disks); 1137 int qd_idx = raid6_next_disk(pd_idx, disks);
@@ -1170,8 +1169,7 @@ static void compute_block_1(struct stripe_head *sh, int dd_idx, int nozero)
1170/* Compute two missing blocks */ 1169/* Compute two missing blocks */
1171static void compute_block_2(struct stripe_head *sh, int dd_idx1, int dd_idx2) 1170static void compute_block_2(struct stripe_head *sh, int dd_idx1, int dd_idx2)
1172{ 1171{
1173 raid6_conf_t *conf = sh->raid_conf; 1172 int i, count, disks = sh->disks;
1174 int i, count, disks = conf->raid_disks;
1175 int pd_idx = sh->pd_idx; 1173 int pd_idx = sh->pd_idx;
1176 int qd_idx = raid6_next_disk(pd_idx, disks); 1174 int qd_idx = raid6_next_disk(pd_idx, disks);
1177 int d0_idx = raid6_next_disk(qd_idx, disks); 1175 int d0_idx = raid6_next_disk(qd_idx, disks);
@@ -1887,11 +1885,11 @@ static void handle_stripe5(struct stripe_head *sh)
1887static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page) 1885static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
1888{ 1886{
1889 raid6_conf_t *conf = sh->raid_conf; 1887 raid6_conf_t *conf = sh->raid_conf;
1890 int disks = conf->raid_disks; 1888 int disks = sh->disks;
1891 struct bio *return_bi= NULL; 1889 struct bio *return_bi= NULL;
1892 struct bio *bi; 1890 struct bio *bi;
1893 int i; 1891 int i;
1894 int syncing; 1892 int syncing, expanding, expanded;
1895 int locked=0, uptodate=0, to_read=0, to_write=0, failed=0, written=0; 1893 int locked=0, uptodate=0, to_read=0, to_write=0, failed=0, written=0;
1896 int non_overwrite = 0; 1894 int non_overwrite = 0;
1897 int failed_num[2] = {0, 0}; 1895 int failed_num[2] = {0, 0};
@@ -1909,6 +1907,8 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
1909 clear_bit(STRIPE_DELAYED, &sh->state); 1907 clear_bit(STRIPE_DELAYED, &sh->state);
1910 1908
1911 syncing = test_bit(STRIPE_SYNCING, &sh->state); 1909 syncing = test_bit(STRIPE_SYNCING, &sh->state);
1910 expanding = test_bit(STRIPE_EXPAND_SOURCE, &sh->state);
1911 expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);
1912 /* Now to look around and see what can be done */ 1912 /* Now to look around and see what can be done */
1913 1913
1914 rcu_read_lock(); 1914 rcu_read_lock();
@@ -2114,13 +2114,15 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
2114 * parity, or to satisfy requests 2114 * parity, or to satisfy requests
2115 * or to load a block that is being partially written. 2115 * or to load a block that is being partially written.
2116 */ 2116 */
2117 if (to_read || non_overwrite || (to_write && failed) || (syncing && (uptodate < disks))) { 2117 if (to_read || non_overwrite || (to_write && failed) ||
2118 (syncing && (uptodate < disks)) || expanding) {
2118 for (i=disks; i--;) { 2119 for (i=disks; i--;) {
2119 dev = &sh->dev[i]; 2120 dev = &sh->dev[i];
2120 if (!test_bit(R5_LOCKED, &dev->flags) && !test_bit(R5_UPTODATE, &dev->flags) && 2121 if (!test_bit(R5_LOCKED, &dev->flags) && !test_bit(R5_UPTODATE, &dev->flags) &&
2121 (dev->toread || 2122 (dev->toread ||
2122 (dev->towrite && !test_bit(R5_OVERWRITE, &dev->flags)) || 2123 (dev->towrite && !test_bit(R5_OVERWRITE, &dev->flags)) ||
2123 syncing || 2124 syncing ||
2125 expanding ||
2124 (failed >= 1 && (sh->dev[failed_num[0]].toread || to_write)) || 2126 (failed >= 1 && (sh->dev[failed_num[0]].toread || to_write)) ||
2125 (failed >= 2 && (sh->dev[failed_num[1]].toread || to_write)) 2127 (failed >= 2 && (sh->dev[failed_num[1]].toread || to_write))
2126 ) 2128 )
@@ -2355,6 +2357,79 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
2355 } 2357 }
2356 } 2358 }
2357 } 2359 }
2360
2361 if (expanded && test_bit(STRIPE_EXPANDING, &sh->state)) {
2362 /* Need to write out all blocks after computing P&Q */
2363 sh->disks = conf->raid_disks;
2364 sh->pd_idx = stripe_to_pdidx(sh->sector, conf,
2365 conf->raid_disks);
2366 compute_parity6(sh, RECONSTRUCT_WRITE);
2367 for (i = conf->raid_disks ; i-- ; ) {
2368 set_bit(R5_LOCKED, &sh->dev[i].flags);
2369 locked++;
2370 set_bit(R5_Wantwrite, &sh->dev[i].flags);
2371 }
2372 clear_bit(STRIPE_EXPANDING, &sh->state);
2373 } else if (expanded) {
2374 clear_bit(STRIPE_EXPAND_READY, &sh->state);
2375 atomic_dec(&conf->reshape_stripes);
2376 wake_up(&conf->wait_for_overlap);
2377 md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
2378 }
2379
2380 if (expanding && locked == 0) {
2381 /* We have read all the blocks in this stripe and now we need to
2382 * copy some of them into a target stripe for expand.
2383 */
2384 clear_bit(STRIPE_EXPAND_SOURCE, &sh->state);
2385 for (i = 0; i < sh->disks ; i++)
2386 if (i != pd_idx && i != qd_idx) {
2387 int dd_idx2, pd_idx2, j;
2388 struct stripe_head *sh2;
2389
2390 sector_t bn = compute_blocknr(sh, i);
2391 sector_t s = raid5_compute_sector(
2392 bn, conf->raid_disks,
2393 conf->raid_disks - conf->max_degraded,
2394 &dd_idx2, &pd_idx2, conf);
2395 sh2 = get_active_stripe(conf, s,
2396 conf->raid_disks,
2397 pd_idx2, 1);
2398 if (sh2 == NULL)
2399 /* so for only the early blocks of
2400 * this stripe have been requests.
2401 * When later blocks get requests, we
2402 * will try again
2403 */
2404 continue;
2405 if (!test_bit(STRIPE_EXPANDING, &sh2->state) ||
2406 test_bit(R5_Expanded,
2407 &sh2->dev[dd_idx2].flags)) {
2408 /* must have already done this block */
2409 release_stripe(sh2);
2410 continue;
2411 }
2412 memcpy(page_address(sh2->dev[dd_idx2].page),
2413 page_address(sh->dev[i].page),
2414 STRIPE_SIZE);
2415 set_bit(R5_Expanded, &sh2->dev[dd_idx2].flags);
2416 set_bit(R5_UPTODATE, &sh2->dev[dd_idx2].flags);
2417 for (j = 0 ; j < conf->raid_disks ; j++)
2418 if (j != sh2->pd_idx &&
2419 j != raid6_next_disk(sh2->pd_idx,
2420 sh2->disks) &&
2421 !test_bit(R5_Expanded,
2422 &sh2->dev[j].flags))
2423 break;
2424 if (j == conf->raid_disks) {
2425 set_bit(STRIPE_EXPAND_READY,
2426 &sh2->state);
2427 set_bit(STRIPE_HANDLE, &sh2->state);
2428 }
2429 release_stripe(sh2);
2430 }
2431 }
2432
2358 spin_unlock(&sh->lock); 2433 spin_unlock(&sh->lock);
2359 2434
2360 while ((bi=return_bi)) { 2435 while ((bi=return_bi)) {
@@ -2395,7 +2470,7 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
2395 rcu_read_unlock(); 2470 rcu_read_unlock();
2396 2471
2397 if (rdev) { 2472 if (rdev) {
2398 if (syncing) 2473 if (syncing || expanding || expanded)
2399 md_sync_acct(rdev->bdev, STRIPE_SECTORS); 2474 md_sync_acct(rdev->bdev, STRIPE_SECTORS);
2400 2475
2401 bi->bi_bdev = rdev->bdev; 2476 bi->bi_bdev = rdev->bdev;
@@ -2915,8 +2990,9 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
2915 struct stripe_head *sh; 2990 struct stripe_head *sh;
2916 int pd_idx; 2991 int pd_idx;
2917 sector_t first_sector, last_sector; 2992 sector_t first_sector, last_sector;
2918 int raid_disks; 2993 int raid_disks = conf->previous_raid_disks;
2919 int data_disks; 2994 int data_disks = raid_disks - conf->max_degraded;
2995 int new_data_disks = conf->raid_disks - conf->max_degraded;
2920 int i; 2996 int i;
2921 int dd_idx; 2997 int dd_idx;
2922 sector_t writepos, safepos, gap; 2998 sector_t writepos, safepos, gap;
@@ -2925,7 +3001,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
2925 conf->expand_progress != 0) { 3001 conf->expand_progress != 0) {
2926 /* restarting in the middle, skip the initial sectors */ 3002 /* restarting in the middle, skip the initial sectors */
2927 sector_nr = conf->expand_progress; 3003 sector_nr = conf->expand_progress;
2928 sector_div(sector_nr, conf->raid_disks-1); 3004 sector_div(sector_nr, new_data_disks);
2929 *skipped = 1; 3005 *skipped = 1;
2930 return sector_nr; 3006 return sector_nr;
2931 } 3007 }
@@ -2939,14 +3015,14 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
2939 * to after where expand_lo old_maps to 3015 * to after where expand_lo old_maps to
2940 */ 3016 */
2941 writepos = conf->expand_progress + 3017 writepos = conf->expand_progress +
2942 conf->chunk_size/512*(conf->raid_disks-1); 3018 conf->chunk_size/512*(new_data_disks);
2943 sector_div(writepos, conf->raid_disks-1); 3019 sector_div(writepos, new_data_disks);
2944 safepos = conf->expand_lo; 3020 safepos = conf->expand_lo;
2945 sector_div(safepos, conf->previous_raid_disks-1); 3021 sector_div(safepos, data_disks);
2946 gap = conf->expand_progress - conf->expand_lo; 3022 gap = conf->expand_progress - conf->expand_lo;
2947 3023
2948 if (writepos >= safepos || 3024 if (writepos >= safepos ||
2949 gap > (conf->raid_disks-1)*3000*2 /*3Meg*/) { 3025 gap > (new_data_disks)*3000*2 /*3Meg*/) {
2950 /* Cannot proceed until we've updated the superblock... */ 3026 /* Cannot proceed until we've updated the superblock... */
2951 wait_event(conf->wait_for_overlap, 3027 wait_event(conf->wait_for_overlap,
2952 atomic_read(&conf->reshape_stripes)==0); 3028 atomic_read(&conf->reshape_stripes)==0);
@@ -2976,6 +3052,9 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
2976 sector_t s; 3052 sector_t s;
2977 if (j == sh->pd_idx) 3053 if (j == sh->pd_idx)
2978 continue; 3054 continue;
3055 if (conf->level == 6 &&
3056 j == raid6_next_disk(sh->pd_idx, sh->disks))
3057 continue;
2979 s = compute_blocknr(sh, j); 3058 s = compute_blocknr(sh, j);
2980 if (s < (mddev->array_size<<1)) { 3059 if (s < (mddev->array_size<<1)) {
2981 skipped = 1; 3060 skipped = 1;
@@ -2999,21 +3078,20 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
2999 * The source stripes are determined by mapping the first and last 3078 * The source stripes are determined by mapping the first and last
3000 * block on the destination stripes. 3079 * block on the destination stripes.
3001 */ 3080 */
3002 raid_disks = conf->previous_raid_disks;
3003 data_disks = raid_disks - 1;
3004 first_sector = 3081 first_sector =
3005 raid5_compute_sector(sector_nr*(conf->raid_disks-1), 3082 raid5_compute_sector(sector_nr*(new_data_disks),
3006 raid_disks, data_disks, 3083 raid_disks, data_disks,
3007 &dd_idx, &pd_idx, conf); 3084 &dd_idx, &pd_idx, conf);
3008 last_sector = 3085 last_sector =
3009 raid5_compute_sector((sector_nr+conf->chunk_size/512) 3086 raid5_compute_sector((sector_nr+conf->chunk_size/512)
3010 *(conf->raid_disks-1) -1, 3087 *(new_data_disks) -1,
3011 raid_disks, data_disks, 3088 raid_disks, data_disks,
3012 &dd_idx, &pd_idx, conf); 3089 &dd_idx, &pd_idx, conf);
3013 if (last_sector >= (mddev->size<<1)) 3090 if (last_sector >= (mddev->size<<1))
3014 last_sector = (mddev->size<<1)-1; 3091 last_sector = (mddev->size<<1)-1;
3015 while (first_sector <= last_sector) { 3092 while (first_sector <= last_sector) {
3016 pd_idx = stripe_to_pdidx(first_sector, conf, conf->previous_raid_disks); 3093 pd_idx = stripe_to_pdidx(first_sector, conf,
3094 conf->previous_raid_disks);
3017 sh = get_active_stripe(conf, first_sector, 3095 sh = get_active_stripe(conf, first_sector,
3018 conf->previous_raid_disks, pd_idx, 0); 3096 conf->previous_raid_disks, pd_idx, 0);
3019 set_bit(STRIPE_EXPAND_SOURCE, &sh->state); 3097 set_bit(STRIPE_EXPAND_SOURCE, &sh->state);
@@ -3348,35 +3426,44 @@ static int run(mddev_t *mddev)
3348 */ 3426 */
3349 sector_t here_new, here_old; 3427 sector_t here_new, here_old;
3350 int old_disks; 3428 int old_disks;
3429 int max_degraded = (mddev->level == 5 ? 1 : 2);
3351 3430
3352 if (mddev->new_level != mddev->level || 3431 if (mddev->new_level != mddev->level ||
3353 mddev->new_layout != mddev->layout || 3432 mddev->new_layout != mddev->layout ||
3354 mddev->new_chunk != mddev->chunk_size) { 3433 mddev->new_chunk != mddev->chunk_size) {
3355 printk(KERN_ERR "raid5: %s: unsupported reshape required - aborting.\n", 3434 printk(KERN_ERR "raid5: %s: unsupported reshape "
3435 "required - aborting.\n",
3356 mdname(mddev)); 3436 mdname(mddev));
3357 return -EINVAL; 3437 return -EINVAL;
3358 } 3438 }
3359 if (mddev->delta_disks <= 0) { 3439 if (mddev->delta_disks <= 0) {
3360 printk(KERN_ERR "raid5: %s: unsupported reshape (reduce disks) required - aborting.\n", 3440 printk(KERN_ERR "raid5: %s: unsupported reshape "
3441 "(reduce disks) required - aborting.\n",
3361 mdname(mddev)); 3442 mdname(mddev));
3362 return -EINVAL; 3443 return -EINVAL;
3363 } 3444 }
3364 old_disks = mddev->raid_disks - mddev->delta_disks; 3445 old_disks = mddev->raid_disks - mddev->delta_disks;
3365 /* reshape_position must be on a new-stripe boundary, and one 3446 /* reshape_position must be on a new-stripe boundary, and one
3366 * further up in new geometry must map after here in old geometry. 3447 * further up in new geometry must map after here in old
3448 * geometry.
3367 */ 3449 */
3368 here_new = mddev->reshape_position; 3450 here_new = mddev->reshape_position;
3369 if (sector_div(here_new, (mddev->chunk_size>>9)*(mddev->raid_disks-1))) { 3451 if (sector_div(here_new, (mddev->chunk_size>>9)*
3370 printk(KERN_ERR "raid5: reshape_position not on a stripe boundary\n"); 3452 (mddev->raid_disks - max_degraded))) {
3453 printk(KERN_ERR "raid5: reshape_position not "
3454 "on a stripe boundary\n");
3371 return -EINVAL; 3455 return -EINVAL;
3372 } 3456 }
3373 /* here_new is the stripe we will write to */ 3457 /* here_new is the stripe we will write to */
3374 here_old = mddev->reshape_position; 3458 here_old = mddev->reshape_position;
3375 sector_div(here_old, (mddev->chunk_size>>9)*(old_disks-1)); 3459 sector_div(here_old, (mddev->chunk_size>>9)*
3376 /* here_old is the first stripe that we might need to read from */ 3460 (old_disks-max_degraded));
3461 /* here_old is the first stripe that we might need to read
3462 * from */
3377 if (here_new >= here_old) { 3463 if (here_new >= here_old) {
3378 /* Reading from the same stripe as writing to - bad */ 3464 /* Reading from the same stripe as writing to - bad */
3379 printk(KERN_ERR "raid5: reshape_position too early for auto-recovery - aborting.\n"); 3465 printk(KERN_ERR "raid5: reshape_position too early for "
3466 "auto-recovery - aborting.\n");
3380 return -EINVAL; 3467 return -EINVAL;
3381 } 3468 }
3382 printk(KERN_INFO "raid5: reshape will continue\n"); 3469 printk(KERN_INFO "raid5: reshape will continue\n");
@@ -3814,6 +3901,8 @@ static int raid5_check_reshape(mddev_t *mddev)
3814 if (err) 3901 if (err)
3815 return err; 3902 return err;
3816 3903
3904 if (mddev->degraded > conf->max_degraded)
3905 return -EINVAL;
3817 /* looks like we might be able to manage this */ 3906 /* looks like we might be able to manage this */
3818 return 0; 3907 return 0;
3819} 3908}
@@ -3827,8 +3916,7 @@ static int raid5_start_reshape(mddev_t *mddev)
3827 int added_devices = 0; 3916 int added_devices = 0;
3828 unsigned long flags; 3917 unsigned long flags;
3829 3918
3830 if (mddev->degraded || 3919 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
3831 test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
3832 return -EBUSY; 3920 return -EBUSY;
3833 3921
3834 ITERATE_RDEV(mddev, rdev, rtmp) 3922 ITERATE_RDEV(mddev, rdev, rtmp)
@@ -3836,7 +3924,7 @@ static int raid5_start_reshape(mddev_t *mddev)
3836 !test_bit(Faulty, &rdev->flags)) 3924 !test_bit(Faulty, &rdev->flags))
3837 spares++; 3925 spares++;
3838 3926
3839 if (spares < mddev->delta_disks-1) 3927 if (spares - mddev->degraded < mddev->delta_disks - conf->max_degraded)
3840 /* Not enough devices even to make a degraded array 3928 /* Not enough devices even to make a degraded array
3841 * of that size 3929 * of that size
3842 */ 3930 */
@@ -3899,7 +3987,8 @@ static void end_reshape(raid5_conf_t *conf)
3899 struct block_device *bdev; 3987 struct block_device *bdev;
3900 3988
3901 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) { 3989 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) {
3902 conf->mddev->array_size = conf->mddev->size * (conf->raid_disks-1); 3990 conf->mddev->array_size = conf->mddev->size *
3991 (conf->raid_disks - conf->max_degraded);
3903 set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1); 3992 set_capacity(conf->mddev->gendisk, conf->mddev->array_size << 1);
3904 conf->mddev->changed = 1; 3993 conf->mddev->changed = 1;
3905 3994
@@ -3972,6 +4061,10 @@ static struct mdk_personality raid6_personality =
3972 .spare_active = raid5_spare_active, 4061 .spare_active = raid5_spare_active,
3973 .sync_request = sync_request, 4062 .sync_request = sync_request,
3974 .resize = raid5_resize, 4063 .resize = raid5_resize,
4064#ifdef CONFIG_MD_RAID5_RESHAPE
4065 .check_reshape = raid5_check_reshape,
4066 .start_reshape = raid5_start_reshape,
4067#endif
3975 .quiesce = raid5_quiesce, 4068 .quiesce = raid5_quiesce,
3976}; 4069};
3977static struct mdk_personality raid5_personality = 4070static struct mdk_personality raid5_personality =
diff --git a/drivers/md/raid6mmx.c b/drivers/md/raid6mmx.c
index 359157aaf9e0..6181a5a3365a 100644
--- a/drivers/md/raid6mmx.c
+++ b/drivers/md/raid6mmx.c
@@ -30,14 +30,8 @@ const struct raid6_mmx_constants {
30 30
31static int raid6_have_mmx(void) 31static int raid6_have_mmx(void)
32{ 32{
33#ifdef __KERNEL__
34 /* Not really "boot_cpu" but "all_cpus" */ 33 /* Not really "boot_cpu" but "all_cpus" */
35 return boot_cpu_has(X86_FEATURE_MMX); 34 return boot_cpu_has(X86_FEATURE_MMX);
36#else
37 /* User space test code */
38 u32 features = cpuid_features();
39 return ( (features & (1<<23)) == (1<<23) );
40#endif
41} 35}
42 36
43/* 37/*
@@ -48,13 +42,12 @@ static void raid6_mmx1_gen_syndrome(int disks, size_t bytes, void **ptrs)
48 u8 **dptr = (u8 **)ptrs; 42 u8 **dptr = (u8 **)ptrs;
49 u8 *p, *q; 43 u8 *p, *q;
50 int d, z, z0; 44 int d, z, z0;
51 raid6_mmx_save_t sa;
52 45
53 z0 = disks - 3; /* Highest data disk */ 46 z0 = disks - 3; /* Highest data disk */
54 p = dptr[z0+1]; /* XOR parity */ 47 p = dptr[z0+1]; /* XOR parity */
55 q = dptr[z0+2]; /* RS syndrome */ 48 q = dptr[z0+2]; /* RS syndrome */
56 49
57 raid6_before_mmx(&sa); 50 kernel_fpu_begin();
58 51
59 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d)); 52 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d));
60 asm volatile("pxor %mm5,%mm5"); /* Zero temp */ 53 asm volatile("pxor %mm5,%mm5"); /* Zero temp */
@@ -78,7 +71,7 @@ static void raid6_mmx1_gen_syndrome(int disks, size_t bytes, void **ptrs)
78 asm volatile("pxor %mm4,%mm4"); 71 asm volatile("pxor %mm4,%mm4");
79 } 72 }
80 73
81 raid6_after_mmx(&sa); 74 kernel_fpu_end();
82} 75}
83 76
84const struct raid6_calls raid6_mmxx1 = { 77const struct raid6_calls raid6_mmxx1 = {
@@ -96,13 +89,12 @@ static void raid6_mmx2_gen_syndrome(int disks, size_t bytes, void **ptrs)
96 u8 **dptr = (u8 **)ptrs; 89 u8 **dptr = (u8 **)ptrs;
97 u8 *p, *q; 90 u8 *p, *q;
98 int d, z, z0; 91 int d, z, z0;
99 raid6_mmx_save_t sa;
100 92
101 z0 = disks - 3; /* Highest data disk */ 93 z0 = disks - 3; /* Highest data disk */
102 p = dptr[z0+1]; /* XOR parity */ 94 p = dptr[z0+1]; /* XOR parity */
103 q = dptr[z0+2]; /* RS syndrome */ 95 q = dptr[z0+2]; /* RS syndrome */
104 96
105 raid6_before_mmx(&sa); 97 kernel_fpu_begin();
106 98
107 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d)); 99 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d));
108 asm volatile("pxor %mm5,%mm5"); /* Zero temp */ 100 asm volatile("pxor %mm5,%mm5"); /* Zero temp */
@@ -137,7 +129,7 @@ static void raid6_mmx2_gen_syndrome(int disks, size_t bytes, void **ptrs)
137 asm volatile("movq %%mm6,%0" : "=m" (q[d+8])); 129 asm volatile("movq %%mm6,%0" : "=m" (q[d+8]));
138 } 130 }
139 131
140 raid6_after_mmx(&sa); 132 kernel_fpu_end();
141} 133}
142 134
143const struct raid6_calls raid6_mmxx2 = { 135const struct raid6_calls raid6_mmxx2 = {
diff --git a/drivers/md/raid6sse1.c b/drivers/md/raid6sse1.c
index f7e7859f71aa..f0a1ba8f40ba 100644
--- a/drivers/md/raid6sse1.c
+++ b/drivers/md/raid6sse1.c
@@ -33,16 +33,10 @@ extern const struct raid6_mmx_constants {
33 33
34static int raid6_have_sse1_or_mmxext(void) 34static int raid6_have_sse1_or_mmxext(void)
35{ 35{
36#ifdef __KERNEL__
37 /* Not really boot_cpu but "all_cpus" */ 36 /* Not really boot_cpu but "all_cpus" */
38 return boot_cpu_has(X86_FEATURE_MMX) && 37 return boot_cpu_has(X86_FEATURE_MMX) &&
39 (boot_cpu_has(X86_FEATURE_XMM) || 38 (boot_cpu_has(X86_FEATURE_XMM) ||
40 boot_cpu_has(X86_FEATURE_MMXEXT)); 39 boot_cpu_has(X86_FEATURE_MMXEXT));
41#else
42 /* User space test code - this incorrectly breaks on some Athlons */
43 u32 features = cpuid_features();
44 return ( (features & (5<<23)) == (5<<23) );
45#endif
46} 40}
47 41
48/* 42/*
@@ -53,14 +47,12 @@ static void raid6_sse11_gen_syndrome(int disks, size_t bytes, void **ptrs)
53 u8 **dptr = (u8 **)ptrs; 47 u8 **dptr = (u8 **)ptrs;
54 u8 *p, *q; 48 u8 *p, *q;
55 int d, z, z0; 49 int d, z, z0;
56 raid6_mmx_save_t sa;
57 50
58 z0 = disks - 3; /* Highest data disk */ 51 z0 = disks - 3; /* Highest data disk */
59 p = dptr[z0+1]; /* XOR parity */ 52 p = dptr[z0+1]; /* XOR parity */
60 q = dptr[z0+2]; /* RS syndrome */ 53 q = dptr[z0+2]; /* RS syndrome */
61 54
62 /* This is really MMX code, not SSE */ 55 kernel_fpu_begin();
63 raid6_before_mmx(&sa);
64 56
65 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d)); 57 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d));
66 asm volatile("pxor %mm5,%mm5"); /* Zero temp */ 58 asm volatile("pxor %mm5,%mm5"); /* Zero temp */
@@ -94,8 +86,8 @@ static void raid6_sse11_gen_syndrome(int disks, size_t bytes, void **ptrs)
94 asm volatile("movntq %%mm4,%0" : "=m" (q[d])); 86 asm volatile("movntq %%mm4,%0" : "=m" (q[d]));
95 } 87 }
96 88
97 raid6_after_mmx(&sa);
98 asm volatile("sfence" : : : "memory"); 89 asm volatile("sfence" : : : "memory");
90 kernel_fpu_end();
99} 91}
100 92
101const struct raid6_calls raid6_sse1x1 = { 93const struct raid6_calls raid6_sse1x1 = {
@@ -113,13 +105,12 @@ static void raid6_sse12_gen_syndrome(int disks, size_t bytes, void **ptrs)
113 u8 **dptr = (u8 **)ptrs; 105 u8 **dptr = (u8 **)ptrs;
114 u8 *p, *q; 106 u8 *p, *q;
115 int d, z, z0; 107 int d, z, z0;
116 raid6_mmx_save_t sa;
117 108
118 z0 = disks - 3; /* Highest data disk */ 109 z0 = disks - 3; /* Highest data disk */
119 p = dptr[z0+1]; /* XOR parity */ 110 p = dptr[z0+1]; /* XOR parity */
120 q = dptr[z0+2]; /* RS syndrome */ 111 q = dptr[z0+2]; /* RS syndrome */
121 112
122 raid6_before_mmx(&sa); 113 kernel_fpu_begin();
123 114
124 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d)); 115 asm volatile("movq %0,%%mm0" : : "m" (raid6_mmx_constants.x1d));
125 asm volatile("pxor %mm5,%mm5"); /* Zero temp */ 116 asm volatile("pxor %mm5,%mm5"); /* Zero temp */
@@ -157,8 +148,8 @@ static void raid6_sse12_gen_syndrome(int disks, size_t bytes, void **ptrs)
157 asm volatile("movntq %%mm6,%0" : "=m" (q[d+8])); 148 asm volatile("movntq %%mm6,%0" : "=m" (q[d+8]));
158 } 149 }
159 150
160 raid6_after_mmx(&sa);
161 asm volatile("sfence" : :: "memory"); 151 asm volatile("sfence" : :: "memory");
152 kernel_fpu_end();
162} 153}
163 154
164const struct raid6_calls raid6_sse1x2 = { 155const struct raid6_calls raid6_sse1x2 = {
diff --git a/drivers/md/raid6sse2.c b/drivers/md/raid6sse2.c
index b3aa7fe0877e..0f019762a7c3 100644
--- a/drivers/md/raid6sse2.c
+++ b/drivers/md/raid6sse2.c
@@ -30,17 +30,11 @@ static const struct raid6_sse_constants {
30 30
31static int raid6_have_sse2(void) 31static int raid6_have_sse2(void)
32{ 32{
33#ifdef __KERNEL__
34 /* Not really boot_cpu but "all_cpus" */ 33 /* Not really boot_cpu but "all_cpus" */
35 return boot_cpu_has(X86_FEATURE_MMX) && 34 return boot_cpu_has(X86_FEATURE_MMX) &&
36 boot_cpu_has(X86_FEATURE_FXSR) && 35 boot_cpu_has(X86_FEATURE_FXSR) &&
37 boot_cpu_has(X86_FEATURE_XMM) && 36 boot_cpu_has(X86_FEATURE_XMM) &&
38 boot_cpu_has(X86_FEATURE_XMM2); 37 boot_cpu_has(X86_FEATURE_XMM2);
39#else
40 /* User space test code */
41 u32 features = cpuid_features();
42 return ( (features & (15<<23)) == (15<<23) );
43#endif
44} 38}
45 39
46/* 40/*
@@ -51,13 +45,12 @@ static void raid6_sse21_gen_syndrome(int disks, size_t bytes, void **ptrs)
51 u8 **dptr = (u8 **)ptrs; 45 u8 **dptr = (u8 **)ptrs;
52 u8 *p, *q; 46 u8 *p, *q;
53 int d, z, z0; 47 int d, z, z0;
54 raid6_sse_save_t sa;
55 48
56 z0 = disks - 3; /* Highest data disk */ 49 z0 = disks - 3; /* Highest data disk */
57 p = dptr[z0+1]; /* XOR parity */ 50 p = dptr[z0+1]; /* XOR parity */
58 q = dptr[z0+2]; /* RS syndrome */ 51 q = dptr[z0+2]; /* RS syndrome */
59 52
60 raid6_before_sse2(&sa); 53 kernel_fpu_begin();
61 54
62 asm volatile("movdqa %0,%%xmm0" : : "m" (raid6_sse_constants.x1d[0])); 55 asm volatile("movdqa %0,%%xmm0" : : "m" (raid6_sse_constants.x1d[0]));
63 asm volatile("pxor %xmm5,%xmm5"); /* Zero temp */ 56 asm volatile("pxor %xmm5,%xmm5"); /* Zero temp */
@@ -93,8 +86,8 @@ static void raid6_sse21_gen_syndrome(int disks, size_t bytes, void **ptrs)
93 asm volatile("pxor %xmm4,%xmm4"); 86 asm volatile("pxor %xmm4,%xmm4");
94 } 87 }
95 88
96 raid6_after_sse2(&sa);
97 asm volatile("sfence" : : : "memory"); 89 asm volatile("sfence" : : : "memory");
90 kernel_fpu_end();
98} 91}
99 92
100const struct raid6_calls raid6_sse2x1 = { 93const struct raid6_calls raid6_sse2x1 = {
@@ -112,13 +105,12 @@ static void raid6_sse22_gen_syndrome(int disks, size_t bytes, void **ptrs)
112 u8 **dptr = (u8 **)ptrs; 105 u8 **dptr = (u8 **)ptrs;
113 u8 *p, *q; 106 u8 *p, *q;
114 int d, z, z0; 107 int d, z, z0;
115 raid6_sse_save_t sa;
116 108
117 z0 = disks - 3; /* Highest data disk */ 109 z0 = disks - 3; /* Highest data disk */
118 p = dptr[z0+1]; /* XOR parity */ 110 p = dptr[z0+1]; /* XOR parity */
119 q = dptr[z0+2]; /* RS syndrome */ 111 q = dptr[z0+2]; /* RS syndrome */
120 112
121 raid6_before_sse2(&sa); 113 kernel_fpu_begin();
122 114
123 asm volatile("movdqa %0,%%xmm0" : : "m" (raid6_sse_constants.x1d[0])); 115 asm volatile("movdqa %0,%%xmm0" : : "m" (raid6_sse_constants.x1d[0]));
124 asm volatile("pxor %xmm5,%xmm5"); /* Zero temp */ 116 asm volatile("pxor %xmm5,%xmm5"); /* Zero temp */
@@ -156,8 +148,8 @@ static void raid6_sse22_gen_syndrome(int disks, size_t bytes, void **ptrs)
156 asm volatile("movntdq %%xmm6,%0" : "=m" (q[d+16])); 148 asm volatile("movntdq %%xmm6,%0" : "=m" (q[d+16]));
157 } 149 }
158 150
159 raid6_after_sse2(&sa);
160 asm volatile("sfence" : : : "memory"); 151 asm volatile("sfence" : : : "memory");
152 kernel_fpu_end();
161} 153}
162 154
163const struct raid6_calls raid6_sse2x2 = { 155const struct raid6_calls raid6_sse2x2 = {
@@ -179,13 +171,12 @@ static void raid6_sse24_gen_syndrome(int disks, size_t bytes, void **ptrs)
179 u8 **dptr = (u8 **)ptrs; 171 u8 **dptr = (u8 **)ptrs;
180 u8 *p, *q; 172 u8 *p, *q;
181 int d, z, z0; 173 int d, z, z0;
182 raid6_sse16_save_t sa;
183 174
184 z0 = disks - 3; /* Highest data disk */ 175 z0 = disks - 3; /* Highest data disk */
185 p = dptr[z0+1]; /* XOR parity */ 176 p = dptr[z0+1]; /* XOR parity */
186 q = dptr[z0+2]; /* RS syndrome */ 177 q = dptr[z0+2]; /* RS syndrome */
187 178
188 raid6_before_sse16(&sa); 179 kernel_fpu_begin();
189 180
190 asm volatile("movdqa %0,%%xmm0" :: "m" (raid6_sse_constants.x1d[0])); 181 asm volatile("movdqa %0,%%xmm0" :: "m" (raid6_sse_constants.x1d[0]));
191 asm volatile("pxor %xmm2,%xmm2"); /* P[0] */ 182 asm volatile("pxor %xmm2,%xmm2"); /* P[0] */
@@ -256,8 +247,9 @@ static void raid6_sse24_gen_syndrome(int disks, size_t bytes, void **ptrs)
256 asm volatile("movntdq %%xmm14,%0" : "=m" (q[d+48])); 247 asm volatile("movntdq %%xmm14,%0" : "=m" (q[d+48]));
257 asm volatile("pxor %xmm14,%xmm14"); 248 asm volatile("pxor %xmm14,%xmm14");
258 } 249 }
250
259 asm volatile("sfence" : : : "memory"); 251 asm volatile("sfence" : : : "memory");
260 raid6_after_sse16(&sa); 252 kernel_fpu_end();
261} 253}
262 254
263const struct raid6_calls raid6_sse2x4 = { 255const struct raid6_calls raid6_sse2x4 = {
diff --git a/drivers/md/raid6x86.h b/drivers/md/raid6x86.h
index 4cf20534fe44..9111950414ff 100644
--- a/drivers/md/raid6x86.h
+++ b/drivers/md/raid6x86.h
@@ -21,224 +21,40 @@
21 21
22#if defined(__i386__) || defined(__x86_64__) 22#if defined(__i386__) || defined(__x86_64__)
23 23
24#ifdef __x86_64__
25
26typedef struct {
27 unsigned int fsave[27];
28 unsigned long cr0;
29} raid6_mmx_save_t __attribute__((aligned(16)));
30
31/* N.B.: For SSE we only save %xmm0-%xmm7 even for x86-64, since
32 the code doesn't know about the additional x86-64 registers */
33typedef struct {
34 unsigned int sarea[8*4+2];
35 unsigned long cr0;
36} raid6_sse_save_t __attribute__((aligned(16)));
37
38/* This is for x86-64-specific code which uses all 16 XMM registers */
39typedef struct {
40 unsigned int sarea[16*4+2];
41 unsigned long cr0;
42} raid6_sse16_save_t __attribute__((aligned(16)));
43
44/* On x86-64 the stack *SHOULD* be 16-byte aligned, but currently this
45 is buggy in the kernel and it's only 8-byte aligned in places, so
46 we need to do this anyway. Sigh. */
47#define SAREA(x) ((unsigned int *)((((unsigned long)&(x)->sarea)+15) & ~15))
48
49#else /* __i386__ */
50
51typedef struct {
52 unsigned int fsave[27];
53 unsigned long cr0;
54} raid6_mmx_save_t;
55
56/* On i386, the stack is only 8-byte aligned, but SSE requires 16-byte
57 alignment. The +3 is so we have the slack space to manually align
58 a properly-sized area correctly. */
59typedef struct {
60 unsigned int sarea[8*4+3];
61 unsigned long cr0;
62} raid6_sse_save_t;
63
64/* Find the 16-byte aligned save area */
65#define SAREA(x) ((unsigned int *)((((unsigned long)&(x)->sarea)+15) & ~15))
66
67#endif
68
69#ifdef __KERNEL__ /* Real code */ 24#ifdef __KERNEL__ /* Real code */
70 25
71/* Note: %cr0 is 32 bits on i386 and 64 bits on x86-64 */ 26#include <asm/i387.h>
72
73static inline unsigned long raid6_get_fpu(void)
74{
75 unsigned long cr0;
76
77 preempt_disable();
78 asm volatile("mov %%cr0,%0 ; clts" : "=r" (cr0));
79 return cr0;
80}
81
82static inline void raid6_put_fpu(unsigned long cr0)
83{
84 asm volatile("mov %0,%%cr0" : : "r" (cr0));
85 preempt_enable();
86}
87 27
88#else /* Dummy code for user space testing */ 28#else /* Dummy code for user space testing */
89 29
90static inline unsigned long raid6_get_fpu(void) 30static inline void kernel_fpu_begin(void)
91{
92 return 0xf00ba6;
93}
94
95static inline void raid6_put_fpu(unsigned long cr0)
96{
97 (void)cr0;
98}
99
100#endif
101
102static inline void raid6_before_mmx(raid6_mmx_save_t *s)
103{
104 s->cr0 = raid6_get_fpu();
105 asm volatile("fsave %0 ; fwait" : "=m" (s->fsave[0]));
106}
107
108static inline void raid6_after_mmx(raid6_mmx_save_t *s)
109{
110 asm volatile("frstor %0" : : "m" (s->fsave[0]));
111 raid6_put_fpu(s->cr0);
112}
113
114static inline void raid6_before_sse(raid6_sse_save_t *s)
115{
116 unsigned int *rsa = SAREA(s);
117
118 s->cr0 = raid6_get_fpu();
119
120 asm volatile("movaps %%xmm0,%0" : "=m" (rsa[0]));
121 asm volatile("movaps %%xmm1,%0" : "=m" (rsa[4]));
122 asm volatile("movaps %%xmm2,%0" : "=m" (rsa[8]));
123 asm volatile("movaps %%xmm3,%0" : "=m" (rsa[12]));
124 asm volatile("movaps %%xmm4,%0" : "=m" (rsa[16]));
125 asm volatile("movaps %%xmm5,%0" : "=m" (rsa[20]));
126 asm volatile("movaps %%xmm6,%0" : "=m" (rsa[24]));
127 asm volatile("movaps %%xmm7,%0" : "=m" (rsa[28]));
128}
129
130static inline void raid6_after_sse(raid6_sse_save_t *s)
131{
132 unsigned int *rsa = SAREA(s);
133
134 asm volatile("movaps %0,%%xmm0" : : "m" (rsa[0]));
135 asm volatile("movaps %0,%%xmm1" : : "m" (rsa[4]));
136 asm volatile("movaps %0,%%xmm2" : : "m" (rsa[8]));
137 asm volatile("movaps %0,%%xmm3" : : "m" (rsa[12]));
138 asm volatile("movaps %0,%%xmm4" : : "m" (rsa[16]));
139 asm volatile("movaps %0,%%xmm5" : : "m" (rsa[20]));
140 asm volatile("movaps %0,%%xmm6" : : "m" (rsa[24]));
141 asm volatile("movaps %0,%%xmm7" : : "m" (rsa[28]));
142
143 raid6_put_fpu(s->cr0);
144}
145
146static inline void raid6_before_sse2(raid6_sse_save_t *s)
147{ 31{
148 unsigned int *rsa = SAREA(s);
149
150 s->cr0 = raid6_get_fpu();
151
152 asm volatile("movdqa %%xmm0,%0" : "=m" (rsa[0]));
153 asm volatile("movdqa %%xmm1,%0" : "=m" (rsa[4]));
154 asm volatile("movdqa %%xmm2,%0" : "=m" (rsa[8]));
155 asm volatile("movdqa %%xmm3,%0" : "=m" (rsa[12]));
156 asm volatile("movdqa %%xmm4,%0" : "=m" (rsa[16]));
157 asm volatile("movdqa %%xmm5,%0" : "=m" (rsa[20]));
158 asm volatile("movdqa %%xmm6,%0" : "=m" (rsa[24]));
159 asm volatile("movdqa %%xmm7,%0" : "=m" (rsa[28]));
160} 32}
161 33
162static inline void raid6_after_sse2(raid6_sse_save_t *s) 34static inline void kernel_fpu_end(void)
163{ 35{
164 unsigned int *rsa = SAREA(s);
165
166 asm volatile("movdqa %0,%%xmm0" : : "m" (rsa[0]));
167 asm volatile("movdqa %0,%%xmm1" : : "m" (rsa[4]));
168 asm volatile("movdqa %0,%%xmm2" : : "m" (rsa[8]));
169 asm volatile("movdqa %0,%%xmm3" : : "m" (rsa[12]));
170 asm volatile("movdqa %0,%%xmm4" : : "m" (rsa[16]));
171 asm volatile("movdqa %0,%%xmm5" : : "m" (rsa[20]));
172 asm volatile("movdqa %0,%%xmm6" : : "m" (rsa[24]));
173 asm volatile("movdqa %0,%%xmm7" : : "m" (rsa[28]));
174
175 raid6_put_fpu(s->cr0);
176} 36}
177 37
178#ifdef __x86_64__ 38#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
179 39#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions
180static inline void raid6_before_sse16(raid6_sse16_save_t *s) 40 * (fast save and restore) */
181{ 41#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */
182 unsigned int *rsa = SAREA(s); 42#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */
183 43#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */
184 s->cr0 = raid6_get_fpu();
185 44
186 asm volatile("movdqa %%xmm0,%0" : "=m" (rsa[0])); 45/* Should work well enough on modern CPUs for testing */
187 asm volatile("movdqa %%xmm1,%0" : "=m" (rsa[4])); 46static inline int boot_cpu_has(int flag)
188 asm volatile("movdqa %%xmm2,%0" : "=m" (rsa[8]));
189 asm volatile("movdqa %%xmm3,%0" : "=m" (rsa[12]));
190 asm volatile("movdqa %%xmm4,%0" : "=m" (rsa[16]));
191 asm volatile("movdqa %%xmm5,%0" : "=m" (rsa[20]));
192 asm volatile("movdqa %%xmm6,%0" : "=m" (rsa[24]));
193 asm volatile("movdqa %%xmm7,%0" : "=m" (rsa[28]));
194 asm volatile("movdqa %%xmm8,%0" : "=m" (rsa[32]));
195 asm volatile("movdqa %%xmm9,%0" : "=m" (rsa[36]));
196 asm volatile("movdqa %%xmm10,%0" : "=m" (rsa[40]));
197 asm volatile("movdqa %%xmm11,%0" : "=m" (rsa[44]));
198 asm volatile("movdqa %%xmm12,%0" : "=m" (rsa[48]));
199 asm volatile("movdqa %%xmm13,%0" : "=m" (rsa[52]));
200 asm volatile("movdqa %%xmm14,%0" : "=m" (rsa[56]));
201 asm volatile("movdqa %%xmm15,%0" : "=m" (rsa[60]));
202}
203
204static inline void raid6_after_sse16(raid6_sse16_save_t *s)
205{ 47{
206 unsigned int *rsa = SAREA(s); 48 u32 eax = (flag >> 5) ? 0x80000001 : 1;
49 u32 edx;
207 50
208 asm volatile("movdqa %0,%%xmm0" : : "m" (rsa[0])); 51 asm volatile("cpuid"
209 asm volatile("movdqa %0,%%xmm1" : : "m" (rsa[4])); 52 : "+a" (eax), "=d" (edx)
210 asm volatile("movdqa %0,%%xmm2" : : "m" (rsa[8])); 53 : : "ecx", "ebx");
211 asm volatile("movdqa %0,%%xmm3" : : "m" (rsa[12]));
212 asm volatile("movdqa %0,%%xmm4" : : "m" (rsa[16]));
213 asm volatile("movdqa %0,%%xmm5" : : "m" (rsa[20]));
214 asm volatile("movdqa %0,%%xmm6" : : "m" (rsa[24]));
215 asm volatile("movdqa %0,%%xmm7" : : "m" (rsa[28]));
216 asm volatile("movdqa %0,%%xmm8" : : "m" (rsa[32]));
217 asm volatile("movdqa %0,%%xmm9" : : "m" (rsa[36]));
218 asm volatile("movdqa %0,%%xmm10" : : "m" (rsa[40]));
219 asm volatile("movdqa %0,%%xmm11" : : "m" (rsa[44]));
220 asm volatile("movdqa %0,%%xmm12" : : "m" (rsa[48]));
221 asm volatile("movdqa %0,%%xmm13" : : "m" (rsa[52]));
222 asm volatile("movdqa %0,%%xmm14" : : "m" (rsa[56]));
223 asm volatile("movdqa %0,%%xmm15" : : "m" (rsa[60]));
224 54
225 raid6_put_fpu(s->cr0); 55 return (edx >> (flag & 31)) & 1;
226} 56}
227 57
228#endif /* __x86_64__ */
229
230/* User space test hack */
231#ifndef __KERNEL__
232static inline int cpuid_features(void)
233{
234 u32 eax = 1;
235 u32 ebx, ecx, edx;
236
237 asm volatile("cpuid" :
238 "+a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx));
239
240 return edx;
241}
242#endif /* ndef __KERNEL__ */ 58#endif /* ndef __KERNEL__ */
243 59
244#endif 60#endif
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index 15d12fce34df..127a94b9a1b5 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -469,9 +469,9 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev,
469 fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { 469 fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) {
470 470
471 fw->data[BLUEBIRD_01_ID_OFFSET + 2] = 471 fw->data[BLUEBIRD_01_ID_OFFSET + 2] =
472 udev->descriptor.idProduct + 1; 472 le16_to_cpu(udev->descriptor.idProduct) + 1;
473 fw->data[BLUEBIRD_01_ID_OFFSET + 3] = 473 fw->data[BLUEBIRD_01_ID_OFFSET + 3] =
474 udev->descriptor.idProduct >> 8; 474 le16_to_cpu(udev->descriptor.idProduct) >> 8;
475 475
476 return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); 476 return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2);
477 } 477 }
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index 4a198d4755b0..b5acb11c0bc9 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -119,6 +119,8 @@ static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_f
119 struct dvb_usb_adapter *adap = fe->dvb->priv; 119 struct dvb_usb_adapter *adap = fe->dvb->priv;
120 u8 b[5]; 120 u8 b[5];
121 dvb_usb_tuner_calc_regs(fe,fep,b, 5); 121 dvb_usb_tuner_calc_regs(fe,fep,b, 5);
122 if (fe->ops.i2c_gate_ctrl)
123 fe->ops.i2c_gate_ctrl(fe, 1);
122 return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); 124 return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0);
123} 125}
124 126
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 682dc7ce48d9..710c11a68296 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -1022,7 +1022,7 @@ static ssize_t cafe_v4l_read(struct file *filp,
1022 char __user *buffer, size_t len, loff_t *pos) 1022 char __user *buffer, size_t len, loff_t *pos)
1023{ 1023{
1024 struct cafe_camera *cam = filp->private_data; 1024 struct cafe_camera *cam = filp->private_data;
1025 int ret; 1025 int ret = 0;
1026 1026
1027 /* 1027 /*
1028 * Perhaps we're in speculative read mode and already 1028 * Perhaps we're in speculative read mode and already
@@ -1251,8 +1251,6 @@ static int cafe_vidioc_reqbufs(struct file *filp, void *priv,
1251 1251
1252 if (cam->n_sbufs == 0) /* no luck at all - ret already set */ 1252 if (cam->n_sbufs == 0) /* no luck at all - ret already set */
1253 kfree(cam->sb_bufs); 1253 kfree(cam->sb_bufs);
1254 else
1255 ret = 0;
1256 req->count = cam->n_sbufs; /* In case of partial success */ 1254 req->count = cam->n_sbufs; /* In case of partial success */
1257 1255
1258 out: 1256 out:
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index cc535ca713d2..774d2536555b 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -633,7 +633,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
633 { 633 {
634 struct v4l2_register *reg = arg; 634 struct v4l2_register *reg = arg;
635 635
636 if (reg->i2c_id != I2C_DRIVERID_CX25840) 636 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
637 return -EINVAL; 637 return -EINVAL;
638 if (!capable(CAP_SYS_ADMIN)) 638 if (!capable(CAP_SYS_ADMIN))
639 return -EPERM; 639 return -EPERM;
@@ -903,13 +903,13 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
903 state->vbi_line_offset = 8; 903 state->vbi_line_offset = 8;
904 state->id = id; 904 state->id = id;
905 905
906 i2c_attach_client(client);
907
906 if (state->is_cx25836) 908 if (state->is_cx25836)
907 cx25836_initialize(client); 909 cx25836_initialize(client);
908 else 910 else
909 cx25840_initialize(client, 1); 911 cx25840_initialize(client, 1);
910 912
911 i2c_attach_client(client);
912
913 return 0; 913 return 0;
914} 914}
915 915
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c
index 1958d4016ea1..0e86b9d033ac 100644
--- a/drivers/media/video/cx25840/cx25840-firmware.c
+++ b/drivers/media/video/cx25840/cx25840-firmware.c
@@ -37,7 +37,7 @@
37 */ 37 */
38#define FWSEND 48 38#define FWSEND 48
39 39
40#define FWDEV(x) &((x)->adapter->dev) 40#define FWDEV(x) &((x)->dev)
41 41
42static char *firmware = FWFILE; 42static char *firmware = FWFILE;
43 43
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index a97be1bdc31d..bdfe2af70124 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1389,7 +1389,7 @@ static int vidioc_g_register (struct file *file, void *fh,
1389{ 1389{
1390 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1390 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
1391 1391
1392 if (reg->i2c_id != 0) 1392 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
1393 return -EINVAL; 1393 return -EINVAL;
1394 /* cx2388x has a 24-bit register space */ 1394 /* cx2388x has a 24-bit register space */
1395 reg->val = cx_read(reg->reg&0xffffff); 1395 reg->val = cx_read(reg->reg&0xffffff);
@@ -1401,7 +1401,7 @@ static int vidioc_s_register (struct file *file, void *fh,
1401{ 1401{
1402 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1402 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
1403 1403
1404 if (reg->i2c_id != 0) 1404 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
1405 return -EINVAL; 1405 return -EINVAL;
1406 cx_write(reg->reg&0xffffff, reg->val); 1406 cx_write(reg->reg&0xffffff, reg->val);
1407 return 0; 1407 return 0;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index a1ca0f5007e0..1cd4bb3ae260 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -3256,8 +3256,8 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
3256 3256
3257 3257
3258int pvr2_hdw_register_access(struct pvr2_hdw *hdw, 3258int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
3259 u32 chip_id, u64 reg_id, 3259 u32 match_type, u32 match_chip, u64 reg_id,
3260 int setFl,u32 *val_ptr) 3260 int setFl,u64 *val_ptr)
3261{ 3261{
3262#ifdef CONFIG_VIDEO_ADV_DEBUG 3262#ifdef CONFIG_VIDEO_ADV_DEBUG
3263 struct list_head *item; 3263 struct list_head *item;
@@ -3268,13 +3268,16 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
3268 3268
3269 if (!capable(CAP_SYS_ADMIN)) return -EPERM; 3269 if (!capable(CAP_SYS_ADMIN)) return -EPERM;
3270 3270
3271 req.i2c_id = chip_id; 3271 req.match_type = match_type;
3272 req.match_chip = match_chip;
3272 req.reg = reg_id; 3273 req.reg = reg_id;
3273 if (setFl) req.val = *val_ptr; 3274 if (setFl) req.val = *val_ptr;
3274 mutex_lock(&hdw->i2c_list_lock); do { 3275 mutex_lock(&hdw->i2c_list_lock); do {
3275 list_for_each(item,&hdw->i2c_clients) { 3276 list_for_each(item,&hdw->i2c_clients) {
3276 cp = list_entry(item,struct pvr2_i2c_client,list); 3277 cp = list_entry(item,struct pvr2_i2c_client,list);
3277 if (cp->client->driver->id != chip_id) continue; 3278 if (!v4l2_chip_match_i2c_client(cp->client, req.match_type, req.match_chip)) {
3279 continue;
3280 }
3278 stat = pvr2_i2c_client_cmd( 3281 stat = pvr2_i2c_client_cmd(
3279 cp,(setFl ? VIDIOC_DBG_S_REGISTER : 3282 cp,(setFl ? VIDIOC_DBG_S_REGISTER :
3280 VIDIOC_DBG_G_REGISTER),&req); 3283 VIDIOC_DBG_G_REGISTER),&req);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 566a8ef7e121..0c9cca43ff85 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -217,13 +217,14 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
217 enum pvr2_v4l_type index,int); 217 enum pvr2_v4l_type index,int);
218 218
219/* Direct read/write access to chip's registers: 219/* Direct read/write access to chip's registers:
220 chip_id - unique id of chip (e.g. I2C_DRIVERD_xxxx) 220 match_type - how to interpret match_chip (e.g. driver ID, i2c address)
221 match_chip - chip match value (e.g. I2C_DRIVERD_xxxx)
221 reg_id - register number to access 222 reg_id - register number to access
222 setFl - true to set the register, false to read it 223 setFl - true to set the register, false to read it
223 val_ptr - storage location for source / result. */ 224 val_ptr - storage location for source / result. */
224int pvr2_hdw_register_access(struct pvr2_hdw *, 225int pvr2_hdw_register_access(struct pvr2_hdw *,
225 u32 chip_id,u64 reg_id, 226 u32 match_type, u32 match_chip,u64 reg_id,
226 int setFl,u32 *val_ptr); 227 int setFl,u64 *val_ptr);
227 228
228/* The following entry points are all lower level things you normally don't 229/* The following entry points are all lower level things you normally don't
229 want to worry about. */ 230 want to worry about. */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 4fe4136204c7..5313d342666e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -740,11 +740,11 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
740 case VIDIOC_DBG_S_REGISTER: 740 case VIDIOC_DBG_S_REGISTER:
741 case VIDIOC_DBG_G_REGISTER: 741 case VIDIOC_DBG_G_REGISTER:
742 { 742 {
743 u32 val; 743 u64 val;
744 struct v4l2_register *req = (struct v4l2_register *)arg; 744 struct v4l2_register *req = (struct v4l2_register *)arg;
745 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val; 745 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val;
746 ret = pvr2_hdw_register_access( 746 ret = pvr2_hdw_register_access(
747 hdw,req->i2c_id,req->reg, 747 hdw,req->match_type,req->match_chip,req->reg,
748 cmd == VIDIOC_DBG_S_REGISTER,&val); 748 cmd == VIDIOC_DBG_S_REGISTER,&val);
749 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val; 749 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val;
750 break; 750 break;
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index c4f066d6668e..7735b6758921 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1425,7 +1425,7 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar
1425 { 1425 {
1426 struct v4l2_register *reg = arg; 1426 struct v4l2_register *reg = arg;
1427 1427
1428 if (reg->i2c_id != I2C_DRIVERID_SAA711X) 1428 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
1429 return -EINVAL; 1429 return -EINVAL;
1430 if (!capable(CAP_SYS_ADMIN)) 1430 if (!capable(CAP_SYS_ADMIN))
1431 return -EPERM; 1431 return -EPERM;
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index bd9c4f3ad02e..654863db1591 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -619,7 +619,7 @@ static int saa7127_command(struct i2c_client *client,
619 { 619 {
620 struct v4l2_register *reg = arg; 620 struct v4l2_register *reg = arg;
621 621
622 if (reg->i2c_id != I2C_DRIVERID_SAA7127) 622 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
623 return -EINVAL; 623 return -EINVAL;
624 if (!capable(CAP_SYS_ADMIN)) 624 if (!capable(CAP_SYS_ADMIN))
625 return -EPERM; 625 return -EPERM;
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 886b5df7c9d1..d5ec05f56adf 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -955,7 +955,7 @@ static int tvp5150_command(struct i2c_client *c,
955 { 955 {
956 struct v4l2_register *reg = arg; 956 struct v4l2_register *reg = arg;
957 957
958 if (reg->i2c_id != I2C_DRIVERID_TVP5150) 958 if (!v4l2_chip_match_i2c_client(c, reg->match_type, reg->match_chip))
959 return -EINVAL; 959 return -EINVAL;
960 if (!capable(CAP_SYS_ADMIN)) 960 if (!capable(CAP_SYS_ADMIN))
961 return -EPERM; 961 return -EPERM;
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c
index b3b5fd536dc3..28d1133a3b7a 100644
--- a/drivers/media/video/upd64031a.c
+++ b/drivers/media/video/upd64031a.c
@@ -167,7 +167,7 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void *
167 { 167 {
168 struct v4l2_register *reg = arg; 168 struct v4l2_register *reg = arg;
169 169
170 if (reg->i2c_id != I2C_DRIVERID_UPD64031A) 170 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
171 return -EINVAL; 171 return -EINVAL;
172 if (!capable(CAP_SYS_ADMIN)) 172 if (!capable(CAP_SYS_ADMIN))
173 return -EPERM; 173 return -EPERM;
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c
index 8852903e7a92..fe38224150d8 100644
--- a/drivers/media/video/upd64083.c
+++ b/drivers/media/video/upd64083.c
@@ -144,7 +144,7 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a
144 { 144 {
145 struct v4l2_register *reg = arg; 145 struct v4l2_register *reg = arg;
146 146
147 if (reg->i2c_id != I2C_DRIVERID_UPD64083) 147 if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
148 return -EINVAL; 148 return -EINVAL;
149 if (!capable(CAP_SYS_ADMIN)) 149 if (!capable(CAP_SYS_ADMIN))
150 return -EPERM; 150 return -EPERM;
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index ae5f42562c0c..6fc14557d623 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -521,7 +521,7 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file,
521 struct v4l2_register *reg = arg; 521 struct v4l2_register *reg = arg;
522 int errCode; 522 int errCode;
523 523
524 if (reg->i2c_id != 0) 524 if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
525 return -EINVAL; 525 return -EINVAL;
526 if (!capable(CAP_SYS_ADMIN)) 526 if (!capable(CAP_SYS_ADMIN))
527 return -EPERM; 527 return -EPERM;
@@ -540,7 +540,7 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file,
540 540
541 PDEBUG(DBG_IOCTL, "VIDIOC_DBG_%c_REGISTER reg=0x%02X, value=0x%02X", 541 PDEBUG(DBG_IOCTL, "VIDIOC_DBG_%c_REGISTER reg=0x%02X, value=0x%02X",
542 cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', 542 cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S',
543 (unsigned int)reg->reg, reg->val); 543 (unsigned int)reg->reg, (unsigned int)reg->val);
544 return 0; 544 return 0;
545 } 545 }
546#endif 546#endif
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index ddfd80c5618b..54747606eae1 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -51,6 +51,7 @@
51#include <linux/mm.h> 51#include <linux/mm.h>
52#include <linux/string.h> 52#include <linux/string.h>
53#include <linux/errno.h> 53#include <linux/errno.h>
54#include <linux/i2c.h>
54#include <asm/uaccess.h> 55#include <asm/uaccess.h>
55#include <asm/system.h> 56#include <asm/system.h>
56#include <asm/pgtable.h> 57#include <asm/pgtable.h>
@@ -365,13 +366,21 @@ static const char *v4l2_ioctls[] = {
365 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", 366 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT",
366 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", 367 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY",
367 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", 368 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY",
368#if 1
369 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", 369 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
370#endif
371 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS", 370 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS",
372 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS", 371 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS",
373 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS", 372 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS",
374 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS" 373 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS",
374#if 1
375 [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
376 [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
377 [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX",
378 [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
379 [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD",
380
381 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
382 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
383#endif
375}; 384};
376#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) 385#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
377 386
@@ -395,9 +404,6 @@ static const char *v4l2_int_ioctls[] = {
395 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", 404 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
396 [_IOC_NR(TDA9887_SET_CONFIG)] = "TDA9887_SET_CONFIG", 405 [_IOC_NR(TDA9887_SET_CONFIG)] = "TDA9887_SET_CONFIG",
397 406
398 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
399 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
400
401 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE", 407 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE",
402 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", 408 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET",
403 [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ", 409 [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
@@ -947,6 +953,28 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
947 return **ctrl_classes; 953 return **ctrl_classes;
948} 954}
949 955
956int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip)
957{
958 switch (match_type) {
959 case V4L2_CHIP_MATCH_I2C_DRIVER:
960 return (c != NULL && c->driver != NULL && c->driver->id == match_chip);
961 case V4L2_CHIP_MATCH_I2C_ADDR:
962 return (c != NULL && c->addr == match_chip);
963 default:
964 return 0;
965 }
966}
967
968int v4l2_chip_match_host(u32 match_type, u32 match_chip)
969{
970 switch (match_type) {
971 case V4L2_CHIP_MATCH_HOST:
972 return match_chip == 0;
973 default:
974 return 0;
975 }
976}
977
950/* ----------------------------------------------------------------- */ 978/* ----------------------------------------------------------------- */
951 979
952EXPORT_SYMBOL(v4l2_norm_to_name); 980EXPORT_SYMBOL(v4l2_norm_to_name);
@@ -970,6 +998,9 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu);
970EXPORT_SYMBOL(v4l2_ctrl_query_fill); 998EXPORT_SYMBOL(v4l2_ctrl_query_fill);
971EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); 999EXPORT_SYMBOL(v4l2_ctrl_query_fill_std);
972 1000
1001EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
1002EXPORT_SYMBOL(v4l2_chip_match_host);
1003
973/* 1004/*
974 * Local variables: 1005 * Local variables:
975 * c-basic-offset: 8 1006 * c-basic-offset: 8
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index dc9b1ef678aa..011938fb7e0e 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -1342,6 +1342,42 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1342 ret=vfd->vidioc_s_jpegcomp(file, fh, p); 1342 ret=vfd->vidioc_s_jpegcomp(file, fh, p);
1343 break; 1343 break;
1344 } 1344 }
1345 case VIDIOC_G_ENC_INDEX:
1346 {
1347 struct v4l2_enc_idx *p=arg;
1348
1349 if (!vfd->vidioc_g_enc_index)
1350 break;
1351 ret=vfd->vidioc_g_enc_index(file, fh, p);
1352 if (!ret)
1353 dbgarg (cmd, "entries=%d, entries_cap=%d\n",
1354 p->entries,p->entries_cap);
1355 break;
1356 }
1357 case VIDIOC_ENCODER_CMD:
1358 {
1359 struct v4l2_encoder_cmd *p=arg;
1360
1361 if (!vfd->vidioc_encoder_cmd)
1362 break;
1363 ret=vfd->vidioc_encoder_cmd(file, fh, p);
1364 if (!ret)
1365 dbgarg (cmd, "cmd=%d, flags=%d\n",
1366 p->cmd,p->flags);
1367 break;
1368 }
1369 case VIDIOC_TRY_ENCODER_CMD:
1370 {
1371 struct v4l2_encoder_cmd *p=arg;
1372
1373 if (!vfd->vidioc_try_encoder_cmd)
1374 break;
1375 ret=vfd->vidioc_try_encoder_cmd(file, fh, p);
1376 if (!ret)
1377 dbgarg (cmd, "cmd=%d, flags=%d\n",
1378 p->cmd,p->flags);
1379 break;
1380 }
1345 case VIDIOC_G_PARM: 1381 case VIDIOC_G_PARM:
1346 { 1382 {
1347 struct v4l2_streamparm *p=arg; 1383 struct v4l2_streamparm *p=arg;
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 7a0d8ee2de9c..04aaa6347234 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -113,10 +113,16 @@ EXPORT_SYMBOL_GPL(rtc_device_register);
113 */ 113 */
114void rtc_device_unregister(struct rtc_device *rtc) 114void rtc_device_unregister(struct rtc_device *rtc)
115{ 115{
116 mutex_lock(&rtc->ops_lock); 116 if (class_device_get(&rtc->class_dev) != NULL) {
117 rtc->ops = NULL; 117 mutex_lock(&rtc->ops_lock);
118 mutex_unlock(&rtc->ops_lock); 118 /* remove innards of this RTC, then disable it, before
119 class_device_unregister(&rtc->class_dev); 119 * letting any rtc_class_open() users access it again
120 */
121 class_device_unregister(&rtc->class_dev);
122 rtc->ops = NULL;
123 mutex_unlock(&rtc->ops_lock);
124 class_device_put(&rtc->class_dev);
125 }
120} 126}
121EXPORT_SYMBOL_GPL(rtc_device_unregister); 127EXPORT_SYMBOL_GPL(rtc_device_unregister);
122 128
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 6f11f6dfdd9d..ef40df0f169d 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -179,7 +179,7 @@ struct class_device *rtc_class_open(char *name)
179 down(&rtc_class->sem); 179 down(&rtc_class->sem);
180 list_for_each_entry(class_dev_tmp, &rtc_class->children, node) { 180 list_for_each_entry(class_dev_tmp, &rtc_class->children, node) {
181 if (strncmp(class_dev_tmp->class_id, name, BUS_ID_SIZE) == 0) { 181 if (strncmp(class_dev_tmp->class_id, name, BUS_ID_SIZE) == 0) {
182 class_dev = class_dev_tmp; 182 class_dev = class_device_get(class_dev_tmp);
183 break; 183 break;
184 } 184 }
185 } 185 }
@@ -197,6 +197,7 @@ EXPORT_SYMBOL_GPL(rtc_class_open);
197void rtc_class_close(struct class_device *class_dev) 197void rtc_class_close(struct class_device *class_dev)
198{ 198{
199 module_put(to_rtc_device(class_dev)->owner); 199 module_put(to_rtc_device(class_dev)->owner);
200 class_device_put(class_dev);
200} 201}
201EXPORT_SYMBOL_GPL(rtc_class_close); 202EXPORT_SYMBOL_GPL(rtc_class_close);
202 203
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index c1536d785551..b8f0a11e8f31 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1618,8 +1618,7 @@ config FB_IBM_GXT4500
1618 1618
1619config FB_PS3 1619config FB_PS3
1620 bool "PS3 GPU framebuffer driver" 1620 bool "PS3 GPU framebuffer driver"
1621 depends on FB && PPC_PS3 1621 depends on FB && PS3_PS3AV
1622 select PS3_PS3AV
1623 select FB_CFB_FILLRECT 1622 select FB_CFB_FILLRECT
1624 select FB_CFB_COPYAREA 1623 select FB_CFB_COPYAREA
1625 select FB_CFB_IMAGEBLIT 1624 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 02b290ca01e1..58c0ac733db9 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -136,8 +136,8 @@ static inline void sm501fb_sync_regs(struct sm501fb_info *info)
136#define SM501_MEMF_CRT (4) 136#define SM501_MEMF_CRT (4)
137#define SM501_MEMF_ACCEL (8) 137#define SM501_MEMF_ACCEL (8)
138 138
139int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem, 139static int sm501_alloc_mem(struct sm501fb_info *inf, struct sm501_mem *mem,
140 unsigned int why, size_t size) 140 unsigned int why, size_t size)
141{ 141{
142 unsigned int ptr = 0; 142 unsigned int ptr = 0;
143 143
@@ -926,7 +926,7 @@ static int sm501fb_blank_crt(int blank_mode, struct fb_info *info)
926 * set or change the hardware cursor parameters 926 * set or change the hardware cursor parameters
927*/ 927*/
928 928
929int sm501fb_cursor(struct fb_info *info, struct fb_cursor *cursor) 929static int sm501fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
930{ 930{
931 struct sm501fb_par *par = info->par; 931 struct sm501fb_par *par = info->par;
932 struct sm501fb_info *fbi = par->info; 932 struct sm501fb_info *fbi = par->info;
@@ -1225,7 +1225,7 @@ static struct sm501fb_info *sm501fb_info_alloc(struct fb_info *fbinfo_crt,
1225 * initialise hw cursor parameters 1225 * initialise hw cursor parameters
1226*/ 1226*/
1227 1227
1228int sm501_init_cursor(struct fb_info *fbi, unsigned int reg_base) 1228static int sm501_init_cursor(struct fb_info *fbi, unsigned int reg_base)
1229{ 1229{
1230 struct sm501fb_par *par = fbi->par; 1230 struct sm501fb_par *par = fbi->par;
1231 struct sm501fb_info *info = par->info; 1231 struct sm501fb_info *info = par->info;
@@ -1768,7 +1768,7 @@ static struct platform_driver sm501fb_driver = {
1768 }, 1768 },
1769}; 1769};
1770 1770
1771int __devinit sm501fb_init(void) 1771static int __devinit sm501fb_init(void)
1772{ 1772{
1773 return platform_driver_register(&sm501fb_driver); 1773 return platform_driver_register(&sm501fb_driver);
1774} 1774}
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index bd969adf70d7..7a7d25d541e7 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -205,6 +205,7 @@ int ecryptfs_open_lower_file(struct file **lower_file,
205{ 205{
206 int rc = 0; 206 int rc = 0;
207 207
208 flags |= O_LARGEFILE;
208 dget(lower_dentry); 209 dget(lower_dentry);
209 mntget(lower_mnt); 210 mntget(lower_mnt);
210 *lower_file = dentry_open(lower_dentry, lower_mnt, flags); 211 *lower_file = dentry_open(lower_dentry, lower_mnt, flags);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 9fa7e0b27a96..0cfff4fefa9e 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -200,9 +200,6 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
200 inode = ecryptfs_dentry->d_inode; 200 inode = ecryptfs_dentry->d_inode;
201 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; 201 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
202 lower_flags = ((O_CREAT | O_TRUNC) & O_ACCMODE) | O_RDWR; 202 lower_flags = ((O_CREAT | O_TRUNC) & O_ACCMODE) | O_RDWR;
203#if BITS_PER_LONG != 32
204 lower_flags |= O_LARGEFILE;
205#endif
206 lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry); 203 lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry);
207 /* Corresponding fput() at end of this function */ 204 /* Corresponding fput() at end of this function */
208 if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt, 205 if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 80044d196fe0..812427e6805c 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -487,7 +487,7 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
487 rc = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); 487 rc = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
488 if (rc) { 488 if (rc) {
489 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n"); 489 ecryptfs_printk(KERN_WARNING, "path_lookup() failed\n");
490 goto out_free; 490 goto out;
491 } 491 }
492 lower_root = nd.dentry; 492 lower_root = nd.dentry;
493 if (!lower_root->d_inode) { 493 if (!lower_root->d_inode) {
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 3a6f65c3f14f..7be8e91b5ba0 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -238,7 +238,6 @@ int ecryptfs_do_readpage(struct file *file, struct page *page,
238 lower_page_data = kmap_atomic(lower_page, KM_USER1); 238 lower_page_data = kmap_atomic(lower_page, KM_USER1);
239 memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE); 239 memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE);
240 kunmap_atomic(lower_page_data, KM_USER1); 240 kunmap_atomic(lower_page_data, KM_USER1);
241 flush_dcache_page(lower_page);
242 kunmap_atomic(page_data, KM_USER0); 241 kunmap_atomic(page_data, KM_USER0);
243 flush_dcache_page(page); 242 flush_dcache_page(page);
244 rc = 0; 243 rc = 0;
@@ -422,9 +421,11 @@ out:
422 return rc; 421 return rc;
423} 422}
424 423
425static void ecryptfs_release_lower_page(struct page *lower_page) 424static
425void ecryptfs_release_lower_page(struct page *lower_page, int page_locked)
426{ 426{
427 unlock_page(lower_page); 427 if (page_locked)
428 unlock_page(lower_page);
428 page_cache_release(lower_page); 429 page_cache_release(lower_page);
429} 430}
430 431
@@ -454,6 +455,13 @@ static int ecryptfs_write_inode_size_to_header(struct file *lower_file,
454 } 455 }
455 lower_a_ops = lower_inode->i_mapping->a_ops; 456 lower_a_ops = lower_inode->i_mapping->a_ops;
456 rc = lower_a_ops->prepare_write(lower_file, header_page, 0, 8); 457 rc = lower_a_ops->prepare_write(lower_file, header_page, 0, 8);
458 if (rc) {
459 if (rc == AOP_TRUNCATED_PAGE)
460 ecryptfs_release_lower_page(header_page, 0);
461 else
462 ecryptfs_release_lower_page(header_page, 1);
463 goto out;
464 }
457 file_size = (u64)i_size_read(inode); 465 file_size = (u64)i_size_read(inode);
458 ecryptfs_printk(KERN_DEBUG, "Writing size: [0x%.16x]\n", file_size); 466 ecryptfs_printk(KERN_DEBUG, "Writing size: [0x%.16x]\n", file_size);
459 file_size = cpu_to_be64(file_size); 467 file_size = cpu_to_be64(file_size);
@@ -465,7 +473,10 @@ static int ecryptfs_write_inode_size_to_header(struct file *lower_file,
465 if (rc < 0) 473 if (rc < 0)
466 ecryptfs_printk(KERN_ERR, "Error commiting header page " 474 ecryptfs_printk(KERN_ERR, "Error commiting header page "
467 "write\n"); 475 "write\n");
468 ecryptfs_release_lower_page(header_page); 476 if (rc == AOP_TRUNCATED_PAGE)
477 ecryptfs_release_lower_page(header_page, 0);
478 else
479 ecryptfs_release_lower_page(header_page, 1);
469 lower_inode->i_mtime = lower_inode->i_ctime = CURRENT_TIME; 480 lower_inode->i_mtime = lower_inode->i_ctime = CURRENT_TIME;
470 mark_inode_dirty_sync(inode); 481 mark_inode_dirty_sync(inode);
471out: 482out:
@@ -572,7 +583,10 @@ int ecryptfs_get_lower_page(struct page **lower_page, struct inode *lower_inode,
572 } 583 }
573out: 584out:
574 if (rc && (*lower_page)) { 585 if (rc && (*lower_page)) {
575 ecryptfs_release_lower_page(*lower_page); 586 if (rc == AOP_TRUNCATED_PAGE)
587 ecryptfs_release_lower_page(*lower_page, 0);
588 else
589 ecryptfs_release_lower_page(*lower_page, 1);
576 (*lower_page) = NULL; 590 (*lower_page) = NULL;
577 } 591 }
578 return rc; 592 return rc;
@@ -588,16 +602,19 @@ ecryptfs_commit_lower_page(struct page *lower_page, struct inode *lower_inode,
588 struct file *lower_file, int byte_offset, 602 struct file *lower_file, int byte_offset,
589 int region_size) 603 int region_size)
590{ 604{
605 int page_locked = 1;
591 int rc = 0; 606 int rc = 0;
592 607
593 rc = lower_inode->i_mapping->a_ops->commit_write( 608 rc = lower_inode->i_mapping->a_ops->commit_write(
594 lower_file, lower_page, byte_offset, region_size); 609 lower_file, lower_page, byte_offset, region_size);
610 if (rc == AOP_TRUNCATED_PAGE)
611 page_locked = 0;
595 if (rc < 0) { 612 if (rc < 0) {
596 ecryptfs_printk(KERN_ERR, 613 ecryptfs_printk(KERN_ERR,
597 "Error committing write; rc = [%d]\n", rc); 614 "Error committing write; rc = [%d]\n", rc);
598 } else 615 } else
599 rc = 0; 616 rc = 0;
600 ecryptfs_release_lower_page(lower_page); 617 ecryptfs_release_lower_page(lower_page, page_locked);
601 return rc; 618 return rc;
602} 619}
603 620
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 99857a400f4b..12f7dda1232c 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -475,8 +475,15 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode,
475 struct buffer_head *bh) 475 struct buffer_head *bh)
476{ 476{
477 struct mb_cache_entry *ce = NULL; 477 struct mb_cache_entry *ce = NULL;
478 int error = 0;
478 479
479 ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev, bh->b_blocknr); 480 ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev, bh->b_blocknr);
481 error = ext3_journal_get_write_access(handle, bh);
482 if (error)
483 goto out;
484
485 lock_buffer(bh);
486
480 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) { 487 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) {
481 ea_bdebug(bh, "refcount now=0; freeing"); 488 ea_bdebug(bh, "refcount now=0; freeing");
482 if (ce) 489 if (ce)
@@ -485,21 +492,20 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode,
485 get_bh(bh); 492 get_bh(bh);
486 ext3_forget(handle, 1, inode, bh, bh->b_blocknr); 493 ext3_forget(handle, 1, inode, bh, bh->b_blocknr);
487 } else { 494 } else {
488 if (ext3_journal_get_write_access(handle, bh) == 0) { 495 BHDR(bh)->h_refcount = cpu_to_le32(
489 lock_buffer(bh);
490 BHDR(bh)->h_refcount = cpu_to_le32(
491 le32_to_cpu(BHDR(bh)->h_refcount) - 1); 496 le32_to_cpu(BHDR(bh)->h_refcount) - 1);
492 ext3_journal_dirty_metadata(handle, bh); 497 error = ext3_journal_dirty_metadata(handle, bh);
493 if (IS_SYNC(inode)) 498 handle->h_sync = 1;
494 handle->h_sync = 1; 499 DQUOT_FREE_BLOCK(inode, 1);
495 DQUOT_FREE_BLOCK(inode, 1); 500 ea_bdebug(bh, "refcount now=%d; releasing",
496 unlock_buffer(bh); 501 le32_to_cpu(BHDR(bh)->h_refcount));
497 ea_bdebug(bh, "refcount now=%d; releasing",
498 le32_to_cpu(BHDR(bh)->h_refcount));
499 }
500 if (ce) 502 if (ce)
501 mb_cache_entry_release(ce); 503 mb_cache_entry_release(ce);
502 } 504 }
505 unlock_buffer(bh);
506out:
507 ext3_std_error(inode->i_sb, error);
508 return;
503} 509}
504 510
505struct ext3_xattr_info { 511struct ext3_xattr_info {
@@ -675,7 +681,7 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
675 struct buffer_head *new_bh = NULL; 681 struct buffer_head *new_bh = NULL;
676 struct ext3_xattr_search *s = &bs->s; 682 struct ext3_xattr_search *s = &bs->s;
677 struct mb_cache_entry *ce = NULL; 683 struct mb_cache_entry *ce = NULL;
678 int error; 684 int error = 0;
679 685
680#define header(x) ((struct ext3_xattr_header *)(x)) 686#define header(x) ((struct ext3_xattr_header *)(x))
681 687
@@ -684,16 +690,17 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
684 if (s->base) { 690 if (s->base) {
685 ce = mb_cache_entry_get(ext3_xattr_cache, bs->bh->b_bdev, 691 ce = mb_cache_entry_get(ext3_xattr_cache, bs->bh->b_bdev,
686 bs->bh->b_blocknr); 692 bs->bh->b_blocknr);
693 error = ext3_journal_get_write_access(handle, bs->bh);
694 if (error)
695 goto cleanup;
696 lock_buffer(bs->bh);
697
687 if (header(s->base)->h_refcount == cpu_to_le32(1)) { 698 if (header(s->base)->h_refcount == cpu_to_le32(1)) {
688 if (ce) { 699 if (ce) {
689 mb_cache_entry_free(ce); 700 mb_cache_entry_free(ce);
690 ce = NULL; 701 ce = NULL;
691 } 702 }
692 ea_bdebug(bs->bh, "modifying in-place"); 703 ea_bdebug(bs->bh, "modifying in-place");
693 error = ext3_journal_get_write_access(handle, bs->bh);
694 if (error)
695 goto cleanup;
696 lock_buffer(bs->bh);
697 error = ext3_xattr_set_entry(i, s); 704 error = ext3_xattr_set_entry(i, s);
698 if (!error) { 705 if (!error) {
699 if (!IS_LAST_ENTRY(s->first)) 706 if (!IS_LAST_ENTRY(s->first))
@@ -713,6 +720,9 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
713 } else { 720 } else {
714 int offset = (char *)s->here - bs->bh->b_data; 721 int offset = (char *)s->here - bs->bh->b_data;
715 722
723 unlock_buffer(bs->bh);
724 journal_release_buffer(handle, bs->bh);
725
716 if (ce) { 726 if (ce) {
717 mb_cache_entry_release(ce); 727 mb_cache_entry_release(ce);
718 ce = NULL; 728 ce = NULL;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index dc969c357aa1..e832e96095b3 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -475,8 +475,14 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
475 struct buffer_head *bh) 475 struct buffer_head *bh)
476{ 476{
477 struct mb_cache_entry *ce = NULL; 477 struct mb_cache_entry *ce = NULL;
478 int error = 0;
478 479
479 ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr); 480 ce = mb_cache_entry_get(ext4_xattr_cache, bh->b_bdev, bh->b_blocknr);
481 error = ext4_journal_get_write_access(handle, bh);
482 if (error)
483 goto out;
484
485 lock_buffer(bh);
480 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) { 486 if (BHDR(bh)->h_refcount == cpu_to_le32(1)) {
481 ea_bdebug(bh, "refcount now=0; freeing"); 487 ea_bdebug(bh, "refcount now=0; freeing");
482 if (ce) 488 if (ce)
@@ -485,21 +491,21 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
485 get_bh(bh); 491 get_bh(bh);
486 ext4_forget(handle, 1, inode, bh, bh->b_blocknr); 492 ext4_forget(handle, 1, inode, bh, bh->b_blocknr);
487 } else { 493 } else {
488 if (ext4_journal_get_write_access(handle, bh) == 0) { 494 BHDR(bh)->h_refcount = cpu_to_le32(
489 lock_buffer(bh);
490 BHDR(bh)->h_refcount = cpu_to_le32(
491 le32_to_cpu(BHDR(bh)->h_refcount) - 1); 495 le32_to_cpu(BHDR(bh)->h_refcount) - 1);
492 ext4_journal_dirty_metadata(handle, bh); 496 error = ext4_journal_dirty_metadata(handle, bh);
493 if (IS_SYNC(inode)) 497 if (IS_SYNC(inode))
494 handle->h_sync = 1; 498 handle->h_sync = 1;
495 DQUOT_FREE_BLOCK(inode, 1); 499 DQUOT_FREE_BLOCK(inode, 1);
496 unlock_buffer(bh); 500 ea_bdebug(bh, "refcount now=%d; releasing",
497 ea_bdebug(bh, "refcount now=%d; releasing", 501 le32_to_cpu(BHDR(bh)->h_refcount));
498 le32_to_cpu(BHDR(bh)->h_refcount));
499 }
500 if (ce) 502 if (ce)
501 mb_cache_entry_release(ce); 503 mb_cache_entry_release(ce);
502 } 504 }
505 unlock_buffer(bh);
506out:
507 ext4_std_error(inode->i_sb, error);
508 return;
503} 509}
504 510
505struct ext4_xattr_info { 511struct ext4_xattr_info {
@@ -675,7 +681,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
675 struct buffer_head *new_bh = NULL; 681 struct buffer_head *new_bh = NULL;
676 struct ext4_xattr_search *s = &bs->s; 682 struct ext4_xattr_search *s = &bs->s;
677 struct mb_cache_entry *ce = NULL; 683 struct mb_cache_entry *ce = NULL;
678 int error; 684 int error = 0;
679 685
680#define header(x) ((struct ext4_xattr_header *)(x)) 686#define header(x) ((struct ext4_xattr_header *)(x))
681 687
@@ -684,16 +690,17 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
684 if (s->base) { 690 if (s->base) {
685 ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev, 691 ce = mb_cache_entry_get(ext4_xattr_cache, bs->bh->b_bdev,
686 bs->bh->b_blocknr); 692 bs->bh->b_blocknr);
693 error = ext4_journal_get_write_access(handle, bs->bh);
694 if (error)
695 goto cleanup;
696 lock_buffer(bs->bh);
697
687 if (header(s->base)->h_refcount == cpu_to_le32(1)) { 698 if (header(s->base)->h_refcount == cpu_to_le32(1)) {
688 if (ce) { 699 if (ce) {
689 mb_cache_entry_free(ce); 700 mb_cache_entry_free(ce);
690 ce = NULL; 701 ce = NULL;
691 } 702 }
692 ea_bdebug(bs->bh, "modifying in-place"); 703 ea_bdebug(bs->bh, "modifying in-place");
693 error = ext4_journal_get_write_access(handle, bs->bh);
694 if (error)
695 goto cleanup;
696 lock_buffer(bs->bh);
697 error = ext4_xattr_set_entry(i, s); 704 error = ext4_xattr_set_entry(i, s);
698 if (!error) { 705 if (!error) {
699 if (!IS_LAST_ENTRY(s->first)) 706 if (!IS_LAST_ENTRY(s->first))
@@ -713,6 +720,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
713 } else { 720 } else {
714 int offset = (char *)s->here - bs->bh->b_data; 721 int offset = (char *)s->here - bs->bh->b_data;
715 722
723 unlock_buffer(bs->bh);
724 jbd2_journal_release_buffer(handle, bs->bh);
716 if (ce) { 725 if (ce) {
717 mb_cache_entry_release(ce); 726 mb_cache_entry_release(ce);
718 ce = NULL; 727 ce = NULL;
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index ba1b37df69d5..8a05aa168616 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -70,7 +70,11 @@ static inline int pte_file(pte_t pte) { return 0; }
70 70
71#define swapper_pg_dir ((pgd_t *) NULL) 71#define swapper_pg_dir ((pgd_t *) NULL)
72 72
73#define pgtable_cache_init() do {} while(0) 73#define pgtable_cache_init() do {} while (0)
74#define arch_enter_lazy_mmu_mode() do {} while (0)
75#define arch_leave_lazy_mmu_mode() do {} while (0)
76#define arch_enter_lazy_cpu_mode() do {} while (0)
77#define arch_leave_lazy_cpu_mode() do {} while (0)
74 78
75#else /* !CONFIG_MMU */ 79#else /* !CONFIG_MMU */
76/*****************************************************************************/ 80/*****************************************************************************/
diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h
index 93e5a062df88..1bf4f7a8fbe1 100644
--- a/include/asm-sparc64/dma.h
+++ b/include/asm-sparc64/dma.h
@@ -205,10 +205,6 @@ do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
205#define for_each_dvma(dma) \ 205#define for_each_dvma(dma) \
206 for((dma) = dma_chain; (dma); (dma) = (dma)->next) 206 for((dma) = dma_chain; (dma); (dma) = (dma)->next)
207 207
208extern int get_dma_list(char *);
209extern int request_dma(unsigned int, __const__ char *);
210extern void free_dma(unsigned int);
211
212/* From PCI */ 208/* From PCI */
213 209
214#ifdef CONFIG_PCI 210#ifdef CONFIG_PCI
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index d3895873e4c7..be9509c8f8c1 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -23,8 +23,30 @@ static struct sparc_ebus_info {
23 struct ebus_dma_info info; 23 struct ebus_dma_info info;
24 unsigned int addr; 24 unsigned int addr;
25 unsigned int count; 25 unsigned int count;
26 int lock;
26} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; 27} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
27 28
29static __inline__ int request_dma(unsigned int dmanr, const char *device_id)
30{
31 if (dmanr >= PARPORT_PC_MAX_PORTS)
32 return -EINVAL;
33 if (xchg(&sparc_ebus_dmas[dmanr].lock, 1) != 0)
34 return -EBUSY;
35 return 0;
36}
37
38static __inline__ void free_dma(unsigned int dmanr)
39{
40 if (dmanr >= PARPORT_PC_MAX_PORTS) {
41 printk(KERN_WARNING "Trying to free DMA%d\n", dmanr);
42 return;
43 }
44 if (xchg(&sparc_ebus_dmas[dmanr].lock, 0) == 0) {
45 printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
46 return;
47 }
48}
49
28static __inline__ void enable_dma(unsigned int dmanr) 50static __inline__ void enable_dma(unsigned int dmanr)
29{ 51{
30 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1); 52 ebus_dma_enable(&sparc_ebus_dmas[dmanr].info, 1);
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index e57ff136ee51..1b1090a91a58 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -270,7 +270,7 @@ static inline pte_t pte_wrprotect(pte_t pte)
270 270
271static inline pte_t pte_mkread(pte_t pte) 271static inline pte_t pte_mkread(pte_t pte)
272{ 272{
273 pte_set_bits(pte, _PAGE_RW); 273 pte_set_bits(pte, _PAGE_USER);
274 return(pte_mknewprot(pte)); 274 return(pte_mknewprot(pte));
275} 275}
276 276
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 37f9279192a9..3bef961b58b1 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -140,6 +140,7 @@ struct hrtimer_sleeper {
140 140
141/** 141/**
142 * struct hrtimer_base - the timer base for a specific clock 142 * struct hrtimer_base - the timer base for a specific clock
143 * @cpu_base: per cpu clock base
143 * @index: clock type index for per_cpu support when moving a 144 * @index: clock type index for per_cpu support when moving a
144 * timer to a base on another cpu. 145 * timer to a base on another cpu.
145 * @active: red black tree root node for the active timers 146 * @active: red black tree root node for the active timers
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index a60995afe334..3f3e7a648da3 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -4,6 +4,7 @@
4#ifdef CONFIG_HUGETLB_PAGE 4#ifdef CONFIG_HUGETLB_PAGE
5 5
6#include <linux/mempolicy.h> 6#include <linux/mempolicy.h>
7#include <linux/shm.h>
7#include <asm/tlbflush.h> 8#include <asm/tlbflush.h>
8 9
9struct ctl_table; 10struct ctl_table;
@@ -168,7 +169,12 @@ void hugetlb_put_quota(struct address_space *mapping);
168 169
169static inline int is_file_hugepages(struct file *file) 170static inline int is_file_hugepages(struct file *file)
170{ 171{
171 return file->f_op == &hugetlbfs_file_operations; 172 if (file->f_op == &hugetlbfs_file_operations)
173 return 1;
174 if (is_file_shm_hugepages(file))
175 return 1;
176
177 return 0;
172} 178}
173 179
174static inline void set_file_hugepages(struct file *file) 180static inline void set_file_hugepages(struct file *file)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index b0a44b8e0281..a6899402b522 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -18,6 +18,7 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/irqreturn.h> 20#include <linux/irqreturn.h>
21#include <linux/errno.h>
21 22
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
diff --git a/include/linux/isdn/capiutil.h b/include/linux/isdn/capiutil.h
index 2e79f816703b..63bd9cf821a7 100644
--- a/include/linux/isdn/capiutil.h
+++ b/include/linux/isdn/capiutil.h
@@ -174,9 +174,26 @@ char *capi_info2str(__u16 reason);
174/* 174/*
175 * Debugging / Tracing functions 175 * Debugging / Tracing functions
176 */ 176 */
177
177char *capi_cmd2str(__u8 cmd, __u8 subcmd); 178char *capi_cmd2str(__u8 cmd, __u8 subcmd);
178char *capi_cmsg2str(_cmsg * cmsg); 179
179char *capi_message2str(__u8 * msg); 180typedef struct {
181 u_char *buf;
182 u_char *p;
183 size_t size;
184 size_t pos;
185} _cdebbuf;
186
187#define CDEBUG_SIZE 1024
188#define CDEBUG_GSIZE 4096
189
190_cdebbuf *cdebbuf_alloc(void);
191void cdebbuf_free(_cdebbuf *cdb);
192int cdebug_init(void);
193void cdebug_exit(void);
194
195_cdebbuf *capi_cmsg2str(_cmsg *cmsg);
196_cdebbuf *capi_message2str(__u8 *msg);
180 197
181/*-----------------------------------------------------------------------*/ 198/*-----------------------------------------------------------------------*/
182 199
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a0eec16eb0bd..60e0e4a592d2 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -660,15 +660,11 @@ static inline int page_mapped(struct page *page)
660extern void show_free_areas(void); 660extern void show_free_areas(void);
661 661
662#ifdef CONFIG_SHMEM 662#ifdef CONFIG_SHMEM
663struct page *shmem_nopage(struct vm_area_struct *vma,
664 unsigned long address, int *type);
665int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new); 663int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new);
666struct mempolicy *shmem_get_policy(struct vm_area_struct *vma, 664struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
667 unsigned long addr); 665 unsigned long addr);
668int shmem_lock(struct file *file, int lock, struct user_struct *user); 666int shmem_lock(struct file *file, int lock, struct user_struct *user);
669#else 667#else
670#define shmem_nopage filemap_nopage
671
672static inline int shmem_lock(struct file *file, int lock, 668static inline int shmem_lock(struct file *file, int lock,
673 struct user_struct *user) 669 struct user_struct *user)
674{ 670{
@@ -688,7 +684,6 @@ static inline struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
688} 684}
689#endif 685#endif
690struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 686struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags);
691extern int shmem_mmap(struct file *file, struct vm_area_struct *vma);
692 687
693int shmem_zero_setup(struct vm_area_struct *); 688int shmem_zero_setup(struct vm_area_struct *);
694 689
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 350878a2d848..9cd0d0eaf523 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -76,7 +76,7 @@
76#define PG_active 6 76#define PG_active 6
77#define PG_slab 7 /* slab debug (Suparna wants this) */ 77#define PG_slab 7 /* slab debug (Suparna wants this) */
78 78
79#define PG_checked 8 /* kill me in 2.5.<early>. */ 79#define PG_owner_priv_1 8 /* Owner use. If pagecache, fs may use*/
80#define PG_arch_1 9 80#define PG_arch_1 9
81#define PG_reserved 10 81#define PG_reserved 10
82#define PG_private 11 /* If pagecache, has fs-private data */ 82#define PG_private 11 /* If pagecache, has fs-private data */
@@ -91,6 +91,8 @@
91#define PG_nosave_free 18 /* Used for system suspend/resume */ 91#define PG_nosave_free 18 /* Used for system suspend/resume */
92#define PG_buddy 19 /* Page is free, on buddy lists */ 92#define PG_buddy 19 /* Page is free, on buddy lists */
93 93
94/* PG_owner_priv_1 users should have descriptive aliases */
95#define PG_checked PG_owner_priv_1 /* Used by some filesystems */
94 96
95#if (BITS_PER_LONG > 32) 97#if (BITS_PER_LONG > 32)
96/* 98/*
diff --git a/include/linux/shm.h b/include/linux/shm.h
index a2c896ad0bef..ad2e3af65997 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -96,12 +96,17 @@ struct shmid_kernel /* private to the kernel */
96 96
97#ifdef CONFIG_SYSVIPC 97#ifdef CONFIG_SYSVIPC
98long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); 98long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
99extern int is_file_shm_hugepages(struct file *file);
99#else 100#else
100static inline long do_shmat(int shmid, char __user *shmaddr, 101static inline long do_shmat(int shmid, char __user *shmaddr,
101 int shmflg, unsigned long *addr) 102 int shmflg, unsigned long *addr)
102{ 103{
103 return -ENOSYS; 104 return -ENOSYS;
104} 105}
106static inline int is_file_shm_hugepages(struct file *file)
107{
108 return 0;
109}
105#endif 110#endif
106 111
107#endif /* __KERNEL__ */ 112#endif /* __KERNEL__ */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 28157a36e6cc..fcd35a210e7f 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -16,7 +16,7 @@ struct __kernel_sockaddr_storage {
16 /* _SS_MAXSIZE value minus size of ss_family */ 16 /* _SS_MAXSIZE value minus size of ss_family */
17} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */ 17} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
18 18
19#ifdef __KERNEL__ 19#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
20 20
21#include <asm/socket.h> /* arch-dependent defines */ 21#include <asm/socket.h> /* arch-dependent defines */
22#include <linux/sockios.h> /* the SIOCxxx I/O controls */ 22#include <linux/sockios.h> /* the SIOCxxx I/O controls */
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 4f8539ccff6c..679ef0d70b6b 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -7,7 +7,7 @@
7 7
8#endif 8#endif
9 9
10#ifdef __KERNEL__ 10#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
11 11
12#define S_IFMT 00170000 12#define S_IFMT 00170000
13#define S_IFSOCK 0140000 13#define S_IFSOCK 0140000
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 21805b500aa2..523405e1e1f6 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -211,9 +211,8 @@ static inline int sysfs_add_file_to_group(struct kobject *kobj,
211} 211}
212 212
213static inline void sysfs_remove_file_from_group(struct kobject *kobj, 213static inline void sysfs_remove_file_from_group(struct kobject *kobj,
214 const struct attribute *attr, const char *group); 214 const struct attribute *attr, const char *group)
215{ 215{
216 ;
217} 216}
218 217
219static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) 218static inline void sysfs_notify(struct kobject * k, char *dir, char *attr)
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 65a165f918c9..441b877bf150 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1193,6 +1193,55 @@ struct v4l2_audioout
1193}; 1193};
1194 1194
1195/* 1195/*
1196 * M P E G S E R V I C E S
1197 *
1198 * NOTE: EXPERIMENTAL API
1199 */
1200#if 1
1201#define V4L2_ENC_IDX_FRAME_I (0)
1202#define V4L2_ENC_IDX_FRAME_P (1)
1203#define V4L2_ENC_IDX_FRAME_B (2)
1204#define V4L2_ENC_IDX_FRAME_MASK (0xf)
1205
1206struct v4l2_enc_idx_entry {
1207 __u64 offset;
1208 __u64 pts;
1209 __u32 length;
1210 __u32 flags;
1211 __u32 reserved[2];
1212};
1213
1214#define V4L2_ENC_IDX_ENTRIES (64)
1215struct v4l2_enc_idx {
1216 __u32 entries;
1217 __u32 entries_cap;
1218 __u32 reserved[4];
1219 struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
1220};
1221
1222
1223#define V4L2_ENC_CMD_START (0)
1224#define V4L2_ENC_CMD_STOP (1)
1225#define V4L2_ENC_CMD_PAUSE (2)
1226#define V4L2_ENC_CMD_RESUME (3)
1227
1228/* Flags for V4L2_ENC_CMD_STOP */
1229#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
1230
1231struct v4l2_encoder_cmd {
1232 __u32 cmd;
1233 __u32 flags;
1234 union {
1235 struct {
1236 __u32 data[8];
1237 } raw;
1238 };
1239};
1240
1241#endif
1242
1243
1244/*
1196 * D A T A S E R V I C E S ( V B I ) 1245 * D A T A S E R V I C E S ( V B I )
1197 * 1246 *
1198 * Data services API by Michael Schimek 1247 * Data services API by Michael Schimek
@@ -1303,13 +1352,21 @@ struct v4l2_streamparm
1303 1352
1304/* 1353/*
1305 * A D V A N C E D D E B U G G I N G 1354 * A D V A N C E D D E B U G G I N G
1355 *
1356 * NOTE: EXPERIMENTAL API
1306 */ 1357 */
1307 1358
1308/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1359/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
1360
1361#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
1362#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */
1363#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1364
1309struct v4l2_register { 1365struct v4l2_register {
1366 __u32 match_type; /* Match type */
1367 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1310 __u64 reg; 1368 __u64 reg;
1311 __u32 i2c_id; /* I2C driver ID of the I2C chip, or 0 for the host */ 1369 __u64 val;
1312 __u32 val;
1313}; 1370};
1314 1371
1315/* 1372/*
@@ -1378,10 +1435,14 @@ struct v4l2_register {
1378#if 1 1435#if 1
1379#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 1436#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum)
1380#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) 1437#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum)
1438#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx)
1439#define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd)
1440#define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd)
1441
1442/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1443#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register)
1444#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register)
1381#endif 1445#endif
1382/* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1383#define VIDIOC_DBG_S_REGISTER _IOW ('d', 100, struct v4l2_register)
1384#define VIDIOC_DBG_G_REGISTER _IOWR('d', 101, struct v4l2_register)
1385 1446
1386#ifdef __OLD_VIDIOC_ 1447#ifdef __OLD_VIDIOC_
1387/* for compatibility, will go away some day */ 1448/* for compatibility, will go away some day */
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index fc35e6bdfb93..0c78f7f4a976 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -84,7 +84,7 @@ static inline void wait_on_inode(struct inode *inode)
84int wakeup_pdflush(long nr_pages); 84int wakeup_pdflush(long nr_pages);
85void laptop_io_completion(void); 85void laptop_io_completion(void);
86void laptop_sync_completion(void); 86void laptop_sync_completion(void);
87void throttle_vm_writeout(void); 87void throttle_vm_writeout(gfp_t gfp_mask);
88 88
89/* These are exported to sysctl. */ 89/* These are exported to sysctl. */
90extern int dirty_background_ratio; 90extern int dirty_background_ratio;
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 244e440edb53..6eaeec98ed89 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -94,6 +94,14 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
94 94
95/* ------------------------------------------------------------------------- */ 95/* ------------------------------------------------------------------------- */
96 96
97/* Register/chip ident helper function */
98
99struct i2c_client; /* forward reference */
100int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id);
101int v4l2_chip_match_host(u32 id_type, u32 chip_id);
102
103/* ------------------------------------------------------------------------- */
104
97/* Internal ioctls */ 105/* Internal ioctls */
98 106
99/* VIDIOC_INT_DECODE_VBI_LINE */ 107/* VIDIOC_INT_DECODE_VBI_LINE */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index aeec56992ef5..1dd3d3239ecf 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -271,6 +271,12 @@ struct video_device
271 struct v4l2_jpegcompression *a); 271 struct v4l2_jpegcompression *a);
272 int (*vidioc_s_jpegcomp) (struct file *file, void *fh, 272 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
273 struct v4l2_jpegcompression *a); 273 struct v4l2_jpegcompression *a);
274 int (*vidioc_g_enc_index) (struct file *file, void *fh,
275 struct v4l2_enc_idx *a);
276 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
277 struct v4l2_encoder_cmd *a);
278 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
279 struct v4l2_encoder_cmd *a);
274 280
275 /* Stream type-dependent parameter ioctls */ 281 /* Stream type-dependent parameter ioctls */
276 int (*vidioc_g_parm) (struct file *file, void *fh, 282 int (*vidioc_g_parm) (struct file *file, void *fh,
diff --git a/include/net/sock.h b/include/net/sock.h
index 03684e702d13..2c7d60ca3548 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1278,7 +1278,7 @@ static inline int sock_writeable(const struct sock *sk)
1278 1278
1279static inline gfp_t gfp_any(void) 1279static inline gfp_t gfp_any(void)
1280{ 1280{
1281 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; 1281 return in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
1282} 1282}
1283 1283
1284static inline long sock_rcvtimeo(const struct sock *sk, int noblock) 1284static inline long sock_rcvtimeo(const struct sock *sk, int noblock)
diff --git a/ipc/shm.c b/ipc/shm.c
index eb57e2254304..4fefbad7096d 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -226,8 +226,8 @@ static void shm_close(struct vm_area_struct *vma)
226 mutex_unlock(&shm_ids(ns).mutex); 226 mutex_unlock(&shm_ids(ns).mutex);
227} 227}
228 228
229struct page *shm_nopage(struct vm_area_struct *vma, unsigned long address, 229static struct page *shm_nopage(struct vm_area_struct *vma,
230 int *type) 230 unsigned long address, int *type)
231{ 231{
232 struct file *file = vma->vm_file; 232 struct file *file = vma->vm_file;
233 struct shm_file_data *sfd = shm_file_data(file); 233 struct shm_file_data *sfd = shm_file_data(file);
@@ -285,21 +285,41 @@ static int shm_release(struct inode *ino, struct file *file)
285 return 0; 285 return 0;
286} 286}
287 287
288#ifndef CONFIG_MMU 288static int shm_fsync(struct file *file, struct dentry *dentry, int datasync)
289{
290 int (*fsync) (struct file *, struct dentry *, int datasync);
291 struct shm_file_data *sfd = shm_file_data(file);
292 int ret = -EINVAL;
293
294 fsync = sfd->file->f_op->fsync;
295 if (fsync)
296 ret = fsync(sfd->file, sfd->file->f_path.dentry, datasync);
297 return ret;
298}
299
289static unsigned long shm_get_unmapped_area(struct file *file, 300static unsigned long shm_get_unmapped_area(struct file *file,
290 unsigned long addr, unsigned long len, unsigned long pgoff, 301 unsigned long addr, unsigned long len, unsigned long pgoff,
291 unsigned long flags) 302 unsigned long flags)
292{ 303{
293 struct shm_file_data *sfd = shm_file_data(file); 304 struct shm_file_data *sfd = shm_file_data(file);
294 return sfd->file->f_op->get_unmapped_area(sfd->file, addr, len, pgoff, 305 return get_unmapped_area(sfd->file, addr, len, pgoff, flags);
295 flags); 306}
307
308int is_file_shm_hugepages(struct file *file)
309{
310 int ret = 0;
311
312 if (file->f_op == &shm_file_operations) {
313 struct shm_file_data *sfd;
314 sfd = shm_file_data(file);
315 ret = is_file_hugepages(sfd->file);
316 }
317 return ret;
296} 318}
297#else
298#define shm_get_unmapped_area NULL
299#endif
300 319
301static const struct file_operations shm_file_operations = { 320static const struct file_operations shm_file_operations = {
302 .mmap = shm_mmap, 321 .mmap = shm_mmap,
322 .fsync = shm_fsync,
303 .release = shm_release, 323 .release = shm_release,
304 .get_unmapped_area = shm_get_unmapped_area, 324 .get_unmapped_area = shm_get_unmapped_area,
305}; 325};
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index a08a17218dfa..8dc24c92dc6d 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2602,7 +2602,7 @@ out_restore:
2602 raw_local_irq_restore(flags); 2602 raw_local_irq_restore(flags);
2603} 2603}
2604 2604
2605void __init lockdep_init(void) 2605void lockdep_init(void)
2606{ 2606{
2607 int i; 2607 int i;
2608 2608
diff --git a/kernel/relay.c b/kernel/relay.c
index ef8a935710a2..577f251c7e28 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -474,13 +474,12 @@ static void setup_callbacks(struct rchan *chan,
474} 474}
475 475
476/** 476/**
477 *
478 * relay_hotcpu_callback - CPU hotplug callback 477 * relay_hotcpu_callback - CPU hotplug callback
479 * @nb: notifier block 478 * @nb: notifier block
480 * @action: hotplug action to take 479 * @action: hotplug action to take
481 * @hcpu: CPU number 480 * @hcpu: CPU number
482 * 481 *
483 * Returns the success/failure of the operation. (NOTIFY_OK, NOTIFY_BAD) 482 * Returns the success/failure of the operation. (%NOTIFY_OK, %NOTIFY_BAD)
484 */ 483 */
485static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb, 484static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb,
486 unsigned long action, 485 unsigned long action,
diff --git a/kernel/sched.c b/kernel/sched.c
index 0dc757246d89..5f102e6c7a4c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3547,7 +3547,7 @@ need_resched_nonpreemptible:
3547 } 3547 }
3548 } 3548 }
3549 next->sleep_type = SLEEP_NORMAL; 3549 next->sleep_type = SLEEP_NORMAL;
3550 if (dependent_sleeper(cpu, rq, next)) 3550 if (rq->nr_running == 1 && dependent_sleeper(cpu, rq, next))
3551 next = rq->idle; 3551 next = rq->idle;
3552switch_tasks: 3552switch_tasks:
3553 if (next == rq->idle) 3553 if (next == rq->idle)
@@ -3566,7 +3566,7 @@ switch_tasks:
3566 3566
3567 sched_info_switch(prev, next); 3567 sched_info_switch(prev, next);
3568 if (likely(prev != next)) { 3568 if (likely(prev != next)) {
3569 next->timestamp = now; 3569 next->timestamp = next->last_ran = now;
3570 rq->nr_switches++; 3570 rq->nr_switches++;
3571 rq->curr = next; 3571 rq->curr = next;
3572 ++*switch_count; 3572 ++*switch_count;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 3ca1d5ff0319..34b2301276ce 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1359,8 +1359,7 @@ void unregister_sysctl_table(struct ctl_table_header * header)
1359} 1359}
1360 1360
1361#else /* !CONFIG_SYSCTL */ 1361#else /* !CONFIG_SYSCTL */
1362struct ctl_table_header * register_sysctl_table(ctl_table * table, 1362struct ctl_table_header *register_sysctl_table(ctl_table * table)
1363 int insert_at_head)
1364{ 1363{
1365 return NULL; 1364 return NULL;
1366} 1365}
diff --git a/kernel/timer.c b/kernel/timer.c
index cb1b86a9c52f..6663a87f7304 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -711,6 +711,7 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now,
711 711
712/** 712/**
713 * next_timer_interrupt - return the jiffy of the next pending timer 713 * next_timer_interrupt - return the jiffy of the next pending timer
714 * @now: current time (in jiffies)
714 */ 715 */
715unsigned long get_next_timer_interrupt(unsigned long now) 716unsigned long get_next_timer_interrupt(unsigned long now)
716{ 717{
@@ -908,7 +909,7 @@ static inline void change_clocksource(void) { }
908#endif 909#endif
909 910
910/** 911/**
911 * timeofday_is_continuous - check to see if timekeeping is free running 912 * timekeeping_is_continuous - check to see if timekeeping is free running
912 */ 913 */
913int timekeeping_is_continuous(void) 914int timekeeping_is_continuous(void)
914{ 915{
diff --git a/lib/bitmap.c b/lib/bitmap.c
index ee6e58fce8f7..26ebafa8c41d 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -97,10 +97,10 @@ EXPORT_SYMBOL(__bitmap_complement);
97 97
98/** 98/**
99 * __bitmap_shift_right - logical right shift of the bits in a bitmap 99 * __bitmap_shift_right - logical right shift of the bits in a bitmap
100 * @dst - destination bitmap 100 * @dst : destination bitmap
101 * @src - source bitmap 101 * @src : source bitmap
102 * @nbits - shift by this many bits 102 * @shift : shift by this many bits
103 * @bits - bitmap size, in bits 103 * @bits : bitmap size, in bits
104 * 104 *
105 * Shifting right (dividing) means moving bits in the MS -> LS bit 105 * Shifting right (dividing) means moving bits in the MS -> LS bit
106 * direction. Zeros are fed into the vacated MS positions and the 106 * direction. Zeros are fed into the vacated MS positions and the
@@ -141,10 +141,10 @@ EXPORT_SYMBOL(__bitmap_shift_right);
141 141
142/** 142/**
143 * __bitmap_shift_left - logical left shift of the bits in a bitmap 143 * __bitmap_shift_left - logical left shift of the bits in a bitmap
144 * @dst - destination bitmap 144 * @dst : destination bitmap
145 * @src - source bitmap 145 * @src : source bitmap
146 * @nbits - shift by this many bits 146 * @shift : shift by this many bits
147 * @bits - bitmap size, in bits 147 * @bits : bitmap size, in bits
148 * 148 *
149 * Shifting left (multiplying) means moving bits in the LS -> MS 149 * Shifting left (multiplying) means moving bits in the LS -> MS
150 * direction. Zeros are fed into the vacated LS bit positions 150 * direction. Zeros are fed into the vacated LS bit positions
diff --git a/mm/mmap.c b/mm/mmap.c
index eb509ae76553..84f997da78d7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -299,6 +299,8 @@ static int browse_rb(struct rb_root *root)
299 printk("vm_end %lx < vm_start %lx\n", vma->vm_end, vma->vm_start); 299 printk("vm_end %lx < vm_start %lx\n", vma->vm_end, vma->vm_start);
300 i++; 300 i++;
301 pn = nd; 301 pn = nd;
302 prev = vma->vm_start;
303 pend = vma->vm_end;
302 } 304 }
303 j = 0; 305 j = 0;
304 for (nd = pn; nd; nd = rb_prev(nd)) { 306 for (nd = pn; nd; nd = rb_prev(nd)) {
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index f7e088f5a309..f469e3cd08e8 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -296,11 +296,21 @@ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
296} 296}
297EXPORT_SYMBOL(balance_dirty_pages_ratelimited_nr); 297EXPORT_SYMBOL(balance_dirty_pages_ratelimited_nr);
298 298
299void throttle_vm_writeout(void) 299void throttle_vm_writeout(gfp_t gfp_mask)
300{ 300{
301 long background_thresh; 301 long background_thresh;
302 long dirty_thresh; 302 long dirty_thresh;
303 303
304 if ((gfp_mask & (__GFP_FS|__GFP_IO)) != (__GFP_FS|__GFP_IO)) {
305 /*
306 * The caller might hold locks which can prevent IO completion
307 * or progress in the filesystem. So we cannot just sit here
308 * waiting for IO to complete.
309 */
310 congestion_wait(WRITE, HZ/10);
311 return;
312 }
313
304 for ( ; ; ) { 314 for ( ; ; ) {
305 get_dirty_limits(&background_thresh, &dirty_thresh, NULL); 315 get_dirty_limits(&background_thresh, &dirty_thresh, NULL);
306 316
@@ -317,7 +327,6 @@ void throttle_vm_writeout(void)
317 } 327 }
318} 328}
319 329
320
321/* 330/*
322 * writeback at least _min_pages, and keep writing until the amount of dirty 331 * writeback at least _min_pages, and keep writing until the amount of dirty
323 * memory is less than the background threshold, or until we're all clean. 332 * memory is less than the background threshold, or until we're all clean.
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 41737395bbcc..353ce9039a86 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -600,7 +600,7 @@ static int prep_new_page(struct page *page, int order, gfp_t gfp_flags)
600 600
601 page->flags &= ~(1 << PG_uptodate | 1 << PG_error | 601 page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
602 1 << PG_referenced | 1 << PG_arch_1 | 602 1 << PG_referenced | 1 << PG_arch_1 |
603 1 << PG_checked | 1 << PG_mappedtodisk); 603 1 << PG_owner_priv_1 | 1 << PG_mappedtodisk);
604 set_page_private(page, 0); 604 set_page_private(page, 0);
605 set_page_refcounted(page); 605 set_page_refcounted(page);
606 606
diff --git a/mm/rmap.c b/mm/rmap.c
index 669acb22b572..22ed3f71a674 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -183,7 +183,7 @@ void __init anon_vma_init(void)
183 */ 183 */
184static struct anon_vma *page_lock_anon_vma(struct page *page) 184static struct anon_vma *page_lock_anon_vma(struct page *page)
185{ 185{
186 struct anon_vma *anon_vma = NULL; 186 struct anon_vma *anon_vma;
187 unsigned long anon_mapping; 187 unsigned long anon_mapping;
188 188
189 rcu_read_lock(); 189 rcu_read_lock();
@@ -195,9 +195,16 @@ static struct anon_vma *page_lock_anon_vma(struct page *page)
195 195
196 anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON); 196 anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON);
197 spin_lock(&anon_vma->lock); 197 spin_lock(&anon_vma->lock);
198 return anon_vma;
198out: 199out:
199 rcu_read_unlock(); 200 rcu_read_unlock();
200 return anon_vma; 201 return NULL;
202}
203
204static void page_unlock_anon_vma(struct anon_vma *anon_vma)
205{
206 spin_unlock(&anon_vma->lock);
207 rcu_read_unlock();
201} 208}
202 209
203/* 210/*
@@ -333,7 +340,8 @@ static int page_referenced_anon(struct page *page)
333 if (!mapcount) 340 if (!mapcount)
334 break; 341 break;
335 } 342 }
336 spin_unlock(&anon_vma->lock); 343
344 page_unlock_anon_vma(anon_vma);
337 return referenced; 345 return referenced;
338} 346}
339 347
@@ -802,7 +810,8 @@ static int try_to_unmap_anon(struct page *page, int migration)
802 if (ret == SWAP_FAIL || !page_mapped(page)) 810 if (ret == SWAP_FAIL || !page_mapped(page))
803 break; 811 break;
804 } 812 }
805 spin_unlock(&anon_vma->lock); 813
814 page_unlock_anon_vma(anon_vma);
806 return ret; 815 return ret;
807} 816}
808 817
diff --git a/mm/shmem.c b/mm/shmem.c
index 882053031aa0..fcb07882c8e0 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1228,7 +1228,8 @@ failed:
1228 return error; 1228 return error;
1229} 1229}
1230 1230
1231struct page *shmem_nopage(struct vm_area_struct *vma, unsigned long address, int *type) 1231static struct page *shmem_nopage(struct vm_area_struct *vma,
1232 unsigned long address, int *type)
1232{ 1233{
1233 struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 1234 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
1234 struct page *page = NULL; 1235 struct page *page = NULL;
@@ -1335,7 +1336,7 @@ out_nomem:
1335 return retval; 1336 return retval;
1336} 1337}
1337 1338
1338int shmem_mmap(struct file *file, struct vm_area_struct *vma) 1339static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
1339{ 1340{
1340 file_accessed(file); 1341 file_accessed(file);
1341 vma->vm_ops = &shmem_vm_ops; 1342 vma->vm_ops = &shmem_vm_ops;
diff --git a/mm/slab.c b/mm/slab.c
index 8fdaffa717ea..57f7aa420064 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4026,7 +4026,7 @@ void drain_array(struct kmem_cache *cachep, struct kmem_list3 *l3,
4026 4026
4027/** 4027/**
4028 * cache_reap - Reclaim memory from caches. 4028 * cache_reap - Reclaim memory from caches.
4029 * @unused: unused parameter 4029 * @w: work descriptor
4030 * 4030 *
4031 * Called from workqueue/eventd every few seconds. 4031 * Called from workqueue/eventd every few seconds.
4032 * Purpose: 4032 * Purpose:
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c
index c7f6e1914bc4..8803471593fd 100644
--- a/mm/tiny-shmem.c
+++ b/mm/tiny-shmem.c
@@ -126,6 +126,7 @@ int shmem_unuse(swp_entry_t entry, struct page *page)
126 return 0; 126 return 0;
127} 127}
128 128
129#if 0
129int shmem_mmap(struct file *file, struct vm_area_struct *vma) 130int shmem_mmap(struct file *file, struct vm_area_struct *vma)
130{ 131{
131 file_accessed(file); 132 file_accessed(file);
@@ -135,6 +136,7 @@ int shmem_mmap(struct file *file, struct vm_area_struct *vma)
135 return 0; 136 return 0;
136#endif 137#endif
137} 138}
139#endif /* 0 */
138 140
139#ifndef CONFIG_MMU 141#ifndef CONFIG_MMU
140unsigned long shmem_get_unmapped_area(struct file *file, 142unsigned long shmem_get_unmapped_area(struct file *file,
diff --git a/mm/truncate.c b/mm/truncate.c
index ebf3fcb4115b..0f4b6d18ab0e 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -375,10 +375,10 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
375 375
376 pagevec_init(&pvec, 0); 376 pagevec_init(&pvec, 0);
377 next = start; 377 next = start;
378 while (next <= end && !ret && !wrapped && 378 while (next <= end && !wrapped &&
379 pagevec_lookup(&pvec, mapping, next, 379 pagevec_lookup(&pvec, mapping, next,
380 min(end - next, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) { 380 min(end - next, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {
381 for (i = 0; !ret && i < pagevec_count(&pvec); i++) { 381 for (i = 0; i < pagevec_count(&pvec); i++) {
382 struct page *page = pvec.pages[i]; 382 struct page *page = pvec.pages[i];
383 pgoff_t page_index; 383 pgoff_t page_index;
384 384
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0655d5fe73e8..db023e2ff385 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -952,7 +952,7 @@ static unsigned long shrink_zone(int priority, struct zone *zone,
952 } 952 }
953 } 953 }
954 954
955 throttle_vm_writeout(); 955 throttle_vm_writeout(sc->gfp_mask);
956 956
957 atomic_dec(&zone->reclaim_in_progress); 957 atomic_dec(&zone->reclaim_in_progress);
958 return nr_reclaimed; 958 return nr_reclaimed;
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index 3ab153d3c508..147015fe5c75 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -291,12 +291,11 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
291 if (!capable(CAP_NET_ADMIN)) 291 if (!capable(CAP_NET_ADMIN))
292 return -EPERM; 292 return -EPERM;
293 293
294 spin_lock_bh(&br->lock);
295 if ((p = br_get_port(br, args[1])) == NULL) 294 if ((p = br_get_port(br, args[1])) == NULL)
296 ret = -EINVAL; 295 ret = -EINVAL;
297 else 296 else
298 br_stp_set_path_cost(p, args[2]); 297 br_stp_set_path_cost(p, args[2]);
299 spin_unlock_bh(&br->lock); 298
300 return ret; 299 return ret;
301 } 300 }
302 301
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f89ff151cfab..820761f9eeef 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2037,7 +2037,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
2037err: 2037err:
2038 while ((skb = segs)) { 2038 while ((skb = segs)) {
2039 segs = skb->next; 2039 segs = skb->next;
2040 kfree(skb); 2040 kfree_skb(skb);
2041 } 2041 }
2042 return ERR_PTR(err); 2042 return ERR_PTR(err);
2043} 2043}
diff --git a/net/dccp/output.c b/net/dccp/output.c
index f5c6aca1dfa4..3282f2f2291b 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -269,7 +269,7 @@ void dccp_write_xmit(struct sock *sk, int block)
269 err); 269 err);
270 } else { 270 } else {
271 dccp_pr_debug("packet discarded\n"); 271 dccp_pr_debug("packet discarded\n");
272 kfree(skb); 272 kfree_skb(skb);
273 } 273 }
274 } 274 }
275} 275}
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 30b1e520ad94..6b5c64f3c925 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -381,7 +381,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
381 if (newsk != NULL) { 381 if (newsk != NULL) {
382 const struct inet_request_sock *ireq = inet_rsk(req); 382 const struct inet_request_sock *ireq = inet_rsk(req);
383 struct tcp_request_sock *treq = tcp_rsk(req); 383 struct tcp_request_sock *treq = tcp_rsk(req);
384 struct inet_connection_sock *newicsk = inet_csk(sk); 384 struct inet_connection_sock *newicsk = inet_csk(newsk);
385 struct tcp_sock *newtp; 385 struct tcp_sock *newtp;
386 386
387 /* Now setup tcp_sock */ 387 /* Now setup tcp_sock */
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f6ac65d36559..e16f1bba5dff 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -400,6 +400,8 @@ static void dev_forward_change(struct inet6_dev *idev)
400 ipv6_dev_mc_dec(dev, &addr); 400 ipv6_dev_mc_dec(dev, &addr);
401 } 401 }
402 for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) { 402 for (ifa=idev->addr_list; ifa; ifa=ifa->if_next) {
403 if (ifa->flags&IFA_F_TENTATIVE)
404 continue;
403 if (idev->cnf.forwarding) 405 if (idev->cnf.forwarding)
404 addrconf_join_anycast(ifa); 406 addrconf_join_anycast(ifa);
405 else 407 else
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index e5ef5979ade4..09117d63256f 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -461,6 +461,7 @@ static inline struct ifacaddr6 *ac6_get_first(struct seq_file *seq)
461 break; 461 break;
462 } 462 }
463 read_unlock_bh(&idev->lock); 463 read_unlock_bh(&idev->lock);
464 in6_dev_put(idev);
464 } 465 }
465 return im; 466 return im;
466} 467}
diff --git a/net/ipx/ChangeLog b/net/ipx/ChangeLog
deleted file mode 100644
index 3b29763751a3..000000000000
--- a/net/ipx/ChangeLog
+++ /dev/null
@@ -1,101 +0,0 @@
1 Revision 0.21: Uses the new generic socket option code.
2
3 Revision 0.22: Gcc clean ups and drop out device registration. Use the
4 new multi-protocol edition of hard_header
5
6 Revision 0.23: IPX /proc by Mark Evans. Adding a route will
7 will overwrite any existing route to the same network.
8
9 Revision 0.24: Supports new /proc with no 4K limit
10
11 Revision 0.25: Add ephemeral sockets, passive local network
12 identification, support for local net 0 and
13 multiple datalinks <Greg Page>
14
15 Revision 0.26: Device drop kills IPX routes via it. (needed for module)
16
17 Revision 0.27: Autobind <Mark Evans>
18
19 Revision 0.28: Small fix for multiple local networks <Thomas Winder>
20
21 Revision 0.29: Assorted major errors removed <Mark Evans>
22 Small correction to promisc mode error fix <Alan Cox>
23 Asynchronous I/O support. Changed to use notifiers
24 and the newer packet_type stuff. Assorted major
25 fixes <Alejandro Liu>
26
27 Revision 0.30: Moved to net/ipx/... <Alan Cox>
28 Don't set address length on recvfrom that errors.
29 Incorrect verify_area.
30
31 Revision 0.31: New sk_buffs. This still needs a lot of
32 testing. <Alan Cox>
33
34 Revision 0.32: Using sock_alloc_send_skb, firewall hooks. <Alan Cox>
35 Supports sendmsg/recvmsg
36
37 Revision 0.33: Internal network support, routing changes, uses a
38 protocol private area for ipx data.
39
40 Revision 0.34: Module support. <Jim Freeman>
41
42 Revision 0.35: Checksum support. <Neil Turton>, hooked in by <Alan Cox>
43 Handles WIN95 discovery packets <Volker Lendecke>
44
45 Revision 0.36: Internal bump up for 2.1
46
47 Revision 0.37: Began adding POSIXisms.
48
49 Revision 0.38: Asynchronous socket stuff made current.
50
51 Revision 0.39: SPX interfaces
52
53 Revision 0.40: Tiny SIOCGSTAMP fix (chris@cybernet.co.nz)
54
55 Revision 0.41: 802.2TR removed (p.norton@computer.org)
56 Fixed connecting to primary net,
57 Automatic binding on send & receive,
58 Martijn van Oosterhout <kleptogimp@geocities.com>
59
60 Revision 042: Multithreading - use spinlocks and refcounting to
61 protect some structures: ipx_interface sock list, list
62 of ipx interfaces, etc.
63 Bugfixes - do refcounting on net_devices, check function
64 results, etc. Thanks to davem and freitag for
65 suggestions and guidance.
66 Arnaldo Carvalho de Melo <acme@conectiva.com.br>,
67 November, 2000
68
69 Revision 043: Shared SKBs, don't mangle packets, some cleanups
70 Arnaldo Carvalho de Melo <acme@conectiva.com.br>,
71 December, 2000
72
73 Revision 044: Call ipxitf_hold on NETDEV_UP - acme
74
75 Revision 045: fix PPROP routing bug - acme
76
77 Revision 046: Further fixes to PPROP, ipxitf_create_internal was
78 doing an unneeded MOD_INC_USE_COUNT, implement
79 sysctl for ipx_pprop_broacasting, fix the ipx sysctl
80 handling, making it dynamic, some cleanups, thanks to
81 Petr Vandrovec for review and good suggestions. (acme)
82
83 Revision 047: Cleanups, CodingStyle changes, move the ncp connection
84 hack out of line - acme
85
86 Revision 048: Use sk->protinfo to store the pointer to IPX private
87 area, remove af_ipx from sk->protinfo and move ipx_opt
88 to include/net/ipx.h, use IPX_SK like DecNET, etc - acme
89
90 Revision 049: SPX support dropped, see comment in ipx_create - acme
91
92 Revision 050: Use seq_file for proc stuff, moving it to ipx_proc.c - acme
93
94Other fixes:
95
96 Protect the module by a MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT pair. Also, now
97 usage count is managed this way:
98 -Count one if the auto_interface mode is on
99 -Count one per configured interface
100
101 Jacques Gelinas (jacques@solucorp.qc.ca)
diff --git a/net/ipx/Kconfig b/net/ipx/Kconfig
index 980a826f5d02..e9ad0062fbb6 100644
--- a/net/ipx/Kconfig
+++ b/net/ipx/Kconfig
@@ -16,8 +16,7 @@ config IPX
16 support", below. 16 support", below.
17 17
18 IPX is similar in scope to IP, while SPX, which runs on top of IPX, 18 IPX is similar in scope to IP, while SPX, which runs on top of IPX,
19 is similar to TCP. There is also experimental support for SPX in 19 is similar to TCP.
20 Linux (see "SPX networking", below).
21 20
22 To turn your Linux box into a fully featured NetWare file server and 21 To turn your Linux box into a fully featured NetWare file server and
23 IPX router, say Y here and fetch either lwared from 22 IPX router, say Y here and fetch either lwared from
@@ -26,9 +25,6 @@ config IPX
26 information, read the IPX-HOWTO available from 25 information, read the IPX-HOWTO available from
27 <http://www.tldp.org/docs.html#howto>. 26 <http://www.tldp.org/docs.html#howto>.
28 27
29 General information about how to connect Linux, Windows machines and
30 Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>.
31
32 The IPX driver would enlarge your kernel by about 16 KB. To compile 28 The IPX driver would enlarge your kernel by about 16 KB. To compile
33 this driver as a module, choose M here: the module will be called ipx. 29 this driver as a module, choose M here: the module will be called ipx.
34 Unless you want to integrate your Linux box with a local Novell 30 Unless you want to integrate your Linux box with a local Novell
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 11d504d0ac72..bf23e489e4cd 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -197,13 +197,12 @@ EXPORT_SYMBOL_GPL(nfnetlink_has_listeners);
197 197
198int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo) 198int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
199{ 199{
200 gfp_t allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
201 int err = 0; 200 int err = 0;
202 201
203 NETLINK_CB(skb).dst_group = group; 202 NETLINK_CB(skb).dst_group = group;
204 if (echo) 203 if (echo)
205 atomic_inc(&skb->users); 204 atomic_inc(&skb->users);
206 netlink_broadcast(nfnl, skb, pid, group, allocation); 205 netlink_broadcast(nfnl, skb, pid, group, gfp_any());
207 if (echo) 206 if (echo)
208 err = netlink_unicast(nfnl, skb, pid, MSG_DONTWAIT); 207 err = netlink_unicast(nfnl, skb, pid, MSG_DONTWAIT);
209 208
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 5bc37181662e..b931edee4b8b 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -173,7 +173,7 @@ static int netlbl_unlabel_list(struct sk_buff *skb, struct genl_info *info)
173 return 0; 173 return 0;
174 174
175list_failure: 175list_failure:
176 kfree(ans_skb); 176 kfree_skb(ans_skb);
177 return ret_val; 177 return ret_val;
178} 178}
179 179
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 256745321611..956cfe0ff7f8 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1401,7 +1401,7 @@ static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
1401 1401
1402 x = xfrm_state_lookup(&id->daddr, id->spi, id->proto, id->family); 1402 x = xfrm_state_lookup(&id->daddr, id->spi, id->proto, id->family);
1403 if (x == NULL) { 1403 if (x == NULL) {
1404 kfree(r_skb); 1404 kfree_skb(r_skb);
1405 return -ESRCH; 1405 return -ESRCH;
1406 } 1406 }
1407 1407
@@ -1557,14 +1557,13 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1557 struct xfrm_usersa_info *p = &ue->state; 1557 struct xfrm_usersa_info *p = &ue->state;
1558 1558
1559 x = xfrm_state_lookup(&p->id.daddr, p->id.spi, p->id.proto, p->family); 1559 x = xfrm_state_lookup(&p->id.daddr, p->id.spi, p->id.proto, p->family);
1560 err = -ENOENT;
1561 1560
1561 err = -ENOENT;
1562 if (x == NULL) 1562 if (x == NULL)
1563 return err; 1563 return err;
1564 1564
1565 err = -EINVAL;
1566
1567 spin_lock_bh(&x->lock); 1565 spin_lock_bh(&x->lock);
1566 err = -EINVAL;
1568 if (x->km.state != XFRM_STATE_VALID) 1567 if (x->km.state != XFRM_STATE_VALID)
1569 goto out; 1568 goto out;
1570 km_state_expired(x, ue->hard, current->pid); 1569 km_state_expired(x, ue->hard, current->pid);
@@ -1574,6 +1573,7 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
1574 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, 1573 xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
1575 AUDIT_MAC_IPSEC_DELSA, 1, NULL, x); 1574 AUDIT_MAC_IPSEC_DELSA, 1, NULL, x);
1576 } 1575 }
1576 err = 0;
1577out: 1577out:
1578 spin_unlock_bh(&x->lock); 1578 spin_unlock_bh(&x->lock);
1579 xfrm_state_put(x); 1579 xfrm_state_put(x);
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index fb43c6440e54..8be269ffbf9d 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1547,7 +1547,7 @@ sub dump_function($$) {
1547 $prototype =~ s/^noinline +//; 1547 $prototype =~ s/^noinline +//;
1548 $prototype =~ s/__devinit +//; 1548 $prototype =~ s/__devinit +//;
1549 $prototype =~ s/^#define\s+//; #ak added 1549 $prototype =~ s/^#define\s+//; #ak added
1550 $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//; 1550 $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;
1551 1551
1552 # Yes, this truly is vile. We are looking for: 1552 # Yes, this truly is vile. We are looking for:
1553 # 1. Return type (may be nothing if we're looking at a macro) 1553 # 1. Return type (may be nothing if we're looking at a macro)