linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Keith Owens <kaos@ocs.com.au>, Len Brown <lenb@kernel.org>,
	Adam Belay <ambx1@neo.rr.com>,
	Matthieu CASTET <castet.matthieu@free.fr>,
	Jean Tourrilhes <jt@hpl.hp.com>,
	Matthew Garrett <mjg59@srcf.ucam.org>,
	Ville Syrjala <syrjala@sci.fi>,
	Russell King <rmk+serial@arm.linux.org.uk>,
	linux-serial@vger.kernel.org, Samuel Ortiz <samuel@sortiz.org>,
	linux-kernel@vger.kernel.org
Subject: [patch 3/5] smsc-ircc2: tidy up module parameter checking
Date: Wed, 04 Apr 2007 16:45:39 -0600	[thread overview]
Message-ID: <20070404224608.828386000@ldl.fc.hp.com> (raw)
In-Reply-To: 20070404224536.337573000@ldl.fc.hp.com

[-- Attachment #1: smsc-ircc2-tidy-module-param-checking.patch --]
[-- Type: text/plain, Size: 1794 bytes --]

To determine whether the user specified a module parameter, use some #defines
instead of checking for bare magic numbers.

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

Index: w/drivers/net/irda/smsc-ircc2.c
===================================================================
--- w.orig/drivers/net/irda/smsc-ircc2.c	2007-04-04 13:38:30.000000000 -0600
+++ w/drivers/net/irda/smsc-ircc2.c	2007-04-04 13:45:18.000000000 -0600
@@ -79,11 +79,13 @@
 MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
 MODULE_LICENSE("GPL");
 
-static int ircc_dma = 255;
+#define DMA_INVAL 255
+static int ircc_dma = DMA_INVAL;
 module_param(ircc_dma, int, 0);
 MODULE_PARM_DESC(ircc_dma, "DMA channel");
 
-static int ircc_irq = 255;
+#define IRQ_INVAL 255
+static int ircc_irq = IRQ_INVAL;
 module_param(ircc_irq, int, 0);
 MODULE_PARM_DESC(ircc_irq, "IRQ line");
 
@@ -646,7 +648,7 @@
 	self->io.fifo_size = SMSC_IRCC2_FIFO_SIZE;
 	self->io.speed = SMSC_IRCC2_C_IRDA_FALLBACK_SPEED;
 
-	if (irq < 255) {
+	if (irq != IRQ_INVAL) {
 		if (irq != chip_irq)
 			IRDA_MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n",
 				     driver_name, chip_irq, irq);
@@ -654,7 +656,7 @@
 	} else
 		self->io.irq = chip_irq;
 
-	if (dma < 255) {
+	if (dma != DMA_INVAL) {
 		if (dma != chip_dma)
 			IRDA_MESSAGE("%s, Overriding DMA - chip says %d, using %d\n",
 				     driver_name, chip_dma, dma);
@@ -2836,9 +2838,9 @@
 					tmpconf.fir_io = ircc_fir;
 				if (ircc_sir != 0)
 					tmpconf.sir_io = ircc_sir;
-				if (ircc_dma != 0xff)
+				if (ircc_dma != DMA_INVAL)
 					tmpconf.fir_dma = ircc_dma;
-				if (ircc_irq != 0xff)
+				if (ircc_irq != IRQ_INVAL)
 					tmpconf.fir_irq = ircc_irq;
 
 				IRDA_MESSAGE("Detected unconfigured %s SMSC IrDA chip, pre-configuring device.\n", conf->name);

--

  parent reply	other threads:[~2007-04-04 22:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-04 22:45 [patch 0/5] PNP: convert x86 legacy serial to platform devs, add SMC IR PNP probe Bjorn Helgaas
2007-04-04 22:45 ` [patch 1/5] PNP: notice whether we have PNP devices (PNPBIOS or PNPACPI) Bjorn Helgaas
2007-04-04 22:45 ` [patch 2/5] PNP: workaround HP BIOS defect that leaves SMCF010 device partly enabled Bjorn Helgaas
2007-04-04 22:45 ` Bjorn Helgaas [this message]
2007-04-04 22:45 ` [patch 4/5] smsc-ircc2: add PNP support Bjorn Helgaas
2007-04-04 23:16   ` Randy Dunlap
2007-04-05 18:45     ` Bjorn Helgaas
2007-04-04 22:45 ` [patch 5/5] x86, serial: convert legacy COM ports to platform devices Bjorn Helgaas

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=20070404224608.828386000@ldl.fc.hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=ambx1@neo.rr.com \
    --cc=castet.matthieu@free.fr \
    --cc=jt@hpl.hp.com \
    --cc=kaos@ocs.com.au \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=rmk+serial@arm.linux.org.uk \
    --cc=samuel@sortiz.org \
    --cc=syrjala@sci.fi \
    /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;
as well as URLs for NNTP newsgroup(s).