mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 5/5] Decrapify evdev.c of per-arch compat hacks
@ 2006-01-08 19:38 Kyle McMartin
  2006-01-08 20:16 ` Vojtech Pavlik
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle McMartin @ 2006-01-08 19:38 UTC (permalink / raw)
  To: akpm; +Cc: linux-input, linux-kernel, parisc-linux, carlos, willy

From: Kyle McMartin <kyle@parisc-linux.org>

A nice cleanup of evdev.c by using the is_compat_task() macro.

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

---

 drivers/input/evdev.c |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)

3e7a8822763c01f93afdb2f0011dec6b641df1fb
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index f7490a0..3cabb4b 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -154,27 +154,15 @@ struct input_event_compat {
 	__s32 value;
 };
 
-#ifdef CONFIG_X86_64
-#  define COMPAT_TEST test_thread_flag(TIF_IA32)
-#elif defined(CONFIG_IA64)
-#  define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current))
-#elif defined(CONFIG_S390)
-#  define COMPAT_TEST test_thread_flag(TIF_31BIT)
-#elif defined(CONFIG_MIPS)
-#  define COMPAT_TEST (current->thread.mflags & MF_32BIT_ADDR)
-#else
-#  define COMPAT_TEST test_thread_flag(TIF_32BIT)
-#endif
-
 static inline size_t evdev_event_size(void)
 {
-	return COMPAT_TEST ?
+	return is_compat_task(current) ?
 		sizeof(struct input_event_compat) : sizeof(struct input_event);
 }
 
 static int evdev_event_from_user(const char __user *buffer, struct input_event *event)
 {
-	if (COMPAT_TEST) {
+	if (is_compat_task(current)) {
 		struct input_event_compat compat_event;
 
 		if (copy_from_user(&compat_event, buffer, sizeof(struct input_event_compat)))
@@ -196,7 +184,7 @@ static int evdev_event_from_user(const c
 
 static int evdev_event_to_user(char __user *buffer, const struct input_event *event)
 {
-	if (COMPAT_TEST) {
+	if (is_compat_task(current)) {
 		struct input_event_compat compat_event;
 
 		compat_event.time.tv_sec = event->time.tv_sec;
-- 
1.0.7


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 5/5] Decrapify evdev.c of per-arch compat hacks
  2006-01-08 19:38 [PATCH 5/5] Decrapify evdev.c of per-arch compat hacks Kyle McMartin
@ 2006-01-08 20:16 ` Vojtech Pavlik
  0 siblings, 0 replies; 2+ messages in thread
From: Vojtech Pavlik @ 2006-01-08 20:16 UTC (permalink / raw)
  To: Kyle McMartin
  Cc: akpm, linux-input, linux-kernel, parisc-linux, carlos, willy, dtor_core

On Sun, Jan 08, 2006 at 02:38:11PM -0500, Kyle McMartin wrote:
> From: Kyle McMartin <kyle@parisc-linux.org>
> 
> A nice cleanup of evdev.c by using the is_compat_task() macro.
> 
> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>

Nice, indeed.

> ---
> 
>  drivers/input/evdev.c |   18 +++---------------
>  1 files changed, 3 insertions(+), 15 deletions(-)
> 
> 3e7a8822763c01f93afdb2f0011dec6b641df1fb
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index f7490a0..3cabb4b 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -154,27 +154,15 @@ struct input_event_compat {
>  	__s32 value;
>  };
>  
> -#ifdef CONFIG_X86_64
> -#  define COMPAT_TEST test_thread_flag(TIF_IA32)
> -#elif defined(CONFIG_IA64)
> -#  define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current))
> -#elif defined(CONFIG_S390)
> -#  define COMPAT_TEST test_thread_flag(TIF_31BIT)
> -#elif defined(CONFIG_MIPS)
> -#  define COMPAT_TEST (current->thread.mflags & MF_32BIT_ADDR)
> -#else
> -#  define COMPAT_TEST test_thread_flag(TIF_32BIT)
> -#endif
> -
>  static inline size_t evdev_event_size(void)
>  {
> -	return COMPAT_TEST ?
> +	return is_compat_task(current) ?
>  		sizeof(struct input_event_compat) : sizeof(struct input_event);
>  }
>  
>  static int evdev_event_from_user(const char __user *buffer, struct input_event *event)
>  {
> -	if (COMPAT_TEST) {
> +	if (is_compat_task(current)) {
>  		struct input_event_compat compat_event;
>  
>  		if (copy_from_user(&compat_event, buffer, sizeof(struct input_event_compat)))
> @@ -196,7 +184,7 @@ static int evdev_event_from_user(const c
>  
>  static int evdev_event_to_user(char __user *buffer, const struct input_event *event)
>  {
> -	if (COMPAT_TEST) {
> +	if (is_compat_task(current)) {
>  		struct input_event_compat compat_event;
>  
>  		compat_event.time.tv_sec = event->time.tv_sec;
> -- 
> 1.0.7
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-01-08 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-08 19:38 [PATCH 5/5] Decrapify evdev.c of per-arch compat hacks Kyle McMartin
2006-01-08 20:16 ` Vojtech Pavlik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®