From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [patch 2/2] staging: sb105x: clean up interface type test
Date: Wed, 09 Jan 2013 07:12:14 +0000 [thread overview]
Message-ID: <20130109071214.GC2454@elgon.mountain> (raw)
IIR_RS232 is zero so "if (IIR_RS232 = (b_ret & IIR_RS232))" is always
true so RS232 was always chosen by default. The test should be
"if (0 = (b_ret & 0x30)) { ". The other tests should also be in that
format.
My patch doesn't change how the code works. I've left the RS232 as the
default and cleaned up the other checks.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/sb105x/sb_mp_register.h b/drivers/staging/sb105x/sb_mp_register.h
index 5480ae1..a2087f5 100644
--- a/drivers/staging/sb105x/sb_mp_register.h
+++ b/drivers/staging/sb105x/sb_mp_register.h
@@ -45,7 +45,7 @@
#define IIR_RS232 0x00 /* RS232 type */
#define IIR_RS422 0x10 /* RS422 type */
#define IIR_RS485 0x20 /* RS485 type */
-#define IIR_UNKNOWN 0x30 /* unknown type */
+#define IIR_TYPE_MASK 0x30
/* Interrrupt Mask Register */
#define MP_OPTR_IMR0 0x0C /* port0 ~ port8 */
diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c
index 131afd0c..3da44df 100644
--- a/drivers/staging/sb105x/sb_pci_mp.c
+++ b/drivers/staging/sb105x/sb_pci_mp.c
@@ -2851,18 +2851,12 @@ static void __init multi_init_ports(void)
printk("IIR_RET = %x\n",b_ret);
}
- if(IIR_RS232 = (b_ret & IIR_RS232))
- {
- mtpt->interface = RS232;
- }
- if(IIR_RS422 = (b_ret & IIR_RS422))
- {
+ /* default to RS232 */
+ mtpt->interface = RS232;
+ if (IIR_RS422 = (b_ret & IIR_TYPE_MASK))
mtpt->interface = RS422PTP;
- }
- if(IIR_RS485 = (b_ret & IIR_RS485))
- {
+ if (IIR_RS485 = (b_ret & IIR_TYPE_MASK))
mtpt->interface = RS485NE;
- }
}
}
}
next reply other threads:[~2013-01-09 7:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 7:12 Dan Carpenter [this message]
2013-01-09 7:44 ` [patch 2/2] staging: sb105x: clean up interface type test Dan Carpenter
2013-01-09 13:27 ` Steven Rostedt
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=20130109071214.GC2454@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.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