Patches contributed by University of Waterloo


commit cd15e8c3313f2831d2d6c7951a93eb5de9621e5a
Author: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Date:   Thu Sep 17 11:49:41 2009 -0400

    m68knommu: show KiB rather than pages in "Freeing initrd memory:" message
    
    Fix "Freeing initrd memory:" message m68knommu to show kilobytes as
    claimed rather than number of pages.
    
    Signed-off-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
    Signed-off-by: Greg Ungerer <gerg@uclinux.org>

diff --git a/arch/m68knommu/mm/init.c b/arch/m68knommu/mm/init.c
index b1703c67a4f1..f3236d0b522d 100644
--- a/arch/m68knommu/mm/init.c
+++ b/arch/m68knommu/mm/init.c
@@ -162,7 +162,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 		totalram_pages++;
 		pages++;
 	}
-	printk (KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages);
+	printk (KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages * (PAGE_SIZE / 1024));
 }
 #endif
 

commit d6f61770f910a976050458807ff8891e78303297
Author: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Date:   Thu Sep 17 11:47:06 2009 -0400

    microblaze: Actually show KiB rather than pages in "Freeing initrd memory:"
    
    Fix "Freeing initrd memory:" message on microblaze to show kilobytes as
    claimed rather than number of pages.
    
    Signed-off-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
    Signed-off-by: Michal Simek <monstr@monstr.eu>

diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index f207f1a94dbc..42cbc15e015a 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -180,7 +180,8 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 		totalram_pages++;
 		pages++;
 	}
-	printk(KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages);
+	printk(KERN_NOTICE "Freeing initrd memory: %dk freed\n",
+					(int)(pages * (PAGE_SIZE / 1024)));
 }
 #endif
 

commit 4330e179a96bc9310d36e9b858bc8f275f329312
Author: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Date:   Thu Feb 5 10:11:24 2009 +1000

    m68knommu: Fix support for console port other than ttyS0 on mcf.c
    
    Due to a case of backwards logic, mfc.c always makes the console port be
    ttyS0 even when you ask for another port.
    
    This patch fixes this issue.
    
    Only when the requested port is NOT in the range 0 to MAXPORTS-1 do we
    force it to be treated as if port 0 was requested.  Forcing the port to
    0 when it is in fact in the range 0 to MAXPORTS is not helpful.
    
    Tested with working console on ttyS2 on a 5271evb.
    
    Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
    Signed-off-by: Greg Ungerer <gerg@uclinux.org>

diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
index 56841fe5f483..0eefb07bebaf 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/serial/mcf.c
@@ -513,7 +513,7 @@ static int __init mcf_console_setup(struct console *co, char *options)
 	int parity = 'n';
 	int flow = 'n';
 
-	if ((co->index >= 0) && (co->index <= MCF_MAXPORTS))
+	if ((co->index < 0) || (co->index >= MCF_MAXPORTS))
 		co->index = 0;
 	port = &mcf_ports[co->index].port;
 	if (port->membase == 0)

