aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/cciss.txt5
-rw-r--r--MAINTAINERS13
-rw-r--r--arch/arm/mach-pxa/ssp.c2
-rw-r--r--arch/m68knommu/platform/coldfire/timers.c8
-rw-r--r--arch/um/os-Linux/start_up.c25
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c4
-rw-r--r--arch/x86/kernel/rtc.c34
-rw-r--r--drivers/ata/ahci.c137
-rw-r--r--drivers/block/cciss.c21
-rw-r--r--drivers/char/Kconfig8
-rw-r--r--drivers/char/agp/ati-agp.c4
-rw-r--r--drivers/char/generic_nvram.c2
-rw-r--r--drivers/char/hw_random/intel-rng.c2
-rw-r--r--drivers/char/keyboard.c7
-rw-r--r--drivers/isdn/sc/ioctl.c1
-rw-r--r--drivers/mmc/host/wbsd.c21
-rw-r--r--drivers/net/bnx2.c9
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/bnx2x.c5
-rw-r--r--drivers/net/bnx2x.h3
-rw-r--r--drivers/net/bnx2x_init.h3
-rw-r--r--drivers/net/ehea/ehea_main.c3
-rw-r--r--drivers/net/fec_mpc52xx.c2
-rw-r--r--drivers/net/hamradio/baycom_epp.c2
-rw-r--r--drivers/net/ipg.c4
-rw-r--r--drivers/net/r6040.c2
-rw-r--r--drivers/net/smc911x.c24
-rw-r--r--drivers/net/smc91x.c17
-rw-r--r--drivers/net/tulip/tulip_core.c2
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c8
-rw-r--r--drivers/rtc/Kconfig11
-rw-r--r--drivers/rtc/Makefile3
-rw-r--r--drivers/rtc/rtc-at32ap700x.c7
-rw-r--r--drivers/rtc/rtc-cmos.c31
-rw-r--r--drivers/rtc/rtc-fm3130.c501
-rw-r--r--drivers/video/cirrusfb.c6
-rw-r--r--drivers/video/hgafb.c26
-rw-r--r--drivers/video/leo.c58
-rw-r--r--drivers/video/pxafb.c6
-rw-r--r--fs/fat/file.c44
-rw-r--r--fs/proc/task_mmu.c83
-rw-r--r--include/asm-arm/arch-pxa/regs-lcd.h5
-rw-r--r--include/asm-m68k/bitops.h45
-rw-r--r--include/linux/mm.h17
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/tcp.h7
-rw-r--r--include/net/request_sock.h4
-rw-r--r--include/net/tcp.h1
-rw-r--r--ipc/shm.c16
-rw-r--r--kernel/kprobes.c15
-rw-r--r--lib/radix-tree.c120
-rw-r--r--mm/pagewalk.c42
-rw-r--r--mm/vmscan.c2
-rw-r--r--net/dccp/ackvec.c29
-rw-r--r--net/dccp/ccids/ccid3.c14
-rw-r--r--net/dccp/ccids/lib/tfrc.c8
-rw-r--r--net/dccp/ccids/lib/tfrc.h25
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c8
-rw-r--r--net/dccp/minisocks.c8
-rw-r--r--net/dccp/options.c4
-rw-r--r--net/dccp/output.c2
-rw-r--r--net/dccp/probe.c2
-rw-r--r--net/ipv4/inet_connection_sock.c11
-rw-r--r--net/ipv4/tcp.c18
-rw-r--r--net/ipv4/tcp_input.c45
-rw-r--r--net/ipv4/tcp_ipv4.c8
-rw-r--r--net/ipv4/tcp_minisocks.c32
-rw-r--r--net/ipv4/tcp_timer.c5
-rw-r--r--net/ipv6/datagram.c5
-rw-r--r--net/ipv6/ipv6_sockglue.c12
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/route.c8
-rw-r--r--net/netfilter/nf_conntrack_core.c3
-rw-r--r--net/netfilter/nf_log.c4
-rw-r--r--security/dummy.c24
77 files changed, 1200 insertions, 515 deletions
diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt
index e65736c6b8bc..63e59b8847c5 100644
--- a/Documentation/cciss.txt
+++ b/Documentation/cciss.txt
@@ -21,6 +21,11 @@ This driver is known to work with the following cards:
21 * SA E200 21 * SA E200
22 * SA E200i 22 * SA E200i
23 * SA E500 23 * SA E500
24 * SA P212
25 * SA P410
26 * SA P410i
27 * SA P411
28 * SA P812
24 29
25Detecting drive failures: 30Detecting drive failures:
26------------------------- 31-------------------------
diff --git a/MAINTAINERS b/MAINTAINERS
index 01605a9b95e7..cd587eec9fa7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -995,8 +995,8 @@ L: netdev@vger.kernel.org
995S: Supported 995S: Supported
996 996
997BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER 997BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
998P: Eliezer Tamir 998P: Eilon Greenstein
999M: eliezert@broadcom.com 999M: eilong@broadcom.com
1000L: netdev@vger.kernel.org 1000L: netdev@vger.kernel.org
1001S: Supported 1001S: Supported
1002 1002
@@ -1202,6 +1202,7 @@ M: pj@sgi.com
1202M: menage@google.com 1202M: menage@google.com
1203L: linux-kernel@vger.kernel.org 1203L: linux-kernel@vger.kernel.org
1204W: http://www.bullopensource.org/cpuset/ 1204W: http://www.bullopensource.org/cpuset/
1205W: http://oss.sgi.com/projects/cpusets/
1205S: Supported 1206S: Supported
1206 1207
1207CRAMFS FILESYSTEM 1208CRAMFS FILESYSTEM
@@ -3329,9 +3330,11 @@ L: video4linux-list@redhat.com
3329W: http://www.isely.net/pvrusb2/ 3330W: http://www.isely.net/pvrusb2/
3330S: Maintained 3331S: Maintained
3331 3332
3332PXA2xx SUPPORT 3333PXA2xx/PXA3xx SUPPORT
3333P: Nicolas Pitre 3334P: Eric Miao
3334M: nico@cam.org 3335M: eric.miao@marvell.com
3336P: Russell King
3337M: linux@arm.linux.org.uk
3335L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 3338L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
3336S: Maintained 3339S: Maintained
3337 3340
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 00af7f2fed66..0bb31982fb6f 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -330,7 +330,7 @@ struct ssp_device *ssp_request(int port, const char *label)
330 330
331 mutex_unlock(&ssp_lock); 331 mutex_unlock(&ssp_lock);
332 332
333 if (ssp->port_id != port) 333 if (&ssp->node == &ssp_list)
334 return NULL; 334 return NULL;
335 335
336 return ssp; 336 return ssp;
diff --git a/arch/m68knommu/platform/coldfire/timers.c b/arch/m68knommu/platform/coldfire/timers.c
index ba5a9f32ebd4..454f25493491 100644
--- a/arch/m68knommu/platform/coldfire/timers.c
+++ b/arch/m68knommu/platform/coldfire/timers.c
@@ -111,7 +111,13 @@ void hw_timer_init(void)
111 111
112 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 112 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
113 mcftmr_cycles_per_jiffy = FREQ / HZ; 113 mcftmr_cycles_per_jiffy = FREQ / HZ;
114 __raw_writetrr(mcftmr_cycles_per_jiffy, TA(MCFTIMER_TRR)); 114 /*
115 * The coldfire timer runs from 0 to TRR included, then 0
116 * again and so on. It counts thus actually TRR + 1 steps
117 * for 1 tick, not TRR. So if you want n cycles,
118 * initialize TRR with n - 1.
119 */
120 __raw_writetrr(mcftmr_cycles_per_jiffy - 1, TA(MCFTIMER_TRR));
115 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | 121 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
116 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR)); 122 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));
117 123
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index b4b36e0f2e89..183db26d01bf 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -121,8 +121,10 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
121{ 121{
122 int status, n, ret = 0; 122 int status, n, ret = 0;
123 123
124 if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) 124 if (ptrace(PTRACE_CONT, pid, 0, 0) < 0) {
125 fatal_perror("stop_ptraced_child : ptrace failed"); 125 perror("stop_ptraced_child : ptrace failed");
126 return -1;
127 }
126 CATCH_EINTR(n = waitpid(pid, &status, 0)); 128 CATCH_EINTR(n = waitpid(pid, &status, 0));
127 if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { 129 if (!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
128 int exit_with = WEXITSTATUS(status); 130 int exit_with = WEXITSTATUS(status);
@@ -212,7 +214,7 @@ static void __init check_sysemu(void)
212 if (n < 0) 214 if (n < 0)
213 fatal_perror("check_sysemu : wait failed"); 215 fatal_perror("check_sysemu : wait failed");
214 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP)) 216 if (!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
215 fatal("check_sysemu : expected SIGTRAP, got status = %d", 217 fatal("check_sysemu : expected SIGTRAP, got status = %d\n",
216 status); 218 status);
217 219
218 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 220 if (ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
@@ -254,9 +256,11 @@ static void __init check_sysemu(void)
254 256
255 if (WIFSTOPPED(status) && 257 if (WIFSTOPPED(status) &&
256 (WSTOPSIG(status) == (SIGTRAP|0x80))) { 258 (WSTOPSIG(status) == (SIGTRAP|0x80))) {
257 if (!count) 259 if (!count) {
258 fatal("check_ptrace : SYSEMU_SINGLESTEP " 260 non_fatal("check_ptrace : SYSEMU_SINGLESTEP "
259 "doesn't singlestep"); 261 "doesn't singlestep");
262 goto fail;
263 }
260 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, 264 n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET,
261 os_getpid()); 265 os_getpid());
262 if (n < 0) 266 if (n < 0)
@@ -266,9 +270,12 @@ static void __init check_sysemu(void)
266 } 270 }
267 else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP)) 271 else if (WIFSTOPPED(status) && (WSTOPSIG(status) == SIGTRAP))
268 count++; 272 count++;
269 else 273 else {
270 fatal("check_ptrace : expected SIGTRAP or " 274 non_fatal("check_ptrace : expected SIGTRAP or "
271 "(SIGTRAP | 0x80), got status = %d", status); 275 "(SIGTRAP | 0x80), got status = %d\n",
276 status);
277 goto fail;
278 }
272 } 279 }
273 if (stop_ptraced_child(pid, 0, 0) < 0) 280 if (stop_ptraced_child(pid, 0, 0) < 0)
274 goto fail_stopped; 281 goto fail_stopped;
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index b487cbead1bd..229f7a53d8da 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -6,7 +6,7 @@
6 6
7#include <errno.h> 7#include <errno.h>
8#include <sys/ptrace.h> 8#include <sys/ptrace.h>
9#include <asm/user.h> 9#include <sys/user.h>
10#include "kern_constants.h" 10#include "kern_constants.h"
11#include "longjmp.h" 11#include "longjmp.h"
12#include "user.h" 12#include "user.h"
@@ -76,7 +76,7 @@ int put_fp_registers(int pid, unsigned long *regs)
76 76
77void arch_init_registers(int pid) 77void arch_init_registers(int pid)
78{ 78{
79 struct user_fxsr_struct fpx_regs; 79 struct user_fpxregs_struct fpx_regs;
80 int err; 80 int err;
81 81
82 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs); 82 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs);
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 9615eee9b775..05191bbc68b8 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -4,6 +4,8 @@
4#include <linux/acpi.h> 4#include <linux/acpi.h>
5#include <linux/bcd.h> 5#include <linux/bcd.h>
6#include <linux/mc146818rtc.h> 6#include <linux/mc146818rtc.h>
7#include <linux/platform_device.h>
8#include <linux/pnp.h>
7 9
8#include <asm/time.h> 10#include <asm/time.h>
9#include <asm/vsyscall.h> 11#include <asm/vsyscall.h>
@@ -197,3 +199,35 @@ unsigned long long native_read_tsc(void)
197} 199}
198EXPORT_SYMBOL(native_read_tsc); 200EXPORT_SYMBOL(native_read_tsc);
199 201
202
203static struct resource rtc_resources[] = {
204 [0] = {
205 .start = RTC_PORT(0),
206 .end = RTC_PORT(1),
207 .flags = IORESOURCE_IO,
208 },
209 [1] = {
210 .start = RTC_IRQ,
211 .end = RTC_IRQ,
212 .flags = IORESOURCE_IRQ,
213 }
214};
215
216static struct platform_device rtc_device = {
217 .name = "rtc_cmos",
218 .id = -1,
219 .resource = rtc_resources,
220 .num_resources = ARRAY_SIZE(rtc_resources),
221};
222
223static __init int add_rtc_cmos(void)
224{
225#ifdef CONFIG_PNP
226 if (!pnp_platform_devices)
227 platform_device_register(&rtc_device);
228#else
229 platform_device_register(&rtc_device);
230#endif /* CONFIG_PNP */
231 return 0;
232}
233device_initcall(add_rtc_cmos);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 544b7d6c617c..966ab401e523 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -89,6 +89,7 @@ enum {
89 board_ahci_sb600 = 3, 89 board_ahci_sb600 = 3,
90 board_ahci_mv = 4, 90 board_ahci_mv = 4,
91 board_ahci_sb700 = 5, 91 board_ahci_sb700 = 5,
92 board_ahci_mcp65 = 6,
92 93
93 /* global controller registers */ 94 /* global controller registers */
94 HOST_CAP = 0x00, /* host capabilities */ 95 HOST_CAP = 0x00, /* host capabilities */
@@ -190,6 +191,7 @@ enum {
190 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ 191 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */
191 AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */ 192 AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */
192 AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ 193 AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */
194 AHCI_HFLAG_YES_NCQ = (1 << 9), /* force NCQ cap on */
193 195
194 /* ap->flags bits */ 196 /* ap->flags bits */
195 197
@@ -253,6 +255,8 @@ static void ahci_pmp_attach(struct ata_port *ap);
253static void ahci_pmp_detach(struct ata_port *ap); 255static void ahci_pmp_detach(struct ata_port *ap);
254static int ahci_softreset(struct ata_link *link, unsigned int *class, 256static int ahci_softreset(struct ata_link *link, unsigned int *class,
255 unsigned long deadline); 257 unsigned long deadline);
258static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
259 unsigned long deadline);
256static int ahci_hardreset(struct ata_link *link, unsigned int *class, 260static int ahci_hardreset(struct ata_link *link, unsigned int *class,
257 unsigned long deadline); 261 unsigned long deadline);
258static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, 262static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
@@ -329,6 +333,12 @@ static struct ata_port_operations ahci_p5wdh_ops = {
329 .hardreset = ahci_p5wdh_hardreset, 333 .hardreset = ahci_p5wdh_hardreset,
330}; 334};
331 335
336static struct ata_port_operations ahci_sb600_ops = {
337 .inherits = &ahci_ops,
338 .softreset = ahci_sb600_softreset,
339 .pmp_softreset = ahci_sb600_softreset,
340};
341
332#define AHCI_HFLAGS(flags) .private_data = (void *)(flags) 342#define AHCI_HFLAGS(flags) .private_data = (void *)(flags)
333 343
334static const struct ata_port_info ahci_port_info[] = { 344static const struct ata_port_info ahci_port_info[] = {
@@ -359,11 +369,11 @@ static const struct ata_port_info ahci_port_info[] = {
359 { 369 {
360 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 370 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL |
361 AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI | 371 AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
362 AHCI_HFLAG_SECT255 | AHCI_HFLAG_NO_PMP), 372 AHCI_HFLAG_SECT255),
363 .flags = AHCI_FLAG_COMMON, 373 .flags = AHCI_FLAG_COMMON,
364 .pio_mask = 0x1f, /* pio0-4 */ 374 .pio_mask = 0x1f, /* pio0-4 */
365 .udma_mask = ATA_UDMA6, 375 .udma_mask = ATA_UDMA6,
366 .port_ops = &ahci_ops, 376 .port_ops = &ahci_sb600_ops,
367 }, 377 },
368 /* board_ahci_mv */ 378 /* board_ahci_mv */
369 { 379 {
@@ -377,8 +387,15 @@ static const struct ata_port_info ahci_port_info[] = {
377 }, 387 },
378 /* board_ahci_sb700 */ 388 /* board_ahci_sb700 */
379 { 389 {
380 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 390 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL),
381 AHCI_HFLAG_NO_PMP), 391 .flags = AHCI_FLAG_COMMON,
392 .pio_mask = 0x1f, /* pio0-4 */
393 .udma_mask = ATA_UDMA6,
394 .port_ops = &ahci_sb600_ops,
395 },
396 /* board_ahci_mcp65 */
397 {
398 AHCI_HFLAGS (AHCI_HFLAG_YES_NCQ),
382 .flags = AHCI_FLAG_COMMON, 399 .flags = AHCI_FLAG_COMMON,
383 .pio_mask = 0x1f, /* pio0-4 */ 400 .pio_mask = 0x1f, /* pio0-4 */
384 .udma_mask = ATA_UDMA6, 401 .udma_mask = ATA_UDMA6,
@@ -438,14 +455,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
438 { PCI_VDEVICE(VIA, 0x6287), board_ahci_vt8251 }, /* VIA VT8251 */ 455 { PCI_VDEVICE(VIA, 0x6287), board_ahci_vt8251 }, /* VIA VT8251 */
439 456
440 /* NVIDIA */ 457 /* NVIDIA */
441 { PCI_VDEVICE(NVIDIA, 0x044c), board_ahci }, /* MCP65 */ 458 { PCI_VDEVICE(NVIDIA, 0x044c), board_ahci_mcp65 }, /* MCP65 */
442 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci }, /* MCP65 */ 459 { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci_mcp65 }, /* MCP65 */
443 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci }, /* MCP65 */ 460 { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci_mcp65 }, /* MCP65 */
444 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci }, /* MCP65 */ 461 { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci_mcp65 }, /* MCP65 */
445 { PCI_VDEVICE(NVIDIA, 0x045c), board_ahci }, /* MCP65 */ 462 { PCI_VDEVICE(NVIDIA, 0x045c), board_ahci_mcp65 }, /* MCP65 */
446 { PCI_VDEVICE(NVIDIA, 0x045d), board_ahci }, /* MCP65 */ 463 { PCI_VDEVICE(NVIDIA, 0x045d), board_ahci_mcp65 }, /* MCP65 */
447 { PCI_VDEVICE(NVIDIA, 0x045e), board_ahci }, /* MCP65 */ 464 { PCI_VDEVICE(NVIDIA, 0x045e), board_ahci_mcp65 }, /* MCP65 */
448 { PCI_VDEVICE(NVIDIA, 0x045f), board_ahci }, /* MCP65 */ 465 { PCI_VDEVICE(NVIDIA, 0x045f), board_ahci_mcp65 }, /* MCP65 */
449 { PCI_VDEVICE(NVIDIA, 0x0550), board_ahci }, /* MCP67 */ 466 { PCI_VDEVICE(NVIDIA, 0x0550), board_ahci }, /* MCP67 */
450 { PCI_VDEVICE(NVIDIA, 0x0551), board_ahci }, /* MCP67 */ 467 { PCI_VDEVICE(NVIDIA, 0x0551), board_ahci }, /* MCP67 */
451 { PCI_VDEVICE(NVIDIA, 0x0552), board_ahci }, /* MCP67 */ 468 { PCI_VDEVICE(NVIDIA, 0x0552), board_ahci }, /* MCP67 */
@@ -624,6 +641,12 @@ static void ahci_save_initial_config(struct pci_dev *pdev,
624 cap &= ~HOST_CAP_NCQ; 641 cap &= ~HOST_CAP_NCQ;
625 } 642 }
626 643
644 if (!(cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_YES_NCQ)) {
645 dev_printk(KERN_INFO, &pdev->dev,
646 "controller can do NCQ, turning on CAP_NCQ\n");
647 cap |= HOST_CAP_NCQ;
648 }
649
627 if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) { 650 if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) {
628 dev_printk(KERN_INFO, &pdev->dev, 651 dev_printk(KERN_INFO, &pdev->dev,
629 "controller can't do PMP, turning off CAP_PMP\n"); 652 "controller can't do PMP, turning off CAP_PMP\n");
@@ -1262,19 +1285,11 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp,
1262 return 0; 1285 return 0;
1263} 1286}
1264 1287
1265static int ahci_check_ready(struct ata_link *link) 1288static int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1266{ 1289 int pmp, unsigned long deadline,
1267 void __iomem *port_mmio = ahci_port_base(link->ap); 1290 int (*check_ready)(struct ata_link *link))
1268 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1269
1270 return ata_check_ready(status);
1271}
1272
1273static int ahci_softreset(struct ata_link *link, unsigned int *class,
1274 unsigned long deadline)
1275{ 1291{
1276 struct ata_port *ap = link->ap; 1292 struct ata_port *ap = link->ap;
1277 int pmp = sata_srst_pmp(link);
1278 const char *reason = NULL; 1293 const char *reason = NULL;
1279 unsigned long now, msecs; 1294 unsigned long now, msecs;
1280 struct ata_taskfile tf; 1295 struct ata_taskfile tf;
@@ -1312,7 +1327,7 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
1312 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0); 1327 ahci_exec_polled_cmd(ap, pmp, &tf, 0, 0, 0);
1313 1328
1314 /* wait for link to become ready */ 1329 /* wait for link to become ready */
1315 rc = ata_wait_after_reset(link, deadline, ahci_check_ready); 1330 rc = ata_wait_after_reset(link, deadline, check_ready);
1316 /* link occupied, -ENODEV too is an error */ 1331 /* link occupied, -ENODEV too is an error */
1317 if (rc) { 1332 if (rc) {
1318 reason = "device not ready"; 1333 reason = "device not ready";
@@ -1328,6 +1343,72 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
1328 return rc; 1343 return rc;
1329} 1344}
1330 1345
1346static int ahci_check_ready(struct ata_link *link)
1347{
1348 void __iomem *port_mmio = ahci_port_base(link->ap);
1349 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1350
1351 return ata_check_ready(status);
1352}
1353
1354static int ahci_softreset(struct ata_link *link, unsigned int *class,
1355 unsigned long deadline)
1356{
1357 int pmp = sata_srst_pmp(link);
1358
1359 DPRINTK("ENTER\n");
1360
1361 return ahci_do_softreset(link, class, pmp, deadline, ahci_check_ready);
1362}
1363
1364static int ahci_sb600_check_ready(struct ata_link *link)
1365{
1366 void __iomem *port_mmio = ahci_port_base(link->ap);
1367 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1368 u32 irq_status = readl(port_mmio + PORT_IRQ_STAT);
1369
1370 /*
1371 * There is no need to check TFDATA if BAD PMP is found due to HW bug,
1372 * which can save timeout delay.
1373 */
1374 if (irq_status & PORT_IRQ_BAD_PMP)
1375 return -EIO;
1376
1377 return ata_check_ready(status);
1378}
1379
1380static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
1381 unsigned long deadline)
1382{
1383 struct ata_port *ap = link->ap;
1384 void __iomem *port_mmio = ahci_port_base(ap);
1385 int pmp = sata_srst_pmp(link);
1386 int rc;
1387 u32 irq_sts;
1388
1389 DPRINTK("ENTER\n");
1390
1391 rc = ahci_do_softreset(link, class, pmp, deadline,
1392 ahci_sb600_check_ready);
1393
1394 /*
1395 * Soft reset fails on some ATI chips with IPMS set when PMP
1396 * is enabled but SATA HDD/ODD is connected to SATA port,
1397 * do soft reset again to port 0.
1398 */
1399 if (rc == -EIO) {
1400 irq_sts = readl(port_mmio + PORT_IRQ_STAT);
1401 if (irq_sts & PORT_IRQ_BAD_PMP) {
1402 ata_link_printk(link, KERN_WARNING,
1403 "failed due to HW bug, retry pmp=0\n");
1404 rc = ahci_do_softreset(link, class, 0, deadline,
1405 ahci_check_ready);
1406 }
1407 }
1408
1409 return rc;
1410}
1411
1331static int ahci_hardreset(struct ata_link *link, unsigned int *class, 1412static int ahci_hardreset(struct ata_link *link, unsigned int *class,
1332 unsigned long deadline) 1413 unsigned long deadline)
1333{ 1414{
@@ -2118,7 +2199,8 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
2118static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2199static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2119{ 2200{
2120 static int printed_version; 2201 static int printed_version;
2121 struct ata_port_info pi = ahci_port_info[ent->driver_data]; 2202 unsigned int board_id = ent->driver_data;
2203 struct ata_port_info pi = ahci_port_info[board_id];
2122 const struct ata_port_info *ppi[] = { &pi, NULL }; 2204 const struct ata_port_info *ppi[] = { &pi, NULL };
2123 struct device *dev = &pdev->dev; 2205 struct device *dev = &pdev->dev;
2124 struct ahci_host_priv *hpriv; 2206 struct ahci_host_priv *hpriv;
@@ -2167,6 +2249,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2167 return -ENOMEM; 2249 return -ENOMEM;
2168 hpriv->flags |= (unsigned long)pi.private_data; 2250 hpriv->flags |= (unsigned long)pi.private_data;
2169 2251
2252 /* MCP65 revision A1 and A2 can't do MSI */
2253 if (board_id == board_ahci_mcp65 &&
2254 (pdev->revision == 0xa1 || pdev->revision == 0xa2))
2255 hpriv->flags |= AHCI_HFLAG_NO_MSI;
2256
2170 if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) 2257 if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev))
2171 pci_intx(pdev, 1); 2258 pci_intx(pdev, 1);
2172 2259
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index e336b05fe4a7..5f1e1cc6165a 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -53,15 +53,16 @@
53#include <linux/scatterlist.h> 53#include <linux/scatterlist.h>
54 54
55#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) 55#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
56#define DRIVER_NAME "HP CISS Driver (v 3.6.14)" 56#define DRIVER_NAME "HP CISS Driver (v 3.6.20)"
57#define DRIVER_VERSION CCISS_DRIVER_VERSION(3,6,14) 57#define DRIVER_VERSION CCISS_DRIVER_VERSION(3, 6, 20)
58 58
59/* Embedded module documentation macros - see modules.h */ 59/* Embedded module documentation macros - see modules.h */
60MODULE_AUTHOR("Hewlett-Packard Company"); 60MODULE_AUTHOR("Hewlett-Packard Company");
61MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 3.6.14"); 61MODULE_DESCRIPTION("Driver for HP Smart Array Controllers");
62MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400" 62MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400"
63 " SA6i P600 P800 P400 P400i E200 E200i E500"); 63 " SA6i P600 P800 P400 P400i E200 E200i E500 P700m"
64MODULE_VERSION("3.6.14"); 64 " Smart Array G2 Series SAS/SATA Controllers");
65MODULE_VERSION("3.6.20");
65MODULE_LICENSE("GPL"); 66MODULE_LICENSE("GPL");
66 67
67#include "cciss_cmd.h" 68#include "cciss_cmd.h"
@@ -90,6 +91,11 @@ static const struct pci_device_id cciss_pci_device_id[] = {
90 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215}, 91 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSD, 0x103C, 0x3215},
91 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237}, 92 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x3237},
92 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x323D}, 93 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSC, 0x103C, 0x323D},
94 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3241},
95 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3243},
96 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3245},
97 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3247},
98 {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3249},
93 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 99 {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
94 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, 100 PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0},
95 {0,} 101 {0,}
@@ -123,6 +129,11 @@ static struct board_type products[] = {
123 {0x3215103C, "Smart Array E200i", &SA5_access, 120}, 129 {0x3215103C, "Smart Array E200i", &SA5_access, 120},
124 {0x3237103C, "Smart Array E500", &SA5_access, 512}, 130 {0x3237103C, "Smart Array E500", &SA5_access, 512},
125 {0x323D103C, "Smart Array P700m", &SA5_access, 512}, 131 {0x323D103C, "Smart Array P700m", &SA5_access, 512},
132 {0x3241103C, "Smart Array P212", &SA5_access, 384},
133 {0x3243103C, "Smart Array P410", &SA5_access, 384},
134 {0x3245103C, "Smart Array P410i", &SA5_access, 384},
135 {0x3247103C, "Smart Array P411", &SA5_access, 384},
136 {0x3249103C, "Smart Array P812", &SA5_access, 384},
126 {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120}, 137 {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120},
127}; 138};
128 139
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index d307bf26af58..2d854bb9373e 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -749,7 +749,7 @@ config NVRAM
749if RTC_LIB=n 749if RTC_LIB=n
750 750
751config RTC 751config RTC
752 tristate "Enhanced Real Time Clock Support" 752 tristate "Enhanced Real Time Clock Support (legacy PC RTC driver)"
753 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \ 753 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV \
754 && !ARM && !SUPERH && !S390 && !AVR32 754 && !ARM && !SUPERH && !S390 && !AVR32
755 ---help--- 755 ---help---
@@ -1036,9 +1036,9 @@ config HPET
1036 non-periodic and/or periodic. 1036 non-periodic and/or periodic.
1037 1037
1038config HPET_RTC_IRQ 1038config HPET_RTC_IRQ
1039 bool "HPET Control RTC IRQ" if !HPET_EMULATE_RTC 1039 bool
1040 default n 1040 default HPET_EMULATE_RTC
1041 depends on HPET 1041 depends on RTC && HPET
1042 help 1042 help
1043 If you say Y here, you will disable RTC_IRQ in drivers/char/rtc.c. It 1043 If you say Y here, you will disable RTC_IRQ in drivers/char/rtc.c. It
1044 is assumed the platform called hpet_alloc with the RTC IRQ values for 1044 is assumed the platform called hpet_alloc with the RTC IRQ values for
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 55c97f623242..07b4d8ff56e5 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -458,6 +458,10 @@ static struct agp_device_ids ati_agp_device_ids[] __devinitdata =
458 .chipset_name = "IGP9100/M", 458 .chipset_name = "IGP9100/M",
459 }, 459 },
460 { 460 {
461 .device_id = PCI_DEVICE_ID_ATI_RS350_133,
462 .chipset_name = "IGP9000/M",
463 },
464 {
461 .device_id = PCI_DEVICE_ID_ATI_RS350_200, 465 .device_id = PCI_DEVICE_ID_ATI_RS350_200,
462 .chipset_name = "IGP9100/M", 466 .chipset_name = "IGP9100/M",
463 }, 467 },
diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
index 2398e864c28d..a00869c650d5 100644
--- a/drivers/char/generic_nvram.c
+++ b/drivers/char/generic_nvram.c
@@ -133,7 +133,7 @@ static struct miscdevice nvram_dev = {
133 133
134int __init nvram_init(void) 134int __init nvram_init(void)
135{ 135{
136 printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n", 136 printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
137 NVRAM_VERSION); 137 NVRAM_VERSION);
138 return misc_register(&nvram_dev); 138 return misc_register(&nvram_dev);
139} 139}
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c
index 5cc651ef75eb..27fdc0866496 100644
--- a/drivers/char/hw_random/intel-rng.c
+++ b/drivers/char/hw_random/intel-rng.c
@@ -273,7 +273,7 @@ static int __init intel_rng_hw_init(void *_intel_rng_hw)
273 if (mfc != INTEL_FWH_MANUFACTURER_CODE || 273 if (mfc != INTEL_FWH_MANUFACTURER_CODE ||
274 (dvc != INTEL_FWH_DEVICE_CODE_8M && 274 (dvc != INTEL_FWH_DEVICE_CODE_8M &&
275 dvc != INTEL_FWH_DEVICE_CODE_4M)) { 275 dvc != INTEL_FWH_DEVICE_CODE_4M)) {
276 printk(KERN_ERR PFX "FWH not detected\n"); 276 printk(KERN_NOTICE PFX "FWH not detected\n");
277 return -ENODEV; 277 return -ENODEV;
278 } 278 }
279 279
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 7f7e798c1384..d9a0a53c842d 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -677,12 +677,7 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag)
677 677
678static void k_self(struct vc_data *vc, unsigned char value, char up_flag) 678static void k_self(struct vc_data *vc, unsigned char value, char up_flag)
679{ 679{
680 unsigned int uni; 680 k_unicode(vc, conv_8bit_to_uni(value), up_flag);
681 if (kbd->kbdmode == VC_UNICODE)
682 uni = value;
683 else
684 uni = conv_8bit_to_uni(value);
685 k_unicode(vc, uni, up_flag);
686} 681}
687 682
688static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) 683static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag)
diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c
index 7817d2244921..1081091bbfaf 100644
--- a/drivers/isdn/sc/ioctl.c
+++ b/drivers/isdn/sc/ioctl.c
@@ -226,6 +226,7 @@ int sc_ioctl(int card, scs_ioctl *data)
226 */ 226 */
227 if (copy_from_user(spid, data->dataptr, SCIOC_SPIDSIZE)) { 227 if (copy_from_user(spid, data->dataptr, SCIOC_SPIDSIZE)) {
228 kfree(rcvmsg); 228 kfree(rcvmsg);
229 kfree(spid);
229 return -EFAULT; 230 return -EFAULT;
230 } 231 }
231 232
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index be624a049c67..c303e7f57ab4 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1457,17 +1457,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1457 int ret; 1457 int ret;
1458 1458
1459 /* 1459 /*
1460 * Allocate interrupt. 1460 * Set up tasklets. Must be done before requesting interrupt.
1461 */
1462
1463 ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host);
1464 if (ret)
1465 return ret;
1466
1467 host->irq = irq;
1468
1469 /*
1470 * Set up tasklets.
1471 */ 1461 */
1472 tasklet_init(&host->card_tasklet, wbsd_tasklet_card, 1462 tasklet_init(&host->card_tasklet, wbsd_tasklet_card,
1473 (unsigned long)host); 1463 (unsigned long)host);
@@ -1480,6 +1470,15 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
1480 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish, 1470 tasklet_init(&host->finish_tasklet, wbsd_tasklet_finish,
1481 (unsigned long)host); 1471 (unsigned long)host);
1482 1472
1473 /*
1474 * Allocate interrupt.
1475 */
1476 ret = request_irq(irq, wbsd_irq, IRQF_SHARED, DRIVER_NAME, host);
1477 if (ret)
1478 return ret;
1479
1480 host->irq = irq;
1481
1483 return 0; 1482 return 0;
1484} 1483}
1485 1484
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 4b46e68183e0..367b6d462708 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5724,14 +5724,12 @@ bnx2_reset_task(struct work_struct *work)
5724 if (!netif_running(bp->dev)) 5724 if (!netif_running(bp->dev))
5725 return; 5725 return;
5726 5726
5727 bp->in_reset_task = 1;
5728 bnx2_netif_stop(bp); 5727 bnx2_netif_stop(bp);
5729 5728
5730 bnx2_init_nic(bp); 5729 bnx2_init_nic(bp);
5731 5730
5732 atomic_set(&bp->intr_sem, 1); 5731 atomic_set(&bp->intr_sem, 1);
5733 bnx2_netif_start(bp); 5732 bnx2_netif_start(bp);
5734 bp->in_reset_task = 0;
5735} 5733}
5736 5734
5737static void 5735static void
@@ -5907,12 +5905,7 @@ bnx2_close(struct net_device *dev)
5907 struct bnx2 *bp = netdev_priv(dev); 5905 struct bnx2 *bp = netdev_priv(dev);
5908 u32 reset_code; 5906 u32 reset_code;
5909 5907
5910 /* Calling flush_scheduled_work() may deadlock because 5908 cancel_work_sync(&bp->reset_task);
5911 * linkwatch_event() may be on the workqueue and it will try to get
5912 * the rtnl_lock which we are holding.
5913 */
5914 while (bp->in_reset_task)
5915 msleep(1);
5916 5909
5917 bnx2_disable_int_sync(bp); 5910 bnx2_disable_int_sync(bp);
5918 bnx2_napi_disable(bp); 5911 bnx2_napi_disable(bp);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 1eaf5bb3d9c2..2377cc13bf61 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6656,7 +6656,6 @@ struct bnx2 {
6656 int current_interval; 6656 int current_interval;
6657 struct timer_list timer; 6657 struct timer_list timer;
6658 struct work_struct reset_task; 6658 struct work_struct reset_task;
6659 int in_reset_task;
6660 6659
6661 /* Used to synchronize phy accesses. */ 6660 /* Used to synchronize phy accesses. */
6662 spinlock_t phy_lock; 6661 spinlock_t phy_lock;
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c
index 7bdb5af35951..70cba64732ca 100644
--- a/drivers/net/bnx2x.c
+++ b/drivers/net/bnx2x.c
@@ -6,7 +6,8 @@
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 * 8 *
9 * Written by: Eliezer Tamir <eliezert@broadcom.com> 9 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
10 * Written by: Eliezer Tamir
10 * Based on code from Michael Chan's bnx2 driver 11 * Based on code from Michael Chan's bnx2 driver
11 * UDP CSUM errata workaround by Arik Gendelman 12 * UDP CSUM errata workaround by Arik Gendelman
12 * Slowpath rework by Vladislav Zolotarov 13 * Slowpath rework by Vladislav Zolotarov
@@ -74,7 +75,7 @@ static char version[] __devinitdata =
74 "Broadcom NetXtreme II 5771X 10Gigabit Ethernet Driver " 75 "Broadcom NetXtreme II 5771X 10Gigabit Ethernet Driver "
75 DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 76 DRV_MODULE_NAME " " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
76 77
77MODULE_AUTHOR("Eliezer Tamir <eliezert@broadcom.com>"); 78MODULE_AUTHOR("Eliezer Tamir");
78MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710 Driver"); 79MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710 Driver");
79MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
80MODULE_VERSION(DRV_MODULE_VERSION); 81MODULE_VERSION(DRV_MODULE_VERSION);
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 4f0c0d31e7c1..8e68d06510a6 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -6,7 +6,8 @@
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 * 8 *
9 * Written by: Eliezer Tamir <eliezert@broadcom.com> 9 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
10 * Written by: Eliezer Tamir
10 * Based on code from Michael Chan's bnx2 driver 11 * Based on code from Michael Chan's bnx2 driver
11 */ 12 */
12 13
diff --git a/drivers/net/bnx2x_init.h b/drivers/net/bnx2x_init.h
index dcaecc53bdb1..370686eef97c 100644
--- a/drivers/net/bnx2x_init.h
+++ b/drivers/net/bnx2x_init.h
@@ -6,7 +6,8 @@
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 * 8 *
9 * Written by: Eliezer Tamir <eliezert@broadcom.com> 9 * Maintained by: Eilon Greenstein <eilong@broadcom.com>
10 * Written by: Eliezer Tamir
10 */ 11 */
11 12
12#ifndef BNX2X_INIT_H 13#ifndef BNX2X_INIT_H
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index faae01dc1c4b..075fd547421e 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2605,7 +2605,8 @@ static int ehea_stop(struct net_device *dev)
2605 if (netif_msg_ifdown(port)) 2605 if (netif_msg_ifdown(port))
2606 ehea_info("disabling port %s", dev->name); 2606 ehea_info("disabling port %s", dev->name);
2607 2607
2608 flush_scheduled_work(); 2608 cancel_work_sync(&port->reset_task);
2609
2609 mutex_lock(&port->port_lock); 2610 mutex_lock(&port->port_lock);
2610 netif_stop_queue(dev); 2611 netif_stop_queue(dev);
2611 port_napi_disable(port); 2612 port_napi_disable(port);
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 5f9c42e7a7f1..329edd9c08fc 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -78,7 +78,7 @@ module_param_array_named(mac, mpc52xx_fec_mac_addr, byte, NULL, 0);
78MODULE_PARM_DESC(mac, "six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe"); 78MODULE_PARM_DESC(mac, "six hex digits, ie. 0x1,0x2,0xc0,0x01,0xba,0xbe");
79 79
80#define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \ 80#define MPC52xx_MESSAGES_DEFAULT ( NETIF_MSG_DRV | NETIF_MSG_PROBE | \
81 NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFDOWN ) 81 NETIF_MSG_LINK | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP)
82static int debug = -1; /* the above default */ 82static int debug = -1; /* the above default */
83module_param(debug, int, 0); 83module_param(debug, int, 0);
84MODULE_PARM_DESC(debug, "debugging messages level"); 84MODULE_PARM_DESC(debug, "debugging messages level");
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index dde9c7e6408a..00bc7fbb6b37 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -959,7 +959,7 @@ static int epp_close(struct net_device *dev)
959 unsigned char tmp[1]; 959 unsigned char tmp[1];
960 960
961 bc->work_running = 0; 961 bc->work_running = 0;
962 flush_scheduled_work(); 962 cancel_delayed_work_sync(&bc->run_work);
963 bc->stat = EPP_DCDBIT; 963 bc->stat = EPP_DCDBIT;
964 tmp[0] = 0; 964 tmp[0] = 0;
965 pp->ops->epp_write_addr(pp, tmp, 1, 0); 965 pp->ops->epp_write_addr(pp, tmp, 1, 0);
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 9b358f61ed7f..679a0826780e 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -577,12 +577,12 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
577 /* NIC to be configured in promiscuous mode. */ 577 /* NIC to be configured in promiscuous mode. */
578 receivemode = IPG_RM_RECEIVEALLFRAMES; 578 receivemode = IPG_RM_RECEIVEALLFRAMES;
579 } else if ((dev->flags & IFF_ALLMULTI) || 579 } else if ((dev->flags & IFF_ALLMULTI) ||
580 (dev->flags & IFF_MULTICAST & 580 ((dev->flags & IFF_MULTICAST) &&
581 (dev->mc_count > IPG_MULTICAST_HASHTABLE_SIZE))) { 581 (dev->mc_count > IPG_MULTICAST_HASHTABLE_SIZE))) {
582 /* NIC to be configured to receive all multicast 582 /* NIC to be configured to receive all multicast
583 * frames. */ 583 * frames. */
584 receivemode |= IPG_RM_RECEIVEMULTICAST; 584 receivemode |= IPG_RM_RECEIVEMULTICAST;
585 } else if (dev->flags & IFF_MULTICAST & (dev->mc_count > 0)) { 585 } else if ((dev->flags & IFF_MULTICAST) && (dev->mc_count > 0)) {
586 /* NIC to be configured to receive selected 586 /* NIC to be configured to receive selected
587 * multicast addresses. */ 587 * multicast addresses. */
588 receivemode |= IPG_RM_RECEIVEMULTICASTHASH; 588 receivemode |= IPG_RM_RECEIVEMULTICASTHASH;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 169edc154928..858b191517b3 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -733,7 +733,7 @@ static void r6040_timer(unsigned long data)
733 } 733 }
734 734
735 /* Timer active again */ 735 /* Timer active again */
736 mod_timer(&lp->timer, jiffies + round_jiffies(HZ)); 736 mod_timer(&lp->timer, round_jiffies(jiffies + HZ));
737} 737}
738 738
739/* Read/set MAC address routines */ 739/* Read/set MAC address routines */
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 4e2800205189..e2ee91a6ae7e 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -136,7 +136,6 @@ struct smc911x_local {
136 136
137 /* work queue */ 137 /* work queue */
138 struct work_struct phy_configure; 138 struct work_struct phy_configure;
139 int work_pending;
140 139
141 int tx_throttle; 140 int tx_throttle;
142 spinlock_t lock; 141 spinlock_t lock;
@@ -960,11 +959,11 @@ static void smc911x_phy_configure(struct work_struct *work)
960 * We should not be called if phy_type is zero. 959 * We should not be called if phy_type is zero.
961 */ 960 */
962 if (lp->phy_type == 0) 961 if (lp->phy_type == 0)
963 goto smc911x_phy_configure_exit_nolock; 962 return;
964 963
965 if (smc911x_phy_reset(dev, phyaddr)) { 964 if (smc911x_phy_reset(dev, phyaddr)) {
966 printk("%s: PHY reset timed out\n", dev->name); 965 printk("%s: PHY reset timed out\n", dev->name);
967 goto smc911x_phy_configure_exit_nolock; 966 return;
968 } 967 }
969 spin_lock_irqsave(&lp->lock, flags); 968 spin_lock_irqsave(&lp->lock, flags);
970 969
@@ -1033,8 +1032,6 @@ static void smc911x_phy_configure(struct work_struct *work)
1033 1032
1034smc911x_phy_configure_exit: 1033smc911x_phy_configure_exit:
1035 spin_unlock_irqrestore(&lp->lock, flags); 1034 spin_unlock_irqrestore(&lp->lock, flags);
1036smc911x_phy_configure_exit_nolock:
1037 lp->work_pending = 0;
1038} 1035}
1039 1036
1040/* 1037/*
@@ -1356,11 +1353,8 @@ static void smc911x_timeout(struct net_device *dev)
1356 * smc911x_phy_configure() calls msleep() which calls schedule_timeout() 1353 * smc911x_phy_configure() calls msleep() which calls schedule_timeout()
1357 * which calls schedule(). Hence we use a work queue. 1354 * which calls schedule(). Hence we use a work queue.
1358 */ 1355 */
1359 if (lp->phy_type != 0) { 1356 if (lp->phy_type != 0)
1360 if (schedule_work(&lp->phy_configure)) { 1357 schedule_work(&lp->phy_configure);
1361 lp->work_pending = 1;
1362 }
1363 }
1364 1358
1365 /* We can accept TX packets again */ 1359 /* We can accept TX packets again */
1366 dev->trans_start = jiffies; 1360 dev->trans_start = jiffies;
@@ -1531,16 +1525,8 @@ static int smc911x_close(struct net_device *dev)
1531 if (lp->phy_type != 0) { 1525 if (lp->phy_type != 0) {
1532 /* We need to ensure that no calls to 1526 /* We need to ensure that no calls to
1533 * smc911x_phy_configure are pending. 1527 * smc911x_phy_configure are pending.
1534
1535 * flush_scheduled_work() cannot be called because we
1536 * are running with the netlink semaphore held (from
1537 * devinet_ioctl()) and the pending work queue
1538 * contains linkwatch_event() (scheduled by
1539 * netif_carrier_off() above). linkwatch_event() also
1540 * wants the netlink semaphore.
1541 */ 1528 */
1542 while (lp->work_pending) 1529 cancel_work_sync(&lp->phy_configure);
1543 schedule();
1544 smc911x_phy_powerdown(dev, lp->mii.phy_id); 1530 smc911x_phy_powerdown(dev, lp->mii.phy_id);
1545 } 1531 }
1546 1532
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index a188e33484e6..f2051b209da2 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1016,15 +1016,8 @@ static void smc_phy_powerdown(struct net_device *dev)
1016 1016
1017 /* We need to ensure that no calls to smc_phy_configure are 1017 /* We need to ensure that no calls to smc_phy_configure are
1018 pending. 1018 pending.
1019
1020 flush_scheduled_work() cannot be called because we are
1021 running with the netlink semaphore held (from
1022 devinet_ioctl()) and the pending work queue contains
1023 linkwatch_event() (scheduled by netif_carrier_off()
1024 above). linkwatch_event() also wants the netlink semaphore.
1025 */ 1019 */
1026 while(lp->work_pending) 1020 cancel_work_sync(&lp->phy_configure);
1027 yield();
1028 1021
1029 bmcr = smc_phy_read(dev, phy, MII_BMCR); 1022 bmcr = smc_phy_read(dev, phy, MII_BMCR);
1030 smc_phy_write(dev, phy, MII_BMCR, bmcr | BMCR_PDOWN); 1023 smc_phy_write(dev, phy, MII_BMCR, bmcr | BMCR_PDOWN);
@@ -1161,7 +1154,6 @@ static void smc_phy_configure(struct work_struct *work)
1161smc_phy_configure_exit: 1154smc_phy_configure_exit:
1162 SMC_SELECT_BANK(lp, 2); 1155 SMC_SELECT_BANK(lp, 2);
1163 spin_unlock_irq(&lp->lock); 1156 spin_unlock_irq(&lp->lock);
1164 lp->work_pending = 0;
1165} 1157}
1166 1158
1167/* 1159/*
@@ -1389,11 +1381,8 @@ static void smc_timeout(struct net_device *dev)
1389 * smc_phy_configure() calls msleep() which calls schedule_timeout() 1381 * smc_phy_configure() calls msleep() which calls schedule_timeout()
1390 * which calls schedule(). Hence we use a work queue. 1382 * which calls schedule(). Hence we use a work queue.
1391 */ 1383 */
1392 if (lp->phy_type != 0) { 1384 if (lp->phy_type != 0)
1393 if (schedule_work(&lp->phy_configure)) { 1385 schedule_work(&lp->phy_configure);
1394 lp->work_pending = 1;
1395 }
1396 }
1397 1386
1398 /* We can accept TX packets again */ 1387 /* We can accept TX packets again */
1399 dev->trans_start = jiffies; 1388 dev->trans_start = jiffies;
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 55670b5eb611..af8d2c436efd 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -731,7 +731,7 @@ static void tulip_down (struct net_device *dev)
731 void __iomem *ioaddr = tp->base_addr; 731 void __iomem *ioaddr = tp->base_addr;
732 unsigned long flags; 732 unsigned long flags;
733 733
734 flush_scheduled_work(); 734 cancel_work_sync(&tp->media_work);
735 735
736#ifdef CONFIG_TULIP_NAPI 736#ifdef CONFIG_TULIP_NAPI
737 napi_disable(&tp->napi); 737 napi_disable(&tp->napi);
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 0dcfc0310264..7c66b052f55a 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -706,7 +706,7 @@ static void kaweth_kill_urbs(struct kaweth_device *kaweth)
706 usb_kill_urb(kaweth->rx_urb); 706 usb_kill_urb(kaweth->rx_urb);
707 usb_kill_urb(kaweth->tx_urb); 707 usb_kill_urb(kaweth->tx_urb);
708 708
709 flush_scheduled_work(); 709 cancel_delayed_work_sync(&kaweth->lowmem_work);
710 710
711 /* a scheduled work may have resubmitted, 711 /* a scheduled work may have resubmitted,
712 we hit them again */ 712 we hit them again */
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 20d387f6658c..f7aec9309d04 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -682,7 +682,13 @@ static int prism2_close(struct net_device *dev)
682 netif_device_detach(dev); 682 netif_device_detach(dev);
683 } 683 }
684 684
685 flush_scheduled_work(); 685 cancel_work_sync(&local->reset_queue);
686 cancel_work_sync(&local->set_multicast_list_queue);
687 cancel_work_sync(&local->set_tim_queue);
688#ifndef PRISM2_NO_STATION_MODES
689 cancel_work_sync(&local->info_queue);
690#endif
691 cancel_work_sync(&local->comms_qual_update);
686 692
687 module_put(local->hw_module); 693 module_put(local->hw_module);
688 694
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 60f8afc7a56e..4949dc4859be 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -256,6 +256,17 @@ config RTC_DRV_S35390A
256 This driver can also be built as a module. If so the module 256 This driver can also be built as a module. If so the module
257 will be called rtc-s35390a. 257 will be called rtc-s35390a.
258 258
259config RTC_DRV_FM3130
260 tristate "Ramtron FM3130"
261 help
262 If you say Y here you will get support for the
263 Ramtron FM3130 RTC chips.
264 Ramtron FM3130 is a chip with two separate devices inside,
265 RTC clock and FRAM. This driver provides only RTC functionality.
266
267 This driver can also be built as a module. If so the module
268 will be called rtc-fm3130.
269
259endif # I2C 270endif # I2C
260 271
261comment "SPI RTC drivers" 272comment "SPI RTC drivers"
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index ebe871cf16c1..b6e14d51670b 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o
31obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o 31obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o
32obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o 32obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o
33obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o 33obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o
34obj-$(CONFIG_RTC_DRV_FM3130) += rtc-fm3130.o
34obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o 35obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o
35obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o 36obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o
36obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o 37obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o
@@ -41,6 +42,7 @@ obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
41obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o 42obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
42obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o 43obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
43obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o 44obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
45obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
44obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o 46obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
45obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o 47obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
46obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o 48obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o
@@ -54,4 +56,3 @@ obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o
54obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o 56obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
55obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o 57obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o
56obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o 58obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
57obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 42244f14b41c..2ef8cdfda4a7 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -94,8 +94,11 @@ static int at32_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
94{ 94{
95 struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); 95 struct rtc_at32ap700x *rtc = dev_get_drvdata(dev);
96 96
97 spin_lock_irq(&rtc->lock);
97 rtc_time_to_tm(rtc->alarm_time, &alrm->time); 98 rtc_time_to_tm(rtc->alarm_time, &alrm->time);
98 alrm->pending = rtc_readl(rtc, IMR) & RTC_BIT(IMR_TOPI) ? 1 : 0; 99 alrm->enabled = rtc_readl(rtc, IMR) & RTC_BIT(IMR_TOPI) ? 1 : 0;
100 alrm->pending = rtc_readl(rtc, ISR) & RTC_BIT(ISR_TOPI) ? 1 : 0;
101 spin_unlock_irq(&rtc->lock);
99 102
100 return 0; 103 return 0;
101} 104}
@@ -119,7 +122,7 @@ static int at32_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
119 spin_lock_irq(&rtc->lock); 122 spin_lock_irq(&rtc->lock);
120 rtc->alarm_time = alarm_unix_time; 123 rtc->alarm_time = alarm_unix_time;
121 rtc_writel(rtc, TOP, rtc->alarm_time); 124 rtc_writel(rtc, TOP, rtc->alarm_time);
122 if (alrm->pending) 125 if (alrm->enabled)
123 rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL) 126 rtc_writel(rtc, CTRL, rtc_readl(rtc, CTRL)
124 | RTC_BIT(CTRL_TOPEN)); 127 | RTC_BIT(CTRL_TOPEN));
125 else 128 else
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index d060a06ce05b..d7bb9bac71df 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -905,19 +905,7 @@ static struct pnp_driver cmos_pnp_driver = {
905 .resume = cmos_pnp_resume, 905 .resume = cmos_pnp_resume,
906}; 906};
907 907
908static int __init cmos_init(void) 908#endif /* CONFIG_PNP */
909{
910 return pnp_register_driver(&cmos_pnp_driver);
911}
912module_init(cmos_init);
913
914static void __exit cmos_exit(void)
915{
916 pnp_unregister_driver(&cmos_pnp_driver);
917}
918module_exit(cmos_exit);
919
920#else /* no PNP */
921 909
922/*----------------------------------------------------------------*/ 910/*----------------------------------------------------------------*/
923 911
@@ -958,20 +946,33 @@ static struct platform_driver cmos_platform_driver = {
958 946
959static int __init cmos_init(void) 947static int __init cmos_init(void)
960{ 948{
949#ifdef CONFIG_PNP
950 if (pnp_platform_devices)
951 return pnp_register_driver(&cmos_pnp_driver);
952 else
953 return platform_driver_probe(&cmos_platform_driver,
954 cmos_platform_probe);
955#else
961 return platform_driver_probe(&cmos_platform_driver, 956 return platform_driver_probe(&cmos_platform_driver,
962 cmos_platform_probe); 957 cmos_platform_probe);
958#endif /* CONFIG_PNP */
963} 959}
964module_init(cmos_init); 960module_init(cmos_init);
965 961
966static void __exit cmos_exit(void) 962static void __exit cmos_exit(void)
967{ 963{
964#ifdef CONFIG_PNP
965 if (pnp_platform_devices)
966 pnp_unregister_driver(&cmos_pnp_driver);
967 else
968 platform_driver_unregister(&cmos_platform_driver);
969#else
968 platform_driver_unregister(&cmos_platform_driver); 970 platform_driver_unregister(&cmos_platform_driver);
971#endif /* CONFIG_PNP */
969} 972}
970module_exit(cmos_exit); 973module_exit(cmos_exit);
971 974
972 975
973#endif /* !PNP */
974
975MODULE_AUTHOR("David Brownell"); 976MODULE_AUTHOR("David Brownell");
976MODULE_DESCRIPTION("Driver for PC-style 'CMOS' RTCs"); 977MODULE_DESCRIPTION("Driver for PC-style 'CMOS' RTCs");
977MODULE_LICENSE("GPL"); 978MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c
new file mode 100644
index 000000000000..11644c8fca82
--- /dev/null
+++ b/drivers/rtc/rtc-fm3130.c
@@ -0,0 +1,501 @@
1/*
2 * rtc-fm3130.c - RTC driver for Ramtron FM3130 I2C chip.
3 *
4 * Copyright (C) 2008 Sergey Lapin
5 * Based on ds1307 driver by James Chapman and David Brownell
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/i2c.h>
14#include <linux/rtc.h>
15#include <linux/bcd.h>
16
17#define FM3130_RTC_CONTROL (0x0)
18#define FM3130_CAL_CONTROL (0x1)
19#define FM3130_RTC_SECONDS (0x2)
20#define FM3130_RTC_MINUTES (0x3)
21#define FM3130_RTC_HOURS (0x4)
22#define FM3130_RTC_DAY (0x5)
23#define FM3130_RTC_DATE (0x6)
24#define FM3130_RTC_MONTHS (0x7)
25#define FM3130_RTC_YEARS (0x8)
26
27#define FM3130_ALARM_SECONDS (0x9)
28#define FM3130_ALARM_MINUTES (0xa)
29#define FM3130_ALARM_HOURS (0xb)
30#define FM3130_ALARM_DATE (0xc)
31#define FM3130_ALARM_MONTHS (0xd)
32#define FM3130_ALARM_WP_CONTROL (0xe)
33
34#define FM3130_CAL_CONTROL_BIT_nOSCEN (1 << 7) /* Osciallator enabled */
35#define FM3130_RTC_CONTROL_BIT_LB (1 << 7) /* Low battery */
36#define FM3130_RTC_CONTROL_BIT_AF (1 << 6) /* Alarm flag */
37#define FM3130_RTC_CONTROL_BIT_CF (1 << 5) /* Century overflow */
38#define FM3130_RTC_CONTROL_BIT_POR (1 << 4) /* Power on reset */
39#define FM3130_RTC_CONTROL_BIT_AEN (1 << 3) /* Alarm enable */
40#define FM3130_RTC_CONTROL_BIT_CAL (1 << 2) /* Calibration mode */
41#define FM3130_RTC_CONTROL_BIT_WRITE (1 << 1) /* W=1 -> write mode W=0 normal */
42#define FM3130_RTC_CONTROL_BIT_READ (1 << 0) /* R=1 -> read mode R=0 normal */
43
44#define FM3130_CLOCK_REGS 7
45#define FM3130_ALARM_REGS 5
46
47struct fm3130 {
48 u8 reg_addr_time;
49 u8 reg_addr_alarm;
50 u8 regs[15];
51 struct i2c_msg msg[4];
52 struct i2c_client *client;
53 struct rtc_device *rtc;
54 int data_valid;
55 int alarm;
56};
57static const struct i2c_device_id fm3130_id[] = {
58 { "fm3130-rtc", 0 },
59 { }
60};
61MODULE_DEVICE_TABLE(i2c, fm3130_id);
62
63#define FM3130_MODE_NORMAL 0
64#define FM3130_MODE_WRITE 1
65#define FM3130_MODE_READ 2
66
67static void fm3130_rtc_mode(struct device *dev, int mode)
68{
69 struct fm3130 *fm3130 = dev_get_drvdata(dev);
70
71 fm3130->regs[FM3130_RTC_CONTROL] =
72 i2c_smbus_read_byte_data(fm3130->client, FM3130_RTC_CONTROL);
73 switch (mode) {
74 case FM3130_MODE_NORMAL:
75 fm3130->regs[FM3130_RTC_CONTROL] &=
76 ~(FM3130_RTC_CONTROL_BIT_WRITE |
77 FM3130_RTC_CONTROL_BIT_READ);
78 break;
79 case FM3130_MODE_WRITE:
80 fm3130->regs[FM3130_RTC_CONTROL] |= FM3130_RTC_CONTROL_BIT_WRITE;
81 break;
82 case FM3130_MODE_READ:
83 fm3130->regs[FM3130_RTC_CONTROL] |= FM3130_RTC_CONTROL_BIT_READ;
84 break;
85 default:
86 dev_dbg(dev, "invalid mode %d\n", mode);
87 break;
88 }
89 /* Checking for alarm */
90 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_AF) {
91 fm3130->alarm = 1;
92 fm3130->regs[FM3130_RTC_CONTROL] &= ~FM3130_RTC_CONTROL_BIT_AF;
93 }
94 i2c_smbus_write_byte_data(fm3130->client,
95 FM3130_RTC_CONTROL, fm3130->regs[FM3130_RTC_CONTROL]);
96}
97
98static int fm3130_get_time(struct device *dev, struct rtc_time *t)
99{
100 struct fm3130 *fm3130 = dev_get_drvdata(dev);
101 int tmp;
102
103 if (!fm3130->data_valid) {
104 /* We have invalid data in RTC, probably due
105 to battery faults or other problems. Return EIO
106 for now, it will allow us to set data later insted
107 of error during probing which disables device */
108 return -EIO;
109 }
110 fm3130_rtc_mode(dev, FM3130_MODE_READ);
111
112 /* read the RTC date and time registers all at once */
113 tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
114 fm3130->msg, 2);
115 if (tmp != 2) {
116 dev_err(dev, "%s error %d\n", "read", tmp);
117 return -EIO;
118 }
119
120 fm3130_rtc_mode(dev, FM3130_MODE_NORMAL);
121
122 dev_dbg(dev, "%s: %02x %02x %02x %02x %02x %02x %02x %02x"
123 "%02x %02x %02x %02x %02x %02x %02x\n",
124 "read",
125 fm3130->regs[0], fm3130->regs[1],
126 fm3130->regs[2], fm3130->regs[3],
127 fm3130->regs[4], fm3130->regs[5],
128 fm3130->regs[6], fm3130->regs[7],
129 fm3130->regs[8], fm3130->regs[9],
130 fm3130->regs[0xa], fm3130->regs[0xb],
131 fm3130->regs[0xc], fm3130->regs[0xd],
132 fm3130->regs[0xe]);
133
134 t->tm_sec = BCD2BIN(fm3130->regs[FM3130_RTC_SECONDS] & 0x7f);
135 t->tm_min = BCD2BIN(fm3130->regs[FM3130_RTC_MINUTES] & 0x7f);
136 tmp = fm3130->regs[FM3130_RTC_HOURS] & 0x3f;
137 t->tm_hour = BCD2BIN(tmp);
138 t->tm_wday = BCD2BIN(fm3130->regs[FM3130_RTC_DAY] & 0x07) - 1;
139 t->tm_mday = BCD2BIN(fm3130->regs[FM3130_RTC_DATE] & 0x3f);
140 tmp = fm3130->regs[FM3130_RTC_MONTHS] & 0x1f;
141 t->tm_mon = BCD2BIN(tmp) - 1;
142
143 /* assume 20YY not 19YY, and ignore CF bit */
144 t->tm_year = BCD2BIN(fm3130->regs[FM3130_RTC_YEARS]) + 100;
145
146 dev_dbg(dev, "%s secs=%d, mins=%d, "
147 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
148 "read", t->tm_sec, t->tm_min,
149 t->tm_hour, t->tm_mday,
150 t->tm_mon, t->tm_year, t->tm_wday);
151
152 /* initial clock setting can be undefined */
153 return rtc_valid_tm(t);
154}
155
156
157static int fm3130_set_time(struct device *dev, struct rtc_time *t)
158{
159 struct fm3130 *fm3130 = dev_get_drvdata(dev);
160 int tmp, i;
161 u8 *buf = fm3130->regs;
162
163 dev_dbg(dev, "%s secs=%d, mins=%d, "
164 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
165 "write", t->tm_sec, t->tm_min,
166 t->tm_hour, t->tm_mday,
167 t->tm_mon, t->tm_year, t->tm_wday);
168
169 /* first register addr */
170 buf[FM3130_RTC_SECONDS] = BIN2BCD(t->tm_sec);
171 buf[FM3130_RTC_MINUTES] = BIN2BCD(t->tm_min);
172 buf[FM3130_RTC_HOURS] = BIN2BCD(t->tm_hour);
173 buf[FM3130_RTC_DAY] = BIN2BCD(t->tm_wday + 1);
174 buf[FM3130_RTC_DATE] = BIN2BCD(t->tm_mday);
175 buf[FM3130_RTC_MONTHS] = BIN2BCD(t->tm_mon + 1);
176
177 /* assume 20YY not 19YY */
178 tmp = t->tm_year - 100;
179 buf[FM3130_RTC_YEARS] = BIN2BCD(tmp);
180
181 dev_dbg(dev, "%s: %02x %02x %02x %02x %02x %02x %02x"
182 "%02x %02x %02x %02x %02x %02x %02x %02x\n",
183 "write", buf[0], buf[1], buf[2], buf[3],
184 buf[4], buf[5], buf[6], buf[7],
185 buf[8], buf[9], buf[0xa], buf[0xb],
186 buf[0xc], buf[0xd], buf[0xe]);
187
188 fm3130_rtc_mode(dev, FM3130_MODE_WRITE);
189
190 /* Writing time registers, we don't support multibyte transfers */
191 for (i = 0; i < FM3130_CLOCK_REGS; i++) {
192 i2c_smbus_write_byte_data(fm3130->client,
193 FM3130_RTC_SECONDS + i,
194 fm3130->regs[FM3130_RTC_SECONDS + i]);
195 }
196
197 fm3130_rtc_mode(dev, FM3130_MODE_NORMAL);
198
199 /* We assume here that data are valid once written */
200 if (!fm3130->data_valid)
201 fm3130->data_valid = 1;
202 return 0;
203}
204
205static int fm3130_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
206{
207 struct fm3130 *fm3130 = dev_get_drvdata(dev);
208 int tmp;
209 struct rtc_time *tm = &alrm->time;
210 /* read the RTC alarm registers all at once */
211 tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
212 &fm3130->msg[2], 2);
213 if (tmp != 2) {
214 dev_err(dev, "%s error %d\n", "read", tmp);
215 return -EIO;
216 }
217 dev_dbg(dev, "alarm read %02x %02x %02x %02x %02x\n",
218 fm3130->regs[FM3130_ALARM_SECONDS],
219 fm3130->regs[FM3130_ALARM_MINUTES],
220 fm3130->regs[FM3130_ALARM_HOURS],
221 fm3130->regs[FM3130_ALARM_DATE],
222 fm3130->regs[FM3130_ALARM_MONTHS]);
223
224
225 tm->tm_sec = BCD2BIN(fm3130->regs[FM3130_ALARM_SECONDS] & 0x7F);
226 tm->tm_min = BCD2BIN(fm3130->regs[FM3130_ALARM_MINUTES] & 0x7F);
227 tm->tm_hour = BCD2BIN(fm3130->regs[FM3130_ALARM_HOURS] & 0x3F);
228 tm->tm_mday = BCD2BIN(fm3130->regs[FM3130_ALARM_DATE] & 0x3F);
229 tm->tm_mon = BCD2BIN(fm3130->regs[FM3130_ALARM_MONTHS] & 0x1F);
230 if (tm->tm_mon > 0)
231 tm->tm_mon -= 1; /* RTC is 1-12, tm_mon is 0-11 */
232 dev_dbg(dev, "%s secs=%d, mins=%d, "
233 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
234 "read alarm", tm->tm_sec, tm->tm_min,
235 tm->tm_hour, tm->tm_mday,
236 tm->tm_mon, tm->tm_year, tm->tm_wday);
237
238 return 0;
239}
240
241static int fm3130_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
242{
243 struct fm3130 *fm3130 = dev_get_drvdata(dev);
244 struct rtc_time *tm = &alrm->time;
245 int i;
246
247 dev_dbg(dev, "%s secs=%d, mins=%d, "
248 "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
249 "write alarm", tm->tm_sec, tm->tm_min,
250 tm->tm_hour, tm->tm_mday,
251 tm->tm_mon, tm->tm_year, tm->tm_wday);
252
253 if (tm->tm_sec != -1)
254 fm3130->regs[FM3130_ALARM_SECONDS] =
255 BIN2BCD(tm->tm_sec) | 0x80;
256
257 if (tm->tm_min != -1)
258 fm3130->regs[FM3130_ALARM_MINUTES] =
259 BIN2BCD(tm->tm_min) | 0x80;
260
261 if (tm->tm_hour != -1)
262 fm3130->regs[FM3130_ALARM_HOURS] =
263 BIN2BCD(tm->tm_hour) | 0x80;
264
265 if (tm->tm_mday != -1)
266 fm3130->regs[FM3130_ALARM_DATE] =
267 BIN2BCD(tm->tm_mday) | 0x80;
268
269 if (tm->tm_mon != -1)
270 fm3130->regs[FM3130_ALARM_MONTHS] =
271 BIN2BCD(tm->tm_mon + 1) | 0x80;
272
273 dev_dbg(dev, "alarm write %02x %02x %02x %02x %02x\n",
274 fm3130->regs[FM3130_ALARM_SECONDS],
275 fm3130->regs[FM3130_ALARM_MINUTES],
276 fm3130->regs[FM3130_ALARM_HOURS],
277 fm3130->regs[FM3130_ALARM_DATE],
278 fm3130->regs[FM3130_ALARM_MONTHS]);
279 /* Writing time registers, we don't support multibyte transfers */
280 for (i = 0; i < FM3130_ALARM_REGS; i++) {
281 i2c_smbus_write_byte_data(fm3130->client,
282 FM3130_ALARM_SECONDS + i,
283 fm3130->regs[FM3130_ALARM_SECONDS + i]);
284 }
285 fm3130->regs[FM3130_RTC_CONTROL] =
286 i2c_smbus_read_byte_data(fm3130->client, FM3130_RTC_CONTROL);
287 /* Checking for alarm */
288 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_AF) {
289 fm3130->alarm = 1;
290 fm3130->regs[FM3130_RTC_CONTROL] &= ~FM3130_RTC_CONTROL_BIT_AF;
291 }
292 if (alrm->enabled) {
293 i2c_smbus_write_byte_data(fm3130->client, FM3130_RTC_CONTROL,
294 (fm3130->regs[FM3130_RTC_CONTROL] &
295 ~(FM3130_RTC_CONTROL_BIT_CAL)) |
296 FM3130_RTC_CONTROL_BIT_AEN);
297 } else {
298 i2c_smbus_write_byte_data(fm3130->client, FM3130_RTC_CONTROL,
299 fm3130->regs[FM3130_RTC_CONTROL] &
300 ~(FM3130_RTC_CONTROL_BIT_AEN));
301 }
302 return 0;
303}
304
305static const struct rtc_class_ops fm3130_rtc_ops = {
306 .read_time = fm3130_get_time,
307 .set_time = fm3130_set_time,
308 .read_alarm = fm3130_read_alarm,
309 .set_alarm = fm3130_set_alarm,
310};
311
312static struct i2c_driver fm3130_driver;
313
314static int __devinit fm3130_probe(struct i2c_client *client,
315 const struct i2c_device_id *id)
316{
317 struct fm3130 *fm3130;
318 int err = -ENODEV;
319 int tmp;
320 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
321
322 if (!i2c_check_functionality(adapter,
323 I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
324 return -EIO;
325
326 fm3130 = kzalloc(sizeof(struct fm3130), GFP_KERNEL);
327
328 if (!fm3130)
329 return -ENOMEM;
330
331 fm3130->client = client;
332 i2c_set_clientdata(client, fm3130);
333 fm3130->reg_addr_time = FM3130_RTC_SECONDS;
334 fm3130->reg_addr_alarm = FM3130_ALARM_SECONDS;
335
336 /* Messages to read time */
337 fm3130->msg[0].addr = client->addr;
338 fm3130->msg[0].flags = 0;
339 fm3130->msg[0].len = 1;
340 fm3130->msg[0].buf = &fm3130->reg_addr_time;
341
342 fm3130->msg[1].addr = client->addr;
343 fm3130->msg[1].flags = I2C_M_RD;
344 fm3130->msg[1].len = FM3130_CLOCK_REGS;
345 fm3130->msg[1].buf = &fm3130->regs[FM3130_RTC_SECONDS];
346
347 /* Messages to read alarm */
348 fm3130->msg[2].addr = client->addr;
349 fm3130->msg[2].flags = 0;
350 fm3130->msg[2].len = 1;
351 fm3130->msg[2].buf = &fm3130->reg_addr_alarm;
352
353 fm3130->msg[3].addr = client->addr;
354 fm3130->msg[3].flags = I2C_M_RD;
355 fm3130->msg[3].len = FM3130_ALARM_REGS;
356 fm3130->msg[3].buf = &fm3130->regs[FM3130_ALARM_SECONDS];
357
358 fm3130->data_valid = 0;
359
360 tmp = i2c_transfer(adapter, fm3130->msg, 4);
361 if (tmp != 4) {
362 pr_debug("read error %d\n", tmp);
363 err = -EIO;
364 goto exit_free;
365 }
366
367 fm3130->regs[FM3130_RTC_CONTROL] =
368 i2c_smbus_read_byte_data(client, FM3130_RTC_CONTROL);
369 fm3130->regs[FM3130_CAL_CONTROL] =
370 i2c_smbus_read_byte_data(client, FM3130_CAL_CONTROL);
371
372 /* Checking for alarm */
373 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_AF) {
374 fm3130->alarm = 1;
375 fm3130->regs[FM3130_RTC_CONTROL] &= ~FM3130_RTC_CONTROL_BIT_AF;
376 }
377
378 /* Disabling calibration mode */
379 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_CAL)
380 i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
381 fm3130->regs[FM3130_RTC_CONTROL] &
382 ~(FM3130_RTC_CONTROL_BIT_CAL));
383 dev_warn(&client->dev, "Disabling calibration mode!\n");
384
385 /* Disabling read and write modes */
386 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_WRITE ||
387 fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_READ)
388 i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
389 fm3130->regs[FM3130_RTC_CONTROL] &
390 ~(FM3130_RTC_CONTROL_BIT_READ |
391 FM3130_RTC_CONTROL_BIT_WRITE));
392 dev_warn(&client->dev, "Disabling READ or WRITE mode!\n");
393
394 /* oscillator off? turn it on, so clock can tick. */
395 if (fm3130->regs[FM3130_CAL_CONTROL] & FM3130_CAL_CONTROL_BIT_nOSCEN)
396 i2c_smbus_write_byte_data(client, FM3130_CAL_CONTROL,
397 fm3130->regs[FM3130_CAL_CONTROL] &
398 ~(FM3130_CAL_CONTROL_BIT_nOSCEN));
399
400 /* oscillator fault? clear flag, and warn */
401 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_LB)
402 dev_warn(&client->dev, "Low battery!\n");
403
404 /* oscillator fault? clear flag, and warn */
405 if (fm3130->regs[FM3130_RTC_CONTROL] & FM3130_RTC_CONTROL_BIT_POR) {
406 i2c_smbus_write_byte_data(client, FM3130_RTC_CONTROL,
407 fm3130->regs[FM3130_RTC_CONTROL] &
408 ~FM3130_RTC_CONTROL_BIT_POR);
409 dev_warn(&client->dev, "SET TIME!\n");
410 }
411 /* ACS is controlled by alarm */
412 i2c_smbus_write_byte_data(client, FM3130_ALARM_WP_CONTROL, 0x80);
413
414 /* TODO */
415 /* TODO need to sanity check alarm */
416 tmp = fm3130->regs[FM3130_RTC_SECONDS];
417 tmp = BCD2BIN(tmp & 0x7f);
418 if (tmp > 60)
419 goto exit_bad;
420 tmp = BCD2BIN(fm3130->regs[FM3130_RTC_MINUTES] & 0x7f);
421 if (tmp > 60)
422 goto exit_bad;
423
424 tmp = BCD2BIN(fm3130->regs[FM3130_RTC_DATE] & 0x3f);
425 if (tmp == 0 || tmp > 31)
426 goto exit_bad;
427
428 tmp = BCD2BIN(fm3130->regs[FM3130_RTC_MONTHS] & 0x1f);
429 if (tmp == 0 || tmp > 12)
430 goto exit_bad;
431
432 tmp = fm3130->regs[FM3130_RTC_HOURS];
433
434 fm3130->data_valid = 1;
435
436exit_bad:
437 if (!fm3130->data_valid)
438 dev_dbg(&client->dev,
439 "%s: %02x %02x %02x %02x %02x %02x %02x %02x"
440 "%02x %02x %02x %02x %02x %02x %02x\n",
441 "bogus registers",
442 fm3130->regs[0], fm3130->regs[1],
443 fm3130->regs[2], fm3130->regs[3],
444 fm3130->regs[4], fm3130->regs[5],
445 fm3130->regs[6], fm3130->regs[7],
446 fm3130->regs[8], fm3130->regs[9],
447 fm3130->regs[0xa], fm3130->regs[0xb],
448 fm3130->regs[0xc], fm3130->regs[0xd],
449 fm3130->regs[0xe]);
450
451 /* We won't bail out here because we just got invalid data.
452 Time setting from u-boot doesn't work anyway */
453 fm3130->rtc = rtc_device_register(client->name, &client->dev,
454 &fm3130_rtc_ops, THIS_MODULE);
455 if (IS_ERR(fm3130->rtc)) {
456 err = PTR_ERR(fm3130->rtc);
457 dev_err(&client->dev,
458 "unable to register the class device\n");
459 goto exit_free;
460 }
461 return 0;
462exit_free:
463 kfree(fm3130);
464 return err;
465}
466
467static int __devexit fm3130_remove(struct i2c_client *client)
468{
469 struct fm3130 *fm3130 = i2c_get_clientdata(client);
470
471 rtc_device_unregister(fm3130->rtc);
472 kfree(fm3130);
473 return 0;
474}
475
476static struct i2c_driver fm3130_driver = {
477 .driver = {
478 .name = "rtc-fm3130",
479 .owner = THIS_MODULE,
480 },
481 .probe = fm3130_probe,
482 .remove = __devexit_p(fm3130_remove),
483 .id_table = fm3130_id,
484};
485
486static int __init fm3130_init(void)
487{
488 return i2c_add_driver(&fm3130_driver);
489}
490module_init(fm3130_init);
491
492static void __exit fm3130_exit(void)
493{
494 i2c_del_driver(&fm3130_driver);
495}
496module_exit(fm3130_exit);
497
498MODULE_DESCRIPTION("RTC driver for FM3130");
499MODULE_AUTHOR("Sergey Lapin <slapin@ossfans.org>");
500MODULE_LICENSE("GPL");
501
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 35ac9d956b3d..c14b2435d23e 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -2432,9 +2432,9 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
2432 info->screen_size = board_size; 2432 info->screen_size = board_size;
2433 cinfo->unmap = cirrusfb_pci_unmap; 2433 cinfo->unmap = cirrusfb_pci_unmap;
2434 2434
2435 printk(KERN_INFO " RAM (%lu kB) at 0xx%lx, ", 2435 printk(KERN_INFO "RAM (%lu kB) at 0x%lx, Cirrus "
2436 info->screen_size >> 10, board_addr); 2436 "Logic chipset on PCI bus\n",
2437 printk(KERN_INFO "Cirrus Logic chipset on PCI bus\n"); 2437 info->screen_size >> 10, board_addr);
2438 pci_set_drvdata(pdev, info); 2438 pci_set_drvdata(pdev, info);
2439 2439
2440 ret = cirrusfb_register(info); 2440 ret = cirrusfb_register(info);
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index fb9e67228543..c18880d9db1f 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -279,7 +279,7 @@ static void hga_blank(int blank_mode)
279 279
280static int __init hga_card_detect(void) 280static int __init hga_card_detect(void)
281{ 281{
282 int count=0; 282 int count = 0;
283 void __iomem *p, *q; 283 void __iomem *p, *q;
284 unsigned short p_save, q_save; 284 unsigned short p_save, q_save;
285 285
@@ -303,20 +303,18 @@ static int __init hga_card_detect(void)
303 writew(0x55aa, p); if (readw(p) == 0x55aa) count++; 303 writew(0x55aa, p); if (readw(p) == 0x55aa) count++;
304 writew(p_save, p); 304 writew(p_save, p);
305 305
306 if (count != 2) { 306 if (count != 2)
307 return 0; 307 goto error;
308 }
309 308
310 /* Ok, there is definitely a card registering at the correct 309 /* Ok, there is definitely a card registering at the correct
311 * memory location, so now we do an I/O port test. 310 * memory location, so now we do an I/O port test.
312 */ 311 */
313 312
314 if (!test_hga_b(0x66, 0x0f)) { /* cursor low register */ 313 if (!test_hga_b(0x66, 0x0f)) /* cursor low register */
315 return 0; 314 goto error;
316 } 315
317 if (!test_hga_b(0x99, 0x0f)) { /* cursor low register */ 316 if (!test_hga_b(0x99, 0x0f)) /* cursor low register */
318 return 0; 317 goto error;
319 }
320 318
321 /* See if the card is a Hercules, by checking whether the vsync 319 /* See if the card is a Hercules, by checking whether the vsync
322 * bit of the status register is changing. This test lasts for 320 * bit of the status register is changing. This test lasts for
@@ -331,7 +329,7 @@ static int __init hga_card_detect(void)
331 } 329 }
332 330
333 if (p_save == q_save) 331 if (p_save == q_save)
334 return 0; 332 goto error;
335 333
336 switch (inb_p(HGA_STATUS_PORT) & 0x70) { 334 switch (inb_p(HGA_STATUS_PORT) & 0x70) {
337 case 0x10: 335 case 0x10:
@@ -348,6 +346,12 @@ static int __init hga_card_detect(void)
348 break; 346 break;
349 } 347 }
350 return 1; 348 return 1;
349error:
350 if (release_io_ports)
351 release_region(0x3b0, 12);
352 if (release_io_port)
353 release_region(0x3bf, 1);
354 return 0;
351} 355}
352 356
353/** 357/**
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index 8bc46e930340..13fea61d6ae4 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -17,8 +17,8 @@
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/of_device.h> 19#include <linux/of_device.h>
20#include <linux/io.h>
20 21
21#include <asm/io.h>
22#include <asm/fbio.h> 22#include <asm/fbio.h>
23 23
24#include "sbuslib.h" 24#include "sbuslib.h"
@@ -33,7 +33,6 @@ static int leo_blank(int, struct fb_info *);
33 33
34static int leo_mmap(struct fb_info *, struct vm_area_struct *); 34static int leo_mmap(struct fb_info *, struct vm_area_struct *);
35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long); 35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long);
36static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *);
37 36
38/* 37/*
39 * Frame buffer operations 38 * Frame buffer operations
@@ -43,7 +42,6 @@ static struct fb_ops leo_ops = {
43 .owner = THIS_MODULE, 42 .owner = THIS_MODULE,
44 .fb_setcolreg = leo_setcolreg, 43 .fb_setcolreg = leo_setcolreg,
45 .fb_blank = leo_blank, 44 .fb_blank = leo_blank,
46 .fb_pan_display = leo_pan_display,
47 .fb_fillrect = cfb_fillrect, 45 .fb_fillrect = cfb_fillrect,
48 .fb_copyarea = cfb_copyarea, 46 .fb_copyarea = cfb_copyarea,
49 .fb_imageblit = cfb_imageblit, 47 .fb_imageblit = cfb_imageblit,
@@ -78,7 +76,7 @@ static struct fb_ops leo_ops = {
78#define LEO_CUR_TYPE_CMAP 0x00000050 76#define LEO_CUR_TYPE_CMAP 0x00000050
79 77
80struct leo_cursor { 78struct leo_cursor {
81 u8 xxx0[16]; 79 u8 xxx0[16];
82 u32 cur_type; 80 u32 cur_type;
83 u32 cur_misc; 81 u32 cur_misc;
84 u32 cur_cursxy; 82 u32 cur_cursxy;
@@ -105,7 +103,7 @@ struct leo_lx_krn {
105 103
106struct leo_lc_ss0_krn { 104struct leo_lc_ss0_krn {
107 u32 misc; 105 u32 misc;
108 u8 xxx0[0x800-4]; 106 u8 xxx0[0x800-4];
109 u32 rev; 107 u32 rev;
110}; 108};
111 109
@@ -116,7 +114,7 @@ struct leo_lc_ss0_usr {
116 u32 fontt; 114 u32 fontt;
117 u32 extent; 115 u32 extent;
118 u32 src; 116 u32 src;
119 u32 dst; 117 u32 dst;
120 u32 copy; 118 u32 copy;
121 u32 fill; 119 u32 fill;
122}; 120};
@@ -129,8 +127,8 @@ struct leo_lc_ss1_usr {
129 u8 unknown; 127 u8 unknown;
130}; 128};
131 129
132struct leo_ld { 130struct leo_ld_ss0 {
133 u8 xxx0[0xe00]; 131 u8 xxx0[0xe00];
134 u32 csr; 132 u32 csr;
135 u32 wid; 133 u32 wid;
136 u32 wmask; 134 u32 wmask;
@@ -144,13 +142,13 @@ struct leo_ld {
144 u32 src; /* Copy/Scroll (SS0 only) */ 142 u32 src; /* Copy/Scroll (SS0 only) */
145 u32 dst; /* Copy/Scroll/Fill (SS0 only) */ 143 u32 dst; /* Copy/Scroll/Fill (SS0 only) */
146 u32 extent; /* Copy/Scroll/Fill size (SS0 only) */ 144 u32 extent; /* Copy/Scroll/Fill size (SS0 only) */
147 u32 xxx1[3]; 145 u32 xxx1[3];
148 u32 setsem; /* SS1 only */ 146 u32 setsem; /* SS1 only */
149 u32 clrsem; /* SS1 only */ 147 u32 clrsem; /* SS1 only */
150 u32 clrpick; /* SS1 only */ 148 u32 clrpick; /* SS1 only */
151 u32 clrdat; /* SS1 only */ 149 u32 clrdat; /* SS1 only */
152 u32 alpha; /* SS1 only */ 150 u32 alpha; /* SS1 only */
153 u8 xxx2[0x2c]; 151 u8 xxx2[0x2c];
154 u32 winbg; 152 u32 winbg;
155 u32 planemask; 153 u32 planemask;
156 u32 rop; 154 u32 rop;
@@ -199,11 +197,12 @@ struct leo_par {
199static void leo_wait(struct leo_lx_krn __iomem *lx_krn) 197static void leo_wait(struct leo_lx_krn __iomem *lx_krn)
200{ 198{
201 int i; 199 int i;
202 200
203 for (i = 0; 201 for (i = 0;
204 (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) && i < 300000; 202 (sbus_readl(&lx_krn->krn_csr) & LEO_KRN_CSR_PROGRESS) &&
203 i < 300000;
205 i++) 204 i++)
206 udelay (1); /* Busy wait at most 0.3 sec */ 205 udelay(1); /* Busy wait at most 0.3 sec */
207 return; 206 return;
208} 207}
209 208
@@ -221,7 +220,7 @@ static int leo_setcolreg(unsigned regno,
221 unsigned transp, struct fb_info *info) 220 unsigned transp, struct fb_info *info)
222{ 221{
223 struct leo_par *par = (struct leo_par *) info->par; 222 struct leo_par *par = (struct leo_par *) info->par;
224 struct leo_lx_krn __iomem *lx_krn = par->lx_krn; 223 struct leo_lx_krn __iomem *lx_krn = par->lx_krn;
225 unsigned long flags; 224 unsigned long flags;
226 u32 val; 225 u32 val;
227 int i; 226 int i;
@@ -408,7 +407,7 @@ static void leo_wid_put(struct fb_info *info, struct fb_wid_list *wl)
408 leo_wait(lx_krn); 407 leo_wait(lx_krn);
409 408
410 for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) { 409 for (i = 0, wi = wl->wl_list; i < wl->wl_count; i++, wi++) {
411 switch(wi->wi_type) { 410 switch (wi->wi_type) {
412 case FB_WID_DBL_8: 411 case FB_WID_DBL_8:
413 j = (wi->wi_index & 0xf) + 0x40; 412 j = (wi->wi_index & 0xf) + 0x40;
414 break; 413 break;
@@ -453,13 +452,12 @@ static void leo_init_wids(struct fb_info *info)
453 wi.wi_index = 1; 452 wi.wi_index = 1;
454 wi.wi_values [0] = 0x30; 453 wi.wi_values [0] = 0x30;
455 leo_wid_put(info, &wl); 454 leo_wid_put(info, &wl);
456
457} 455}
458 456
459static void leo_switch_from_graph(struct fb_info *info) 457static void leo_switch_from_graph(struct fb_info *info)
460{ 458{
461 struct leo_par *par = (struct leo_par *) info->par; 459 struct leo_par *par = (struct leo_par *) info->par;
462 struct leo_ld __iomem *ss = (struct leo_ld __iomem *) par->ld_ss0; 460 struct leo_ld_ss0 __iomem *ss = par->ld_ss0;
463 unsigned long flags; 461 unsigned long flags;
464 u32 val; 462 u32 val;
465 463
@@ -485,19 +483,13 @@ static void leo_switch_from_graph(struct fb_info *info)
485 val = sbus_readl(&par->lc_ss0_usr->csr); 483 val = sbus_readl(&par->lc_ss0_usr->csr);
486 } while (val & 0x20000000); 484 } while (val & 0x20000000);
487 485
488 spin_unlock_irqrestore(&par->lock, flags); 486 /* setup screen buffer for cfb_* functions */
489} 487 sbus_writel(1, &ss->wid);
490 488 sbus_writel(0x00ffffff, &ss->planemask);
491static int leo_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) 489 sbus_writel(0x310b90, &ss->rop);
492{ 490 sbus_writel(0, &par->lc_ss0_usr->addrspace);
493 /* We just use this to catch switches out of
494 * graphics mode.
495 */
496 leo_switch_from_graph(info);
497 491
498 if (var->xoffset || var->yoffset || var->vmode) 492 spin_unlock_irqrestore(&par->lock, flags);
499 return -EINVAL;
500 return 0;
501} 493}
502 494
503static void leo_init_hw(struct fb_info *info) 495static void leo_init_hw(struct fb_info *info)
@@ -542,7 +534,8 @@ static void leo_unmap_regs(struct of_device *op, struct fb_info *info,
542 of_iounmap(&op->resource[0], info->screen_base, 0x800000); 534 of_iounmap(&op->resource[0], info->screen_base, 0x800000);
543} 535}
544 536
545static int __devinit leo_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit leo_probe(struct of_device *op,
538 const struct of_device_id *match)
546{ 539{
547 struct device_node *dp = op->node; 540 struct device_node *dp = op->node;
548 struct fb_info *info; 541 struct fb_info *info;
@@ -594,8 +587,9 @@ static int __devinit leo_probe(struct of_device *op, const struct of_device_id *
594 !info->screen_base) 587 !info->screen_base)
595 goto out_unmap_regs; 588 goto out_unmap_regs;
596 589
597 info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; 590 info->flags = FBINFO_DEFAULT;
598 info->fbops = &leo_ops; 591 info->fbops = &leo_ops;
592 info->pseudo_palette = par->clut_data;
599 593
600 leo_init_wids(info); 594 leo_init_wids(info);
601 leo_init_hw(info); 595 leo_init_hw(info);
@@ -649,7 +643,7 @@ static int __devexit leo_remove(struct of_device *op)
649 643
650static struct of_device_id leo_match[] = { 644static struct of_device_id leo_match[] = {
651 { 645 {
652 .name = "leo", 646 .name = "SUNW,leo",
653 }, 647 },
654 {}, 648 {},
655}; 649};
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 274bc93ab7d8..7dcda187d9ba 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -573,8 +573,8 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal,
573 dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off; 573 dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off;
574 fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off; 574 fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off;
575 } else { 575 } else {
576 pal_desc = &fbi->dma_buff->pal_desc[dma]; 576 pal_desc = &fbi->dma_buff->pal_desc[pal];
577 pal_desc_off = offsetof(struct pxafb_dma_buff, dma_desc[pal]); 577 pal_desc_off = offsetof(struct pxafb_dma_buff, pal_desc[pal]);
578 578
579 pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE; 579 pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE;
580 pal_desc->fidr = 0; 580 pal_desc->fidr = 0;
@@ -1276,6 +1276,8 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi)
1276 fbi->dma_buff_phys = fbi->map_dma; 1276 fbi->dma_buff_phys = fbi->map_dma;
1277 fbi->palette_cpu = (u16 *) fbi->dma_buff->palette; 1277 fbi->palette_cpu = (u16 *) fbi->dma_buff->palette;
1278 1278
1279 pr_debug("pxafb: palette_mem_size = 0x%08lx\n", fbi->palette_size*sizeof(u16));
1280
1279#ifdef CONFIG_FB_PXA_SMARTPANEL 1281#ifdef CONFIG_FB_PXA_SMARTPANEL
1280 fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff; 1282 fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff;
1281 fbi->n_smart_cmds = 0; 1283 fbi->n_smart_cmds = 0;
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 27cc1164ec36..771326b8047e 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -257,26 +257,34 @@ int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
257} 257}
258EXPORT_SYMBOL_GPL(fat_getattr); 258EXPORT_SYMBOL_GPL(fat_getattr);
259 259
260static int fat_check_mode(const struct msdos_sb_info *sbi, struct inode *inode, 260static int fat_sanitize_mode(const struct msdos_sb_info *sbi,
261 mode_t mode) 261 struct inode *inode, umode_t *mode_ptr)
262{ 262{
263 mode_t mask, req = mode & ~S_IFMT; 263 mode_t mask, perm;
264 264
265 if (S_ISREG(mode)) 265 /*
266 * Note, the basic check is already done by a caller of
267 * (attr->ia_mode & ~MSDOS_VALID_MODE)
268 */
269
270 if (S_ISREG(inode->i_mode))
266 mask = sbi->options.fs_fmask; 271 mask = sbi->options.fs_fmask;
267 else 272 else
268 mask = sbi->options.fs_dmask; 273 mask = sbi->options.fs_dmask;
269 274
275 perm = *mode_ptr & ~(S_IFMT | mask);
276
270 /* 277 /*
271 * Of the r and x bits, all (subject to umask) must be present. Of the 278 * Of the r and x bits, all (subject to umask) must be present. Of the
272 * w bits, either all (subject to umask) or none must be present. 279 * w bits, either all (subject to umask) or none must be present.
273 */ 280 */
274 req &= ~mask; 281 if ((perm & (S_IRUGO | S_IXUGO)) != (inode->i_mode & (S_IRUGO|S_IXUGO)))
275 if ((req & (S_IRUGO | S_IXUGO)) != (inode->i_mode & (S_IRUGO|S_IXUGO)))
276 return -EPERM; 282 return -EPERM;
277 if ((req & S_IWUGO) && ((req & S_IWUGO) != (S_IWUGO & ~mask))) 283 if ((perm & S_IWUGO) && ((perm & S_IWUGO) != (S_IWUGO & ~mask)))
278 return -EPERM; 284 return -EPERM;
279 285
286 *mode_ptr &= S_IFMT | perm;
287
280 return 0; 288 return 0;
281} 289}
282 290
@@ -299,7 +307,7 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
299{ 307{
300 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); 308 struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
301 struct inode *inode = dentry->d_inode; 309 struct inode *inode = dentry->d_inode;
302 int mask, error = 0; 310 int error = 0;
303 unsigned int ia_valid; 311 unsigned int ia_valid;
304 312
305 lock_kernel(); 313 lock_kernel();
@@ -332,12 +340,13 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
332 error = 0; 340 error = 0;
333 goto out; 341 goto out;
334 } 342 }
343
335 if (((attr->ia_valid & ATTR_UID) && 344 if (((attr->ia_valid & ATTR_UID) &&
336 (attr->ia_uid != sbi->options.fs_uid)) || 345 (attr->ia_uid != sbi->options.fs_uid)) ||
337 ((attr->ia_valid & ATTR_GID) && 346 ((attr->ia_valid & ATTR_GID) &&
338 (attr->ia_gid != sbi->options.fs_gid)) || 347 (attr->ia_gid != sbi->options.fs_gid)) ||
339 ((attr->ia_valid & ATTR_MODE) && 348 ((attr->ia_valid & ATTR_MODE) &&
340 fat_check_mode(sbi, inode, attr->ia_mode) < 0)) 349 (attr->ia_mode & ~MSDOS_VALID_MODE)))
341 error = -EPERM; 350 error = -EPERM;
342 351
343 if (error) { 352 if (error) {
@@ -346,15 +355,16 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
346 goto out; 355 goto out;
347 } 356 }
348 357
349 error = inode_setattr(inode, attr); 358 /*
350 if (error) 359 * We don't return -EPERM here. Yes, strange, but this is too
351 goto out; 360 * old behavior.
361 */
362 if (attr->ia_valid & ATTR_MODE) {
363 if (fat_sanitize_mode(sbi, inode, &attr->ia_mode) < 0)
364 attr->ia_valid &= ~ATTR_MODE;
365 }
352 366
353 if (S_ISDIR(inode->i_mode)) 367 error = inode_setattr(inode, attr);
354 mask = sbi->options.fs_dmask;
355 else
356 mask = sbi->options.fs_fmask;
357 inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask);
358out: 368out:
359 unlock_kernel(); 369 unlock_kernel();
360 return error; 370 return error;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 17403629e330..ab8ccc9d14ff 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -315,9 +315,9 @@ struct mem_size_stats {
315}; 315};
316 316
317static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 317static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
318 void *private) 318 struct mm_walk *walk)
319{ 319{
320 struct mem_size_stats *mss = private; 320 struct mem_size_stats *mss = walk->private;
321 struct vm_area_struct *vma = mss->vma; 321 struct vm_area_struct *vma = mss->vma;
322 pte_t *pte, ptent; 322 pte_t *pte, ptent;
323 spinlock_t *ptl; 323 spinlock_t *ptl;
@@ -365,19 +365,21 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
365 return 0; 365 return 0;
366} 366}
367 367
368static struct mm_walk smaps_walk = { .pmd_entry = smaps_pte_range };
369
370static int show_smap(struct seq_file *m, void *v) 368static int show_smap(struct seq_file *m, void *v)
371{ 369{
372 struct vm_area_struct *vma = v; 370 struct vm_area_struct *vma = v;
373 struct mem_size_stats mss; 371 struct mem_size_stats mss;
374 int ret; 372 int ret;
373 struct mm_walk smaps_walk = {
374 .pmd_entry = smaps_pte_range,
375 .mm = vma->vm_mm,
376 .private = &mss,
377 };
375 378
376 memset(&mss, 0, sizeof mss); 379 memset(&mss, 0, sizeof mss);
377 mss.vma = vma; 380 mss.vma = vma;
378 if (vma->vm_mm && !is_vm_hugetlb_page(vma)) 381 if (vma->vm_mm && !is_vm_hugetlb_page(vma))
379 walk_page_range(vma->vm_mm, vma->vm_start, vma->vm_end, 382 walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk);
380 &smaps_walk, &mss);
381 383
382 ret = show_map(m, v); 384 ret = show_map(m, v);
383 if (ret) 385 if (ret)
@@ -426,9 +428,9 @@ const struct file_operations proc_smaps_operations = {
426}; 428};
427 429
428static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, 430static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
429 unsigned long end, void *private) 431 unsigned long end, struct mm_walk *walk)
430{ 432{
431 struct vm_area_struct *vma = private; 433 struct vm_area_struct *vma = walk->private;
432 pte_t *pte, ptent; 434 pte_t *pte, ptent;
433 spinlock_t *ptl; 435 spinlock_t *ptl;
434 struct page *page; 436 struct page *page;
@@ -452,8 +454,6 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
452 return 0; 454 return 0;
453} 455}
454 456
455static struct mm_walk clear_refs_walk = { .pmd_entry = clear_refs_pte_range };
456
457static ssize_t clear_refs_write(struct file *file, const char __user *buf, 457static ssize_t clear_refs_write(struct file *file, const char __user *buf,
458 size_t count, loff_t *ppos) 458 size_t count, loff_t *ppos)
459{ 459{
@@ -476,11 +476,17 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
476 return -ESRCH; 476 return -ESRCH;
477 mm = get_task_mm(task); 477 mm = get_task_mm(task);
478 if (mm) { 478 if (mm) {
479 static struct mm_walk clear_refs_walk;
480 memset(&clear_refs_walk, 0, sizeof(clear_refs_walk));
481 clear_refs_walk.pmd_entry = clear_refs_pte_range;
482 clear_refs_walk.mm = mm;
479 down_read(&mm->mmap_sem); 483 down_read(&mm->mmap_sem);
480 for (vma = mm->mmap; vma; vma = vma->vm_next) 484 for (vma = mm->mmap; vma; vma = vma->vm_next) {
485 clear_refs_walk.private = vma;
481 if (!is_vm_hugetlb_page(vma)) 486 if (!is_vm_hugetlb_page(vma))
482 walk_page_range(mm, vma->vm_start, vma->vm_end, 487 walk_page_range(vma->vm_start, vma->vm_end,
483 &clear_refs_walk, vma); 488 &clear_refs_walk);
489 }
484 flush_tlb_mm(mm); 490 flush_tlb_mm(mm);
485 up_read(&mm->mmap_sem); 491 up_read(&mm->mmap_sem);
486 mmput(mm); 492 mmput(mm);
@@ -528,9 +534,9 @@ static int add_to_pagemap(unsigned long addr, u64 pfn,
528} 534}
529 535
530static int pagemap_pte_hole(unsigned long start, unsigned long end, 536static int pagemap_pte_hole(unsigned long start, unsigned long end,
531 void *private) 537 struct mm_walk *walk)
532{ 538{
533 struct pagemapread *pm = private; 539 struct pagemapread *pm = walk->private;
534 unsigned long addr; 540 unsigned long addr;
535 int err = 0; 541 int err = 0;
536 for (addr = start; addr < end; addr += PAGE_SIZE) { 542 for (addr = start; addr < end; addr += PAGE_SIZE) {
@@ -547,24 +553,45 @@ static u64 swap_pte_to_pagemap_entry(pte_t pte)
547 return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT); 553 return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT);
548} 554}
549 555
556static unsigned long pte_to_pagemap_entry(pte_t pte)
557{
558 unsigned long pme = 0;
559 if (is_swap_pte(pte))
560 pme = PM_PFRAME(swap_pte_to_pagemap_entry(pte))
561 | PM_PSHIFT(PAGE_SHIFT) | PM_SWAP;
562 else if (pte_present(pte))
563 pme = PM_PFRAME(pte_pfn(pte))
564 | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT;
565 return pme;
566}
567
550static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 568static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
551 void *private) 569 struct mm_walk *walk)
552{ 570{
553 struct pagemapread *pm = private; 571 struct vm_area_struct *vma;
572 struct pagemapread *pm = walk->private;
554 pte_t *pte; 573 pte_t *pte;
555 int err = 0; 574 int err = 0;
556 575
576 /* find the first VMA at or above 'addr' */
577 vma = find_vma(walk->mm, addr);
557 for (; addr != end; addr += PAGE_SIZE) { 578 for (; addr != end; addr += PAGE_SIZE) {
558 u64 pfn = PM_NOT_PRESENT; 579 u64 pfn = PM_NOT_PRESENT;
559 pte = pte_offset_map(pmd, addr); 580
560 if (is_swap_pte(*pte)) 581 /* check to see if we've left 'vma' behind
561 pfn = PM_PFRAME(swap_pte_to_pagemap_entry(*pte)) 582 * and need a new, higher one */
562 | PM_PSHIFT(PAGE_SHIFT) | PM_SWAP; 583 if (vma && (addr >= vma->vm_end))
563 else if (pte_present(*pte)) 584 vma = find_vma(walk->mm, addr);
564 pfn = PM_PFRAME(pte_pfn(*pte)) 585
565 | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT; 586 /* check that 'vma' actually covers this address,
566 /* unmap so we're not in atomic when we copy to userspace */ 587 * and that it isn't a huge page vma */
567 pte_unmap(pte); 588 if (vma && (vma->vm_start <= addr) &&
589 !is_vm_hugetlb_page(vma)) {
590 pte = pte_offset_map(pmd, addr);
591 pfn = pte_to_pagemap_entry(*pte);
592 /* unmap before userspace copy */
593 pte_unmap(pte);
594 }
568 err = add_to_pagemap(addr, pfn, pm); 595 err = add_to_pagemap(addr, pfn, pm);
569 if (err) 596 if (err)
570 return err; 597 return err;
@@ -675,8 +702,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
675 * user buffer is tracked in "pm", and the walk 702 * user buffer is tracked in "pm", and the walk
676 * will stop when we hit the end of the buffer. 703 * will stop when we hit the end of the buffer.
677 */ 704 */
678 ret = walk_page_range(mm, start_vaddr, end_vaddr, 705 ret = walk_page_range(start_vaddr, end_vaddr,
679 &pagemap_walk, &pm); 706 &pagemap_walk);
680 if (ret == PM_END_OF_BUFFER) 707 if (ret == PM_END_OF_BUFFER)
681 ret = 0; 708 ret = 0;
682 /* don't need mmap_sem for these, but this looks cleaner */ 709 /* don't need mmap_sem for these, but this looks cleaner */
diff --git a/include/asm-arm/arch-pxa/regs-lcd.h b/include/asm-arm/arch-pxa/regs-lcd.h
index f762493f5141..3ba464c913a5 100644
--- a/include/asm-arm/arch-pxa/regs-lcd.h
+++ b/include/asm-arm/arch-pxa/regs-lcd.h
@@ -1,5 +1,8 @@
1#ifndef __ASM_ARCH_REGS_LCD_H 1#ifndef __ASM_ARCH_REGS_LCD_H
2#define __ASM_ARCH_REGS_LCD_H 2#define __ASM_ARCH_REGS_LCD_H
3
4#include <asm/arch/bitfield.h>
5
3/* 6/*
4 * LCD Controller Registers and Bits Definitions 7 * LCD Controller Registers and Bits Definitions
5 */ 8 */
@@ -69,7 +72,7 @@
69#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */ 72#define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */
70#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */ 73#define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */
71#define LCCR0_PDD_S 12 74#define LCCR0_PDD_S 12
72#define LCCR0_BM (1 << 20) /* Branch mask */ 75#define LCCR0_BM (1 << 20) /* Branch mask */
73#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */ 76#define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */
74#define LCCR0_LCDT (1 << 22) /* LCD panel type */ 77#define LCCR0_LCDT (1 << 22) /* LCD panel type */
75#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */ 78#define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index 83d1f286230b..3e8106442d5a 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -410,8 +410,49 @@ static inline int ext2_find_next_zero_bit(const void *vaddr, unsigned size,
410 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr)); 410 res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
411 return (p - addr) * 32 + res; 411 return (p - addr) * 32 + res;
412} 412}
413#define ext2_find_next_bit(addr, size, off) \ 413
414 generic_find_next_le_bit((unsigned long *)(addr), (size), (off)) 414static inline int ext2_find_first_bit(const void *vaddr, unsigned size)
415{
416 const unsigned long *p = vaddr, *addr = vaddr;
417 int res;
418
419 if (!size)
420 return 0;
421
422 size = (size >> 5) + ((size & 31) > 0);
423 while (*p++ == 0UL) {
424 if (--size == 0)
425 return (p - addr) << 5;
426 }
427
428 --p;
429 for (res = 0; res < 32; res++)
430 if (ext2_test_bit(res, p))
431 break;
432 return (p - addr) * 32 + res;
433}
434
435static inline int ext2_find_next_bit(const void *vaddr, unsigned size,
436 unsigned offset)
437{
438 const unsigned long *addr = vaddr;
439 const unsigned long *p = addr + (offset >> 5);
440 int bit = offset & 31UL, res;
441
442 if (offset >= size)
443 return size;
444
445 if (bit) {
446 /* Look for one in first longword */
447 for (res = bit; res < 32; res++)
448 if (ext2_test_bit(res, p))
449 return (p - addr) * 32 + res;
450 p++;
451 }
452 /* No set bit yet, search remaining full bytes for a set bit */
453 res = ext2_find_first_bit(p, size - 32 * (p - addr));
454 return (p - addr) * 32 + res;
455}
415 456
416#endif /* __KERNEL__ */ 457#endif /* __KERNEL__ */
417 458
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c31a9cd2a30e..586a943cab01 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -760,16 +760,17 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
760 * (see walk_page_range for more details) 760 * (see walk_page_range for more details)
761 */ 761 */
762struct mm_walk { 762struct mm_walk {
763 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, void *); 763 int (*pgd_entry)(pgd_t *, unsigned long, unsigned long, struct mm_walk *);
764 int (*pud_entry)(pud_t *, unsigned long, unsigned long, void *); 764 int (*pud_entry)(pud_t *, unsigned long, unsigned long, struct mm_walk *);
765 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, void *); 765 int (*pmd_entry)(pmd_t *, unsigned long, unsigned long, struct mm_walk *);
766 int (*pte_entry)(pte_t *, unsigned long, unsigned long, void *); 766 int (*pte_entry)(pte_t *, unsigned long, unsigned long, struct mm_walk *);
767 int (*pte_hole)(unsigned long, unsigned long, void *); 767 int (*pte_hole)(unsigned long, unsigned long, struct mm_walk *);
768 struct mm_struct *mm;
769 void *private;
768}; 770};
769 771
770int walk_page_range(const struct mm_struct *, unsigned long addr, 772int walk_page_range(unsigned long addr, unsigned long end,
771 unsigned long end, const struct mm_walk *walk, 773 struct mm_walk *walk);
772 void *private);
773void free_pgd_range(struct mmu_gather **tlb, unsigned long addr, 774void free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
774 unsigned long end, unsigned long floor, unsigned long ceiling); 775 unsigned long end, unsigned long floor, unsigned long ceiling);
775void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma, 776void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *start_vma,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9b940e644179..eafc9d6d2b35 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -716,6 +716,7 @@
716#define PCI_DEVICE_ID_HP_CISSA 0x3220 716#define PCI_DEVICE_ID_HP_CISSA 0x3220
717#define PCI_DEVICE_ID_HP_CISSC 0x3230 717#define PCI_DEVICE_ID_HP_CISSC 0x3230
718#define PCI_DEVICE_ID_HP_CISSD 0x3238 718#define PCI_DEVICE_ID_HP_CISSD 0x3238
719#define PCI_DEVICE_ID_HP_CISSE 0x323a
719#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 720#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
720 721
721#define PCI_VENDOR_ID_PCTECH 0x1042 722#define PCI_VENDOR_ID_PCTECH 0x1042
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 9883bc942262..fff1d27ddb4c 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -9,6 +9,8 @@
9 9
10struct net; 10struct net;
11struct completion; 11struct completion;
12struct mm_struct;
13
12/* 14/*
13 * The proc filesystem constants/structures 15 * The proc filesystem constants/structures
14 */ 16 */
@@ -101,8 +103,6 @@ extern spinlock_t proc_subdir_lock;
101extern void proc_root_init(void); 103extern void proc_root_init(void);
102extern void proc_misc_init(void); 104extern void proc_misc_init(void);
103 105
104struct mm_struct;
105
106void proc_flush_task(struct task_struct *task); 106void proc_flush_task(struct task_struct *task);
107struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *); 107struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
108int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir); 108int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 18e62e3d406f..b31b6b74aa28 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -239,11 +239,6 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
239 return (struct tcp_request_sock *)req; 239 return (struct tcp_request_sock *)req;
240} 240}
241 241
242struct tcp_deferred_accept_info {
243 struct sock *listen_sk;
244 struct request_sock *request;
245};
246
247struct tcp_sock { 242struct tcp_sock {
248 /* inet_connection_sock has to be the first member of tcp_sock */ 243 /* inet_connection_sock has to be the first member of tcp_sock */
249 struct inet_connection_sock inet_conn; 244 struct inet_connection_sock inet_conn;
@@ -379,8 +374,6 @@ struct tcp_sock {
379 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 374 unsigned int keepalive_intvl; /* time interval between keep alive probes */
380 int linger2; 375 int linger2;
381 376
382 struct tcp_deferred_accept_info defer_tcp_accept;
383
384 unsigned long last_synq_overflow; 377 unsigned long last_synq_overflow;
385 378
386 u32 tso_deferred; 379 u32 tso_deferred;
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index b220b5f624de..0c96e7bed5db 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -115,8 +115,8 @@ struct request_sock_queue {
115 struct request_sock *rskq_accept_head; 115 struct request_sock *rskq_accept_head;
116 struct request_sock *rskq_accept_tail; 116 struct request_sock *rskq_accept_tail;
117 rwlock_t syn_wait_lock; 117 rwlock_t syn_wait_lock;
118 u16 rskq_defer_accept; 118 u8 rskq_defer_accept;
119 /* 2 bytes hole, try to pack */ 119 /* 3 bytes hole, try to pack */
120 struct listen_sock *listen_opt; 120 struct listen_sock *listen_opt;
121}; 121};
122 122
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d448310c82c1..cf54034019d9 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -139,7 +139,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
139#define MAX_TCP_KEEPINTVL 32767 139#define MAX_TCP_KEEPINTVL 32767
140#define MAX_TCP_KEEPCNT 127 140#define MAX_TCP_KEEPCNT 127
141#define MAX_TCP_SYNCNT 127 141#define MAX_TCP_SYNCNT 127
142#define MAX_TCP_ACCEPT_DEFERRED 65535
143 142
144#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */ 143#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */
145 144
diff --git a/ipc/shm.c b/ipc/shm.c
index d05f6b564998..790240cd067f 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1058,16 +1058,16 @@ asmlinkage long sys_shmdt(char __user *shmaddr)
1058static int sysvipc_shm_proc_show(struct seq_file *s, void *it) 1058static int sysvipc_shm_proc_show(struct seq_file *s, void *it)
1059{ 1059{
1060 struct shmid_kernel *shp = it; 1060 struct shmid_kernel *shp = it;
1061 char *format;
1062 1061
1063#define SMALL_STRING "%10d %10d %4o %10u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu\n" 1062#if BITS_PER_LONG <= 32
1064#define BIG_STRING "%10d %10d %4o %21u %5u %5u %5d %5u %5u %5u %5u %10lu %10lu %10lu\n" 1063#define SIZE_SPEC "%10lu"
1064#else
1065#define SIZE_SPEC "%21lu"
1066#endif
1065 1067
1066 if (sizeof(size_t) <= sizeof(int)) 1068 return seq_printf(s,
1067 format = SMALL_STRING; 1069 "%10d %10d %4o " SIZE_SPEC " %5u %5u "
1068 else 1070 "%5lu %5u %5u %5u %5u %10lu %10lu %10lu\n",
1069 format = BIG_STRING;
1070 return seq_printf(s, format,
1071 shp->shm_perm.key, 1071 shp->shm_perm.key,
1072 shp->shm_perm.id, 1072 shp->shm_perm.id,
1073 shp->shm_perm.mode, 1073 shp->shm_perm.mode,
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 1e0250cb9486..d4998f81e229 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -699,8 +699,9 @@ static int __register_kprobes(struct kprobe **kps, int num,
699 return -EINVAL; 699 return -EINVAL;
700 for (i = 0; i < num; i++) { 700 for (i = 0; i < num; i++) {
701 ret = __register_kprobe(kps[i], called_from); 701 ret = __register_kprobe(kps[i], called_from);
702 if (ret < 0 && i > 0) { 702 if (ret < 0) {
703 unregister_kprobes(kps, i); 703 if (i > 0)
704 unregister_kprobes(kps, i);
704 break; 705 break;
705 } 706 }
706 } 707 }
@@ -776,8 +777,9 @@ static int __register_jprobes(struct jprobe **jps, int num,
776 jp->kp.break_handler = longjmp_break_handler; 777 jp->kp.break_handler = longjmp_break_handler;
777 ret = __register_kprobe(&jp->kp, called_from); 778 ret = __register_kprobe(&jp->kp, called_from);
778 } 779 }
779 if (ret < 0 && i > 0) { 780 if (ret < 0) {
780 unregister_jprobes(jps, i); 781 if (i > 0)
782 unregister_jprobes(jps, i);
781 break; 783 break;
782 } 784 }
783 } 785 }
@@ -920,8 +922,9 @@ static int __register_kretprobes(struct kretprobe **rps, int num,
920 return -EINVAL; 922 return -EINVAL;
921 for (i = 0; i < num; i++) { 923 for (i = 0; i < num; i++) {
922 ret = __register_kretprobe(rps[i], called_from); 924 ret = __register_kretprobe(rps[i], called_from);
923 if (ret < 0 && i > 0) { 925 if (ret < 0) {
924 unregister_kretprobes(rps, i); 926 if (i > 0)
927 unregister_kretprobes(rps, i);
925 break; 928 break;
926 } 929 }
927 } 930 }
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index bd521716ab1a..169a2f8dabcc 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -88,6 +88,57 @@ static inline gfp_t root_gfp_mask(struct radix_tree_root *root)
88 return root->gfp_mask & __GFP_BITS_MASK; 88 return root->gfp_mask & __GFP_BITS_MASK;
89} 89}
90 90
91static inline void tag_set(struct radix_tree_node *node, unsigned int tag,
92 int offset)
93{
94 __set_bit(offset, node->tags[tag]);
95}
96
97static inline void tag_clear(struct radix_tree_node *node, unsigned int tag,
98 int offset)
99{
100 __clear_bit(offset, node->tags[tag]);
101}
102
103static inline int tag_get(struct radix_tree_node *node, unsigned int tag,
104 int offset)
105{
106 return test_bit(offset, node->tags[tag]);
107}
108
109static inline void root_tag_set(struct radix_tree_root *root, unsigned int tag)
110{
111 root->gfp_mask |= (__force gfp_t)(1 << (tag + __GFP_BITS_SHIFT));
112}
113
114static inline void root_tag_clear(struct radix_tree_root *root, unsigned int tag)
115{
116 root->gfp_mask &= (__force gfp_t)~(1 << (tag + __GFP_BITS_SHIFT));
117}
118
119static inline void root_tag_clear_all(struct radix_tree_root *root)
120{
121 root->gfp_mask &= __GFP_BITS_MASK;
122}
123
124static inline int root_tag_get(struct radix_tree_root *root, unsigned int tag)
125{
126 return (__force unsigned)root->gfp_mask & (1 << (tag + __GFP_BITS_SHIFT));
127}
128
129/*
130 * Returns 1 if any slot in the node has this tag set.
131 * Otherwise returns 0.
132 */
133static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag)
134{
135 int idx;
136 for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) {
137 if (node->tags[tag][idx])
138 return 1;
139 }
140 return 0;
141}
91/* 142/*
92 * This assumes that the caller has performed appropriate preallocation, and 143 * This assumes that the caller has performed appropriate preallocation, and
93 * that the caller has pinned this thread of control to the current CPU. 144 * that the caller has pinned this thread of control to the current CPU.
@@ -124,6 +175,17 @@ static void radix_tree_node_rcu_free(struct rcu_head *head)
124{ 175{
125 struct radix_tree_node *node = 176 struct radix_tree_node *node =
126 container_of(head, struct radix_tree_node, rcu_head); 177 container_of(head, struct radix_tree_node, rcu_head);
178
179 /*
180 * must only free zeroed nodes into the slab. radix_tree_shrink
181 * can leave us with a non-NULL entry in the first slot, so clear
182 * that here to make sure.
183 */
184 tag_clear(node, 0, 0);
185 tag_clear(node, 1, 0);
186 node->slots[0] = NULL;
187 node->count = 0;
188
127 kmem_cache_free(radix_tree_node_cachep, node); 189 kmem_cache_free(radix_tree_node_cachep, node);
128} 190}
129 191
@@ -165,59 +227,6 @@ out:
165} 227}
166EXPORT_SYMBOL(radix_tree_preload); 228EXPORT_SYMBOL(radix_tree_preload);
167 229
168static inline void tag_set(struct radix_tree_node *node, unsigned int tag,
169 int offset)
170{
171 __set_bit(offset, node->tags[tag]);
172}
173
174static inline void tag_clear(struct radix_tree_node *node, unsigned int tag,
175 int offset)
176{
177 __clear_bit(offset, node->tags[tag]);
178}
179
180static inline int tag_get(struct radix_tree_node *node, unsigned int tag,
181 int offset)
182{
183 return test_bit(offset, node->tags[tag]);
184}
185
186static inline void root_tag_set(struct radix_tree_root *root, unsigned int tag)
187{
188 root->gfp_mask |= (__force gfp_t)(1 << (tag + __GFP_BITS_SHIFT));
189}
190
191
192static inline void root_tag_clear(struct radix_tree_root *root, unsigned int tag)
193{
194 root->gfp_mask &= (__force gfp_t)~(1 << (tag + __GFP_BITS_SHIFT));
195}
196
197static inline void root_tag_clear_all(struct radix_tree_root *root)
198{
199 root->gfp_mask &= __GFP_BITS_MASK;
200}
201
202static inline int root_tag_get(struct radix_tree_root *root, unsigned int tag)
203{
204 return (__force unsigned)root->gfp_mask & (1 << (tag + __GFP_BITS_SHIFT));
205}
206
207/*
208 * Returns 1 if any slot in the node has this tag set.
209 * Otherwise returns 0.
210 */
211static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag)
212{
213 int idx;
214 for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) {
215 if (node->tags[tag][idx])
216 return 1;
217 }
218 return 0;
219}
220
221/* 230/*
222 * Return the maximum key which can be store into a 231 * Return the maximum key which can be store into a
223 * radix tree with height HEIGHT. 232 * radix tree with height HEIGHT.
@@ -930,11 +939,6 @@ static inline void radix_tree_shrink(struct radix_tree_root *root)
930 newptr = radix_tree_ptr_to_indirect(newptr); 939 newptr = radix_tree_ptr_to_indirect(newptr);
931 root->rnode = newptr; 940 root->rnode = newptr;
932 root->height--; 941 root->height--;
933 /* must only free zeroed nodes into the slab */
934 tag_clear(to_free, 0, 0);
935 tag_clear(to_free, 1, 0);
936 to_free->slots[0] = NULL;
937 to_free->count = 0;
938 radix_tree_node_free(to_free); 942 radix_tree_node_free(to_free);
939 } 943 }
940} 944}
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index 0afd2387e507..d5878bed7841 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -3,14 +3,14 @@
3#include <linux/sched.h> 3#include <linux/sched.h>
4 4
5static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 5static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
6 const struct mm_walk *walk, void *private) 6 struct mm_walk *walk)
7{ 7{
8 pte_t *pte; 8 pte_t *pte;
9 int err = 0; 9 int err = 0;
10 10
11 pte = pte_offset_map(pmd, addr); 11 pte = pte_offset_map(pmd, addr);
12 for (;;) { 12 for (;;) {
13 err = walk->pte_entry(pte, addr, addr + PAGE_SIZE, private); 13 err = walk->pte_entry(pte, addr, addr + PAGE_SIZE, walk);
14 if (err) 14 if (err)
15 break; 15 break;
16 addr += PAGE_SIZE; 16 addr += PAGE_SIZE;
@@ -24,7 +24,7 @@ static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
24} 24}
25 25
26static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, 26static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
27 const struct mm_walk *walk, void *private) 27 struct mm_walk *walk)
28{ 28{
29 pmd_t *pmd; 29 pmd_t *pmd;
30 unsigned long next; 30 unsigned long next;
@@ -35,15 +35,15 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
35 next = pmd_addr_end(addr, end); 35 next = pmd_addr_end(addr, end);
36 if (pmd_none_or_clear_bad(pmd)) { 36 if (pmd_none_or_clear_bad(pmd)) {
37 if (walk->pte_hole) 37 if (walk->pte_hole)
38 err = walk->pte_hole(addr, next, private); 38 err = walk->pte_hole(addr, next, walk);
39 if (err) 39 if (err)
40 break; 40 break;
41 continue; 41 continue;
42 } 42 }
43 if (walk->pmd_entry) 43 if (walk->pmd_entry)
44 err = walk->pmd_entry(pmd, addr, next, private); 44 err = walk->pmd_entry(pmd, addr, next, walk);
45 if (!err && walk->pte_entry) 45 if (!err && walk->pte_entry)
46 err = walk_pte_range(pmd, addr, next, walk, private); 46 err = walk_pte_range(pmd, addr, next, walk);
47 if (err) 47 if (err)
48 break; 48 break;
49 } while (pmd++, addr = next, addr != end); 49 } while (pmd++, addr = next, addr != end);
@@ -52,7 +52,7 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
52} 52}
53 53
54static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end, 54static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
55 const struct mm_walk *walk, void *private) 55 struct mm_walk *walk)
56{ 56{
57 pud_t *pud; 57 pud_t *pud;
58 unsigned long next; 58 unsigned long next;
@@ -63,15 +63,15 @@ static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
63 next = pud_addr_end(addr, end); 63 next = pud_addr_end(addr, end);
64 if (pud_none_or_clear_bad(pud)) { 64 if (pud_none_or_clear_bad(pud)) {
65 if (walk->pte_hole) 65 if (walk->pte_hole)
66 err = walk->pte_hole(addr, next, private); 66 err = walk->pte_hole(addr, next, walk);
67 if (err) 67 if (err)
68 break; 68 break;
69 continue; 69 continue;
70 } 70 }
71 if (walk->pud_entry) 71 if (walk->pud_entry)
72 err = walk->pud_entry(pud, addr, next, private); 72 err = walk->pud_entry(pud, addr, next, walk);
73 if (!err && (walk->pmd_entry || walk->pte_entry)) 73 if (!err && (walk->pmd_entry || walk->pte_entry))
74 err = walk_pmd_range(pud, addr, next, walk, private); 74 err = walk_pmd_range(pud, addr, next, walk);
75 if (err) 75 if (err)
76 break; 76 break;
77 } while (pud++, addr = next, addr != end); 77 } while (pud++, addr = next, addr != end);
@@ -85,15 +85,15 @@ static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
85 * @addr: starting address 85 * @addr: starting address
86 * @end: ending address 86 * @end: ending address
87 * @walk: set of callbacks to invoke for each level of the tree 87 * @walk: set of callbacks to invoke for each level of the tree
88 * @private: private data passed to the callback function
89 * 88 *
90 * Recursively walk the page table for the memory area in a VMA, 89 * Recursively walk the page table for the memory area in a VMA,
91 * calling supplied callbacks. Callbacks are called in-order (first 90 * calling supplied callbacks. Callbacks are called in-order (first
92 * PGD, first PUD, first PMD, first PTE, second PTE... second PMD, 91 * PGD, first PUD, first PMD, first PTE, second PTE... second PMD,
93 * etc.). If lower-level callbacks are omitted, walking depth is reduced. 92 * etc.). If lower-level callbacks are omitted, walking depth is reduced.
94 * 93 *
95 * Each callback receives an entry pointer, the start and end of the 94 * Each callback receives an entry pointer and the start and end of the
96 * associated range, and a caller-supplied private data pointer. 95 * associated range, and a copy of the original mm_walk for access to
96 * the ->private or ->mm fields.
97 * 97 *
98 * No locks are taken, but the bottom level iterator will map PTE 98 * No locks are taken, but the bottom level iterator will map PTE
99 * directories from highmem if necessary. 99 * directories from highmem if necessary.
@@ -101,9 +101,8 @@ static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
101 * If any callback returns a non-zero value, the walk is aborted and 101 * If any callback returns a non-zero value, the walk is aborted and
102 * the return value is propagated back to the caller. Otherwise 0 is returned. 102 * the return value is propagated back to the caller. Otherwise 0 is returned.
103 */ 103 */
104int walk_page_range(const struct mm_struct *mm, 104int walk_page_range(unsigned long addr, unsigned long end,
105 unsigned long addr, unsigned long end, 105 struct mm_walk *walk)
106 const struct mm_walk *walk, void *private)
107{ 106{
108 pgd_t *pgd; 107 pgd_t *pgd;
109 unsigned long next; 108 unsigned long next;
@@ -112,21 +111,24 @@ int walk_page_range(const struct mm_struct *mm,
112 if (addr >= end) 111 if (addr >= end)
113 return err; 112 return err;
114 113
115 pgd = pgd_offset(mm, addr); 114 if (!walk->mm)
115 return -EINVAL;
116
117 pgd = pgd_offset(walk->mm, addr);
116 do { 118 do {
117 next = pgd_addr_end(addr, end); 119 next = pgd_addr_end(addr, end);
118 if (pgd_none_or_clear_bad(pgd)) { 120 if (pgd_none_or_clear_bad(pgd)) {
119 if (walk->pte_hole) 121 if (walk->pte_hole)
120 err = walk->pte_hole(addr, next, private); 122 err = walk->pte_hole(addr, next, walk);
121 if (err) 123 if (err)
122 break; 124 break;
123 continue; 125 continue;
124 } 126 }
125 if (walk->pgd_entry) 127 if (walk->pgd_entry)
126 err = walk->pgd_entry(pgd, addr, next, private); 128 err = walk->pgd_entry(pgd, addr, next, walk);
127 if (!err && 129 if (!err &&
128 (walk->pud_entry || walk->pmd_entry || walk->pte_entry)) 130 (walk->pud_entry || walk->pmd_entry || walk->pte_entry))
129 err = walk_pud_range(pgd, addr, next, walk, private); 131 err = walk_pud_range(pgd, addr, next, walk);
130 if (err) 132 if (err)
131 break; 133 break;
132 } while (pgd++, addr = next, addr != end); 134 } while (pgd++, addr = next, addr != end);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9a29901ad3b3..967d30ccd92b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1307,7 +1307,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
1307 struct scan_control *sc) 1307 struct scan_control *sc)
1308{ 1308{
1309 int priority; 1309 int priority;
1310 int ret = 0; 1310 unsigned long ret = 0;
1311 unsigned long total_scanned = 0; 1311 unsigned long total_scanned = 0;
1312 unsigned long nr_reclaimed = 0; 1312 unsigned long nr_reclaimed = 0;
1313 struct reclaim_state *reclaim_state = current->reclaim_state; 1313 struct reclaim_state *reclaim_state = current->reclaim_state;
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 6de4bd195d28..1e8be246ad15 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -290,12 +290,12 @@ int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
290 290
291 while (1) { 291 while (1) {
292 const u8 len = dccp_ackvec_len(av, index); 292 const u8 len = dccp_ackvec_len(av, index);
293 const u8 state = dccp_ackvec_state(av, index); 293 const u8 av_state = dccp_ackvec_state(av, index);
294 /* 294 /*
295 * valid packets not yet in av_buf have a reserved 295 * valid packets not yet in av_buf have a reserved
296 * entry, with a len equal to 0. 296 * entry, with a len equal to 0.
297 */ 297 */
298 if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED && 298 if (av_state == DCCP_ACKVEC_STATE_NOT_RECEIVED &&
299 len == 0 && delta == 0) { /* Found our 299 len == 0 && delta == 0) { /* Found our
300 reserved seat! */ 300 reserved seat! */
301 dccp_pr_debug("Found %llu reserved seat!\n", 301 dccp_pr_debug("Found %llu reserved seat!\n",
@@ -325,31 +325,6 @@ out_duplicate:
325 return -EILSEQ; 325 return -EILSEQ;
326} 326}
327 327
328#ifdef CONFIG_IP_DCCP_DEBUG
329void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len)
330{
331 dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len,
332 (unsigned long long)ackno);
333
334 while (len--) {
335 const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6;
336 const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK;
337
338 dccp_pr_debug_cat("%d,%d|", state, rl);
339 ++vector;
340 }
341
342 dccp_pr_debug_cat("\n");
343}
344
345void dccp_ackvec_print(const struct dccp_ackvec *av)
346{
347 dccp_ackvector_print(av->av_buf_ackno,
348 av->av_buf + av->av_buf_head,
349 av->av_vec_len);
350}
351#endif
352
353static void dccp_ackvec_throw_record(struct dccp_ackvec *av, 328static void dccp_ackvec_throw_record(struct dccp_ackvec *av,
354 struct dccp_ackvec_record *avr) 329 struct dccp_ackvec_record *avr)
355{ 330{
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index f813077234b7..a1929f33d703 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -159,8 +159,8 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
159 } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld) 159 } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld)
160 - (s64)hctx->ccid3hctx_rtt >= 0) { 160 - (s64)hctx->ccid3hctx_rtt >= 0) {
161 161
162 hctx->ccid3hctx_x = 162 hctx->ccid3hctx_x = min(2 * hctx->ccid3hctx_x, min_rate);
163 max(min(2 * hctx->ccid3hctx_x, min_rate), 163 hctx->ccid3hctx_x = max(hctx->ccid3hctx_x,
164 scaled_div(((__u64)hctx->ccid3hctx_s) << 6, 164 scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
165 hctx->ccid3hctx_rtt)); 165 hctx->ccid3hctx_rtt));
166 hctx->ccid3hctx_t_ld = now; 166 hctx->ccid3hctx_t_ld = now;
@@ -329,8 +329,14 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
329 hctx->ccid3hctx_x = rfc3390_initial_rate(sk); 329 hctx->ccid3hctx_x = rfc3390_initial_rate(sk);
330 hctx->ccid3hctx_t_ld = now; 330 hctx->ccid3hctx_t_ld = now;
331 } else { 331 } else {
332 /* Sender does not have RTT sample: X_pps = 1 pkt/sec */ 332 /*
333 hctx->ccid3hctx_x = hctx->ccid3hctx_s; 333 * Sender does not have RTT sample:
334 * - set fallback RTT (RFC 4340, 3.4) since a RTT value
335 * is needed in several parts (e.g. window counter);
336 * - set sending rate X_pps = 1pps as per RFC 3448, 4.2.
337 */
338 hctx->ccid3hctx_rtt = DCCP_FALLBACK_RTT;
339 hctx->ccid3hctx_x = hctx->ccid3hctx_s;
334 hctx->ccid3hctx_x <<= 6; 340 hctx->ccid3hctx_x <<= 6;
335 } 341 }
336 ccid3_update_send_interval(hctx); 342 ccid3_update_send_interval(hctx);
diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c
index d1dfbb8de64c..97ecec0a8e76 100644
--- a/net/dccp/ccids/lib/tfrc.c
+++ b/net/dccp/ccids/lib/tfrc.c
@@ -14,14 +14,6 @@ module_param(tfrc_debug, bool, 0444);
14MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); 14MODULE_PARM_DESC(tfrc_debug, "Enable debug messages");
15#endif 15#endif
16 16
17extern int tfrc_tx_packet_history_init(void);
18extern void tfrc_tx_packet_history_exit(void);
19extern int tfrc_rx_packet_history_init(void);
20extern void tfrc_rx_packet_history_exit(void);
21
22extern int tfrc_li_init(void);
23extern void tfrc_li_exit(void);
24
25static int __init tfrc_module_init(void) 17static int __init tfrc_module_init(void)
26{ 18{
27 int rc = tfrc_li_init(); 19 int rc = tfrc_li_init();
diff --git a/net/dccp/ccids/lib/tfrc.h b/net/dccp/ccids/lib/tfrc.h
index 1fb1187bbf1c..ed9857527acf 100644
--- a/net/dccp/ccids/lib/tfrc.h
+++ b/net/dccp/ccids/lib/tfrc.h
@@ -15,7 +15,7 @@
15 * (at your option) any later version. 15 * (at your option) any later version.
16 */ 16 */
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/div64.h> 18#include <linux/math64.h>
19#include "../../dccp.h" 19#include "../../dccp.h"
20/* internal includes that this module exports: */ 20/* internal includes that this module exports: */
21#include "loss_interval.h" 21#include "loss_interval.h"
@@ -29,21 +29,19 @@ extern int tfrc_debug;
29#endif 29#endif
30 30
31/* integer-arithmetic divisions of type (a * 1000000)/b */ 31/* integer-arithmetic divisions of type (a * 1000000)/b */
32static inline u64 scaled_div(u64 a, u32 b) 32static inline u64 scaled_div(u64 a, u64 b)
33{ 33{
34 BUG_ON(b==0); 34 BUG_ON(b==0);
35 a *= 1000000; 35 return div64_u64(a * 1000000, b);
36 do_div(a, b);
37 return a;
38} 36}
39 37
40static inline u32 scaled_div32(u64 a, u32 b) 38static inline u32 scaled_div32(u64 a, u64 b)
41{ 39{
42 u64 result = scaled_div(a, b); 40 u64 result = scaled_div(a, b);
43 41
44 if (result > UINT_MAX) { 42 if (result > UINT_MAX) {
45 DCCP_CRIT("Overflow: a(%llu)/b(%u) > ~0U", 43 DCCP_CRIT("Overflow: %llu/%llu > UINT_MAX",
46 (unsigned long long)a, b); 44 (unsigned long long)a, (unsigned long long)b);
47 return UINT_MAX; 45 return UINT_MAX;
48 } 46 }
49 return result; 47 return result;
@@ -58,7 +56,14 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight)
58 return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval; 56 return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval;
59} 57}
60 58
61extern u32 tfrc_calc_x(u16 s, u32 R, u32 p); 59extern u32 tfrc_calc_x(u16 s, u32 R, u32 p);
62extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue); 60extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
63 61
62extern int tfrc_tx_packet_history_init(void);
63extern void tfrc_tx_packet_history_exit(void);
64extern int tfrc_rx_packet_history_init(void);
65extern void tfrc_rx_packet_history_exit(void);
66
67extern int tfrc_li_init(void);
68extern void tfrc_li_exit(void);
64#endif /* _TFRC_H_ */ 69#endif /* _TFRC_H_ */
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index e4e64b76c10c..2f20a29cffe4 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -661,7 +661,7 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
661 661
662EXPORT_SYMBOL_GPL(tfrc_calc_x); 662EXPORT_SYMBOL_GPL(tfrc_calc_x);
663 663
664/* 664/**
665 * tfrc_calc_x_reverse_lookup - try to find p given f(p) 665 * tfrc_calc_x_reverse_lookup - try to find p given f(p)
666 * 666 *
667 * @fvalue: function value to match, scaled by 1000000 667 * @fvalue: function value to match, scaled by 1000000
@@ -676,11 +676,11 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue)
676 676
677 /* Error cases. */ 677 /* Error cases. */
678 if (fvalue < tfrc_calc_x_lookup[0][1]) { 678 if (fvalue < tfrc_calc_x_lookup[0][1]) {
679 DCCP_WARN("fvalue %d smaller than resolution\n", fvalue); 679 DCCP_WARN("fvalue %u smaller than resolution\n", fvalue);
680 return tfrc_calc_x_lookup[0][1]; 680 return TFRC_SMALLEST_P;
681 } 681 }
682 if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) { 682 if (fvalue > tfrc_calc_x_lookup[TFRC_CALC_X_ARRSIZE - 1][0]) {
683 DCCP_WARN("fvalue %d exceeds bounds!\n", fvalue); 683 DCCP_WARN("fvalue %u exceeds bounds!\n", fvalue);
684 return 1000000; 684 return 1000000;
685 } 685 }
686 686
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 33ad48321b08..66dca5bba858 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -165,12 +165,12 @@ out_free:
165 /* See dccp_v4_conn_request */ 165 /* See dccp_v4_conn_request */
166 newdmsk->dccpms_sequence_window = req->rcv_wnd; 166 newdmsk->dccpms_sequence_window = req->rcv_wnd;
167 167
168 newdp->dccps_gar = newdp->dccps_isr = dreq->dreq_isr; 168 newdp->dccps_gar = newdp->dccps_iss = dreq->dreq_iss;
169 dccp_update_gsr(newsk, dreq->dreq_isr);
170
171 newdp->dccps_iss = dreq->dreq_iss;
172 dccp_update_gss(newsk, dreq->dreq_iss); 169 dccp_update_gss(newsk, dreq->dreq_iss);
173 170
171 newdp->dccps_isr = dreq->dreq_isr;
172 dccp_update_gsr(newsk, dreq->dreq_isr);
173
174 /* 174 /*
175 * SWL and AWL are initially adjusted so that they are not less than 175 * SWL and AWL are initially adjusted so that they are not less than
176 * the initial Sequence Numbers received and sent, respectively: 176 * the initial Sequence Numbers received and sent, respectively:
diff --git a/net/dccp/options.c b/net/dccp/options.c
index d2a84a2fecee..43bc24e761d0 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -107,9 +107,11 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
107 * 107 *
108 * CCID-specific options are ignored during connection setup, as 108 * CCID-specific options are ignored during connection setup, as
109 * negotiation may still be in progress (see RFC 4340, 10.3). 109 * negotiation may still be in progress (see RFC 4340, 10.3).
110 * The same applies to Ack Vectors, as these depend on the CCID.
110 * 111 *
111 */ 112 */
112 if (dreq != NULL && opt >= 128) 113 if (dreq != NULL && (opt >= 128 ||
114 opt == DCCPO_ACK_VECTOR_0 || opt == DCCPO_ACK_VECTOR_1))
113 goto ignore_option; 115 goto ignore_option;
114 116
115 switch (opt) { 117 switch (opt) {
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 1f8a9b64c083..fe20068c5d8e 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -508,6 +508,7 @@ void dccp_send_ack(struct sock *sk)
508 508
509EXPORT_SYMBOL_GPL(dccp_send_ack); 509EXPORT_SYMBOL_GPL(dccp_send_ack);
510 510
511#if 0
511/* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */ 512/* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */
512void dccp_send_delayed_ack(struct sock *sk) 513void dccp_send_delayed_ack(struct sock *sk)
513{ 514{
@@ -538,6 +539,7 @@ void dccp_send_delayed_ack(struct sock *sk)
538 icsk->icsk_ack.timeout = timeout; 539 icsk->icsk_ack.timeout = timeout;
539 sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout); 540 sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout);
540} 541}
542#endif
541 543
542void dccp_send_sync(struct sock *sk, const u64 ackno, 544void dccp_send_sync(struct sock *sk, const u64 ackno,
543 const enum dccp_pkt_type pkt_type) 545 const enum dccp_pkt_type pkt_type)
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index 0bcdc9250279..81368a7f5379 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -42,7 +42,7 @@ static int bufsize = 64 * 1024;
42 42
43static const char procname[] = "dccpprobe"; 43static const char procname[] = "dccpprobe";
44 44
45struct { 45static struct {
46 struct kfifo *fifo; 46 struct kfifo *fifo;
47 spinlock_t lock; 47 spinlock_t lock;
48 wait_queue_head_t wait; 48 wait_queue_head_t wait;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 828ea211ff21..045e799d3e1d 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -419,7 +419,8 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
419 struct inet_connection_sock *icsk = inet_csk(parent); 419 struct inet_connection_sock *icsk = inet_csk(parent);
420 struct request_sock_queue *queue = &icsk->icsk_accept_queue; 420 struct request_sock_queue *queue = &icsk->icsk_accept_queue;
421 struct listen_sock *lopt = queue->listen_opt; 421 struct listen_sock *lopt = queue->listen_opt;
422 int thresh = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries; 422 int max_retries = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries;
423 int thresh = max_retries;
423 unsigned long now = jiffies; 424 unsigned long now = jiffies;
424 struct request_sock **reqp, *req; 425 struct request_sock **reqp, *req;
425 int i, budget; 426 int i, budget;
@@ -455,6 +456,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
455 } 456 }
456 } 457 }
457 458
459 if (queue->rskq_defer_accept)
460 max_retries = queue->rskq_defer_accept;
461
458 budget = 2 * (lopt->nr_table_entries / (timeout / interval)); 462 budget = 2 * (lopt->nr_table_entries / (timeout / interval));
459 i = lopt->clock_hand; 463 i = lopt->clock_hand;
460 464
@@ -462,8 +466,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent,
462 reqp=&lopt->syn_table[i]; 466 reqp=&lopt->syn_table[i];
463 while ((req = *reqp) != NULL) { 467 while ((req = *reqp) != NULL) {
464 if (time_after_eq(now, req->expires)) { 468 if (time_after_eq(now, req->expires)) {
465 if (req->retrans < thresh && 469 if ((req->retrans < (inet_rsk(req)->acked ? max_retries : thresh)) &&
466 !req->rsk_ops->rtx_syn_ack(parent, req)) { 470 (inet_rsk(req)->acked ||
471 !req->rsk_ops->rtx_syn_ack(parent, req))) {
467 unsigned long timeo; 472 unsigned long timeo;
468 473
469 if (req->retrans++ == 0) 474 if (req->retrans++ == 0)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index ab66683b8043..fc54a48fde1e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2112,12 +2112,15 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2112 break; 2112 break;
2113 2113
2114 case TCP_DEFER_ACCEPT: 2114 case TCP_DEFER_ACCEPT:
2115 if (val < 0) { 2115 icsk->icsk_accept_queue.rskq_defer_accept = 0;
2116 err = -EINVAL; 2116 if (val > 0) {
2117 } else { 2117 /* Translate value in seconds to number of
2118 if (val > MAX_TCP_ACCEPT_DEFERRED) 2118 * retransmits */
2119 val = MAX_TCP_ACCEPT_DEFERRED; 2119 while (icsk->icsk_accept_queue.rskq_defer_accept < 32 &&
2120 icsk->icsk_accept_queue.rskq_defer_accept = val; 2120 val > ((TCP_TIMEOUT_INIT / HZ) <<
2121 icsk->icsk_accept_queue.rskq_defer_accept))
2122 icsk->icsk_accept_queue.rskq_defer_accept++;
2123 icsk->icsk_accept_queue.rskq_defer_accept++;
2121 } 2124 }
2122 break; 2125 break;
2123 2126
@@ -2299,7 +2302,8 @@ static int do_tcp_getsockopt(struct sock *sk, int level,
2299 val = (val ? : sysctl_tcp_fin_timeout) / HZ; 2302 val = (val ? : sysctl_tcp_fin_timeout) / HZ;
2300 break; 2303 break;
2301 case TCP_DEFER_ACCEPT: 2304 case TCP_DEFER_ACCEPT:
2302 val = icsk->icsk_accept_queue.rskq_defer_accept; 2305 val = !icsk->icsk_accept_queue.rskq_defer_accept ? 0 :
2306 ((TCP_TIMEOUT_INIT / HZ) << (icsk->icsk_accept_queue.rskq_defer_accept - 1));
2303 break; 2307 break;
2304 case TCP_WINDOW_CLAMP: 2308 case TCP_WINDOW_CLAMP:
2305 val = tp->window_clamp; 2309 val = tp->window_clamp;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index eba873e9b560..cad73b7dfef0 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4541,49 +4541,6 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, struct tcphdr *th)
4541 } 4541 }
4542} 4542}
4543 4543
4544static int tcp_defer_accept_check(struct sock *sk)
4545{
4546 struct tcp_sock *tp = tcp_sk(sk);
4547
4548 if (tp->defer_tcp_accept.request) {
4549 int queued_data = tp->rcv_nxt - tp->copied_seq;
4550 int hasfin = !skb_queue_empty(&sk->sk_receive_queue) ?
4551 tcp_hdr((struct sk_buff *)
4552 sk->sk_receive_queue.prev)->fin : 0;
4553
4554 if (queued_data && hasfin)
4555 queued_data--;
4556
4557 if (queued_data &&
4558 tp->defer_tcp_accept.listen_sk->sk_state == TCP_LISTEN) {
4559 if (sock_flag(sk, SOCK_KEEPOPEN)) {
4560 inet_csk_reset_keepalive_timer(sk,
4561 keepalive_time_when(tp));
4562 } else {
4563 inet_csk_delete_keepalive_timer(sk);
4564 }
4565
4566 inet_csk_reqsk_queue_add(
4567 tp->defer_tcp_accept.listen_sk,
4568 tp->defer_tcp_accept.request,
4569 sk);
4570
4571 tp->defer_tcp_accept.listen_sk->sk_data_ready(
4572 tp->defer_tcp_accept.listen_sk, 0);
4573
4574 sock_put(tp->defer_tcp_accept.listen_sk);
4575 sock_put(sk);
4576 tp->defer_tcp_accept.listen_sk = NULL;
4577 tp->defer_tcp_accept.request = NULL;
4578 } else if (hasfin ||
4579 tp->defer_tcp_accept.listen_sk->sk_state != TCP_LISTEN) {
4580 tcp_reset(sk);
4581 return -1;
4582 }
4583 }
4584 return 0;
4585}
4586
4587static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen) 4544static int tcp_copy_to_iovec(struct sock *sk, struct sk_buff *skb, int hlen)
4588{ 4545{
4589 struct tcp_sock *tp = tcp_sk(sk); 4546 struct tcp_sock *tp = tcp_sk(sk);
@@ -4944,8 +4901,6 @@ step5:
4944 4901
4945 tcp_data_snd_check(sk); 4902 tcp_data_snd_check(sk);
4946 tcp_ack_snd_check(sk); 4903 tcp_ack_snd_check(sk);
4947
4948 tcp_defer_accept_check(sk);
4949 return 0; 4904 return 0;
4950 4905
4951csum_error: 4906csum_error:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 4f8485c67d1a..97a230026e13 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1918,14 +1918,6 @@ int tcp_v4_destroy_sock(struct sock *sk)
1918 sk->sk_sndmsg_page = NULL; 1918 sk->sk_sndmsg_page = NULL;
1919 } 1919 }
1920 1920
1921 if (tp->defer_tcp_accept.request) {
1922 reqsk_free(tp->defer_tcp_accept.request);
1923 sock_put(tp->defer_tcp_accept.listen_sk);
1924 sock_put(sk);
1925 tp->defer_tcp_accept.listen_sk = NULL;
1926 tp->defer_tcp_accept.request = NULL;
1927 }
1928
1929 atomic_dec(&tcp_sockets_allocated); 1921 atomic_dec(&tcp_sockets_allocated);
1930 1922
1931 return 0; 1923 return 0;
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 019c8c16e5cc..8245247a6ceb 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -571,8 +571,10 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
571 does sequence test, SYN is truncated, and thus we consider 571 does sequence test, SYN is truncated, and thus we consider
572 it a bare ACK. 572 it a bare ACK.
573 573
574 Both ends (listening sockets) accept the new incoming 574 If icsk->icsk_accept_queue.rskq_defer_accept, we silently drop this
575 connection and try to talk to each other. 8-) 575 bare ACK. Otherwise, we create an established connection. Both
576 ends (listening sockets) accept the new incoming connection and try
577 to talk to each other. 8-)
576 578
577 Note: This case is both harmless, and rare. Possibility is about the 579 Note: This case is both harmless, and rare. Possibility is about the
578 same as us discovering intelligent life on another plant tomorrow. 580 same as us discovering intelligent life on another plant tomorrow.
@@ -640,6 +642,13 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
640 if (!(flg & TCP_FLAG_ACK)) 642 if (!(flg & TCP_FLAG_ACK))
641 return NULL; 643 return NULL;
642 644
645 /* If TCP_DEFER_ACCEPT is set, drop bare ACK. */
646 if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept &&
647 TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) {
648 inet_rsk(req)->acked = 1;
649 return NULL;
650 }
651
643 /* OK, ACK is valid, create big socket and 652 /* OK, ACK is valid, create big socket and
644 * feed this segment to it. It will repeat all 653 * feed this segment to it. It will repeat all
645 * the tests. THIS SEGMENT MUST MOVE SOCKET TO 654 * the tests. THIS SEGMENT MUST MOVE SOCKET TO
@@ -678,24 +687,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
678 inet_csk_reqsk_queue_unlink(sk, req, prev); 687 inet_csk_reqsk_queue_unlink(sk, req, prev);
679 inet_csk_reqsk_queue_removed(sk, req); 688 inet_csk_reqsk_queue_removed(sk, req);
680 689
681 if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept && 690 inet_csk_reqsk_queue_add(sk, req, child);
682 TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) {
683
684 /* the accept queue handling is done is est recv slow
685 * path so lets make sure to start there
686 */
687 tcp_sk(child)->pred_flags = 0;
688 sock_hold(sk);
689 sock_hold(child);
690 tcp_sk(child)->defer_tcp_accept.listen_sk = sk;
691 tcp_sk(child)->defer_tcp_accept.request = req;
692
693 inet_csk_reset_keepalive_timer(child,
694 inet_csk(sk)->icsk_accept_queue.rskq_defer_accept * HZ);
695 } else {
696 inet_csk_reqsk_queue_add(sk, req, child);
697 }
698
699 return child; 691 return child;
700 692
701 listen_overflow: 693 listen_overflow:
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 4de68cf5f2aa..63ed9d6830e7 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -489,11 +489,6 @@ static void tcp_keepalive_timer (unsigned long data)
489 goto death; 489 goto death;
490 } 490 }
491 491
492 if (tp->defer_tcp_accept.request && sk->sk_state == TCP_ESTABLISHED) {
493 tcp_send_active_reset(sk, GFP_ATOMIC);
494 goto death;
495 }
496
497 if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE) 492 if (!sock_flag(sk, SOCK_KEEPOPEN) || sk->sk_state == TCP_CLOSE)
498 goto out; 493 goto out;
499 494
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index b9c2de84a8a2..0f0f94a40335 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -705,6 +705,11 @@ int datagram_send_ctl(struct net *net,
705 } 705 }
706 706
707 *hlimit = *(int *)CMSG_DATA(cmsg); 707 *hlimit = *(int *)CMSG_DATA(cmsg);
708 if (*hlimit < -1 || *hlimit > 0xff) {
709 err = -EINVAL;
710 goto exit_f;
711 }
712
708 break; 713 break;
709 714
710 case IPV6_TCLASS: 715 case IPV6_TCLASS:
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 26b83e512a09..c042ce19bd14 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -67,7 +67,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *))
67 67
68 /* RA packet may be delivered ONLY to IPPROTO_RAW socket */ 68 /* RA packet may be delivered ONLY to IPPROTO_RAW socket */
69 if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW) 69 if (sk->sk_type != SOCK_RAW || inet_sk(sk)->num != IPPROTO_RAW)
70 return -EINVAL; 70 return -ENOPROTOOPT;
71 71
72 new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL; 72 new_ra = (sel>=0) ? kmalloc(sizeof(*new_ra), GFP_KERNEL) : NULL;
73 73
@@ -446,7 +446,7 @@ done:
446 446
447 case IPV6_MULTICAST_HOPS: 447 case IPV6_MULTICAST_HOPS:
448 if (sk->sk_type == SOCK_STREAM) 448 if (sk->sk_type == SOCK_STREAM)
449 goto e_inval; 449 break;
450 if (optlen < sizeof(int)) 450 if (optlen < sizeof(int))
451 goto e_inval; 451 goto e_inval;
452 if (val > 255 || val < -1) 452 if (val > 255 || val < -1)
@@ -458,13 +458,15 @@ done:
458 case IPV6_MULTICAST_LOOP: 458 case IPV6_MULTICAST_LOOP:
459 if (optlen < sizeof(int)) 459 if (optlen < sizeof(int))
460 goto e_inval; 460 goto e_inval;
461 if (val != valbool)
462 goto e_inval;
461 np->mc_loop = valbool; 463 np->mc_loop = valbool;
462 retv = 0; 464 retv = 0;
463 break; 465 break;
464 466
465 case IPV6_MULTICAST_IF: 467 case IPV6_MULTICAST_IF:
466 if (sk->sk_type == SOCK_STREAM) 468 if (sk->sk_type == SOCK_STREAM)
467 goto e_inval; 469 break;
468 if (optlen < sizeof(int)) 470 if (optlen < sizeof(int))
469 goto e_inval; 471 goto e_inval;
470 472
@@ -860,7 +862,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
860 if (sk->sk_protocol != IPPROTO_UDP && 862 if (sk->sk_protocol != IPPROTO_UDP &&
861 sk->sk_protocol != IPPROTO_UDPLITE && 863 sk->sk_protocol != IPPROTO_UDPLITE &&
862 sk->sk_protocol != IPPROTO_TCP) 864 sk->sk_protocol != IPPROTO_TCP)
863 return -EINVAL; 865 return -ENOPROTOOPT;
864 if (sk->sk_state != TCP_ESTABLISHED) 866 if (sk->sk_state != TCP_ESTABLISHED)
865 return -ENOTCONN; 867 return -ENOTCONN;
866 val = sk->sk_family; 868 val = sk->sk_family;
@@ -874,6 +876,8 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
874 return -EINVAL; 876 return -EINVAL;
875 if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) 877 if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0)))
876 return -EFAULT; 878 return -EFAULT;
879 if (gsf.gf_group.ss_family != AF_INET6)
880 return -EADDRNOTAVAIL;
877 lock_sock(sk); 881 lock_sock(sk);
878 err = ip6_mc_msfget(sk, &gsf, 882 err = ip6_mc_msfget(sk, &gsf,
879 (struct group_filter __user *)optval, optlen); 883 (struct group_filter __user *)optval, optlen);
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 8fee9a15b2d3..3aee12310d94 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1169,7 +1169,8 @@ static int raw6_destroy(struct sock *sk)
1169 lock_sock(sk); 1169 lock_sock(sk);
1170 ip6_flush_pending_frames(sk); 1170 ip6_flush_pending_frames(sk);
1171 release_sock(sk); 1171 release_sock(sk);
1172 return 0; 1172
1173 return inet6_destroy_sock(sk);
1173} 1174}
1174 1175
1175static int rawv6_init_sk(struct sock *sk) 1176static int rawv6_init_sk(struct sock *sk)
@@ -1200,7 +1201,6 @@ struct proto rawv6_prot = {
1200 .disconnect = udp_disconnect, 1201 .disconnect = udp_disconnect,
1201 .ioctl = rawv6_ioctl, 1202 .ioctl = rawv6_ioctl,
1202 .init = rawv6_init_sk, 1203 .init = rawv6_init_sk,
1203 .destroy = inet6_destroy_sock,
1204 .setsockopt = rawv6_setsockopt, 1204 .setsockopt = rawv6_setsockopt,
1205 .getsockopt = rawv6_getsockopt, 1205 .getsockopt = rawv6_getsockopt,
1206 .sendmsg = rawv6_sendmsg, 1206 .sendmsg = rawv6_sendmsg,
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 220cffe9e63b..d1f3e19b06c7 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2196,8 +2196,12 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
2196 2196
2197 NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); 2197 NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric);
2198 2198
2199 expires = (rt->rt6i_flags & RTF_EXPIRES) ? 2199 if (!(rt->rt6i_flags & RTF_EXPIRES))
2200 rt->rt6i_expires - jiffies : 0; 2200 expires = 0;
2201 else if (rt->rt6i_expires - jiffies < INT_MAX)
2202 expires = rt->rt6i_expires - jiffies;
2203 else
2204 expires = INT_MAX;
2201 2205
2202 if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, 2206 if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0,
2203 expires, rt->u.dst.error) < 0) 2207 expires, rt->u.dst.error) < 0)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index c4b1799da5d7..662c1ccfee26 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -196,8 +196,6 @@ destroy_conntrack(struct nf_conntrack *nfct)
196 if (l4proto && l4proto->destroy) 196 if (l4proto && l4proto->destroy)
197 l4proto->destroy(ct); 197 l4proto->destroy(ct);
198 198
199 nf_ct_ext_destroy(ct);
200
201 rcu_read_unlock(); 199 rcu_read_unlock();
202 200
203 spin_lock_bh(&nf_conntrack_lock); 201 spin_lock_bh(&nf_conntrack_lock);
@@ -520,6 +518,7 @@ static void nf_conntrack_free_rcu(struct rcu_head *head)
520 518
521void nf_conntrack_free(struct nf_conn *ct) 519void nf_conntrack_free(struct nf_conn *ct)
522{ 520{
521 nf_ct_ext_destroy(ct);
523 call_rcu(&ct->rcu, nf_conntrack_free_rcu); 522 call_rcu(&ct->rcu, nf_conntrack_free_rcu);
524} 523}
525EXPORT_SYMBOL_GPL(nf_conntrack_free); 524EXPORT_SYMBOL_GPL(nf_conntrack_free);
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index bc11d7092032..9fda6ee95a31 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -92,10 +92,6 @@ void nf_log_packet(int pf,
92 vsnprintf(prefix, sizeof(prefix), fmt, args); 92 vsnprintf(prefix, sizeof(prefix), fmt, args);
93 va_end(args); 93 va_end(args);
94 logger->logfn(pf, hooknum, skb, in, out, loginfo, prefix); 94 logger->logfn(pf, hooknum, skb, in, out, loginfo, prefix);
95 } else if (net_ratelimit()) {
96 printk(KERN_WARNING "nf_log_packet: can\'t log since "
97 "no backend logging module loaded in! Please either "
98 "load one, or disable logging explicitly\n");
99 } 95 }
100 rcu_read_unlock(); 96 rcu_read_unlock();
101} 97}
diff --git a/security/dummy.c b/security/dummy.c
index f50c6c3c32c9..b8916883b77f 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -27,6 +27,8 @@
27#include <linux/hugetlb.h> 27#include <linux/hugetlb.h>
28#include <linux/ptrace.h> 28#include <linux/ptrace.h>
29#include <linux/file.h> 29#include <linux/file.h>
30#include <linux/prctl.h>
31#include <linux/securebits.h>
30 32
31static int dummy_ptrace (struct task_struct *parent, struct task_struct *child) 33static int dummy_ptrace (struct task_struct *parent, struct task_struct *child)
32{ 34{
@@ -607,7 +609,27 @@ static int dummy_task_kill (struct task_struct *p, struct siginfo *info,
607static int dummy_task_prctl (int option, unsigned long arg2, unsigned long arg3, 609static int dummy_task_prctl (int option, unsigned long arg2, unsigned long arg3,
608 unsigned long arg4, unsigned long arg5, long *rc_p) 610 unsigned long arg4, unsigned long arg5, long *rc_p)
609{ 611{
610 return 0; 612 switch (option) {
613 case PR_CAPBSET_READ:
614 *rc_p = (cap_valid(arg2) ? 1 : -EINVAL);
615 break;
616 case PR_GET_KEEPCAPS:
617 *rc_p = issecure(SECURE_KEEP_CAPS);
618 break;
619 case PR_SET_KEEPCAPS:
620 if (arg2 > 1)
621 *rc_p = -EINVAL;
622 else if (arg2)
623 current->securebits |= issecure_mask(SECURE_KEEP_CAPS);
624 else
625 current->securebits &=
626 ~issecure_mask(SECURE_KEEP_CAPS);
627 break;
628 default:
629 return 0;
630 }
631
632 return 1;
611} 633}
612 634
613static void dummy_task_reparent_to_init (struct task_struct *p) 635static void dummy_task_reparent_to_init (struct task_struct *p)