public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: torvalds@osdl.org, dtor_core@ameritech.net,
	linux-kernel@vger.kernel.org, vojtech@suse.cz
Subject: [PATCH 7/26] make i8042_platform_init return 'real' error code
Date: Sun, 11 Sep 2005 00:34:12 +0200	[thread overview]
Message-ID: <11263916522920@midnight.ucw.cz> (raw)
In-Reply-To: <11263916524159@midnight.ucw.cz>

Subject: [PATCH] Input: make i8042_platform_init return 'real' error code
From: Dmitry Torokhov <dtor_core@ameritech.net>
Date: 1125816098 -0500

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

---

 drivers/input/serio/i8042-io.h        |    6 +++---
 drivers/input/serio/i8042-ip22io.h    |    2 +-
 drivers/input/serio/i8042-jazzio.h    |    2 +-
 drivers/input/serio/i8042-sparcio.h   |   12 ++++++------
 drivers/input/serio/i8042-x86ia64io.h |   22 ++++++++++++----------
 drivers/input/serio/i8042.c           |    5 +++--
 6 files changed, 26 insertions(+), 23 deletions(-)

8d5987a6e17fa36776a0c9964db0f24c3d070862
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h
--- a/drivers/input/serio/i8042-io.h
+++ b/drivers/input/serio/i8042-io.h
@@ -69,16 +69,16 @@ static inline int i8042_platform_init(vo
  */
 #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64)
 	if (!request_region(I8042_DATA_REG, 16, "i8042"))
-		return -1;
+		return -EBUSY;
 #endif
 
         i8042_reset = 1;
 
 #if defined(CONFIG_PPC64)
 	if (check_legacy_ioport(I8042_DATA_REG))
-		return -1;
+		return -EBUSY;
 	if (!request_region(I8042_DATA_REG, 16, "i8042"))
-		return -1;
+		return -EBUSY;
 #endif
 	return 0;
 }
diff --git a/drivers/input/serio/i8042-ip22io.h b/drivers/input/serio/i8042-ip22io.h
--- a/drivers/input/serio/i8042-ip22io.h
+++ b/drivers/input/serio/i8042-ip22io.h
@@ -58,7 +58,7 @@ static inline int i8042_platform_init(vo
 #if 0
 	/* XXX sgi_kh is a virtual address */
 	if (!request_mem_region(sgi_kh, sizeof(struct hpc_keyb), "i8042"))
-		return 1;
+		return -EBUSY;
 #endif
 
 	i8042_reset = 1;
diff --git a/drivers/input/serio/i8042-jazzio.h b/drivers/input/serio/i8042-jazzio.h
--- a/drivers/input/serio/i8042-jazzio.h
+++ b/drivers/input/serio/i8042-jazzio.h
@@ -53,7 +53,7 @@ static inline int i8042_platform_init(vo
 #if 0
 	/* XXX JAZZ_KEYBOARD_ADDRESS is a virtual address */
 	if (!request_mem_region(JAZZ_KEYBOARD_ADDRESS, 2, "i8042"))
-		return 1;
+		return -EBUSY;
 #endif
 
 	return 0;
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -48,10 +48,10 @@ static inline void i8042_write_command(i
 #define OBP_PS2MS_NAME1		"kdmouse"
 #define OBP_PS2MS_NAME2		"mouse"
 
-static int i8042_platform_init(void)
+static int __init i8042_platform_init(void)
 {
 #ifndef CONFIG_PCI
-	return -1;
+	return -ENODEV;
 #else
 	char prop[128];
 	int len;
@@ -59,14 +59,14 @@ static int i8042_platform_init(void)
 	len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop));
 	if (len < 0) {
 		printk("i8042: Cannot get name property of root OBP node.\n");
-		return -1;
+		return -ENODEV;
 	}
 	if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) {
 		/* Hardcoded values for MrCoffee.  */
 		i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
 		kbd_iobase = ioremap(0x71300060, 8);
 		if (!kbd_iobase)
-			return -1;
+			return -ENODEV;
 	} else {
 		struct linux_ebus *ebus;
 		struct linux_ebus_device *edev;
@@ -78,7 +78,7 @@ static int i8042_platform_init(void)
 					goto edev_found;
 			}
 		}
-		return -1;
+		return -ENODEV;
 
 	edev_found:
 		for_each_edevchild(edev, child) {
@@ -96,7 +96,7 @@ static int i8042_platform_init(void)
 		    i8042_aux_irq == -1) {
 			printk("i8042: Error, 8042 device lacks both kbd and "
 			       "mouse nodes.\n");
-			return -1;
+			return -ENODEV;
 		}
 	}
 
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -256,7 +256,7 @@ static void i8042_pnp_exit(void)
 	}
 }
 
-static int i8042_pnp_init(void)
+static int __init i8042_pnp_init(void)
 {
 	int result_kbd, result_aux;
 
@@ -322,25 +322,29 @@ static int i8042_pnp_init(void)
 	return 0;
 }
 
+#else
+static inline int i8042_pnp_init(void) { return 0; }
+static inline void i8042_pnp_exit(void) { }
 #endif
 
