mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Adam Belay <ambx1@neo.rr.com>
Cc: linux-kernel@vger.kernel.org, Jaroslav Kysela <perex@suse.cz>,
	Matthieu Castet <castet.matthieu@free.fr>,
	Li Shaohua <shaohua.li@intel.com>, Andrew Morton <akpm@osdl.org>,
	Dmitry Torokhov <dtor_core@ameritech.net>,
	linux-input@atrey.karlin.mff.cuni.cz
Subject: [PATCH 6/9] i8042: adjust pnp_register_driver signature
Date: Thu, 2 Mar 2006 16:09:42 -0700	[thread overview]
Message-ID: <200603021609.42272.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <200603021601.27467.bjorn.helgaas@hp.com>

Remove the assumption that pnp_register_driver() returns the number of
devices claimed.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Index: work-mm4/drivers/input/serio/i8042-x86ia64io.h
===================================================================
--- work-mm4.orig/drivers/input/serio/i8042-x86ia64io.h	2006-03-02 12:40:45.000000000 -0700
+++ work-mm4/drivers/input/serio/i8042-x86ia64io.h	2006-03-02 12:45:21.000000000 -0700
@@ -192,7 +192,9 @@
 #include <linux/pnp.h>
 
 static int i8042_pnp_kbd_registered;
+static unsigned int i8042_pnp_kbd_devices;
 static int i8042_pnp_aux_registered;
+static unsigned int i8042_pnp_aux_devices;
 
 static int i8042_pnp_command_reg;
 static int i8042_pnp_data_reg;
@@ -219,6 +221,7 @@
 		strncat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
 	}
 
+	i8042_pnp_kbd_devices++;
 	return 0;
 }
 
@@ -239,6 +242,7 @@
 		strncat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
 	}
 
+	i8042_pnp_aux_devices++;
 	return 0;
 }
 
@@ -287,21 +291,23 @@
 
 static int __init i8042_pnp_init(void)
 {
-	int result_kbd = 0, result_aux = 0;
 	char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
+	int err;
 
 	if (i8042_nopnp) {
 		printk(KERN_INFO "i8042: PNP detection disabled\n");
 		return 0;
 	}
 
-	if ((result_kbd = pnp_register_driver(&i8042_pnp_kbd_driver)) >= 0)
+	err = pnp_register_driver(&i8042_pnp_kbd_driver);
+	if (!err)
 		i8042_pnp_kbd_registered = 1;
 
-	if ((result_aux = pnp_register_driver(&i8042_pnp_aux_driver)) >= 0)
+	err = pnp_register_driver(&i8042_pnp_aux_driver);
+	if (!err)
 		i8042_pnp_aux_registered = 1;
 
-	if (result_kbd <= 0 && result_aux <= 0) {
+	if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
 		i8042_pnp_exit();
 #if defined(__ia64__)
 		return -ENODEV;
@@ -311,24 +317,24 @@
 #endif
 	}
 
-	if (result_kbd > 0)
+	if (i8042_pnp_kbd_devices)
 		snprintf(kbd_irq_str, sizeof(kbd_irq_str),
 			"%d", i8042_pnp_kbd_irq);
-	if (result_aux > 0)
+	if (i8042_pnp_aux_devices)
 		snprintf(aux_irq_str, sizeof(aux_irq_str),
 			"%d", i8042_pnp_aux_irq);
 
 	printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
-		i8042_pnp_kbd_name, (result_kbd > 0 && result_aux > 0) ? "," : "",
+		i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
 		i8042_pnp_aux_name,
 		i8042_pnp_data_reg, i8042_pnp_command_reg,
-		kbd_irq_str, (result_kbd > 0 && result_aux > 0) ? "," : "",
+		kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
 		aux_irq_str);
 
 #if defined(__ia64__)
-	if (result_kbd <= 0)
+	if (!i8042_pnp_kbd_devices)
 		i8042_nokbd = 1;
-	if (result_aux <= 0)
+	if (!i8042_pnp_aux_devices)
 		i8042_noaux = 1;
 #endif
 

  parent reply	other threads:[~2006-03-02 23:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-02 23:01 [PATCH 0/9] PNP: " Bjorn Helgaas
2006-03-02 23:09 ` [PATCH 1/9] parport: " Bjorn Helgaas
2006-03-02 23:09 ` [PATCH 2/9] mpu401: " Bjorn Helgaas
2006-03-02 23:09 ` [PATCH 3/9] cs4236: " Bjorn Helgaas
2006-03-02 23:09 ` [PATCH 4/9] opl3sa2: " Bjorn Helgaas
2006-03-02 23:09 ` [PATCH 5/9] ns558: " Bjorn Helgaas
2006-03-03 12:55   ` Vojtech Pavlik
2006-03-03 15:58     ` Bjorn Helgaas
2006-03-02 23:09 ` Bjorn Helgaas [this message]
2006-03-14  5:31   ` [PATCH 6/9] i8042: " Dmitry Torokhov
2006-03-02 23:09 ` [PATCH 7/9] IRDA: " Bjorn Helgaas
2006-03-02 23:09 ` [PATCH 8/9] cs4232: " Bjorn Helgaas
2006-03-02 23:09 ` [PATCH 9/9] PNP: " Bjorn Helgaas
2006-03-14  6:19 ` [PATCH 0/9] " Adam Belay

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=200603021609.42272.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=akpm@osdl.org \
    --cc=ambx1@neo.rr.com \
    --cc=castet.matthieu@free.fr \
    --cc=dtor_core@ameritech.net \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    --cc=shaohua.li@intel.com \
    /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

all inboxes | Powered by JetHome®