diff options
author | Dave Jones <davej@redhat.com> | 2006-12-12 18:13:32 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-12-12 18:13:32 -0500 |
commit | f0eef25339f92f7cd4aeea23d9ae97987a5a1e82 (patch) | |
tree | 2472e94d39f43a9580a6d2d5d92de0b749023263 /drivers/char/watchdog/alim7101_wdt.c | |
parent | 0cfea5dd98205f2fa318836da664a7d7df1afbc1 (diff) | |
parent | e1036502e5263851259d147771226161e5ccc85a (diff) |
Merge ../linus
Diffstat (limited to 'drivers/char/watchdog/alim7101_wdt.c')
-rw-r--r-- | drivers/char/watchdog/alim7101_wdt.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c index ffd7684f999b..bf25d0a55a99 100644 --- a/drivers/char/watchdog/alim7101_wdt.c +++ b/drivers/char/watchdog/alim7101_wdt.c | |||
@@ -77,7 +77,8 @@ static struct pci_dev *alim7101_pmu; | |||
77 | 77 | ||
78 | static int nowayout = WATCHDOG_NOWAYOUT; | 78 | static int nowayout = WATCHDOG_NOWAYOUT; |
79 | module_param(nowayout, int, 0); | 79 | module_param(nowayout, int, 0); |
80 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); | 80 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" |
81 | __stringify(CONFIG_WATCHDOG_NOWAYOUT) ")"); | ||
81 | 82 | ||
82 | /* | 83 | /* |
83 | * Whack the dog | 84 | * Whack the dog |
@@ -277,7 +278,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u | |||
277 | case WDIOC_GETTIMEOUT: | 278 | case WDIOC_GETTIMEOUT: |
278 | return put_user(timeout, p); | 279 | return put_user(timeout, p); |
279 | default: | 280 | default: |
280 | return -ENOIOCTLCMD; | 281 | return -ENOTTY; |
281 | } | 282 | } |
282 | } | 283 | } |
283 | 284 | ||
@@ -333,6 +334,7 @@ static void __exit alim7101_wdt_unload(void) | |||
333 | /* Deregister */ | 334 | /* Deregister */ |
334 | misc_deregister(&wdt_miscdev); | 335 | misc_deregister(&wdt_miscdev); |
335 | unregister_reboot_notifier(&wdt_notifier); | 336 | unregister_reboot_notifier(&wdt_notifier); |
337 | pci_dev_put(alim7101_pmu); | ||
336 | } | 338 | } |
337 | 339 | ||
338 | static int __init alim7101_wdt_init(void) | 340 | static int __init alim7101_wdt_init(void) |
@@ -342,7 +344,8 @@ static int __init alim7101_wdt_init(void) | |||
342 | char tmp; | 344 | char tmp; |
343 | 345 | ||
344 | printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n"); | 346 | printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n"); |
345 | alim7101_pmu = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,NULL); | 347 | alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, |
348 | NULL); | ||
346 | if (!alim7101_pmu) { | 349 | if (!alim7101_pmu) { |
347 | printk(KERN_INFO PFX "ALi M7101 PMU not present - WDT not set\n"); | 350 | printk(KERN_INFO PFX "ALi M7101 PMU not present - WDT not set\n"); |
348 | return -EBUSY; | 351 | return -EBUSY; |
@@ -351,21 +354,23 @@ static int __init alim7101_wdt_init(void) | |||
351 | /* Set the WDT in the PMU to 1 second */ | 354 | /* Set the WDT in the PMU to 1 second */ |
352 | pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02); | 355 | pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02); |
353 | 356 | ||
354 | ali1543_south = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | 357 | ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, |
358 | NULL); | ||
355 | if (!ali1543_south) { | 359 | if (!ali1543_south) { |
356 | printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n"); | 360 | printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n"); |
357 | return -EBUSY; | 361 | goto err_out; |
358 | } | 362 | } |
359 | pci_read_config_byte(ali1543_south, 0x5e, &tmp); | 363 | pci_read_config_byte(ali1543_south, 0x5e, &tmp); |
364 | pci_dev_put(ali1543_south); | ||
360 | if ((tmp & 0x1e) == 0x00) { | 365 | if ((tmp & 0x1e) == 0x00) { |
361 | if (!use_gpio) { | 366 | if (!use_gpio) { |
362 | printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n"); | 367 | printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n"); |
363 | return -EBUSY; | 368 | goto err_out; |
364 | } | 369 | } |
365 | nowayout = 1; | 370 | nowayout = 1; |
366 | } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) { | 371 | } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) { |
367 | printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n"); | 372 | printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n"); |
368 | return -EBUSY; | 373 | goto err_out; |
369 | } | 374 | } |
370 | 375 | ||
371 | if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */ | 376 | if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */ |
@@ -404,12 +409,23 @@ static int __init alim7101_wdt_init(void) | |||
404 | err_out_miscdev: | 409 | err_out_miscdev: |
405 | misc_deregister(&wdt_miscdev); | 410 | misc_deregister(&wdt_miscdev); |
406 | err_out: | 411 | err_out: |
412 | pci_dev_put(alim7101_pmu); | ||
407 | return rc; | 413 | return rc; |
408 | } | 414 | } |
409 | 415 | ||
410 | module_init(alim7101_wdt_init); | 416 | module_init(alim7101_wdt_init); |
411 | module_exit(alim7101_wdt_unload); | 417 | module_exit(alim7101_wdt_unload); |
412 | 418 | ||
419 | static struct pci_device_id alim7101_pci_tbl[] __devinitdata = { | ||
420 | { PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, | ||
421 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
422 | { PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, | ||
423 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
424 | { } | ||
425 | }; | ||
426 | |||
427 | MODULE_DEVICE_TABLE(pci, alim7101_pci_tbl); | ||
428 | |||
413 | MODULE_AUTHOR("Steve Hill"); | 429 | MODULE_AUTHOR("Steve Hill"); |
414 | MODULE_DESCRIPTION("ALi M7101 PMU Computer Watchdog Timer driver"); | 430 | MODULE_DESCRIPTION("ALi M7101 PMU Computer Watchdog Timer driver"); |
415 | MODULE_LICENSE("GPL"); | 431 | MODULE_LICENSE("GPL"); |