-static inline int i8042_platform_init(void)
+static int __init i8042_platform_init(void)
 {
+	int retval;
+
 /*
  * On ix86 platforms touching the i8042 data register region can do really
  * bad things. Because of this the region is always reserved on ix86 boxes.
  *
  *	if (!request_region(I8042_DATA_REG, 16, "i8042"))
- *		return -1;
+ *		return -EBUSY;
  */
 
 	i8042_kbd_irq = I8042_MAP_IRQ(1);
 	i8042_aux_irq = I8042_MAP_IRQ(12);
 
-#ifdef CONFIG_PNP
-	if (i8042_pnp_init())
-		return -1;
-#endif
+	retval = i8042_pnp_init();
+	if (retval)
+		return retval;
 
 #if defined(__ia64__)
         i8042_reset = 1;
@@ -354,14 +358,12 @@ static inline int i8042_platform_init(vo
 		i8042_nomux = 1;
 #endif
 
-	return 0;
+	return retval;
 }
 
 static inline void i8042_platform_exit(void)
 {
-#ifdef CONFIG_PNP
 	i8042_pnp_exit();
-#endif
 }
 
 #endif /* _I8042_X86IA64IO_H */
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1066,8 +1066,9 @@ static int __init i8042_init(void)
 	init_timer(&i8042_timer);
 	i8042_timer.function = i8042_timer_func;
 
-	if (i8042_platform_init())
-		return -EBUSY;
+	err = i8042_platform_init();
+	if (err)
+		return err;
 
 	i8042_ports[I8042_AUX_PORT_NO].irq = I8042_AUX_IRQ;
 	i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ;


  reply	other threads:[~2005-09-10 22:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-10 22:32 [GIT PULL 0/26] Input update Vojtech Pavlik
2005-09-10 22:34 ` [PATCH 1/26] psmouse - add support for IBM TrackPoint devices Vojtech Pavlik
2005-09-10 22:34   ` [PATCH 2/26] rework psmouse attributes to reduce module size Vojtech Pavlik
2005-09-10 22:34     ` [PATCH 3/26] ALPS - fix wheel decoding Vojtech Pavlik
2005-09-10 22:34       ` [PATCH 4/26] psmouse - add new Logitech wheel mouse model Vojtech Pavlik
2005-09-10 22:34         ` [PATCH 5/26] fix checking whether new keycode fits size-wise Vojtech Pavlik
2005-09-10 22:34           ` [PATCH 6/26] i8042 - clean up initialization code; abort if we Vojtech Pavlik
2005-09-10 22:34             ` Vojtech Pavlik [this message]
2005-09-10 22:34               ` [PATCH 8/26] i8042 - fix IRQ printing when either KBD or AUX port Vojtech Pavlik
2005-09-10 22:34                 ` [PATCH 9/26] i8042 - add i8042.nokbd module option to allow supressing Vojtech Pavlik
2005-09-10 22:34                   ` [PATCH 10/26] i8042 - add Lifebook E4010 to MUX blacklist Vojtech Pavlik
2005-09-10 22:34                     ` [PATCH 11/26] recognize and ignore Logitech vendor usages in HID Vojtech Pavlik
2005-09-10 22:34                       ` [PATCH 12/26] add HID simulation mappings Vojtech Pavlik
2005-09-10 22:34                         ` [PATCH 13/26] HID - add more consumer usages Vojtech Pavlik
2005-09-10 22:34                           ` [PATCH 14/26] atkbd - handle keyboards generating scancode 0x7f Vojtech Pavlik
2005-09-10 22:34                             ` [PATCH 15/26] HID - handle multi-transascion reports Vojtech Pavlik
2005-09-10 22:34                               ` [PATCH 16/26] HID - add support for Logitech UltraX Media Remote control Vojtech Pavlik
2005-09-10 22:34                                 ` [PATCH 17/26] iforce - use wait_event_interruptible_timeout Vojtech Pavlik
2005-09-10 22:34                                   ` [PATCH 18/26] sunkbd - extend mapping to handle Type-6 Sun keyboards Vojtech Pavlik
2005-09-10 22:34                                     ` [PATCH 19/26] HID - fix URB success status handling Vojtech Pavlik
2005-09-10 22:34                                       ` [PATCH 20/26] HID - add a quirk for the Apple Powermouse Vojtech Pavlik
2005-09-10 22:34                                         ` [PATCH 21/26] HID - add the Trust Predator TH 400 gamepad to the badpad list Vojtech Pavlik
2005-09-10 22:34                                           ` [PATCH 22/26] HID - add mapping for Powerbook USB keyboard Vojtech Pavlik
2005-09-10 22:34                                             ` [PATCH 23/26] HID - add Wireless Security Lock to HID blacklist Vojtech Pavlik
2005-09-10 22:34                                               ` [PATCH 24/26] HIDDEV - make HIDIOCSREPORT wait IO completion Vojtech Pavlik
2005-09-10 22:34                                                 ` [PATCH 25/26] clean up whitespace and formatting in drivers/char/keyboard.c Vojtech Pavlik
2005-09-10 22:34                                                   ` [PATCH 26/26] i8042 - use kzalloc instead of kcalloc Vojtech Pavlik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11263916522920@midnight.ucw.cz \
    --to=vojtech@suse.cz \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox