diff options
Diffstat (limited to 'drivers')
72 files changed, 1746 insertions, 637 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 0eae9b453556..5a4aad123c42 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1013,9 +1013,12 @@ next_sg: | |||
1013 | qc->cursg_ofs = 0; | 1013 | qc->cursg_ofs = 0; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | /* consumed can be larger than count only for the last transfer */ | 1016 | /* |
1017 | WARN_ON_ONCE(qc->cursg && count != consumed); | 1017 | * There used to be a WARN_ON_ONCE(qc->cursg && count != consumed); |
1018 | 1018 | * Unfortunately __atapi_pio_bytes doesn't know enough to do the WARN | |
1019 | * check correctly as it doesn't know if it is the last request being | ||
1020 | * made. Somebody should implement a proper sanity check. | ||
1021 | */ | ||
1019 | if (bytes) | 1022 | if (bytes) |
1020 | goto next_sg; | 1023 | goto next_sg; |
1021 | return 0; | 1024 | return 0; |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index f828a29d7756..f1bb2f9fecbf 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -80,7 +80,7 @@ | |||
80 | 80 | ||
81 | 81 | ||
82 | #define DRV_NAME "pata_it821x" | 82 | #define DRV_NAME "pata_it821x" |
83 | #define DRV_VERSION "0.4.0" | 83 | #define DRV_VERSION "0.4.2" |
84 | 84 | ||
85 | struct it821x_dev | 85 | struct it821x_dev |
86 | { | 86 | { |
@@ -494,8 +494,6 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus | |||
494 | * special. In our case we need to lock the sector count to avoid | 494 | * special. In our case we need to lock the sector count to avoid |
495 | * blowing the brains out of the firmware with large LBA48 requests | 495 | * blowing the brains out of the firmware with large LBA48 requests |
496 | * | 496 | * |
497 | * FIXME: When FUA appears we need to block FUA too. And SMART and | ||
498 | * basically we need to filter commands for this chip. | ||
499 | */ | 497 | */ |
500 | 498 | ||
501 | static void it821x_dev_config(struct ata_device *adev) | 499 | static void it821x_dev_config(struct ata_device *adev) |
@@ -890,6 +888,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
890 | .flags = ATA_FLAG_SLAVE_POSS, | 888 | .flags = ATA_FLAG_SLAVE_POSS, |
891 | .pio_mask = 0x1f, | 889 | .pio_mask = 0x1f, |
892 | .mwdma_mask = 0x07, | 890 | .mwdma_mask = 0x07, |
891 | .udma_mask = ATA_UDMA6, | ||
892 | .port_ops = &it821x_rdc_port_ops | ||
893 | }; | ||
894 | static const struct ata_port_info info_rdc_11 = { | ||
895 | .flags = ATA_FLAG_SLAVE_POSS, | ||
896 | .pio_mask = 0x1f, | ||
897 | .mwdma_mask = 0x07, | ||
893 | /* No UDMA */ | 898 | /* No UDMA */ |
894 | .port_ops = &it821x_rdc_port_ops | 899 | .port_ops = &it821x_rdc_port_ops |
895 | }; | 900 | }; |
@@ -903,7 +908,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
903 | return rc; | 908 | return rc; |
904 | 909 | ||
905 | if (pdev->vendor == PCI_VENDOR_ID_RDC) { | 910 | if (pdev->vendor == PCI_VENDOR_ID_RDC) { |
906 | ppi[0] = &info_rdc; | 911 | /* Deal with Vortex86SX */ |
912 | if (pdev->revision == 0x11) | ||
913 | ppi[0] = &info_rdc_11; | ||
914 | else | ||
915 | ppi[0] = &info_rdc; | ||
907 | } else { | 916 | } else { |
908 | /* Force the card into bypass mode if so requested */ | 917 | /* Force the card into bypass mode if so requested */ |
909 | if (it8212_noraid) { | 918 | if (it8212_noraid) { |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 7bcc1d8bc967..34f80fa6fed1 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -406,6 +406,7 @@ static int nbd_do_it(struct nbd_device *lo) | |||
406 | ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); | 406 | ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); |
407 | if (ret) { | 407 | if (ret) { |
408 | printk(KERN_ERR "nbd: sysfs_create_file failed!"); | 408 | printk(KERN_ERR "nbd: sysfs_create_file failed!"); |
409 | lo->pid = 0; | ||
409 | return ret; | 410 | return ret; |
410 | } | 411 | } |
411 | 412 | ||
@@ -413,6 +414,7 @@ static int nbd_do_it(struct nbd_device *lo) | |||
413 | nbd_end_request(req); | 414 | nbd_end_request(req); |
414 | 415 | ||
415 | sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); | 416 | sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); |
417 | lo->pid = 0; | ||
416 | return 0; | 418 | return 0; |
417 | } | 419 | } |
418 | 420 | ||
@@ -648,6 +650,8 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode, | |||
648 | set_capacity(lo->disk, lo->bytesize >> 9); | 650 | set_capacity(lo->disk, lo->bytesize >> 9); |
649 | return 0; | 651 | return 0; |
650 | case NBD_DO_IT: | 652 | case NBD_DO_IT: |
653 | if (lo->pid) | ||
654 | return -EBUSY; | ||
651 | if (!lo->file) | 655 | if (!lo->file) |
652 | return -EINVAL; | 656 | return -EINVAL; |
653 | thread = kthread_create(nbd_thread, lo, lo->disk->disk_name); | 657 | thread = kthread_create(nbd_thread, lo, lo->disk->disk_name); |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 29e1dfafb7c6..381d686fc1a3 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -1206,6 +1206,7 @@ static struct of_device_id ace_of_match[] __devinitdata = { | |||
1206 | { .compatible = "xlnx,opb-sysace-1.00.b", }, | 1206 | { .compatible = "xlnx,opb-sysace-1.00.b", }, |
1207 | { .compatible = "xlnx,opb-sysace-1.00.c", }, | 1207 | { .compatible = "xlnx,opb-sysace-1.00.c", }, |
1208 | { .compatible = "xlnx,xps-sysace-1.00.a", }, | 1208 | { .compatible = "xlnx,xps-sysace-1.00.a", }, |
1209 | { .compatible = "xlnx,sysace", }, | ||
1209 | {}, | 1210 | {}, |
1210 | }; | 1211 | }; |
1211 | MODULE_DEVICE_TABLE(of, ace_of_match); | 1212 | MODULE_DEVICE_TABLE(of, ace_of_match); |
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c index 977dfb1096a0..f6094ae0ef33 100644 --- a/drivers/char/bsr.c +++ b/drivers/char/bsr.c | |||
@@ -103,7 +103,7 @@ static ssize_t | |||
103 | bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf) | 103 | bsr_len_show(struct device *dev, struct device_attribute *attr, char *buf) |
104 | { | 104 | { |
105 | struct bsr_dev *bsr_dev = dev_get_drvdata(dev); | 105 | struct bsr_dev *bsr_dev = dev_get_drvdata(dev); |
106 | return sprintf(buf, "%lu\n", bsr_dev->bsr_len); | 106 | return sprintf(buf, "%llu\n", bsr_dev->bsr_len); |
107 | } | 107 | } |
108 | 108 | ||
109 | static struct device_attribute bsr_dev_attrs[] = { | 109 | static struct device_attribute bsr_dev_attrs[] = { |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 5a8a4c28c867..09676b4e5d89 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -318,7 +318,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) | |||
318 | } /* else count == 0 */ | 318 | } /* else count == 0 */ |
319 | 319 | ||
320 | tty->driver_data = hp; | 320 | tty->driver_data = hp; |
321 | tty->low_latency = 1; /* Makes flushes to ldisc synchronous. */ | 321 | if (!hp->irq_requested) |
322 | tty->low_latency = 1; /* Makes flushes to ldisc synchronous. */ | ||
322 | 323 | ||
323 | hp->tty = tty; | 324 | hp->tty = tty; |
324 | 325 | ||
@@ -764,13 +765,11 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int data, | |||
764 | return ERR_PTR(err); | 765 | return ERR_PTR(err); |
765 | } | 766 | } |
766 | 767 | ||
767 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, | 768 | hp = kzalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, |
768 | GFP_KERNEL); | 769 | GFP_KERNEL); |
769 | if (!hp) | 770 | if (!hp) |
770 | return ERR_PTR(-ENOMEM); | 771 | return ERR_PTR(-ENOMEM); |
771 | 772 | ||
772 | memset(hp, 0x00, sizeof(*hp)); | ||
773 | |||
774 | hp->vtermno = vtermno; | 773 | hp->vtermno = vtermno; |
775 | hp->data = data; | 774 | hp->data = data; |
776 | hp->ops = ops; | 775 | hp->ops = ops; |
@@ -876,8 +875,11 @@ static int hvc_init(void) | |||
876 | goto stop_thread; | 875 | goto stop_thread; |
877 | } | 876 | } |
878 | 877 | ||
879 | /* FIXME: This mb() seems completely random. Remove it. */ | 878 | /* |
880 | mb(); | 879 | * Make sure tty is fully registered before allowing it to be |
880 | * found by hvc_console_device. | ||
881 | */ | ||
882 | smp_mb(); | ||
881 | hvc_driver = drv; | 883 | hvc_driver = drv; |
882 | return 0; | 884 | return 0; |
883 | 885 | ||
diff --git a/drivers/char/hvc_irq.c b/drivers/char/hvc_irq.c index d09e5688d449..2623e177e8d6 100644 --- a/drivers/char/hvc_irq.c +++ b/drivers/char/hvc_irq.c | |||
@@ -37,7 +37,7 @@ int notifier_add_irq(struct hvc_struct *hp, int irq) | |||
37 | 37 | ||
38 | void notifier_del_irq(struct hvc_struct *hp, int irq) | 38 | void notifier_del_irq(struct hvc_struct *hp, int irq) |
39 | { | 39 | { |
40 | if (!irq) | 40 | if (!hp->irq_requested) |
41 | return; | 41 | return; |
42 | free_irq(irq, hp); | 42 | free_irq(irq, hp); |
43 | hp->irq_requested = 0; | 43 | hp->irq_requested = 0; |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 53544e21f191..f329f459817c 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: synclink_gt.c,v 4.50 2007/07/25 19:29:25 paulkf Exp $ | ||
3 | * | ||
4 | * Device driver for Microgate SyncLink GT serial adapters. | 2 | * Device driver for Microgate SyncLink GT serial adapters. |
5 | * | 3 | * |
6 | * written by Paul Fulghum for Microgate Corporation | 4 | * written by Paul Fulghum for Microgate Corporation |
@@ -91,7 +89,6 @@ | |||
91 | * module identification | 89 | * module identification |
92 | */ | 90 | */ |
93 | static char *driver_name = "SyncLink GT"; | 91 | static char *driver_name = "SyncLink GT"; |
94 | static char *driver_version = "$Revision: 4.50 $"; | ||
95 | static char *tty_driver_name = "synclink_gt"; | 92 | static char *tty_driver_name = "synclink_gt"; |
96 | static char *tty_dev_prefix = "ttySLG"; | 93 | static char *tty_dev_prefix = "ttySLG"; |
97 | MODULE_LICENSE("GPL"); | 94 | MODULE_LICENSE("GPL"); |
@@ -1309,7 +1306,7 @@ static int read_proc(char *page, char **start, off_t off, int count, | |||
1309 | off_t begin = 0; | 1306 | off_t begin = 0; |
1310 | struct slgt_info *info; | 1307 | struct slgt_info *info; |
1311 | 1308 | ||
1312 | len += sprintf(page, "synclink_gt driver:%s\n", driver_version); | 1309 | len += sprintf(page, "synclink_gt driver\n"); |
1313 | 1310 | ||
1314 | info = slgt_device_list; | 1311 | info = slgt_device_list; |
1315 | while( info ) { | 1312 | while( info ) { |
@@ -2441,7 +2438,7 @@ static void program_hw(struct slgt_info *info) | |||
2441 | info->ri_chkcount = 0; | 2438 | info->ri_chkcount = 0; |
2442 | info->dsr_chkcount = 0; | 2439 | info->dsr_chkcount = 0; |
2443 | 2440 | ||
2444 | slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR); | 2441 | slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI); |
2445 | get_signals(info); | 2442 | get_signals(info); |
2446 | 2443 | ||
2447 | if (info->netcount || | 2444 | if (info->netcount || |
@@ -3576,7 +3573,7 @@ static void slgt_cleanup(void) | |||
3576 | struct slgt_info *info; | 3573 | struct slgt_info *info; |
3577 | struct slgt_info *tmp; | 3574 | struct slgt_info *tmp; |
3578 | 3575 | ||
3579 | printk("unload %s %s\n", driver_name, driver_version); | 3576 | printk(KERN_INFO "unload %s\n", driver_name); |
3580 | 3577 | ||
3581 | if (serial_driver) { | 3578 | if (serial_driver) { |
3582 | for (info=slgt_device_list ; info != NULL ; info=info->next_device) | 3579 | for (info=slgt_device_list ; info != NULL ; info=info->next_device) |
@@ -3619,7 +3616,7 @@ static int __init slgt_init(void) | |||
3619 | { | 3616 | { |
3620 | int rc; | 3617 | int rc; |
3621 | 3618 | ||
3622 | printk("%s %s\n", driver_name, driver_version); | 3619 | printk(KERN_INFO "%s\n", driver_name); |
3623 | 3620 | ||
3624 | serial_driver = alloc_tty_driver(MAX_DEVICES); | 3621 | serial_driver = alloc_tty_driver(MAX_DEVICES); |
3625 | if (!serial_driver) { | 3622 | if (!serial_driver) { |
@@ -3650,9 +3647,8 @@ static int __init slgt_init(void) | |||
3650 | goto error; | 3647 | goto error; |
3651 | } | 3648 | } |
3652 | 3649 | ||
3653 | printk("%s %s, tty major#%d\n", | 3650 | printk(KERN_INFO "%s, tty major#%d\n", |
3654 | driver_name, driver_version, | 3651 | driver_name, serial_driver->major); |
3655 | serial_driver->major); | ||
3656 | 3652 | ||
3657 | slgt_device_count = 0; | 3653 | slgt_device_count = 0; |
3658 | if ((rc = pci_register_driver(&pci_driver)) < 0) { | 3654 | if ((rc = pci_register_driver(&pci_driver)) < 0) { |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index d41b9f6f7903..33a9351c896d 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -473,6 +473,12 @@ void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) | |||
473 | unsigned long flags; | 473 | unsigned long flags; |
474 | 474 | ||
475 | spin_lock_irqsave(&sysrq_key_table_lock, flags); | 475 | spin_lock_irqsave(&sysrq_key_table_lock, flags); |
476 | /* | ||
477 | * Raise the apparent loglevel to maximum so that the sysrq header | ||
478 | * is shown to provide the user with positive feedback. We do not | ||
479 | * simply emit this at KERN_EMERG as that would change message | ||
480 | * routing in the consumers of /proc/kmsg. | ||
481 | */ | ||
476 | orig_log_level = console_loglevel; | 482 | orig_log_level = console_loglevel; |
477 | console_loglevel = 7; | 483 | console_loglevel = 7; |
478 | printk(KERN_INFO "SysRq : "); | 484 | printk(KERN_INFO "SysRq : "); |
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index a408c8e487ec..6f4c7d0a53bf 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -1057,7 +1057,7 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg) | |||
1057 | if (retval) | 1057 | if (retval) |
1058 | return retval; | 1058 | return retval; |
1059 | 1059 | ||
1060 | ld = tty_ldisc_ref(tty); | 1060 | ld = tty_ldisc_ref_wait(tty); |
1061 | switch (arg) { | 1061 | switch (arg) { |
1062 | case TCIFLUSH: | 1062 | case TCIFLUSH: |
1063 | if (ld && ld->ops->flush_buffer) | 1063 | if (ld && ld->ops->flush_buffer) |
diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c index 8b24d784db93..3e7f4e06386e 100644 --- a/drivers/gpio/max7301.c +++ b/drivers/gpio/max7301.c | |||
@@ -217,8 +217,10 @@ static int __devinit max7301_probe(struct spi_device *spi) | |||
217 | int i, ret; | 217 | int i, ret; |
218 | 218 | ||
219 | pdata = spi->dev.platform_data; | 219 | pdata = spi->dev.platform_data; |
220 | if (!pdata || !pdata->base) | 220 | if (!pdata || !pdata->base) { |
221 | return -ENODEV; | 221 | dev_dbg(&spi->dev, "incorrect or missing platform data\n"); |
222 | return -EINVAL; | ||
223 | } | ||
222 | 224 | ||
223 | /* | 225 | /* |
224 | * bits_per_word cannot be configured in platform data | 226 | * bits_per_word cannot be configured in platform data |
diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c index 55ae9a41897a..f7868243af89 100644 --- a/drivers/gpio/max732x.c +++ b/drivers/gpio/max732x.c | |||
@@ -267,8 +267,10 @@ static int __devinit max732x_probe(struct i2c_client *client, | |||
267 | int ret, nr_port; | 267 | int ret, nr_port; |
268 | 268 | ||
269 | pdata = client->dev.platform_data; | 269 | pdata = client->dev.platform_data; |
270 | if (pdata == NULL) | 270 | if (pdata == NULL) { |
271 | return -ENODEV; | 271 | dev_dbg(&client->dev, "no platform data\n"); |
272 | return -EINVAL; | ||
273 | } | ||
272 | 274 | ||
273 | chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL); | 275 | chip = kzalloc(sizeof(struct max732x_chip), GFP_KERNEL); |
274 | if (chip == NULL) | 276 | if (chip == NULL) |
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c index 89c1d222e9d1..f6fae0e50e65 100644 --- a/drivers/gpio/mcp23s08.c +++ b/drivers/gpio/mcp23s08.c | |||
@@ -310,8 +310,10 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
310 | unsigned base; | 310 | unsigned base; |
311 | 311 | ||
312 | pdata = spi->dev.platform_data; | 312 | pdata = spi->dev.platform_data; |
313 | if (!pdata || !gpio_is_valid(pdata->base)) | 313 | if (!pdata || !gpio_is_valid(pdata->base)) { |
314 | return -ENODEV; | 314 | dev_dbg(&spi->dev, "invalid or missing platform data\n"); |
315 | return -EINVAL; | ||
316 | } | ||
315 | 317 | ||
316 | for (addr = 0; addr < 4; addr++) { | 318 | for (addr = 0; addr < 4; addr++) { |
317 | if (!pdata->chip[addr].is_present) | 319 | if (!pdata->chip[addr].is_present) |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 37f35388a2ae..8dc0164bd51e 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -202,8 +202,10 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
202 | int ret; | 202 | int ret; |
203 | 203 | ||
204 | pdata = client->dev.platform_data; | 204 | pdata = client->dev.platform_data; |
205 | if (pdata == NULL) | 205 | if (pdata == NULL) { |
206 | return -ENODEV; | 206 | dev_dbg(&client->dev, "no platform data\n"); |
207 | return -EINVAL; | ||
208 | } | ||
207 | 209 | ||
208 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); | 210 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); |
209 | if (chip == NULL) | 211 | if (chip == NULL) |
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c index 4bc2070dd4a1..9525724be731 100644 --- a/drivers/gpio/pcf857x.c +++ b/drivers/gpio/pcf857x.c | |||
@@ -188,8 +188,10 @@ static int pcf857x_probe(struct i2c_client *client, | |||
188 | int status; | 188 | int status; |
189 | 189 | ||
190 | pdata = client->dev.platform_data; | 190 | pdata = client->dev.platform_data; |
191 | if (!pdata) | 191 | if (!pdata) { |
192 | return -ENODEV; | 192 | dev_dbg(&client->dev, "no platform data\n"); |
193 | return -EINVAL; | ||
194 | } | ||
193 | 195 | ||
194 | /* Allocate, initialize, and register this gpio_chip. */ | 196 | /* Allocate, initialize, and register this gpio_chip. */ |
195 | gpio = kzalloc(sizeof *gpio, GFP_KERNEL); | 197 | gpio = kzalloc(sizeof *gpio, GFP_KERNEL); |
@@ -248,8 +250,10 @@ static int pcf857x_probe(struct i2c_client *client, | |||
248 | else | 250 | else |
249 | status = i2c_read_le16(client); | 251 | status = i2c_read_le16(client); |
250 | 252 | ||
251 | } else | 253 | } else { |
252 | status = -ENODEV; | 254 | dev_dbg(&client->dev, "unsupported number of gpios\n"); |
255 | status = -EINVAL; | ||
256 | } | ||
253 | 257 | ||
254 | if (status < 0) | 258 | if (status < 0) |
255 | goto fail; | 259 | goto fail; |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 4b33bc82cc24..b84bf066879b 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -189,6 +189,16 @@ config SENSORS_ADT7473 | |||
189 | This driver can also be built as a module. If so, the module | 189 | This driver can also be built as a module. If so, the module |
190 | will be called adt7473. | 190 | will be called adt7473. |
191 | 191 | ||
192 | config SENSORS_ADT7475 | ||
193 | tristate "Analog Devices ADT7475" | ||
194 | depends on I2C && EXPERIMENTAL | ||
195 | help | ||
196 | If you say yes here you get support for the Analog Devices | ||
197 | ADT7475 hardware monitoring chips. | ||
198 | |||
199 | This driver can also be build as a module. If so, the module | ||
200 | will be called adt7475. | ||
201 | |||
192 | config SENSORS_K8TEMP | 202 | config SENSORS_K8TEMP |
193 | tristate "AMD Athlon64/FX or Opteron temperature sensor" | 203 | tristate "AMD Athlon64/FX or Opteron temperature sensor" |
194 | depends on X86 && PCI && EXPERIMENTAL | 204 | depends on X86 && PCI && EXPERIMENTAL |
@@ -861,6 +871,8 @@ config SENSORS_HDAPS | |||
861 | config SENSORS_LIS3LV02D | 871 | config SENSORS_LIS3LV02D |
862 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" | 872 | tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer" |
863 | depends on ACPI && INPUT | 873 | depends on ACPI && INPUT |
874 | select NEW_LEDS | ||
875 | select LEDS_CLASS | ||
864 | default n | 876 | default n |
865 | help | 877 | help |
866 | This driver provides support for the LIS3LV02Dx accelerometer. In | 878 | This driver provides support for the LIS3LV02Dx accelerometer. In |
@@ -872,10 +884,16 @@ config SENSORS_LIS3LV02D | |||
872 | /sys/devices/platform/lis3lv02d. | 884 | /sys/devices/platform/lis3lv02d. |
873 | 885 | ||
874 | This driver also provides an absolute input class device, allowing | 886 | This driver also provides an absolute input class device, allowing |
875 | the laptop to act as a pinball machine-esque joystick. | 887 | the laptop to act as a pinball machine-esque joystick. On HP laptops, |
888 | if the led infrastructure is activated, support for a led indicating | ||
889 | disk protection will be provided as hp:red:hddprotection. | ||
876 | 890 | ||
877 | This driver can also be built as a module. If so, the module | 891 | This driver can also be built as modules. If so, the core module |
878 | will be called lis3lv02d. | 892 | will be called lis3lv02d and a specific module for HP laptops will be |
893 | called hp_accel. | ||
894 | |||
895 | Say Y here if you have an applicable laptop and want to experience | ||
896 | the awesome power of lis3lv02d. | ||
879 | 897 | ||
880 | config SENSORS_APPLESMC | 898 | config SENSORS_APPLESMC |
881 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" | 899 | tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)" |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 19cb1ace3eb4..2e80f37f39eb 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
@@ -28,6 +28,8 @@ obj-$(CONFIG_SENSORS_ADS7828) += ads7828.o | |||
28 | obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o | 28 | obj-$(CONFIG_SENSORS_ADT7462) += adt7462.o |
29 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o | 29 | obj-$(CONFIG_SENSORS_ADT7470) += adt7470.o |
30 | obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o | 30 | obj-$(CONFIG_SENSORS_ADT7473) += adt7473.o |
31 | obj-$(CONFIG_SENSORS_ADT7475) += adt7475.o | ||
32 | |||
31 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o | 33 | obj-$(CONFIG_SENSORS_APPLESMC) += applesmc.o |
32 | obj-$(CONFIG_SENSORS_AMS) += ams/ | 34 | obj-$(CONFIG_SENSORS_AMS) += ams/ |
33 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o | 35 | obj-$(CONFIG_SENSORS_ATXP1) += atxp1.o |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index 70bb854086df..e52b38806d03 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
279 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, | 279 | { "OTES1 Fan", 36, 2, 60, 1, 0 }, |
280 | { NULL, 0, 0, 0, 0, 0 } } | 280 | { NULL, 0, 0, 0, 0, 0 } } |
281 | }, | 281 | }, |
282 | { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", { | 282 | { 0x0011, "AT8 32X", { |
283 | { "CPU Core", 0, 0, 10, 1, 0 }, | 283 | { "CPU Core", 0, 0, 10, 1, 0 }, |
284 | { "DDR", 1, 0, 20, 1, 0 }, | 284 | { "DDR", 1, 0, 20, 1, 0 }, |
285 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 285 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -402,7 +402,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
402 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 402 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
403 | { NULL, 0, 0, 0, 0, 0 } } | 403 | { NULL, 0, 0, 0, 0, 0 } } |
404 | }, | 404 | }, |
405 | { 0x0016, "AW9D-MAX (Intel i975-ICH7)", { | 405 | { 0x0016, "AW9D-MAX", { |
406 | { "CPU Core", 0, 0, 10, 1, 0 }, | 406 | { "CPU Core", 0, 0, 10, 1, 0 }, |
407 | { "DDR2", 1, 0, 20, 1, 0 }, | 407 | { "DDR2", 1, 0, 20, 1, 0 }, |
408 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 408 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -482,7 +482,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
482 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 482 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
483 | { NULL, 0, 0, 0, 0, 0 } } | 483 | { NULL, 0, 0, 0, 0, 0 } } |
484 | }, | 484 | }, |
485 | { 0x0019, NULL /* Unknown, need DMI string */, { | 485 | { 0x0019, "IN9 32X MAX", { |
486 | { "CPU Core", 7, 0, 10, 1, 0 }, | 486 | { "CPU Core", 7, 0, 10, 1, 0 }, |
487 | { "DDR2", 13, 0, 20, 1, 0 }, | 487 | { "DDR2", 13, 0, 20, 1, 0 }, |
488 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, | 488 | { "DDR2 VTT", 14, 0, 10, 1, 0 }, |
@@ -509,7 +509,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
509 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, | 509 | { "AUX3 FAN", 36, 2, 60, 1, 0 }, |
510 | { NULL, 0, 0, 0, 0, 0 } } | 510 | { NULL, 0, 0, 0, 0, 0 } } |
511 | }, | 511 | }, |
512 | { 0x001A, "IP35 Pro(Intel P35-ICH9R)", { | 512 | { 0x001A, "IP35 Pro", { |
513 | { "CPU Core", 0, 0, 10, 1, 0 }, | 513 | { "CPU Core", 0, 0, 10, 1, 0 }, |
514 | { "DDR2", 1, 0, 20, 1, 0 }, | 514 | { "DDR2", 1, 0, 20, 1, 0 }, |
515 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 515 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -1128,6 +1128,7 @@ static int __init abituguru3_dmi_detect(void) | |||
1128 | { | 1128 | { |
1129 | const char *board_vendor, *board_name; | 1129 | const char *board_vendor, *board_name; |
1130 | int i, err = (force) ? 1 : -ENODEV; | 1130 | int i, err = (force) ? 1 : -ENODEV; |
1131 | size_t sublen; | ||
1131 | 1132 | ||
1132 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); | 1133 | board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR); |
1133 | if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) | 1134 | if (!board_vendor || strcmp(board_vendor, "http://www.abit.com.tw/")) |
@@ -1137,9 +1138,20 @@ static int __init abituguru3_dmi_detect(void) | |||
1137 | if (!board_name) | 1138 | if (!board_name) |
1138 | return err; | 1139 | return err; |
1139 | 1140 | ||
1141 | /* At the moment, we don't care about the part of the vendor | ||
1142 | * DMI string contained in brackets. Truncate the string at | ||
1143 | * the first occurrence of a bracket. Trim any trailing space | ||
1144 | * from the substring. | ||
1145 | */ | ||
1146 | sublen = strcspn(board_name, "("); | ||
1147 | while (sublen > 0 && board_name[sublen - 1] == ' ') | ||
1148 | sublen--; | ||
1149 | |||
1140 | for (i = 0; abituguru3_motherboards[i].id; i++) { | 1150 | for (i = 0; abituguru3_motherboards[i].id; i++) { |
1141 | const char *dmi_name = abituguru3_motherboards[i].dmi_name; | 1151 | const char *dmi_name = abituguru3_motherboards[i].dmi_name; |
1142 | if (dmi_name && !strcmp(dmi_name, board_name)) | 1152 | if (!dmi_name || strlen(dmi_name) != sublen) |
1153 | continue; | ||
1154 | if (!strncasecmp(board_name, dmi_name, sublen)) | ||
1143 | break; | 1155 | break; |
1144 | } | 1156 | } |
1145 | 1157 | ||
@@ -1153,7 +1165,7 @@ static int __init abituguru3_dmi_detect(void) | |||
1153 | 1165 | ||
1154 | static inline int abituguru3_dmi_detect(void) | 1166 | static inline int abituguru3_dmi_detect(void) |
1155 | { | 1167 | { |
1156 | return -ENODEV; | 1168 | return 1; |
1157 | } | 1169 | } |
1158 | 1170 | ||
1159 | #endif /* CONFIG_DMI */ | 1171 | #endif /* CONFIG_DMI */ |
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c new file mode 100644 index 000000000000..d39877a7da63 --- /dev/null +++ b/drivers/hwmon/adt7475.c | |||
@@ -0,0 +1,1221 @@ | |||
1 | /* | ||
2 | * adt7475 - Thermal sensor driver for the ADT7475 chip and derivatives | ||
3 | * Copyright (C) 2007-2008, Advanced Micro Devices, Inc. | ||
4 | * Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net> | ||
5 | * Copyright (C) 2008 Hans de Goede <hdegoede@redhat.com> | ||
6 | |||
7 | * Derived from the lm83 driver by Jean Delvare | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include <linux/i2c.h> | ||
18 | #include <linux/hwmon.h> | ||
19 | #include <linux/hwmon-sysfs.h> | ||
20 | #include <linux/err.h> | ||
21 | |||
22 | /* Indexes for the sysfs hooks */ | ||
23 | |||
24 | #define INPUT 0 | ||
25 | #define MIN 1 | ||
26 | #define MAX 2 | ||
27 | #define CONTROL 3 | ||
28 | #define OFFSET 3 | ||
29 | #define AUTOMIN 4 | ||
30 | #define THERM 5 | ||
31 | #define HYSTERSIS 6 | ||
32 | |||
33 | /* These are unique identifiers for the sysfs functions - unlike the | ||
34 | numbers above, these are not also indexes into an array | ||
35 | */ | ||
36 | |||
37 | #define ALARM 9 | ||
38 | #define FAULT 10 | ||
39 | |||
40 | /* 7475 Common Registers */ | ||
41 | |||
42 | #define REG_VOLTAGE_BASE 0x21 | ||
43 | #define REG_TEMP_BASE 0x25 | ||
44 | #define REG_TACH_BASE 0x28 | ||
45 | #define REG_PWM_BASE 0x30 | ||
46 | #define REG_PWM_MAX_BASE 0x38 | ||
47 | |||
48 | #define REG_DEVID 0x3D | ||
49 | #define REG_VENDID 0x3E | ||
50 | |||
51 | #define REG_STATUS1 0x41 | ||
52 | #define REG_STATUS2 0x42 | ||
53 | |||
54 | #define REG_VOLTAGE_MIN_BASE 0x46 | ||
55 | #define REG_VOLTAGE_MAX_BASE 0x47 | ||
56 | |||
57 | #define REG_TEMP_MIN_BASE 0x4E | ||
58 | #define REG_TEMP_MAX_BASE 0x4F | ||
59 | |||
60 | #define REG_TACH_MIN_BASE 0x54 | ||
61 | |||
62 | #define REG_PWM_CONFIG_BASE 0x5C | ||
63 | |||
64 | #define REG_TEMP_TRANGE_BASE 0x5F | ||
65 | |||
66 | #define REG_PWM_MIN_BASE 0x64 | ||
67 | |||
68 | #define REG_TEMP_TMIN_BASE 0x67 | ||
69 | #define REG_TEMP_THERM_BASE 0x6A | ||
70 | |||
71 | #define REG_REMOTE1_HYSTERSIS 0x6D | ||
72 | #define REG_REMOTE2_HYSTERSIS 0x6E | ||
73 | |||
74 | #define REG_TEMP_OFFSET_BASE 0x70 | ||
75 | |||
76 | #define REG_EXTEND1 0x76 | ||
77 | #define REG_EXTEND2 0x77 | ||
78 | #define REG_CONFIG5 0x7C | ||
79 | |||
80 | #define CONFIG5_TWOSCOMP 0x01 | ||
81 | #define CONFIG5_TEMPOFFSET 0x02 | ||
82 | |||
83 | /* ADT7475 Settings */ | ||
84 | |||
85 | #define ADT7475_VOLTAGE_COUNT 2 | ||
86 | #define ADT7475_TEMP_COUNT 3 | ||
87 | #define ADT7475_TACH_COUNT 4 | ||
88 | #define ADT7475_PWM_COUNT 3 | ||
89 | |||
90 | /* Macro to read the registers */ | ||
91 | |||
92 | #define adt7475_read(reg) i2c_smbus_read_byte_data(client, (reg)) | ||
93 | |||
94 | /* Macros to easily index the registers */ | ||
95 | |||
96 | #define TACH_REG(idx) (REG_TACH_BASE + ((idx) * 2)) | ||
97 | #define TACH_MIN_REG(idx) (REG_TACH_MIN_BASE + ((idx) * 2)) | ||
98 | |||
99 | #define PWM_REG(idx) (REG_PWM_BASE + (idx)) | ||
100 | #define PWM_MAX_REG(idx) (REG_PWM_MAX_BASE + (idx)) | ||
101 | #define PWM_MIN_REG(idx) (REG_PWM_MIN_BASE + (idx)) | ||
102 | #define PWM_CONFIG_REG(idx) (REG_PWM_CONFIG_BASE + (idx)) | ||
103 | |||
104 | #define VOLTAGE_REG(idx) (REG_VOLTAGE_BASE + (idx)) | ||
105 | #define VOLTAGE_MIN_REG(idx) (REG_VOLTAGE_MIN_BASE + ((idx) * 2)) | ||
106 | #define VOLTAGE_MAX_REG(idx) (REG_VOLTAGE_MAX_BASE + ((idx) * 2)) | ||
107 | |||
108 | #define TEMP_REG(idx) (REG_TEMP_BASE + (idx)) | ||
109 | #define TEMP_MIN_REG(idx) (REG_TEMP_MIN_BASE + ((idx) * 2)) | ||
110 | #define TEMP_MAX_REG(idx) (REG_TEMP_MAX_BASE + ((idx) * 2)) | ||
111 | #define TEMP_TMIN_REG(idx) (REG_TEMP_TMIN_BASE + (idx)) | ||
112 | #define TEMP_THERM_REG(idx) (REG_TEMP_THERM_BASE + (idx)) | ||
113 | #define TEMP_OFFSET_REG(idx) (REG_TEMP_OFFSET_BASE + (idx)) | ||
114 | #define TEMP_TRANGE_REG(idx) (REG_TEMP_TRANGE_BASE + (idx)) | ||
115 | |||
116 | static unsigned short normal_i2c[] = { 0x2e, I2C_CLIENT_END }; | ||
117 | |||
118 | I2C_CLIENT_INSMOD_1(adt7475); | ||
119 | |||
120 | static const struct i2c_device_id adt7475_id[] = { | ||
121 | { "adt7475", adt7475 }, | ||
122 | { } | ||
123 | }; | ||
124 | MODULE_DEVICE_TABLE(i2c, adt7475_id); | ||
125 | |||
126 | struct adt7475_data { | ||
127 | struct device *hwmon_dev; | ||
128 | struct mutex lock; | ||
129 | |||
130 | unsigned long measure_updated; | ||
131 | unsigned long limits_updated; | ||
132 | char valid; | ||
133 | |||
134 | u8 config5; | ||
135 | u16 alarms; | ||
136 | u16 voltage[3][3]; | ||
137 | u16 temp[7][3]; | ||
138 | u16 tach[2][4]; | ||
139 | u8 pwm[4][3]; | ||
140 | u8 range[3]; | ||
141 | u8 pwmctl[3]; | ||
142 | u8 pwmchan[3]; | ||
143 | }; | ||
144 | |||
145 | static struct i2c_driver adt7475_driver; | ||
146 | static struct adt7475_data *adt7475_update_device(struct device *dev); | ||
147 | static void adt7475_read_hystersis(struct i2c_client *client); | ||
148 | static void adt7475_read_pwm(struct i2c_client *client, int index); | ||
149 | |||
150 | /* Given a temp value, convert it to register value */ | ||
151 | |||
152 | static inline u16 temp2reg(struct adt7475_data *data, long val) | ||
153 | { | ||
154 | u16 ret; | ||
155 | |||
156 | if (!(data->config5 & CONFIG5_TWOSCOMP)) { | ||
157 | val = SENSORS_LIMIT(val, -64000, 191000); | ||
158 | ret = (val + 64500) / 1000; | ||
159 | } else { | ||
160 | val = SENSORS_LIMIT(val, -128000, 127000); | ||
161 | if (val < -500) | ||
162 | ret = (256500 + val) / 1000; | ||
163 | else | ||
164 | ret = (val + 500) / 1000; | ||
165 | } | ||
166 | |||
167 | return ret << 2; | ||
168 | } | ||
169 | |||
170 | /* Given a register value, convert it to a real temp value */ | ||
171 | |||
172 | static inline int reg2temp(struct adt7475_data *data, u16 reg) | ||
173 | { | ||
174 | if (data->config5 & CONFIG5_TWOSCOMP) { | ||
175 | if (reg >= 512) | ||
176 | return (reg - 1024) * 250; | ||
177 | else | ||
178 | return reg * 250; | ||
179 | } else | ||
180 | return (reg - 256) * 250; | ||
181 | } | ||
182 | |||
183 | static inline int tach2rpm(u16 tach) | ||
184 | { | ||
185 | if (tach == 0 || tach == 0xFFFF) | ||
186 | return 0; | ||
187 | |||
188 | return (90000 * 60) / tach; | ||
189 | } | ||
190 | |||
191 | static inline u16 rpm2tach(unsigned long rpm) | ||
192 | { | ||
193 | if (rpm == 0) | ||
194 | return 0; | ||
195 | |||
196 | return SENSORS_LIMIT((90000 * 60) / rpm, 1, 0xFFFF); | ||
197 | } | ||
198 | |||
199 | static inline int reg2vcc(u16 reg) | ||
200 | { | ||
201 | return (4296 * reg) / 1000; | ||
202 | } | ||
203 | |||
204 | static inline int reg2vccp(u16 reg) | ||
205 | { | ||
206 | return (2929 * reg) / 1000; | ||
207 | } | ||
208 | |||
209 | static inline u16 vcc2reg(long vcc) | ||
210 | { | ||
211 | vcc = SENSORS_LIMIT(vcc, 0, 4396); | ||
212 | return (vcc * 1000) / 4296; | ||
213 | } | ||
214 | |||
215 | static inline u16 vccp2reg(long vcc) | ||
216 | { | ||
217 | vcc = SENSORS_LIMIT(vcc, 0, 2998); | ||
218 | return (vcc * 1000) / 2929; | ||
219 | } | ||
220 | |||
221 | static u16 adt7475_read_word(struct i2c_client *client, int reg) | ||
222 | { | ||
223 | u16 val; | ||
224 | |||
225 | val = i2c_smbus_read_byte_data(client, reg); | ||
226 | val |= (i2c_smbus_read_byte_data(client, reg + 1) << 8); | ||
227 | |||
228 | return val; | ||
229 | } | ||
230 | |||
231 | static void adt7475_write_word(struct i2c_client *client, int reg, u16 val) | ||
232 | { | ||
233 | i2c_smbus_write_byte_data(client, reg + 1, val >> 8); | ||
234 | i2c_smbus_write_byte_data(client, reg, val & 0xFF); | ||
235 | } | ||
236 | |||
237 | /* Find the nearest value in a table - used for pwm frequency and | ||
238 | auto temp range */ | ||
239 | static int find_nearest(long val, const int *array, int size) | ||
240 | { | ||
241 | int i; | ||
242 | |||
243 | if (val < array[0]) | ||
244 | return 0; | ||
245 | |||
246 | if (val > array[size - 1]) | ||
247 | return size - 1; | ||
248 | |||
249 | for (i = 0; i < size - 1; i++) { | ||
250 | int a, b; | ||
251 | |||
252 | if (val > array[i + 1]) | ||
253 | continue; | ||
254 | |||
255 | a = val - array[i]; | ||
256 | b = array[i + 1] - val; | ||
257 | |||
258 | return (a <= b) ? i : i + 1; | ||
259 | } | ||
260 | |||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | static ssize_t show_voltage(struct device *dev, struct device_attribute *attr, | ||
265 | char *buf) | ||
266 | { | ||
267 | struct adt7475_data *data = adt7475_update_device(dev); | ||
268 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
269 | unsigned short val; | ||
270 | |||
271 | switch (sattr->nr) { | ||
272 | case ALARM: | ||
273 | return sprintf(buf, "%d\n", | ||
274 | (data->alarms >> (sattr->index + 1)) & 1); | ||
275 | default: | ||
276 | val = data->voltage[sattr->nr][sattr->index]; | ||
277 | return sprintf(buf, "%d\n", | ||
278 | sattr->index == | ||
279 | 0 ? reg2vccp(val) : reg2vcc(val)); | ||
280 | } | ||
281 | } | ||
282 | |||
283 | static ssize_t set_voltage(struct device *dev, struct device_attribute *attr, | ||
284 | const char *buf, size_t count) | ||
285 | { | ||
286 | |||
287 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
288 | struct i2c_client *client = to_i2c_client(dev); | ||
289 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
290 | unsigned char reg; | ||
291 | long val; | ||
292 | |||
293 | if (strict_strtol(buf, 10, &val)) | ||
294 | return -EINVAL; | ||
295 | |||
296 | mutex_lock(&data->lock); | ||
297 | |||
298 | data->voltage[sattr->nr][sattr->index] = | ||
299 | sattr->index ? vcc2reg(val) : vccp2reg(val); | ||
300 | |||
301 | if (sattr->nr == MIN) | ||
302 | reg = VOLTAGE_MIN_REG(sattr->index); | ||
303 | else | ||
304 | reg = VOLTAGE_MAX_REG(sattr->index); | ||
305 | |||
306 | i2c_smbus_write_byte_data(client, reg, | ||
307 | data->voltage[sattr->nr][sattr->index] >> 2); | ||
308 | mutex_unlock(&data->lock); | ||
309 | |||
310 | return count; | ||
311 | } | ||
312 | |||
313 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | ||
314 | char *buf) | ||
315 | { | ||
316 | struct adt7475_data *data = adt7475_update_device(dev); | ||
317 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
318 | int out; | ||
319 | |||
320 | switch (sattr->nr) { | ||
321 | case HYSTERSIS: | ||
322 | mutex_lock(&data->lock); | ||
323 | out = data->temp[sattr->nr][sattr->index]; | ||
324 | if (sattr->index != 1) | ||
325 | out = (out >> 4) & 0xF; | ||
326 | else | ||
327 | out = (out & 0xF); | ||
328 | /* Show the value as an absolute number tied to | ||
329 | * THERM */ | ||
330 | out = reg2temp(data, data->temp[THERM][sattr->index]) - | ||
331 | out * 1000; | ||
332 | mutex_unlock(&data->lock); | ||
333 | break; | ||
334 | |||
335 | case OFFSET: | ||
336 | /* Offset is always 2's complement, regardless of the | ||
337 | * setting in CONFIG5 */ | ||
338 | mutex_lock(&data->lock); | ||
339 | out = (s8)data->temp[sattr->nr][sattr->index]; | ||
340 | if (data->config5 & CONFIG5_TEMPOFFSET) | ||
341 | out *= 1000; | ||
342 | else | ||
343 | out *= 500; | ||
344 | mutex_unlock(&data->lock); | ||
345 | break; | ||
346 | |||
347 | case ALARM: | ||
348 | out = (data->alarms >> (sattr->index + 4)) & 1; | ||
349 | break; | ||
350 | |||
351 | case FAULT: | ||
352 | /* Note - only for remote1 and remote2 */ | ||
353 | out = data->alarms & (sattr->index ? 0x8000 : 0x4000); | ||
354 | out = out ? 0 : 1; | ||
355 | break; | ||
356 | |||
357 | default: | ||
358 | /* All other temp values are in the configured format */ | ||
359 | out = reg2temp(data, data->temp[sattr->nr][sattr->index]); | ||
360 | } | ||
361 | |||
362 | return sprintf(buf, "%d\n", out); | ||
363 | } | ||
364 | |||
365 | static ssize_t set_temp(struct device *dev, struct device_attribute *attr, | ||
366 | const char *buf, size_t count) | ||
367 | { | ||
368 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
369 | struct i2c_client *client = to_i2c_client(dev); | ||
370 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
371 | unsigned char reg = 0; | ||
372 | u8 out; | ||
373 | int temp; | ||
374 | long val; | ||
375 | |||
376 | if (strict_strtol(buf, 10, &val)) | ||
377 | return -EINVAL; | ||
378 | |||
379 | mutex_lock(&data->lock); | ||
380 | |||
381 | /* We need the config register in all cases for temp <-> reg conv. */ | ||
382 | data->config5 = adt7475_read(REG_CONFIG5); | ||
383 | |||
384 | switch (sattr->nr) { | ||
385 | case OFFSET: | ||
386 | if (data->config5 & CONFIG5_TEMPOFFSET) { | ||
387 | val = SENSORS_LIMIT(val, -63000, 127000); | ||
388 | out = data->temp[OFFSET][sattr->index] = val / 1000; | ||
389 | } else { | ||
390 | val = SENSORS_LIMIT(val, -63000, 64000); | ||
391 | out = data->temp[OFFSET][sattr->index] = val / 500; | ||
392 | } | ||
393 | break; | ||
394 | |||
395 | case HYSTERSIS: | ||
396 | /* The value will be given as an absolute value, turn it | ||
397 | into an offset based on THERM */ | ||
398 | |||
399 | /* Read fresh THERM and HYSTERSIS values from the chip */ | ||
400 | data->temp[THERM][sattr->index] = | ||
401 | adt7475_read(TEMP_THERM_REG(sattr->index)) << 2; | ||
402 | adt7475_read_hystersis(client); | ||
403 | |||
404 | temp = reg2temp(data, data->temp[THERM][sattr->index]); | ||
405 | val = SENSORS_LIMIT(val, temp - 15000, temp); | ||
406 | val = (temp - val) / 1000; | ||
407 | |||
408 | if (sattr->index != 1) { | ||
409 | data->temp[HYSTERSIS][sattr->index] &= 0xF0; | ||
410 | data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4; | ||
411 | } else { | ||
412 | data->temp[HYSTERSIS][sattr->index] &= 0x0F; | ||
413 | data->temp[HYSTERSIS][sattr->index] |= (val & 0xF); | ||
414 | } | ||
415 | |||
416 | out = data->temp[HYSTERSIS][sattr->index]; | ||
417 | break; | ||
418 | |||
419 | default: | ||
420 | data->temp[sattr->nr][sattr->index] = temp2reg(data, val); | ||
421 | |||
422 | /* We maintain an extra 2 digits of precision for simplicity | ||
423 | * - shift those back off before writing the value */ | ||
424 | out = (u8) (data->temp[sattr->nr][sattr->index] >> 2); | ||
425 | } | ||
426 | |||
427 | switch (sattr->nr) { | ||
428 | case MIN: | ||
429 | reg = TEMP_MIN_REG(sattr->index); | ||
430 | break; | ||
431 | case MAX: | ||
432 | reg = TEMP_MAX_REG(sattr->index); | ||
433 | break; | ||
434 | case OFFSET: | ||
435 | reg = TEMP_OFFSET_REG(sattr->index); | ||
436 | break; | ||
437 | case AUTOMIN: | ||
438 | reg = TEMP_TMIN_REG(sattr->index); | ||
439 | break; | ||
440 | case THERM: | ||
441 | reg = TEMP_THERM_REG(sattr->index); | ||
442 | break; | ||
443 | case HYSTERSIS: | ||
444 | if (sattr->index != 2) | ||
445 | reg = REG_REMOTE1_HYSTERSIS; | ||
446 | else | ||
447 | reg = REG_REMOTE2_HYSTERSIS; | ||
448 | |||
449 | break; | ||
450 | } | ||
451 | |||
452 | i2c_smbus_write_byte_data(client, reg, out); | ||
453 | |||
454 | mutex_unlock(&data->lock); | ||
455 | return count; | ||
456 | } | ||
457 | |||
458 | /* Table of autorange values - the user will write the value in millidegrees, | ||
459 | and we'll convert it */ | ||
460 | static const int autorange_table[] = { | ||
461 | 2000, 2500, 3330, 4000, 5000, 6670, 8000, | ||
462 | 10000, 13330, 16000, 20000, 26670, 32000, 40000, | ||
463 | 53330, 80000 | ||
464 | }; | ||
465 | |||
466 | static ssize_t show_point2(struct device *dev, struct device_attribute *attr, | ||
467 | char *buf) | ||
468 | { | ||
469 | struct adt7475_data *data = adt7475_update_device(dev); | ||
470 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
471 | int out, val; | ||
472 | |||
473 | mutex_lock(&data->lock); | ||
474 | out = (data->range[sattr->index] >> 4) & 0x0F; | ||
475 | val = reg2temp(data, data->temp[AUTOMIN][sattr->index]); | ||
476 | mutex_unlock(&data->lock); | ||
477 | |||
478 | return sprintf(buf, "%d\n", val + autorange_table[out]); | ||
479 | } | ||
480 | |||
481 | static ssize_t set_point2(struct device *dev, struct device_attribute *attr, | ||
482 | const char *buf, size_t count) | ||
483 | { | ||
484 | struct i2c_client *client = to_i2c_client(dev); | ||
485 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
486 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
487 | int temp; | ||
488 | long val; | ||
489 | |||
490 | if (strict_strtol(buf, 10, &val)) | ||
491 | return -EINVAL; | ||
492 | |||
493 | mutex_lock(&data->lock); | ||
494 | |||
495 | /* Get a fresh copy of the needed registers */ | ||
496 | data->config5 = adt7475_read(REG_CONFIG5); | ||
497 | data->temp[AUTOMIN][sattr->index] = | ||
498 | adt7475_read(TEMP_TMIN_REG(sattr->index)) << 2; | ||
499 | data->range[sattr->index] = | ||
500 | adt7475_read(TEMP_TRANGE_REG(sattr->index)); | ||
501 | |||
502 | /* The user will write an absolute value, so subtract the start point | ||
503 | to figure the range */ | ||
504 | temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]); | ||
505 | val = SENSORS_LIMIT(val, temp + autorange_table[0], | ||
506 | temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]); | ||
507 | val -= temp; | ||
508 | |||
509 | /* Find the nearest table entry to what the user wrote */ | ||
510 | val = find_nearest(val, autorange_table, ARRAY_SIZE(autorange_table)); | ||
511 | |||
512 | data->range[sattr->index] &= ~0xF0; | ||
513 | data->range[sattr->index] |= val << 4; | ||
514 | |||
515 | i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), | ||
516 | data->range[sattr->index]); | ||
517 | |||
518 | mutex_unlock(&data->lock); | ||
519 | return count; | ||
520 | } | ||
521 | |||
522 | static ssize_t show_tach(struct device *dev, struct device_attribute *attr, | ||
523 | char *buf) | ||
524 | { | ||
525 | struct adt7475_data *data = adt7475_update_device(dev); | ||
526 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
527 | int out; | ||
528 | |||
529 | if (sattr->nr == ALARM) | ||
530 | out = (data->alarms >> (sattr->index + 10)) & 1; | ||
531 | else | ||
532 | out = tach2rpm(data->tach[sattr->nr][sattr->index]); | ||
533 | |||
534 | return sprintf(buf, "%d\n", out); | ||
535 | } | ||
536 | |||
537 | static ssize_t set_tach(struct device *dev, struct device_attribute *attr, | ||
538 | const char *buf, size_t count) | ||
539 | { | ||
540 | |||
541 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
542 | struct i2c_client *client = to_i2c_client(dev); | ||
543 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
544 | unsigned long val; | ||
545 | |||
546 | if (strict_strtoul(buf, 10, &val)) | ||
547 | return -EINVAL; | ||
548 | |||
549 | mutex_lock(&data->lock); | ||
550 | |||
551 | data->tach[MIN][sattr->index] = rpm2tach(val); | ||
552 | |||
553 | adt7475_write_word(client, TACH_MIN_REG(sattr->index), | ||
554 | data->tach[MIN][sattr->index]); | ||
555 | |||
556 | mutex_unlock(&data->lock); | ||
557 | return count; | ||
558 | } | ||
559 | |||
560 | static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, | ||
561 | char *buf) | ||
562 | { | ||
563 | struct adt7475_data *data = adt7475_update_device(dev); | ||
564 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
565 | |||
566 | return sprintf(buf, "%d\n", data->pwm[sattr->nr][sattr->index]); | ||
567 | } | ||
568 | |||
569 | static ssize_t show_pwmchan(struct device *dev, struct device_attribute *attr, | ||
570 | char *buf) | ||
571 | { | ||
572 | struct adt7475_data *data = adt7475_update_device(dev); | ||
573 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
574 | |||
575 | return sprintf(buf, "%d\n", data->pwmchan[sattr->index]); | ||
576 | } | ||
577 | |||
578 | static ssize_t show_pwmctrl(struct device *dev, struct device_attribute *attr, | ||
579 | char *buf) | ||
580 | { | ||
581 | struct adt7475_data *data = adt7475_update_device(dev); | ||
582 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
583 | |||
584 | return sprintf(buf, "%d\n", data->pwmctl[sattr->index]); | ||
585 | } | ||
586 | |||
587 | static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, | ||
588 | const char *buf, size_t count) | ||
589 | { | ||
590 | |||
591 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
592 | struct i2c_client *client = to_i2c_client(dev); | ||
593 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
594 | unsigned char reg = 0; | ||
595 | long val; | ||
596 | |||
597 | if (strict_strtol(buf, 10, &val)) | ||
598 | return -EINVAL; | ||
599 | |||
600 | mutex_lock(&data->lock); | ||
601 | |||
602 | switch (sattr->nr) { | ||
603 | case INPUT: | ||
604 | /* Get a fresh value for CONTROL */ | ||
605 | data->pwm[CONTROL][sattr->index] = | ||
606 | adt7475_read(PWM_CONFIG_REG(sattr->index)); | ||
607 | |||
608 | /* If we are not in manual mode, then we shouldn't allow | ||
609 | * the user to set the pwm speed */ | ||
610 | if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) { | ||
611 | mutex_unlock(&data->lock); | ||
612 | return count; | ||
613 | } | ||
614 | |||
615 | reg = PWM_REG(sattr->index); | ||
616 | break; | ||
617 | |||
618 | case MIN: | ||
619 | reg = PWM_MIN_REG(sattr->index); | ||
620 | break; | ||
621 | |||
622 | case MAX: | ||
623 | reg = PWM_MAX_REG(sattr->index); | ||
624 | break; | ||
625 | } | ||
626 | |||
627 | data->pwm[sattr->nr][sattr->index] = SENSORS_LIMIT(val, 0, 0xFF); | ||
628 | i2c_smbus_write_byte_data(client, reg, | ||
629 | data->pwm[sattr->nr][sattr->index]); | ||
630 | |||
631 | mutex_unlock(&data->lock); | ||
632 | |||
633 | return count; | ||
634 | } | ||
635 | |||
636 | /* Called by set_pwmctrl and set_pwmchan */ | ||
637 | |||
638 | static int hw_set_pwm(struct i2c_client *client, int index, | ||
639 | unsigned int pwmctl, unsigned int pwmchan) | ||
640 | { | ||
641 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
642 | long val = 0; | ||
643 | |||
644 | switch (pwmctl) { | ||
645 | case 0: | ||
646 | val = 0x03; /* Run at full speed */ | ||
647 | break; | ||
648 | case 1: | ||
649 | val = 0x07; /* Manual mode */ | ||
650 | break; | ||
651 | case 2: | ||
652 | switch (pwmchan) { | ||
653 | case 1: | ||
654 | /* Remote1 controls PWM */ | ||
655 | val = 0x00; | ||
656 | break; | ||
657 | case 2: | ||
658 | /* local controls PWM */ | ||
659 | val = 0x01; | ||
660 | break; | ||
661 | case 4: | ||
662 | /* remote2 controls PWM */ | ||
663 | val = 0x02; | ||
664 | break; | ||
665 | case 6: | ||
666 | /* local/remote2 control PWM */ | ||
667 | val = 0x05; | ||
668 | break; | ||
669 | case 7: | ||
670 | /* All three control PWM */ | ||
671 | val = 0x06; | ||
672 | break; | ||
673 | default: | ||
674 | return -EINVAL; | ||
675 | } | ||
676 | break; | ||
677 | default: | ||
678 | return -EINVAL; | ||
679 | } | ||
680 | |||
681 | data->pwmctl[index] = pwmctl; | ||
682 | data->pwmchan[index] = pwmchan; | ||
683 | |||
684 | data->pwm[CONTROL][index] &= ~0xE0; | ||
685 | data->pwm[CONTROL][index] |= (val & 7) << 5; | ||
686 | |||
687 | i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index), | ||
688 | data->pwm[CONTROL][index]); | ||
689 | |||
690 | return 0; | ||
691 | } | ||
692 | |||
693 | static ssize_t set_pwmchan(struct device *dev, struct device_attribute *attr, | ||
694 | const char *buf, size_t count) | ||
695 | { | ||
696 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
697 | struct i2c_client *client = to_i2c_client(dev); | ||
698 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
699 | int r; | ||
700 | long val; | ||
701 | |||
702 | if (strict_strtol(buf, 10, &val)) | ||
703 | return -EINVAL; | ||
704 | |||
705 | mutex_lock(&data->lock); | ||
706 | /* Read Modify Write PWM values */ | ||
707 | adt7475_read_pwm(client, sattr->index); | ||
708 | r = hw_set_pwm(client, sattr->index, data->pwmctl[sattr->index], val); | ||
709 | if (r) | ||
710 | count = r; | ||
711 | mutex_unlock(&data->lock); | ||
712 | |||
713 | return count; | ||
714 | } | ||
715 | |||
716 | static ssize_t set_pwmctrl(struct device *dev, struct device_attribute *attr, | ||
717 | const char *buf, size_t count) | ||
718 | { | ||
719 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
720 | struct i2c_client *client = to_i2c_client(dev); | ||
721 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
722 | int r; | ||
723 | long val; | ||
724 | |||
725 | if (strict_strtol(buf, 10, &val)) | ||
726 | return -EINVAL; | ||
727 | |||
728 | mutex_lock(&data->lock); | ||
729 | /* Read Modify Write PWM values */ | ||
730 | adt7475_read_pwm(client, sattr->index); | ||
731 | r = hw_set_pwm(client, sattr->index, val, data->pwmchan[sattr->index]); | ||
732 | if (r) | ||
733 | count = r; | ||
734 | mutex_unlock(&data->lock); | ||
735 | |||
736 | return count; | ||
737 | } | ||
738 | |||
739 | /* List of frequencies for the PWM */ | ||
740 | static const int pwmfreq_table[] = { | ||
741 | 11, 14, 22, 29, 35, 44, 58, 88 | ||
742 | }; | ||
743 | |||
744 | static ssize_t show_pwmfreq(struct device *dev, struct device_attribute *attr, | ||
745 | char *buf) | ||
746 | { | ||
747 | struct adt7475_data *data = adt7475_update_device(dev); | ||
748 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
749 | |||
750 | return sprintf(buf, "%d\n", | ||
751 | pwmfreq_table[data->range[sattr->index] & 7]); | ||
752 | } | ||
753 | |||
754 | static ssize_t set_pwmfreq(struct device *dev, struct device_attribute *attr, | ||
755 | const char *buf, size_t count) | ||
756 | { | ||
757 | struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr); | ||
758 | struct i2c_client *client = to_i2c_client(dev); | ||
759 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
760 | int out; | ||
761 | long val; | ||
762 | |||
763 | if (strict_strtol(buf, 10, &val)) | ||
764 | return -EINVAL; | ||
765 | |||
766 | out = find_nearest(val, pwmfreq_table, ARRAY_SIZE(pwmfreq_table)); | ||
767 | |||
768 | mutex_lock(&data->lock); | ||
769 | |||
770 | data->range[sattr->index] = | ||
771 | adt7475_read(TEMP_TRANGE_REG(sattr->index)); | ||
772 | data->range[sattr->index] &= ~7; | ||
773 | data->range[sattr->index] |= out; | ||
774 | |||
775 | i2c_smbus_write_byte_data(client, TEMP_TRANGE_REG(sattr->index), | ||
776 | data->range[sattr->index]); | ||
777 | |||
778 | mutex_unlock(&data->lock); | ||
779 | return count; | ||
780 | } | ||
781 | |||
782 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, show_voltage, NULL, INPUT, 0); | ||
783 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IRUGO | S_IWUSR, show_voltage, | ||
784 | set_voltage, MAX, 0); | ||
785 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IRUGO | S_IWUSR, show_voltage, | ||
786 | set_voltage, MIN, 0); | ||
787 | static SENSOR_DEVICE_ATTR_2(in1_alarm, S_IRUGO, show_voltage, NULL, ALARM, 0); | ||
788 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, show_voltage, NULL, INPUT, 1); | ||
789 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IRUGO | S_IWUSR, show_voltage, | ||
790 | set_voltage, MAX, 1); | ||
791 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IRUGO | S_IWUSR, show_voltage, | ||
792 | set_voltage, MIN, 1); | ||
793 | static SENSOR_DEVICE_ATTR_2(in2_alarm, S_IRUGO, show_voltage, NULL, ALARM, 1); | ||
794 | static SENSOR_DEVICE_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, INPUT, 0); | ||
795 | static SENSOR_DEVICE_ATTR_2(temp1_alarm, S_IRUGO, show_temp, NULL, ALARM, 0); | ||
796 | static SENSOR_DEVICE_ATTR_2(temp1_fault, S_IRUGO, show_temp, NULL, FAULT, 0); | ||
797 | static SENSOR_DEVICE_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
798 | MAX, 0); | ||
799 | static SENSOR_DEVICE_ATTR_2(temp1_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
800 | MIN, 0); | ||
801 | static SENSOR_DEVICE_ATTR_2(temp1_offset, S_IRUGO | S_IWUSR, show_temp, | ||
802 | set_temp, OFFSET, 0); | ||
803 | static SENSOR_DEVICE_ATTR_2(temp1_auto_point1_temp, S_IRUGO | S_IWUSR, | ||
804 | show_temp, set_temp, AUTOMIN, 0); | ||
805 | static SENSOR_DEVICE_ATTR_2(temp1_auto_point2_temp, S_IRUGO | S_IWUSR, | ||
806 | show_point2, set_point2, 0, 0); | ||
807 | static SENSOR_DEVICE_ATTR_2(temp1_crit, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
808 | THERM, 0); | ||
809 | static SENSOR_DEVICE_ATTR_2(temp1_crit_hyst, S_IRUGO | S_IWUSR, show_temp, | ||
810 | set_temp, HYSTERSIS, 0); | ||
811 | static SENSOR_DEVICE_ATTR_2(temp2_input, S_IRUGO, show_temp, NULL, INPUT, 1); | ||
812 | static SENSOR_DEVICE_ATTR_2(temp2_alarm, S_IRUGO, show_temp, NULL, ALARM, 1); | ||
813 | static SENSOR_DEVICE_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
814 | MAX, 1); | ||
815 | static SENSOR_DEVICE_ATTR_2(temp2_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
816 | MIN, 1); | ||
817 | static SENSOR_DEVICE_ATTR_2(temp2_offset, S_IRUGO | S_IWUSR, show_temp, | ||
818 | set_temp, OFFSET, 1); | ||
819 | static SENSOR_DEVICE_ATTR_2(temp2_auto_point1_temp, S_IRUGO | S_IWUSR, | ||
820 | show_temp, set_temp, AUTOMIN, 1); | ||
821 | static SENSOR_DEVICE_ATTR_2(temp2_auto_point2_temp, S_IRUGO | S_IWUSR, | ||
822 | show_point2, set_point2, 0, 1); | ||
823 | static SENSOR_DEVICE_ATTR_2(temp2_crit, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
824 | THERM, 1); | ||
825 | static SENSOR_DEVICE_ATTR_2(temp2_crit_hyst, S_IRUGO | S_IWUSR, show_temp, | ||
826 | set_temp, HYSTERSIS, 1); | ||
827 | static SENSOR_DEVICE_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, INPUT, 2); | ||
828 | static SENSOR_DEVICE_ATTR_2(temp3_alarm, S_IRUGO, show_temp, NULL, ALARM, 2); | ||
829 | static SENSOR_DEVICE_ATTR_2(temp3_fault, S_IRUGO, show_temp, NULL, FAULT, 2); | ||
830 | static SENSOR_DEVICE_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
831 | MAX, 2); | ||
832 | static SENSOR_DEVICE_ATTR_2(temp3_min, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
833 | MIN, 2); | ||
834 | static SENSOR_DEVICE_ATTR_2(temp3_offset, S_IRUGO | S_IWUSR, show_temp, | ||
835 | set_temp, OFFSET, 2); | ||
836 | static SENSOR_DEVICE_ATTR_2(temp3_auto_point1_temp, S_IRUGO | S_IWUSR, | ||
837 | show_temp, set_temp, AUTOMIN, 2); | ||
838 | static SENSOR_DEVICE_ATTR_2(temp3_auto_point2_temp, S_IRUGO | S_IWUSR, | ||
839 | show_point2, set_point2, 0, 2); | ||
840 | static SENSOR_DEVICE_ATTR_2(temp3_crit, S_IRUGO | S_IWUSR, show_temp, set_temp, | ||
841 | THERM, 2); | ||
842 | static SENSOR_DEVICE_ATTR_2(temp3_crit_hyst, S_IRUGO | S_IWUSR, show_temp, | ||
843 | set_temp, HYSTERSIS, 2); | ||
844 | static SENSOR_DEVICE_ATTR_2(fan1_input, S_IRUGO, show_tach, NULL, INPUT, 0); | ||
845 | static SENSOR_DEVICE_ATTR_2(fan1_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
846 | MIN, 0); | ||
847 | static SENSOR_DEVICE_ATTR_2(fan1_alarm, S_IRUGO, show_tach, NULL, ALARM, 0); | ||
848 | static SENSOR_DEVICE_ATTR_2(fan2_input, S_IRUGO, show_tach, NULL, INPUT, 1); | ||
849 | static SENSOR_DEVICE_ATTR_2(fan2_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
850 | MIN, 1); | ||
851 | static SENSOR_DEVICE_ATTR_2(fan2_alarm, S_IRUGO, show_tach, NULL, ALARM, 1); | ||
852 | static SENSOR_DEVICE_ATTR_2(fan3_input, S_IRUGO, show_tach, NULL, INPUT, 2); | ||
853 | static SENSOR_DEVICE_ATTR_2(fan3_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
854 | MIN, 2); | ||
855 | static SENSOR_DEVICE_ATTR_2(fan3_alarm, S_IRUGO, show_tach, NULL, ALARM, 2); | ||
856 | static SENSOR_DEVICE_ATTR_2(fan4_input, S_IRUGO, show_tach, NULL, INPUT, 3); | ||
857 | static SENSOR_DEVICE_ATTR_2(fan4_min, S_IRUGO | S_IWUSR, show_tach, set_tach, | ||
858 | MIN, 3); | ||
859 | static SENSOR_DEVICE_ATTR_2(fan4_alarm, S_IRUGO, show_tach, NULL, ALARM, 3); | ||
860 | static SENSOR_DEVICE_ATTR_2(pwm1, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT, | ||
861 | 0); | ||
862 | static SENSOR_DEVICE_ATTR_2(pwm1_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | ||
863 | set_pwmfreq, INPUT, 0); | ||
864 | static SENSOR_DEVICE_ATTR_2(pwm1_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | ||
865 | set_pwmctrl, INPUT, 0); | ||
866 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_channel_temp, S_IRUGO | S_IWUSR, | ||
867 | show_pwmchan, set_pwmchan, INPUT, 0); | ||
868 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
869 | set_pwm, MIN, 0); | ||
870 | static SENSOR_DEVICE_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
871 | set_pwm, MAX, 0); | ||
872 | static SENSOR_DEVICE_ATTR_2(pwm2, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT, | ||
873 | 1); | ||
874 | static SENSOR_DEVICE_ATTR_2(pwm2_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | ||
875 | set_pwmfreq, INPUT, 1); | ||
876 | static SENSOR_DEVICE_ATTR_2(pwm2_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | ||
877 | set_pwmctrl, INPUT, 1); | ||
878 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_channel_temp, S_IRUGO | S_IWUSR, | ||
879 | show_pwmchan, set_pwmchan, INPUT, 1); | ||
880 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
881 | set_pwm, MIN, 1); | ||
882 | static SENSOR_DEVICE_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
883 | set_pwm, MAX, 1); | ||
884 | static SENSOR_DEVICE_ATTR_2(pwm3, S_IRUGO | S_IWUSR, show_pwm, set_pwm, INPUT, | ||
885 | 2); | ||
886 | static SENSOR_DEVICE_ATTR_2(pwm3_freq, S_IRUGO | S_IWUSR, show_pwmfreq, | ||
887 | set_pwmfreq, INPUT, 2); | ||
888 | static SENSOR_DEVICE_ATTR_2(pwm3_enable, S_IRUGO | S_IWUSR, show_pwmctrl, | ||
889 | set_pwmctrl, INPUT, 2); | ||
890 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_channel_temp, S_IRUGO | S_IWUSR, | ||
891 | show_pwmchan, set_pwmchan, INPUT, 2); | ||
892 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
893 | set_pwm, MIN, 2); | ||
894 | static SENSOR_DEVICE_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO | S_IWUSR, show_pwm, | ||
895 | set_pwm, MAX, 2); | ||
896 | |||
897 | static struct attribute *adt7475_attrs[] = { | ||
898 | &sensor_dev_attr_in1_input.dev_attr.attr, | ||
899 | &sensor_dev_attr_in1_max.dev_attr.attr, | ||
900 | &sensor_dev_attr_in1_min.dev_attr.attr, | ||
901 | &sensor_dev_attr_in1_alarm.dev_attr.attr, | ||
902 | &sensor_dev_attr_in2_input.dev_attr.attr, | ||
903 | &sensor_dev_attr_in2_max.dev_attr.attr, | ||
904 | &sensor_dev_attr_in2_min.dev_attr.attr, | ||
905 | &sensor_dev_attr_in2_alarm.dev_attr.attr, | ||
906 | &sensor_dev_attr_temp1_input.dev_attr.attr, | ||
907 | &sensor_dev_attr_temp1_alarm.dev_attr.attr, | ||
908 | &sensor_dev_attr_temp1_fault.dev_attr.attr, | ||
909 | &sensor_dev_attr_temp1_max.dev_attr.attr, | ||
910 | &sensor_dev_attr_temp1_min.dev_attr.attr, | ||
911 | &sensor_dev_attr_temp1_offset.dev_attr.attr, | ||
912 | &sensor_dev_attr_temp1_auto_point1_temp.dev_attr.attr, | ||
913 | &sensor_dev_attr_temp1_auto_point2_temp.dev_attr.attr, | ||
914 | &sensor_dev_attr_temp1_crit.dev_attr.attr, | ||
915 | &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, | ||
916 | &sensor_dev_attr_temp2_input.dev_attr.attr, | ||
917 | &sensor_dev_attr_temp2_alarm.dev_attr.attr, | ||
918 | &sensor_dev_attr_temp2_max.dev_attr.attr, | ||
919 | &sensor_dev_attr_temp2_min.dev_attr.attr, | ||
920 | &sensor_dev_attr_temp2_offset.dev_attr.attr, | ||
921 | &sensor_dev_attr_temp2_auto_point1_temp.dev_attr.attr, | ||
922 | &sensor_dev_attr_temp2_auto_point2_temp.dev_attr.attr, | ||
923 | &sensor_dev_attr_temp2_crit.dev_attr.attr, | ||
924 | &sensor_dev_attr_temp2_crit_hyst.dev_attr.attr, | ||
925 | &sensor_dev_attr_temp3_input.dev_attr.attr, | ||
926 | &sensor_dev_attr_temp3_fault.dev_attr.attr, | ||
927 | &sensor_dev_attr_temp3_alarm.dev_attr.attr, | ||
928 | &sensor_dev_attr_temp3_max.dev_attr.attr, | ||
929 | &sensor_dev_attr_temp3_min.dev_attr.attr, | ||
930 | &sensor_dev_attr_temp3_offset.dev_attr.attr, | ||
931 | &sensor_dev_attr_temp3_auto_point1_temp.dev_attr.attr, | ||
932 | &sensor_dev_attr_temp3_auto_point2_temp.dev_attr.attr, | ||
933 | &sensor_dev_attr_temp3_crit.dev_attr.attr, | ||
934 | &sensor_dev_attr_temp3_crit_hyst.dev_attr.attr, | ||
935 | &sensor_dev_attr_fan1_input.dev_attr.attr, | ||
936 | &sensor_dev_attr_fan1_min.dev_attr.attr, | ||
937 | &sensor_dev_attr_fan1_alarm.dev_attr.attr, | ||
938 | &sensor_dev_attr_fan2_input.dev_attr.attr, | ||
939 | &sensor_dev_attr_fan2_min.dev_attr.attr, | ||
940 | &sensor_dev_attr_fan2_alarm.dev_attr.attr, | ||
941 | &sensor_dev_attr_fan3_input.dev_attr.attr, | ||
942 | &sensor_dev_attr_fan3_min.dev_attr.attr, | ||
943 | &sensor_dev_attr_fan3_alarm.dev_attr.attr, | ||
944 | &sensor_dev_attr_fan4_input.dev_attr.attr, | ||
945 | &sensor_dev_attr_fan4_min.dev_attr.attr, | ||
946 | &sensor_dev_attr_fan4_alarm.dev_attr.attr, | ||
947 | &sensor_dev_attr_pwm1.dev_attr.attr, | ||
948 | &sensor_dev_attr_pwm1_freq.dev_attr.attr, | ||
949 | &sensor_dev_attr_pwm1_enable.dev_attr.attr, | ||
950 | &sensor_dev_attr_pwm1_auto_channel_temp.dev_attr.attr, | ||
951 | &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr, | ||
952 | &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr, | ||
953 | &sensor_dev_attr_pwm2.dev_attr.attr, | ||
954 | &sensor_dev_attr_pwm2_freq.dev_attr.attr, | ||
955 | &sensor_dev_attr_pwm2_enable.dev_attr.attr, | ||
956 | &sensor_dev_attr_pwm2_auto_channel_temp.dev_attr.attr, | ||
957 | &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr, | ||
958 | &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr, | ||
959 | &sensor_dev_attr_pwm3.dev_attr.attr, | ||
960 | &sensor_dev_attr_pwm3_freq.dev_attr.attr, | ||
961 | &sensor_dev_attr_pwm3_enable.dev_attr.attr, | ||
962 | &sensor_dev_attr_pwm3_auto_channel_temp.dev_attr.attr, | ||
963 | &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, | ||
964 | &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, | ||
965 | NULL, | ||
966 | }; | ||
967 | |||
968 | struct attribute_group adt7475_attr_group = { .attrs = adt7475_attrs }; | ||
969 | |||
970 | static int adt7475_detect(struct i2c_client *client, int kind, | ||
971 | struct i2c_board_info *info) | ||
972 | { | ||
973 | struct i2c_adapter *adapter = client->adapter; | ||
974 | |||
975 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
976 | return -ENODEV; | ||
977 | |||
978 | if (kind <= 0) { | ||
979 | if (adt7475_read(REG_VENDID) != 0x41 || | ||
980 | adt7475_read(REG_DEVID) != 0x75) { | ||
981 | dev_err(&adapter->dev, | ||
982 | "Couldn't detect a adt7475 part at 0x%02x\n", | ||
983 | (unsigned int)client->addr); | ||
984 | return -ENODEV; | ||
985 | } | ||
986 | } | ||
987 | |||
988 | strlcpy(info->type, adt7475_id[0].name, I2C_NAME_SIZE); | ||
989 | |||
990 | return 0; | ||
991 | } | ||
992 | |||
993 | static int adt7475_probe(struct i2c_client *client, | ||
994 | const struct i2c_device_id *id) | ||
995 | { | ||
996 | struct adt7475_data *data; | ||
997 | int i, ret = 0; | ||
998 | |||
999 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
1000 | if (data == NULL) | ||
1001 | return -ENOMEM; | ||
1002 | |||
1003 | mutex_init(&data->lock); | ||
1004 | i2c_set_clientdata(client, data); | ||
1005 | |||
1006 | /* Call adt7475_read_pwm for all pwm's as this will reprogram any | ||
1007 | pwm's which are disabled to manual mode with 0% duty cycle */ | ||
1008 | for (i = 0; i < ADT7475_PWM_COUNT; i++) | ||
1009 | adt7475_read_pwm(client, i); | ||
1010 | |||
1011 | ret = sysfs_create_group(&client->dev.kobj, &adt7475_attr_group); | ||
1012 | if (ret) | ||
1013 | goto efree; | ||
1014 | |||
1015 | data->hwmon_dev = hwmon_device_register(&client->dev); | ||
1016 | if (IS_ERR(data->hwmon_dev)) { | ||
1017 | ret = PTR_ERR(data->hwmon_dev); | ||
1018 | goto eremove; | ||
1019 | } | ||
1020 | |||
1021 | return 0; | ||
1022 | |||
1023 | eremove: | ||
1024 | sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); | ||
1025 | efree: | ||
1026 | kfree(data); | ||
1027 | return ret; | ||
1028 | } | ||
1029 | |||
1030 | static int adt7475_remove(struct i2c_client *client) | ||
1031 | { | ||
1032 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1033 | |||
1034 | hwmon_device_unregister(data->hwmon_dev); | ||
1035 | sysfs_remove_group(&client->dev.kobj, &adt7475_attr_group); | ||
1036 | kfree(data); | ||
1037 | |||
1038 | return 0; | ||
1039 | } | ||
1040 | |||
1041 | static struct i2c_driver adt7475_driver = { | ||
1042 | .class = I2C_CLASS_HWMON, | ||
1043 | .driver = { | ||
1044 | .name = "adt7475", | ||
1045 | }, | ||
1046 | .probe = adt7475_probe, | ||
1047 | .remove = adt7475_remove, | ||
1048 | .id_table = adt7475_id, | ||
1049 | .detect = adt7475_detect, | ||
1050 | .address_data = &addr_data, | ||
1051 | }; | ||
1052 | |||
1053 | static void adt7475_read_hystersis(struct i2c_client *client) | ||
1054 | { | ||
1055 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1056 | |||
1057 | data->temp[HYSTERSIS][0] = (u16) adt7475_read(REG_REMOTE1_HYSTERSIS); | ||
1058 | data->temp[HYSTERSIS][1] = data->temp[HYSTERSIS][0]; | ||
1059 | data->temp[HYSTERSIS][2] = (u16) adt7475_read(REG_REMOTE2_HYSTERSIS); | ||
1060 | } | ||
1061 | |||
1062 | static void adt7475_read_pwm(struct i2c_client *client, int index) | ||
1063 | { | ||
1064 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1065 | unsigned int v; | ||
1066 | |||
1067 | data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index)); | ||
1068 | |||
1069 | /* Figure out the internal value for pwmctrl and pwmchan | ||
1070 | based on the current settings */ | ||
1071 | v = (data->pwm[CONTROL][index] >> 5) & 7; | ||
1072 | |||
1073 | if (v == 3) | ||
1074 | data->pwmctl[index] = 0; | ||
1075 | else if (v == 7) | ||
1076 | data->pwmctl[index] = 1; | ||
1077 | else if (v == 4) { | ||
1078 | /* The fan is disabled - we don't want to | ||
1079 | support that, so change to manual mode and | ||
1080 | set the duty cycle to 0 instead | ||
1081 | */ | ||
1082 | data->pwm[INPUT][index] = 0; | ||
1083 | data->pwm[CONTROL][index] &= ~0xE0; | ||
1084 | data->pwm[CONTROL][index] |= (7 << 5); | ||
1085 | |||
1086 | i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index), | ||
1087 | data->pwm[INPUT][index]); | ||
1088 | |||
1089 | i2c_smbus_write_byte_data(client, PWM_CONFIG_REG(index), | ||
1090 | data->pwm[CONTROL][index]); | ||
1091 | |||
1092 | data->pwmctl[index] = 1; | ||
1093 | } else { | ||
1094 | data->pwmctl[index] = 2; | ||
1095 | |||
1096 | switch (v) { | ||
1097 | case 0: | ||
1098 | data->pwmchan[index] = 1; | ||
1099 | break; | ||
1100 | case 1: | ||
1101 | data->pwmchan[index] = 2; | ||
1102 | break; | ||
1103 | case 2: | ||
1104 | data->pwmchan[index] = 4; | ||
1105 | break; | ||
1106 | case 5: | ||
1107 | data->pwmchan[index] = 6; | ||
1108 | break; | ||
1109 | case 6: | ||
1110 | data->pwmchan[index] = 7; | ||
1111 | break; | ||
1112 | } | ||
1113 | } | ||
1114 | } | ||
1115 | |||
1116 | static struct adt7475_data *adt7475_update_device(struct device *dev) | ||
1117 | { | ||
1118 | struct i2c_client *client = to_i2c_client(dev); | ||
1119 | struct adt7475_data *data = i2c_get_clientdata(client); | ||
1120 | u8 ext; | ||
1121 | int i; | ||
1122 | |||
1123 | mutex_lock(&data->lock); | ||
1124 | |||
1125 | /* Measurement values update every 2 seconds */ | ||
1126 | if (time_after(jiffies, data->measure_updated + HZ * 2) || | ||
1127 | !data->valid) { | ||
1128 | data->alarms = adt7475_read(REG_STATUS2) << 8; | ||
1129 | data->alarms |= adt7475_read(REG_STATUS1); | ||
1130 | |||
1131 | ext = adt7475_read(REG_EXTEND1); | ||
1132 | for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++) | ||
1133 | data->voltage[INPUT][i] = | ||
1134 | (adt7475_read(VOLTAGE_REG(i)) << 2) | | ||
1135 | ((ext >> ((i + 1) * 2)) & 3); | ||
1136 | |||
1137 | ext = adt7475_read(REG_EXTEND2); | ||
1138 | for (i = 0; i < ADT7475_TEMP_COUNT; i++) | ||
1139 | data->temp[INPUT][i] = | ||
1140 | (adt7475_read(TEMP_REG(i)) << 2) | | ||
1141 | ((ext >> ((i + 1) * 2)) & 3); | ||
1142 | |||
1143 | for (i = 0; i < ADT7475_TACH_COUNT; i++) | ||
1144 | data->tach[INPUT][i] = | ||
1145 | adt7475_read_word(client, TACH_REG(i)); | ||
1146 | |||
1147 | /* Updated by hw when in auto mode */ | ||
1148 | for (i = 0; i < ADT7475_PWM_COUNT; i++) | ||
1149 | data->pwm[INPUT][i] = adt7475_read(PWM_REG(i)); | ||
1150 | |||
1151 | data->measure_updated = jiffies; | ||
1152 | } | ||
1153 | |||
1154 | /* Limits and settings, should never change update every 60 seconds */ | ||
1155 | if (time_after(jiffies, data->limits_updated + HZ * 2) || | ||
1156 | !data->valid) { | ||
1157 | data->config5 = adt7475_read(REG_CONFIG5); | ||
1158 | |||
1159 | for (i = 0; i < ADT7475_VOLTAGE_COUNT; i++) { | ||
1160 | /* Adjust values so they match the input precision */ | ||
1161 | data->voltage[MIN][i] = | ||
1162 | adt7475_read(VOLTAGE_MIN_REG(i)) << 2; | ||
1163 | data->voltage[MAX][i] = | ||
1164 | adt7475_read(VOLTAGE_MAX_REG(i)) << 2; | ||
1165 | } | ||
1166 | |||
1167 | for (i = 0; i < ADT7475_TEMP_COUNT; i++) { | ||
1168 | /* Adjust values so they match the input precision */ | ||
1169 | data->temp[MIN][i] = | ||
1170 | adt7475_read(TEMP_MIN_REG(i)) << 2; | ||
1171 | data->temp[MAX][i] = | ||
1172 | adt7475_read(TEMP_MAX_REG(i)) << 2; | ||
1173 | data->temp[AUTOMIN][i] = | ||
1174 | adt7475_read(TEMP_TMIN_REG(i)) << 2; | ||
1175 | data->temp[THERM][i] = | ||
1176 | adt7475_read(TEMP_THERM_REG(i)) << 2; | ||
1177 | data->temp[OFFSET][i] = | ||
1178 | adt7475_read(TEMP_OFFSET_REG(i)); | ||
1179 | } | ||
1180 | adt7475_read_hystersis(client); | ||
1181 | |||
1182 | for (i = 0; i < ADT7475_TACH_COUNT; i++) | ||
1183 | data->tach[MIN][i] = | ||
1184 | adt7475_read_word(client, TACH_MIN_REG(i)); | ||
1185 | |||
1186 | for (i = 0; i < ADT7475_PWM_COUNT; i++) { | ||
1187 | data->pwm[MAX][i] = adt7475_read(PWM_MAX_REG(i)); | ||
1188 | data->pwm[MIN][i] = adt7475_read(PWM_MIN_REG(i)); | ||
1189 | /* Set the channel and control information */ | ||
1190 | adt7475_read_pwm(client, i); | ||
1191 | } | ||
1192 | |||
1193 | data->range[0] = adt7475_read(TEMP_TRANGE_REG(0)); | ||
1194 | data->range[1] = adt7475_read(TEMP_TRANGE_REG(1)); | ||
1195 | data->range[2] = adt7475_read(TEMP_TRANGE_REG(2)); | ||
1196 | |||
1197 | data->limits_updated = jiffies; | ||
1198 | data->valid = 1; | ||
1199 | } | ||
1200 | |||
1201 | mutex_unlock(&data->lock); | ||
1202 | |||
1203 | return data; | ||
1204 | } | ||
1205 | |||
1206 | static int __init sensors_adt7475_init(void) | ||
1207 | { | ||
1208 | return i2c_add_driver(&adt7475_driver); | ||
1209 | } | ||
1210 | |||
1211 | static void __exit sensors_adt7475_exit(void) | ||
1212 | { | ||
1213 | i2c_del_driver(&adt7475_driver); | ||
1214 | } | ||
1215 | |||
1216 | MODULE_AUTHOR("Advanced Micro Devices, Inc"); | ||
1217 | MODULE_DESCRIPTION("adt7475 driver"); | ||
1218 | MODULE_LICENSE("GPL"); | ||
1219 | |||
1220 | module_init(sensors_adt7475_init); | ||
1221 | module_exit(sensors_adt7475_exit); | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index dca47a591baf..e30186236588 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -590,6 +590,11 @@ static ssize_t applesmc_light_show(struct device *dev, | |||
590 | } | 590 | } |
591 | 591 | ||
592 | ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); | 592 | ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); |
593 | /* newer macbooks report a single 10-bit bigendian value */ | ||
594 | if (data_length == 10) { | ||
595 | left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2; | ||
596 | goto out; | ||
597 | } | ||
593 | left = buffer[2]; | 598 | left = buffer[2]; |
594 | if (ret) | 599 | if (ret) |
595 | goto out; | 600 | goto out; |
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c index bf8d40580577..03705240000f 100644 --- a/drivers/hwmon/hp_accel.c +++ b/drivers/hwmon/hp_accel.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2007-2008 Yan Burman | 4 | * Copyright (C) 2007-2008 Yan Burman |
5 | * Copyright (C) 2008 Eric Piel | 5 | * Copyright (C) 2008 Eric Piel |
6 | * Copyright (C) 2008 Pavel Machek | 6 | * Copyright (C) 2008-2009 Pavel Machek |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/freezer.h> | 36 | #include <linux/freezer.h> |
37 | #include <linux/version.h> | 37 | #include <linux/version.h> |
38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
39 | #include <linux/leds.h> | ||
39 | #include <acpi/acpi_drivers.h> | 40 | #include <acpi/acpi_drivers.h> |
40 | #include <asm/atomic.h> | 41 | #include <asm/atomic.h> |
41 | #include "lis3lv02d.h" | 42 | #include "lis3lv02d.h" |
@@ -43,6 +44,36 @@ | |||
43 | #define DRIVER_NAME "lis3lv02d" | 44 | #define DRIVER_NAME "lis3lv02d" |
44 | #define ACPI_MDPS_CLASS "accelerometer" | 45 | #define ACPI_MDPS_CLASS "accelerometer" |
45 | 46 | ||
47 | /* Delayed LEDs infrastructure ------------------------------------ */ | ||
48 | |||
49 | /* Special LED class that can defer work */ | ||
50 | struct delayed_led_classdev { | ||
51 | struct led_classdev led_classdev; | ||
52 | struct work_struct work; | ||
53 | enum led_brightness new_brightness; | ||
54 | |||
55 | unsigned int led; /* For driver */ | ||
56 | void (*set_brightness)(struct delayed_led_classdev *data, enum led_brightness value); | ||
57 | }; | ||
58 | |||
59 | static inline void delayed_set_status_worker(struct work_struct *work) | ||
60 | { | ||
61 | struct delayed_led_classdev *data = | ||
62 | container_of(work, struct delayed_led_classdev, work); | ||
63 | |||
64 | data->set_brightness(data, data->new_brightness); | ||
65 | } | ||
66 | |||
67 | static inline void delayed_sysfs_set(struct led_classdev *led_cdev, | ||
68 | enum led_brightness brightness) | ||
69 | { | ||
70 | struct delayed_led_classdev *data = container_of(led_cdev, | ||
71 | struct delayed_led_classdev, led_classdev); | ||
72 | data->new_brightness = brightness; | ||
73 | schedule_work(&data->work); | ||
74 | } | ||
75 | |||
76 | /* HP-specific accelerometer driver ------------------------------------ */ | ||
46 | 77 | ||
47 | /* For automatic insertion of the module */ | 78 | /* For automatic insertion of the module */ |
48 | static struct acpi_device_id lis3lv02d_device_ids[] = { | 79 | static struct acpi_device_id lis3lv02d_device_ids[] = { |
@@ -154,10 +185,33 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = { | |||
154 | */ | 185 | */ |
155 | }; | 186 | }; |
156 | 187 | ||
188 | static void hpled_set(struct delayed_led_classdev *led_cdev, enum led_brightness value) | ||
189 | { | ||
190 | acpi_handle handle = adev.device->handle; | ||
191 | unsigned long long ret; /* Not used when writing */ | ||
192 | union acpi_object in_obj[1]; | ||
193 | struct acpi_object_list args = { 1, in_obj }; | ||
194 | |||
195 | in_obj[0].type = ACPI_TYPE_INTEGER; | ||
196 | in_obj[0].integer.value = !!value; | ||
197 | |||
198 | acpi_evaluate_integer(handle, "ALED", &args, &ret); | ||
199 | } | ||
200 | |||
201 | static struct delayed_led_classdev hpled_led = { | ||
202 | .led_classdev = { | ||
203 | .name = "hp::hddprotect", | ||
204 | .default_trigger = "none", | ||
205 | .brightness_set = delayed_sysfs_set, | ||
206 | .flags = LED_CORE_SUSPENDRESUME, | ||
207 | }, | ||
208 | .set_brightness = hpled_set, | ||
209 | }; | ||
157 | 210 | ||
158 | static int lis3lv02d_add(struct acpi_device *device) | 211 | static int lis3lv02d_add(struct acpi_device *device) |
159 | { | 212 | { |
160 | u8 val; | 213 | u8 val; |
214 | int ret; | ||
161 | 215 | ||
162 | if (!device) | 216 | if (!device) |
163 | return -EINVAL; | 217 | return -EINVAL; |
@@ -183,7 +237,19 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
183 | adev.ac = lis3lv02d_axis_normal; | 237 | adev.ac = lis3lv02d_axis_normal; |
184 | } | 238 | } |
185 | 239 | ||
186 | return lis3lv02d_init_device(&adev); | 240 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); |
241 | ret = led_classdev_register(NULL, &hpled_led.led_classdev); | ||
242 | if (ret) | ||
243 | return ret; | ||
244 | |||
245 | ret = lis3lv02d_init_device(&adev); | ||
246 | if (ret) { | ||
247 | flush_work(&hpled_led.work); | ||
248 | led_classdev_unregister(&hpled_led.led_classdev); | ||
249 | return ret; | ||
250 | } | ||
251 | |||
252 | return ret; | ||
187 | } | 253 | } |
188 | 254 | ||
189 | static int lis3lv02d_remove(struct acpi_device *device, int type) | 255 | static int lis3lv02d_remove(struct acpi_device *device, int type) |
@@ -194,6 +260,9 @@ static int lis3lv02d_remove(struct acpi_device *device, int type) | |||
194 | lis3lv02d_joystick_disable(); | 260 | lis3lv02d_joystick_disable(); |
195 | lis3lv02d_poweroff(device->handle); | 261 | lis3lv02d_poweroff(device->handle); |
196 | 262 | ||
263 | flush_work(&hpled_led.work); | ||
264 | led_classdev_unregister(&hpled_led.led_classdev); | ||
265 | |||
197 | return lis3lv02d_remove_fs(); | 266 | return lis3lv02d_remove_fs(); |
198 | } | 267 | } |
199 | 268 | ||
@@ -256,7 +325,7 @@ static void __exit lis3lv02d_exit_module(void) | |||
256 | acpi_bus_unregister_driver(&lis3lv02d_driver); | 325 | acpi_bus_unregister_driver(&lis3lv02d_driver); |
257 | } | 326 | } |
258 | 327 | ||
259 | MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS"); | 328 | MODULE_DESCRIPTION("Glue between LIS3LV02Dx and HP ACPI BIOS and support for disk protection LED."); |
260 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); | 329 | MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek"); |
261 | MODULE_LICENSE("GPL"); | 330 | MODULE_LICENSE("GPL"); |
262 | 331 | ||
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index bd2bde0ef95e..1fe995111841 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/hwmon-sysfs.h> | 31 | #include <linux/hwmon-sysfs.h> |
32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
33 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
34 | #include <asm/processor.h> | ||
34 | 35 | ||
35 | #define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000) | 36 | #define TEMP_FROM_REG(val) (((((val) >> 16) & 0xff) - 49) * 1000) |
36 | #define REG_TEMP 0xe4 | 37 | #define REG_TEMP 0xe4 |
@@ -47,6 +48,8 @@ struct k8temp_data { | |||
47 | /* registers values */ | 48 | /* registers values */ |
48 | u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ | 49 | u8 sensorsp; /* sensor presence bits - SEL_CORE & SEL_PLACE */ |
49 | u32 temp[2][2]; /* core, place */ | 50 | u32 temp[2][2]; /* core, place */ |
51 | u8 swap_core_select; /* meaning of SEL_CORE is inverted */ | ||
52 | u32 temp_offset; | ||
50 | }; | 53 | }; |
51 | 54 | ||
52 | static struct k8temp_data *k8temp_update_device(struct device *dev) | 55 | static struct k8temp_data *k8temp_update_device(struct device *dev) |
@@ -114,10 +117,15 @@ static ssize_t show_temp(struct device *dev, | |||
114 | to_sensor_dev_attr_2(devattr); | 117 | to_sensor_dev_attr_2(devattr); |
115 | int core = attr->nr; | 118 | int core = attr->nr; |
116 | int place = attr->index; | 119 | int place = attr->index; |
120 | int temp; | ||
117 | struct k8temp_data *data = k8temp_update_device(dev); | 121 | struct k8temp_data *data = k8temp_update_device(dev); |
118 | 122 | ||
119 | return sprintf(buf, "%d\n", | 123 | if (data->swap_core_select) |
120 | TEMP_FROM_REG(data->temp[core][place])); | 124 | core = core ? 0 : 1; |
125 | |||
126 | temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; | ||
127 | |||
128 | return sprintf(buf, "%d\n", temp); | ||
121 | } | 129 | } |
122 | 130 | ||
123 | /* core, place */ | 131 | /* core, place */ |
@@ -141,20 +149,49 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, | |||
141 | int err; | 149 | int err; |
142 | u8 scfg; | 150 | u8 scfg; |
143 | u32 temp; | 151 | u32 temp; |
152 | u8 model, stepping; | ||
144 | struct k8temp_data *data; | 153 | struct k8temp_data *data; |
145 | u32 cpuid = cpuid_eax(1); | ||
146 | |||
147 | /* this feature should be available since SH-C0 core */ | ||
148 | if ((cpuid == 0xf40) || (cpuid == 0xf50) || (cpuid == 0xf51)) { | ||
149 | err = -ENODEV; | ||
150 | goto exit; | ||
151 | } | ||
152 | 154 | ||
153 | if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) { | 155 | if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) { |
154 | err = -ENOMEM; | 156 | err = -ENOMEM; |
155 | goto exit; | 157 | goto exit; |
156 | } | 158 | } |
157 | 159 | ||
160 | model = boot_cpu_data.x86_model; | ||
161 | stepping = boot_cpu_data.x86_mask; | ||
162 | |||
163 | switch (boot_cpu_data.x86) { | ||
164 | case 0xf: | ||
165 | /* feature available since SH-C0, exclude older revisions */ | ||
166 | if (((model == 4) && (stepping == 0)) || | ||
167 | ((model == 5) && (stepping <= 1))) { | ||
168 | err = -ENODEV; | ||
169 | goto exit_free; | ||
170 | } | ||
171 | |||
172 | /* | ||
173 | * AMD NPT family 0fh, i.e. RevF and RevG: | ||
174 | * meaning of SEL_CORE bit is inverted | ||
175 | */ | ||
176 | if (model >= 0x40) { | ||
177 | data->swap_core_select = 1; | ||
178 | dev_warn(&pdev->dev, "Temperature readouts might be " | ||
179 | "wrong - check erratum #141\n"); | ||
180 | } | ||
181 | |||
182 | if ((model >= 0x69) && | ||
183 | !(model == 0xc1 || model == 0x6c || model == 0x7c)) { | ||
184 | /* | ||
185 | * RevG desktop CPUs (i.e. no socket S1G1 parts) | ||
186 | * need additional offset, otherwise reported | ||
187 | * temperature is below ambient temperature | ||
188 | */ | ||
189 | data->temp_offset = 21000; | ||
190 | } | ||
191 | |||
192 | break; | ||
193 | } | ||
194 | |||
158 | pci_read_config_byte(pdev, REG_TEMP, &scfg); | 195 | pci_read_config_byte(pdev, REG_TEMP, &scfg); |
159 | scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ | 196 | scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */ |
160 | pci_write_config_byte(pdev, REG_TEMP, scfg); | 197 | pci_write_config_byte(pdev, REG_TEMP, scfg); |
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig index 59c3d23f5bdc..b9bef04b7be4 100644 --- a/drivers/i2c/chips/Kconfig +++ b/drivers/i2c/chips/Kconfig | |||
@@ -139,15 +139,4 @@ config SENSORS_TSL2550 | |||
139 | This driver can also be built as a module. If so, the module | 139 | This driver can also be built as a module. If so, the module |
140 | will be called tsl2550. | 140 | will be called tsl2550. |
141 | 141 | ||
142 | config MCU_MPC8349EMITX | ||
143 | tristate "MPC8349E-mITX MCU driver" | ||
144 | depends on I2C && PPC_83xx | ||
145 | select GENERIC_GPIO | ||
146 | select ARCH_REQUIRE_GPIOLIB | ||
147 | help | ||
148 | Say Y here to enable soft power-off functionality on the Freescale | ||
149 | boards with the MPC8349E-mITX-compatible MCU chips. This driver will | ||
150 | also register MCU GPIOs with the generic GPIO API, so you'll able | ||
151 | to use MCU pins as GPIOs. | ||
152 | |||
153 | endmenu | 142 | endmenu |
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index 83accaaf8164..00fcb5193ac2 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile | |||
@@ -19,7 +19,6 @@ obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o | |||
19 | obj-$(CONFIG_PCF8575) += pcf8575.o | 19 | obj-$(CONFIG_PCF8575) += pcf8575.o |
20 | obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o | 20 | obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o |
21 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o | 21 | obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o |
22 | obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o | ||
23 | 22 | ||
24 | ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) | 23 | ifeq ($(CONFIG_I2C_DEBUG_CHIP),y) |
25 | EXTRA_CFLAGS += -DDEBUG | 24 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/drivers/i2c/chips/mcu_mpc8349emitx.c b/drivers/i2c/chips/mcu_mpc8349emitx.c deleted file mode 100644 index 82a9bcb858b6..000000000000 --- a/drivers/i2c/chips/mcu_mpc8349emitx.c +++ /dev/null | |||
@@ -1,209 +0,0 @@ | |||
1 | /* | ||
2 | * Power Management and GPIO expander driver for MPC8349E-mITX-compatible MCU | ||
3 | * | ||
4 | * Copyright (c) 2008 MontaVista Software, Inc. | ||
5 | * | ||
6 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/mutex.h> | ||
19 | #include <linux/i2c.h> | ||
20 | #include <linux/gpio.h> | ||
21 | #include <linux/of.h> | ||
22 | #include <linux/of_gpio.h> | ||
23 | #include <asm/prom.h> | ||
24 | #include <asm/machdep.h> | ||
25 | |||
26 | /* | ||
27 | * I don't have specifications for the MCU firmware, I found this register | ||
28 | * and bits positions by the trial&error method. | ||
29 | */ | ||
30 | #define MCU_REG_CTRL 0x20 | ||
31 | #define MCU_CTRL_POFF 0x40 | ||
32 | |||
33 | #define MCU_NUM_GPIO 2 | ||
34 | |||
35 | struct mcu { | ||
36 | struct mutex lock; | ||
37 | struct device_node *np; | ||
38 | struct i2c_client *client; | ||
39 | struct of_gpio_chip of_gc; | ||
40 | u8 reg_ctrl; | ||
41 | }; | ||
42 | |||
43 | static struct mcu *glob_mcu; | ||
44 | |||
45 | static void mcu_power_off(void) | ||
46 | { | ||
47 | struct mcu *mcu = glob_mcu; | ||
48 | |||
49 | pr_info("Sending power-off request to the MCU...\n"); | ||
50 | mutex_lock(&mcu->lock); | ||
51 | i2c_smbus_write_byte_data(glob_mcu->client, MCU_REG_CTRL, | ||
52 | mcu->reg_ctrl | MCU_CTRL_POFF); | ||
53 | mutex_unlock(&mcu->lock); | ||
54 | } | ||
55 | |||
56 | static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) | ||
57 | { | ||
58 | struct of_gpio_chip *of_gc = to_of_gpio_chip(gc); | ||
59 | struct mcu *mcu = container_of(of_gc, struct mcu, of_gc); | ||
60 | u8 bit = 1 << (4 + gpio); | ||
61 | |||
62 | mutex_lock(&mcu->lock); | ||
63 | if (val) | ||
64 | mcu->reg_ctrl &= ~bit; | ||
65 | else | ||
66 | mcu->reg_ctrl |= bit; | ||
67 | |||
68 | i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL, mcu->reg_ctrl); | ||
69 | mutex_unlock(&mcu->lock); | ||
70 | } | ||
71 | |||
72 | static int mcu_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) | ||
73 | { | ||
74 | mcu_gpio_set(gc, gpio, val); | ||
75 | return 0; | ||
76 | } | ||
77 | |||
78 | static int mcu_gpiochip_add(struct mcu *mcu) | ||
79 | { | ||
80 | struct device_node *np; | ||
81 | struct of_gpio_chip *of_gc = &mcu->of_gc; | ||
82 | struct gpio_chip *gc = &of_gc->gc; | ||
83 | int ret; | ||
84 | |||
85 | np = of_find_compatible_node(NULL, NULL, "fsl,mcu-mpc8349emitx"); | ||
86 | if (!np) | ||
87 | return -ENODEV; | ||
88 | |||
89 | gc->owner = THIS_MODULE; | ||
90 | gc->label = np->full_name; | ||
91 | gc->can_sleep = 1; | ||
92 | gc->ngpio = MCU_NUM_GPIO; | ||
93 | gc->base = -1; | ||
94 | gc->set = mcu_gpio_set; | ||
95 | gc->direction_output = mcu_gpio_dir_out; | ||
96 | of_gc->gpio_cells = 2; | ||
97 | of_gc->xlate = of_gpio_simple_xlate; | ||
98 | |||
99 | np->data = of_gc; | ||
100 | mcu->np = np; | ||
101 | |||
102 | /* | ||
103 | * We don't want to lose the node, its ->data and ->full_name... | ||
104 | * So, if succeeded, we don't put the node here. | ||
105 | */ | ||
106 | ret = gpiochip_add(gc); | ||
107 | if (ret) | ||
108 | of_node_put(np); | ||
109 | return ret; | ||
110 | } | ||
111 | |||
112 | static int mcu_gpiochip_remove(struct mcu *mcu) | ||
113 | { | ||
114 | int ret; | ||
115 | |||
116 | ret = gpiochip_remove(&mcu->of_gc.gc); | ||
117 | if (ret) | ||
118 | return ret; | ||
119 | of_node_put(mcu->np); | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | static int __devinit mcu_probe(struct i2c_client *client, | ||
125 | const struct i2c_device_id *id) | ||
126 | { | ||
127 | struct mcu *mcu; | ||
128 | int ret; | ||
129 | |||
130 | mcu = kzalloc(sizeof(*mcu), GFP_KERNEL); | ||
131 | if (!mcu) | ||
132 | return -ENOMEM; | ||
133 | |||
134 | mutex_init(&mcu->lock); | ||
135 | mcu->client = client; | ||
136 | i2c_set_clientdata(client, mcu); | ||
137 | |||
138 | ret = i2c_smbus_read_byte_data(mcu->client, MCU_REG_CTRL); | ||
139 | if (ret < 0) | ||
140 | goto err; | ||
141 | mcu->reg_ctrl = ret; | ||
142 | |||
143 | ret = mcu_gpiochip_add(mcu); | ||
144 | if (ret) | ||
145 | goto err; | ||
146 | |||
147 | /* XXX: this is potentially racy, but there is no lock for ppc_md */ | ||
148 | if (!ppc_md.power_off) { | ||
149 | glob_mcu = mcu; | ||
150 | ppc_md.power_off = mcu_power_off; | ||
151 | dev_info(&client->dev, "will provide power-off service\n"); | ||
152 | } | ||
153 | |||
154 | return 0; | ||
155 | err: | ||
156 | kfree(mcu); | ||
157 | return ret; | ||
158 | } | ||
159 | |||
160 | static int __devexit mcu_remove(struct i2c_client *client) | ||
161 | { | ||
162 | struct mcu *mcu = i2c_get_clientdata(client); | ||
163 | int ret; | ||
164 | |||
165 | if (glob_mcu == mcu) { | ||
166 | ppc_md.power_off = NULL; | ||
167 | glob_mcu = NULL; | ||
168 | } | ||
169 | |||
170 | ret = mcu_gpiochip_remove(mcu); | ||
171 | if (ret) | ||
172 | return ret; | ||
173 | i2c_set_clientdata(client, NULL); | ||
174 | kfree(mcu); | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static const struct i2c_device_id mcu_ids[] = { | ||
179 | { "mcu-mpc8349emitx", }, | ||
180 | {}, | ||
181 | }; | ||
182 | MODULE_DEVICE_TABLE(i2c, mcu_ids); | ||
183 | |||
184 | static struct i2c_driver mcu_driver = { | ||
185 | .driver = { | ||
186 | .name = "mcu-mpc8349emitx", | ||
187 | .owner = THIS_MODULE, | ||
188 | }, | ||
189 | .probe = mcu_probe, | ||
190 | .remove = __devexit_p(mcu_remove), | ||
191 | .id_table = mcu_ids, | ||
192 | }; | ||
193 | |||
194 | static int __init mcu_init(void) | ||
195 | { | ||
196 | return i2c_add_driver(&mcu_driver); | ||
197 | } | ||
198 | module_init(mcu_init); | ||
199 | |||
200 | static void __exit mcu_exit(void) | ||
201 | { | ||
202 | i2c_del_driver(&mcu_driver); | ||
203 | } | ||
204 | module_exit(mcu_exit); | ||
205 | |||
206 | MODULE_DESCRIPTION("Power Management and GPIO expander driver for " | ||
207 | "MPC8349E-mITX-compatible MCU"); | ||
208 | MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>"); | ||
209 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 3f9503867e6b..b1c6f68d98ce 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -701,11 +701,6 @@ config BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | |||
701 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX | 701 | depends on SOC_AU1200 && BLK_DEV_IDE_AU1XXX |
702 | endchoice | 702 | endchoice |
703 | 703 | ||
704 | config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ | ||
705 | int "Maximum transfer size (KB) per request (up to 128)" | ||
706 | default "128" | ||
707 | depends on BLK_DEV_IDE_AU1XXX | ||
708 | |||
709 | config BLK_DEV_IDE_TX4938 | 704 | config BLK_DEV_IDE_TX4938 |
710 | tristate "TX4938 internal IDE support" | 705 | tristate "TX4938 internal IDE support" |
711 | depends on SOC_TX4938 | 706 | depends on SOC_TX4938 |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 4088a622873e..806760d24cef 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -633,7 +633,7 @@ static void ide_disk_setup(ide_drive_t *drive) | |||
633 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, | 633 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, |
634 | q->max_sectors / 2); | 634 | q->max_sectors / 2); |
635 | 635 | ||
636 | if (ata_id_is_ssd(id) || ata_id_is_cfa(id)) | 636 | if (ata_id_is_ssd(id)) |
637 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); | 637 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); |
638 | 638 | ||
639 | /* calculate drive capacity, and select LBA if possible */ | 639 | /* calculate drive capacity, and select LBA if possible */ |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index e728cfe7273f..753b92ebe0ae 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -493,7 +493,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti | |||
493 | stat = tp_ops->read_status(hwif); | 493 | stat = tp_ops->read_status(hwif); |
494 | 494 | ||
495 | if (stat & ATA_BUSY) { | 495 | if (stat & ATA_BUSY) { |
496 | local_irq_save(flags); | 496 | local_save_flags(flags); |
497 | local_irq_enable_in_hardirq(); | 497 | local_irq_enable_in_hardirq(); |
498 | timeout += jiffies; | 498 | timeout += jiffies; |
499 | while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) { | 499 | while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) { |
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 4b3bf6a06b70..60538d9c84ee 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -186,12 +186,10 @@ void ide_complete_pm_request(ide_drive_t *drive, struct request *rq) | |||
186 | blk_pm_suspend_request(rq) ? "suspend" : "resume"); | 186 | blk_pm_suspend_request(rq) ? "suspend" : "resume"); |
187 | #endif | 187 | #endif |
188 | spin_lock_irqsave(q->queue_lock, flags); | 188 | spin_lock_irqsave(q->queue_lock, flags); |
189 | if (blk_pm_suspend_request(rq)) { | 189 | if (blk_pm_suspend_request(rq)) |
190 | blk_stop_queue(q); | 190 | blk_stop_queue(q); |
191 | } else { | 191 | else |
192 | drive->dev_flags &= ~IDE_DFLAG_BLOCKED; | 192 | drive->dev_flags &= ~IDE_DFLAG_BLOCKED; |
193 | blk_start_queue(q); | ||
194 | } | ||
195 | spin_unlock_irqrestore(q->queue_lock, flags); | 193 | spin_unlock_irqrestore(q->queue_lock, flags); |
196 | 194 | ||
197 | drive->hwif->rq = NULL; | 195 | drive->hwif->rq = NULL; |
@@ -219,6 +217,8 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
219 | * point. | 217 | * point. |
220 | */ | 218 | */ |
221 | ide_hwif_t *hwif = drive->hwif; | 219 | ide_hwif_t *hwif = drive->hwif; |
220 | struct request_queue *q = drive->queue; | ||
221 | unsigned long flags; | ||
222 | int rc; | 222 | int rc; |
223 | #ifdef DEBUG_PM | 223 | #ifdef DEBUG_PM |
224 | printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); | 224 | printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); |
@@ -231,5 +231,9 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
231 | rc = ide_wait_not_busy(hwif, 100000); | 231 | rc = ide_wait_not_busy(hwif, 100000); |
232 | if (rc) | 232 | if (rc) |
233 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); | 233 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); |
234 | |||
235 | spin_lock_irqsave(q->queue_lock, flags); | ||
236 | blk_start_queue(q); | ||
237 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
234 | } | 238 | } |
235 | } | 239 | } |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 0ccbb4459fb9..312127ea443a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -796,7 +796,7 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
796 | if (irqd) | 796 | if (irqd) |
797 | disable_irq(hwif->irq); | 797 | disable_irq(hwif->irq); |
798 | 798 | ||
799 | local_irq_save(flags); | 799 | local_save_flags(flags); |
800 | local_irq_enable_in_hardirq(); | 800 | local_irq_enable_in_hardirq(); |
801 | 801 | ||
802 | if (ide_port_wait_ready(hwif) == -EBUSY) | 802 | if (ide_port_wait_ready(hwif) == -EBUSY) |
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c index 0be27ac1f077..e1c4f5437396 100644 --- a/drivers/ide/it821x.c +++ b/drivers/ide/it821x.c | |||
@@ -68,6 +68,8 @@ | |||
68 | 68 | ||
69 | #define DRV_NAME "it821x" | 69 | #define DRV_NAME "it821x" |
70 | 70 | ||
71 | #define QUIRK_VORTEX86 1 | ||
72 | |||
71 | struct it821x_dev | 73 | struct it821x_dev |
72 | { | 74 | { |
73 | unsigned int smart:1, /* Are we in smart raid mode */ | 75 | unsigned int smart:1, /* Are we in smart raid mode */ |
@@ -79,6 +81,7 @@ struct it821x_dev | |||
79 | u16 pio[2]; /* Cached PIO values */ | 81 | u16 pio[2]; /* Cached PIO values */ |
80 | u16 mwdma[2]; /* Cached MWDMA values */ | 82 | u16 mwdma[2]; /* Cached MWDMA values */ |
81 | u16 udma[2]; /* Cached UDMA values (per drive) */ | 83 | u16 udma[2]; /* Cached UDMA values (per drive) */ |
84 | u16 quirks; | ||
82 | }; | 85 | }; |
83 | 86 | ||
84 | #define ATA_66 0 | 87 | #define ATA_66 0 |
@@ -557,8 +560,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
557 | * this is necessary. | 560 | * this is necessary. |
558 | */ | 561 | */ |
559 | 562 | ||
560 | pci_read_config_byte(dev, 0x08, &conf); | 563 | if (dev->revision == 0x10) { |
561 | if (conf == 0x10) { | ||
562 | idev->timing10 = 1; | 564 | idev->timing10 = 1; |
563 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 565 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
564 | if (idev->smart == 0) | 566 | if (idev->smart == 0) |
@@ -577,6 +579,12 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) | |||
577 | 579 | ||
578 | hwif->ultra_mask = ATA_UDMA6; | 580 | hwif->ultra_mask = ATA_UDMA6; |
579 | hwif->mwdma_mask = ATA_MWDMA2; | 581 | hwif->mwdma_mask = ATA_MWDMA2; |
582 | |||
583 | /* Vortex86SX quirk: prevent Ultra-DMA mode to fix BadCRC issue */ | ||
584 | if (idev->quirks & QUIRK_VORTEX86) { | ||
585 | if (dev->revision == 0x11) | ||
586 | hwif->ultra_mask = 0; | ||
587 | } | ||
580 | } | 588 | } |
581 | 589 | ||
582 | static void it8212_disable_raid(struct pci_dev *dev) | 590 | static void it8212_disable_raid(struct pci_dev *dev) |
@@ -649,6 +657,8 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic | |||
649 | return -ENOMEM; | 657 | return -ENOMEM; |
650 | } | 658 | } |
651 | 659 | ||
660 | itdevs->quirks = id->driver_data; | ||
661 | |||
652 | rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); | 662 | rc = ide_pci_init_one(dev, &it821x_chipset, itdevs); |
653 | if (rc) | 663 | if (rc) |
654 | kfree(itdevs); | 664 | kfree(itdevs); |
@@ -668,6 +678,7 @@ static void __devexit it821x_remove(struct pci_dev *dev) | |||
668 | static const struct pci_device_id it821x_pci_tbl[] = { | 678 | static const struct pci_device_id it821x_pci_tbl[] = { |
669 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 }, | 679 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 }, |
670 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 }, | 680 | { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 }, |
681 | { PCI_VDEVICE(RDC, PCI_DEVICE_ID_RDC_D1010), QUIRK_VORTEX86 }, | ||
671 | { 0, }, | 682 | { 0, }, |
672 | }; | 683 | }; |
673 | 684 | ||
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c index 48cc748c5043..6297956507c0 100644 --- a/drivers/ide/sl82c105.c +++ b/drivers/ide/sl82c105.c | |||
@@ -310,10 +310,6 @@ static const struct ide_port_info sl82c105_chipset __devinitdata = { | |||
310 | .dma_ops = &sl82c105_dma_ops, | 310 | .dma_ops = &sl82c105_dma_ops, |
311 | .host_flags = IDE_HFLAG_IO_32BIT | | 311 | .host_flags = IDE_HFLAG_IO_32BIT | |
312 | IDE_HFLAG_UNMASK_IRQS | | 312 | IDE_HFLAG_UNMASK_IRQS | |
313 | /* FIXME: check for Compatibility mode in generic IDE PCI code */ | ||
314 | #if defined(CONFIG_LOPEC) || defined(CONFIG_SANDPOINT) | ||
315 | IDE_HFLAG_FORCE_LEGACY_IRQS | | ||
316 | #endif | ||
317 | IDE_HFLAG_SERIALIZE_DMA | | 313 | IDE_HFLAG_SERIALIZE_DMA | |
318 | IDE_HFLAG_NO_AUTODMA, | 314 | IDE_HFLAG_NO_AUTODMA, |
319 | .pio_mask = ATA_PIO5, | 315 | .pio_mask = ATA_PIO5, |
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index b4ef218072cd..d9095345f7ca 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c | |||
@@ -202,7 +202,6 @@ static const struct ide_tp_ops tx4938ide_tp_ops = { | |||
202 | .exec_command = ide_exec_command, | 202 | .exec_command = ide_exec_command, |
203 | .read_status = ide_read_status, | 203 | .read_status = ide_read_status, |
204 | .read_altstatus = ide_read_altstatus, | 204 | .read_altstatus = ide_read_altstatus, |
205 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
206 | 205 | ||
207 | .set_irq = ide_set_irq, | 206 | .set_irq = ide_set_irq, |
208 | 207 | ||
diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c index fecc0e03c3fc..703c3eeb20a8 100644 --- a/drivers/ide/via82cxxx.c +++ b/drivers/ide/via82cxxx.c | |||
@@ -432,8 +432,6 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i | |||
432 | if (via_clock < 20000 || via_clock > 50000) { | 432 | if (via_clock < 20000 || via_clock > 50000) { |
433 | printk(KERN_WARNING DRV_NAME ": User given PCI clock speed " | 433 | printk(KERN_WARNING DRV_NAME ": User given PCI clock speed " |
434 | "impossible (%d), using 33 MHz instead.\n", via_clock); | 434 | "impossible (%d), using 33 MHz instead.\n", via_clock); |
435 | printk(KERN_WARNING DRV_NAME ": Use ide0=ata66 if you want " | ||
436 | "to assume 80-wire cable.\n"); | ||
437 | via_clock = 33333; | 435 | via_clock = 33333; |
438 | } | 436 | } |
439 | 437 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index 3b77b674cbf6..c7b8a506af65 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -955,7 +955,7 @@ void ehca_poll_eqs(unsigned long data) | |||
955 | struct ehca_eq *eq = &shca->eq; | 955 | struct ehca_eq *eq = &shca->eq; |
956 | int max = 3; | 956 | int max = 3; |
957 | volatile u64 q_ofs, q_ofs2; | 957 | volatile u64 q_ofs, q_ofs2; |
958 | u64 flags; | 958 | unsigned long flags; |
959 | spin_lock_irqsave(&eq->spinlock, flags); | 959 | spin_lock_irqsave(&eq->spinlock, flags); |
960 | q_ofs = eq->ipz_queue.current_q_offset; | 960 | q_ofs = eq->ipz_queue.current_q_offset; |
961 | spin_unlock_irqrestore(&eq->spinlock, flags); | 961 | spin_unlock_irqrestore(&eq->spinlock, flags); |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index dcefe1fceb5c..61588bd273bd 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -543,14 +543,21 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
543 | { | 543 | { |
544 | static int mlx4_ib_version_printed; | 544 | static int mlx4_ib_version_printed; |
545 | struct mlx4_ib_dev *ibdev; | 545 | struct mlx4_ib_dev *ibdev; |
546 | int num_ports = 0; | ||
546 | int i; | 547 | int i; |
547 | 548 | ||
548 | |||
549 | if (!mlx4_ib_version_printed) { | 549 | if (!mlx4_ib_version_printed) { |
550 | printk(KERN_INFO "%s", mlx4_ib_version); | 550 | printk(KERN_INFO "%s", mlx4_ib_version); |
551 | ++mlx4_ib_version_printed; | 551 | ++mlx4_ib_version_printed; |
552 | } | 552 | } |
553 | 553 | ||
554 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
555 | num_ports++; | ||
556 | |||
557 | /* No point in registering a device with no ports... */ | ||
558 | if (num_ports == 0) | ||
559 | return NULL; | ||
560 | |||
554 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); | 561 | ibdev = (struct mlx4_ib_dev *) ib_alloc_device(sizeof *ibdev); |
555 | if (!ibdev) { | 562 | if (!ibdev) { |
556 | dev_err(&dev->pdev->dev, "Device struct alloc failed\n"); | 563 | dev_err(&dev->pdev->dev, "Device struct alloc failed\n"); |
@@ -574,9 +581,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
574 | ibdev->ib_dev.owner = THIS_MODULE; | 581 | ibdev->ib_dev.owner = THIS_MODULE; |
575 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; | 582 | ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; |
576 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; | 583 | ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; |
577 | ibdev->num_ports = 0; | 584 | ibdev->num_ports = num_ports; |
578 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
579 | ibdev->num_ports++; | ||
580 | ibdev->ib_dev.phys_port_cnt = ibdev->num_ports; | 585 | ibdev->ib_dev.phys_port_cnt = ibdev->num_ports; |
581 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; | 586 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; |
582 | ibdev->ib_dev.dma_device = &dev->pdev->dev; | 587 | ibdev->ib_dev.dma_device = &dev->pdev->dev; |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 6ba57e91d7ab..a01b4488208b 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -778,12 +778,13 @@ static struct nes_cm_node *find_node(struct nes_cm_core *cm_core, | |||
778 | unsigned long flags; | 778 | unsigned long flags; |
779 | struct list_head *hte; | 779 | struct list_head *hte; |
780 | struct nes_cm_node *cm_node; | 780 | struct nes_cm_node *cm_node; |
781 | __be32 tmp_addr = cpu_to_be32(loc_addr); | ||
781 | 782 | ||
782 | /* get a handle on the hte */ | 783 | /* get a handle on the hte */ |
783 | hte = &cm_core->connected_nodes; | 784 | hte = &cm_core->connected_nodes; |
784 | 785 | ||
785 | nes_debug(NES_DBG_CM, "Searching for an owner node: %pI4:%x from core %p->%p\n", | 786 | nes_debug(NES_DBG_CM, "Searching for an owner node: %pI4:%x from core %p->%p\n", |
786 | &loc_addr, loc_port, cm_core, hte); | 787 | &tmp_addr, loc_port, cm_core, hte); |
787 | 788 | ||
788 | /* walk list and find cm_node associated with this session ID */ | 789 | /* walk list and find cm_node associated with this session ID */ |
789 | spin_lock_irqsave(&cm_core->ht_lock, flags); | 790 | spin_lock_irqsave(&cm_core->ht_lock, flags); |
@@ -816,6 +817,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, | |||
816 | { | 817 | { |
817 | unsigned long flags; | 818 | unsigned long flags; |
818 | struct nes_cm_listener *listen_node; | 819 | struct nes_cm_listener *listen_node; |
820 | __be32 tmp_addr = cpu_to_be32(dst_addr); | ||
819 | 821 | ||
820 | /* walk list and find cm_node associated with this session ID */ | 822 | /* walk list and find cm_node associated with this session ID */ |
821 | spin_lock_irqsave(&cm_core->listen_list_lock, flags); | 823 | spin_lock_irqsave(&cm_core->listen_list_lock, flags); |
@@ -833,7 +835,7 @@ static struct nes_cm_listener *find_listener(struct nes_cm_core *cm_core, | |||
833 | spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); | 835 | spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); |
834 | 836 | ||
835 | nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n", | 837 | nes_debug(NES_DBG_CM, "Unable to find listener for %pI4:%x\n", |
836 | &dst_addr, dst_port); | 838 | &tmp_addr, dst_port); |
837 | 839 | ||
838 | /* no listener */ | 840 | /* no listener */ |
839 | return NULL; | 841 | return NULL; |
@@ -2059,6 +2061,7 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core, | |||
2059 | struct tcphdr *tcph; | 2061 | struct tcphdr *tcph; |
2060 | struct nes_cm_info nfo; | 2062 | struct nes_cm_info nfo; |
2061 | int skb_handled = 1; | 2063 | int skb_handled = 1; |
2064 | __be32 tmp_daddr, tmp_saddr; | ||
2062 | 2065 | ||
2063 | if (!skb) | 2066 | if (!skb) |
2064 | return 0; | 2067 | return 0; |
@@ -2074,8 +2077,11 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core, | |||
2074 | nfo.rem_addr = ntohl(iph->saddr); | 2077 | nfo.rem_addr = ntohl(iph->saddr); |
2075 | nfo.rem_port = ntohs(tcph->source); | 2078 | nfo.rem_port = ntohs(tcph->source); |
2076 | 2079 | ||
2080 | tmp_daddr = cpu_to_be32(iph->daddr); | ||
2081 | tmp_saddr = cpu_to_be32(iph->saddr); | ||
2082 | |||
2077 | nes_debug(NES_DBG_CM, "Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n", | 2083 | nes_debug(NES_DBG_CM, "Received packet: dest=%pI4:0x%04X src=%pI4:0x%04X\n", |
2078 | &iph->daddr, tcph->dest, &iph->saddr, tcph->source); | 2084 | &tmp_daddr, tcph->dest, &tmp_saddr, tcph->source); |
2079 | 2085 | ||
2080 | do { | 2086 | do { |
2081 | cm_node = find_node(cm_core, | 2087 | cm_node = find_node(cm_core, |
diff --git a/drivers/infiniband/hw/nes/nes_utils.c b/drivers/infiniband/hw/nes/nes_utils.c index aa9b7348c728..6f3bc1b6bf22 100644 --- a/drivers/infiniband/hw/nes/nes_utils.c +++ b/drivers/infiniband/hw/nes/nes_utils.c | |||
@@ -655,6 +655,7 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti | |||
655 | struct nes_adapter *nesadapter = nesdev->nesadapter; | 655 | struct nes_adapter *nesadapter = nesdev->nesadapter; |
656 | int arp_index; | 656 | int arp_index; |
657 | int err = 0; | 657 | int err = 0; |
658 | __be32 tmp_addr; | ||
658 | 659 | ||
659 | for (arp_index = 0; (u32) arp_index < nesadapter->arp_table_size; arp_index++) { | 660 | for (arp_index = 0; (u32) arp_index < nesadapter->arp_table_size; arp_index++) { |
660 | if (nesadapter->arp_table[arp_index].ip_addr == ip_addr) | 661 | if (nesadapter->arp_table[arp_index].ip_addr == ip_addr) |
@@ -682,8 +683,9 @@ int nes_arp_table(struct nes_device *nesdev, u32 ip_addr, u8 *mac_addr, u32 acti | |||
682 | 683 | ||
683 | /* DELETE or RESOLVE */ | 684 | /* DELETE or RESOLVE */ |
684 | if (arp_index == nesadapter->arp_table_size) { | 685 | if (arp_index == nesadapter->arp_table_size) { |
686 | tmp_addr = cpu_to_be32(ip_addr); | ||
685 | nes_debug(NES_DBG_NETDEV, "MAC for %pI4 not in ARP table - cannot %s\n", | 687 | nes_debug(NES_DBG_NETDEV, "MAC for %pI4 not in ARP table - cannot %s\n", |
686 | &ip_addr, action == NES_ARP_RESOLVE ? "resolve" : "delete"); | 688 | &tmp_addr, action == NES_ARP_RESOLVE ? "resolve" : "delete"); |
687 | return -1; | 689 | return -1; |
688 | } | 690 | } |
689 | 691 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 19e06bc38b39..dce0443f9d69 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -711,26 +711,26 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
711 | 711 | ||
712 | neigh = *to_ipoib_neigh(skb->dst->neighbour); | 712 | neigh = *to_ipoib_neigh(skb->dst->neighbour); |
713 | 713 | ||
714 | if (neigh->ah) | 714 | if (unlikely((memcmp(&neigh->dgid.raw, |
715 | if (unlikely((memcmp(&neigh->dgid.raw, | 715 | skb->dst->neighbour->ha + 4, |
716 | skb->dst->neighbour->ha + 4, | 716 | sizeof(union ib_gid))) || |
717 | sizeof(union ib_gid))) || | 717 | (neigh->dev != dev))) { |
718 | (neigh->dev != dev))) { | 718 | spin_lock_irqsave(&priv->lock, flags); |
719 | spin_lock_irqsave(&priv->lock, flags); | 719 | /* |
720 | /* | 720 | * It's safe to call ipoib_put_ah() inside |
721 | * It's safe to call ipoib_put_ah() inside | 721 | * priv->lock here, because we know that |
722 | * priv->lock here, because we know that | 722 | * path->ah will always hold one more reference, |
723 | * path->ah will always hold one more reference, | 723 | * so ipoib_put_ah() will never do more than |
724 | * so ipoib_put_ah() will never do more than | 724 | * decrement the ref count. |
725 | * decrement the ref count. | 725 | */ |
726 | */ | 726 | if (neigh->ah) |
727 | ipoib_put_ah(neigh->ah); | 727 | ipoib_put_ah(neigh->ah); |
728 | list_del(&neigh->list); | 728 | list_del(&neigh->list); |
729 | ipoib_neigh_free(dev, neigh); | 729 | ipoib_neigh_free(dev, neigh); |
730 | spin_unlock_irqrestore(&priv->lock, flags); | 730 | spin_unlock_irqrestore(&priv->lock, flags); |
731 | ipoib_path_lookup(skb, dev); | 731 | ipoib_path_lookup(skb, dev); |
732 | return NETDEV_TX_OK; | 732 | return NETDEV_TX_OK; |
733 | } | 733 | } |
734 | 734 | ||
735 | if (ipoib_cm_get(neigh)) { | 735 | if (ipoib_cm_get(neigh)) { |
736 | if (ipoib_cm_up(neigh)) { | 736 | if (ipoib_cm_up(neigh)) { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index a2eb3b9789eb..59d02e0b8df1 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -529,6 +529,9 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
529 | if (!priv->broadcast) { | 529 | if (!priv->broadcast) { |
530 | struct ipoib_mcast *broadcast; | 530 | struct ipoib_mcast *broadcast; |
531 | 531 | ||
532 | if (!test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)) | ||
533 | return; | ||
534 | |||
532 | broadcast = ipoib_mcast_alloc(dev, 1); | 535 | broadcast = ipoib_mcast_alloc(dev, 1); |
533 | if (!broadcast) { | 536 | if (!broadcast) { |
534 | ipoib_warn(priv, "failed to allocate broadcast group\n"); | 537 | ipoib_warn(priv, "failed to allocate broadcast group\n"); |
diff --git a/drivers/infiniband/ulp/iser/Kconfig b/drivers/infiniband/ulp/iser/Kconfig index 77dedba829e6..b411c51842da 100644 --- a/drivers/infiniband/ulp/iser/Kconfig +++ b/drivers/infiniband/ulp/iser/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config INFINIBAND_ISER | 1 | config INFINIBAND_ISER |
2 | tristate "iSCSI Extensions for RDMA (iSER)" | 2 | tristate "iSCSI Extensions for RDMA (iSER)" |
3 | depends on SCSI && INET | 3 | depends on SCSI && INET && INFINIBAND_ADDR_TRANS |
4 | select SCSI_ISCSI_ATTRS | 4 | select SCSI_ISCSI_ATTRS |
5 | ---help--- | 5 | ---help--- |
6 | Support for the iSCSI Extensions for RDMA (iSER) Protocol | 6 | Support for the iSCSI Extensions for RDMA (iSER) Protocol |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a4a1ae214630..742713611bc5 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -119,13 +119,6 @@ config LEDS_GPIO | |||
119 | outputs. To be useful the particular board must have LEDs | 119 | outputs. To be useful the particular board must have LEDs |
120 | and they must be connected to the GPIO lines. | 120 | and they must be connected to the GPIO lines. |
121 | 121 | ||
122 | config LEDS_HP_DISK | ||
123 | tristate "LED Support for disk protection LED on HP notebooks" | ||
124 | depends on LEDS_CLASS && ACPI | ||
125 | help | ||
126 | This option enable support for disk protection LED, found on | ||
127 | newer HP notebooks. | ||
128 | |||
129 | config LEDS_CLEVO_MAIL | 122 | config LEDS_CLEVO_MAIL |
130 | tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" | 123 | tristate "Mail LED on Clevo notebook (EXPERIMENTAL)" |
131 | depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL | 124 | depends on LEDS_CLASS && X86 && SERIO_I8042 && DMI && EXPERIMENTAL |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index bc247cb02e82..9d76f0f160a4 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -23,7 +23,6 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o | |||
23 | obj-$(CONFIG_LEDS_FSG) += leds-fsg.o | 23 | obj-$(CONFIG_LEDS_FSG) += leds-fsg.o |
24 | obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o | 24 | obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o |
25 | obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o | 25 | obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o |
26 | obj-$(CONFIG_LEDS_HP_DISK) += leds-hp-disk.o | ||
27 | obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o | 26 | obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o |
28 | 27 | ||
29 | # LED Triggers | 28 | # LED Triggers |
diff --git a/drivers/leds/leds-hp-disk.c b/drivers/leds/leds-hp-disk.c deleted file mode 100644 index d786adc8c5e3..000000000000 --- a/drivers/leds/leds-hp-disk.c +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | /* | ||
2 | * leds-hp-disk.c - driver for HP "hard disk protection" LED | ||
3 | * | ||
4 | * Copyright (C) 2008 Pavel Machek | ||
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; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/dmi.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/input.h> | ||
29 | #include <linux/kthread.h> | ||
30 | #include <linux/leds.h> | ||
31 | #include <acpi/acpi_drivers.h> | ||
32 | |||
33 | #define DRIVER_NAME "leds-hp-disk" | ||
34 | #define ACPI_MDPS_CLASS "led" | ||
35 | |||
36 | /* For automatic insertion of the module */ | ||
37 | static struct acpi_device_id hpled_device_ids[] = { | ||
38 | {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ | ||
39 | {"", 0}, | ||
40 | }; | ||
41 | MODULE_DEVICE_TABLE(acpi, hpled_device_ids); | ||
42 | |||
43 | struct acpi_hpled { | ||
44 | struct acpi_device *device; /* The ACPI device */ | ||
45 | }; | ||
46 | |||
47 | static struct acpi_hpled adev; | ||
48 | |||
49 | static acpi_status hpled_acpi_write(acpi_handle handle, int reg) | ||
50 | { | ||
51 | unsigned long long ret; /* Not used when writing */ | ||
52 | union acpi_object in_obj[1]; | ||
53 | struct acpi_object_list args = { 1, in_obj }; | ||
54 | |||
55 | in_obj[0].type = ACPI_TYPE_INTEGER; | ||
56 | in_obj[0].integer.value = reg; | ||
57 | |||
58 | return acpi_evaluate_integer(handle, "ALED", &args, &ret); | ||
59 | } | ||
60 | |||
61 | static void hpled_set(struct led_classdev *led_cdev, | ||
62 | enum led_brightness value) | ||
63 | { | ||
64 | hpled_acpi_write(adev.device->handle, !!value); | ||
65 | } | ||
66 | |||
67 | static struct led_classdev hpled_led = { | ||
68 | .name = "hp:red:hddprotection", | ||
69 | .default_trigger = "heartbeat", | ||
70 | .brightness_set = hpled_set, | ||
71 | .flags = LED_CORE_SUSPENDRESUME, | ||
72 | }; | ||
73 | |||
74 | static int hpled_add(struct acpi_device *device) | ||
75 | { | ||
76 | int ret; | ||
77 | |||
78 | if (!device) | ||
79 | return -EINVAL; | ||
80 | |||
81 | adev.device = device; | ||
82 | strcpy(acpi_device_name(device), DRIVER_NAME); | ||
83 | strcpy(acpi_device_class(device), ACPI_MDPS_CLASS); | ||
84 | device->driver_data = &adev; | ||
85 | |||
86 | ret = led_classdev_register(NULL, &hpled_led); | ||
87 | return ret; | ||
88 | } | ||
89 | |||
90 | static int hpled_remove(struct acpi_device *device, int type) | ||
91 | { | ||
92 | if (!device) | ||
93 | return -EINVAL; | ||
94 | |||
95 | led_classdev_unregister(&hpled_led); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | |||
100 | |||
101 | static struct acpi_driver leds_hp_driver = { | ||
102 | .name = DRIVER_NAME, | ||
103 | .class = ACPI_MDPS_CLASS, | ||
104 | .ids = hpled_device_ids, | ||
105 | .ops = { | ||
106 | .add = hpled_add, | ||
107 | .remove = hpled_remove, | ||
108 | } | ||
109 | }; | ||
110 | |||
111 | static int __init hpled_init_module(void) | ||
112 | { | ||
113 | int ret; | ||
114 | |||
115 | if (acpi_disabled) | ||
116 | return -ENODEV; | ||
117 | |||
118 | ret = acpi_bus_register_driver(&leds_hp_driver); | ||
119 | if (ret < 0) | ||
120 | return ret; | ||
121 | |||
122 | printk(KERN_INFO DRIVER_NAME " driver loaded.\n"); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static void __exit hpled_exit_module(void) | ||
128 | { | ||
129 | acpi_bus_unregister_driver(&leds_hp_driver); | ||
130 | } | ||
131 | |||
132 | MODULE_DESCRIPTION("Driver for HP disk protection LED"); | ||
133 | MODULE_AUTHOR("Pavel Machek <pavel@suse.cz>"); | ||
134 | MODULE_LICENSE("GPL"); | ||
135 | |||
136 | module_init(hpled_init_module); | ||
137 | module_exit(hpled_exit_module); | ||
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c index 074b11ffbf41..e7ab0035d305 100644 --- a/drivers/mfd/twl4030-core.c +++ b/drivers/mfd/twl4030-core.c | |||
@@ -649,7 +649,7 @@ static inline int __init unprotect_pm_master(void) | |||
649 | return e; | 649 | return e; |
650 | } | 650 | } |
651 | 651 | ||
652 | static void __init clocks_init(void) | 652 | static void __init clocks_init(struct device *dev) |
653 | { | 653 | { |
654 | int e = 0; | 654 | int e = 0; |
655 | struct clk *osc; | 655 | struct clk *osc; |
@@ -658,9 +658,9 @@ static void __init clocks_init(void) | |||
658 | 658 | ||
659 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 659 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) |
660 | if (cpu_is_omap2430()) | 660 | if (cpu_is_omap2430()) |
661 | osc = clk_get(NULL, "osc_ck"); | 661 | osc = clk_get(dev, "osc_ck"); |
662 | else | 662 | else |
663 | osc = clk_get(NULL, "osc_sys_ck"); | 663 | osc = clk_get(dev, "osc_sys_ck"); |
664 | 664 | ||
665 | if (IS_ERR(osc)) { | 665 | if (IS_ERR(osc)) { |
666 | printk(KERN_WARNING "Skipping twl4030 internal clock init and " | 666 | printk(KERN_WARNING "Skipping twl4030 internal clock init and " |
@@ -776,7 +776,7 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
776 | inuse = true; | 776 | inuse = true; |
777 | 777 | ||
778 | /* setup clock framework */ | 778 | /* setup clock framework */ |
779 | clocks_init(); | 779 | clocks_init(&client->dev); |
780 | 780 | ||
781 | /* Maybe init the T2 Interrupt subsystem */ | 781 | /* Maybe init the T2 Interrupt subsystem */ |
782 | if (client->irq | 782 | if (client->irq |
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c index 73b7fb8de47a..82fb9958f22f 100644 --- a/drivers/misc/sgi-xp/xpc_sn2.c +++ b/drivers/misc/sgi-xp/xpc_sn2.c | |||
@@ -899,7 +899,7 @@ xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version, | |||
899 | dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", | 899 | dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n", |
900 | part_sn2->remote_vars_pa); | 900 | part_sn2->remote_vars_pa); |
901 | 901 | ||
902 | part->last_heartbeat = remote_vars->heartbeat; | 902 | part->last_heartbeat = remote_vars->heartbeat - 1; |
903 | dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", | 903 | dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n", |
904 | part->last_heartbeat); | 904 | part->last_heartbeat); |
905 | 905 | ||
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index e3131ea629cd..dfe92264e825 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -132,7 +132,7 @@ void ehea_dump(void *adr, int len, char *msg) | |||
132 | int x; | 132 | int x; |
133 | unsigned char *deb = adr; | 133 | unsigned char *deb = adr; |
134 | for (x = 0; x < len; x += 16) { | 134 | for (x = 0; x < len; x += 16) { |
135 | printk(DRV_NAME " %s adr=%p ofs=%04x %016lx %016lx\n", msg, | 135 | printk(DRV_NAME " %s adr=%p ofs=%04x %016llx %016llx\n", msg, |
136 | deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); | 136 | deb, x, *((u64 *)&deb[0]), *((u64 *)&deb[8])); |
137 | deb += 16; | 137 | deb += 16; |
138 | } | 138 | } |
@@ -883,7 +883,7 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param) | |||
883 | 883 | ||
884 | while (eqe) { | 884 | while (eqe) { |
885 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); | 885 | qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); |
886 | ehea_error("QP aff_err: entry=0x%lx, token=0x%x", | 886 | ehea_error("QP aff_err: entry=0x%llx, token=0x%x", |
887 | eqe->entry, qp_token); | 887 | eqe->entry, qp_token); |
888 | 888 | ||
889 | qp = port->port_res[qp_token].qp; | 889 | qp = port->port_res[qp_token].qp; |
@@ -1159,7 +1159,7 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe) | |||
1159 | netif_stop_queue(port->netdev); | 1159 | netif_stop_queue(port->netdev); |
1160 | break; | 1160 | break; |
1161 | default: | 1161 | default: |
1162 | ehea_error("unknown event code %x, eqe=0x%lX", ec, eqe); | 1162 | ehea_error("unknown event code %x, eqe=0x%llX", ec, eqe); |
1163 | break; | 1163 | break; |
1164 | } | 1164 | } |
1165 | } | 1165 | } |
@@ -1971,7 +1971,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1971 | } | 1971 | } |
1972 | 1972 | ||
1973 | if (dev->mc_count > port->adapter->max_mc_mac) { | 1973 | if (dev->mc_count > port->adapter->max_mc_mac) { |
1974 | ehea_info("Mcast registration limit reached (0x%lx). " | 1974 | ehea_info("Mcast registration limit reached (0x%llx). " |
1975 | "Use ALLMULTI!", | 1975 | "Use ALLMULTI!", |
1976 | port->adapter->max_mc_mac); | 1976 | port->adapter->max_mc_mac); |
1977 | goto out; | 1977 | goto out; |
diff --git a/drivers/net/ehea/ehea_qmr.c b/drivers/net/ehea/ehea_qmr.c index 225c692b5d99..49d766ebbcf4 100644 --- a/drivers/net/ehea/ehea_qmr.c +++ b/drivers/net/ehea/ehea_qmr.c | |||
@@ -168,7 +168,7 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
168 | cq->fw_handle, rpage, 1); | 168 | cq->fw_handle, rpage, 1); |
169 | if (hret < H_SUCCESS) { | 169 | if (hret < H_SUCCESS) { |
170 | ehea_error("register_rpage_cq failed ehea_cq=%p " | 170 | ehea_error("register_rpage_cq failed ehea_cq=%p " |
171 | "hret=%lx counter=%i act_pages=%i", | 171 | "hret=%llx counter=%i act_pages=%i", |
172 | cq, hret, counter, cq->attr.nr_pages); | 172 | cq, hret, counter, cq->attr.nr_pages); |
173 | goto out_kill_hwq; | 173 | goto out_kill_hwq; |
174 | } | 174 | } |
@@ -178,13 +178,13 @@ struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter, | |||
178 | 178 | ||
179 | if ((hret != H_SUCCESS) || (vpage)) { | 179 | if ((hret != H_SUCCESS) || (vpage)) { |
180 | ehea_error("registration of pages not " | 180 | ehea_error("registration of pages not " |
181 | "complete hret=%lx\n", hret); | 181 | "complete hret=%llx\n", hret); |
182 | goto out_kill_hwq; | 182 | goto out_kill_hwq; |
183 | } | 183 | } |
184 | } else { | 184 | } else { |
185 | if (hret != H_PAGE_REGISTERED) { | 185 | if (hret != H_PAGE_REGISTERED) { |
186 | ehea_error("CQ: registration of page failed " | 186 | ehea_error("CQ: registration of page failed " |
187 | "hret=%lx\n", hret); | 187 | "hret=%llx\n", hret); |
188 | goto out_kill_hwq; | 188 | goto out_kill_hwq; |
189 | } | 189 | } |
190 | } | 190 | } |
@@ -986,15 +986,15 @@ void print_error_data(u64 *data) | |||
986 | length = EHEA_PAGESIZE; | 986 | length = EHEA_PAGESIZE; |
987 | 987 | ||
988 | if (type == 0x8) /* Queue Pair */ | 988 | if (type == 0x8) /* Queue Pair */ |
989 | ehea_error("QP (resource=%lX) state: AER=0x%lX, AERR=0x%lX, " | 989 | ehea_error("QP (resource=%llX) state: AER=0x%llX, AERR=0x%llX, " |
990 | "port=%lX", resource, data[6], data[12], data[22]); | 990 | "port=%llX", resource, data[6], data[12], data[22]); |
991 | 991 | ||
992 | if (type == 0x4) /* Completion Queue */ | 992 | if (type == 0x4) /* Completion Queue */ |
993 | ehea_error("CQ (resource=%lX) state: AER=0x%lX", resource, | 993 | ehea_error("CQ (resource=%llX) state: AER=0x%llX", resource, |
994 | data[6]); | 994 | data[6]); |
995 | 995 | ||
996 | if (type == 0x3) /* Event Queue */ | 996 | if (type == 0x3) /* Event Queue */ |
997 | ehea_error("EQ (resource=%lX) state: AER=0x%lX", resource, | 997 | ehea_error("EQ (resource=%llX) state: AER=0x%llX", resource, |
998 | data[6]); | 998 | data[6]); |
999 | 999 | ||
1000 | ehea_dump(data, length, "error data"); | 1000 | ehea_dump(data, length, "error data"); |
@@ -1016,11 +1016,11 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle) | |||
1016 | rblock); | 1016 | rblock); |
1017 | 1017 | ||
1018 | if (ret == H_R_STATE) | 1018 | if (ret == H_R_STATE) |
1019 | ehea_error("No error data is available: %lX.", res_handle); | 1019 | ehea_error("No error data is available: %llX.", res_handle); |
1020 | else if (ret == H_SUCCESS) | 1020 | else if (ret == H_SUCCESS) |
1021 | print_error_data(rblock); | 1021 | print_error_data(rblock); |
1022 | else | 1022 | else |
1023 | ehea_error("Error data could not be fetched: %lX", res_handle); | 1023 | ehea_error("Error data could not be fetched: %llX", res_handle); |
1024 | 1024 | ||
1025 | kfree(rblock); | 1025 | kfree(rblock); |
1026 | } | 1026 | } |
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c index ca3bb9f7321b..dfa6348ac1dc 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -602,7 +602,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
602 | 602 | ||
603 | if(lpar_rc != H_SUCCESS) { | 603 | if(lpar_rc != H_SUCCESS) { |
604 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); | 604 | ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); |
605 | ibmveth_error_printk("buffer TCE:0x%lx filter TCE:0x%lx rxq desc:0x%lx MAC:0x%lx\n", | 605 | ibmveth_error_printk("buffer TCE:0x%llx filter TCE:0x%llx rxq desc:0x%llx MAC:0x%llx\n", |
606 | adapter->buffer_list_dma, | 606 | adapter->buffer_list_dma, |
607 | adapter->filter_list_dma, | 607 | adapter->filter_list_dma, |
608 | rxq_desc.desc, | 608 | rxq_desc.desc, |
@@ -1378,13 +1378,13 @@ static int ibmveth_show(struct seq_file *seq, void *v) | |||
1378 | seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac); | 1378 | seq_printf(seq, "Firmware MAC: %pM\n", firmware_mac); |
1379 | 1379 | ||
1380 | seq_printf(seq, "\nAdapter Statistics:\n"); | 1380 | seq_printf(seq, "\nAdapter Statistics:\n"); |
1381 | seq_printf(seq, " TX: vio_map_single failres: %ld\n", adapter->tx_map_failed); | 1381 | seq_printf(seq, " TX: vio_map_single failres: %lld\n", adapter->tx_map_failed); |
1382 | seq_printf(seq, " send failures: %ld\n", adapter->tx_send_failed); | 1382 | seq_printf(seq, " send failures: %lld\n", adapter->tx_send_failed); |
1383 | seq_printf(seq, " RX: replenish task cycles: %ld\n", adapter->replenish_task_cycles); | 1383 | seq_printf(seq, " RX: replenish task cycles: %lld\n", adapter->replenish_task_cycles); |
1384 | seq_printf(seq, " alloc_skb_failures: %ld\n", adapter->replenish_no_mem); | 1384 | seq_printf(seq, " alloc_skb_failures: %lld\n", adapter->replenish_no_mem); |
1385 | seq_printf(seq, " add buffer failures: %ld\n", adapter->replenish_add_buff_failure); | 1385 | seq_printf(seq, " add buffer failures: %lld\n", adapter->replenish_add_buff_failure); |
1386 | seq_printf(seq, " invalid buffers: %ld\n", adapter->rx_invalid_buffer); | 1386 | seq_printf(seq, " invalid buffers: %lld\n", adapter->rx_invalid_buffer); |
1387 | seq_printf(seq, " no buffers: %ld\n", adapter->rx_no_buffer); | 1387 | seq_printf(seq, " no buffers: %lld\n", adapter->rx_no_buffer); |
1388 | 1388 | ||
1389 | return 0; | 1389 | return 0; |
1390 | } | 1390 | } |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index c7457f97259d..cb793c2bade2 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -429,7 +429,7 @@ SIMPLE_PORT_ATTR(promiscuous); | |||
429 | SIMPLE_PORT_ATTR(num_mcast); | 429 | SIMPLE_PORT_ATTR(num_mcast); |
430 | CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map); | 430 | CUSTOM_PORT_ATTR(lpar_map, "0x%X\n", port->lpar_map); |
431 | CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map); | 431 | CUSTOM_PORT_ATTR(stopped_map, "0x%X\n", port->stopped_map); |
432 | CUSTOM_PORT_ATTR(mac_addr, "0x%lX\n", port->mac_addr); | 432 | CUSTOM_PORT_ATTR(mac_addr, "0x%llX\n", port->mac_addr); |
433 | 433 | ||
434 | #define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr) | 434 | #define GET_PORT_ATTR(_name) (&veth_port_attr_##_name.attr) |
435 | static struct attribute *veth_port_default_attrs[] = { | 435 | static struct attribute *veth_port_default_attrs[] = { |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 710c79e7a2db..6ef2490d5c3e 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
@@ -912,8 +912,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) | |||
912 | int i; | 912 | int i; |
913 | 913 | ||
914 | if (msi_x) { | 914 | if (msi_x) { |
915 | nreq = min(dev->caps.num_eqs - dev->caps.reserved_eqs, | 915 | nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, |
916 | num_possible_cpus() + 1); | 916 | num_possible_cpus() + 1); |
917 | entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); | 917 | entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); |
918 | if (!entries) | 918 | if (!entries) |
919 | goto no_msi; | 919 | goto no_msi; |
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 5b7a574ce571..d0349e7d73ea 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -712,7 +712,7 @@ static inline void pasemi_mac_rx_error(const struct pasemi_mac *mac, | |||
712 | rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); | 712 | rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); |
713 | ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); | 713 | ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); |
714 | 714 | ||
715 | printk(KERN_ERR "pasemi_mac: rx error. macrx %016lx, rx status %lx\n", | 715 | printk(KERN_ERR "pasemi_mac: rx error. macrx %016llx, rx status %llx\n", |
716 | macrx, *chan->status); | 716 | macrx, *chan->status); |
717 | 717 | ||
718 | printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n", | 718 | printk(KERN_ERR "pasemi_mac: rcmdsta %08x ccmdsta %08x\n", |
@@ -730,8 +730,8 @@ static inline void pasemi_mac_tx_error(const struct pasemi_mac *mac, | |||
730 | 730 | ||
731 | cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); | 731 | cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); |
732 | 732 | ||
733 | printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016lx, "\ | 733 | printk(KERN_ERR "pasemi_mac: tx error. mactx 0x%016llx, "\ |
734 | "tx status 0x%016lx\n", mactx, *chan->status); | 734 | "tx status 0x%016llx\n", mactx, *chan->status); |
735 | 735 | ||
736 | printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta); | 736 | printk(KERN_ERR "pasemi_mac: tcmdsta 0x%08x\n", cmdsta); |
737 | } | 737 | } |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index d17dc5214c9a..0d0fa91c0251 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1297,6 +1297,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp) | |||
1297 | /* setup */ | 1297 | /* setup */ |
1298 | spin_lock_irq(&serial->serial_lock); | 1298 | spin_lock_irq(&serial->serial_lock); |
1299 | tty->driver_data = serial; | 1299 | tty->driver_data = serial; |
1300 | tty_kref_put(serial->tty); | ||
1300 | serial->tty = tty_kref_get(tty); | 1301 | serial->tty = tty_kref_get(tty); |
1301 | spin_unlock_irq(&serial->serial_lock); | 1302 | spin_unlock_irq(&serial->serial_lock); |
1302 | 1303 | ||
@@ -2043,9 +2044,8 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | |||
2043 | return -2; | 2044 | return -2; |
2044 | } | 2045 | } |
2045 | 2046 | ||
2046 | spin_lock(&serial->serial_lock); | 2047 | /* All callers to put_rxbuf_data hold serial_lock */ |
2047 | tty = tty_kref_get(serial->tty); | 2048 | tty = tty_kref_get(serial->tty); |
2048 | spin_unlock(&serial->serial_lock); | ||
2049 | 2049 | ||
2050 | /* Push data to tty */ | 2050 | /* Push data to tty */ |
2051 | if (tty) { | 2051 | if (tty) { |
@@ -2053,8 +2053,10 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | |||
2053 | serial->curr_rx_urb_offset; | 2053 | serial->curr_rx_urb_offset; |
2054 | D1("data to push to tty"); | 2054 | D1("data to push to tty"); |
2055 | while (write_length_remaining) { | 2055 | while (write_length_remaining) { |
2056 | if (test_bit(TTY_THROTTLED, &tty->flags)) | 2056 | if (test_bit(TTY_THROTTLED, &tty->flags)) { |
2057 | tty_kref_put(tty); | ||
2057 | return -1; | 2058 | return -1; |
2059 | } | ||
2058 | curr_write_len = tty_insert_flip_string | 2060 | curr_write_len = tty_insert_flip_string |
2059 | (tty, urb->transfer_buffer + | 2061 | (tty, urb->transfer_buffer + |
2060 | serial->curr_rx_urb_offset, | 2062 | serial->curr_rx_urb_offset, |
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c index e1b0ad6e918f..fa65a2b2ae2e 100644 --- a/drivers/of/of_i2c.c +++ b/drivers/of/of_i2c.c | |||
@@ -66,4 +66,23 @@ void of_register_i2c_devices(struct i2c_adapter *adap, | |||
66 | } | 66 | } |
67 | EXPORT_SYMBOL(of_register_i2c_devices); | 67 | EXPORT_SYMBOL(of_register_i2c_devices); |
68 | 68 | ||
69 | static int of_dev_node_match(struct device *dev, void *data) | ||
70 | { | ||
71 | return dev_archdata_get_node(&dev->archdata) == data; | ||
72 | } | ||
73 | |||
74 | /* must call put_device() when done with returned i2c_client device */ | ||
75 | struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) | ||
76 | { | ||
77 | struct device *dev; | ||
78 | |||
79 | dev = bus_find_device(&i2c_bus_type, NULL, node, | ||
80 | of_dev_node_match); | ||
81 | if (!dev) | ||
82 | return NULL; | ||
83 | |||
84 | return to_i2c_client(dev); | ||
85 | } | ||
86 | EXPORT_SYMBOL(of_find_i2c_device_by_node); | ||
87 | |||
69 | MODULE_LICENSE("GPL"); | 88 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index 1e93c837514f..4fa3bb2ddfe4 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c | |||
@@ -405,7 +405,6 @@ static void __init superio_serial_init(void) | |||
405 | serial_port.type = PORT_16550A; | 405 | serial_port.type = PORT_16550A; |
406 | serial_port.uartclk = 115200*16; | 406 | serial_port.uartclk = 115200*16; |
407 | serial_port.fifosize = 16; | 407 | serial_port.fifosize = 16; |
408 | spin_lock_init(&serial_port.lock); | ||
409 | 408 | ||
410 | /* serial port #1 */ | 409 | /* serial port #1 */ |
411 | serial_port.iobase = sio_dev.sp1_base; | 410 | serial_port.iobase = sio_dev.sp1_base; |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 235fb7a5a8a5..3dfecb20d5e7 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -438,7 +438,8 @@ static struct intel_iommu *device_to_iommu(u8 bus, u8 devfn) | |||
438 | continue; | 438 | continue; |
439 | 439 | ||
440 | for (i = 0; i < drhd->devices_cnt; i++) | 440 | for (i = 0; i < drhd->devices_cnt; i++) |
441 | if (drhd->devices[i]->bus->number == bus && | 441 | if (drhd->devices[i] && |
442 | drhd->devices[i]->bus->number == bus && | ||
442 | drhd->devices[i]->devfn == devfn) | 443 | drhd->devices[i]->devfn == devfn) |
443 | return drhd->iommu; | 444 | return drhd->iommu; |
444 | 445 | ||
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index 645d7a60e412..ec22284eed30 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c | |||
@@ -14,10 +14,8 @@ | |||
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include "pci.h" | 15 | #include "pci.h" |
16 | 16 | ||
17 | asmlinkage long | 17 | SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, |
18 | sys_pciconfig_read(unsigned long bus, unsigned long dfn, | 18 | unsigned long, off, unsigned long, len, void __user *, buf) |
19 | unsigned long off, unsigned long len, | ||
20 | void __user *buf) | ||
21 | { | 19 | { |
22 | struct pci_dev *dev; | 20 | struct pci_dev *dev; |
23 | u8 byte; | 21 | u8 byte; |
@@ -86,10 +84,8 @@ error: | |||
86 | return err; | 84 | return err; |
87 | } | 85 | } |
88 | 86 | ||
89 | asmlinkage long | 87 | SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn, |
90 | sys_pciconfig_write(unsigned long bus, unsigned long dfn, | 88 | unsigned long, off, unsigned long, len, void __user *, buf) |
91 | unsigned long off, unsigned long len, | ||
92 | void __user *buf) | ||
93 | { | 89 | { |
94 | struct pci_dev *dev; | 90 | struct pci_dev *dev; |
95 | u8 byte; | 91 | u8 byte; |
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c index a34284b1482a..d187ba4c5e0e 100644 --- a/drivers/pcmcia/electra_cf.c +++ b/drivers/pcmcia/electra_cf.c | |||
@@ -297,7 +297,7 @@ static int __devinit electra_cf_probe(struct of_device *ofdev, | |||
297 | goto fail3; | 297 | goto fail3; |
298 | } | 298 | } |
299 | 299 | ||
300 | dev_info(device, "at mem 0x%lx io 0x%lx irq %d\n", | 300 | dev_info(device, "at mem 0x%lx io 0x%llx irq %d\n", |
301 | cf->mem_phys, io.start, cf->irq); | 301 | cf->mem_phys, io.start, cf->irq); |
302 | 302 | ||
303 | cf->active = 1; | 303 | cf->active = 1; |
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index cc7eb8767b82..bd56a033bfd0 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/io.h> | 28 | #include <linux/io.h> |
29 | 29 | ||
30 | #include <mach/hardware.h> | ||
31 | |||
30 | #define TIMER_FREQ CLOCK_TICK_RATE | 32 | #define TIMER_FREQ CLOCK_TICK_RATE |
31 | #define RTC_DEF_DIVIDER (32768 - 1) | 33 | #define RTC_DEF_DIVIDER (32768 - 1) |
32 | #define RTC_DEF_TRIM 0 | 34 | #define RTC_DEF_TRIM 0 |
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c index 8ce5f74ee45b..ad35f76c46b7 100644 --- a/drivers/rtc/rtc-twl4030.c +++ b/drivers/rtc/rtc-twl4030.c | |||
@@ -120,7 +120,7 @@ static int twl4030_rtc_write_u8(u8 data, u8 reg) | |||
120 | static unsigned char rtc_irq_bits; | 120 | static unsigned char rtc_irq_bits; |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Enable timer and/or alarm interrupts. | 123 | * Enable 1/second update and/or alarm interrupts. |
124 | */ | 124 | */ |
125 | static int set_rtc_irq_bit(unsigned char bit) | 125 | static int set_rtc_irq_bit(unsigned char bit) |
126 | { | 126 | { |
@@ -128,6 +128,7 @@ static int set_rtc_irq_bit(unsigned char bit) | |||
128 | int ret; | 128 | int ret; |
129 | 129 | ||
130 | val = rtc_irq_bits | bit; | 130 | val = rtc_irq_bits | bit; |
131 | val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M; | ||
131 | ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); | 132 | ret = twl4030_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG); |
132 | if (ret == 0) | 133 | if (ret == 0) |
133 | rtc_irq_bits = val; | 134 | rtc_irq_bits = val; |
@@ -136,7 +137,7 @@ static int set_rtc_irq_bit(unsigned char bit) | |||
136 | } | 137 | } |
137 | 138 | ||
138 | /* | 139 | /* |
139 | * Disable timer and/or alarm interrupts. | 140 | * Disable update and/or alarm interrupts. |
140 | */ | 141 | */ |
141 | static int mask_rtc_irq_bit(unsigned char bit) | 142 | static int mask_rtc_irq_bit(unsigned char bit) |
142 | { | 143 | { |
@@ -151,7 +152,7 @@ static int mask_rtc_irq_bit(unsigned char bit) | |||
151 | return ret; | 152 | return ret; |
152 | } | 153 | } |
153 | 154 | ||
154 | static inline int twl4030_rtc_alarm_irq_set_state(int enabled) | 155 | static int twl4030_rtc_alarm_irq_enable(struct device *dev, unsigned enabled) |
155 | { | 156 | { |
156 | int ret; | 157 | int ret; |
157 | 158 | ||
@@ -163,7 +164,7 @@ static inline int twl4030_rtc_alarm_irq_set_state(int enabled) | |||
163 | return ret; | 164 | return ret; |
164 | } | 165 | } |
165 | 166 | ||
166 | static inline int twl4030_rtc_irq_set_state(int enabled) | 167 | static int twl4030_rtc_update_irq_enable(struct device *dev, unsigned enabled) |
167 | { | 168 | { |
168 | int ret; | 169 | int ret; |
169 | 170 | ||
@@ -292,7 +293,7 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
292 | unsigned char alarm_data[ALL_TIME_REGS + 1]; | 293 | unsigned char alarm_data[ALL_TIME_REGS + 1]; |
293 | int ret; | 294 | int ret; |
294 | 295 | ||
295 | ret = twl4030_rtc_alarm_irq_set_state(0); | 296 | ret = twl4030_rtc_alarm_irq_enable(dev, 0); |
296 | if (ret) | 297 | if (ret) |
297 | goto out; | 298 | goto out; |
298 | 299 | ||
@@ -312,35 +313,11 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | |||
312 | } | 313 | } |
313 | 314 | ||
314 | if (alm->enabled) | 315 | if (alm->enabled) |
315 | ret = twl4030_rtc_alarm_irq_set_state(1); | 316 | ret = twl4030_rtc_alarm_irq_enable(dev, 1); |
316 | out: | 317 | out: |
317 | return ret; | 318 | return ret; |
318 | } | 319 | } |
319 | 320 | ||
320 | #ifdef CONFIG_RTC_INTF_DEV | ||
321 | |||
322 | static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd, | ||
323 | unsigned long arg) | ||
324 | { | ||
325 | switch (cmd) { | ||
326 | case RTC_AIE_OFF: | ||
327 | return twl4030_rtc_alarm_irq_set_state(0); | ||
328 | case RTC_AIE_ON: | ||
329 | return twl4030_rtc_alarm_irq_set_state(1); | ||
330 | case RTC_UIE_OFF: | ||
331 | return twl4030_rtc_irq_set_state(0); | ||
332 | case RTC_UIE_ON: | ||
333 | return twl4030_rtc_irq_set_state(1); | ||
334 | |||
335 | default: | ||
336 | return -ENOIOCTLCMD; | ||
337 | } | ||
338 | } | ||
339 | |||
340 | #else | ||
341 | #define twl4030_rtc_ioctl NULL | ||
342 | #endif | ||
343 | |||
344 | static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) | 321 | static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc) |
345 | { | 322 | { |
346 | unsigned long events = 0; | 323 | unsigned long events = 0; |
@@ -400,11 +377,12 @@ out: | |||
400 | } | 377 | } |
401 | 378 | ||
402 | static struct rtc_class_ops twl4030_rtc_ops = { | 379 | static struct rtc_class_ops twl4030_rtc_ops = { |
403 | .ioctl = twl4030_rtc_ioctl, | ||
404 | .read_time = twl4030_rtc_read_time, | 380 | .read_time = twl4030_rtc_read_time, |
405 | .set_time = twl4030_rtc_set_time, | 381 | .set_time = twl4030_rtc_set_time, |
406 | .read_alarm = twl4030_rtc_read_alarm, | 382 | .read_alarm = twl4030_rtc_read_alarm, |
407 | .set_alarm = twl4030_rtc_set_alarm, | 383 | .set_alarm = twl4030_rtc_set_alarm, |
384 | .alarm_irq_enable = twl4030_rtc_alarm_irq_enable, | ||
385 | .update_irq_enable = twl4030_rtc_update_irq_enable, | ||
408 | }; | 386 | }; |
409 | 387 | ||
410 | /*----------------------------------------------------------------------*/ | 388 | /*----------------------------------------------------------------------*/ |
@@ -422,7 +400,7 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) | |||
422 | rtc = rtc_device_register(pdev->name, | 400 | rtc = rtc_device_register(pdev->name, |
423 | &pdev->dev, &twl4030_rtc_ops, THIS_MODULE); | 401 | &pdev->dev, &twl4030_rtc_ops, THIS_MODULE); |
424 | if (IS_ERR(rtc)) { | 402 | if (IS_ERR(rtc)) { |
425 | ret = -EINVAL; | 403 | ret = PTR_ERR(rtc); |
426 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", | 404 | dev_err(&pdev->dev, "can't register RTC device, err %ld\n", |
427 | PTR_ERR(rtc)); | 405 | PTR_ERR(rtc)); |
428 | goto out0; | 406 | goto out0; |
@@ -432,7 +410,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) | |||
432 | platform_set_drvdata(pdev, rtc); | 410 | platform_set_drvdata(pdev, rtc); |
433 | 411 | ||
434 | ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); | 412 | ret = twl4030_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); |
435 | |||
436 | if (ret < 0) | 413 | if (ret < 0) |
437 | goto out1; | 414 | goto out1; |
438 | 415 | ||
@@ -475,7 +452,6 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev) | |||
475 | 452 | ||
476 | return ret; | 453 | return ret; |
477 | 454 | ||
478 | |||
479 | out2: | 455 | out2: |
480 | free_irq(irq, rtc); | 456 | free_irq(irq, rtc); |
481 | out1: | 457 | out1: |
@@ -506,8 +482,9 @@ static int __devexit twl4030_rtc_remove(struct platform_device *pdev) | |||
506 | 482 | ||
507 | static void twl4030_rtc_shutdown(struct platform_device *pdev) | 483 | static void twl4030_rtc_shutdown(struct platform_device *pdev) |
508 | { | 484 | { |
509 | mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M | | 485 | /* mask timer interrupts, but leave alarm interrupts on to enable |
510 | BIT_RTC_INTERRUPTS_REG_IT_ALARM_M); | 486 | power-on when alarm is triggered */ |
487 | mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M); | ||
511 | } | 488 | } |
512 | 489 | ||
513 | #ifdef CONFIG_PM | 490 | #ifdef CONFIG_PM |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 5c541f7850f9..74d07d137dae 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1061,7 +1061,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | |||
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | sdev_printk(KERN_INFO, cmd->device, | 1063 | sdev_printk(KERN_INFO, cmd->device, |
1064 | "aborting command. lun 0x%lx, tag 0x%lx\n", | 1064 | "aborting command. lun 0x%llx, tag 0x%llx\n", |
1065 | (((u64) lun) << 48), (u64) found_evt); | 1065 | (((u64) lun) << 48), (u64) found_evt); |
1066 | 1066 | ||
1067 | wait_for_completion(&evt->comp); | 1067 | wait_for_completion(&evt->comp); |
@@ -1082,7 +1082,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | |||
1082 | if (rsp_rc) { | 1082 | if (rsp_rc) { |
1083 | if (printk_ratelimit()) | 1083 | if (printk_ratelimit()) |
1084 | sdev_printk(KERN_WARNING, cmd->device, | 1084 | sdev_printk(KERN_WARNING, cmd->device, |
1085 | "abort code %d for task tag 0x%lx\n", | 1085 | "abort code %d for task tag 0x%llx\n", |
1086 | rsp_rc, tsk_mgmt->task_tag); | 1086 | rsp_rc, tsk_mgmt->task_tag); |
1087 | return FAILED; | 1087 | return FAILED; |
1088 | } | 1088 | } |
@@ -1102,12 +1102,12 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd) | |||
1102 | 1102 | ||
1103 | if (found_evt == NULL) { | 1103 | if (found_evt == NULL) { |
1104 | spin_unlock_irqrestore(hostdata->host->host_lock, flags); | 1104 | spin_unlock_irqrestore(hostdata->host->host_lock, flags); |
1105 | sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%lx completed\n", | 1105 | sdev_printk(KERN_INFO, cmd->device, "aborted task tag 0x%llx completed\n", |
1106 | tsk_mgmt->task_tag); | 1106 | tsk_mgmt->task_tag); |
1107 | return SUCCESS; | 1107 | return SUCCESS; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%lx\n", | 1110 | sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%llx\n", |
1111 | tsk_mgmt->task_tag); | 1111 | tsk_mgmt->task_tag); |
1112 | 1112 | ||
1113 | cmd->result = (DID_ABORT << 16); | 1113 | cmd->result = (DID_ABORT << 16); |
@@ -1182,7 +1182,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) | |||
1182 | return FAILED; | 1182 | return FAILED; |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%lx\n", | 1185 | sdev_printk(KERN_INFO, cmd->device, "resetting device. lun 0x%llx\n", |
1186 | (((u64) lun) << 48)); | 1186 | (((u64) lun) << 48)); |
1187 | 1187 | ||
1188 | wait_for_completion(&evt->comp); | 1188 | wait_for_completion(&evt->comp); |
@@ -1203,7 +1203,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) | |||
1203 | if (rsp_rc) { | 1203 | if (rsp_rc) { |
1204 | if (printk_ratelimit()) | 1204 | if (printk_ratelimit()) |
1205 | sdev_printk(KERN_WARNING, cmd->device, | 1205 | sdev_printk(KERN_WARNING, cmd->device, |
1206 | "reset code %d for task tag 0x%lx\n", | 1206 | "reset code %d for task tag 0x%llx\n", |
1207 | rsp_rc, tsk_mgmt->task_tag); | 1207 | rsp_rc, tsk_mgmt->task_tag); |
1208 | return FAILED; | 1208 | return FAILED; |
1209 | } | 1209 | } |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 1889a63ebc22..0d934bfbdd9b 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -2839,6 +2839,8 @@ int __init early_serial_setup(struct uart_port *port) | |||
2839 | p->flags = port->flags; | 2839 | p->flags = port->flags; |
2840 | p->mapbase = port->mapbase; | 2840 | p->mapbase = port->mapbase; |
2841 | p->private_data = port->private_data; | 2841 | p->private_data = port->private_data; |
2842 | p->type = port->type; | ||
2843 | p->line = port->line; | ||
2842 | 2844 | ||
2843 | set_io_from_upio(p); | 2845 | set_io_from_upio(p); |
2844 | if (port->serial_in) | 2846 | if (port->serial_in) |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index c088146b7513..2a3671233b15 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -602,6 +602,10 @@ static int pci_netmos_init(struct pci_dev *dev) | |||
602 | /* subdevice 0x00PS means <P> parallel, <S> serial */ | 602 | /* subdevice 0x00PS means <P> parallel, <S> serial */ |
603 | unsigned int num_serial = dev->subsystem_device & 0xf; | 603 | unsigned int num_serial = dev->subsystem_device & 0xf; |
604 | 604 | ||
605 | if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM && | ||
606 | dev->subsystem_device == 0x0299) | ||
607 | return 0; | ||
608 | |||
605 | if (num_serial == 0) | 609 | if (num_serial == 0) |
606 | return -ENODEV; | 610 | return -ENODEV; |
607 | return num_serial; | 611 | return num_serial; |
@@ -3096,6 +3100,10 @@ static struct pci_device_id serial_pci_tbl[] = { | |||
3096 | 0, | 3100 | 0, |
3097 | pbn_b0_8_115200 }, | 3101 | pbn_b0_8_115200 }, |
3098 | 3102 | ||
3103 | { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835, | ||
3104 | PCI_VENDOR_ID_IBM, 0x0299, | ||
3105 | 0, 0, pbn_b0_bt_2_115200 }, | ||
3106 | |||
3099 | /* | 3107 | /* |
3100 | * These entries match devices with class COMMUNICATION_SERIAL, | 3108 | * These entries match devices with class COMMUNICATION_SERIAL, |
3101 | * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL | 3109 | * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index fde7f9ccf57e..bbcfc26a3b6d 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -270,6 +270,8 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
270 | { "RSS0250", 0 }, | 270 | { "RSS0250", 0 }, |
271 | /* SupraExpress 28.8 Data/Fax PnP modem */ | 271 | /* SupraExpress 28.8 Data/Fax PnP modem */ |
272 | { "SUP1310", 0 }, | 272 | { "SUP1310", 0 }, |
273 | /* SupraExpress 336i PnP Voice Modem */ | ||
274 | { "SUP1381", 0 }, | ||
273 | /* SupraExpress 33.6 Data/Fax PnP modem */ | 275 | /* SupraExpress 33.6 Data/Fax PnP modem */ |
274 | { "SUP1421", 0 }, | 276 | { "SUP1421", 0 }, |
275 | /* SupraExpress 33.6 Data/Fax PnP modem */ | 277 | /* SupraExpress 33.6 Data/Fax PnP modem */ |
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index d5efd6c77904..89362d733d62 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -579,7 +579,7 @@ static void atmel_tx_dma(struct uart_port *port) | |||
579 | /* disable PDC transmit */ | 579 | /* disable PDC transmit */ |
580 | UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); | 580 | UART_PUT_PTCR(port, ATMEL_PDC_TXTDIS); |
581 | 581 | ||
582 | if (!uart_circ_empty(xmit)) { | 582 | if (!uart_circ_empty(xmit) && !uart_tx_stopped(port)) { |
583 | dma_sync_single_for_device(port->dev, | 583 | dma_sync_single_for_device(port->dev, |
584 | pdc->dma_addr, | 584 | pdc->dma_addr, |
585 | pdc->dma_size, | 585 | pdc->dma_size, |
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c index 22e30d21225e..1bb8f1b45767 100644 --- a/drivers/serial/pnx8xxx_uart.c +++ b/drivers/serial/pnx8xxx_uart.c | |||
@@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) | |||
187 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | | 187 | status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | |
188 | ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); | 188 | ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); |
189 | while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) { | 189 | while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) { |
190 | ch = serial_in(sport, PNX8XXX_FIFO); | 190 | ch = serial_in(sport, PNX8XXX_FIFO) & 0xff; |
191 | 191 | ||
192 | sport->port.icount.rx++; | 192 | sport->port.icount.rx++; |
193 | 193 | ||
@@ -198,9 +198,16 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) | |||
198 | * out of the main execution path | 198 | * out of the main execution path |
199 | */ | 199 | */ |
200 | if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE | | 200 | if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE | |
201 | PNX8XXX_UART_FIFO_RXPAR) | | 201 | PNX8XXX_UART_FIFO_RXPAR | |
202 | PNX8XXX_UART_FIFO_RXBRK) | | ||
202 | ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) { | 203 | ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) { |
203 | if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)) | 204 | if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) { |
205 | status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) | | ||
206 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)); | ||
207 | sport->port.icount.brk++; | ||
208 | if (uart_handle_break(&sport->port)) | ||
209 | goto ignore_char; | ||
210 | } else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)) | ||
204 | sport->port.icount.parity++; | 211 | sport->port.icount.parity++; |
205 | else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) | 212 | else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) |
206 | sport->port.icount.frame++; | 213 | sport->port.icount.frame++; |
@@ -284,14 +291,8 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id) | |||
284 | /* Get the interrupts */ | 291 | /* Get the interrupts */ |
285 | status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN); | 292 | status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN); |
286 | 293 | ||
287 | /* Break signal received */ | 294 | /* Byte or break signal received */ |
288 | if (status & PNX8XXX_UART_INT_BREAK) { | 295 | if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK)) |
289 | sport->port.icount.brk++; | ||
290 | uart_handle_break(&sport->port); | ||
291 | } | ||
292 | |||
293 | /* Byte received */ | ||
294 | if (status & PNX8XXX_UART_INT_RX) | ||
295 | pnx8xxx_rx_chars(sport); | 296 | pnx8xxx_rx_chars(sport); |
296 | 297 | ||
297 | /* TX holding register empty - transmit a byte */ | 298 | /* TX holding register empty - transmit a byte */ |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 5e39bac9c51b..56ff3e6864ea 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -670,8 +670,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) | |||
670 | dev_dbg(controller, "new message %p submitted for %s\n", | 670 | dev_dbg(controller, "new message %p submitted for %s\n", |
671 | msg, spi->dev.bus_id); | 671 | msg, spi->dev.bus_id); |
672 | 672 | ||
673 | if (unlikely(list_empty(&msg->transfers) | 673 | if (unlikely(list_empty(&msg->transfers))) |
674 | || !spi->max_speed_hz)) | ||
675 | return -EINVAL; | 674 | return -EINVAL; |
676 | 675 | ||
677 | if (as->stopping) | 676 | if (as->stopping) |
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 68d6f4988fb5..fe7e5f35e5d0 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c | |||
@@ -15,12 +15,15 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | |||
19 | #include <linux/of_platform.h> | ||
20 | #include <linux/of_device.h> | ||
21 | #include <linux/of_spi.h> | ||
22 | |||
18 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
19 | #include <linux/spi/spi_bitbang.h> | 24 | #include <linux/spi/spi_bitbang.h> |
20 | #include <linux/io.h> | 25 | #include <linux/io.h> |
21 | 26 | ||
22 | #include <syslib/virtex_devices.h> | ||
23 | |||
24 | #define XILINX_SPI_NAME "xilinx_spi" | 27 | #define XILINX_SPI_NAME "xilinx_spi" |
25 | 28 | ||
26 | /* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e) | 29 | /* Register definitions as per "OPB Serial Peripheral Interface (SPI) (v1.00e) |
@@ -144,23 +147,14 @@ static int xilinx_spi_setup_transfer(struct spi_device *spi, | |||
144 | struct spi_transfer *t) | 147 | struct spi_transfer *t) |
145 | { | 148 | { |
146 | u8 bits_per_word; | 149 | u8 bits_per_word; |
147 | u32 hz; | ||
148 | struct xilinx_spi *xspi = spi_master_get_devdata(spi->master); | ||
149 | 150 | ||
150 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; | 151 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; |
151 | hz = (t) ? t->speed_hz : spi->max_speed_hz; | ||
152 | if (bits_per_word != 8) { | 152 | if (bits_per_word != 8) { |
153 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", | 153 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", |
154 | __func__, bits_per_word); | 154 | __func__, bits_per_word); |
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (hz && xspi->speed_hz > hz) { | ||
159 | dev_err(&spi->dev, "%s, unsupported clock rate %uHz\n", | ||
160 | __func__, hz); | ||
161 | return -EINVAL; | ||
162 | } | ||
163 | |||
164 | return 0; | 158 | return 0; |
165 | } | 159 | } |
166 | 160 | ||
@@ -304,32 +298,38 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id) | |||
304 | return IRQ_HANDLED; | 298 | return IRQ_HANDLED; |
305 | } | 299 | } |
306 | 300 | ||
307 | static int __init xilinx_spi_probe(struct platform_device *dev) | 301 | static int __init xilinx_spi_of_probe(struct of_device *ofdev, |
302 | const struct of_device_id *match) | ||
308 | { | 303 | { |
309 | int ret = 0; | ||
310 | struct spi_master *master; | 304 | struct spi_master *master; |
311 | struct xilinx_spi *xspi; | 305 | struct xilinx_spi *xspi; |
312 | struct xspi_platform_data *pdata; | 306 | struct resource r_irq_struct; |
313 | struct resource *r; | 307 | struct resource r_mem_struct; |
308 | |||
309 | struct resource *r_irq = &r_irq_struct; | ||
310 | struct resource *r_mem = &r_mem_struct; | ||
311 | int rc = 0; | ||
312 | const u32 *prop; | ||
313 | int len; | ||
314 | 314 | ||
315 | /* Get resources(memory, IRQ) associated with the device */ | 315 | /* Get resources(memory, IRQ) associated with the device */ |
316 | master = spi_alloc_master(&dev->dev, sizeof(struct xilinx_spi)); | 316 | master = spi_alloc_master(&ofdev->dev, sizeof(struct xilinx_spi)); |
317 | 317 | ||
318 | if (master == NULL) { | 318 | if (master == NULL) { |
319 | return -ENOMEM; | 319 | return -ENOMEM; |
320 | } | 320 | } |
321 | 321 | ||
322 | platform_set_drvdata(dev, master); | 322 | dev_set_drvdata(&ofdev->dev, master); |
323 | pdata = dev->dev.platform_data; | ||
324 | 323 | ||
325 | if (pdata == NULL) { | 324 | rc = of_address_to_resource(ofdev->node, 0, r_mem); |
326 | ret = -ENODEV; | 325 | if (rc) { |
326 | dev_warn(&ofdev->dev, "invalid address\n"); | ||
327 | goto put_master; | 327 | goto put_master; |
328 | } | 328 | } |
329 | 329 | ||
330 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | 330 | rc = of_irq_to_resource(ofdev->node, 0, r_irq); |
331 | if (r == NULL) { | 331 | if (rc == NO_IRQ) { |
332 | ret = -ENODEV; | 332 | dev_warn(&ofdev->dev, "no IRQ found\n"); |
333 | goto put_master; | 333 | goto put_master; |
334 | } | 334 | } |
335 | 335 | ||
@@ -341,47 +341,57 @@ static int __init xilinx_spi_probe(struct platform_device *dev) | |||
341 | xspi->bitbang.master->setup = xilinx_spi_setup; | 341 | xspi->bitbang.master->setup = xilinx_spi_setup; |
342 | init_completion(&xspi->done); | 342 | init_completion(&xspi->done); |
343 | 343 | ||
344 | if (!request_mem_region(r->start, | 344 | xspi->irq = r_irq->start; |
345 | r->end - r->start + 1, XILINX_SPI_NAME)) { | 345 | |
346 | ret = -ENXIO; | 346 | if (!request_mem_region(r_mem->start, |
347 | r_mem->end - r_mem->start + 1, XILINX_SPI_NAME)) { | ||
348 | rc = -ENXIO; | ||
349 | dev_warn(&ofdev->dev, "memory request failure\n"); | ||
347 | goto put_master; | 350 | goto put_master; |
348 | } | 351 | } |
349 | 352 | ||
350 | xspi->regs = ioremap(r->start, r->end - r->start + 1); | 353 | xspi->regs = ioremap(r_mem->start, r_mem->end - r_mem->start + 1); |
351 | if (xspi->regs == NULL) { | 354 | if (xspi->regs == NULL) { |
352 | ret = -ENOMEM; | 355 | rc = -ENOMEM; |
356 | dev_warn(&ofdev->dev, "ioremap failure\n"); | ||
353 | goto put_master; | 357 | goto put_master; |
354 | } | 358 | } |
359 | xspi->irq = r_irq->start; | ||
355 | 360 | ||
356 | ret = platform_get_irq(dev, 0); | 361 | /* dynamic bus assignment */ |
357 | if (ret < 0) { | 362 | master->bus_num = -1; |
358 | ret = -ENXIO; | ||
359 | goto unmap_io; | ||
360 | } | ||
361 | xspi->irq = ret; | ||
362 | 363 | ||
363 | master->bus_num = pdata->bus_num; | 364 | /* number of slave select bits is required */ |
364 | master->num_chipselect = pdata->num_chipselect; | 365 | prop = of_get_property(ofdev->node, "xlnx,num-ss-bits", &len); |
365 | xspi->speed_hz = pdata->speed_hz; | 366 | if (!prop || len < sizeof(*prop)) { |
367 | dev_warn(&ofdev->dev, "no 'xlnx,num-ss-bits' property\n"); | ||
368 | goto put_master; | ||
369 | } | ||
370 | master->num_chipselect = *prop; | ||
366 | 371 | ||
367 | /* SPI controller initializations */ | 372 | /* SPI controller initializations */ |
368 | xspi_init_hw(xspi->regs); | 373 | xspi_init_hw(xspi->regs); |
369 | 374 | ||
370 | /* Register for SPI Interrupt */ | 375 | /* Register for SPI Interrupt */ |
371 | ret = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); | 376 | rc = request_irq(xspi->irq, xilinx_spi_irq, 0, XILINX_SPI_NAME, xspi); |
372 | if (ret != 0) | 377 | if (rc != 0) { |
378 | dev_warn(&ofdev->dev, "irq request failure: %d\n", xspi->irq); | ||
373 | goto unmap_io; | 379 | goto unmap_io; |
380 | } | ||
374 | 381 | ||
375 | ret = spi_bitbang_start(&xspi->bitbang); | 382 | rc = spi_bitbang_start(&xspi->bitbang); |
376 | if (ret != 0) { | 383 | if (rc != 0) { |
377 | dev_err(&dev->dev, "spi_bitbang_start FAILED\n"); | 384 | dev_err(&ofdev->dev, "spi_bitbang_start FAILED\n"); |
378 | goto free_irq; | 385 | goto free_irq; |
379 | } | 386 | } |
380 | 387 | ||
381 | dev_info(&dev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", | 388 | dev_info(&ofdev->dev, "at 0x%08X mapped to 0x%08X, irq=%d\n", |
382 | r->start, (u32)xspi->regs, xspi->irq); | 389 | (unsigned int)r_mem->start, (u32)xspi->regs, xspi->irq); |
383 | 390 | ||
384 | return ret; | 391 | /* Add any subnodes on the SPI bus */ |
392 | of_register_spi_devices(master, ofdev->node); | ||
393 | |||
394 | return rc; | ||
385 | 395 | ||
386 | free_irq: | 396 | free_irq: |
387 | free_irq(xspi->irq, xspi); | 397 | free_irq(xspi->irq, xspi); |
@@ -389,21 +399,21 @@ unmap_io: | |||
389 | iounmap(xspi->regs); | 399 | iounmap(xspi->regs); |
390 | put_master: | 400 | put_master: |
391 | spi_master_put(master); | 401 | spi_master_put(master); |
392 | return ret; | 402 | return rc; |
393 | } | 403 | } |
394 | 404 | ||
395 | static int __devexit xilinx_spi_remove(struct platform_device *dev) | 405 | static int __devexit xilinx_spi_remove(struct of_device *ofdev) |
396 | { | 406 | { |
397 | struct xilinx_spi *xspi; | 407 | struct xilinx_spi *xspi; |
398 | struct spi_master *master; | 408 | struct spi_master *master; |
399 | 409 | ||
400 | master = platform_get_drvdata(dev); | 410 | master = platform_get_drvdata(ofdev); |
401 | xspi = spi_master_get_devdata(master); | 411 | xspi = spi_master_get_devdata(master); |
402 | 412 | ||
403 | spi_bitbang_stop(&xspi->bitbang); | 413 | spi_bitbang_stop(&xspi->bitbang); |
404 | free_irq(xspi->irq, xspi); | 414 | free_irq(xspi->irq, xspi); |
405 | iounmap(xspi->regs); | 415 | iounmap(xspi->regs); |
406 | platform_set_drvdata(dev, 0); | 416 | dev_set_drvdata(&ofdev->dev, 0); |
407 | spi_master_put(xspi->bitbang.master); | 417 | spi_master_put(xspi->bitbang.master); |
408 | 418 | ||
409 | return 0; | 419 | return 0; |
@@ -412,27 +422,42 @@ static int __devexit xilinx_spi_remove(struct platform_device *dev) | |||
412 | /* work with hotplug and coldplug */ | 422 | /* work with hotplug and coldplug */ |
413 | MODULE_ALIAS("platform:" XILINX_SPI_NAME); | 423 | MODULE_ALIAS("platform:" XILINX_SPI_NAME); |
414 | 424 | ||
415 | static struct platform_driver xilinx_spi_driver = { | 425 | static int __exit xilinx_spi_of_remove(struct of_device *op) |
416 | .probe = xilinx_spi_probe, | 426 | { |
417 | .remove = __devexit_p(xilinx_spi_remove), | 427 | return xilinx_spi_remove(op); |
428 | } | ||
429 | |||
430 | static struct of_device_id xilinx_spi_of_match[] = { | ||
431 | { .compatible = "xlnx,xps-spi-2.00.a", }, | ||
432 | { .compatible = "xlnx,xps-spi-2.00.b", }, | ||
433 | {} | ||
434 | }; | ||
435 | |||
436 | MODULE_DEVICE_TABLE(of, xilinx_spi_of_match); | ||
437 | |||
438 | static struct of_platform_driver xilinx_spi_of_driver = { | ||
439 | .owner = THIS_MODULE, | ||
440 | .name = "xilinx-xps-spi", | ||
441 | .match_table = xilinx_spi_of_match, | ||
442 | .probe = xilinx_spi_of_probe, | ||
443 | .remove = __exit_p(xilinx_spi_of_remove), | ||
418 | .driver = { | 444 | .driver = { |
419 | .name = XILINX_SPI_NAME, | 445 | .name = "xilinx-xps-spi", |
420 | .owner = THIS_MODULE, | 446 | .owner = THIS_MODULE, |
421 | }, | 447 | }, |
422 | }; | 448 | }; |
423 | 449 | ||
424 | static int __init xilinx_spi_init(void) | 450 | static int __init xilinx_spi_init(void) |
425 | { | 451 | { |
426 | return platform_driver_register(&xilinx_spi_driver); | 452 | return of_register_platform_driver(&xilinx_spi_of_driver); |
427 | } | 453 | } |
428 | module_init(xilinx_spi_init); | 454 | module_init(xilinx_spi_init); |
429 | 455 | ||
430 | static void __exit xilinx_spi_exit(void) | 456 | static void __exit xilinx_spi_exit(void) |
431 | { | 457 | { |
432 | platform_driver_unregister(&xilinx_spi_driver); | 458 | of_unregister_platform_driver(&xilinx_spi_of_driver); |
433 | } | 459 | } |
434 | module_exit(xilinx_spi_exit); | 460 | module_exit(xilinx_spi_exit); |
435 | |||
436 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); | 461 | MODULE_AUTHOR("MontaVista Software, Inc. <source@mvista.com>"); |
437 | MODULE_DESCRIPTION("Xilinx SPI driver"); | 462 | MODULE_DESCRIPTION("Xilinx SPI driver"); |
438 | MODULE_LICENSE("GPL"); | 463 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index d5d0e40b1e2d..94d5ee263c20 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1554,7 +1554,7 @@ static int usb_configure_device_otg(struct usb_device *udev) | |||
1554 | * (Includes HNP test device.) | 1554 | * (Includes HNP test device.) |
1555 | */ | 1555 | */ |
1556 | if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { | 1556 | if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { |
1557 | err = usb_port_suspend(udev); | 1557 | err = usb_port_suspend(udev, PMSG_SUSPEND); |
1558 | if (err < 0) | 1558 | if (err < 0) |
1559 | dev_dbg(&udev->dev, "HNP fail, %d\n", err); | 1559 | dev_dbg(&udev->dev, "HNP fail, %d\n", err); |
1560 | } | 1560 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ef6cfa5a447f..c70a8f667d85 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2030,7 +2030,7 @@ static void ftdi_process_read(struct work_struct *work) | |||
2030 | spin_unlock_irqrestore(&priv->rx_lock, flags); | 2030 | spin_unlock_irqrestore(&priv->rx_lock, flags); |
2031 | dbg("%s - deferring remainder until unthrottled", | 2031 | dbg("%s - deferring remainder until unthrottled", |
2032 | __func__); | 2032 | __func__); |
2033 | return; | 2033 | goto out; |
2034 | } | 2034 | } |
2035 | spin_unlock_irqrestore(&priv->rx_lock, flags); | 2035 | spin_unlock_irqrestore(&priv->rx_lock, flags); |
2036 | /* if the port is closed stop trying to read */ | 2036 | /* if the port is closed stop trying to read */ |
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 7644ed249564..37e60b1d2ed9 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
@@ -335,7 +335,20 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var, | |||
335 | struct fb_info *info) | 335 | struct fb_info *info) |
336 | { | 336 | { |
337 | 337 | ||
338 | if (var->bits_per_pixel != LCD_BPP) { | 338 | switch (var->bits_per_pixel) { |
339 | case 24:/* TRUECOLOUR, 16m */ | ||
340 | var->red.offset = 16; | ||
341 | var->green.offset = 8; | ||
342 | var->blue.offset = 0; | ||
343 | var->red.length = var->green.length = var->blue.length = 8; | ||
344 | var->transp.offset = 0; | ||
345 | var->transp.length = 0; | ||
346 | var->transp.msb_right = 0; | ||
347 | var->red.msb_right = 0; | ||
348 | var->green.msb_right = 0; | ||
349 | var->blue.msb_right = 0; | ||
350 | break; | ||
351 | default: | ||
339 | pr_debug("%s: depth not supported: %u BPP\n", __func__, | 352 | pr_debug("%s: depth not supported: %u BPP\n", __func__, |
340 | var->bits_per_pixel); | 353 | var->bits_per_pixel); |
341 | return -EINVAL; | 354 | return -EINVAL; |
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c index a9b3ada05d99..2a423d3a2a8e 100644 --- a/drivers/video/bfin-t350mcqb-fb.c +++ b/drivers/video/bfin-t350mcqb-fb.c | |||
@@ -254,7 +254,20 @@ static int bfin_t350mcqb_fb_check_var(struct fb_var_screeninfo *var, | |||
254 | struct fb_info *info) | 254 | struct fb_info *info) |
255 | { | 255 | { |
256 | 256 | ||
257 | if (var->bits_per_pixel != LCD_BPP) { | 257 | switch (var->bits_per_pixel) { |
258 | case 24:/* TRUECOLOUR, 16m */ | ||
259 | var->red.offset = 0; | ||
260 | var->green.offset = 8; | ||
261 | var->blue.offset = 16; | ||
262 | var->red.length = var->green.length = var->blue.length = 8; | ||
263 | var->transp.offset = 0; | ||
264 | var->transp.length = 0; | ||
265 | var->transp.msb_right = 0; | ||
266 | var->red.msb_right = 0; | ||
267 | var->green.msb_right = 0; | ||
268 | var->blue.msb_right = 0; | ||
269 | break; | ||
270 | default: | ||
258 | pr_debug("%s: depth not supported: %u BPP\n", __func__, | 271 | pr_debug("%s: depth not supported: %u BPP\n", __func__, |
259 | var->bits_per_pixel); | 272 | var->bits_per_pixel); |
260 | return -EINVAL; | 273 | return -EINVAL; |