[kernel] r16233 - in dists/sid/linux-2.6/debian: . patches/bugfix/all patches/series

Ben Hutchings benh at alioth.debian.org
Wed Sep 1 23:28:50 UTC 2010


Author: benh
Date: Wed Sep  1 23:28:48 2010
New Revision: 16233

Log:
input: add compat support for sysfs and /proc capabilities output (Closes: #579017)

Added:
   dists/sid/linux-2.6/debian/patches/bugfix/all/input-add-compat-support-for-sysfs-and-proc-capabilities.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/22

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Wed Sep  1 23:26:12 2010	(r16232)
+++ dists/sid/linux-2.6/debian/changelog	Wed Sep  1 23:28:48 2010	(r16233)
@@ -31,6 +31,8 @@
     (Closes: #571526)
   * postinst: Really warn users on upgrade if the current configuration may
     rely on running a default boot loader.
+  * input: add compat support for sysfs and /proc capabilities output
+    (Closes: #579017)
 
   [ Bastian Blank ]
   * Use Breaks instead of Conflicts.

Added: dists/sid/linux-2.6/debian/patches/bugfix/all/input-add-compat-support-for-sysfs-and-proc-capabilities.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/bugfix/all/input-add-compat-support-for-sysfs-and-proc-capabilities.patch	Wed Sep  1 23:28:48 2010	(r16233)
@@ -0,0 +1,158 @@
+From 34c2e1ca5dd11b4969258b02f6730771694af6cf Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov at gmail.com>
+Date: Mon, 11 Jan 2010 00:05:43 -0800
+Subject: [PATCH] Input: add compat support for sysfs and /proc capabilities output
+
+commit 15e184afa83a45cf8bafdb9dc906b97a8fbc974f upstream.
+
+Input core displays capabilities bitmasks in form of one or more longs printed
+in hex form and separated by spaces. Unfortunately it does not work well
+for 32-bit applications running on 64-bit kernels since applications expect
+that number is "worth" only 32 bits when kernel advances by 64 bits.
+
+Fix that by ensuring that output produced for compat tasks uses 32-bit units.
+
+Reported-and-tested-by: Michael Tokarev <mjt at tls.msk.ru>
+Signed-off-by: Dmitry Torokhov <dtor at mail.ru>
+---
+ drivers/input/input.c |   86 ++++++++++++++++++++++++++++++++++++++++--------
+ 1 files changed, 71 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/input/input.c b/drivers/input/input.c
+index 2266ecb..c82ae82 100644
+--- a/drivers/input/input.c
++++ b/drivers/input/input.c
+@@ -24,6 +24,7 @@
+ #include <linux/mutex.h>
+ #include <linux/rcupdate.h>
+ #include <linux/smp_lock.h>
++#include "input-compat.h"
+ 
+ MODULE_AUTHOR("Vojtech Pavlik <vojtech at suse.cz>");
+ MODULE_DESCRIPTION("Input core");
+@@ -758,6 +759,40 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han
+ 	return error;
+ }
+ 
++#ifdef CONFIG_COMPAT
++
++static int input_bits_to_string(char *buf, int buf_size,
++				unsigned long bits, bool skip_empty)
++{
++	int len = 0;
++
++	if (INPUT_COMPAT_TEST) {
++		u32 dword = bits >> 32;
++		if (dword || !skip_empty)
++			len += snprintf(buf, buf_size, "%x ", dword);
++
++		dword = bits & 0xffffffffUL;
++		if (dword || !skip_empty || len)
++			len += snprintf(buf + len, max(buf_size - len, 0),
++					"%x", dword);
++	} else {
++		if (bits || !skip_empty)
++			len += snprintf(buf, buf_size, "%lx", bits);
++	}
++
++	return len;
++}
++
++#else /* !CONFIG_COMPAT */
++
++static int input_bits_to_string(char *buf, int buf_size,
++				unsigned long bits, bool skip_empty)
++{
++	return bits || !skip_empty ?
++		snprintf(buf, buf_size, "%lx", bits) : 0;
++}
++
++#endif
+ 
+ #ifdef CONFIG_PROC_FS
+ 
+@@ -826,14 +861,25 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
+ 				   unsigned long *bitmap, int max)
+ {
+ 	int i;
+-
+-	for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
+-		if (bitmap[i])
+-			break;
++	bool skip_empty = true;
++	char buf[18];
+ 
+ 	seq_printf(seq, "B: %s=", name);
+-	for (; i >= 0; i--)
+-		seq_printf(seq, "%lx%s", bitmap[i], i > 0 ? " " : "");
++
++	for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
++		if (input_bits_to_string(buf, sizeof(buf),
++					 bitmap[i], skip_empty)) {
++			skip_empty = false;
++			seq_printf(seq, "%s%s", buf, i > 0 ? " " : "");
++		}
++	}
++
++	/*
++	 * If no output was produced print a single 0.
++	 */
++	if (skip_empty)
++		seq_puts(seq, "0");
++
+ 	seq_putc(seq, '\n');
+ }
+ 
+@@ -1122,14 +1168,23 @@ static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap,
+ {
+ 	int i;
+ 	int len = 0;
++	bool skip_empty = true;
++
++	for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
++		len += input_bits_to_string(buf + len, max(buf_size - len, 0),
++					    bitmap[i], skip_empty);
++		if (len) {
++			skip_empty = false;
++			if (i > 0)
++				len += snprintf(buf + len, max(buf_size - len, 0), " ");
++		}
++	}
+ 
+-	for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
+-		if (bitmap[i])
+-			break;
+-
+-	for (; i >= 0; i--)
+-		len += snprintf(buf + len, max(buf_size - len, 0),
+-				"%lx%s", bitmap[i], i > 0 ? " " : "");
++	/*
++	 * If no output was produced print a single 0.
++	 */
++	if (len == 0)
++		len = snprintf(buf, buf_size, "%d", 0);
+ 
+ 	if (add_cr)
+ 		len += snprintf(buf + len, max(buf_size - len, 0), "\n");
+@@ -1144,7 +1199,8 @@ static ssize_t input_dev_show_cap_##bm(struct device *dev,		\
+ {									\
+ 	struct input_dev *input_dev = to_input_dev(dev);		\
+ 	int len = input_print_bitmap(buf, PAGE_SIZE,			\
+-				     input_dev->bm##bit, ev##_MAX, 1);	\
++				     input_dev->bm##bit, ev##_MAX,	\
++				     true);				\
+ 	return min_t(int, len, PAGE_SIZE);				\
+ }									\
+ static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL)
+@@ -1208,7 +1264,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env,
+ 
+ 	len = input_print_bitmap(&env->buf[env->buflen - 1],
+ 				 sizeof(env->buf) - env->buflen,
+-				 bitmap, max, 0);
++				 bitmap, max, false);
+ 	if (len >= (sizeof(env->buf) - env->buflen))
+ 		return -ENOMEM;
+ 
+-- 
+1.7.1
+

Modified: dists/sid/linux-2.6/debian/patches/series/22
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/22	Wed Sep  1 23:26:12 2010	(r16232)
+++ dists/sid/linux-2.6/debian/patches/series/22	Wed Sep  1 23:28:48 2010	(r16233)
@@ -74,3 +74,4 @@
 + features/all/sky2/0053-sky2-Refactor-down-up-code-out-of-sky2_restart.patch
 + features/all/sky2/0054-sky2-Avoid-allocating-memory-in-sky2_resume.patch
 + features/all/sky2/0055-sky2-version-1.28.patch
++ bugfix/all/input-add-compat-support-for-sysfs-and-proc-capabilities.patch



More information about the Kernel-svn-changes mailing list