commit 1ba869ec581fd9078b684c56c399ffe3d2345e27
Author: Michael Spang <mspang@csclub.uwaterloo.ca>
Date:   Thu Mar 12 14:31:34 2009 -0700

    acer-wmi: fix regression in backlight detection
    
    Currently we disable the Acer WMI backlight device if there is no ACPI
    backlight device.  As a result, we end up with no backlight device at all.
     We should instead disable it if there is an ACPI device, as the other
    laptop drivers do.  This regression was introduced in febf2d9 ("Acer-WMI:
    fingers off backlight if video.ko is serving this functionality").
    
    Each laptop driver with backlight support got a similar change around
    febf2d9.  The changes to the other drivers look correct; see e.g.
    a598c82f for a similar but correct change.  The regression is also in
    2.6.28.
    
    Signed-off-by: Michael Spang <mspang@csclub.uwaterloo.ca>
    Acked-by: Thomas Renninger <trenn@suse.de>
    Cc: Zhang Rui <rui.zhang@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
    Cc: Len Brown <len.brown@intel.com>
    Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
    Cc: <stable@kernel.org>         [2.6.28.x]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 94c9f911824e..6bcca616a704 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1297,7 +1297,7 @@ static int __init acer_wmi_init(void)
 
 	set_quirks();
 
-	if (!acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
+	if (acpi_video_backlight_support() && has_cap(ACER_CAP_BRIGHTNESS)) {
 		interface->capability &= ~ACER_CAP_BRIGHTNESS;
 		printk(ACER_INFO "Brightness must be controlled by "
 		       "generic video driver\n");

commit 4a029abee0f1d69cb0445657d6fa5a38597bd17d
Author: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Date:   Thu Oct 30 15:55:47 2008 +0100

    scx200_i2c: Add missing class parameter
    
    The scx200_i2c driver is missing the .class parameter, which means no
    i2c drivers are willing to probe for devices on the bus and attach to
    them.
    
    Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
    Signed-off-by: Jean Delvare <khali@linux-fr.org>

diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c
index c3022a023449..e4c98539c517 100644
--- a/drivers/i2c/busses/scx200_i2c.c
+++ b/drivers/i2c/busses/scx200_i2c.c
@@ -81,6 +81,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
 
 static struct i2c_adapter scx200_i2c_ops = {
 	.owner		   = THIS_MODULE,
+	.class             = I2C_CLASS_HWMON | I2C_CLASS_SPD,
 	.id		   = I2C_HW_B_SCX200,
 	.algo_data	   = &scx200_i2c_data,
 	.name	= "NatSemi SCx200 I2C",

commit e97cb3e28ce2fdd3b06a65f67d00462d86929008
Author: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Date:   Tue May 8 00:26:33 2007 -0700

    Subject: jsm driver fix for linuxpps support
    
    The jsm driver doesn't currently use the uart_handle_*_change helper
    functions, which are the obvious place for things like linuxpps to tie
    into (which it now does of course), and as a result the jsm driver can
    not be used with linuxpps and anything else that ties into the
    serial_core helper functions.  This patch adds calls to these helper
    functions whenever the value they manage changes.  That actual storage
    of the state is not modified since the jsm driver caches the current
    settings (The 8250 driver reads them everytime a user asks for the
    state), and only updates them whenever they change.
    
    Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
    Cc: Scott H Kilau <Scott_Kilau@digi.com>
    Cc: Wendy Xiong <wendyx@us.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c
index 8be8da37f629..b2d6f5b1a7c2 100644
--- a/drivers/serial/jsm/jsm_neo.c
+++ b/drivers/serial/jsm/jsm_neo.c
@@ -581,8 +581,13 @@ static void neo_parse_modem(struct jsm_channel *ch, u8 signals)
 		return;
 
 	/* Scrub off lower bits. They signify delta's, which I don't care about */
-	msignals &= 0xf0;
+	/* Keep DDCD and DDSR though */
+	msignals &= 0xf8;
 
+	if (msignals & UART_MSR_DDCD)
+		uart_handle_dcd_change(&ch->uart_port, msignals & UART_MSR_DCD);
+	if (msignals & UART_MSR_DDSR)
+		uart_handle_cts_change(&ch->uart_port, msignals & UART_MSR_CTS);
 	if (msignals & UART_MSR_DCD)
 		ch->ch_mistat |= UART_MSR_DCD;
 	else

commit 3c04c27251c4d064f16846c305cbc1ff2f5b5fbe
Author: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Date:   Tue May 8 00:26:30 2007 -0700

    Small fixes for jsm driver
    
    The jsm driver fails when you try to use the TIOCSSERIAL ioctl.  The reason
    is that the driver never sets uart_port.uartclk, causing the data received
    using TIOCGSERIAL to not match the internal state of the driver.  This
    patch fixes this problem by settings the uartclk to the value used by the
    serial_core (16 times the baud base).
    
    Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
    Cc: Scott H Kilau <Scott_Kilau@digi.com>
    Cc: Wendy Xiong <wendyx@us.ibm.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index be22bbdbc8e5..281f23a371b2 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -448,6 +448,7 @@ int jsm_uart_port_init(struct jsm_board *brd)
 			continue;
 
 		brd->channels[i]->uart_port.irq = brd->irq;
+		brd->channels[i]->uart_port.uartclk = 14745600;
 		brd->channels[i]->uart_port.type = PORT_JSM;
 		brd->channels[i]->uart_port.iotype = UPIO_MEM;
 		brd->channels[i]->uart_port.membase = brd->re_map_membase;

commit 69ac43b05eef4b8555e84ad51ceb6c58b5a3bc75
Author: Chen Liu <chenliu@asset.uwaterloo.ca>
Date:   Wed Mar 23 10:14:58 2011 +0100

    [S390] early: Fix possible overlapping data buffer
    
    This patch fixed bugzilla #12965:
    https://bugzilla.kernel.org/show_bug.cgi?id=12965
    
    The original code contains some inproper use of sprintf
    function where a buffer is used both as input string
    as well as output string. It should remember the written
    bytes in the previous and use that as the offset for
    later writing. Also replace sprintf with snprintf.
    
    Signed-off-by: Chen Liu <chenliu@asset.uwaterloo.ca>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 3b7e7dddc324..668138ee85d9 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -94,6 +94,7 @@ static noinline __init void create_kernel_nss(void)
 	unsigned int sinitrd_pfn, einitrd_pfn;
 #endif
 	int response;
+	int hlen;
 	size_t len;
 	char *savesys_ptr;
 	char defsys_cmd[DEFSYS_CMD_SIZE];
@@ -124,22 +125,24 @@ static noinline __init void create_kernel_nss(void)
 	end_pfn = PFN_UP(__pa(&_end));
 	min_size = end_pfn << 2;
 
-	sprintf(defsys_cmd, "DEFSYS %s 00000-%.5X EW %.5X-%.5X SR %.5X-%.5X",
-		kernel_nss_name, stext_pfn - 1, stext_pfn, eshared_pfn - 1,
-		eshared_pfn, end_pfn);
+	hlen = snprintf(defsys_cmd, DEFSYS_CMD_SIZE,
+			"DEFSYS %s 00000-%.5X EW %.5X-%.5X SR %.5X-%.5X",
+			kernel_nss_name, stext_pfn - 1, stext_pfn,
+			eshared_pfn - 1, eshared_pfn, end_pfn);
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (INITRD_START && INITRD_SIZE) {
 		sinitrd_pfn = PFN_DOWN(__pa(INITRD_START));
 		einitrd_pfn = PFN_UP(__pa(INITRD_START + INITRD_SIZE));
 		min_size = einitrd_pfn << 2;
-		sprintf(defsys_cmd, "%s EW %.5X-%.5X", defsys_cmd,
-		sinitrd_pfn, einitrd_pfn);
+		hlen += snprintf(defsys_cmd + hlen, DEFSYS_CMD_SIZE - hlen,
+				 " EW %.5X-%.5X", sinitrd_pfn, einitrd_pfn);
 	}
 #endif
 
-	sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK PARMREGS=0-13",
-		defsys_cmd, min_size);
+	snprintf(defsys_cmd + hlen, DEFSYS_CMD_SIZE - hlen,
+		 " EW MINSIZE=%.7iK PARMREGS=0-13", min_size);
+	defsys_cmd[DEFSYS_CMD_SIZE - 1] = '\0';
 	sprintf(savesys_cmd, "SAVESYS %s \n IPL %s",
 		kernel_nss_name, kernel_nss_name);
 

commit ba3c578de274a5438bafbce03f9225936698051c
Author: j223yang@asset.uwaterloo.ca <j223yang@asset.uwaterloo.ca>
Date:   Wed Mar 16 11:16:22 2011 -0400

    xprt: remove redundant check
    
    remove redundant check.
    
    Signed-off-by: Jinqiu Yang <crindy646@gmail.com>
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 4499b5a51763..9494c3767356 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -212,7 +212,7 @@ int xprt_reserve_xprt(struct rpc_task *task)
 			task->tk_pid, xprt);
 	task->tk_timeout = 0;
 	task->tk_status = -EAGAIN;
-	if (req && req->rq_ntrans)
+	if (req->rq_ntrans)
 		rpc_sleep_on(&xprt->resend, task, NULL);
 	else
 		rpc_sleep_on(&xprt->sending, task, NULL);

commit 4d4a76f3309edc671918a767b336492fbc80a16d
Author: j223yang@asset.uwaterloo.ca <j223yang@asset.uwaterloo.ca>
Date:   Thu Mar 10 12:40:28 2011 -0500

    xprt: remove redundant null check
    
    'req' is dereferenced before checked for NULL.
    The patch simply removes the check.
    
    Signed-off-by: Jinqiu Yang<crindy646@gmail.com>
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 856274d7e85c..8bdcdbe07b98 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -202,10 +202,9 @@ int xprt_reserve_xprt(struct rpc_task *task)
 		goto out_sleep;
 	}
 	xprt->snd_task = task;
-	if (req) {
-		req->rq_bytes_sent = 0;
-		req->rq_ntrans++;
-	}
+	req->rq_bytes_sent = 0;
+	req->rq_ntrans++;
+
 	return 1;
 
 out_sleep: