diff options
Diffstat (limited to 'drivers')
124 files changed, 2969 insertions, 766 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 63a17b55b39b..7a0f4aa4fa1e 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * | 20 | * |
21 | * | 21 | * |
22 | * ACPI based HotPlug driver that supports Memory Hotplug | 22 | * ACPI based HotPlug driver that supports Memory Hotplug |
23 | * This driver fields notifications from firmare for memory add | 23 | * This driver fields notifications from firmware for memory add |
24 | * and remove operations and alerts the VM of the affected memory | 24 | * and remove operations and alerts the VM of the affected memory |
25 | * ranges. | 25 | * ranges. |
26 | */ | 26 | */ |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 5d438c32989d..a7dc87ecee37 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -404,7 +404,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
404 | * | 404 | * |
405 | * RETURN: Status | 405 | * RETURN: Status |
406 | * | 406 | * |
407 | * DESCRIPTION: Construct an union acpi_operand_object of type def_field and | 407 | * DESCRIPTION: Construct a union acpi_operand_object of type def_field and |
408 | * connect it to the parent Node. | 408 | * connect it to the parent Node. |
409 | * | 409 | * |
410 | ******************************************************************************/ | 410 | ******************************************************************************/ |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 89571b92a522..60e8c47128e9 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -146,7 +146,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
146 | 146 | ||
147 | stack_desc = *stack_ptr; | 147 | stack_desc = *stack_ptr; |
148 | 148 | ||
149 | /* This is an union acpi_operand_object */ | 149 | /* This is a union acpi_operand_object */ |
150 | 150 | ||
151 | switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { | 151 | switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { |
152 | case ACPI_TYPE_LOCAL_REFERENCE: | 152 | case ACPI_TYPE_LOCAL_REFERENCE: |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 3318df4cbd98..1c118ba78adb 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -274,7 +274,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
274 | * | 274 | * |
275 | * PARAMETERS: *source_desc - Value to be stored | 275 | * PARAMETERS: *source_desc - Value to be stored |
276 | * *dest_desc - Where to store it. Must be an NS node | 276 | * *dest_desc - Where to store it. Must be an NS node |
277 | * or an union acpi_operand_object of type | 277 | * or a union acpi_operand_object of type |
278 | * Reference; | 278 | * Reference; |
279 | * walk_state - Current walk state | 279 | * walk_state - Current walk state |
280 | * | 280 | * |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index c0bbfa2c4193..08b8d73e6ee5 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -124,7 +124,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
124 | * | 124 | * |
125 | * FUNCTION: acpi_rs_create_pci_routing_table | 125 | * FUNCTION: acpi_rs_create_pci_routing_table |
126 | * | 126 | * |
127 | * PARAMETERS: package_object - Pointer to an union acpi_operand_object | 127 | * PARAMETERS: package_object - Pointer to a union acpi_operand_object |
128 | * package | 128 | * package |
129 | * output_buffer - Pointer to the user's buffer | 129 | * output_buffer - Pointer to the user's buffer |
130 | * | 130 | * |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index c354e7a42bcd..4bef3cfbaccb 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -297,7 +297,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
297 | * | 297 | * |
298 | * RETURN: TRUE if object is valid, FALSE otherwise | 298 | * RETURN: TRUE if object is valid, FALSE otherwise |
299 | * | 299 | * |
300 | * DESCRIPTION: Validate a pointer to be an union acpi_operand_object | 300 | * DESCRIPTION: Validate a pointer to be a union acpi_operand_object |
301 | * | 301 | * |
302 | ******************************************************************************/ | 302 | ******************************************************************************/ |
303 | 303 | ||
@@ -389,7 +389,7 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object) | |||
389 | { | 389 | { |
390 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); | 390 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); |
391 | 391 | ||
392 | /* Object must be an union acpi_operand_object */ | 392 | /* Object must be a union acpi_operand_object */ |
393 | 393 | ||
394 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { | 394 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { |
395 | ACPI_ERROR((AE_INFO, | 395 | ACPI_ERROR((AE_INFO, |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index fecca4223f8e..f178a450ec08 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <linux/workqueue.h> | 56 | #include <linux/workqueue.h> |
57 | #include <linux/scatterlist.h> | 57 | #include <linux/scatterlist.h> |
58 | #include <linux/io.h> | 58 | #include <linux/io.h> |
59 | #include <linux/async.h> | ||
59 | #include <scsi/scsi.h> | 60 | #include <scsi/scsi.h> |
60 | #include <scsi/scsi_cmnd.h> | 61 | #include <scsi/scsi_cmnd.h> |
61 | #include <scsi/scsi_host.h> | 62 | #include <scsi/scsi_host.h> |
@@ -5909,6 +5910,54 @@ void ata_host_init(struct ata_host *host, struct device *dev, | |||
5909 | host->ops = ops; | 5910 | host->ops = ops; |
5910 | } | 5911 | } |
5911 | 5912 | ||
5913 | |||
5914 | static void async_port_probe(void *data, async_cookie_t cookie) | ||
5915 | { | ||
5916 | int rc; | ||
5917 | struct ata_port *ap = data; | ||
5918 | /* probe */ | ||
5919 | if (ap->ops->error_handler) { | ||
5920 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
5921 | unsigned long flags; | ||
5922 | |||
5923 | ata_port_probe(ap); | ||
5924 | |||
5925 | /* kick EH for boot probing */ | ||
5926 | spin_lock_irqsave(ap->lock, flags); | ||
5927 | |||
5928 | ehi->probe_mask |= ATA_ALL_DEVICES; | ||
5929 | ehi->action |= ATA_EH_RESET | ATA_EH_LPM; | ||
5930 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | ||
5931 | |||
5932 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | ||
5933 | ap->pflags |= ATA_PFLAG_LOADING; | ||
5934 | ata_port_schedule_eh(ap); | ||
5935 | |||
5936 | spin_unlock_irqrestore(ap->lock, flags); | ||
5937 | |||
5938 | /* wait for EH to finish */ | ||
5939 | ata_port_wait_eh(ap); | ||
5940 | } else { | ||
5941 | DPRINTK("ata%u: bus probe begin\n", ap->print_id); | ||
5942 | rc = ata_bus_probe(ap); | ||
5943 | DPRINTK("ata%u: bus probe end\n", ap->print_id); | ||
5944 | |||
5945 | if (rc) { | ||
5946 | /* FIXME: do something useful here? | ||
5947 | * Current libata behavior will | ||
5948 | * tear down everything when | ||
5949 | * the module is removed | ||
5950 | * or the h/w is unplugged. | ||
5951 | */ | ||
5952 | } | ||
5953 | } | ||
5954 | |||
5955 | /* in order to keep device order, we need to synchronize at this point */ | ||
5956 | async_synchronize_cookie(cookie); | ||
5957 | |||
5958 | ata_scsi_scan_host(ap, 1); | ||
5959 | |||
5960 | } | ||
5912 | /** | 5961 | /** |
5913 | * ata_host_register - register initialized ATA host | 5962 | * ata_host_register - register initialized ATA host |
5914 | * @host: ATA host to register | 5963 | * @host: ATA host to register |
@@ -5988,52 +6037,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
5988 | DPRINTK("probe begin\n"); | 6037 | DPRINTK("probe begin\n"); |
5989 | for (i = 0; i < host->n_ports; i++) { | 6038 | for (i = 0; i < host->n_ports; i++) { |
5990 | struct ata_port *ap = host->ports[i]; | 6039 | struct ata_port *ap = host->ports[i]; |
5991 | 6040 | async_schedule(async_port_probe, ap); | |
5992 | /* probe */ | ||
5993 | if (ap->ops->error_handler) { | ||
5994 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
5995 | unsigned long flags; | ||
5996 | |||
5997 | ata_port_probe(ap); | ||
5998 | |||
5999 | /* kick EH for boot probing */ | ||
6000 | spin_lock_irqsave(ap->lock, flags); | ||
6001 | |||
6002 | ehi->probe_mask |= ATA_ALL_DEVICES; | ||
6003 | ehi->action |= ATA_EH_RESET | ATA_EH_LPM; | ||
6004 | ehi->flags |= ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET; | ||
6005 | |||
6006 | ap->pflags &= ~ATA_PFLAG_INITIALIZING; | ||
6007 | ap->pflags |= ATA_PFLAG_LOADING; | ||
6008 | ata_port_schedule_eh(ap); | ||
6009 | |||
6010 | spin_unlock_irqrestore(ap->lock, flags); | ||
6011 | |||
6012 | /* wait for EH to finish */ | ||
6013 | ata_port_wait_eh(ap); | ||
6014 | } else { | ||
6015 | DPRINTK("ata%u: bus probe begin\n", ap->print_id); | ||
6016 | rc = ata_bus_probe(ap); | ||
6017 | DPRINTK("ata%u: bus probe end\n", ap->print_id); | ||
6018 | |||
6019 | if (rc) { | ||
6020 | /* FIXME: do something useful here? | ||
6021 | * Current libata behavior will | ||
6022 | * tear down everything when | ||
6023 | * the module is removed | ||
6024 | * or the h/w is unplugged. | ||
6025 | */ | ||
6026 | } | ||
6027 | } | ||
6028 | } | ||
6029 | |||
6030 | /* probes are done, now scan each port's disk(s) */ | ||
6031 | DPRINTK("host probe begin\n"); | ||
6032 | for (i = 0; i < host->n_ports; i++) { | ||
6033 | struct ata_port *ap = host->ports[i]; | ||
6034 | |||
6035 | ata_scsi_scan_host(ap, 1); | ||
6036 | } | 6041 | } |
6042 | DPRINTK("probe end\n"); | ||
6037 | 6043 | ||
6038 | return 0; | 6044 | return 0; |
6039 | } | 6045 | } |
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index d8e8c49c0cbd..8f006f96ff53 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -54,7 +54,7 @@ config FIRMWARE_IN_KERNEL | |||
54 | such firmware, and do not wish to use an initrd. | 54 | such firmware, and do not wish to use an initrd. |
55 | 55 | ||
56 | This single option controls the inclusion of firmware for | 56 | This single option controls the inclusion of firmware for |
57 | every driver which uses request_firmare() and ships its | 57 | every driver which uses request_firmware() and ships its |
58 | firmware in the kernel source tree, to avoid a proliferation | 58 | firmware in the kernel source tree, to avoid a proliferation |
59 | of 'Include firmware for xxx device' options. | 59 | of 'Include firmware for xxx device' options. |
60 | 60 | ||
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index a8bc1cbcfa7c..a778fb52b11f 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/cpu.h> | 29 | #include <linux/cpu.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/hardirq.h> | ||
31 | #include <linux/topology.h> | 32 | #include <linux/topology.h> |
32 | 33 | ||
33 | #define define_one_ro(_name) \ | 34 | #define define_one_ro(_name) \ |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 39ad820b2350..af7c13ca9493 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -769,7 +769,7 @@ static int pc_open(struct tty_struct *tty, struct file *filp) | |||
769 | /* Check status of board configured in system. */ | 769 | /* Check status of board configured in system. */ |
770 | 770 | ||
771 | /* | 771 | /* |
772 | * I check to see if the epca_setup routine detected an user error. It | 772 | * I check to see if the epca_setup routine detected a user error. It |
773 | * might be better to put this in pc_init, but for the moment it goes | 773 | * might be better to put this in pc_init, but for the moment it goes |
774 | * here. | 774 | * here. |
775 | */ | 775 | */ |
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 5f076aef74fa..a8c8d9c19d74 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
@@ -83,7 +83,7 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE | |||
83 | select CPU_FREQ_GOV_USERSPACE | 83 | select CPU_FREQ_GOV_USERSPACE |
84 | help | 84 | help |
85 | Use the CPUFreq governor 'userspace' as default. This allows | 85 | Use the CPUFreq governor 'userspace' as default. This allows |
86 | you to set the CPU frequency manually or when an userspace | 86 | you to set the CPU frequency manually or when a userspace |
87 | program shall be able to set the CPU dynamically without having | 87 | program shall be able to set the CPU dynamically without having |
88 | to enable the userspace governor manually. | 88 | to enable the userspace governor manually. |
89 | 89 | ||
@@ -138,7 +138,7 @@ config CPU_FREQ_GOV_USERSPACE | |||
138 | tristate "'userspace' governor for userspace frequency scaling" | 138 | tristate "'userspace' governor for userspace frequency scaling" |
139 | help | 139 | help |
140 | Enable this cpufreq governor when you either want to set the | 140 | Enable this cpufreq governor when you either want to set the |
141 | CPU frequency manually or when an userspace program shall | 141 | CPU frequency manually or when a userspace program shall |
142 | be able to set the CPU dynamically, like on LART | 142 | be able to set the CPU dynamically, like on LART |
143 | <http://www.lartmaker.nl/>. | 143 | <http://www.lartmaker.nl/>. |
144 | 144 | ||
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c index 418c18f07e9d..799f94424c8a 100644 --- a/drivers/firewire/fw-card.c +++ b/drivers/firewire/fw-card.c | |||
@@ -75,7 +75,7 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length) | |||
75 | * controller, block reads to the config rom accesses the host | 75 | * controller, block reads to the config rom accesses the host |
76 | * memory, but quadlet read access the hardware bus info block | 76 | * memory, but quadlet read access the hardware bus info block |
77 | * registers. That's just crack, but it means we should make | 77 | * registers. That's just crack, but it means we should make |
78 | * sure the contents of bus info block in host memory mathces | 78 | * sure the contents of bus info block in host memory matches |
79 | * the version stored in the OHCI registers. | 79 | * the version stored in the OHCI registers. |
80 | */ | 80 | */ |
81 | 81 | ||
@@ -189,6 +189,17 @@ static const char gap_count_table[] = { | |||
189 | 63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40 | 189 | 63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40 |
190 | }; | 190 | }; |
191 | 191 | ||
192 | void | ||
193 | fw_schedule_bm_work(struct fw_card *card, unsigned long delay) | ||
194 | { | ||
195 | int scheduled; | ||
196 | |||
197 | fw_card_get(card); | ||
198 | scheduled = schedule_delayed_work(&card->work, delay); | ||
199 | if (!scheduled) | ||
200 | fw_card_put(card); | ||
201 | } | ||
202 | |||
192 | static void | 203 | static void |
193 | fw_card_bm_work(struct work_struct *work) | 204 | fw_card_bm_work(struct work_struct *work) |
194 | { | 205 | { |
@@ -206,7 +217,7 @@ fw_card_bm_work(struct work_struct *work) | |||
206 | 217 | ||
207 | if (local_node == NULL) { | 218 | if (local_node == NULL) { |
208 | spin_unlock_irqrestore(&card->lock, flags); | 219 | spin_unlock_irqrestore(&card->lock, flags); |
209 | return; | 220 | goto out_put_card; |
210 | } | 221 | } |
211 | fw_node_get(local_node); | 222 | fw_node_get(local_node); |
212 | fw_node_get(root_node); | 223 | fw_node_get(root_node); |
@@ -280,7 +291,7 @@ fw_card_bm_work(struct work_struct *work) | |||
280 | * this task 100ms from now. | 291 | * this task 100ms from now. |
281 | */ | 292 | */ |
282 | spin_unlock_irqrestore(&card->lock, flags); | 293 | spin_unlock_irqrestore(&card->lock, flags); |
283 | schedule_delayed_work(&card->work, DIV_ROUND_UP(HZ, 10)); | 294 | fw_schedule_bm_work(card, DIV_ROUND_UP(HZ, 10)); |
284 | goto out; | 295 | goto out; |
285 | } | 296 | } |
286 | 297 | ||
@@ -355,6 +366,8 @@ fw_card_bm_work(struct work_struct *work) | |||
355 | fw_device_put(root_device); | 366 | fw_device_put(root_device); |
356 | fw_node_put(root_node); | 367 | fw_node_put(root_node); |
357 | fw_node_put(local_node); | 368 | fw_node_put(local_node); |
369 | out_put_card: | ||
370 | fw_card_put(card); | ||
358 | } | 371 | } |
359 | 372 | ||
360 | static void | 373 | static void |
@@ -510,7 +523,6 @@ fw_core_remove_card(struct fw_card *card) | |||
510 | fw_card_put(card); | 523 | fw_card_put(card); |
511 | wait_for_completion(&card->done); | 524 | wait_for_completion(&card->done); |
512 | 525 | ||
513 | cancel_delayed_work_sync(&card->work); | ||
514 | WARN_ON(!list_empty(&card->transaction_list)); | 526 | WARN_ON(!list_empty(&card->transaction_list)); |
515 | del_timer_sync(&card->flush_timer); | 527 | del_timer_sync(&card->flush_timer); |
516 | } | 528 | } |
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c index 6b9be42c7b98..c173be383725 100644 --- a/drivers/firewire/fw-device.c +++ b/drivers/firewire/fw-device.c | |||
@@ -617,7 +617,7 @@ static int shutdown_unit(struct device *device, void *data) | |||
617 | */ | 617 | */ |
618 | DECLARE_RWSEM(fw_device_rwsem); | 618 | DECLARE_RWSEM(fw_device_rwsem); |
619 | 619 | ||
620 | static DEFINE_IDR(fw_device_idr); | 620 | DEFINE_IDR(fw_device_idr); |
621 | int fw_cdev_major; | 621 | int fw_cdev_major; |
622 | 622 | ||
623 | struct fw_device *fw_device_get_by_devt(dev_t devt) | 623 | struct fw_device *fw_device_get_by_devt(dev_t devt) |
@@ -689,7 +689,7 @@ static void fw_device_init(struct work_struct *work) | |||
689 | fw_notify("giving up on config rom for node id %x\n", | 689 | fw_notify("giving up on config rom for node id %x\n", |
690 | device->node_id); | 690 | device->node_id); |
691 | if (device->node == device->card->root_node) | 691 | if (device->node == device->card->root_node) |
692 | schedule_delayed_work(&device->card->work, 0); | 692 | fw_schedule_bm_work(device->card, 0); |
693 | fw_device_release(&device->device); | 693 | fw_device_release(&device->device); |
694 | } | 694 | } |
695 | return; | 695 | return; |
@@ -758,7 +758,7 @@ static void fw_device_init(struct work_struct *work) | |||
758 | * pretty harmless. | 758 | * pretty harmless. |
759 | */ | 759 | */ |
760 | if (device->node == device->card->root_node) | 760 | if (device->node == device->card->root_node) |
761 | schedule_delayed_work(&device->card->work, 0); | 761 | fw_schedule_bm_work(device->card, 0); |
762 | 762 | ||
763 | return; | 763 | return; |
764 | 764 | ||
@@ -892,7 +892,7 @@ static void fw_device_refresh(struct work_struct *work) | |||
892 | fw_device_shutdown(work); | 892 | fw_device_shutdown(work); |
893 | out: | 893 | out: |
894 | if (node_id == card->root_node->node_id) | 894 | if (node_id == card->root_node->node_id) |
895 | schedule_delayed_work(&card->work, 0); | 895 | fw_schedule_bm_work(card, 0); |
896 | } | 896 | } |
897 | 897 | ||
898 | void fw_node_event(struct fw_card *card, struct fw_node *node, int event) | 898 | void fw_node_event(struct fw_card *card, struct fw_node *node, int event) |
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h index 42305bbac72f..df51732608d9 100644 --- a/drivers/firewire/fw-device.h +++ b/drivers/firewire/fw-device.h | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
23 | #include <linux/cdev.h> | 23 | #include <linux/cdev.h> |
24 | #include <linux/idr.h> | ||
24 | #include <linux/rwsem.h> | 25 | #include <linux/rwsem.h> |
25 | #include <asm/atomic.h> | 26 | #include <asm/atomic.h> |
26 | 27 | ||
@@ -99,6 +100,7 @@ void fw_device_cdev_update(struct fw_device *device); | |||
99 | void fw_device_cdev_remove(struct fw_device *device); | 100 | void fw_device_cdev_remove(struct fw_device *device); |
100 | 101 | ||
101 | extern struct rw_semaphore fw_device_rwsem; | 102 | extern struct rw_semaphore fw_device_rwsem; |
103 | extern struct idr fw_device_idr; | ||
102 | extern int fw_cdev_major; | 104 | extern int fw_cdev_major; |
103 | 105 | ||
104 | /* | 106 | /* |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index e54403ee59e7..e88d5067448c 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -670,17 +670,6 @@ static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu) | |||
670 | &d, sizeof(d), complete_agent_reset_write_no_wait, t); | 670 | &d, sizeof(d), complete_agent_reset_write_no_wait, t); |
671 | } | 671 | } |
672 | 672 | ||
673 | static void sbp2_set_generation(struct sbp2_logical_unit *lu, int generation) | ||
674 | { | ||
675 | struct fw_card *card = fw_device(lu->tgt->unit->device.parent)->card; | ||
676 | unsigned long flags; | ||
677 | |||
678 | /* serialize with comparisons of lu->generation and card->generation */ | ||
679 | spin_lock_irqsave(&card->lock, flags); | ||
680 | lu->generation = generation; | ||
681 | spin_unlock_irqrestore(&card->lock, flags); | ||
682 | } | ||
683 | |||
684 | static inline void sbp2_allow_block(struct sbp2_logical_unit *lu) | 673 | static inline void sbp2_allow_block(struct sbp2_logical_unit *lu) |
685 | { | 674 | { |
686 | /* | 675 | /* |
@@ -884,7 +873,7 @@ static void sbp2_login(struct work_struct *work) | |||
884 | goto out; | 873 | goto out; |
885 | 874 | ||
886 | generation = device->generation; | 875 | generation = device->generation; |
887 | smp_rmb(); /* node_id must not be older than generation */ | 876 | smp_rmb(); /* node IDs must not be older than generation */ |
888 | node_id = device->node_id; | 877 | node_id = device->node_id; |
889 | local_node_id = device->card->node_id; | 878 | local_node_id = device->card->node_id; |
890 | 879 | ||
@@ -908,7 +897,8 @@ static void sbp2_login(struct work_struct *work) | |||
908 | 897 | ||
909 | tgt->node_id = node_id; | 898 | tgt->node_id = node_id; |
910 | tgt->address_high = local_node_id << 16; | 899 | tgt->address_high = local_node_id << 16; |
911 | sbp2_set_generation(lu, generation); | 900 | smp_wmb(); /* node IDs must not be older than generation */ |
901 | lu->generation = generation; | ||
912 | 902 | ||
913 | lu->command_block_agent_address = | 903 | lu->command_block_agent_address = |
914 | ((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff) | 904 | ((u64)(be32_to_cpu(response.command_block_agent.high) & 0xffff) |
@@ -1201,7 +1191,7 @@ static void sbp2_reconnect(struct work_struct *work) | |||
1201 | goto out; | 1191 | goto out; |
1202 | 1192 | ||
1203 | generation = device->generation; | 1193 | generation = device->generation; |
1204 | smp_rmb(); /* node_id must not be older than generation */ | 1194 | smp_rmb(); /* node IDs must not be older than generation */ |
1205 | node_id = device->node_id; | 1195 | node_id = device->node_id; |
1206 | local_node_id = device->card->node_id; | 1196 | local_node_id = device->card->node_id; |
1207 | 1197 | ||
@@ -1228,7 +1218,8 @@ static void sbp2_reconnect(struct work_struct *work) | |||
1228 | 1218 | ||
1229 | tgt->node_id = node_id; | 1219 | tgt->node_id = node_id; |
1230 | tgt->address_high = local_node_id << 16; | 1220 | tgt->address_high = local_node_id << 16; |
1231 | sbp2_set_generation(lu, generation); | 1221 | smp_wmb(); /* node IDs must not be older than generation */ |
1222 | lu->generation = generation; | ||
1232 | 1223 | ||
1233 | fw_notify("%s: reconnected to LUN %04x (%d retries)\n", | 1224 | fw_notify("%s: reconnected to LUN %04x (%d retries)\n", |
1234 | tgt->bus_id, lu->lun, lu->retries); | 1225 | tgt->bus_id, lu->lun, lu->retries); |
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index 5e204713002d..c9be6e6948c4 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c | |||
@@ -355,6 +355,9 @@ report_lost_node(struct fw_card *card, | |||
355 | { | 355 | { |
356 | fw_node_event(card, node, FW_NODE_DESTROYED); | 356 | fw_node_event(card, node, FW_NODE_DESTROYED); |
357 | fw_node_put(node); | 357 | fw_node_put(node); |
358 | |||
359 | /* Topology has changed - reset bus manager retry counter */ | ||
360 | card->bm_retries = 0; | ||
358 | } | 361 | } |
359 | 362 | ||
360 | static void | 363 | static void |
@@ -374,6 +377,9 @@ report_found_node(struct fw_card *card, | |||
374 | } | 377 | } |
375 | 378 | ||
376 | fw_node_event(card, node, FW_NODE_CREATED); | 379 | fw_node_event(card, node, FW_NODE_CREATED); |
380 | |||
381 | /* Topology has changed - reset bus manager retry counter */ | ||
382 | card->bm_retries = 0; | ||
377 | } | 383 | } |
378 | 384 | ||
379 | void fw_destroy_nodes(struct fw_card *card) | 385 | void fw_destroy_nodes(struct fw_card *card) |
@@ -514,14 +520,6 @@ fw_core_handle_bus_reset(struct fw_card *card, | |||
514 | 520 | ||
515 | spin_lock_irqsave(&card->lock, flags); | 521 | spin_lock_irqsave(&card->lock, flags); |
516 | 522 | ||
517 | /* | ||
518 | * If the new topology has a different self_id_count the topology | ||
519 | * changed, either nodes were added or removed. In that case we | ||
520 | * reset the IRM reset counter. | ||
521 | */ | ||
522 | if (card->self_id_count != self_id_count) | ||
523 | card->bm_retries = 0; | ||
524 | |||
525 | card->node_id = node_id; | 523 | card->node_id = node_id; |
526 | /* | 524 | /* |
527 | * Update node_id before generation to prevent anybody from using | 525 | * Update node_id before generation to prevent anybody from using |
@@ -530,7 +528,7 @@ fw_core_handle_bus_reset(struct fw_card *card, | |||
530 | smp_wmb(); | 528 | smp_wmb(); |
531 | card->generation = generation; | 529 | card->generation = generation; |
532 | card->reset_jiffies = jiffies; | 530 | card->reset_jiffies = jiffies; |
533 | schedule_delayed_work(&card->work, 0); | 531 | fw_schedule_bm_work(card, 0); |
534 | 532 | ||
535 | local_node = build_tree(card, self_ids, self_id_count); | 533 | local_node = build_tree(card, self_ids, self_id_count); |
536 | 534 | ||
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index 2884f876397b..699ac041f39a 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -19,6 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/completion.h> | 21 | #include <linux/completion.h> |
22 | #include <linux/idr.h> | ||
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
23 | #include <linux/kref.h> | 24 | #include <linux/kref.h> |
24 | #include <linux/module.h> | 25 | #include <linux/module.h> |
@@ -971,6 +972,7 @@ static void __exit fw_core_cleanup(void) | |||
971 | { | 972 | { |
972 | unregister_chrdev(fw_cdev_major, "firewire"); | 973 | unregister_chrdev(fw_cdev_major, "firewire"); |
973 | bus_unregister(&fw_bus_type); | 974 | bus_unregister(&fw_bus_type); |
975 | idr_destroy(&fw_device_idr); | ||
974 | } | 976 | } |
975 | 977 | ||
976 | module_init(fw_core_init); | 978 | module_init(fw_core_init); |
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 839466f0a795..c9ab12a15f6e 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -237,14 +237,6 @@ struct fw_card { | |||
237 | int link_speed; | 237 | int link_speed; |
238 | int config_rom_generation; | 238 | int config_rom_generation; |
239 | 239 | ||
240 | /* | ||
241 | * We need to store up to 4 self ID for a maximum of 63 | ||
242 | * devices plus 3 words for the topology map header. | ||
243 | */ | ||
244 | int self_id_count; | ||
245 | u32 topology_map[252 + 3]; | ||
246 | u32 broadcast_channel; | ||
247 | |||
248 | spinlock_t lock; /* Take this lock when handling the lists in | 240 | spinlock_t lock; /* Take this lock when handling the lists in |
249 | * this struct. */ | 241 | * this struct. */ |
250 | struct fw_node *local_node; | 242 | struct fw_node *local_node; |
@@ -262,6 +254,9 @@ struct fw_card { | |||
262 | struct delayed_work work; | 254 | struct delayed_work work; |
263 | int bm_retries; | 255 | int bm_retries; |
264 | int bm_generation; | 256 | int bm_generation; |
257 | |||
258 | u32 broadcast_channel; | ||
259 | u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; | ||
265 | }; | 260 | }; |
266 | 261 | ||
267 | static inline struct fw_card *fw_card_get(struct fw_card *card) | 262 | static inline struct fw_card *fw_card_get(struct fw_card *card) |
@@ -278,6 +273,8 @@ static inline void fw_card_put(struct fw_card *card) | |||
278 | kref_put(&card->kref, fw_card_release); | 273 | kref_put(&card->kref, fw_card_release); |
279 | } | 274 | } |
280 | 275 | ||
276 | extern void fw_schedule_bm_work(struct fw_card *card, unsigned long delay); | ||
277 | |||
281 | /* | 278 | /* |
282 | * The iso packet format allows for an immediate header/payload part | 279 | * The iso packet format allows for an immediate header/payload part |
283 | * stored in 'header' immediately after the packet info plus an | 280 | * stored in 'header' immediately after the packet info plus an |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 6a98f9f572b0..d73eea382ab3 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -874,12 +874,14 @@ int hiddev_connect(struct hid_device *hid, unsigned int force) | |||
874 | INIT_LIST_HEAD(&hiddev->list); | 874 | INIT_LIST_HEAD(&hiddev->list); |
875 | spin_lock_init(&hiddev->list_lock); | 875 | spin_lock_init(&hiddev->list_lock); |
876 | mutex_init(&hiddev->existancelock); | 876 | mutex_init(&hiddev->existancelock); |
877 | hid->hiddev = hiddev; | ||
877 | hiddev->hid = hid; | 878 | hiddev->hid = hid; |
878 | hiddev->exist = 1; | 879 | hiddev->exist = 1; |
879 | 880 | ||
880 | retval = usb_register_dev(usbhid->intf, &hiddev_class); | 881 | retval = usb_register_dev(usbhid->intf, &hiddev_class); |
881 | if (retval) { | 882 | if (retval) { |
882 | err_hid("Not able to get a minor for this device."); | 883 | err_hid("Not able to get a minor for this device."); |
884 | hid->hiddev = NULL; | ||
883 | kfree(hiddev); | 885 | kfree(hiddev); |
884 | return -1; | 886 | return -1; |
885 | } else { | 887 | } else { |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index c709e821f04b..4b33bc82cc24 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -284,11 +284,12 @@ config SENSORS_F71805F | |||
284 | will be called f71805f. | 284 | will be called f71805f. |
285 | 285 | ||
286 | config SENSORS_F71882FG | 286 | config SENSORS_F71882FG |
287 | tristate "Fintek F71882FG and F71883FG" | 287 | tristate "Fintek F71862FG, F71882FG and F8000" |
288 | depends on EXPERIMENTAL | 288 | depends on EXPERIMENTAL |
289 | help | 289 | help |
290 | If you say yes here you get support for hardware monitoring | 290 | If you say yes here you get support for hardware monitoring |
291 | features of the Fintek F71882FG and F71883FG Super-I/O chips. | 291 | features of the Fintek F71882FG/F71883FG, F71862FG/71863FG |
292 | and F8000 Super-I/O chips. | ||
292 | 293 | ||
293 | This driver can also be built as a module. If so, the module | 294 | This driver can also be built as a module. If so, the module |
294 | will be called f71882fg. | 295 | will be called f71882fg. |
@@ -304,9 +305,13 @@ config SENSORS_F75375S | |||
304 | will be called f75375s. | 305 | will be called f75375s. |
305 | 306 | ||
306 | config SENSORS_FSCHER | 307 | config SENSORS_FSCHER |
307 | tristate "FSC Hermes" | 308 | tristate "FSC Hermes (DEPRECATED)" |
308 | depends on X86 && I2C | 309 | depends on X86 && I2C |
309 | help | 310 | help |
311 | This driver is DEPRECATED please use the new merged fschmd | ||
312 | ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver | ||
313 | instead. | ||
314 | |||
310 | If you say yes here you get support for Fujitsu Siemens | 315 | If you say yes here you get support for Fujitsu Siemens |
311 | Computers Hermes sensor chips. | 316 | Computers Hermes sensor chips. |
312 | 317 | ||
@@ -314,9 +319,13 @@ config SENSORS_FSCHER | |||
314 | will be called fscher. | 319 | will be called fscher. |
315 | 320 | ||
316 | config SENSORS_FSCPOS | 321 | config SENSORS_FSCPOS |
317 | tristate "FSC Poseidon" | 322 | tristate "FSC Poseidon (DEPRECATED)" |
318 | depends on X86 && I2C | 323 | depends on X86 && I2C |
319 | help | 324 | help |
325 | This driver is DEPRECATED please use the new merged fschmd | ||
326 | ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver | ||
327 | instead. | ||
328 | |||
320 | If you say yes here you get support for Fujitsu Siemens | 329 | If you say yes here you get support for Fujitsu Siemens |
321 | Computers Poseidon sensor chips. | 330 | Computers Poseidon sensor chips. |
322 | 331 | ||
@@ -325,14 +334,15 @@ config SENSORS_FSCPOS | |||
325 | 334 | ||
326 | config SENSORS_FSCHMD | 335 | config SENSORS_FSCHMD |
327 | tristate "FSC Poseidon, Scylla, Hermes, Heimdall and Heracles" | 336 | tristate "FSC Poseidon, Scylla, Hermes, Heimdall and Heracles" |
328 | depends on X86 && I2C && EXPERIMENTAL | 337 | depends on X86 && I2C |
329 | help | 338 | help |
330 | If you say yes here you get support for various Fujitsu Siemens | 339 | If you say yes here you get support for various Fujitsu Siemens |
331 | Computers sensor chips. | 340 | Computers sensor chips, including support for the integrated |
341 | watchdog. | ||
332 | 342 | ||
333 | This is a new merged driver for FSC sensor chips which is intended | 343 | This is a merged driver for FSC sensor chips replacing the fscpos, |
334 | as a replacment for the fscpos, fscscy and fscher drivers and adds | 344 | fscscy and fscher drivers and adding support for several other FSC |
335 | support for several other FCS sensor chips. | 345 | sensor chips. |
336 | 346 | ||
337 | This driver can also be built as a module. If so, the module | 347 | This driver can also be built as a module. If so, the module |
338 | will be called fschmd. | 348 | will be called fschmd. |
@@ -399,7 +409,8 @@ config SENSORS_IT87 | |||
399 | select HWMON_VID | 409 | select HWMON_VID |
400 | help | 410 | help |
401 | If you say yes here you get support for ITE IT8705F, IT8712F, | 411 | If you say yes here you get support for ITE IT8705F, IT8712F, |
402 | IT8716F, IT8718F and IT8726F sensor chips, and the SiS960 clone. | 412 | IT8716F, IT8718F, IT8720F and IT8726F sensor chips, and the |
413 | SiS960 clone. | ||
403 | 414 | ||
404 | This driver can also be built as a module. If so, the module | 415 | This driver can also be built as a module. If so, the module |
405 | will be called it87. | 416 | will be called it87. |
@@ -417,11 +428,12 @@ config SENSORS_LM63 | |||
417 | will be called lm63. | 428 | will be called lm63. |
418 | 429 | ||
419 | config SENSORS_LM70 | 430 | config SENSORS_LM70 |
420 | tristate "National Semiconductor LM70" | 431 | tristate "National Semiconductor LM70 / Texas Instruments TMP121" |
421 | depends on SPI_MASTER && EXPERIMENTAL | 432 | depends on SPI_MASTER && EXPERIMENTAL |
422 | help | 433 | help |
423 | If you say yes here you get support for the National Semiconductor | 434 | If you say yes here you get support for the National Semiconductor |
424 | LM70 digital temperature sensor chip. | 435 | LM70 and Texas Instruments TMP121/TMP123 digital temperature |
436 | sensor chips. | ||
425 | 437 | ||
426 | This driver can also be built as a module. If so, the module | 438 | This driver can also be built as a module. If so, the module |
427 | will be called lm70. | 439 | will be called lm70. |
@@ -548,6 +560,17 @@ config SENSORS_LM93 | |||
548 | This driver can also be built as a module. If so, the module | 560 | This driver can also be built as a module. If so, the module |
549 | will be called lm93. | 561 | will be called lm93. |
550 | 562 | ||
563 | config SENSORS_LTC4245 | ||
564 | tristate "Linear Technology LTC4245" | ||
565 | depends on I2C && EXPERIMENTAL | ||
566 | default n | ||
567 | help | ||
568 | If you say yes here you get support for Linear Technology LTC4245 | ||
569 | Multiple Supply Hot Swap Controller I2C interface. | ||
570 | |||
571 | This driver can also be built as a module. If so, the module will | ||
572 | be called ltc4245. | ||
573 | |||
551 | config SENSORS_MAX1111 | 574 | config SENSORS_MAX1111 |
552 | tristate "Maxim MAX1111 Multichannel, Serial 8-bit ADC chip" | 575 | tristate "Maxim MAX1111 Multichannel, Serial 8-bit ADC chip" |
553 | depends on SPI_MASTER | 576 | depends on SPI_MASTER |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 58fc5be5355d..8fd124eff646 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -62,6 +62,7 @@ obj-$(CONFIG_SENSORS_LM87) += lm87.o | |||
62 | obj-$(CONFIG_SENSORS_LM90) += lm90.o | 62 | obj-$(CONFIG_SENSORS_LM90) += lm90.o |
63 | obj-$(CONFIG_SENSORS_LM92) += lm92.o | 63 | obj-$(CONFIG_SENSORS_LM92) += lm92.o |
64 | obj-$(CONFIG_SENSORS_LM93) += lm93.o | 64 | obj-$(CONFIG_SENSORS_LM93) += lm93.o |
65 | obj-$(CONFIG_SENSORS_LTC4245) += ltc4245.o | ||
65 | obj-$(CONFIG_SENSORS_MAX1111) += max1111.o | 66 | obj-$(CONFIG_SENSORS_MAX1111) += max1111.o |
66 | obj-$(CONFIG_SENSORS_MAX1619) += max1619.o | 67 | obj-$(CONFIG_SENSORS_MAX1619) += max1619.o |
67 | obj-$(CONFIG_SENSORS_MAX6650) += max6650.o | 68 | obj-$(CONFIG_SENSORS_MAX6650) += max6650.o |
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 8a45a2e6ba8a..8acf82977e7b 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
@@ -53,7 +53,10 @@ static const unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END }; | |||
53 | 53 | ||
54 | /* Insmod parameters */ | 54 | /* Insmod parameters */ |
55 | I2C_CLIENT_INSMOD_1(asb100); | 55 | I2C_CLIENT_INSMOD_1(asb100); |
56 | I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " | 56 | |
57 | static unsigned short force_subclients[4]; | ||
58 | module_param_array(force_subclients, short, NULL, 0); | ||
59 | MODULE_PARM_DESC(force_subclients, "List of subclient addresses: " | ||
57 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); | 60 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); |
58 | 61 | ||
59 | /* Voltage IN registers 0-6 */ | 62 | /* Voltage IN registers 0-6 */ |
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 27a5d397f9a1..3df202a9ad72 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/hwmon-vid.h> | 34 | #include <linux/hwmon-vid.h> |
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/acpi.h> | ||
37 | #include <asm/io.h> | 38 | #include <asm/io.h> |
38 | 39 | ||
39 | /* ISA device, if found */ | 40 | /* ISA device, if found */ |
@@ -2361,6 +2362,10 @@ static int __init dme1737_isa_device_add(unsigned short addr) | |||
2361 | }; | 2362 | }; |
2362 | int err; | 2363 | int err; |
2363 | 2364 | ||
2365 | err = acpi_check_resource_conflict(&res); | ||
2366 | if (err) | ||
2367 | goto exit; | ||
2368 | |||
2364 | if (!(pdev = platform_device_alloc("dme1737", addr))) { | 2369 | if (!(pdev = platform_device_alloc("dme1737", addr))) { |
2365 | printk(KERN_ERR "dme1737: Failed to allocate device.\n"); | 2370 | printk(KERN_ERR "dme1737: Failed to allocate device.\n"); |
2366 | err = -ENOMEM; | 2371 | err = -ENOMEM; |
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 7a14a2dbb752..899876579253 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/mutex.h> | 39 | #include <linux/mutex.h> |
40 | #include <linux/sysfs.h> | 40 | #include <linux/sysfs.h> |
41 | #include <linux/ioport.h> | 41 | #include <linux/ioport.h> |
42 | #include <linux/acpi.h> | ||
42 | #include <asm/io.h> | 43 | #include <asm/io.h> |
43 | 44 | ||
44 | static unsigned short force_id; | 45 | static unsigned short force_id; |
@@ -1455,6 +1456,10 @@ static int __init f71805f_device_add(unsigned short address, | |||
1455 | } | 1456 | } |
1456 | 1457 | ||
1457 | res.name = pdev->name; | 1458 | res.name = pdev->name; |
1459 | err = acpi_check_resource_conflict(&res); | ||
1460 | if (err) | ||
1461 | goto exit_device_put; | ||
1462 | |||
1458 | err = platform_device_add_resources(pdev, &res, 1); | 1463 | err = platform_device_add_resources(pdev, &res, 1); |
1459 | if (err) { | 1464 | if (err) { |
1460 | printk(KERN_ERR DRVNAME ": Device resource addition failed " | 1465 | printk(KERN_ERR DRVNAME ": Device resource addition failed " |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 67067e9a323e..609cafff86bc 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * Copyright (C) 2006 by Hans Edgington <hans@edgington.nl> * | 2 | * Copyright (C) 2006 by Hans Edgington <hans@edgington.nl> * |
3 | * Copyright (C) 2007 by Hans de Goede <j.w.r.degoede@hhs.nl> * | 3 | * Copyright (C) 2007,2008 by Hans de Goede <hdegoede@redhat.com> * |
4 | * * | 4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * | 5 | * This program is free software; you can redistribute it and/or modify * |
6 | * it under the terms of the GNU General Public License as published by * | 6 | * it under the terms of the GNU General Public License as published by * |
@@ -27,11 +27,12 @@ | |||
27 | #include <linux/hwmon-sysfs.h> | 27 | #include <linux/hwmon-sysfs.h> |
28 | #include <linux/err.h> | 28 | #include <linux/err.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <asm/io.h> | 30 | #include <linux/io.h> |
31 | #include <linux/acpi.h> | ||
31 | 32 | ||
32 | #define DRVNAME "f71882fg" | 33 | #define DRVNAME "f71882fg" |
33 | 34 | ||
34 | #define SIO_F71882FG_LD_HWM 0x04 /* Hardware monitor logical device*/ | 35 | #define SIO_F71882FG_LD_HWM 0x04 /* Hardware monitor logical device */ |
35 | #define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */ | 36 | #define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */ |
36 | #define SIO_LOCK_KEY 0xAA /* Key to diasble Super-I/O */ | 37 | #define SIO_LOCK_KEY 0xAA /* Key to diasble Super-I/O */ |
37 | 38 | ||
@@ -43,7 +44,9 @@ | |||
43 | #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ | 44 | #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ |
44 | 45 | ||
45 | #define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ | 46 | #define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ |
47 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ | ||
46 | #define SIO_F71882_ID 0x0541 /* Chipset ID */ | 48 | #define SIO_F71882_ID 0x0541 /* Chipset ID */ |
49 | #define SIO_F8000_ID 0x0581 /* Chipset ID */ | ||
47 | 50 | ||
48 | #define REGION_LENGTH 8 | 51 | #define REGION_LENGTH 8 |
49 | #define ADDR_REG_OFFSET 5 | 52 | #define ADDR_REG_OFFSET 5 |
@@ -51,25 +54,36 @@ | |||
51 | 54 | ||
52 | #define F71882FG_REG_PECI 0x0A | 55 | #define F71882FG_REG_PECI 0x0A |
53 | 56 | ||
54 | #define F71882FG_REG_IN_STATUS 0x12 | 57 | #define F71882FG_REG_IN_STATUS 0x12 /* f71882fg only */ |
55 | #define F71882FG_REG_IN_BEEP 0x13 | 58 | #define F71882FG_REG_IN_BEEP 0x13 /* f71882fg only */ |
56 | #define F71882FG_REG_IN(nr) (0x20 + (nr)) | 59 | #define F71882FG_REG_IN(nr) (0x20 + (nr)) |
57 | #define F71882FG_REG_IN1_HIGH 0x32 | 60 | #define F71882FG_REG_IN1_HIGH 0x32 /* f71882fg only */ |
58 | 61 | ||
59 | #define F71882FG_REG_FAN(nr) (0xA0 + (16 * (nr))) | 62 | #define F71882FG_REG_FAN(nr) (0xA0 + (16 * (nr))) |
63 | #define F71882FG_REG_FAN_TARGET(nr) (0xA2 + (16 * (nr))) | ||
64 | #define F71882FG_REG_FAN_FULL_SPEED(nr) (0xA4 + (16 * (nr))) | ||
60 | #define F71882FG_REG_FAN_STATUS 0x92 | 65 | #define F71882FG_REG_FAN_STATUS 0x92 |
61 | #define F71882FG_REG_FAN_BEEP 0x93 | 66 | #define F71882FG_REG_FAN_BEEP 0x93 |
62 | 67 | ||
63 | #define F71882FG_REG_TEMP(nr) (0x72 + 2 * (nr)) | 68 | #define F71882FG_REG_TEMP(nr) (0x70 + 2 * (nr)) |
64 | #define F71882FG_REG_TEMP_OVT(nr) (0x82 + 2 * (nr)) | 69 | #define F71882FG_REG_TEMP_OVT(nr) (0x80 + 2 * (nr)) |
65 | #define F71882FG_REG_TEMP_HIGH(nr) (0x83 + 2 * (nr)) | 70 | #define F71882FG_REG_TEMP_HIGH(nr) (0x81 + 2 * (nr)) |
66 | #define F71882FG_REG_TEMP_STATUS 0x62 | 71 | #define F71882FG_REG_TEMP_STATUS 0x62 |
67 | #define F71882FG_REG_TEMP_BEEP 0x63 | 72 | #define F71882FG_REG_TEMP_BEEP 0x63 |
68 | #define F71882FG_REG_TEMP_HYST1 0x6C | 73 | #define F71882FG_REG_TEMP_HYST(nr) (0x6C + (nr)) |
69 | #define F71882FG_REG_TEMP_HYST23 0x6D | ||
70 | #define F71882FG_REG_TEMP_TYPE 0x6B | 74 | #define F71882FG_REG_TEMP_TYPE 0x6B |
71 | #define F71882FG_REG_TEMP_DIODE_OPEN 0x6F | 75 | #define F71882FG_REG_TEMP_DIODE_OPEN 0x6F |
72 | 76 | ||
77 | #define F71882FG_REG_PWM(nr) (0xA3 + (16 * (nr))) | ||
78 | #define F71882FG_REG_PWM_TYPE 0x94 | ||
79 | #define F71882FG_REG_PWM_ENABLE 0x96 | ||
80 | |||
81 | #define F71882FG_REG_FAN_HYST(nr) (0x98 + (nr)) | ||
82 | |||
83 | #define F71882FG_REG_POINT_PWM(pwm, point) (0xAA + (point) + (16 * (pwm))) | ||
84 | #define F71882FG_REG_POINT_TEMP(pwm, point) (0xA6 + (point) + (16 * (pwm))) | ||
85 | #define F71882FG_REG_POINT_MAPPING(nr) (0xAF + 16 * (nr)) | ||
86 | |||
73 | #define F71882FG_REG_START 0x01 | 87 | #define F71882FG_REG_START 0x01 |
74 | 88 | ||
75 | #define FAN_MIN_DETECT 366 /* Lowest detectable fanspeed */ | 89 | #define FAN_MIN_DETECT 366 /* Lowest detectable fanspeed */ |
@@ -78,7 +92,15 @@ static unsigned short force_id; | |||
78 | module_param(force_id, ushort, 0); | 92 | module_param(force_id, ushort, 0); |
79 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 93 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
80 | 94 | ||
81 | static struct platform_device *f71882fg_pdev = NULL; | 95 | enum chips { f71862fg, f71882fg, f8000 }; |
96 | |||
97 | static const char *f71882fg_names[] = { | ||
98 | "f71862fg", | ||
99 | "f71882fg", | ||
100 | "f8000", | ||
101 | }; | ||
102 | |||
103 | static struct platform_device *f71882fg_pdev; | ||
82 | 104 | ||
83 | /* Super-I/O Function prototypes */ | 105 | /* Super-I/O Function prototypes */ |
84 | static inline int superio_inb(int base, int reg); | 106 | static inline int superio_inb(int base, int reg); |
@@ -87,8 +109,13 @@ static inline void superio_enter(int base); | |||
87 | static inline void superio_select(int base, int ld); | 109 | static inline void superio_select(int base, int ld); |
88 | static inline void superio_exit(int base); | 110 | static inline void superio_exit(int base); |
89 | 111 | ||
112 | struct f71882fg_sio_data { | ||
113 | enum chips type; | ||
114 | }; | ||
115 | |||
90 | struct f71882fg_data { | 116 | struct f71882fg_data { |
91 | unsigned short addr; | 117 | unsigned short addr; |
118 | enum chips type; | ||
92 | struct device *hwmon_dev; | 119 | struct device *hwmon_dev; |
93 | 120 | ||
94 | struct mutex update_lock; | 121 | struct mutex update_lock; |
@@ -102,19 +129,30 @@ struct f71882fg_data { | |||
102 | u8 in_status; | 129 | u8 in_status; |
103 | u8 in_beep; | 130 | u8 in_beep; |
104 | u16 fan[4]; | 131 | u16 fan[4]; |
132 | u16 fan_target[4]; | ||
133 | u16 fan_full_speed[4]; | ||
105 | u8 fan_status; | 134 | u8 fan_status; |
106 | u8 fan_beep; | 135 | u8 fan_beep; |
107 | u8 temp[3]; | 136 | /* Note: all models have only 3 temperature channels, but on some |
108 | u8 temp_ovt[3]; | 137 | they are addressed as 0-2 and on others as 1-3, so for coding |
109 | u8 temp_high[3]; | 138 | convenience we reserve space for 4 channels */ |
110 | u8 temp_hyst[3]; | 139 | u8 temp[4]; |
111 | u8 temp_type[3]; | 140 | u8 temp_ovt[4]; |
141 | u8 temp_high[4]; | ||
142 | u8 temp_hyst[2]; /* 2 hysts stored per reg */ | ||
143 | u8 temp_type[4]; | ||
112 | u8 temp_status; | 144 | u8 temp_status; |
113 | u8 temp_beep; | 145 | u8 temp_beep; |
114 | u8 temp_diode_open; | 146 | u8 temp_diode_open; |
147 | u8 pwm[4]; | ||
148 | u8 pwm_enable; | ||
149 | u8 pwm_auto_point_hyst[2]; | ||
150 | u8 pwm_auto_point_mapping[4]; | ||
151 | u8 pwm_auto_point_pwm[4][5]; | ||
152 | u8 pwm_auto_point_temp[4][4]; | ||
115 | }; | 153 | }; |
116 | 154 | ||
117 | /* Sysfs in*/ | 155 | /* Sysfs in */ |
118 | static ssize_t show_in(struct device *dev, struct device_attribute *devattr, | 156 | static ssize_t show_in(struct device *dev, struct device_attribute *devattr, |
119 | char *buf); | 157 | char *buf); |
120 | static ssize_t show_in_max(struct device *dev, struct device_attribute | 158 | static ssize_t show_in_max(struct device *dev, struct device_attribute |
@@ -130,6 +168,10 @@ static ssize_t show_in_alarm(struct device *dev, struct device_attribute | |||
130 | /* Sysfs Fan */ | 168 | /* Sysfs Fan */ |
131 | static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, | 169 | static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, |
132 | char *buf); | 170 | char *buf); |
171 | static ssize_t show_fan_full_speed(struct device *dev, | ||
172 | struct device_attribute *devattr, char *buf); | ||
173 | static ssize_t store_fan_full_speed(struct device *dev, | ||
174 | struct device_attribute *devattr, const char *buf, size_t count); | ||
133 | static ssize_t show_fan_beep(struct device *dev, struct device_attribute | 175 | static ssize_t show_fan_beep(struct device *dev, struct device_attribute |
134 | *devattr, char *buf); | 176 | *devattr, char *buf); |
135 | static ssize_t store_fan_beep(struct device *dev, struct device_attribute | 177 | static ssize_t store_fan_beep(struct device *dev, struct device_attribute |
@@ -163,16 +205,41 @@ static ssize_t show_temp_alarm(struct device *dev, struct device_attribute | |||
163 | *devattr, char *buf); | 205 | *devattr, char *buf); |
164 | static ssize_t show_temp_fault(struct device *dev, struct device_attribute | 206 | static ssize_t show_temp_fault(struct device *dev, struct device_attribute |
165 | *devattr, char *buf); | 207 | *devattr, char *buf); |
208 | /* PWM and Auto point control */ | ||
209 | static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, | ||
210 | char *buf); | ||
211 | static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, | ||
212 | const char *buf, size_t count); | ||
213 | static ssize_t show_pwm_enable(struct device *dev, | ||
214 | struct device_attribute *devattr, char *buf); | ||
215 | static ssize_t store_pwm_enable(struct device *dev, | ||
216 | struct device_attribute *devattr, const char *buf, size_t count); | ||
217 | static ssize_t show_pwm_interpolate(struct device *dev, | ||
218 | struct device_attribute *devattr, char *buf); | ||
219 | static ssize_t store_pwm_interpolate(struct device *dev, | ||
220 | struct device_attribute *devattr, const char *buf, size_t count); | ||
221 | static ssize_t show_pwm_auto_point_channel(struct device *dev, | ||
222 | struct device_attribute *devattr, char *buf); | ||
223 | static ssize_t store_pwm_auto_point_channel(struct device *dev, | ||
224 | struct device_attribute *devattr, const char *buf, size_t count); | ||
225 | static ssize_t show_pwm_auto_point_temp_hyst(struct device *dev, | ||
226 | struct device_attribute *devattr, char *buf); | ||
227 | static ssize_t store_pwm_auto_point_temp_hyst(struct device *dev, | ||
228 | struct device_attribute *devattr, const char *buf, size_t count); | ||
229 | static ssize_t show_pwm_auto_point_pwm(struct device *dev, | ||
230 | struct device_attribute *devattr, char *buf); | ||
231 | static ssize_t store_pwm_auto_point_pwm(struct device *dev, | ||
232 | struct device_attribute *devattr, const char *buf, size_t count); | ||
233 | static ssize_t show_pwm_auto_point_temp(struct device *dev, | ||
234 | struct device_attribute *devattr, char *buf); | ||
235 | static ssize_t store_pwm_auto_point_temp(struct device *dev, | ||
236 | struct device_attribute *devattr, const char *buf, size_t count); | ||
166 | /* Sysfs misc */ | 237 | /* Sysfs misc */ |
167 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | 238 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, |
168 | char *buf); | 239 | char *buf); |
169 | 240 | ||
170 | static int __devinit f71882fg_probe(struct platform_device * pdev); | 241 | static int __devinit f71882fg_probe(struct platform_device * pdev); |
171 | static int __devexit f71882fg_remove(struct platform_device *pdev); | 242 | static int f71882fg_remove(struct platform_device *pdev); |
172 | static int __init f71882fg_init(void); | ||
173 | static int __init f71882fg_find(int sioaddr, unsigned short *address); | ||
174 | static int __init f71882fg_device_add(unsigned short address); | ||
175 | static void __exit f71882fg_exit(void); | ||
176 | 243 | ||
177 | static struct platform_driver f71882fg_driver = { | 244 | static struct platform_driver f71882fg_driver = { |
178 | .driver = { | 245 | .driver = { |
@@ -183,86 +250,531 @@ static struct platform_driver f71882fg_driver = { | |||
183 | .remove = __devexit_p(f71882fg_remove), | 250 | .remove = __devexit_p(f71882fg_remove), |
184 | }; | 251 | }; |
185 | 252 | ||
186 | static struct device_attribute f71882fg_dev_attr[] = | 253 | static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); |
187 | { | 254 | |
188 | __ATTR( name, S_IRUGO, show_name, NULL ), | 255 | /* Temp and in attr common to both the f71862fg and f71882fg */ |
256 | static struct sensor_device_attribute_2 f718x2fg_in_temp_attr[] = { | ||
257 | SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), | ||
258 | SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1), | ||
259 | SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2), | ||
260 | SENSOR_ATTR_2(in3_input, S_IRUGO, show_in, NULL, 0, 3), | ||
261 | SENSOR_ATTR_2(in4_input, S_IRUGO, show_in, NULL, 0, 4), | ||
262 | SENSOR_ATTR_2(in5_input, S_IRUGO, show_in, NULL, 0, 5), | ||
263 | SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 6), | ||
264 | SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 7), | ||
265 | SENSOR_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 0, 8), | ||
266 | SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1), | ||
267 | SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max, | ||
268 | store_temp_max, 0, 1), | ||
269 | SENSOR_ATTR_2(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, | ||
270 | store_temp_max_hyst, 0, 1), | ||
271 | /* Should really be temp1_max_alarm, but older versions did not handle | ||
272 | the max and crit alarms separately and lm_sensors v2 depends on the | ||
273 | presence of temp#_alarm files. The same goes for temp2/3 _alarm. */ | ||
274 | SENSOR_ATTR_2(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 1), | ||
275 | SENSOR_ATTR_2(temp1_max_beep, S_IRUGO|S_IWUSR, show_temp_beep, | ||
276 | store_temp_beep, 0, 1), | ||
277 | SENSOR_ATTR_2(temp1_crit, S_IRUGO|S_IWUSR, show_temp_crit, | ||
278 | store_temp_crit, 0, 1), | ||
279 | SENSOR_ATTR_2(temp1_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, | ||
280 | 0, 1), | ||
281 | SENSOR_ATTR_2(temp1_crit_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 5), | ||
282 | SENSOR_ATTR_2(temp1_crit_beep, S_IRUGO|S_IWUSR, show_temp_beep, | ||
283 | store_temp_beep, 0, 5), | ||
284 | SENSOR_ATTR_2(temp1_type, S_IRUGO, show_temp_type, NULL, 0, 1), | ||
285 | SENSOR_ATTR_2(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0, 1), | ||
286 | SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 2), | ||
287 | SENSOR_ATTR_2(temp2_max, S_IRUGO|S_IWUSR, show_temp_max, | ||
288 | store_temp_max, 0, 2), | ||
289 | SENSOR_ATTR_2(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, | ||
290 | store_temp_max_hyst, 0, 2), | ||
291 | /* Should be temp2_max_alarm, see temp1_alarm note */ | ||
292 | SENSOR_ATTR_2(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 2), | ||
293 | SENSOR_ATTR_2(temp2_max_beep, S_IRUGO|S_IWUSR, show_temp_beep, | ||
294 | store_temp_beep, 0, 2), | ||
295 | SENSOR_ATTR_2(temp2_crit, S_IRUGO|S_IWUSR, show_temp_crit, | ||
296 | store_temp_crit, 0, 2), | ||
297 | SENSOR_ATTR_2(temp2_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, | ||
298 | 0, 2), | ||
299 | SENSOR_ATTR_2(temp2_crit_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 6), | ||
300 | SENSOR_ATTR_2(temp2_crit_beep, S_IRUGO|S_IWUSR, show_temp_beep, | ||
301 | store_temp_beep, 0, 6), | ||
302 | SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2), | ||
303 | SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 2), | ||
304 | SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3), | ||
305 | SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max, | ||
306 | store_temp_max, 0, 3), | ||
307 | SENSOR_ATTR_2(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, | ||
308 | store_temp_max_hyst, 0, 3), | ||
309 | /* Should be temp3_max_alarm, see temp1_alarm note */ | ||
310 | SENSOR_ATTR_2(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 3), | ||
311 | SENSOR_ATTR_2(temp3_max_beep, S_IRUGO|S_IWUSR, show_temp_beep, | ||
312 | store_temp_beep, 0, 3), | ||
313 | SENSOR_ATTR_2(temp3_crit, S_IRUGO|S_IWUSR, show_temp_crit, | ||
314 | store_temp_crit, 0, 3), | ||
315 | SENSOR_ATTR_2(temp3_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, | ||
316 | 0, 3), | ||
317 | SENSOR_ATTR_2(temp3_crit_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 7), | ||
318 | SENSOR_ATTR_2(temp3_crit_beep, S_IRUGO|S_IWUSR, show_temp_beep, | ||
319 | store_temp_beep, 0, 7), | ||
320 | SENSOR_ATTR_2(temp3_type, S_IRUGO, show_temp_type, NULL, 0, 3), | ||
321 | SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 3), | ||
322 | }; | ||
323 | |||
324 | /* Temp and in attr found only on the f71882fg */ | ||
325 | static struct sensor_device_attribute_2 f71882fg_in_temp_attr[] = { | ||
326 | SENSOR_ATTR_2(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max, | ||
327 | 0, 1), | ||
328 | SENSOR_ATTR_2(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep, | ||
329 | 0, 1), | ||
330 | SENSOR_ATTR_2(in1_alarm, S_IRUGO, show_in_alarm, NULL, 0, 1), | ||
331 | }; | ||
332 | |||
333 | /* Temp and in attr for the f8000 | ||
334 | Note on the f8000 temp_ovt (crit) is used as max, and temp_high (max) | ||
335 | is used as hysteresis value to clear alarms | ||
336 | */ | ||
337 | static struct sensor_device_attribute_2 f8000_in_temp_attr[] = { | ||
338 | SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), | ||
339 | SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1), | ||
340 | SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2), | ||
341 | SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 0), | ||
342 | SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_crit, | ||
343 | store_temp_crit, 0, 0), | ||
344 | SENSOR_ATTR_2(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max, | ||
345 | store_temp_max, 0, 0), | ||
346 | SENSOR_ATTR_2(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 4), | ||
347 | SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, 0, 1), | ||
348 | SENSOR_ATTR_2(temp2_max, S_IRUGO|S_IWUSR, show_temp_crit, | ||
349 | store_temp_crit, 0, 1), | ||
350 | SENSOR_ATTR_2(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max, | ||
351 | store_temp_max, 0, 1), | ||
352 | SENSOR_ATTR_2(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 5), | ||
353 | SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 1), | ||
354 | SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 2), | ||
355 | SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_crit, | ||
356 | store_temp_crit, 0, 2), | ||
357 | SENSOR_ATTR_2(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max, | ||
358 | store_temp_max, 0, 2), | ||
359 | SENSOR_ATTR_2(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 0, 6), | ||
360 | }; | ||
361 | |||
362 | /* Fan / PWM attr common to all models */ | ||
363 | static struct sensor_device_attribute_2 fxxxx_fan_attr[] = { | ||
364 | SENSOR_ATTR_2(fan1_input, S_IRUGO, show_fan, NULL, 0, 0), | ||
365 | SENSOR_ATTR_2(fan1_full_speed, S_IRUGO|S_IWUSR, | ||
366 | show_fan_full_speed, | ||
367 | store_fan_full_speed, 0, 0), | ||
368 | SENSOR_ATTR_2(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 0), | ||
369 | SENSOR_ATTR_2(fan2_input, S_IRUGO, show_fan, NULL, 0, 1), | ||
370 | SENSOR_ATTR_2(fan2_full_speed, S_IRUGO|S_IWUSR, | ||
371 | show_fan_full_speed, | ||
372 | store_fan_full_speed, 0, 1), | ||
373 | SENSOR_ATTR_2(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 1), | ||
374 | SENSOR_ATTR_2(fan3_input, S_IRUGO, show_fan, NULL, 0, 2), | ||
375 | SENSOR_ATTR_2(fan3_full_speed, S_IRUGO|S_IWUSR, | ||
376 | show_fan_full_speed, | ||
377 | store_fan_full_speed, 0, 2), | ||
378 | SENSOR_ATTR_2(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 2), | ||
379 | |||
380 | SENSOR_ATTR_2(pwm1, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 0), | ||
381 | SENSOR_ATTR_2(pwm1_enable, S_IRUGO|S_IWUSR, show_pwm_enable, | ||
382 | store_pwm_enable, 0, 0), | ||
383 | SENSOR_ATTR_2(pwm1_interpolate, S_IRUGO|S_IWUSR, | ||
384 | show_pwm_interpolate, store_pwm_interpolate, 0, 0), | ||
385 | SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR, | ||
386 | show_pwm_auto_point_channel, | ||
387 | store_pwm_auto_point_channel, 0, 0), | ||
388 | |||
389 | SENSOR_ATTR_2(pwm2, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 1), | ||
390 | SENSOR_ATTR_2(pwm2_enable, S_IRUGO|S_IWUSR, show_pwm_enable, | ||
391 | store_pwm_enable, 0, 1), | ||
392 | SENSOR_ATTR_2(pwm2_interpolate, S_IRUGO|S_IWUSR, | ||
393 | show_pwm_interpolate, store_pwm_interpolate, 0, 1), | ||
394 | SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR, | ||
395 | show_pwm_auto_point_channel, | ||
396 | store_pwm_auto_point_channel, 0, 1), | ||
397 | |||
398 | SENSOR_ATTR_2(pwm3_interpolate, S_IRUGO|S_IWUSR, | ||
399 | show_pwm_interpolate, store_pwm_interpolate, 0, 2), | ||
400 | SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR, | ||
401 | show_pwm_auto_point_channel, | ||
402 | store_pwm_auto_point_channel, 0, 2), | ||
189 | }; | 403 | }; |
190 | 404 | ||
191 | static struct sensor_device_attribute f71882fg_in_temp_attr[] = | 405 | /* Fan / PWM attr for the f71862fg, less pwms and less zones per pwm than the |
192 | { | 406 | f71882fg */ |
193 | SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0), | 407 | static struct sensor_device_attribute_2 f71862fg_fan_attr[] = { |
194 | SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1), | 408 | SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
195 | SENSOR_ATTR(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max, 1), | 409 | store_fan_beep, 0, 0), |
196 | SENSOR_ATTR(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep, 1), | 410 | SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
197 | SENSOR_ATTR(in1_alarm, S_IRUGO, show_in_alarm, NULL, 1), | 411 | store_fan_beep, 0, 1), |
198 | SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2), | 412 | SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
199 | SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3), | 413 | store_fan_beep, 0, 2), |
200 | SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4), | 414 | |
201 | SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5), | 415 | SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR, |
202 | SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6), | 416 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, |
203 | SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7), | 417 | 1, 0), |
204 | SENSOR_ATTR(in8_input, S_IRUGO, show_in, NULL, 8), | 418 | SENSOR_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO|S_IWUSR, |
205 | SENSOR_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0), | 419 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, |
206 | SENSOR_ATTR(temp1_max, S_IRUGO|S_IWUSR, show_temp_max, | 420 | 4, 0), |
207 | store_temp_max, 0), | 421 | SENSOR_ATTR_2(pwm1_auto_point1_temp, S_IRUGO|S_IWUSR, |
208 | SENSOR_ATTR(temp1_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, | 422 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, |
209 | store_temp_max_hyst, 0), | 423 | 0, 0), |
210 | SENSOR_ATTR(temp1_crit, S_IRUGO|S_IWUSR, show_temp_crit, | 424 | SENSOR_ATTR_2(pwm1_auto_point2_temp, S_IRUGO|S_IWUSR, |
211 | store_temp_crit, 0), | 425 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, |
212 | SENSOR_ATTR(temp1_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 0), | 426 | 3, 0), |
213 | SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0), | 427 | SENSOR_ATTR_2(pwm1_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, |
214 | SENSOR_ATTR(temp1_beep, S_IRUGO|S_IWUSR, show_temp_beep, | 428 | show_pwm_auto_point_temp_hyst, |
215 | store_temp_beep, 0), | 429 | store_pwm_auto_point_temp_hyst, |
216 | SENSOR_ATTR(temp1_alarm, S_IRUGO, show_temp_alarm, NULL, 0), | 430 | 0, 0), |
217 | SENSOR_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0), | 431 | SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO, |
218 | SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1), | 432 | show_pwm_auto_point_temp_hyst, NULL, 3, 0), |
219 | SENSOR_ATTR(temp2_max, S_IRUGO|S_IWUSR, show_temp_max, | 433 | |
220 | store_temp_max, 1), | 434 | SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR, |
221 | SENSOR_ATTR(temp2_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, | 435 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, |
222 | store_temp_max_hyst, 1), | 436 | 1, 1), |
223 | SENSOR_ATTR(temp2_crit, S_IRUGO|S_IWUSR, show_temp_crit, | 437 | SENSOR_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO|S_IWUSR, |
224 | store_temp_crit, 1), | 438 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, |
225 | SENSOR_ATTR(temp2_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 1), | 439 | 4, 1), |
226 | SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1), | 440 | SENSOR_ATTR_2(pwm2_auto_point1_temp, S_IRUGO|S_IWUSR, |
227 | SENSOR_ATTR(temp2_beep, S_IRUGO|S_IWUSR, show_temp_beep, | 441 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, |
228 | store_temp_beep, 1), | 442 | 0, 1), |
229 | SENSOR_ATTR(temp2_alarm, S_IRUGO, show_temp_alarm, NULL, 1), | 443 | SENSOR_ATTR_2(pwm2_auto_point2_temp, S_IRUGO|S_IWUSR, |
230 | SENSOR_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1), | 444 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, |
231 | SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2), | 445 | 3, 1), |
232 | SENSOR_ATTR(temp3_max, S_IRUGO|S_IWUSR, show_temp_max, | 446 | SENSOR_ATTR_2(pwm2_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, |
233 | store_temp_max, 2), | 447 | show_pwm_auto_point_temp_hyst, |
234 | SENSOR_ATTR(temp3_max_hyst, S_IRUGO|S_IWUSR, show_temp_max_hyst, | 448 | store_pwm_auto_point_temp_hyst, |
235 | store_temp_max_hyst, 2), | 449 | 0, 1), |
236 | SENSOR_ATTR(temp3_crit, S_IRUGO|S_IWUSR, show_temp_crit, | 450 | SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO, |
237 | store_temp_crit, 2), | 451 | show_pwm_auto_point_temp_hyst, NULL, 3, 1), |
238 | SENSOR_ATTR(temp3_crit_hyst, S_IRUGO, show_temp_crit_hyst, NULL, 2), | 452 | |
239 | SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2), | 453 | SENSOR_ATTR_2(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 2), |
240 | SENSOR_ATTR(temp3_beep, S_IRUGO|S_IWUSR, show_temp_beep, | 454 | SENSOR_ATTR_2(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable, |
241 | store_temp_beep, 2), | 455 | store_pwm_enable, 0, 2), |
242 | SENSOR_ATTR(temp3_alarm, S_IRUGO, show_temp_alarm, NULL, 2), | 456 | SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR, |
243 | SENSOR_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2) | 457 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, |
458 | 1, 2), | ||
459 | SENSOR_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
460 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
461 | 4, 2), | ||
462 | SENSOR_ATTR_2(pwm3_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
463 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
464 | 0, 2), | ||
465 | SENSOR_ATTR_2(pwm3_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
466 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
467 | 3, 2), | ||
468 | SENSOR_ATTR_2(pwm3_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
469 | show_pwm_auto_point_temp_hyst, | ||
470 | store_pwm_auto_point_temp_hyst, | ||
471 | 0, 2), | ||
472 | SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO, | ||
473 | show_pwm_auto_point_temp_hyst, NULL, 3, 2), | ||
244 | }; | 474 | }; |
245 | 475 | ||
246 | static struct sensor_device_attribute f71882fg_fan_attr[] = | 476 | /* Fan / PWM attr for the f71882fg */ |
247 | { | 477 | static struct sensor_device_attribute_2 f71882fg_fan_attr[] = { |
248 | SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0), | 478 | SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
249 | SENSOR_ATTR(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, | 479 | store_fan_beep, 0, 0), |
250 | store_fan_beep, 0), | 480 | SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
251 | SENSOR_ATTR(fan1_alarm, S_IRUGO, show_fan_alarm, NULL, 0), | 481 | store_fan_beep, 0, 1), |
252 | SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1), | 482 | SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
253 | SENSOR_ATTR(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep, | 483 | store_fan_beep, 0, 2), |
254 | store_fan_beep, 1), | 484 | SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3), |
255 | SENSOR_ATTR(fan2_alarm, S_IRUGO, show_fan_alarm, NULL, 1), | 485 | SENSOR_ATTR_2(fan4_full_speed, S_IRUGO|S_IWUSR, |
256 | SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2), | 486 | show_fan_full_speed, |
257 | SENSOR_ATTR(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep, | 487 | store_fan_full_speed, 0, 3), |
258 | store_fan_beep, 2), | 488 | SENSOR_ATTR_2(fan4_beep, S_IRUGO|S_IWUSR, show_fan_beep, |
259 | SENSOR_ATTR(fan3_alarm, S_IRUGO, show_fan_alarm, NULL, 2), | 489 | store_fan_beep, 0, 3), |
260 | SENSOR_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3), | 490 | SENSOR_ATTR_2(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 0, 3), |
261 | SENSOR_ATTR(fan4_beep, S_IRUGO|S_IWUSR, show_fan_beep, | 491 | |
262 | store_fan_beep, 3), | 492 | SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR, |
263 | SENSOR_ATTR(fan4_alarm, S_IRUGO, show_fan_alarm, NULL, 3) | 493 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, |
494 | 0, 0), | ||
495 | SENSOR_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
496 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
497 | 1, 0), | ||
498 | SENSOR_ATTR_2(pwm1_auto_point3_pwm, S_IRUGO|S_IWUSR, | ||
499 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
500 | 2, 0), | ||
501 | SENSOR_ATTR_2(pwm1_auto_point4_pwm, S_IRUGO|S_IWUSR, | ||
502 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
503 | 3, 0), | ||
504 | SENSOR_ATTR_2(pwm1_auto_point5_pwm, S_IRUGO|S_IWUSR, | ||
505 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
506 | 4, 0), | ||
507 | SENSOR_ATTR_2(pwm1_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
508 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
509 | 0, 0), | ||
510 | SENSOR_ATTR_2(pwm1_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
511 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
512 | 1, 0), | ||
513 | SENSOR_ATTR_2(pwm1_auto_point3_temp, S_IRUGO|S_IWUSR, | ||
514 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
515 | 2, 0), | ||
516 | SENSOR_ATTR_2(pwm1_auto_point4_temp, S_IRUGO|S_IWUSR, | ||
517 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
518 | 3, 0), | ||
519 | SENSOR_ATTR_2(pwm1_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
520 | show_pwm_auto_point_temp_hyst, | ||
521 | store_pwm_auto_point_temp_hyst, | ||
522 | 0, 0), | ||
523 | SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO, | ||
524 | show_pwm_auto_point_temp_hyst, NULL, 1, 0), | ||
525 | SENSOR_ATTR_2(pwm1_auto_point3_temp_hyst, S_IRUGO, | ||
526 | show_pwm_auto_point_temp_hyst, NULL, 2, 0), | ||
527 | SENSOR_ATTR_2(pwm1_auto_point4_temp_hyst, S_IRUGO, | ||
528 | show_pwm_auto_point_temp_hyst, NULL, 3, 0), | ||
529 | |||
530 | SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR, | ||
531 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
532 | 0, 1), | ||
533 | SENSOR_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
534 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
535 | 1, 1), | ||
536 | SENSOR_ATTR_2(pwm2_auto_point3_pwm, S_IRUGO|S_IWUSR, | ||
537 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
538 | 2, 1), | ||
539 | SENSOR_ATTR_2(pwm2_auto_point4_pwm, S_IRUGO|S_IWUSR, | ||
540 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
541 | 3, 1), | ||
542 | SENSOR_ATTR_2(pwm2_auto_point5_pwm, S_IRUGO|S_IWUSR, | ||
543 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
544 | 4, 1), | ||
545 | SENSOR_ATTR_2(pwm2_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
546 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
547 | 0, 1), | ||
548 | SENSOR_ATTR_2(pwm2_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
549 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
550 | 1, 1), | ||
551 | SENSOR_ATTR_2(pwm2_auto_point3_temp, S_IRUGO|S_IWUSR, | ||
552 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
553 | 2, 1), | ||
554 | SENSOR_ATTR_2(pwm2_auto_point4_temp, S_IRUGO|S_IWUSR, | ||
555 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
556 | 3, 1), | ||
557 | SENSOR_ATTR_2(pwm2_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
558 | show_pwm_auto_point_temp_hyst, | ||
559 | store_pwm_auto_point_temp_hyst, | ||
560 | 0, 1), | ||
561 | SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO, | ||
562 | show_pwm_auto_point_temp_hyst, NULL, 1, 1), | ||
563 | SENSOR_ATTR_2(pwm2_auto_point3_temp_hyst, S_IRUGO, | ||
564 | show_pwm_auto_point_temp_hyst, NULL, 2, 1), | ||
565 | SENSOR_ATTR_2(pwm2_auto_point4_temp_hyst, S_IRUGO, | ||
566 | show_pwm_auto_point_temp_hyst, NULL, 3, 1), | ||
567 | |||
568 | SENSOR_ATTR_2(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 2), | ||
569 | SENSOR_ATTR_2(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable, | ||
570 | store_pwm_enable, 0, 2), | ||
571 | SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR, | ||
572 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
573 | 0, 2), | ||
574 | SENSOR_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
575 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
576 | 1, 2), | ||
577 | SENSOR_ATTR_2(pwm3_auto_point3_pwm, S_IRUGO|S_IWUSR, | ||
578 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
579 | 2, 2), | ||
580 | SENSOR_ATTR_2(pwm3_auto_point4_pwm, S_IRUGO|S_IWUSR, | ||
581 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
582 | 3, 2), | ||
583 | SENSOR_ATTR_2(pwm3_auto_point5_pwm, S_IRUGO|S_IWUSR, | ||
584 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
585 | 4, 2), | ||
586 | SENSOR_ATTR_2(pwm3_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
587 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
588 | 0, 2), | ||
589 | SENSOR_ATTR_2(pwm3_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
590 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
591 | 1, 2), | ||
592 | SENSOR_ATTR_2(pwm3_auto_point3_temp, S_IRUGO|S_IWUSR, | ||
593 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
594 | 2, 2), | ||
595 | SENSOR_ATTR_2(pwm3_auto_point4_temp, S_IRUGO|S_IWUSR, | ||
596 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
597 | 3, 2), | ||
598 | SENSOR_ATTR_2(pwm3_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
599 | show_pwm_auto_point_temp_hyst, | ||
600 | store_pwm_auto_point_temp_hyst, | ||
601 | 0, 2), | ||
602 | SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO, | ||
603 | show_pwm_auto_point_temp_hyst, NULL, 1, 2), | ||
604 | SENSOR_ATTR_2(pwm3_auto_point3_temp_hyst, S_IRUGO, | ||
605 | show_pwm_auto_point_temp_hyst, NULL, 2, 2), | ||
606 | SENSOR_ATTR_2(pwm3_auto_point4_temp_hyst, S_IRUGO, | ||
607 | show_pwm_auto_point_temp_hyst, NULL, 3, 2), | ||
608 | |||
609 | SENSOR_ATTR_2(pwm4, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 3), | ||
610 | SENSOR_ATTR_2(pwm4_enable, S_IRUGO|S_IWUSR, show_pwm_enable, | ||
611 | store_pwm_enable, 0, 3), | ||
612 | SENSOR_ATTR_2(pwm4_interpolate, S_IRUGO|S_IWUSR, | ||
613 | show_pwm_interpolate, store_pwm_interpolate, 0, 3), | ||
614 | SENSOR_ATTR_2(pwm4_auto_channels_temp, S_IRUGO|S_IWUSR, | ||
615 | show_pwm_auto_point_channel, | ||
616 | store_pwm_auto_point_channel, 0, 3), | ||
617 | SENSOR_ATTR_2(pwm4_auto_point1_pwm, S_IRUGO|S_IWUSR, | ||
618 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
619 | 0, 3), | ||
620 | SENSOR_ATTR_2(pwm4_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
621 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
622 | 1, 3), | ||
623 | SENSOR_ATTR_2(pwm4_auto_point3_pwm, S_IRUGO|S_IWUSR, | ||
624 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
625 | 2, 3), | ||
626 | SENSOR_ATTR_2(pwm4_auto_point4_pwm, S_IRUGO|S_IWUSR, | ||
627 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
628 | 3, 3), | ||
629 | SENSOR_ATTR_2(pwm4_auto_point5_pwm, S_IRUGO|S_IWUSR, | ||
630 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
631 | 4, 3), | ||
632 | SENSOR_ATTR_2(pwm4_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
633 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
634 | 0, 3), | ||
635 | SENSOR_ATTR_2(pwm4_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
636 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
637 | 1, 3), | ||
638 | SENSOR_ATTR_2(pwm4_auto_point3_temp, S_IRUGO|S_IWUSR, | ||
639 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
640 | 2, 3), | ||
641 | SENSOR_ATTR_2(pwm4_auto_point4_temp, S_IRUGO|S_IWUSR, | ||
642 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
643 | 3, 3), | ||
644 | SENSOR_ATTR_2(pwm4_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
645 | show_pwm_auto_point_temp_hyst, | ||
646 | store_pwm_auto_point_temp_hyst, | ||
647 | 0, 3), | ||
648 | SENSOR_ATTR_2(pwm4_auto_point2_temp_hyst, S_IRUGO, | ||
649 | show_pwm_auto_point_temp_hyst, NULL, 1, 3), | ||
650 | SENSOR_ATTR_2(pwm4_auto_point3_temp_hyst, S_IRUGO, | ||
651 | show_pwm_auto_point_temp_hyst, NULL, 2, 3), | ||
652 | SENSOR_ATTR_2(pwm4_auto_point4_temp_hyst, S_IRUGO, | ||
653 | show_pwm_auto_point_temp_hyst, NULL, 3, 3), | ||
264 | }; | 654 | }; |
265 | 655 | ||
656 | /* Fan / PWM attr for the f8000, zones mapped to temp instead of to pwm! | ||
657 | Also the register block at offset A0 maps to TEMP1 (so our temp2, as the | ||
658 | F8000 starts counting temps at 0), B0 maps the TEMP2 and C0 maps to TEMP0 */ | ||
659 | static struct sensor_device_attribute_2 f8000_fan_attr[] = { | ||
660 | SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3), | ||
661 | |||
662 | SENSOR_ATTR_2(pwm3, S_IRUGO, show_pwm, NULL, 0, 2), | ||
663 | |||
664 | SENSOR_ATTR_2(temp1_auto_point1_pwm, S_IRUGO|S_IWUSR, | ||
665 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
666 | 0, 2), | ||
667 | SENSOR_ATTR_2(temp1_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
668 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
669 | 1, 2), | ||
670 | SENSOR_ATTR_2(temp1_auto_point3_pwm, S_IRUGO|S_IWUSR, | ||
671 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
672 | 2, 2), | ||
673 | SENSOR_ATTR_2(temp1_auto_point4_pwm, S_IRUGO|S_IWUSR, | ||
674 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
675 | 3, 2), | ||
676 | SENSOR_ATTR_2(temp1_auto_point5_pwm, S_IRUGO|S_IWUSR, | ||
677 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
678 | 4, 2), | ||
679 | SENSOR_ATTR_2(temp1_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
680 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
681 | 0, 2), | ||
682 | SENSOR_ATTR_2(temp1_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
683 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
684 | 1, 2), | ||
685 | SENSOR_ATTR_2(temp1_auto_point3_temp, S_IRUGO|S_IWUSR, | ||
686 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
687 | 2, 2), | ||
688 | SENSOR_ATTR_2(temp1_auto_point4_temp, S_IRUGO|S_IWUSR, | ||
689 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
690 | 3, 2), | ||
691 | SENSOR_ATTR_2(temp1_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
692 | show_pwm_auto_point_temp_hyst, | ||
693 | store_pwm_auto_point_temp_hyst, | ||
694 | 0, 2), | ||
695 | SENSOR_ATTR_2(temp1_auto_point2_temp_hyst, S_IRUGO, | ||
696 | show_pwm_auto_point_temp_hyst, NULL, 1, 2), | ||
697 | SENSOR_ATTR_2(temp1_auto_point3_temp_hyst, S_IRUGO, | ||
698 | show_pwm_auto_point_temp_hyst, NULL, 2, 2), | ||
699 | SENSOR_ATTR_2(temp1_auto_point4_temp_hyst, S_IRUGO, | ||
700 | show_pwm_auto_point_temp_hyst, NULL, 3, 2), | ||
701 | |||
702 | SENSOR_ATTR_2(temp2_auto_point1_pwm, S_IRUGO|S_IWUSR, | ||
703 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
704 | 0, 0), | ||
705 | SENSOR_ATTR_2(temp2_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
706 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
707 | 1, 0), | ||
708 | SENSOR_ATTR_2(temp2_auto_point3_pwm, S_IRUGO|S_IWUSR, | ||
709 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
710 | 2, 0), | ||
711 | SENSOR_ATTR_2(temp2_auto_point4_pwm, S_IRUGO|S_IWUSR, | ||
712 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
713 | 3, 0), | ||
714 | SENSOR_ATTR_2(temp2_auto_point5_pwm, S_IRUGO|S_IWUSR, | ||
715 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
716 | 4, 0), | ||
717 | SENSOR_ATTR_2(temp2_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
718 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
719 | 0, 0), | ||
720 | SENSOR_ATTR_2(temp2_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
721 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
722 | 1, 0), | ||
723 | SENSOR_ATTR_2(temp2_auto_point3_temp, S_IRUGO|S_IWUSR, | ||
724 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
725 | 2, 0), | ||
726 | SENSOR_ATTR_2(temp2_auto_point4_temp, S_IRUGO|S_IWUSR, | ||
727 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
728 | 3, 0), | ||
729 | SENSOR_ATTR_2(temp2_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
730 | show_pwm_auto_point_temp_hyst, | ||
731 | store_pwm_auto_point_temp_hyst, | ||
732 | 0, 0), | ||
733 | SENSOR_ATTR_2(temp2_auto_point2_temp_hyst, S_IRUGO, | ||
734 | show_pwm_auto_point_temp_hyst, NULL, 1, 0), | ||
735 | SENSOR_ATTR_2(temp2_auto_point3_temp_hyst, S_IRUGO, | ||
736 | show_pwm_auto_point_temp_hyst, NULL, 2, 0), | ||
737 | SENSOR_ATTR_2(temp2_auto_point4_temp_hyst, S_IRUGO, | ||
738 | show_pwm_auto_point_temp_hyst, NULL, 3, 0), | ||
739 | |||
740 | SENSOR_ATTR_2(temp3_auto_point1_pwm, S_IRUGO|S_IWUSR, | ||
741 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
742 | 0, 1), | ||
743 | SENSOR_ATTR_2(temp3_auto_point2_pwm, S_IRUGO|S_IWUSR, | ||
744 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
745 | 1, 1), | ||
746 | SENSOR_ATTR_2(temp3_auto_point3_pwm, S_IRUGO|S_IWUSR, | ||
747 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
748 | 2, 1), | ||
749 | SENSOR_ATTR_2(temp3_auto_point4_pwm, S_IRUGO|S_IWUSR, | ||
750 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
751 | 3, 1), | ||
752 | SENSOR_ATTR_2(temp3_auto_point5_pwm, S_IRUGO|S_IWUSR, | ||
753 | show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, | ||
754 | 4, 1), | ||
755 | SENSOR_ATTR_2(temp3_auto_point1_temp, S_IRUGO|S_IWUSR, | ||
756 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
757 | 0, 1), | ||
758 | SENSOR_ATTR_2(temp3_auto_point2_temp, S_IRUGO|S_IWUSR, | ||
759 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
760 | 1, 1), | ||
761 | SENSOR_ATTR_2(temp3_auto_point3_temp, S_IRUGO|S_IWUSR, | ||
762 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
763 | 2, 1), | ||
764 | SENSOR_ATTR_2(temp3_auto_point4_temp, S_IRUGO|S_IWUSR, | ||
765 | show_pwm_auto_point_temp, store_pwm_auto_point_temp, | ||
766 | 3, 1), | ||
767 | SENSOR_ATTR_2(temp3_auto_point1_temp_hyst, S_IRUGO|S_IWUSR, | ||
768 | show_pwm_auto_point_temp_hyst, | ||
769 | store_pwm_auto_point_temp_hyst, | ||
770 | 0, 1), | ||
771 | SENSOR_ATTR_2(temp3_auto_point2_temp_hyst, S_IRUGO, | ||
772 | show_pwm_auto_point_temp_hyst, NULL, 1, 1), | ||
773 | SENSOR_ATTR_2(temp3_auto_point3_temp_hyst, S_IRUGO, | ||
774 | show_pwm_auto_point_temp_hyst, NULL, 2, 1), | ||
775 | SENSOR_ATTR_2(temp3_auto_point4_temp_hyst, S_IRUGO, | ||
776 | show_pwm_auto_point_temp_hyst, NULL, 3, 1), | ||
777 | }; | ||
266 | 778 | ||
267 | /* Super I/O functions */ | 779 | /* Super I/O functions */ |
268 | static inline int superio_inb(int base, int reg) | 780 | static inline int superio_inb(int base, int reg) |
@@ -299,11 +811,16 @@ static inline void superio_exit(int base) | |||
299 | outb(SIO_LOCK_KEY, base); | 811 | outb(SIO_LOCK_KEY, base); |
300 | } | 812 | } |
301 | 813 | ||
302 | static inline u16 fan_from_reg(u16 reg) | 814 | static inline int fan_from_reg(u16 reg) |
303 | { | 815 | { |
304 | return reg ? (1500000 / reg) : 0; | 816 | return reg ? (1500000 / reg) : 0; |
305 | } | 817 | } |
306 | 818 | ||
819 | static inline u16 fan_to_reg(int fan) | ||
820 | { | ||
821 | return fan ? (1500000 / fan) : 0; | ||
822 | } | ||
823 | |||
307 | static u8 f71882fg_read8(struct f71882fg_data *data, u8 reg) | 824 | static u8 f71882fg_read8(struct f71882fg_data *data, u8 reg) |
308 | { | 825 | { |
309 | u8 val; | 826 | u8 val; |
@@ -332,52 +849,111 @@ static void f71882fg_write8(struct f71882fg_data *data, u8 reg, u8 val) | |||
332 | outb(val, data->addr + DATA_REG_OFFSET); | 849 | outb(val, data->addr + DATA_REG_OFFSET); |
333 | } | 850 | } |
334 | 851 | ||
335 | static struct f71882fg_data *f71882fg_update_device(struct device * dev) | 852 | static void f71882fg_write16(struct f71882fg_data *data, u8 reg, u16 val) |
853 | { | ||
854 | outb(reg++, data->addr + ADDR_REG_OFFSET); | ||
855 | outb(val >> 8, data->addr + DATA_REG_OFFSET); | ||
856 | outb(reg, data->addr + ADDR_REG_OFFSET); | ||
857 | outb(val & 255, data->addr + DATA_REG_OFFSET); | ||
858 | } | ||
859 | |||
860 | static struct f71882fg_data *f71882fg_update_device(struct device *dev) | ||
336 | { | 861 | { |
337 | struct f71882fg_data *data = dev_get_drvdata(dev); | 862 | struct f71882fg_data *data = dev_get_drvdata(dev); |
338 | int nr, reg, reg2; | 863 | int nr, reg = 0, reg2; |
864 | int nr_fans = (data->type == f71882fg) ? 4 : 3; | ||
865 | int nr_ins = (data->type == f8000) ? 3 : 9; | ||
866 | int temp_start = (data->type == f8000) ? 0 : 1; | ||
339 | 867 | ||
340 | mutex_lock(&data->update_lock); | 868 | mutex_lock(&data->update_lock); |
341 | 869 | ||
342 | /* Update once every 60 seconds */ | 870 | /* Update once every 60 seconds */ |
343 | if ( time_after(jiffies, data->last_limits + 60 * HZ ) || | 871 | if ( time_after(jiffies, data->last_limits + 60 * HZ ) || |
344 | !data->valid) { | 872 | !data->valid) { |
345 | data->in1_max = f71882fg_read8(data, F71882FG_REG_IN1_HIGH); | 873 | if (data->type == f71882fg) { |
346 | data->in_beep = f71882fg_read8(data, F71882FG_REG_IN_BEEP); | 874 | data->in1_max = |
875 | f71882fg_read8(data, F71882FG_REG_IN1_HIGH); | ||
876 | data->in_beep = | ||
877 | f71882fg_read8(data, F71882FG_REG_IN_BEEP); | ||
878 | } | ||
347 | 879 | ||
348 | /* Get High & boundary temps*/ | 880 | /* Get High & boundary temps*/ |
349 | for (nr = 0; nr < 3; nr++) { | 881 | for (nr = temp_start; nr < 3 + temp_start; nr++) { |
350 | data->temp_ovt[nr] = f71882fg_read8(data, | 882 | data->temp_ovt[nr] = f71882fg_read8(data, |
351 | F71882FG_REG_TEMP_OVT(nr)); | 883 | F71882FG_REG_TEMP_OVT(nr)); |
352 | data->temp_high[nr] = f71882fg_read8(data, | 884 | data->temp_high[nr] = f71882fg_read8(data, |
353 | F71882FG_REG_TEMP_HIGH(nr)); | 885 | F71882FG_REG_TEMP_HIGH(nr)); |
354 | } | 886 | } |
355 | 887 | ||
356 | /* Have to hardcode hyst*/ | 888 | if (data->type != f8000) { |
357 | data->temp_hyst[0] = f71882fg_read8(data, | 889 | data->fan_beep = f71882fg_read8(data, |
358 | F71882FG_REG_TEMP_HYST1) >> 4; | 890 | F71882FG_REG_FAN_BEEP); |
359 | /* Hyst temps 2 & 3 stored in same register */ | 891 | data->temp_beep = f71882fg_read8(data, |
360 | reg = f71882fg_read8(data, F71882FG_REG_TEMP_HYST23); | 892 | F71882FG_REG_TEMP_BEEP); |
361 | data->temp_hyst[1] = reg & 0x0F; | 893 | data->temp_hyst[0] = f71882fg_read8(data, |
362 | data->temp_hyst[2] = reg >> 4; | 894 | F71882FG_REG_TEMP_HYST(0)); |
363 | 895 | data->temp_hyst[1] = f71882fg_read8(data, | |
364 | /* Have to hardcode type, because temp1 is special */ | 896 | F71882FG_REG_TEMP_HYST(1)); |
365 | reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE); | 897 | /* Have to hardcode type, because temp1 is special */ |
898 | reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE); | ||
899 | data->temp_type[2] = (reg & 0x04) ? 2 : 4; | ||
900 | data->temp_type[3] = (reg & 0x08) ? 2 : 4; | ||
901 | } | ||
366 | reg2 = f71882fg_read8(data, F71882FG_REG_PECI); | 902 | reg2 = f71882fg_read8(data, F71882FG_REG_PECI); |
367 | if ((reg2 & 0x03) == 0x01) | 903 | if ((reg2 & 0x03) == 0x01) |
368 | data->temp_type[0] = 6 /* PECI */; | 904 | data->temp_type[1] = 6 /* PECI */; |
369 | else if ((reg2 & 0x03) == 0x02) | 905 | else if ((reg2 & 0x03) == 0x02) |
370 | data->temp_type[0] = 5 /* AMDSI */; | 906 | data->temp_type[1] = 5 /* AMDSI */; |
907 | else if (data->type != f8000) | ||
908 | data->temp_type[1] = (reg & 0x02) ? 2 : 4; | ||
371 | else | 909 | else |
372 | data->temp_type[0] = (reg & 0x02) ? 2 : 4; | 910 | data->temp_type[1] = 2; /* F8000 only supports BJT */ |
373 | 911 | ||
374 | data->temp_type[1] = (reg & 0x04) ? 2 : 4; | 912 | data->pwm_enable = f71882fg_read8(data, |
375 | data->temp_type[2] = (reg & 0x08) ? 2 : 4; | 913 | F71882FG_REG_PWM_ENABLE); |
376 | 914 | data->pwm_auto_point_hyst[0] = | |
377 | data->temp_beep = f71882fg_read8(data, F71882FG_REG_TEMP_BEEP); | 915 | f71882fg_read8(data, F71882FG_REG_FAN_HYST(0)); |
378 | 916 | data->pwm_auto_point_hyst[1] = | |
379 | data->fan_beep = f71882fg_read8(data, F71882FG_REG_FAN_BEEP); | 917 | f71882fg_read8(data, F71882FG_REG_FAN_HYST(1)); |
380 | 918 | ||
919 | for (nr = 0; nr < nr_fans; nr++) { | ||
920 | data->pwm_auto_point_mapping[nr] = | ||
921 | f71882fg_read8(data, | ||
922 | F71882FG_REG_POINT_MAPPING(nr)); | ||
923 | |||
924 | if (data->type != f71862fg) { | ||
925 | int point; | ||
926 | for (point = 0; point < 5; point++) { | ||
927 | data->pwm_auto_point_pwm[nr][point] = | ||
928 | f71882fg_read8(data, | ||
929 | F71882FG_REG_POINT_PWM | ||
930 | (nr, point)); | ||
931 | } | ||
932 | for (point = 0; point < 4; point++) { | ||
933 | data->pwm_auto_point_temp[nr][point] = | ||
934 | f71882fg_read8(data, | ||
935 | F71882FG_REG_POINT_TEMP | ||
936 | (nr, point)); | ||
937 | } | ||
938 | } else { | ||
939 | data->pwm_auto_point_pwm[nr][1] = | ||
940 | f71882fg_read8(data, | ||
941 | F71882FG_REG_POINT_PWM | ||
942 | (nr, 1)); | ||
943 | data->pwm_auto_point_pwm[nr][4] = | ||
944 | f71882fg_read8(data, | ||
945 | F71882FG_REG_POINT_PWM | ||
946 | (nr, 4)); | ||
947 | data->pwm_auto_point_temp[nr][0] = | ||
948 | f71882fg_read8(data, | ||
949 | F71882FG_REG_POINT_TEMP | ||
950 | (nr, 0)); | ||
951 | data->pwm_auto_point_temp[nr][3] = | ||
952 | f71882fg_read8(data, | ||
953 | F71882FG_REG_POINT_TEMP | ||
954 | (nr, 3)); | ||
955 | } | ||
956 | } | ||
381 | data->last_limits = jiffies; | 957 | data->last_limits = jiffies; |
382 | } | 958 | } |
383 | 959 | ||
@@ -387,19 +963,32 @@ static struct f71882fg_data *f71882fg_update_device(struct device * dev) | |||
387 | F71882FG_REG_TEMP_STATUS); | 963 | F71882FG_REG_TEMP_STATUS); |
388 | data->temp_diode_open = f71882fg_read8(data, | 964 | data->temp_diode_open = f71882fg_read8(data, |
389 | F71882FG_REG_TEMP_DIODE_OPEN); | 965 | F71882FG_REG_TEMP_DIODE_OPEN); |
390 | for (nr = 0; nr < 3; nr++) | 966 | for (nr = temp_start; nr < 3 + temp_start; nr++) |
391 | data->temp[nr] = f71882fg_read8(data, | 967 | data->temp[nr] = f71882fg_read8(data, |
392 | F71882FG_REG_TEMP(nr)); | 968 | F71882FG_REG_TEMP(nr)); |
393 | 969 | ||
394 | data->fan_status = f71882fg_read8(data, | 970 | data->fan_status = f71882fg_read8(data, |
395 | F71882FG_REG_FAN_STATUS); | 971 | F71882FG_REG_FAN_STATUS); |
396 | for (nr = 0; nr < 4; nr++) | 972 | for (nr = 0; nr < nr_fans; nr++) { |
397 | data->fan[nr] = f71882fg_read16(data, | 973 | data->fan[nr] = f71882fg_read16(data, |
398 | F71882FG_REG_FAN(nr)); | 974 | F71882FG_REG_FAN(nr)); |
975 | data->fan_target[nr] = | ||
976 | f71882fg_read16(data, F71882FG_REG_FAN_TARGET(nr)); | ||
977 | data->fan_full_speed[nr] = | ||
978 | f71882fg_read16(data, | ||
979 | F71882FG_REG_FAN_FULL_SPEED(nr)); | ||
980 | data->pwm[nr] = | ||
981 | f71882fg_read8(data, F71882FG_REG_PWM(nr)); | ||
982 | } | ||
399 | 983 | ||
400 | data->in_status = f71882fg_read8(data, | 984 | /* The f8000 can monitor 1 more fan, but has no pwm for it */ |
985 | if (data->type == f8000) | ||
986 | data->fan[3] = f71882fg_read16(data, | ||
987 | F71882FG_REG_FAN(3)); | ||
988 | if (data->type == f71882fg) | ||
989 | data->in_status = f71882fg_read8(data, | ||
401 | F71882FG_REG_IN_STATUS); | 990 | F71882FG_REG_IN_STATUS); |
402 | for (nr = 0; nr < 9; nr++) | 991 | for (nr = 0; nr < nr_ins; nr++) |
403 | data->in[nr] = f71882fg_read8(data, | 992 | data->in[nr] = f71882fg_read8(data, |
404 | F71882FG_REG_IN(nr)); | 993 | F71882FG_REG_IN(nr)); |
405 | 994 | ||
@@ -417,7 +1006,7 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, | |||
417 | char *buf) | 1006 | char *buf) |
418 | { | 1007 | { |
419 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1008 | struct f71882fg_data *data = f71882fg_update_device(dev); |
420 | int nr = to_sensor_dev_attr(devattr)->index; | 1009 | int nr = to_sensor_dev_attr_2(devattr)->index; |
421 | int speed = fan_from_reg(data->fan[nr]); | 1010 | int speed = fan_from_reg(data->fan[nr]); |
422 | 1011 | ||
423 | if (speed == FAN_MIN_DETECT) | 1012 | if (speed == FAN_MIN_DETECT) |
@@ -426,11 +1015,39 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *devattr, | |||
426 | return sprintf(buf, "%d\n", speed); | 1015 | return sprintf(buf, "%d\n", speed); |
427 | } | 1016 | } |
428 | 1017 | ||
1018 | static ssize_t show_fan_full_speed(struct device *dev, | ||
1019 | struct device_attribute *devattr, char *buf) | ||
1020 | { | ||
1021 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1022 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1023 | int speed = fan_from_reg(data->fan_full_speed[nr]); | ||
1024 | return sprintf(buf, "%d\n", speed); | ||
1025 | } | ||
1026 | |||
1027 | static ssize_t store_fan_full_speed(struct device *dev, | ||
1028 | struct device_attribute *devattr, | ||
1029 | const char *buf, size_t count) | ||
1030 | { | ||
1031 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1032 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1033 | long val = simple_strtol(buf, NULL, 10); | ||
1034 | |||
1035 | val = SENSORS_LIMIT(val, 23, 1500000); | ||
1036 | val = fan_to_reg(val); | ||
1037 | |||
1038 | mutex_lock(&data->update_lock); | ||
1039 | f71882fg_write16(data, F71882FG_REG_FAN_FULL_SPEED(nr), val); | ||
1040 | data->fan_full_speed[nr] = val; | ||
1041 | mutex_unlock(&data->update_lock); | ||
1042 | |||
1043 | return count; | ||
1044 | } | ||
1045 | |||
429 | static ssize_t show_fan_beep(struct device *dev, struct device_attribute | 1046 | static ssize_t show_fan_beep(struct device *dev, struct device_attribute |
430 | *devattr, char *buf) | 1047 | *devattr, char *buf) |
431 | { | 1048 | { |
432 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1049 | struct f71882fg_data *data = f71882fg_update_device(dev); |
433 | int nr = to_sensor_dev_attr(devattr)->index; | 1050 | int nr = to_sensor_dev_attr_2(devattr)->index; |
434 | 1051 | ||
435 | if (data->fan_beep & (1 << nr)) | 1052 | if (data->fan_beep & (1 << nr)) |
436 | return sprintf(buf, "1\n"); | 1053 | return sprintf(buf, "1\n"); |
@@ -442,10 +1059,11 @@ static ssize_t store_fan_beep(struct device *dev, struct device_attribute | |||
442 | *devattr, const char *buf, size_t count) | 1059 | *devattr, const char *buf, size_t count) |
443 | { | 1060 | { |
444 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1061 | struct f71882fg_data *data = dev_get_drvdata(dev); |
445 | int nr = to_sensor_dev_attr(devattr)->index; | 1062 | int nr = to_sensor_dev_attr_2(devattr)->index; |
446 | int val = simple_strtoul(buf, NULL, 10); | 1063 | unsigned long val = simple_strtoul(buf, NULL, 10); |
447 | 1064 | ||
448 | mutex_lock(&data->update_lock); | 1065 | mutex_lock(&data->update_lock); |
1066 | data->fan_beep = f71882fg_read8(data, F71882FG_REG_FAN_BEEP); | ||
449 | if (val) | 1067 | if (val) |
450 | data->fan_beep |= 1 << nr; | 1068 | data->fan_beep |= 1 << nr; |
451 | else | 1069 | else |
@@ -461,7 +1079,7 @@ static ssize_t show_fan_alarm(struct device *dev, struct device_attribute | |||
461 | *devattr, char *buf) | 1079 | *devattr, char *buf) |
462 | { | 1080 | { |
463 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1081 | struct f71882fg_data *data = f71882fg_update_device(dev); |
464 | int nr = to_sensor_dev_attr(devattr)->index; | 1082 | int nr = to_sensor_dev_attr_2(devattr)->index; |
465 | 1083 | ||
466 | if (data->fan_status & (1 << nr)) | 1084 | if (data->fan_status & (1 << nr)) |
467 | return sprintf(buf, "1\n"); | 1085 | return sprintf(buf, "1\n"); |
@@ -473,7 +1091,7 @@ static ssize_t show_in(struct device *dev, struct device_attribute *devattr, | |||
473 | char *buf) | 1091 | char *buf) |
474 | { | 1092 | { |
475 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1093 | struct f71882fg_data *data = f71882fg_update_device(dev); |
476 | int nr = to_sensor_dev_attr(devattr)->index; | 1094 | int nr = to_sensor_dev_attr_2(devattr)->index; |
477 | 1095 | ||
478 | return sprintf(buf, "%d\n", data->in[nr] * 8); | 1096 | return sprintf(buf, "%d\n", data->in[nr] * 8); |
479 | } | 1097 | } |
@@ -490,10 +1108,8 @@ static ssize_t store_in_max(struct device *dev, struct device_attribute | |||
490 | *devattr, const char *buf, size_t count) | 1108 | *devattr, const char *buf, size_t count) |
491 | { | 1109 | { |
492 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1110 | struct f71882fg_data *data = dev_get_drvdata(dev); |
493 | int val = simple_strtoul(buf, NULL, 10) / 8; | 1111 | long val = simple_strtol(buf, NULL, 10) / 8; |
494 | 1112 | val = SENSORS_LIMIT(val, 0, 255); | |
495 | if (val > 255) | ||
496 | val = 255; | ||
497 | 1113 | ||
498 | mutex_lock(&data->update_lock); | 1114 | mutex_lock(&data->update_lock); |
499 | f71882fg_write8(data, F71882FG_REG_IN1_HIGH, val); | 1115 | f71882fg_write8(data, F71882FG_REG_IN1_HIGH, val); |
@@ -507,7 +1123,7 @@ static ssize_t show_in_beep(struct device *dev, struct device_attribute | |||
507 | *devattr, char *buf) | 1123 | *devattr, char *buf) |
508 | { | 1124 | { |
509 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1125 | struct f71882fg_data *data = f71882fg_update_device(dev); |
510 | int nr = to_sensor_dev_attr(devattr)->index; | 1126 | int nr = to_sensor_dev_attr_2(devattr)->index; |
511 | 1127 | ||
512 | if (data->in_beep & (1 << nr)) | 1128 | if (data->in_beep & (1 << nr)) |
513 | return sprintf(buf, "1\n"); | 1129 | return sprintf(buf, "1\n"); |
@@ -519,10 +1135,11 @@ static ssize_t store_in_beep(struct device *dev, struct device_attribute | |||
519 | *devattr, const char *buf, size_t count) | 1135 | *devattr, const char *buf, size_t count) |
520 | { | 1136 | { |
521 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1137 | struct f71882fg_data *data = dev_get_drvdata(dev); |
522 | int nr = to_sensor_dev_attr(devattr)->index; | 1138 | int nr = to_sensor_dev_attr_2(devattr)->index; |
523 | int val = simple_strtoul(buf, NULL, 10); | 1139 | unsigned long val = simple_strtoul(buf, NULL, 10); |
524 | 1140 | ||
525 | mutex_lock(&data->update_lock); | 1141 | mutex_lock(&data->update_lock); |
1142 | data->in_beep = f71882fg_read8(data, F71882FG_REG_IN_BEEP); | ||
526 | if (val) | 1143 | if (val) |
527 | data->in_beep |= 1 << nr; | 1144 | data->in_beep |= 1 << nr; |
528 | else | 1145 | else |
@@ -538,7 +1155,7 @@ static ssize_t show_in_alarm(struct device *dev, struct device_attribute | |||
538 | *devattr, char *buf) | 1155 | *devattr, char *buf) |
539 | { | 1156 | { |
540 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1157 | struct f71882fg_data *data = f71882fg_update_device(dev); |
541 | int nr = to_sensor_dev_attr(devattr)->index; | 1158 | int nr = to_sensor_dev_attr_2(devattr)->index; |
542 | 1159 | ||
543 | if (data->in_status & (1 << nr)) | 1160 | if (data->in_status & (1 << nr)) |
544 | return sprintf(buf, "1\n"); | 1161 | return sprintf(buf, "1\n"); |
@@ -550,7 +1167,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, | |||
550 | char *buf) | 1167 | char *buf) |
551 | { | 1168 | { |
552 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1169 | struct f71882fg_data *data = f71882fg_update_device(dev); |
553 | int nr = to_sensor_dev_attr(devattr)->index; | 1170 | int nr = to_sensor_dev_attr_2(devattr)->index; |
554 | 1171 | ||
555 | return sprintf(buf, "%d\n", data->temp[nr] * 1000); | 1172 | return sprintf(buf, "%d\n", data->temp[nr] * 1000); |
556 | } | 1173 | } |
@@ -559,7 +1176,7 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute | |||
559 | *devattr, char *buf) | 1176 | *devattr, char *buf) |
560 | { | 1177 | { |
561 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1178 | struct f71882fg_data *data = f71882fg_update_device(dev); |
562 | int nr = to_sensor_dev_attr(devattr)->index; | 1179 | int nr = to_sensor_dev_attr_2(devattr)->index; |
563 | 1180 | ||
564 | return sprintf(buf, "%d\n", data->temp_high[nr] * 1000); | 1181 | return sprintf(buf, "%d\n", data->temp_high[nr] * 1000); |
565 | } | 1182 | } |
@@ -568,11 +1185,9 @@ static ssize_t store_temp_max(struct device *dev, struct device_attribute | |||
568 | *devattr, const char *buf, size_t count) | 1185 | *devattr, const char *buf, size_t count) |
569 | { | 1186 | { |
570 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1187 | struct f71882fg_data *data = dev_get_drvdata(dev); |
571 | int nr = to_sensor_dev_attr(devattr)->index; | 1188 | int nr = to_sensor_dev_attr_2(devattr)->index; |
572 | int val = simple_strtoul(buf, NULL, 10) / 1000; | 1189 | long val = simple_strtol(buf, NULL, 10) / 1000; |
573 | 1190 | val = SENSORS_LIMIT(val, 0, 255); | |
574 | if (val > 255) | ||
575 | val = 255; | ||
576 | 1191 | ||
577 | mutex_lock(&data->update_lock); | 1192 | mutex_lock(&data->update_lock); |
578 | f71882fg_write8(data, F71882FG_REG_TEMP_HIGH(nr), val); | 1193 | f71882fg_write8(data, F71882FG_REG_TEMP_HIGH(nr), val); |
@@ -586,48 +1201,46 @@ static ssize_t show_temp_max_hyst(struct device *dev, struct device_attribute | |||
586 | *devattr, char *buf) | 1201 | *devattr, char *buf) |
587 | { | 1202 | { |
588 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1203 | struct f71882fg_data *data = f71882fg_update_device(dev); |
589 | int nr = to_sensor_dev_attr(devattr)->index; | 1204 | int nr = to_sensor_dev_attr_2(devattr)->index; |
1205 | int temp_max_hyst; | ||
1206 | |||
1207 | mutex_lock(&data->update_lock); | ||
1208 | if (nr & 1) | ||
1209 | temp_max_hyst = data->temp_hyst[nr / 2] >> 4; | ||
1210 | else | ||
1211 | temp_max_hyst = data->temp_hyst[nr / 2] & 0x0f; | ||
1212 | temp_max_hyst = (data->temp_high[nr] - temp_max_hyst) * 1000; | ||
1213 | mutex_unlock(&data->update_lock); | ||
590 | 1214 | ||
591 | return sprintf(buf, "%d\n", | 1215 | return sprintf(buf, "%d\n", temp_max_hyst); |
592 | (data->temp_high[nr] - data->temp_hyst[nr]) * 1000); | ||
593 | } | 1216 | } |
594 | 1217 | ||
595 | static ssize_t store_temp_max_hyst(struct device *dev, struct device_attribute | 1218 | static ssize_t store_temp_max_hyst(struct device *dev, struct device_attribute |
596 | *devattr, const char *buf, size_t count) | 1219 | *devattr, const char *buf, size_t count) |
597 | { | 1220 | { |
598 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1221 | struct f71882fg_data *data = dev_get_drvdata(dev); |
599 | int nr = to_sensor_dev_attr(devattr)->index; | 1222 | int nr = to_sensor_dev_attr_2(devattr)->index; |
600 | int val = simple_strtoul(buf, NULL, 10) / 1000; | 1223 | long val = simple_strtol(buf, NULL, 10) / 1000; |
601 | ssize_t ret = count; | 1224 | ssize_t ret = count; |
1225 | u8 reg; | ||
602 | 1226 | ||
603 | mutex_lock(&data->update_lock); | 1227 | mutex_lock(&data->update_lock); |
604 | 1228 | ||
605 | /* convert abs to relative and check */ | 1229 | /* convert abs to relative and check */ |
1230 | data->temp_high[nr] = f71882fg_read8(data, F71882FG_REG_TEMP_HIGH(nr)); | ||
1231 | val = SENSORS_LIMIT(val, data->temp_high[nr] - 15, | ||
1232 | data->temp_high[nr]); | ||
606 | val = data->temp_high[nr] - val; | 1233 | val = data->temp_high[nr] - val; |
607 | if (val < 0 || val > 15) { | ||
608 | ret = -EINVAL; | ||
609 | goto store_temp_max_hyst_exit; | ||
610 | } | ||
611 | |||
612 | data->temp_hyst[nr] = val; | ||
613 | 1234 | ||
614 | /* convert value to register contents */ | 1235 | /* convert value to register contents */ |
615 | switch (nr) { | 1236 | reg = f71882fg_read8(data, F71882FG_REG_TEMP_HYST(nr / 2)); |
616 | case 0: | 1237 | if (nr & 1) |
617 | val = val << 4; | 1238 | reg = (reg & 0x0f) | (val << 4); |
618 | break; | 1239 | else |
619 | case 1: | 1240 | reg = (reg & 0xf0) | val; |
620 | val = val | (data->temp_hyst[2] << 4); | 1241 | f71882fg_write8(data, F71882FG_REG_TEMP_HYST(nr / 2), reg); |
621 | break; | 1242 | data->temp_hyst[nr / 2] = reg; |
622 | case 2: | ||
623 | val = data->temp_hyst[1] | (val << 4); | ||
624 | break; | ||
625 | } | ||
626 | |||
627 | f71882fg_write8(data, nr ? F71882FG_REG_TEMP_HYST23 : | ||
628 | F71882FG_REG_TEMP_HYST1, val); | ||
629 | 1243 | ||
630 | store_temp_max_hyst_exit: | ||
631 | mutex_unlock(&data->update_lock); | 1244 | mutex_unlock(&data->update_lock); |
632 | return ret; | 1245 | return ret; |
633 | } | 1246 | } |
@@ -636,7 +1249,7 @@ static ssize_t show_temp_crit(struct device *dev, struct device_attribute | |||
636 | *devattr, char *buf) | 1249 | *devattr, char *buf) |
637 | { | 1250 | { |
638 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1251 | struct f71882fg_data *data = f71882fg_update_device(dev); |
639 | int nr = to_sensor_dev_attr(devattr)->index; | 1252 | int nr = to_sensor_dev_attr_2(devattr)->index; |
640 | 1253 | ||
641 | return sprintf(buf, "%d\n", data->temp_ovt[nr] * 1000); | 1254 | return sprintf(buf, "%d\n", data->temp_ovt[nr] * 1000); |
642 | } | 1255 | } |
@@ -645,11 +1258,9 @@ static ssize_t store_temp_crit(struct device *dev, struct device_attribute | |||
645 | *devattr, const char *buf, size_t count) | 1258 | *devattr, const char *buf, size_t count) |
646 | { | 1259 | { |
647 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1260 | struct f71882fg_data *data = dev_get_drvdata(dev); |
648 | int nr = to_sensor_dev_attr(devattr)->index; | 1261 | int nr = to_sensor_dev_attr_2(devattr)->index; |
649 | int val = simple_strtoul(buf, NULL, 10) / 1000; | 1262 | long val = simple_strtol(buf, NULL, 10) / 1000; |
650 | 1263 | val = SENSORS_LIMIT(val, 0, 255); | |
651 | if (val > 255) | ||
652 | val = 255; | ||
653 | 1264 | ||
654 | mutex_lock(&data->update_lock); | 1265 | mutex_lock(&data->update_lock); |
655 | f71882fg_write8(data, F71882FG_REG_TEMP_OVT(nr), val); | 1266 | f71882fg_write8(data, F71882FG_REG_TEMP_OVT(nr), val); |
@@ -663,17 +1274,25 @@ static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute | |||
663 | *devattr, char *buf) | 1274 | *devattr, char *buf) |
664 | { | 1275 | { |
665 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1276 | struct f71882fg_data *data = f71882fg_update_device(dev); |
666 | int nr = to_sensor_dev_attr(devattr)->index; | 1277 | int nr = to_sensor_dev_attr_2(devattr)->index; |
1278 | int temp_crit_hyst; | ||
1279 | |||
1280 | mutex_lock(&data->update_lock); | ||
1281 | if (nr & 1) | ||
1282 | temp_crit_hyst = data->temp_hyst[nr / 2] >> 4; | ||
1283 | else | ||
1284 | temp_crit_hyst = data->temp_hyst[nr / 2] & 0x0f; | ||
1285 | temp_crit_hyst = (data->temp_ovt[nr] - temp_crit_hyst) * 1000; | ||
1286 | mutex_unlock(&data->update_lock); | ||
667 | 1287 | ||
668 | return sprintf(buf, "%d\n", | 1288 | return sprintf(buf, "%d\n", temp_crit_hyst); |
669 | (data->temp_ovt[nr] - data->temp_hyst[nr]) * 1000); | ||
670 | } | 1289 | } |
671 | 1290 | ||
672 | static ssize_t show_temp_type(struct device *dev, struct device_attribute | 1291 | static ssize_t show_temp_type(struct device *dev, struct device_attribute |
673 | *devattr, char *buf) | 1292 | *devattr, char *buf) |
674 | { | 1293 | { |
675 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1294 | struct f71882fg_data *data = f71882fg_update_device(dev); |
676 | int nr = to_sensor_dev_attr(devattr)->index; | 1295 | int nr = to_sensor_dev_attr_2(devattr)->index; |
677 | 1296 | ||
678 | return sprintf(buf, "%d\n", data->temp_type[nr]); | 1297 | return sprintf(buf, "%d\n", data->temp_type[nr]); |
679 | } | 1298 | } |
@@ -682,9 +1301,9 @@ static ssize_t show_temp_beep(struct device *dev, struct device_attribute | |||
682 | *devattr, char *buf) | 1301 | *devattr, char *buf) |
683 | { | 1302 | { |
684 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1303 | struct f71882fg_data *data = f71882fg_update_device(dev); |
685 | int nr = to_sensor_dev_attr(devattr)->index; | 1304 | int nr = to_sensor_dev_attr_2(devattr)->index; |
686 | 1305 | ||
687 | if (data->temp_beep & (1 << (nr + 1))) | 1306 | if (data->temp_beep & (1 << nr)) |
688 | return sprintf(buf, "1\n"); | 1307 | return sprintf(buf, "1\n"); |
689 | else | 1308 | else |
690 | return sprintf(buf, "0\n"); | 1309 | return sprintf(buf, "0\n"); |
@@ -694,14 +1313,15 @@ static ssize_t store_temp_beep(struct device *dev, struct device_attribute | |||
694 | *devattr, const char *buf, size_t count) | 1313 | *devattr, const char *buf, size_t count) |
695 | { | 1314 | { |
696 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1315 | struct f71882fg_data *data = dev_get_drvdata(dev); |
697 | int nr = to_sensor_dev_attr(devattr)->index; | 1316 | int nr = to_sensor_dev_attr_2(devattr)->index; |
698 | int val = simple_strtoul(buf, NULL, 10); | 1317 | unsigned long val = simple_strtoul(buf, NULL, 10); |
699 | 1318 | ||
700 | mutex_lock(&data->update_lock); | 1319 | mutex_lock(&data->update_lock); |
1320 | data->temp_beep = f71882fg_read8(data, F71882FG_REG_TEMP_BEEP); | ||
701 | if (val) | 1321 | if (val) |
702 | data->temp_beep |= 1 << (nr + 1); | 1322 | data->temp_beep |= 1 << nr; |
703 | else | 1323 | else |
704 | data->temp_beep &= ~(1 << (nr + 1)); | 1324 | data->temp_beep &= ~(1 << nr); |
705 | 1325 | ||
706 | f71882fg_write8(data, F71882FG_REG_TEMP_BEEP, data->temp_beep); | 1326 | f71882fg_write8(data, F71882FG_REG_TEMP_BEEP, data->temp_beep); |
707 | mutex_unlock(&data->update_lock); | 1327 | mutex_unlock(&data->update_lock); |
@@ -713,9 +1333,9 @@ static ssize_t show_temp_alarm(struct device *dev, struct device_attribute | |||
713 | *devattr, char *buf) | 1333 | *devattr, char *buf) |
714 | { | 1334 | { |
715 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1335 | struct f71882fg_data *data = f71882fg_update_device(dev); |
716 | int nr = to_sensor_dev_attr(devattr)->index; | 1336 | int nr = to_sensor_dev_attr_2(devattr)->index; |
717 | 1337 | ||
718 | if (data->temp_status & (1 << (nr + 1))) | 1338 | if (data->temp_status & (1 << nr)) |
719 | return sprintf(buf, "1\n"); | 1339 | return sprintf(buf, "1\n"); |
720 | else | 1340 | else |
721 | return sprintf(buf, "0\n"); | 1341 | return sprintf(buf, "0\n"); |
@@ -725,113 +1345,528 @@ static ssize_t show_temp_fault(struct device *dev, struct device_attribute | |||
725 | *devattr, char *buf) | 1345 | *devattr, char *buf) |
726 | { | 1346 | { |
727 | struct f71882fg_data *data = f71882fg_update_device(dev); | 1347 | struct f71882fg_data *data = f71882fg_update_device(dev); |
728 | int nr = to_sensor_dev_attr(devattr)->index; | 1348 | int nr = to_sensor_dev_attr_2(devattr)->index; |
729 | 1349 | ||
730 | if (data->temp_diode_open & (1 << (nr + 1))) | 1350 | if (data->temp_diode_open & (1 << nr)) |
731 | return sprintf(buf, "1\n"); | 1351 | return sprintf(buf, "1\n"); |
732 | else | 1352 | else |
733 | return sprintf(buf, "0\n"); | 1353 | return sprintf(buf, "0\n"); |
734 | } | 1354 | } |
735 | 1355 | ||
1356 | static ssize_t show_pwm(struct device *dev, | ||
1357 | struct device_attribute *devattr, char *buf) | ||
1358 | { | ||
1359 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1360 | int val, nr = to_sensor_dev_attr_2(devattr)->index; | ||
1361 | mutex_lock(&data->update_lock); | ||
1362 | if (data->pwm_enable & (1 << (2 * nr))) | ||
1363 | /* PWM mode */ | ||
1364 | val = data->pwm[nr]; | ||
1365 | else { | ||
1366 | /* RPM mode */ | ||
1367 | val = 255 * fan_from_reg(data->fan_target[nr]) | ||
1368 | / fan_from_reg(data->fan_full_speed[nr]); | ||
1369 | } | ||
1370 | mutex_unlock(&data->update_lock); | ||
1371 | return sprintf(buf, "%d\n", val); | ||
1372 | } | ||
1373 | |||
1374 | static ssize_t store_pwm(struct device *dev, | ||
1375 | struct device_attribute *devattr, const char *buf, | ||
1376 | size_t count) | ||
1377 | { | ||
1378 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1379 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1380 | long val = simple_strtol(buf, NULL, 10); | ||
1381 | val = SENSORS_LIMIT(val, 0, 255); | ||
1382 | |||
1383 | mutex_lock(&data->update_lock); | ||
1384 | data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); | ||
1385 | if ((data->type == f8000 && ((data->pwm_enable >> 2 * nr) & 3) != 2) || | ||
1386 | (data->type != f8000 && !((data->pwm_enable >> 2 * nr) & 2))) { | ||
1387 | count = -EROFS; | ||
1388 | goto leave; | ||
1389 | } | ||
1390 | if (data->pwm_enable & (1 << (2 * nr))) { | ||
1391 | /* PWM mode */ | ||
1392 | f71882fg_write8(data, F71882FG_REG_PWM(nr), val); | ||
1393 | data->pwm[nr] = val; | ||
1394 | } else { | ||
1395 | /* RPM mode */ | ||
1396 | int target, full_speed; | ||
1397 | full_speed = f71882fg_read16(data, | ||
1398 | F71882FG_REG_FAN_FULL_SPEED(nr)); | ||
1399 | target = fan_to_reg(val * fan_from_reg(full_speed) / 255); | ||
1400 | f71882fg_write16(data, F71882FG_REG_FAN_TARGET(nr), target); | ||
1401 | data->fan_target[nr] = target; | ||
1402 | data->fan_full_speed[nr] = full_speed; | ||
1403 | } | ||
1404 | leave: | ||
1405 | mutex_unlock(&data->update_lock); | ||
1406 | |||
1407 | return count; | ||
1408 | } | ||
1409 | |||
1410 | static ssize_t show_pwm_enable(struct device *dev, | ||
1411 | struct device_attribute *devattr, char *buf) | ||
1412 | { | ||
1413 | int result = 0; | ||
1414 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1415 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1416 | |||
1417 | switch ((data->pwm_enable >> 2 * nr) & 3) { | ||
1418 | case 0: | ||
1419 | case 1: | ||
1420 | result = 2; /* Normal auto mode */ | ||
1421 | break; | ||
1422 | case 2: | ||
1423 | result = 1; /* Manual mode */ | ||
1424 | break; | ||
1425 | case 3: | ||
1426 | if (data->type == f8000) | ||
1427 | result = 3; /* Thermostat mode */ | ||
1428 | else | ||
1429 | result = 1; /* Manual mode */ | ||
1430 | break; | ||
1431 | } | ||
1432 | |||
1433 | return sprintf(buf, "%d\n", result); | ||
1434 | } | ||
1435 | |||
1436 | static ssize_t store_pwm_enable(struct device *dev, struct device_attribute | ||
1437 | *devattr, const char *buf, size_t count) | ||
1438 | { | ||
1439 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1440 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1441 | long val = simple_strtol(buf, NULL, 10); | ||
1442 | |||
1443 | mutex_lock(&data->update_lock); | ||
1444 | data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); | ||
1445 | /* Special case for F8000 auto PWM mode / Thermostat mode */ | ||
1446 | if (data->type == f8000 && ((data->pwm_enable >> 2 * nr) & 1)) { | ||
1447 | switch (val) { | ||
1448 | case 2: | ||
1449 | data->pwm_enable &= ~(2 << (2 * nr)); | ||
1450 | break; /* Normal auto mode */ | ||
1451 | case 3: | ||
1452 | data->pwm_enable |= 2 << (2 * nr); | ||
1453 | break; /* Thermostat mode */ | ||
1454 | default: | ||
1455 | count = -EINVAL; | ||
1456 | goto leave; | ||
1457 | } | ||
1458 | } else { | ||
1459 | switch (val) { | ||
1460 | case 1: | ||
1461 | data->pwm_enable |= 2 << (2 * nr); | ||
1462 | break; /* Manual */ | ||
1463 | case 2: | ||
1464 | data->pwm_enable &= ~(2 << (2 * nr)); | ||
1465 | break; /* Normal auto mode */ | ||
1466 | default: | ||
1467 | count = -EINVAL; | ||
1468 | goto leave; | ||
1469 | } | ||
1470 | } | ||
1471 | f71882fg_write8(data, F71882FG_REG_PWM_ENABLE, data->pwm_enable); | ||
1472 | leave: | ||
1473 | mutex_unlock(&data->update_lock); | ||
1474 | |||
1475 | return count; | ||
1476 | } | ||
1477 | |||
1478 | static ssize_t show_pwm_auto_point_pwm(struct device *dev, | ||
1479 | struct device_attribute *devattr, | ||
1480 | char *buf) | ||
1481 | { | ||
1482 | int result; | ||
1483 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1484 | int pwm = to_sensor_dev_attr_2(devattr)->index; | ||
1485 | int point = to_sensor_dev_attr_2(devattr)->nr; | ||
1486 | |||
1487 | mutex_lock(&data->update_lock); | ||
1488 | if (data->pwm_enable & (1 << (2 * pwm))) { | ||
1489 | /* PWM mode */ | ||
1490 | result = data->pwm_auto_point_pwm[pwm][point]; | ||
1491 | } else { | ||
1492 | /* RPM mode */ | ||
1493 | result = 32 * 255 / (32 + data->pwm_auto_point_pwm[pwm][point]); | ||
1494 | } | ||
1495 | mutex_unlock(&data->update_lock); | ||
1496 | |||
1497 | return sprintf(buf, "%d\n", result); | ||
1498 | } | ||
1499 | |||
1500 | static ssize_t store_pwm_auto_point_pwm(struct device *dev, | ||
1501 | struct device_attribute *devattr, | ||
1502 | const char *buf, size_t count) | ||
1503 | { | ||
1504 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1505 | int pwm = to_sensor_dev_attr_2(devattr)->index; | ||
1506 | int point = to_sensor_dev_attr_2(devattr)->nr; | ||
1507 | long val = simple_strtol(buf, NULL, 10); | ||
1508 | val = SENSORS_LIMIT(val, 0, 255); | ||
1509 | |||
1510 | mutex_lock(&data->update_lock); | ||
1511 | data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); | ||
1512 | if (data->pwm_enable & (1 << (2 * pwm))) { | ||
1513 | /* PWM mode */ | ||
1514 | } else { | ||
1515 | /* RPM mode */ | ||
1516 | if (val < 29) /* Prevent negative numbers */ | ||
1517 | val = 255; | ||
1518 | else | ||
1519 | val = (255 - val) * 32 / val; | ||
1520 | } | ||
1521 | f71882fg_write8(data, F71882FG_REG_POINT_PWM(pwm, point), val); | ||
1522 | data->pwm_auto_point_pwm[pwm][point] = val; | ||
1523 | mutex_unlock(&data->update_lock); | ||
1524 | |||
1525 | return count; | ||
1526 | } | ||
1527 | |||
1528 | static ssize_t show_pwm_auto_point_temp_hyst(struct device *dev, | ||
1529 | struct device_attribute *devattr, | ||
1530 | char *buf) | ||
1531 | { | ||
1532 | int result = 0; | ||
1533 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1534 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1535 | int point = to_sensor_dev_attr_2(devattr)->nr; | ||
1536 | |||
1537 | mutex_lock(&data->update_lock); | ||
1538 | if (nr & 1) | ||
1539 | result = data->pwm_auto_point_hyst[nr / 2] >> 4; | ||
1540 | else | ||
1541 | result = data->pwm_auto_point_hyst[nr / 2] & 0x0f; | ||
1542 | result = 1000 * (data->pwm_auto_point_temp[nr][point] - result); | ||
1543 | mutex_unlock(&data->update_lock); | ||
1544 | |||
1545 | return sprintf(buf, "%d\n", result); | ||
1546 | } | ||
1547 | |||
1548 | static ssize_t store_pwm_auto_point_temp_hyst(struct device *dev, | ||
1549 | struct device_attribute *devattr, | ||
1550 | const char *buf, size_t count) | ||
1551 | { | ||
1552 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1553 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1554 | int point = to_sensor_dev_attr_2(devattr)->nr; | ||
1555 | long val = simple_strtol(buf, NULL, 10) / 1000; | ||
1556 | u8 reg; | ||
1557 | |||
1558 | mutex_lock(&data->update_lock); | ||
1559 | data->pwm_auto_point_temp[nr][point] = | ||
1560 | f71882fg_read8(data, F71882FG_REG_POINT_TEMP(nr, point)); | ||
1561 | val = SENSORS_LIMIT(val, data->pwm_auto_point_temp[nr][point] - 15, | ||
1562 | data->pwm_auto_point_temp[nr][point]); | ||
1563 | val = data->pwm_auto_point_temp[nr][point] - val; | ||
1564 | |||
1565 | reg = f71882fg_read8(data, F71882FG_REG_FAN_HYST(nr / 2)); | ||
1566 | if (nr & 1) | ||
1567 | reg = (reg & 0x0f) | (val << 4); | ||
1568 | else | ||
1569 | reg = (reg & 0xf0) | val; | ||
1570 | |||
1571 | f71882fg_write8(data, F71882FG_REG_FAN_HYST(nr / 2), reg); | ||
1572 | data->pwm_auto_point_hyst[nr / 2] = reg; | ||
1573 | mutex_unlock(&data->update_lock); | ||
1574 | |||
1575 | return count; | ||
1576 | } | ||
1577 | |||
1578 | static ssize_t show_pwm_interpolate(struct device *dev, | ||
1579 | struct device_attribute *devattr, char *buf) | ||
1580 | { | ||
1581 | int result; | ||
1582 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1583 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1584 | |||
1585 | result = (data->pwm_auto_point_mapping[nr] >> 4) & 1; | ||
1586 | |||
1587 | return sprintf(buf, "%d\n", result); | ||
1588 | } | ||
1589 | |||
1590 | static ssize_t store_pwm_interpolate(struct device *dev, | ||
1591 | struct device_attribute *devattr, | ||
1592 | const char *buf, size_t count) | ||
1593 | { | ||
1594 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1595 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1596 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
1597 | |||
1598 | mutex_lock(&data->update_lock); | ||
1599 | data->pwm_auto_point_mapping[nr] = | ||
1600 | f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr)); | ||
1601 | if (val) | ||
1602 | val = data->pwm_auto_point_mapping[nr] | (1 << 4); | ||
1603 | else | ||
1604 | val = data->pwm_auto_point_mapping[nr] & (~(1 << 4)); | ||
1605 | f71882fg_write8(data, F71882FG_REG_POINT_MAPPING(nr), val); | ||
1606 | data->pwm_auto_point_mapping[nr] = val; | ||
1607 | mutex_unlock(&data->update_lock); | ||
1608 | |||
1609 | return count; | ||
1610 | } | ||
1611 | |||
1612 | static ssize_t show_pwm_auto_point_channel(struct device *dev, | ||
1613 | struct device_attribute *devattr, | ||
1614 | char *buf) | ||
1615 | { | ||
1616 | int result; | ||
1617 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1618 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1619 | int temp_start = (data->type == f8000) ? 0 : 1; | ||
1620 | |||
1621 | result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - temp_start); | ||
1622 | |||
1623 | return sprintf(buf, "%d\n", result); | ||
1624 | } | ||
1625 | |||
1626 | static ssize_t store_pwm_auto_point_channel(struct device *dev, | ||
1627 | struct device_attribute *devattr, | ||
1628 | const char *buf, size_t count) | ||
1629 | { | ||
1630 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1631 | int nr = to_sensor_dev_attr_2(devattr)->index; | ||
1632 | int temp_start = (data->type == f8000) ? 0 : 1; | ||
1633 | long val = simple_strtol(buf, NULL, 10); | ||
1634 | |||
1635 | switch (val) { | ||
1636 | case 1: | ||
1637 | val = 0; | ||
1638 | break; | ||
1639 | case 2: | ||
1640 | val = 1; | ||
1641 | break; | ||
1642 | case 4: | ||
1643 | val = 2; | ||
1644 | break; | ||
1645 | default: | ||
1646 | return -EINVAL; | ||
1647 | } | ||
1648 | val += temp_start; | ||
1649 | mutex_lock(&data->update_lock); | ||
1650 | data->pwm_auto_point_mapping[nr] = | ||
1651 | f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr)); | ||
1652 | val = (data->pwm_auto_point_mapping[nr] & 0xfc) | val; | ||
1653 | f71882fg_write8(data, F71882FG_REG_POINT_MAPPING(nr), val); | ||
1654 | data->pwm_auto_point_mapping[nr] = val; | ||
1655 | mutex_unlock(&data->update_lock); | ||
1656 | |||
1657 | return count; | ||
1658 | } | ||
1659 | |||
1660 | static ssize_t show_pwm_auto_point_temp(struct device *dev, | ||
1661 | struct device_attribute *devattr, | ||
1662 | char *buf) | ||
1663 | { | ||
1664 | int result; | ||
1665 | struct f71882fg_data *data = f71882fg_update_device(dev); | ||
1666 | int pwm = to_sensor_dev_attr_2(devattr)->index; | ||
1667 | int point = to_sensor_dev_attr_2(devattr)->nr; | ||
1668 | |||
1669 | result = data->pwm_auto_point_temp[pwm][point]; | ||
1670 | return sprintf(buf, "%d\n", 1000 * result); | ||
1671 | } | ||
1672 | |||
1673 | static ssize_t store_pwm_auto_point_temp(struct device *dev, | ||
1674 | struct device_attribute *devattr, | ||
1675 | const char *buf, size_t count) | ||
1676 | { | ||
1677 | struct f71882fg_data *data = dev_get_drvdata(dev); | ||
1678 | int pwm = to_sensor_dev_attr_2(devattr)->index; | ||
1679 | int point = to_sensor_dev_attr_2(devattr)->nr; | ||
1680 | long val = simple_strtol(buf, NULL, 10) / 1000; | ||
1681 | val = SENSORS_LIMIT(val, 0, 255); | ||
1682 | |||
1683 | mutex_lock(&data->update_lock); | ||
1684 | f71882fg_write8(data, F71882FG_REG_POINT_TEMP(pwm, point), val); | ||
1685 | data->pwm_auto_point_temp[pwm][point] = val; | ||
1686 | mutex_unlock(&data->update_lock); | ||
1687 | |||
1688 | return count; | ||
1689 | } | ||
1690 | |||
736 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, | 1691 | static ssize_t show_name(struct device *dev, struct device_attribute *devattr, |
737 | char *buf) | 1692 | char *buf) |
738 | { | 1693 | { |
739 | return sprintf(buf, DRVNAME "\n"); | 1694 | struct f71882fg_data *data = dev_get_drvdata(dev); |
1695 | return sprintf(buf, "%s\n", f71882fg_names[data->type]); | ||
740 | } | 1696 | } |
741 | 1697 | ||
1698 | static int __devinit f71882fg_create_sysfs_files(struct platform_device *pdev, | ||
1699 | struct sensor_device_attribute_2 *attr, int count) | ||
1700 | { | ||
1701 | int err, i; | ||
1702 | |||
1703 | for (i = 0; i < count; i++) { | ||
1704 | err = device_create_file(&pdev->dev, &attr[i].dev_attr); | ||
1705 | if (err) | ||
1706 | return err; | ||
1707 | } | ||
1708 | return 0; | ||
1709 | } | ||
742 | 1710 | ||
743 | static int __devinit f71882fg_probe(struct platform_device * pdev) | 1711 | static int __devinit f71882fg_probe(struct platform_device *pdev) |
744 | { | 1712 | { |
745 | struct f71882fg_data *data; | 1713 | struct f71882fg_data *data; |
746 | int err, i; | 1714 | struct f71882fg_sio_data *sio_data = pdev->dev.platform_data; |
1715 | int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3; | ||
747 | u8 start_reg; | 1716 | u8 start_reg; |
748 | 1717 | ||
749 | if (!(data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL))) | 1718 | data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); |
1719 | if (!data) | ||
750 | return -ENOMEM; | 1720 | return -ENOMEM; |
751 | 1721 | ||
752 | data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start; | 1722 | data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start; |
1723 | data->type = sio_data->type; | ||
753 | mutex_init(&data->update_lock); | 1724 | mutex_init(&data->update_lock); |
754 | platform_set_drvdata(pdev, data); | 1725 | platform_set_drvdata(pdev, data); |
755 | 1726 | ||
756 | /* Register sysfs interface files */ | 1727 | start_reg = f71882fg_read8(data, F71882FG_REG_START); |
757 | for (i = 0; i < ARRAY_SIZE(f71882fg_dev_attr); i++) { | 1728 | if (start_reg & 0x04) { |
758 | err = device_create_file(&pdev->dev, &f71882fg_dev_attr[i]); | 1729 | dev_warn(&pdev->dev, "Hardware monitor is powered down\n"); |
759 | if (err) | 1730 | err = -ENODEV; |
760 | goto exit_unregister_sysfs; | 1731 | goto exit_free; |
1732 | } | ||
1733 | if (!(start_reg & 0x03)) { | ||
1734 | dev_warn(&pdev->dev, "Hardware monitoring not activated\n"); | ||
1735 | err = -ENODEV; | ||
1736 | goto exit_free; | ||
761 | } | 1737 | } |
762 | 1738 | ||
763 | start_reg = f71882fg_read8(data, F71882FG_REG_START); | 1739 | data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); |
1740 | /* If it is a 71862 and the fan / pwm part is enabled sanity check | ||
1741 | the pwm settings */ | ||
1742 | if (data->type == f71862fg && (start_reg & 0x02)) { | ||
1743 | if ((data->pwm_enable & 0x15) != 0x15) { | ||
1744 | dev_err(&pdev->dev, | ||
1745 | "Invalid (reserved) pwm settings: 0x%02x\n", | ||
1746 | (unsigned int)data->pwm_enable); | ||
1747 | err = -ENODEV; | ||
1748 | goto exit_free; | ||
1749 | } | ||
1750 | } | ||
1751 | |||
1752 | /* Register sysfs interface files */ | ||
1753 | err = device_create_file(&pdev->dev, &dev_attr_name); | ||
1754 | if (err) | ||
1755 | goto exit_unregister_sysfs; | ||
1756 | |||
764 | if (start_reg & 0x01) { | 1757 | if (start_reg & 0x01) { |
765 | for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++) { | 1758 | switch (data->type) { |
766 | err = device_create_file(&pdev->dev, | 1759 | case f71882fg: |
767 | &f71882fg_in_temp_attr[i].dev_attr); | 1760 | err = f71882fg_create_sysfs_files(pdev, |
1761 | f71882fg_in_temp_attr, | ||
1762 | ARRAY_SIZE(f71882fg_in_temp_attr)); | ||
768 | if (err) | 1763 | if (err) |
769 | goto exit_unregister_sysfs; | 1764 | goto exit_unregister_sysfs; |
1765 | /* fall through! */ | ||
1766 | case f71862fg: | ||
1767 | err = f71882fg_create_sysfs_files(pdev, | ||
1768 | f718x2fg_in_temp_attr, | ||
1769 | ARRAY_SIZE(f718x2fg_in_temp_attr)); | ||
1770 | break; | ||
1771 | case f8000: | ||
1772 | err = f71882fg_create_sysfs_files(pdev, | ||
1773 | f8000_in_temp_attr, | ||
1774 | ARRAY_SIZE(f8000_in_temp_attr)); | ||
1775 | break; | ||
770 | } | 1776 | } |
1777 | if (err) | ||
1778 | goto exit_unregister_sysfs; | ||
771 | } | 1779 | } |
772 | 1780 | ||
773 | if (start_reg & 0x02) { | 1781 | if (start_reg & 0x02) { |
774 | for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++) { | 1782 | err = f71882fg_create_sysfs_files(pdev, fxxxx_fan_attr, |
775 | err = device_create_file(&pdev->dev, | 1783 | ARRAY_SIZE(fxxxx_fan_attr)); |
776 | &f71882fg_fan_attr[i].dev_attr); | 1784 | if (err) |
777 | if (err) | 1785 | goto exit_unregister_sysfs; |
778 | goto exit_unregister_sysfs; | 1786 | |
1787 | switch (data->type) { | ||
1788 | case f71862fg: | ||
1789 | err = f71882fg_create_sysfs_files(pdev, | ||
1790 | f71862fg_fan_attr, | ||
1791 | ARRAY_SIZE(f71862fg_fan_attr)); | ||
1792 | break; | ||
1793 | case f71882fg: | ||
1794 | err = f71882fg_create_sysfs_files(pdev, | ||
1795 | f71882fg_fan_attr, | ||
1796 | ARRAY_SIZE(f71882fg_fan_attr)); | ||
1797 | break; | ||
1798 | case f8000: | ||
1799 | err = f71882fg_create_sysfs_files(pdev, | ||
1800 | f8000_fan_attr, | ||
1801 | ARRAY_SIZE(f8000_fan_attr)); | ||
1802 | break; | ||
779 | } | 1803 | } |
1804 | if (err) | ||
1805 | goto exit_unregister_sysfs; | ||
1806 | |||
1807 | for (i = 0; i < nr_fans; i++) | ||
1808 | dev_info(&pdev->dev, "Fan: %d is in %s mode\n", i + 1, | ||
1809 | (data->pwm_enable & (1 << 2 * i)) ? | ||
1810 | "duty-cycle" : "RPM"); | ||
780 | } | 1811 | } |
781 | 1812 | ||
782 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | 1813 | data->hwmon_dev = hwmon_device_register(&pdev->dev); |
783 | if (IS_ERR(data->hwmon_dev)) { | 1814 | if (IS_ERR(data->hwmon_dev)) { |
784 | err = PTR_ERR(data->hwmon_dev); | 1815 | err = PTR_ERR(data->hwmon_dev); |
1816 | data->hwmon_dev = NULL; | ||
785 | goto exit_unregister_sysfs; | 1817 | goto exit_unregister_sysfs; |
786 | } | 1818 | } |
787 | 1819 | ||
788 | return 0; | 1820 | return 0; |
789 | 1821 | ||
790 | exit_unregister_sysfs: | 1822 | exit_unregister_sysfs: |
791 | for (i = 0; i < ARRAY_SIZE(f71882fg_dev_attr); i++) | 1823 | f71882fg_remove(pdev); /* Will unregister the sysfs files for us */ |
792 | device_remove_file(&pdev->dev, &f71882fg_dev_attr[i]); | 1824 | return err; /* f71882fg_remove() also frees our data */ |
793 | 1825 | exit_free: | |
794 | for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++) | ||
795 | device_remove_file(&pdev->dev, | ||
796 | &f71882fg_in_temp_attr[i].dev_attr); | ||
797 | |||
798 | for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++) | ||
799 | device_remove_file(&pdev->dev, &f71882fg_fan_attr[i].dev_attr); | ||
800 | |||
801 | kfree(data); | 1826 | kfree(data); |
802 | |||
803 | return err; | 1827 | return err; |
804 | } | 1828 | } |
805 | 1829 | ||
806 | static int __devexit f71882fg_remove(struct platform_device *pdev) | 1830 | static int f71882fg_remove(struct platform_device *pdev) |
807 | { | 1831 | { |
808 | int i; | 1832 | int i; |
809 | struct f71882fg_data *data = platform_get_drvdata(pdev); | 1833 | struct f71882fg_data *data = platform_get_drvdata(pdev); |
810 | 1834 | ||
811 | platform_set_drvdata(pdev, NULL); | 1835 | platform_set_drvdata(pdev, NULL); |
812 | hwmon_device_unregister(data->hwmon_dev); | 1836 | if (data->hwmon_dev) |
1837 | hwmon_device_unregister(data->hwmon_dev); | ||
1838 | |||
1839 | /* Note we are not looping over all attr arrays we have as the ones | ||
1840 | below are supersets of the ones skipped. */ | ||
1841 | device_remove_file(&pdev->dev, &dev_attr_name); | ||
813 | 1842 | ||
814 | for (i = 0; i < ARRAY_SIZE(f71882fg_dev_attr); i++) | 1843 | for (i = 0; i < ARRAY_SIZE(f718x2fg_in_temp_attr); i++) |
815 | device_remove_file(&pdev->dev, &f71882fg_dev_attr[i]); | 1844 | device_remove_file(&pdev->dev, |
1845 | &f718x2fg_in_temp_attr[i].dev_attr); | ||
816 | 1846 | ||
817 | for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++) | 1847 | for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++) |
818 | device_remove_file(&pdev->dev, | 1848 | device_remove_file(&pdev->dev, |
819 | &f71882fg_in_temp_attr[i].dev_attr); | 1849 | &f71882fg_in_temp_attr[i].dev_attr); |
820 | 1850 | ||
1851 | for (i = 0; i < ARRAY_SIZE(fxxxx_fan_attr); i++) | ||
1852 | device_remove_file(&pdev->dev, &fxxxx_fan_attr[i].dev_attr); | ||
1853 | |||
821 | for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++) | 1854 | for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++) |
822 | device_remove_file(&pdev->dev, &f71882fg_fan_attr[i].dev_attr); | 1855 | device_remove_file(&pdev->dev, &f71882fg_fan_attr[i].dev_attr); |
823 | 1856 | ||
1857 | for (i = 0; i < ARRAY_SIZE(f8000_fan_attr); i++) | ||
1858 | device_remove_file(&pdev->dev, &f8000_fan_attr[i].dev_attr); | ||
1859 | |||
824 | kfree(data); | 1860 | kfree(data); |
825 | 1861 | ||
826 | return 0; | 1862 | return 0; |
827 | } | 1863 | } |
828 | 1864 | ||
829 | static int __init f71882fg_find(int sioaddr, unsigned short *address) | 1865 | static int __init f71882fg_find(int sioaddr, unsigned short *address, |
1866 | struct f71882fg_sio_data *sio_data) | ||
830 | { | 1867 | { |
831 | int err = -ENODEV; | 1868 | int err = -ENODEV; |
832 | u16 devid; | 1869 | u16 devid; |
833 | u8 start_reg; | ||
834 | struct f71882fg_data data; | ||
835 | 1870 | ||
836 | superio_enter(sioaddr); | 1871 | superio_enter(sioaddr); |
837 | 1872 | ||
@@ -842,7 +1877,17 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address) | |||
842 | } | 1877 | } |
843 | 1878 | ||
844 | devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); | 1879 | devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); |
845 | if (devid != SIO_F71882_ID) { | 1880 | switch (devid) { |
1881 | case SIO_F71862_ID: | ||
1882 | sio_data->type = f71862fg; | ||
1883 | break; | ||
1884 | case SIO_F71882_ID: | ||
1885 | sio_data->type = f71882fg; | ||
1886 | break; | ||
1887 | case SIO_F8000_ID: | ||
1888 | sio_data->type = f8000; | ||
1889 | break; | ||
1890 | default: | ||
846 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n"); | 1891 | printk(KERN_INFO DRVNAME ": Unsupported Fintek device\n"); |
847 | goto exit; | 1892 | goto exit; |
848 | } | 1893 | } |
@@ -861,24 +1906,17 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address) | |||
861 | } | 1906 | } |
862 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ | 1907 | *address &= ~(REGION_LENGTH - 1); /* Ignore 3 LSB */ |
863 | 1908 | ||
864 | data.addr = *address; | ||
865 | start_reg = f71882fg_read8(&data, F71882FG_REG_START); | ||
866 | if (!(start_reg & 0x03)) { | ||
867 | printk(KERN_WARNING DRVNAME | ||
868 | ": Hardware monitoring not activated\n"); | ||
869 | goto exit; | ||
870 | } | ||
871 | |||
872 | err = 0; | 1909 | err = 0; |
873 | printk(KERN_INFO DRVNAME ": Found F71882FG chip at %#x, revision %d\n", | 1910 | printk(KERN_INFO DRVNAME ": Found %s chip at %#x, revision %d\n", |
874 | (unsigned int)*address, | 1911 | f71882fg_names[sio_data->type], (unsigned int)*address, |
875 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); | 1912 | (int)superio_inb(sioaddr, SIO_REG_DEVREV)); |
876 | exit: | 1913 | exit: |
877 | superio_exit(sioaddr); | 1914 | superio_exit(sioaddr); |
878 | return err; | 1915 | return err; |
879 | } | 1916 | } |
880 | 1917 | ||
881 | static int __init f71882fg_device_add(unsigned short address) | 1918 | static int __init f71882fg_device_add(unsigned short address, |
1919 | const struct f71882fg_sio_data *sio_data) | ||
882 | { | 1920 | { |
883 | struct resource res = { | 1921 | struct resource res = { |
884 | .start = address, | 1922 | .start = address, |
@@ -892,12 +1930,23 @@ static int __init f71882fg_device_add(unsigned short address) | |||
892 | return -ENOMEM; | 1930 | return -ENOMEM; |
893 | 1931 | ||
894 | res.name = f71882fg_pdev->name; | 1932 | res.name = f71882fg_pdev->name; |
1933 | err = acpi_check_resource_conflict(&res); | ||
1934 | if (err) | ||
1935 | return err; | ||
1936 | |||
895 | err = platform_device_add_resources(f71882fg_pdev, &res, 1); | 1937 | err = platform_device_add_resources(f71882fg_pdev, &res, 1); |
896 | if (err) { | 1938 | if (err) { |
897 | printk(KERN_ERR DRVNAME ": Device resource addition failed\n"); | 1939 | printk(KERN_ERR DRVNAME ": Device resource addition failed\n"); |
898 | goto exit_device_put; | 1940 | goto exit_device_put; |
899 | } | 1941 | } |
900 | 1942 | ||
1943 | err = platform_device_add_data(f71882fg_pdev, sio_data, | ||
1944 | sizeof(struct f71882fg_sio_data)); | ||
1945 | if (err) { | ||
1946 | printk(KERN_ERR DRVNAME ": Platform data allocation failed\n"); | ||
1947 | goto exit_device_put; | ||
1948 | } | ||
1949 | |||
901 | err = platform_device_add(f71882fg_pdev); | 1950 | err = platform_device_add(f71882fg_pdev); |
902 | if (err) { | 1951 | if (err) { |
903 | printk(KERN_ERR DRVNAME ": Device addition failed\n"); | 1952 | printk(KERN_ERR DRVNAME ": Device addition failed\n"); |
@@ -916,14 +1965,20 @@ static int __init f71882fg_init(void) | |||
916 | { | 1965 | { |
917 | int err = -ENODEV; | 1966 | int err = -ENODEV; |
918 | unsigned short address; | 1967 | unsigned short address; |
1968 | struct f71882fg_sio_data sio_data; | ||
1969 | |||
1970 | memset(&sio_data, 0, sizeof(sio_data)); | ||
919 | 1971 | ||
920 | if (f71882fg_find(0x2e, &address) && f71882fg_find(0x4e, &address)) | 1972 | if (f71882fg_find(0x2e, &address, &sio_data) && |
1973 | f71882fg_find(0x4e, &address, &sio_data)) | ||
921 | goto exit; | 1974 | goto exit; |
922 | 1975 | ||
923 | if ((err = platform_driver_register(&f71882fg_driver))) | 1976 | err = platform_driver_register(&f71882fg_driver); |
1977 | if (err) | ||
924 | goto exit; | 1978 | goto exit; |
925 | 1979 | ||
926 | if ((err = f71882fg_device_add(address))) | 1980 | err = f71882fg_device_add(address, &sio_data); |
1981 | if (err) | ||
927 | goto exit_driver; | 1982 | goto exit_driver; |
928 | 1983 | ||
929 | return 0; | 1984 | return 0; |
@@ -941,7 +1996,7 @@ static void __exit f71882fg_exit(void) | |||
941 | } | 1996 | } |
942 | 1997 | ||
943 | MODULE_DESCRIPTION("F71882FG Hardware Monitoring Driver"); | 1998 | MODULE_DESCRIPTION("F71882FG Hardware Monitoring Driver"); |
944 | MODULE_AUTHOR("Hans Edgington (hans@edgington.nl)"); | 1999 | MODULE_AUTHOR("Hans Edgington, Hans de Goede (hdegoede@redhat.com)"); |
945 | MODULE_LICENSE("GPL"); | 2000 | MODULE_LICENSE("GPL"); |
946 | 2001 | ||
947 | module_init(f71882fg_init); | 2002 | module_init(f71882fg_init); |
diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c index 967170368933..d07f4ef75092 100644 --- a/drivers/hwmon/fschmd.c +++ b/drivers/hwmon/fschmd.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* fschmd.c | 1 | /* fschmd.c |
2 | * | 2 | * |
3 | * Copyright (C) 2007 Hans de Goede <j.w.r.degoede@hhs.nl> | 3 | * Copyright (C) 2007,2008 Hans de Goede <hdegoede@redhat.com> |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -42,11 +42,20 @@ | |||
42 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/sysfs.h> | 43 | #include <linux/sysfs.h> |
44 | #include <linux/dmi.h> | 44 | #include <linux/dmi.h> |
45 | #include <linux/fs.h> | ||
46 | #include <linux/watchdog.h> | ||
47 | #include <linux/miscdevice.h> | ||
48 | #include <linux/uaccess.h> | ||
49 | #include <linux/kref.h> | ||
45 | 50 | ||
46 | /* Addresses to scan */ | 51 | /* Addresses to scan */ |
47 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; | 52 | static const unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END }; |
48 | 53 | ||
49 | /* Insmod parameters */ | 54 | /* Insmod parameters */ |
55 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
56 | module_param(nowayout, int, 0); | ||
57 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | ||
58 | __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
50 | I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); | 59 | I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); |
51 | 60 | ||
52 | /* | 61 | /* |
@@ -63,19 +72,26 @@ I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd); | |||
63 | #define FSCHMD_REG_EVENT_STATE 0x04 | 72 | #define FSCHMD_REG_EVENT_STATE 0x04 |
64 | #define FSCHMD_REG_CONTROL 0x05 | 73 | #define FSCHMD_REG_CONTROL 0x05 |
65 | 74 | ||
66 | #define FSCHMD_CONTROL_ALERT_LED_MASK 0x01 | 75 | #define FSCHMD_CONTROL_ALERT_LED 0x01 |
67 | 76 | ||
68 | /* watchdog (support to be implemented) */ | 77 | /* watchdog */ |
69 | #define FSCHMD_REG_WDOG_PRESET 0x28 | 78 | #define FSCHMD_REG_WDOG_PRESET 0x28 |
70 | #define FSCHMD_REG_WDOG_STATE 0x23 | 79 | #define FSCHMD_REG_WDOG_STATE 0x23 |
71 | #define FSCHMD_REG_WDOG_CONTROL 0x21 | 80 | #define FSCHMD_REG_WDOG_CONTROL 0x21 |
72 | 81 | ||
82 | #define FSCHMD_WDOG_CONTROL_TRIGGER 0x10 | ||
83 | #define FSCHMD_WDOG_CONTROL_STARTED 0x10 /* the same as trigger */ | ||
84 | #define FSCHMD_WDOG_CONTROL_STOP 0x20 | ||
85 | #define FSCHMD_WDOG_CONTROL_RESOLUTION 0x40 | ||
86 | |||
87 | #define FSCHMD_WDOG_STATE_CARDRESET 0x02 | ||
88 | |||
73 | /* voltages, weird order is to keep the same order as the old drivers */ | 89 | /* voltages, weird order is to keep the same order as the old drivers */ |
74 | static const u8 FSCHMD_REG_VOLT[3] = { 0x45, 0x42, 0x48 }; | 90 | static const u8 FSCHMD_REG_VOLT[3] = { 0x45, 0x42, 0x48 }; |
75 | 91 | ||
76 | /* minimum pwm at which the fan is driven (pwm can by increased depending on | 92 | /* minimum pwm at which the fan is driven (pwm can by increased depending on |
77 | the temp. Notice that for the scy some fans share there minimum speed. | 93 | the temp. Notice that for the scy some fans share there minimum speed. |
78 | Also notice that with the scy the sensor order is different then with the | 94 | Also notice that with the scy the sensor order is different than with the |
79 | other chips, this order was in the 2.4 driver and kept for consistency. */ | 95 | other chips, this order was in the 2.4 driver and kept for consistency. */ |
80 | static const u8 FSCHMD_REG_FAN_MIN[5][6] = { | 96 | static const u8 FSCHMD_REG_FAN_MIN[5][6] = { |
81 | { 0x55, 0x65 }, /* pos */ | 97 | { 0x55, 0x65 }, /* pos */ |
@@ -115,8 +131,8 @@ static const u8 FSCHMD_REG_FAN_RIPPLE[5][6] = { | |||
115 | static const int FSCHMD_NO_FAN_SENSORS[5] = { 3, 3, 6, 4, 5 }; | 131 | static const int FSCHMD_NO_FAN_SENSORS[5] = { 3, 3, 6, 4, 5 }; |
116 | 132 | ||
117 | /* Fan status register bitmasks */ | 133 | /* Fan status register bitmasks */ |
118 | #define FSCHMD_FAN_ALARM_MASK 0x04 /* called fault by FSC! */ | 134 | #define FSCHMD_FAN_ALARM 0x04 /* called fault by FSC! */ |
119 | #define FSCHMD_FAN_NOT_PRESENT_MASK 0x08 /* not documented */ | 135 | #define FSCHMD_FAN_NOT_PRESENT 0x08 /* not documented */ |
120 | 136 | ||
121 | 137 | ||
122 | /* actual temperature registers */ | 138 | /* actual temperature registers */ |
@@ -158,14 +174,11 @@ static const u8 FSCHER_REG_TEMP_AUTOP2[] = { 0x75, 0x85, 0x95 }; */ | |||
158 | static const int FSCHMD_NO_TEMP_SENSORS[5] = { 3, 3, 4, 3, 5 }; | 174 | static const int FSCHMD_NO_TEMP_SENSORS[5] = { 3, 3, 4, 3, 5 }; |
159 | 175 | ||
160 | /* temp status register bitmasks */ | 176 | /* temp status register bitmasks */ |
161 | #define FSCHMD_TEMP_WORKING_MASK 0x01 | 177 | #define FSCHMD_TEMP_WORKING 0x01 |
162 | #define FSCHMD_TEMP_ALERT_MASK 0x02 | 178 | #define FSCHMD_TEMP_ALERT 0x02 |
163 | /* there only really is an alarm if the sensor is working and alert == 1 */ | 179 | /* there only really is an alarm if the sensor is working and alert == 1 */ |
164 | #define FSCHMD_TEMP_ALARM_MASK \ | 180 | #define FSCHMD_TEMP_ALARM_MASK \ |
165 | (FSCHMD_TEMP_WORKING_MASK | FSCHMD_TEMP_ALERT_MASK) | 181 | (FSCHMD_TEMP_WORKING | FSCHMD_TEMP_ALERT) |
166 | |||
167 | /* our driver name */ | ||
168 | #define FSCHMD_NAME "fschmd" | ||
169 | 182 | ||
170 | /* | 183 | /* |
171 | * Functions declarations | 184 | * Functions declarations |
@@ -195,7 +208,7 @@ MODULE_DEVICE_TABLE(i2c, fschmd_id); | |||
195 | static struct i2c_driver fschmd_driver = { | 208 | static struct i2c_driver fschmd_driver = { |
196 | .class = I2C_CLASS_HWMON, | 209 | .class = I2C_CLASS_HWMON, |
197 | .driver = { | 210 | .driver = { |
198 | .name = FSCHMD_NAME, | 211 | .name = "fschmd", |
199 | }, | 212 | }, |
200 | .probe = fschmd_probe, | 213 | .probe = fschmd_probe, |
201 | .remove = fschmd_remove, | 214 | .remove = fschmd_remove, |
@@ -209,14 +222,26 @@ static struct i2c_driver fschmd_driver = { | |||
209 | */ | 222 | */ |
210 | 223 | ||
211 | struct fschmd_data { | 224 | struct fschmd_data { |
225 | struct i2c_client *client; | ||
212 | struct device *hwmon_dev; | 226 | struct device *hwmon_dev; |
213 | struct mutex update_lock; | 227 | struct mutex update_lock; |
228 | struct mutex watchdog_lock; | ||
229 | struct list_head list; /* member of the watchdog_data_list */ | ||
230 | struct kref kref; | ||
231 | struct miscdevice watchdog_miscdev; | ||
214 | int kind; | 232 | int kind; |
233 | unsigned long watchdog_is_open; | ||
234 | char watchdog_expect_close; | ||
235 | char watchdog_name[10]; /* must be unique to avoid sysfs conflict */ | ||
215 | char valid; /* zero until following fields are valid */ | 236 | char valid; /* zero until following fields are valid */ |
216 | unsigned long last_updated; /* in jiffies */ | 237 | unsigned long last_updated; /* in jiffies */ |
217 | 238 | ||
218 | /* register values */ | 239 | /* register values */ |
240 | u8 revision; /* chip revision */ | ||
219 | u8 global_control; /* global control register */ | 241 | u8 global_control; /* global control register */ |
242 | u8 watchdog_control; /* watchdog control register */ | ||
243 | u8 watchdog_state; /* watchdog status register */ | ||
244 | u8 watchdog_preset; /* watchdog counter preset on trigger val */ | ||
220 | u8 volt[3]; /* 12, 5, battery voltage */ | 245 | u8 volt[3]; /* 12, 5, battery voltage */ |
221 | u8 temp_act[5]; /* temperature */ | 246 | u8 temp_act[5]; /* temperature */ |
222 | u8 temp_status[5]; /* status of sensor */ | 247 | u8 temp_status[5]; /* status of sensor */ |
@@ -228,11 +253,28 @@ struct fschmd_data { | |||
228 | }; | 253 | }; |
229 | 254 | ||
230 | /* Global variables to hold information read from special DMI tables, which are | 255 | /* Global variables to hold information read from special DMI tables, which are |
231 | available on FSC machines with an fscher or later chip. */ | 256 | available on FSC machines with an fscher or later chip. There is no need to |
257 | protect these with a lock as they are only modified from our attach function | ||
258 | which always gets called with the i2c-core lock held and never accessed | ||
259 | before the attach function is done with them. */ | ||
232 | static int dmi_mult[3] = { 490, 200, 100 }; | 260 | static int dmi_mult[3] = { 490, 200, 100 }; |
233 | static int dmi_offset[3] = { 0, 0, 0 }; | 261 | static int dmi_offset[3] = { 0, 0, 0 }; |
234 | static int dmi_vref = -1; | 262 | static int dmi_vref = -1; |
235 | 263 | ||
264 | /* Somewhat ugly :( global data pointer list with all fschmd devices, so that | ||
265 | we can find our device data as when using misc_register there is no other | ||
266 | method to get to ones device data from the open fop. */ | ||
267 | static LIST_HEAD(watchdog_data_list); | ||
268 | /* Note this lock not only protect list access, but also data.kref access */ | ||
269 | static DEFINE_MUTEX(watchdog_data_mutex); | ||
270 | |||
271 | /* Release our data struct when we're detached from the i2c client *and* all | ||
272 | references to our watchdog device are released */ | ||
273 | static void fschmd_release_resources(struct kref *ref) | ||
274 | { | ||
275 | struct fschmd_data *data = container_of(ref, struct fschmd_data, kref); | ||
276 | kfree(data); | ||
277 | } | ||
236 | 278 | ||
237 | /* | 279 | /* |
238 | * Sysfs attr show / store functions | 280 | * Sysfs attr show / store functions |
@@ -300,7 +342,7 @@ static ssize_t show_temp_fault(struct device *dev, | |||
300 | struct fschmd_data *data = fschmd_update_device(dev); | 342 | struct fschmd_data *data = fschmd_update_device(dev); |
301 | 343 | ||
302 | /* bit 0 set means sensor working ok, so no fault! */ | 344 | /* bit 0 set means sensor working ok, so no fault! */ |
303 | if (data->temp_status[index] & FSCHMD_TEMP_WORKING_MASK) | 345 | if (data->temp_status[index] & FSCHMD_TEMP_WORKING) |
304 | return sprintf(buf, "0\n"); | 346 | return sprintf(buf, "0\n"); |
305 | else | 347 | else |
306 | return sprintf(buf, "1\n"); | 348 | return sprintf(buf, "1\n"); |
@@ -385,7 +427,7 @@ static ssize_t show_fan_alarm(struct device *dev, | |||
385 | int index = to_sensor_dev_attr(devattr)->index; | 427 | int index = to_sensor_dev_attr(devattr)->index; |
386 | struct fschmd_data *data = fschmd_update_device(dev); | 428 | struct fschmd_data *data = fschmd_update_device(dev); |
387 | 429 | ||
388 | if (data->fan_status[index] & FSCHMD_FAN_ALARM_MASK) | 430 | if (data->fan_status[index] & FSCHMD_FAN_ALARM) |
389 | return sprintf(buf, "1\n"); | 431 | return sprintf(buf, "1\n"); |
390 | else | 432 | else |
391 | return sprintf(buf, "0\n"); | 433 | return sprintf(buf, "0\n"); |
@@ -397,7 +439,7 @@ static ssize_t show_fan_fault(struct device *dev, | |||
397 | int index = to_sensor_dev_attr(devattr)->index; | 439 | int index = to_sensor_dev_attr(devattr)->index; |
398 | struct fschmd_data *data = fschmd_update_device(dev); | 440 | struct fschmd_data *data = fschmd_update_device(dev); |
399 | 441 | ||
400 | if (data->fan_status[index] & FSCHMD_FAN_NOT_PRESENT_MASK) | 442 | if (data->fan_status[index] & FSCHMD_FAN_NOT_PRESENT) |
401 | return sprintf(buf, "1\n"); | 443 | return sprintf(buf, "1\n"); |
402 | else | 444 | else |
403 | return sprintf(buf, "0\n"); | 445 | return sprintf(buf, "0\n"); |
@@ -449,7 +491,7 @@ static ssize_t show_alert_led(struct device *dev, | |||
449 | { | 491 | { |
450 | struct fschmd_data *data = fschmd_update_device(dev); | 492 | struct fschmd_data *data = fschmd_update_device(dev); |
451 | 493 | ||
452 | if (data->global_control & FSCHMD_CONTROL_ALERT_LED_MASK) | 494 | if (data->global_control & FSCHMD_CONTROL_ALERT_LED) |
453 | return sprintf(buf, "1\n"); | 495 | return sprintf(buf, "1\n"); |
454 | else | 496 | else |
455 | return sprintf(buf, "0\n"); | 497 | return sprintf(buf, "0\n"); |
@@ -467,9 +509,9 @@ static ssize_t store_alert_led(struct device *dev, | |||
467 | reg = i2c_smbus_read_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL); | 509 | reg = i2c_smbus_read_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL); |
468 | 510 | ||
469 | if (v) | 511 | if (v) |
470 | reg |= FSCHMD_CONTROL_ALERT_LED_MASK; | 512 | reg |= FSCHMD_CONTROL_ALERT_LED; |
471 | else | 513 | else |
472 | reg &= ~FSCHMD_CONTROL_ALERT_LED_MASK; | 514 | reg &= ~FSCHMD_CONTROL_ALERT_LED; |
473 | 515 | ||
474 | i2c_smbus_write_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL, reg); | 516 | i2c_smbus_write_byte_data(to_i2c_client(dev), FSCHMD_REG_CONTROL, reg); |
475 | 517 | ||
@@ -551,7 +593,265 @@ static struct sensor_device_attribute fschmd_fan_attr[] = { | |||
551 | 593 | ||
552 | 594 | ||
553 | /* | 595 | /* |
554 | * Real code | 596 | * Watchdog routines |
597 | */ | ||
598 | |||
599 | static int watchdog_set_timeout(struct fschmd_data *data, int timeout) | ||
600 | { | ||
601 | int ret, resolution; | ||
602 | int kind = data->kind + 1; /* 0-x array index -> 1-x module param */ | ||
603 | |||
604 | /* 2 second or 60 second resolution? */ | ||
605 | if (timeout <= 510 || kind == fscpos || kind == fscscy) | ||
606 | resolution = 2; | ||
607 | else | ||
608 | resolution = 60; | ||
609 | |||
610 | if (timeout < resolution || timeout > (resolution * 255)) | ||
611 | return -EINVAL; | ||
612 | |||
613 | mutex_lock(&data->watchdog_lock); | ||
614 | if (!data->client) { | ||
615 | ret = -ENODEV; | ||
616 | goto leave; | ||
617 | } | ||
618 | |||
619 | if (resolution == 2) | ||
620 | data->watchdog_control &= ~FSCHMD_WDOG_CONTROL_RESOLUTION; | ||
621 | else | ||
622 | data->watchdog_control |= FSCHMD_WDOG_CONTROL_RESOLUTION; | ||
623 | |||
624 | data->watchdog_preset = DIV_ROUND_UP(timeout, resolution); | ||
625 | |||
626 | /* Write new timeout value */ | ||
627 | i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_PRESET, | ||
628 | data->watchdog_preset); | ||
629 | /* Write new control register, do not trigger! */ | ||
630 | i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL, | ||
631 | data->watchdog_control & ~FSCHMD_WDOG_CONTROL_TRIGGER); | ||
632 | |||
633 | ret = data->watchdog_preset * resolution; | ||
634 | |||
635 | leave: | ||
636 | mutex_unlock(&data->watchdog_lock); | ||
637 | return ret; | ||
638 | } | ||
639 | |||
640 | static int watchdog_get_timeout(struct fschmd_data *data) | ||
641 | { | ||
642 | int timeout; | ||
643 | |||
644 | mutex_lock(&data->watchdog_lock); | ||
645 | if (data->watchdog_control & FSCHMD_WDOG_CONTROL_RESOLUTION) | ||
646 | timeout = data->watchdog_preset * 60; | ||
647 | else | ||
648 | timeout = data->watchdog_preset * 2; | ||
649 | mutex_unlock(&data->watchdog_lock); | ||
650 | |||
651 | return timeout; | ||
652 | } | ||
653 | |||
654 | static int watchdog_trigger(struct fschmd_data *data) | ||
655 | { | ||
656 | int ret = 0; | ||
657 | |||
658 | mutex_lock(&data->watchdog_lock); | ||
659 | if (!data->client) { | ||
660 | ret = -ENODEV; | ||
661 | goto leave; | ||
662 | } | ||
663 | |||
664 | data->watchdog_control |= FSCHMD_WDOG_CONTROL_TRIGGER; | ||
665 | i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL, | ||
666 | data->watchdog_control); | ||
667 | leave: | ||
668 | mutex_unlock(&data->watchdog_lock); | ||
669 | return ret; | ||
670 | } | ||
671 | |||
672 | static int watchdog_stop(struct fschmd_data *data) | ||
673 | { | ||
674 | int ret = 0; | ||
675 | |||
676 | mutex_lock(&data->watchdog_lock); | ||
677 | if (!data->client) { | ||
678 | ret = -ENODEV; | ||
679 | goto leave; | ||
680 | } | ||
681 | |||
682 | data->watchdog_control &= ~FSCHMD_WDOG_CONTROL_STARTED; | ||
683 | /* Don't store the stop flag in our watchdog control register copy, as | ||
684 | its a write only bit (read always returns 0) */ | ||
685 | i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL, | ||
686 | data->watchdog_control | FSCHMD_WDOG_CONTROL_STOP); | ||
687 | leave: | ||
688 | mutex_unlock(&data->watchdog_lock); | ||
689 | return ret; | ||
690 | } | ||
691 | |||
692 | static int watchdog_open(struct inode *inode, struct file *filp) | ||
693 | { | ||
694 | struct fschmd_data *pos, *data = NULL; | ||
695 | |||
696 | /* We get called from drivers/char/misc.c with misc_mtx hold, and we | ||
697 | call misc_register() from fschmd_probe() with watchdog_data_mutex | ||
698 | hold, as misc_register() takes the misc_mtx lock, this is a possible | ||
699 | deadlock, so we use mutex_trylock here. */ | ||
700 | if (!mutex_trylock(&watchdog_data_mutex)) | ||
701 | return -ERESTARTSYS; | ||
702 | list_for_each_entry(pos, &watchdog_data_list, list) { | ||
703 | if (pos->watchdog_miscdev.minor == iminor(inode)) { | ||
704 | data = pos; | ||
705 | break; | ||
706 | } | ||
707 | } | ||
708 | /* Note we can never not have found data, so we don't check for this */ | ||
709 | kref_get(&data->kref); | ||
710 | mutex_unlock(&watchdog_data_mutex); | ||
711 | |||
712 | if (test_and_set_bit(0, &data->watchdog_is_open)) | ||
713 | return -EBUSY; | ||
714 | |||
715 | /* Start the watchdog */ | ||
716 | watchdog_trigger(data); | ||
717 | filp->private_data = data; | ||
718 | |||
719 | return nonseekable_open(inode, filp); | ||
720 | } | ||
721 | |||
722 | static int watchdog_release(struct inode *inode, struct file *filp) | ||
723 | { | ||
724 | struct fschmd_data *data = filp->private_data; | ||
725 | |||
726 | if (data->watchdog_expect_close) { | ||
727 | watchdog_stop(data); | ||
728 | data->watchdog_expect_close = 0; | ||
729 | } else { | ||
730 | watchdog_trigger(data); | ||
731 | dev_crit(&data->client->dev, | ||
732 | "unexpected close, not stopping watchdog!\n"); | ||
733 | } | ||
734 | |||
735 | clear_bit(0, &data->watchdog_is_open); | ||
736 | |||
737 | mutex_lock(&watchdog_data_mutex); | ||
738 | kref_put(&data->kref, fschmd_release_resources); | ||
739 | mutex_unlock(&watchdog_data_mutex); | ||
740 | |||
741 | return 0; | ||
742 | } | ||
743 | |||
744 | static ssize_t watchdog_write(struct file *filp, const char __user *buf, | ||
745 | size_t count, loff_t *offset) | ||
746 | { | ||
747 | size_t ret; | ||
748 | struct fschmd_data *data = filp->private_data; | ||
749 | |||
750 | if (count) { | ||
751 | if (!nowayout) { | ||
752 | size_t i; | ||
753 | |||
754 | /* Clear it in case it was set with a previous write */ | ||
755 | data->watchdog_expect_close = 0; | ||
756 | |||
757 | for (i = 0; i != count; i++) { | ||
758 | char c; | ||
759 | if (get_user(c, buf + i)) | ||
760 | return -EFAULT; | ||
761 | if (c == 'V') | ||
762 | data->watchdog_expect_close = 1; | ||
763 | } | ||
764 | } | ||
765 | ret = watchdog_trigger(data); | ||
766 | if (ret < 0) | ||
767 | return ret; | ||
768 | } | ||
769 | return count; | ||
770 | } | ||
771 | |||
772 | static int watchdog_ioctl(struct inode *inode, struct file *filp, | ||
773 | unsigned int cmd, unsigned long arg) | ||
774 | { | ||
775 | static struct watchdog_info ident = { | ||
776 | .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | | ||
777 | WDIOF_CARDRESET, | ||
778 | .identity = "FSC watchdog" | ||
779 | }; | ||
780 | int i, ret = 0; | ||
781 | struct fschmd_data *data = filp->private_data; | ||
782 | |||
783 | switch (cmd) { | ||
784 | case WDIOC_GETSUPPORT: | ||
785 | ident.firmware_version = data->revision; | ||
786 | if (!nowayout) | ||
787 | ident.options |= WDIOF_MAGICCLOSE; | ||
788 | if (copy_to_user((void __user *)arg, &ident, sizeof(ident))) | ||
789 | ret = -EFAULT; | ||
790 | break; | ||
791 | |||
792 | case WDIOC_GETSTATUS: | ||
793 | ret = put_user(0, (int __user *)arg); | ||
794 | break; | ||
795 | |||
796 | case WDIOC_GETBOOTSTATUS: | ||
797 | if (data->watchdog_state & FSCHMD_WDOG_STATE_CARDRESET) | ||
798 | ret = put_user(WDIOF_CARDRESET, (int __user *)arg); | ||
799 | else | ||
800 | ret = put_user(0, (int __user *)arg); | ||
801 | break; | ||
802 | |||
803 | case WDIOC_KEEPALIVE: | ||
804 | ret = watchdog_trigger(data); | ||
805 | break; | ||
806 | |||
807 | case WDIOC_GETTIMEOUT: | ||
808 | i = watchdog_get_timeout(data); | ||
809 | ret = put_user(i, (int __user *)arg); | ||
810 | break; | ||
811 | |||
812 | case WDIOC_SETTIMEOUT: | ||
813 | if (get_user(i, (int __user *)arg)) { | ||
814 | ret = -EFAULT; | ||
815 | break; | ||
816 | } | ||
817 | ret = watchdog_set_timeout(data, i); | ||
818 | if (ret > 0) | ||
819 | ret = put_user(ret, (int __user *)arg); | ||
820 | break; | ||
821 | |||
822 | case WDIOC_SETOPTIONS: | ||
823 | if (get_user(i, (int __user *)arg)) { | ||
824 | ret = -EFAULT; | ||
825 | break; | ||
826 | } | ||
827 | |||
828 | if (i & WDIOS_DISABLECARD) | ||
829 | ret = watchdog_stop(data); | ||
830 | else if (i & WDIOS_ENABLECARD) | ||
831 | ret = watchdog_trigger(data); | ||
832 | else | ||
833 | ret = -EINVAL; | ||
834 | |||
835 | break; | ||
836 | default: | ||
837 | ret = -ENOTTY; | ||
838 | } | ||
839 | |||
840 | return ret; | ||
841 | } | ||
842 | |||
843 | static struct file_operations watchdog_fops = { | ||
844 | .owner = THIS_MODULE, | ||
845 | .llseek = no_llseek, | ||
846 | .open = watchdog_open, | ||
847 | .release = watchdog_release, | ||
848 | .write = watchdog_write, | ||
849 | .ioctl = watchdog_ioctl, | ||
850 | }; | ||
851 | |||
852 | |||
853 | /* | ||
854 | * Detect, register, unregister and update device functions | ||
555 | */ | 855 | */ |
556 | 856 | ||
557 | /* DMI decode routine to read voltage scaling factors from special DMI tables, | 857 | /* DMI decode routine to read voltage scaling factors from special DMI tables, |
@@ -661,9 +961,9 @@ static int fschmd_probe(struct i2c_client *client, | |||
661 | const struct i2c_device_id *id) | 961 | const struct i2c_device_id *id) |
662 | { | 962 | { |
663 | struct fschmd_data *data; | 963 | struct fschmd_data *data; |
664 | u8 revision; | ||
665 | const char * const names[5] = { "Poseidon", "Hermes", "Scylla", | 964 | const char * const names[5] = { "Poseidon", "Hermes", "Scylla", |
666 | "Heracles", "Heimdall" }; | 965 | "Heracles", "Heimdall" }; |
966 | const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 }; | ||
667 | int i, err; | 967 | int i, err; |
668 | enum chips kind = id->driver_data; | 968 | enum chips kind = id->driver_data; |
669 | 969 | ||
@@ -673,6 +973,13 @@ static int fschmd_probe(struct i2c_client *client, | |||
673 | 973 | ||
674 | i2c_set_clientdata(client, data); | 974 | i2c_set_clientdata(client, data); |
675 | mutex_init(&data->update_lock); | 975 | mutex_init(&data->update_lock); |
976 | mutex_init(&data->watchdog_lock); | ||
977 | INIT_LIST_HEAD(&data->list); | ||
978 | kref_init(&data->kref); | ||
979 | /* Store client pointer in our data struct for watchdog usage | ||
980 | (where the client is found through a data ptr instead of the | ||
981 | otherway around) */ | ||
982 | data->client = client; | ||
676 | 983 | ||
677 | if (kind == fscpos) { | 984 | if (kind == fscpos) { |
678 | /* The Poseidon has hardwired temp limits, fill these | 985 | /* The Poseidon has hardwired temp limits, fill these |
@@ -683,16 +990,27 @@ static int fschmd_probe(struct i2c_client *client, | |||
683 | } | 990 | } |
684 | 991 | ||
685 | /* Read the special DMI table for fscher and newer chips */ | 992 | /* Read the special DMI table for fscher and newer chips */ |
686 | if (kind == fscher || kind >= fschrc) { | 993 | if ((kind == fscher || kind >= fschrc) && dmi_vref == -1) { |
687 | dmi_walk(fschmd_dmi_decode); | 994 | dmi_walk(fschmd_dmi_decode); |
688 | if (dmi_vref == -1) { | 995 | if (dmi_vref == -1) { |
689 | printk(KERN_WARNING FSCHMD_NAME | 996 | dev_warn(&client->dev, |
690 | ": Couldn't get voltage scaling factors from " | 997 | "Couldn't get voltage scaling factors from " |
691 | "BIOS DMI table, using builtin defaults\n"); | 998 | "BIOS DMI table, using builtin defaults\n"); |
692 | dmi_vref = 33; | 999 | dmi_vref = 33; |
693 | } | 1000 | } |
694 | } | 1001 | } |
695 | 1002 | ||
1003 | /* Read in some never changing registers */ | ||
1004 | data->revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION); | ||
1005 | data->global_control = i2c_smbus_read_byte_data(client, | ||
1006 | FSCHMD_REG_CONTROL); | ||
1007 | data->watchdog_control = i2c_smbus_read_byte_data(client, | ||
1008 | FSCHMD_REG_WDOG_CONTROL); | ||
1009 | data->watchdog_state = i2c_smbus_read_byte_data(client, | ||
1010 | FSCHMD_REG_WDOG_STATE); | ||
1011 | data->watchdog_preset = i2c_smbus_read_byte_data(client, | ||
1012 | FSCHMD_REG_WDOG_PRESET); | ||
1013 | |||
696 | /* i2c kind goes from 1-5, we want from 0-4 to address arrays */ | 1014 | /* i2c kind goes from 1-5, we want from 0-4 to address arrays */ |
697 | data->kind = kind - 1; | 1015 | data->kind = kind - 1; |
698 | 1016 | ||
@@ -735,9 +1053,43 @@ static int fschmd_probe(struct i2c_client *client, | |||
735 | goto exit_detach; | 1053 | goto exit_detach; |
736 | } | 1054 | } |
737 | 1055 | ||
738 | revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION); | 1056 | /* We take the data_mutex lock early so that watchdog_open() cannot |
739 | printk(KERN_INFO FSCHMD_NAME ": Detected FSC %s chip, revision: %d\n", | 1057 | run when misc_register() has completed, but we've not yet added |
740 | names[data->kind], (int) revision); | 1058 | our data to the watchdog_data_list (and set the default timeout) */ |
1059 | mutex_lock(&watchdog_data_mutex); | ||
1060 | for (i = 0; i < ARRAY_SIZE(watchdog_minors); i++) { | ||
1061 | /* Register our watchdog part */ | ||
1062 | snprintf(data->watchdog_name, sizeof(data->watchdog_name), | ||
1063 | "watchdog%c", (i == 0) ? '\0' : ('0' + i)); | ||
1064 | data->watchdog_miscdev.name = data->watchdog_name; | ||
1065 | data->watchdog_miscdev.fops = &watchdog_fops; | ||
1066 | data->watchdog_miscdev.minor = watchdog_minors[i]; | ||
1067 | err = misc_register(&data->watchdog_miscdev); | ||
1068 | if (err == -EBUSY) | ||
1069 | continue; | ||
1070 | if (err) { | ||
1071 | data->watchdog_miscdev.minor = 0; | ||
1072 | dev_err(&client->dev, | ||
1073 | "Registering watchdog chardev: %d\n", err); | ||
1074 | break; | ||
1075 | } | ||
1076 | |||
1077 | list_add(&data->list, &watchdog_data_list); | ||
1078 | watchdog_set_timeout(data, 60); | ||
1079 | dev_info(&client->dev, | ||
1080 | "Registered watchdog chardev major 10, minor: %d\n", | ||
1081 | watchdog_minors[i]); | ||
1082 | break; | ||
1083 | } | ||
1084 | if (i == ARRAY_SIZE(watchdog_minors)) { | ||
1085 | data->watchdog_miscdev.minor = 0; | ||
1086 | dev_warn(&client->dev, "Couldn't register watchdog chardev " | ||
1087 | "(due to no free minor)\n"); | ||
1088 | } | ||
1089 | mutex_unlock(&watchdog_data_mutex); | ||
1090 | |||
1091 | dev_info(&client->dev, "Detected FSC %s chip, revision: %d\n", | ||
1092 | names[data->kind], (int) data->revision); | ||
741 | 1093 | ||
742 | return 0; | 1094 | return 0; |
743 | 1095 | ||
@@ -751,6 +1103,24 @@ static int fschmd_remove(struct i2c_client *client) | |||
751 | struct fschmd_data *data = i2c_get_clientdata(client); | 1103 | struct fschmd_data *data = i2c_get_clientdata(client); |
752 | int i; | 1104 | int i; |
753 | 1105 | ||
1106 | /* Unregister the watchdog (if registered) */ | ||
1107 | if (data->watchdog_miscdev.minor) { | ||
1108 | misc_deregister(&data->watchdog_miscdev); | ||
1109 | if (data->watchdog_is_open) { | ||
1110 | dev_warn(&client->dev, | ||
1111 | "i2c client detached with watchdog open! " | ||
1112 | "Stopping watchdog.\n"); | ||
1113 | watchdog_stop(data); | ||
1114 | } | ||
1115 | mutex_lock(&watchdog_data_mutex); | ||
1116 | list_del(&data->list); | ||
1117 | mutex_unlock(&watchdog_data_mutex); | ||
1118 | /* Tell the watchdog code the client is gone */ | ||
1119 | mutex_lock(&data->watchdog_lock); | ||
1120 | data->client = NULL; | ||
1121 | mutex_unlock(&data->watchdog_lock); | ||
1122 | } | ||
1123 | |||
754 | /* Check if registered in case we're called from fschmd_detect | 1124 | /* Check if registered in case we're called from fschmd_detect |
755 | to cleanup after an error */ | 1125 | to cleanup after an error */ |
756 | if (data->hwmon_dev) | 1126 | if (data->hwmon_dev) |
@@ -765,7 +1135,10 @@ static int fschmd_remove(struct i2c_client *client) | |||
765 | device_remove_file(&client->dev, | 1135 | device_remove_file(&client->dev, |
766 | &fschmd_fan_attr[i].dev_attr); | 1136 | &fschmd_fan_attr[i].dev_attr); |
767 | 1137 | ||
768 | kfree(data); | 1138 | mutex_lock(&watchdog_data_mutex); |
1139 | kref_put(&data->kref, fschmd_release_resources); | ||
1140 | mutex_unlock(&watchdog_data_mutex); | ||
1141 | |||
769 | return 0; | 1142 | return 0; |
770 | } | 1143 | } |
771 | 1144 | ||
@@ -798,7 +1171,7 @@ static struct fschmd_data *fschmd_update_device(struct device *dev) | |||
798 | data->temp_act[i] < data->temp_max[i]) | 1171 | data->temp_act[i] < data->temp_max[i]) |
799 | i2c_smbus_write_byte_data(client, | 1172 | i2c_smbus_write_byte_data(client, |
800 | FSCHMD_REG_TEMP_STATE[data->kind][i], | 1173 | FSCHMD_REG_TEMP_STATE[data->kind][i], |
801 | FSCHMD_TEMP_ALERT_MASK); | 1174 | FSCHMD_TEMP_ALERT); |
802 | } | 1175 | } |
803 | 1176 | ||
804 | for (i = 0; i < FSCHMD_NO_FAN_SENSORS[data->kind]; i++) { | 1177 | for (i = 0; i < FSCHMD_NO_FAN_SENSORS[data->kind]; i++) { |
@@ -816,28 +1189,17 @@ static struct fschmd_data *fschmd_update_device(struct device *dev) | |||
816 | FSCHMD_REG_FAN_MIN[data->kind][i]); | 1189 | FSCHMD_REG_FAN_MIN[data->kind][i]); |
817 | 1190 | ||
818 | /* reset fan status if speed is back to > 0 */ | 1191 | /* reset fan status if speed is back to > 0 */ |
819 | if ((data->fan_status[i] & FSCHMD_FAN_ALARM_MASK) && | 1192 | if ((data->fan_status[i] & FSCHMD_FAN_ALARM) && |
820 | data->fan_act[i]) | 1193 | data->fan_act[i]) |
821 | i2c_smbus_write_byte_data(client, | 1194 | i2c_smbus_write_byte_data(client, |
822 | FSCHMD_REG_FAN_STATE[data->kind][i], | 1195 | FSCHMD_REG_FAN_STATE[data->kind][i], |
823 | FSCHMD_FAN_ALARM_MASK); | 1196 | FSCHMD_FAN_ALARM); |
824 | } | 1197 | } |
825 | 1198 | ||
826 | for (i = 0; i < 3; i++) | 1199 | for (i = 0; i < 3; i++) |
827 | data->volt[i] = i2c_smbus_read_byte_data(client, | 1200 | data->volt[i] = i2c_smbus_read_byte_data(client, |
828 | FSCHMD_REG_VOLT[i]); | 1201 | FSCHMD_REG_VOLT[i]); |
829 | 1202 | ||
830 | data->global_control = i2c_smbus_read_byte_data(client, | ||
831 | FSCHMD_REG_CONTROL); | ||
832 | |||
833 | /* To be implemented in the future | ||
834 | data->watchdog[0] = i2c_smbus_read_byte_data(client, | ||
835 | FSCHMD_REG_WDOG_PRESET); | ||
836 | data->watchdog[1] = i2c_smbus_read_byte_data(client, | ||
837 | FSCHMD_REG_WDOG_STATE); | ||
838 | data->watchdog[2] = i2c_smbus_read_byte_data(client, | ||
839 | FSCHMD_REG_WDOG_CONTROL); */ | ||
840 | |||
841 | data->last_updated = jiffies; | 1203 | data->last_updated = jiffies; |
842 | data->valid = 1; | 1204 | data->valid = 1; |
843 | } | 1205 | } |
@@ -857,7 +1219,7 @@ static void __exit fschmd_exit(void) | |||
857 | i2c_del_driver(&fschmd_driver); | 1219 | i2c_del_driver(&fschmd_driver); |
858 | } | 1220 | } |
859 | 1221 | ||
860 | MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); | 1222 | MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); |
861 | MODULE_DESCRIPTION("FSC Poseidon, Hermes, Scylla, Heracles and " | 1223 | MODULE_DESCRIPTION("FSC Poseidon, Hermes, Scylla, Heracles and " |
862 | "Heimdall driver"); | 1224 | "Heimdall driver"); |
863 | MODULE_LICENSE("GPL"); | 1225 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index 2ede9388096b..27d7f72a5f11 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c | |||
@@ -490,6 +490,13 @@ static unsigned long chipset_ids[] = { | |||
490 | 0 | 490 | 0 |
491 | }; | 491 | }; |
492 | 492 | ||
493 | static struct pci_device_id i5k_amb_ids[] __devinitdata = { | ||
494 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, | ||
495 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) }, | ||
496 | { 0, } | ||
497 | }; | ||
498 | MODULE_DEVICE_TABLE(pci, i5k_amb_ids); | ||
499 | |||
493 | static int __devinit i5k_amb_probe(struct platform_device *pdev) | 500 | static int __devinit i5k_amb_probe(struct platform_device *pdev) |
494 | { | 501 | { |
495 | struct i5k_amb_data *data; | 502 | struct i5k_amb_data *data; |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index b74c95735f95..95a99c590da2 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -14,6 +14,7 @@ | |||
14 | IT8712F Super I/O chip w/LPC interface | 14 | IT8712F Super I/O chip w/LPC interface |
15 | IT8716F Super I/O chip w/LPC interface | 15 | IT8716F Super I/O chip w/LPC interface |
16 | IT8718F Super I/O chip w/LPC interface | 16 | IT8718F Super I/O chip w/LPC interface |
17 | IT8720F Super I/O chip w/LPC interface | ||
17 | IT8726F Super I/O chip w/LPC interface | 18 | IT8726F Super I/O chip w/LPC interface |
18 | Sis950 A clone of the IT8705F | 19 | Sis950 A clone of the IT8705F |
19 | 20 | ||
@@ -48,11 +49,12 @@ | |||
48 | #include <linux/sysfs.h> | 49 | #include <linux/sysfs.h> |
49 | #include <linux/string.h> | 50 | #include <linux/string.h> |
50 | #include <linux/dmi.h> | 51 | #include <linux/dmi.h> |
52 | #include <linux/acpi.h> | ||
51 | #include <asm/io.h> | 53 | #include <asm/io.h> |
52 | 54 | ||
53 | #define DRVNAME "it87" | 55 | #define DRVNAME "it87" |
54 | 56 | ||
55 | enum chips { it87, it8712, it8716, it8718 }; | 57 | enum chips { it87, it8712, it8716, it8718, it8720 }; |
56 | 58 | ||
57 | static unsigned short force_id; | 59 | static unsigned short force_id; |
58 | module_param(force_id, ushort, 0); | 60 | module_param(force_id, ushort, 0); |
@@ -64,7 +66,10 @@ static struct platform_device *pdev; | |||
64 | #define DEV 0x07 /* Register: Logical device select */ | 66 | #define DEV 0x07 /* Register: Logical device select */ |
65 | #define VAL 0x2f /* The value to read/write */ | 67 | #define VAL 0x2f /* The value to read/write */ |
66 | #define PME 0x04 /* The device with the fan registers in it */ | 68 | #define PME 0x04 /* The device with the fan registers in it */ |
67 | #define GPIO 0x07 /* The device with the IT8718F VID value in it */ | 69 | |
70 | /* The device with the IT8718F/IT8720F VID value in it */ | ||
71 | #define GPIO 0x07 | ||
72 | |||
68 | #define DEVID 0x20 /* Register: Device ID */ | 73 | #define DEVID 0x20 /* Register: Device ID */ |
69 | #define DEVREV 0x22 /* Register: Device Revision */ | 74 | #define DEVREV 0x22 /* Register: Device Revision */ |
70 | 75 | ||
@@ -113,6 +118,7 @@ superio_exit(void) | |||
113 | #define IT8705F_DEVID 0x8705 | 118 | #define IT8705F_DEVID 0x8705 |
114 | #define IT8716F_DEVID 0x8716 | 119 | #define IT8716F_DEVID 0x8716 |
115 | #define IT8718F_DEVID 0x8718 | 120 | #define IT8718F_DEVID 0x8718 |
121 | #define IT8720F_DEVID 0x8720 | ||
116 | #define IT8726F_DEVID 0x8726 | 122 | #define IT8726F_DEVID 0x8726 |
117 | #define IT87_ACT_REG 0x30 | 123 | #define IT87_ACT_REG 0x30 |
118 | #define IT87_BASE_REG 0x60 | 124 | #define IT87_BASE_REG 0x60 |
@@ -150,8 +156,8 @@ static int fix_pwm_polarity; | |||
150 | #define IT87_REG_ALARM2 0x02 | 156 | #define IT87_REG_ALARM2 0x02 |
151 | #define IT87_REG_ALARM3 0x03 | 157 | #define IT87_REG_ALARM3 0x03 |
152 | 158 | ||
153 | /* The IT8718F has the VID value in a different register, in Super-I/O | 159 | /* The IT8718F and IT8720F have the VID value in a different register, in |
154 | configuration space. */ | 160 | Super-I/O configuration space. */ |
155 | #define IT87_REG_VID 0x0a | 161 | #define IT87_REG_VID 0x0a |
156 | /* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b | 162 | /* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b |
157 | for fan divisors. Later IT8712F revisions must use 16-bit tachometer | 163 | for fan divisors. Later IT8712F revisions must use 16-bit tachometer |
@@ -282,7 +288,8 @@ static inline int has_16bit_fans(const struct it87_data *data) | |||
282 | return (data->type == it87 && data->revision >= 0x03) | 288 | return (data->type == it87 && data->revision >= 0x03) |
283 | || (data->type == it8712 && data->revision >= 0x08) | 289 | || (data->type == it8712 && data->revision >= 0x08) |
284 | || data->type == it8716 | 290 | || data->type == it8716 |
285 | || data->type == it8718; | 291 | || data->type == it8718 |
292 | || data->type == it8720; | ||
286 | } | 293 | } |
287 | 294 | ||
288 | static int it87_probe(struct platform_device *pdev); | 295 | static int it87_probe(struct platform_device *pdev); |
@@ -992,6 +999,9 @@ static int __init it87_find(unsigned short *address, | |||
992 | case IT8718F_DEVID: | 999 | case IT8718F_DEVID: |
993 | sio_data->type = it8718; | 1000 | sio_data->type = it8718; |
994 | break; | 1001 | break; |
1002 | case IT8720F_DEVID: | ||
1003 | sio_data->type = it8720; | ||
1004 | break; | ||
995 | case 0xffff: /* No device at all */ | 1005 | case 0xffff: /* No device at all */ |
996 | goto exit; | 1006 | goto exit; |
997 | default: | 1007 | default: |
@@ -1022,7 +1032,8 @@ static int __init it87_find(unsigned short *address, | |||
1022 | int reg; | 1032 | int reg; |
1023 | 1033 | ||
1024 | superio_select(GPIO); | 1034 | superio_select(GPIO); |
1025 | if (chip_type == it8718) | 1035 | if ((chip_type == it8718) || |
1036 | (chip_type == it8720)) | ||
1026 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); | 1037 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); |
1027 | 1038 | ||
1028 | reg = superio_inb(IT87_SIO_PINX2_REG); | 1039 | reg = superio_inb(IT87_SIO_PINX2_REG); |
@@ -1068,6 +1079,7 @@ static int __devinit it87_probe(struct platform_device *pdev) | |||
1068 | "it8712", | 1079 | "it8712", |
1069 | "it8716", | 1080 | "it8716", |
1070 | "it8718", | 1081 | "it8718", |
1082 | "it8720", | ||
1071 | }; | 1083 | }; |
1072 | 1084 | ||
1073 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 1085 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
@@ -1226,7 +1238,7 @@ static int __devinit it87_probe(struct platform_device *pdev) | |||
1226 | } | 1238 | } |
1227 | 1239 | ||
1228 | if (data->type == it8712 || data->type == it8716 | 1240 | if (data->type == it8712 || data->type == it8716 |
1229 | || data->type == it8718) { | 1241 | || data->type == it8718 || data->type == it8720) { |
1230 | data->vrm = vid_which_vrm(); | 1242 | data->vrm = vid_which_vrm(); |
1231 | /* VID reading from Super-I/O config space if available */ | 1243 | /* VID reading from Super-I/O config space if available */ |
1232 | data->vid = sio_data->vid_value; | 1244 | data->vid = sio_data->vid_value; |
@@ -1374,7 +1386,7 @@ static void __devinit it87_init_device(struct platform_device *pdev) | |||
1374 | it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127); | 1386 | it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127); |
1375 | } | 1387 | } |
1376 | 1388 | ||
1377 | /* Check if temperature channnels are reset manually or by some reason */ | 1389 | /* Check if temperature channels are reset manually or by some reason */ |
1378 | tmp = it87_read_value(data, IT87_REG_TEMP_ENABLE); | 1390 | tmp = it87_read_value(data, IT87_REG_TEMP_ENABLE); |
1379 | if ((tmp & 0x3f) == 0) { | 1391 | if ((tmp & 0x3f) == 0) { |
1380 | /* Temp1,Temp3=thermistor; Temp2=thermal diode */ | 1392 | /* Temp1,Temp3=thermistor; Temp2=thermal diode */ |
@@ -1513,7 +1525,8 @@ static struct it87_data *it87_update_device(struct device *dev) | |||
1513 | 1525 | ||
1514 | data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); | 1526 | data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE); |
1515 | /* The 8705 does not have VID capability. | 1527 | /* The 8705 does not have VID capability. |
1516 | The 8718 does not use IT87_REG_VID for the same purpose. */ | 1528 | The 8718 and the 8720 don't use IT87_REG_VID for the |
1529 | same purpose. */ | ||
1517 | if (data->type == it8712 || data->type == it8716) { | 1530 | if (data->type == it8712 || data->type == it8716) { |
1518 | data->vid = it87_read_value(data, IT87_REG_VID); | 1531 | data->vid = it87_read_value(data, IT87_REG_VID); |
1519 | /* The older IT8712F revisions had only 5 VID pins, | 1532 | /* The older IT8712F revisions had only 5 VID pins, |
@@ -1540,6 +1553,10 @@ static int __init it87_device_add(unsigned short address, | |||
1540 | }; | 1553 | }; |
1541 | int err; | 1554 | int err; |
1542 | 1555 | ||
1556 | err = acpi_check_resource_conflict(&res); | ||
1557 | if (err) | ||
1558 | goto exit; | ||
1559 | |||
1543 | pdev = platform_device_alloc(DRVNAME, address); | 1560 | pdev = platform_device_alloc(DRVNAME, address); |
1544 | if (!pdev) { | 1561 | if (!pdev) { |
1545 | err = -ENOMEM; | 1562 | err = -ENOMEM; |
@@ -1608,7 +1625,7 @@ static void __exit sm_it87_exit(void) | |||
1608 | 1625 | ||
1609 | MODULE_AUTHOR("Chris Gauthron, " | 1626 | MODULE_AUTHOR("Chris Gauthron, " |
1610 | "Jean Delvare <khali@linux-fr.org>"); | 1627 | "Jean Delvare <khali@linux-fr.org>"); |
1611 | MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8726F, SiS950 driver"); | 1628 | MODULE_DESCRIPTION("IT8705F/8712F/8716F/8718F/8720F/8726F, SiS950 driver"); |
1612 | module_param(update_vbat, bool, 0); | 1629 | module_param(update_vbat, bool, 0); |
1613 | MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); | 1630 | MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value"); |
1614 | module_param(fix_pwm_polarity, bool, 0); | 1631 | module_param(fix_pwm_polarity, bool, 0); |
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index d435f003292d..ae6204f33214 100644 --- a/drivers/hwmon/lm70.c +++ b/drivers/hwmon/lm70.c | |||
@@ -37,9 +37,13 @@ | |||
37 | 37 | ||
38 | #define DRVNAME "lm70" | 38 | #define DRVNAME "lm70" |
39 | 39 | ||
40 | #define LM70_CHIP_LM70 0 /* original NS LM70 */ | ||
41 | #define LM70_CHIP_TMP121 1 /* TI TMP121/TMP123 */ | ||
42 | |||
40 | struct lm70 { | 43 | struct lm70 { |
41 | struct device *hwmon_dev; | 44 | struct device *hwmon_dev; |
42 | struct mutex lock; | 45 | struct mutex lock; |
46 | unsigned int chip; | ||
43 | }; | 47 | }; |
44 | 48 | ||
45 | /* sysfs hook function */ | 49 | /* sysfs hook function */ |
@@ -47,7 +51,7 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
47 | struct device_attribute *attr, char *buf) | 51 | struct device_attribute *attr, char *buf) |
48 | { | 52 | { |
49 | struct spi_device *spi = to_spi_device(dev); | 53 | struct spi_device *spi = to_spi_device(dev); |
50 | int status, val; | 54 | int status, val = 0; |
51 | u8 rxbuf[2]; | 55 | u8 rxbuf[2]; |
52 | s16 raw=0; | 56 | s16 raw=0; |
53 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 57 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); |
@@ -65,12 +69,12 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
65 | "spi_write_then_read failed with status %d\n", status); | 69 | "spi_write_then_read failed with status %d\n", status); |
66 | goto out; | 70 | goto out; |
67 | } | 71 | } |
68 | dev_dbg(dev, "rxbuf[1] : 0x%x rxbuf[0] : 0x%x\n", rxbuf[1], rxbuf[0]); | 72 | raw = (rxbuf[0] << 8) + rxbuf[1]; |
69 | 73 | dev_dbg(dev, "rxbuf[0] : 0x%02x rxbuf[1] : 0x%02x raw=0x%04x\n", | |
70 | raw = (rxbuf[1] << 8) + rxbuf[0]; | 74 | rxbuf[0], rxbuf[1], raw); |
71 | dev_dbg(dev, "raw=0x%x\n", raw); | ||
72 | 75 | ||
73 | /* | 76 | /* |
77 | * LM70: | ||
74 | * The "raw" temperature read into rxbuf[] is a 16-bit signed 2's | 78 | * The "raw" temperature read into rxbuf[] is a 16-bit signed 2's |
75 | * complement value. Only the MSB 11 bits (1 sign + 10 temperature | 79 | * complement value. Only the MSB 11 bits (1 sign + 10 temperature |
76 | * bits) are meaningful; the LSB 5 bits are to be discarded. | 80 | * bits) are meaningful; the LSB 5 bits are to be discarded. |
@@ -80,8 +84,21 @@ static ssize_t lm70_sense_temp(struct device *dev, | |||
80 | * by 0.25. Also multiply by 1000 to represent in millidegrees | 84 | * by 0.25. Also multiply by 1000 to represent in millidegrees |
81 | * Celsius. | 85 | * Celsius. |
82 | * So it's equivalent to multiplying by 0.25 * 1000 = 250. | 86 | * So it's equivalent to multiplying by 0.25 * 1000 = 250. |
87 | * | ||
88 | * TMP121/TMP123: | ||
89 | * 13 bits of 2's complement data, discard LSB 3 bits, | ||
90 | * resolution 0.0625 degrees celsius. | ||
83 | */ | 91 | */ |
84 | val = ((int)raw/32) * 250; | 92 | switch (p_lm70->chip) { |
93 | case LM70_CHIP_LM70: | ||
94 | val = ((int)raw / 32) * 250; | ||
95 | break; | ||
96 | |||
97 | case LM70_CHIP_TMP121: | ||
98 | val = ((int)raw / 8) * 625 / 10; | ||
99 | break; | ||
100 | } | ||
101 | |||
85 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ | 102 | status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */ |
86 | out: | 103 | out: |
87 | mutex_unlock(&p_lm70->lock); | 104 | mutex_unlock(&p_lm70->lock); |
@@ -93,27 +110,39 @@ static DEVICE_ATTR(temp1_input, S_IRUGO, lm70_sense_temp, NULL); | |||
93 | static ssize_t lm70_show_name(struct device *dev, struct device_attribute | 110 | static ssize_t lm70_show_name(struct device *dev, struct device_attribute |
94 | *devattr, char *buf) | 111 | *devattr, char *buf) |
95 | { | 112 | { |
96 | return sprintf(buf, "lm70\n"); | 113 | struct lm70 *p_lm70 = dev_get_drvdata(dev); |
114 | int ret; | ||
115 | |||
116 | switch (p_lm70->chip) { | ||
117 | case LM70_CHIP_LM70: | ||
118 | ret = sprintf(buf, "lm70\n"); | ||
119 | break; | ||
120 | case LM70_CHIP_TMP121: | ||
121 | ret = sprintf(buf, "tmp121\n"); | ||
122 | break; | ||
123 | default: | ||
124 | ret = -EINVAL; | ||
125 | } | ||
126 | return ret; | ||
97 | } | 127 | } |
98 | 128 | ||
99 | static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL); | 129 | static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL); |
100 | 130 | ||
101 | /*----------------------------------------------------------------------*/ | 131 | /*----------------------------------------------------------------------*/ |
102 | 132 | ||
103 | static int __devinit lm70_probe(struct spi_device *spi) | 133 | static int __devinit common_probe(struct spi_device *spi, int chip) |
104 | { | 134 | { |
105 | struct lm70 *p_lm70; | 135 | struct lm70 *p_lm70; |
106 | int status; | 136 | int status; |
107 | 137 | ||
108 | /* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */ | 138 | /* NOTE: we assume 8-bit words, and convert to 16 bits manually */ |
109 | if ((spi->mode & (SPI_CPOL|SPI_CPHA)) || !(spi->mode & SPI_3WIRE)) | ||
110 | return -EINVAL; | ||
111 | 139 | ||
112 | p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); | 140 | p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); |
113 | if (!p_lm70) | 141 | if (!p_lm70) |
114 | return -ENOMEM; | 142 | return -ENOMEM; |
115 | 143 | ||
116 | mutex_init(&p_lm70->lock); | 144 | mutex_init(&p_lm70->lock); |
145 | p_lm70->chip = chip; | ||
117 | 146 | ||
118 | /* sysfs hook */ | 147 | /* sysfs hook */ |
119 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); | 148 | p_lm70->hwmon_dev = hwmon_device_register(&spi->dev); |
@@ -141,6 +170,24 @@ out_dev_reg_failed: | |||
141 | return status; | 170 | return status; |
142 | } | 171 | } |
143 | 172 | ||
173 | static int __devinit lm70_probe(struct spi_device *spi) | ||
174 | { | ||
175 | /* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */ | ||
176 | if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE)) | ||
177 | return -EINVAL; | ||
178 | |||
179 | return common_probe(spi, LM70_CHIP_LM70); | ||
180 | } | ||
181 | |||
182 | static int __devinit tmp121_probe(struct spi_device *spi) | ||
183 | { | ||
184 | /* signaling is SPI_MODE_0 with only MISO connected */ | ||
185 | if (spi->mode & (SPI_CPOL | SPI_CPHA)) | ||
186 | return -EINVAL; | ||
187 | |||
188 | return common_probe(spi, LM70_CHIP_TMP121); | ||
189 | } | ||
190 | |||
144 | static int __devexit lm70_remove(struct spi_device *spi) | 191 | static int __devexit lm70_remove(struct spi_device *spi) |
145 | { | 192 | { |
146 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); | 193 | struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev); |
@@ -154,6 +201,15 @@ static int __devexit lm70_remove(struct spi_device *spi) | |||
154 | return 0; | 201 | return 0; |
155 | } | 202 | } |
156 | 203 | ||
204 | static struct spi_driver tmp121_driver = { | ||
205 | .driver = { | ||
206 | .name = "tmp121", | ||
207 | .owner = THIS_MODULE, | ||
208 | }, | ||
209 | .probe = tmp121_probe, | ||
210 | .remove = __devexit_p(lm70_remove), | ||
211 | }; | ||
212 | |||
157 | static struct spi_driver lm70_driver = { | 213 | static struct spi_driver lm70_driver = { |
158 | .driver = { | 214 | .driver = { |
159 | .name = "lm70", | 215 | .name = "lm70", |
@@ -165,17 +221,26 @@ static struct spi_driver lm70_driver = { | |||
165 | 221 | ||
166 | static int __init init_lm70(void) | 222 | static int __init init_lm70(void) |
167 | { | 223 | { |
168 | return spi_register_driver(&lm70_driver); | 224 | int ret = spi_register_driver(&lm70_driver); |
225 | if (ret) | ||
226 | return ret; | ||
227 | |||
228 | ret = spi_register_driver(&tmp121_driver); | ||
229 | if (ret) | ||
230 | spi_unregister_driver(&lm70_driver); | ||
231 | |||
232 | return ret; | ||
169 | } | 233 | } |
170 | 234 | ||
171 | static void __exit cleanup_lm70(void) | 235 | static void __exit cleanup_lm70(void) |
172 | { | 236 | { |
173 | spi_unregister_driver(&lm70_driver); | 237 | spi_unregister_driver(&lm70_driver); |
238 | spi_unregister_driver(&tmp121_driver); | ||
174 | } | 239 | } |
175 | 240 | ||
176 | module_init(init_lm70); | 241 | module_init(init_lm70); |
177 | module_exit(cleanup_lm70); | 242 | module_exit(cleanup_lm70); |
178 | 243 | ||
179 | MODULE_AUTHOR("Kaiwan N Billimoria"); | 244 | MODULE_AUTHOR("Kaiwan N Billimoria"); |
180 | MODULE_DESCRIPTION("National Semiconductor LM70 Linux driver"); | 245 | MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver"); |
181 | MODULE_LICENSE("GPL"); | 246 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c new file mode 100644 index 000000000000..034b2c515848 --- /dev/null +++ b/drivers/hwmon/ltc4245.c | |||
@@ -0,0 +1,567 @@ | |||
1 | /* | ||
2 | * Driver for Linear Technology LTC4245 I2C Multiple Supply Hot Swap Controller | ||
3 | * | ||
4 | * Copyright (C) 2008 Ira W. Snyder <iws@ovro.caltech.edu> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; version 2 of the License. | ||
9 | * | ||
10 | * This driver is based on the ds1621 and ina209 drivers. | ||
11 | * | ||
12 | * Datasheet: | ||
13 | * http://www.linear.com/pc/downloadDocument.do?navId=H0,C1,C1003,C1006,C1140,P19392,D13517 | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/i2c.h> | ||
22 | #include <linux/hwmon.h> | ||
23 | #include <linux/hwmon-sysfs.h> | ||
24 | |||
25 | /* Valid addresses are 0x20 - 0x3f | ||
26 | * | ||
27 | * For now, we do not probe, since some of these addresses | ||
28 | * are known to be unfriendly to probing */ | ||
29 | static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; | ||
30 | |||
31 | /* Insmod parameters */ | ||
32 | I2C_CLIENT_INSMOD_1(ltc4245); | ||
33 | |||
34 | /* Here are names of the chip's registers (a.k.a. commands) */ | ||
35 | enum ltc4245_cmd { | ||
36 | LTC4245_STATUS = 0x00, /* readonly */ | ||
37 | LTC4245_ALERT = 0x01, | ||
38 | LTC4245_CONTROL = 0x02, | ||
39 | LTC4245_ON = 0x03, | ||
40 | LTC4245_FAULT1 = 0x04, | ||
41 | LTC4245_FAULT2 = 0x05, | ||
42 | LTC4245_GPIO = 0x06, | ||
43 | LTC4245_ADCADR = 0x07, | ||
44 | |||
45 | LTC4245_12VIN = 0x10, | ||
46 | LTC4245_12VSENSE = 0x11, | ||
47 | LTC4245_12VOUT = 0x12, | ||
48 | LTC4245_5VIN = 0x13, | ||
49 | LTC4245_5VSENSE = 0x14, | ||
50 | LTC4245_5VOUT = 0x15, | ||
51 | LTC4245_3VIN = 0x16, | ||
52 | LTC4245_3VSENSE = 0x17, | ||
53 | LTC4245_3VOUT = 0x18, | ||
54 | LTC4245_VEEIN = 0x19, | ||
55 | LTC4245_VEESENSE = 0x1a, | ||
56 | LTC4245_VEEOUT = 0x1b, | ||
57 | LTC4245_GPIOADC1 = 0x1c, | ||
58 | LTC4245_GPIOADC2 = 0x1d, | ||
59 | LTC4245_GPIOADC3 = 0x1e, | ||
60 | }; | ||
61 | |||
62 | struct ltc4245_data { | ||
63 | struct device *hwmon_dev; | ||
64 | |||
65 | struct mutex update_lock; | ||
66 | bool valid; | ||
67 | unsigned long last_updated; /* in jiffies */ | ||
68 | |||
69 | /* Control registers */ | ||
70 | u8 cregs[0x08]; | ||
71 | |||
72 | /* Voltage registers */ | ||
73 | u8 vregs[0x0f]; | ||
74 | }; | ||
75 | |||
76 | static struct ltc4245_data *ltc4245_update_device(struct device *dev) | ||
77 | { | ||
78 | struct i2c_client *client = to_i2c_client(dev); | ||
79 | struct ltc4245_data *data = i2c_get_clientdata(client); | ||
80 | s32 val; | ||
81 | int i; | ||
82 | |||
83 | mutex_lock(&data->update_lock); | ||
84 | |||
85 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { | ||
86 | |||
87 | dev_dbg(&client->dev, "Starting ltc4245 update\n"); | ||
88 | |||
89 | /* Read control registers -- 0x00 to 0x07 */ | ||
90 | for (i = 0; i < ARRAY_SIZE(data->cregs); i++) { | ||
91 | val = i2c_smbus_read_byte_data(client, i); | ||
92 | if (unlikely(val < 0)) | ||
93 | data->cregs[i] = 0; | ||
94 | else | ||
95 | data->cregs[i] = val; | ||
96 | } | ||
97 | |||
98 | /* Read voltage registers -- 0x10 to 0x1f */ | ||
99 | for (i = 0; i < ARRAY_SIZE(data->vregs); i++) { | ||
100 | val = i2c_smbus_read_byte_data(client, i+0x10); | ||
101 | if (unlikely(val < 0)) | ||
102 | data->vregs[i] = 0; | ||
103 | else | ||
104 | data->vregs[i] = val; | ||
105 | } | ||
106 | |||
107 | data->last_updated = jiffies; | ||
108 | data->valid = 1; | ||
109 | } | ||
110 | |||
111 | mutex_unlock(&data->update_lock); | ||
112 | |||
113 | return data; | ||
114 | } | ||
115 | |||
116 | /* Return the voltage from the given register in millivolts */ | ||
117 | static int ltc4245_get_voltage(struct device *dev, u8 reg) | ||
118 | { | ||
119 | struct ltc4245_data *data = ltc4245_update_device(dev); | ||
120 | const u8 regval = data->vregs[reg - 0x10]; | ||
121 | u32 voltage = 0; | ||
122 | |||
123 | switch (reg) { | ||
124 | case LTC4245_12VIN: | ||
125 | case LTC4245_12VOUT: | ||
126 | voltage = regval * 55; | ||
127 | break; | ||
128 | case LTC4245_5VIN: | ||
129 | case LTC4245_5VOUT: | ||
130 | voltage = regval * 22; | ||
131 | break; | ||
132 | case LTC4245_3VIN: | ||
133 | case LTC4245_3VOUT: | ||
134 | voltage = regval * 15; | ||
135 | break; | ||
136 | case LTC4245_VEEIN: | ||
137 | case LTC4245_VEEOUT: | ||
138 | voltage = regval * -55; | ||
139 | break; | ||
140 | case LTC4245_GPIOADC1: | ||
141 | case LTC4245_GPIOADC2: | ||
142 | case LTC4245_GPIOADC3: | ||
143 | voltage = regval * 10; | ||
144 | break; | ||
145 | default: | ||
146 | /* If we get here, the developer messed up */ | ||
147 | WARN_ON_ONCE(1); | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | return voltage; | ||
152 | } | ||
153 | |||
154 | /* Return the current in the given sense register in milliAmperes */ | ||
155 | static unsigned int ltc4245_get_current(struct device *dev, u8 reg) | ||
156 | { | ||
157 | struct ltc4245_data *data = ltc4245_update_device(dev); | ||
158 | const u8 regval = data->vregs[reg - 0x10]; | ||
159 | unsigned int voltage; | ||
160 | unsigned int curr; | ||
161 | |||
162 | /* The strange looking conversions that follow are fixed-point | ||
163 | * math, since we cannot do floating point in the kernel. | ||
164 | * | ||
165 | * Step 1: convert sense register to microVolts | ||
166 | * Step 2: convert voltage to milliAmperes | ||
167 | * | ||
168 | * If you play around with the V=IR equation, you come up with | ||
169 | * the following: X uV / Y mOhm == Z mA | ||
170 | * | ||
171 | * With the resistors that are fractions of a milliOhm, we multiply | ||
172 | * the voltage and resistance by 10, to shift the decimal point. | ||
173 | * Now we can use the normal division operator again. | ||
174 | */ | ||
175 | |||
176 | switch (reg) { | ||
177 | case LTC4245_12VSENSE: | ||
178 | voltage = regval * 250; /* voltage in uV */ | ||
179 | curr = voltage / 50; /* sense resistor 50 mOhm */ | ||
180 | break; | ||
181 | case LTC4245_5VSENSE: | ||
182 | voltage = regval * 125; /* voltage in uV */ | ||
183 | curr = (voltage * 10) / 35; /* sense resistor 3.5 mOhm */ | ||
184 | break; | ||
185 | case LTC4245_3VSENSE: | ||
186 | voltage = regval * 125; /* voltage in uV */ | ||
187 | curr = (voltage * 10) / 25; /* sense resistor 2.5 mOhm */ | ||
188 | break; | ||
189 | case LTC4245_VEESENSE: | ||
190 | voltage = regval * 250; /* voltage in uV */ | ||
191 | curr = voltage / 100; /* sense resistor 100 mOhm */ | ||
192 | break; | ||
193 | default: | ||
194 | /* If we get here, the developer messed up */ | ||
195 | WARN_ON_ONCE(1); | ||
196 | curr = 0; | ||
197 | break; | ||
198 | } | ||
199 | |||
200 | return curr; | ||
201 | } | ||
202 | |||
203 | static ssize_t ltc4245_show_voltage(struct device *dev, | ||
204 | struct device_attribute *da, | ||
205 | char *buf) | ||
206 | { | ||
207 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | ||
208 | const int voltage = ltc4245_get_voltage(dev, attr->index); | ||
209 | |||
210 | return snprintf(buf, PAGE_SIZE, "%d\n", voltage); | ||
211 | } | ||
212 | |||
213 | static ssize_t ltc4245_show_current(struct device *dev, | ||
214 | struct device_attribute *da, | ||
215 | char *buf) | ||
216 | { | ||
217 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | ||
218 | const unsigned int curr = ltc4245_get_current(dev, attr->index); | ||
219 | |||
220 | return snprintf(buf, PAGE_SIZE, "%u\n", curr); | ||
221 | } | ||
222 | |||
223 | static ssize_t ltc4245_show_power(struct device *dev, | ||
224 | struct device_attribute *da, | ||
225 | char *buf) | ||
226 | { | ||
227 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | ||
228 | const unsigned int curr = ltc4245_get_current(dev, attr->index); | ||
229 | const int output_voltage = ltc4245_get_voltage(dev, attr->index+1); | ||
230 | |||
231 | /* current in mA * voltage in mV == power in uW */ | ||
232 | const unsigned int power = abs(output_voltage * curr); | ||
233 | |||
234 | return snprintf(buf, PAGE_SIZE, "%u\n", power); | ||
235 | } | ||
236 | |||
237 | static ssize_t ltc4245_show_alarm(struct device *dev, | ||
238 | struct device_attribute *da, | ||
239 | char *buf) | ||
240 | { | ||
241 | struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(da); | ||
242 | struct ltc4245_data *data = ltc4245_update_device(dev); | ||
243 | const u8 reg = data->cregs[attr->index]; | ||
244 | const u32 mask = attr->nr; | ||
245 | |||
246 | return snprintf(buf, PAGE_SIZE, "%u\n", (reg & mask) ? 1 : 0); | ||
247 | } | ||
248 | |||
249 | /* These macros are used below in constructing device attribute objects | ||
250 | * for use with sysfs_create_group() to make a sysfs device file | ||
251 | * for each register. | ||
252 | */ | ||
253 | |||
254 | #define LTC4245_VOLTAGE(name, ltc4245_cmd_idx) \ | ||
255 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
256 | ltc4245_show_voltage, NULL, ltc4245_cmd_idx) | ||
257 | |||
258 | #define LTC4245_CURRENT(name, ltc4245_cmd_idx) \ | ||
259 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
260 | ltc4245_show_current, NULL, ltc4245_cmd_idx) | ||
261 | |||
262 | #define LTC4245_POWER(name, ltc4245_cmd_idx) \ | ||
263 | static SENSOR_DEVICE_ATTR(name, S_IRUGO, \ | ||
264 | ltc4245_show_power, NULL, ltc4245_cmd_idx) | ||
265 | |||
266 | #define LTC4245_ALARM(name, mask, reg) \ | ||
267 | static SENSOR_DEVICE_ATTR_2(name, S_IRUGO, \ | ||
268 | ltc4245_show_alarm, NULL, (mask), reg) | ||
269 | |||
270 | /* Construct a sensor_device_attribute structure for each register */ | ||
271 | |||
272 | /* Input voltages */ | ||
273 | LTC4245_VOLTAGE(in1_input, LTC4245_12VIN); | ||
274 | LTC4245_VOLTAGE(in2_input, LTC4245_5VIN); | ||
275 | LTC4245_VOLTAGE(in3_input, LTC4245_3VIN); | ||
276 | LTC4245_VOLTAGE(in4_input, LTC4245_VEEIN); | ||
277 | |||
278 | /* Input undervoltage alarms */ | ||
279 | LTC4245_ALARM(in1_min_alarm, (1 << 0), LTC4245_FAULT1); | ||
280 | LTC4245_ALARM(in2_min_alarm, (1 << 1), LTC4245_FAULT1); | ||
281 | LTC4245_ALARM(in3_min_alarm, (1 << 2), LTC4245_FAULT1); | ||
282 | LTC4245_ALARM(in4_min_alarm, (1 << 3), LTC4245_FAULT1); | ||
283 | |||
284 | /* Currents (via sense resistor) */ | ||
285 | LTC4245_CURRENT(curr1_input, LTC4245_12VSENSE); | ||
286 | LTC4245_CURRENT(curr2_input, LTC4245_5VSENSE); | ||
287 | LTC4245_CURRENT(curr3_input, LTC4245_3VSENSE); | ||
288 | LTC4245_CURRENT(curr4_input, LTC4245_VEESENSE); | ||
289 | |||
290 | /* Overcurrent alarms */ | ||
291 | LTC4245_ALARM(curr1_max_alarm, (1 << 4), LTC4245_FAULT1); | ||
292 | LTC4245_ALARM(curr2_max_alarm, (1 << 5), LTC4245_FAULT1); | ||
293 | LTC4245_ALARM(curr3_max_alarm, (1 << 6), LTC4245_FAULT1); | ||
294 | LTC4245_ALARM(curr4_max_alarm, (1 << 7), LTC4245_FAULT1); | ||
295 | |||
296 | /* Output voltages */ | ||
297 | LTC4245_VOLTAGE(in5_input, LTC4245_12VOUT); | ||
298 | LTC4245_VOLTAGE(in6_input, LTC4245_5VOUT); | ||
299 | LTC4245_VOLTAGE(in7_input, LTC4245_3VOUT); | ||
300 | LTC4245_VOLTAGE(in8_input, LTC4245_VEEOUT); | ||
301 | |||
302 | /* Power Bad alarms */ | ||
303 | LTC4245_ALARM(in5_min_alarm, (1 << 0), LTC4245_FAULT2); | ||
304 | LTC4245_ALARM(in6_min_alarm, (1 << 1), LTC4245_FAULT2); | ||
305 | LTC4245_ALARM(in7_min_alarm, (1 << 2), LTC4245_FAULT2); | ||
306 | LTC4245_ALARM(in8_min_alarm, (1 << 3), LTC4245_FAULT2); | ||
307 | |||
308 | /* GPIO voltages */ | ||
309 | LTC4245_VOLTAGE(in9_input, LTC4245_GPIOADC1); | ||
310 | LTC4245_VOLTAGE(in10_input, LTC4245_GPIOADC2); | ||
311 | LTC4245_VOLTAGE(in11_input, LTC4245_GPIOADC3); | ||
312 | |||
313 | /* Power Consumption (virtual) */ | ||
314 | LTC4245_POWER(power1_input, LTC4245_12VSENSE); | ||
315 | LTC4245_POWER(power2_input, LTC4245_5VSENSE); | ||
316 | LTC4245_POWER(power3_input, LTC4245_3VSENSE); | ||
317 | LTC4245_POWER(power4_input, LTC4245_VEESENSE); | ||
318 | |||
319 | /* Finally, construct an array of pointers to members of the above objects, | ||
320 | * as required for sysfs_create_group() | ||
321 | */ | ||
322 | static struct attribute *ltc4245_attributes[] = { | ||
323 | &sensor_dev_attr_in1_input.dev_attr.attr, | ||
324 | &sensor_dev_attr_in2_input.dev_attr.attr, | ||
325 | &sensor_dev_attr_in3_input.dev_attr.attr, | ||
326 | &sensor_dev_attr_in4_input.dev_attr.attr, | ||
327 | |||
328 | &sensor_dev_attr_in1_min_alarm.dev_attr.attr, | ||
329 | &sensor_dev_attr_in2_min_alarm.dev_attr.attr, | ||
330 | &sensor_dev_attr_in3_min_alarm.dev_attr.attr, | ||
331 | &sensor_dev_attr_in4_min_alarm.dev_attr.attr, | ||
332 | |||
333 | &sensor_dev_attr_curr1_input.dev_attr.attr, | ||
334 | &sensor_dev_attr_curr2_input.dev_attr.attr, | ||
335 | &sensor_dev_attr_curr3_input.dev_attr.attr, | ||
336 | &sensor_dev_attr_curr4_input.dev_attr.attr, | ||
337 | |||
338 | &sensor_dev_attr_curr1_max_alarm.dev_attr.attr, | ||
339 | &sensor_dev_attr_curr2_max_alarm.dev_attr.attr, | ||
340 | &sensor_dev_attr_curr3_max_alarm.dev_attr.attr, | ||
341 | &sensor_dev_attr_curr4_max_alarm.dev_attr.attr, | ||
342 | |||
343 | &sensor_dev_attr_in5_input.dev_attr.attr, | ||
344 | &sensor_dev_attr_in6_input.dev_attr.attr, | ||
345 | &sensor_dev_attr_in7_input.dev_attr.attr, | ||
346 | &sensor_dev_attr_in8_input.dev_attr.attr, | ||
347 | |||
348 | &sensor_dev_attr_in5_min_alarm.dev_attr.attr, | ||
349 | &sensor_dev_attr_in6_min_alarm.dev_attr.attr, | ||
350 | &sensor_dev_attr_in7_min_alarm.dev_attr.attr, | ||
351 | &sensor_dev_attr_in8_min_alarm.dev_attr.attr, | ||
352 | |||
353 | &sensor_dev_attr_in9_input.dev_attr.attr, | ||
354 | &sensor_dev_attr_in10_input.dev_attr.attr, | ||
355 | &sensor_dev_attr_in11_input.dev_attr.attr, | ||
356 | |||
357 | &sensor_dev_attr_power1_input.dev_attr.attr, | ||
358 | &sensor_dev_attr_power2_input.dev_attr.attr, | ||
359 | &sensor_dev_attr_power3_input.dev_attr.attr, | ||
360 | &sensor_dev_attr_power4_input.dev_attr.attr, | ||
361 | |||
362 | NULL, | ||
363 | }; | ||
364 | |||
365 | static const struct attribute_group ltc4245_group = { | ||
366 | .attrs = ltc4245_attributes, | ||
367 | }; | ||
368 | |||
369 | static int ltc4245_probe(struct i2c_client *client, | ||
370 | const struct i2c_device_id *id) | ||
371 | { | ||
372 | struct ltc4245_data *data; | ||
373 | int ret; | ||
374 | |||
375 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
376 | if (!data) { | ||
377 | ret = -ENOMEM; | ||
378 | goto out_kzalloc; | ||
379 | } | ||
380 | |||
381 | i2c_set_clientdata(client, data); | ||
382 | mutex_init(&data->update_lock); | ||
383 | |||
384 | /* Initialize the LTC4245 chip */ | ||
385 | /* TODO */ | ||
386 | |||
387 | /* Register sysfs hooks */ | ||
388 | ret = sysfs_create_group(&client->dev.kobj, <c4245_group); | ||
389 | if (ret) | ||
390 | goto out_sysfs_create_group; | ||
391 | |||
392 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
393 | if (IS_ERR(data->hwmon_dev)) { | ||
394 | ret = PTR_ERR(data->hwmon_dev); | ||
395 | goto out_hwmon_device_register; | ||
396 | } | ||
397 | |||
398 | return 0; | ||
399 | |||
400 | out_hwmon_device_register: | ||
401 | sysfs_remove_group(&client->dev.kobj, <c4245_group); | ||
402 | out_sysfs_create_group: | ||
403 | kfree(data); | ||
404 | out_kzalloc: | ||
405 | return ret; | ||
406 | } | ||
407 | |||
408 | static int ltc4245_remove(struct i2c_client *client) | ||
409 | { | ||
410 | struct ltc4245_data *data = i2c_get_clientdata(client); | ||
411 | |||
412 | hwmon_device_unregister(data->hwmon_dev); | ||
413 | sysfs_remove_group(&client->dev.kobj, <c4245_group); | ||
414 | |||
415 | kfree(data); | ||
416 | |||
417 | return 0; | ||
418 | } | ||
419 | |||
420 | /* Check that some bits in a control register appear at all possible | ||
421 | * locations without changing value | ||
422 | * | ||
423 | * @client: the i2c client to use | ||
424 | * @reg: the register to read | ||
425 | * @bits: the bits to check (0xff checks all bits, | ||
426 | * 0x03 checks only the last two bits) | ||
427 | * | ||
428 | * return -ERRNO if the register read failed | ||
429 | * return -ENODEV if the register value doesn't stay constant at all | ||
430 | * possible addresses | ||
431 | * | ||
432 | * return 0 for success | ||
433 | */ | ||
434 | static int ltc4245_check_control_reg(struct i2c_client *client, u8 reg, u8 bits) | ||
435 | { | ||
436 | int i; | ||
437 | s32 v, voff1, voff2; | ||
438 | |||
439 | /* Read register and check for error */ | ||
440 | v = i2c_smbus_read_byte_data(client, reg); | ||
441 | if (v < 0) | ||
442 | return v; | ||
443 | |||
444 | v &= bits; | ||
445 | |||
446 | for (i = 0x00; i < 0xff; i += 0x20) { | ||
447 | |||
448 | voff1 = i2c_smbus_read_byte_data(client, reg + i); | ||
449 | if (voff1 < 0) | ||
450 | return voff1; | ||
451 | |||
452 | voff2 = i2c_smbus_read_byte_data(client, reg + i + 0x08); | ||
453 | if (voff2 < 0) | ||
454 | return voff2; | ||
455 | |||
456 | voff1 &= bits; | ||
457 | voff2 &= bits; | ||
458 | |||
459 | if (v != voff1 || v != voff2) | ||
460 | return -ENODEV; | ||
461 | } | ||
462 | |||
463 | return 0; | ||
464 | } | ||
465 | |||
466 | static int ltc4245_detect(struct i2c_client *client, | ||
467 | int kind, | ||
468 | struct i2c_board_info *info) | ||
469 | { | ||
470 | struct i2c_adapter *adapter = client->adapter; | ||
471 | |||
472 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
473 | return -ENODEV; | ||
474 | |||
475 | if (kind < 0) { /* probed detection - check the chip type */ | ||
476 | s32 v; /* 8 bits from the chip, or -ERRNO */ | ||
477 | |||
478 | /* Chip registers 0x00-0x07 are control registers | ||
479 | * Chip registers 0x10-0x1f are data registers | ||
480 | * | ||
481 | * Address bits b7-b5 are ignored. This makes the chip "repeat" | ||
482 | * in steps of 0x20. Any control registers should appear with | ||
483 | * the same values across all duplicated addresses. | ||
484 | * | ||
485 | * Register 0x02 bit b2 is reserved, expect 0 | ||
486 | * Register 0x07 bits b7 to b4 are reserved, expect 0 | ||
487 | * | ||
488 | * Registers 0x01, 0x02 are control registers and should not | ||
489 | * change on their own. | ||
490 | * | ||
491 | * Register 0x06 bits b6 and b7 are control bits, and should | ||
492 | * not change on their own. | ||
493 | * | ||
494 | * Register 0x07 bits b3 to b0 are control bits, and should | ||
495 | * not change on their own. | ||
496 | */ | ||
497 | |||
498 | /* read register 0x02 reserved bit, expect 0 */ | ||
499 | v = i2c_smbus_read_byte_data(client, LTC4245_CONTROL); | ||
500 | if (v < 0 || (v & 0x04) != 0) | ||
501 | return -ENODEV; | ||
502 | |||
503 | /* read register 0x07 reserved bits, expect 0 */ | ||
504 | v = i2c_smbus_read_byte_data(client, LTC4245_ADCADR); | ||
505 | if (v < 0 || (v & 0xf0) != 0) | ||
506 | return -ENODEV; | ||
507 | |||
508 | /* check that the alert register appears at all locations */ | ||
509 | if (ltc4245_check_control_reg(client, LTC4245_ALERT, 0xff)) | ||
510 | return -ENODEV; | ||
511 | |||
512 | /* check that the control register appears at all locations */ | ||
513 | if (ltc4245_check_control_reg(client, LTC4245_CONTROL, 0xff)) | ||
514 | return -ENODEV; | ||
515 | |||
516 | /* check that register 0x06 bits b6 and b7 stay constant */ | ||
517 | if (ltc4245_check_control_reg(client, LTC4245_GPIO, 0xc0)) | ||
518 | return -ENODEV; | ||
519 | |||
520 | /* check that register 0x07 bits b3-b0 stay constant */ | ||
521 | if (ltc4245_check_control_reg(client, LTC4245_ADCADR, 0x0f)) | ||
522 | return -ENODEV; | ||
523 | } | ||
524 | |||
525 | strlcpy(info->type, "ltc4245", I2C_NAME_SIZE); | ||
526 | dev_info(&adapter->dev, "ltc4245 %s at address 0x%02x\n", | ||
527 | kind < 0 ? "probed" : "forced", | ||
528 | client->addr); | ||
529 | |||
530 | return 0; | ||
531 | } | ||
532 | |||
533 | static const struct i2c_device_id ltc4245_id[] = { | ||
534 | { "ltc4245", ltc4245 }, | ||
535 | { } | ||
536 | }; | ||
537 | MODULE_DEVICE_TABLE(i2c, ltc4245_id); | ||
538 | |||
539 | /* This is the driver that will be inserted */ | ||
540 | static struct i2c_driver ltc4245_driver = { | ||
541 | .class = I2C_CLASS_HWMON, | ||
542 | .driver = { | ||
543 | .name = "ltc4245", | ||
544 | }, | ||
545 | .probe = ltc4245_probe, | ||
546 | .remove = ltc4245_remove, | ||
547 | .id_table = ltc4245_id, | ||
548 | .detect = ltc4245_detect, | ||
549 | .address_data = &addr_data, | ||
550 | }; | ||
551 | |||
552 | static int __init ltc4245_init(void) | ||
553 | { | ||
554 | return i2c_add_driver(<c4245_driver); | ||
555 | } | ||
556 | |||
557 | static void __exit ltc4245_exit(void) | ||
558 | { | ||
559 | i2c_del_driver(<c4245_driver); | ||
560 | } | ||
561 | |||
562 | MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>"); | ||
563 | MODULE_DESCRIPTION("LTC4245 driver"); | ||
564 | MODULE_LICENSE("GPL"); | ||
565 | |||
566 | module_init(ltc4245_init); | ||
567 | module_exit(ltc4245_exit); | ||
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 5fbfa34c110e..fb052fea3744 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/hwmon-vid.h> | 43 | #include <linux/hwmon-vid.h> |
44 | #include <linux/err.h> | 44 | #include <linux/err.h> |
45 | #include <linux/mutex.h> | 45 | #include <linux/mutex.h> |
46 | #include <linux/acpi.h> | ||
46 | #include <asm/io.h> | 47 | #include <asm/io.h> |
47 | 48 | ||
48 | static u8 devid; | 49 | static u8 devid; |
@@ -1627,6 +1628,11 @@ static int __init pc87360_device_add(unsigned short address) | |||
1627 | continue; | 1628 | continue; |
1628 | res.start = extra_isa[i]; | 1629 | res.start = extra_isa[i]; |
1629 | res.end = extra_isa[i] + PC87360_EXTENT - 1; | 1630 | res.end = extra_isa[i] + PC87360_EXTENT - 1; |
1631 | |||
1632 | err = acpi_check_resource_conflict(&res); | ||
1633 | if (err) | ||
1634 | goto exit_device_put; | ||
1635 | |||
1630 | err = platform_device_add_resources(pdev, &res, 1); | 1636 | err = platform_device_add_resources(pdev, &res, 1); |
1631 | if (err) { | 1637 | if (err) { |
1632 | printk(KERN_ERR "pc87360: Device resource[%d] " | 1638 | printk(KERN_ERR "pc87360: Device resource[%d] " |
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c index 7265f22ae5cd..3a8a0f7a7736 100644 --- a/drivers/hwmon/pc87427.c +++ b/drivers/hwmon/pc87427.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
33 | #include <linux/sysfs.h> | 33 | #include <linux/sysfs.h> |
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/acpi.h> | ||
35 | #include <asm/io.h> | 36 | #include <asm/io.h> |
36 | 37 | ||
37 | static unsigned short force_id; | 38 | static unsigned short force_id; |
@@ -524,6 +525,10 @@ static int __init pc87427_device_add(unsigned short address) | |||
524 | }; | 525 | }; |
525 | int err; | 526 | int err; |
526 | 527 | ||
528 | err = acpi_check_resource_conflict(&res); | ||
529 | if (err) | ||
530 | goto exit; | ||
531 | |||
527 | pdev = platform_device_alloc(DRVNAME, address); | 532 | pdev = platform_device_alloc(DRVNAME, address); |
528 | if (!pdev) { | 533 | if (!pdev) { |
529 | err = -ENOMEM; | 534 | err = -ENOMEM; |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index a276806f3d53..aa2e8318f167 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/jiffies.h> | 62 | #include <linux/jiffies.h> |
63 | #include <linux/mutex.h> | 63 | #include <linux/mutex.h> |
64 | #include <linux/sysfs.h> | 64 | #include <linux/sysfs.h> |
65 | #include <linux/acpi.h> | ||
65 | #include <asm/io.h> | 66 | #include <asm/io.h> |
66 | 67 | ||
67 | 68 | ||
@@ -727,6 +728,10 @@ static int __devinit sis5595_device_add(unsigned short address) | |||
727 | }; | 728 | }; |
728 | int err; | 729 | int err; |
729 | 730 | ||
731 | err = acpi_check_resource_conflict(&res); | ||
732 | if (err) | ||
733 | goto exit; | ||
734 | |||
730 | pdev = platform_device_alloc("sis5595", address); | 735 | pdev = platform_device_alloc("sis5595", address); |
731 | if (!pdev) { | 736 | if (!pdev) { |
732 | err = -ENOMEM; | 737 | err = -ENOMEM; |
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index eb03544c731c..6f6d52b4fb64 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/err.h> | 36 | #include <linux/err.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
39 | #include <linux/acpi.h> | ||
39 | #include <asm/io.h> | 40 | #include <asm/io.h> |
40 | 41 | ||
41 | static unsigned short force_id; | 42 | static unsigned short force_id; |
@@ -303,6 +304,10 @@ static int __init smsc47b397_device_add(unsigned short address) | |||
303 | }; | 304 | }; |
304 | int err; | 305 | int err; |
305 | 306 | ||
307 | err = acpi_check_resource_conflict(&res); | ||
308 | if (err) | ||
309 | goto exit; | ||
310 | |||
306 | pdev = platform_device_alloc(DRVNAME, address); | 311 | pdev = platform_device_alloc(DRVNAME, address); |
307 | if (!pdev) { | 312 | if (!pdev) { |
308 | err = -ENOMEM; | 313 | err = -ENOMEM; |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index d1b498548736..a92dbb97ee99 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
39 | #include <linux/sysfs.h> | 39 | #include <linux/sysfs.h> |
40 | #include <linux/acpi.h> | ||
40 | #include <asm/io.h> | 41 | #include <asm/io.h> |
41 | 42 | ||
42 | static unsigned short force_id; | 43 | static unsigned short force_id; |
@@ -705,6 +706,10 @@ static int __init smsc47m1_device_add(unsigned short address, | |||
705 | }; | 706 | }; |
706 | int err; | 707 | int err; |
707 | 708 | ||
709 | err = acpi_check_resource_conflict(&res); | ||
710 | if (err) | ||
711 | goto exit; | ||
712 | |||
708 | pdev = platform_device_alloc(DRVNAME, address); | 713 | pdev = platform_device_alloc(DRVNAME, address); |
709 | if (!pdev) { | 714 | if (!pdev) { |
710 | err = -ENOMEM; | 715 | err = -ENOMEM; |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index f1ee5e731968..a022aedcaacb 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/mutex.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/sysfs.h> | 43 | #include <linux/sysfs.h> |
44 | #include <linux/acpi.h> | ||
44 | #include <asm/io.h> | 45 | #include <asm/io.h> |
45 | 46 | ||
46 | 47 | ||
@@ -783,6 +784,10 @@ static int __devinit via686a_device_add(unsigned short address) | |||
783 | }; | 784 | }; |
784 | int err; | 785 | int err; |
785 | 786 | ||
787 | err = acpi_check_resource_conflict(&res); | ||
788 | if (err) | ||
789 | goto exit; | ||
790 | |||
786 | pdev = platform_device_alloc("via686a", address); | 791 | pdev = platform_device_alloc("via686a", address); |
787 | if (!pdev) { | 792 | if (!pdev) { |
788 | err = -ENOMEM; | 793 | err = -ENOMEM; |
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index 12b43590fa53..b0ce37852281 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/acpi.h> | ||
35 | #include <asm/io.h> | 36 | #include <asm/io.h> |
36 | 37 | ||
37 | static int uch_config = -1; | 38 | static int uch_config = -1; |
@@ -1259,6 +1260,10 @@ static int __init vt1211_device_add(unsigned short address) | |||
1259 | } | 1260 | } |
1260 | 1261 | ||
1261 | res.name = pdev->name; | 1262 | res.name = pdev->name; |
1263 | err = acpi_check_resource_conflict(&res); | ||
1264 | if (err) | ||
1265 | goto EXIT; | ||
1266 | |||
1262 | err = platform_device_add_resources(pdev, &res, 1); | 1267 | err = platform_device_add_resources(pdev, &res, 1); |
1263 | if (err) { | 1268 | if (err) { |
1264 | printk(KERN_ERR DRVNAME ": Device resource addition failed " | 1269 | printk(KERN_ERR DRVNAME ": Device resource addition failed " |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 5bc57275cae8..9982b45fbb14 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/hwmon-vid.h> | 35 | #include <linux/hwmon-vid.h> |
36 | #include <linux/err.h> | 36 | #include <linux/err.h> |
37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
38 | #include <linux/acpi.h> | ||
38 | #include <asm/io.h> | 39 | #include <asm/io.h> |
39 | 40 | ||
40 | static int force_addr; | 41 | static int force_addr; |
@@ -894,6 +895,10 @@ static int __devinit vt8231_device_add(unsigned short address) | |||
894 | }; | 895 | }; |
895 | int err; | 896 | int err; |
896 | 897 | ||
898 | err = acpi_check_resource_conflict(&res); | ||
899 | if (err) | ||
900 | goto exit; | ||
901 | |||
897 | pdev = platform_device_alloc("vt8231", address); | 902 | pdev = platform_device_alloc("vt8231", address); |
898 | if (!pdev) { | 903 | if (!pdev) { |
899 | err = -ENOMEM; | 904 | err = -ENOMEM; |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 075164dd65a7..cb808d015361 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/hwmon-vid.h> | 48 | #include <linux/hwmon-vid.h> |
49 | #include <linux/err.h> | 49 | #include <linux/err.h> |
50 | #include <linux/mutex.h> | 50 | #include <linux/mutex.h> |
51 | #include <linux/acpi.h> | ||
51 | #include <asm/io.h> | 52 | #include <asm/io.h> |
52 | #include "lm75.h" | 53 | #include "lm75.h" |
53 | 54 | ||
@@ -502,7 +503,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) | |||
502 | } | 503 | } |
503 | 504 | ||
504 | for (i = 0; i < 4; i++) { | 505 | for (i = 0; i < 4; i++) { |
505 | /* pwmcfg, tolarance mapped for i=0, i=1 to same reg */ | 506 | /* pwmcfg, tolerance mapped for i=0, i=1 to same reg */ |
506 | if (i != 1) { | 507 | if (i != 1) { |
507 | pwmcfg = w83627ehf_read_value(data, | 508 | pwmcfg = w83627ehf_read_value(data, |
508 | W83627EHF_REG_PWM_ENABLE[i]); | 509 | W83627EHF_REG_PWM_ENABLE[i]); |
@@ -1544,6 +1545,11 @@ static int __init sensors_w83627ehf_init(void) | |||
1544 | res.start = address + IOREGION_OFFSET; | 1545 | res.start = address + IOREGION_OFFSET; |
1545 | res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1; | 1546 | res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1; |
1546 | res.flags = IORESOURCE_IO; | 1547 | res.flags = IORESOURCE_IO; |
1548 | |||
1549 | err = acpi_check_resource_conflict(&res); | ||
1550 | if (err) | ||
1551 | goto exit; | ||
1552 | |||
1547 | err = platform_device_add_resources(pdev, &res, 1); | 1553 | err = platform_device_add_resources(pdev, &res, 1); |
1548 | if (err) { | 1554 | if (err) { |
1549 | printk(KERN_ERR DRVNAME ": Device resource addition failed " | 1555 | printk(KERN_ERR DRVNAME ": Device resource addition failed " |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index b30e5796cb26..389150ba30d3 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/err.h> | 50 | #include <linux/err.h> |
51 | #include <linux/mutex.h> | 51 | #include <linux/mutex.h> |
52 | #include <linux/ioport.h> | 52 | #include <linux/ioport.h> |
53 | #include <linux/acpi.h> | ||
53 | #include <asm/io.h> | 54 | #include <asm/io.h> |
54 | #include "lm75.h" | 55 | #include "lm75.h" |
55 | 56 | ||
@@ -1793,6 +1794,10 @@ static int __init w83627hf_device_add(unsigned short address, | |||
1793 | }; | 1794 | }; |
1794 | int err; | 1795 | int err; |
1795 | 1796 | ||
1797 | err = acpi_check_resource_conflict(&res); | ||
1798 | if (err) | ||
1799 | goto exit; | ||
1800 | |||
1796 | pdev = platform_device_alloc(DRVNAME, address); | 1801 | pdev = platform_device_alloc(DRVNAME, address); |
1797 | if (!pdev) { | 1802 | if (!pdev) { |
1798 | err = -ENOMEM; | 1803 | err = -ENOMEM; |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index fc12bd412e3a..dbfb30c588d8 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -58,7 +58,10 @@ static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, | |||
58 | 0x2e, 0x2f, I2C_CLIENT_END }; | 58 | 0x2e, 0x2f, I2C_CLIENT_END }; |
59 | /* Insmod parameters */ | 59 | /* Insmod parameters */ |
60 | I2C_CLIENT_INSMOD_4(w83781d, w83782d, w83783s, as99127f); | 60 | I2C_CLIENT_INSMOD_4(w83781d, w83782d, w83783s, as99127f); |
61 | I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " | 61 | |
62 | static unsigned short force_subclients[4]; | ||
63 | module_param_array(force_subclients, short, NULL, 0); | ||
64 | MODULE_PARM_DESC(force_subclients, "List of subclient addresses: " | ||
62 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); | 65 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); |
63 | 66 | ||
64 | static int reset; | 67 | static int reset; |
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index 5768def8a4f2..97851c5ba3a3 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c | |||
@@ -53,7 +53,10 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, | |||
53 | 53 | ||
54 | /* Insmod parameters */ | 54 | /* Insmod parameters */ |
55 | I2C_CLIENT_INSMOD_1(w83791d); | 55 | I2C_CLIENT_INSMOD_1(w83791d); |
56 | I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " | 56 | |
57 | static unsigned short force_subclients[4]; | ||
58 | module_param_array(force_subclients, short, NULL, 0); | ||
59 | MODULE_PARM_DESC(force_subclients, "List of subclient addresses: " | ||
57 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); | 60 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); |
58 | 61 | ||
59 | static int reset; | 62 | static int reset; |
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index cf94c5b0c879..2be16194ddf3 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c | |||
@@ -51,7 +51,10 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, | |||
51 | 51 | ||
52 | /* Insmod parameters */ | 52 | /* Insmod parameters */ |
53 | I2C_CLIENT_INSMOD_1(w83792d); | 53 | I2C_CLIENT_INSMOD_1(w83792d); |
54 | I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " | 54 | |
55 | static unsigned short force_subclients[4]; | ||
56 | module_param_array(force_subclients, short, NULL, 0); | ||
57 | MODULE_PARM_DESC(force_subclients, "List of subclient addresses: " | ||
55 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); | 58 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); |
56 | 59 | ||
57 | static int init; | 60 | static int init; |
diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 0a739f1c69be..47dd398f7258 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c | |||
@@ -42,7 +42,10 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, 0x2f, | |||
42 | 42 | ||
43 | /* Insmod parameters */ | 43 | /* Insmod parameters */ |
44 | I2C_CLIENT_INSMOD_1(w83793); | 44 | I2C_CLIENT_INSMOD_1(w83793); |
45 | I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: " | 45 | |
46 | static unsigned short force_subclients[4]; | ||
47 | module_param_array(force_subclients, short, NULL, 0); | ||
48 | MODULE_PARM_DESC(force_subclients, "List of subclient addresses: " | ||
46 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); | 49 | "{bus, clientaddr, subclientaddr1, subclientaddr2}"); |
47 | 50 | ||
48 | static int reset; | 51 | static int reset; |
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index fc3e5b026423..dd9e796fad69 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
@@ -399,8 +399,8 @@ static int __devinit ali1563_probe(struct pci_dev * dev, | |||
399 | if ((error = ali1563_setup(dev))) | 399 | if ((error = ali1563_setup(dev))) |
400 | goto exit; | 400 | goto exit; |
401 | ali1563_adapter.dev.parent = &dev->dev; | 401 | ali1563_adapter.dev.parent = &dev->dev; |
402 | sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", | 402 | snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name), |
403 | ali1563_smba); | 403 | "SMBus ALi 1563 Adapter @ %04x", ali1563_smba); |
404 | if ((error = i2c_add_adapter(&ali1563_adapter))) | 404 | if ((error = i2c_add_adapter(&ali1563_adapter))) |
405 | goto exit_shutdown; | 405 | goto exit_shutdown; |
406 | return 0; | 406 | return 0; |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 8ba2bcf727d3..378fcb5d5783 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -197,8 +197,8 @@ static int __init amd756_s4882_init(void) | |||
197 | for (i = 1; i < 5; i++) { | 197 | for (i = 1; i < 5; i++) { |
198 | s4882_algo[i] = *(amd756_smbus.algo); | 198 | s4882_algo[i] = *(amd756_smbus.algo); |
199 | s4882_adapter[i] = amd756_smbus; | 199 | s4882_adapter[i] = amd756_smbus; |
200 | sprintf(s4882_adapter[i].name, | 200 | snprintf(s4882_adapter[i].name, sizeof(s4882_adapter[i].name), |
201 | "SMBus 8111 adapter (CPU%d)", i-1); | 201 | "SMBus 8111 adapter (CPU%d)", i-1); |
202 | s4882_adapter[i].algo = s4882_algo+i; | 202 | s4882_adapter[i].algo = s4882_algo+i; |
203 | s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; | 203 | s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; |
204 | } | 204 | } |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 424dad6f18d8..36bee5b9c952 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -380,8 +380,9 @@ static int __devinit amd756_probe(struct pci_dev *pdev, | |||
380 | /* set up the sysfs linkage to our parent device */ | 380 | /* set up the sysfs linkage to our parent device */ |
381 | amd756_smbus.dev.parent = &pdev->dev; | 381 | amd756_smbus.dev.parent = &pdev->dev; |
382 | 382 | ||
383 | sprintf(amd756_smbus.name, "SMBus %s adapter at %04x", | 383 | snprintf(amd756_smbus.name, sizeof(amd756_smbus.name), |
384 | chipname[id->driver_data], amd756_ioport); | 384 | "SMBus %s adapter at %04x", chipname[id->driver_data], |
385 | amd756_ioport); | ||
385 | 386 | ||
386 | error = i2c_add_adapter(&amd756_smbus); | 387 | error = i2c_add_adapter(&amd756_smbus); |
387 | if (error) { | 388 | if (error) { |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 9efb02137254..67d9dc5b351b 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -222,7 +222,7 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev) | |||
222 | rc = -ENOMEM; | 222 | rc = -ENOMEM; |
223 | goto fail2; | 223 | goto fail2; |
224 | } | 224 | } |
225 | sprintf(adapter->name, "AT91"); | 225 | snprintf(adapter->name, sizeof(adapter->name), "AT91"); |
226 | adapter->algo = &at91_algorithm; | 226 | adapter->algo = &at91_algorithm; |
227 | adapter->class = I2C_CLASS_HWMON; | 227 | adapter->class = I2C_CLASS_HWMON; |
228 | adapter->dev.parent = &pdev->dev; | 228 | adapter->dev.parent = &pdev->dev; |
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index 3c855ff2992f..3fd2c417c1e0 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c | |||
@@ -656,7 +656,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) | |||
656 | strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); | 656 | strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); |
657 | p_adap->algo = &bfin_twi_algorithm; | 657 | p_adap->algo = &bfin_twi_algorithm; |
658 | p_adap->algo_data = iface; | 658 | p_adap->algo_data = iface; |
659 | p_adap->class = I2C_CLASS_ALL; | 659 | p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
660 | p_adap->dev.parent = &pdev->dev; | 660 | p_adap->dev.parent = &pdev->dev; |
661 | 661 | ||
662 | rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi"); | 662 | rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi"); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 5123eb69a971..526625eaa84b 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #include <linux/init.h> | 64 | #include <linux/init.h> |
65 | #include <linux/i2c.h> | 65 | #include <linux/i2c.h> |
66 | #include <linux/acpi.h> | 66 | #include <linux/acpi.h> |
67 | #include <asm/io.h> | 67 | #include <linux/io.h> |
68 | 68 | ||
69 | /* I801 SMBus address offsets */ | 69 | /* I801 SMBus address offsets */ |
70 | #define SMBHSTSTS (0 + i801_smba) | 70 | #define SMBHSTSTS (0 + i801_smba) |
@@ -583,6 +583,40 @@ static struct pci_device_id i801_ids[] = { | |||
583 | 583 | ||
584 | MODULE_DEVICE_TABLE (pci, i801_ids); | 584 | MODULE_DEVICE_TABLE (pci, i801_ids); |
585 | 585 | ||
586 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE | ||
587 | static unsigned char apanel_addr; | ||
588 | |||
589 | /* Scan the system ROM for the signature "FJKEYINF" */ | ||
590 | static __init const void __iomem *bios_signature(const void __iomem *bios) | ||
591 | { | ||
592 | ssize_t offset; | ||
593 | const unsigned char signature[] = "FJKEYINF"; | ||
594 | |||
595 | for (offset = 0; offset < 0x10000; offset += 0x10) { | ||
596 | if (check_signature(bios + offset, signature, | ||
597 | sizeof(signature)-1)) | ||
598 | return bios + offset; | ||
599 | } | ||
600 | return NULL; | ||
601 | } | ||
602 | |||
603 | static void __init input_apanel_init(void) | ||
604 | { | ||
605 | void __iomem *bios; | ||
606 | const void __iomem *p; | ||
607 | |||
608 | bios = ioremap(0xF0000, 0x10000); /* Can't fail */ | ||
609 | p = bios_signature(bios); | ||
610 | if (p) { | ||
611 | /* just use the first address */ | ||
612 | apanel_addr = readb(p + 8 + 3) >> 1; | ||
613 | } | ||
614 | iounmap(bios); | ||
615 | } | ||
616 | #else | ||
617 | static void __init input_apanel_init(void) {} | ||
618 | #endif | ||
619 | |||
586 | static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) | 620 | static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id) |
587 | { | 621 | { |
588 | unsigned char temp; | 622 | unsigned char temp; |
@@ -667,6 +701,19 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
667 | dev_err(&dev->dev, "Failed to add SMBus adapter\n"); | 701 | dev_err(&dev->dev, "Failed to add SMBus adapter\n"); |
668 | goto exit_release; | 702 | goto exit_release; |
669 | } | 703 | } |
704 | |||
705 | /* Register optional slaves */ | ||
706 | #if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE | ||
707 | if (apanel_addr) { | ||
708 | struct i2c_board_info info; | ||
709 | |||
710 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
711 | info.addr = apanel_addr; | ||
712 | strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE); | ||
713 | i2c_new_device(&i801_adapter, &info); | ||
714 | } | ||
715 | #endif | ||
716 | |||
670 | return 0; | 717 | return 0; |
671 | 718 | ||
672 | exit_release: | 719 | exit_release: |
@@ -717,6 +764,7 @@ static struct pci_driver i801_driver = { | |||
717 | 764 | ||
718 | static int __init i2c_i801_init(void) | 765 | static int __init i2c_i801_init(void) |
719 | { | 766 | { |
767 | input_apanel_init(); | ||
720 | return pci_register_driver(&i801_driver); | 768 | return pci_register_driver(&i801_driver); |
721 | } | 769 | } |
722 | 770 | ||
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 587f5b2380d4..6af68146c342 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -1076,10 +1076,10 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
1076 | 1076 | ||
1077 | #ifdef CONFIG_I2C_PXA_SLAVE | 1077 | #ifdef CONFIG_I2C_PXA_SLAVE |
1078 | printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", | 1078 | printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n", |
1079 | i2c->adap.dev.bus_id, i2c->slave_addr); | 1079 | dev_name(&i2c->adap.dev), i2c->slave_addr); |
1080 | #else | 1080 | #else |
1081 | printk(KERN_INFO "I2C: %s: PXA I2C adapter\n", | 1081 | printk(KERN_INFO "I2C: %s: PXA I2C adapter\n", |
1082 | i2c->adap.dev.bus_id); | 1082 | dev_name(&i2c->adap.dev)); |
1083 | #endif | 1083 | #endif |
1084 | return 0; | 1084 | return 0; |
1085 | 1085 | ||
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index f69f91ffb469..5b7f95641ba4 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -906,7 +906,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
906 | 906 | ||
907 | platform_set_drvdata(pdev, i2c); | 907 | platform_set_drvdata(pdev, i2c); |
908 | 908 | ||
909 | dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); | 909 | dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); |
910 | return 0; | 910 | return 0; |
911 | 911 | ||
912 | err_cpufreq: | 912 | err_cpufreq: |
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c index 5e0e254976de..baa28b73ae42 100644 --- a/drivers/i2c/busses/i2c-sh7760.c +++ b/drivers/i2c/busses/i2c-sh7760.c | |||
@@ -475,7 +475,7 @@ static int __devinit sh7760_i2c_probe(struct platform_device *pdev) | |||
475 | 475 | ||
476 | id->adap.nr = pdev->id; | 476 | id->adap.nr = pdev->id; |
477 | id->adap.algo = &sh7760_i2c_algo; | 477 | id->adap.algo = &sh7760_i2c_algo; |
478 | id->adap.class = I2C_CLASS_ALL; | 478 | id->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; |
479 | id->adap.retries = 3; | 479 | id->adap.retries = 3; |
480 | id->adap.algo_data = id; | 480 | id->adap.algo_data = id; |
481 | id->adap.dev.parent = &pdev->dev; | 481 | id->adap.dev.parent = &pdev->dev; |
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 6c3d60b939bf..1c01083b01b5 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c | |||
@@ -500,7 +500,7 @@ static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook) | |||
500 | while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) { | 500 | while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) { |
501 | for (n = res->start; hook && n <= res->end; n++) { | 501 | for (n = res->start; hook && n <= res->end; n++) { |
502 | if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED, | 502 | if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED, |
503 | dev->dev.bus_id, dev)) | 503 | dev_name(&dev->dev), dev)) |
504 | goto rollback; | 504 | goto rollback; |
505 | } | 505 | } |
506 | k++; | 506 | k++; |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index dfc2d5eb6a68..8ce2daff985c 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -389,8 +389,8 @@ static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_ | |||
389 | /* set up the sysfs linkage to our parent device */ | 389 | /* set up the sysfs linkage to our parent device */ |
390 | sis5595_adapter.dev.parent = &dev->dev; | 390 | sis5595_adapter.dev.parent = &dev->dev; |
391 | 391 | ||
392 | sprintf(sis5595_adapter.name, "SMBus SIS5595 adapter at %04x", | 392 | snprintf(sis5595_adapter.name, sizeof(sis5595_adapter.name), |
393 | sis5595_base + SMB_INDEX); | 393 | "SMBus SIS5595 adapter at %04x", sis5595_base + SMB_INDEX); |
394 | err = i2c_add_adapter(&sis5595_adapter); | 394 | err = i2c_add_adapter(&sis5595_adapter); |
395 | if (err) { | 395 | if (err) { |
396 | release_region(sis5595_base + SMB_INDEX, 2); | 396 | release_region(sis5595_base + SMB_INDEX, 2); |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index e7c4b790da54..9c9c016ff2b5 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -487,8 +487,8 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i | |||
487 | /* set up the sysfs linkage to our parent device */ | 487 | /* set up the sysfs linkage to our parent device */ |
488 | sis630_adapter.dev.parent = &dev->dev; | 488 | sis630_adapter.dev.parent = &dev->dev; |
489 | 489 | ||
490 | sprintf(sis630_adapter.name, "SMBus SIS630 adapter at %04x", | 490 | snprintf(sis630_adapter.name, sizeof(sis630_adapter.name), |
491 | acpi_base + SMB_STS); | 491 | "SMBus SIS630 adapter at %04x", acpi_base + SMB_STS); |
492 | 492 | ||
493 | return i2c_add_adapter(&sis630_adapter); | 493 | return i2c_add_adapter(&sis630_adapter); |
494 | } | 494 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index c6a63f46bc15..b1c9abe24c7b 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -459,7 +459,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap) | |||
459 | pr_debug("I2C adapter driver [%s] forgot to specify " | 459 | pr_debug("I2C adapter driver [%s] forgot to specify " |
460 | "physical device\n", adap->name); | 460 | "physical device\n", adap->name); |
461 | } | 461 | } |
462 | sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); | 462 | dev_set_name(&adap->dev, "i2c-%d", adap->nr); |
463 | adap->dev.release = &i2c_adapter_dev_release; | 463 | adap->dev.release = &i2c_adapter_dev_release; |
464 | adap->dev.class = &i2c_adapter_class; | 464 | adap->dev.class = &i2c_adapter_class; |
465 | res = device_register(&adap->dev); | 465 | res = device_register(&adap->dev); |
@@ -845,8 +845,8 @@ int i2c_attach_client(struct i2c_client *client) | |||
845 | } else | 845 | } else |
846 | client->dev.release = i2c_client_dev_release; | 846 | client->dev.release = i2c_client_dev_release; |
847 | 847 | ||
848 | snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), | 848 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adapter), |
849 | "%d-%04x", i2c_adapter_id(adapter), client->addr); | 849 | client->addr); |
850 | res = device_register(&client->dev); | 850 | res = device_register(&client->dev); |
851 | if (res) | 851 | if (res) |
852 | goto out_err; | 852 | goto out_err; |
@@ -856,7 +856,7 @@ int i2c_attach_client(struct i2c_client *client) | |||
856 | mutex_unlock(&adapter->clist_lock); | 856 | mutex_unlock(&adapter->clist_lock); |
857 | 857 | ||
858 | dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", | 858 | dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", |
859 | client->name, client->dev.bus_id); | 859 | client->name, dev_name(&client->dev)); |
860 | 860 | ||
861 | if (adapter->client_register) { | 861 | if (adapter->client_register) { |
862 | if (adapter->client_register(client)) { | 862 | if (adapter->client_register(client)) { |
diff --git a/drivers/ieee1394/csr.c b/drivers/ieee1394/csr.c index c90be4070e40..31400c8ae051 100644 --- a/drivers/ieee1394/csr.c +++ b/drivers/ieee1394/csr.c | |||
@@ -68,22 +68,22 @@ static struct hpsb_highlevel csr_highlevel = { | |||
68 | .host_reset = host_reset, | 68 | .host_reset = host_reset, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static struct hpsb_address_ops map_ops = { | 71 | const static struct hpsb_address_ops map_ops = { |
72 | .read = read_maps, | 72 | .read = read_maps, |
73 | }; | 73 | }; |
74 | 74 | ||
75 | static struct hpsb_address_ops fcp_ops = { | 75 | const static struct hpsb_address_ops fcp_ops = { |
76 | .write = write_fcp, | 76 | .write = write_fcp, |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static struct hpsb_address_ops reg_ops = { | 79 | const static struct hpsb_address_ops reg_ops = { |
80 | .read = read_regs, | 80 | .read = read_regs, |
81 | .write = write_regs, | 81 | .write = write_regs, |
82 | .lock = lock_regs, | 82 | .lock = lock_regs, |
83 | .lock64 = lock64_regs, | 83 | .lock64 = lock64_regs, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static struct hpsb_address_ops config_rom_ops = { | 86 | const static struct hpsb_address_ops config_rom_ops = { |
87 | .read = read_config_rom, | 87 | .read = read_config_rom, |
88 | }; | 88 | }; |
89 | 89 | ||
@@ -217,7 +217,7 @@ static void add_host(struct hpsb_host *host) | |||
217 | 217 | ||
218 | host->csr.generation = 2; | 218 | host->csr.generation = 2; |
219 | 219 | ||
220 | bus_info[1] = __constant_cpu_to_be32(0x31333934); | 220 | bus_info[1] = IEEE1394_BUSID_MAGIC; |
221 | bus_info[2] = cpu_to_be32((hpsb_disable_irm ? 0 : 1 << CSR_IRMC_SHIFT) | | 221 | bus_info[2] = cpu_to_be32((hpsb_disable_irm ? 0 : 1 << CSR_IRMC_SHIFT) | |
222 | (1 << CSR_CMC_SHIFT) | | 222 | (1 << CSR_CMC_SHIFT) | |
223 | (1 << CSR_ISC_SHIFT) | | 223 | (1 << CSR_ISC_SHIFT) | |
@@ -250,7 +250,7 @@ static void remove_host(struct hpsb_host *host) | |||
250 | { | 250 | { |
251 | quadlet_t bus_info[CSR_BUS_INFO_SIZE]; | 251 | quadlet_t bus_info[CSR_BUS_INFO_SIZE]; |
252 | 252 | ||
253 | bus_info[1] = __constant_cpu_to_be32(0x31333934); | 253 | bus_info[1] = IEEE1394_BUSID_MAGIC; |
254 | bus_info[2] = cpu_to_be32((0 << CSR_IRMC_SHIFT) | | 254 | bus_info[2] = cpu_to_be32((0 << CSR_IRMC_SHIFT) | |
255 | (0 << CSR_CMC_SHIFT) | | 255 | (0 << CSR_CMC_SHIFT) | |
256 | (0 << CSR_ISC_SHIFT) | | 256 | (0 << CSR_ISC_SHIFT) | |
diff --git a/drivers/ieee1394/csr.h b/drivers/ieee1394/csr.h index f11546550d84..90fb3f2192c3 100644 --- a/drivers/ieee1394/csr.h +++ b/drivers/ieee1394/csr.h | |||
@@ -50,11 +50,11 @@ | |||
50 | #define CSR_MAX_ROM_SHIFT 8 | 50 | #define CSR_MAX_ROM_SHIFT 8 |
51 | #define CSR_GENERATION_SHIFT 4 | 51 | #define CSR_GENERATION_SHIFT 4 |
52 | 52 | ||
53 | #define CSR_SET_BUS_INFO_GENERATION(csr, gen) \ | 53 | static inline void csr_set_bus_info_generation(struct csr1212_csr *csr, u8 gen) |
54 | ((csr)->bus_info_data[2] = \ | 54 | { |
55 | cpu_to_be32((be32_to_cpu((csr)->bus_info_data[2]) & \ | 55 | csr->bus_info_data[2] &= ~cpu_to_be32(0xf << CSR_GENERATION_SHIFT); |
56 | ~(0xf << CSR_GENERATION_SHIFT)) | \ | 56 | csr->bus_info_data[2] |= cpu_to_be32((u32)gen << CSR_GENERATION_SHIFT); |
57 | (gen) << CSR_GENERATION_SHIFT)) | 57 | } |
58 | 58 | ||
59 | struct csr_control { | 59 | struct csr_control { |
60 | spinlock_t lock; | 60 | spinlock_t lock; |
diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index 5e38a68b8af2..a6dfeb0b3372 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c | |||
@@ -1077,15 +1077,10 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1077 | int i; | 1077 | int i; |
1078 | int ret; | 1078 | int ret; |
1079 | 1079 | ||
1080 | /* IEEE 1212 says that the entire bus info block should be readable in | ||
1081 | * a single transaction regardless of the max_rom value. | ||
1082 | * Unfortunately, many IEEE 1394 devices do not abide by that, so the | ||
1083 | * bus info block will be read 1 quadlet at a time. The rest of the | ||
1084 | * ConfigROM will be read according to the max_rom field. */ | ||
1085 | for (i = 0; i < csr->bus_info_len; i += sizeof(u32)) { | 1080 | for (i = 0; i < csr->bus_info_len; i += sizeof(u32)) { |
1086 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, | 1081 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, |
1087 | sizeof(u32), &csr->cache_head->data[bytes_to_quads(i)], | 1082 | &csr->cache_head->data[bytes_to_quads(i)], |
1088 | csr->private); | 1083 | csr->private); |
1089 | if (ret != CSR1212_SUCCESS) | 1084 | if (ret != CSR1212_SUCCESS) |
1090 | return ret; | 1085 | return ret; |
1091 | 1086 | ||
@@ -1104,8 +1099,8 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) | |||
1104 | * a time. */ | 1099 | * a time. */ |
1105 | for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(u32)) { | 1100 | for (i = csr->bus_info_len; i <= csr->crc_len; i += sizeof(u32)) { |
1106 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, | 1101 | ret = csr->ops->bus_read(csr, CSR1212_CONFIG_ROM_SPACE_BASE + i, |
1107 | sizeof(u32), &csr->cache_head->data[bytes_to_quads(i)], | 1102 | &csr->cache_head->data[bytes_to_quads(i)], |
1108 | csr->private); | 1103 | csr->private); |
1109 | if (ret != CSR1212_SUCCESS) | 1104 | if (ret != CSR1212_SUCCESS) |
1110 | return ret; | 1105 | return ret; |
1111 | } | 1106 | } |
@@ -1289,7 +1284,7 @@ csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1289 | 1284 | ||
1290 | if (csr->ops->bus_read(csr, | 1285 | if (csr->ops->bus_read(csr, |
1291 | CSR1212_REGISTER_SPACE_BASE + kv->offset, | 1286 | CSR1212_REGISTER_SPACE_BASE + kv->offset, |
1292 | sizeof(u32), &q, csr->private)) | 1287 | &q, csr->private)) |
1293 | return -EIO; | 1288 | return -EIO; |
1294 | 1289 | ||
1295 | kv->value.leaf.len = be32_to_cpu(q) >> 16; | 1290 | kv->value.leaf.len = be32_to_cpu(q) >> 16; |
@@ -1372,17 +1367,8 @@ csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1372 | addr = (CSR1212_CSR_ARCH_REG_SPACE_BASE + cache->offset + | 1367 | addr = (CSR1212_CSR_ARCH_REG_SPACE_BASE + cache->offset + |
1373 | cr->offset_end) & ~(csr->max_rom - 1); | 1368 | cr->offset_end) & ~(csr->max_rom - 1); |
1374 | 1369 | ||
1375 | if (csr->ops->bus_read(csr, addr, csr->max_rom, cache_ptr, | 1370 | if (csr->ops->bus_read(csr, addr, cache_ptr, csr->private)) |
1376 | csr->private)) { | 1371 | return -EIO; |
1377 | if (csr->max_rom == 4) | ||
1378 | /* We've got problems! */ | ||
1379 | return -EIO; | ||
1380 | |||
1381 | /* Apperently the max_rom value was a lie, set it to | ||
1382 | * do quadlet reads and try again. */ | ||
1383 | csr->max_rom = 4; | ||
1384 | continue; | ||
1385 | } | ||
1386 | 1372 | ||
1387 | cr->offset_end += csr->max_rom - (cr->offset_end & | 1373 | cr->offset_end += csr->max_rom - (cr->offset_end & |
1388 | (csr->max_rom - 1)); | 1374 | (csr->max_rom - 1)); |
@@ -1433,7 +1419,6 @@ csr1212_get_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) | |||
1433 | 1419 | ||
1434 | int csr1212_parse_csr(struct csr1212_csr *csr) | 1420 | int csr1212_parse_csr(struct csr1212_csr *csr) |
1435 | { | 1421 | { |
1436 | static const int mr_map[] = { 4, 64, 1024, 0 }; | ||
1437 | struct csr1212_dentry *dentry; | 1422 | struct csr1212_dentry *dentry; |
1438 | int ret; | 1423 | int ret; |
1439 | 1424 | ||
@@ -1443,15 +1428,13 @@ int csr1212_parse_csr(struct csr1212_csr *csr) | |||
1443 | if (ret != CSR1212_SUCCESS) | 1428 | if (ret != CSR1212_SUCCESS) |
1444 | return ret; | 1429 | return ret; |
1445 | 1430 | ||
1446 | if (!csr->ops->get_max_rom) { | 1431 | /* |
1447 | csr->max_rom = mr_map[0]; /* default value */ | 1432 | * There has been a buggy firmware with bus_info_block.max_rom > 0 |
1448 | } else { | 1433 | * spotted which actually only supported quadlet read requests to the |
1449 | int i = csr->ops->get_max_rom(csr->bus_info_data, | 1434 | * config ROM. Therefore read everything quadlet by quadlet regardless |
1450 | csr->private); | 1435 | * of what the bus info block says. |
1451 | if (i & ~0x3) | 1436 | */ |
1452 | return -EINVAL; | 1437 | csr->max_rom = 4; |
1453 | csr->max_rom = mr_map[i]; | ||
1454 | } | ||
1455 | 1438 | ||
1456 | csr->cache_head->layout_head = csr->root_kv; | 1439 | csr->cache_head->layout_head = csr->root_kv; |
1457 | csr->cache_head->layout_tail = csr->root_kv; | 1440 | csr->cache_head->layout_tail = csr->root_kv; |
diff --git a/drivers/ieee1394/csr1212.h b/drivers/ieee1394/csr1212.h index 043039fc63ec..a892d922dbc9 100644 --- a/drivers/ieee1394/csr1212.h +++ b/drivers/ieee1394/csr1212.h | |||
@@ -181,7 +181,7 @@ struct csr1212_csr_rom_cache { | |||
181 | struct csr1212_csr { | 181 | struct csr1212_csr { |
182 | size_t bus_info_len; /* bus info block length in bytes */ | 182 | size_t bus_info_len; /* bus info block length in bytes */ |
183 | size_t crc_len; /* crc length in bytes */ | 183 | size_t crc_len; /* crc length in bytes */ |
184 | u32 *bus_info_data; /* bus info data incl bus name and EUI */ | 184 | __be32 *bus_info_data; /* bus info data incl bus name and EUI */ |
185 | 185 | ||
186 | void *private; /* private, bus specific data */ | 186 | void *private; /* private, bus specific data */ |
187 | struct csr1212_bus_ops *ops; | 187 | struct csr1212_bus_ops *ops; |
@@ -200,7 +200,7 @@ struct csr1212_bus_ops { | |||
200 | * entries located in the Units Space. Must return 0 on success | 200 | * entries located in the Units Space. Must return 0 on success |
201 | * anything else indicates an error. */ | 201 | * anything else indicates an error. */ |
202 | int (*bus_read) (struct csr1212_csr *csr, u64 addr, | 202 | int (*bus_read) (struct csr1212_csr *csr, u64 addr, |
203 | u16 length, void *buffer, void *private); | 203 | void *buffer, void *private); |
204 | 204 | ||
205 | /* This function is used by csr1212 to allocate a region in units space | 205 | /* This function is used by csr1212 to allocate a region in units space |
206 | * in the event that Config ROM entries don't all fit in the predefined | 206 | * in the event that Config ROM entries don't all fit in the predefined |
@@ -211,11 +211,6 @@ struct csr1212_bus_ops { | |||
211 | /* This function is used by csr1212 to release a region in units space | 211 | /* This function is used by csr1212 to release a region in units space |
212 | * that is no longer needed. */ | 212 | * that is no longer needed. */ |
213 | void (*release_addr) (u64 addr, void *private); | 213 | void (*release_addr) (u64 addr, void *private); |
214 | |||
215 | /* This function is used by csr1212 to determine the max read request | ||
216 | * supported by a remote node when reading the ConfigROM space. Must | ||
217 | * return 0, 1, or 2 per IEEE 1212. */ | ||
218 | int (*get_max_rom) (u32 *bus_info, void *private); | ||
219 | }; | 214 | }; |
220 | 215 | ||
221 | 216 | ||
diff --git a/drivers/ieee1394/dv1394-private.h b/drivers/ieee1394/dv1394-private.h index 7d1d2845b420..18b92cbf4a9f 100644 --- a/drivers/ieee1394/dv1394-private.h +++ b/drivers/ieee1394/dv1394-private.h | |||
@@ -77,11 +77,11 @@ static inline void fill_cip_header(struct CIP_header *cip, | |||
77 | See the Texas Instruments OHCI 1394 chipset documentation. | 77 | See the Texas Instruments OHCI 1394 chipset documentation. |
78 | */ | 78 | */ |
79 | 79 | ||
80 | struct output_more_immediate { u32 q[8]; }; | 80 | struct output_more_immediate { __le32 q[8]; }; |
81 | struct output_more { u32 q[4]; }; | 81 | struct output_more { __le32 q[4]; }; |
82 | struct output_last { u32 q[4]; }; | 82 | struct output_last { __le32 q[4]; }; |
83 | struct input_more { u32 q[4]; }; | 83 | struct input_more { __le32 q[4]; }; |
84 | struct input_last { u32 q[4]; }; | 84 | struct input_last { __le32 q[4]; }; |
85 | 85 | ||
86 | /* outputs */ | 86 | /* outputs */ |
87 | 87 | ||
@@ -92,9 +92,9 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi, | |||
92 | unsigned int payload_size) | 92 | unsigned int payload_size) |
93 | { | 93 | { |
94 | omi->q[0] = cpu_to_le32(0x02000000 | 8); /* OUTPUT_MORE_IMMEDIATE; 8 is the size of the IT header */ | 94 | omi->q[0] = cpu_to_le32(0x02000000 | 8); /* OUTPUT_MORE_IMMEDIATE; 8 is the size of the IT header */ |
95 | omi->q[1] = 0; | 95 | omi->q[1] = cpu_to_le32(0); |
96 | omi->q[2] = 0; | 96 | omi->q[2] = cpu_to_le32(0); |
97 | omi->q[3] = 0; | 97 | omi->q[3] = cpu_to_le32(0); |
98 | 98 | ||
99 | /* IT packet header */ | 99 | /* IT packet header */ |
100 | omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */ | 100 | omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */ |
@@ -106,8 +106,8 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi, | |||
106 | /* reserved field; mimic behavior of my Sony DSR-40 */ | 106 | /* reserved field; mimic behavior of my Sony DSR-40 */ |
107 | omi->q[5] = cpu_to_le32((payload_size << 16) | (0x7F << 8) | 0xA0); | 107 | omi->q[5] = cpu_to_le32((payload_size << 16) | (0x7F << 8) | 0xA0); |
108 | 108 | ||
109 | omi->q[6] = 0; | 109 | omi->q[6] = cpu_to_le32(0); |
110 | omi->q[7] = 0; | 110 | omi->q[7] = cpu_to_le32(0); |
111 | } | 111 | } |
112 | 112 | ||
113 | static inline void fill_output_more(struct output_more *om, | 113 | static inline void fill_output_more(struct output_more *om, |
@@ -116,8 +116,8 @@ static inline void fill_output_more(struct output_more *om, | |||
116 | { | 116 | { |
117 | om->q[0] = cpu_to_le32(data_size); | 117 | om->q[0] = cpu_to_le32(data_size); |
118 | om->q[1] = cpu_to_le32(data_phys_addr); | 118 | om->q[1] = cpu_to_le32(data_phys_addr); |
119 | om->q[2] = 0; | 119 | om->q[2] = cpu_to_le32(0); |
120 | om->q[3] = 0; | 120 | om->q[3] = cpu_to_le32(0); |
121 | } | 121 | } |
122 | 122 | ||
123 | static inline void fill_output_last(struct output_last *ol, | 123 | static inline void fill_output_last(struct output_last *ol, |
@@ -140,8 +140,8 @@ static inline void fill_output_last(struct output_last *ol, | |||
140 | 140 | ||
141 | ol->q[0] = cpu_to_le32(temp); | 141 | ol->q[0] = cpu_to_le32(temp); |
142 | ol->q[1] = cpu_to_le32(data_phys_addr); | 142 | ol->q[1] = cpu_to_le32(data_phys_addr); |
143 | ol->q[2] = 0; | 143 | ol->q[2] = cpu_to_le32(0); |
144 | ol->q[3] = 0; | 144 | ol->q[3] = cpu_to_le32(0); |
145 | } | 145 | } |
146 | 146 | ||
147 | /* inputs */ | 147 | /* inputs */ |
@@ -161,8 +161,8 @@ static inline void fill_input_more(struct input_more *im, | |||
161 | 161 | ||
162 | im->q[0] = cpu_to_le32(temp); | 162 | im->q[0] = cpu_to_le32(temp); |
163 | im->q[1] = cpu_to_le32(data_phys_addr); | 163 | im->q[1] = cpu_to_le32(data_phys_addr); |
164 | im->q[2] = 0; /* branchAddress and Z not use in packet-per-buffer mode */ | 164 | im->q[2] = cpu_to_le32(0); /* branchAddress and Z not use in packet-per-buffer mode */ |
165 | im->q[3] = 0; /* xferStatus & resCount, resCount must be initialize to data_size */ | 165 | im->q[3] = cpu_to_le32(0); /* xferStatus & resCount, resCount must be initialize to data_size */ |
166 | } | 166 | } |
167 | 167 | ||
168 | static inline void fill_input_last(struct input_last *il, | 168 | static inline void fill_input_last(struct input_last *il, |
@@ -331,7 +331,7 @@ struct frame { | |||
331 | 331 | ||
332 | /* points to status/timestamp field of first DMA packet */ | 332 | /* points to status/timestamp field of first DMA packet */ |
333 | /* (we'll check it later to monitor timestamp accuracy) */ | 333 | /* (we'll check it later to monitor timestamp accuracy) */ |
334 | u32 *frame_begin_timestamp; | 334 | __le32 *frame_begin_timestamp; |
335 | 335 | ||
336 | /* the timestamp we assigned to the first packet in the frame */ | 336 | /* the timestamp we assigned to the first packet in the frame */ |
337 | u32 assigned_timestamp; | 337 | u32 assigned_timestamp; |
@@ -348,15 +348,15 @@ struct frame { | |||
348 | that can cause interrupts. We'll check these from the | 348 | that can cause interrupts. We'll check these from the |
349 | interrupt handler. | 349 | interrupt handler. |
350 | */ | 350 | */ |
351 | u32 *mid_frame_timestamp; | 351 | __le32 *mid_frame_timestamp; |
352 | u32 *frame_end_timestamp; | 352 | __le32 *frame_end_timestamp; |
353 | 353 | ||
354 | /* branch address field of final packet. This is effectively | 354 | /* branch address field of final packet. This is effectively |
355 | the "tail" in the chain of DMA descriptor blocks. | 355 | the "tail" in the chain of DMA descriptor blocks. |
356 | We will fill it with the address of the first DMA descriptor | 356 | We will fill it with the address of the first DMA descriptor |
357 | block in the subsequent frame, once it is ready. | 357 | block in the subsequent frame, once it is ready. |
358 | */ | 358 | */ |
359 | u32 *frame_end_branch; | 359 | __le32 *frame_end_branch; |
360 | 360 | ||
361 | /* the number of descriptors in the first descriptor block | 361 | /* the number of descriptors in the first descriptor block |
362 | of the frame. Needed to start DMA */ | 362 | of the frame. Needed to start DMA */ |
@@ -365,10 +365,10 @@ struct frame { | |||
365 | 365 | ||
366 | 366 | ||
367 | struct packet { | 367 | struct packet { |
368 | u16 timestamp; | 368 | __le16 timestamp; |
369 | u16 invalid; | 369 | u16 invalid; |
370 | u16 iso_header; | 370 | u16 iso_header; |
371 | u16 data_length; | 371 | __le16 data_length; |
372 | u32 cip_h1; | 372 | u32 cip_h1; |
373 | u32 cip_h2; | 373 | u32 cip_h2; |
374 | unsigned char data[480]; | 374 | unsigned char data[480]; |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index c19f23267157..a329e6bd5d2d 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -265,7 +265,7 @@ static void frame_prepare(struct video_card *video, unsigned int this_frame) | |||
265 | /* these flags denote packets that need special attention */ | 265 | /* these flags denote packets that need special attention */ |
266 | int empty_packet, first_packet, last_packet, mid_packet; | 266 | int empty_packet, first_packet, last_packet, mid_packet; |
267 | 267 | ||
268 | u32 *branch_address, *last_branch_address = NULL; | 268 | __le32 *branch_address, *last_branch_address = NULL; |
269 | unsigned long data_p; | 269 | unsigned long data_p; |
270 | int first_packet_empty = 0; | 270 | int first_packet_empty = 0; |
271 | u32 cycleTimer, ct_sec, ct_cyc, ct_off; | 271 | u32 cycleTimer, ct_sec, ct_cyc, ct_off; |
@@ -848,7 +848,7 @@ static void receive_packets(struct video_card *video) | |||
848 | dma_addr_t block_dma = 0; | 848 | dma_addr_t block_dma = 0; |
849 | struct packet *data = NULL; | 849 | struct packet *data = NULL; |
850 | dma_addr_t data_dma = 0; | 850 | dma_addr_t data_dma = 0; |
851 | u32 *last_branch_address = NULL; | 851 | __le32 *last_branch_address = NULL; |
852 | unsigned long irq_flags; | 852 | unsigned long irq_flags; |
853 | int want_interrupt = 0; | 853 | int want_interrupt = 0; |
854 | struct frame *f = NULL; | 854 | struct frame *f = NULL; |
@@ -2110,17 +2110,17 @@ static void ir_tasklet_func(unsigned long data) | |||
2110 | f = video->frames[next_i / MAX_PACKETS]; | 2110 | f = video->frames[next_i / MAX_PACKETS]; |
2111 | next = &(f->descriptor_pool[next_i % MAX_PACKETS]); | 2111 | next = &(f->descriptor_pool[next_i % MAX_PACKETS]); |
2112 | next_dma = ((unsigned long) block - (unsigned long) f->descriptor_pool) + f->descriptor_pool_dma; | 2112 | next_dma = ((unsigned long) block - (unsigned long) f->descriptor_pool) + f->descriptor_pool_dma; |
2113 | next->u.in.il.q[0] |= 3 << 20; /* enable interrupt */ | 2113 | next->u.in.il.q[0] |= cpu_to_le32(3 << 20); /* enable interrupt */ |
2114 | next->u.in.il.q[2] = 0; /* disable branch */ | 2114 | next->u.in.il.q[2] = cpu_to_le32(0); /* disable branch */ |
2115 | 2115 | ||
2116 | /* link previous to next */ | 2116 | /* link previous to next */ |
2117 | prev_i = (next_i == 0) ? (MAX_PACKETS * video->n_frames - 1) : (next_i - 1); | 2117 | prev_i = (next_i == 0) ? (MAX_PACKETS * video->n_frames - 1) : (next_i - 1); |
2118 | f = video->frames[prev_i / MAX_PACKETS]; | 2118 | f = video->frames[prev_i / MAX_PACKETS]; |
2119 | prev = &(f->descriptor_pool[prev_i % MAX_PACKETS]); | 2119 | prev = &(f->descriptor_pool[prev_i % MAX_PACKETS]); |
2120 | if (prev_i % (MAX_PACKETS/2)) { | 2120 | if (prev_i % (MAX_PACKETS/2)) { |
2121 | prev->u.in.il.q[0] &= ~(3 << 20); /* no interrupt */ | 2121 | prev->u.in.il.q[0] &= ~cpu_to_le32(3 << 20); /* no interrupt */ |
2122 | } else { | 2122 | } else { |
2123 | prev->u.in.il.q[0] |= 3 << 20; /* enable interrupt */ | 2123 | prev->u.in.il.q[0] |= cpu_to_le32(3 << 20); /* enable interrupt */ |
2124 | } | 2124 | } |
2125 | prev->u.in.il.q[2] = cpu_to_le32(next_dma | 1); /* set Z=1 */ | 2125 | prev->u.in.il.q[2] = cpu_to_le32(next_dma | 1); /* set Z=1 */ |
2126 | wmb(); | 2126 | wmb(); |
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 20128692b339..a074bfd5f825 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -92,7 +92,7 @@ struct partial_datagram { | |||
92 | struct list_head list; | 92 | struct list_head list; |
93 | u16 dgl; | 93 | u16 dgl; |
94 | u16 dg_size; | 94 | u16 dg_size; |
95 | u16 ether_type; | 95 | __be16 ether_type; |
96 | struct sk_buff *skb; | 96 | struct sk_buff *skb; |
97 | char *pbuf; | 97 | char *pbuf; |
98 | struct list_head frag_info; | 98 | struct list_head frag_info; |
@@ -181,7 +181,7 @@ static void ether1394_remove_host(struct hpsb_host *host); | |||
181 | static void ether1394_host_reset(struct hpsb_host *host); | 181 | static void ether1394_host_reset(struct hpsb_host *host); |
182 | 182 | ||
183 | /* Function for incoming 1394 packets */ | 183 | /* Function for incoming 1394 packets */ |
184 | static struct hpsb_address_ops addr_ops = { | 184 | const static struct hpsb_address_ops addr_ops = { |
185 | .write = ether1394_write, | 185 | .write = ether1394_write, |
186 | }; | 186 | }; |
187 | 187 | ||
@@ -767,7 +767,7 @@ static int ether1394_header_parse(const struct sk_buff *skb, | |||
767 | static int ether1394_header_cache(const struct neighbour *neigh, | 767 | static int ether1394_header_cache(const struct neighbour *neigh, |
768 | struct hh_cache *hh) | 768 | struct hh_cache *hh) |
769 | { | 769 | { |
770 | unsigned short type = hh->hh_type; | 770 | __be16 type = hh->hh_type; |
771 | struct net_device *dev = neigh->dev; | 771 | struct net_device *dev = neigh->dev; |
772 | struct eth1394hdr *eth = | 772 | struct eth1394hdr *eth = |
773 | (struct eth1394hdr *)((u8 *)hh->hh_data + 16 - ETH1394_HLEN); | 773 | (struct eth1394hdr *)((u8 *)hh->hh_data + 16 - ETH1394_HLEN); |
@@ -795,7 +795,7 @@ static void ether1394_header_cache_update(struct hh_cache *hh, | |||
795 | ******************************************/ | 795 | ******************************************/ |
796 | 796 | ||
797 | /* Copied from net/ethernet/eth.c */ | 797 | /* Copied from net/ethernet/eth.c */ |
798 | static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev) | 798 | static __be16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev) |
799 | { | 799 | { |
800 | struct eth1394hdr *eth; | 800 | struct eth1394hdr *eth; |
801 | unsigned char *rawp; | 801 | unsigned char *rawp; |
@@ -829,17 +829,17 @@ static u16 ether1394_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
829 | 829 | ||
830 | /* Parse an encapsulated IP1394 header into an ethernet frame packet. | 830 | /* Parse an encapsulated IP1394 header into an ethernet frame packet. |
831 | * We also perform ARP translation here, if need be. */ | 831 | * We also perform ARP translation here, if need be. */ |
832 | static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, | 832 | static __be16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, |
833 | nodeid_t srcid, nodeid_t destid, | 833 | nodeid_t srcid, nodeid_t destid, |
834 | u16 ether_type) | 834 | __be16 ether_type) |
835 | { | 835 | { |
836 | struct eth1394_priv *priv = netdev_priv(dev); | 836 | struct eth1394_priv *priv = netdev_priv(dev); |
837 | u64 dest_hw; | 837 | __be64 dest_hw; |
838 | unsigned short ret = 0; | 838 | __be16 ret = 0; |
839 | 839 | ||
840 | /* Setup our hw addresses. We use these to build the ethernet header. */ | 840 | /* Setup our hw addresses. We use these to build the ethernet header. */ |
841 | if (destid == (LOCAL_BUS | ALL_NODES)) | 841 | if (destid == (LOCAL_BUS | ALL_NODES)) |
842 | dest_hw = ~0ULL; /* broadcast */ | 842 | dest_hw = ~cpu_to_be64(0); /* broadcast */ |
843 | else | 843 | else |
844 | dest_hw = cpu_to_be64((u64)priv->host->csr.guid_hi << 32 | | 844 | dest_hw = cpu_to_be64((u64)priv->host->csr.guid_hi << 32 | |
845 | priv->host->csr.guid_lo); | 845 | priv->host->csr.guid_lo); |
@@ -873,7 +873,7 @@ static u16 ether1394_parse_encap(struct sk_buff *skb, struct net_device *dev, | |||
873 | node = eth1394_find_node_guid(&priv->ip_node_list, | 873 | node = eth1394_find_node_guid(&priv->ip_node_list, |
874 | be64_to_cpu(guid)); | 874 | be64_to_cpu(guid)); |
875 | if (!node) | 875 | if (!node) |
876 | return 0; | 876 | return cpu_to_be16(0); |
877 | 877 | ||
878 | node_info = | 878 | node_info = |
879 | (struct eth1394_node_info *)node->ud->device.driver_data; | 879 | (struct eth1394_node_info *)node->ud->device.driver_data; |
@@ -1063,7 +1063,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, | |||
1063 | unsigned long flags; | 1063 | unsigned long flags; |
1064 | struct eth1394_priv *priv = netdev_priv(dev); | 1064 | struct eth1394_priv *priv = netdev_priv(dev); |
1065 | union eth1394_hdr *hdr = (union eth1394_hdr *)buf; | 1065 | union eth1394_hdr *hdr = (union eth1394_hdr *)buf; |
1066 | u16 ether_type = 0; /* initialized to clear warning */ | 1066 | __be16 ether_type = cpu_to_be16(0); /* initialized to clear warning */ |
1067 | int hdr_len; | 1067 | int hdr_len; |
1068 | struct unit_directory *ud = priv->ud_list[NODEID_TO_NODE(srcid)]; | 1068 | struct unit_directory *ud = priv->ud_list[NODEID_TO_NODE(srcid)]; |
1069 | struct eth1394_node_info *node_info; | 1069 | struct eth1394_node_info *node_info; |
@@ -1259,7 +1259,7 @@ static int ether1394_write(struct hpsb_host *host, int srcid, int destid, | |||
1259 | 1259 | ||
1260 | static void ether1394_iso(struct hpsb_iso *iso) | 1260 | static void ether1394_iso(struct hpsb_iso *iso) |
1261 | { | 1261 | { |
1262 | quadlet_t *data; | 1262 | __be32 *data; |
1263 | char *buf; | 1263 | char *buf; |
1264 | struct eth1394_host_info *hi; | 1264 | struct eth1394_host_info *hi; |
1265 | struct net_device *dev; | 1265 | struct net_device *dev; |
@@ -1283,7 +1283,7 @@ static void ether1394_iso(struct hpsb_iso *iso) | |||
1283 | for (i = 0; i < nready; i++) { | 1283 | for (i = 0; i < nready; i++) { |
1284 | struct hpsb_iso_packet_info *info = | 1284 | struct hpsb_iso_packet_info *info = |
1285 | &iso->infos[(iso->first_packet + i) % iso->buf_packets]; | 1285 | &iso->infos[(iso->first_packet + i) % iso->buf_packets]; |
1286 | data = (quadlet_t *)(iso->data_buf.kvirt + info->offset); | 1286 | data = (__be32 *)(iso->data_buf.kvirt + info->offset); |
1287 | 1287 | ||
1288 | /* skip over GASP header */ | 1288 | /* skip over GASP header */ |
1289 | buf = (char *)data + 8; | 1289 | buf = (char *)data + 8; |
@@ -1614,7 +1614,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev) | |||
1614 | if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF]) | 1614 | if (max_payload < dg_size + hdr_type_len[ETH1394_HDR_LF_UF]) |
1615 | priv->bc_dgl++; | 1615 | priv->bc_dgl++; |
1616 | } else { | 1616 | } else { |
1617 | __be64 guid = get_unaligned((u64 *)hdr_buf.h_dest); | 1617 | __be64 guid = get_unaligned((__be64 *)hdr_buf.h_dest); |
1618 | 1618 | ||
1619 | node = eth1394_find_node_guid(&priv->ip_node_list, | 1619 | node = eth1394_find_node_guid(&priv->ip_node_list, |
1620 | be64_to_cpu(guid)); | 1620 | be64_to_cpu(guid)); |
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h index 4f3e2dd46f00..e1b5ea80f623 100644 --- a/drivers/ieee1394/eth1394.h +++ b/drivers/ieee1394/eth1394.h | |||
@@ -82,7 +82,7 @@ struct eth1394_priv { | |||
82 | 82 | ||
83 | struct eth1394hdr { | 83 | struct eth1394hdr { |
84 | unsigned char h_dest[ETH1394_ALEN]; /* destination eth1394 addr */ | 84 | unsigned char h_dest[ETH1394_ALEN]; /* destination eth1394 addr */ |
85 | unsigned short h_proto; /* packet type ID field */ | 85 | __be16 h_proto; /* packet type ID field */ |
86 | } __attribute__((packed)); | 86 | } __attribute__((packed)); |
87 | 87 | ||
88 | static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb) | 88 | static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb) |
@@ -99,13 +99,13 @@ typedef enum {ETH1394_GASP, ETH1394_WRREQ} eth1394_tx_type; | |||
99 | struct eth1394_uf_hdr { | 99 | struct eth1394_uf_hdr { |
100 | u16 lf:2; | 100 | u16 lf:2; |
101 | u16 res:14; | 101 | u16 res:14; |
102 | u16 ether_type; /* Ethernet packet type */ | 102 | __be16 ether_type; /* Ethernet packet type */ |
103 | } __attribute__((packed)); | 103 | } __attribute__((packed)); |
104 | #elif defined __LITTLE_ENDIAN_BITFIELD | 104 | #elif defined __LITTLE_ENDIAN_BITFIELD |
105 | struct eth1394_uf_hdr { | 105 | struct eth1394_uf_hdr { |
106 | u16 res:14; | 106 | u16 res:14; |
107 | u16 lf:2; | 107 | u16 lf:2; |
108 | u16 ether_type; | 108 | __be16 ether_type; |
109 | } __attribute__((packed)); | 109 | } __attribute__((packed)); |
110 | #else | 110 | #else |
111 | #error Unknown bit field type | 111 | #error Unknown bit field type |
@@ -117,7 +117,7 @@ struct eth1394_ff_hdr { | |||
117 | u16 lf:2; | 117 | u16 lf:2; |
118 | u16 res1:2; | 118 | u16 res1:2; |
119 | u16 dg_size:12; /* Datagram size */ | 119 | u16 dg_size:12; /* Datagram size */ |
120 | u16 ether_type; /* Ethernet packet type */ | 120 | __be16 ether_type; /* Ethernet packet type */ |
121 | u16 dgl; /* Datagram label */ | 121 | u16 dgl; /* Datagram label */ |
122 | u16 res2; | 122 | u16 res2; |
123 | } __attribute__((packed)); | 123 | } __attribute__((packed)); |
@@ -126,7 +126,7 @@ struct eth1394_ff_hdr { | |||
126 | u16 dg_size:12; | 126 | u16 dg_size:12; |
127 | u16 res1:2; | 127 | u16 res1:2; |
128 | u16 lf:2; | 128 | u16 lf:2; |
129 | u16 ether_type; | 129 | __be16 ether_type; |
130 | u16 dgl; | 130 | u16 dgl; |
131 | u16 res2; | 131 | u16 res2; |
132 | } __attribute__((packed)); | 132 | } __attribute__((packed)); |
@@ -207,11 +207,11 @@ struct eth1394_arp { | |||
207 | u16 opcode; /* ARP Opcode */ | 207 | u16 opcode; /* ARP Opcode */ |
208 | /* Above is exactly the same format as struct arphdr */ | 208 | /* Above is exactly the same format as struct arphdr */ |
209 | 209 | ||
210 | u64 s_uniq_id; /* Sender's 64bit EUI */ | 210 | __be64 s_uniq_id; /* Sender's 64bit EUI */ |
211 | u8 max_rec; /* Sender's max packet size */ | 211 | u8 max_rec; /* Sender's max packet size */ |
212 | u8 sspd; /* Sender's max speed */ | 212 | u8 sspd; /* Sender's max speed */ |
213 | u16 fifo_hi; /* hi 16bits of sender's FIFO addr */ | 213 | __be16 fifo_hi; /* hi 16bits of sender's FIFO addr */ |
214 | u32 fifo_lo; /* lo 32bits of sender's FIFO addr */ | 214 | __be32 fifo_lo; /* lo 32bits of sender's FIFO addr */ |
215 | u32 sip; /* Sender's IP Address */ | 215 | u32 sip; /* Sender's IP Address */ |
216 | u32 tip; /* IP Address of requested hw addr */ | 216 | u32 tip; /* IP Address of requested hw addr */ |
217 | }; | 217 | }; |
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c index 272543a42a43..600e391c8fe7 100644 --- a/drivers/ieee1394/highlevel.c +++ b/drivers/ieee1394/highlevel.c | |||
@@ -320,7 +320,7 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl) | |||
320 | */ | 320 | */ |
321 | u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, | 321 | u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, |
322 | struct hpsb_host *host, | 322 | struct hpsb_host *host, |
323 | struct hpsb_address_ops *ops, | 323 | const struct hpsb_address_ops *ops, |
324 | u64 size, u64 alignment, | 324 | u64 size, u64 alignment, |
325 | u64 start, u64 end) | 325 | u64 start, u64 end) |
326 | { | 326 | { |
@@ -407,7 +407,8 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, | |||
407 | * are automatically deallocated together with the hpsb_highlevel @hl. | 407 | * are automatically deallocated together with the hpsb_highlevel @hl. |
408 | */ | 408 | */ |
409 | int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | 409 | int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, |
410 | struct hpsb_address_ops *ops, u64 start, u64 end) | 410 | const struct hpsb_address_ops *ops, |
411 | u64 start, u64 end) | ||
411 | { | 412 | { |
412 | struct hpsb_address_serve *as; | 413 | struct hpsb_address_serve *as; |
413 | struct list_head *lh; | 414 | struct list_head *lh; |
@@ -420,7 +421,7 @@ int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | |||
420 | return 0; | 421 | return 0; |
421 | } | 422 | } |
422 | 423 | ||
423 | as = kmalloc(sizeof(*as), GFP_ATOMIC); | 424 | as = kmalloc(sizeof(*as), GFP_KERNEL); |
424 | if (!as) | 425 | if (!as) |
425 | return 0; | 426 | return 0; |
426 | 427 | ||
@@ -477,7 +478,7 @@ int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | |||
477 | return retval; | 478 | return retval; |
478 | } | 479 | } |
479 | 480 | ||
480 | static struct hpsb_address_ops dummy_ops; | 481 | const static struct hpsb_address_ops dummy_ops; |
481 | 482 | ||
482 | /* dummy address spaces as lower and upper bounds of the host's a.s. list */ | 483 | /* dummy address spaces as lower and upper bounds of the host's a.s. list */ |
483 | static void init_hpsb_highlevel(struct hpsb_host *host) | 484 | static void init_hpsb_highlevel(struct hpsb_host *host) |
diff --git a/drivers/ieee1394/highlevel.h b/drivers/ieee1394/highlevel.h index bc5d0854c17e..9dba89fc60ad 100644 --- a/drivers/ieee1394/highlevel.h +++ b/drivers/ieee1394/highlevel.h | |||
@@ -15,7 +15,7 @@ struct hpsb_host; | |||
15 | struct hpsb_address_serve { | 15 | struct hpsb_address_serve { |
16 | struct list_head host_list; /* per host list */ | 16 | struct list_head host_list; /* per host list */ |
17 | struct list_head hl_list; /* hpsb_highlevel list */ | 17 | struct list_head hl_list; /* hpsb_highlevel list */ |
18 | struct hpsb_address_ops *op; | 18 | const struct hpsb_address_ops *op; |
19 | struct hpsb_host *host; | 19 | struct hpsb_host *host; |
20 | u64 start; /* first address handled, quadlet aligned */ | 20 | u64 start; /* first address handled, quadlet aligned */ |
21 | u64 end; /* first address behind, quadlet aligned */ | 21 | u64 end; /* first address behind, quadlet aligned */ |
@@ -119,11 +119,12 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl); | |||
119 | 119 | ||
120 | u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, | 120 | u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl, |
121 | struct hpsb_host *host, | 121 | struct hpsb_host *host, |
122 | struct hpsb_address_ops *ops, | 122 | const struct hpsb_address_ops *ops, |
123 | u64 size, u64 alignment, | 123 | u64 size, u64 alignment, |
124 | u64 start, u64 end); | 124 | u64 start, u64 end); |
125 | int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | 125 | int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, |
126 | struct hpsb_address_ops *ops, u64 start, u64 end); | 126 | const struct hpsb_address_ops *ops, |
127 | u64 start, u64 end); | ||
127 | int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, | 128 | int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, |
128 | u64 start); | 129 | u64 start); |
129 | 130 | ||
diff --git a/drivers/ieee1394/hosts.c b/drivers/ieee1394/hosts.c index 237d0c9d69c6..e947d8ffac85 100644 --- a/drivers/ieee1394/hosts.c +++ b/drivers/ieee1394/hosts.c | |||
@@ -34,18 +34,18 @@ static void delayed_reset_bus(struct work_struct *work) | |||
34 | { | 34 | { |
35 | struct hpsb_host *host = | 35 | struct hpsb_host *host = |
36 | container_of(work, struct hpsb_host, delayed_reset.work); | 36 | container_of(work, struct hpsb_host, delayed_reset.work); |
37 | int generation = host->csr.generation + 1; | 37 | u8 generation = host->csr.generation + 1; |
38 | 38 | ||
39 | /* The generation field rolls over to 2 rather than 0 per IEEE | 39 | /* The generation field rolls over to 2 rather than 0 per IEEE |
40 | * 1394a-2000. */ | 40 | * 1394a-2000. */ |
41 | if (generation > 0xf || generation < 2) | 41 | if (generation > 0xf || generation < 2) |
42 | generation = 2; | 42 | generation = 2; |
43 | 43 | ||
44 | CSR_SET_BUS_INFO_GENERATION(host->csr.rom, generation); | 44 | csr_set_bus_info_generation(host->csr.rom, generation); |
45 | if (csr1212_generate_csr_image(host->csr.rom) != CSR1212_SUCCESS) { | 45 | if (csr1212_generate_csr_image(host->csr.rom) != CSR1212_SUCCESS) { |
46 | /* CSR image creation failed. | 46 | /* CSR image creation failed. |
47 | * Reset generation field and do not issue a bus reset. */ | 47 | * Reset generation field and do not issue a bus reset. */ |
48 | CSR_SET_BUS_INFO_GENERATION(host->csr.rom, | 48 | csr_set_bus_info_generation(host->csr.rom, |
49 | host->csr.generation); | 49 | host->csr.generation); |
50 | return; | 50 | return; |
51 | } | 51 | } |
diff --git a/drivers/ieee1394/hosts.h b/drivers/ieee1394/hosts.h index dd229950acca..49c359022c54 100644 --- a/drivers/ieee1394/hosts.h +++ b/drivers/ieee1394/hosts.h | |||
@@ -154,7 +154,7 @@ struct hpsb_host_driver { | |||
154 | * to set the hardware ConfigROM if the hardware supports handling | 154 | * to set the hardware ConfigROM if the hardware supports handling |
155 | * reads to the ConfigROM on its own. */ | 155 | * reads to the ConfigROM on its own. */ |
156 | void (*set_hw_config_rom)(struct hpsb_host *host, | 156 | void (*set_hw_config_rom)(struct hpsb_host *host, |
157 | quadlet_t *config_rom); | 157 | __be32 *config_rom); |
158 | 158 | ||
159 | /* This function shall implement packet transmission based on | 159 | /* This function shall implement packet transmission based on |
160 | * packet->type. It shall CRC both parts of the packet (unless | 160 | * packet->type. It shall CRC both parts of the packet (unless |
diff --git a/drivers/ieee1394/ieee1394.h b/drivers/ieee1394/ieee1394.h index 40492074c013..e0ae0d3d747f 100644 --- a/drivers/ieee1394/ieee1394.h +++ b/drivers/ieee1394/ieee1394.h | |||
@@ -121,6 +121,9 @@ extern const char *hpsb_speedto_str[]; | |||
121 | 121 | ||
122 | #include <asm/byteorder.h> | 122 | #include <asm/byteorder.h> |
123 | 123 | ||
124 | /* '1' '3' '9' '4' in ASCII */ | ||
125 | #define IEEE1394_BUSID_MAGIC cpu_to_be32(0x31333934) | ||
126 | |||
124 | #ifdef __BIG_ENDIAN_BITFIELD | 127 | #ifdef __BIG_ENDIAN_BITFIELD |
125 | 128 | ||
126 | struct selfid { | 129 | struct selfid { |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 79ef5fd928ae..906c5a98d814 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -67,7 +67,7 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr, | |||
67 | for (i = IEEE1394_SPEED_100; i <= old_speed; i++) { | 67 | for (i = IEEE1394_SPEED_100; i <= old_speed; i++) { |
68 | *speed = i; | 68 | *speed = i; |
69 | error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, | 69 | error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, |
70 | &q, sizeof(quadlet_t)); | 70 | &q, 4); |
71 | if (error) | 71 | if (error) |
72 | break; | 72 | break; |
73 | *buffer = q; | 73 | *buffer = q; |
@@ -85,7 +85,7 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr, | |||
85 | return error; | 85 | return error; |
86 | } | 86 | } |
87 | 87 | ||
88 | static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, | 88 | static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, |
89 | void *buffer, void *__ci) | 89 | void *buffer, void *__ci) |
90 | { | 90 | { |
91 | struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci; | 91 | struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci; |
@@ -93,7 +93,7 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, | |||
93 | 93 | ||
94 | for (i = 1; ; i++) { | 94 | for (i = 1; ; i++) { |
95 | error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, | 95 | error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr, |
96 | buffer, length); | 96 | buffer, 4); |
97 | if (!error) { | 97 | if (!error) { |
98 | ci->speed_unverified = 0; | 98 | ci->speed_unverified = 0; |
99 | break; | 99 | break; |
@@ -104,7 +104,7 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, | |||
104 | 104 | ||
105 | /* The ieee1394_core guessed the node's speed capability from | 105 | /* The ieee1394_core guessed the node's speed capability from |
106 | * the self ID. Check whether a lower speed works. */ | 106 | * the self ID. Check whether a lower speed works. */ |
107 | if (ci->speed_unverified && length == sizeof(quadlet_t)) { | 107 | if (ci->speed_unverified) { |
108 | error = nodemgr_check_speed(ci, addr, buffer); | 108 | error = nodemgr_check_speed(ci, addr, buffer); |
109 | if (!error) | 109 | if (!error) |
110 | break; | 110 | break; |
@@ -115,20 +115,8 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length, | |||
115 | return error; | 115 | return error; |
116 | } | 116 | } |
117 | 117 | ||
118 | #define OUI_FREECOM_TECHNOLOGIES_GMBH 0x0001db | ||
119 | |||
120 | static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci) | ||
121 | { | ||
122 | /* Freecom FireWire Hard Drive firmware bug */ | ||
123 | if (be32_to_cpu(bus_info_data[3]) >> 8 == OUI_FREECOM_TECHNOLOGIES_GMBH) | ||
124 | return 0; | ||
125 | |||
126 | return (be32_to_cpu(bus_info_data[2]) >> 8) & 0x3; | ||
127 | } | ||
128 | |||
129 | static struct csr1212_bus_ops nodemgr_csr_ops = { | 118 | static struct csr1212_bus_ops nodemgr_csr_ops = { |
130 | .bus_read = nodemgr_bus_read, | 119 | .bus_read = nodemgr_bus_read, |
131 | .get_max_rom = nodemgr_get_max_rom | ||
132 | }; | 120 | }; |
133 | 121 | ||
134 | 122 | ||
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h index 4f287a3561ba..15ea09733e84 100644 --- a/drivers/ieee1394/nodemgr.h +++ b/drivers/ieee1394/nodemgr.h | |||
@@ -31,9 +31,6 @@ struct csr1212_keyval; | |||
31 | struct hpsb_host; | 31 | struct hpsb_host; |
32 | struct ieee1394_device_id; | 32 | struct ieee1394_device_id; |
33 | 33 | ||
34 | /* '1' '3' '9' '4' in ASCII */ | ||
35 | #define IEEE1394_BUSID_MAGIC __constant_cpu_to_be32(0x31333934) | ||
36 | |||
37 | /* This is the start of a Node entry structure. It should be a stable API | 34 | /* This is the start of a Node entry structure. It should be a stable API |
38 | * for which to gather info from the Node Manager about devices attached | 35 | * for which to gather info from the Node Manager about devices attached |
39 | * to the bus. */ | 36 | * to the bus. */ |
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index e509e13cb7a7..65c1429e4129 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -2973,7 +2973,7 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d, | |||
2973 | return 0; | 2973 | return 0; |
2974 | } | 2974 | } |
2975 | 2975 | ||
2976 | static void ohci_set_hw_config_rom(struct hpsb_host *host, quadlet_t *config_rom) | 2976 | static void ohci_set_hw_config_rom(struct hpsb_host *host, __be32 *config_rom) |
2977 | { | 2977 | { |
2978 | struct ti_ohci *ohci = host->hostdata; | 2978 | struct ti_ohci *ohci = host->hostdata; |
2979 | 2979 | ||
@@ -3199,15 +3199,16 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev, | |||
3199 | /* Now enable LPS, which we need in order to start accessing | 3199 | /* Now enable LPS, which we need in order to start accessing |
3200 | * most of the registers. In fact, on some cards (ALI M5251), | 3200 | * most of the registers. In fact, on some cards (ALI M5251), |
3201 | * accessing registers in the SClk domain without LPS enabled | 3201 | * accessing registers in the SClk domain without LPS enabled |
3202 | * will lock up the machine. Wait 50msec to make sure we have | 3202 | * will lock up the machine. */ |
3203 | * full link enabled. */ | ||
3204 | reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); | 3203 | reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); |
3205 | 3204 | ||
3206 | /* Disable and clear interrupts */ | 3205 | /* Disable and clear interrupts */ |
3207 | reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); | 3206 | reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); |
3208 | reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); | 3207 | reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); |
3209 | 3208 | ||
3210 | mdelay(50); | 3209 | /* Flush MMIO writes and wait to make sure we have full link enabled. */ |
3210 | reg_read(ohci, OHCI1394_Version); | ||
3211 | msleep(50); | ||
3211 | 3212 | ||
3212 | /* Determine the number of available IR and IT contexts. */ | 3213 | /* Determine the number of available IR and IT contexts. */ |
3213 | ohci->nb_iso_rcv_ctx = | 3214 | ohci->nb_iso_rcv_ctx = |
@@ -3233,8 +3234,9 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev, | |||
3233 | * we need to get to that "no event", so enough should be initialized | 3234 | * we need to get to that "no event", so enough should be initialized |
3234 | * by that point. | 3235 | * by that point. |
3235 | */ | 3236 | */ |
3236 | if (request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED, | 3237 | err = request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED, |
3237 | OHCI1394_DRIVER_NAME, ohci)) { | 3238 | OHCI1394_DRIVER_NAME, ohci); |
3239 | if (err) { | ||
3238 | PRINT_G(KERN_ERR, "Failed to allocate interrupt %d", dev->irq); | 3240 | PRINT_G(KERN_ERR, "Failed to allocate interrupt %d", dev->irq); |
3239 | goto err; | 3241 | goto err; |
3240 | } | 3242 | } |
@@ -3381,6 +3383,7 @@ static int ohci1394_pci_suspend(struct pci_dev *dev, pm_message_t state) | |||
3381 | ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT); | 3383 | ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT); |
3382 | ohci_soft_reset(ohci); | 3384 | ohci_soft_reset(ohci); |
3383 | 3385 | ||
3386 | free_irq(dev->irq, ohci); | ||
3384 | err = pci_save_state(dev); | 3387 | err = pci_save_state(dev); |
3385 | if (err) { | 3388 | if (err) { |
3386 | PRINT(KERN_ERR, "pci_save_state failed with %d", err); | 3389 | PRINT(KERN_ERR, "pci_save_state failed with %d", err); |
@@ -3420,7 +3423,16 @@ static int ohci1394_pci_resume(struct pci_dev *dev) | |||
3420 | reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); | 3423 | reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); |
3421 | reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); | 3424 | reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); |
3422 | reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); | 3425 | reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); |
3423 | mdelay(50); | 3426 | reg_read(ohci, OHCI1394_Version); |
3427 | msleep(50); | ||
3428 | |||
3429 | err = request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED, | ||
3430 | OHCI1394_DRIVER_NAME, ohci); | ||
3431 | if (err) { | ||
3432 | PRINT_G(KERN_ERR, "Failed to allocate interrupt %d", dev->irq); | ||
3433 | return err; | ||
3434 | } | ||
3435 | |||
3424 | ohci_initialize(ohci); | 3436 | ohci_initialize(ohci); |
3425 | 3437 | ||
3426 | hpsb_resume_host(ohci->host); | 3438 | hpsb_resume_host(ohci->host); |
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index 7aee1ac97c80..dc15cadb06ef 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c | |||
@@ -1463,7 +1463,7 @@ static int __devinit add_card(struct pci_dev *dev, | |||
1463 | 1463 | ||
1464 | /* info_length, crc_length and 1394 magic number to check, if it is really a bus info block */ | 1464 | /* info_length, crc_length and 1394 magic number to check, if it is really a bus info block */ |
1465 | if (((be32_to_cpu(lynx->bus_info_block[0]) & 0xffff0000) == 0x04040000) && | 1465 | if (((be32_to_cpu(lynx->bus_info_block[0]) & 0xffff0000) == 0x04040000) && |
1466 | (lynx->bus_info_block[1] == __constant_cpu_to_be32(0x31333934))) | 1466 | (lynx->bus_info_block[1] == IEEE1394_BUSID_MAGIC)) |
1467 | { | 1467 | { |
1468 | PRINT(KERN_DEBUG, lynx->id, "read a valid bus info block from"); | 1468 | PRINT(KERN_DEBUG, lynx->id, "read a valid bus info block from"); |
1469 | } else { | 1469 | } else { |
diff --git a/drivers/ieee1394/pcilynx.h b/drivers/ieee1394/pcilynx.h index ec27321f6724..693a169acea3 100644 --- a/drivers/ieee1394/pcilynx.h +++ b/drivers/ieee1394/pcilynx.h | |||
@@ -52,7 +52,7 @@ struct ti_lynx { | |||
52 | void __iomem *local_rom; | 52 | void __iomem *local_rom; |
53 | void __iomem *local_ram; | 53 | void __iomem *local_ram; |
54 | void __iomem *aux_port; | 54 | void __iomem *aux_port; |
55 | quadlet_t bus_info_block[5]; | 55 | __be32 bus_info_block[5]; |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * use local RAM of LOCALRAM_SIZE bytes for PCLs, which allows for | 58 | * use local RAM of LOCALRAM_SIZE bytes for PCLs, which allows for |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index bf7e761c12b1..bad66c65b0d6 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -90,7 +90,7 @@ static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store, | |||
90 | static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, | 90 | static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store, |
91 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, | 91 | u64 addr, octlet_t data, octlet_t arg, int ext_tcode, |
92 | u16 flags); | 92 | u16 flags); |
93 | static struct hpsb_address_ops arm_ops = { | 93 | const static struct hpsb_address_ops arm_ops = { |
94 | .read = arm_read, | 94 | .read = arm_read, |
95 | .write = arm_write, | 95 | .write = arm_write, |
96 | .lock = arm_lock, | 96 | .lock = arm_lock, |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index a373c18cf7b8..ab1034ccb7fb 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -265,7 +265,7 @@ static struct hpsb_highlevel sbp2_highlevel = { | |||
265 | .host_reset = sbp2_host_reset, | 265 | .host_reset = sbp2_host_reset, |
266 | }; | 266 | }; |
267 | 267 | ||
268 | static struct hpsb_address_ops sbp2_ops = { | 268 | const static struct hpsb_address_ops sbp2_ops = { |
269 | .write = sbp2_handle_status_write | 269 | .write = sbp2_handle_status_write |
270 | }; | 270 | }; |
271 | 271 | ||
@@ -275,7 +275,7 @@ static int sbp2_handle_physdma_write(struct hpsb_host *, int, int, quadlet_t *, | |||
275 | static int sbp2_handle_physdma_read(struct hpsb_host *, int, quadlet_t *, u64, | 275 | static int sbp2_handle_physdma_read(struct hpsb_host *, int, quadlet_t *, u64, |
276 | size_t, u16); | 276 | size_t, u16); |
277 | 277 | ||
278 | static struct hpsb_address_ops sbp2_physdma_ops = { | 278 | const static struct hpsb_address_ops sbp2_physdma_ops = { |
279 | .read = sbp2_handle_physdma_read, | 279 | .read = sbp2_handle_physdma_read, |
280 | .write = sbp2_handle_physdma_write, | 280 | .write = sbp2_handle_physdma_write, |
281 | }; | 281 | }; |
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index a3c5af1d7ec0..de5263beab4a 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -367,7 +367,7 @@ int mlx4_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) | |||
367 | if (err) | 367 | if (err) |
368 | goto out; | 368 | goto out; |
369 | } else { | 369 | } else { |
370 | /* Can't be smaller then the number of outstanding CQEs */ | 370 | /* Can't be smaller than the number of outstanding CQEs */ |
371 | outst_cqe = mlx4_ib_get_outstanding_cqes(cq); | 371 | outst_cqe = mlx4_ib_get_outstanding_cqes(cq); |
372 | if (entries < outst_cqe + 1) { | 372 | if (entries < outst_cqe + 1) { |
373 | err = 0; | 373 | err = 0; |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index f6e9f39a527b..c3c8b9bc40ae 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -65,7 +65,7 @@ MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and | |||
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Scancode to keycode tables. These are just the default setting, and | 67 | * Scancode to keycode tables. These are just the default setting, and |
68 | * are loadable via an userland utility. | 68 | * are loadable via a userland utility. |
69 | */ | 69 | */ |
70 | 70 | ||
71 | static const unsigned short atkbd_set2_keycode[512] = { | 71 | static const unsigned short atkbd_set2_keycode[512] = { |
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index d82f7f727f7a..71b82434264d 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c | |||
@@ -57,7 +57,7 @@ static enum apanel_chip device_chip[APANEL_DEV_MAX]; | |||
57 | 57 | ||
58 | struct apanel { | 58 | struct apanel { |
59 | struct input_polled_dev *ipdev; | 59 | struct input_polled_dev *ipdev; |
60 | struct i2c_client client; | 60 | struct i2c_client *client; |
61 | unsigned short keymap[MAX_PANEL_KEYS]; | 61 | unsigned short keymap[MAX_PANEL_KEYS]; |
62 | u16 nkeys; | 62 | u16 nkeys; |
63 | u16 led_bits; | 63 | u16 led_bits; |
@@ -66,16 +66,7 @@ struct apanel { | |||
66 | }; | 66 | }; |
67 | 67 | ||
68 | 68 | ||
69 | static int apanel_probe(struct i2c_adapter *, int, int); | 69 | static int apanel_probe(struct i2c_client *, const struct i2c_device_id *); |
70 | |||
71 | /* for now, we only support one address */ | ||
72 | static unsigned short normal_i2c[] = {0, I2C_CLIENT_END}; | ||
73 | static unsigned short ignore = I2C_CLIENT_END; | ||
74 | static struct i2c_client_address_data addr_data = { | ||
75 | .normal_i2c = normal_i2c, | ||
76 | .probe = &ignore, | ||
77 | .ignore = &ignore, | ||
78 | }; | ||
79 | 70 | ||
80 | static void report_key(struct input_dev *input, unsigned keycode) | 71 | static void report_key(struct input_dev *input, unsigned keycode) |
81 | { | 72 | { |
@@ -103,12 +94,12 @@ static void apanel_poll(struct input_polled_dev *ipdev) | |||
103 | s32 data; | 94 | s32 data; |
104 | int i; | 95 | int i; |
105 | 96 | ||
106 | data = i2c_smbus_read_word_data(&ap->client, cmd); | 97 | data = i2c_smbus_read_word_data(ap->client, cmd); |
107 | if (data < 0) | 98 | if (data < 0) |
108 | return; /* ignore errors (due to ACPI??) */ | 99 | return; /* ignore errors (due to ACPI??) */ |
109 | 100 | ||
110 | /* write back to clear latch */ | 101 | /* write back to clear latch */ |
111 | i2c_smbus_write_word_data(&ap->client, cmd, 0); | 102 | i2c_smbus_write_word_data(ap->client, cmd, 0); |
112 | 103 | ||
113 | if (!data) | 104 | if (!data) |
114 | return; | 105 | return; |
@@ -124,7 +115,7 @@ static void led_update(struct work_struct *work) | |||
124 | { | 115 | { |
125 | struct apanel *ap = container_of(work, struct apanel, led_work); | 116 | struct apanel *ap = container_of(work, struct apanel, led_work); |
126 | 117 | ||
127 | i2c_smbus_write_word_data(&ap->client, 0x10, ap->led_bits); | 118 | i2c_smbus_write_word_data(ap->client, 0x10, ap->led_bits); |
128 | } | 119 | } |
129 | 120 | ||
130 | static void mail_led_set(struct led_classdev *led, | 121 | static void mail_led_set(struct led_classdev *led, |
@@ -140,7 +131,7 @@ static void mail_led_set(struct led_classdev *led, | |||
140 | schedule_work(&ap->led_work); | 131 | schedule_work(&ap->led_work); |
141 | } | 132 | } |
142 | 133 | ||
143 | static int apanel_detach_client(struct i2c_client *client) | 134 | static int apanel_remove(struct i2c_client *client) |
144 | { | 135 | { |
145 | struct apanel *ap = i2c_get_clientdata(client); | 136 | struct apanel *ap = i2c_get_clientdata(client); |
146 | 137 | ||
@@ -148,43 +139,33 @@ static int apanel_detach_client(struct i2c_client *client) | |||
148 | led_classdev_unregister(&ap->mail_led); | 139 | led_classdev_unregister(&ap->mail_led); |
149 | 140 | ||
150 | input_unregister_polled_device(ap->ipdev); | 141 | input_unregister_polled_device(ap->ipdev); |
151 | i2c_detach_client(&ap->client); | ||
152 | input_free_polled_device(ap->ipdev); | 142 | input_free_polled_device(ap->ipdev); |
153 | 143 | ||
154 | return 0; | 144 | return 0; |
155 | } | 145 | } |
156 | 146 | ||
157 | /* Function is invoked for every i2c adapter. */ | ||
158 | static int apanel_attach_adapter(struct i2c_adapter *adap) | ||
159 | { | ||
160 | dev_dbg(&adap->dev, APANEL ": attach adapter id=%d\n", adap->id); | ||
161 | |||
162 | /* Our device is connected only to i801 on laptop */ | ||
163 | if (adap->id != I2C_HW_SMBUS_I801) | ||
164 | return -ENODEV; | ||
165 | |||
166 | return i2c_probe(adap, &addr_data, apanel_probe); | ||
167 | } | ||
168 | |||
169 | static void apanel_shutdown(struct i2c_client *client) | 147 | static void apanel_shutdown(struct i2c_client *client) |
170 | { | 148 | { |
171 | apanel_detach_client(client); | 149 | apanel_remove(client); |
172 | } | 150 | } |
173 | 151 | ||
152 | static struct i2c_device_id apanel_id[] = { | ||
153 | { "fujitsu_apanel", 0 }, | ||
154 | { } | ||
155 | }; | ||
156 | MODULE_DEVICE_TABLE(i2c, apanel_id); | ||
157 | |||
174 | static struct i2c_driver apanel_driver = { | 158 | static struct i2c_driver apanel_driver = { |
175 | .driver = { | 159 | .driver = { |
176 | .name = APANEL, | 160 | .name = APANEL, |
177 | }, | 161 | }, |
178 | .attach_adapter = &apanel_attach_adapter, | 162 | .probe = &apanel_probe, |
179 | .detach_client = &apanel_detach_client, | 163 | .remove = &apanel_remove, |
180 | .shutdown = &apanel_shutdown, | 164 | .shutdown = &apanel_shutdown, |
165 | .id_table = apanel_id, | ||
181 | }; | 166 | }; |
182 | 167 | ||
183 | static struct apanel apanel = { | 168 | static struct apanel apanel = { |
184 | .client = { | ||
185 | .driver = &apanel_driver, | ||
186 | .name = APANEL, | ||
187 | }, | ||
188 | .keymap = { | 169 | .keymap = { |
189 | [0] = KEY_MAIL, | 170 | [0] = KEY_MAIL, |
190 | [1] = KEY_WWW, | 171 | [1] = KEY_WWW, |
@@ -204,7 +185,8 @@ static struct apanel apanel = { | |||
204 | }; | 185 | }; |
205 | 186 | ||
206 | /* NB: Only one panel on the i2c. */ | 187 | /* NB: Only one panel on the i2c. */ |
207 | static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | 188 | static int apanel_probe(struct i2c_client *client, |
189 | const struct i2c_device_id *id) | ||
208 | { | 190 | { |
209 | struct apanel *ap; | 191 | struct apanel *ap; |
210 | struct input_polled_dev *ipdev; | 192 | struct input_polled_dev *ipdev; |
@@ -212,9 +194,6 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
212 | u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; | 194 | u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8; |
213 | int i, err = -ENOMEM; | 195 | int i, err = -ENOMEM; |
214 | 196 | ||
215 | dev_dbg(&bus->dev, APANEL ": probe adapter %p addr %d kind %d\n", | ||
216 | bus, address, kind); | ||
217 | |||
218 | ap = &apanel; | 197 | ap = &apanel; |
219 | 198 | ||
220 | ipdev = input_allocate_polled_device(); | 199 | ipdev = input_allocate_polled_device(); |
@@ -222,18 +201,13 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
222 | goto out1; | 201 | goto out1; |
223 | 202 | ||
224 | ap->ipdev = ipdev; | 203 | ap->ipdev = ipdev; |
225 | ap->client.adapter = bus; | 204 | ap->client = client; |
226 | ap->client.addr = address; | ||
227 | |||
228 | i2c_set_clientdata(&ap->client, ap); | ||
229 | 205 | ||
230 | err = i2c_attach_client(&ap->client); | 206 | i2c_set_clientdata(client, ap); |
231 | if (err) | ||
232 | goto out2; | ||
233 | 207 | ||
234 | err = i2c_smbus_write_word_data(&ap->client, cmd, 0); | 208 | err = i2c_smbus_write_word_data(client, cmd, 0); |
235 | if (err) { | 209 | if (err) { |
236 | dev_warn(&ap->client.dev, APANEL ": smbus write error %d\n", | 210 | dev_warn(&client->dev, APANEL ": smbus write error %d\n", |
237 | err); | 211 | err); |
238 | goto out3; | 212 | goto out3; |
239 | } | 213 | } |
@@ -246,7 +220,7 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
246 | idev->name = APANEL_NAME " buttons"; | 220 | idev->name = APANEL_NAME " buttons"; |
247 | idev->phys = "apanel/input0"; | 221 | idev->phys = "apanel/input0"; |
248 | idev->id.bustype = BUS_HOST; | 222 | idev->id.bustype = BUS_HOST; |
249 | idev->dev.parent = &ap->client.dev; | 223 | idev->dev.parent = &client->dev; |
250 | 224 | ||
251 | set_bit(EV_KEY, idev->evbit); | 225 | set_bit(EV_KEY, idev->evbit); |
252 | 226 | ||
@@ -264,7 +238,7 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
264 | 238 | ||
265 | INIT_WORK(&ap->led_work, led_update); | 239 | INIT_WORK(&ap->led_work, led_update); |
266 | if (device_chip[APANEL_DEV_LED] != CHIP_NONE) { | 240 | if (device_chip[APANEL_DEV_LED] != CHIP_NONE) { |
267 | err = led_classdev_register(&ap->client.dev, &ap->mail_led); | 241 | err = led_classdev_register(&client->dev, &ap->mail_led); |
268 | if (err) | 242 | if (err) |
269 | goto out4; | 243 | goto out4; |
270 | } | 244 | } |
@@ -273,8 +247,6 @@ static int apanel_probe(struct i2c_adapter *bus, int address, int kind) | |||
273 | out4: | 247 | out4: |
274 | input_unregister_polled_device(ipdev); | 248 | input_unregister_polled_device(ipdev); |
275 | out3: | 249 | out3: |
276 | i2c_detach_client(&ap->client); | ||
277 | out2: | ||
278 | input_free_polled_device(ipdev); | 250 | input_free_polled_device(ipdev); |
279 | out1: | 251 | out1: |
280 | return err; | 252 | return err; |
@@ -301,6 +273,7 @@ static int __init apanel_init(void) | |||
301 | void __iomem *bios; | 273 | void __iomem *bios; |
302 | const void __iomem *p; | 274 | const void __iomem *p; |
303 | u8 devno; | 275 | u8 devno; |
276 | unsigned char i2c_addr; | ||
304 | int found = 0; | 277 | int found = 0; |
305 | 278 | ||
306 | bios = ioremap(0xF0000, 0x10000); /* Can't fail */ | 279 | bios = ioremap(0xF0000, 0x10000); /* Can't fail */ |
@@ -313,7 +286,7 @@ static int __init apanel_init(void) | |||
313 | 286 | ||
314 | /* just use the first address */ | 287 | /* just use the first address */ |
315 | p += 8; | 288 | p += 8; |
316 | normal_i2c[0] = readb(p+3) >> 1; | 289 | i2c_addr = readb(p + 3) >> 1; |
317 | 290 | ||
318 | for ( ; (devno = readb(p)) & 0x7f; p += 4) { | 291 | for ( ; (devno = readb(p)) & 0x7f; p += 4) { |
319 | unsigned char method, slave, chip; | 292 | unsigned char method, slave, chip; |
@@ -322,7 +295,7 @@ static int __init apanel_init(void) | |||
322 | chip = readb(p + 2); | 295 | chip = readb(p + 2); |
323 | slave = readb(p + 3) >> 1; | 296 | slave = readb(p + 3) >> 1; |
324 | 297 | ||
325 | if (slave != normal_i2c[0]) { | 298 | if (slave != i2c_addr) { |
326 | pr_notice(APANEL ": only one SMBus slave " | 299 | pr_notice(APANEL ": only one SMBus slave " |
327 | "address supported, skiping device...\n"); | 300 | "address supported, skiping device...\n"); |
328 | continue; | 301 | continue; |
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c index 4342e77814b5..fa67d782c3c3 100644 --- a/drivers/input/touchscreen/da9034-ts.c +++ b/drivers/input/touchscreen/da9034-ts.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/input.h> | 18 | #include <linux/input.h> |
19 | #include <linux/workqueue.h> | ||
19 | #include <linux/mfd/da903x.h> | 20 | #include <linux/mfd/da903x.h> |
20 | 21 | ||
21 | #define DA9034_MANUAL_CTRL 0x50 | 22 | #define DA9034_MANUAL_CTRL 0x50 |
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index b52659620d50..173cf55c64d0 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -138,7 +138,7 @@ config PMAC_BACKLIGHT | |||
138 | Say Y here to enable Macintosh specific extensions of the generic | 138 | Say Y here to enable Macintosh specific extensions of the generic |
139 | backlight code. With this enabled, the brightness keys on older | 139 | backlight code. With this enabled, the brightness keys on older |
140 | PowerBooks will be enabled so you can change the screen brightness. | 140 | PowerBooks will be enabled so you can change the screen brightness. |
141 | Newer models should use an userspace daemon like pbbuttonsd. | 141 | Newer models should use a userspace daemon like pbbuttonsd. |
142 | 142 | ||
143 | config PMAC_BACKLIGHT_LEGACY | 143 | config PMAC_BACKLIGHT_LEGACY |
144 | bool "Provide legacy ioctl's on /dev/pmu for the backlight" | 144 | bool "Provide legacy ioctl's on /dev/pmu for the backlight" |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 34a39d2e4703..46fd573a4f15 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -569,7 +569,6 @@ static int cafe_smbus_setup(struct cafe_camera *cam) | |||
569 | 569 | ||
570 | cafe_smbus_enable_irq(cam); | 570 | cafe_smbus_enable_irq(cam); |
571 | adap->id = I2C_HW_SMBUS_CAFE; | 571 | adap->id = I2C_HW_SMBUS_CAFE; |
572 | adap->class = I2C_CLASS_CAM_DIGITAL; | ||
573 | adap->owner = THIS_MODULE; | 572 | adap->owner = THIS_MODULE; |
574 | adap->client_register = cafe_smbus_attach; | 573 | adap->client_register = cafe_smbus_attach; |
575 | adap->client_unregister = cafe_smbus_detach; | 574 | adap->client_unregister = cafe_smbus_detach; |
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index ca26b0c50cf2..05c14a29375a 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -1347,7 +1347,6 @@ static struct i2c_driver ov7670_driver = { | |||
1347 | .name = "ov7670", | 1347 | .name = "ov7670", |
1348 | }, | 1348 | }, |
1349 | .id = I2C_DRIVERID_OV7670, | 1349 | .id = I2C_DRIVERID_OV7670, |
1350 | .class = I2C_CLASS_CAM_DIGITAL, | ||
1351 | .attach_adapter = ov7670_attach, | 1350 | .attach_adapter = ov7670_attach, |
1352 | .detach_client = ov7670_detach, | 1351 | .detach_client = ov7670_detach, |
1353 | .command = ov7670_command, | 1352 | .command = ov7670_command, |
diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 2c4acbf5a4fe..c841f4e4fbe4 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c | |||
@@ -405,7 +405,6 @@ static struct i2c_driver driver = { | |||
405 | .name = "ovcamchip", | 405 | .name = "ovcamchip", |
406 | }, | 406 | }, |
407 | .id = I2C_DRIVERID_OVCAMCHIP, | 407 | .id = I2C_DRIVERID_OVCAMCHIP, |
408 | .class = I2C_CLASS_CAM_DIGITAL, | ||
409 | .attach_adapter = ovcamchip_attach, | 408 | .attach_adapter = ovcamchip_attach, |
410 | .detach_client = ovcamchip_detach, | 409 | .detach_client = ovcamchip_detach, |
411 | .command = ovcamchip_command, | 410 | .command = ovcamchip_command, |
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index a3997b7d4366..105a832531f2 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c | |||
@@ -1553,7 +1553,6 @@ static int w9968cf_i2c_init(struct w9968cf_device* cam) | |||
1553 | 1553 | ||
1554 | static struct i2c_adapter adap = { | 1554 | static struct i2c_adapter adap = { |
1555 | .id = I2C_HW_SMBUS_W9968CF, | 1555 | .id = I2C_HW_SMBUS_W9968CF, |
1556 | .class = I2C_CLASS_CAM_DIGITAL, | ||
1557 | .owner = THIS_MODULE, | 1556 | .owner = THIS_MODULE, |
1558 | .client_register = w9968cf_i2c_attach_inform, | 1557 | .client_register = w9968cf_i2c_attach_inform, |
1559 | .client_unregister = w9968cf_i2c_detach_inform, | 1558 | .client_unregister = w9968cf_i2c_detach_inform, |
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c index 1bcdbbb9e7d3..3d45817e6dcd 100644 --- a/drivers/message/i2o/i2o_scsi.c +++ b/drivers/message/i2o/i2o_scsi.c | |||
@@ -390,7 +390,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m, | |||
390 | * @i2o_dev: the I2O device which was added | 390 | * @i2o_dev: the I2O device which was added |
391 | * | 391 | * |
392 | * If a I2O device is added we catch the notification, because I2O classes | 392 | * If a I2O device is added we catch the notification, because I2O classes |
393 | * other then SCSI peripheral will not be received through | 393 | * other than SCSI peripheral will not be received through |
394 | * i2o_scsi_probe(). | 394 | * i2o_scsi_probe(). |
395 | */ | 395 | */ |
396 | static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev) | 396 | static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev) |
diff --git a/drivers/misc/ibmasm/event.c b/drivers/misc/ibmasm/event.c index fda6a4d3bf23..68a0a5b94795 100644 --- a/drivers/misc/ibmasm/event.c +++ b/drivers/misc/ibmasm/event.c | |||
@@ -50,7 +50,7 @@ static void wake_up_event_readers(struct service_processor *sp) | |||
50 | * Store the event in the circular event buffer, wake up any sleeping | 50 | * Store the event in the circular event buffer, wake up any sleeping |
51 | * event readers. | 51 | * event readers. |
52 | * There is no reader marker in the buffer, therefore readers are | 52 | * There is no reader marker in the buffer, therefore readers are |
53 | * responsible for keeping up with the writer, or they will loose events. | 53 | * responsible for keeping up with the writer, or they will lose events. |
54 | */ | 54 | */ |
55 | void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size) | 55 | void ibmasm_receive_event(struct service_processor *sp, void *data, unsigned int data_size) |
56 | { | 56 | { |
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index abdebe347383..fa57b67593ae 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * You need an userspace library to cooperate with this driver. It (and other | 9 | * You need a userspace library to cooperate with this driver. It (and other |
10 | * info) may be obtained here: | 10 | * info) may be obtained here: |
11 | * http://www.fi.muni.cz/~xslaby/phantom.html | 11 | * http://www.fi.muni.cz/~xslaby/phantom.html |
12 | * or alternatively, you might use OpenHaptics provided by Sensable. | 12 | * or alternatively, you might use OpenHaptics provided by Sensable. |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 7a3f2436b011..1e97916914ad 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <linux/stat.h> | 25 | #include <linux/stat.h> |
26 | 26 | ||
27 | #include <linux/mmc/host.h> | 27 | #include <linux/mmc/host.h> |
28 | #include <linux/atmel-mci.h> | ||
28 | 29 | ||
29 | #include <asm/atmel-mci.h> | ||
30 | #include <asm/io.h> | 30 | #include <asm/io.h> |
31 | #include <asm/unaligned.h> | 31 | #include <asm/unaligned.h> |
32 | 32 | ||
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index d38bca64bb15..d2fd550f7e09 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c | |||
@@ -34,7 +34,7 @@ | |||
34 | * aperture size, not the dram size, and the V370PDC supplies no | 34 | * aperture size, not the dram size, and the V370PDC supplies no |
35 | * other method for memory size discovery. This problem is | 35 | * other method for memory size discovery. This problem is |
36 | * mostly only relevant when compiled as a module, as the | 36 | * mostly only relevant when compiled as a module, as the |
37 | * unloading of the module with an aperture size smaller then | 37 | * unloading of the module with an aperture size smaller than |
38 | * the ram will cause the driver to detect the onboard memory | 38 | * the ram will cause the driver to detect the onboard memory |
39 | * size to be equal to the aperture size when the module is | 39 | * size to be equal to the aperture size when the module is |
40 | * reloaded. Soooo, to help, the module supports an msize | 40 | * reloaded. Soooo, to help, the module supports an msize |
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 048a606cebde..25def348e5ba 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -717,7 +717,7 @@ write_error: | |||
717 | * to the real data size, although the @buf buffer has to contain the | 717 | * to the real data size, although the @buf buffer has to contain the |
718 | * alignment. In all other cases, @len has to be aligned. | 718 | * alignment. In all other cases, @len has to be aligned. |
719 | * | 719 | * |
720 | * It is prohibited to write more then once to logical eraseblocks of static | 720 | * It is prohibited to write more than once to logical eraseblocks of static |
721 | * volumes. This function returns zero in case of success and a negative error | 721 | * volumes. This function returns zero in case of success and a negative error |
722 | * code in case of failure. | 722 | * code in case of failure. |
723 | */ | 723 | */ |
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index a74118c05745..fe81039f2a7c 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -465,7 +465,7 @@ out: | |||
465 | * This function synchronously erases physical eraseblock @pnum. If @torture | 465 | * This function synchronously erases physical eraseblock @pnum. If @torture |
466 | * flag is not zero, the physical eraseblock is checked by means of writing | 466 | * flag is not zero, the physical eraseblock is checked by means of writing |
467 | * different patterns to it and reading them back. If the torturing is enabled, | 467 | * different patterns to it and reading them back. If the torturing is enabled, |
468 | * the physical eraseblock is erased more then once. | 468 | * the physical eraseblock is erased more than once. |
469 | * | 469 | * |
470 | * This function returns the number of erasures made in case of success, %-EIO | 470 | * This function returns the number of erasures made in case of success, %-EIO |
471 | * if the erasure failed or the torturing test failed, and other negative error | 471 | * if the erasure failed or the torturing test failed, and other negative error |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 41d47e1cf15c..ecde202a5a12 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -478,7 +478,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
478 | return 0; | 478 | return 0; |
479 | } else { | 479 | } else { |
480 | /* | 480 | /* |
481 | * This logical eraseblock is older then the one found | 481 | * This logical eraseblock is older than the one found |
482 | * previously. | 482 | * previously. |
483 | */ | 483 | */ |
484 | if (cmp_res & 4) | 484 | if (cmp_res & 4) |
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h index 2ad940409053..8419fdccc79c 100644 --- a/drivers/mtd/ubi/ubi-media.h +++ b/drivers/mtd/ubi/ubi-media.h | |||
@@ -135,7 +135,7 @@ enum { | |||
135 | * The erase counter header takes 64 bytes and has a plenty of unused space for | 135 | * The erase counter header takes 64 bytes and has a plenty of unused space for |
136 | * future usage. The unused fields are zeroed. The @version field is used to | 136 | * future usage. The unused fields are zeroed. The @version field is used to |
137 | * indicate the version of UBI implementation which is supposed to be able to | 137 | * indicate the version of UBI implementation which is supposed to be able to |
138 | * work with this UBI image. If @version is greater then the current UBI | 138 | * work with this UBI image. If @version is greater than the current UBI |
139 | * version, the image is rejected. This may be useful in future if something | 139 | * version, the image is rejected. This may be useful in future if something |
140 | * is changed radically. This field is duplicated in the volume identifier | 140 | * is changed radically. This field is duplicated in the volume identifier |
141 | * header. | 141 | * header. |
@@ -187,7 +187,7 @@ struct ubi_ec_hdr { | |||
187 | * (sequence number) is used to distinguish between older and newer versions of | 187 | * (sequence number) is used to distinguish between older and newer versions of |
188 | * logical eraseblocks. | 188 | * logical eraseblocks. |
189 | * | 189 | * |
190 | * There are 2 situations when there may be more then one physical eraseblock | 190 | * There are 2 situations when there may be more than one physical eraseblock |
191 | * corresponding to the same logical eraseblock, i.e., having the same @vol_id | 191 | * corresponding to the same logical eraseblock, i.e., having the same @vol_id |
192 | * and @lnum values in the volume identifier header. Suppose we have a logical | 192 | * and @lnum values in the volume identifier header. Suppose we have a logical |
193 | * eraseblock L and it is mapped to the physical eraseblock P. | 193 | * eraseblock L and it is mapped to the physical eraseblock P. |
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 333c8941552f..1afc61e7455d 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -577,7 +577,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si, | |||
577 | if (vtbl[i].flags & UBI_VTBL_AUTORESIZE_FLG) { | 577 | if (vtbl[i].flags & UBI_VTBL_AUTORESIZE_FLG) { |
578 | /* Auto re-size flag may be set only for one volume */ | 578 | /* Auto re-size flag may be set only for one volume */ |
579 | if (ubi->autoresize_vol_id != -1) { | 579 | if (ubi->autoresize_vol_id != -1) { |
580 | ubi_err("more then one auto-resize volume (%d " | 580 | ubi_err("more than one auto-resize volume (%d " |
581 | "and %d)", ubi->autoresize_vol_id, i); | 581 | "and %d)", ubi->autoresize_vol_id, i); |
582 | kfree(vol); | 582 | kfree(vol); |
583 | return -EINVAL; | 583 | return -EINVAL; |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 14901cb82c18..891534f8210d 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -128,7 +128,7 @@ | |||
128 | * situation when the picked physical eraseblock is constantly erased after the | 128 | * situation when the picked physical eraseblock is constantly erased after the |
129 | * data is written to it. So, we have a constant which limits the highest erase | 129 | * data is written to it. So, we have a constant which limits the highest erase |
130 | * counter of the free physical eraseblock to pick. Namely, the WL sub-system | 130 | * counter of the free physical eraseblock to pick. Namely, the WL sub-system |
131 | * does not pick eraseblocks with erase counter greater then the lowest erase | 131 | * does not pick eraseblocks with erase counter greater than the lowest erase |
132 | * counter plus %WL_FREE_MAX_DIFF. | 132 | * counter plus %WL_FREE_MAX_DIFF. |
133 | */ | 133 | */ |
134 | #define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD) | 134 | #define WL_FREE_MAX_DIFF (2*UBI_WL_THRESHOLD) |
@@ -917,7 +917,7 @@ static int ensure_wear_leveling(struct ubi_device *ubi) | |||
917 | /* | 917 | /* |
918 | * We schedule wear-leveling only if the difference between the | 918 | * We schedule wear-leveling only if the difference between the |
919 | * lowest erase counter of used physical eraseblocks and a high | 919 | * lowest erase counter of used physical eraseblocks and a high |
920 | * erase counter of free physical eraseblocks is greater then | 920 | * erase counter of free physical eraseblocks is greater than |
921 | * %UBI_WL_THRESHOLD. | 921 | * %UBI_WL_THRESHOLD. |
922 | */ | 922 | */ |
923 | e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb); | 923 | e1 = rb_entry(rb_first(&ubi->used), struct ubi_wl_entry, u.rb); |
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c index 67de94f1f30e..fefa6ab13064 100644 --- a/drivers/net/bnx2x_link.c +++ b/drivers/net/bnx2x_link.c | |||
@@ -3359,7 +3359,7 @@ static u8 bnx2x_format_ver(u32 num, u8 *str, u16 len) | |||
3359 | u8 shift = 8*4; | 3359 | u8 shift = 8*4; |
3360 | u8 digit; | 3360 | u8 digit; |
3361 | if (len < 10) { | 3361 | if (len < 10) { |
3362 | /* Need more then 10chars for this format */ | 3362 | /* Need more than 10chars for this format */ |
3363 | *str_ptr = '\0'; | 3363 | *str_ptr = '\0'; |
3364 | return -EINVAL; | 3364 | return -EINVAL; |
3365 | } | 3365 | } |
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index d04eef53571e..e1a3fc1303ee 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -6758,7 +6758,7 @@ static s32 e1000_get_cable_length(struct e1000_hw *hw, u16 *min_length, | |||
6758 | * returns: - E1000_ERR_XXX | 6758 | * returns: - E1000_ERR_XXX |
6759 | * E1000_SUCCESS | 6759 | * E1000_SUCCESS |
6760 | * | 6760 | * |
6761 | * For phy's older then IGP, this function simply reads the polarity bit in the | 6761 | * For phy's older than IGP, this function simply reads the polarity bit in the |
6762 | * Phy Status register. For IGP phy's, this bit is valid only if link speed is | 6762 | * Phy Status register. For IGP phy's, this bit is valid only if link speed is |
6763 | * 10 Mbps. If the link speed is 100 Mbps there is no polarity so this bit will | 6763 | * 10 Mbps. If the link speed is 100 Mbps there is no polarity so this bit will |
6764 | * return 0. If the link speed is 1000 Mbps the polarity status is in the | 6764 | * return 0. If the link speed is 1000 Mbps the polarity status is in the |
@@ -6834,7 +6834,7 @@ static s32 e1000_check_polarity(struct e1000_hw *hw, | |||
6834 | * returns: - E1000_ERR_XXX | 6834 | * returns: - E1000_ERR_XXX |
6835 | * E1000_SUCCESS | 6835 | * E1000_SUCCESS |
6836 | * | 6836 | * |
6837 | * For phy's older then IGP, this function reads the Downshift bit in the Phy | 6837 | * For phy's older than IGP, this function reads the Downshift bit in the Phy |
6838 | * Specific Status register. For IGP phy's, it reads the Downgrade bit in the | 6838 | * Specific Status register. For IGP phy's, it reads the Downgrade bit in the |
6839 | * Link Health register. In IGP this bit is latched high, so the driver must | 6839 | * Link Health register. In IGP this bit is latched high, so the driver must |
6840 | * read it immediately after link is established. | 6840 | * read it immediately after link is established. |
diff --git a/drivers/net/slip.h b/drivers/net/slip.h index 853e0f6ec710..9ea5c11287d2 100644 --- a/drivers/net/slip.h +++ b/drivers/net/slip.h | |||
@@ -75,7 +75,7 @@ struct slip { | |||
75 | unsigned long tx_errors; /* Planned stuff */ | 75 | unsigned long tx_errors; /* Planned stuff */ |
76 | unsigned long rx_dropped; /* No memory for skb */ | 76 | unsigned long rx_dropped; /* No memory for skb */ |
77 | unsigned long tx_dropped; /* When MTU change */ | 77 | unsigned long tx_dropped; /* When MTU change */ |
78 | unsigned long rx_over_errors; /* Frame bigger then SLIP buf. */ | 78 | unsigned long rx_over_errors; /* Frame bigger than SLIP buf. */ |
79 | #ifdef SL_INCLUDE_CSLIP | 79 | #ifdef SL_INCLUDE_CSLIP |
80 | unsigned long tx_compressed; | 80 | unsigned long tx_compressed; |
81 | unsigned long rx_compressed; | 81 | unsigned long rx_compressed; |
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index a10a83a11d9f..a7a4dc4d6313 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -1004,7 +1004,7 @@ static inline void bdx_rxdb_free_elem(struct rxdb *db, int n) | |||
1004 | * skb for rx. It assumes that Rx is desabled in HW | 1004 | * skb for rx. It assumes that Rx is desabled in HW |
1005 | * funcs are grouped for better cache usage | 1005 | * funcs are grouped for better cache usage |
1006 | * | 1006 | * |
1007 | * RxD fifo is smaller then RxF fifo by design. Upon high load, RxD will be | 1007 | * RxD fifo is smaller than RxF fifo by design. Upon high load, RxD will be |
1008 | * filled and packets will be dropped by nic without getting into host or | 1008 | * filled and packets will be dropped by nic without getting into host or |
1009 | * cousing interrupt. Anyway, in that condition, host has no chance to proccess | 1009 | * cousing interrupt. Anyway, in that condition, host has no chance to proccess |
1010 | * all packets, but dropping in nic is cheaper, since it takes 0 cpu cycles | 1010 | * all packets, but dropping in nic is cheaper, since it takes 0 cpu cycles |
@@ -1826,7 +1826,7 @@ static void bdx_tx_free(struct bdx_priv *priv) | |||
1826 | * | 1826 | * |
1827 | * Pushes desc to TxD fifo and overlaps it if needed. | 1827 | * Pushes desc to TxD fifo and overlaps it if needed. |
1828 | * NOTE: this func does not check for available space. this is responsibility | 1828 | * NOTE: this func does not check for available space. this is responsibility |
1829 | * of the caller. Neither does it check that data size is smaller then | 1829 | * of the caller. Neither does it check that data size is smaller than |
1830 | * fifo size. | 1830 | * fifo size. |
1831 | */ | 1831 | */ |
1832 | static void bdx_tx_push_desc(struct bdx_priv *priv, void *data, int size) | 1832 | static void bdx_tx_push_desc(struct bdx_priv *priv, void *data, int size) |
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c index a011666342ff..50eb29ce3c87 100644 --- a/drivers/net/tokenring/smctr.c +++ b/drivers/net/tokenring/smctr.c | |||
@@ -3064,7 +3064,7 @@ static int smctr_load_node_addr(struct net_device *dev) | |||
3064 | * will consequently cause a timeout. | 3064 | * will consequently cause a timeout. |
3065 | * | 3065 | * |
3066 | * NOTE 1: If the monitor_state is MS_BEACON_TEST_STATE, all transmit | 3066 | * NOTE 1: If the monitor_state is MS_BEACON_TEST_STATE, all transmit |
3067 | * queues other then the one used for the lobe_media_test should be | 3067 | * queues other than the one used for the lobe_media_test should be |
3068 | * disabled.!? | 3068 | * disabled.!? |
3069 | * | 3069 | * |
3070 | * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask | 3070 | * NOTE 2: If the monitor_state is MS_BEACON_TEST_STATE and the receive_mask |
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 350157fcd080..4223672c4432 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -3836,7 +3836,7 @@ static int reset_atmel_card(struct net_device *dev) | |||
3836 | This routine is also responsible for initialising some | 3836 | This routine is also responsible for initialising some |
3837 | hardware-specific fields in the atmel_private structure, | 3837 | hardware-specific fields in the atmel_private structure, |
3838 | including a copy of the firmware's hostinfo stucture | 3838 | including a copy of the firmware's hostinfo stucture |
3839 | which is the route into the rest of the firmare datastructures. */ | 3839 | which is the route into the rest of the firmware datastructures. */ |
3840 | 3840 | ||
3841 | struct atmel_private *priv = netdev_priv(dev); | 3841 | struct atmel_private *priv = netdev_priv(dev); |
3842 | u8 configuration; | 3842 | u8 configuration; |
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index 1667065b86a7..823c2bf5e31e 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c | |||
@@ -1332,7 +1332,7 @@ static int ipw2100_power_cycle_adapter(struct ipw2100_priv *priv) | |||
1332 | IPW_AUX_HOST_RESET_REG_STOP_MASTER); | 1332 | IPW_AUX_HOST_RESET_REG_STOP_MASTER); |
1333 | 1333 | ||
1334 | /* Step 2. Wait for stop Master Assert | 1334 | /* Step 2. Wait for stop Master Assert |
1335 | * (not more then 50us, otherwise ret error */ | 1335 | * (not more than 50us, otherwise ret error */ |
1336 | i = 5; | 1336 | i = 5; |
1337 | do { | 1337 | do { |
1338 | udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); | 1338 | udelay(IPW_WAIT_RESET_MASTER_ASSERT_COMPLETE_DELAY); |
@@ -1830,7 +1830,7 @@ static void ipw2100_down(struct ipw2100_priv *priv) | |||
1830 | cancel_delayed_work(&priv->rf_kill); | 1830 | cancel_delayed_work(&priv->rf_kill); |
1831 | } | 1831 | } |
1832 | 1832 | ||
1833 | /* Kill the firmare hang check timer */ | 1833 | /* Kill the firmware hang check timer */ |
1834 | if (!priv->stop_hang_check) { | 1834 | if (!priv->stop_hang_check) { |
1835 | priv->stop_hang_check = 1; | 1835 | priv->stop_hang_check = 1; |
1836 | cancel_delayed_work(&priv->hang_check); | 1836 | cancel_delayed_work(&priv->hang_check); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c index 37ad0d2fb64c..aee9cba13eb3 100644 --- a/drivers/net/wireless/rt2x00/rt2x00crypto.c +++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c | |||
@@ -184,8 +184,8 @@ void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, unsigned int align, | |||
184 | * Make room for new data, note that we increase both | 184 | * Make room for new data, note that we increase both |
185 | * headsize and tailsize when required. The tailsize is | 185 | * headsize and tailsize when required. The tailsize is |
186 | * only needed when ICV data needs to be inserted and | 186 | * only needed when ICV data needs to be inserted and |
187 | * the padding is smaller then the ICV data. | 187 | * the padding is smaller than the ICV data. |
188 | * When alignment requirements is greater then the | 188 | * When alignment requirements is greater than the |
189 | * ICV data we must trim the skb to the correct size | 189 | * ICV data we must trim the skb to the correct size |
190 | * because we need to remove the extra bytes. | 190 | * because we need to remove the extra bytes. |
191 | */ | 191 | */ |
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index dd0de3a9ed4e..7015f2480550 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -236,7 +236,7 @@ struct strip { | |||
236 | unsigned long tx_errors; /* Planned stuff */ | 236 | unsigned long tx_errors; /* Planned stuff */ |
237 | unsigned long rx_dropped; /* No memory for skb */ | 237 | unsigned long rx_dropped; /* No memory for skb */ |
238 | unsigned long tx_dropped; /* When MTU change */ | 238 | unsigned long tx_dropped; /* When MTU change */ |
239 | unsigned long rx_over_errors; /* Frame bigger then STRIP buf. */ | 239 | unsigned long rx_over_errors; /* Frame bigger than STRIP buf. */ |
240 | 240 | ||
241 | unsigned long pps_timer; /* Timer to determine pps */ | 241 | unsigned long pps_timer; /* Timer to determine pps */ |
242 | unsigned long rx_pps_count; /* Counter to determine pps */ | 242 | unsigned long rx_pps_count; /* Counter to determine pps */ |
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c index 23a07fe15a2c..0b6b7730c716 100644 --- a/drivers/rtc/rtc-ds1511.c +++ b/drivers/rtc/rtc-ds1511.c | |||
@@ -630,7 +630,7 @@ ds1511_rtc_init(void) | |||
630 | static void __exit | 630 | static void __exit |
631 | ds1511_rtc_exit(void) | 631 | ds1511_rtc_exit(void) |
632 | { | 632 | { |
633 | return platform_driver_unregister(&ds1511_rtc_driver); | 633 | platform_driver_unregister(&ds1511_rtc_driver); |
634 | } | 634 | } |
635 | 635 | ||
636 | module_init(ds1511_rtc_init); | 636 | module_init(ds1511_rtc_init); |
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c index dc0b6224ad9b..7d1547b0070e 100644 --- a/drivers/rtc/rtc-stk17ta8.c +++ b/drivers/rtc/rtc-stk17ta8.c | |||
@@ -399,7 +399,7 @@ static __init int stk17ta8_init(void) | |||
399 | 399 | ||
400 | static __exit void stk17ta8_exit(void) | 400 | static __exit void stk17ta8_exit(void) |
401 | { | 401 | { |
402 | return platform_driver_unregister(&stk17ta8_rtc_driver); | 402 | platform_driver_unregister(&stk17ta8_rtc_driver); |
403 | } | 403 | } |
404 | 404 | ||
405 | module_init(stk17ta8_init); | 405 | module_init(stk17ta8_init); |
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index 892e2878d61b..f8e05ce98621 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c | |||
@@ -535,8 +535,8 @@ static int dasd_eer_open(struct inode *inp, struct file *filp) | |||
535 | eerb->buffer_page_count > INT_MAX / PAGE_SIZE) { | 535 | eerb->buffer_page_count > INT_MAX / PAGE_SIZE) { |
536 | kfree(eerb); | 536 | kfree(eerb); |
537 | MESSAGE(KERN_WARNING, "can't open device since module " | 537 | MESSAGE(KERN_WARNING, "can't open device since module " |
538 | "parameter eer_pages is smaller then 1 or" | 538 | "parameter eer_pages is smaller than 1 or" |
539 | " bigger then %d", (int)(INT_MAX / PAGE_SIZE)); | 539 | " bigger than %d", (int)(INT_MAX / PAGE_SIZE)); |
540 | unlock_kernel(); | 540 | unlock_kernel(); |
541 | return -EINVAL; | 541 | return -EINVAL; |
542 | } | 542 | } |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index aabbeb909cc6..d8a2289fcb69 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -427,7 +427,7 @@ static int vmlogrdr_receive_data(struct vmlogrdr_priv_t *priv) | |||
427 | buffer = priv->buffer + sizeof(int); | 427 | buffer = priv->buffer + sizeof(int); |
428 | } | 428 | } |
429 | /* | 429 | /* |
430 | * If the record is bigger then our buffer, we receive only | 430 | * If the record is bigger than our buffer, we receive only |
431 | * a part of it. We can get the rest later. | 431 | * a part of it. We can get the rest later. |
432 | */ | 432 | */ |
433 | if (iucv_data_count > NET_BUFFER_SIZE) | 433 | if (iucv_data_count > NET_BUFFER_SIZE) |
@@ -437,7 +437,7 @@ static int vmlogrdr_receive_data(struct vmlogrdr_priv_t *priv) | |||
437 | 0, buffer, iucv_data_count, | 437 | 0, buffer, iucv_data_count, |
438 | &priv->residual_length); | 438 | &priv->residual_length); |
439 | spin_unlock_bh(&priv->priv_lock); | 439 | spin_unlock_bh(&priv->priv_lock); |
440 | /* An rc of 5 indicates that the record was bigger then | 440 | /* An rc of 5 indicates that the record was bigger than |
441 | * the buffer, which is OK for us. A 9 indicates that the | 441 | * the buffer, which is OK for us. A 9 indicates that the |
442 | * record was purged befor we could receive it. | 442 | * record was purged befor we could receive it. |
443 | */ | 443 | */ |
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index 3c298c7253ee..964769f66eac 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c | |||
@@ -633,7 +633,7 @@ static int orc_device_reset(struct orc_host * host, struct scsi_cmnd *cmd, unsig | |||
633 | return FAILED; | 633 | return FAILED; |
634 | } | 634 | } |
635 | 635 | ||
636 | /* Reset device is handled by the firmare, we fill in an SCB and | 636 | /* Reset device is handled by the firmware, we fill in an SCB and |
637 | fire it at the controller, it does the rest */ | 637 | fire it at the controller, it does the rest */ |
638 | scb->opcode = ORC_BUSDEVRST; | 638 | scb->opcode = ORC_BUSDEVRST; |
639 | scb->target = target; | 639 | scb->target = target; |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 8c64494444bf..311ed6dea726 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1964,10 +1964,10 @@ lpfc_set_disctmo(struct lpfc_vport *vport) | |||
1964 | uint32_t tmo; | 1964 | uint32_t tmo; |
1965 | 1965 | ||
1966 | if (vport->port_state == LPFC_LOCAL_CFG_LINK) { | 1966 | if (vport->port_state == LPFC_LOCAL_CFG_LINK) { |
1967 | /* For FAN, timeout should be greater then edtov */ | 1967 | /* For FAN, timeout should be greater than edtov */ |
1968 | tmo = (((phba->fc_edtov + 999) / 1000) + 1); | 1968 | tmo = (((phba->fc_edtov + 999) / 1000) + 1); |
1969 | } else { | 1969 | } else { |
1970 | /* Normal discovery timeout should be > then ELS/CT timeout | 1970 | /* Normal discovery timeout should be > than ELS/CT timeout |
1971 | * FC spec states we need 3 * ratov for CT requests | 1971 | * FC spec states we need 3 * ratov for CT requests |
1972 | */ | 1972 | */ |
1973 | tmo = ((phba->fc_ratov * 3) + 3); | 1973 | tmo = ((phba->fc_ratov * 3) + 3); |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 01dfdc8696f8..a36a120561e2 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -420,7 +420,7 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
420 | if (unlikely(pring->local_getidx >= max_cmd_idx)) { | 420 | if (unlikely(pring->local_getidx >= max_cmd_idx)) { |
421 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 421 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
422 | "0315 Ring %d issue: portCmdGet %d " | 422 | "0315 Ring %d issue: portCmdGet %d " |
423 | "is bigger then cmd ring %d\n", | 423 | "is bigger than cmd ring %d\n", |
424 | pring->ringno, | 424 | pring->ringno, |
425 | pring->local_getidx, max_cmd_idx); | 425 | pring->local_getidx, max_cmd_idx); |
426 | 426 | ||
@@ -1628,12 +1628,12 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
1628 | { | 1628 | { |
1629 | struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; | 1629 | struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno]; |
1630 | /* | 1630 | /* |
1631 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then | 1631 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger than |
1632 | * rsp ring <portRspMax> | 1632 | * rsp ring <portRspMax> |
1633 | */ | 1633 | */ |
1634 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 1634 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
1635 | "0312 Ring %d handler: portRspPut %d " | 1635 | "0312 Ring %d handler: portRspPut %d " |
1636 | "is bigger then rsp ring %d\n", | 1636 | "is bigger than rsp ring %d\n", |
1637 | pring->ringno, le32_to_cpu(pgp->rspPutInx), | 1637 | pring->ringno, le32_to_cpu(pgp->rspPutInx), |
1638 | pring->numRiocb); | 1638 | pring->numRiocb); |
1639 | 1639 | ||
@@ -2083,12 +2083,12 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
2083 | portRspPut = le32_to_cpu(pgp->rspPutInx); | 2083 | portRspPut = le32_to_cpu(pgp->rspPutInx); |
2084 | if (portRspPut >= portRspMax) { | 2084 | if (portRspPut >= portRspMax) { |
2085 | /* | 2085 | /* |
2086 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger then | 2086 | * Ring <ringno> handler: portRspPut <portRspPut> is bigger than |
2087 | * rsp ring <portRspMax> | 2087 | * rsp ring <portRspMax> |
2088 | */ | 2088 | */ |
2089 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 2089 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
2090 | "0303 Ring %d handler: portRspPut %d " | 2090 | "0303 Ring %d handler: portRspPut %d " |
2091 | "is bigger then rsp ring %d\n", | 2091 | "is bigger than rsp ring %d\n", |
2092 | pring->ringno, portRspPut, portRspMax); | 2092 | pring->ringno, portRspPut, portRspMax); |
2093 | 2093 | ||
2094 | phba->link_state = LPFC_HBA_ERROR; | 2094 | phba->link_state = LPFC_HBA_ERROR; |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 7dc62deb4087..9fdcd60c5493 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -1967,8 +1967,8 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor) | |||
1967 | scb->state |= aor; | 1967 | scb->state |= aor; |
1968 | 1968 | ||
1969 | /* | 1969 | /* |
1970 | * Check if this command has firmare owenership. If | 1970 | * Check if this command has firmware ownership. If |
1971 | * yes, we cannot reset this command. Whenever, f/w | 1971 | * yes, we cannot reset this command. Whenever f/w |
1972 | * completes this command, we will return appropriate | 1972 | * completes this command, we will return appropriate |
1973 | * status from ISR. | 1973 | * status from ISR. |
1974 | */ | 1974 | */ |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 8cb9240596ab..df09820e8916 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -128,7 +128,7 @@ | |||
128 | - Integrate ql12160_set_target_parameters() with 1280 version | 128 | - Integrate ql12160_set_target_parameters() with 1280 version |
129 | - Make qla1280_setup() non static | 129 | - Make qla1280_setup() non static |
130 | - Do not call qla1280_check_for_dead_scsi_bus() on every I/O request | 130 | - Do not call qla1280_check_for_dead_scsi_bus() on every I/O request |
131 | sent to the card - this command pauses the firmare!!! | 131 | sent to the card - this command pauses the firmware!!! |
132 | Rev 3.23.15 Beta March 19, 2002, Jes Sorensen | 132 | Rev 3.23.15 Beta March 19, 2002, Jes Sorensen |
133 | - Clean up qla1280.h - remove obsolete QL_DEBUG_LEVEL_x definitions | 133 | - Clean up qla1280.h - remove obsolete QL_DEBUG_LEVEL_x definitions |
134 | - Remove a pile of pointless and confusing (srb_t **) and | 134 | - Remove a pile of pointless and confusing (srb_t **) and |
@@ -659,7 +659,7 @@ static int qla1280_read_nvram(struct scsi_qla_host *ha) | |||
659 | /* The firmware interface is, um, interesting, in that the | 659 | /* The firmware interface is, um, interesting, in that the |
660 | * actual firmware image on the chip is little endian, thus, | 660 | * actual firmware image on the chip is little endian, thus, |
661 | * the process of taking that image to the CPU would end up | 661 | * the process of taking that image to the CPU would end up |
662 | * little endian. However, the firmare interface requires it | 662 | * little endian. However, the firmware interface requires it |
663 | * to be read a word (two bytes) at a time. | 663 | * to be read a word (two bytes) at a time. |
664 | * | 664 | * |
665 | * The net result of this would be that the word (and | 665 | * The net result of this would be that the word (and |
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index c577d79bd7e8..051b0f5e8c8e 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -392,7 +392,7 @@ int qla4xxx_get_firmware_status(struct scsi_qla_host * ha) | |||
392 | ha->iocb_hiwat -= IOCB_HIWAT_CUSHION; | 392 | ha->iocb_hiwat -= IOCB_HIWAT_CUSHION; |
393 | else | 393 | else |
394 | dev_info(&ha->pdev->dev, "WARNING!!! You have less than %d " | 394 | dev_info(&ha->pdev->dev, "WARNING!!! You have less than %d " |
395 | "firmare IOCBs available (%d).\n", | 395 | "firmware IOCBs available (%d).\n", |
396 | IOCB_HIWAT_CUSHION, ha->iocb_hiwat); | 396 | IOCB_HIWAT_CUSHION, ha->iocb_hiwat); |
397 | 397 | ||
398 | return QLA_SUCCESS; | 398 | return QLA_SUCCESS; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 381838ebd460..d86ebea9350a 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -1650,7 +1650,7 @@ int scsi_error_handler(void *data) | |||
1650 | * We use TASK_INTERRUPTIBLE so that the thread is not | 1650 | * We use TASK_INTERRUPTIBLE so that the thread is not |
1651 | * counted against the load average as a running process. | 1651 | * counted against the load average as a running process. |
1652 | * We never actually get interrupted because kthread_run | 1652 | * We never actually get interrupted because kthread_run |
1653 | * disables singal delivery for the created thread. | 1653 | * disables signal delivery for the created thread. |
1654 | */ | 1654 | */ |
1655 | set_current_state(TASK_INTERRUPTIBLE); | 1655 | set_current_state(TASK_INTERRUPTIBLE); |
1656 | while (!kthread_should_stop()) { | 1656 | while (!kthread_should_stop()) { |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 18486b51668d..17914a346f71 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/kthread.h> | 33 | #include <linux/kthread.h> |
34 | #include <linux/spinlock.h> | 34 | #include <linux/spinlock.h> |
35 | #include <linux/async.h> | ||
35 | 36 | ||
36 | #include <scsi/scsi.h> | 37 | #include <scsi/scsi.h> |
37 | #include <scsi/scsi_cmnd.h> | 38 | #include <scsi/scsi_cmnd.h> |
@@ -179,6 +180,8 @@ int scsi_complete_async_scans(void) | |||
179 | spin_unlock(&async_scan_lock); | 180 | spin_unlock(&async_scan_lock); |
180 | 181 | ||
181 | kfree(data); | 182 | kfree(data); |
183 | /* Synchronize async operations globally */ | ||
184 | async_synchronize_full(); | ||
182 | return 0; | 185 | return 0; |
183 | } | 186 | } |
184 | 187 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 62b28d58e65e..e035c1114010 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/mutex.h> | 49 | #include <linux/mutex.h> |
50 | #include <linux/string_helpers.h> | 50 | #include <linux/string_helpers.h> |
51 | #include <linux/async.h> | ||
51 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
52 | 53 | ||
53 | #include <scsi/scsi.h> | 54 | #include <scsi/scsi.h> |
@@ -1802,6 +1803,71 @@ static int sd_format_disk_name(char *prefix, int index, char *buf, int buflen) | |||
1802 | return 0; | 1803 | return 0; |
1803 | } | 1804 | } |
1804 | 1805 | ||
1806 | /* | ||
1807 | * The asynchronous part of sd_probe | ||
1808 | */ | ||
1809 | static void sd_probe_async(void *data, async_cookie_t cookie) | ||
1810 | { | ||
1811 | struct scsi_disk *sdkp = data; | ||
1812 | struct scsi_device *sdp; | ||
1813 | struct gendisk *gd; | ||
1814 | u32 index; | ||
1815 | struct device *dev; | ||
1816 | |||
1817 | sdp = sdkp->device; | ||
1818 | gd = sdkp->disk; | ||
1819 | index = sdkp->index; | ||
1820 | dev = &sdp->sdev_gendev; | ||
1821 | |||
1822 | if (!sdp->request_queue->rq_timeout) { | ||
1823 | if (sdp->type != TYPE_MOD) | ||
1824 | blk_queue_rq_timeout(sdp->request_queue, SD_TIMEOUT); | ||
1825 | else | ||
1826 | blk_queue_rq_timeout(sdp->request_queue, | ||
1827 | SD_MOD_TIMEOUT); | ||
1828 | } | ||
1829 | |||
1830 | device_initialize(&sdkp->dev); | ||
1831 | sdkp->dev.parent = &sdp->sdev_gendev; | ||
1832 | sdkp->dev.class = &sd_disk_class; | ||
1833 | strncpy(sdkp->dev.bus_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); | ||
1834 | |||
1835 | if (device_add(&sdkp->dev)) | ||
1836 | goto out_free_index; | ||
1837 | |||
1838 | get_device(&sdp->sdev_gendev); | ||
1839 | |||
1840 | if (index < SD_MAX_DISKS) { | ||
1841 | gd->major = sd_major((index & 0xf0) >> 4); | ||
1842 | gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); | ||
1843 | gd->minors = SD_MINORS; | ||
1844 | } | ||
1845 | gd->fops = &sd_fops; | ||
1846 | gd->private_data = &sdkp->driver; | ||
1847 | gd->queue = sdkp->device->request_queue; | ||
1848 | |||
1849 | sd_revalidate_disk(gd); | ||
1850 | |||
1851 | blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); | ||
1852 | |||
1853 | gd->driverfs_dev = &sdp->sdev_gendev; | ||
1854 | gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS; | ||
1855 | if (sdp->removable) | ||
1856 | gd->flags |= GENHD_FL_REMOVABLE; | ||
1857 | |||
1858 | dev_set_drvdata(dev, sdkp); | ||
1859 | add_disk(gd); | ||
1860 | sd_dif_config_host(sdkp); | ||
1861 | |||
1862 | sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", | ||
1863 | sdp->removable ? "removable " : ""); | ||
1864 | |||
1865 | return; | ||
1866 | |||
1867 | out_free_index: | ||
1868 | ida_remove(&sd_index_ida, index); | ||
1869 | } | ||
1870 | |||
1805 | /** | 1871 | /** |
1806 | * sd_probe - called during driver initialization and whenever a | 1872 | * sd_probe - called during driver initialization and whenever a |
1807 | * new scsi device is attached to the system. It is called once | 1873 | * new scsi device is attached to the system. It is called once |
@@ -1865,48 +1931,7 @@ static int sd_probe(struct device *dev) | |||
1865 | sdkp->openers = 0; | 1931 | sdkp->openers = 0; |
1866 | sdkp->previous_state = 1; | 1932 | sdkp->previous_state = 1; |
1867 | 1933 | ||
1868 | if (!sdp->request_queue->rq_timeout) { | 1934 | async_schedule(sd_probe_async, sdkp); |
1869 | if (sdp->type != TYPE_MOD) | ||
1870 | blk_queue_rq_timeout(sdp->request_queue, SD_TIMEOUT); | ||
1871 | else | ||
1872 | blk_queue_rq_timeout(sdp->request_queue, | ||
1873 | SD_MOD_TIMEOUT); | ||
1874 | } | ||
1875 | |||
1876 | device_initialize(&sdkp->dev); | ||
1877 | sdkp->dev.parent = &sdp->sdev_gendev; | ||
1878 | sdkp->dev.class = &sd_disk_class; | ||
1879 | strncpy(sdkp->dev.bus_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); | ||
1880 | |||
1881 | if (device_add(&sdkp->dev)) | ||
1882 | goto out_free_index; | ||
1883 | |||
1884 | get_device(&sdp->sdev_gendev); | ||
1885 | |||
1886 | if (index < SD_MAX_DISKS) { | ||
1887 | gd->major = sd_major((index & 0xf0) >> 4); | ||
1888 | gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); | ||
1889 | gd->minors = SD_MINORS; | ||
1890 | } | ||
1891 | gd->fops = &sd_fops; | ||
1892 | gd->private_data = &sdkp->driver; | ||
1893 | gd->queue = sdkp->device->request_queue; | ||
1894 | |||
1895 | sd_revalidate_disk(gd); | ||
1896 | |||
1897 | blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); | ||
1898 | |||
1899 | gd->driverfs_dev = &sdp->sdev_gendev; | ||
1900 | gd->flags = GENHD_FL_EXT_DEVT | GENHD_FL_DRIVERFS; | ||
1901 | if (sdp->removable) | ||
1902 | gd->flags |= GENHD_FL_REMOVABLE; | ||
1903 | |||
1904 | dev_set_drvdata(dev, sdkp); | ||
1905 | add_disk(gd); | ||
1906 | sd_dif_config_host(sdkp); | ||
1907 | |||
1908 | sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", | ||
1909 | sdp->removable ? "removable " : ""); | ||
1910 | 1935 | ||
1911 | return 0; | 1936 | return 0; |
1912 | 1937 | ||
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index daa00567bc44..1889a63ebc22 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -3123,7 +3123,7 @@ static int __init serial8250_init(void) | |||
3123 | if (nr_uarts > UART_NR) | 3123 | if (nr_uarts > UART_NR) |
3124 | nr_uarts = UART_NR; | 3124 | nr_uarts = UART_NR; |
3125 | 3125 | ||
3126 | printk(KERN_INFO "Serial: 8250/16550 driver" | 3126 | printk(KERN_INFO "Serial: 8250/16550 driver, " |
3127 | "%d ports, IRQ sharing %sabled\n", nr_uarts, | 3127 | "%d ports, IRQ sharing %sabled\n", nr_uarts, |
3128 | share_irqs ? "en" : "dis"); | 3128 | share_irqs ? "en" : "dis"); |
3129 | 3129 | ||
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 8b2c619a09f2..e642c22c80e2 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -1203,7 +1203,7 @@ static void e100_disable_txdma_channel(struct e100_serial *info) | |||
1203 | unsigned long flags; | 1203 | unsigned long flags; |
1204 | 1204 | ||
1205 | /* Disable output DMA channel for the serial port in question | 1205 | /* Disable output DMA channel for the serial port in question |
1206 | * ( set to something other then serialX) | 1206 | * ( set to something other than serialX) |
1207 | */ | 1207 | */ |
1208 | local_irq_save(flags); | 1208 | local_irq_save(flags); |
1209 | DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); | 1209 | DFLOW(DEBUG_LOG(info->line, "disable_txdma_channel %i\n", info->line)); |
@@ -1266,7 +1266,7 @@ static void e100_disable_rxdma_channel(struct e100_serial *info) | |||
1266 | unsigned long flags; | 1266 | unsigned long flags; |
1267 | 1267 | ||
1268 | /* Disable input DMA channel for the serial port in question | 1268 | /* Disable input DMA channel for the serial port in question |
1269 | * ( set to something other then serialX) | 1269 | * ( set to something other than serialX) |
1270 | */ | 1270 | */ |
1271 | local_irq_save(flags); | 1271 | local_irq_save(flags); |
1272 | if (info->line == 0) { | 1272 | if (info->line == 0) { |
diff --git a/drivers/spi/spi_lm70llp.c b/drivers/spi/spi_lm70llp.c index af6526767e2a..568c781ad91c 100644 --- a/drivers/spi/spi_lm70llp.c +++ b/drivers/spi/spi_lm70llp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * spi_lm70llp.c - driver for lm70llp eval board for the LM70 sensor | 2 | * spi_lm70llp.c - driver for LM70EVAL-LLP board for the LM70 sensor |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Kaiwan N Billimoria <kaiwan@designergraphix.com> | 4 | * Copyright (C) 2006 Kaiwan N Billimoria <kaiwan@designergraphix.com> |
5 | * | 5 | * |
@@ -40,8 +40,12 @@ | |||
40 | * master controller driver. The hwmon/lm70 driver is a "SPI protocol | 40 | * master controller driver. The hwmon/lm70 driver is a "SPI protocol |
41 | * driver", layered on top of this one and usable without the lm70llp. | 41 | * driver", layered on top of this one and usable without the lm70llp. |
42 | * | 42 | * |
43 | * Datasheet and Schematic: | ||
43 | * The LM70 is a temperature sensor chip from National Semiconductor; its | 44 | * The LM70 is a temperature sensor chip from National Semiconductor; its |
44 | * datasheet is available at http://www.national.com/pf/LM/LM70.html | 45 | * datasheet is available at http://www.national.com/pf/LM/LM70.html |
46 | * The schematic for this particular board (the LM70EVAL-LLP) is | ||
47 | * available (on page 4) here: | ||
48 | * http://www.national.com/appinfo/tempsensors/files/LM70LLPEVALmanual.pdf | ||
45 | * | 49 | * |
46 | * Also see Documentation/spi/spi-lm70llp. The SPI<->parport code here is | 50 | * Also see Documentation/spi/spi-lm70llp. The SPI<->parport code here is |
47 | * (heavily) based on spi-butterfly by David Brownell. | 51 | * (heavily) based on spi-butterfly by David Brownell. |
@@ -64,7 +68,7 @@ | |||
64 | * | 68 | * |
65 | * Note that parport pin 13 actually gets inverted by the transistor | 69 | * Note that parport pin 13 actually gets inverted by the transistor |
66 | * arrangement which lets either the parport or the LM70 drive the | 70 | * arrangement which lets either the parport or the LM70 drive the |
67 | * SI/SO signal. | 71 | * SI/SO signal (see the schematic for details). |
68 | */ | 72 | */ |
69 | 73 | ||
70 | #define DRVNAME "spi-lm70llp" | 74 | #define DRVNAME "spi-lm70llp" |
@@ -106,12 +110,16 @@ static inline struct spi_lm70llp *spidev_to_pp(struct spi_device *spi) | |||
106 | static inline void deassertCS(struct spi_lm70llp *pp) | 110 | static inline void deassertCS(struct spi_lm70llp *pp) |
107 | { | 111 | { |
108 | u8 data = parport_read_data(pp->port); | 112 | u8 data = parport_read_data(pp->port); |
113 | |||
114 | data &= ~0x80; /* pull D7/SI-out low while de-asserted */ | ||
109 | parport_write_data(pp->port, data | nCS); | 115 | parport_write_data(pp->port, data | nCS); |
110 | } | 116 | } |
111 | 117 | ||
112 | static inline void assertCS(struct spi_lm70llp *pp) | 118 | static inline void assertCS(struct spi_lm70llp *pp) |
113 | { | 119 | { |
114 | u8 data = parport_read_data(pp->port); | 120 | u8 data = parport_read_data(pp->port); |
121 | |||
122 | data |= 0x80; /* pull D7/SI-out high so lm70 drives SO-in */ | ||
115 | parport_write_data(pp->port, data & ~nCS); | 123 | parport_write_data(pp->port, data & ~nCS); |
116 | } | 124 | } |
117 | 125 | ||
@@ -184,22 +192,7 @@ static void lm70_chipselect(struct spi_device *spi, int value) | |||
184 | */ | 192 | */ |
185 | static u32 lm70_txrx(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits) | 193 | static u32 lm70_txrx(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits) |
186 | { | 194 | { |
187 | static u32 sio=0; | 195 | return bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits); |
188 | static int first_time=1; | ||
189 | |||
190 | /* First time: perform SPI bitbang and return the LSB of | ||
191 | * the result of the SPI call. | ||
192 | */ | ||
193 | if (first_time) { | ||
194 | sio = bitbang_txrx_be_cpha0(spi, nsecs, 0, word, bits); | ||
195 | first_time=0; | ||
196 | return (sio & 0x00ff); | ||
197 | } | ||
198 | /* Return the MSB of the result of the SPI call */ | ||
199 | else { | ||
200 | first_time=1; | ||
201 | return (sio >> 8); | ||
202 | } | ||
203 | } | 196 | } |
204 | 197 | ||
205 | static void spi_lm70llp_attach(struct parport *p) | 198 | static void spi_lm70llp_attach(struct parport *p) |
@@ -293,10 +286,9 @@ static void spi_lm70llp_attach(struct parport *p) | |||
293 | status = -ENODEV; | 286 | status = -ENODEV; |
294 | goto out_bitbang_stop; | 287 | goto out_bitbang_stop; |
295 | } | 288 | } |
296 | pp->spidev_lm70->bits_per_word = 16; | 289 | pp->spidev_lm70->bits_per_word = 8; |
297 | 290 | ||
298 | lm70llp = pp; | 291 | lm70llp = pp; |
299 | |||
300 | return; | 292 | return; |
301 | 293 | ||
302 | out_bitbang_stop: | 294 | out_bitbang_stop: |
@@ -326,7 +318,6 @@ static void spi_lm70llp_detach(struct parport *p) | |||
326 | 318 | ||
327 | /* power down */ | 319 | /* power down */ |
328 | parport_write_data(pp->port, 0); | 320 | parport_write_data(pp->port, 0); |
329 | msleep(10); | ||
330 | 321 | ||
331 | parport_release(pp->pd); | 322 | parport_release(pp->pd); |
332 | parport_unregister_device(pp->pd); | 323 | parport_unregister_device(pp->pd); |
diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c index 686795e97195..c7080d497311 100644 --- a/drivers/uwb/i1480/dfu/usb.c +++ b/drivers/uwb/i1480/dfu/usb.c | |||
@@ -387,7 +387,7 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id) | |||
387 | goto error_create; | 387 | goto error_create; |
388 | } | 388 | } |
389 | 389 | ||
390 | /* setup the fops and upload the firmare */ | 390 | /* setup the fops and upload the firmware */ |
391 | i1480->pre_fw_name = "i1480-pre-phy-0.0.bin"; | 391 | i1480->pre_fw_name = "i1480-pre-phy-0.0.bin"; |
392 | i1480->mac_fw_name = "i1480-usb-0.0.bin"; | 392 | i1480->mac_fw_name = "i1480-usb-0.0.bin"; |
393 | i1480->mac_fw_name_deprecate = "ptc-0.0.bin"; | 393 | i1480->mac_fw_name_deprecate = "ptc-0.0.bin"; |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index e6210725b9ab..d012edda6d11 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -1332,7 +1332,7 @@ static void vgacon_save_screen(struct vc_data *c) | |||
1332 | c->vc_y = screen_info.orig_y; | 1332 | c->vc_y = screen_info.orig_y; |
1333 | } | 1333 | } |
1334 | 1334 | ||
1335 | /* We can't copy in more then the size of the video buffer, | 1335 | /* We can't copy in more than the size of the video buffer, |
1336 | * or we'll be copying in VGA BIOS */ | 1336 | * or we'll be copying in VGA BIOS */ |
1337 | 1337 | ||
1338 | if (!vga_is_gfx) | 1338 | if (!vga_is_gfx) |