aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-05-08 03:36:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:23 -0400
commit916f11c760fc1c835d3fe10bebc97a02e2ac6b41 (patch)
tree01265e3cc0aba33ef32b399965105b64975176c7
parenta1e7e636fe9fff531a4fc42e65c8e8416fde5220 (diff)
smsc-ircc2: tidy up module parameter checking
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> Cc: Keith Owens <kaos@ocs.com.au> Cc: Len Brown <lenb@kernel.org> Cc: Adam Belay <ambx1@neo.rr.com> Cc: Matthieu CASTET <castet.matthieu@free.fr> Cc: Jean Tourrilhes <jt@hpl.hp.com> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Ville Syrjala <syrjala@sci.fi> Cc: Russell King <rmk+serial@arm.linux.org.uk> Cc: Samuel Ortiz <samuel@sortiz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/net/irda/smsc-ircc2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 198bf3bfa70f..1d249737f96f 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -79,11 +79,13 @@ MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
79MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver"); 79MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
81 81
82static int ircc_dma = 255; 82#define DMA_INVAL 255
83static int ircc_dma = DMA_INVAL;
83module_param(ircc_dma, int, 0); 84module_param(ircc_dma, int, 0);
84MODULE_PARM_DESC(ircc_dma, "DMA channel"); 85MODULE_PARM_DESC(ircc_dma, "DMA channel");
85 86
86static int ircc_irq = 255; 87#define IRQ_INVAL 255
88static int ircc_irq = IRQ_INVAL;
87module_param(ircc_irq, int, 0); 89module_param(ircc_irq, int, 0);
88MODULE_PARM_DESC(ircc_irq, "IRQ line"); 90MODULE_PARM_DESC(ircc_irq, "IRQ line");
89 91
@@ -646,7 +648,7 @@ static void smsc_ircc_setup_io(struct smsc_ircc_cb *self,
646 self->io.fifo_size = SMSC_IRCC2_FIFO_SIZE; 648 self->io.fifo_size = SMSC_IRCC2_FIFO_SIZE;
647 self->io.speed = SMSC_IRCC2_C_IRDA_FALLBACK_SPEED; 649 self->io.speed = SMSC_IRCC2_C_IRDA_FALLBACK_SPEED;
648 650
649 if (irq < 255) { 651 if (irq != IRQ_INVAL) {
650 if (irq != chip_irq) 652 if (irq != chip_irq)
651 IRDA_MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n", 653 IRDA_MESSAGE("%s, Overriding IRQ - chip says %d, using %d\n",
652 driver_name, chip_irq, irq); 654 driver_name, chip_irq, irq);
@@ -654,7 +656,7 @@ static void smsc_ircc_setup_io(struct smsc_ircc_cb *self,
654 } else 656 } else
655 self->io.irq = chip_irq; 657 self->io.irq = chip_irq;
656 658
657 if (dma < 255) { 659 if (dma != DMA_INVAL) {
658 if (dma != chip_dma) 660 if (dma != chip_dma)
659 IRDA_MESSAGE("%s, Overriding DMA - chip says %d, using %d\n", 661 IRDA_MESSAGE("%s, Overriding DMA - chip says %d, using %d\n",
660 driver_name, chip_dma, dma); 662 driver_name, chip_dma, dma);
@@ -2836,9 +2838,9 @@ static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg,
2836 tmpconf.fir_io = ircc_fir; 2838 tmpconf.fir_io = ircc_fir;
2837 if (ircc_sir != 0) 2839 if (ircc_sir != 0)
2838 tmpconf.sir_io = ircc_sir; 2840 tmpconf.sir_io = ircc_sir;
2839 if (ircc_dma != 0xff) 2841 if (ircc_dma != DMA_INVAL)
2840 tmpconf.fir_dma = ircc_dma; 2842 tmpconf.fir_dma = ircc_dma;
2841 if (ircc_irq != 0xff) 2843 if (ircc_irq != IRQ_INVAL)
2842 tmpconf.fir_irq = ircc_irq; 2844 tmpconf.fir_irq = ircc_irq;
2843 2845
2844 IRDA_MESSAGE("Detected unconfigured %s SMSC IrDA chip, pre-configuring device.\n", conf->name); 2846 IRDA_MESSAGE("Detected unconfigured %s SMSC IrDA chip, pre-configuring device.\n", conf->name);