diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2005-10-20 04:21:33 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2005-10-20 04:21:33 -0400 |
commit | 312f5726055534be1dc9dd369be13aabd2943fcb (patch) | |
tree | 29394a3f83b4952a73b36a4aa962dfeda839e9db /drivers/char | |
parent | 3d5efad953c6d5ba11d5bcb584ef8e906f953a73 (diff) | |
parent | 93918e9afc76717176e9e114e79cdbb602a45ae8 (diff) |
merge Linus head tree into my drm tree and fix up conflicts
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/.gitignore | 3 | ||||
-rw-r--r-- | drivers/char/drm/drm_drv.c | 2 | ||||
-rw-r--r-- | drivers/char/drm/drm_proc.c | 2 | ||||
-rw-r--r-- | drivers/char/drm/drm_stub.c | 2 | ||||
-rw-r--r-- | drivers/char/drm/mga_dma.c | 22 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_poweroff.c | 2 | ||||
-rw-r--r-- | drivers/char/mbcs.c | 3 | ||||
-rw-r--r-- | drivers/char/n_r3964.c | 92 | ||||
-rw-r--r-- | drivers/char/s3c2410-rtc.c | 1 | ||||
-rw-r--r-- | drivers/char/watchdog/mv64x60_wdt.c | 14 | ||||
-rw-r--r-- | drivers/char/watchdog/pcwd_pci.c | 239 |
11 files changed, 255 insertions, 127 deletions
diff --git a/drivers/char/.gitignore b/drivers/char/.gitignore new file mode 100644 index 000000000000..2b6b1d772ed7 --- /dev/null +++ b/drivers/char/.gitignore | |||
@@ -0,0 +1,3 @@ | |||
1 | consolemap_deftbl.c | ||
2 | defkeymap.c | ||
3 | |||
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index 26733248ff4a..4dff7554eb08 100644 --- a/drivers/char/drm/drm_drv.c +++ b/drivers/char/drm/drm_drv.c | |||
@@ -382,7 +382,7 @@ static int __init drm_core_init(void) | |||
382 | goto err_p2; | 382 | goto err_p2; |
383 | } | 383 | } |
384 | 384 | ||
385 | drm_proc_root = create_proc_entry("dri", S_IFDIR, NULL); | 385 | drm_proc_root = proc_mkdir("dri", NULL); |
386 | if (!drm_proc_root) { | 386 | if (!drm_proc_root) { |
387 | DRM_ERROR("Cannot create /proc/dri\n"); | 387 | DRM_ERROR("Cannot create /proc/dri\n"); |
388 | ret = -1; | 388 | ret = -1; |
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c index 8ec2156b97a9..3f452f763f0f 100644 --- a/drivers/char/drm/drm_proc.c +++ b/drivers/char/drm/drm_proc.c | |||
@@ -97,7 +97,7 @@ int drm_proc_init(drm_device_t * dev, int minor, | |||
97 | char name[64]; | 97 | char name[64]; |
98 | 98 | ||
99 | sprintf(name, "%d", minor); | 99 | sprintf(name, "%d", minor); |
100 | *dev_root = create_proc_entry(name, S_IFDIR, root); | 100 | *dev_root = proc_mkdir(name, root); |
101 | if (!*dev_root) { | 101 | if (!*dev_root) { |
102 | DRM_ERROR("Cannot create /proc/dri/%s\n", name); | 102 | DRM_ERROR("Cannot create /proc/dri/%s\n", name); |
103 | return -1; | 103 | return -1; |
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c index 7cb7234d6288..60b6f8e8bf69 100644 --- a/drivers/char/drm/drm_stub.c +++ b/drivers/char/drm/drm_stub.c | |||
@@ -47,7 +47,7 @@ MODULE_PARM_DESC(cards_limit, "Maximum number of graphics cards"); | |||
47 | MODULE_PARM_DESC(debug, "Enable debug output"); | 47 | MODULE_PARM_DESC(debug, "Enable debug output"); |
48 | 48 | ||
49 | module_param_named(cards_limit, drm_cards_limit, int, 0444); | 49 | module_param_named(cards_limit, drm_cards_limit, int, 0444); |
50 | module_param_named(debug, drm_debug, int, 0666); | 50 | module_param_named(debug, drm_debug, int, 0600); |
51 | 51 | ||
52 | drm_head_t **drm_heads; | 52 | drm_head_t **drm_heads; |
53 | struct drm_sysfs_class *drm_class; | 53 | struct drm_sysfs_class *drm_class; |
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c index cfbe35d5d862..70dc7f64b7b9 100644 --- a/drivers/char/drm/mga_dma.c +++ b/drivers/char/drm/mga_dma.c | |||
@@ -429,7 +429,7 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
429 | { | 429 | { |
430 | drm_mga_private_t *const dev_priv = | 430 | drm_mga_private_t *const dev_priv = |
431 | (drm_mga_private_t *) dev->dev_private; | 431 | (drm_mga_private_t *) dev->dev_private; |
432 | const unsigned int warp_size = mga_warp_microcode_size(dev_priv); | 432 | unsigned int warp_size = mga_warp_microcode_size(dev_priv); |
433 | int err; | 433 | int err; |
434 | unsigned offset; | 434 | unsigned offset; |
435 | const unsigned secondary_size = dma_bs->secondary_bin_count | 435 | const unsigned secondary_size = dma_bs->secondary_bin_count |
@@ -487,6 +487,12 @@ static int mga_do_agp_dma_bootstrap(drm_device_t * dev, | |||
487 | return err; | 487 | return err; |
488 | } | 488 | } |
489 | 489 | ||
490 | /* Make drm_addbufs happy by not trying to create a mapping for less | ||
491 | * than a page. | ||
492 | */ | ||
493 | if (warp_size < PAGE_SIZE) | ||
494 | warp_size = PAGE_SIZE; | ||
495 | |||
490 | offset = 0; | 496 | offset = 0; |
491 | err = drm_addmap(dev, offset, warp_size, | 497 | err = drm_addmap(dev, offset, warp_size, |
492 | _DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp); | 498 | _DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp); |
@@ -576,7 +582,7 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
576 | { | 582 | { |
577 | drm_mga_private_t *const dev_priv = | 583 | drm_mga_private_t *const dev_priv = |
578 | (drm_mga_private_t *) dev->dev_private; | 584 | (drm_mga_private_t *) dev->dev_private; |
579 | const unsigned int warp_size = mga_warp_microcode_size(dev_priv); | 585 | unsigned int warp_size = mga_warp_microcode_size(dev_priv); |
580 | unsigned int primary_size; | 586 | unsigned int primary_size; |
581 | unsigned int bin_count; | 587 | unsigned int bin_count; |
582 | int err; | 588 | int err; |
@@ -587,6 +593,12 @@ static int mga_do_pci_dma_bootstrap(drm_device_t * dev, | |||
587 | return DRM_ERR(EFAULT); | 593 | return DRM_ERR(EFAULT); |
588 | } | 594 | } |
589 | 595 | ||
596 | /* Make drm_addbufs happy by not trying to create a mapping for less | ||
597 | * than a page. | ||
598 | */ | ||
599 | if (warp_size < PAGE_SIZE) | ||
600 | warp_size = PAGE_SIZE; | ||
601 | |||
590 | /* The proper alignment is 0x100 for this mapping */ | 602 | /* The proper alignment is 0x100 for this mapping */ |
591 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, | 603 | err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT, |
592 | _DRM_READ_ONLY, &dev_priv->warp); | 604 | _DRM_READ_ONLY, &dev_priv->warp); |
@@ -789,6 +801,10 @@ static int mga_do_init_dma(drm_device_t * dev, drm_mga_init_t * init) | |||
789 | } | 801 | } |
790 | 802 | ||
791 | if (!dev_priv->used_new_dma_init) { | 803 | if (!dev_priv->used_new_dma_init) { |
804 | |||
805 | dev_priv->dma_access = MGA_PAGPXFER; | ||
806 | dev_priv->wagp_enable = MGA_WAGP_ENABLE; | ||
807 | |||
792 | dev_priv->status = drm_core_findmap(dev, init->status_offset); | 808 | dev_priv->status = drm_core_findmap(dev, init->status_offset); |
793 | if (!dev_priv->status) { | 809 | if (!dev_priv->status) { |
794 | DRM_ERROR("failed to find status page!\n"); | 810 | DRM_ERROR("failed to find status page!\n"); |
@@ -904,7 +920,7 @@ static int mga_do_cleanup_dma(drm_device_t * dev) | |||
904 | drm_mga_private_t *dev_priv = dev->dev_private; | 920 | drm_mga_private_t *dev_priv = dev->dev_private; |
905 | 921 | ||
906 | if ((dev_priv->warp != NULL) | 922 | if ((dev_priv->warp != NULL) |
907 | && (dev_priv->mmio->type != _DRM_CONSISTENT)) | 923 | && (dev_priv->warp->type != _DRM_CONSISTENT)) |
908 | drm_core_ioremapfree(dev_priv->warp, dev); | 924 | drm_core_ioremapfree(dev_priv->warp, dev); |
909 | 925 | ||
910 | if ((dev_priv->primary != NULL) | 926 | if ((dev_priv->primary != NULL) |
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index e82a96ba396b..f66947722e12 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c | |||
@@ -55,7 +55,7 @@ extern void (*pm_power_off)(void); | |||
55 | static int poweroff_powercycle; | 55 | static int poweroff_powercycle; |
56 | 56 | ||
57 | /* parameter definition to allow user to flag power cycle */ | 57 | /* parameter definition to allow user to flag power cycle */ |
58 | module_param(poweroff_powercycle, int, 0); | 58 | module_param(poweroff_powercycle, int, 0644); |
59 | MODULE_PARM_DESC(poweroff_powercycles, " Set to non-zero to enable power cycle instead of power down. Power cycle is contingent on hardware support, otherwise it defaults back to power down."); | 59 | MODULE_PARM_DESC(poweroff_powercycles, " Set to non-zero to enable power cycle instead of power down. Power cycle is contingent on hardware support, otherwise it defaults back to power down."); |
60 | 60 | ||
61 | /* Stuff from the get device id command. */ | 61 | /* Stuff from the get device id command. */ |
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index 3fa64c631108..c268ee04b2aa 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
@@ -830,6 +830,9 @@ static int __init mbcs_init(void) | |||
830 | { | 830 | { |
831 | int rv; | 831 | int rv; |
832 | 832 | ||
833 | if (!ia64_platform_is("sn2")) | ||
834 | return -ENODEV; | ||
835 | |||
833 | // Put driver into chrdevs[]. Get major number. | 836 | // Put driver into chrdevs[]. Get major number. |
834 | rv = register_chrdev(mbcs_major, DEVICE_NAME, &mbcs_ops); | 837 | rv = register_chrdev(mbcs_major, DEVICE_NAME, &mbcs_ops); |
835 | if (rv < 0) { | 838 | if (rv < 0) { |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 2291a87e8ada..853c98cee64f 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -229,8 +229,8 @@ static int __init r3964_init(void) | |||
229 | TRACE_L("line discipline %d registered", N_R3964); | 229 | TRACE_L("line discipline %d registered", N_R3964); |
230 | TRACE_L("flags=%x num=%x", tty_ldisc_N_R3964.flags, | 230 | TRACE_L("flags=%x num=%x", tty_ldisc_N_R3964.flags, |
231 | tty_ldisc_N_R3964.num); | 231 | tty_ldisc_N_R3964.num); |
232 | TRACE_L("open=%x", (int)tty_ldisc_N_R3964.open); | 232 | TRACE_L("open=%p", tty_ldisc_N_R3964.open); |
233 | TRACE_L("tty_ldisc_N_R3964 = %x", (int)&tty_ldisc_N_R3964); | 233 | TRACE_L("tty_ldisc_N_R3964 = %p", &tty_ldisc_N_R3964); |
234 | } | 234 | } |
235 | else | 235 | else |
236 | { | 236 | { |
@@ -267,8 +267,8 @@ static void add_tx_queue(struct r3964_info *pInfo, struct r3964_block_header *pH | |||
267 | 267 | ||
268 | spin_unlock_irqrestore(&pInfo->lock, flags); | 268 | spin_unlock_irqrestore(&pInfo->lock, flags); |
269 | 269 | ||
270 | TRACE_Q("add_tx_queue %x, length %d, tx_first = %x", | 270 | TRACE_Q("add_tx_queue %p, length %d, tx_first = %p", |
271 | (int)pHeader, pHeader->length, (int)pInfo->tx_first ); | 271 | pHeader, pHeader->length, pInfo->tx_first ); |
272 | } | 272 | } |
273 | 273 | ||
274 | static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code) | 274 | static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code) |
@@ -285,10 +285,10 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code) | |||
285 | return; | 285 | return; |
286 | 286 | ||
287 | #ifdef DEBUG_QUEUE | 287 | #ifdef DEBUG_QUEUE |
288 | printk("r3964: remove_from_tx_queue: %x, length %d - ", | 288 | printk("r3964: remove_from_tx_queue: %p, length %u - ", |
289 | (int)pHeader, (int)pHeader->length ); | 289 | pHeader, pHeader->length ); |
290 | for(pDump=pHeader;pDump;pDump=pDump->next) | 290 | for(pDump=pHeader;pDump;pDump=pDump->next) |
291 | printk("%x ", (int)pDump); | 291 | printk("%p ", pDump); |
292 | printk("\n"); | 292 | printk("\n"); |
293 | #endif | 293 | #endif |
294 | 294 | ||
@@ -319,10 +319,10 @@ static void remove_from_tx_queue(struct r3964_info *pInfo, int error_code) | |||
319 | spin_unlock_irqrestore(&pInfo->lock, flags); | 319 | spin_unlock_irqrestore(&pInfo->lock, flags); |
320 | 320 | ||
321 | kfree(pHeader); | 321 | kfree(pHeader); |
322 | TRACE_M("remove_from_tx_queue - kfree %x",(int)pHeader); | 322 | TRACE_M("remove_from_tx_queue - kfree %p",pHeader); |
323 | 323 | ||
324 | TRACE_Q("remove_from_tx_queue: tx_first = %x, tx_last = %x", | 324 | TRACE_Q("remove_from_tx_queue: tx_first = %p, tx_last = %p", |
325 | (int)pInfo->tx_first, (int)pInfo->tx_last ); | 325 | pInfo->tx_first, pInfo->tx_last ); |
326 | } | 326 | } |
327 | 327 | ||
328 | static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader) | 328 | static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader) |
@@ -346,9 +346,9 @@ static void add_rx_queue(struct r3964_info *pInfo, struct r3964_block_header *pH | |||
346 | 346 | ||
347 | spin_unlock_irqrestore(&pInfo->lock, flags); | 347 | spin_unlock_irqrestore(&pInfo->lock, flags); |
348 | 348 | ||
349 | TRACE_Q("add_rx_queue: %x, length = %d, rx_first = %x, count = %d", | 349 | TRACE_Q("add_rx_queue: %p, length = %d, rx_first = %p, count = %d", |
350 | (int)pHeader, pHeader->length, | 350 | pHeader, pHeader->length, |
351 | (int)pInfo->rx_first, pInfo->blocks_in_rx_queue); | 351 | pInfo->rx_first, pInfo->blocks_in_rx_queue); |
352 | } | 352 | } |
353 | 353 | ||
354 | static void remove_from_rx_queue(struct r3964_info *pInfo, | 354 | static void remove_from_rx_queue(struct r3964_info *pInfo, |
@@ -360,10 +360,10 @@ static void remove_from_rx_queue(struct r3964_info *pInfo, | |||
360 | if(pHeader==NULL) | 360 | if(pHeader==NULL) |
361 | return; | 361 | return; |
362 | 362 | ||
363 | TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d", | 363 | TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d", |
364 | (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue ); | 364 | pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue ); |
365 | TRACE_Q("remove_from_rx_queue: %x, length %d", | 365 | TRACE_Q("remove_from_rx_queue: %p, length %u", |
366 | (int)pHeader, (int)pHeader->length ); | 366 | pHeader, pHeader->length ); |
367 | 367 | ||
368 | spin_lock_irqsave(&pInfo->lock, flags); | 368 | spin_lock_irqsave(&pInfo->lock, flags); |
369 | 369 | ||
@@ -401,10 +401,10 @@ static void remove_from_rx_queue(struct r3964_info *pInfo, | |||
401 | spin_unlock_irqrestore(&pInfo->lock, flags); | 401 | spin_unlock_irqrestore(&pInfo->lock, flags); |
402 | 402 | ||
403 | kfree(pHeader); | 403 | kfree(pHeader); |
404 | TRACE_M("remove_from_rx_queue - kfree %x",(int)pHeader); | 404 | TRACE_M("remove_from_rx_queue - kfree %p",pHeader); |
405 | 405 | ||
406 | TRACE_Q("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d", | 406 | TRACE_Q("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d", |
407 | (int)pInfo->rx_first, (int)pInfo->rx_last, pInfo->blocks_in_rx_queue ); | 407 | pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue ); |
408 | } | 408 | } |
409 | 409 | ||
410 | static void put_char(struct r3964_info *pInfo, unsigned char ch) | 410 | static void put_char(struct r3964_info *pInfo, unsigned char ch) |
@@ -506,8 +506,8 @@ static void transmit_block(struct r3964_info *pInfo) | |||
506 | if(tty->driver->write_room) | 506 | if(tty->driver->write_room) |
507 | room=tty->driver->write_room(tty); | 507 | room=tty->driver->write_room(tty); |
508 | 508 | ||
509 | TRACE_PS("transmit_block %x, room %d, length %d", | 509 | TRACE_PS("transmit_block %p, room %d, length %d", |
510 | (int)pBlock, room, pBlock->length); | 510 | pBlock, room, pBlock->length); |
511 | 511 | ||
512 | while(pInfo->tx_position < pBlock->length) | 512 | while(pInfo->tx_position < pBlock->length) |
513 | { | 513 | { |
@@ -588,7 +588,7 @@ static void on_receive_block(struct r3964_info *pInfo) | |||
588 | 588 | ||
589 | /* prepare struct r3964_block_header: */ | 589 | /* prepare struct r3964_block_header: */ |
590 | pBlock = kmalloc(length+sizeof(struct r3964_block_header), GFP_KERNEL); | 590 | pBlock = kmalloc(length+sizeof(struct r3964_block_header), GFP_KERNEL); |
591 | TRACE_M("on_receive_block - kmalloc %x",(int)pBlock); | 591 | TRACE_M("on_receive_block - kmalloc %p",pBlock); |
592 | 592 | ||
593 | if(pBlock==NULL) | 593 | if(pBlock==NULL) |
594 | return; | 594 | return; |
@@ -695,7 +695,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c) | |||
695 | { | 695 | { |
696 | TRACE_PE("IDLE - got STX but no space in rx_queue!"); | 696 | TRACE_PE("IDLE - got STX but no space in rx_queue!"); |
697 | pInfo->state=R3964_WAIT_FOR_RX_BUF; | 697 | pInfo->state=R3964_WAIT_FOR_RX_BUF; |
698 | mod_timer(&pInfo->tmr, R3964_TO_NO_BUF); | 698 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_NO_BUF); |
699 | break; | 699 | break; |
700 | } | 700 | } |
701 | start_receiving: | 701 | start_receiving: |
@@ -705,7 +705,7 @@ start_receiving: | |||
705 | pInfo->last_rx = 0; | 705 | pInfo->last_rx = 0; |
706 | pInfo->flags &= ~R3964_ERROR; | 706 | pInfo->flags &= ~R3964_ERROR; |
707 | pInfo->state=R3964_RECEIVING; | 707 | pInfo->state=R3964_RECEIVING; |
708 | mod_timer(&pInfo->tmr, R3964_TO_ZVZ); | 708 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); |
709 | pInfo->nRetry = 0; | 709 | pInfo->nRetry = 0; |
710 | put_char(pInfo, DLE); | 710 | put_char(pInfo, DLE); |
711 | flush(pInfo); | 711 | flush(pInfo); |
@@ -732,7 +732,7 @@ start_receiving: | |||
732 | if(pInfo->flags & R3964_BCC) | 732 | if(pInfo->flags & R3964_BCC) |
733 | { | 733 | { |
734 | pInfo->state = R3964_WAIT_FOR_BCC; | 734 | pInfo->state = R3964_WAIT_FOR_BCC; |
735 | mod_timer(&pInfo->tmr, R3964_TO_ZVZ); | 735 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); |
736 | } | 736 | } |
737 | else | 737 | else |
738 | { | 738 | { |
@@ -744,7 +744,7 @@ start_receiving: | |||
744 | pInfo->last_rx = c; | 744 | pInfo->last_rx = c; |
745 | char_to_buf: | 745 | char_to_buf: |
746 | pInfo->rx_buf[pInfo->rx_position++] = c; | 746 | pInfo->rx_buf[pInfo->rx_position++] = c; |
747 | mod_timer(&pInfo->tmr, R3964_TO_ZVZ); | 747 | mod_timer(&pInfo->tmr, jiffies + R3964_TO_ZVZ); |
748 | } | 748 | } |
749 | } | 749 | } |
750 | /* else: overflow-msg? BUF_SIZE>MTU; should not happen? */ | 750 | /* else: overflow-msg? BUF_SIZE>MTU; should not happen? */ |
@@ -868,11 +868,11 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) | |||
868 | if(pMsg) | 868 | if(pMsg) |
869 | { | 869 | { |
870 | kfree(pMsg); | 870 | kfree(pMsg); |
871 | TRACE_M("enable_signals - msg kfree %x",(int)pMsg); | 871 | TRACE_M("enable_signals - msg kfree %p",pMsg); |
872 | } | 872 | } |
873 | } | 873 | } |
874 | kfree(pClient); | 874 | kfree(pClient); |
875 | TRACE_M("enable_signals - kfree %x",(int)pClient); | 875 | TRACE_M("enable_signals - kfree %p",pClient); |
876 | return 0; | 876 | return 0; |
877 | } | 877 | } |
878 | } | 878 | } |
@@ -890,7 +890,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg) | |||
890 | { | 890 | { |
891 | /* add client to client list */ | 891 | /* add client to client list */ |
892 | pClient=kmalloc(sizeof(struct r3964_client_info), GFP_KERNEL); | 892 | pClient=kmalloc(sizeof(struct r3964_client_info), GFP_KERNEL); |
893 | TRACE_M("enable_signals - kmalloc %x",(int)pClient); | 893 | TRACE_M("enable_signals - kmalloc %p",pClient); |
894 | if(pClient==NULL) | 894 | if(pClient==NULL) |
895 | return -ENOMEM; | 895 | return -ENOMEM; |
896 | 896 | ||
@@ -954,7 +954,7 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg, | |||
954 | queue_the_message: | 954 | queue_the_message: |
955 | 955 | ||
956 | pMsg = kmalloc(sizeof(struct r3964_message), GFP_KERNEL); | 956 | pMsg = kmalloc(sizeof(struct r3964_message), GFP_KERNEL); |
957 | TRACE_M("add_msg - kmalloc %x",(int)pMsg); | 957 | TRACE_M("add_msg - kmalloc %p",pMsg); |
958 | if(pMsg==NULL) { | 958 | if(pMsg==NULL) { |
959 | return; | 959 | return; |
960 | } | 960 | } |
@@ -1067,11 +1067,11 @@ static int r3964_open(struct tty_struct *tty) | |||
1067 | struct r3964_info *pInfo; | 1067 | struct r3964_info *pInfo; |
1068 | 1068 | ||
1069 | TRACE_L("open"); | 1069 | TRACE_L("open"); |
1070 | TRACE_L("tty=%x, PID=%d, disc_data=%x", | 1070 | TRACE_L("tty=%p, PID=%d, disc_data=%p", |
1071 | (int)tty, current->pid, (int)tty->disc_data); | 1071 | tty, current->pid, tty->disc_data); |
1072 | 1072 | ||
1073 | pInfo=kmalloc(sizeof(struct r3964_info), GFP_KERNEL); | 1073 | pInfo=kmalloc(sizeof(struct r3964_info), GFP_KERNEL); |
1074 | TRACE_M("r3964_open - info kmalloc %x",(int)pInfo); | 1074 | TRACE_M("r3964_open - info kmalloc %p",pInfo); |
1075 | 1075 | ||
1076 | if(!pInfo) | 1076 | if(!pInfo) |
1077 | { | 1077 | { |
@@ -1080,26 +1080,26 @@ static int r3964_open(struct tty_struct *tty) | |||
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | pInfo->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL); | 1082 | pInfo->rx_buf = kmalloc(RX_BUF_SIZE, GFP_KERNEL); |
1083 | TRACE_M("r3964_open - rx_buf kmalloc %x",(int)pInfo->rx_buf); | 1083 | TRACE_M("r3964_open - rx_buf kmalloc %p",pInfo->rx_buf); |
1084 | 1084 | ||
1085 | if(!pInfo->rx_buf) | 1085 | if(!pInfo->rx_buf) |
1086 | { | 1086 | { |
1087 | printk(KERN_ERR "r3964: failed to alloc receive buffer\n"); | 1087 | printk(KERN_ERR "r3964: failed to alloc receive buffer\n"); |
1088 | kfree(pInfo); | 1088 | kfree(pInfo); |
1089 | TRACE_M("r3964_open - info kfree %x",(int)pInfo); | 1089 | TRACE_M("r3964_open - info kfree %p",pInfo); |
1090 | return -ENOMEM; | 1090 | return -ENOMEM; |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | pInfo->tx_buf = kmalloc(TX_BUF_SIZE, GFP_KERNEL); | 1093 | pInfo->tx_buf = kmalloc(TX_BUF_SIZE, GFP_KERNEL); |
1094 | TRACE_M("r3964_open - tx_buf kmalloc %x",(int)pInfo->tx_buf); | 1094 | TRACE_M("r3964_open - tx_buf kmalloc %p",pInfo->tx_buf); |
1095 | 1095 | ||
1096 | if(!pInfo->tx_buf) | 1096 | if(!pInfo->tx_buf) |
1097 | { | 1097 | { |
1098 | printk(KERN_ERR "r3964: failed to alloc transmit buffer\n"); | 1098 | printk(KERN_ERR "r3964: failed to alloc transmit buffer\n"); |
1099 | kfree(pInfo->rx_buf); | 1099 | kfree(pInfo->rx_buf); |
1100 | TRACE_M("r3964_open - rx_buf kfree %x",(int)pInfo->rx_buf); | 1100 | TRACE_M("r3964_open - rx_buf kfree %p",pInfo->rx_buf); |
1101 | kfree(pInfo); | 1101 | kfree(pInfo); |
1102 | TRACE_M("r3964_open - info kfree %x",(int)pInfo); | 1102 | TRACE_M("r3964_open - info kfree %p",pInfo); |
1103 | return -ENOMEM; | 1103 | return -ENOMEM; |
1104 | } | 1104 | } |
1105 | 1105 | ||
@@ -1154,11 +1154,11 @@ static void r3964_close(struct tty_struct *tty) | |||
1154 | if(pMsg) | 1154 | if(pMsg) |
1155 | { | 1155 | { |
1156 | kfree(pMsg); | 1156 | kfree(pMsg); |
1157 | TRACE_M("r3964_close - msg kfree %x",(int)pMsg); | 1157 | TRACE_M("r3964_close - msg kfree %p",pMsg); |
1158 | } | 1158 | } |
1159 | } | 1159 | } |
1160 | kfree(pClient); | 1160 | kfree(pClient); |
1161 | TRACE_M("r3964_close - client kfree %x",(int)pClient); | 1161 | TRACE_M("r3964_close - client kfree %p",pClient); |
1162 | pClient=pNext; | 1162 | pClient=pNext; |
1163 | } | 1163 | } |
1164 | /* Remove jobs from tx_queue: */ | 1164 | /* Remove jobs from tx_queue: */ |
@@ -1177,11 +1177,11 @@ static void r3964_close(struct tty_struct *tty) | |||
1177 | /* Free buffers: */ | 1177 | /* Free buffers: */ |
1178 | wake_up_interruptible(&pInfo->read_wait); | 1178 | wake_up_interruptible(&pInfo->read_wait); |
1179 | kfree(pInfo->rx_buf); | 1179 | kfree(pInfo->rx_buf); |
1180 | TRACE_M("r3964_close - rx_buf kfree %x",(int)pInfo->rx_buf); | 1180 | TRACE_M("r3964_close - rx_buf kfree %p",pInfo->rx_buf); |
1181 | kfree(pInfo->tx_buf); | 1181 | kfree(pInfo->tx_buf); |
1182 | TRACE_M("r3964_close - tx_buf kfree %x",(int)pInfo->tx_buf); | 1182 | TRACE_M("r3964_close - tx_buf kfree %p",pInfo->tx_buf); |
1183 | kfree(pInfo); | 1183 | kfree(pInfo); |
1184 | TRACE_M("r3964_close - info kfree %x",(int)pInfo); | 1184 | TRACE_M("r3964_close - info kfree %p",pInfo); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | static ssize_t r3964_read(struct tty_struct *tty, struct file *file, | 1187 | static ssize_t r3964_read(struct tty_struct *tty, struct file *file, |
@@ -1234,7 +1234,7 @@ repeat: | |||
1234 | count = sizeof(struct r3964_client_message); | 1234 | count = sizeof(struct r3964_client_message); |
1235 | 1235 | ||
1236 | kfree(pMsg); | 1236 | kfree(pMsg); |
1237 | TRACE_M("r3964_read - msg kfree %x",(int)pMsg); | 1237 | TRACE_M("r3964_read - msg kfree %p",pMsg); |
1238 | 1238 | ||
1239 | if (copy_to_user(buf,&theMsg, count)) | 1239 | if (copy_to_user(buf,&theMsg, count)) |
1240 | return -EFAULT; | 1240 | return -EFAULT; |
@@ -1279,7 +1279,7 @@ static ssize_t r3964_write(struct tty_struct * tty, struct file * file, | |||
1279 | * Allocate a buffer for the data and copy it from the buffer with header prepended | 1279 | * Allocate a buffer for the data and copy it from the buffer with header prepended |
1280 | */ | 1280 | */ |
1281 | new_data = kmalloc (count+sizeof(struct r3964_block_header), GFP_KERNEL); | 1281 | new_data = kmalloc (count+sizeof(struct r3964_block_header), GFP_KERNEL); |
1282 | TRACE_M("r3964_write - kmalloc %x",(int)new_data); | 1282 | TRACE_M("r3964_write - kmalloc %p",new_data); |
1283 | if (new_data == NULL) { | 1283 | if (new_data == NULL) { |
1284 | if (pInfo->flags & R3964_DEBUG) | 1284 | if (pInfo->flags & R3964_DEBUG) |
1285 | { | 1285 | { |
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c index ed867db550a9..e1a90d9a8756 100644 --- a/drivers/char/s3c2410-rtc.c +++ b/drivers/char/s3c2410-rtc.c | |||
@@ -564,6 +564,7 @@ static int s3c2410_rtc_resume(struct device *dev, u32 level) | |||
564 | 564 | ||
565 | static struct device_driver s3c2410_rtcdrv = { | 565 | static struct device_driver s3c2410_rtcdrv = { |
566 | .name = "s3c2410-rtc", | 566 | .name = "s3c2410-rtc", |
567 | .owner = THIS_MODULE, | ||
567 | .bus = &platform_bus_type, | 568 | .bus = &platform_bus_type, |
568 | .probe = s3c2410_rtc_probe, | 569 | .probe = s3c2410_rtc_probe, |
569 | .remove = s3c2410_rtc_remove, | 570 | .remove = s3c2410_rtc_remove, |
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index 1436aea3b28f..6d3ff0836c44 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c | |||
@@ -87,6 +87,8 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file) | |||
87 | mv64x60_wdt_service(); | 87 | mv64x60_wdt_service(); |
88 | mv64x60_wdt_handler_enable(); | 88 | mv64x60_wdt_handler_enable(); |
89 | 89 | ||
90 | nonseekable_open(inode, file); | ||
91 | |||
90 | return 0; | 92 | return 0; |
91 | } | 93 | } |
92 | 94 | ||
@@ -103,12 +105,9 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file) | |||
103 | return 0; | 105 | return 0; |
104 | } | 106 | } |
105 | 107 | ||
106 | static ssize_t mv64x60_wdt_write(struct file *file, const char *data, | 108 | static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data, |
107 | size_t len, loff_t * ppos) | 109 | size_t len, loff_t * ppos) |
108 | { | 110 | { |
109 | if (*ppos != file->f_pos) | ||
110 | return -ESPIPE; | ||
111 | |||
112 | if (len) | 111 | if (len) |
113 | mv64x60_wdt_service(); | 112 | mv64x60_wdt_service(); |
114 | 113 | ||
@@ -119,6 +118,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
119 | unsigned int cmd, unsigned long arg) | 118 | unsigned int cmd, unsigned long arg) |
120 | { | 119 | { |
121 | int timeout; | 120 | int timeout; |
121 | void __user *argp = (void __user *)arg; | ||
122 | static struct watchdog_info info = { | 122 | static struct watchdog_info info = { |
123 | .options = WDIOF_KEEPALIVEPING, | 123 | .options = WDIOF_KEEPALIVEPING, |
124 | .firmware_version = 0, | 124 | .firmware_version = 0, |
@@ -127,13 +127,13 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
127 | 127 | ||
128 | switch (cmd) { | 128 | switch (cmd) { |
129 | case WDIOC_GETSUPPORT: | 129 | case WDIOC_GETSUPPORT: |
130 | if (copy_to_user((void *)arg, &info, sizeof(info))) | 130 | if (copy_to_user(argp, &info, sizeof(info))) |
131 | return -EFAULT; | 131 | return -EFAULT; |
132 | break; | 132 | break; |
133 | 133 | ||
134 | case WDIOC_GETSTATUS: | 134 | case WDIOC_GETSTATUS: |
135 | case WDIOC_GETBOOTSTATUS: | 135 | case WDIOC_GETBOOTSTATUS: |
136 | if (put_user(wdt_status, (int *)arg)) | 136 | if (put_user(wdt_status, (int __user *)argp)) |
137 | return -EFAULT; | 137 | return -EFAULT; |
138 | wdt_status &= ~WDIOF_KEEPALIVEPING; | 138 | wdt_status &= ~WDIOF_KEEPALIVEPING; |
139 | break; | 139 | break; |
@@ -154,7 +154,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
154 | 154 | ||
155 | case WDIOC_GETTIMEOUT: | 155 | case WDIOC_GETTIMEOUT: |
156 | timeout = mv64x60_wdt_timeout * HZ; | 156 | timeout = mv64x60_wdt_timeout * HZ; |
157 | if (put_user(timeout, (int *)arg)) | 157 | if (put_user(timeout, (int __user *)argp)) |
158 | return -EFAULT; | 158 | return -EFAULT; |
159 | break; | 159 | break; |
160 | 160 | ||
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 5a80adbf8032..0b8e493be045 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c | |||
@@ -50,8 +50,8 @@ | |||
50 | #include <asm/io.h> /* For inb/outb/... */ | 50 | #include <asm/io.h> /* For inb/outb/... */ |
51 | 51 | ||
52 | /* Module and version information */ | 52 | /* Module and version information */ |
53 | #define WATCHDOG_VERSION "1.01" | 53 | #define WATCHDOG_VERSION "1.02" |
54 | #define WATCHDOG_DATE "02 Sep 2005" | 54 | #define WATCHDOG_DATE "03 Sep 2005" |
55 | #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" | 55 | #define WATCHDOG_DRIVER_NAME "PCI-PC Watchdog" |
56 | #define WATCHDOG_NAME "pcwd_pci" | 56 | #define WATCHDOG_NAME "pcwd_pci" |
57 | #define PFX WATCHDOG_NAME ": " | 57 | #define PFX WATCHDOG_NAME ": " |
@@ -70,19 +70,30 @@ | |||
70 | * These are the defines that describe the control status bits for the | 70 | * These are the defines that describe the control status bits for the |
71 | * PCI-PC Watchdog card. | 71 | * PCI-PC Watchdog card. |
72 | */ | 72 | */ |
73 | #define WD_PCI_WTRP 0x01 /* Watchdog Trip status */ | 73 | /* Port 1 : Control Status #1 */ |
74 | #define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */ | 74 | #define WD_PCI_WTRP 0x01 /* Watchdog Trip status */ |
75 | #define WD_PCI_TTRP 0x04 /* Temperature Trip status */ | 75 | #define WD_PCI_HRBT 0x02 /* Watchdog Heartbeat */ |
76 | #define WD_PCI_TTRP 0x04 /* Temperature Trip status */ | ||
77 | #define WD_PCI_RL2A 0x08 /* Relay 2 Active */ | ||
78 | #define WD_PCI_RL1A 0x10 /* Relay 1 Active */ | ||
79 | #define WD_PCI_R2DS 0x40 /* Relay 2 Disable Temperature-trip/reset */ | ||
80 | #define WD_PCI_RLY2 0x80 /* Activate Relay 2 on the board */ | ||
81 | /* Port 2 : Control Status #2 */ | ||
82 | #define WD_PCI_WDIS 0x10 /* Watchdog Disable */ | ||
83 | #define WD_PCI_ENTP 0x20 /* Enable Temperature Trip Reset */ | ||
84 | #define WD_PCI_WRSP 0x40 /* Watchdog wrote response */ | ||
85 | #define WD_PCI_PCMD 0x80 /* PC has sent command */ | ||
76 | 86 | ||
77 | /* according to documentation max. time to process a command for the pci | 87 | /* according to documentation max. time to process a command for the pci |
78 | * watchdog card is 100 ms, so we give it 150 ms to do it's job */ | 88 | * watchdog card is 100 ms, so we give it 150 ms to do it's job */ |
79 | #define PCI_COMMAND_TIMEOUT 150 | 89 | #define PCI_COMMAND_TIMEOUT 150 |
80 | 90 | ||
81 | /* Watchdog's internal commands */ | 91 | /* Watchdog's internal commands */ |
82 | #define CMD_GET_STATUS 0x04 | 92 | #define CMD_GET_STATUS 0x04 |
83 | #define CMD_GET_FIRMWARE_VERSION 0x08 | 93 | #define CMD_GET_FIRMWARE_VERSION 0x08 |
84 | #define CMD_READ_WATCHDOG_TIMEOUT 0x18 | 94 | #define CMD_READ_WATCHDOG_TIMEOUT 0x18 |
85 | #define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 | 95 | #define CMD_WRITE_WATCHDOG_TIMEOUT 0x19 |
96 | #define CMD_GET_CLEAR_RESET_COUNT 0x84 | ||
86 | 97 | ||
87 | /* We can only use 1 card due to the /dev/watchdog restriction */ | 98 | /* We can only use 1 card due to the /dev/watchdog restriction */ |
88 | static int cards_found; | 99 | static int cards_found; |
@@ -91,15 +102,22 @@ static int cards_found; | |||
91 | static int temp_panic; | 102 | static int temp_panic; |
92 | static unsigned long is_active; | 103 | static unsigned long is_active; |
93 | static char expect_release; | 104 | static char expect_release; |
94 | static struct { | 105 | static struct { /* this is private data for each PCI-PC watchdog card */ |
95 | int supports_temp; /* Wether or not the card has a temperature device */ | 106 | int supports_temp; /* Wether or not the card has a temperature device */ |
96 | int boot_status; /* The card's boot status */ | 107 | int boot_status; /* The card's boot status */ |
97 | unsigned long io_addr; /* The cards I/O address */ | 108 | unsigned long io_addr; /* The cards I/O address */ |
98 | spinlock_t io_lock; | 109 | spinlock_t io_lock; /* the lock for io operations */ |
99 | struct pci_dev *pdev; | 110 | struct pci_dev *pdev; /* the PCI-device */ |
100 | } pcipcwd_private; | 111 | } pcipcwd_private; |
101 | 112 | ||
102 | /* module parameters */ | 113 | /* module parameters */ |
114 | #define QUIET 0 /* Default */ | ||
115 | #define VERBOSE 1 /* Verbose */ | ||
116 | #define DEBUG 2 /* print fancy stuff too */ | ||
117 | static int debug = QUIET; | ||
118 | module_param(debug, int, 0); | ||
119 | MODULE_PARM_DESC(debug, "Debug level: 0=Quiet, 1=Verbose, 2=Debug (default=0)"); | ||
120 | |||
103 | #define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */ | 121 | #define WATCHDOG_HEARTBEAT 2 /* 2 sec default heartbeat */ |
104 | static int heartbeat = WATCHDOG_HEARTBEAT; | 122 | static int heartbeat = WATCHDOG_HEARTBEAT; |
105 | module_param(heartbeat, int, 0); | 123 | module_param(heartbeat, int, 0); |
@@ -117,6 +135,10 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
117 | { | 135 | { |
118 | int got_response, count; | 136 | int got_response, count; |
119 | 137 | ||
138 | if (debug >= DEBUG) | ||
139 | printk(KERN_DEBUG PFX "sending following data cmd=0x%02x msb=0x%02x lsb=0x%02x\n", | ||
140 | cmd, *msb, *lsb); | ||
141 | |||
120 | spin_lock(&pcipcwd_private.io_lock); | 142 | spin_lock(&pcipcwd_private.io_lock); |
121 | /* If a command requires data it should be written first. | 143 | /* If a command requires data it should be written first. |
122 | * Data for commands with 8 bits of data should be written to port 4. | 144 | * Data for commands with 8 bits of data should be written to port 4. |
@@ -131,10 +153,19 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
131 | /* wait till the pci card processed the command, signaled by | 153 | /* wait till the pci card processed the command, signaled by |
132 | * the WRSP bit in port 2 and give it a max. timeout of | 154 | * the WRSP bit in port 2 and give it a max. timeout of |
133 | * PCI_COMMAND_TIMEOUT to process */ | 155 | * PCI_COMMAND_TIMEOUT to process */ |
134 | got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; | 156 | got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP; |
135 | for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) { | 157 | for (count = 0; (count < PCI_COMMAND_TIMEOUT) && (!got_response); count++) { |
136 | mdelay(1); | 158 | mdelay(1); |
137 | got_response = inb_p(pcipcwd_private.io_addr + 2) & 0x40; | 159 | got_response = inb_p(pcipcwd_private.io_addr + 2) & WD_PCI_WRSP; |
160 | } | ||
161 | |||
162 | if (debug >= DEBUG) { | ||
163 | if (got_response) { | ||
164 | printk(KERN_DEBUG PFX "time to process command was: %d ms\n", | ||
165 | count); | ||
166 | } else { | ||
167 | printk(KERN_DEBUG PFX "card did not respond on command!\n"); | ||
168 | } | ||
138 | } | 169 | } |
139 | 170 | ||
140 | if (got_response) { | 171 | if (got_response) { |
@@ -144,12 +175,66 @@ static int send_command(int cmd, int *msb, int *lsb) | |||
144 | 175 | ||
145 | /* clear WRSP bit */ | 176 | /* clear WRSP bit */ |
146 | inb_p(pcipcwd_private.io_addr + 6); | 177 | inb_p(pcipcwd_private.io_addr + 6); |
178 | |||
179 | if (debug >= DEBUG) | ||
180 | printk(KERN_DEBUG PFX "received following data for cmd=0x%02x: msb=0x%02x lsb=0x%02x\n", | ||
181 | cmd, *msb, *lsb); | ||
147 | } | 182 | } |
183 | |||
148 | spin_unlock(&pcipcwd_private.io_lock); | 184 | spin_unlock(&pcipcwd_private.io_lock); |
149 | 185 | ||
150 | return got_response; | 186 | return got_response; |
151 | } | 187 | } |
152 | 188 | ||
189 | static inline void pcipcwd_check_temperature_support(void) | ||
190 | { | ||
191 | if (inb_p(pcipcwd_private.io_addr) != 0xF0) | ||
192 | pcipcwd_private.supports_temp = 1; | ||
193 | } | ||
194 | |||
195 | static int pcipcwd_get_option_switches(void) | ||
196 | { | ||
197 | int option_switches; | ||
198 | |||
199 | option_switches = inb_p(pcipcwd_private.io_addr + 3); | ||
200 | return option_switches; | ||
201 | } | ||
202 | |||
203 | static void pcipcwd_show_card_info(void) | ||
204 | { | ||
205 | int got_fw_rev, fw_rev_major, fw_rev_minor; | ||
206 | char fw_ver_str[20]; /* The cards firmware version */ | ||
207 | int option_switches; | ||
208 | |||
209 | got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); | ||
210 | if (got_fw_rev) { | ||
211 | sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); | ||
212 | } else { | ||
213 | sprintf(fw_ver_str, "<card no answer>"); | ||
214 | } | ||
215 | |||
216 | /* Get switch settings */ | ||
217 | option_switches = pcipcwd_get_option_switches(); | ||
218 | |||
219 | printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n", | ||
220 | (int) pcipcwd_private.io_addr, fw_ver_str, | ||
221 | (pcipcwd_private.supports_temp ? "with" : "without")); | ||
222 | |||
223 | printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
224 | option_switches, | ||
225 | ((option_switches & 0x10) ? "ON" : "OFF"), | ||
226 | ((option_switches & 0x08) ? "ON" : "OFF")); | ||
227 | |||
228 | if (pcipcwd_private.boot_status & WDIOF_CARDRESET) | ||
229 | printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n"); | ||
230 | |||
231 | if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) | ||
232 | printk(KERN_INFO PFX "Card sensed a CPU Overheat\n"); | ||
233 | |||
234 | if (pcipcwd_private.boot_status == 0) | ||
235 | printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); | ||
236 | } | ||
237 | |||
153 | static int pcipcwd_start(void) | 238 | static int pcipcwd_start(void) |
154 | { | 239 | { |
155 | int stat_reg; | 240 | int stat_reg; |
@@ -161,11 +246,14 @@ static int pcipcwd_start(void) | |||
161 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); | 246 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); |
162 | spin_unlock(&pcipcwd_private.io_lock); | 247 | spin_unlock(&pcipcwd_private.io_lock); |
163 | 248 | ||
164 | if (stat_reg & 0x10) { | 249 | if (stat_reg & WD_PCI_WDIS) { |
165 | printk(KERN_ERR PFX "Card timer not enabled\n"); | 250 | printk(KERN_ERR PFX "Card timer not enabled\n"); |
166 | return -1; | 251 | return -1; |
167 | } | 252 | } |
168 | 253 | ||
254 | if (debug >= VERBOSE) | ||
255 | printk(KERN_DEBUG PFX "Watchdog started\n"); | ||
256 | |||
169 | return 0; | 257 | return 0; |
170 | } | 258 | } |
171 | 259 | ||
@@ -183,18 +271,25 @@ static int pcipcwd_stop(void) | |||
183 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); | 271 | stat_reg = inb_p(pcipcwd_private.io_addr + 2); |
184 | spin_unlock(&pcipcwd_private.io_lock); | 272 | spin_unlock(&pcipcwd_private.io_lock); |
185 | 273 | ||
186 | if (!(stat_reg & 0x10)) { | 274 | if (!(stat_reg & WD_PCI_WDIS)) { |
187 | printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n"); | 275 | printk(KERN_ERR PFX "Card did not acknowledge disable attempt\n"); |
188 | return -1; | 276 | return -1; |
189 | } | 277 | } |
190 | 278 | ||
279 | if (debug >= VERBOSE) | ||
280 | printk(KERN_DEBUG PFX "Watchdog stopped\n"); | ||
281 | |||
191 | return 0; | 282 | return 0; |
192 | } | 283 | } |
193 | 284 | ||
194 | static int pcipcwd_keepalive(void) | 285 | static int pcipcwd_keepalive(void) |
195 | { | 286 | { |
196 | /* Re-trigger watchdog by writing to port 0 */ | 287 | /* Re-trigger watchdog by writing to port 0 */ |
197 | outb_p(0x42, pcipcwd_private.io_addr); | 288 | outb_p(0x42, pcipcwd_private.io_addr); /* send out any data */ |
289 | |||
290 | if (debug >= DEBUG) | ||
291 | printk(KERN_DEBUG PFX "Watchdog keepalive signal send\n"); | ||
292 | |||
198 | return 0; | 293 | return 0; |
199 | } | 294 | } |
200 | 295 | ||
@@ -210,29 +305,64 @@ static int pcipcwd_set_heartbeat(int t) | |||
210 | send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb); | 305 | send_command(CMD_WRITE_WATCHDOG_TIMEOUT, &t_msb, &t_lsb); |
211 | 306 | ||
212 | heartbeat = t; | 307 | heartbeat = t; |
308 | if (debug >= VERBOSE) | ||
309 | printk(KERN_DEBUG PFX "New heartbeat: %d\n", | ||
310 | heartbeat); | ||
311 | |||
213 | return 0; | 312 | return 0; |
214 | } | 313 | } |
215 | 314 | ||
216 | static int pcipcwd_get_status(int *status) | 315 | static int pcipcwd_get_status(int *status) |
217 | { | 316 | { |
218 | int new_status; | 317 | int control_status; |
219 | 318 | ||
220 | *status=0; | 319 | *status=0; |
221 | new_status = inb_p(pcipcwd_private.io_addr + 1); | 320 | control_status = inb_p(pcipcwd_private.io_addr + 1); |
222 | if (new_status & WD_PCI_WTRP) | 321 | if (control_status & WD_PCI_WTRP) |
223 | *status |= WDIOF_CARDRESET; | 322 | *status |= WDIOF_CARDRESET; |
224 | if (new_status & WD_PCI_TTRP) { | 323 | if (control_status & WD_PCI_TTRP) { |
225 | *status |= WDIOF_OVERHEAT; | 324 | *status |= WDIOF_OVERHEAT; |
226 | if (temp_panic) | 325 | if (temp_panic) |
227 | panic(PFX "Temperature overheat trip!\n"); | 326 | panic(PFX "Temperature overheat trip!\n"); |
228 | } | 327 | } |
229 | 328 | ||
329 | if (debug >= DEBUG) | ||
330 | printk(KERN_DEBUG PFX "Control Status #1: 0x%02x\n", | ||
331 | control_status); | ||
332 | |||
230 | return 0; | 333 | return 0; |
231 | } | 334 | } |
232 | 335 | ||
233 | static int pcipcwd_clear_status(void) | 336 | static int pcipcwd_clear_status(void) |
234 | { | 337 | { |
235 | outb_p(0x01, pcipcwd_private.io_addr + 1); | 338 | int control_status; |
339 | int msb; | ||
340 | int reset_counter; | ||
341 | |||
342 | if (debug >= VERBOSE) | ||
343 | printk(KERN_INFO PFX "clearing watchdog trip status & LED\n"); | ||
344 | |||
345 | control_status = inb_p(pcipcwd_private.io_addr + 1); | ||
346 | |||
347 | if (debug >= DEBUG) { | ||
348 | printk(KERN_DEBUG PFX "status was: 0x%02x\n", control_status); | ||
349 | printk(KERN_DEBUG PFX "sending: 0x%02x\n", | ||
350 | (control_status & WD_PCI_R2DS) | WD_PCI_WTRP); | ||
351 | } | ||
352 | |||
353 | /* clear trip status & LED and keep mode of relay 2 */ | ||
354 | outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1); | ||
355 | |||
356 | /* clear reset counter */ | ||
357 | msb=0; | ||
358 | reset_counter=0xff; | ||
359 | send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter); | ||
360 | |||
361 | if (debug >= DEBUG) { | ||
362 | printk(KERN_DEBUG PFX "reset count was: 0x%02x\n", | ||
363 | reset_counter); | ||
364 | } | ||
365 | |||
236 | return 0; | 366 | return 0; |
237 | } | 367 | } |
238 | 368 | ||
@@ -242,11 +372,18 @@ static int pcipcwd_get_temperature(int *temperature) | |||
242 | if (!pcipcwd_private.supports_temp) | 372 | if (!pcipcwd_private.supports_temp) |
243 | return -ENODEV; | 373 | return -ENODEV; |
244 | 374 | ||
375 | *temperature = inb_p(pcipcwd_private.io_addr); | ||
376 | |||
245 | /* | 377 | /* |
246 | * Convert celsius to fahrenheit, since this was | 378 | * Convert celsius to fahrenheit, since this was |
247 | * the decided 'standard' for this return value. | 379 | * the decided 'standard' for this return value. |
248 | */ | 380 | */ |
249 | *temperature = ((inb_p(pcipcwd_private.io_addr)) * 9 / 5) + 32; | 381 | *temperature = (*temperature * 9 / 5) + 32; |
382 | |||
383 | if (debug >= DEBUG) { | ||
384 | printk(KERN_DEBUG PFX "temperature is: %d F\n", | ||
385 | *temperature); | ||
386 | } | ||
250 | 387 | ||
251 | return 0; | 388 | return 0; |
252 | } | 389 | } |
@@ -256,7 +393,7 @@ static int pcipcwd_get_temperature(int *temperature) | |||
256 | */ | 393 | */ |
257 | 394 | ||
258 | static ssize_t pcipcwd_write(struct file *file, const char __user *data, | 395 | static ssize_t pcipcwd_write(struct file *file, const char __user *data, |
259 | size_t len, loff_t *ppos) | 396 | size_t len, loff_t *ppos) |
260 | { | 397 | { |
261 | /* See if we got the magic character 'V' and reload the timer */ | 398 | /* See if we got the magic character 'V' and reload the timer */ |
262 | if (len) { | 399 | if (len) { |
@@ -381,8 +518,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, | |||
381 | static int pcipcwd_open(struct inode *inode, struct file *file) | 518 | static int pcipcwd_open(struct inode *inode, struct file *file) |
382 | { | 519 | { |
383 | /* /dev/watchdog can only be opened once */ | 520 | /* /dev/watchdog can only be opened once */ |
384 | if (test_and_set_bit(0, &is_active)) | 521 | if (test_and_set_bit(0, &is_active)) { |
522 | if (debug >= VERBOSE) | ||
523 | printk(KERN_ERR PFX "Attempt to open already opened device.\n"); | ||
385 | return -EBUSY; | 524 | return -EBUSY; |
525 | } | ||
386 | 526 | ||
387 | /* Activate */ | 527 | /* Activate */ |
388 | pcipcwd_start(); | 528 | pcipcwd_start(); |
@@ -492,19 +632,10 @@ static struct notifier_block pcipcwd_notifier = { | |||
492 | * Init & exit routines | 632 | * Init & exit routines |
493 | */ | 633 | */ |
494 | 634 | ||
495 | static inline void check_temperature_support(void) | ||
496 | { | ||
497 | if (inb_p(pcipcwd_private.io_addr) != 0xF0) | ||
498 | pcipcwd_private.supports_temp = 1; | ||
499 | } | ||
500 | |||
501 | static int __devinit pcipcwd_card_init(struct pci_dev *pdev, | 635 | static int __devinit pcipcwd_card_init(struct pci_dev *pdev, |
502 | const struct pci_device_id *ent) | 636 | const struct pci_device_id *ent) |
503 | { | 637 | { |
504 | int ret = -EIO; | 638 | int ret = -EIO; |
505 | int got_fw_rev, fw_rev_major, fw_rev_minor; | ||
506 | char fw_ver_str[20]; | ||
507 | char option_switches; | ||
508 | 639 | ||
509 | cards_found++; | 640 | cards_found++; |
510 | if (cards_found == 1) | 641 | if (cards_found == 1) |
@@ -546,36 +677,10 @@ static int __devinit pcipcwd_card_init(struct pci_dev *pdev, | |||
546 | pcipcwd_stop(); | 677 | pcipcwd_stop(); |
547 | 678 | ||
548 | /* Check whether or not the card supports the temperature device */ | 679 | /* Check whether or not the card supports the temperature device */ |
549 | check_temperature_support(); | 680 | pcipcwd_check_temperature_support(); |
550 | |||
551 | /* Get the Firmware Version */ | ||
552 | got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); | ||
553 | if (got_fw_rev) { | ||
554 | sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); | ||
555 | } else { | ||
556 | sprintf(fw_ver_str, "<card no answer>"); | ||
557 | } | ||
558 | 681 | ||
559 | /* Get switch settings */ | 682 | /* Show info about the card itself */ |
560 | option_switches = inb_p(pcipcwd_private.io_addr + 3); | 683 | pcipcwd_show_card_info(); |
561 | |||
562 | printk(KERN_INFO PFX "Found card at port 0x%04x (Firmware: %s) %s temp option\n", | ||
563 | (int) pcipcwd_private.io_addr, fw_ver_str, | ||
564 | (pcipcwd_private.supports_temp ? "with" : "without")); | ||
565 | |||
566 | printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
567 | option_switches, | ||
568 | ((option_switches & 0x10) ? "ON" : "OFF"), | ||
569 | ((option_switches & 0x08) ? "ON" : "OFF")); | ||
570 | |||
571 | if (pcipcwd_private.boot_status & WDIOF_CARDRESET) | ||
572 | printk(KERN_INFO PFX "Previous reset was caused by the Watchdog card\n"); | ||
573 | |||
574 | if (pcipcwd_private.boot_status & WDIOF_OVERHEAT) | ||
575 | printk(KERN_INFO PFX "Card sensed a CPU Overheat\n"); | ||
576 | |||
577 | if (pcipcwd_private.boot_status == 0) | ||
578 | printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); | ||
579 | 684 | ||
580 | /* Check that the heartbeat value is within it's range ; if not reset to the default */ | 685 | /* Check that the heartbeat value is within it's range ; if not reset to the default */ |
581 | if (pcipcwd_set_heartbeat(heartbeat)) { | 686 | if (pcipcwd_set_heartbeat(heartbeat)) { |
@@ -656,7 +761,7 @@ static struct pci_driver pcipcwd_driver = { | |||
656 | 761 | ||
657 | static int __init pcipcwd_init_module(void) | 762 | static int __init pcipcwd_init_module(void) |
658 | { | 763 | { |
659 | spin_lock_init (&pcipcwd_private.io_lock); | 764 | spin_lock_init(&pcipcwd_private.io_lock); |
660 | 765 | ||
661 | return pci_register_driver(&pcipcwd_driver); | 766 | return pci_register_driver(&pcipcwd_driver); |
662 | } | 767 | } |