aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/pcwd.c
diff options
context:
space:
mode:
authorWim Van Sebroeck <wim@iguana.be>2006-02-12 10:47:34 -0500
committerWim Van Sebroeck <wim@iguana.be>2006-04-02 12:39:48 -0400
commit2891b6ad188f8cd1407f17e52befb26b7e1f4de1 (patch)
tree2d9c4c7d9b2ad89856d935c636f67c6efedbd0ec /drivers/char/watchdog/pcwd.c
parent4206f0c4de9f9683676a8507ef56941535761579 (diff)
[WATCHDOG] pcwd.c firmware-info patch
Get the firmware version into the private data struct of the ISA-PC watchdog card. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/pcwd.c')
-rw-r--r--drivers/char/watchdog/pcwd.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c
index c6e27e2f0390..3d20241b1261 100644
--- a/drivers/char/watchdog/pcwd.c
+++ b/drivers/char/watchdog/pcwd.c
@@ -146,6 +146,7 @@ static atomic_t open_allowed = ATOMIC_INIT(1);
146static char expect_close; 146static char expect_close;
147static int temp_panic; 147static int temp_panic;
148static struct { /* this is private data for each ISA-PC watchdog card */ 148static struct { /* this is private data for each ISA-PC watchdog card */
149 char fw_ver_str[6]; /* The cards firmware version */
149 int revision; /* The card's revision */ 150 int revision; /* The card's revision */
150 int supports_temp; /* Wether or not the card has a temperature device */ 151 int supports_temp; /* Wether or not the card has a temperature device */
151 int command_mode; /* Wether or not the card is in command mode */ 152 int command_mode; /* Wether or not the card is in command mode */
@@ -238,27 +239,22 @@ static inline void pcwd_check_temperature_support(void)
238 pcwd_private.supports_temp = 1; 239 pcwd_private.supports_temp = 1;
239} 240}
240 241
241static inline char *get_firmware(void) 242static inline void pcwd_get_firmware(void)
242{ 243{
243 int one, ten, hund, minor; 244 int one, ten, hund, minor;
244 char *ret;
245 245
246 ret = kmalloc(6, GFP_KERNEL); 246 sprintf(pcwd_private.fw_ver_str, "ERROR");
247 if(ret == NULL)
248 return NULL;
249 247
250 if (set_command_mode()) { 248 if (set_command_mode()) {
251 one = send_isa_command(CMD_ISA_VERSION_INTEGER); 249 one = send_isa_command(CMD_ISA_VERSION_INTEGER);
252 ten = send_isa_command(CMD_ISA_VERSION_TENTH); 250 ten = send_isa_command(CMD_ISA_VERSION_TENTH);
253 hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH); 251 hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH);
254 minor = send_isa_command(CMD_ISA_VERSION_MINOR); 252 minor = send_isa_command(CMD_ISA_VERSION_MINOR);
255 sprintf(ret, "%c.%c%c%c", one, ten, hund, minor); 253 sprintf(pcwd_private.fw_ver_str, "%c.%c%c%c", one, ten, hund, minor);
256 } 254 }
257 else
258 sprintf(ret, "ERROR");
259
260 unset_command_mode(); 255 unset_command_mode();
261 return(ret); 256
257 return;
262} 258}
263 259
264static inline int pcwd_get_option_switches(void) 260static inline int pcwd_get_option_switches(void)
@@ -276,17 +272,15 @@ static inline int pcwd_get_option_switches(void)
276 272
277static void pcwd_show_card_info(void) 273static void pcwd_show_card_info(void)
278{ 274{
279 char *firmware;
280 int option_switches; 275 int option_switches;
281 276
282 /* Get some extra info from the hardware (in command/debug/diag mode) */ 277 /* Get some extra info from the hardware (in command/debug/diag mode) */
283 if (pcwd_private.revision == PCWD_REVISION_A) 278 if (pcwd_private.revision == PCWD_REVISION_A)
284 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr); 279 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr);
285 else if (pcwd_private.revision == PCWD_REVISION_C) { 280 else if (pcwd_private.revision == PCWD_REVISION_C) {
286 firmware = get_firmware(); 281 pcwd_get_firmware();
287 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n", 282 printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",
288 pcwd_private.io_addr, firmware); 283 pcwd_private.io_addr, pcwd_private.fw_ver_str);
289 kfree(firmware);
290 option_switches = pcwd_get_option_switches(); 284 option_switches = pcwd_get_option_switches();
291 printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", 285 printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
292 option_switches, 286 option_switches,