aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/mixcomwd.c
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2007-06-03 15:01:38 -0400
committerWim Van Sebroeck <wim@iguana.be>2007-06-03 15:14:15 -0400
commit4194db10fab1c9595f12b2846b6799417a8db4dd (patch)
tree5e0e0f0b3bc4c3165fa02fbeaf40a78262972c3a /drivers/char/watchdog/mixcomwd.c
parent63e6e17ead8f918889c63cc361de58a3f71f6115 (diff)
[WATCHDOG] Mixcom Watchdog - checkcard
Simplify the mixcomwd_checkcard and flashcom_checkcard functions to one checkcard function as part of the port to an isa watchdog device driver. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/mixcomwd.c')
-rw-r--r--drivers/char/watchdog/mixcomwd.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c
index b614a5f6e331..17c29cb78d09 100644
--- a/drivers/char/watchdog/mixcomwd.c
+++ b/drivers/char/watchdog/mixcomwd.c
@@ -217,23 +217,7 @@ static struct miscdevice mixcomwd_miscdev=
217 .fops = &mixcomwd_fops, 217 .fops = &mixcomwd_fops,
218}; 218};
219 219
220static int __init mixcomwd_checkcard(int port) 220static int __init checkcard(int port, int card_id)
221{
222 int id;
223
224 if (!request_region(port, 1, "MixCOM watchdog")) {
225 return 0;
226 }
227
228 id=inb_p(port) & 0x3f;
229 if(id!=MIXCOM_ID) {
230 release_region(port, 1);
231 return 0;
232 }
233 return port;
234}
235
236static int __init flashcom_checkcard(int port)
237{ 221{
238 int id; 222 int id;
239 223
@@ -242,12 +226,15 @@ static int __init flashcom_checkcard(int port)
242 } 226 }
243 227
244 id=inb_p(port); 228 id=inb_p(port);
245 if(id!=FLASHCOM_ID) { 229 if (card_id==MIXCOM_ID)
230 id &= 0x3f;
231
232 if (id!=card_id) {
246 release_region(port, 1); 233 release_region(port, 1);
247 return 0; 234 return 0;
248 } 235 }
249 return port; 236 return 1;
250 } 237}
251 238
252static int __init mixcomwd_init(void) 239static int __init mixcomwd_init(void)
253{ 240{
@@ -256,17 +243,17 @@ static int __init mixcomwd_init(void)
256 int found=0; 243 int found=0;
257 244
258 for (i = 0; !found && mixcomwd_ioports[i] != 0; i++) { 245 for (i = 0; !found && mixcomwd_ioports[i] != 0; i++) {
259 watchdog_port = mixcomwd_checkcard(mixcomwd_ioports[i]); 246 if (checkcard(mixcomwd_ioports[i], MIXCOM_ID)) {
260 if (watchdog_port) {
261 found = 1; 247 found = 1;
248 watchdog_port = mixcomwd_ioports[i];
262 } 249 }
263 } 250 }
264 251
265 /* The FlashCOM card can be set up at 0x304 -> 0x37c, in 0x8 jumps */ 252 /* The FlashCOM card can be set up at 0x304 -> 0x37c, in 0x8 jumps */
266 for (i = 0x304; !found && i < 0x380; i+=0x8) { 253 for (i = 0x304; !found && i < 0x380; i+=0x8) {
267 watchdog_port = flashcom_checkcard(i); 254 if (checkcard(i, FLASHCOM_ID)) {
268 if (watchdog_port) {
269 found = 1; 255 found = 1;
256 watchdog_port = i;
270 } 257 }
271 } 258 }
272 259