diff options
Diffstat (limited to 'drivers/char')
52 files changed, 3059 insertions, 251 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 0e6f35fcc2eb..ad8b537ad47b 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -409,14 +409,6 @@ config SGI_MBCS | |||
409 | If you have an SGI Altix with an attached SABrick | 409 | If you have an SGI Altix with an attached SABrick |
410 | say Y or M here, otherwise say N. | 410 | say Y or M here, otherwise say N. |
411 | 411 | ||
412 | config MSPEC | ||
413 | tristate "Memory special operations driver" | ||
414 | depends on IA64 | ||
415 | help | ||
416 | If you have an ia64 and you want to enable memory special | ||
417 | operations support (formerly known as fetchop), say Y here, | ||
418 | otherwise say N. | ||
419 | |||
420 | source "drivers/serial/Kconfig" | 412 | source "drivers/serial/Kconfig" |
421 | 413 | ||
422 | config UNIX98_PTYS | 414 | config UNIX98_PTYS |
@@ -1002,7 +994,7 @@ config HPET | |||
1002 | help | 994 | help |
1003 | If you say Y here, you will have a miscdevice named "/dev/hpet/". Each | 995 | If you say Y here, you will have a miscdevice named "/dev/hpet/". Each |
1004 | open selects one of the timers supported by the HPET. The timers are | 996 | open selects one of the timers supported by the HPET. The timers are |
1005 | non-periodioc and/or periodic. | 997 | non-periodic and/or periodic. |
1006 | 998 | ||
1007 | config HPET_RTC_IRQ | 999 | config HPET_RTC_IRQ |
1008 | bool "HPET Control RTC IRQ" if !HPET_EMULATE_RTC | 1000 | bool "HPET Control RTC IRQ" if !HPET_EMULATE_RTC |
@@ -1046,7 +1038,7 @@ source "drivers/char/tpm/Kconfig" | |||
1046 | 1038 | ||
1047 | config TELCLOCK | 1039 | config TELCLOCK |
1048 | tristate "Telecom clock driver for MPBL0010 ATCA SBC" | 1040 | tristate "Telecom clock driver for MPBL0010 ATCA SBC" |
1049 | depends on EXPERIMENTAL | 1041 | depends on EXPERIMENTAL && X86 |
1050 | default n | 1042 | default n |
1051 | help | 1043 | help |
1052 | The telecom clock device is specific to the MPBL0010 ATCA computer and | 1044 | The telecom clock device is specific to the MPBL0010 ATCA computer and |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index c39200161688..5ff457b41efb 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -1054,7 +1054,7 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge) | |||
1054 | { | 1054 | { |
1055 | struct page * page; | 1055 | struct page * page; |
1056 | 1056 | ||
1057 | page = alloc_page(GFP_KERNEL); | 1057 | page = alloc_page(GFP_KERNEL | GFP_DMA32); |
1058 | if (page == NULL) | 1058 | if (page == NULL) |
1059 | return NULL; | 1059 | return NULL; |
1060 | 1060 | ||
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index d1ede7db5a12..555b3a8ab49c 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -169,7 +169,7 @@ static void *i8xx_alloc_pages(void) | |||
169 | { | 169 | { |
170 | struct page * page; | 170 | struct page * page; |
171 | 171 | ||
172 | page = alloc_pages(GFP_KERNEL, 2); | 172 | page = alloc_pages(GFP_KERNEL | GFP_DMA32, 2); |
173 | if (page == NULL) | 173 | if (page == NULL) |
174 | return NULL; | 174 | return NULL; |
175 | 175 | ||
@@ -387,11 +387,7 @@ static void intel_i830_init_gtt_entries(void) | |||
387 | /* We obtain the size of the GTT, which is also stored (for some | 387 | /* We obtain the size of the GTT, which is also stored (for some |
388 | * reason) at the top of stolen memory. Then we add 4KB to that | 388 | * reason) at the top of stolen memory. Then we add 4KB to that |
389 | * for the video BIOS popup, which is also stored in there. */ | 389 | * for the video BIOS popup, which is also stored in there. */ |
390 | 390 | size = agp_bridge->driver->fetch_size() + 4; | |
391 | if (IS_I965) | ||
392 | size = 512 + 4; | ||
393 | else | ||
394 | size = agp_bridge->driver->fetch_size() + 4; | ||
395 | 391 | ||
396 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || | 392 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || |
397 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { | 393 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { |
@@ -805,6 +801,26 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
805 | 801 | ||
806 | return 0; | 802 | return 0; |
807 | } | 803 | } |
804 | |||
805 | /* | ||
806 | * The i965 supports 36-bit physical addresses, but to keep | ||
807 | * the format of the GTT the same, the bits that don't fit | ||
808 | * in a 32-bit word are shifted down to bits 4..7. | ||
809 | * | ||
810 | * Gcc is smart enough to notice that "(addr >> 28) & 0xf0" | ||
811 | * is always zero on 32-bit architectures, so no need to make | ||
812 | * this conditional. | ||
813 | */ | ||
814 | static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge, | ||
815 | unsigned long addr, int type) | ||
816 | { | ||
817 | /* Shift high bits down */ | ||
818 | addr |= (addr >> 28) & 0xf0; | ||
819 | |||
820 | /* Type checking must be done elsewhere */ | ||
821 | return addr | bridge->driver->masks[type].mask; | ||
822 | } | ||
823 | |||
808 | static int intel_i965_fetch_size(void) | 824 | static int intel_i965_fetch_size(void) |
809 | { | 825 | { |
810 | struct aper_size_info_fixed *values; | 826 | struct aper_size_info_fixed *values; |
@@ -832,7 +848,8 @@ static int intel_i965_fetch_size(void) | |||
832 | 848 | ||
833 | agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); | 849 | agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); |
834 | 850 | ||
835 | return values[offset].size; | 851 | /* The i965 GTT is always sized as if it had a 512kB aperture size */ |
852 | return 512; | ||
836 | } | 853 | } |
837 | 854 | ||
838 | /* The intel i965 automatically initializes the agp aperture during POST. | 855 | /* The intel i965 automatically initializes the agp aperture during POST. |
@@ -1584,7 +1601,7 @@ static struct agp_bridge_driver intel_i965_driver = { | |||
1584 | .fetch_size = intel_i965_fetch_size, | 1601 | .fetch_size = intel_i965_fetch_size, |
1585 | .cleanup = intel_i915_cleanup, | 1602 | .cleanup = intel_i915_cleanup, |
1586 | .tlb_flush = intel_i810_tlbflush, | 1603 | .tlb_flush = intel_i810_tlbflush, |
1587 | .mask_memory = intel_i810_mask_memory, | 1604 | .mask_memory = intel_i965_mask_memory, |
1588 | .masks = intel_i810_masks, | 1605 | .masks = intel_i810_masks, |
1589 | .agp_enable = intel_i810_agp_enable, | 1606 | .agp_enable = intel_i810_agp_enable, |
1590 | .cache_flush = global_cache_flush, | 1607 | .cache_flush = global_cache_flush, |
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index 91b71e750ee1..dffc19382f7e 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
@@ -27,32 +27,42 @@ | |||
27 | static int uninorth_rev; | 27 | static int uninorth_rev; |
28 | static int is_u3; | 28 | static int is_u3; |
29 | 29 | ||
30 | static char __devinitdata *aperture = NULL; | ||
30 | 31 | ||
31 | static int uninorth_fetch_size(void) | 32 | static int uninorth_fetch_size(void) |
32 | { | 33 | { |
33 | int i; | 34 | int i, size = 0; |
34 | u32 temp; | 35 | struct aper_size_info_32 *values = |
35 | struct aper_size_info_32 *values; | 36 | A_SIZE_32(agp_bridge->driver->aperture_sizes); |
36 | 37 | ||
37 | pci_read_config_dword(agp_bridge->dev, UNI_N_CFG_GART_BASE, &temp); | 38 | if (aperture) { |
38 | temp &= ~(0xfffff000); | 39 | char *save = aperture; |
39 | values = A_SIZE_32(agp_bridge->driver->aperture_sizes); | 40 | |
40 | 41 | size = memparse(aperture, &aperture) >> 20; | |
41 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { | 42 | aperture = save; |
42 | if (temp == values[i].size_value) { | 43 | |
43 | agp_bridge->previous_size = | 44 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) |
44 | agp_bridge->current_size = (void *) (values + i); | 45 | if (size == values[i].size) |
45 | agp_bridge->aperture_size_idx = i; | 46 | break; |
46 | return values[i].size; | 47 | |
48 | if (i == agp_bridge->driver->num_aperture_sizes) { | ||
49 | printk(KERN_ERR PFX "Invalid aperture size, using" | ||
50 | " default\n"); | ||
51 | size = 0; | ||
52 | aperture = NULL; | ||
47 | } | 53 | } |
48 | } | 54 | } |
49 | 55 | ||
50 | agp_bridge->previous_size = | 56 | if (!size) { |
51 | agp_bridge->current_size = (void *) (values + 1); | 57 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) |
52 | agp_bridge->aperture_size_idx = 1; | 58 | if (values[i].size == 32) |
53 | return values[1].size; | 59 | break; |
60 | } | ||
54 | 61 | ||
55 | return 0; | 62 | agp_bridge->previous_size = |
63 | agp_bridge->current_size = (void *)(values + i); | ||
64 | agp_bridge->aperture_size_idx = i; | ||
65 | return values[i].size; | ||
56 | } | 66 | } |
57 | 67 | ||
58 | static void uninorth_tlbflush(struct agp_memory *mem) | 68 | static void uninorth_tlbflush(struct agp_memory *mem) |
@@ -683,5 +693,11 @@ static void __exit agp_uninorth_cleanup(void) | |||
683 | module_init(agp_uninorth_init); | 693 | module_init(agp_uninorth_init); |
684 | module_exit(agp_uninorth_cleanup); | 694 | module_exit(agp_uninorth_cleanup); |
685 | 695 | ||
696 | module_param(aperture, charp, 0); | ||
697 | MODULE_PARM_DESC(aperture, | ||
698 | "Aperture size, must be power of two between 4MB and an\n" | ||
699 | "\t\tupper limit specific to the UniNorth revision.\n" | ||
700 | "\t\tDefault: 32M"); | ||
701 | |||
686 | MODULE_AUTHOR("Ben Herrenschmidt & Paul Mackerras"); | 702 | MODULE_AUTHOR("Ben Herrenschmidt & Paul Mackerras"); |
687 | MODULE_LICENSE("GPL"); | 703 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 029baea33b62..6eafff13dab6 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c | |||
@@ -237,6 +237,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, | |||
237 | 237 | ||
238 | list = drm_alloc(sizeof(*list), DRM_MEM_MAPS); | 238 | list = drm_alloc(sizeof(*list), DRM_MEM_MAPS); |
239 | if (!list) { | 239 | if (!list) { |
240 | if (map->type == _DRM_REGISTERS) | ||
241 | drm_ioremapfree(map->handle, map->size, dev); | ||
240 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 242 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
241 | return -EINVAL; | 243 | return -EINVAL; |
242 | } | 244 | } |
@@ -252,6 +254,8 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, | |||
252 | map->offset; | 254 | map->offset; |
253 | ret = drm_map_handle(dev, &list->hash, user_token, 0); | 255 | ret = drm_map_handle(dev, &list->hash, user_token, 0); |
254 | if (ret) { | 256 | if (ret) { |
257 | if (map->type == _DRM_REGISTERS) | ||
258 | drm_ioremapfree(map->handle, map->size, dev); | ||
255 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 259 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
256 | drm_free(list, sizeof(*list), DRM_MEM_MAPS); | 260 | drm_free(list, sizeof(*list), DRM_MEM_MAPS); |
257 | mutex_unlock(&dev->struct_mutex); | 261 | mutex_unlock(&dev->struct_mutex); |
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 51ad98c685c3..ba4b8de83cf0 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c | |||
@@ -42,13 +42,24 @@ static CLASS_ATTR(version, S_IRUGO, version_show, NULL); | |||
42 | struct class *drm_sysfs_create(struct module *owner, char *name) | 42 | struct class *drm_sysfs_create(struct module *owner, char *name) |
43 | { | 43 | { |
44 | struct class *class; | 44 | struct class *class; |
45 | int err; | ||
45 | 46 | ||
46 | class = class_create(owner, name); | 47 | class = class_create(owner, name); |
47 | if (!class) | 48 | if (!class) { |
48 | return class; | 49 | err = -ENOMEM; |
50 | goto err_out; | ||
51 | } | ||
52 | |||
53 | err = class_create_file(class, &class_attr_version); | ||
54 | if (err) | ||
55 | goto err_out_class; | ||
49 | 56 | ||
50 | class_create_file(class, &class_attr_version); | ||
51 | return class; | 57 | return class; |
58 | |||
59 | err_out_class: | ||
60 | class_destroy(class); | ||
61 | err_out: | ||
62 | return ERR_PTR(err); | ||
52 | } | 63 | } |
53 | 64 | ||
54 | /** | 65 | /** |
@@ -96,20 +107,36 @@ static struct class_device_attribute class_device_attrs[] = { | |||
96 | struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) | 107 | struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) |
97 | { | 108 | { |
98 | struct class_device *class_dev; | 109 | struct class_device *class_dev; |
99 | int i; | 110 | int i, j, err; |
100 | 111 | ||
101 | class_dev = class_device_create(cs, NULL, | 112 | class_dev = class_device_create(cs, NULL, |
102 | MKDEV(DRM_MAJOR, head->minor), | 113 | MKDEV(DRM_MAJOR, head->minor), |
103 | &(head->dev->pdev)->dev, | 114 | &(head->dev->pdev)->dev, |
104 | "card%d", head->minor); | 115 | "card%d", head->minor); |
105 | if (!class_dev) | 116 | if (!class_dev) { |
106 | return NULL; | 117 | err = -ENOMEM; |
118 | goto err_out; | ||
119 | } | ||
107 | 120 | ||
108 | class_set_devdata(class_dev, head); | 121 | class_set_devdata(class_dev, head); |
109 | 122 | ||
110 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) | 123 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) { |
111 | class_device_create_file(class_dev, &class_device_attrs[i]); | 124 | err = class_device_create_file(class_dev, |
125 | &class_device_attrs[i]); | ||
126 | if (err) | ||
127 | goto err_out_files; | ||
128 | } | ||
129 | |||
112 | return class_dev; | 130 | return class_dev; |
131 | |||
132 | err_out_files: | ||
133 | if (i > 0) | ||
134 | for (j = 0; j < i; j++) | ||
135 | class_device_remove_file(class_dev, | ||
136 | &class_device_attrs[i]); | ||
137 | class_device_unregister(class_dev); | ||
138 | err_out: | ||
139 | return ERR_PTR(err); | ||
113 | } | 140 | } |
114 | 141 | ||
115 | /** | 142 | /** |
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index e30f556b79f1..be49dbb9ec3f 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c | |||
@@ -47,6 +47,7 @@ static struct drm_driver driver = { | |||
47 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | | 47 | DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | |
48 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | | 48 | DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | |
49 | DRIVER_IRQ_VBL, | 49 | DRIVER_IRQ_VBL, |
50 | .dev_priv_size = sizeof(drm_mga_buf_priv_t), | ||
50 | .load = mga_driver_load, | 51 | .load = mga_driver_load, |
51 | .unload = mga_driver_unload, | 52 | .unload = mga_driver_unload, |
52 | .lastclose = mga_driver_lastclose, | 53 | .lastclose = mga_driver_lastclose, |
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c index 26bdf2ca59d7..d14477ba3679 100644 --- a/drivers/char/drm/r300_cmdbuf.c +++ b/drivers/char/drm/r300_cmdbuf.c | |||
@@ -538,6 +538,36 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, | |||
538 | return 0; | 538 | return 0; |
539 | } | 539 | } |
540 | 540 | ||
541 | static __inline__ int r300_emit_indx_buffer(drm_radeon_private_t *dev_priv, | ||
542 | drm_radeon_kcmd_buffer_t *cmdbuf) | ||
543 | { | ||
544 | u32 *cmd = (u32 *) cmdbuf->buf; | ||
545 | int count, ret; | ||
546 | RING_LOCALS; | ||
547 | |||
548 | count=(cmd[0]>>16) & 0x3fff; | ||
549 | |||
550 | if ((cmd[1] & 0x8000ffff) != 0x80000810) { | ||
551 | DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); | ||
552 | return DRM_ERR(EINVAL); | ||
553 | } | ||
554 | ret = r300_check_offset(dev_priv, cmd[2]); | ||
555 | if (ret) { | ||
556 | DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); | ||
557 | return DRM_ERR(EINVAL); | ||
558 | } | ||
559 | |||
560 | BEGIN_RING(count+2); | ||
561 | OUT_RING(cmd[0]); | ||
562 | OUT_RING_TABLE((int *)(cmdbuf->buf + 4), count + 1); | ||
563 | ADVANCE_RING(); | ||
564 | |||
565 | cmdbuf->buf += (count+2)*4; | ||
566 | cmdbuf->bufsz -= (count+2)*4; | ||
567 | |||
568 | return 0; | ||
569 | } | ||
570 | |||
541 | static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, | 571 | static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, |
542 | drm_radeon_kcmd_buffer_t *cmdbuf) | 572 | drm_radeon_kcmd_buffer_t *cmdbuf) |
543 | { | 573 | { |
@@ -578,10 +608,11 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, | |||
578 | case RADEON_CNTL_BITBLT_MULTI: | 608 | case RADEON_CNTL_BITBLT_MULTI: |
579 | return r300_emit_bitblt_multi(dev_priv, cmdbuf); | 609 | return r300_emit_bitblt_multi(dev_priv, cmdbuf); |
580 | 610 | ||
611 | case RADEON_CP_INDX_BUFFER: /* DRAW_INDX_2 without INDX_BUFFER seems to lock up the gpu */ | ||
612 | return r300_emit_indx_buffer(dev_priv, cmdbuf); | ||
581 | case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ | 613 | case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ |
582 | case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ | 614 | case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ |
583 | case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ | 615 | case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ |
584 | case RADEON_CP_INDX_BUFFER: /* DRAW_INDX_2 without INDX_BUFFER seems to lock up the gpu */ | ||
585 | case RADEON_WAIT_FOR_IDLE: | 616 | case RADEON_WAIT_FOR_IDLE: |
586 | case RADEON_CP_NOP: | 617 | case RADEON_CP_NOP: |
587 | /* these packets are safe */ | 618 | /* these packets are safe */ |
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c index feac5f005d47..6e04fdd732ac 100644 --- a/drivers/char/drm/radeon_state.c +++ b/drivers/char/drm/radeon_state.c | |||
@@ -275,6 +275,8 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * | |||
275 | unsigned int *cmdsz) | 275 | unsigned int *cmdsz) |
276 | { | 276 | { |
277 | u32 *cmd = (u32 *) cmdbuf->buf; | 277 | u32 *cmd = (u32 *) cmdbuf->buf; |
278 | u32 offset, narrays; | ||
279 | int count, i, k; | ||
278 | 280 | ||
279 | *cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16); | 281 | *cmdsz = 2 + ((cmd[0] & RADEON_CP_PACKET_COUNT_MASK) >> 16); |
280 | 282 | ||
@@ -288,10 +290,106 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * | |||
288 | return DRM_ERR(EINVAL); | 290 | return DRM_ERR(EINVAL); |
289 | } | 291 | } |
290 | 292 | ||
291 | /* Check client state and fix it up if necessary */ | 293 | switch(cmd[0] & 0xff00) { |
292 | if (cmd[0] & 0x8000) { /* MSB of opcode: next DWORD GUI_CNTL */ | 294 | /* XXX Are there old drivers needing other packets? */ |
293 | u32 offset; | ||
294 | 295 | ||
296 | case RADEON_3D_DRAW_IMMD: | ||
297 | case RADEON_3D_DRAW_VBUF: | ||
298 | case RADEON_3D_DRAW_INDX: | ||
299 | case RADEON_WAIT_FOR_IDLE: | ||
300 | case RADEON_CP_NOP: | ||
301 | case RADEON_3D_CLEAR_ZMASK: | ||
302 | /* case RADEON_CP_NEXT_CHAR: | ||
303 | case RADEON_CP_PLY_NEXTSCAN: | ||
304 | case RADEON_CP_SET_SCISSORS: */ /* probably safe but will never need them? */ | ||
305 | /* these packets are safe */ | ||
306 | break; | ||
307 | |||
308 | case RADEON_CP_3D_DRAW_IMMD_2: | ||
309 | case RADEON_CP_3D_DRAW_VBUF_2: | ||
310 | case RADEON_CP_3D_DRAW_INDX_2: | ||
311 | case RADEON_3D_CLEAR_HIZ: | ||
312 | /* safe but r200 only */ | ||
313 | if (dev_priv->microcode_version != UCODE_R200) { | ||
314 | DRM_ERROR("Invalid 3d packet for r100-class chip\n"); | ||
315 | return DRM_ERR(EINVAL); | ||
316 | } | ||
317 | break; | ||
318 | |||
319 | case RADEON_3D_LOAD_VBPNTR: | ||
320 | count = (cmd[0] >> 16) & 0x3fff; | ||
321 | |||
322 | if (count > 18) { /* 12 arrays max */ | ||
323 | DRM_ERROR("Too large payload in 3D_LOAD_VBPNTR (count=%d)\n", | ||
324 | count); | ||
325 | return DRM_ERR(EINVAL); | ||
326 | } | ||
327 | |||
328 | /* carefully check packet contents */ | ||
329 | narrays = cmd[1] & ~0xc000; | ||
330 | k = 0; | ||
331 | i = 2; | ||
332 | while ((k < narrays) && (i < (count + 2))) { | ||
333 | i++; /* skip attribute field */ | ||
334 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[i])) { | ||
335 | DRM_ERROR | ||
336 | ("Invalid offset (k=%d i=%d) in 3D_LOAD_VBPNTR packet.\n", | ||
337 | k, i); | ||
338 | return DRM_ERR(EINVAL); | ||
339 | } | ||
340 | k++; | ||
341 | i++; | ||
342 | if (k == narrays) | ||
343 | break; | ||
344 | /* have one more to process, they come in pairs */ | ||
345 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[i])) { | ||
346 | DRM_ERROR | ||
347 | ("Invalid offset (k=%d i=%d) in 3D_LOAD_VBPNTR packet.\n", | ||
348 | k, i); | ||
349 | return DRM_ERR(EINVAL); | ||
350 | } | ||
351 | k++; | ||
352 | i++; | ||
353 | } | ||
354 | /* do the counts match what we expect ? */ | ||
355 | if ((k != narrays) || (i != (count + 2))) { | ||
356 | DRM_ERROR | ||
357 | ("Malformed 3D_LOAD_VBPNTR packet (k=%d i=%d narrays=%d count+1=%d).\n", | ||
358 | k, i, narrays, count + 1); | ||
359 | return DRM_ERR(EINVAL); | ||
360 | } | ||
361 | break; | ||
362 | |||
363 | case RADEON_3D_RNDR_GEN_INDX_PRIM: | ||
364 | if (dev_priv->microcode_version != UCODE_R100) { | ||
365 | DRM_ERROR("Invalid 3d packet for r200-class chip\n"); | ||
366 | return DRM_ERR(EINVAL); | ||
367 | } | ||
368 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[1])) { | ||
369 | DRM_ERROR("Invalid rndr_gen_indx offset\n"); | ||
370 | return DRM_ERR(EINVAL); | ||
371 | } | ||
372 | break; | ||
373 | |||
374 | case RADEON_CP_INDX_BUFFER: | ||
375 | if (dev_priv->microcode_version != UCODE_R200) { | ||
376 | DRM_ERROR("Invalid 3d packet for r100-class chip\n"); | ||
377 | return DRM_ERR(EINVAL); | ||
378 | } | ||
379 | if ((cmd[1] & 0x8000ffff) != 0x80000810) { | ||
380 | DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); | ||
381 | return DRM_ERR(EINVAL); | ||
382 | } | ||
383 | if (radeon_check_and_fixup_offset(dev_priv, filp_priv, &cmd[2])) { | ||
384 | DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); | ||
385 | return DRM_ERR(EINVAL); | ||
386 | } | ||
387 | break; | ||
388 | |||
389 | case RADEON_CNTL_HOSTDATA_BLT: | ||
390 | case RADEON_CNTL_PAINT_MULTI: | ||
391 | case RADEON_CNTL_BITBLT_MULTI: | ||
392 | /* MSB of opcode: next DWORD GUI_CNTL */ | ||
295 | if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL | 393 | if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
296 | | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { | 394 | | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { |
297 | offset = cmd[2] << 10; | 395 | offset = cmd[2] << 10; |
@@ -313,6 +411,11 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * | |||
313 | } | 411 | } |
314 | cmd[3] = (cmd[3] & 0xffc00000) | offset >> 10; | 412 | cmd[3] = (cmd[3] & 0xffc00000) | offset >> 10; |
315 | } | 413 | } |
414 | break; | ||
415 | |||
416 | default: | ||
417 | DRM_ERROR("Invalid packet type %x\n", cmd[0] & 0xff00); | ||
418 | return DRM_ERR(EINVAL); | ||
316 | } | 419 | } |
317 | 420 | ||
318 | return 0; | 421 | return 0; |
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c index 59c7520bf9a2..a9a84f88df5e 100644 --- a/drivers/char/drm/savage_bci.c +++ b/drivers/char/drm/savage_bci.c | |||
@@ -728,6 +728,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init) | |||
728 | dev_priv->status = NULL; | 728 | dev_priv->status = NULL; |
729 | } | 729 | } |
730 | if (dev_priv->dma_type == SAVAGE_DMA_AGP && init->buffers_offset) { | 730 | if (dev_priv->dma_type == SAVAGE_DMA_AGP && init->buffers_offset) { |
731 | dev->agp_buffer_token = init->buffers_offset; | ||
731 | dev->agp_buffer_map = drm_core_findmap(dev, | 732 | dev->agp_buffer_map = drm_core_findmap(dev, |
732 | init->buffers_offset); | 733 | init->buffers_offset); |
733 | if (!dev->agp_buffer_map) { | 734 | if (!dev->agp_buffer_map) { |
diff --git a/drivers/char/drm/savage_state.c b/drivers/char/drm/savage_state.c index ef2581d16146..1ca1e9cb5a33 100644 --- a/drivers/char/drm/savage_state.c +++ b/drivers/char/drm/savage_state.c | |||
@@ -994,7 +994,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
994 | if (cmdbuf.size) { | 994 | if (cmdbuf.size) { |
995 | kcmd_addr = drm_alloc(cmdbuf.size * 8, DRM_MEM_DRIVER); | 995 | kcmd_addr = drm_alloc(cmdbuf.size * 8, DRM_MEM_DRIVER); |
996 | if (kcmd_addr == NULL) | 996 | if (kcmd_addr == NULL) |
997 | return ENOMEM; | 997 | return DRM_ERR(ENOMEM); |
998 | 998 | ||
999 | if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf.cmd_addr, | 999 | if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf.cmd_addr, |
1000 | cmdbuf.size * 8)) | 1000 | cmdbuf.size * 8)) |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index c3f95583a120..706733c0b36a 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -1157,6 +1157,7 @@ static int __init pc_init(void) | |||
1157 | int crd; | 1157 | int crd; |
1158 | struct board_info *bd; | 1158 | struct board_info *bd; |
1159 | unsigned char board_id = 0; | 1159 | unsigned char board_id = 0; |
1160 | int err = -ENOMEM; | ||
1160 | 1161 | ||
1161 | int pci_boards_found, pci_count; | 1162 | int pci_boards_found, pci_count; |
1162 | 1163 | ||
@@ -1164,13 +1165,11 @@ static int __init pc_init(void) | |||
1164 | 1165 | ||
1165 | pc_driver = alloc_tty_driver(MAX_ALLOC); | 1166 | pc_driver = alloc_tty_driver(MAX_ALLOC); |
1166 | if (!pc_driver) | 1167 | if (!pc_driver) |
1167 | return -ENOMEM; | 1168 | goto out1; |
1168 | 1169 | ||
1169 | pc_info = alloc_tty_driver(MAX_ALLOC); | 1170 | pc_info = alloc_tty_driver(MAX_ALLOC); |
1170 | if (!pc_info) { | 1171 | if (!pc_info) |
1171 | put_tty_driver(pc_driver); | 1172 | goto out2; |
1172 | return -ENOMEM; | ||
1173 | } | ||
1174 | 1173 | ||
1175 | /* ----------------------------------------------------------------------- | 1174 | /* ----------------------------------------------------------------------- |
1176 | If epca_setup has not been ran by LILO set num_cards to defaults; copy | 1175 | If epca_setup has not been ran by LILO set num_cards to defaults; copy |
@@ -1370,11 +1369,17 @@ static int __init pc_init(void) | |||
1370 | 1369 | ||
1371 | } /* End for each card */ | 1370 | } /* End for each card */ |
1372 | 1371 | ||
1373 | if (tty_register_driver(pc_driver)) | 1372 | err = tty_register_driver(pc_driver); |
1374 | panic("Couldn't register Digi PC/ driver"); | 1373 | if (err) { |
1374 | printk(KERN_ERR "Couldn't register Digi PC/ driver"); | ||
1375 | goto out3; | ||
1376 | } | ||
1375 | 1377 | ||
1376 | if (tty_register_driver(pc_info)) | 1378 | err = tty_register_driver(pc_info); |
1377 | panic("Couldn't register Digi PC/ info "); | 1379 | if (err) { |
1380 | printk(KERN_ERR "Couldn't register Digi PC/ info "); | ||
1381 | goto out4; | ||
1382 | } | ||
1378 | 1383 | ||
1379 | /* ------------------------------------------------------------------- | 1384 | /* ------------------------------------------------------------------- |
1380 | Start up the poller to check for events on all enabled boards | 1385 | Start up the poller to check for events on all enabled boards |
@@ -1385,6 +1390,15 @@ static int __init pc_init(void) | |||
1385 | mod_timer(&epca_timer, jiffies + HZ/25); | 1390 | mod_timer(&epca_timer, jiffies + HZ/25); |
1386 | return 0; | 1391 | return 0; |
1387 | 1392 | ||
1393 | out4: | ||
1394 | tty_unregister_driver(pc_driver); | ||
1395 | out3: | ||
1396 | put_tty_driver(pc_info); | ||
1397 | out2: | ||
1398 | put_tty_driver(pc_driver); | ||
1399 | out1: | ||
1400 | return err; | ||
1401 | |||
1388 | } /* End pc_init */ | 1402 | } /* End pc_init */ |
1389 | 1403 | ||
1390 | /* ------------------ Begin post_fep_init ---------------------- */ | 1404 | /* ------------------ Begin post_fep_init ---------------------- */ |
diff --git a/drivers/char/ftape/zftape/zftape-buffers.c b/drivers/char/ftape/zftape/zftape-buffers.c index da06f138334e..7ebce2ec7897 100644 --- a/drivers/char/ftape/zftape/zftape-buffers.c +++ b/drivers/char/ftape/zftape/zftape-buffers.c | |||
@@ -85,7 +85,7 @@ int zft_vmalloc_once(void *new, size_t size) | |||
85 | peak_memory = used_memory; | 85 | peak_memory = used_memory; |
86 | } | 86 | } |
87 | TRACE_ABORT(0, ft_t_noise, | 87 | TRACE_ABORT(0, ft_t_noise, |
88 | "allocated buffer @ %p, %d bytes", *(void **)new, size); | 88 | "allocated buffer @ %p, %zd bytes", *(void **)new, size); |
89 | } | 89 | } |
90 | int zft_vmalloc_always(void *new, size_t size) | 90 | int zft_vmalloc_always(void *new, size_t size) |
91 | { | 91 | { |
@@ -101,7 +101,7 @@ void zft_vfree(void *old, size_t size) | |||
101 | if (*(void **)old) { | 101 | if (*(void **)old) { |
102 | vfree(*(void **)old); | 102 | vfree(*(void **)old); |
103 | used_memory -= size; | 103 | used_memory -= size; |
104 | TRACE(ft_t_noise, "released buffer @ %p, %d bytes", | 104 | TRACE(ft_t_noise, "released buffer @ %p, %zd bytes", |
105 | *(void **)old, size); | 105 | *(void **)old, size); |
106 | *(void **)old = NULL; | 106 | *(void **)old = NULL; |
107 | } | 107 | } |
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 154a81d328c1..ebace201bec6 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -162,7 +162,8 @@ static struct miscdevice rng_miscdev = { | |||
162 | }; | 162 | }; |
163 | 163 | ||
164 | 164 | ||
165 | static ssize_t hwrng_attr_current_store(struct class_device *class, | 165 | static ssize_t hwrng_attr_current_store(struct device *dev, |
166 | struct device_attribute *attr, | ||
166 | const char *buf, size_t len) | 167 | const char *buf, size_t len) |
167 | { | 168 | { |
168 | int err; | 169 | int err; |
@@ -192,7 +193,8 @@ static ssize_t hwrng_attr_current_store(struct class_device *class, | |||
192 | return err ? : len; | 193 | return err ? : len; |
193 | } | 194 | } |
194 | 195 | ||
195 | static ssize_t hwrng_attr_current_show(struct class_device *class, | 196 | static ssize_t hwrng_attr_current_show(struct device *dev, |
197 | struct device_attribute *attr, | ||
196 | char *buf) | 198 | char *buf) |
197 | { | 199 | { |
198 | int err; | 200 | int err; |
@@ -210,7 +212,8 @@ static ssize_t hwrng_attr_current_show(struct class_device *class, | |||
210 | return ret; | 212 | return ret; |
211 | } | 213 | } |
212 | 214 | ||
213 | static ssize_t hwrng_attr_available_show(struct class_device *class, | 215 | static ssize_t hwrng_attr_available_show(struct device *dev, |
216 | struct device_attribute *attr, | ||
214 | char *buf) | 217 | char *buf) |
215 | { | 218 | { |
216 | int err; | 219 | int err; |
@@ -234,20 +237,18 @@ static ssize_t hwrng_attr_available_show(struct class_device *class, | |||
234 | return ret; | 237 | return ret; |
235 | } | 238 | } |
236 | 239 | ||
237 | static CLASS_DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, | 240 | static DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, |
238 | hwrng_attr_current_show, | 241 | hwrng_attr_current_show, |
239 | hwrng_attr_current_store); | 242 | hwrng_attr_current_store); |
240 | static CLASS_DEVICE_ATTR(rng_available, S_IRUGO, | 243 | static DEVICE_ATTR(rng_available, S_IRUGO, |
241 | hwrng_attr_available_show, | 244 | hwrng_attr_available_show, |
242 | NULL); | 245 | NULL); |
243 | 246 | ||
244 | 247 | ||
245 | static void unregister_miscdev(void) | 248 | static void unregister_miscdev(void) |
246 | { | 249 | { |
247 | class_device_remove_file(rng_miscdev.class, | 250 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); |
248 | &class_device_attr_rng_available); | 251 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); |
249 | class_device_remove_file(rng_miscdev.class, | ||
250 | &class_device_attr_rng_current); | ||
251 | misc_deregister(&rng_miscdev); | 252 | misc_deregister(&rng_miscdev); |
252 | } | 253 | } |
253 | 254 | ||
@@ -258,20 +259,19 @@ static int register_miscdev(void) | |||
258 | err = misc_register(&rng_miscdev); | 259 | err = misc_register(&rng_miscdev); |
259 | if (err) | 260 | if (err) |
260 | goto out; | 261 | goto out; |
261 | err = class_device_create_file(rng_miscdev.class, | 262 | err = device_create_file(rng_miscdev.this_device, |
262 | &class_device_attr_rng_current); | 263 | &dev_attr_rng_current); |
263 | if (err) | 264 | if (err) |
264 | goto err_misc_dereg; | 265 | goto err_misc_dereg; |
265 | err = class_device_create_file(rng_miscdev.class, | 266 | err = device_create_file(rng_miscdev.this_device, |
266 | &class_device_attr_rng_available); | 267 | &dev_attr_rng_available); |
267 | if (err) | 268 | if (err) |
268 | goto err_remove_current; | 269 | goto err_remove_current; |
269 | out: | 270 | out: |
270 | return err; | 271 | return err; |
271 | 272 | ||
272 | err_remove_current: | 273 | err_remove_current: |
273 | class_device_remove_file(rng_miscdev.class, | 274 | device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); |
274 | &class_device_attr_rng_current); | ||
275 | err_misc_dereg: | 275 | err_misc_dereg: |
276 | misc_deregister(&rng_miscdev); | 276 | misc_deregister(&rng_miscdev); |
277 | goto out; | 277 | goto out; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 34a4fd13fa81..c47add8e47df 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -376,13 +376,23 @@ static void free_recv_msg_list(struct list_head *q) | |||
376 | } | 376 | } |
377 | } | 377 | } |
378 | 378 | ||
379 | static void free_smi_msg_list(struct list_head *q) | ||
380 | { | ||
381 | struct ipmi_smi_msg *msg, *msg2; | ||
382 | |||
383 | list_for_each_entry_safe(msg, msg2, q, link) { | ||
384 | list_del(&msg->link); | ||
385 | ipmi_free_smi_msg(msg); | ||
386 | } | ||
387 | } | ||
388 | |||
379 | static void clean_up_interface_data(ipmi_smi_t intf) | 389 | static void clean_up_interface_data(ipmi_smi_t intf) |
380 | { | 390 | { |
381 | int i; | 391 | int i; |
382 | struct cmd_rcvr *rcvr, *rcvr2; | 392 | struct cmd_rcvr *rcvr, *rcvr2; |
383 | struct list_head list; | 393 | struct list_head list; |
384 | 394 | ||
385 | free_recv_msg_list(&intf->waiting_msgs); | 395 | free_smi_msg_list(&intf->waiting_msgs); |
386 | free_recv_msg_list(&intf->waiting_events); | 396 | free_recv_msg_list(&intf->waiting_events); |
387 | 397 | ||
388 | /* Wholesale remove all the entries from the list in the | 398 | /* Wholesale remove all the entries from the list in the |
@@ -1844,7 +1854,7 @@ static ssize_t provides_dev_sdrs_show(struct device *dev, | |||
1844 | struct bmc_device *bmc = dev_get_drvdata(dev); | 1854 | struct bmc_device *bmc = dev_get_drvdata(dev); |
1845 | 1855 | ||
1846 | return snprintf(buf, 10, "%u\n", | 1856 | return snprintf(buf, 10, "%u\n", |
1847 | bmc->id.device_revision && 0x80 >> 7); | 1857 | (bmc->id.device_revision & 0x80) >> 7); |
1848 | } | 1858 | } |
1849 | 1859 | ||
1850 | static ssize_t revision_show(struct device *dev, struct device_attribute *attr, | 1860 | static ssize_t revision_show(struct device *dev, struct device_attribute *attr, |
@@ -1853,7 +1863,7 @@ static ssize_t revision_show(struct device *dev, struct device_attribute *attr, | |||
1853 | struct bmc_device *bmc = dev_get_drvdata(dev); | 1863 | struct bmc_device *bmc = dev_get_drvdata(dev); |
1854 | 1864 | ||
1855 | return snprintf(buf, 20, "%u\n", | 1865 | return snprintf(buf, 20, "%u\n", |
1856 | bmc->id.device_revision && 0x0F); | 1866 | bmc->id.device_revision & 0x0F); |
1857 | } | 1867 | } |
1858 | 1868 | ||
1859 | static ssize_t firmware_rev_show(struct device *dev, | 1869 | static ssize_t firmware_rev_show(struct device *dev, |
@@ -2108,7 +2118,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf) | |||
2108 | dev_set_drvdata(&bmc->dev->dev, bmc); | 2118 | dev_set_drvdata(&bmc->dev->dev, bmc); |
2109 | kref_init(&bmc->refcount); | 2119 | kref_init(&bmc->refcount); |
2110 | 2120 | ||
2111 | rv = platform_device_register(bmc->dev); | 2121 | rv = platform_device_add(bmc->dev); |
2112 | mutex_unlock(&ipmidriver_mutex); | 2122 | mutex_unlock(&ipmidriver_mutex); |
2113 | if (rv) { | 2123 | if (rv) { |
2114 | printk(KERN_ERR | 2124 | printk(KERN_ERR |
@@ -3232,7 +3242,9 @@ void ipmi_smi_msg_received(ipmi_smi_t intf, | |||
3232 | report the error immediately. */ | 3242 | report the error immediately. */ |
3233 | if ((msg->rsp_size >= 3) && (msg->rsp[2] != 0) | 3243 | if ((msg->rsp_size >= 3) && (msg->rsp[2] != 0) |
3234 | && (msg->rsp[2] != IPMI_NODE_BUSY_ERR) | 3244 | && (msg->rsp[2] != IPMI_NODE_BUSY_ERR) |
3235 | && (msg->rsp[2] != IPMI_LOST_ARBITRATION_ERR)) | 3245 | && (msg->rsp[2] != IPMI_LOST_ARBITRATION_ERR) |
3246 | && (msg->rsp[2] != IPMI_BUS_ERR) | ||
3247 | && (msg->rsp[2] != IPMI_NAK_ON_WRITE_ERR)) | ||
3236 | { | 3248 | { |
3237 | int chan = msg->rsp[3] & 0xf; | 3249 | int chan = msg->rsp[3] & 0xf; |
3238 | 3250 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 24825bdca8f4..bb1fac104fda 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1211,7 +1211,7 @@ static void intf_mem_outb(struct si_sm_io *io, unsigned int offset, | |||
1211 | static unsigned char intf_mem_inw(struct si_sm_io *io, unsigned int offset) | 1211 | static unsigned char intf_mem_inw(struct si_sm_io *io, unsigned int offset) |
1212 | { | 1212 | { |
1213 | return (readw((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1213 | return (readw((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1214 | && 0xff; | 1214 | & 0xff; |
1215 | } | 1215 | } |
1216 | 1216 | ||
1217 | static void intf_mem_outw(struct si_sm_io *io, unsigned int offset, | 1217 | static void intf_mem_outw(struct si_sm_io *io, unsigned int offset, |
@@ -1223,7 +1223,7 @@ static void intf_mem_outw(struct si_sm_io *io, unsigned int offset, | |||
1223 | static unsigned char intf_mem_inl(struct si_sm_io *io, unsigned int offset) | 1223 | static unsigned char intf_mem_inl(struct si_sm_io *io, unsigned int offset) |
1224 | { | 1224 | { |
1225 | return (readl((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1225 | return (readl((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1226 | && 0xff; | 1226 | & 0xff; |
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | static void intf_mem_outl(struct si_sm_io *io, unsigned int offset, | 1229 | static void intf_mem_outl(struct si_sm_io *io, unsigned int offset, |
@@ -1236,7 +1236,7 @@ static void intf_mem_outl(struct si_sm_io *io, unsigned int offset, | |||
1236 | static unsigned char mem_inq(struct si_sm_io *io, unsigned int offset) | 1236 | static unsigned char mem_inq(struct si_sm_io *io, unsigned int offset) |
1237 | { | 1237 | { |
1238 | return (readq((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1238 | return (readq((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1239 | && 0xff; | 1239 | & 0xff; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | static void mem_outq(struct si_sm_io *io, unsigned int offset, | 1242 | static void mem_outq(struct si_sm_io *io, unsigned int offset, |
@@ -1789,7 +1789,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev, | |||
1789 | 1789 | ||
1790 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 1790 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
1791 | if (!info) | 1791 | if (!info) |
1792 | return ENOMEM; | 1792 | return -ENOMEM; |
1793 | 1793 | ||
1794 | info->addr_source = "PCI"; | 1794 | info->addr_source = "PCI"; |
1795 | 1795 | ||
@@ -1810,7 +1810,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev, | |||
1810 | kfree(info); | 1810 | kfree(info); |
1811 | printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n", | 1811 | printk(KERN_INFO "ipmi_si: %s: Unknown IPMI type: %d\n", |
1812 | pci_name(pdev), class_type); | 1812 | pci_name(pdev), class_type); |
1813 | return ENOMEM; | 1813 | return -ENOMEM; |
1814 | } | 1814 | } |
1815 | 1815 | ||
1816 | rv = pci_enable_device(pdev); | 1816 | rv = pci_enable_device(pdev); |
@@ -1867,7 +1867,7 @@ static int ipmi_pci_resume(struct pci_dev *pdev) | |||
1867 | 1867 | ||
1868 | static struct pci_device_id ipmi_pci_devices[] = { | 1868 | static struct pci_device_id ipmi_pci_devices[] = { |
1869 | { PCI_DEVICE(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID) }, | 1869 | { PCI_DEVICE(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID) }, |
1870 | { PCI_DEVICE_CLASS(PCI_ERMC_CLASSCODE, PCI_ERMC_CLASSCODE) } | 1870 | { PCI_DEVICE_CLASS(PCI_ERMC_CLASSCODE, PCI_ERMC_CLASSCODE_MASK) } |
1871 | }; | 1871 | }; |
1872 | MODULE_DEVICE_TABLE(pci, ipmi_pci_devices); | 1872 | MODULE_DEVICE_TABLE(pci, ipmi_pci_devices); |
1873 | 1873 | ||
@@ -2346,7 +2346,7 @@ static int try_smi_init(struct smi_info *new_smi) | |||
2346 | new_smi->dev = &new_smi->pdev->dev; | 2346 | new_smi->dev = &new_smi->pdev->dev; |
2347 | new_smi->dev->driver = &ipmi_driver; | 2347 | new_smi->dev->driver = &ipmi_driver; |
2348 | 2348 | ||
2349 | rv = platform_device_register(new_smi->pdev); | 2349 | rv = platform_device_add(new_smi->pdev); |
2350 | if (rv) { | 2350 | if (rv) { |
2351 | printk(KERN_ERR | 2351 | printk(KERN_ERR |
2352 | "ipmi_si_intf:" | 2352 | "ipmi_si_intf:" |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index e9e9bf31c369..58c955e390b3 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -1062,11 +1062,12 @@ static void isicom_shutdown_port(struct isi_port *port) | |||
1062 | static void isicom_close(struct tty_struct *tty, struct file *filp) | 1062 | static void isicom_close(struct tty_struct *tty, struct file *filp) |
1063 | { | 1063 | { |
1064 | struct isi_port *port = tty->driver_data; | 1064 | struct isi_port *port = tty->driver_data; |
1065 | struct isi_board *card = port->card; | 1065 | struct isi_board *card; |
1066 | unsigned long flags; | 1066 | unsigned long flags; |
1067 | 1067 | ||
1068 | if (!port) | 1068 | if (!port) |
1069 | return; | 1069 | return; |
1070 | card = port->card; | ||
1070 | if (isicom_paranoia_check(port, tty->name, "isicom_close")) | 1071 | if (isicom_paranoia_check(port, tty->name, "isicom_close")) |
1071 | return; | 1072 | return; |
1072 | 1073 | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 55473371b7c6..e67eef4867ba 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -980,10 +980,10 @@ static int __init chr_dev_init(void) | |||
980 | 980 | ||
981 | mem_class = class_create(THIS_MODULE, "mem"); | 981 | mem_class = class_create(THIS_MODULE, "mem"); |
982 | for (i = 0; i < ARRAY_SIZE(devlist); i++) | 982 | for (i = 0; i < ARRAY_SIZE(devlist); i++) |
983 | class_device_create(mem_class, NULL, | 983 | device_create(mem_class, NULL, |
984 | MKDEV(MEM_MAJOR, devlist[i].minor), | 984 | MKDEV(MEM_MAJOR, devlist[i].minor), |
985 | NULL, devlist[i].name); | 985 | devlist[i].name); |
986 | 986 | ||
987 | return 0; | 987 | return 0; |
988 | } | 988 | } |
989 | 989 | ||
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 62ebe09656e3..7a484fc7cb9e 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -169,11 +169,6 @@ fail: | |||
169 | return err; | 169 | return err; |
170 | } | 170 | } |
171 | 171 | ||
172 | /* | ||
173 | * TODO for 2.7: | ||
174 | * - add a struct kref to struct miscdevice and make all usages of | ||
175 | * them dynamic. | ||
176 | */ | ||
177 | static struct class *misc_class; | 172 | static struct class *misc_class; |
178 | 173 | ||
179 | static const struct file_operations misc_fops = { | 174 | static const struct file_operations misc_fops = { |
@@ -228,10 +223,10 @@ int misc_register(struct miscdevice * misc) | |||
228 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); | 223 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); |
229 | dev = MKDEV(MISC_MAJOR, misc->minor); | 224 | dev = MKDEV(MISC_MAJOR, misc->minor); |
230 | 225 | ||
231 | misc->class = class_device_create(misc_class, NULL, dev, misc->dev, | 226 | misc->this_device = device_create(misc_class, misc->parent, dev, |
232 | "%s", misc->name); | 227 | "%s", misc->name); |
233 | if (IS_ERR(misc->class)) { | 228 | if (IS_ERR(misc->this_device)) { |
234 | err = PTR_ERR(misc->class); | 229 | err = PTR_ERR(misc->this_device); |
235 | goto out; | 230 | goto out; |
236 | } | 231 | } |
237 | 232 | ||
@@ -264,7 +259,7 @@ int misc_deregister(struct miscdevice * misc) | |||
264 | 259 | ||
265 | down(&misc_sem); | 260 | down(&misc_sem); |
266 | list_del(&misc->list); | 261 | list_del(&misc->list); |
267 | class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); | 262 | device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); |
268 | if (i < DYNAMIC_MINORS && i>0) { | 263 | if (i < DYNAMIC_MINORS && i>0) { |
269 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); | 264 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); |
270 | } | 265 | } |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index b401383808c2..96cb1f07332b 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -130,6 +130,7 @@ static moxa_isa_board_conf moxa_isa_boards[] = | |||
130 | typedef struct _moxa_pci_devinfo { | 130 | typedef struct _moxa_pci_devinfo { |
131 | ushort busNum; | 131 | ushort busNum; |
132 | ushort devNum; | 132 | ushort devNum; |
133 | struct pci_dev *pdev; | ||
133 | } moxa_pci_devinfo; | 134 | } moxa_pci_devinfo; |
134 | 135 | ||
135 | typedef struct _moxa_board_conf { | 136 | typedef struct _moxa_board_conf { |
@@ -324,6 +325,9 @@ static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf | |||
324 | board->busType = MOXA_BUS_TYPE_PCI; | 325 | board->busType = MOXA_BUS_TYPE_PCI; |
325 | board->pciInfo.busNum = p->bus->number; | 326 | board->pciInfo.busNum = p->bus->number; |
326 | board->pciInfo.devNum = p->devfn >> 3; | 327 | board->pciInfo.devNum = p->devfn >> 3; |
328 | board->pciInfo.pdev = p; | ||
329 | /* don't lose the reference in the next pci_get_device iteration */ | ||
330 | pci_dev_get(p); | ||
327 | 331 | ||
328 | return (0); | 332 | return (0); |
329 | } | 333 | } |
@@ -493,6 +497,11 @@ static void __exit moxa_exit(void) | |||
493 | if (tty_unregister_driver(moxaDriver)) | 497 | if (tty_unregister_driver(moxaDriver)) |
494 | printk("Couldn't unregister MOXA Intellio family serial driver\n"); | 498 | printk("Couldn't unregister MOXA Intellio family serial driver\n"); |
495 | put_tty_driver(moxaDriver); | 499 | put_tty_driver(moxaDriver); |
500 | |||
501 | for (i = 0; i < MAX_BOARDS; i++) | ||
502 | if (moxa_boards[i].busType == MOXA_BUS_TYPE_PCI) | ||
503 | pci_dev_put(moxa_boards[i].pciInfo.pdev); | ||
504 | |||
496 | if (verbose) | 505 | if (verbose) |
497 | printk("Done\n"); | 506 | printk("Done\n"); |
498 | } | 507 | } |
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c index 5c0dec39cf6c..235e89226112 100644 --- a/drivers/char/mspec.c +++ b/drivers/char/mspec.c | |||
@@ -72,7 +72,11 @@ enum { | |||
72 | MSPEC_UNCACHED | 72 | MSPEC_UNCACHED |
73 | }; | 73 | }; |
74 | 74 | ||
75 | #ifdef CONFIG_SGI_SN | ||
75 | static int is_sn2; | 76 | static int is_sn2; |
77 | #else | ||
78 | #define is_sn2 0 | ||
79 | #endif | ||
76 | 80 | ||
77 | /* | 81 | /* |
78 | * One of these structures is allocated when an mspec region is mmaped. The | 82 | * One of these structures is allocated when an mspec region is mmaped. The |
@@ -211,7 +215,7 @@ mspec_nopfn(struct vm_area_struct *vma, unsigned long address) | |||
211 | if (vdata->type == MSPEC_FETCHOP) | 215 | if (vdata->type == MSPEC_FETCHOP) |
212 | paddr = TO_AMO(maddr); | 216 | paddr = TO_AMO(maddr); |
213 | else | 217 | else |
214 | paddr = __pa(TO_CAC(maddr)); | 218 | paddr = maddr & ~__IA64_UNCACHED_OFFSET; |
215 | 219 | ||
216 | pfn = paddr >> PAGE_SHIFT; | 220 | pfn = paddr >> PAGE_SHIFT; |
217 | 221 | ||
@@ -335,6 +339,7 @@ mspec_init(void) | |||
335 | * The fetchop device only works on SN2 hardware, uncached and cached | 339 | * The fetchop device only works on SN2 hardware, uncached and cached |
336 | * memory drivers should both be valid on all ia64 hardware | 340 | * memory drivers should both be valid on all ia64 hardware |
337 | */ | 341 | */ |
342 | #ifdef CONFIG_SGI_SN | ||
338 | if (ia64_platform_is("sn2")) { | 343 | if (ia64_platform_is("sn2")) { |
339 | is_sn2 = 1; | 344 | is_sn2 = 1; |
340 | if (is_shub2()) { | 345 | if (is_shub2()) { |
@@ -363,6 +368,7 @@ mspec_init(void) | |||
363 | goto free_scratch_pages; | 368 | goto free_scratch_pages; |
364 | } | 369 | } |
365 | } | 370 | } |
371 | #endif | ||
366 | ret = misc_register(&cached_miscdev); | 372 | ret = misc_register(&cached_miscdev); |
367 | if (ret) { | 373 | if (ret) { |
368 | printk(KERN_ERR "%s: failed to register device %i\n", | 374 | printk(KERN_ERR "%s: failed to register device %i\n", |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index efc485edad1c..c1e3dd837fc8 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -752,13 +752,13 @@ static const struct file_operations pp_fops = { | |||
752 | 752 | ||
753 | static void pp_attach(struct parport *port) | 753 | static void pp_attach(struct parport *port) |
754 | { | 754 | { |
755 | class_device_create(ppdev_class, NULL, MKDEV(PP_MAJOR, port->number), | 755 | device_create(ppdev_class, NULL, MKDEV(PP_MAJOR, port->number), |
756 | NULL, "parport%d", port->number); | 756 | "parport%d", port->number); |
757 | } | 757 | } |
758 | 758 | ||
759 | static void pp_detach(struct parport *port) | 759 | static void pp_detach(struct parport *port) |
760 | { | 760 | { |
761 | class_device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number)); | 761 | device_destroy(ppdev_class, MKDEV(PP_MAJOR, port->number)); |
762 | } | 762 | } |
763 | 763 | ||
764 | static struct parport_driver pp_driver = { | 764 | static struct parport_driver pp_driver = { |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 07f47a0208a7..d40df30c2b10 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -645,6 +645,7 @@ void add_input_randomness(unsigned int type, unsigned int code, | |||
645 | add_timer_randomness(&input_timer_state, | 645 | add_timer_randomness(&input_timer_state, |
646 | (type << 4) ^ code ^ (code >> 4) ^ value); | 646 | (type << 4) ^ code ^ (code >> 4) ^ value); |
647 | } | 647 | } |
648 | EXPORT_SYMBOL_GPL(add_input_randomness); | ||
648 | 649 | ||
649 | void add_interrupt_randomness(int irq) | 650 | void add_interrupt_randomness(int irq) |
650 | { | 651 | { |
@@ -1465,8 +1466,8 @@ static __init int seqgen_init(void) | |||
1465 | late_initcall(seqgen_init); | 1466 | late_initcall(seqgen_init); |
1466 | 1467 | ||
1467 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 1468 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
1468 | __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, | 1469 | __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr, |
1469 | __u16 sport, __u16 dport) | 1470 | __be16 sport, __be16 dport) |
1470 | { | 1471 | { |
1471 | struct timeval tv; | 1472 | struct timeval tv; |
1472 | __u32 seq; | 1473 | __u32 seq; |
@@ -1478,10 +1479,10 @@ __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, | |||
1478 | */ | 1479 | */ |
1479 | 1480 | ||
1480 | memcpy(hash, saddr, 16); | 1481 | memcpy(hash, saddr, 16); |
1481 | hash[4]=(sport << 16) + dport; | 1482 | hash[4]=((__force u16)sport << 16) + (__force u16)dport; |
1482 | memcpy(&hash[5],keyptr->secret,sizeof(__u32) * 7); | 1483 | memcpy(&hash[5],keyptr->secret,sizeof(__u32) * 7); |
1483 | 1484 | ||
1484 | seq = twothirdsMD4Transform(daddr, hash) & HASH_MASK; | 1485 | seq = twothirdsMD4Transform((const __u32 *)daddr, hash) & HASH_MASK; |
1485 | seq += keyptr->count; | 1486 | seq += keyptr->count; |
1486 | 1487 | ||
1487 | do_gettimeofday(&tv); | 1488 | do_gettimeofday(&tv); |
@@ -1495,7 +1496,7 @@ EXPORT_SYMBOL(secure_tcpv6_sequence_number); | |||
1495 | /* The code below is shamelessly stolen from secure_tcp_sequence_number(). | 1496 | /* The code below is shamelessly stolen from secure_tcp_sequence_number(). |
1496 | * All blames to Andrey V. Savochkin <saw@msu.ru>. | 1497 | * All blames to Andrey V. Savochkin <saw@msu.ru>. |
1497 | */ | 1498 | */ |
1498 | __u32 secure_ip_id(__u32 daddr) | 1499 | __u32 secure_ip_id(__be32 daddr) |
1499 | { | 1500 | { |
1500 | struct keydata *keyptr; | 1501 | struct keydata *keyptr; |
1501 | __u32 hash[4]; | 1502 | __u32 hash[4]; |
@@ -1507,7 +1508,7 @@ __u32 secure_ip_id(__u32 daddr) | |||
1507 | * The dest ip address is placed in the starting vector, | 1508 | * The dest ip address is placed in the starting vector, |
1508 | * which is then hashed with random data. | 1509 | * which is then hashed with random data. |
1509 | */ | 1510 | */ |
1510 | hash[0] = daddr; | 1511 | hash[0] = (__force __u32)daddr; |
1511 | hash[1] = keyptr->secret[9]; | 1512 | hash[1] = keyptr->secret[9]; |
1512 | hash[2] = keyptr->secret[10]; | 1513 | hash[2] = keyptr->secret[10]; |
1513 | hash[3] = keyptr->secret[11]; | 1514 | hash[3] = keyptr->secret[11]; |
@@ -1517,8 +1518,8 @@ __u32 secure_ip_id(__u32 daddr) | |||
1517 | 1518 | ||
1518 | #ifdef CONFIG_INET | 1519 | #ifdef CONFIG_INET |
1519 | 1520 | ||
1520 | __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, | 1521 | __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, |
1521 | __u16 sport, __u16 dport) | 1522 | __be16 sport, __be16 dport) |
1522 | { | 1523 | { |
1523 | struct timeval tv; | 1524 | struct timeval tv; |
1524 | __u32 seq; | 1525 | __u32 seq; |
@@ -1531,9 +1532,9 @@ __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, | |||
1531 | * Note that the words are placed into the starting vector, which is | 1532 | * Note that the words are placed into the starting vector, which is |
1532 | * then mixed with a partial MD4 over random data. | 1533 | * then mixed with a partial MD4 over random data. |
1533 | */ | 1534 | */ |
1534 | hash[0]=saddr; | 1535 | hash[0]=(__force u32)saddr; |
1535 | hash[1]=daddr; | 1536 | hash[1]=(__force u32)daddr; |
1536 | hash[2]=(sport << 16) + dport; | 1537 | hash[2]=((__force u16)sport << 16) + (__force u16)dport; |
1537 | hash[3]=keyptr->secret[11]; | 1538 | hash[3]=keyptr->secret[11]; |
1538 | 1539 | ||
1539 | seq = half_md4_transform(hash, keyptr->secret) & HASH_MASK; | 1540 | seq = half_md4_transform(hash, keyptr->secret) & HASH_MASK; |
@@ -1558,7 +1559,7 @@ __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, | |||
1558 | EXPORT_SYMBOL(secure_tcp_sequence_number); | 1559 | EXPORT_SYMBOL(secure_tcp_sequence_number); |
1559 | 1560 | ||
1560 | /* Generate secure starting point for ephemeral IPV4 transport port search */ | 1561 | /* Generate secure starting point for ephemeral IPV4 transport port search */ |
1561 | u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport) | 1562 | u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport) |
1562 | { | 1563 | { |
1563 | struct keydata *keyptr = get_keyptr(); | 1564 | struct keydata *keyptr = get_keyptr(); |
1564 | u32 hash[4]; | 1565 | u32 hash[4]; |
@@ -1567,25 +1568,25 @@ u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport) | |||
1567 | * Pick a unique starting offset for each ephemeral port search | 1568 | * Pick a unique starting offset for each ephemeral port search |
1568 | * (saddr, daddr, dport) and 48bits of random data. | 1569 | * (saddr, daddr, dport) and 48bits of random data. |
1569 | */ | 1570 | */ |
1570 | hash[0] = saddr; | 1571 | hash[0] = (__force u32)saddr; |
1571 | hash[1] = daddr; | 1572 | hash[1] = (__force u32)daddr; |
1572 | hash[2] = dport ^ keyptr->secret[10]; | 1573 | hash[2] = (__force u32)dport ^ keyptr->secret[10]; |
1573 | hash[3] = keyptr->secret[11]; | 1574 | hash[3] = keyptr->secret[11]; |
1574 | 1575 | ||
1575 | return half_md4_transform(hash, keyptr->secret); | 1576 | return half_md4_transform(hash, keyptr->secret); |
1576 | } | 1577 | } |
1577 | 1578 | ||
1578 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 1579 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
1579 | u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport) | 1580 | u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, __be16 dport) |
1580 | { | 1581 | { |
1581 | struct keydata *keyptr = get_keyptr(); | 1582 | struct keydata *keyptr = get_keyptr(); |
1582 | u32 hash[12]; | 1583 | u32 hash[12]; |
1583 | 1584 | ||
1584 | memcpy(hash, saddr, 16); | 1585 | memcpy(hash, saddr, 16); |
1585 | hash[4] = dport; | 1586 | hash[4] = (__force u32)dport; |
1586 | memcpy(&hash[5],keyptr->secret,sizeof(__u32) * 7); | 1587 | memcpy(&hash[5],keyptr->secret,sizeof(__u32) * 7); |
1587 | 1588 | ||
1588 | return twothirdsMD4Transform(daddr, hash); | 1589 | return twothirdsMD4Transform((const __u32 *)daddr, hash); |
1589 | } | 1590 | } |
1590 | #endif | 1591 | #endif |
1591 | 1592 | ||
@@ -1594,17 +1595,17 @@ u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dpo | |||
1594 | * bit's 32-47 increase every key exchange | 1595 | * bit's 32-47 increase every key exchange |
1595 | * 0-31 hash(source, dest) | 1596 | * 0-31 hash(source, dest) |
1596 | */ | 1597 | */ |
1597 | u64 secure_dccp_sequence_number(__u32 saddr, __u32 daddr, | 1598 | u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, |
1598 | __u16 sport, __u16 dport) | 1599 | __be16 sport, __be16 dport) |
1599 | { | 1600 | { |
1600 | struct timeval tv; | 1601 | struct timeval tv; |
1601 | u64 seq; | 1602 | u64 seq; |
1602 | __u32 hash[4]; | 1603 | __u32 hash[4]; |
1603 | struct keydata *keyptr = get_keyptr(); | 1604 | struct keydata *keyptr = get_keyptr(); |
1604 | 1605 | ||
1605 | hash[0] = saddr; | 1606 | hash[0] = (__force u32)saddr; |
1606 | hash[1] = daddr; | 1607 | hash[1] = (__force u32)daddr; |
1607 | hash[2] = (sport << 16) + dport; | 1608 | hash[2] = ((__force u16)sport << 16) + (__force u16)dport; |
1608 | hash[3] = keyptr->secret[11]; | 1609 | hash[3] = keyptr->secret[11]; |
1609 | 1610 | ||
1610 | seq = half_md4_transform(hash, keyptr->secret); | 1611 | seq = half_md4_transform(hash, keyptr->secret); |
@@ -1640,7 +1641,7 @@ unsigned int get_random_int(void) | |||
1640 | * drain on it), and uses halfMD4Transform within the second. We | 1641 | * drain on it), and uses halfMD4Transform within the second. We |
1641 | * also mix it with jiffies and the PID: | 1642 | * also mix it with jiffies and the PID: |
1642 | */ | 1643 | */ |
1643 | return secure_ip_id(current->pid + jiffies); | 1644 | return secure_ip_id((__force __be32)(current->pid + jiffies)); |
1644 | } | 1645 | } |
1645 | 1646 | ||
1646 | /* | 1647 | /* |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 89b718e326e5..3b32313f6eb4 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -127,9 +127,9 @@ raw_ioctl(struct inode *inode, struct file *filp, | |||
127 | 127 | ||
128 | static void bind_device(struct raw_config_request *rq) | 128 | static void bind_device(struct raw_config_request *rq) |
129 | { | 129 | { |
130 | class_device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); | 130 | device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor)); |
131 | class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), | 131 | device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), |
132 | NULL, "raw%d", rq->raw_minor); | 132 | "raw%d", rq->raw_minor); |
133 | } | 133 | } |
134 | 134 | ||
135 | /* | 135 | /* |
@@ -200,7 +200,7 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, | |||
200 | if (rq.block_major == 0 && rq.block_minor == 0) { | 200 | if (rq.block_major == 0 && rq.block_minor == 0) { |
201 | /* unbind */ | 201 | /* unbind */ |
202 | rawdev->binding = NULL; | 202 | rawdev->binding = NULL; |
203 | class_device_destroy(raw_class, | 203 | device_destroy(raw_class, |
204 | MKDEV(RAW_MAJOR, rq.raw_minor)); | 204 | MKDEV(RAW_MAJOR, rq.raw_minor)); |
205 | } else { | 205 | } else { |
206 | rawdev->binding = bdget(dev); | 206 | rawdev->binding = bdget(dev); |
@@ -283,7 +283,7 @@ static int __init raw_init(void) | |||
283 | ret = PTR_ERR(raw_class); | 283 | ret = PTR_ERR(raw_class); |
284 | goto error_region; | 284 | goto error_region; |
285 | } | 285 | } |
286 | class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); | 286 | device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), "rawctl"); |
287 | 287 | ||
288 | return 0; | 288 | return 0; |
289 | 289 | ||
@@ -295,7 +295,7 @@ error: | |||
295 | 295 | ||
296 | static void __exit raw_exit(void) | 296 | static void __exit raw_exit(void) |
297 | { | 297 | { |
298 | class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); | 298 | device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); |
299 | class_destroy(raw_class); | 299 | class_destroy(raw_class); |
300 | cdev_del(&raw_cdev); | 300 | cdev_del(&raw_cdev); |
301 | unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS); | 301 | unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS); |
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h index ee2ddea7a63a..23d0681fe491 100644 --- a/drivers/char/rio/host.h +++ b/drivers/char/rio/host.h | |||
@@ -44,6 +44,7 @@ | |||
44 | ** the host. | 44 | ** the host. |
45 | */ | 45 | */ |
46 | struct Host { | 46 | struct Host { |
47 | struct pci_dev *pdev; | ||
47 | unsigned char Type; /* RIO_EISA, RIO_MCA, ... */ | 48 | unsigned char Type; /* RIO_EISA, RIO_MCA, ... */ |
48 | unsigned char Ivec; /* POLLED or ivec number */ | 49 | unsigned char Ivec; /* POLLED or ivec number */ |
49 | unsigned char Mode; /* Control stuff */ | 50 | unsigned char Mode; /* Control stuff */ |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index c382df0f82f6..7ac68cb3bedd 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -1017,6 +1017,10 @@ static int __init rio_init(void) | |||
1017 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); | 1017 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1018 | 1018 | ||
1019 | fix_rio_pci(pdev); | 1019 | fix_rio_pci(pdev); |
1020 | |||
1021 | p->RIOHosts[p->RIONumHosts].pdev = pdev; | ||
1022 | pci_dev_get(pdev); | ||
1023 | |||
1020 | p->RIOLastPCISearch = 0; | 1024 | p->RIOLastPCISearch = 0; |
1021 | p->RIONumHosts++; | 1025 | p->RIONumHosts++; |
1022 | found++; | 1026 | found++; |
@@ -1066,6 +1070,9 @@ static int __init rio_init(void) | |||
1066 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); | 1070 | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); |
1067 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); | 1071 | rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); |
1068 | 1072 | ||
1073 | p->RIOHosts[p->RIONumHosts].pdev = pdev; | ||
1074 | pci_dev_get(pdev); | ||
1075 | |||
1069 | p->RIOLastPCISearch = 0; | 1076 | p->RIOLastPCISearch = 0; |
1070 | p->RIONumHosts++; | 1077 | p->RIONumHosts++; |
1071 | found++; | 1078 | found++; |
@@ -1181,6 +1188,8 @@ static void __exit rio_exit(void) | |||
1181 | } | 1188 | } |
1182 | /* It is safe/allowed to del_timer a non-active timer */ | 1189 | /* It is safe/allowed to del_timer a non-active timer */ |
1183 | del_timer(&hp->timer); | 1190 | del_timer(&hp->timer); |
1191 | if (hp->Type == RIO_PCI) | ||
1192 | pci_dev_put(hp->pdev); | ||
1184 | } | 1193 | } |
1185 | 1194 | ||
1186 | if (misc_deregister(&rio_fw_device) < 0) { | 1195 | if (misc_deregister(&rio_fw_device) < 0) { |
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 4df6ab2206a1..167ebc84e8d7 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -922,7 +922,7 @@ int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP) | |||
922 | ** | 922 | ** |
923 | ** Packet is an actual packet structure to be filled in with the packet | 923 | ** Packet is an actual packet structure to be filled in with the packet |
924 | ** information associated with the command. You need to fill in everything, | 924 | ** information associated with the command. You need to fill in everything, |
925 | ** as the command processore doesn't process the command packet in any way. | 925 | ** as the command processor doesn't process the command packet in any way. |
926 | ** | 926 | ** |
927 | ** The PreFuncP is called before the packet is enqueued on the host rup. | 927 | ** The PreFuncP is called before the packet is enqueued on the host rup. |
928 | ** PreFuncP is called as (*PreFuncP)(PreArg, CmdBlkP);. PreFuncP must | 928 | ** PreFuncP is called as (*PreFuncP)(PreArg, CmdBlkP);. PreFuncP must |
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index 052e8120a471..7ce77619707c 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -662,7 +662,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su | |||
662 | p->RIOError.Error = COPYIN_FAILED; | 662 | p->RIOError.Error = COPYIN_FAILED; |
663 | return -EFAULT; | 663 | return -EFAULT; |
664 | } | 664 | } |
665 | if (portStats.port >= RIO_PORTS) { | 665 | if (portStats.port < 0 || portStats.port >= RIO_PORTS) { |
666 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 666 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
667 | return -ENXIO; | 667 | return -ENXIO; |
668 | } | 668 | } |
@@ -702,7 +702,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su | |||
702 | p->RIOError.Error = COPYIN_FAILED; | 702 | p->RIOError.Error = COPYIN_FAILED; |
703 | return -EFAULT; | 703 | return -EFAULT; |
704 | } | 704 | } |
705 | if (portStats.port >= RIO_PORTS) { | 705 | if (portStats.port < 0 || portStats.port >= RIO_PORTS) { |
706 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 706 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
707 | return -ENXIO; | 707 | return -ENXIO; |
708 | } | 708 | } |
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 99f3df02b61c..0794844369d6 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c | |||
@@ -222,7 +222,7 @@ int RIOBoardTest(unsigned long paddr, void __iomem *caddr, unsigned char type, i | |||
222 | ** which value will be written into memory. | 222 | ** which value will be written into memory. |
223 | ** Call with op set to zero means that the RAM will not be read and checked | 223 | ** Call with op set to zero means that the RAM will not be read and checked |
224 | ** before it is written. | 224 | ** before it is written. |
225 | ** Call with op not zero, and the RAM will be read and compated with val[op-1] | 225 | ** Call with op not zero and the RAM will be read and compared with val[op-1] |
226 | ** to check that the data from the previous phase was retained. | 226 | ** to check that the data from the previous phase was retained. |
227 | */ | 227 | */ |
228 | 228 | ||
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index 1066d9760704..bb498d24adcc 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c | |||
@@ -87,8 +87,8 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; | |||
87 | ** command bit set onto the port. The command bit is in the len field, | 87 | ** command bit set onto the port. The command bit is in the len field, |
88 | ** and gets ORed in with the actual byte count. | 88 | ** and gets ORed in with the actual byte count. |
89 | ** | 89 | ** |
90 | ** When you send a packet with the command bit set, then the first | 90 | ** When you send a packet with the command bit set the first |
91 | ** data byte ( data[0] ) is interpretted as the command to execute. | 91 | ** data byte (data[0]) is interpreted as the command to execute. |
92 | ** It also governs what data structure overlay should accompany the packet. | 92 | ** It also governs what data structure overlay should accompany the packet. |
93 | ** Commands are defined in cirrus/cirrus.h | 93 | ** Commands are defined in cirrus/cirrus.h |
94 | ** | 94 | ** |
@@ -103,7 +103,7 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; | |||
103 | ** | 103 | ** |
104 | ** Most commands do not use the remaining bytes in the data array. The | 104 | ** Most commands do not use the remaining bytes in the data array. The |
105 | ** exceptions are OPEN MOPEN and CONFIG. (NB. As with the SI CONFIG and | 105 | ** exceptions are OPEN MOPEN and CONFIG. (NB. As with the SI CONFIG and |
106 | ** OPEN are currently analagous). With these three commands the following | 106 | ** OPEN are currently analogous). With these three commands the following |
107 | ** 11 data bytes are all used to pass config information such as baud rate etc. | 107 | ** 11 data bytes are all used to pass config information such as baud rate etc. |
108 | ** The fields are also defined in cirrus.h. Some contain straightforward | 108 | ** The fields are also defined in cirrus.h. Some contain straightforward |
109 | ** information such as the transmit XON character. Two contain the transmit and | 109 | ** information such as the transmit XON character. Two contain the transmit and |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index d0b88d0e87fd..7e1bd9562c2a 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -183,11 +183,6 @@ static int sx_poll = HZ; | |||
183 | 183 | ||
184 | static struct tty_driver *specialix_driver; | 184 | static struct tty_driver *specialix_driver; |
185 | 185 | ||
186 | static unsigned long baud_table[] = { | ||
187 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, | ||
188 | 9600, 19200, 38400, 57600, 115200, 0, | ||
189 | }; | ||
190 | |||
191 | static struct specialix_board sx_board[SX_NBOARD] = { | 186 | static struct specialix_board sx_board[SX_NBOARD] = { |
192 | { 0, SX_IOBASE1, 9, }, | 187 | { 0, SX_IOBASE1, 9, }, |
193 | { 0, SX_IOBASE2, 11, }, | 188 | { 0, SX_IOBASE2, 11, }, |
@@ -1090,9 +1085,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1090 | 1085 | ||
1091 | if (baud == 38400) { | 1086 | if (baud == 38400) { |
1092 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 1087 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
1093 | baud ++; | 1088 | baud = 57600; |
1094 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 1089 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
1095 | baud += 2; | 1090 | baud = 115200; |
1096 | } | 1091 | } |
1097 | 1092 | ||
1098 | if (!baud) { | 1093 | if (!baud) { |
@@ -1150,11 +1145,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p | |||
1150 | sx_out(bp, CD186x_RBPRL, tmp & 0xff); | 1145 | sx_out(bp, CD186x_RBPRL, tmp & 0xff); |
1151 | sx_out(bp, CD186x_TBPRL, tmp & 0xff); | 1146 | sx_out(bp, CD186x_TBPRL, tmp & 0xff); |
1152 | spin_unlock_irqrestore(&bp->lock, flags); | 1147 | spin_unlock_irqrestore(&bp->lock, flags); |
1153 | if (port->custom_divisor) { | 1148 | if (port->custom_divisor) |
1154 | baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor; | 1149 | baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor; |
1155 | baud = ( baud + 5 ) / 10; | 1150 | baud = (baud + 5) / 10; /* Estimated CPS */ |
1156 | } else | ||
1157 | baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */ | ||
1158 | 1151 | ||
1159 | /* Two timer ticks seems enough to wakeup something like SLIP driver */ | 1152 | /* Two timer ticks seems enough to wakeup something like SLIP driver */ |
1160 | tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO; | 1153 | tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO; |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 5fec626598cd..cc10af08cb05 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -2602,7 +2602,7 @@ static void __exit sx_exit (void) | |||
2602 | } | 2602 | } |
2603 | } | 2603 | } |
2604 | if (misc_deregister(&sx_fw_device) < 0) { | 2604 | if (misc_deregister(&sx_fw_device) < 0) { |
2605 | printk (KERN_INFO "sx: couldn't deregister firmware loader devic\n"); | 2605 | printk (KERN_INFO "sx: couldn't deregister firmware loader device\n"); |
2606 | } | 2606 | } |
2607 | sx_dprintk (SX_DEBUG_CLEANUP, "Cleaning up drivers (%d)\n", sx_initialized); | 2607 | sx_dprintk (SX_DEBUG_CLEANUP, "Cleaning up drivers (%d)\n", sx_initialized); |
2608 | if (sx_initialized) | 2608 | if (sx_initialized) |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index f2864cc64240..06784adcc35c 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -133,8 +133,8 @@ static MGSL_PARAMS default_params = { | |||
133 | }; | 133 | }; |
134 | 134 | ||
135 | #define SHARED_MEM_ADDRESS_SIZE 0x40000 | 135 | #define SHARED_MEM_ADDRESS_SIZE 0x40000 |
136 | #define BUFFERLISTSIZE (PAGE_SIZE) | 136 | #define BUFFERLISTSIZE 4096 |
137 | #define DMABUFFERSIZE (PAGE_SIZE) | 137 | #define DMABUFFERSIZE 4096 |
138 | #define MAXRXFRAMES 7 | 138 | #define MAXRXFRAMES 7 |
139 | 139 | ||
140 | typedef struct _DMABUFFERENTRY | 140 | typedef struct _DMABUFFERENTRY |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 2444a0e24b31..244d30a03fef 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
@@ -792,15 +792,14 @@ static int __init tlclk_init(void) | |||
792 | ret = misc_register(&tlclk_miscdev); | 792 | ret = misc_register(&tlclk_miscdev); |
793 | if (ret < 0) { | 793 | if (ret < 0) { |
794 | printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret); | 794 | printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret); |
795 | ret = -EBUSY; | ||
796 | goto out3; | 795 | goto out3; |
797 | } | 796 | } |
798 | 797 | ||
799 | tlclk_device = platform_device_register_simple("telco_clock", | 798 | tlclk_device = platform_device_register_simple("telco_clock", |
800 | -1, NULL, 0); | 799 | -1, NULL, 0); |
801 | if (!tlclk_device) { | 800 | if (IS_ERR(tlclk_device)) { |
802 | printk(KERN_ERR "tlclk: platform_device_register failed.\n"); | 801 | printk(KERN_ERR "tlclk: platform_device_register failed.\n"); |
803 | ret = -EBUSY; | 802 | ret = PTR_ERR(tlclk_device); |
804 | goto out4; | 803 | goto out4; |
805 | } | 804 | } |
806 | 805 | ||
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 6ad2d3bb945c..6e1329d404d2 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -1130,7 +1130,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend | |||
1130 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); | 1130 | scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); |
1131 | chip->vendor.miscdev.name = devname; | 1131 | chip->vendor.miscdev.name = devname; |
1132 | 1132 | ||
1133 | chip->vendor.miscdev.dev = dev; | 1133 | chip->vendor.miscdev.parent = dev; |
1134 | chip->dev = get_device(dev); | 1134 | chip->dev = get_device(dev); |
1135 | 1135 | ||
1136 | if (misc_register(&chip->vendor.miscdev)) { | 1136 | if (misc_register(&chip->vendor.miscdev)) { |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index e90ea39c7c4b..50dc49205a23 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -3612,7 +3612,8 @@ static struct class *tty_class; | |||
3612 | * This field is optional, if there is no known struct device | 3612 | * This field is optional, if there is no known struct device |
3613 | * for this tty device it can be set to NULL safely. | 3613 | * for this tty device it can be set to NULL safely. |
3614 | * | 3614 | * |
3615 | * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). | 3615 | * Returns a pointer to the struct device for this tty device |
3616 | * (or ERR_PTR(-EFOO) on error). | ||
3616 | * | 3617 | * |
3617 | * This call is required to be made to register an individual tty device | 3618 | * This call is required to be made to register an individual tty device |
3618 | * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If | 3619 | * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If |
@@ -3622,8 +3623,8 @@ static struct class *tty_class; | |||
3622 | * Locking: ?? | 3623 | * Locking: ?? |
3623 | */ | 3624 | */ |
3624 | 3625 | ||
3625 | struct class_device *tty_register_device(struct tty_driver *driver, | 3626 | struct device *tty_register_device(struct tty_driver *driver, unsigned index, |
3626 | unsigned index, struct device *device) | 3627 | struct device *device) |
3627 | { | 3628 | { |
3628 | char name[64]; | 3629 | char name[64]; |
3629 | dev_t dev = MKDEV(driver->major, driver->minor_start) + index; | 3630 | dev_t dev = MKDEV(driver->major, driver->minor_start) + index; |
@@ -3639,7 +3640,7 @@ struct class_device *tty_register_device(struct tty_driver *driver, | |||
3639 | else | 3640 | else |
3640 | tty_line_name(driver, index, name); | 3641 | tty_line_name(driver, index, name); |
3641 | 3642 | ||
3642 | return class_device_create(tty_class, NULL, dev, device, "%s", name); | 3643 | return device_create(tty_class, device, dev, name); |
3643 | } | 3644 | } |
3644 | 3645 | ||
3645 | /** | 3646 | /** |
@@ -3655,7 +3656,7 @@ struct class_device *tty_register_device(struct tty_driver *driver, | |||
3655 | 3656 | ||
3656 | void tty_unregister_device(struct tty_driver *driver, unsigned index) | 3657 | void tty_unregister_device(struct tty_driver *driver, unsigned index) |
3657 | { | 3658 | { |
3658 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); | 3659 | device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); |
3659 | } | 3660 | } |
3660 | 3661 | ||
3661 | EXPORT_SYMBOL(tty_register_device); | 3662 | EXPORT_SYMBOL(tty_register_device); |
@@ -3895,20 +3896,20 @@ static int __init tty_init(void) | |||
3895 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || | 3896 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || |
3896 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) | 3897 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) |
3897 | panic("Couldn't register /dev/tty driver\n"); | 3898 | panic("Couldn't register /dev/tty driver\n"); |
3898 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); | 3899 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), "tty"); |
3899 | 3900 | ||
3900 | cdev_init(&console_cdev, &console_fops); | 3901 | cdev_init(&console_cdev, &console_fops); |
3901 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || | 3902 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || |
3902 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) | 3903 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) |
3903 | panic("Couldn't register /dev/console driver\n"); | 3904 | panic("Couldn't register /dev/console driver\n"); |
3904 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); | 3905 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), "console"); |
3905 | 3906 | ||
3906 | #ifdef CONFIG_UNIX98_PTYS | 3907 | #ifdef CONFIG_UNIX98_PTYS |
3907 | cdev_init(&ptmx_cdev, &ptmx_fops); | 3908 | cdev_init(&ptmx_cdev, &ptmx_fops); |
3908 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || | 3909 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || |
3909 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) | 3910 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) |
3910 | panic("Couldn't register /dev/ptmx driver\n"); | 3911 | panic("Couldn't register /dev/ptmx driver\n"); |
3911 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); | 3912 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), "ptmx"); |
3912 | #endif | 3913 | #endif |
3913 | 3914 | ||
3914 | #ifdef CONFIG_VT | 3915 | #ifdef CONFIG_VT |
@@ -3916,7 +3917,7 @@ static int __init tty_init(void) | |||
3916 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || | 3917 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || |
3917 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) | 3918 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) |
3918 | panic("Couldn't register /dev/tty0 driver\n"); | 3919 | panic("Couldn't register /dev/tty0 driver\n"); |
3919 | class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); | 3920 | device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), "tty0"); |
3920 | 3921 | ||
3921 | vty_init(); | 3922 | vty_init(); |
3922 | #endif | 3923 | #endif |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index bd7a98c6ea7a..f442b574b44a 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
@@ -476,16 +476,16 @@ static struct class *vc_class; | |||
476 | 476 | ||
477 | void vcs_make_sysfs(struct tty_struct *tty) | 477 | void vcs_make_sysfs(struct tty_struct *tty) |
478 | { | 478 | { |
479 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), | 479 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), |
480 | NULL, "vcs%u", tty->index + 1); | 480 | "vcs%u", tty->index + 1); |
481 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), | 481 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), |
482 | NULL, "vcsa%u", tty->index + 1); | 482 | "vcsa%u", tty->index + 1); |
483 | } | 483 | } |
484 | 484 | ||
485 | void vcs_remove_sysfs(struct tty_struct *tty) | 485 | void vcs_remove_sysfs(struct tty_struct *tty) |
486 | { | 486 | { |
487 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); | 487 | device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); |
488 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); | 488 | device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); |
489 | } | 489 | } |
490 | 490 | ||
491 | int __init vcs_init(void) | 491 | int __init vcs_init(void) |
@@ -494,7 +494,7 @@ int __init vcs_init(void) | |||
494 | panic("unable to get major %d for vcs device", VCS_MAJOR); | 494 | panic("unable to get major %d for vcs device", VCS_MAJOR); |
495 | vc_class = class_create(THIS_MODULE, "vc"); | 495 | vc_class = class_create(THIS_MODULE, "vc"); |
496 | 496 | ||
497 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); | 497 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), "vcs"); |
498 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); | 498 | device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), "vcsa"); |
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 8e4413f6fbaf..87587b4385ab 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -112,7 +112,7 @@ | |||
112 | struct con_driver { | 112 | struct con_driver { |
113 | const struct consw *con; | 113 | const struct consw *con; |
114 | const char *desc; | 114 | const char *desc; |
115 | struct class_device *class_dev; | 115 | struct device *dev; |
116 | int node; | 116 | int node; |
117 | int first; | 117 | int first; |
118 | int last; | 118 | int last; |
@@ -3023,10 +3023,10 @@ static inline int vt_unbind(struct con_driver *con) | |||
3023 | } | 3023 | } |
3024 | #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ | 3024 | #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ |
3025 | 3025 | ||
3026 | static ssize_t store_bind(struct class_device *class_device, | 3026 | static ssize_t store_bind(struct device *dev, struct device_attribute *attr, |
3027 | const char *buf, size_t count) | 3027 | const char *buf, size_t count) |
3028 | { | 3028 | { |
3029 | struct con_driver *con = class_get_devdata(class_device); | 3029 | struct con_driver *con = dev_get_drvdata(dev); |
3030 | int bind = simple_strtoul(buf, NULL, 0); | 3030 | int bind = simple_strtoul(buf, NULL, 0); |
3031 | 3031 | ||
3032 | if (bind) | 3032 | if (bind) |
@@ -3037,17 +3037,19 @@ static ssize_t store_bind(struct class_device *class_device, | |||
3037 | return count; | 3037 | return count; |
3038 | } | 3038 | } |
3039 | 3039 | ||
3040 | static ssize_t show_bind(struct class_device *class_device, char *buf) | 3040 | static ssize_t show_bind(struct device *dev, struct device_attribute *attr, |
3041 | char *buf) | ||
3041 | { | 3042 | { |
3042 | struct con_driver *con = class_get_devdata(class_device); | 3043 | struct con_driver *con = dev_get_drvdata(dev); |
3043 | int bind = con_is_bound(con->con); | 3044 | int bind = con_is_bound(con->con); |
3044 | 3045 | ||
3045 | return snprintf(buf, PAGE_SIZE, "%i\n", bind); | 3046 | return snprintf(buf, PAGE_SIZE, "%i\n", bind); |
3046 | } | 3047 | } |
3047 | 3048 | ||
3048 | static ssize_t show_name(struct class_device *class_device, char *buf) | 3049 | static ssize_t show_name(struct device *dev, struct device_attribute *attr, |
3050 | char *buf) | ||
3049 | { | 3051 | { |
3050 | struct con_driver *con = class_get_devdata(class_device); | 3052 | struct con_driver *con = dev_get_drvdata(dev); |
3051 | 3053 | ||
3052 | return snprintf(buf, PAGE_SIZE, "%s %s\n", | 3054 | return snprintf(buf, PAGE_SIZE, "%s %s\n", |
3053 | (con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)", | 3055 | (con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)", |
@@ -3055,43 +3057,40 @@ static ssize_t show_name(struct class_device *class_device, char *buf) | |||
3055 | 3057 | ||
3056 | } | 3058 | } |
3057 | 3059 | ||
3058 | static struct class_device_attribute class_device_attrs[] = { | 3060 | static struct device_attribute device_attrs[] = { |
3059 | __ATTR(bind, S_IRUGO|S_IWUSR, show_bind, store_bind), | 3061 | __ATTR(bind, S_IRUGO|S_IWUSR, show_bind, store_bind), |
3060 | __ATTR(name, S_IRUGO, show_name, NULL), | 3062 | __ATTR(name, S_IRUGO, show_name, NULL), |
3061 | }; | 3063 | }; |
3062 | 3064 | ||
3063 | static int vtconsole_init_class_device(struct con_driver *con) | 3065 | static int vtconsole_init_device(struct con_driver *con) |
3064 | { | 3066 | { |
3065 | int i; | 3067 | int i; |
3066 | int error = 0; | 3068 | int error = 0; |
3067 | 3069 | ||
3068 | con->flag |= CON_DRIVER_FLAG_ATTR; | 3070 | con->flag |= CON_DRIVER_FLAG_ATTR; |
3069 | class_set_devdata(con->class_dev, con); | 3071 | dev_set_drvdata(con->dev, con); |
3070 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) { | 3072 | for (i = 0; i < ARRAY_SIZE(device_attrs); i++) { |
3071 | error = class_device_create_file(con->class_dev, | 3073 | error = device_create_file(con->dev, &device_attrs[i]); |
3072 | &class_device_attrs[i]); | ||
3073 | if (error) | 3074 | if (error) |
3074 | break; | 3075 | break; |
3075 | } | 3076 | } |
3076 | 3077 | ||
3077 | if (error) { | 3078 | if (error) { |
3078 | while (--i >= 0) | 3079 | while (--i >= 0) |
3079 | class_device_remove_file(con->class_dev, | 3080 | device_remove_file(con->dev, &device_attrs[i]); |
3080 | &class_device_attrs[i]); | ||
3081 | con->flag &= ~CON_DRIVER_FLAG_ATTR; | 3081 | con->flag &= ~CON_DRIVER_FLAG_ATTR; |
3082 | } | 3082 | } |
3083 | 3083 | ||
3084 | return error; | 3084 | return error; |
3085 | } | 3085 | } |
3086 | 3086 | ||
3087 | static void vtconsole_deinit_class_device(struct con_driver *con) | 3087 | static void vtconsole_deinit_device(struct con_driver *con) |
3088 | { | 3088 | { |
3089 | int i; | 3089 | int i; |
3090 | 3090 | ||
3091 | if (con->flag & CON_DRIVER_FLAG_ATTR) { | 3091 | if (con->flag & CON_DRIVER_FLAG_ATTR) { |
3092 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) | 3092 | for (i = 0; i < ARRAY_SIZE(device_attrs); i++) |
3093 | class_device_remove_file(con->class_dev, | 3093 | device_remove_file(con->dev, &device_attrs[i]); |
3094 | &class_device_attrs[i]); | ||
3095 | con->flag &= ~CON_DRIVER_FLAG_ATTR; | 3094 | con->flag &= ~CON_DRIVER_FLAG_ATTR; |
3096 | } | 3095 | } |
3097 | } | 3096 | } |
@@ -3179,18 +3178,17 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3179 | if (retval) | 3178 | if (retval) |
3180 | goto err; | 3179 | goto err; |
3181 | 3180 | ||
3182 | con_driver->class_dev = class_device_create(vtconsole_class, NULL, | 3181 | con_driver->dev = device_create(vtconsole_class, NULL, |
3183 | MKDEV(0, con_driver->node), | 3182 | MKDEV(0, con_driver->node), |
3184 | NULL, "vtcon%i", | 3183 | "vtcon%i", con_driver->node); |
3185 | con_driver->node); | ||
3186 | 3184 | ||
3187 | if (IS_ERR(con_driver->class_dev)) { | 3185 | if (IS_ERR(con_driver->dev)) { |
3188 | printk(KERN_WARNING "Unable to create class_device for %s; " | 3186 | printk(KERN_WARNING "Unable to create device for %s; " |
3189 | "errno = %ld\n", con_driver->desc, | 3187 | "errno = %ld\n", con_driver->desc, |
3190 | PTR_ERR(con_driver->class_dev)); | 3188 | PTR_ERR(con_driver->dev)); |
3191 | con_driver->class_dev = NULL; | 3189 | con_driver->dev = NULL; |
3192 | } else { | 3190 | } else { |
3193 | vtconsole_init_class_device(con_driver); | 3191 | vtconsole_init_device(con_driver); |
3194 | } | 3192 | } |
3195 | 3193 | ||
3196 | err: | 3194 | err: |
@@ -3226,12 +3224,12 @@ int unregister_con_driver(const struct consw *csw) | |||
3226 | 3224 | ||
3227 | if (con_driver->con == csw && | 3225 | if (con_driver->con == csw && |
3228 | con_driver->flag & CON_DRIVER_FLAG_MODULE) { | 3226 | con_driver->flag & CON_DRIVER_FLAG_MODULE) { |
3229 | vtconsole_deinit_class_device(con_driver); | 3227 | vtconsole_deinit_device(con_driver); |
3230 | class_device_destroy(vtconsole_class, | 3228 | device_destroy(vtconsole_class, |
3231 | MKDEV(0, con_driver->node)); | 3229 | MKDEV(0, con_driver->node)); |
3232 | con_driver->con = NULL; | 3230 | con_driver->con = NULL; |
3233 | con_driver->desc = NULL; | 3231 | con_driver->desc = NULL; |
3234 | con_driver->class_dev = NULL; | 3232 | con_driver->dev = NULL; |
3235 | con_driver->node = 0; | 3233 | con_driver->node = 0; |
3236 | con_driver->flag = 0; | 3234 | con_driver->flag = 0; |
3237 | con_driver->first = 0; | 3235 | con_driver->first = 0; |
@@ -3289,19 +3287,18 @@ static int __init vtconsole_class_init(void) | |||
3289 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3287 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3290 | struct con_driver *con = ®istered_con_driver[i]; | 3288 | struct con_driver *con = ®istered_con_driver[i]; |
3291 | 3289 | ||
3292 | if (con->con && !con->class_dev) { | 3290 | if (con->con && !con->dev) { |
3293 | con->class_dev = | 3291 | con->dev = device_create(vtconsole_class, NULL, |
3294 | class_device_create(vtconsole_class, NULL, | 3292 | MKDEV(0, con->node), |
3295 | MKDEV(0, con->node), NULL, | 3293 | "vtcon%i", con->node); |
3296 | "vtcon%i", con->node); | ||
3297 | 3294 | ||
3298 | if (IS_ERR(con->class_dev)) { | 3295 | if (IS_ERR(con->dev)) { |
3299 | printk(KERN_WARNING "Unable to create " | 3296 | printk(KERN_WARNING "Unable to create " |
3300 | "class_device for %s; errno = %ld\n", | 3297 | "device for %s; errno = %ld\n", |
3301 | con->desc, PTR_ERR(con->class_dev)); | 3298 | con->desc, PTR_ERR(con->dev)); |
3302 | con->class_dev = NULL; | 3299 | con->dev = NULL; |
3303 | } else { | 3300 | } else { |
3304 | vtconsole_init_class_device(con); | 3301 | vtconsole_init_device(con); |
3305 | } | 3302 | } |
3306 | } | 3303 | } |
3307 | } | 3304 | } |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index 89e46d6dfc4e..ea09d0c974ea 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -13,7 +13,7 @@ config WATCHDOG | |||
13 | subsequently opening the file and then failing to write to it for | 13 | subsequently opening the file and then failing to write to it for |
14 | longer than 1 minute will result in rebooting the machine. This | 14 | longer than 1 minute will result in rebooting the machine. This |
15 | could be useful for a networked machine that needs to come back | 15 | could be useful for a networked machine that needs to come back |
16 | online as fast as possible after a lock-up. There's both a watchdog | 16 | on-line as fast as possible after a lock-up. There's both a watchdog |
17 | implementation entirely in software (which can sometimes fail to | 17 | implementation entirely in software (which can sometimes fail to |
18 | reboot the machine) and a driver for hardware watchdog boards, which | 18 | reboot the machine) and a driver for hardware watchdog boards, which |
19 | are more robust and can also keep track of the temperature inside | 19 | are more robust and can also keep track of the temperature inside |
@@ -60,7 +60,7 @@ config SOFT_WATCHDOG | |||
60 | 60 | ||
61 | # ARM Architecture | 61 | # ARM Architecture |
62 | 62 | ||
63 | config AT91_WATCHDOG | 63 | config AT91RM9200_WATCHDOG |
64 | tristate "AT91RM9200 watchdog" | 64 | tristate "AT91RM9200 watchdog" |
65 | depends on WATCHDOG && ARCH_AT91RM9200 | 65 | depends on WATCHDOG && ARCH_AT91RM9200 |
66 | help | 66 | help |
@@ -71,7 +71,7 @@ config 21285_WATCHDOG | |||
71 | tristate "DC21285 watchdog" | 71 | tristate "DC21285 watchdog" |
72 | depends on WATCHDOG && FOOTBRIDGE | 72 | depends on WATCHDOG && FOOTBRIDGE |
73 | help | 73 | help |
74 | The Intel Footbridge chip contains a builtin watchdog circuit. Say Y | 74 | The Intel Footbridge chip contains a built-in watchdog circuit. Say Y |
75 | here if you wish to use this. Alternatively say M to compile the | 75 | here if you wish to use this. Alternatively say M to compile the |
76 | driver as a module, which will be called wdt285. | 76 | driver as a module, which will be called wdt285. |
77 | 77 | ||
@@ -269,11 +269,11 @@ config IB700_WDT | |||
269 | Most people will say N. | 269 | Most people will say N. |
270 | 270 | ||
271 | config IBMASR | 271 | config IBMASR |
272 | tristate "IBM Automatic Server Restart" | 272 | tristate "IBM Automatic Server Restart" |
273 | depends on WATCHDOG && X86 | 273 | depends on WATCHDOG && X86 |
274 | help | 274 | help |
275 | This is the driver for the IBM Automatic Server Restart watchdog | 275 | This is the driver for the IBM Automatic Server Restart watchdog |
276 | timer builtin into some eServer xSeries machines. | 276 | timer built-in into some eServer xSeries machines. |
277 | 277 | ||
278 | To compile this driver as a module, choose M here: the | 278 | To compile this driver as a module, choose M here: the |
279 | module will be called ibmasr. | 279 | module will be called ibmasr. |
@@ -316,13 +316,16 @@ config I8XX_TCO | |||
316 | To compile this driver as a module, choose M here: the | 316 | To compile this driver as a module, choose M here: the |
317 | module will be called i8xx_tco. | 317 | module will be called i8xx_tco. |
318 | 318 | ||
319 | Note: This driver will be removed in the near future. Please | ||
320 | use the Intel TCO Timer/Watchdog driver. | ||
321 | |||
319 | config ITCO_WDT | 322 | config ITCO_WDT |
320 | tristate "Intel TCO Timer/Watchdog (EXPERIMENTAL)" | 323 | tristate "Intel TCO Timer/Watchdog" |
321 | depends on WATCHDOG && (X86 || IA64) && PCI && EXPERIMENTAL | 324 | depends on WATCHDOG && (X86 || IA64) && PCI |
322 | ---help--- | 325 | ---help--- |
323 | Hardware driver for the intel TCO timer based watchdog devices. | 326 | Hardware driver for the intel TCO timer based watchdog devices. |
324 | These drivers are included in the Intel 82801 I/O Controller | 327 | These drivers are included in the Intel 82801 I/O Controller |
325 | Hub family 'from ICH0 up to ICH7) and in the Intel 6300ESB | 328 | Hub family (from ICH0 up to ICH8) and in the Intel 6300ESB |
326 | controller hub. | 329 | controller hub. |
327 | 330 | ||
328 | The TCO (Total Cost of Ownership) timer is a watchdog timer | 331 | The TCO (Total Cost of Ownership) timer is a watchdog timer |
@@ -337,6 +340,14 @@ config ITCO_WDT | |||
337 | To compile this driver as a module, choose M here: the | 340 | To compile this driver as a module, choose M here: the |
338 | module will be called iTCO_wdt. | 341 | module will be called iTCO_wdt. |
339 | 342 | ||
343 | config ITCO_VENDOR_SUPPORT | ||
344 | bool "Intel TCO Timer/Watchdog Specific Vendor Support" | ||
345 | depends on ITCO_WDT | ||
346 | ---help--- | ||
347 | Add vendor specific support to the intel TCO timer based watchdog | ||
348 | devices. At this moment we only have additional support for some | ||
349 | SuperMicro Inc. motherboards. | ||
350 | |||
340 | config SC1200_WDT | 351 | config SC1200_WDT |
341 | tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" | 352 | tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" |
342 | depends on WATCHDOG && X86 | 353 | depends on WATCHDOG && X86 |
@@ -360,6 +371,20 @@ config SCx200_WDT | |||
360 | 371 | ||
361 | If compiled as a module, it will be called scx200_wdt. | 372 | If compiled as a module, it will be called scx200_wdt. |
362 | 373 | ||
374 | config PC87413_WDT | ||
375 | tristate "NS PC87413 watchdog" | ||
376 | depends on WATCHDOG && X86 | ||
377 | ---help--- | ||
378 | This is the driver for the hardware watchdog on the PC87413 chipset | ||
379 | This watchdog simply watches your kernel to make sure it doesn't | ||
380 | freeze, and if it does, it reboots your computer after a certain | ||
381 | amount of time. | ||
382 | |||
383 | To compile this driver as a module, choose M here: the | ||
384 | module will be called pc87413_wdt. | ||
385 | |||
386 | Most people will say N. | ||
387 | |||
363 | config 60XX_WDT | 388 | config 60XX_WDT |
364 | tristate "SBC-60XX Watchdog Timer" | 389 | tristate "SBC-60XX Watchdog Timer" |
365 | depends on WATCHDOG && X86 | 390 | depends on WATCHDOG && X86 |
@@ -395,6 +420,26 @@ config CPU5_WDT | |||
395 | To compile this driver as a module, choose M here: the | 420 | To compile this driver as a module, choose M here: the |
396 | module will be called cpu5wdt. | 421 | module will be called cpu5wdt. |
397 | 422 | ||
423 | config SMSC37B787_WDT | ||
424 | tristate "Winbond SMsC37B787 Watchdog Timer" | ||
425 | depends on WATCHDOG && X86 | ||
426 | ---help--- | ||
427 | This is the driver for the hardware watchdog component on the | ||
428 | Winbond SMsC37B787 chipset as used on the NetRunner Mainboard | ||
429 | from Vision Systems and maybe others. | ||
430 | |||
431 | This watchdog simply watches your kernel to make sure it doesn't | ||
432 | freeze, and if it does, it reboots your computer after a certain | ||
433 | amount of time. | ||
434 | |||
435 | Usually a userspace daemon will notify the kernel WDT driver that | ||
436 | userspace is still alive, at regular intervals. | ||
437 | |||
438 | To compile this driver as a module, choose M here: the | ||
439 | module will be called smsc37b787_wdt. | ||
440 | |||
441 | Most people will say N. | ||
442 | |||
398 | config W83627HF_WDT | 443 | config W83627HF_WDT |
399 | tristate "W83627HF Watchdog Timer" | 444 | tristate "W83627HF Watchdog Timer" |
400 | depends on WATCHDOG && X86 | 445 | depends on WATCHDOG && X86 |
@@ -410,6 +455,21 @@ config W83627HF_WDT | |||
410 | 455 | ||
411 | Most people will say N. | 456 | Most people will say N. |
412 | 457 | ||
458 | config W83697HF_WDT | ||
459 | tristate "W83697HF/W83697HG Watchdog Timer" | ||
460 | depends on WATCHDOG && X86 | ||
461 | ---help--- | ||
462 | This is the driver for the hardware watchdog on the W83697HF/HG | ||
463 | chipset as used in Dedibox/VIA motherboards (and likely others). | ||
464 | This watchdog simply watches your kernel to make sure it doesn't | ||
465 | freeze, and if it does, it reboots your computer after a certain | ||
466 | amount of time. | ||
467 | |||
468 | To compile this driver as a module, choose M here: the | ||
469 | module will be called w83697hf_wdt. | ||
470 | |||
471 | Most people will say N. | ||
472 | |||
413 | config W83877F_WDT | 473 | config W83877F_WDT |
414 | tristate "W83877F (EMACS) Watchdog Timer" | 474 | tristate "W83877F (EMACS) Watchdog Timer" |
415 | depends on WATCHDOG && X86 | 475 | depends on WATCHDOG && X86 |
@@ -443,7 +503,7 @@ config MACHZ_WDT | |||
443 | depends on WATCHDOG && X86 | 503 | depends on WATCHDOG && X86 |
444 | ---help--- | 504 | ---help--- |
445 | If you are using a ZF Micro MachZ processor, say Y here, otherwise | 505 | If you are using a ZF Micro MachZ processor, say Y here, otherwise |
446 | N. This is the driver for the watchdog timer builtin on that | 506 | N. This is the driver for the watchdog timer built-in on that |
447 | processor using ZF-Logic interface. This watchdog simply watches | 507 | processor using ZF-Logic interface. This watchdog simply watches |
448 | your kernel to make sure it doesn't freeze, and if it does, it | 508 | your kernel to make sure it doesn't freeze, and if it does, it |
449 | reboots your computer after a certain amount of time. | 509 | reboots your computer after a certain amount of time. |
@@ -472,7 +532,6 @@ config SBC_EPX_C3_WATCHDOG | |||
472 | To compile this driver as a module, choose M here: the | 532 | To compile this driver as a module, choose M here: the |
473 | module will be called sbc_epx_c3. | 533 | module will be called sbc_epx_c3. |
474 | 534 | ||
475 | |||
476 | # PowerPC Architecture | 535 | # PowerPC Architecture |
477 | 536 | ||
478 | config 8xx_WDT | 537 | config 8xx_WDT |
@@ -502,7 +561,7 @@ config WATCHDOG_RTAS | |||
502 | help | 561 | help |
503 | This driver adds watchdog support for the RTAS watchdog. | 562 | This driver adds watchdog support for the RTAS watchdog. |
504 | 563 | ||
505 | To compile this driver as a module, choose M here. The module | 564 | To compile this driver as a module, choose M here. The module |
506 | will be called wdrtas. | 565 | will be called wdrtas. |
507 | 566 | ||
508 | # MIPS Architecture | 567 | # MIPS Architecture |
@@ -516,6 +575,16 @@ config INDYDOG | |||
516 | timer expired and no process has written to /dev/watchdog during | 575 | timer expired and no process has written to /dev/watchdog during |
517 | that time. | 576 | that time. |
518 | 577 | ||
578 | config WDT_RM9K_GPI | ||
579 | tristate "RM9000/GPI hardware watchdog" | ||
580 | depends on WATCHDOG && CPU_RM9000 | ||
581 | help | ||
582 | Watchdog implementation using the GPI hardware found on | ||
583 | PMC-Sierra RM9xxx CPUs. | ||
584 | |||
585 | To compile this driver as a module, choose M here: the | ||
586 | module will be called rm9k_wdt. | ||
587 | |||
519 | # S390 Architecture | 588 | # S390 Architecture |
520 | 589 | ||
521 | config ZVM_WATCHDOG | 590 | config ZVM_WATCHDOG |
@@ -556,7 +625,7 @@ config SH_WDT_MMAP | |||
556 | help | 625 | help |
557 | If you say Y here, user applications will be able to mmap the | 626 | If you say Y here, user applications will be able to mmap the |
558 | WDT/CPG registers. | 627 | WDT/CPG registers. |
559 | # | 628 | |
560 | # SPARC64 Architecture | 629 | # SPARC64 Architecture |
561 | 630 | ||
562 | config WATCHDOG_CP1XXX | 631 | config WATCHDOG_CP1XXX |
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile index 7f70abad465a..2cd8ff8d10ac 100644 --- a/drivers/char/watchdog/Makefile +++ b/drivers/char/watchdog/Makefile | |||
@@ -23,7 +23,7 @@ obj-$(CONFIG_WDTPCI) += wdt_pci.o | |||
23 | obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o | 23 | obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o |
24 | 24 | ||
25 | # ARM Architecture | 25 | # ARM Architecture |
26 | obj-$(CONFIG_AT91_WATCHDOG) += at91_wdt.o | 26 | obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o |
27 | obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o | 27 | obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o |
28 | obj-$(CONFIG_21285_WATCHDOG) += wdt285.o | 28 | obj-$(CONFIG_21285_WATCHDOG) += wdt285.o |
29 | obj-$(CONFIG_977_WATCHDOG) += wdt977.o | 29 | obj-$(CONFIG_977_WATCHDOG) += wdt977.o |
@@ -47,13 +47,16 @@ obj-$(CONFIG_IBMASR) += ibmasr.o | |||
47 | obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o | 47 | obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o |
48 | obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o | 48 | obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o |
49 | obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o | 49 | obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o |
50 | obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o | 50 | obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o |
51 | obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o | 51 | obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o |
52 | obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o | 52 | obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o |
53 | obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o | ||
53 | obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o | 54 | obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o |
54 | obj-$(CONFIG_SBC8360_WDT) += sbc8360.o | 55 | obj-$(CONFIG_SBC8360_WDT) += sbc8360.o |
55 | obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o | 56 | obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o |
57 | obj-$(CONFIG_SMSC37B787_WDT) += smsc37b787_wdt.o | ||
56 | obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o | 58 | obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o |
59 | obj-$(CONFIG_W83697HF_WDT) += w83697hf_wdt.o | ||
57 | obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o | 60 | obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o |
58 | obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o | 61 | obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o |
59 | obj-$(CONFIG_MACHZ_WDT) += machzwd.o | 62 | obj-$(CONFIG_MACHZ_WDT) += machzwd.o |
@@ -70,6 +73,7 @@ obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o | |||
70 | 73 | ||
71 | # MIPS Architecture | 74 | # MIPS Architecture |
72 | obj-$(CONFIG_INDYDOG) += indydog.o | 75 | obj-$(CONFIG_INDYDOG) += indydog.o |
76 | obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o | ||
73 | 77 | ||
74 | # S390 Architecture | 78 | # S390 Architecture |
75 | 79 | ||
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c index 5948863b592b..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 |
@@ -415,6 +416,16 @@ err_out: | |||
415 | module_init(alim7101_wdt_init); | 416 | module_init(alim7101_wdt_init); |
416 | module_exit(alim7101_wdt_unload); | 417 | module_exit(alim7101_wdt_unload); |
417 | 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 | |||
418 | MODULE_AUTHOR("Steve Hill"); | 429 | MODULE_AUTHOR("Steve Hill"); |
419 | MODULE_DESCRIPTION("ALi M7101 PMU Computer Watchdog Timer driver"); | 430 | MODULE_DESCRIPTION("ALi M7101 PMU Computer Watchdog Timer driver"); |
420 | MODULE_LICENSE("GPL"); | 431 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/watchdog/at91_wdt.c b/drivers/char/watchdog/at91rm9200_wdt.c index 4e7a1145e78f..4e7a1145e78f 100644 --- a/drivers/char/watchdog/at91_wdt.c +++ b/drivers/char/watchdog/at91rm9200_wdt.c | |||
diff --git a/drivers/char/watchdog/iTCO_vendor_support.c b/drivers/char/watchdog/iTCO_vendor_support.c new file mode 100644 index 000000000000..415083990097 --- /dev/null +++ b/drivers/char/watchdog/iTCO_vendor_support.c | |||
@@ -0,0 +1,307 @@ | |||
1 | /* | ||
2 | * intel TCO vendor specific watchdog driver support | ||
3 | * | ||
4 | * (c) Copyright 2006 Wim Van Sebroeck <wim@iguana.be>. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * Neither Wim Van Sebroeck nor Iguana vzw. admit liability nor | ||
12 | * provide warranty for any of this software. This material is | ||
13 | * provided "AS-IS" and at no charge. | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * Includes, defines, variables, module parameters, ... | ||
18 | */ | ||
19 | |||
20 | /* Module and version information */ | ||
21 | #define DRV_NAME "iTCO_vendor_support" | ||
22 | #define DRV_VERSION "1.01" | ||
23 | #define DRV_RELDATE "11-Nov-2006" | ||
24 | #define PFX DRV_NAME ": " | ||
25 | |||
26 | /* Includes */ | ||
27 | #include <linux/module.h> /* For module specific items */ | ||
28 | #include <linux/moduleparam.h> /* For new moduleparam's */ | ||
29 | #include <linux/types.h> /* For standard types (like size_t) */ | ||
30 | #include <linux/errno.h> /* For the -ENODEV/... values */ | ||
31 | #include <linux/kernel.h> /* For printk/panic/... */ | ||
32 | #include <linux/init.h> /* For __init/__exit/... */ | ||
33 | #include <linux/ioport.h> /* For io-port access */ | ||
34 | |||
35 | #include <asm/io.h> /* For inb/outb/... */ | ||
36 | |||
37 | /* iTCO defines */ | ||
38 | #define SMI_EN acpibase + 0x30 /* SMI Control and Enable Register */ | ||
39 | #define TCOBASE acpibase + 0x60 /* TCO base address */ | ||
40 | #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ | ||
41 | |||
42 | /* List of vendor support modes */ | ||
43 | #define SUPERMICRO_OLD_BOARD 1 /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */ | ||
44 | #define SUPERMICRO_NEW_BOARD 2 /* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems */ | ||
45 | |||
46 | static int vendorsupport = 0; | ||
47 | module_param(vendorsupport, int, 0); | ||
48 | MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+"); | ||
49 | |||
50 | /* | ||
51 | * Vendor Specific Support | ||
52 | */ | ||
53 | |||
54 | /* | ||
55 | * Vendor Support: 1 | ||
56 | * Board: Super Micro Computer Inc. 370SSE+-OEM1/P3TSSE | ||
57 | * iTCO chipset: ICH2 | ||
58 | * | ||
59 | * Code contributed by: R. Seretny <lkpatches@paypc.com> | ||
60 | * Documentation obtained by R. Seretny from SuperMicro Technical Support | ||
61 | * | ||
62 | * To enable Watchdog function: | ||
63 | * BIOS setup -> Power -> TCO Logic SMI Enable -> Within5Minutes | ||
64 | * This setting enables SMI to clear the watchdog expired flag. | ||
65 | * If BIOS or CPU fail which may cause SMI hang, then system will | ||
66 | * reboot. When application starts to use watchdog function, | ||
67 | * application has to take over the control from SMI. | ||
68 | * | ||
69 | * For P3TSSE, J36 jumper needs to be removed to enable the Watchdog | ||
70 | * function. | ||
71 | * | ||
72 | * Note: The system will reboot when Expire Flag is set TWICE. | ||
73 | * So, if the watchdog timer is 20 seconds, then the maximum hang | ||
74 | * time is about 40 seconds, and the minimum hang time is about | ||
75 | * 20.6 seconds. | ||
76 | */ | ||
77 | |||
78 | static void supermicro_old_pre_start(unsigned long acpibase) | ||
79 | { | ||
80 | unsigned long val32; | ||
81 | |||
82 | val32 = inl(SMI_EN); | ||
83 | val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ | ||
84 | outl(val32, SMI_EN); /* Needed to activate watchdog */ | ||
85 | } | ||
86 | |||
87 | static void supermicro_old_pre_stop(unsigned long acpibase) | ||
88 | { | ||
89 | unsigned long val32; | ||
90 | |||
91 | val32 = inl(SMI_EN); | ||
92 | val32 &= 0x00002000; /* Turn on SMI clearing watchdog */ | ||
93 | outl(val32, SMI_EN); /* Needed to deactivate watchdog */ | ||
94 | } | ||
95 | |||
96 | static void supermicro_old_pre_keepalive(unsigned long acpibase) | ||
97 | { | ||
98 | /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */ | ||
99 | /* Clear "Expire Flag" (Bit 3 of TC01_STS register) */ | ||
100 | outb(0x08, TCO1_STS); | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * Vendor Support: 2 | ||
105 | * Board: Super Micro Computer Inc. P4SBx, P4DPx | ||
106 | * iTCO chipset: ICH4 | ||
107 | * | ||
108 | * Code contributed by: R. Seretny <lkpatches@paypc.com> | ||
109 | * Documentation obtained by R. Seretny from SuperMicro Technical Support | ||
110 | * | ||
111 | * To enable Watchdog function: | ||
112 | * 1. BIOS | ||
113 | * For P4SBx: | ||
114 | * BIOS setup -> Advanced -> Integrated Peripherals -> Watch Dog Feature | ||
115 | * For P4DPx: | ||
116 | * BIOS setup -> Advanced -> I/O Device Configuration -> Watch Dog | ||
117 | * This setting enables or disables Watchdog function. When enabled, the | ||
118 | * default watchdog timer is set to be 5 minutes (about 4’35â€). It is | ||
119 | * enough to load and run the OS. The application (service or driver) has | ||
120 | * to take over the control once OS is running up and before watchdog | ||
121 | * expires. | ||
122 | * | ||
123 | * 2. JUMPER | ||
124 | * For P4SBx: JP39 | ||
125 | * For P4DPx: JP37 | ||
126 | * This jumper is used for safety. Closed is enabled. This jumper | ||
127 | * prevents user enables watchdog in BIOS by accident. | ||
128 | * | ||
129 | * To enable Watch Dog function, both BIOS and JUMPER must be enabled. | ||
130 | * | ||
131 | * The documentation lists motherboards P4SBx and P4DPx series as of | ||
132 | * 20-March-2002. However, this code works flawlessly with much newer | ||
133 | * motherboards, such as my X6DHR-8G2 (SuperServer 6014H-82). | ||
134 | * | ||
135 | * The original iTCO driver as written does not actually reset the | ||
136 | * watchdog timer on these machines, as a result they reboot after five | ||
137 | * minutes. | ||
138 | * | ||
139 | * NOTE: You may leave the Watchdog function disabled in the SuperMicro | ||
140 | * BIOS to avoid a "boot-race"... This driver will enable watchdog | ||
141 | * functionality even if it's disabled in the BIOS once the /dev/watchdog | ||
142 | * file is opened. | ||
143 | */ | ||
144 | |||
145 | /* I/O Port's */ | ||
146 | #define SM_REGINDEX 0x2e /* SuperMicro ICH4+ Register Index */ | ||
147 | #define SM_DATAIO 0x2f /* SuperMicro ICH4+ Register Data I/O */ | ||
148 | |||
149 | /* Control Register's */ | ||
150 | #define SM_CTLPAGESW 0x07 /* SuperMicro ICH4+ Control Page Switch */ | ||
151 | #define SM_CTLPAGE 0x08 /* SuperMicro ICH4+ Control Page Num */ | ||
152 | |||
153 | #define SM_WATCHENABLE 0x30 /* Watchdog enable: Bit 0: 0=off, 1=on */ | ||
154 | |||
155 | #define SM_WATCHPAGE 0x87 /* Watchdog unlock control page */ | ||
156 | |||
157 | #define SM_ENDWATCH 0xAA /* Watchdog lock control page */ | ||
158 | |||
159 | #define SM_COUNTMODE 0xf5 /* Watchdog count mode select */ | ||
160 | /* (Bit 3: 0 = seconds, 1 = minutes */ | ||
161 | |||
162 | #define SM_WATCHTIMER 0xf6 /* 8-bits, Watchdog timer counter (RW) */ | ||
163 | |||
164 | #define SM_RESETCONTROL 0xf7 /* Watchdog reset control */ | ||
165 | /* Bit 6: timer is reset by kbd interrupt */ | ||
166 | /* Bit 7: timer is reset by mouse interrupt */ | ||
167 | |||
168 | static void supermicro_new_unlock_watchdog(void) | ||
169 | { | ||
170 | outb(SM_WATCHPAGE, SM_REGINDEX); /* Write 0x87 to port 0x2e twice */ | ||
171 | outb(SM_WATCHPAGE, SM_REGINDEX); | ||
172 | |||
173 | outb(SM_CTLPAGESW, SM_REGINDEX); /* Switch to watchdog control page */ | ||
174 | outb(SM_CTLPAGE, SM_DATAIO); | ||
175 | } | ||
176 | |||
177 | static void supermicro_new_lock_watchdog(void) | ||
178 | { | ||
179 | outb(SM_ENDWATCH, SM_REGINDEX); | ||
180 | } | ||
181 | |||
182 | static void supermicro_new_pre_start(unsigned int heartbeat) | ||
183 | { | ||
184 | unsigned int val; | ||
185 | |||
186 | supermicro_new_unlock_watchdog(); | ||
187 | |||
188 | /* Watchdog timer setting needs to be in seconds*/ | ||
189 | outb(SM_COUNTMODE, SM_REGINDEX); | ||
190 | val = inb(SM_DATAIO); | ||
191 | val &= 0xF7; | ||
192 | outb(val, SM_DATAIO); | ||
193 | |||
194 | /* Write heartbeat interval to WDOG */ | ||
195 | outb (SM_WATCHTIMER, SM_REGINDEX); | ||
196 | outb((heartbeat & 255), SM_DATAIO); | ||
197 | |||
198 | /* Make sure keyboard/mouse interrupts don't interfere */ | ||
199 | outb(SM_RESETCONTROL, SM_REGINDEX); | ||
200 | val = inb(SM_DATAIO); | ||
201 | val &= 0x3f; | ||
202 | outb(val, SM_DATAIO); | ||
203 | |||
204 | /* enable watchdog by setting bit 0 of Watchdog Enable to 1 */ | ||
205 | outb(SM_WATCHENABLE, SM_REGINDEX); | ||
206 | val = inb(SM_DATAIO); | ||
207 | val |= 0x01; | ||
208 | outb(val, SM_DATAIO); | ||
209 | |||
210 | supermicro_new_lock_watchdog(); | ||
211 | } | ||
212 | |||
213 | static void supermicro_new_pre_stop(void) | ||
214 | { | ||
215 | unsigned int val; | ||
216 | |||
217 | supermicro_new_unlock_watchdog(); | ||
218 | |||
219 | /* disable watchdog by setting bit 0 of Watchdog Enable to 0 */ | ||
220 | outb(SM_WATCHENABLE, SM_REGINDEX); | ||
221 | val = inb(SM_DATAIO); | ||
222 | val &= 0xFE; | ||
223 | outb(val, SM_DATAIO); | ||
224 | |||
225 | supermicro_new_lock_watchdog(); | ||
226 | } | ||
227 | |||
228 | static void supermicro_new_pre_set_heartbeat(unsigned int heartbeat) | ||
229 | { | ||
230 | supermicro_new_unlock_watchdog(); | ||
231 | |||
232 | /* reset watchdog timeout to heartveat value */ | ||
233 | outb(SM_WATCHTIMER, SM_REGINDEX); | ||
234 | outb((heartbeat & 255), SM_DATAIO); | ||
235 | |||
236 | supermicro_new_lock_watchdog(); | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | * Generic Support Functions | ||
241 | */ | ||
242 | |||
243 | void iTCO_vendor_pre_start(unsigned long acpibase, | ||
244 | unsigned int heartbeat) | ||
245 | { | ||
246 | if (vendorsupport == SUPERMICRO_OLD_BOARD) | ||
247 | supermicro_old_pre_start(acpibase); | ||
248 | else if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
249 | supermicro_new_pre_start(heartbeat); | ||
250 | } | ||
251 | EXPORT_SYMBOL(iTCO_vendor_pre_start); | ||
252 | |||
253 | void iTCO_vendor_pre_stop(unsigned long acpibase) | ||
254 | { | ||
255 | if (vendorsupport == SUPERMICRO_OLD_BOARD) | ||
256 | supermicro_old_pre_stop(acpibase); | ||
257 | else if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
258 | supermicro_new_pre_stop(); | ||
259 | } | ||
260 | EXPORT_SYMBOL(iTCO_vendor_pre_stop); | ||
261 | |||
262 | void iTCO_vendor_pre_keepalive(unsigned long acpibase, unsigned int heartbeat) | ||
263 | { | ||
264 | if (vendorsupport == SUPERMICRO_OLD_BOARD) | ||
265 | supermicro_old_pre_keepalive(acpibase); | ||
266 | else if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
267 | supermicro_new_pre_set_heartbeat(heartbeat); | ||
268 | } | ||
269 | EXPORT_SYMBOL(iTCO_vendor_pre_keepalive); | ||
270 | |||
271 | void iTCO_vendor_pre_set_heartbeat(unsigned int heartbeat) | ||
272 | { | ||
273 | if (vendorsupport == SUPERMICRO_NEW_BOARD) | ||
274 | supermicro_new_pre_set_heartbeat(heartbeat); | ||
275 | } | ||
276 | EXPORT_SYMBOL(iTCO_vendor_pre_set_heartbeat); | ||
277 | |||
278 | int iTCO_vendor_check_noreboot_on(void) | ||
279 | { | ||
280 | switch(vendorsupport) { | ||
281 | case SUPERMICRO_OLD_BOARD: | ||
282 | return 0; | ||
283 | default: | ||
284 | return 1; | ||
285 | } | ||
286 | } | ||
287 | EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on); | ||
288 | |||
289 | static int __init iTCO_vendor_init_module(void) | ||
290 | { | ||
291 | printk (KERN_INFO PFX "vendor-support=%d\n", vendorsupport); | ||
292 | return 0; | ||
293 | } | ||
294 | |||
295 | static void __exit iTCO_vendor_exit_module(void) | ||
296 | { | ||
297 | printk (KERN_INFO PFX "Module Unloaded\n"); | ||
298 | } | ||
299 | |||
300 | module_init(iTCO_vendor_init_module); | ||
301 | module_exit(iTCO_vendor_exit_module); | ||
302 | |||
303 | MODULE_AUTHOR("Wim Van Sebroeck <wim@iguana.be>, R. Seretny <lkpatches@paypc.com>"); | ||
304 | MODULE_DESCRIPTION("Intel TCO Vendor Specific WatchDog Timer Driver Support"); | ||
305 | MODULE_VERSION(DRV_VERSION); | ||
306 | MODULE_LICENSE("GPL"); | ||
307 | |||
diff --git a/drivers/char/watchdog/iTCO_wdt.c b/drivers/char/watchdog/iTCO_wdt.c index aaac94db0d8b..7eac922df867 100644 --- a/drivers/char/watchdog/iTCO_wdt.c +++ b/drivers/char/watchdog/iTCO_wdt.c | |||
@@ -35,6 +35,10 @@ | |||
35 | * 82801GDH (ICH7DH) : document number 307013-002, 307014-009, | 35 | * 82801GDH (ICH7DH) : document number 307013-002, 307014-009, |
36 | * 82801GBM (ICH7-M) : document number 307013-002, 307014-009, | 36 | * 82801GBM (ICH7-M) : document number 307013-002, 307014-009, |
37 | * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009, | 37 | * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009, |
38 | * 82801HB (ICH8) : document number 313056-002, 313057-004, | ||
39 | * 82801HR (ICH8R) : document number 313056-002, 313057-004, | ||
40 | * 82801HH (ICH8DH) : document number 313056-002, 313057-004, | ||
41 | * 82801HO (ICH8DO) : document number 313056-002, 313057-004, | ||
38 | * 6300ESB (6300ESB) : document number 300641-003 | 42 | * 6300ESB (6300ESB) : document number 300641-003 |
39 | */ | 43 | */ |
40 | 44 | ||
@@ -44,8 +48,8 @@ | |||
44 | 48 | ||
45 | /* Module and version information */ | 49 | /* Module and version information */ |
46 | #define DRV_NAME "iTCO_wdt" | 50 | #define DRV_NAME "iTCO_wdt" |
47 | #define DRV_VERSION "1.00" | 51 | #define DRV_VERSION "1.01" |
48 | #define DRV_RELDATE "30-Jul-2006" | 52 | #define DRV_RELDATE "11-Nov-2006" |
49 | #define PFX DRV_NAME ": " | 53 | #define PFX DRV_NAME ": " |
50 | 54 | ||
51 | /* Includes */ | 55 | /* Includes */ |
@@ -85,6 +89,9 @@ enum iTCO_chipsets { | |||
85 | TCO_ICH7, /* ICH7 & ICH7R */ | 89 | TCO_ICH7, /* ICH7 & ICH7R */ |
86 | TCO_ICH7M, /* ICH7-M */ | 90 | TCO_ICH7M, /* ICH7-M */ |
87 | TCO_ICH7MDH, /* ICH7-M DH */ | 91 | TCO_ICH7MDH, /* ICH7-M DH */ |
92 | TCO_ICH8, /* ICH8 & ICH8R */ | ||
93 | TCO_ICH8DH, /* ICH8DH */ | ||
94 | TCO_ICH8DO, /* ICH8DO */ | ||
88 | }; | 95 | }; |
89 | 96 | ||
90 | static struct { | 97 | static struct { |
@@ -108,6 +115,9 @@ static struct { | |||
108 | {"ICH7 or ICH7R", 2}, | 115 | {"ICH7 or ICH7R", 2}, |
109 | {"ICH7-M", 2}, | 116 | {"ICH7-M", 2}, |
110 | {"ICH7-M DH", 2}, | 117 | {"ICH7-M DH", 2}, |
118 | {"ICH8 or ICH8R", 2}, | ||
119 | {"ICH8DH", 2}, | ||
120 | {"ICH8DO", 2}, | ||
111 | {NULL,0} | 121 | {NULL,0} |
112 | }; | 122 | }; |
113 | 123 | ||
@@ -135,6 +145,9 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = { | |||
135 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7 }, | 145 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7 }, |
136 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7M }, | 146 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7M }, |
137 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7MDH }, | 147 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7MDH }, |
148 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8 }, | ||
149 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DH }, | ||
150 | { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DO }, | ||
138 | { 0, }, /* End of list */ | 151 | { 0, }, /* End of list */ |
139 | }; | 152 | }; |
140 | MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); | 153 | MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); |
@@ -176,6 +189,21 @@ static int nowayout = WATCHDOG_NOWAYOUT; | |||
176 | module_param(nowayout, int, 0); | 189 | module_param(nowayout, int, 0); |
177 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); | 190 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); |
178 | 191 | ||
192 | /* iTCO Vendor Specific Support hooks */ | ||
193 | #ifdef CONFIG_ITCO_VENDOR_SUPPORT | ||
194 | extern void iTCO_vendor_pre_start(unsigned long, unsigned int); | ||
195 | extern void iTCO_vendor_pre_stop(unsigned long); | ||
196 | extern void iTCO_vendor_pre_keepalive(unsigned long, unsigned int); | ||
197 | extern void iTCO_vendor_pre_set_heartbeat(unsigned int); | ||
198 | extern int iTCO_vendor_check_noreboot_on(void); | ||
199 | #else | ||
200 | #define iTCO_vendor_pre_start(acpibase, heartbeat) {} | ||
201 | #define iTCO_vendor_pre_stop(acpibase) {} | ||
202 | #define iTCO_vendor_pre_keepalive(acpibase,heartbeat) {} | ||
203 | #define iTCO_vendor_pre_set_heartbeat(heartbeat) {} | ||
204 | #define iTCO_vendor_check_noreboot_on() 1 /* 1=check noreboot; 0=don't check */ | ||
205 | #endif | ||
206 | |||
179 | /* | 207 | /* |
180 | * Some TCO specific functions | 208 | * Some TCO specific functions |
181 | */ | 209 | */ |
@@ -236,6 +264,8 @@ static int iTCO_wdt_start(void) | |||
236 | 264 | ||
237 | spin_lock(&iTCO_wdt_private.io_lock); | 265 | spin_lock(&iTCO_wdt_private.io_lock); |
238 | 266 | ||
267 | iTCO_vendor_pre_start(iTCO_wdt_private.ACPIBASE, heartbeat); | ||
268 | |||
239 | /* disable chipset's NO_REBOOT bit */ | 269 | /* disable chipset's NO_REBOOT bit */ |
240 | if (iTCO_wdt_unset_NO_REBOOT_bit()) { | 270 | if (iTCO_wdt_unset_NO_REBOOT_bit()) { |
241 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); | 271 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); |
@@ -260,6 +290,8 @@ static int iTCO_wdt_stop(void) | |||
260 | 290 | ||
261 | spin_lock(&iTCO_wdt_private.io_lock); | 291 | spin_lock(&iTCO_wdt_private.io_lock); |
262 | 292 | ||
293 | iTCO_vendor_pre_stop(iTCO_wdt_private.ACPIBASE); | ||
294 | |||
263 | /* Bit 11: TCO Timer Halt -> 1 = The TCO timer is disabled */ | 295 | /* Bit 11: TCO Timer Halt -> 1 = The TCO timer is disabled */ |
264 | val = inw(TCO1_CNT); | 296 | val = inw(TCO1_CNT); |
265 | val |= 0x0800; | 297 | val |= 0x0800; |
@@ -280,6 +312,8 @@ static int iTCO_wdt_keepalive(void) | |||
280 | { | 312 | { |
281 | spin_lock(&iTCO_wdt_private.io_lock); | 313 | spin_lock(&iTCO_wdt_private.io_lock); |
282 | 314 | ||
315 | iTCO_vendor_pre_keepalive(iTCO_wdt_private.ACPIBASE, heartbeat); | ||
316 | |||
283 | /* Reload the timer by writing to the TCO Timer Counter register */ | 317 | /* Reload the timer by writing to the TCO Timer Counter register */ |
284 | if (iTCO_wdt_private.iTCO_version == 2) { | 318 | if (iTCO_wdt_private.iTCO_version == 2) { |
285 | outw(0x01, TCO_RLD); | 319 | outw(0x01, TCO_RLD); |
@@ -306,6 +340,8 @@ static int iTCO_wdt_set_heartbeat(int t) | |||
306 | ((iTCO_wdt_private.iTCO_version == 1) && (tmrval > 0x03f))) | 340 | ((iTCO_wdt_private.iTCO_version == 1) && (tmrval > 0x03f))) |
307 | return -EINVAL; | 341 | return -EINVAL; |
308 | 342 | ||
343 | iTCO_vendor_pre_set_heartbeat(tmrval); | ||
344 | |||
309 | /* Write new heartbeat to watchdog */ | 345 | /* Write new heartbeat to watchdog */ |
310 | if (iTCO_wdt_private.iTCO_version == 2) { | 346 | if (iTCO_wdt_private.iTCO_version == 2) { |
311 | spin_lock(&iTCO_wdt_private.io_lock); | 347 | spin_lock(&iTCO_wdt_private.io_lock); |
@@ -355,7 +391,8 @@ static int iTCO_wdt_get_timeleft (int *time_left) | |||
355 | spin_unlock(&iTCO_wdt_private.io_lock); | 391 | spin_unlock(&iTCO_wdt_private.io_lock); |
356 | 392 | ||
357 | *time_left = (val8 * 6) / 10; | 393 | *time_left = (val8 * 6) / 10; |
358 | } | 394 | } else |
395 | return -EINVAL; | ||
359 | return 0; | 396 | return 0; |
360 | } | 397 | } |
361 | 398 | ||
@@ -426,7 +463,6 @@ static int iTCO_wdt_ioctl (struct inode *inode, struct file *file, | |||
426 | { | 463 | { |
427 | int new_options, retval = -EINVAL; | 464 | int new_options, retval = -EINVAL; |
428 | int new_heartbeat; | 465 | int new_heartbeat; |
429 | int time_left; | ||
430 | void __user *argp = (void __user *)arg; | 466 | void __user *argp = (void __user *)arg; |
431 | int __user *p = argp; | 467 | int __user *p = argp; |
432 | static struct watchdog_info ident = { | 468 | static struct watchdog_info ident = { |
@@ -486,6 +522,8 @@ static int iTCO_wdt_ioctl (struct inode *inode, struct file *file, | |||
486 | 522 | ||
487 | case WDIOC_GETTIMELEFT: | 523 | case WDIOC_GETTIMELEFT: |
488 | { | 524 | { |
525 | int time_left; | ||
526 | |||
489 | if (iTCO_wdt_get_timeleft(&time_left)) | 527 | if (iTCO_wdt_get_timeleft(&time_left)) |
490 | return -EINVAL; | 528 | return -EINVAL; |
491 | 529 | ||
@@ -554,7 +592,7 @@ static int iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, | |||
554 | } | 592 | } |
555 | 593 | ||
556 | /* Check chipset's NO_REBOOT bit */ | 594 | /* Check chipset's NO_REBOOT bit */ |
557 | if (iTCO_wdt_unset_NO_REBOOT_bit()) { | 595 | if (iTCO_wdt_unset_NO_REBOOT_bit() && iTCO_vendor_check_noreboot_on()) { |
558 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); | 596 | printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); |
559 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ | 597 | ret = -ENODEV; /* Cannot reset NO_REBOOT bit */ |
560 | goto out; | 598 | goto out; |
diff --git a/drivers/char/watchdog/pc87413_wdt.c b/drivers/char/watchdog/pc87413_wdt.c new file mode 100644 index 000000000000..1d447e32af41 --- /dev/null +++ b/drivers/char/watchdog/pc87413_wdt.c | |||
@@ -0,0 +1,635 @@ | |||
1 | /* | ||
2 | * NS pc87413-wdt Watchdog Timer driver for Linux 2.6.x.x | ||
3 | * | ||
4 | * This code is based on wdt.c with original copyright. | ||
5 | * | ||
6 | * (C) Copyright 2006 Sven Anders, <anders@anduras.de> | ||
7 | * and Marcus Junker, <junker@anduras.de> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | * | ||
14 | * Neither Sven Anders, Marcus Junker nor ANDURAS AG | ||
15 | * admit liability nor provide warranty for any of this software. | ||
16 | * This material is provided "AS-IS" and at no charge. | ||
17 | * | ||
18 | * Release 1.1 | ||
19 | */ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/miscdevice.h> | ||
24 | #include <linux/watchdog.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/notifier.h> | ||
28 | #include <linux/fs.h> | ||
29 | #include <linux/reboot.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/spinlock.h> | ||
32 | #include <linux/moduleparam.h> | ||
33 | #include <linux/version.h> | ||
34 | |||
35 | #include <asm/io.h> | ||
36 | #include <asm/uaccess.h> | ||
37 | #include <asm/system.h> | ||
38 | |||
39 | /* #define DEBUG 1 */ | ||
40 | |||
41 | #define DEFAULT_TIMEOUT 1 /* 1 minute */ | ||
42 | #define MAX_TIMEOUT 255 | ||
43 | |||
44 | #define VERSION "1.1" | ||
45 | #define MODNAME "pc87413 WDT" | ||
46 | #define PFX MODNAME ": " | ||
47 | #define DPFX MODNAME " - DEBUG: " | ||
48 | |||
49 | #define WDT_INDEX_IO_PORT (io+0) /* I/O port base (index register) */ | ||
50 | #define WDT_DATA_IO_PORT (WDT_INDEX_IO_PORT+1) | ||
51 | #define SWC_LDN 0x04 | ||
52 | #define SIOCFG2 0x22 /* Serial IO register */ | ||
53 | #define WDCTL 0x10 /* Watchdog-Timer-Controll-Register */ | ||
54 | #define WDTO 0x11 /* Watchdog timeout register */ | ||
55 | #define WDCFG 0x12 /* Watchdog config register */ | ||
56 | |||
57 | static int io = 0x2E; /* Address used on Portwell Boards */ | ||
58 | |||
59 | static int timeout = DEFAULT_TIMEOUT; /* timeout value */ | ||
60 | static unsigned long timer_enabled = 0; /* is the timer enabled? */ | ||
61 | |||
62 | static char expect_close; /* is the close expected? */ | ||
63 | |||
64 | static spinlock_t io_lock; /* to guard the watchdog from io races */ | ||
65 | |||
66 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
67 | |||
68 | /* -- Low level function ----------------------------------------*/ | ||
69 | |||
70 | /* Select pins for Watchdog output */ | ||
71 | |||
72 | static inline void pc87413_select_wdt_out (void) | ||
73 | { | ||
74 | unsigned int cr_data = 0; | ||
75 | |||
76 | /* Step 1: Select multiple pin,pin55,as WDT output */ | ||
77 | |||
78 | outb_p(SIOCFG2, WDT_INDEX_IO_PORT); | ||
79 | |||
80 | cr_data = inb (WDT_DATA_IO_PORT); | ||
81 | |||
82 | cr_data |= 0x80; /* Set Bit7 to 1*/ | ||
83 | outb_p(SIOCFG2, WDT_INDEX_IO_PORT); | ||
84 | |||
85 | outb_p(cr_data, WDT_DATA_IO_PORT); | ||
86 | |||
87 | #ifdef DEBUG | ||
88 | printk(KERN_INFO DPFX "Select multiple pin,pin55,as WDT output:" | ||
89 | " Bit7 to 1: %d\n", cr_data); | ||
90 | #endif | ||
91 | } | ||
92 | |||
93 | /* Enable SWC functions */ | ||
94 | |||
95 | static inline void pc87413_enable_swc(void) | ||
96 | { | ||
97 | unsigned int cr_data=0; | ||
98 | |||
99 | /* Step 2: Enable SWC functions */ | ||
100 | |||
101 | outb_p(0x07, WDT_INDEX_IO_PORT); /* Point SWC_LDN (LDN=4) */ | ||
102 | outb_p(SWC_LDN, WDT_DATA_IO_PORT); | ||
103 | |||
104 | outb_p(0x30, WDT_INDEX_IO_PORT); /* Read Index 0x30 First */ | ||
105 | cr_data = inb(WDT_DATA_IO_PORT); | ||
106 | cr_data |= 0x01; /* Set Bit0 to 1 */ | ||
107 | outb_p(0x30, WDT_INDEX_IO_PORT); | ||
108 | outb_p(cr_data, WDT_DATA_IO_PORT); /* Index0x30_bit0P1 */ | ||
109 | |||
110 | #ifdef DEBUG | ||
111 | printk(KERN_INFO DPFX "pc87413 - Enable SWC functions\n"); | ||
112 | #endif | ||
113 | } | ||
114 | |||
115 | /* Read SWC I/O base address */ | ||
116 | |||
117 | static inline unsigned int pc87413_get_swc_base(void) | ||
118 | { | ||
119 | unsigned int swc_base_addr = 0; | ||
120 | unsigned char addr_l, addr_h = 0; | ||
121 | |||
122 | /* Step 3: Read SWC I/O Base Address */ | ||
123 | |||
124 | outb_p(0x60, WDT_INDEX_IO_PORT); /* Read Index 0x60 */ | ||
125 | addr_h = inb(WDT_DATA_IO_PORT); | ||
126 | |||
127 | outb_p(0x61, WDT_INDEX_IO_PORT); /* Read Index 0x61 */ | ||
128 | |||
129 | addr_l = inb(WDT_DATA_IO_PORT); | ||
130 | |||
131 | swc_base_addr = (addr_h << 8) + addr_l; | ||
132 | |||
133 | #ifdef DEBUG | ||
134 | printk(KERN_INFO DPFX "Read SWC I/O Base Address: low %d, high %d," | ||
135 | " res %d\n", addr_l, addr_h, swc_base_addr); | ||
136 | #endif | ||
137 | |||
138 | return swc_base_addr; | ||
139 | } | ||
140 | |||
141 | /* Select Bank 3 of SWC */ | ||
142 | |||
143 | static inline void pc87413_swc_bank3(unsigned int swc_base_addr) | ||
144 | { | ||
145 | /* Step 4: Select Bank3 of SWC */ | ||
146 | |||
147 | outb_p(inb(swc_base_addr + 0x0f) | 0x03, swc_base_addr + 0x0f); | ||
148 | |||
149 | #ifdef DEBUG | ||
150 | printk(KERN_INFO DPFX "Select Bank3 of SWC\n"); | ||
151 | #endif | ||
152 | } | ||
153 | |||
154 | /* Set watchdog timeout to x minutes */ | ||
155 | |||
156 | static inline void pc87413_programm_wdto(unsigned int swc_base_addr, | ||
157 | char pc87413_time) | ||
158 | { | ||
159 | /* Step 5: Programm WDTO, Twd. */ | ||
160 | |||
161 | outb_p(pc87413_time, swc_base_addr + WDTO); | ||
162 | |||
163 | #ifdef DEBUG | ||
164 | printk(KERN_INFO DPFX "Set WDTO to %d minutes\n", pc87413_time); | ||
165 | #endif | ||
166 | } | ||
167 | |||
168 | /* Enable WDEN */ | ||
169 | |||
170 | static inline void pc87413_enable_wden(unsigned int swc_base_addr) | ||
171 | { | ||
172 | /* Step 6: Enable WDEN */ | ||
173 | |||
174 | outb_p(inb (swc_base_addr + WDCTL) | 0x01, swc_base_addr + WDCTL); | ||
175 | |||
176 | #ifdef DEBUG | ||
177 | printk(KERN_INFO DPFX "Enable WDEN\n"); | ||
178 | #endif | ||
179 | } | ||
180 | |||
181 | /* Enable SW_WD_TREN */ | ||
182 | static inline void pc87413_enable_sw_wd_tren(unsigned int swc_base_addr) | ||
183 | { | ||
184 | /* Enable SW_WD_TREN */ | ||
185 | |||
186 | outb_p(inb (swc_base_addr + WDCFG) | 0x80, swc_base_addr + WDCFG); | ||
187 | |||
188 | #ifdef DEBUG | ||
189 | printk(KERN_INFO DPFX "Enable SW_WD_TREN\n"); | ||
190 | #endif | ||
191 | } | ||
192 | |||
193 | /* Disable SW_WD_TREN */ | ||
194 | |||
195 | static inline void pc87413_disable_sw_wd_tren(unsigned int swc_base_addr) | ||
196 | { | ||
197 | /* Disable SW_WD_TREN */ | ||
198 | |||
199 | outb_p(inb (swc_base_addr + WDCFG) & 0x7f, swc_base_addr + WDCFG); | ||
200 | |||
201 | #ifdef DEBUG | ||
202 | printk(KERN_INFO DPFX "pc87413 - Disable SW_WD_TREN\n"); | ||
203 | #endif | ||
204 | } | ||
205 | |||
206 | /* Enable SW_WD_TRG */ | ||
207 | |||
208 | static inline void pc87413_enable_sw_wd_trg(unsigned int swc_base_addr) | ||
209 | { | ||
210 | /* Enable SW_WD_TRG */ | ||
211 | |||
212 | outb_p(inb (swc_base_addr + WDCTL) | 0x80, swc_base_addr + WDCTL); | ||
213 | |||
214 | #ifdef DEBUG | ||
215 | printk(KERN_INFO DPFX "pc87413 - Enable SW_WD_TRG\n"); | ||
216 | #endif | ||
217 | } | ||
218 | |||
219 | /* Disable SW_WD_TRG */ | ||
220 | |||
221 | static inline void pc87413_disable_sw_wd_trg(unsigned int swc_base_addr) | ||
222 | { | ||
223 | /* Disable SW_WD_TRG */ | ||
224 | |||
225 | outb_p(inb (swc_base_addr + WDCTL) & 0x7f, swc_base_addr + WDCTL); | ||
226 | |||
227 | #ifdef DEBUG | ||
228 | printk(KERN_INFO DPFX "Disable SW_WD_TRG\n"); | ||
229 | #endif | ||
230 | } | ||
231 | |||
232 | /* -- Higher level functions ------------------------------------*/ | ||
233 | |||
234 | /* Enable the watchdog */ | ||
235 | |||
236 | static void pc87413_enable(void) | ||
237 | { | ||
238 | unsigned int swc_base_addr; | ||
239 | |||
240 | spin_lock(&io_lock); | ||
241 | |||
242 | pc87413_select_wdt_out(); | ||
243 | pc87413_enable_swc(); | ||
244 | swc_base_addr = pc87413_get_swc_base(); | ||
245 | pc87413_swc_bank3(swc_base_addr); | ||
246 | pc87413_programm_wdto(swc_base_addr, timeout); | ||
247 | pc87413_enable_wden(swc_base_addr); | ||
248 | pc87413_enable_sw_wd_tren(swc_base_addr); | ||
249 | pc87413_enable_sw_wd_trg(swc_base_addr); | ||
250 | |||
251 | spin_unlock(&io_lock); | ||
252 | } | ||
253 | |||
254 | /* Disable the watchdog */ | ||
255 | |||
256 | static void pc87413_disable(void) | ||
257 | { | ||
258 | unsigned int swc_base_addr; | ||
259 | |||
260 | spin_lock(&io_lock); | ||
261 | |||
262 | pc87413_select_wdt_out(); | ||
263 | pc87413_enable_swc(); | ||
264 | swc_base_addr = pc87413_get_swc_base(); | ||
265 | pc87413_swc_bank3(swc_base_addr); | ||
266 | pc87413_disable_sw_wd_tren(swc_base_addr); | ||
267 | pc87413_disable_sw_wd_trg(swc_base_addr); | ||
268 | pc87413_programm_wdto(swc_base_addr, 0); | ||
269 | |||
270 | spin_unlock(&io_lock); | ||
271 | } | ||
272 | |||
273 | /* Refresh the watchdog */ | ||
274 | |||
275 | static void pc87413_refresh(void) | ||
276 | { | ||
277 | unsigned int swc_base_addr; | ||
278 | |||
279 | spin_lock(&io_lock); | ||
280 | |||
281 | pc87413_select_wdt_out(); | ||
282 | pc87413_enable_swc(); | ||
283 | swc_base_addr = pc87413_get_swc_base(); | ||
284 | pc87413_swc_bank3(swc_base_addr); | ||
285 | pc87413_disable_sw_wd_tren(swc_base_addr); | ||
286 | pc87413_disable_sw_wd_trg(swc_base_addr); | ||
287 | pc87413_programm_wdto(swc_base_addr, timeout); | ||
288 | pc87413_enable_wden(swc_base_addr); | ||
289 | pc87413_enable_sw_wd_tren(swc_base_addr); | ||
290 | pc87413_enable_sw_wd_trg(swc_base_addr); | ||
291 | |||
292 | spin_unlock(&io_lock); | ||
293 | } | ||
294 | |||
295 | /* -- File operations -------------------------------------------*/ | ||
296 | |||
297 | /** | ||
298 | * pc87413_open: | ||
299 | * @inode: inode of device | ||
300 | * @file: file handle to device | ||
301 | * | ||
302 | */ | ||
303 | |||
304 | static int pc87413_open(struct inode *inode, struct file *file) | ||
305 | { | ||
306 | /* /dev/watchdog can only be opened once */ | ||
307 | |||
308 | if (test_and_set_bit(0, &timer_enabled)) | ||
309 | return -EBUSY; | ||
310 | |||
311 | if (nowayout) | ||
312 | __module_get(THIS_MODULE); | ||
313 | |||
314 | /* Reload and activate timer */ | ||
315 | pc87413_refresh(); | ||
316 | |||
317 | printk(KERN_INFO MODNAME "Watchdog enabled. Timeout set to" | ||
318 | " %d minute(s).\n", timeout); | ||
319 | |||
320 | return nonseekable_open(inode, file); | ||
321 | } | ||
322 | |||
323 | /** | ||
324 | * pc87413_release: | ||
325 | * @inode: inode to board | ||
326 | * @file: file handle to board | ||
327 | * | ||
328 | * The watchdog has a configurable API. There is a religious dispute | ||
329 | * between people who want their watchdog to be able to shut down and | ||
330 | * those who want to be sure if the watchdog manager dies the machine | ||
331 | * reboots. In the former case we disable the counters, in the latter | ||
332 | * case you have to open it again very soon. | ||
333 | */ | ||
334 | |||
335 | static int pc87413_release(struct inode *inode, struct file *file) | ||
336 | { | ||
337 | /* Shut off the timer. */ | ||
338 | |||
339 | if (expect_close == 42) { | ||
340 | pc87413_disable(); | ||
341 | printk(KERN_INFO MODNAME "Watchdog disabled," | ||
342 | " sleeping again...\n"); | ||
343 | } else { | ||
344 | printk(KERN_CRIT MODNAME "Unexpected close, not stopping" | ||
345 | " watchdog!\n"); | ||
346 | pc87413_refresh(); | ||
347 | } | ||
348 | |||
349 | clear_bit(0, &timer_enabled); | ||
350 | expect_close = 0; | ||
351 | |||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * pc87413_status: | ||
357 | * | ||
358 | * return, if the watchdog is enabled (timeout is set...) | ||
359 | */ | ||
360 | |||
361 | |||
362 | static int pc87413_status(void) | ||
363 | { | ||
364 | return 0; /* currently not supported */ | ||
365 | } | ||
366 | |||
367 | /** | ||
368 | * pc87413_write: | ||
369 | * @file: file handle to the watchdog | ||
370 | * @data: data buffer to write | ||
371 | * @len: length in bytes | ||
372 | * @ppos: pointer to the position to write. No seeks allowed | ||
373 | * | ||
374 | * A write to a watchdog device is defined as a keepalive signal. Any | ||
375 | * write of data will do, as we we don't define content meaning. | ||
376 | */ | ||
377 | |||
378 | static ssize_t pc87413_write(struct file *file, const char __user *data, | ||
379 | size_t len, loff_t *ppos) | ||
380 | { | ||
381 | /* See if we got the magic character 'V' and reload the timer */ | ||
382 | if (len) { | ||
383 | if (!nowayout) { | ||
384 | size_t i; | ||
385 | |||
386 | /* reset expect flag */ | ||
387 | expect_close = 0; | ||
388 | |||
389 | /* scan to see whether or not we got the magic character */ | ||
390 | for (i = 0; i != len; i++) { | ||
391 | char c; | ||
392 | if (get_user(c, data+i)) | ||
393 | return -EFAULT; | ||
394 | if (c == 'V') | ||
395 | expect_close = 42; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | /* someone wrote to us, we should reload the timer */ | ||
400 | pc87413_refresh(); | ||
401 | } | ||
402 | return len; | ||
403 | } | ||
404 | |||
405 | /** | ||
406 | * pc87413_ioctl: | ||
407 | * @inode: inode of the device | ||
408 | * @file: file handle to the device | ||
409 | * @cmd: watchdog command | ||
410 | * @arg: argument pointer | ||
411 | * | ||
412 | * The watchdog API defines a common set of functions for all watchdogs | ||
413 | * according to their available features. We only actually usefully support | ||
414 | * querying capabilities and current status. | ||
415 | */ | ||
416 | |||
417 | static int pc87413_ioctl(struct inode *inode, struct file *file, | ||
418 | unsigned int cmd, unsigned long arg) | ||
419 | { | ||
420 | int new_timeout; | ||
421 | |||
422 | union { | ||
423 | struct watchdog_info __user *ident; | ||
424 | int __user *i; | ||
425 | } uarg; | ||
426 | |||
427 | static struct watchdog_info ident = { | ||
428 | .options = WDIOF_KEEPALIVEPING | | ||
429 | WDIOF_SETTIMEOUT | | ||
430 | WDIOF_MAGICCLOSE, | ||
431 | .firmware_version = 1, | ||
432 | .identity = "PC87413(HF/F) watchdog" | ||
433 | }; | ||
434 | |||
435 | uarg.i = (int __user *)arg; | ||
436 | |||
437 | switch(cmd) { | ||
438 | default: | ||
439 | return -ENOTTY; | ||
440 | |||
441 | case WDIOC_GETSUPPORT: | ||
442 | return copy_to_user(uarg.ident, &ident, | ||
443 | sizeof(ident)) ? -EFAULT : 0; | ||
444 | |||
445 | case WDIOC_GETSTATUS: | ||
446 | return put_user(pc87413_status(), uarg.i); | ||
447 | |||
448 | case WDIOC_GETBOOTSTATUS: | ||
449 | return put_user(0, uarg.i); | ||
450 | |||
451 | case WDIOC_KEEPALIVE: | ||
452 | pc87413_refresh(); | ||
453 | #ifdef DEBUG | ||
454 | printk(KERN_INFO DPFX "keepalive\n"); | ||
455 | #endif | ||
456 | return 0; | ||
457 | |||
458 | case WDIOC_SETTIMEOUT: | ||
459 | if (get_user(new_timeout, uarg.i)) | ||
460 | return -EFAULT; | ||
461 | |||
462 | // the API states this is given in secs | ||
463 | new_timeout /= 60; | ||
464 | |||
465 | if (new_timeout < 0 || new_timeout > MAX_TIMEOUT) | ||
466 | return -EINVAL; | ||
467 | |||
468 | timeout = new_timeout; | ||
469 | pc87413_refresh(); | ||
470 | |||
471 | // fall through and return the new timeout... | ||
472 | |||
473 | case WDIOC_GETTIMEOUT: | ||
474 | |||
475 | new_timeout = timeout * 60; | ||
476 | |||
477 | return put_user(new_timeout, uarg.i); | ||
478 | |||
479 | case WDIOC_SETOPTIONS: | ||
480 | { | ||
481 | int options, retval = -EINVAL; | ||
482 | |||
483 | if (get_user(options, uarg.i)) | ||
484 | return -EFAULT; | ||
485 | |||
486 | if (options & WDIOS_DISABLECARD) { | ||
487 | pc87413_disable(); | ||
488 | retval = 0; | ||
489 | } | ||
490 | |||
491 | if (options & WDIOS_ENABLECARD) { | ||
492 | pc87413_enable(); | ||
493 | retval = 0; | ||
494 | } | ||
495 | |||
496 | return retval; | ||
497 | } | ||
498 | } | ||
499 | } | ||
500 | |||
501 | /* -- Notifier funtions -----------------------------------------*/ | ||
502 | |||
503 | /** | ||
504 | * notify_sys: | ||
505 | * @this: our notifier block | ||
506 | * @code: the event being reported | ||
507 | * @unused: unused | ||
508 | * | ||
509 | * Our notifier is called on system shutdowns. We want to turn the card | ||
510 | * off at reboot otherwise the machine will reboot again during memory | ||
511 | * test or worse yet during the following fsck. This would suck, in fact | ||
512 | * trust me - if it happens it does suck. | ||
513 | */ | ||
514 | |||
515 | static int pc87413_notify_sys(struct notifier_block *this, | ||
516 | unsigned long code, | ||
517 | void *unused) | ||
518 | { | ||
519 | if (code == SYS_DOWN || code == SYS_HALT) | ||
520 | { | ||
521 | /* Turn the card off */ | ||
522 | pc87413_disable(); | ||
523 | } | ||
524 | return NOTIFY_DONE; | ||
525 | } | ||
526 | |||
527 | /* -- Module's structures ---------------------------------------*/ | ||
528 | |||
529 | static struct file_operations pc87413_fops = { | ||
530 | .owner = THIS_MODULE, | ||
531 | .llseek = no_llseek, | ||
532 | .write = pc87413_write, | ||
533 | .ioctl = pc87413_ioctl, | ||
534 | .open = pc87413_open, | ||
535 | .release = pc87413_release, | ||
536 | }; | ||
537 | |||
538 | static struct notifier_block pc87413_notifier = | ||
539 | { | ||
540 | .notifier_call = pc87413_notify_sys, | ||
541 | }; | ||
542 | |||
543 | static struct miscdevice pc87413_miscdev= | ||
544 | { | ||
545 | .minor = WATCHDOG_MINOR, | ||
546 | .name = "watchdog", | ||
547 | .fops = &pc87413_fops | ||
548 | }; | ||
549 | |||
550 | /* -- Module init functions -------------------------------------*/ | ||
551 | |||
552 | /** | ||
553 | * pc87413_init: module's "constructor" | ||
554 | * | ||
555 | * Set up the WDT watchdog board. All we have to do is grab the | ||
556 | * resources we require and bitch if anyone beat us to them. | ||
557 | * The open() function will actually kick the board off. | ||
558 | */ | ||
559 | |||
560 | static int __init pc87413_init(void) | ||
561 | { | ||
562 | int ret; | ||
563 | |||
564 | spin_lock_init(&io_lock); | ||
565 | |||
566 | printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT); | ||
567 | |||
568 | /* request_region(io, 2, "pc87413"); */ | ||
569 | |||
570 | ret = register_reboot_notifier(&pc87413_notifier); | ||
571 | if (ret != 0) { | ||
572 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | ||
573 | ret); | ||
574 | } | ||
575 | |||
576 | ret = misc_register(&pc87413_miscdev); | ||
577 | |||
578 | if (ret != 0) { | ||
579 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | ||
580 | WATCHDOG_MINOR, ret); | ||
581 | unregister_reboot_notifier(&pc87413_notifier); | ||
582 | return ret; | ||
583 | } | ||
584 | |||
585 | printk(KERN_INFO PFX "initialized. timeout=%d min \n", timeout); | ||
586 | |||
587 | pc87413_enable(); | ||
588 | |||
589 | return 0; | ||
590 | } | ||
591 | |||
592 | /** | ||
593 | * pc87413_exit: module's "destructor" | ||
594 | * | ||
595 | * Unload the watchdog. You cannot do this with any file handles open. | ||
596 | * If your watchdog is set to continue ticking on close and you unload | ||
597 | * it, well it keeps ticking. We won't get the interrupt but the board | ||
598 | * will not touch PC memory so all is fine. You just have to load a new | ||
599 | * module in 60 seconds or reboot. | ||
600 | */ | ||
601 | |||
602 | static void __exit pc87413_exit(void) | ||
603 | { | ||
604 | /* Stop the timer before we leave */ | ||
605 | if (!nowayout) | ||
606 | { | ||
607 | pc87413_disable(); | ||
608 | printk(KERN_INFO MODNAME "Watchdog disabled.\n"); | ||
609 | } | ||
610 | |||
611 | misc_deregister(&pc87413_miscdev); | ||
612 | unregister_reboot_notifier(&pc87413_notifier); | ||
613 | /* release_region(io,2); */ | ||
614 | |||
615 | printk(MODNAME " watchdog component driver removed.\n"); | ||
616 | } | ||
617 | |||
618 | module_init(pc87413_init); | ||
619 | module_exit(pc87413_exit); | ||
620 | |||
621 | MODULE_AUTHOR("Sven Anders <anders@anduras.de>, Marcus Junker <junker@anduras.de>,"); | ||
622 | MODULE_DESCRIPTION("PC87413 WDT driver"); | ||
623 | MODULE_LICENSE("GPL"); | ||
624 | |||
625 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
626 | |||
627 | module_param(io, int, 0); | ||
628 | MODULE_PARM_DESC(io, MODNAME " I/O port (default: " __MODULE_STRING(io) ")."); | ||
629 | |||
630 | module_param(timeout, int, 0); | ||
631 | MODULE_PARM_DESC(timeout, "Watchdog timeout in minutes (default=" __MODULE_STRING(timeout) ")."); | ||
632 | |||
633 | module_param(nowayout, int, 0); | ||
634 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); | ||
635 | |||
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index bda45334d802..e275dd4a705d 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -561,8 +561,7 @@ static struct notifier_block usb_pcwd_notifier = { | |||
561 | */ | 561 | */ |
562 | static inline void usb_pcwd_delete (struct usb_pcwd_private *usb_pcwd) | 562 | static inline void usb_pcwd_delete (struct usb_pcwd_private *usb_pcwd) |
563 | { | 563 | { |
564 | if (usb_pcwd->intr_urb != NULL) | 564 | usb_free_urb(usb_pcwd->intr_urb); |
565 | usb_free_urb (usb_pcwd->intr_urb); | ||
566 | if (usb_pcwd->intr_buffer != NULL) | 565 | if (usb_pcwd->intr_buffer != NULL) |
567 | usb_buffer_free(usb_pcwd->udev, usb_pcwd->intr_size, | 566 | usb_buffer_free(usb_pcwd->udev, usb_pcwd->intr_size, |
568 | usb_pcwd->intr_buffer, usb_pcwd->intr_dma); | 567 | usb_pcwd->intr_buffer, usb_pcwd->intr_dma); |
diff --git a/drivers/char/watchdog/rm9k_wdt.c b/drivers/char/watchdog/rm9k_wdt.c new file mode 100644 index 000000000000..ec3909371c21 --- /dev/null +++ b/drivers/char/watchdog/rm9k_wdt.c | |||
@@ -0,0 +1,420 @@ | |||
1 | /* | ||
2 | * Watchdog implementation for GPI h/w found on PMC-Sierra RM9xxx | ||
3 | * chips. | ||
4 | * | ||
5 | * Copyright (C) 2004 by Basler Vision Technologies AG | ||
6 | * Author: Thomas Koeller <thomas.koeller@baslerweb.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/moduleparam.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/reboot.h> | ||
29 | #include <linux/notifier.h> | ||
30 | #include <linux/miscdevice.h> | ||
31 | #include <linux/watchdog.h> | ||
32 | #include <asm/io.h> | ||
33 | #include <asm/atomic.h> | ||
34 | #include <asm/processor.h> | ||
35 | #include <asm/uaccess.h> | ||
36 | #include <asm/system.h> | ||
37 | #include <asm/rm9k-ocd.h> | ||
38 | |||
39 | #include <rm9k_wdt.h> | ||
40 | |||
41 | |||
42 | #define CLOCK 125000000 | ||
43 | #define MAX_TIMEOUT_SECONDS 32 | ||
44 | #define CPCCR 0x0080 | ||
45 | #define CPGIG1SR 0x0044 | ||
46 | #define CPGIG1ER 0x0054 | ||
47 | |||
48 | |||
49 | /* Function prototypes */ | ||
50 | static irqreturn_t wdt_gpi_irqhdl(int, void *, struct pt_regs *); | ||
51 | static void wdt_gpi_start(void); | ||
52 | static void wdt_gpi_stop(void); | ||
53 | static void wdt_gpi_set_timeout(unsigned int); | ||
54 | static int wdt_gpi_open(struct inode *, struct file *); | ||
55 | static int wdt_gpi_release(struct inode *, struct file *); | ||
56 | static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t, loff_t *); | ||
57 | static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long); | ||
58 | static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *); | ||
59 | static const struct resource *wdt_gpi_get_resource(struct platform_device *, const char *, unsigned int); | ||
60 | static int __init wdt_gpi_probe(struct device *); | ||
61 | static int __exit wdt_gpi_remove(struct device *); | ||
62 | |||
63 | |||
64 | static const char wdt_gpi_name[] = "wdt_gpi"; | ||
65 | static atomic_t opencnt; | ||
66 | static int expect_close; | ||
67 | static int locked; | ||
68 | |||
69 | |||
70 | /* These are set from device resources */ | ||
71 | static void __iomem * wd_regs; | ||
72 | static unsigned int wd_irq, wd_ctr; | ||
73 | |||
74 | |||
75 | /* Module arguments */ | ||
76 | static int timeout = MAX_TIMEOUT_SECONDS; | ||
77 | module_param(timeout, int, 0444); | ||
78 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds"); | ||
79 | |||
80 | static unsigned long resetaddr = 0xbffdc200; | ||
81 | module_param(resetaddr, ulong, 0444); | ||
82 | MODULE_PARM_DESC(resetaddr, "Address to write to to force a reset"); | ||
83 | |||
84 | static unsigned long flagaddr = 0xbffdc104; | ||
85 | module_param(flagaddr, ulong, 0444); | ||
86 | MODULE_PARM_DESC(flagaddr, "Address to write to boot flags to"); | ||
87 | |||
88 | static int powercycle; | ||
89 | module_param(powercycle, bool, 0444); | ||
90 | MODULE_PARM_DESC(powercycle, "Cycle power if watchdog expires"); | ||
91 | |||
92 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
93 | module_param(nowayout, bool, 0444); | ||
94 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started"); | ||
95 | |||
96 | |||
97 | /* Interrupt handler */ | ||
98 | static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt, struct pt_regs *regs) | ||
99 | { | ||
100 | if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1)) | ||
101 | return IRQ_NONE; | ||
102 | __raw_writel(0x1, wd_regs + 0x0008); | ||
103 | |||
104 | |||
105 | printk(KERN_CRIT "%s: watchdog expired - resetting system\n", | ||
106 | wdt_gpi_name); | ||
107 | |||
108 | *(volatile char *) flagaddr |= 0x01; | ||
109 | *(volatile char *) resetaddr = powercycle ? 0x01 : 0x2; | ||
110 | iob(); | ||
111 | while (1) | ||
112 | cpu_relax(); | ||
113 | } | ||
114 | |||
115 | |||
116 | /* Watchdog functions */ | ||
117 | static void wdt_gpi_start(void) | ||
118 | { | ||
119 | u32 reg; | ||
120 | |||
121 | lock_titan_regs(); | ||
122 | reg = titan_readl(CPGIG1ER); | ||
123 | titan_writel(reg | (0x100 << wd_ctr), CPGIG1ER); | ||
124 | iob(); | ||
125 | unlock_titan_regs(); | ||
126 | } | ||
127 | |||
128 | static void wdt_gpi_stop(void) | ||
129 | { | ||
130 | u32 reg; | ||
131 | |||
132 | lock_titan_regs(); | ||
133 | reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4)); | ||
134 | titan_writel(reg, CPCCR); | ||
135 | reg = titan_readl(CPGIG1ER); | ||
136 | titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER); | ||
137 | iob(); | ||
138 | unlock_titan_regs(); | ||
139 | } | ||
140 | |||
141 | static void wdt_gpi_set_timeout(unsigned int to) | ||
142 | { | ||
143 | u32 reg; | ||
144 | const u32 wdval = (to * CLOCK) & ~0x0000000f; | ||
145 | |||
146 | lock_titan_regs(); | ||
147 | reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4)); | ||
148 | titan_writel(reg, CPCCR); | ||
149 | wmb(); | ||
150 | __raw_writel(wdval, wd_regs + 0x0000); | ||
151 | wmb(); | ||
152 | titan_writel(reg | (0x2 << (wd_ctr * 4)), CPCCR); | ||
153 | wmb(); | ||
154 | titan_writel(reg | (0x5 << (wd_ctr * 4)), CPCCR); | ||
155 | iob(); | ||
156 | unlock_titan_regs(); | ||
157 | } | ||
158 | |||
159 | |||
160 | /* /dev/watchdog operations */ | ||
161 | static int wdt_gpi_open(struct inode *inode, struct file *file) | ||
162 | { | ||
163 | int res; | ||
164 | |||
165 | if (unlikely(atomic_dec_if_positive(&opencnt) < 0)) | ||
166 | return -EBUSY; | ||
167 | |||
168 | expect_close = 0; | ||
169 | if (locked) { | ||
170 | module_put(THIS_MODULE); | ||
171 | free_irq(wd_irq, &miscdev); | ||
172 | locked = 0; | ||
173 | } | ||
174 | |||
175 | res = request_irq(wd_irq, wdt_gpi_irqhdl, SA_SHIRQ | SA_INTERRUPT, | ||
176 | wdt_gpi_name, &miscdev); | ||
177 | if (unlikely(res)) | ||
178 | return res; | ||
179 | |||
180 | wdt_gpi_set_timeout(timeout); | ||
181 | wdt_gpi_start(); | ||
182 | |||
183 | printk(KERN_INFO "%s: watchdog started, timeout = %u seconds\n", | ||
184 | wdt_gpi_name, timeout); | ||
185 | return nonseekable_open(inode, file); | ||
186 | } | ||
187 | |||
188 | static int wdt_gpi_release(struct inode *inode, struct file *file) | ||
189 | { | ||
190 | if (nowayout) { | ||
191 | printk(KERN_INFO "%s: no way out - watchdog left running\n", | ||
192 | wdt_gpi_name); | ||
193 | __module_get(THIS_MODULE); | ||
194 | locked = 1; | ||
195 | } else { | ||
196 | if (expect_close) { | ||
197 | wdt_gpi_stop(); | ||
198 | free_irq(wd_irq, &miscdev); | ||
199 | printk(KERN_INFO "%s: watchdog stopped\n", wdt_gpi_name); | ||
200 | } else { | ||
201 | printk(KERN_CRIT "%s: unexpected close() -" | ||
202 | " watchdog left running\n", | ||
203 | wdt_gpi_name); | ||
204 | wdt_gpi_set_timeout(timeout); | ||
205 | __module_get(THIS_MODULE); | ||
206 | locked = 1; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | atomic_inc(&opencnt); | ||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | static ssize_t | ||
215 | wdt_gpi_write(struct file *f, const char __user *d, size_t s, loff_t *o) | ||
216 | { | ||
217 | char val; | ||
218 | |||
219 | wdt_gpi_set_timeout(timeout); | ||
220 | expect_close = (s > 0) && !get_user(val, d) && (val == 'V'); | ||
221 | return s ? 1 : 0; | ||
222 | } | ||
223 | |||
224 | static long | ||
225 | wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | ||
226 | { | ||
227 | long res = -ENOTTY; | ||
228 | const long size = _IOC_SIZE(cmd); | ||
229 | int stat; | ||
230 | void __user *argp = (void __user *)arg; | ||
231 | static struct watchdog_info wdinfo = { | ||
232 | .identity = "RM9xxx/GPI watchdog", | ||
233 | .firmware_version = 0, | ||
234 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | ||
235 | }; | ||
236 | |||
237 | if (unlikely(_IOC_TYPE(cmd) != WATCHDOG_IOCTL_BASE)) | ||
238 | return -ENOTTY; | ||
239 | |||
240 | if ((_IOC_DIR(cmd) & _IOC_READ) | ||
241 | && !access_ok(VERIFY_WRITE, arg, size)) | ||
242 | return -EFAULT; | ||
243 | |||
244 | if ((_IOC_DIR(cmd) & _IOC_WRITE) | ||
245 | && !access_ok(VERIFY_READ, arg, size)) | ||
246 | return -EFAULT; | ||
247 | |||
248 | expect_close = 0; | ||
249 | |||
250 | switch (cmd) { | ||
251 | case WDIOC_GETSUPPORT: | ||
252 | wdinfo.options = nowayout ? | ||
253 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING : | ||
254 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE; | ||
255 | res = __copy_to_user(argp, &wdinfo, size) ? -EFAULT : size; | ||
256 | break; | ||
257 | |||
258 | case WDIOC_GETSTATUS: | ||
259 | break; | ||
260 | |||
261 | case WDIOC_GETBOOTSTATUS: | ||
262 | stat = (*(volatile char *) flagaddr & 0x01) | ||
263 | ? WDIOF_CARDRESET : 0; | ||
264 | res = __copy_to_user(argp, &stat, size) ? | ||
265 | -EFAULT : size; | ||
266 | break; | ||
267 | |||
268 | case WDIOC_SETOPTIONS: | ||
269 | break; | ||
270 | |||
271 | case WDIOC_KEEPALIVE: | ||
272 | wdt_gpi_set_timeout(timeout); | ||
273 | res = size; | ||
274 | break; | ||
275 | |||
276 | case WDIOC_SETTIMEOUT: | ||
277 | { | ||
278 | int val; | ||
279 | if (unlikely(__copy_from_user(&val, argp, size))) { | ||
280 | res = -EFAULT; | ||
281 | break; | ||
282 | } | ||
283 | |||
284 | if (val > MAX_TIMEOUT_SECONDS) | ||
285 | val = MAX_TIMEOUT_SECONDS; | ||
286 | timeout = val; | ||
287 | wdt_gpi_set_timeout(val); | ||
288 | res = size; | ||
289 | printk(KERN_INFO "%s: timeout set to %u seconds\n", | ||
290 | wdt_gpi_name, timeout); | ||
291 | } | ||
292 | break; | ||
293 | |||
294 | case WDIOC_GETTIMEOUT: | ||
295 | res = __copy_to_user(argp, &timeout, size) ? | ||
296 | -EFAULT : size; | ||
297 | break; | ||
298 | } | ||
299 | |||
300 | return res; | ||
301 | } | ||
302 | |||
303 | |||
304 | /* Shutdown notifier */ | ||
305 | static int | ||
306 | wdt_gpi_notify(struct notifier_block *this, unsigned long code, void *unused) | ||
307 | { | ||
308 | if (code == SYS_DOWN || code == SYS_HALT) | ||
309 | wdt_gpi_stop(); | ||
310 | |||
311 | return NOTIFY_DONE; | ||
312 | } | ||
313 | |||
314 | |||
315 | /* Kernel interfaces */ | ||
316 | static struct file_operations fops = { | ||
317 | .owner = THIS_MODULE, | ||
318 | .open = wdt_gpi_open, | ||
319 | .release = wdt_gpi_release, | ||
320 | .write = wdt_gpi_write, | ||
321 | .unlocked_ioctl = wdt_gpi_ioctl, | ||
322 | }; | ||
323 | |||
324 | static struct miscdevice miscdev = { | ||
325 | .minor = WATCHDOG_MINOR, | ||
326 | .name = wdt_gpi_name, | ||
327 | .fops = &fops, | ||
328 | }; | ||
329 | |||
330 | static struct notifier_block wdt_gpi_shutdown = { | ||
331 | .notifier_call = wdt_gpi_notify, | ||
332 | }; | ||
333 | |||
334 | |||
335 | /* Init & exit procedures */ | ||
336 | static const struct resource * | ||
337 | wdt_gpi_get_resource(struct platform_device *pdv, const char *name, | ||
338 | unsigned int type) | ||
339 | { | ||
340 | char buf[80]; | ||
341 | if (snprintf(buf, sizeof buf, "%s_0", name) >= sizeof buf) | ||
342 | return NULL; | ||
343 | return platform_get_resource_byname(pdv, type, buf); | ||
344 | } | ||
345 | |||
346 | /* No hotplugging on the platform bus - use __init */ | ||
347 | static int __init wdt_gpi_probe(struct device *dev) | ||
348 | { | ||
349 | int res; | ||
350 | struct platform_device * const pdv = to_platform_device(dev); | ||
351 | const struct resource | ||
352 | * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS, | ||
353 | IORESOURCE_MEM), | ||
354 | * const ri = wdt_gpi_get_resource(pdv, WDT_RESOURCE_IRQ, | ||
355 | IORESOURCE_IRQ), | ||
356 | * const rc = wdt_gpi_get_resource(pdv, WDT_RESOURCE_COUNTER, | ||
357 | 0); | ||
358 | |||
359 | if (unlikely(!rr || !ri || !rc)) | ||
360 | return -ENXIO; | ||
361 | |||
362 | wd_regs = ioremap_nocache(rr->start, rr->end + 1 - rr->start); | ||
363 | if (unlikely(!wd_regs)) | ||
364 | return -ENOMEM; | ||
365 | wd_irq = ri->start; | ||
366 | wd_ctr = rc->start; | ||
367 | res = misc_register(&miscdev); | ||
368 | if (res) | ||
369 | iounmap(wd_regs); | ||
370 | else | ||
371 | register_reboot_notifier(&wdt_gpi_shutdown); | ||
372 | return res; | ||
373 | } | ||
374 | |||
375 | static int __exit wdt_gpi_remove(struct device *dev) | ||
376 | { | ||
377 | int res; | ||
378 | |||
379 | unregister_reboot_notifier(&wdt_gpi_shutdown); | ||
380 | res = misc_deregister(&miscdev); | ||
381 | iounmap(wd_regs); | ||
382 | wd_regs = NULL; | ||
383 | return res; | ||
384 | } | ||
385 | |||
386 | |||
387 | /* Device driver init & exit */ | ||
388 | static struct device_driver wdt_gpi_driver = { | ||
389 | .name = (char *) wdt_gpi_name, | ||
390 | .bus = &platform_bus_type, | ||
391 | .owner = THIS_MODULE, | ||
392 | .probe = wdt_gpi_probe, | ||
393 | .remove = __exit_p(wdt_gpi_remove), | ||
394 | .shutdown = NULL, | ||
395 | .suspend = NULL, | ||
396 | .resume = NULL, | ||
397 | }; | ||
398 | |||
399 | static int __init wdt_gpi_init_module(void) | ||
400 | { | ||
401 | atomic_set(&opencnt, 1); | ||
402 | if (timeout > MAX_TIMEOUT_SECONDS) | ||
403 | timeout = MAX_TIMEOUT_SECONDS; | ||
404 | return driver_register(&wdt_gpi_driver); | ||
405 | } | ||
406 | |||
407 | static void __exit wdt_gpi_cleanup_module(void) | ||
408 | { | ||
409 | driver_unregister(&wdt_gpi_driver); | ||
410 | } | ||
411 | |||
412 | module_init(wdt_gpi_init_module); | ||
413 | module_exit(wdt_gpi_cleanup_module); | ||
414 | |||
415 | MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>"); | ||
416 | MODULE_DESCRIPTION("Basler eXcite watchdog driver for gpi devices"); | ||
417 | MODULE_VERSION("0.1"); | ||
418 | MODULE_LICENSE("GPL"); | ||
419 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
420 | |||
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 68b1ca976d53..18cb050c3862 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -380,18 +380,21 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
380 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 380 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
381 | if (res == NULL) { | 381 | if (res == NULL) { |
382 | printk(KERN_INFO PFX "failed to get irq resource\n"); | 382 | printk(KERN_INFO PFX "failed to get irq resource\n"); |
383 | iounmap(wdt_base); | ||
383 | return -ENOENT; | 384 | return -ENOENT; |
384 | } | 385 | } |
385 | 386 | ||
386 | ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev); | 387 | ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev); |
387 | if (ret != 0) { | 388 | if (ret != 0) { |
388 | printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); | 389 | printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); |
390 | iounmap(wdt_base); | ||
389 | return ret; | 391 | return ret; |
390 | } | 392 | } |
391 | 393 | ||
392 | wdt_clock = clk_get(&pdev->dev, "watchdog"); | 394 | wdt_clock = clk_get(&pdev->dev, "watchdog"); |
393 | if (wdt_clock == NULL) { | 395 | if (wdt_clock == NULL) { |
394 | printk(KERN_INFO PFX "failed to find watchdog clock source\n"); | 396 | printk(KERN_INFO PFX "failed to find watchdog clock source\n"); |
397 | iounmap(wdt_base); | ||
395 | return -ENOENT; | 398 | return -ENOENT; |
396 | } | 399 | } |
397 | 400 | ||
@@ -415,6 +418,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
415 | if (ret) { | 418 | if (ret) { |
416 | printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", | 419 | printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", |
417 | WATCHDOG_MINOR, ret); | 420 | WATCHDOG_MINOR, ret); |
421 | iounmap(wdt_base); | ||
418 | return ret; | 422 | return ret; |
419 | } | 423 | } |
420 | 424 | ||
@@ -451,6 +455,7 @@ static int s3c2410wdt_remove(struct platform_device *dev) | |||
451 | wdt_clock = NULL; | 455 | wdt_clock = NULL; |
452 | } | 456 | } |
453 | 457 | ||
458 | iounmap(wdt_base); | ||
454 | misc_deregister(&s3c2410wdt_miscdev); | 459 | misc_deregister(&s3c2410wdt_miscdev); |
455 | return 0; | 460 | return 0; |
456 | } | 461 | } |
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index d8d0f28e0acf..e3239833e4b0 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c | |||
@@ -392,7 +392,7 @@ static int __init sc1200wdt_init(void) | |||
392 | if (io == -1) { | 392 | if (io == -1) { |
393 | printk(KERN_ERR PFX "io parameter must be specified\n"); | 393 | printk(KERN_ERR PFX "io parameter must be specified\n"); |
394 | ret = -EINVAL; | 394 | ret = -EINVAL; |
395 | goto out_clean; | 395 | goto out_pnp; |
396 | } | 396 | } |
397 | 397 | ||
398 | #if defined CONFIG_PNP | 398 | #if defined CONFIG_PNP |
@@ -405,7 +405,7 @@ static int __init sc1200wdt_init(void) | |||
405 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { | 405 | if (!request_region(io, io_len, SC1200_MODULE_NAME)) { |
406 | printk(KERN_ERR PFX "Unable to register IO port %#x\n", io); | 406 | printk(KERN_ERR PFX "Unable to register IO port %#x\n", io); |
407 | ret = -EBUSY; | 407 | ret = -EBUSY; |
408 | goto out_clean; | 408 | goto out_pnp; |
409 | } | 409 | } |
410 | 410 | ||
411 | ret = sc1200wdt_probe(); | 411 | ret = sc1200wdt_probe(); |
@@ -435,6 +435,11 @@ out_rbt: | |||
435 | out_io: | 435 | out_io: |
436 | release_region(io, io_len); | 436 | release_region(io, io_len); |
437 | 437 | ||
438 | out_pnp: | ||
439 | #if defined CONFIG_PNP | ||
440 | if (isapnp) | ||
441 | pnp_unregister_driver(&scl200wdt_pnp_driver); | ||
442 | #endif | ||
438 | goto out_clean; | 443 | goto out_clean; |
439 | } | 444 | } |
440 | 445 | ||
diff --git a/drivers/char/watchdog/smsc37b787_wdt.c b/drivers/char/watchdog/smsc37b787_wdt.c new file mode 100644 index 000000000000..9f56913b484f --- /dev/null +++ b/drivers/char/watchdog/smsc37b787_wdt.c | |||
@@ -0,0 +1,627 @@ | |||
1 | /* | ||
2 | * SMsC 37B787 Watchdog Timer driver for Linux 2.6.x.x | ||
3 | * | ||
4 | * Based on acquirewdt.c by Alan Cox <alan@redhat.com> | ||
5 | * and some other existing drivers | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * The authors do NOT admit liability nor provide warranty for | ||
13 | * any of this software. This material is provided "AS-IS" in | ||
14 | * the hope that it may be useful for others. | ||
15 | * | ||
16 | * (C) Copyright 2003-2006 Sven Anders <anders@anduras.de> | ||
17 | * | ||
18 | * History: | ||
19 | * 2003 - Created version 1.0 for Linux 2.4.x. | ||
20 | * 2006 - Ported to Linux 2.6, added nowayout and MAGICCLOSE | ||
21 | * features. Released version 1.1 | ||
22 | * | ||
23 | * Theory of operation: | ||
24 | * | ||
25 | * A Watchdog Timer (WDT) is a hardware circuit that can | ||
26 | * reset the computer system in case of a software fault. | ||
27 | * You probably knew that already. | ||
28 | * | ||
29 | * Usually a userspace daemon will notify the kernel WDT driver | ||
30 | * via the /dev/watchdog special device file that userspace is | ||
31 | * still alive, at regular intervals. When such a notification | ||
32 | * occurs, the driver will usually tell the hardware watchdog | ||
33 | * that everything is in order, and that the watchdog should wait | ||
34 | * for yet another little while to reset the system. | ||
35 | * If userspace fails (RAM error, kernel bug, whatever), the | ||
36 | * notifications cease to occur, and the hardware watchdog will | ||
37 | * reset the system (causing a reboot) after the timeout occurs. | ||
38 | * | ||
39 | * Create device with: | ||
40 | * mknod /dev/watchdog c 10 130 | ||
41 | * | ||
42 | * For an example userspace keep-alive daemon, see: | ||
43 | * Documentation/watchdog/watchdog.txt | ||
44 | */ | ||
45 | |||
46 | #include <linux/module.h> | ||
47 | #include <linux/moduleparam.h> | ||
48 | #include <linux/types.h> | ||
49 | #include <linux/miscdevice.h> | ||
50 | #include <linux/watchdog.h> | ||
51 | #include <linux/delay.h> | ||
52 | #include <linux/fs.h> | ||
53 | #include <linux/ioport.h> | ||
54 | #include <linux/notifier.h> | ||
55 | #include <linux/reboot.h> | ||
56 | #include <linux/init.h> | ||
57 | #include <linux/spinlock.h> | ||
58 | |||
59 | #include <asm/io.h> | ||
60 | #include <asm/uaccess.h> | ||
61 | #include <asm/system.h> | ||
62 | |||
63 | /* enable support for minutes as units? */ | ||
64 | /* (does not always work correctly, so disabled by default!) */ | ||
65 | #define SMSC_SUPPORT_MINUTES | ||
66 | #undef SMSC_SUPPORT_MINUTES | ||
67 | |||
68 | #define MAX_TIMEOUT 255 | ||
69 | |||
70 | #define UNIT_SECOND 0 | ||
71 | #define UNIT_MINUTE 1 | ||
72 | |||
73 | #define MODNAME "smsc37b787_wdt: " | ||
74 | #define VERSION "1.1" | ||
75 | |||
76 | #define IOPORT 0x3F0 | ||
77 | #define IOPORT_SIZE 2 | ||
78 | #define IODEV_NO 8 | ||
79 | |||
80 | static int unit = UNIT_SECOND; /* timer's unit */ | ||
81 | static int timeout = 60; /* timeout value: default is 60 "units" */ | ||
82 | static unsigned long timer_enabled = 0; /* is the timer enabled? */ | ||
83 | |||
84 | static char expect_close; /* is the close expected? */ | ||
85 | |||
86 | static spinlock_t io_lock; /* to guard the watchdog from io races */ | ||
87 | |||
88 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
89 | |||
90 | /* -- Low level function ----------------------------------------*/ | ||
91 | |||
92 | /* unlock the IO chip */ | ||
93 | |||
94 | static inline void open_io_config(void) | ||
95 | { | ||
96 | outb(0x55, IOPORT); | ||
97 | mdelay(1); | ||
98 | outb(0x55, IOPORT); | ||
99 | } | ||
100 | |||
101 | /* lock the IO chip */ | ||
102 | static inline void close_io_config(void) | ||
103 | { | ||
104 | outb(0xAA, IOPORT); | ||
105 | } | ||
106 | |||
107 | /* select the IO device */ | ||
108 | static inline void select_io_device(unsigned char devno) | ||
109 | { | ||
110 | outb(0x07, IOPORT); | ||
111 | outb(devno, IOPORT+1); | ||
112 | } | ||
113 | |||
114 | /* write to the control register */ | ||
115 | static inline void write_io_cr(unsigned char reg, unsigned char data) | ||
116 | { | ||
117 | outb(reg, IOPORT); | ||
118 | outb(data, IOPORT+1); | ||
119 | } | ||
120 | |||
121 | /* read from the control register */ | ||
122 | static inline char read_io_cr(unsigned char reg) | ||
123 | { | ||
124 | outb(reg, IOPORT); | ||
125 | return inb(IOPORT+1); | ||
126 | } | ||
127 | |||
128 | /* -- Medium level functions ------------------------------------*/ | ||
129 | |||
130 | static inline void gpio_bit12(unsigned char reg) | ||
131 | { | ||
132 | // -- General Purpose I/O Bit 1.2 -- | ||
133 | // Bit 0, In/Out: 0 = Output, 1 = Input | ||
134 | // Bit 1, Polarity: 0 = No Invert, 1 = Invert | ||
135 | // Bit 2, Group Enable Intr.: 0 = Disable, 1 = Enable | ||
136 | // Bit 3/4, Function select: 00 = GPI/O, 01 = WDT, 10 = P17, | ||
137 | // 11 = Either Edge Triggered Intr. 2 | ||
138 | // Bit 5/6 (Reserved) | ||
139 | // Bit 7, Output Type: 0 = Push Pull Bit, 1 = Open Drain | ||
140 | write_io_cr(0xE2, reg); | ||
141 | } | ||
142 | |||
143 | static inline void gpio_bit13(unsigned char reg) | ||
144 | { | ||
145 | // -- General Purpose I/O Bit 1.3 -- | ||
146 | // Bit 0, In/Out: 0 = Output, 1 = Input | ||
147 | // Bit 1, Polarity: 0 = No Invert, 1 = Invert | ||
148 | // Bit 2, Group Enable Intr.: 0 = Disable, 1 = Enable | ||
149 | // Bit 3, Function select: 0 = GPI/O, 1 = LED | ||
150 | // Bit 4-6 (Reserved) | ||
151 | // Bit 7, Output Type: 0 = Push Pull Bit, 1 = Open Drain | ||
152 | write_io_cr(0xE3, reg); | ||
153 | } | ||
154 | |||
155 | static inline void wdt_timer_units(unsigned char new_units) | ||
156 | { | ||
157 | // -- Watchdog timer units -- | ||
158 | // Bit 0-6 (Reserved) | ||
159 | // Bit 7, WDT Time-out Value Units Select | ||
160 | // (0 = Minutes, 1 = Seconds) | ||
161 | write_io_cr(0xF1, new_units); | ||
162 | } | ||
163 | |||
164 | static inline void wdt_timeout_value(unsigned char new_timeout) | ||
165 | { | ||
166 | // -- Watchdog Timer Time-out Value -- | ||
167 | // Bit 0-7 Binary coded units (0=Disabled, 1..255) | ||
168 | write_io_cr(0xF2, new_timeout); | ||
169 | } | ||
170 | |||
171 | static inline void wdt_timer_conf(unsigned char conf) | ||
172 | { | ||
173 | // -- Watchdog timer configuration -- | ||
174 | // Bit 0 Joystick enable: 0* = No Reset, 1 = Reset WDT upon Gameport I/O | ||
175 | // Bit 1 Keyboard enable: 0* = No Reset, 1 = Reset WDT upon KBD Intr. | ||
176 | // Bit 2 Mouse enable: 0* = No Reset, 1 = Reset WDT upon Mouse Intr. | ||
177 | // Bit 3 Reset the timer | ||
178 | // (Wrong in SMsC documentation? Given as: PowerLED Timout Enabled) | ||
179 | // Bit 4-7 WDT Interrupt Mapping: (0000* = Disabled, | ||
180 | // 0001=IRQ1, 0010=(Invalid), 0011=IRQ3 to 1111=IRQ15) | ||
181 | write_io_cr(0xF3, conf); | ||
182 | } | ||
183 | |||
184 | static inline void wdt_timer_ctrl(unsigned char reg) | ||
185 | { | ||
186 | // -- Watchdog timer control -- | ||
187 | // Bit 0 Status Bit: 0 = Timer counting, 1 = Timeout occured | ||
188 | // Bit 1 Power LED Toggle: 0 = Disable Toggle, 1 = Toggle at 1 Hz | ||
189 | // Bit 2 Force Timeout: 1 = Forces WD timeout event (self-cleaning) | ||
190 | // Bit 3 P20 Force Timeout enabled: | ||
191 | // 0 = P20 activity does not generate the WD timeout event | ||
192 | // 1 = P20 Allows rising edge of P20, from the keyboard | ||
193 | // controller, to force the WD timeout event. | ||
194 | // Bit 4 (Reserved) | ||
195 | // -- Soft power management -- | ||
196 | // Bit 5 Stop Counter: 1 = Stop software power down counter | ||
197 | // set via register 0xB8, (self-cleaning) | ||
198 | // (Upon read: 0 = Counter running, 1 = Counter stopped) | ||
199 | // Bit 6 Restart Counter: 1 = Restart software power down counter | ||
200 | // set via register 0xB8, (self-cleaning) | ||
201 | // Bit 7 SPOFF: 1 = Force software power down (self-cleaning) | ||
202 | |||
203 | write_io_cr(0xF4, reg); | ||
204 | } | ||
205 | |||
206 | /* -- Higher level functions ------------------------------------*/ | ||
207 | |||
208 | /* initialize watchdog */ | ||
209 | |||
210 | static void wb_smsc_wdt_initialize(void) | ||
211 | { | ||
212 | unsigned char old; | ||
213 | |||
214 | spin_lock(&io_lock); | ||
215 | open_io_config(); | ||
216 | select_io_device(IODEV_NO); | ||
217 | |||
218 | // enable the watchdog | ||
219 | gpio_bit13(0x08); // Select pin 80 = LED not GPIO | ||
220 | gpio_bit12(0x0A); // Set pin 79 = WDT not GPIO/Output/Polarity=Invert | ||
221 | |||
222 | // disable the timeout | ||
223 | wdt_timeout_value(0); | ||
224 | |||
225 | // reset control register | ||
226 | wdt_timer_ctrl(0x00); | ||
227 | |||
228 | // reset configuration register | ||
229 | wdt_timer_conf(0x00); | ||
230 | |||
231 | // read old (timer units) register | ||
232 | old = read_io_cr(0xF1) & 0x7F; | ||
233 | if (unit == UNIT_SECOND) old |= 0x80; // set to seconds | ||
234 | |||
235 | // set the watchdog timer units | ||
236 | wdt_timer_units(old); | ||
237 | |||
238 | close_io_config(); | ||
239 | spin_unlock(&io_lock); | ||
240 | } | ||
241 | |||
242 | /* shutdown the watchdog */ | ||
243 | |||
244 | static void wb_smsc_wdt_shutdown(void) | ||
245 | { | ||
246 | spin_lock(&io_lock); | ||
247 | open_io_config(); | ||
248 | select_io_device(IODEV_NO); | ||
249 | |||
250 | // disable the watchdog | ||
251 | gpio_bit13(0x09); | ||
252 | gpio_bit12(0x09); | ||
253 | |||
254 | // reset watchdog config register | ||
255 | wdt_timer_conf(0x00); | ||
256 | |||
257 | // reset watchdog control register | ||
258 | wdt_timer_ctrl(0x00); | ||
259 | |||
260 | // disable timeout | ||
261 | wdt_timeout_value(0x00); | ||
262 | |||
263 | close_io_config(); | ||
264 | spin_unlock(&io_lock); | ||
265 | } | ||
266 | |||
267 | /* set timeout => enable watchdog */ | ||
268 | |||
269 | static void wb_smsc_wdt_set_timeout(unsigned char new_timeout) | ||
270 | { | ||
271 | spin_lock(&io_lock); | ||
272 | open_io_config(); | ||
273 | select_io_device(IODEV_NO); | ||
274 | |||
275 | // set Power LED to blink, if we enable the timeout | ||
276 | wdt_timer_ctrl((new_timeout == 0) ? 0x00 : 0x02); | ||
277 | |||
278 | // set timeout value | ||
279 | wdt_timeout_value(new_timeout); | ||
280 | |||
281 | close_io_config(); | ||
282 | spin_unlock(&io_lock); | ||
283 | } | ||
284 | |||
285 | /* get timeout */ | ||
286 | |||
287 | static unsigned char wb_smsc_wdt_get_timeout(void) | ||
288 | { | ||
289 | unsigned char set_timeout; | ||
290 | |||
291 | spin_lock(&io_lock); | ||
292 | open_io_config(); | ||
293 | select_io_device(IODEV_NO); | ||
294 | set_timeout = read_io_cr(0xF2); | ||
295 | close_io_config(); | ||
296 | spin_unlock(&io_lock); | ||
297 | |||
298 | return set_timeout; | ||
299 | } | ||
300 | |||
301 | /* disable watchdog */ | ||
302 | |||
303 | static void wb_smsc_wdt_disable(void) | ||
304 | { | ||
305 | // set the timeout to 0 to disable the watchdog | ||
306 | wb_smsc_wdt_set_timeout(0); | ||
307 | } | ||
308 | |||
309 | /* enable watchdog by setting the current timeout */ | ||
310 | |||
311 | static void wb_smsc_wdt_enable(void) | ||
312 | { | ||
313 | // set the current timeout... | ||
314 | wb_smsc_wdt_set_timeout(timeout); | ||
315 | } | ||
316 | |||
317 | /* reset the timer */ | ||
318 | |||
319 | static void wb_smsc_wdt_reset_timer(void) | ||
320 | { | ||
321 | spin_lock(&io_lock); | ||
322 | open_io_config(); | ||
323 | select_io_device(IODEV_NO); | ||
324 | |||
325 | // reset the timer | ||
326 | wdt_timeout_value(timeout); | ||
327 | wdt_timer_conf(0x08); | ||
328 | |||
329 | close_io_config(); | ||
330 | spin_unlock(&io_lock); | ||
331 | } | ||
332 | |||
333 | /* return, if the watchdog is enabled (timeout is set...) */ | ||
334 | |||
335 | static int wb_smsc_wdt_status(void) | ||
336 | { | ||
337 | return (wb_smsc_wdt_get_timeout() == 0) ? 0 : WDIOF_KEEPALIVEPING; | ||
338 | } | ||
339 | |||
340 | |||
341 | /* -- File operations -------------------------------------------*/ | ||
342 | |||
343 | /* open => enable watchdog and set initial timeout */ | ||
344 | |||
345 | static int wb_smsc_wdt_open(struct inode *inode, struct file *file) | ||
346 | { | ||
347 | /* /dev/watchdog can only be opened once */ | ||
348 | |||
349 | if (test_and_set_bit(0, &timer_enabled)) | ||
350 | return -EBUSY; | ||
351 | |||
352 | if (nowayout) | ||
353 | __module_get(THIS_MODULE); | ||
354 | |||
355 | /* Reload and activate timer */ | ||
356 | wb_smsc_wdt_enable(); | ||
357 | |||
358 | printk(KERN_INFO MODNAME "Watchdog enabled. Timeout set to %d %s.\n", timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)"); | ||
359 | |||
360 | return nonseekable_open(inode, file); | ||
361 | } | ||
362 | |||
363 | /* close => shut off the timer */ | ||
364 | |||
365 | static int wb_smsc_wdt_release(struct inode *inode, struct file *file) | ||
366 | { | ||
367 | /* Shut off the timer. */ | ||
368 | |||
369 | if (expect_close == 42) { | ||
370 | wb_smsc_wdt_disable(); | ||
371 | printk(KERN_INFO MODNAME "Watchdog disabled, sleeping again...\n"); | ||
372 | } else { | ||
373 | printk(KERN_CRIT MODNAME "Unexpected close, not stopping watchdog!\n"); | ||
374 | wb_smsc_wdt_reset_timer(); | ||
375 | } | ||
376 | |||
377 | clear_bit(0, &timer_enabled); | ||
378 | expect_close = 0; | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | /* write => update the timer to keep the machine alive */ | ||
383 | |||
384 | static ssize_t wb_smsc_wdt_write(struct file *file, const char __user *data, | ||
385 | size_t len, loff_t *ppos) | ||
386 | { | ||
387 | /* See if we got the magic character 'V' and reload the timer */ | ||
388 | if (len) { | ||
389 | if (!nowayout) { | ||
390 | size_t i; | ||
391 | |||
392 | /* reset expect flag */ | ||
393 | expect_close = 0; | ||
394 | |||
395 | /* scan to see whether or not we got the magic character */ | ||
396 | for (i = 0; i != len; i++) { | ||
397 | char c; | ||
398 | if (get_user(c, data+i)) | ||
399 | return -EFAULT; | ||
400 | if (c == 'V') | ||
401 | expect_close = 42; | ||
402 | } | ||
403 | } | ||
404 | |||
405 | /* someone wrote to us, we should reload the timer */ | ||
406 | wb_smsc_wdt_reset_timer(); | ||
407 | } | ||
408 | return len; | ||
409 | } | ||
410 | |||
411 | /* ioctl => control interface */ | ||
412 | |||
413 | static int wb_smsc_wdt_ioctl(struct inode *inode, struct file *file, | ||
414 | unsigned int cmd, unsigned long arg) | ||
415 | { | ||
416 | int new_timeout; | ||
417 | |||
418 | union { | ||
419 | struct watchdog_info __user *ident; | ||
420 | int __user *i; | ||
421 | } uarg; | ||
422 | |||
423 | static struct watchdog_info ident = { | ||
424 | .options = WDIOF_KEEPALIVEPING | | ||
425 | WDIOF_SETTIMEOUT | | ||
426 | WDIOF_MAGICCLOSE, | ||
427 | .firmware_version = 0, | ||
428 | .identity = "SMsC 37B787 Watchdog" | ||
429 | }; | ||
430 | |||
431 | uarg.i = (int __user *)arg; | ||
432 | |||
433 | switch (cmd) { | ||
434 | default: | ||
435 | return -ENOTTY; | ||
436 | |||
437 | case WDIOC_GETSUPPORT: | ||
438 | return copy_to_user(uarg.ident, &ident, | ||
439 | sizeof(ident)) ? -EFAULT : 0; | ||
440 | |||
441 | case WDIOC_GETSTATUS: | ||
442 | return put_user(wb_smsc_wdt_status(), uarg.i); | ||
443 | |||
444 | case WDIOC_GETBOOTSTATUS: | ||
445 | return put_user(0, uarg.i); | ||
446 | |||
447 | case WDIOC_KEEPALIVE: | ||
448 | wb_smsc_wdt_reset_timer(); | ||
449 | return 0; | ||
450 | |||
451 | case WDIOC_SETTIMEOUT: | ||
452 | if (get_user(new_timeout, uarg.i)) | ||
453 | return -EFAULT; | ||
454 | |||
455 | // the API states this is given in secs | ||
456 | if (unit == UNIT_MINUTE) | ||
457 | new_timeout /= 60; | ||
458 | |||
459 | if (new_timeout < 0 || new_timeout > MAX_TIMEOUT) | ||
460 | return -EINVAL; | ||
461 | |||
462 | timeout = new_timeout; | ||
463 | wb_smsc_wdt_set_timeout(timeout); | ||
464 | |||
465 | // fall through and return the new timeout... | ||
466 | |||
467 | case WDIOC_GETTIMEOUT: | ||
468 | |||
469 | new_timeout = timeout; | ||
470 | |||
471 | if (unit == UNIT_MINUTE) | ||
472 | new_timeout *= 60; | ||
473 | |||
474 | return put_user(new_timeout, uarg.i); | ||
475 | |||
476 | case WDIOC_SETOPTIONS: | ||
477 | { | ||
478 | int options, retval = -EINVAL; | ||
479 | |||
480 | if (get_user(options, uarg.i)) | ||
481 | return -EFAULT; | ||
482 | |||
483 | if (options & WDIOS_DISABLECARD) { | ||
484 | wb_smsc_wdt_disable(); | ||
485 | retval = 0; | ||
486 | } | ||
487 | |||
488 | if (options & WDIOS_ENABLECARD) { | ||
489 | wb_smsc_wdt_enable(); | ||
490 | retval = 0; | ||
491 | } | ||
492 | |||
493 | return retval; | ||
494 | } | ||
495 | } | ||
496 | } | ||
497 | |||
498 | /* -- Notifier funtions -----------------------------------------*/ | ||
499 | |||
500 | static int wb_smsc_wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused) | ||
501 | { | ||
502 | if (code == SYS_DOWN || code == SYS_HALT) | ||
503 | { | ||
504 | // set timeout to 0, to avoid possible race-condition | ||
505 | timeout = 0; | ||
506 | wb_smsc_wdt_disable(); | ||
507 | } | ||
508 | return NOTIFY_DONE; | ||
509 | } | ||
510 | |||
511 | /* -- Module's structures ---------------------------------------*/ | ||
512 | |||
513 | static struct file_operations wb_smsc_wdt_fops = | ||
514 | { | ||
515 | .owner = THIS_MODULE, | ||
516 | .llseek = no_llseek, | ||
517 | .write = wb_smsc_wdt_write, | ||
518 | .ioctl = wb_smsc_wdt_ioctl, | ||
519 | .open = wb_smsc_wdt_open, | ||
520 | .release = wb_smsc_wdt_release, | ||
521 | }; | ||
522 | |||
523 | static struct notifier_block wb_smsc_wdt_notifier = | ||
524 | { | ||
525 | .notifier_call = wb_smsc_wdt_notify_sys, | ||
526 | }; | ||
527 | |||
528 | static struct miscdevice wb_smsc_wdt_miscdev = | ||
529 | { | ||
530 | .minor = WATCHDOG_MINOR, | ||
531 | .name = "watchdog", | ||
532 | .fops = &wb_smsc_wdt_fops, | ||
533 | }; | ||
534 | |||
535 | /* -- Module init functions -------------------------------------*/ | ||
536 | |||
537 | /* module's "constructor" */ | ||
538 | |||
539 | static int __init wb_smsc_wdt_init(void) | ||
540 | { | ||
541 | int ret; | ||
542 | |||
543 | spin_lock_init(&io_lock); | ||
544 | |||
545 | printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n"); | ||
546 | |||
547 | if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { | ||
548 | printk(KERN_ERR MODNAME "Unable to register IO port %#x\n", IOPORT); | ||
549 | ret = -EBUSY; | ||
550 | goto out_pnp; | ||
551 | } | ||
552 | |||
553 | // set new maximum, if it's too big | ||
554 | if (timeout > MAX_TIMEOUT) | ||
555 | timeout = MAX_TIMEOUT; | ||
556 | |||
557 | // init the watchdog timer | ||
558 | wb_smsc_wdt_initialize(); | ||
559 | |||
560 | ret = register_reboot_notifier(&wb_smsc_wdt_notifier); | ||
561 | if (ret) { | ||
562 | printk(KERN_ERR MODNAME "Unable to register reboot notifier err = %d\n", ret); | ||
563 | goto out_io; | ||
564 | } | ||
565 | |||
566 | ret = misc_register(&wb_smsc_wdt_miscdev); | ||
567 | if (ret) { | ||
568 | printk(KERN_ERR MODNAME "Unable to register miscdev on minor %d\n", WATCHDOG_MINOR); | ||
569 | goto out_rbt; | ||
570 | } | ||
571 | |||
572 | // output info | ||
573 | printk(KERN_INFO MODNAME "Timeout set to %d %s.\n", timeout, (unit == UNIT_SECOND) ? "second(s)" : "minute(s)"); | ||
574 | printk(KERN_INFO MODNAME "Watchdog initialized and sleeping (nowayout=%d)...\n", nowayout); | ||
575 | |||
576 | // ret = 0 | ||
577 | |||
578 | out_clean: | ||
579 | return ret; | ||
580 | |||
581 | out_rbt: | ||
582 | unregister_reboot_notifier(&wb_smsc_wdt_notifier); | ||
583 | |||
584 | out_io: | ||
585 | release_region(IOPORT, IOPORT_SIZE); | ||
586 | |||
587 | out_pnp: | ||
588 | goto out_clean; | ||
589 | } | ||
590 | |||
591 | /* module's "destructor" */ | ||
592 | |||
593 | static void __exit wb_smsc_wdt_exit(void) | ||
594 | { | ||
595 | /* Stop the timer before we leave */ | ||
596 | if (!nowayout) | ||
597 | { | ||
598 | wb_smsc_wdt_shutdown(); | ||
599 | printk(KERN_INFO MODNAME "Watchdog disabled.\n"); | ||
600 | } | ||
601 | |||
602 | misc_deregister(&wb_smsc_wdt_miscdev); | ||
603 | unregister_reboot_notifier(&wb_smsc_wdt_notifier); | ||
604 | release_region(IOPORT, IOPORT_SIZE); | ||
605 | |||
606 | printk("SMsC 37B787 watchdog component driver removed.\n"); | ||
607 | } | ||
608 | |||
609 | module_init(wb_smsc_wdt_init); | ||
610 | module_exit(wb_smsc_wdt_exit); | ||
611 | |||
612 | MODULE_AUTHOR("Sven Anders <anders@anduras.de>"); | ||
613 | MODULE_DESCRIPTION("Driver for SMsC 37B787 watchdog component (Version " VERSION ")"); | ||
614 | MODULE_LICENSE("GPL"); | ||
615 | |||
616 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
617 | |||
618 | #ifdef SMSC_SUPPORT_MINUTES | ||
619 | module_param(unit, int, 0); | ||
620 | MODULE_PARM_DESC(unit, "set unit to use, 0=seconds or 1=minutes, default is 0"); | ||
621 | #endif | ||
622 | |||
623 | module_param(timeout, int, 0); | ||
624 | MODULE_PARM_DESC(timeout, "range is 1-255 units, default is 60"); | ||
625 | |||
626 | module_param(nowayout, int, 0); | ||
627 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); | ||
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c index b4adc527e687..07d4bff27226 100644 --- a/drivers/char/watchdog/w83627hf_wdt.c +++ b/drivers/char/watchdog/w83627hf_wdt.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/notifier.h> | 33 | #include <linux/notifier.h> |
34 | #include <linux/reboot.h> | 34 | #include <linux/reboot.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/spinlock.h> | ||
36 | 37 | ||
37 | #include <asm/io.h> | 38 | #include <asm/io.h> |
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
@@ -44,6 +45,7 @@ | |||
44 | 45 | ||
45 | static unsigned long wdt_is_open; | 46 | static unsigned long wdt_is_open; |
46 | static char expect_close; | 47 | static char expect_close; |
48 | static spinlock_t io_lock; | ||
47 | 49 | ||
48 | /* You must set this - there is no sane way to probe for this board. */ | 50 | /* You must set this - there is no sane way to probe for this board. */ |
49 | static int wdt_io = 0x2E; | 51 | static int wdt_io = 0x2E; |
@@ -110,12 +112,16 @@ w83627hf_init(void) | |||
110 | static void | 112 | static void |
111 | wdt_ctrl(int timeout) | 113 | wdt_ctrl(int timeout) |
112 | { | 114 | { |
115 | spin_lock(&io_lock); | ||
116 | |||
113 | w83627hf_select_wd_register(); | 117 | w83627hf_select_wd_register(); |
114 | 118 | ||
115 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ | 119 | outb_p(0xF6, WDT_EFER); /* Select CRF6 */ |
116 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF6 */ | 120 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF6 */ |
117 | 121 | ||
118 | w83627hf_unselect_wd_register(); | 122 | w83627hf_unselect_wd_register(); |
123 | |||
124 | spin_unlock(&io_lock); | ||
119 | } | 125 | } |
120 | 126 | ||
121 | static int | 127 | static int |
@@ -303,6 +309,8 @@ wdt_init(void) | |||
303 | { | 309 | { |
304 | int ret; | 310 | int ret; |
305 | 311 | ||
312 | spin_lock_init(&io_lock); | ||
313 | |||
306 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n"); | 314 | printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n"); |
307 | 315 | ||
308 | if (wdt_set_heartbeat(timeout)) { | 316 | if (wdt_set_heartbeat(timeout)) { |
diff --git a/drivers/char/watchdog/w83697hf_wdt.c b/drivers/char/watchdog/w83697hf_wdt.c new file mode 100644 index 000000000000..7768b55487c8 --- /dev/null +++ b/drivers/char/watchdog/w83697hf_wdt.c | |||
@@ -0,0 +1,450 @@ | |||
1 | /* | ||
2 | * w83697hf/hg WDT driver | ||
3 | * | ||
4 | * (c) Copyright 2006 Samuel Tardieu <sam@rfc1149.net> | ||
5 | * (c) Copyright 2006 Marcus Junker <junker@anduras.de> | ||
6 | * | ||
7 | * Based on w83627hf_wdt.c which is based on advantechwdt.c | ||
8 | * which is based on wdt.c. | ||
9 | * Original copyright messages: | ||
10 | * | ||
11 | * (c) Copyright 2003 Pádraig Brady <P@draigBrady.com> | ||
12 | * | ||
13 | * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl> | ||
14 | * | ||
15 | * (c) Copyright 1996 Alan Cox <alan@redhat.com>, All Rights Reserved. | ||
16 | * http://www.redhat.com | ||
17 | * | ||
18 | * This program is free software; you can redistribute it and/or | ||
19 | * modify it under the terms of the GNU General Public License | ||
20 | * as published by the Free Software Foundation; either version | ||
21 | * 2 of the License, or (at your option) any later version. | ||
22 | * | ||
23 | * Neither Marcus Junker nor ANDURAS AG admit liability nor provide | ||
24 | * warranty for any of this software. This material is provided | ||
25 | * "AS-IS" and at no charge. | ||
26 | */ | ||
27 | |||
28 | #include <linux/module.h> | ||
29 | #include <linux/moduleparam.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <linux/miscdevice.h> | ||
32 | #include <linux/watchdog.h> | ||
33 | #include <linux/fs.h> | ||
34 | #include <linux/ioport.h> | ||
35 | #include <linux/notifier.h> | ||
36 | #include <linux/reboot.h> | ||
37 | #include <linux/init.h> | ||
38 | #include <linux/spinlock.h> | ||
39 | |||
40 | #include <asm/io.h> | ||
41 | #include <asm/uaccess.h> | ||
42 | #include <asm/system.h> | ||
43 | |||
44 | #define WATCHDOG_NAME "w83697hf/hg WDT" | ||
45 | #define PFX WATCHDOG_NAME ": " | ||
46 | #define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */ | ||
47 | |||
48 | static unsigned long wdt_is_open; | ||
49 | static char expect_close; | ||
50 | static spinlock_t io_lock; | ||
51 | |||
52 | /* You must set this - there is no sane way to probe for this board. */ | ||
53 | static int wdt_io = 0x2e; | ||
54 | module_param(wdt_io, int, 0); | ||
55 | MODULE_PARM_DESC(wdt_io, "w83697hf/hg WDT io port (default 0x2e, 0 = autodetect)"); | ||
56 | |||
57 | static int timeout = WATCHDOG_TIMEOUT; /* in seconds */ | ||
58 | module_param(timeout, int, 0); | ||
59 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); | ||
60 | |||
61 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
62 | module_param(nowayout, int, 0); | ||
63 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); | ||
64 | |||
65 | /* | ||
66 | * Kernel methods. | ||
67 | */ | ||
68 | |||
69 | #define W83697HF_EFER (wdt_io+0) /* Extended Function Enable Register */ | ||
70 | #define W83697HF_EFIR (wdt_io+0) /* Extended Function Index Register (same as EFER) */ | ||
71 | #define W83697HF_EFDR (wdt_io+1) /* Extended Function Data Register */ | ||
72 | |||
73 | static inline void | ||
74 | w83697hf_unlock(void) | ||
75 | { | ||
76 | outb_p(0x87, W83697HF_EFER); /* Enter extended function mode */ | ||
77 | outb_p(0x87, W83697HF_EFER); /* Again according to manual */ | ||
78 | } | ||
79 | |||
80 | static inline void | ||
81 | w83697hf_lock(void) | ||
82 | { | ||
83 | outb_p(0xAA, W83697HF_EFER); /* Leave extended function mode */ | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * The three functions w83697hf_get_reg(), w83697hf_set_reg() and | ||
88 | * w83697hf_write_timeout() must be called with the device unlocked. | ||
89 | */ | ||
90 | |||
91 | static unsigned char | ||
92 | w83697hf_get_reg(unsigned char reg) | ||
93 | { | ||
94 | outb_p(reg, W83697HF_EFIR); | ||
95 | return inb_p(W83697HF_EFDR); | ||
96 | } | ||
97 | |||
98 | static void | ||
99 | w83697hf_set_reg(unsigned char reg, unsigned char data) | ||
100 | { | ||
101 | outb_p(reg, W83697HF_EFIR); | ||
102 | outb_p(data, W83697HF_EFDR); | ||
103 | } | ||
104 | |||
105 | static void | ||
106 | w83697hf_write_timeout(int timeout) | ||
107 | { | ||
108 | w83697hf_set_reg(0xF4, timeout); /* Write Timeout counter to CRF4 */ | ||
109 | } | ||
110 | |||
111 | static void | ||
112 | w83697hf_select_wdt(void) | ||
113 | { | ||
114 | w83697hf_unlock(); | ||
115 | w83697hf_set_reg(0x07, 0x08); /* Switch to logic device 8 (GPIO2) */ | ||
116 | } | ||
117 | |||
118 | static inline void | ||
119 | w83697hf_deselect_wdt(void) | ||
120 | { | ||
121 | w83697hf_lock(); | ||
122 | } | ||
123 | |||
124 | static void | ||
125 | w83697hf_init(void) | ||
126 | { | ||
127 | unsigned char bbuf; | ||
128 | |||
129 | w83697hf_select_wdt(); | ||
130 | |||
131 | bbuf = w83697hf_get_reg(0x29); | ||
132 | bbuf &= ~0x60; | ||
133 | bbuf |= 0x20; | ||
134 | w83697hf_set_reg(0x29, bbuf); /* Set pin 119 to WDTO# mode (= CR29, WDT0) */ | ||
135 | |||
136 | bbuf = w83697hf_get_reg(0xF3); | ||
137 | bbuf &= ~0x04; | ||
138 | w83697hf_set_reg(0xF3, bbuf); /* Count mode is seconds */ | ||
139 | |||
140 | w83697hf_deselect_wdt(); | ||
141 | } | ||
142 | |||
143 | static int | ||
144 | wdt_ping(void) | ||
145 | { | ||
146 | spin_lock(&io_lock); | ||
147 | w83697hf_select_wdt(); | ||
148 | |||
149 | w83697hf_write_timeout(timeout); | ||
150 | |||
151 | w83697hf_deselect_wdt(); | ||
152 | spin_unlock(&io_lock); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static int | ||
157 | wdt_enable(void) | ||
158 | { | ||
159 | spin_lock(&io_lock); | ||
160 | w83697hf_select_wdt(); | ||
161 | |||
162 | w83697hf_write_timeout(timeout); | ||
163 | w83697hf_set_reg(0x30, 1); /* Enable timer */ | ||
164 | |||
165 | w83697hf_deselect_wdt(); | ||
166 | spin_unlock(&io_lock); | ||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | static int | ||
171 | wdt_disable(void) | ||
172 | { | ||
173 | spin_lock(&io_lock); | ||
174 | w83697hf_select_wdt(); | ||
175 | |||
176 | w83697hf_set_reg(0x30, 0); /* Disable timer */ | ||
177 | w83697hf_write_timeout(0); | ||
178 | |||
179 | w83697hf_deselect_wdt(); | ||
180 | spin_unlock(&io_lock); | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | static int | ||
185 | wdt_set_heartbeat(int t) | ||
186 | { | ||
187 | if ((t < 1) || (t > 255)) | ||
188 | return -EINVAL; | ||
189 | |||
190 | timeout = t; | ||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | static ssize_t | ||
195 | wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | ||
196 | { | ||
197 | if (count) { | ||
198 | if (!nowayout) { | ||
199 | size_t i; | ||
200 | |||
201 | expect_close = 0; | ||
202 | |||
203 | for (i = 0; i != count; i++) { | ||
204 | char c; | ||
205 | if (get_user(c, buf+i)) | ||
206 | return -EFAULT; | ||
207 | if (c == 'V') | ||
208 | expect_close = 42; | ||
209 | } | ||
210 | } | ||
211 | wdt_ping(); | ||
212 | } | ||
213 | return count; | ||
214 | } | ||
215 | |||
216 | static int | ||
217 | wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
218 | unsigned long arg) | ||
219 | { | ||
220 | void __user *argp = (void __user *)arg; | ||
221 | int __user *p = argp; | ||
222 | int new_timeout; | ||
223 | static struct watchdog_info ident = { | ||
224 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, | ||
225 | .firmware_version = 1, | ||
226 | .identity = "W83697HF WDT", | ||
227 | }; | ||
228 | |||
229 | switch (cmd) { | ||
230 | case WDIOC_GETSUPPORT: | ||
231 | if (copy_to_user(argp, &ident, sizeof(ident))) | ||
232 | return -EFAULT; | ||
233 | break; | ||
234 | |||
235 | case WDIOC_GETSTATUS: | ||
236 | case WDIOC_GETBOOTSTATUS: | ||
237 | return put_user(0, p); | ||
238 | |||
239 | case WDIOC_KEEPALIVE: | ||
240 | wdt_ping(); | ||
241 | break; | ||
242 | |||
243 | case WDIOC_SETTIMEOUT: | ||
244 | if (get_user(new_timeout, p)) | ||
245 | return -EFAULT; | ||
246 | if (wdt_set_heartbeat(new_timeout)) | ||
247 | return -EINVAL; | ||
248 | wdt_ping(); | ||
249 | /* Fall */ | ||
250 | |||
251 | case WDIOC_GETTIMEOUT: | ||
252 | return put_user(timeout, p); | ||
253 | |||
254 | case WDIOC_SETOPTIONS: | ||
255 | { | ||
256 | int options, retval = -EINVAL; | ||
257 | |||
258 | if (get_user(options, p)) | ||
259 | return -EFAULT; | ||
260 | |||
261 | if (options & WDIOS_DISABLECARD) { | ||
262 | wdt_disable(); | ||
263 | retval = 0; | ||
264 | } | ||
265 | |||
266 | if (options & WDIOS_ENABLECARD) { | ||
267 | wdt_enable(); | ||
268 | retval = 0; | ||
269 | } | ||
270 | |||
271 | return retval; | ||
272 | } | ||
273 | |||
274 | default: | ||
275 | return -ENOTTY; | ||
276 | } | ||
277 | return 0; | ||
278 | } | ||
279 | |||
280 | static int | ||
281 | wdt_open(struct inode *inode, struct file *file) | ||
282 | { | ||
283 | if (test_and_set_bit(0, &wdt_is_open)) | ||
284 | return -EBUSY; | ||
285 | /* | ||
286 | * Activate | ||
287 | */ | ||
288 | |||
289 | wdt_enable(); | ||
290 | return nonseekable_open(inode, file); | ||
291 | } | ||
292 | |||
293 | static int | ||
294 | wdt_close(struct inode *inode, struct file *file) | ||
295 | { | ||
296 | if (expect_close == 42) { | ||
297 | wdt_disable(); | ||
298 | } else { | ||
299 | printk (KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); | ||
300 | wdt_ping(); | ||
301 | } | ||
302 | expect_close = 0; | ||
303 | clear_bit(0, &wdt_is_open); | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * Notifier for system down | ||
309 | */ | ||
310 | |||
311 | static int | ||
312 | wdt_notify_sys(struct notifier_block *this, unsigned long code, | ||
313 | void *unused) | ||
314 | { | ||
315 | if (code == SYS_DOWN || code == SYS_HALT) { | ||
316 | /* Turn the WDT off */ | ||
317 | wdt_disable(); | ||
318 | } | ||
319 | return NOTIFY_DONE; | ||
320 | } | ||
321 | |||
322 | /* | ||
323 | * Kernel Interfaces | ||
324 | */ | ||
325 | |||
326 | static struct file_operations wdt_fops = { | ||
327 | .owner = THIS_MODULE, | ||
328 | .llseek = no_llseek, | ||
329 | .write = wdt_write, | ||
330 | .ioctl = wdt_ioctl, | ||
331 | .open = wdt_open, | ||
332 | .release = wdt_close, | ||
333 | }; | ||
334 | |||
335 | static struct miscdevice wdt_miscdev = { | ||
336 | .minor = WATCHDOG_MINOR, | ||
337 | .name = "watchdog", | ||
338 | .fops = &wdt_fops, | ||
339 | }; | ||
340 | |||
341 | /* | ||
342 | * The WDT needs to learn about soft shutdowns in order to | ||
343 | * turn the timebomb registers off. | ||
344 | */ | ||
345 | |||
346 | static struct notifier_block wdt_notifier = { | ||
347 | .notifier_call = wdt_notify_sys, | ||
348 | }; | ||
349 | |||
350 | static int | ||
351 | w83697hf_check_wdt(void) | ||
352 | { | ||
353 | if (!request_region(wdt_io, 2, WATCHDOG_NAME)) { | ||
354 | printk (KERN_ERR PFX "I/O address 0x%x already in use\n", wdt_io); | ||
355 | return -EIO; | ||
356 | } | ||
357 | |||
358 | printk (KERN_DEBUG PFX "Looking for watchdog at address 0x%x\n", wdt_io); | ||
359 | w83697hf_unlock(); | ||
360 | if (w83697hf_get_reg(0x20) == 0x60) { | ||
361 | printk (KERN_INFO PFX "watchdog found at address 0x%x\n", wdt_io); | ||
362 | w83697hf_lock(); | ||
363 | return 0; | ||
364 | } | ||
365 | w83697hf_lock(); /* Reprotect in case it was a compatible device */ | ||
366 | |||
367 | printk (KERN_INFO PFX "watchdog not found at address 0x%x\n", wdt_io); | ||
368 | release_region(wdt_io, 2); | ||
369 | return -EIO; | ||
370 | } | ||
371 | |||
372 | static int w83697hf_ioports[] = { 0x2e, 0x4e, 0x00 }; | ||
373 | |||
374 | static int __init | ||
375 | wdt_init(void) | ||
376 | { | ||
377 | int ret, i, found = 0; | ||
378 | |||
379 | spin_lock_init(&io_lock); | ||
380 | |||
381 | printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); | ||
382 | |||
383 | if (wdt_io == 0) { | ||
384 | /* we will autodetect the W83697HF/HG watchdog */ | ||
385 | for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) { | ||
386 | wdt_io = w83697hf_ioports[i]; | ||
387 | if (!w83697hf_check_wdt()) | ||
388 | found++; | ||
389 | } | ||
390 | } else { | ||
391 | if (!w83697hf_check_wdt()) | ||
392 | found++; | ||
393 | } | ||
394 | |||
395 | if (!found) { | ||
396 | printk (KERN_ERR PFX "No W83697HF/HG could be found\n"); | ||
397 | ret = -EIO; | ||
398 | goto out; | ||
399 | } | ||
400 | |||
401 | w83697hf_init(); | ||
402 | wdt_disable(); /* Disable watchdog until first use */ | ||
403 | |||
404 | if (wdt_set_heartbeat(timeout)) { | ||
405 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | ||
406 | printk (KERN_INFO PFX "timeout value must be 1<=timeout<=255, using %d\n", | ||
407 | WATCHDOG_TIMEOUT); | ||
408 | } | ||
409 | |||
410 | ret = register_reboot_notifier(&wdt_notifier); | ||
411 | if (ret != 0) { | ||
412 | printk (KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | ||
413 | ret); | ||
414 | goto unreg_regions; | ||
415 | } | ||
416 | |||
417 | ret = misc_register(&wdt_miscdev); | ||
418 | if (ret != 0) { | ||
419 | printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | ||
420 | WATCHDOG_MINOR, ret); | ||
421 | goto unreg_reboot; | ||
422 | } | ||
423 | |||
424 | printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n", | ||
425 | timeout, nowayout); | ||
426 | |||
427 | out: | ||
428 | return ret; | ||
429 | unreg_reboot: | ||
430 | unregister_reboot_notifier(&wdt_notifier); | ||
431 | unreg_regions: | ||
432 | release_region(wdt_io, 2); | ||
433 | goto out; | ||
434 | } | ||
435 | |||
436 | static void __exit | ||
437 | wdt_exit(void) | ||
438 | { | ||
439 | misc_deregister(&wdt_miscdev); | ||
440 | unregister_reboot_notifier(&wdt_notifier); | ||
441 | release_region(wdt_io, 2); | ||
442 | } | ||
443 | |||
444 | module_init(wdt_init); | ||
445 | module_exit(wdt_exit); | ||
446 | |||
447 | MODULE_LICENSE("GPL"); | ||
448 | MODULE_AUTHOR("Marcus Junker <junker@anduras.de>, Samuel Tardieu <sam@rfc1149.net>"); | ||
449 | MODULE_DESCRIPTION("w83697hf/hg WDT driver"); | ||
450 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||