diff options
Diffstat (limited to 'drivers')
357 files changed, 5599 insertions, 2225 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index dfb6e9d3d759..7f099d6e4e0b 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2802,10 +2802,11 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2802 | } | 2802 | } |
2803 | 2803 | ||
2804 | /* | 2804 | /* |
2805 | * Some controllers can't be frozen very well and may set | 2805 | * Some controllers can't be frozen very well and may set spurious |
2806 | * spuruious error conditions during reset. Clear accumulated | 2806 | * error conditions during reset. Clear accumulated error |
2807 | * error information. As reset is the final recovery action, | 2807 | * information and re-thaw the port if frozen. As reset is the |
2808 | * nothing is lost by doing this. | 2808 | * final recovery action and we cross check link onlineness against |
2809 | * device classification later, no hotplug event is lost by this. | ||
2809 | */ | 2810 | */ |
2810 | spin_lock_irqsave(link->ap->lock, flags); | 2811 | spin_lock_irqsave(link->ap->lock, flags); |
2811 | memset(&link->eh_info, 0, sizeof(link->eh_info)); | 2812 | memset(&link->eh_info, 0, sizeof(link->eh_info)); |
@@ -2814,6 +2815,9 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2814 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; | 2815 | ap->pflags &= ~ATA_PFLAG_EH_PENDING; |
2815 | spin_unlock_irqrestore(link->ap->lock, flags); | 2816 | spin_unlock_irqrestore(link->ap->lock, flags); |
2816 | 2817 | ||
2818 | if (ap->pflags & ATA_PFLAG_FROZEN) | ||
2819 | ata_eh_thaw_port(ap); | ||
2820 | |||
2817 | /* | 2821 | /* |
2818 | * Make sure onlineness and classification result correspond. | 2822 | * Make sure onlineness and classification result correspond. |
2819 | * Hotplug could have happened during reset and some | 2823 | * Hotplug could have happened during reset and some |
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index c0dd09df7be8..ad367c4139b1 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c | |||
@@ -291,7 +291,7 @@ static int pm_runtime_clk_notify(struct notifier_block *nb, | |||
291 | { | 291 | { |
292 | struct pm_clk_notifier_block *clknb; | 292 | struct pm_clk_notifier_block *clknb; |
293 | struct device *dev = data; | 293 | struct device *dev = data; |
294 | char *con_id; | 294 | char **con_id; |
295 | int error; | 295 | int error; |
296 | 296 | ||
297 | dev_dbg(dev, "%s() %ld\n", __func__, action); | 297 | dev_dbg(dev, "%s() %ld\n", __func__, action); |
@@ -309,8 +309,8 @@ static int pm_runtime_clk_notify(struct notifier_block *nb, | |||
309 | 309 | ||
310 | dev->pwr_domain = clknb->pwr_domain; | 310 | dev->pwr_domain = clknb->pwr_domain; |
311 | if (clknb->con_ids[0]) { | 311 | if (clknb->con_ids[0]) { |
312 | for (con_id = clknb->con_ids[0]; *con_id; con_id++) | 312 | for (con_id = clknb->con_ids; *con_id; con_id++) |
313 | pm_runtime_clk_add(dev, con_id); | 313 | pm_runtime_clk_add(dev, *con_id); |
314 | } else { | 314 | } else { |
315 | pm_runtime_clk_add(dev, NULL); | 315 | pm_runtime_clk_add(dev, NULL); |
316 | } | 316 | } |
@@ -380,25 +380,25 @@ static int pm_runtime_clk_notify(struct notifier_block *nb, | |||
380 | { | 380 | { |
381 | struct pm_clk_notifier_block *clknb; | 381 | struct pm_clk_notifier_block *clknb; |
382 | struct device *dev = data; | 382 | struct device *dev = data; |
383 | char *con_id; | 383 | char **con_id; |
384 | 384 | ||
385 | dev_dbg(dev, "%s() %ld\n", __func__, action); | 385 | dev_dbg(dev, "%s() %ld\n", __func__, action); |
386 | 386 | ||
387 | clknb = container_of(nb, struct pm_clk_notifier_block, nb); | 387 | clknb = container_of(nb, struct pm_clk_notifier_block, nb); |
388 | 388 | ||
389 | switch (action) { | 389 | switch (action) { |
390 | case BUS_NOTIFY_ADD_DEVICE: | 390 | case BUS_NOTIFY_BIND_DRIVER: |
391 | if (clknb->con_ids[0]) { | 391 | if (clknb->con_ids[0]) { |
392 | for (con_id = clknb->con_ids[0]; *con_id; con_id++) | 392 | for (con_id = clknb->con_ids; *con_id; con_id++) |
393 | enable_clock(dev, con_id); | 393 | enable_clock(dev, *con_id); |
394 | } else { | 394 | } else { |
395 | enable_clock(dev, NULL); | 395 | enable_clock(dev, NULL); |
396 | } | 396 | } |
397 | break; | 397 | break; |
398 | case BUS_NOTIFY_DEL_DEVICE: | 398 | case BUS_NOTIFY_UNBOUND_DRIVER: |
399 | if (clknb->con_ids[0]) { | 399 | if (clknb->con_ids[0]) { |
400 | for (con_id = clknb->con_ids[0]; *con_id; con_id++) | 400 | for (con_id = clknb->con_ids; *con_id; con_id++) |
401 | disable_clock(dev, con_id); | 401 | disable_clock(dev, *con_id); |
402 | } else { | 402 | } else { |
403 | disable_clock(dev, NULL); | 403 | disable_clock(dev, NULL); |
404 | } | 404 | } |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index aa6320207745..06f09bf89cb2 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -57,7 +57,8 @@ static int async_error; | |||
57 | */ | 57 | */ |
58 | void device_pm_init(struct device *dev) | 58 | void device_pm_init(struct device *dev) |
59 | { | 59 | { |
60 | dev->power.in_suspend = false; | 60 | dev->power.is_prepared = false; |
61 | dev->power.is_suspended = false; | ||
61 | init_completion(&dev->power.completion); | 62 | init_completion(&dev->power.completion); |
62 | complete_all(&dev->power.completion); | 63 | complete_all(&dev->power.completion); |
63 | dev->power.wakeup = NULL; | 64 | dev->power.wakeup = NULL; |
@@ -91,7 +92,7 @@ void device_pm_add(struct device *dev) | |||
91 | pr_debug("PM: Adding info for %s:%s\n", | 92 | pr_debug("PM: Adding info for %s:%s\n", |
92 | dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); | 93 | dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); |
93 | mutex_lock(&dpm_list_mtx); | 94 | mutex_lock(&dpm_list_mtx); |
94 | if (dev->parent && dev->parent->power.in_suspend) | 95 | if (dev->parent && dev->parent->power.is_prepared) |
95 | dev_warn(dev, "parent %s should not be sleeping\n", | 96 | dev_warn(dev, "parent %s should not be sleeping\n", |
96 | dev_name(dev->parent)); | 97 | dev_name(dev->parent)); |
97 | list_add_tail(&dev->power.entry, &dpm_list); | 98 | list_add_tail(&dev->power.entry, &dpm_list); |
@@ -511,7 +512,14 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) | |||
511 | dpm_wait(dev->parent, async); | 512 | dpm_wait(dev->parent, async); |
512 | device_lock(dev); | 513 | device_lock(dev); |
513 | 514 | ||
514 | dev->power.in_suspend = false; | 515 | /* |
516 | * This is a fib. But we'll allow new children to be added below | ||
517 | * a resumed device, even if the device hasn't been completed yet. | ||
518 | */ | ||
519 | dev->power.is_prepared = false; | ||
520 | |||
521 | if (!dev->power.is_suspended) | ||
522 | goto Unlock; | ||
515 | 523 | ||
516 | if (dev->pwr_domain) { | 524 | if (dev->pwr_domain) { |
517 | pm_dev_dbg(dev, state, "power domain "); | 525 | pm_dev_dbg(dev, state, "power domain "); |
@@ -548,6 +556,9 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) | |||
548 | } | 556 | } |
549 | 557 | ||
550 | End: | 558 | End: |
559 | dev->power.is_suspended = false; | ||
560 | |||
561 | Unlock: | ||
551 | device_unlock(dev); | 562 | device_unlock(dev); |
552 | complete_all(&dev->power.completion); | 563 | complete_all(&dev->power.completion); |
553 | 564 | ||
@@ -670,7 +681,7 @@ void dpm_complete(pm_message_t state) | |||
670 | struct device *dev = to_device(dpm_prepared_list.prev); | 681 | struct device *dev = to_device(dpm_prepared_list.prev); |
671 | 682 | ||
672 | get_device(dev); | 683 | get_device(dev); |
673 | dev->power.in_suspend = false; | 684 | dev->power.is_prepared = false; |
674 | list_move(&dev->power.entry, &list); | 685 | list_move(&dev->power.entry, &list); |
675 | mutex_unlock(&dpm_list_mtx); | 686 | mutex_unlock(&dpm_list_mtx); |
676 | 687 | ||
@@ -835,11 +846,11 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
835 | device_lock(dev); | 846 | device_lock(dev); |
836 | 847 | ||
837 | if (async_error) | 848 | if (async_error) |
838 | goto End; | 849 | goto Unlock; |
839 | 850 | ||
840 | if (pm_wakeup_pending()) { | 851 | if (pm_wakeup_pending()) { |
841 | async_error = -EBUSY; | 852 | async_error = -EBUSY; |
842 | goto End; | 853 | goto Unlock; |
843 | } | 854 | } |
844 | 855 | ||
845 | if (dev->pwr_domain) { | 856 | if (dev->pwr_domain) { |
@@ -877,6 +888,9 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
877 | } | 888 | } |
878 | 889 | ||
879 | End: | 890 | End: |
891 | dev->power.is_suspended = !error; | ||
892 | |||
893 | Unlock: | ||
880 | device_unlock(dev); | 894 | device_unlock(dev); |
881 | complete_all(&dev->power.completion); | 895 | complete_all(&dev->power.completion); |
882 | 896 | ||
@@ -1042,7 +1056,7 @@ int dpm_prepare(pm_message_t state) | |||
1042 | put_device(dev); | 1056 | put_device(dev); |
1043 | break; | 1057 | break; |
1044 | } | 1058 | } |
1045 | dev->power.in_suspend = true; | 1059 | dev->power.is_prepared = true; |
1046 | if (!list_empty(&dev->power.entry)) | 1060 | if (!list_empty(&dev->power.entry)) |
1047 | list_move_tail(&dev->power.entry, &dpm_prepared_list); | 1061 | list_move_tail(&dev->power.entry, &dpm_prepared_list); |
1048 | put_device(dev); | 1062 | put_device(dev); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index e6fc716aca45..f533f3375e24 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -192,7 +192,8 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size, | |||
192 | if (lo->xmit_timeout) | 192 | if (lo->xmit_timeout) |
193 | del_timer_sync(&ti); | 193 | del_timer_sync(&ti); |
194 | } else | 194 | } else |
195 | result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0); | 195 | result = kernel_recvmsg(sock, &msg, &iov, 1, size, |
196 | msg.msg_flags); | ||
196 | 197 | ||
197 | if (signal_pending(current)) { | 198 | if (signal_pending(current)) { |
198 | siginfo_t info; | 199 | siginfo_t info; |
@@ -753,9 +754,26 @@ static int __init nbd_init(void) | |||
753 | return -ENOMEM; | 754 | return -ENOMEM; |
754 | 755 | ||
755 | part_shift = 0; | 756 | part_shift = 0; |
756 | if (max_part > 0) | 757 | if (max_part > 0) { |
757 | part_shift = fls(max_part); | 758 | part_shift = fls(max_part); |
758 | 759 | ||
760 | /* | ||
761 | * Adjust max_part according to part_shift as it is exported | ||
762 | * to user space so that user can know the max number of | ||
763 | * partition kernel should be able to manage. | ||
764 | * | ||
765 | * Note that -1 is required because partition 0 is reserved | ||
766 | * for the whole disk. | ||
767 | */ | ||
768 | max_part = (1UL << part_shift) - 1; | ||
769 | } | ||
770 | |||
771 | if ((1UL << part_shift) > DISK_MAX_PARTS) | ||
772 | return -EINVAL; | ||
773 | |||
774 | if (nbds_max > 1UL << (MINORBITS - part_shift)) | ||
775 | return -EINVAL; | ||
776 | |||
759 | for (i = 0; i < nbds_max; i++) { | 777 | for (i = 0; i < nbds_max; i++) { |
760 | struct gendisk *disk = alloc_disk(1 << part_shift); | 778 | struct gendisk *disk = alloc_disk(1 << part_shift); |
761 | if (!disk) | 779 | if (!disk) |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index a0aabd904a51..46b8136c31bb 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -321,7 +321,6 @@ static void pcd_init_units(void) | |||
321 | strcpy(disk->disk_name, cd->name); /* umm... */ | 321 | strcpy(disk->disk_name, cd->name); /* umm... */ |
322 | disk->fops = &pcd_bdops; | 322 | disk->fops = &pcd_bdops; |
323 | disk->flags = GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | 323 | disk->flags = GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
324 | disk->events = DISK_EVENT_MEDIA_CHANGE; | ||
325 | } | 324 | } |
326 | } | 325 | } |
327 | 326 | ||
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6ecf89cdf006..079c08808d8a 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -6,10 +6,13 @@ | |||
6 | #include <linux/virtio.h> | 6 | #include <linux/virtio.h> |
7 | #include <linux/virtio_blk.h> | 7 | #include <linux/virtio_blk.h> |
8 | #include <linux/scatterlist.h> | 8 | #include <linux/scatterlist.h> |
9 | #include <linux/string_helpers.h> | ||
10 | #include <scsi/scsi_cmnd.h> | ||
9 | 11 | ||
10 | #define PART_BITS 4 | 12 | #define PART_BITS 4 |
11 | 13 | ||
12 | static int major, index; | 14 | static int major, index; |
15 | struct workqueue_struct *virtblk_wq; | ||
13 | 16 | ||
14 | struct virtio_blk | 17 | struct virtio_blk |
15 | { | 18 | { |
@@ -26,6 +29,9 @@ struct virtio_blk | |||
26 | 29 | ||
27 | mempool_t *pool; | 30 | mempool_t *pool; |
28 | 31 | ||
32 | /* Process context for config space updates */ | ||
33 | struct work_struct config_work; | ||
34 | |||
29 | /* What host tells us, plus 2 for header & tailer. */ | 35 | /* What host tells us, plus 2 for header & tailer. */ |
30 | unsigned int sg_elems; | 36 | unsigned int sg_elems; |
31 | 37 | ||
@@ -141,7 +147,7 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk, | |||
141 | num = blk_rq_map_sg(q, vbr->req, vblk->sg + out); | 147 | num = blk_rq_map_sg(q, vbr->req, vblk->sg + out); |
142 | 148 | ||
143 | if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC) { | 149 | if (vbr->req->cmd_type == REQ_TYPE_BLOCK_PC) { |
144 | sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, 96); | 150 | sg_set_buf(&vblk->sg[num + out + in++], vbr->req->sense, SCSI_SENSE_BUFFERSIZE); |
145 | sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr, | 151 | sg_set_buf(&vblk->sg[num + out + in++], &vbr->in_hdr, |
146 | sizeof(vbr->in_hdr)); | 152 | sizeof(vbr->in_hdr)); |
147 | } | 153 | } |
@@ -291,6 +297,46 @@ static ssize_t virtblk_serial_show(struct device *dev, | |||
291 | } | 297 | } |
292 | DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL); | 298 | DEVICE_ATTR(serial, S_IRUGO, virtblk_serial_show, NULL); |
293 | 299 | ||
300 | static void virtblk_config_changed_work(struct work_struct *work) | ||
301 | { | ||
302 | struct virtio_blk *vblk = | ||
303 | container_of(work, struct virtio_blk, config_work); | ||
304 | struct virtio_device *vdev = vblk->vdev; | ||
305 | struct request_queue *q = vblk->disk->queue; | ||
306 | char cap_str_2[10], cap_str_10[10]; | ||
307 | u64 capacity, size; | ||
308 | |||
309 | /* Host must always specify the capacity. */ | ||
310 | vdev->config->get(vdev, offsetof(struct virtio_blk_config, capacity), | ||
311 | &capacity, sizeof(capacity)); | ||
312 | |||
313 | /* If capacity is too big, truncate with warning. */ | ||
314 | if ((sector_t)capacity != capacity) { | ||
315 | dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n", | ||
316 | (unsigned long long)capacity); | ||
317 | capacity = (sector_t)-1; | ||
318 | } | ||
319 | |||
320 | size = capacity * queue_logical_block_size(q); | ||
321 | string_get_size(size, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2)); | ||
322 | string_get_size(size, STRING_UNITS_10, cap_str_10, sizeof(cap_str_10)); | ||
323 | |||
324 | dev_notice(&vdev->dev, | ||
325 | "new size: %llu %d-byte logical blocks (%s/%s)\n", | ||
326 | (unsigned long long)capacity, | ||
327 | queue_logical_block_size(q), | ||
328 | cap_str_10, cap_str_2); | ||
329 | |||
330 | set_capacity(vblk->disk, capacity); | ||
331 | } | ||
332 | |||
333 | static void virtblk_config_changed(struct virtio_device *vdev) | ||
334 | { | ||
335 | struct virtio_blk *vblk = vdev->priv; | ||
336 | |||
337 | queue_work(virtblk_wq, &vblk->config_work); | ||
338 | } | ||
339 | |||
294 | static int __devinit virtblk_probe(struct virtio_device *vdev) | 340 | static int __devinit virtblk_probe(struct virtio_device *vdev) |
295 | { | 341 | { |
296 | struct virtio_blk *vblk; | 342 | struct virtio_blk *vblk; |
@@ -327,6 +373,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
327 | vblk->vdev = vdev; | 373 | vblk->vdev = vdev; |
328 | vblk->sg_elems = sg_elems; | 374 | vblk->sg_elems = sg_elems; |
329 | sg_init_table(vblk->sg, vblk->sg_elems); | 375 | sg_init_table(vblk->sg, vblk->sg_elems); |
376 | INIT_WORK(&vblk->config_work, virtblk_config_changed_work); | ||
330 | 377 | ||
331 | /* We expect one virtqueue, for output. */ | 378 | /* We expect one virtqueue, for output. */ |
332 | vblk->vq = virtio_find_single_vq(vdev, blk_done, "requests"); | 379 | vblk->vq = virtio_find_single_vq(vdev, blk_done, "requests"); |
@@ -477,6 +524,8 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) | |||
477 | { | 524 | { |
478 | struct virtio_blk *vblk = vdev->priv; | 525 | struct virtio_blk *vblk = vdev->priv; |
479 | 526 | ||
527 | flush_work(&vblk->config_work); | ||
528 | |||
480 | /* Nothing should be pending. */ | 529 | /* Nothing should be pending. */ |
481 | BUG_ON(!list_empty(&vblk->reqs)); | 530 | BUG_ON(!list_empty(&vblk->reqs)); |
482 | 531 | ||
@@ -508,27 +557,47 @@ static unsigned int features[] = { | |||
508 | * Use __refdata to avoid this warning. | 557 | * Use __refdata to avoid this warning. |
509 | */ | 558 | */ |
510 | static struct virtio_driver __refdata virtio_blk = { | 559 | static struct virtio_driver __refdata virtio_blk = { |
511 | .feature_table = features, | 560 | .feature_table = features, |
512 | .feature_table_size = ARRAY_SIZE(features), | 561 | .feature_table_size = ARRAY_SIZE(features), |
513 | .driver.name = KBUILD_MODNAME, | 562 | .driver.name = KBUILD_MODNAME, |
514 | .driver.owner = THIS_MODULE, | 563 | .driver.owner = THIS_MODULE, |
515 | .id_table = id_table, | 564 | .id_table = id_table, |
516 | .probe = virtblk_probe, | 565 | .probe = virtblk_probe, |
517 | .remove = __devexit_p(virtblk_remove), | 566 | .remove = __devexit_p(virtblk_remove), |
567 | .config_changed = virtblk_config_changed, | ||
518 | }; | 568 | }; |
519 | 569 | ||
520 | static int __init init(void) | 570 | static int __init init(void) |
521 | { | 571 | { |
572 | int error; | ||
573 | |||
574 | virtblk_wq = alloc_workqueue("virtio-blk", 0, 0); | ||
575 | if (!virtblk_wq) | ||
576 | return -ENOMEM; | ||
577 | |||
522 | major = register_blkdev(0, "virtblk"); | 578 | major = register_blkdev(0, "virtblk"); |
523 | if (major < 0) | 579 | if (major < 0) { |
524 | return major; | 580 | error = major; |
525 | return register_virtio_driver(&virtio_blk); | 581 | goto out_destroy_workqueue; |
582 | } | ||
583 | |||
584 | error = register_virtio_driver(&virtio_blk); | ||
585 | if (error) | ||
586 | goto out_unregister_blkdev; | ||
587 | return 0; | ||
588 | |||
589 | out_unregister_blkdev: | ||
590 | unregister_blkdev(major, "virtblk"); | ||
591 | out_destroy_workqueue: | ||
592 | destroy_workqueue(virtblk_wq); | ||
593 | return error; | ||
526 | } | 594 | } |
527 | 595 | ||
528 | static void __exit fini(void) | 596 | static void __exit fini(void) |
529 | { | 597 | { |
530 | unregister_blkdev(major, "virtblk"); | 598 | unregister_blkdev(major, "virtblk"); |
531 | unregister_virtio_driver(&virtio_blk); | 599 | unregister_virtio_driver(&virtio_blk); |
600 | destroy_workqueue(virtblk_wq); | ||
532 | } | 601 | } |
533 | module_init(init); | 602 | module_init(init); |
534 | module_exit(fini); | 603 | module_exit(fini); |
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index c73910cc28c9..5cf2993a8338 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -809,11 +809,13 @@ static int __init xen_blkif_init(void) | |||
809 | failed_init: | 809 | failed_init: |
810 | kfree(blkbk->pending_reqs); | 810 | kfree(blkbk->pending_reqs); |
811 | kfree(blkbk->pending_grant_handles); | 811 | kfree(blkbk->pending_grant_handles); |
812 | for (i = 0; i < mmap_pages; i++) { | 812 | if (blkbk->pending_pages) { |
813 | if (blkbk->pending_pages[i]) | 813 | for (i = 0; i < mmap_pages; i++) { |
814 | __free_page(blkbk->pending_pages[i]); | 814 | if (blkbk->pending_pages[i]) |
815 | __free_page(blkbk->pending_pages[i]); | ||
816 | } | ||
817 | kfree(blkbk->pending_pages); | ||
815 | } | 818 | } |
816 | kfree(blkbk->pending_pages); | ||
817 | kfree(blkbk); | 819 | kfree(blkbk); |
818 | blkbk = NULL; | 820 | blkbk = NULL; |
819 | return rc; | 821 | return rc; |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 34570823355b..6cc0db1bf522 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -357,14 +357,13 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, | |||
357 | } | 357 | } |
358 | 358 | ||
359 | vbd->bdev = bdev; | 359 | vbd->bdev = bdev; |
360 | vbd->size = vbd_sz(vbd); | ||
361 | |||
362 | if (vbd->bdev->bd_disk == NULL) { | 360 | if (vbd->bdev->bd_disk == NULL) { |
363 | DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", | 361 | DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", |
364 | vbd->pdevice); | 362 | vbd->pdevice); |
365 | xen_vbd_free(vbd); | 363 | xen_vbd_free(vbd); |
366 | return -ENOENT; | 364 | return -ENOENT; |
367 | } | 365 | } |
366 | vbd->size = vbd_sz(vbd); | ||
368 | 367 | ||
369 | if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) | 368 | if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) |
370 | vbd->type |= VDISK_CDROM; | 369 | vbd->type |= VDISK_CDROM; |
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index fd6305bf953e..8ecf4c6c2874 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c | |||
@@ -64,6 +64,8 @@ static ssize_t btmrvl_hscfgcmd_write(struct file *file, | |||
64 | return -EFAULT; | 64 | return -EFAULT; |
65 | 65 | ||
66 | ret = strict_strtol(buf, 10, &result); | 66 | ret = strict_strtol(buf, 10, &result); |
67 | if (ret) | ||
68 | return ret; | ||
67 | 69 | ||
68 | priv->btmrvl_dev.hscfgcmd = result; | 70 | priv->btmrvl_dev.hscfgcmd = result; |
69 | 71 | ||
@@ -108,6 +110,8 @@ static ssize_t btmrvl_psmode_write(struct file *file, const char __user *ubuf, | |||
108 | return -EFAULT; | 110 | return -EFAULT; |
109 | 111 | ||
110 | ret = strict_strtol(buf, 10, &result); | 112 | ret = strict_strtol(buf, 10, &result); |
113 | if (ret) | ||
114 | return ret; | ||
111 | 115 | ||
112 | priv->btmrvl_dev.psmode = result; | 116 | priv->btmrvl_dev.psmode = result; |
113 | 117 | ||
@@ -147,6 +151,8 @@ static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf, | |||
147 | return -EFAULT; | 151 | return -EFAULT; |
148 | 152 | ||
149 | ret = strict_strtol(buf, 10, &result); | 153 | ret = strict_strtol(buf, 10, &result); |
154 | if (ret) | ||
155 | return ret; | ||
150 | 156 | ||
151 | priv->btmrvl_dev.pscmd = result; | 157 | priv->btmrvl_dev.pscmd = result; |
152 | 158 | ||
@@ -191,6 +197,8 @@ static ssize_t btmrvl_gpiogap_write(struct file *file, const char __user *ubuf, | |||
191 | return -EFAULT; | 197 | return -EFAULT; |
192 | 198 | ||
193 | ret = strict_strtol(buf, 16, &result); | 199 | ret = strict_strtol(buf, 16, &result); |
200 | if (ret) | ||
201 | return ret; | ||
194 | 202 | ||
195 | priv->btmrvl_dev.gpio_gap = result; | 203 | priv->btmrvl_dev.gpio_gap = result; |
196 | 204 | ||
@@ -230,6 +238,8 @@ static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf, | |||
230 | return -EFAULT; | 238 | return -EFAULT; |
231 | 239 | ||
232 | ret = strict_strtol(buf, 10, &result); | 240 | ret = strict_strtol(buf, 10, &result); |
241 | if (ret) | ||
242 | return ret; | ||
233 | 243 | ||
234 | priv->btmrvl_dev.hscmd = result; | 244 | priv->btmrvl_dev.hscmd = result; |
235 | if (priv->btmrvl_dev.hscmd) { | 245 | if (priv->btmrvl_dev.hscmd) { |
@@ -272,6 +282,8 @@ static ssize_t btmrvl_hsmode_write(struct file *file, const char __user *ubuf, | |||
272 | return -EFAULT; | 282 | return -EFAULT; |
273 | 283 | ||
274 | ret = strict_strtol(buf, 10, &result); | 284 | ret = strict_strtol(buf, 10, &result); |
285 | if (ret) | ||
286 | return ret; | ||
275 | 287 | ||
276 | priv->btmrvl_dev.hsmode = result; | 288 | priv->btmrvl_dev.hsmode = result; |
277 | 289 | ||
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index b3f01996318f..48ad2a7ab080 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -355,29 +355,24 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) | |||
355 | * flags pointer to flags for data | 355 | * flags pointer to flags for data |
356 | * count count of received data in bytes | 356 | * count count of received data in bytes |
357 | * | 357 | * |
358 | * Return Value: Number of bytes received | 358 | * Return Value: None |
359 | */ | 359 | */ |
360 | static unsigned int hci_uart_tty_receive(struct tty_struct *tty, | 360 | static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *flags, int count) |
361 | const u8 *data, char *flags, int count) | ||
362 | { | 361 | { |
363 | struct hci_uart *hu = (void *)tty->disc_data; | 362 | struct hci_uart *hu = (void *)tty->disc_data; |
364 | int received; | ||
365 | 363 | ||
366 | if (!hu || tty != hu->tty) | 364 | if (!hu || tty != hu->tty) |
367 | return -ENODEV; | 365 | return; |
368 | 366 | ||
369 | if (!test_bit(HCI_UART_PROTO_SET, &hu->flags)) | 367 | if (!test_bit(HCI_UART_PROTO_SET, &hu->flags)) |
370 | return -EINVAL; | 368 | return; |
371 | 369 | ||
372 | spin_lock(&hu->rx_lock); | 370 | spin_lock(&hu->rx_lock); |
373 | received = hu->proto->recv(hu, (void *) data, count); | 371 | hu->proto->recv(hu, (void *) data, count); |
374 | if (received > 0) | 372 | hu->hdev->stat.byte_rx += count; |
375 | hu->hdev->stat.byte_rx += received; | ||
376 | spin_unlock(&hu->rx_lock); | 373 | spin_unlock(&hu->rx_lock); |
377 | 374 | ||
378 | tty_unthrottle(tty); | 375 | tty_unthrottle(tty); |
379 | |||
380 | return received; | ||
381 | } | 376 | } |
382 | 377 | ||
383 | static int hci_uart_register_dev(struct hci_uart *hu) | 378 | static int hci_uart_register_dev(struct hci_uart *hu) |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index ae15a4ddaa9b..7878da89d29e 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -627,7 +627,6 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
627 | gendisk->fops = &viocd_fops; | 627 | gendisk->fops = &viocd_fops; |
628 | gendisk->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE | | 628 | gendisk->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE | |
629 | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | 629 | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
630 | gendisk->events = DISK_EVENT_MEDIA_CHANGE; | ||
631 | set_capacity(gendisk, 0); | 630 | set_capacity(gendisk, 0); |
632 | gendisk->private_data = d; | 631 | gendisk->private_data = d; |
633 | d->viocd_disk = gendisk; | 632 | d->viocd_disk = gendisk; |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 051474c65b78..34d6a1cab8de 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -163,11 +163,32 @@ static irqreturn_t hpet_interrupt(int irq, void *data) | |||
163 | * This has the effect of treating non-periodic like periodic. | 163 | * This has the effect of treating non-periodic like periodic. |
164 | */ | 164 | */ |
165 | if ((devp->hd_flags & (HPET_IE | HPET_PERIODIC)) == HPET_IE) { | 165 | if ((devp->hd_flags & (HPET_IE | HPET_PERIODIC)) == HPET_IE) { |
166 | unsigned long m, t; | 166 | unsigned long m, t, mc, base, k; |
167 | struct hpet __iomem *hpet = devp->hd_hpet; | ||
168 | struct hpets *hpetp = devp->hd_hpets; | ||
167 | 169 | ||
168 | t = devp->hd_ireqfreq; | 170 | t = devp->hd_ireqfreq; |
169 | m = read_counter(&devp->hd_timer->hpet_compare); | 171 | m = read_counter(&devp->hd_timer->hpet_compare); |
170 | write_counter(t + m, &devp->hd_timer->hpet_compare); | 172 | mc = read_counter(&hpet->hpet_mc); |
173 | /* The time for the next interrupt would logically be t + m, | ||
174 | * however, if we are very unlucky and the interrupt is delayed | ||
175 | * for longer than t then we will completely miss the next | ||
176 | * interrupt if we set t + m and an application will hang. | ||
177 | * Therefore we need to make a more complex computation assuming | ||
178 | * that there exists a k for which the following is true: | ||
179 | * k * t + base < mc + delta | ||
180 | * (k + 1) * t + base > mc + delta | ||
181 | * where t is the interval in hpet ticks for the given freq, | ||
182 | * base is the theoretical start value 0 < base < t, | ||
183 | * mc is the main counter value at the time of the interrupt, | ||
184 | * delta is the time it takes to write the a value to the | ||
185 | * comparator. | ||
186 | * k may then be computed as (mc - base + delta) / t . | ||
187 | */ | ||
188 | base = mc % t; | ||
189 | k = (mc - base + hpetp->hp_delta) / t; | ||
190 | write_counter(t * (k + 1) + base, | ||
191 | &devp->hd_timer->hpet_compare); | ||
171 | } | 192 | } |
172 | 193 | ||
173 | if (devp->hd_flags & HPET_SHARED_IRQ) | 194 | if (devp->hd_flags & HPET_SHARED_IRQ) |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 838568a7dbf5..fb68b1295373 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1677,17 +1677,12 @@ static int __devinit virtcons_probe(struct virtio_device *vdev) | |||
1677 | portdev->config.max_nr_ports = 1; | 1677 | portdev->config.max_nr_ports = 1; |
1678 | if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) { | 1678 | if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) { |
1679 | multiport = true; | 1679 | multiport = true; |
1680 | vdev->features[0] |= 1 << VIRTIO_CONSOLE_F_MULTIPORT; | ||
1681 | |||
1682 | vdev->config->get(vdev, offsetof(struct virtio_console_config, | 1680 | vdev->config->get(vdev, offsetof(struct virtio_console_config, |
1683 | max_nr_ports), | 1681 | max_nr_ports), |
1684 | &portdev->config.max_nr_ports, | 1682 | &portdev->config.max_nr_ports, |
1685 | sizeof(portdev->config.max_nr_ports)); | 1683 | sizeof(portdev->config.max_nr_ports)); |
1686 | } | 1684 | } |
1687 | 1685 | ||
1688 | /* Let the Host know we support multiple ports.*/ | ||
1689 | vdev->config->finalize_features(vdev); | ||
1690 | |||
1691 | err = init_vqs(portdev); | 1686 | err = init_vqs(portdev); |
1692 | if (err < 0) { | 1687 | if (err < 0) { |
1693 | dev_err(&vdev->dev, "Error %d initializing vqs\n", err); | 1688 | dev_err(&vdev->dev, "Error %d initializing vqs\n", err); |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 036e5865eb40..dc7c033ef587 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/ioport.h> | 24 | #include <linux/ioport.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/pm_runtime.h> | ||
28 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
29 | #include <linux/err.h> | 28 | #include <linux/err.h> |
30 | #include <linux/clocksource.h> | 29 | #include <linux/clocksource.h> |
@@ -153,12 +152,10 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
153 | { | 152 | { |
154 | int ret; | 153 | int ret; |
155 | 154 | ||
156 | /* wake up device and enable clock */ | 155 | /* enable clock */ |
157 | pm_runtime_get_sync(&p->pdev->dev); | ||
158 | ret = clk_enable(p->clk); | 156 | ret = clk_enable(p->clk); |
159 | if (ret) { | 157 | if (ret) { |
160 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | 158 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
161 | pm_runtime_put_sync(&p->pdev->dev); | ||
162 | return ret; | 159 | return ret; |
163 | } | 160 | } |
164 | 161 | ||
@@ -190,9 +187,8 @@ static void sh_cmt_disable(struct sh_cmt_priv *p) | |||
190 | /* disable interrupts in CMT block */ | 187 | /* disable interrupts in CMT block */ |
191 | sh_cmt_write(p, CMCSR, 0); | 188 | sh_cmt_write(p, CMCSR, 0); |
192 | 189 | ||
193 | /* stop clock and mark device as idle */ | 190 | /* stop clock */ |
194 | clk_disable(p->clk); | 191 | clk_disable(p->clk); |
195 | pm_runtime_put_sync(&p->pdev->dev); | ||
196 | } | 192 | } |
197 | 193 | ||
198 | /* private flags */ | 194 | /* private flags */ |
@@ -664,7 +660,6 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev) | |||
664 | 660 | ||
665 | if (p) { | 661 | if (p) { |
666 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 662 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
667 | pm_runtime_enable(&pdev->dev); | ||
668 | return 0; | 663 | return 0; |
669 | } | 664 | } |
670 | 665 | ||
@@ -679,9 +674,6 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev) | |||
679 | kfree(p); | 674 | kfree(p); |
680 | platform_set_drvdata(pdev, NULL); | 675 | platform_set_drvdata(pdev, NULL); |
681 | } | 676 | } |
682 | |||
683 | if (!is_early_platform_device(pdev)) | ||
684 | pm_runtime_enable(&pdev->dev); | ||
685 | return ret; | 677 | return ret; |
686 | } | 678 | } |
687 | 679 | ||
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 17296288a205..808135768617 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/pm_runtime.h> | ||
29 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
30 | #include <linux/err.h> | 29 | #include <linux/err.h> |
31 | #include <linux/clocksource.h> | 30 | #include <linux/clocksource.h> |
@@ -110,12 +109,10 @@ static int sh_tmu_enable(struct sh_tmu_priv *p) | |||
110 | { | 109 | { |
111 | int ret; | 110 | int ret; |
112 | 111 | ||
113 | /* wake up device and enable clock */ | 112 | /* enable clock */ |
114 | pm_runtime_get_sync(&p->pdev->dev); | ||
115 | ret = clk_enable(p->clk); | 113 | ret = clk_enable(p->clk); |
116 | if (ret) { | 114 | if (ret) { |
117 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | 115 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
118 | pm_runtime_put_sync(&p->pdev->dev); | ||
119 | return ret; | 116 | return ret; |
120 | } | 117 | } |
121 | 118 | ||
@@ -144,9 +141,8 @@ static void sh_tmu_disable(struct sh_tmu_priv *p) | |||
144 | /* disable interrupts in TMU block */ | 141 | /* disable interrupts in TMU block */ |
145 | sh_tmu_write(p, TCR, 0x0000); | 142 | sh_tmu_write(p, TCR, 0x0000); |
146 | 143 | ||
147 | /* stop clock and mark device as idle */ | 144 | /* stop clock */ |
148 | clk_disable(p->clk); | 145 | clk_disable(p->clk); |
149 | pm_runtime_put_sync(&p->pdev->dev); | ||
150 | } | 146 | } |
151 | 147 | ||
152 | static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta, | 148 | static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta, |
@@ -415,7 +411,6 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev) | |||
415 | 411 | ||
416 | if (p) { | 412 | if (p) { |
417 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 413 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
418 | pm_runtime_enable(&pdev->dev); | ||
419 | return 0; | 414 | return 0; |
420 | } | 415 | } |
421 | 416 | ||
@@ -430,9 +425,6 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev) | |||
430 | kfree(p); | 425 | kfree(p); |
431 | platform_set_drvdata(pdev, NULL); | 426 | platform_set_drvdata(pdev, NULL); |
432 | } | 427 | } |
433 | |||
434 | if (!is_early_platform_device(pdev)) | ||
435 | pm_runtime_enable(&pdev->dev); | ||
436 | return ret; | 428 | return ret; |
437 | } | 429 | } |
438 | 430 | ||
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index b60a4c263686..faf7c5217848 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -298,11 +298,13 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, | |||
298 | old_index = stat->last_index; | 298 | old_index = stat->last_index; |
299 | new_index = freq_table_get_index(stat, freq->new); | 299 | new_index = freq_table_get_index(stat, freq->new); |
300 | 300 | ||
301 | cpufreq_stats_update(freq->cpu); | 301 | /* We can't do stat->time_in_state[-1]= .. */ |
302 | if (old_index == new_index) | 302 | if (old_index == -1 || new_index == -1) |
303 | return 0; | 303 | return 0; |
304 | 304 | ||
305 | if (old_index == -1 || new_index == -1) | 305 | cpufreq_stats_update(freq->cpu); |
306 | |||
307 | if (old_index == new_index) | ||
306 | return 0; | 308 | return 0; |
307 | 309 | ||
308 | spin_lock(&cpufreq_stats_lock); | 310 | spin_lock(&cpufreq_stats_lock); |
@@ -387,6 +389,7 @@ static void __exit cpufreq_stats_exit(void) | |||
387 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | 389 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
388 | for_each_online_cpu(cpu) { | 390 | for_each_online_cpu(cpu) { |
389 | cpufreq_stats_free_table(cpu); | 391 | cpufreq_stats_free_table(cpu); |
392 | cpufreq_stats_free_sysfs(cpu); | ||
390 | } | 393 | } |
391 | } | 394 | } |
392 | 395 | ||
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 83479b6fb9a1..bce576d7478e 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -1079,6 +1079,9 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, | |||
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | res = transition_fid_vid(data, fid, vid); | 1081 | res = transition_fid_vid(data, fid, vid); |
1082 | if (res) | ||
1083 | return res; | ||
1084 | |||
1082 | freqs.new = find_khz_freq_from_fid(data->currfid); | 1085 | freqs.new = find_khz_freq_from_fid(data->currfid); |
1083 | 1086 | ||
1084 | for_each_cpu(i, data->available_cores) { | 1087 | for_each_cpu(i, data->available_cores) { |
@@ -1101,7 +1104,8 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, | |||
1101 | /* get MSR index for hardware pstate transition */ | 1104 | /* get MSR index for hardware pstate transition */ |
1102 | pstate = index & HW_PSTATE_MASK; | 1105 | pstate = index & HW_PSTATE_MASK; |
1103 | if (pstate > data->max_hw_pstate) | 1106 | if (pstate > data->max_hw_pstate) |
1104 | return 0; | 1107 | return -EINVAL; |
1108 | |||
1105 | freqs.old = find_khz_freq_from_pstate(data->powernow_table, | 1109 | freqs.old = find_khz_freq_from_pstate(data->powernow_table, |
1106 | data->currpstate); | 1110 | data->currpstate); |
1107 | freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); | 1111 | freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); |
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c index 636e40925b16..028330044201 100644 --- a/drivers/dma/shdma.c +++ b/drivers/dma/shdma.c | |||
@@ -343,7 +343,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan) | |||
343 | 343 | ||
344 | dmae_set_dmars(sh_chan, cfg->mid_rid); | 344 | dmae_set_dmars(sh_chan, cfg->mid_rid); |
345 | dmae_set_chcr(sh_chan, cfg->chcr); | 345 | dmae_set_chcr(sh_chan, cfg->chcr); |
346 | } else if ((sh_dmae_readl(sh_chan, CHCR) & 0xf00) != 0x400) { | 346 | } else { |
347 | dmae_init(sh_chan); | 347 | dmae_init(sh_chan); |
348 | } | 348 | } |
349 | 349 | ||
@@ -1144,6 +1144,8 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1144 | /* platform data */ | 1144 | /* platform data */ |
1145 | shdev->pdata = pdata; | 1145 | shdev->pdata = pdata; |
1146 | 1146 | ||
1147 | platform_set_drvdata(pdev, shdev); | ||
1148 | |||
1147 | pm_runtime_enable(&pdev->dev); | 1149 | pm_runtime_enable(&pdev->dev); |
1148 | pm_runtime_get_sync(&pdev->dev); | 1150 | pm_runtime_get_sync(&pdev->dev); |
1149 | 1151 | ||
@@ -1219,6 +1221,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1219 | } else { | 1221 | } else { |
1220 | do { | 1222 | do { |
1221 | for (i = chanirq_res->start; i <= chanirq_res->end; i++) { | 1223 | for (i = chanirq_res->start; i <= chanirq_res->end; i++) { |
1224 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) { | ||
1225 | irq_cap = 1; | ||
1226 | break; | ||
1227 | } | ||
1228 | |||
1222 | if ((errirq_res->flags & IORESOURCE_BITS) == | 1229 | if ((errirq_res->flags & IORESOURCE_BITS) == |
1223 | IORESOURCE_IRQ_SHAREABLE) | 1230 | IORESOURCE_IRQ_SHAREABLE) |
1224 | chan_flag[irq_cnt] = IRQF_SHARED; | 1231 | chan_flag[irq_cnt] = IRQF_SHARED; |
@@ -1228,15 +1235,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1228 | "Found IRQ %d for channel %d\n", | 1235 | "Found IRQ %d for channel %d\n", |
1229 | i, irq_cnt); | 1236 | i, irq_cnt); |
1230 | chan_irq[irq_cnt++] = i; | 1237 | chan_irq[irq_cnt++] = i; |
1231 | |||
1232 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) | ||
1233 | break; | ||
1234 | } | 1238 | } |
1235 | 1239 | ||
1236 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) { | 1240 | if (irq_cnt >= SH_DMAC_MAX_CHANNELS) |
1237 | irq_cap = 1; | ||
1238 | break; | 1241 | break; |
1239 | } | 1242 | |
1240 | chanirq_res = platform_get_resource(pdev, | 1243 | chanirq_res = platform_get_resource(pdev, |
1241 | IORESOURCE_IRQ, ++irqres); | 1244 | IORESOURCE_IRQ, ++irqres); |
1242 | } while (irq_cnt < pdata->channel_num && chanirq_res); | 1245 | } while (irq_cnt < pdata->channel_num && chanirq_res); |
@@ -1256,7 +1259,6 @@ static int __init sh_dmae_probe(struct platform_device *pdev) | |||
1256 | 1259 | ||
1257 | pm_runtime_put(&pdev->dev); | 1260 | pm_runtime_put(&pdev->dev); |
1258 | 1261 | ||
1259 | platform_set_drvdata(pdev, shdev); | ||
1260 | dma_async_device_register(&shdev->common); | 1262 | dma_async_device_register(&shdev->common); |
1261 | 1263 | ||
1262 | return err; | 1264 | return err; |
@@ -1278,6 +1280,8 @@ rst_err: | |||
1278 | 1280 | ||
1279 | if (dmars) | 1281 | if (dmars) |
1280 | iounmap(shdev->dmars); | 1282 | iounmap(shdev->dmars); |
1283 | |||
1284 | platform_set_drvdata(pdev, NULL); | ||
1281 | emapdmars: | 1285 | emapdmars: |
1282 | iounmap(shdev->chan_reg); | 1286 | iounmap(shdev->chan_reg); |
1283 | synchronize_rcu(); | 1287 | synchronize_rcu(); |
@@ -1316,6 +1320,8 @@ static int __exit sh_dmae_remove(struct platform_device *pdev) | |||
1316 | iounmap(shdev->dmars); | 1320 | iounmap(shdev->dmars); |
1317 | iounmap(shdev->chan_reg); | 1321 | iounmap(shdev->chan_reg); |
1318 | 1322 | ||
1323 | platform_set_drvdata(pdev, NULL); | ||
1324 | |||
1319 | synchronize_rcu(); | 1325 | synchronize_rcu(); |
1320 | kfree(shdev); | 1326 | kfree(shdev); |
1321 | 1327 | ||
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c index f032e446fc11..bfe723266fd8 100644 --- a/drivers/firmware/iscsi_ibft_find.c +++ b/drivers/firmware/iscsi_ibft_find.c | |||
@@ -108,7 +108,9 @@ done: | |||
108 | */ | 108 | */ |
109 | unsigned long __init find_ibft_region(unsigned long *sizep) | 109 | unsigned long __init find_ibft_region(unsigned long *sizep) |
110 | { | 110 | { |
111 | #ifdef CONFIG_ACPI | ||
111 | int i; | 112 | int i; |
113 | #endif | ||
112 | ibft_addr = NULL; | 114 | ibft_addr = NULL; |
113 | 115 | ||
114 | #ifdef CONFIG_ACPI | 116 | #ifdef CONFIG_ACPI |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 4a7f63143455..2967002a9f82 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -87,32 +87,20 @@ config GPIO_IT8761E | |||
87 | Say yes here to support GPIO functionality of IT8761E super I/O chip. | 87 | Say yes here to support GPIO functionality of IT8761E super I/O chip. |
88 | 88 | ||
89 | config GPIO_EXYNOS4 | 89 | config GPIO_EXYNOS4 |
90 | bool "Samsung Exynos4 GPIO library support" | 90 | def_bool y |
91 | default y if CPU_EXYNOS4210 | 91 | depends on CPU_EXYNOS4210 |
92 | depends on ARM | ||
93 | help | ||
94 | Say yes here to support Samsung Exynos4 series SoCs GPIO library | ||
95 | 92 | ||
96 | config GPIO_PLAT_SAMSUNG | 93 | config GPIO_PLAT_SAMSUNG |
97 | bool "Samsung SoCs GPIO library support" | 94 | def_bool y |
98 | default y if SAMSUNG_GPIOLIB_4BIT | 95 | depends on SAMSUNG_GPIOLIB_4BIT |
99 | depends on ARM | ||
100 | help | ||
101 | Say yes here to support Samsung SoCs GPIO library | ||
102 | 96 | ||
103 | config GPIO_S5PC100 | 97 | config GPIO_S5PC100 |
104 | bool "Samsung S5PC100 GPIO library support" | 98 | def_bool y |
105 | default y if CPU_S5PC100 | 99 | depends on CPU_S5PC100 |
106 | depends on ARM | ||
107 | help | ||
108 | Say yes here to support Samsung S5PC100 SoCs GPIO library | ||
109 | 100 | ||
110 | config GPIO_S5PV210 | 101 | config GPIO_S5PV210 |
111 | bool "Samsung S5PV210/S5PC110 GPIO library support" | 102 | def_bool y |
112 | default y if CPU_S5PV210 | 103 | depends on CPU_S5PV210 |
113 | depends on ARM | ||
114 | help | ||
115 | Say yes here to support Samsung S5PV210/S5PC110 SoCs GPIO library | ||
116 | 104 | ||
117 | config GPIO_PL061 | 105 | config GPIO_PL061 |
118 | bool "PrimeCell PL061 GPIO support" | 106 | bool "PrimeCell PL061 GPIO support" |
diff --git a/drivers/gpio/gpio-exynos4.c b/drivers/gpio/gpio-exynos4.c index d54ca6adb660..9029835112e7 100644 --- a/drivers/gpio/gpio-exynos4.c +++ b/drivers/gpio/gpio-exynos4.c | |||
@@ -21,16 +21,37 @@ | |||
21 | #include <plat/gpio-cfg.h> | 21 | #include <plat/gpio-cfg.h> |
22 | #include <plat/gpio-cfg-helpers.h> | 22 | #include <plat/gpio-cfg-helpers.h> |
23 | 23 | ||
24 | int s3c_gpio_setpull_exynos4(struct s3c_gpio_chip *chip, | ||
25 | unsigned int off, s3c_gpio_pull_t pull) | ||
26 | { | ||
27 | if (pull == S3C_GPIO_PULL_UP) | ||
28 | pull = 3; | ||
29 | |||
30 | return s3c_gpio_setpull_updown(chip, off, pull); | ||
31 | } | ||
32 | |||
33 | s3c_gpio_pull_t s3c_gpio_getpull_exynos4(struct s3c_gpio_chip *chip, | ||
34 | unsigned int off) | ||
35 | { | ||
36 | s3c_gpio_pull_t pull; | ||
37 | |||
38 | pull = s3c_gpio_getpull_updown(chip, off); | ||
39 | if (pull == 3) | ||
40 | pull = S3C_GPIO_PULL_UP; | ||
41 | |||
42 | return pull; | ||
43 | } | ||
44 | |||
24 | static struct s3c_gpio_cfg gpio_cfg = { | 45 | static struct s3c_gpio_cfg gpio_cfg = { |
25 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | 46 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, |
26 | .set_pull = s3c_gpio_setpull_updown, | 47 | .set_pull = s3c_gpio_setpull_exynos4, |
27 | .get_pull = s3c_gpio_getpull_updown, | 48 | .get_pull = s3c_gpio_getpull_exynos4, |
28 | }; | 49 | }; |
29 | 50 | ||
30 | static struct s3c_gpio_cfg gpio_cfg_noint = { | 51 | static struct s3c_gpio_cfg gpio_cfg_noint = { |
31 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, | 52 | .set_config = s3c_gpio_setcfg_s3c64xx_4bit, |
32 | .set_pull = s3c_gpio_setpull_updown, | 53 | .set_pull = s3c_gpio_setpull_exynos4, |
33 | .get_pull = s3c_gpio_getpull_updown, | 54 | .get_pull = s3c_gpio_getpull_exynos4, |
34 | }; | 55 | }; |
35 | 56 | ||
36 | /* | 57 | /* |
diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 4961ef9bc153..2c212c732d76 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright (C) 2008,2009 STMicroelectronics | 4 | * Copyright (C) 2008,2009 STMicroelectronics |
5 | * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> | 5 | * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> |
6 | * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> | 6 | * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> |
7 | * Copyright (C) 2011 Linus Walleij <linus.walleij@linaro.org> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
@@ -49,6 +50,7 @@ struct nmk_gpio_chip { | |||
49 | u32 (*get_secondary_status)(unsigned int bank); | 50 | u32 (*get_secondary_status)(unsigned int bank); |
50 | void (*set_ioforce)(bool enable); | 51 | void (*set_ioforce)(bool enable); |
51 | spinlock_t lock; | 52 | spinlock_t lock; |
53 | bool sleepmode; | ||
52 | /* Keep track of configured edges */ | 54 | /* Keep track of configured edges */ |
53 | u32 edge_rising; | 55 | u32 edge_rising; |
54 | u32 edge_falling; | 56 | u32 edge_falling; |
@@ -393,14 +395,25 @@ EXPORT_SYMBOL(nmk_config_pins_sleep); | |||
393 | * @gpio: pin number | 395 | * @gpio: pin number |
394 | * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE, | 396 | * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE, |
395 | * | 397 | * |
396 | * Sets the sleep mode of a pin. If @mode is NMK_GPIO_SLPM_INPUT, the pin is | 398 | * This register is actually in the pinmux layer, not the GPIO block itself. |
397 | * changed to an input (with pullup/down enabled) in sleep and deep sleep. If | 399 | * The GPIO1B_SLPM register defines the GPIO mode when SLEEP/DEEP-SLEEP |
398 | * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was | 400 | * mode is entered (i.e. when signal IOFORCE is HIGH by the platform code). |
399 | * configured even when in sleep and deep sleep. | 401 | * Each GPIO can be configured to be forced into GPIO mode when IOFORCE is |
402 | * HIGH, overriding the normal setting defined by GPIO_AFSELx registers. | ||
403 | * When IOFORCE returns LOW (by software, after SLEEP/DEEP-SLEEP exit), | ||
404 | * the GPIOs return to the normal setting defined by GPIO_AFSELx registers. | ||
400 | * | 405 | * |
401 | * On DB8500v2 onwards, this setting loses the previous meaning and instead | 406 | * If @mode is NMK_GPIO_SLPM_INPUT, the corresponding GPIO is switched to GPIO |
402 | * indicates if wakeup detection is enabled on the pin. Note that | 407 | * mode when signal IOFORCE is HIGH (i.e. when SLEEP/DEEP-SLEEP mode is |
403 | * enable_irq_wake() will automatically enable wakeup detection. | 408 | * entered) regardless of the altfunction selected. Also wake-up detection is |
409 | * ENABLED. | ||
410 | * | ||
411 | * If @mode is NMK_GPIO_SLPM_NOCHANGE, the corresponding GPIO remains | ||
412 | * controlled by NMK_GPIO_DATC, NMK_GPIO_DATS, NMK_GPIO_DIR, NMK_GPIO_PDIS | ||
413 | * (for altfunction GPIO) or respective on-chip peripherals (for other | ||
414 | * altfuncs) when IOFORCE is HIGH. Also wake-up detection DISABLED. | ||
415 | * | ||
416 | * Note that enable_irq_wake() will automatically enable wakeup detection. | ||
404 | */ | 417 | */ |
405 | int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) | 418 | int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode) |
406 | { | 419 | { |
@@ -551,6 +564,12 @@ static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, | |||
551 | static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, | 564 | static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, |
552 | int gpio, bool on) | 565 | int gpio, bool on) |
553 | { | 566 | { |
567 | if (nmk_chip->sleepmode) { | ||
568 | __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base, | ||
569 | on ? NMK_GPIO_SLPM_WAKEUP_ENABLE | ||
570 | : NMK_GPIO_SLPM_WAKEUP_DISABLE); | ||
571 | } | ||
572 | |||
554 | __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); | 573 | __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, on); |
555 | } | 574 | } |
556 | 575 | ||
@@ -901,7 +920,7 @@ void nmk_gpio_wakeups_suspend(void) | |||
901 | writel(chip->fwimsc & chip->real_wake, | 920 | writel(chip->fwimsc & chip->real_wake, |
902 | chip->addr + NMK_GPIO_FWIMSC); | 921 | chip->addr + NMK_GPIO_FWIMSC); |
903 | 922 | ||
904 | if (cpu_is_u8500v2()) { | 923 | if (chip->sleepmode) { |
905 | chip->slpm = readl(chip->addr + NMK_GPIO_SLPC); | 924 | chip->slpm = readl(chip->addr + NMK_GPIO_SLPC); |
906 | 925 | ||
907 | /* 0 -> wakeup enable */ | 926 | /* 0 -> wakeup enable */ |
@@ -923,7 +942,7 @@ void nmk_gpio_wakeups_resume(void) | |||
923 | writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); | 942 | writel(chip->rwimsc, chip->addr + NMK_GPIO_RWIMSC); |
924 | writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); | 943 | writel(chip->fwimsc, chip->addr + NMK_GPIO_FWIMSC); |
925 | 944 | ||
926 | if (cpu_is_u8500v2()) | 945 | if (chip->sleepmode) |
927 | writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); | 946 | writel(chip->slpm, chip->addr + NMK_GPIO_SLPC); |
928 | } | 947 | } |
929 | } | 948 | } |
@@ -1010,6 +1029,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
1010 | nmk_chip->secondary_parent_irq = secondary_irq; | 1029 | nmk_chip->secondary_parent_irq = secondary_irq; |
1011 | nmk_chip->get_secondary_status = pdata->get_secondary_status; | 1030 | nmk_chip->get_secondary_status = pdata->get_secondary_status; |
1012 | nmk_chip->set_ioforce = pdata->set_ioforce; | 1031 | nmk_chip->set_ioforce = pdata->set_ioforce; |
1032 | nmk_chip->sleepmode = pdata->supports_sleepmode; | ||
1013 | spin_lock_init(&nmk_chip->lock); | 1033 | spin_lock_init(&nmk_chip->lock); |
1014 | 1034 | ||
1015 | chip = &nmk_chip->chip; | 1035 | chip = &nmk_chip->chip; |
@@ -1065,5 +1085,3 @@ core_initcall(nmk_gpio_init); | |||
1065 | MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); | 1085 | MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); |
1066 | MODULE_DESCRIPTION("Nomadik GPIO Driver"); | 1086 | MODULE_DESCRIPTION("Nomadik GPIO Driver"); |
1067 | MODULE_LICENSE("GPL"); | 1087 | MODULE_LICENSE("GPL"); |
1068 | |||
1069 | |||
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 6c51191da567..35bebde23e83 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -432,7 +432,6 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
432 | { | 432 | { |
433 | void __iomem *base = bank->base; | 433 | void __iomem *base = bank->base; |
434 | u32 gpio_bit = 1 << gpio; | 434 | u32 gpio_bit = 1 << gpio; |
435 | u32 val; | ||
436 | 435 | ||
437 | if (cpu_is_omap44xx()) { | 436 | if (cpu_is_omap44xx()) { |
438 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, | 437 | MOD_REG_BIT(OMAP4_GPIO_LEVELDETECT0, gpio_bit, |
@@ -455,15 +454,8 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
455 | } | 454 | } |
456 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { | 455 | if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { |
457 | if (cpu_is_omap44xx()) { | 456 | if (cpu_is_omap44xx()) { |
458 | if (trigger != 0) | 457 | MOD_REG_BIT(OMAP4_GPIO_IRQWAKEN0, gpio_bit, |
459 | __raw_writel(1 << gpio, bank->base+ | 458 | trigger != 0); |
460 | OMAP4_GPIO_IRQWAKEN0); | ||
461 | else { | ||
462 | val = __raw_readl(bank->base + | ||
463 | OMAP4_GPIO_IRQWAKEN0); | ||
464 | __raw_writel(val & (~(1 << gpio)), bank->base + | ||
465 | OMAP4_GPIO_IRQWAKEN0); | ||
466 | } | ||
467 | } else { | 459 | } else { |
468 | /* | 460 | /* |
469 | * GPIO wakeup request can only be generated on edge | 461 | * GPIO wakeup request can only be generated on edge |
@@ -477,8 +469,9 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
477 | + OMAP24XX_GPIO_CLEARWKUENA); | 469 | + OMAP24XX_GPIO_CLEARWKUENA); |
478 | } | 470 | } |
479 | } | 471 | } |
480 | /* This part needs to be executed always for OMAP34xx */ | 472 | /* This part needs to be executed always for OMAP{34xx, 44xx} */ |
481 | if (cpu_is_omap34xx() || (bank->non_wakeup_gpios & gpio_bit)) { | 473 | if (cpu_is_omap34xx() || cpu_is_omap44xx() || |
474 | (bank->non_wakeup_gpios & gpio_bit)) { | ||
482 | /* | 475 | /* |
483 | * Log the edge gpio and manually trigger the IRQ | 476 | * Log the edge gpio and manually trigger the IRQ |
484 | * after resume if the input level changes | 477 | * after resume if the input level changes |
@@ -1134,8 +1127,11 @@ static void gpio_irq_shutdown(struct irq_data *d) | |||
1134 | { | 1127 | { |
1135 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1128 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1136 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1129 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1130 | unsigned long flags; | ||
1137 | 1131 | ||
1132 | spin_lock_irqsave(&bank->lock, flags); | ||
1138 | _reset_gpio(bank, gpio); | 1133 | _reset_gpio(bank, gpio); |
1134 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1139 | } | 1135 | } |
1140 | 1136 | ||
1141 | static void gpio_ack_irq(struct irq_data *d) | 1137 | static void gpio_ack_irq(struct irq_data *d) |
@@ -1150,9 +1146,12 @@ static void gpio_mask_irq(struct irq_data *d) | |||
1150 | { | 1146 | { |
1151 | unsigned int gpio = d->irq - IH_GPIO_BASE; | 1147 | unsigned int gpio = d->irq - IH_GPIO_BASE; |
1152 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1148 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1149 | unsigned long flags; | ||
1153 | 1150 | ||
1151 | spin_lock_irqsave(&bank->lock, flags); | ||
1154 | _set_gpio_irqenable(bank, gpio, 0); | 1152 | _set_gpio_irqenable(bank, gpio, 0); |
1155 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); | 1153 | _set_gpio_triggering(bank, get_gpio_index(gpio), IRQ_TYPE_NONE); |
1154 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1156 | } | 1155 | } |
1157 | 1156 | ||
1158 | static void gpio_unmask_irq(struct irq_data *d) | 1157 | static void gpio_unmask_irq(struct irq_data *d) |
@@ -1161,7 +1160,9 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
1161 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 1160 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
1162 | unsigned int irq_mask = 1 << get_gpio_index(gpio); | 1161 | unsigned int irq_mask = 1 << get_gpio_index(gpio); |
1163 | u32 trigger = irqd_get_trigger_type(d); | 1162 | u32 trigger = irqd_get_trigger_type(d); |
1163 | unsigned long flags; | ||
1164 | 1164 | ||
1165 | spin_lock_irqsave(&bank->lock, flags); | ||
1165 | if (trigger) | 1166 | if (trigger) |
1166 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); | 1167 | _set_gpio_triggering(bank, get_gpio_index(gpio), trigger); |
1167 | 1168 | ||
@@ -1173,6 +1174,7 @@ static void gpio_unmask_irq(struct irq_data *d) | |||
1173 | } | 1174 | } |
1174 | 1175 | ||
1175 | _set_gpio_irqenable(bank, gpio, 1); | 1176 | _set_gpio_irqenable(bank, gpio, 1); |
1177 | spin_unlock_irqrestore(&bank->lock, flags); | ||
1176 | } | 1178 | } |
1177 | 1179 | ||
1178 | static struct irq_chip gpio_irq_chip = { | 1180 | static struct irq_chip gpio_irq_chip = { |
@@ -1524,7 +1526,7 @@ static void omap_gpio_mod_init(struct gpio_bank *bank, int id) | |||
1524 | } | 1526 | } |
1525 | } | 1527 | } |
1526 | 1528 | ||
1527 | static void __init omap_gpio_chip_init(struct gpio_bank *bank) | 1529 | static void __devinit omap_gpio_chip_init(struct gpio_bank *bank) |
1528 | { | 1530 | { |
1529 | int j; | 1531 | int j; |
1530 | static int gpio; | 1532 | static int gpio; |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 3e257a50bf56..61e1ef90d4e5 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -46,10 +46,11 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, | |||
46 | list_for_each_entry(entry, &dev->maplist, head) { | 46 | list_for_each_entry(entry, &dev->maplist, head) { |
47 | /* | 47 | /* |
48 | * Because the kernel-userspace ABI is fixed at a 32-bit offset | 48 | * Because the kernel-userspace ABI is fixed at a 32-bit offset |
49 | * while PCI resources may live above that, we ignore the map | 49 | * while PCI resources may live above that, we only compare the |
50 | * offset for maps of type _DRM_FRAMEBUFFER or _DRM_REGISTERS. | 50 | * lower 32 bits of the map offset for maps of type |
51 | * It is assumed that each driver will have only one resource of | 51 | * _DRM_FRAMEBUFFER or _DRM_REGISTERS. |
52 | * each type. | 52 | * It is assumed that if a driver have more than one resource |
53 | * of each type, the lower 32 bits are different. | ||
53 | */ | 54 | */ |
54 | if (!entry->map || | 55 | if (!entry->map || |
55 | map->type != entry->map->type || | 56 | map->type != entry->map->type || |
@@ -59,9 +60,12 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev, | |||
59 | case _DRM_SHM: | 60 | case _DRM_SHM: |
60 | if (map->flags != _DRM_CONTAINS_LOCK) | 61 | if (map->flags != _DRM_CONTAINS_LOCK) |
61 | break; | 62 | break; |
63 | return entry; | ||
62 | case _DRM_REGISTERS: | 64 | case _DRM_REGISTERS: |
63 | case _DRM_FRAME_BUFFER: | 65 | case _DRM_FRAME_BUFFER: |
64 | return entry; | 66 | if ((entry->map->offset & 0xffffffff) == |
67 | (map->offset & 0xffffffff)) | ||
68 | return entry; | ||
65 | default: /* Make gcc happy */ | 69 | default: /* Make gcc happy */ |
66 | ; | 70 | ; |
67 | } | 71 | } |
@@ -183,9 +187,6 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, | |||
183 | return -EINVAL; | 187 | return -EINVAL; |
184 | } | 188 | } |
185 | #endif | 189 | #endif |
186 | #ifdef __alpha__ | ||
187 | map->offset += dev->hose->mem_space->start; | ||
188 | #endif | ||
189 | /* Some drivers preinitialize some maps, without the X Server | 190 | /* Some drivers preinitialize some maps, without the X Server |
190 | * needing to be aware of it. Therefore, we just return success | 191 | * needing to be aware of it. Therefore, we just return success |
191 | * when the server tries to create a duplicate map. | 192 | * when the server tries to create a duplicate map. |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 872747c5a544..21058e6ad2b8 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -1113,7 +1113,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, | |||
1113 | if (card_res->count_fbs >= fb_count) { | 1113 | if (card_res->count_fbs >= fb_count) { |
1114 | copied = 0; | 1114 | copied = 0; |
1115 | fb_id = (uint32_t __user *)(unsigned long)card_res->fb_id_ptr; | 1115 | fb_id = (uint32_t __user *)(unsigned long)card_res->fb_id_ptr; |
1116 | list_for_each_entry(fb, &file_priv->fbs, head) { | 1116 | list_for_each_entry(fb, &file_priv->fbs, filp_head) { |
1117 | if (put_user(fb->base.id, fb_id + copied)) { | 1117 | if (put_user(fb->base.id, fb_id + copied)) { |
1118 | ret = -EFAULT; | 1118 | ret = -EFAULT; |
1119 | goto out; | 1119 | goto out; |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 0a9357c66ff8..09292193dafe 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -184,9 +184,9 @@ drm_edid_block_valid(u8 *raw_edid) | |||
184 | 184 | ||
185 | bad: | 185 | bad: |
186 | if (raw_edid) { | 186 | if (raw_edid) { |
187 | DRM_ERROR("Raw EDID:\n"); | 187 | printk(KERN_ERR "Raw EDID:\n"); |
188 | print_hex_dump_bytes(KERN_ERR, DUMP_PREFIX_NONE, raw_edid, EDID_LENGTH); | 188 | print_hex_dump_bytes(KERN_ERR, DUMP_PREFIX_NONE, raw_edid, EDID_LENGTH); |
189 | printk("\n"); | 189 | printk(KERN_ERR "\n"); |
190 | } | 190 | } |
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
@@ -258,6 +258,17 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, | |||
258 | return ret == 2 ? 0 : -1; | 258 | return ret == 2 ? 0 : -1; |
259 | } | 259 | } |
260 | 260 | ||
261 | static bool drm_edid_is_zero(u8 *in_edid, int length) | ||
262 | { | ||
263 | int i; | ||
264 | u32 *raw_edid = (u32 *)in_edid; | ||
265 | |||
266 | for (i = 0; i < length / 4; i++) | ||
267 | if (*(raw_edid + i) != 0) | ||
268 | return false; | ||
269 | return true; | ||
270 | } | ||
271 | |||
261 | static u8 * | 272 | static u8 * |
262 | drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) | 273 | drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) |
263 | { | 274 | { |
@@ -273,6 +284,10 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) | |||
273 | goto out; | 284 | goto out; |
274 | if (drm_edid_block_valid(block)) | 285 | if (drm_edid_block_valid(block)) |
275 | break; | 286 | break; |
287 | if (i == 0 && drm_edid_is_zero(block, EDID_LENGTH)) { | ||
288 | connector->null_edid_counter++; | ||
289 | goto carp; | ||
290 | } | ||
276 | } | 291 | } |
277 | if (i == 4) | 292 | if (i == 4) |
278 | goto carp; | 293 | goto carp; |
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index d61d185cf040..4a058c7af6c0 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -28,6 +28,7 @@ | |||
28 | * IN THE SOFTWARE. | 28 | * IN THE SOFTWARE. |
29 | */ | 29 | */ |
30 | #include <linux/compat.h> | 30 | #include <linux/compat.h> |
31 | #include <linux/ratelimit.h> | ||
31 | 32 | ||
32 | #include "drmP.h" | 33 | #include "drmP.h" |
33 | #include "drm_core.h" | 34 | #include "drm_core.h" |
@@ -253,10 +254,10 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd, | |||
253 | return -EFAULT; | 254 | return -EFAULT; |
254 | 255 | ||
255 | m32.handle = (unsigned long)handle; | 256 | m32.handle = (unsigned long)handle; |
256 | if (m32.handle != (unsigned long)handle && printk_ratelimit()) | 257 | if (m32.handle != (unsigned long)handle) |
257 | printk(KERN_ERR "compat_drm_addmap truncated handle" | 258 | printk_ratelimited(KERN_ERR "compat_drm_addmap truncated handle" |
258 | " %p for type %d offset %x\n", | 259 | " %p for type %d offset %x\n", |
259 | handle, m32.type, m32.offset); | 260 | handle, m32.type, m32.offset); |
260 | 261 | ||
261 | if (copy_to_user(argp, &m32, sizeof(m32))) | 262 | if (copy_to_user(argp, &m32, sizeof(m32))) |
262 | return -EFAULT; | 263 | return -EFAULT; |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index e1aee4f6a7c6..b6a19cb07caf 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -251,7 +251,7 @@ err: | |||
251 | } | 251 | } |
252 | 252 | ||
253 | 253 | ||
254 | int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) | 254 | static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) |
255 | { | 255 | { |
256 | if ((p->busnum >> 8) != drm_get_pci_domain(dev) || | 256 | if ((p->busnum >> 8) != drm_get_pci_domain(dev) || |
257 | (p->busnum & 0xff) != dev->pdev->bus->number || | 257 | (p->busnum & 0xff) != dev->pdev->bus->number || |
@@ -292,6 +292,7 @@ static struct drm_bus drm_pci_bus = { | |||
292 | .get_name = drm_pci_get_name, | 292 | .get_name = drm_pci_get_name, |
293 | .set_busid = drm_pci_set_busid, | 293 | .set_busid = drm_pci_set_busid, |
294 | .set_unique = drm_pci_set_unique, | 294 | .set_unique = drm_pci_set_unique, |
295 | .irq_by_busid = drm_pci_irq_by_busid, | ||
295 | .agp_init = drm_pci_agp_init, | 296 | .agp_init = drm_pci_agp_init, |
296 | }; | 297 | }; |
297 | 298 | ||
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index 2c3fcbdfd8ff..5db96d45fc71 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c | |||
@@ -526,7 +526,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) | |||
526 | static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev) | 526 | static resource_size_t drm_core_get_reg_ofs(struct drm_device *dev) |
527 | { | 527 | { |
528 | #ifdef __alpha__ | 528 | #ifdef __alpha__ |
529 | return dev->hose->dense_mem_base - dev->hose->mem_space->start; | 529 | return dev->hose->dense_mem_base; |
530 | #else | 530 | #else |
531 | return 0; | 531 | return 0; |
532 | #endif | 532 | #endif |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 51c2257b11e6..4d46441cbe2d 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -776,7 +776,7 @@ static int i915_error_state(struct seq_file *m, void *unused) | |||
776 | seq_printf(m, " INSTPM: 0x%08x\n", error->instpm); | 776 | seq_printf(m, " INSTPM: 0x%08x\n", error->instpm); |
777 | seq_printf(m, " seqno: 0x%08x\n", error->seqno); | 777 | seq_printf(m, " seqno: 0x%08x\n", error->seqno); |
778 | 778 | ||
779 | for (i = 0; i < 16; i++) | 779 | for (i = 0; i < dev_priv->num_fence_regs; i++) |
780 | seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]); | 780 | seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]); |
781 | 781 | ||
782 | if (error->active_bo) | 782 | if (error->active_bo) |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ee660355ae68..f63ee162f124 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -716,6 +716,7 @@ typedef struct drm_i915_private { | |||
716 | struct intel_fbdev *fbdev; | 716 | struct intel_fbdev *fbdev; |
717 | 717 | ||
718 | struct drm_property *broadcast_rgb_property; | 718 | struct drm_property *broadcast_rgb_property; |
719 | struct drm_property *force_audio_property; | ||
719 | 720 | ||
720 | atomic_t forcewake_count; | 721 | atomic_t forcewake_count; |
721 | } drm_i915_private_t; | 722 | } drm_i915_private_t; |
@@ -909,13 +910,6 @@ struct drm_i915_file_private { | |||
909 | } mm; | 910 | } mm; |
910 | }; | 911 | }; |
911 | 912 | ||
912 | enum intel_chip_family { | ||
913 | CHIP_I8XX = 0x01, | ||
914 | CHIP_I9XX = 0x02, | ||
915 | CHIP_I915 = 0x04, | ||
916 | CHIP_I965 = 0x08, | ||
917 | }; | ||
918 | |||
919 | #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info) | 913 | #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info) |
920 | 914 | ||
921 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) | 915 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 0b2e167d2bce..94c84d744100 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -354,7 +354,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, | |||
354 | * page_offset = offset within page | 354 | * page_offset = offset within page |
355 | * page_length = bytes to copy for this page | 355 | * page_length = bytes to copy for this page |
356 | */ | 356 | */ |
357 | page_offset = offset & (PAGE_SIZE-1); | 357 | page_offset = offset_in_page(offset); |
358 | page_length = remain; | 358 | page_length = remain; |
359 | if ((page_offset + remain) > PAGE_SIZE) | 359 | if ((page_offset + remain) > PAGE_SIZE) |
360 | page_length = PAGE_SIZE - page_offset; | 360 | page_length = PAGE_SIZE - page_offset; |
@@ -453,9 +453,9 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, | |||
453 | * data_page_offset = offset with data_page_index page. | 453 | * data_page_offset = offset with data_page_index page. |
454 | * page_length = bytes to copy for this page | 454 | * page_length = bytes to copy for this page |
455 | */ | 455 | */ |
456 | shmem_page_offset = offset & ~PAGE_MASK; | 456 | shmem_page_offset = offset_in_page(offset); |
457 | data_page_index = data_ptr / PAGE_SIZE - first_data_page; | 457 | data_page_index = data_ptr / PAGE_SIZE - first_data_page; |
458 | data_page_offset = data_ptr & ~PAGE_MASK; | 458 | data_page_offset = offset_in_page(data_ptr); |
459 | 459 | ||
460 | page_length = remain; | 460 | page_length = remain; |
461 | if ((shmem_page_offset + page_length) > PAGE_SIZE) | 461 | if ((shmem_page_offset + page_length) > PAGE_SIZE) |
@@ -465,8 +465,10 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, | |||
465 | 465 | ||
466 | page = read_cache_page_gfp(mapping, offset >> PAGE_SHIFT, | 466 | page = read_cache_page_gfp(mapping, offset >> PAGE_SHIFT, |
467 | GFP_HIGHUSER | __GFP_RECLAIMABLE); | 467 | GFP_HIGHUSER | __GFP_RECLAIMABLE); |
468 | if (IS_ERR(page)) | 468 | if (IS_ERR(page)) { |
469 | return PTR_ERR(page); | 469 | ret = PTR_ERR(page); |
470 | goto out; | ||
471 | } | ||
470 | 472 | ||
471 | if (do_bit17_swizzling) { | 473 | if (do_bit17_swizzling) { |
472 | slow_shmem_bit17_copy(page, | 474 | slow_shmem_bit17_copy(page, |
@@ -638,8 +640,8 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, | |||
638 | * page_offset = offset within page | 640 | * page_offset = offset within page |
639 | * page_length = bytes to copy for this page | 641 | * page_length = bytes to copy for this page |
640 | */ | 642 | */ |
641 | page_base = (offset & ~(PAGE_SIZE-1)); | 643 | page_base = offset & PAGE_MASK; |
642 | page_offset = offset & (PAGE_SIZE-1); | 644 | page_offset = offset_in_page(offset); |
643 | page_length = remain; | 645 | page_length = remain; |
644 | if ((page_offset + remain) > PAGE_SIZE) | 646 | if ((page_offset + remain) > PAGE_SIZE) |
645 | page_length = PAGE_SIZE - page_offset; | 647 | page_length = PAGE_SIZE - page_offset; |
@@ -650,7 +652,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, | |||
650 | */ | 652 | */ |
651 | if (fast_user_write(dev_priv->mm.gtt_mapping, page_base, | 653 | if (fast_user_write(dev_priv->mm.gtt_mapping, page_base, |
652 | page_offset, user_data, page_length)) | 654 | page_offset, user_data, page_length)) |
653 | |||
654 | return -EFAULT; | 655 | return -EFAULT; |
655 | 656 | ||
656 | remain -= page_length; | 657 | remain -= page_length; |
@@ -730,9 +731,9 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, | |||
730 | * page_length = bytes to copy for this page | 731 | * page_length = bytes to copy for this page |
731 | */ | 732 | */ |
732 | gtt_page_base = offset & PAGE_MASK; | 733 | gtt_page_base = offset & PAGE_MASK; |
733 | gtt_page_offset = offset & ~PAGE_MASK; | 734 | gtt_page_offset = offset_in_page(offset); |
734 | data_page_index = data_ptr / PAGE_SIZE - first_data_page; | 735 | data_page_index = data_ptr / PAGE_SIZE - first_data_page; |
735 | data_page_offset = data_ptr & ~PAGE_MASK; | 736 | data_page_offset = offset_in_page(data_ptr); |
736 | 737 | ||
737 | page_length = remain; | 738 | page_length = remain; |
738 | if ((gtt_page_offset + page_length) > PAGE_SIZE) | 739 | if ((gtt_page_offset + page_length) > PAGE_SIZE) |
@@ -791,7 +792,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, | |||
791 | * page_offset = offset within page | 792 | * page_offset = offset within page |
792 | * page_length = bytes to copy for this page | 793 | * page_length = bytes to copy for this page |
793 | */ | 794 | */ |
794 | page_offset = offset & (PAGE_SIZE-1); | 795 | page_offset = offset_in_page(offset); |
795 | page_length = remain; | 796 | page_length = remain; |
796 | if ((page_offset + remain) > PAGE_SIZE) | 797 | if ((page_offset + remain) > PAGE_SIZE) |
797 | page_length = PAGE_SIZE - page_offset; | 798 | page_length = PAGE_SIZE - page_offset; |
@@ -896,9 +897,9 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, | |||
896 | * data_page_offset = offset with data_page_index page. | 897 | * data_page_offset = offset with data_page_index page. |
897 | * page_length = bytes to copy for this page | 898 | * page_length = bytes to copy for this page |
898 | */ | 899 | */ |
899 | shmem_page_offset = offset & ~PAGE_MASK; | 900 | shmem_page_offset = offset_in_page(offset); |
900 | data_page_index = data_ptr / PAGE_SIZE - first_data_page; | 901 | data_page_index = data_ptr / PAGE_SIZE - first_data_page; |
901 | data_page_offset = data_ptr & ~PAGE_MASK; | 902 | data_page_offset = offset_in_page(data_ptr); |
902 | 903 | ||
903 | page_length = remain; | 904 | page_length = remain; |
904 | if ((shmem_page_offset + page_length) > PAGE_SIZE) | 905 | if ((shmem_page_offset + page_length) > PAGE_SIZE) |
@@ -1450,8 +1451,9 @@ i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj) | |||
1450 | * edge of an even tile row (where tile rows are counted as if the bo is | 1451 | * edge of an even tile row (where tile rows are counted as if the bo is |
1451 | * placed in a fenced gtt region). | 1452 | * placed in a fenced gtt region). |
1452 | */ | 1453 | */ |
1453 | if (IS_GEN2(dev) || | 1454 | if (IS_GEN2(dev)) |
1454 | (obj->tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) | 1455 | tile_height = 16; |
1456 | else if (obj->tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev)) | ||
1455 | tile_height = 32; | 1457 | tile_height = 32; |
1456 | else | 1458 | else |
1457 | tile_height = 8; | 1459 | tile_height = 8; |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index b79619a7b788..9e34a1abeb61 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -517,7 +517,7 @@ irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) | |||
517 | if (de_iir & DE_PIPEA_VBLANK_IVB) | 517 | if (de_iir & DE_PIPEA_VBLANK_IVB) |
518 | drm_handle_vblank(dev, 0); | 518 | drm_handle_vblank(dev, 0); |
519 | 519 | ||
520 | if (de_iir & DE_PIPEB_VBLANK_IVB); | 520 | if (de_iir & DE_PIPEB_VBLANK_IVB) |
521 | drm_handle_vblank(dev, 1); | 521 | drm_handle_vblank(dev, 1); |
522 | 522 | ||
523 | /* check event from PCH */ | 523 | /* check event from PCH */ |
@@ -1740,6 +1740,16 @@ void ironlake_irq_preinstall(struct drm_device *dev) | |||
1740 | INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work); | 1740 | INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work); |
1741 | 1741 | ||
1742 | I915_WRITE(HWSTAM, 0xeffe); | 1742 | I915_WRITE(HWSTAM, 0xeffe); |
1743 | if (IS_GEN6(dev)) { | ||
1744 | /* Workaround stalls observed on Sandy Bridge GPUs by | ||
1745 | * making the blitter command streamer generate a | ||
1746 | * write to the Hardware Status Page for | ||
1747 | * MI_USER_INTERRUPT. This appears to serialize the | ||
1748 | * previous seqno write out before the interrupt | ||
1749 | * happens. | ||
1750 | */ | ||
1751 | I915_WRITE(GEN6_BLITTER_HWSTAM, ~GEN6_BLITTER_USER_INTERRUPT); | ||
1752 | } | ||
1743 | 1753 | ||
1744 | /* XXX hotplug from PCH */ | 1754 | /* XXX hotplug from PCH */ |
1745 | 1755 | ||
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index e93f93cc7e78..0979d8877880 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -288,6 +288,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) | |||
288 | * This may be a DVI-I connector with a shared DDC | 288 | * This may be a DVI-I connector with a shared DDC |
289 | * link between analog and digital outputs, so we | 289 | * link between analog and digital outputs, so we |
290 | * have to check the EDID input spec of the attached device. | 290 | * have to check the EDID input spec of the attached device. |
291 | * | ||
292 | * On the other hand, what should we do if it is a broken EDID? | ||
291 | */ | 293 | */ |
292 | if (edid != NULL) { | 294 | if (edid != NULL) { |
293 | is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; | 295 | is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; |
@@ -298,6 +300,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) | |||
298 | if (!is_digital) { | 300 | if (!is_digital) { |
299 | DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); | 301 | DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); |
300 | return true; | 302 | return true; |
303 | } else { | ||
304 | DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n"); | ||
301 | } | 305 | } |
302 | } | 306 | } |
303 | 307 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f553ddfdc168..81a9059b6a94 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3983,54 +3983,6 @@ static void i830_update_wm(struct drm_device *dev) | |||
3983 | #define ILK_LP0_PLANE_LATENCY 700 | 3983 | #define ILK_LP0_PLANE_LATENCY 700 |
3984 | #define ILK_LP0_CURSOR_LATENCY 1300 | 3984 | #define ILK_LP0_CURSOR_LATENCY 1300 |
3985 | 3985 | ||
3986 | static bool ironlake_compute_wm0(struct drm_device *dev, | ||
3987 | int pipe, | ||
3988 | const struct intel_watermark_params *display, | ||
3989 | int display_latency_ns, | ||
3990 | const struct intel_watermark_params *cursor, | ||
3991 | int cursor_latency_ns, | ||
3992 | int *plane_wm, | ||
3993 | int *cursor_wm) | ||
3994 | { | ||
3995 | struct drm_crtc *crtc; | ||
3996 | int htotal, hdisplay, clock, pixel_size; | ||
3997 | int line_time_us, line_count; | ||
3998 | int entries, tlb_miss; | ||
3999 | |||
4000 | crtc = intel_get_crtc_for_pipe(dev, pipe); | ||
4001 | if (crtc->fb == NULL || !crtc->enabled) | ||
4002 | return false; | ||
4003 | |||
4004 | htotal = crtc->mode.htotal; | ||
4005 | hdisplay = crtc->mode.hdisplay; | ||
4006 | clock = crtc->mode.clock; | ||
4007 | pixel_size = crtc->fb->bits_per_pixel / 8; | ||
4008 | |||
4009 | /* Use the small buffer method to calculate plane watermark */ | ||
4010 | entries = ((clock * pixel_size / 1000) * display_latency_ns) / 1000; | ||
4011 | tlb_miss = display->fifo_size*display->cacheline_size - hdisplay * 8; | ||
4012 | if (tlb_miss > 0) | ||
4013 | entries += tlb_miss; | ||
4014 | entries = DIV_ROUND_UP(entries, display->cacheline_size); | ||
4015 | *plane_wm = entries + display->guard_size; | ||
4016 | if (*plane_wm > (int)display->max_wm) | ||
4017 | *plane_wm = display->max_wm; | ||
4018 | |||
4019 | /* Use the large buffer method to calculate cursor watermark */ | ||
4020 | line_time_us = ((htotal * 1000) / clock); | ||
4021 | line_count = (cursor_latency_ns / line_time_us + 1000) / 1000; | ||
4022 | entries = line_count * 64 * pixel_size; | ||
4023 | tlb_miss = cursor->fifo_size*cursor->cacheline_size - hdisplay * 8; | ||
4024 | if (tlb_miss > 0) | ||
4025 | entries += tlb_miss; | ||
4026 | entries = DIV_ROUND_UP(entries, cursor->cacheline_size); | ||
4027 | *cursor_wm = entries + cursor->guard_size; | ||
4028 | if (*cursor_wm > (int)cursor->max_wm) | ||
4029 | *cursor_wm = (int)cursor->max_wm; | ||
4030 | |||
4031 | return true; | ||
4032 | } | ||
4033 | |||
4034 | /* | 3986 | /* |
4035 | * Check the wm result. | 3987 | * Check the wm result. |
4036 | * | 3988 | * |
@@ -4139,12 +4091,12 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
4139 | unsigned int enabled; | 4091 | unsigned int enabled; |
4140 | 4092 | ||
4141 | enabled = 0; | 4093 | enabled = 0; |
4142 | if (ironlake_compute_wm0(dev, 0, | 4094 | if (g4x_compute_wm0(dev, 0, |
4143 | &ironlake_display_wm_info, | 4095 | &ironlake_display_wm_info, |
4144 | ILK_LP0_PLANE_LATENCY, | 4096 | ILK_LP0_PLANE_LATENCY, |
4145 | &ironlake_cursor_wm_info, | 4097 | &ironlake_cursor_wm_info, |
4146 | ILK_LP0_CURSOR_LATENCY, | 4098 | ILK_LP0_CURSOR_LATENCY, |
4147 | &plane_wm, &cursor_wm)) { | 4099 | &plane_wm, &cursor_wm)) { |
4148 | I915_WRITE(WM0_PIPEA_ILK, | 4100 | I915_WRITE(WM0_PIPEA_ILK, |
4149 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); | 4101 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); |
4150 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" | 4102 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" |
@@ -4153,12 +4105,12 @@ static void ironlake_update_wm(struct drm_device *dev) | |||
4153 | enabled |= 1; | 4105 | enabled |= 1; |
4154 | } | 4106 | } |
4155 | 4107 | ||
4156 | if (ironlake_compute_wm0(dev, 1, | 4108 | if (g4x_compute_wm0(dev, 1, |
4157 | &ironlake_display_wm_info, | 4109 | &ironlake_display_wm_info, |
4158 | ILK_LP0_PLANE_LATENCY, | 4110 | ILK_LP0_PLANE_LATENCY, |
4159 | &ironlake_cursor_wm_info, | 4111 | &ironlake_cursor_wm_info, |
4160 | ILK_LP0_CURSOR_LATENCY, | 4112 | ILK_LP0_CURSOR_LATENCY, |
4161 | &plane_wm, &cursor_wm)) { | 4113 | &plane_wm, &cursor_wm)) { |
4162 | I915_WRITE(WM0_PIPEB_ILK, | 4114 | I915_WRITE(WM0_PIPEB_ILK, |
4163 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); | 4115 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); |
4164 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" | 4116 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" |
@@ -4223,10 +4175,10 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
4223 | unsigned int enabled; | 4175 | unsigned int enabled; |
4224 | 4176 | ||
4225 | enabled = 0; | 4177 | enabled = 0; |
4226 | if (ironlake_compute_wm0(dev, 0, | 4178 | if (g4x_compute_wm0(dev, 0, |
4227 | &sandybridge_display_wm_info, latency, | 4179 | &sandybridge_display_wm_info, latency, |
4228 | &sandybridge_cursor_wm_info, latency, | 4180 | &sandybridge_cursor_wm_info, latency, |
4229 | &plane_wm, &cursor_wm)) { | 4181 | &plane_wm, &cursor_wm)) { |
4230 | I915_WRITE(WM0_PIPEA_ILK, | 4182 | I915_WRITE(WM0_PIPEA_ILK, |
4231 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); | 4183 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); |
4232 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" | 4184 | DRM_DEBUG_KMS("FIFO watermarks For pipe A -" |
@@ -4235,10 +4187,10 @@ static void sandybridge_update_wm(struct drm_device *dev) | |||
4235 | enabled |= 1; | 4187 | enabled |= 1; |
4236 | } | 4188 | } |
4237 | 4189 | ||
4238 | if (ironlake_compute_wm0(dev, 1, | 4190 | if (g4x_compute_wm0(dev, 1, |
4239 | &sandybridge_display_wm_info, latency, | 4191 | &sandybridge_display_wm_info, latency, |
4240 | &sandybridge_cursor_wm_info, latency, | 4192 | &sandybridge_cursor_wm_info, latency, |
4241 | &plane_wm, &cursor_wm)) { | 4193 | &plane_wm, &cursor_wm)) { |
4242 | I915_WRITE(WM0_PIPEB_ILK, | 4194 | I915_WRITE(WM0_PIPEB_ILK, |
4243 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); | 4195 | (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); |
4244 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" | 4196 | DRM_DEBUG_KMS("FIFO watermarks For pipe B -" |
@@ -7675,6 +7627,7 @@ static void intel_init_display(struct drm_device *dev) | |||
7675 | dev_priv->display.update_wm = NULL; | 7627 | dev_priv->display.update_wm = NULL; |
7676 | } else | 7628 | } else |
7677 | dev_priv->display.update_wm = pineview_update_wm; | 7629 | dev_priv->display.update_wm = pineview_update_wm; |
7630 | dev_priv->display.init_clock_gating = gen3_init_clock_gating; | ||
7678 | } else if (IS_G4X(dev)) { | 7631 | } else if (IS_G4X(dev)) { |
7679 | dev_priv->display.update_wm = g4x_update_wm; | 7632 | dev_priv->display.update_wm = g4x_update_wm; |
7680 | dev_priv->display.init_clock_gating = g4x_init_clock_gating; | 7633 | dev_priv->display.init_clock_gating = g4x_init_clock_gating; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a4d80314e7f8..391b55f1cc74 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -59,8 +59,6 @@ struct intel_dp { | |||
59 | bool is_pch_edp; | 59 | bool is_pch_edp; |
60 | uint8_t train_set[4]; | 60 | uint8_t train_set[4]; |
61 | uint8_t link_status[DP_LINK_STATUS_SIZE]; | 61 | uint8_t link_status[DP_LINK_STATUS_SIZE]; |
62 | |||
63 | struct drm_property *force_audio_property; | ||
64 | }; | 62 | }; |
65 | 63 | ||
66 | /** | 64 | /** |
@@ -1702,7 +1700,7 @@ intel_dp_set_property(struct drm_connector *connector, | |||
1702 | if (ret) | 1700 | if (ret) |
1703 | return ret; | 1701 | return ret; |
1704 | 1702 | ||
1705 | if (property == intel_dp->force_audio_property) { | 1703 | if (property == dev_priv->force_audio_property) { |
1706 | int i = val; | 1704 | int i = val; |
1707 | bool has_audio; | 1705 | bool has_audio; |
1708 | 1706 | ||
@@ -1841,16 +1839,7 @@ bool intel_dpd_is_edp(struct drm_device *dev) | |||
1841 | static void | 1839 | static void |
1842 | intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector) | 1840 | intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector) |
1843 | { | 1841 | { |
1844 | struct drm_device *dev = connector->dev; | 1842 | intel_attach_force_audio_property(connector); |
1845 | |||
1846 | intel_dp->force_audio_property = | ||
1847 | drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2); | ||
1848 | if (intel_dp->force_audio_property) { | ||
1849 | intel_dp->force_audio_property->values[0] = -1; | ||
1850 | intel_dp->force_audio_property->values[1] = 1; | ||
1851 | drm_connector_attach_property(connector, intel_dp->force_audio_property, 0); | ||
1852 | } | ||
1853 | |||
1854 | intel_attach_broadcast_rgb_property(connector); | 1843 | intel_attach_broadcast_rgb_property(connector); |
1855 | } | 1844 | } |
1856 | 1845 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 831d7a4a0d18..9ffa61eb4d7e 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -236,6 +236,7 @@ struct intel_unpin_work { | |||
236 | int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); | 236 | int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); |
237 | extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus); | 237 | extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus); |
238 | 238 | ||
239 | extern void intel_attach_force_audio_property(struct drm_connector *connector); | ||
239 | extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector); | 240 | extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector); |
240 | 241 | ||
241 | extern void intel_crt_init(struct drm_device *dev); | 242 | extern void intel_crt_init(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f289b8642976..aa0a8e83142e 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -45,7 +45,6 @@ struct intel_hdmi { | |||
45 | bool has_hdmi_sink; | 45 | bool has_hdmi_sink; |
46 | bool has_audio; | 46 | bool has_audio; |
47 | int force_audio; | 47 | int force_audio; |
48 | struct drm_property *force_audio_property; | ||
49 | }; | 48 | }; |
50 | 49 | ||
51 | static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) | 50 | static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) |
@@ -194,7 +193,7 @@ static int intel_hdmi_mode_valid(struct drm_connector *connector, | |||
194 | if (mode->clock > 165000) | 193 | if (mode->clock > 165000) |
195 | return MODE_CLOCK_HIGH; | 194 | return MODE_CLOCK_HIGH; |
196 | if (mode->clock < 20000) | 195 | if (mode->clock < 20000) |
197 | return MODE_CLOCK_HIGH; | 196 | return MODE_CLOCK_LOW; |
198 | 197 | ||
199 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) | 198 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) |
200 | return MODE_NO_DBLESCAN; | 199 | return MODE_NO_DBLESCAN; |
@@ -287,7 +286,7 @@ intel_hdmi_set_property(struct drm_connector *connector, | |||
287 | if (ret) | 286 | if (ret) |
288 | return ret; | 287 | return ret; |
289 | 288 | ||
290 | if (property == intel_hdmi->force_audio_property) { | 289 | if (property == dev_priv->force_audio_property) { |
291 | int i = val; | 290 | int i = val; |
292 | bool has_audio; | 291 | bool has_audio; |
293 | 292 | ||
@@ -365,16 +364,7 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { | |||
365 | static void | 364 | static void |
366 | intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector) | 365 | intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector) |
367 | { | 366 | { |
368 | struct drm_device *dev = connector->dev; | 367 | intel_attach_force_audio_property(connector); |
369 | |||
370 | intel_hdmi->force_audio_property = | ||
371 | drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2); | ||
372 | if (intel_hdmi->force_audio_property) { | ||
373 | intel_hdmi->force_audio_property->values[0] = -1; | ||
374 | intel_hdmi->force_audio_property->values[1] = 1; | ||
375 | drm_connector_attach_property(connector, intel_hdmi->force_audio_property, 0); | ||
376 | } | ||
377 | |||
378 | intel_attach_broadcast_rgb_property(connector); | 368 | intel_attach_broadcast_rgb_property(connector); |
379 | } | 369 | } |
380 | 370 | ||
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index d3b903bce7c5..d98cee60b602 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -401,8 +401,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
401 | bus->reg0 = i | GMBUS_RATE_100KHZ; | 401 | bus->reg0 = i | GMBUS_RATE_100KHZ; |
402 | 402 | ||
403 | /* XXX force bit banging until GMBUS is fully debugged */ | 403 | /* XXX force bit banging until GMBUS is fully debugged */ |
404 | if (IS_GEN2(dev)) | 404 | bus->force_bit = intel_gpio_create(dev_priv, i); |
405 | bus->force_bit = intel_gpio_create(dev_priv, i); | ||
406 | } | 405 | } |
407 | 406 | ||
408 | intel_i2c_reset(dev_priv->dev); | 407 | intel_i2c_reset(dev_priv->dev); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 67cb076d271b..b28f7bd9f88a 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -727,6 +727,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
727 | DMI_MATCH(DMI_PRODUCT_NAME, "U800"), | 727 | DMI_MATCH(DMI_PRODUCT_NAME, "U800"), |
728 | }, | 728 | }, |
729 | }, | 729 | }, |
730 | { | ||
731 | .callback = intel_no_lvds_dmi_callback, | ||
732 | .ident = "Asus EeeBox PC EB1007", | ||
733 | .matches = { | ||
734 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."), | ||
735 | DMI_MATCH(DMI_PRODUCT_NAME, "EB1007"), | ||
736 | }, | ||
737 | }, | ||
730 | 738 | ||
731 | { } /* terminating entry */ | 739 | { } /* terminating entry */ |
732 | }; | 740 | }; |
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c index 9034dd8f33c7..3b26a3ba02dd 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c | |||
@@ -81,6 +81,36 @@ int intel_ddc_get_modes(struct drm_connector *connector, | |||
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | 83 | ||
84 | static const char *force_audio_names[] = { | ||
85 | "off", | ||
86 | "auto", | ||
87 | "on", | ||
88 | }; | ||
89 | |||
90 | void | ||
91 | intel_attach_force_audio_property(struct drm_connector *connector) | ||
92 | { | ||
93 | struct drm_device *dev = connector->dev; | ||
94 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
95 | struct drm_property *prop; | ||
96 | int i; | ||
97 | |||
98 | prop = dev_priv->force_audio_property; | ||
99 | if (prop == NULL) { | ||
100 | prop = drm_property_create(dev, DRM_MODE_PROP_ENUM, | ||
101 | "audio", | ||
102 | ARRAY_SIZE(force_audio_names)); | ||
103 | if (prop == NULL) | ||
104 | return; | ||
105 | |||
106 | for (i = 0; i < ARRAY_SIZE(force_audio_names); i++) | ||
107 | drm_property_add_enum(prop, i, i-1, force_audio_names[i]); | ||
108 | |||
109 | dev_priv->force_audio_property = prop; | ||
110 | } | ||
111 | drm_connector_attach_property(connector, prop, 0); | ||
112 | } | ||
113 | |||
84 | static const char *broadcast_rgb_names[] = { | 114 | static const char *broadcast_rgb_names[] = { |
85 | "Full", | 115 | "Full", |
86 | "Limited 16:235", | 116 | "Limited 16:235", |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 754086f83941..30fe554d8936 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -148,8 +148,6 @@ struct intel_sdvo_connector { | |||
148 | int format_supported_num; | 148 | int format_supported_num; |
149 | struct drm_property *tv_format; | 149 | struct drm_property *tv_format; |
150 | 150 | ||
151 | struct drm_property *force_audio_property; | ||
152 | |||
153 | /* add the property for the SDVO-TV */ | 151 | /* add the property for the SDVO-TV */ |
154 | struct drm_property *left; | 152 | struct drm_property *left; |
155 | struct drm_property *right; | 153 | struct drm_property *right; |
@@ -1712,7 +1710,7 @@ intel_sdvo_set_property(struct drm_connector *connector, | |||
1712 | if (ret) | 1710 | if (ret) |
1713 | return ret; | 1711 | return ret; |
1714 | 1712 | ||
1715 | if (property == intel_sdvo_connector->force_audio_property) { | 1713 | if (property == dev_priv->force_audio_property) { |
1716 | int i = val; | 1714 | int i = val; |
1717 | bool has_audio; | 1715 | bool has_audio; |
1718 | 1716 | ||
@@ -2037,15 +2035,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo_connector *connector) | |||
2037 | { | 2035 | { |
2038 | struct drm_device *dev = connector->base.base.dev; | 2036 | struct drm_device *dev = connector->base.base.dev; |
2039 | 2037 | ||
2040 | connector->force_audio_property = | 2038 | intel_attach_force_audio_property(&connector->base.base); |
2041 | drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2); | ||
2042 | if (connector->force_audio_property) { | ||
2043 | connector->force_audio_property->values[0] = -1; | ||
2044 | connector->force_audio_property->values[1] = 1; | ||
2045 | drm_connector_attach_property(&connector->base.base, | ||
2046 | connector->force_audio_property, 0); | ||
2047 | } | ||
2048 | |||
2049 | if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) | 2039 | if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) |
2050 | intel_attach_broadcast_rgb_property(&connector->base.base); | 2040 | intel_attach_broadcast_rgb_property(&connector->base.base); |
2051 | } | 2041 | } |
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h index 1084fa4d261b..54558a01969a 100644 --- a/drivers/gpu/drm/mga/mga_drv.h +++ b/drivers/gpu/drm/mga/mga_drv.h | |||
@@ -195,29 +195,10 @@ extern long mga_compat_ioctl(struct file *filp, unsigned int cmd, | |||
195 | 195 | ||
196 | #define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER() | 196 | #define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER() |
197 | 197 | ||
198 | #if defined(__linux__) && defined(__alpha__) | ||
199 | #define MGA_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) | ||
200 | #define MGA_ADDR(reg) (MGA_BASE(reg) + reg) | ||
201 | |||
202 | #define MGA_DEREF(reg) (*(volatile u32 *)MGA_ADDR(reg)) | ||
203 | #define MGA_DEREF8(reg) (*(volatile u8 *)MGA_ADDR(reg)) | ||
204 | |||
205 | #define MGA_READ(reg) (_MGA_READ((u32 *)MGA_ADDR(reg))) | ||
206 | #define MGA_READ8(reg) (_MGA_READ((u8 *)MGA_ADDR(reg))) | ||
207 | #define MGA_WRITE(reg, val) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF(reg) = val; } while (0) | ||
208 | #define MGA_WRITE8(reg, val) do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF8(reg) = val; } while (0) | ||
209 | |||
210 | static inline u32 _MGA_READ(u32 *addr) | ||
211 | { | ||
212 | DRM_MEMORYBARRIER(); | ||
213 | return *(volatile u32 *)addr; | ||
214 | } | ||
215 | #else | ||
216 | #define MGA_READ8(reg) DRM_READ8(dev_priv->mmio, (reg)) | 198 | #define MGA_READ8(reg) DRM_READ8(dev_priv->mmio, (reg)) |
217 | #define MGA_READ(reg) DRM_READ32(dev_priv->mmio, (reg)) | 199 | #define MGA_READ(reg) DRM_READ32(dev_priv->mmio, (reg)) |
218 | #define MGA_WRITE8(reg, val) DRM_WRITE8(dev_priv->mmio, (reg), (val)) | 200 | #define MGA_WRITE8(reg, val) DRM_WRITE8(dev_priv->mmio, (reg), (val)) |
219 | #define MGA_WRITE(reg, val) DRM_WRITE32(dev_priv->mmio, (reg), (val)) | 201 | #define MGA_WRITE(reg, val) DRM_WRITE32(dev_priv->mmio, (reg), (val)) |
220 | #endif | ||
221 | 202 | ||
222 | #define DWGREG0 0x1c00 | 203 | #define DWGREG0 0x1c00 |
223 | #define DWGREG0_END 0x1dff | 204 | #define DWGREG0_END 0x1dff |
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index f0d459bb46e4..525744d593c1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -262,7 +262,6 @@ static bool nouveau_dsm_detect(void) | |||
262 | vga_count++; | 262 | vga_count++; |
263 | 263 | ||
264 | retval = nouveau_dsm_pci_probe(pdev); | 264 | retval = nouveau_dsm_pci_probe(pdev); |
265 | printk("ret val is %d\n", retval); | ||
266 | if (retval & NOUVEAU_DSM_HAS_MUX) | 265 | if (retval & NOUVEAU_DSM_HAS_MUX) |
267 | has_dsm |= 1; | 266 | has_dsm |= 1; |
268 | if (retval & NOUVEAU_DSM_HAS_OPT) | 267 | if (retval & NOUVEAU_DSM_HAS_OPT) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 4b9f4493c9f9..7347075ca5b8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -339,11 +339,12 @@ semaphore_acquire(struct nouveau_channel *chan, struct nouveau_semaphore *sema) | |||
339 | int ret; | 339 | int ret; |
340 | 340 | ||
341 | if (dev_priv->chipset < 0x84) { | 341 | if (dev_priv->chipset < 0x84) { |
342 | ret = RING_SPACE(chan, 3); | 342 | ret = RING_SPACE(chan, 4); |
343 | if (ret) | 343 | if (ret) |
344 | return ret; | 344 | return ret; |
345 | 345 | ||
346 | BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_OFFSET, 2); | 346 | BEGIN_RING(chan, NvSubSw, NV_SW_DMA_SEMAPHORE, 3); |
347 | OUT_RING (chan, NvSema); | ||
347 | OUT_RING (chan, sema->mem->start); | 348 | OUT_RING (chan, sema->mem->start); |
348 | OUT_RING (chan, 1); | 349 | OUT_RING (chan, 1); |
349 | } else | 350 | } else |
@@ -351,10 +352,12 @@ semaphore_acquire(struct nouveau_channel *chan, struct nouveau_semaphore *sema) | |||
351 | struct nouveau_vma *vma = &dev_priv->fence.bo->vma; | 352 | struct nouveau_vma *vma = &dev_priv->fence.bo->vma; |
352 | u64 offset = vma->offset + sema->mem->start; | 353 | u64 offset = vma->offset + sema->mem->start; |
353 | 354 | ||
354 | ret = RING_SPACE(chan, 5); | 355 | ret = RING_SPACE(chan, 7); |
355 | if (ret) | 356 | if (ret) |
356 | return ret; | 357 | return ret; |
357 | 358 | ||
359 | BEGIN_RING(chan, NvSubSw, NV_SW_DMA_SEMAPHORE, 1); | ||
360 | OUT_RING (chan, chan->vram_handle); | ||
358 | BEGIN_RING(chan, NvSubSw, 0x0010, 4); | 361 | BEGIN_RING(chan, NvSubSw, 0x0010, 4); |
359 | OUT_RING (chan, upper_32_bits(offset)); | 362 | OUT_RING (chan, upper_32_bits(offset)); |
360 | OUT_RING (chan, lower_32_bits(offset)); | 363 | OUT_RING (chan, lower_32_bits(offset)); |
@@ -394,11 +397,12 @@ semaphore_release(struct nouveau_channel *chan, struct nouveau_semaphore *sema) | |||
394 | int ret; | 397 | int ret; |
395 | 398 | ||
396 | if (dev_priv->chipset < 0x84) { | 399 | if (dev_priv->chipset < 0x84) { |
397 | ret = RING_SPACE(chan, 4); | 400 | ret = RING_SPACE(chan, 5); |
398 | if (ret) | 401 | if (ret) |
399 | return ret; | 402 | return ret; |
400 | 403 | ||
401 | BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_OFFSET, 1); | 404 | BEGIN_RING(chan, NvSubSw, NV_SW_DMA_SEMAPHORE, 2); |
405 | OUT_RING (chan, NvSema); | ||
402 | OUT_RING (chan, sema->mem->start); | 406 | OUT_RING (chan, sema->mem->start); |
403 | BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_RELEASE, 1); | 407 | BEGIN_RING(chan, NvSubSw, NV_SW_SEMAPHORE_RELEASE, 1); |
404 | OUT_RING (chan, 1); | 408 | OUT_RING (chan, 1); |
@@ -407,10 +411,12 @@ semaphore_release(struct nouveau_channel *chan, struct nouveau_semaphore *sema) | |||
407 | struct nouveau_vma *vma = &dev_priv->fence.bo->vma; | 411 | struct nouveau_vma *vma = &dev_priv->fence.bo->vma; |
408 | u64 offset = vma->offset + sema->mem->start; | 412 | u64 offset = vma->offset + sema->mem->start; |
409 | 413 | ||
410 | ret = RING_SPACE(chan, 5); | 414 | ret = RING_SPACE(chan, 7); |
411 | if (ret) | 415 | if (ret) |
412 | return ret; | 416 | return ret; |
413 | 417 | ||
418 | BEGIN_RING(chan, NvSubSw, NV_SW_DMA_SEMAPHORE, 1); | ||
419 | OUT_RING (chan, chan->vram_handle); | ||
414 | BEGIN_RING(chan, NvSubSw, 0x0010, 4); | 420 | BEGIN_RING(chan, NvSubSw, 0x0010, 4); |
415 | OUT_RING (chan, upper_32_bits(offset)); | 421 | OUT_RING (chan, upper_32_bits(offset)); |
416 | OUT_RING (chan, lower_32_bits(offset)); | 422 | OUT_RING (chan, lower_32_bits(offset)); |
@@ -504,22 +510,22 @@ nouveau_fence_channel_init(struct nouveau_channel *chan) | |||
504 | struct nouveau_gpuobj *obj = NULL; | 510 | struct nouveau_gpuobj *obj = NULL; |
505 | int ret; | 511 | int ret; |
506 | 512 | ||
507 | if (dev_priv->card_type >= NV_C0) | 513 | if (dev_priv->card_type < NV_C0) { |
508 | goto out_initialised; | 514 | /* Create an NV_SW object for various sync purposes */ |
515 | ret = nouveau_gpuobj_gr_new(chan, NvSw, NV_SW); | ||
516 | if (ret) | ||
517 | return ret; | ||
509 | 518 | ||
510 | /* Create an NV_SW object for various sync purposes */ | 519 | ret = RING_SPACE(chan, 2); |
511 | ret = nouveau_gpuobj_gr_new(chan, NvSw, NV_SW); | 520 | if (ret) |
512 | if (ret) | 521 | return ret; |
513 | return ret; | ||
514 | 522 | ||
515 | /* we leave subchannel empty for nvc0 */ | 523 | BEGIN_RING(chan, NvSubSw, 0, 1); |
516 | ret = RING_SPACE(chan, 2); | 524 | OUT_RING (chan, NvSw); |
517 | if (ret) | 525 | FIRE_RING (chan); |
518 | return ret; | 526 | } |
519 | BEGIN_RING(chan, NvSubSw, 0, 1); | ||
520 | OUT_RING(chan, NvSw); | ||
521 | 527 | ||
522 | /* Create a DMA object for the shared cross-channel sync area. */ | 528 | /* Setup area of memory shared between all channels for x-chan sync */ |
523 | if (USE_SEMA(dev) && dev_priv->chipset < 0x84) { | 529 | if (USE_SEMA(dev) && dev_priv->chipset < 0x84) { |
524 | struct ttm_mem_reg *mem = &dev_priv->fence.bo->bo.mem; | 530 | struct ttm_mem_reg *mem = &dev_priv->fence.bo->bo.mem; |
525 | 531 | ||
@@ -534,23 +540,8 @@ nouveau_fence_channel_init(struct nouveau_channel *chan) | |||
534 | nouveau_gpuobj_ref(NULL, &obj); | 540 | nouveau_gpuobj_ref(NULL, &obj); |
535 | if (ret) | 541 | if (ret) |
536 | return ret; | 542 | return ret; |
537 | |||
538 | ret = RING_SPACE(chan, 2); | ||
539 | if (ret) | ||
540 | return ret; | ||
541 | BEGIN_RING(chan, NvSubSw, NV_SW_DMA_SEMAPHORE, 1); | ||
542 | OUT_RING(chan, NvSema); | ||
543 | } else { | ||
544 | ret = RING_SPACE(chan, 2); | ||
545 | if (ret) | ||
546 | return ret; | ||
547 | BEGIN_RING(chan, NvSubSw, NV_SW_DMA_SEMAPHORE, 1); | ||
548 | OUT_RING (chan, chan->vram_handle); /* whole VM */ | ||
549 | } | 543 | } |
550 | 544 | ||
551 | FIRE_RING(chan); | ||
552 | |||
553 | out_initialised: | ||
554 | INIT_LIST_HEAD(&chan->fence.pending); | 545 | INIT_LIST_HEAD(&chan->fence.pending); |
555 | spin_lock_init(&chan->fence.lock); | 546 | spin_lock_init(&chan->fence.lock); |
556 | atomic_set(&chan->fence.last_sequence_irq, 0); | 547 | atomic_set(&chan->fence.last_sequence_irq, 0); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.c b/drivers/gpu/drm/nouveau/nouveau_hw.c index 053edf9d2f67..ba896e54b799 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hw.c +++ b/drivers/gpu/drm/nouveau/nouveau_hw.c | |||
@@ -900,6 +900,7 @@ nv_save_state_ext(struct drm_device *dev, int head, | |||
900 | } | 900 | } |
901 | /* NV11 and NV20 don't have this, they stop at 0x52. */ | 901 | /* NV11 and NV20 don't have this, they stop at 0x52. */ |
902 | if (nv_gf4_disp_arch(dev)) { | 902 | if (nv_gf4_disp_arch(dev)) { |
903 | rd_cio_state(dev, head, regp, NV_CIO_CRE_42); | ||
903 | rd_cio_state(dev, head, regp, NV_CIO_CRE_53); | 904 | rd_cio_state(dev, head, regp, NV_CIO_CRE_53); |
904 | rd_cio_state(dev, head, regp, NV_CIO_CRE_54); | 905 | rd_cio_state(dev, head, regp, NV_CIO_CRE_54); |
905 | 906 | ||
@@ -1003,6 +1004,7 @@ nv_load_state_ext(struct drm_device *dev, int head, | |||
1003 | nouveau_wait_eq(dev, 650000000, NV_PRMCIO_INP0__COLOR, 0x8, 0x0); | 1004 | nouveau_wait_eq(dev, 650000000, NV_PRMCIO_INP0__COLOR, 0x8, 0x0); |
1004 | } | 1005 | } |
1005 | 1006 | ||
1007 | wr_cio_state(dev, head, regp, NV_CIO_CRE_42); | ||
1006 | wr_cio_state(dev, head, regp, NV_CIO_CRE_53); | 1008 | wr_cio_state(dev, head, regp, NV_CIO_CRE_53); |
1007 | wr_cio_state(dev, head, regp, NV_CIO_CRE_54); | 1009 | wr_cio_state(dev, head, regp, NV_CIO_CRE_54); |
1008 | 1010 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 2960f583dc38..5ee14d216ce8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -397,7 +397,7 @@ nouveau_mem_vram_init(struct drm_device *dev) | |||
397 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(40))) | 397 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(40))) |
398 | dma_bits = 40; | 398 | dma_bits = 40; |
399 | } else | 399 | } else |
400 | if (drm_pci_device_is_pcie(dev) && | 400 | if (0 && drm_pci_device_is_pcie(dev) && |
401 | dev_priv->chipset > 0x40 && | 401 | dev_priv->chipset > 0x40 && |
402 | dev_priv->chipset != 0x45) { | 402 | dev_priv->chipset != 0x45) { |
403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) | 403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) |
@@ -868,7 +868,9 @@ nouveau_gart_manager_del(struct ttm_mem_type_manager *man, | |||
868 | nouveau_vm_unmap(&node->tmp_vma); | 868 | nouveau_vm_unmap(&node->tmp_vma); |
869 | nouveau_vm_put(&node->tmp_vma); | 869 | nouveau_vm_put(&node->tmp_vma); |
870 | } | 870 | } |
871 | |||
871 | mem->mm_node = NULL; | 872 | mem->mm_node = NULL; |
873 | kfree(node); | ||
872 | } | 874 | } |
873 | 875 | ||
874 | static int | 876 | static int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index 922fb6b664ed..ef9dec0e6f8b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
@@ -182,6 +182,11 @@ nouveau_perf_init(struct drm_device *dev) | |||
182 | entries = perf[2]; | 182 | entries = perf[2]; |
183 | } | 183 | } |
184 | 184 | ||
185 | if (entries > NOUVEAU_PM_MAX_LEVEL) { | ||
186 | NV_DEBUG(dev, "perf table has too many entries - buggy vbios?\n"); | ||
187 | entries = NOUVEAU_PM_MAX_LEVEL; | ||
188 | } | ||
189 | |||
185 | entry = perf + headerlen; | 190 | entry = perf + headerlen; |
186 | for (i = 0; i < entries; i++) { | 191 | for (i = 0; i < entries; i++) { |
187 | struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl]; | 192 | struct nouveau_pm_level *perflvl = &pm->perflvl[pm->nr_perflvl]; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index c77111eca6ac..82fad914e648 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
@@ -458,7 +458,7 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
458 | dev_priv->gart_info.type = NOUVEAU_GART_HW; | 458 | dev_priv->gart_info.type = NOUVEAU_GART_HW; |
459 | dev_priv->gart_info.func = &nv50_sgdma_backend; | 459 | dev_priv->gart_info.func = &nv50_sgdma_backend; |
460 | } else | 460 | } else |
461 | if (drm_pci_device_is_pcie(dev) && | 461 | if (0 && drm_pci_device_is_pcie(dev) && |
462 | dev_priv->chipset > 0x40 && dev_priv->chipset != 0x45) { | 462 | dev_priv->chipset > 0x40 && dev_priv->chipset != 0x45) { |
463 | if (nv44_graph_class(dev)) { | 463 | if (nv44_graph_class(dev)) { |
464 | dev_priv->gart_info.func = &nv44_sgdma_backend; | 464 | dev_priv->gart_info.func = &nv44_sgdma_backend; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 38ea662568c1..144f79a350ae 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -371,6 +371,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
371 | engine->vram.flags_valid = nv50_vram_flags_valid; | 371 | engine->vram.flags_valid = nv50_vram_flags_valid; |
372 | break; | 372 | break; |
373 | case 0xC0: | 373 | case 0xC0: |
374 | case 0xD0: | ||
374 | engine->instmem.init = nvc0_instmem_init; | 375 | engine->instmem.init = nvc0_instmem_init; |
375 | engine->instmem.takedown = nvc0_instmem_takedown; | 376 | engine->instmem.takedown = nvc0_instmem_takedown; |
376 | engine->instmem.suspend = nvc0_instmem_suspend; | 377 | engine->instmem.suspend = nvc0_instmem_suspend; |
@@ -563,68 +564,68 @@ nouveau_card_init(struct drm_device *dev) | |||
563 | if (ret) | 564 | if (ret) |
564 | goto out_timer; | 565 | goto out_timer; |
565 | 566 | ||
566 | switch (dev_priv->card_type) { | 567 | if (!nouveau_noaccel) { |
567 | case NV_04: | 568 | switch (dev_priv->card_type) { |
568 | nv04_graph_create(dev); | 569 | case NV_04: |
569 | break; | 570 | nv04_graph_create(dev); |
570 | case NV_10: | 571 | break; |
571 | nv10_graph_create(dev); | 572 | case NV_10: |
572 | break; | 573 | nv10_graph_create(dev); |
573 | case NV_20: | 574 | break; |
574 | case NV_30: | 575 | case NV_20: |
575 | nv20_graph_create(dev); | 576 | case NV_30: |
576 | break; | 577 | nv20_graph_create(dev); |
577 | case NV_40: | 578 | break; |
578 | nv40_graph_create(dev); | 579 | case NV_40: |
579 | break; | 580 | nv40_graph_create(dev); |
580 | case NV_50: | 581 | break; |
581 | nv50_graph_create(dev); | 582 | case NV_50: |
582 | break; | 583 | nv50_graph_create(dev); |
583 | case NV_C0: | 584 | break; |
584 | nvc0_graph_create(dev); | 585 | case NV_C0: |
585 | break; | 586 | nvc0_graph_create(dev); |
586 | default: | 587 | break; |
587 | break; | 588 | default: |
588 | } | 589 | break; |
589 | 590 | } | |
590 | switch (dev_priv->chipset) { | ||
591 | case 0x84: | ||
592 | case 0x86: | ||
593 | case 0x92: | ||
594 | case 0x94: | ||
595 | case 0x96: | ||
596 | case 0xa0: | ||
597 | nv84_crypt_create(dev); | ||
598 | break; | ||
599 | } | ||
600 | 591 | ||
601 | switch (dev_priv->card_type) { | ||
602 | case NV_50: | ||
603 | switch (dev_priv->chipset) { | 592 | switch (dev_priv->chipset) { |
604 | case 0xa3: | 593 | case 0x84: |
605 | case 0xa5: | 594 | case 0x86: |
606 | case 0xa8: | 595 | case 0x92: |
607 | case 0xaf: | 596 | case 0x94: |
608 | nva3_copy_create(dev); | 597 | case 0x96: |
598 | case 0xa0: | ||
599 | nv84_crypt_create(dev); | ||
609 | break; | 600 | break; |
610 | } | 601 | } |
611 | break; | ||
612 | case NV_C0: | ||
613 | nvc0_copy_create(dev, 0); | ||
614 | nvc0_copy_create(dev, 1); | ||
615 | break; | ||
616 | default: | ||
617 | break; | ||
618 | } | ||
619 | 602 | ||
620 | if (dev_priv->card_type == NV_40) | 603 | switch (dev_priv->card_type) { |
621 | nv40_mpeg_create(dev); | 604 | case NV_50: |
622 | else | 605 | switch (dev_priv->chipset) { |
623 | if (dev_priv->card_type == NV_50 && | 606 | case 0xa3: |
624 | (dev_priv->chipset < 0x98 || dev_priv->chipset == 0xa0)) | 607 | case 0xa5: |
625 | nv50_mpeg_create(dev); | 608 | case 0xa8: |
609 | case 0xaf: | ||
610 | nva3_copy_create(dev); | ||
611 | break; | ||
612 | } | ||
613 | break; | ||
614 | case NV_C0: | ||
615 | nvc0_copy_create(dev, 0); | ||
616 | nvc0_copy_create(dev, 1); | ||
617 | break; | ||
618 | default: | ||
619 | break; | ||
620 | } | ||
621 | |||
622 | if (dev_priv->card_type == NV_40) | ||
623 | nv40_mpeg_create(dev); | ||
624 | else | ||
625 | if (dev_priv->card_type == NV_50 && | ||
626 | (dev_priv->chipset < 0x98 || dev_priv->chipset == 0xa0)) | ||
627 | nv50_mpeg_create(dev); | ||
626 | 628 | ||
627 | if (!nouveau_noaccel) { | ||
628 | for (e = 0; e < NVOBJ_ENGINE_NR; e++) { | 629 | for (e = 0; e < NVOBJ_ENGINE_NR; e++) { |
629 | if (dev_priv->eng[e]) { | 630 | if (dev_priv->eng[e]) { |
630 | ret = dev_priv->eng[e]->init(dev, e); | 631 | ret = dev_priv->eng[e]->init(dev, e); |
@@ -880,8 +881,8 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
880 | 881 | ||
881 | #ifdef __BIG_ENDIAN | 882 | #ifdef __BIG_ENDIAN |
882 | /* Put the card in BE mode if it's not */ | 883 | /* Put the card in BE mode if it's not */ |
883 | if (nv_rd32(dev, NV03_PMC_BOOT_1)) | 884 | if (nv_rd32(dev, NV03_PMC_BOOT_1) != 0x01000001) |
884 | nv_wr32(dev, NV03_PMC_BOOT_1, 0x00000001); | 885 | nv_wr32(dev, NV03_PMC_BOOT_1, 0x01000001); |
885 | 886 | ||
886 | DRM_MEMORYBARRIER(); | 887 | DRM_MEMORYBARRIER(); |
887 | #endif | 888 | #endif |
@@ -922,6 +923,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
922 | dev_priv->card_type = NV_50; | 923 | dev_priv->card_type = NV_50; |
923 | break; | 924 | break; |
924 | case 0xc0: | 925 | case 0xc0: |
926 | case 0xd0: | ||
925 | dev_priv->card_type = NV_C0; | 927 | dev_priv->card_type = NV_C0; |
926 | break; | 928 | break; |
927 | default: | 929 | default: |
diff --git a/drivers/gpu/drm/nouveau/nouveau_vm.c b/drivers/gpu/drm/nouveau/nouveau_vm.c index 0059e6f58a8b..519a6b4bba46 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vm.c +++ b/drivers/gpu/drm/nouveau/nouveau_vm.c | |||
@@ -58,6 +58,7 @@ nouveau_vm_map_at(struct nouveau_vma *vma, u64 delta, struct nouveau_mem *node) | |||
58 | num -= len; | 58 | num -= len; |
59 | pte += len; | 59 | pte += len; |
60 | if (unlikely(end >= max)) { | 60 | if (unlikely(end >= max)) { |
61 | phys += len << (bits + 12); | ||
61 | pde++; | 62 | pde++; |
62 | pte = 0; | 63 | pte = 0; |
63 | } | 64 | } |
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index 3c78bc81357e..f1a3ae491995 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
@@ -376,7 +376,10 @@ nv_crtc_mode_set_vga(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
376 | */ | 376 | */ |
377 | 377 | ||
378 | /* framebuffer can be larger than crtc scanout area. */ | 378 | /* framebuffer can be larger than crtc scanout area. */ |
379 | regp->CRTC[NV_CIO_CRE_RPC0_INDEX] = XLATE(fb->pitch / 8, 8, NV_CIO_CRE_RPC0_OFFSET_10_8); | 379 | regp->CRTC[NV_CIO_CRE_RPC0_INDEX] = |
380 | XLATE(fb->pitch / 8, 8, NV_CIO_CRE_RPC0_OFFSET_10_8); | ||
381 | regp->CRTC[NV_CIO_CRE_42] = | ||
382 | XLATE(fb->pitch / 8, 11, NV_CIO_CRE_42_OFFSET_11); | ||
380 | regp->CRTC[NV_CIO_CRE_RPC1_INDEX] = mode->crtc_hdisplay < 1280 ? | 383 | regp->CRTC[NV_CIO_CRE_RPC1_INDEX] = mode->crtc_hdisplay < 1280 ? |
381 | MASK(NV_CIO_CRE_RPC1_LARGE) : 0x00; | 384 | MASK(NV_CIO_CRE_RPC1_LARGE) : 0x00; |
382 | regp->CRTC[NV_CIO_CRE_LSR_INDEX] = XLATE(horizBlankEnd, 6, NV_CIO_CRE_LSR_HBE_6) | | 385 | regp->CRTC[NV_CIO_CRE_LSR_INDEX] = XLATE(horizBlankEnd, 6, NV_CIO_CRE_LSR_HBE_6) | |
@@ -824,8 +827,11 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
824 | regp->CRTC[NV_CIO_CR_OFFSET_INDEX] = drm_fb->pitch >> 3; | 827 | regp->CRTC[NV_CIO_CR_OFFSET_INDEX] = drm_fb->pitch >> 3; |
825 | regp->CRTC[NV_CIO_CRE_RPC0_INDEX] = | 828 | regp->CRTC[NV_CIO_CRE_RPC0_INDEX] = |
826 | XLATE(drm_fb->pitch >> 3, 8, NV_CIO_CRE_RPC0_OFFSET_10_8); | 829 | XLATE(drm_fb->pitch >> 3, 8, NV_CIO_CRE_RPC0_OFFSET_10_8); |
830 | regp->CRTC[NV_CIO_CRE_42] = | ||
831 | XLATE(drm_fb->pitch / 8, 11, NV_CIO_CRE_42_OFFSET_11); | ||
827 | crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_RPC0_INDEX); | 832 | crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_RPC0_INDEX); |
828 | crtc_wr_cio_state(crtc, regp, NV_CIO_CR_OFFSET_INDEX); | 833 | crtc_wr_cio_state(crtc, regp, NV_CIO_CR_OFFSET_INDEX); |
834 | crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_42); | ||
829 | 835 | ||
830 | /* Update the framebuffer location. */ | 836 | /* Update the framebuffer location. */ |
831 | regp->fb_start = nv_crtc->fb.offset & ~3; | 837 | regp->fb_start = nv_crtc->fb.offset & ~3; |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 74a3f6872701..08da478ba544 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -409,7 +409,7 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
409 | struct nouveau_channel *evo = dispc->sync; | 409 | struct nouveau_channel *evo = dispc->sync; |
410 | int ret; | 410 | int ret; |
411 | 411 | ||
412 | ret = RING_SPACE(evo, 24); | 412 | ret = RING_SPACE(evo, chan ? 25 : 27); |
413 | if (unlikely(ret)) | 413 | if (unlikely(ret)) |
414 | return ret; | 414 | return ret; |
415 | 415 | ||
@@ -458,8 +458,19 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
458 | /* queue the flip on the crtc's "display sync" channel */ | 458 | /* queue the flip on the crtc's "display sync" channel */ |
459 | BEGIN_RING(evo, 0, 0x0100, 1); | 459 | BEGIN_RING(evo, 0, 0x0100, 1); |
460 | OUT_RING (evo, 0xfffe0000); | 460 | OUT_RING (evo, 0xfffe0000); |
461 | BEGIN_RING(evo, 0, 0x0084, 5); | 461 | if (chan) { |
462 | OUT_RING (evo, chan ? 0x00000100 : 0x00000010); | 462 | BEGIN_RING(evo, 0, 0x0084, 1); |
463 | OUT_RING (evo, 0x00000100); | ||
464 | } else { | ||
465 | BEGIN_RING(evo, 0, 0x0084, 1); | ||
466 | OUT_RING (evo, 0x00000010); | ||
467 | /* allows gamma somehow, PDISP will bitch at you if | ||
468 | * you don't wait for vblank before changing this.. | ||
469 | */ | ||
470 | BEGIN_RING(evo, 0, 0x00e0, 1); | ||
471 | OUT_RING (evo, 0x40000000); | ||
472 | } | ||
473 | BEGIN_RING(evo, 0, 0x0088, 4); | ||
463 | OUT_RING (evo, dispc->sem.offset); | 474 | OUT_RING (evo, dispc->sem.offset); |
464 | OUT_RING (evo, 0xf00d0000 | dispc->sem.value); | 475 | OUT_RING (evo, 0xf00d0000 | dispc->sem.value); |
465 | OUT_RING (evo, 0x74b1e000); | 476 | OUT_RING (evo, 0x74b1e000); |
diff --git a/drivers/gpu/drm/nouveau/nvreg.h b/drivers/gpu/drm/nouveau/nvreg.h index fe0f253089ac..bbfb1a68fb11 100644 --- a/drivers/gpu/drm/nouveau/nvreg.h +++ b/drivers/gpu/drm/nouveau/nvreg.h | |||
@@ -277,6 +277,8 @@ | |||
277 | # define NV_CIO_CRE_EBR_VDE_11 2:2 | 277 | # define NV_CIO_CRE_EBR_VDE_11 2:2 |
278 | # define NV_CIO_CRE_EBR_VRS_11 4:4 | 278 | # define NV_CIO_CRE_EBR_VRS_11 4:4 |
279 | # define NV_CIO_CRE_EBR_VBS_11 6:6 | 279 | # define NV_CIO_CRE_EBR_VBS_11 6:6 |
280 | # define NV_CIO_CRE_42 0x42 | ||
281 | # define NV_CIO_CRE_42_OFFSET_11 6:6 | ||
280 | # define NV_CIO_CRE_43 0x43 | 282 | # define NV_CIO_CRE_43 0x43 |
281 | # define NV_CIO_CRE_44 0x44 /* head control */ | 283 | # define NV_CIO_CRE_44 0x44 /* head control */ |
282 | # define NV_CIO_CRE_CSB 0x45 /* colour saturation boost */ | 284 | # define NV_CIO_CRE_CSB 0x45 /* colour saturation boost */ |
diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig index 9746fee59f56..ea92bbe3ed37 100644 --- a/drivers/gpu/drm/radeon/Kconfig +++ b/drivers/gpu/drm/radeon/Kconfig | |||
@@ -28,11 +28,4 @@ config DRM_RADEON_KMS | |||
28 | The kernel will also perform security check on command stream | 28 | The kernel will also perform security check on command stream |
29 | provided by the user, we want to catch and forbid any illegal use | 29 | provided by the user, we want to catch and forbid any illegal use |
30 | of the GPU such as DMA into random system memory or into memory | 30 | of the GPU such as DMA into random system memory or into memory |
31 | not owned by the process supplying the command stream. This part | 31 | not owned by the process supplying the command stream. |
32 | of the code is still incomplete and this why we propose that patch | ||
33 | as a staging driver addition, future security might forbid current | ||
34 | experimental userspace to run. | ||
35 | |||
36 | This code support the following hardware : R1XX,R2XX,R3XX,R4XX,R5XX | ||
37 | (radeon up to X1950). Works is underway to provide support for R6XX, | ||
38 | R7XX and newer hardware (radeon from HD2XXX to HD4XXX). | ||
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h index 49611e2365d9..1b50ad8919d5 100644 --- a/drivers/gpu/drm/radeon/atombios.h +++ b/drivers/gpu/drm/radeon/atombios.h | |||
@@ -1200,6 +1200,7 @@ typedef struct _EXTERNAL_ENCODER_CONTROL_PARAMETERS_V3 | |||
1200 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING_OFF 0x10 | 1200 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING_OFF 0x10 |
1201 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING 0x11 | 1201 | #define EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING 0x11 |
1202 | #define EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION 0x12 | 1202 | #define EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION 0x12 |
1203 | #define EXTERNAL_ENCODER_ACTION_V3_DDC_SETUP 0x14 | ||
1203 | 1204 | ||
1204 | // ucConfig | 1205 | // ucConfig |
1205 | #define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_MASK 0x03 | 1206 | #define EXTERNAL_ENCODER_CONFIG_V3_DPLINKRATE_MASK 0x03 |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index ec848787d7d9..9541995e4b21 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -671,6 +671,13 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
671 | DISPPLL_CONFIG_DUAL_LINK; | 671 | DISPPLL_CONFIG_DUAL_LINK; |
672 | } | 672 | } |
673 | } | 673 | } |
674 | if (radeon_encoder_is_dp_bridge(encoder)) { | ||
675 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
676 | struct radeon_encoder *ext_radeon_encoder = to_radeon_encoder(ext_encoder); | ||
677 | args.v3.sInput.ucExtTransmitterID = ext_radeon_encoder->encoder_id; | ||
678 | } else | ||
679 | args.v3.sInput.ucExtTransmitterID = 0; | ||
680 | |||
674 | atom_execute_table(rdev->mode_info.atom_context, | 681 | atom_execute_table(rdev->mode_info.atom_context, |
675 | index, (uint32_t *)&args); | 682 | index, (uint32_t *)&args); |
676 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; | 683 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; |
@@ -1045,7 +1052,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1045 | uint64_t fb_location; | 1052 | uint64_t fb_location; |
1046 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1053 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1047 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); | 1054 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); |
1048 | u32 tmp; | 1055 | u32 tmp, viewport_w, viewport_h; |
1049 | int r; | 1056 | int r; |
1050 | 1057 | ||
1051 | /* no fb bound */ | 1058 | /* no fb bound */ |
@@ -1171,8 +1178,10 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1171 | y &= ~1; | 1178 | y &= ~1; |
1172 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, | 1179 | WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset, |
1173 | (x << 16) | y); | 1180 | (x << 16) | y); |
1181 | viewport_w = crtc->mode.hdisplay; | ||
1182 | viewport_h = (crtc->mode.vdisplay + 1) & ~1; | ||
1174 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1183 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1175 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1184 | (viewport_w << 16) | viewport_h); |
1176 | 1185 | ||
1177 | /* pageflip setup */ | 1186 | /* pageflip setup */ |
1178 | /* make sure flip is at vb rather than hb */ | 1187 | /* make sure flip is at vb rather than hb */ |
@@ -1213,7 +1222,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1213 | uint64_t fb_location; | 1222 | uint64_t fb_location; |
1214 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1223 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1215 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; | 1224 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; |
1216 | u32 tmp; | 1225 | u32 tmp, viewport_w, viewport_h; |
1217 | int r; | 1226 | int r; |
1218 | 1227 | ||
1219 | /* no fb bound */ | 1228 | /* no fb bound */ |
@@ -1338,8 +1347,10 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1338 | y &= ~1; | 1347 | y &= ~1; |
1339 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, | 1348 | WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset, |
1340 | (x << 16) | y); | 1349 | (x << 16) | y); |
1350 | viewport_w = crtc->mode.hdisplay; | ||
1351 | viewport_h = (crtc->mode.vdisplay + 1) & ~1; | ||
1341 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1352 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1342 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1353 | (viewport_w << 16) | viewport_h); |
1343 | 1354 | ||
1344 | /* pageflip setup */ | 1355 | /* pageflip setup */ |
1345 | /* make sure flip is at vb rather than hb */ | 1356 | /* make sure flip is at vb rather than hb */ |
diff --git a/drivers/gpu/drm/radeon/cayman_blit_shaders.c b/drivers/gpu/drm/radeon/cayman_blit_shaders.c index e148ab04b80b..7b4eeb7b4a8c 100644 --- a/drivers/gpu/drm/radeon/cayman_blit_shaders.c +++ b/drivers/gpu/drm/radeon/cayman_blit_shaders.c | |||
@@ -39,17 +39,335 @@ | |||
39 | 39 | ||
40 | const u32 cayman_default_state[] = | 40 | const u32 cayman_default_state[] = |
41 | { | 41 | { |
42 | /* XXX fill in additional blit state */ | 42 | 0xc0066900, |
43 | 0x00000000, | ||
44 | 0x00000060, /* DB_RENDER_CONTROL */ | ||
45 | 0x00000000, /* DB_COUNT_CONTROL */ | ||
46 | 0x00000000, /* DB_DEPTH_VIEW */ | ||
47 | 0x0000002a, /* DB_RENDER_OVERRIDE */ | ||
48 | 0x00000000, /* DB_RENDER_OVERRIDE2 */ | ||
49 | 0x00000000, /* DB_HTILE_DATA_BASE */ | ||
43 | 50 | ||
44 | 0xc0026900, | 51 | 0xc0026900, |
45 | 0x00000316, | 52 | 0x0000000a, |
46 | 0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | 53 | 0x00000000, /* DB_STENCIL_CLEAR */ |
47 | 0x00000010, /* */ | 54 | 0x00000000, /* DB_DEPTH_CLEAR */ |
55 | |||
56 | 0xc0036900, | ||
57 | 0x0000000f, | ||
58 | 0x00000000, /* DB_DEPTH_INFO */ | ||
59 | 0x00000000, /* DB_Z_INFO */ | ||
60 | 0x00000000, /* DB_STENCIL_INFO */ | ||
61 | |||
62 | 0xc0016900, | ||
63 | 0x00000080, | ||
64 | 0x00000000, /* PA_SC_WINDOW_OFFSET */ | ||
65 | |||
66 | 0xc00d6900, | ||
67 | 0x00000083, | ||
68 | 0x0000ffff, /* PA_SC_CLIPRECT_RULE */ | ||
69 | 0x00000000, /* PA_SC_CLIPRECT_0_TL */ | ||
70 | 0x20002000, /* PA_SC_CLIPRECT_0_BR */ | ||
71 | 0x00000000, | ||
72 | 0x20002000, | ||
73 | 0x00000000, | ||
74 | 0x20002000, | ||
75 | 0x00000000, | ||
76 | 0x20002000, | ||
77 | 0xaaaaaaaa, /* PA_SC_EDGERULE */ | ||
78 | 0x00000000, /* PA_SU_HARDWARE_SCREEN_OFFSET */ | ||
79 | 0x0000000f, /* CB_TARGET_MASK */ | ||
80 | 0x0000000f, /* CB_SHADER_MASK */ | ||
81 | |||
82 | 0xc0226900, | ||
83 | 0x00000094, | ||
84 | 0x80000000, /* PA_SC_VPORT_SCISSOR_0_TL */ | ||
85 | 0x20002000, /* PA_SC_VPORT_SCISSOR_0_BR */ | ||
86 | 0x80000000, | ||
87 | 0x20002000, | ||
88 | 0x80000000, | ||
89 | 0x20002000, | ||
90 | 0x80000000, | ||
91 | 0x20002000, | ||
92 | 0x80000000, | ||
93 | 0x20002000, | ||
94 | 0x80000000, | ||
95 | 0x20002000, | ||
96 | 0x80000000, | ||
97 | 0x20002000, | ||
98 | 0x80000000, | ||
99 | 0x20002000, | ||
100 | 0x80000000, | ||
101 | 0x20002000, | ||
102 | 0x80000000, | ||
103 | 0x20002000, | ||
104 | 0x80000000, | ||
105 | 0x20002000, | ||
106 | 0x80000000, | ||
107 | 0x20002000, | ||
108 | 0x80000000, | ||
109 | 0x20002000, | ||
110 | 0x80000000, | ||
111 | 0x20002000, | ||
112 | 0x80000000, | ||
113 | 0x20002000, | ||
114 | 0x80000000, | ||
115 | 0x20002000, | ||
116 | 0x00000000, /* PA_SC_VPORT_ZMIN_0 */ | ||
117 | 0x3f800000, /* PA_SC_VPORT_ZMAX_0 */ | ||
118 | |||
119 | 0xc0016900, | ||
120 | 0x000000d4, | ||
121 | 0x00000000, /* SX_MISC */ | ||
48 | 122 | ||
49 | 0xc0026900, | 123 | 0xc0026900, |
50 | 0x000000d9, | 124 | 0x000000d9, |
51 | 0x00000000, /* CP_RINGID */ | 125 | 0x00000000, /* CP_RINGID */ |
52 | 0x00000000, /* CP_VMID */ | 126 | 0x00000000, /* CP_VMID */ |
127 | |||
128 | 0xc0096900, | ||
129 | 0x00000100, | ||
130 | 0x00ffffff, /* VGT_MAX_VTX_INDX */ | ||
131 | 0x00000000, /* VGT_MIN_VTX_INDX */ | ||
132 | 0x00000000, /* VGT_INDX_OFFSET */ | ||
133 | 0x00000000, /* VGT_MULTI_PRIM_IB_RESET_INDX */ | ||
134 | 0x00000000, /* SX_ALPHA_TEST_CONTROL */ | ||
135 | 0x00000000, /* CB_BLEND_RED */ | ||
136 | 0x00000000, /* CB_BLEND_GREEN */ | ||
137 | 0x00000000, /* CB_BLEND_BLUE */ | ||
138 | 0x00000000, /* CB_BLEND_ALPHA */ | ||
139 | |||
140 | 0xc0016900, | ||
141 | 0x00000187, | ||
142 | 0x00000100, /* SPI_VS_OUT_ID_0 */ | ||
143 | |||
144 | 0xc0026900, | ||
145 | 0x00000191, | ||
146 | 0x00000100, /* SPI_PS_INPUT_CNTL_0 */ | ||
147 | 0x00000101, /* SPI_PS_INPUT_CNTL_1 */ | ||
148 | |||
149 | 0xc0016900, | ||
150 | 0x000001b1, | ||
151 | 0x00000000, /* SPI_VS_OUT_CONFIG */ | ||
152 | |||
153 | 0xc0106900, | ||
154 | 0x000001b3, | ||
155 | 0x20000001, /* SPI_PS_IN_CONTROL_0 */ | ||
156 | 0x00000000, /* SPI_PS_IN_CONTROL_1 */ | ||
157 | 0x00000000, /* SPI_INTERP_CONTROL_0 */ | ||
158 | 0x00000000, /* SPI_INPUT_Z */ | ||
159 | 0x00000000, /* SPI_FOG_CNTL */ | ||
160 | 0x00100000, /* SPI_BARYC_CNTL */ | ||
161 | 0x00000000, /* SPI_PS_IN_CONTROL_2 */ | ||
162 | 0x00000000, /* SPI_COMPUTE_INPUT_CNTL */ | ||
163 | 0x00000000, /* SPI_COMPUTE_NUM_THREAD_X */ | ||
164 | 0x00000000, /* SPI_COMPUTE_NUM_THREAD_Y */ | ||
165 | 0x00000000, /* SPI_COMPUTE_NUM_THREAD_Z */ | ||
166 | 0x00000000, /* SPI_GPR_MGMT */ | ||
167 | 0x00000000, /* SPI_LDS_MGMT */ | ||
168 | 0x00000000, /* SPI_STACK_MGMT */ | ||
169 | 0x00000000, /* SPI_WAVE_MGMT_1 */ | ||
170 | 0x00000000, /* SPI_WAVE_MGMT_2 */ | ||
171 | |||
172 | 0xc0016900, | ||
173 | 0x000001e0, | ||
174 | 0x00000000, /* CB_BLEND0_CONTROL */ | ||
175 | |||
176 | 0xc00e6900, | ||
177 | 0x00000200, | ||
178 | 0x00000000, /* DB_DEPTH_CONTROL */ | ||
179 | 0x00000000, /* DB_EQAA */ | ||
180 | 0x00cc0010, /* CB_COLOR_CONTROL */ | ||
181 | 0x00000210, /* DB_SHADER_CONTROL */ | ||
182 | 0x00010000, /* PA_CL_CLIP_CNTL */ | ||
183 | 0x00000004, /* PA_SU_SC_MODE_CNTL */ | ||
184 | 0x00000100, /* PA_CL_VTE_CNTL */ | ||
185 | 0x00000000, /* PA_CL_VS_OUT_CNTL */ | ||
186 | 0x00000000, /* PA_CL_NANINF_CNTL */ | ||
187 | 0x00000000, /* PA_SU_LINE_STIPPLE_CNTL */ | ||
188 | 0x00000000, /* PA_SU_LINE_STIPPLE_SCALE */ | ||
189 | 0x00000000, /* PA_SU_PRIM_FILTER_CNTL */ | ||
190 | 0x00000000, /* */ | ||
191 | 0x00000000, /* */ | ||
192 | |||
193 | 0xc0026900, | ||
194 | 0x00000229, | ||
195 | 0x00000000, /* SQ_PGM_START_FS */ | ||
196 | 0x00000000, | ||
197 | |||
198 | 0xc0016900, | ||
199 | 0x0000023b, | ||
200 | 0x00000000, /* SQ_LDS_ALLOC_PS */ | ||
201 | |||
202 | 0xc0066900, | ||
203 | 0x00000240, | ||
204 | 0x00000000, /* SQ_ESGS_RING_ITEMSIZE */ | ||
205 | 0x00000000, | ||
206 | 0x00000000, | ||
207 | 0x00000000, | ||
208 | 0x00000000, | ||
209 | 0x00000000, | ||
210 | |||
211 | 0xc0046900, | ||
212 | 0x00000247, | ||
213 | 0x00000000, /* SQ_GS_VERT_ITEMSIZE */ | ||
214 | 0x00000000, | ||
215 | 0x00000000, | ||
216 | 0x00000000, | ||
217 | |||
218 | 0xc0116900, | ||
219 | 0x00000280, | ||
220 | 0x00000000, /* PA_SU_POINT_SIZE */ | ||
221 | 0x00000000, /* PA_SU_POINT_MINMAX */ | ||
222 | 0x00000008, /* PA_SU_LINE_CNTL */ | ||
223 | 0x00000000, /* PA_SC_LINE_STIPPLE */ | ||
224 | 0x00000000, /* VGT_OUTPUT_PATH_CNTL */ | ||
225 | 0x00000000, /* VGT_HOS_CNTL */ | ||
226 | 0x00000000, | ||
227 | 0x00000000, | ||
228 | 0x00000000, | ||
229 | 0x00000000, | ||
230 | 0x00000000, | ||
231 | 0x00000000, | ||
232 | 0x00000000, | ||
233 | 0x00000000, | ||
234 | 0x00000000, | ||
235 | 0x00000000, | ||
236 | 0x00000000, /* VGT_GS_MODE */ | ||
237 | |||
238 | 0xc0026900, | ||
239 | 0x00000292, | ||
240 | 0x00000000, /* PA_SC_MODE_CNTL_0 */ | ||
241 | 0x00000000, /* PA_SC_MODE_CNTL_1 */ | ||
242 | |||
243 | 0xc0016900, | ||
244 | 0x000002a1, | ||
245 | 0x00000000, /* VGT_PRIMITIVEID_EN */ | ||
246 | |||
247 | 0xc0016900, | ||
248 | 0x000002a5, | ||
249 | 0x00000000, /* VGT_MULTI_PRIM_IB_RESET_EN */ | ||
250 | |||
251 | 0xc0026900, | ||
252 | 0x000002a8, | ||
253 | 0x00000000, /* VGT_INSTANCE_STEP_RATE_0 */ | ||
254 | 0x00000000, | ||
255 | |||
256 | 0xc0026900, | ||
257 | 0x000002ad, | ||
258 | 0x00000000, /* VGT_REUSE_OFF */ | ||
259 | 0x00000000, | ||
260 | |||
261 | 0xc0016900, | ||
262 | 0x000002d5, | ||
263 | 0x00000000, /* VGT_SHADER_STAGES_EN */ | ||
264 | |||
265 | 0xc0016900, | ||
266 | 0x000002dc, | ||
267 | 0x0000aa00, /* DB_ALPHA_TO_MASK */ | ||
268 | |||
269 | 0xc0066900, | ||
270 | 0x000002de, | ||
271 | 0x00000000, /* PA_SU_POLY_OFFSET_DB_FMT_CNTL */ | ||
272 | 0x00000000, | ||
273 | 0x00000000, | ||
274 | 0x00000000, | ||
275 | 0x00000000, | ||
276 | 0x00000000, | ||
277 | |||
278 | 0xc0026900, | ||
279 | 0x000002e5, | ||
280 | 0x00000000, /* VGT_STRMOUT_CONFIG */ | ||
281 | 0x00000000, | ||
282 | |||
283 | 0xc01b6900, | ||
284 | 0x000002f5, | ||
285 | 0x76543210, /* PA_SC_CENTROID_PRIORITY_0 */ | ||
286 | 0xfedcba98, /* PA_SC_CENTROID_PRIORITY_1 */ | ||
287 | 0x00000000, /* PA_SC_LINE_CNTL */ | ||
288 | 0x00000000, /* PA_SC_AA_CONFIG */ | ||
289 | 0x00000005, /* PA_SU_VTX_CNTL */ | ||
290 | 0x3f800000, /* PA_CL_GB_VERT_CLIP_ADJ */ | ||
291 | 0x3f800000, /* PA_CL_GB_VERT_DISC_ADJ */ | ||
292 | 0x3f800000, /* PA_CL_GB_HORZ_CLIP_ADJ */ | ||
293 | 0x3f800000, /* PA_CL_GB_HORZ_DISC_ADJ */ | ||
294 | 0x00000000, /* PA_SC_AA_SAMPLE_LOCS_PIXEL_X0Y0_0 */ | ||
295 | 0x00000000, | ||
296 | 0x00000000, | ||
297 | 0x00000000, | ||
298 | 0x00000000, | ||
299 | 0x00000000, | ||
300 | 0x00000000, | ||
301 | 0x00000000, | ||
302 | 0x00000000, | ||
303 | 0x00000000, | ||
304 | 0x00000000, | ||
305 | 0x00000000, | ||
306 | 0x00000000, | ||
307 | 0x00000000, | ||
308 | 0x00000000, | ||
309 | 0x00000000, | ||
310 | 0xffffffff, /* PA_SC_AA_MASK_X0Y0_X1Y0 */ | ||
311 | 0xffffffff, | ||
312 | |||
313 | 0xc0026900, | ||
314 | 0x00000316, | ||
315 | 0x0000000e, /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | ||
316 | 0x00000010, /* */ | ||
317 | }; | ||
318 | |||
319 | const u32 cayman_vs[] = | ||
320 | { | ||
321 | 0x00000004, | ||
322 | 0x80400400, | ||
323 | 0x0000a03c, | ||
324 | 0x95000688, | ||
325 | 0x00004000, | ||
326 | 0x15000688, | ||
327 | 0x00000000, | ||
328 | 0x88000000, | ||
329 | 0x04000000, | ||
330 | 0x67961001, | ||
331 | #ifdef __BIG_ENDIAN | ||
332 | 0x00020000, | ||
333 | #else | ||
334 | 0x00000000, | ||
335 | #endif | ||
336 | 0x00000000, | ||
337 | 0x04000000, | ||
338 | 0x67961000, | ||
339 | #ifdef __BIG_ENDIAN | ||
340 | 0x00020008, | ||
341 | #else | ||
342 | 0x00000008, | ||
343 | #endif | ||
344 | 0x00000000, | ||
345 | }; | ||
346 | |||
347 | const u32 cayman_ps[] = | ||
348 | { | ||
349 | 0x00000004, | ||
350 | 0xa00c0000, | ||
351 | 0x00000008, | ||
352 | 0x80400000, | ||
353 | 0x00000000, | ||
354 | 0x95000688, | ||
355 | 0x00000000, | ||
356 | 0x88000000, | ||
357 | 0x00380400, | ||
358 | 0x00146b10, | ||
359 | 0x00380000, | ||
360 | 0x20146b10, | ||
361 | 0x00380400, | ||
362 | 0x40146b00, | ||
363 | 0x80380000, | ||
364 | 0x60146b00, | ||
365 | 0x00000010, | ||
366 | 0x000d1000, | ||
367 | 0xb0800000, | ||
368 | 0x00000000, | ||
53 | }; | 369 | }; |
54 | 370 | ||
371 | const u32 cayman_ps_size = ARRAY_SIZE(cayman_ps); | ||
372 | const u32 cayman_vs_size = ARRAY_SIZE(cayman_vs); | ||
55 | const u32 cayman_default_size = ARRAY_SIZE(cayman_default_state); | 373 | const u32 cayman_default_size = ARRAY_SIZE(cayman_default_state); |
diff --git a/drivers/gpu/drm/radeon/cayman_blit_shaders.h b/drivers/gpu/drm/radeon/cayman_blit_shaders.h index 33b75e5d0fa4..f5d0e9a60267 100644 --- a/drivers/gpu/drm/radeon/cayman_blit_shaders.h +++ b/drivers/gpu/drm/radeon/cayman_blit_shaders.h | |||
@@ -25,8 +25,11 @@ | |||
25 | #ifndef CAYMAN_BLIT_SHADERS_H | 25 | #ifndef CAYMAN_BLIT_SHADERS_H |
26 | #define CAYMAN_BLIT_SHADERS_H | 26 | #define CAYMAN_BLIT_SHADERS_H |
27 | 27 | ||
28 | extern const u32 cayman_ps[]; | ||
29 | extern const u32 cayman_vs[]; | ||
28 | extern const u32 cayman_default_state[]; | 30 | extern const u32 cayman_default_state[]; |
29 | 31 | ||
32 | extern const u32 cayman_ps_size, cayman_vs_size; | ||
30 | extern const u32 cayman_default_size; | 33 | extern const u32 cayman_default_size; |
31 | 34 | ||
32 | #endif | 35 | #endif |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 7c37638095f7..445af7981637 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -88,21 +88,40 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
88 | /* get temperature in millidegrees */ | 88 | /* get temperature in millidegrees */ |
89 | int evergreen_get_temp(struct radeon_device *rdev) | 89 | int evergreen_get_temp(struct radeon_device *rdev) |
90 | { | 90 | { |
91 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | 91 | u32 temp, toffset; |
92 | ASIC_T_SHIFT; | 92 | int actual_temp = 0; |
93 | u32 actual_temp = 0; | 93 | |
94 | 94 | if (rdev->family == CHIP_JUNIPER) { | |
95 | if (temp & 0x400) | 95 | toffset = (RREG32(CG_THERMAL_CTRL) & TOFFSET_MASK) >> |
96 | actual_temp = -256; | 96 | TOFFSET_SHIFT; |
97 | else if (temp & 0x200) | 97 | temp = (RREG32(CG_TS0_STATUS) & TS0_ADC_DOUT_MASK) >> |
98 | actual_temp = 255; | 98 | TS0_ADC_DOUT_SHIFT; |
99 | else if (temp & 0x100) { | 99 | |
100 | actual_temp = temp & 0x1ff; | 100 | if (toffset & 0x100) |
101 | actual_temp |= ~0x1ff; | 101 | actual_temp = temp / 2 - (0x200 - toffset); |
102 | } else | 102 | else |
103 | actual_temp = temp & 0xff; | 103 | actual_temp = temp / 2 + toffset; |
104 | |||
105 | actual_temp = actual_temp * 1000; | ||
106 | |||
107 | } else { | ||
108 | temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | ||
109 | ASIC_T_SHIFT; | ||
110 | |||
111 | if (temp & 0x400) | ||
112 | actual_temp = -256; | ||
113 | else if (temp & 0x200) | ||
114 | actual_temp = 255; | ||
115 | else if (temp & 0x100) { | ||
116 | actual_temp = temp & 0x1ff; | ||
117 | actual_temp |= ~0x1ff; | ||
118 | } else | ||
119 | actual_temp = temp & 0xff; | ||
104 | 120 | ||
105 | return (actual_temp * 1000) / 2; | 121 | actual_temp = (actual_temp * 1000) / 2; |
122 | } | ||
123 | |||
124 | return actual_temp; | ||
106 | } | 125 | } |
107 | 126 | ||
108 | int sumo_get_temp(struct radeon_device *rdev) | 127 | int sumo_get_temp(struct radeon_device *rdev) |
@@ -121,11 +140,17 @@ void evergreen_pm_misc(struct radeon_device *rdev) | |||
121 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | 140 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; |
122 | 141 | ||
123 | if (voltage->type == VOLTAGE_SW) { | 142 | if (voltage->type == VOLTAGE_SW) { |
143 | /* 0xff01 is a flag rather then an actual voltage */ | ||
144 | if (voltage->voltage == 0xff01) | ||
145 | return; | ||
124 | if (voltage->voltage && (voltage->voltage != rdev->pm.current_vddc)) { | 146 | if (voltage->voltage && (voltage->voltage != rdev->pm.current_vddc)) { |
125 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); | 147 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
126 | rdev->pm.current_vddc = voltage->voltage; | 148 | rdev->pm.current_vddc = voltage->voltage; |
127 | DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage); | 149 | DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage); |
128 | } | 150 | } |
151 | /* 0xff01 is a flag rather then an actual voltage */ | ||
152 | if (voltage->vddci == 0xff01) | ||
153 | return; | ||
129 | if (voltage->vddci && (voltage->vddci != rdev->pm.current_vddci)) { | 154 | if (voltage->vddci && (voltage->vddci != rdev->pm.current_vddci)) { |
130 | radeon_atom_set_voltage(rdev, voltage->vddci, SET_VOLTAGE_TYPE_ASIC_VDDCI); | 155 | radeon_atom_set_voltage(rdev, voltage->vddci, SET_VOLTAGE_TYPE_ASIC_VDDCI); |
131 | rdev->pm.current_vddci = voltage->vddci; | 156 | rdev->pm.current_vddci = voltage->vddci; |
@@ -1415,6 +1440,8 @@ static u32 evergreen_get_tile_pipe_to_backend_map(struct radeon_device *rdev, | |||
1415 | case CHIP_CEDAR: | 1440 | case CHIP_CEDAR: |
1416 | case CHIP_REDWOOD: | 1441 | case CHIP_REDWOOD: |
1417 | case CHIP_PALM: | 1442 | case CHIP_PALM: |
1443 | case CHIP_SUMO: | ||
1444 | case CHIP_SUMO2: | ||
1418 | case CHIP_TURKS: | 1445 | case CHIP_TURKS: |
1419 | case CHIP_CAICOS: | 1446 | case CHIP_CAICOS: |
1420 | force_no_swizzle = false; | 1447 | force_no_swizzle = false; |
@@ -1544,6 +1571,8 @@ static void evergreen_program_channel_remap(struct radeon_device *rdev) | |||
1544 | case CHIP_REDWOOD: | 1571 | case CHIP_REDWOOD: |
1545 | case CHIP_CEDAR: | 1572 | case CHIP_CEDAR: |
1546 | case CHIP_PALM: | 1573 | case CHIP_PALM: |
1574 | case CHIP_SUMO: | ||
1575 | case CHIP_SUMO2: | ||
1547 | case CHIP_TURKS: | 1576 | case CHIP_TURKS: |
1548 | case CHIP_CAICOS: | 1577 | case CHIP_CAICOS: |
1549 | default: | 1578 | default: |
@@ -1689,6 +1718,54 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1689 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | 1718 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; |
1690 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | 1719 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; |
1691 | break; | 1720 | break; |
1721 | case CHIP_SUMO: | ||
1722 | rdev->config.evergreen.num_ses = 1; | ||
1723 | rdev->config.evergreen.max_pipes = 4; | ||
1724 | rdev->config.evergreen.max_tile_pipes = 2; | ||
1725 | if (rdev->pdev->device == 0x9648) | ||
1726 | rdev->config.evergreen.max_simds = 3; | ||
1727 | else if ((rdev->pdev->device == 0x9647) || | ||
1728 | (rdev->pdev->device == 0x964a)) | ||
1729 | rdev->config.evergreen.max_simds = 4; | ||
1730 | else | ||
1731 | rdev->config.evergreen.max_simds = 5; | ||
1732 | rdev->config.evergreen.max_backends = 2 * rdev->config.evergreen.num_ses; | ||
1733 | rdev->config.evergreen.max_gprs = 256; | ||
1734 | rdev->config.evergreen.max_threads = 248; | ||
1735 | rdev->config.evergreen.max_gs_threads = 32; | ||
1736 | rdev->config.evergreen.max_stack_entries = 256; | ||
1737 | rdev->config.evergreen.sx_num_of_sets = 4; | ||
1738 | rdev->config.evergreen.sx_max_export_size = 256; | ||
1739 | rdev->config.evergreen.sx_max_export_pos_size = 64; | ||
1740 | rdev->config.evergreen.sx_max_export_smx_size = 192; | ||
1741 | rdev->config.evergreen.max_hw_contexts = 8; | ||
1742 | rdev->config.evergreen.sq_num_cf_insts = 2; | ||
1743 | |||
1744 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | ||
1745 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | ||
1746 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | ||
1747 | break; | ||
1748 | case CHIP_SUMO2: | ||
1749 | rdev->config.evergreen.num_ses = 1; | ||
1750 | rdev->config.evergreen.max_pipes = 4; | ||
1751 | rdev->config.evergreen.max_tile_pipes = 4; | ||
1752 | rdev->config.evergreen.max_simds = 2; | ||
1753 | rdev->config.evergreen.max_backends = 1 * rdev->config.evergreen.num_ses; | ||
1754 | rdev->config.evergreen.max_gprs = 256; | ||
1755 | rdev->config.evergreen.max_threads = 248; | ||
1756 | rdev->config.evergreen.max_gs_threads = 32; | ||
1757 | rdev->config.evergreen.max_stack_entries = 512; | ||
1758 | rdev->config.evergreen.sx_num_of_sets = 4; | ||
1759 | rdev->config.evergreen.sx_max_export_size = 256; | ||
1760 | rdev->config.evergreen.sx_max_export_pos_size = 64; | ||
1761 | rdev->config.evergreen.sx_max_export_smx_size = 192; | ||
1762 | rdev->config.evergreen.max_hw_contexts = 8; | ||
1763 | rdev->config.evergreen.sq_num_cf_insts = 2; | ||
1764 | |||
1765 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | ||
1766 | rdev->config.evergreen.sc_hiz_tile_fifo_size = 0x30; | ||
1767 | rdev->config.evergreen.sc_earlyz_tile_fifo_size = 0x130; | ||
1768 | break; | ||
1692 | case CHIP_BARTS: | 1769 | case CHIP_BARTS: |
1693 | rdev->config.evergreen.num_ses = 2; | 1770 | rdev->config.evergreen.num_ses = 2; |
1694 | rdev->config.evergreen.max_pipes = 4; | 1771 | rdev->config.evergreen.max_pipes = 4; |
@@ -2039,6 +2116,8 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2039 | switch (rdev->family) { | 2116 | switch (rdev->family) { |
2040 | case CHIP_CEDAR: | 2117 | case CHIP_CEDAR: |
2041 | case CHIP_PALM: | 2118 | case CHIP_PALM: |
2119 | case CHIP_SUMO: | ||
2120 | case CHIP_SUMO2: | ||
2042 | case CHIP_CAICOS: | 2121 | case CHIP_CAICOS: |
2043 | /* no vertex cache */ | 2122 | /* no vertex cache */ |
2044 | sq_config &= ~VC_ENABLE; | 2123 | sq_config &= ~VC_ENABLE; |
@@ -2060,6 +2139,8 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2060 | switch (rdev->family) { | 2139 | switch (rdev->family) { |
2061 | case CHIP_CEDAR: | 2140 | case CHIP_CEDAR: |
2062 | case CHIP_PALM: | 2141 | case CHIP_PALM: |
2142 | case CHIP_SUMO: | ||
2143 | case CHIP_SUMO2: | ||
2063 | ps_thread_count = 96; | 2144 | ps_thread_count = 96; |
2064 | break; | 2145 | break; |
2065 | default: | 2146 | default: |
@@ -2099,6 +2180,8 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2099 | switch (rdev->family) { | 2180 | switch (rdev->family) { |
2100 | case CHIP_CEDAR: | 2181 | case CHIP_CEDAR: |
2101 | case CHIP_PALM: | 2182 | case CHIP_PALM: |
2183 | case CHIP_SUMO: | ||
2184 | case CHIP_SUMO2: | ||
2102 | case CHIP_CAICOS: | 2185 | case CHIP_CAICOS: |
2103 | vgt_cache_invalidation = CACHE_INVALIDATION(TC_ONLY); | 2186 | vgt_cache_invalidation = CACHE_INVALIDATION(TC_ONLY); |
2104 | break; | 2187 | break; |
@@ -2618,28 +2701,25 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
2618 | 2701 | ||
2619 | int evergreen_irq_process(struct radeon_device *rdev) | 2702 | int evergreen_irq_process(struct radeon_device *rdev) |
2620 | { | 2703 | { |
2621 | u32 wptr = evergreen_get_ih_wptr(rdev); | 2704 | u32 wptr; |
2622 | u32 rptr = rdev->ih.rptr; | 2705 | u32 rptr; |
2623 | u32 src_id, src_data; | 2706 | u32 src_id, src_data; |
2624 | u32 ring_index; | 2707 | u32 ring_index; |
2625 | unsigned long flags; | 2708 | unsigned long flags; |
2626 | bool queue_hotplug = false; | 2709 | bool queue_hotplug = false; |
2627 | 2710 | ||
2628 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | 2711 | if (!rdev->ih.enabled || rdev->shutdown) |
2629 | if (!rdev->ih.enabled) | ||
2630 | return IRQ_NONE; | 2712 | return IRQ_NONE; |
2631 | 2713 | ||
2632 | spin_lock_irqsave(&rdev->ih.lock, flags); | 2714 | wptr = evergreen_get_ih_wptr(rdev); |
2715 | rptr = rdev->ih.rptr; | ||
2716 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | ||
2633 | 2717 | ||
2718 | spin_lock_irqsave(&rdev->ih.lock, flags); | ||
2634 | if (rptr == wptr) { | 2719 | if (rptr == wptr) { |
2635 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | 2720 | spin_unlock_irqrestore(&rdev->ih.lock, flags); |
2636 | return IRQ_NONE; | 2721 | return IRQ_NONE; |
2637 | } | 2722 | } |
2638 | if (rdev->shutdown) { | ||
2639 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | ||
2640 | return IRQ_NONE; | ||
2641 | } | ||
2642 | |||
2643 | restart_ih: | 2723 | restart_ih: |
2644 | /* display interrupts */ | 2724 | /* display interrupts */ |
2645 | evergreen_irq_ack(rdev); | 2725 | evergreen_irq_ack(rdev); |
@@ -2868,7 +2948,7 @@ restart_ih: | |||
2868 | radeon_fence_process(rdev); | 2948 | radeon_fence_process(rdev); |
2869 | break; | 2949 | break; |
2870 | case 233: /* GUI IDLE */ | 2950 | case 233: /* GUI IDLE */ |
2871 | DRM_DEBUG("IH: CP EOP\n"); | 2951 | DRM_DEBUG("IH: GUI idle\n"); |
2872 | rdev->pm.gui_idle = true; | 2952 | rdev->pm.gui_idle = true; |
2873 | wake_up(&rdev->irq.idle_queue); | 2953 | wake_up(&rdev->irq.idle_queue); |
2874 | break; | 2954 | break; |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index ba06a69c6de8..57f3bc17b87e 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include "evergreend.h" | 32 | #include "evergreend.h" |
33 | #include "evergreen_blit_shaders.h" | 33 | #include "evergreen_blit_shaders.h" |
34 | #include "cayman_blit_shaders.h" | ||
34 | 35 | ||
35 | #define DI_PT_RECTLIST 0x11 | 36 | #define DI_PT_RECTLIST 0x11 |
36 | #define DI_INDEX_SIZE_16_BIT 0x0 | 37 | #define DI_INDEX_SIZE_16_BIT 0x0 |
@@ -152,6 +153,8 @@ set_vtx_resource(struct radeon_device *rdev, u64 gpu_addr) | |||
152 | 153 | ||
153 | if ((rdev->family == CHIP_CEDAR) || | 154 | if ((rdev->family == CHIP_CEDAR) || |
154 | (rdev->family == CHIP_PALM) || | 155 | (rdev->family == CHIP_PALM) || |
156 | (rdev->family == CHIP_SUMO) || | ||
157 | (rdev->family == CHIP_SUMO2) || | ||
155 | (rdev->family == CHIP_CAICOS)) | 158 | (rdev->family == CHIP_CAICOS)) |
156 | cp_set_surface_sync(rdev, | 159 | cp_set_surface_sync(rdev, |
157 | PACKET3_TC_ACTION_ENA, 48, gpu_addr); | 160 | PACKET3_TC_ACTION_ENA, 48, gpu_addr); |
@@ -199,6 +202,16 @@ static void | |||
199 | set_scissors(struct radeon_device *rdev, int x1, int y1, | 202 | set_scissors(struct radeon_device *rdev, int x1, int y1, |
200 | int x2, int y2) | 203 | int x2, int y2) |
201 | { | 204 | { |
205 | /* workaround some hw bugs */ | ||
206 | if (x2 == 0) | ||
207 | x1 = 1; | ||
208 | if (y2 == 0) | ||
209 | y1 = 1; | ||
210 | if (rdev->family == CHIP_CAYMAN) { | ||
211 | if ((x2 == 1) && (y2 == 1)) | ||
212 | x2 = 2; | ||
213 | } | ||
214 | |||
202 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); | 215 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONTEXT_REG, 2)); |
203 | radeon_ring_write(rdev, (PA_SC_SCREEN_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_START) >> 2); | 216 | radeon_ring_write(rdev, (PA_SC_SCREEN_SCISSOR_TL - PACKET3_SET_CONTEXT_REG_START) >> 2); |
204 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16)); | 217 | radeon_ring_write(rdev, (x1 << 0) | (y1 << 16)); |
@@ -255,238 +268,284 @@ set_default_state(struct radeon_device *rdev) | |||
255 | u64 gpu_addr; | 268 | u64 gpu_addr; |
256 | int dwords; | 269 | int dwords; |
257 | 270 | ||
258 | switch (rdev->family) { | ||
259 | case CHIP_CEDAR: | ||
260 | default: | ||
261 | num_ps_gprs = 93; | ||
262 | num_vs_gprs = 46; | ||
263 | num_temp_gprs = 4; | ||
264 | num_gs_gprs = 31; | ||
265 | num_es_gprs = 31; | ||
266 | num_hs_gprs = 23; | ||
267 | num_ls_gprs = 23; | ||
268 | num_ps_threads = 96; | ||
269 | num_vs_threads = 16; | ||
270 | num_gs_threads = 16; | ||
271 | num_es_threads = 16; | ||
272 | num_hs_threads = 16; | ||
273 | num_ls_threads = 16; | ||
274 | num_ps_stack_entries = 42; | ||
275 | num_vs_stack_entries = 42; | ||
276 | num_gs_stack_entries = 42; | ||
277 | num_es_stack_entries = 42; | ||
278 | num_hs_stack_entries = 42; | ||
279 | num_ls_stack_entries = 42; | ||
280 | break; | ||
281 | case CHIP_REDWOOD: | ||
282 | num_ps_gprs = 93; | ||
283 | num_vs_gprs = 46; | ||
284 | num_temp_gprs = 4; | ||
285 | num_gs_gprs = 31; | ||
286 | num_es_gprs = 31; | ||
287 | num_hs_gprs = 23; | ||
288 | num_ls_gprs = 23; | ||
289 | num_ps_threads = 128; | ||
290 | num_vs_threads = 20; | ||
291 | num_gs_threads = 20; | ||
292 | num_es_threads = 20; | ||
293 | num_hs_threads = 20; | ||
294 | num_ls_threads = 20; | ||
295 | num_ps_stack_entries = 42; | ||
296 | num_vs_stack_entries = 42; | ||
297 | num_gs_stack_entries = 42; | ||
298 | num_es_stack_entries = 42; | ||
299 | num_hs_stack_entries = 42; | ||
300 | num_ls_stack_entries = 42; | ||
301 | break; | ||
302 | case CHIP_JUNIPER: | ||
303 | num_ps_gprs = 93; | ||
304 | num_vs_gprs = 46; | ||
305 | num_temp_gprs = 4; | ||
306 | num_gs_gprs = 31; | ||
307 | num_es_gprs = 31; | ||
308 | num_hs_gprs = 23; | ||
309 | num_ls_gprs = 23; | ||
310 | num_ps_threads = 128; | ||
311 | num_vs_threads = 20; | ||
312 | num_gs_threads = 20; | ||
313 | num_es_threads = 20; | ||
314 | num_hs_threads = 20; | ||
315 | num_ls_threads = 20; | ||
316 | num_ps_stack_entries = 85; | ||
317 | num_vs_stack_entries = 85; | ||
318 | num_gs_stack_entries = 85; | ||
319 | num_es_stack_entries = 85; | ||
320 | num_hs_stack_entries = 85; | ||
321 | num_ls_stack_entries = 85; | ||
322 | break; | ||
323 | case CHIP_CYPRESS: | ||
324 | case CHIP_HEMLOCK: | ||
325 | num_ps_gprs = 93; | ||
326 | num_vs_gprs = 46; | ||
327 | num_temp_gprs = 4; | ||
328 | num_gs_gprs = 31; | ||
329 | num_es_gprs = 31; | ||
330 | num_hs_gprs = 23; | ||
331 | num_ls_gprs = 23; | ||
332 | num_ps_threads = 128; | ||
333 | num_vs_threads = 20; | ||
334 | num_gs_threads = 20; | ||
335 | num_es_threads = 20; | ||
336 | num_hs_threads = 20; | ||
337 | num_ls_threads = 20; | ||
338 | num_ps_stack_entries = 85; | ||
339 | num_vs_stack_entries = 85; | ||
340 | num_gs_stack_entries = 85; | ||
341 | num_es_stack_entries = 85; | ||
342 | num_hs_stack_entries = 85; | ||
343 | num_ls_stack_entries = 85; | ||
344 | break; | ||
345 | case CHIP_PALM: | ||
346 | num_ps_gprs = 93; | ||
347 | num_vs_gprs = 46; | ||
348 | num_temp_gprs = 4; | ||
349 | num_gs_gprs = 31; | ||
350 | num_es_gprs = 31; | ||
351 | num_hs_gprs = 23; | ||
352 | num_ls_gprs = 23; | ||
353 | num_ps_threads = 96; | ||
354 | num_vs_threads = 16; | ||
355 | num_gs_threads = 16; | ||
356 | num_es_threads = 16; | ||
357 | num_hs_threads = 16; | ||
358 | num_ls_threads = 16; | ||
359 | num_ps_stack_entries = 42; | ||
360 | num_vs_stack_entries = 42; | ||
361 | num_gs_stack_entries = 42; | ||
362 | num_es_stack_entries = 42; | ||
363 | num_hs_stack_entries = 42; | ||
364 | num_ls_stack_entries = 42; | ||
365 | break; | ||
366 | case CHIP_BARTS: | ||
367 | num_ps_gprs = 93; | ||
368 | num_vs_gprs = 46; | ||
369 | num_temp_gprs = 4; | ||
370 | num_gs_gprs = 31; | ||
371 | num_es_gprs = 31; | ||
372 | num_hs_gprs = 23; | ||
373 | num_ls_gprs = 23; | ||
374 | num_ps_threads = 128; | ||
375 | num_vs_threads = 20; | ||
376 | num_gs_threads = 20; | ||
377 | num_es_threads = 20; | ||
378 | num_hs_threads = 20; | ||
379 | num_ls_threads = 20; | ||
380 | num_ps_stack_entries = 85; | ||
381 | num_vs_stack_entries = 85; | ||
382 | num_gs_stack_entries = 85; | ||
383 | num_es_stack_entries = 85; | ||
384 | num_hs_stack_entries = 85; | ||
385 | num_ls_stack_entries = 85; | ||
386 | break; | ||
387 | case CHIP_TURKS: | ||
388 | num_ps_gprs = 93; | ||
389 | num_vs_gprs = 46; | ||
390 | num_temp_gprs = 4; | ||
391 | num_gs_gprs = 31; | ||
392 | num_es_gprs = 31; | ||
393 | num_hs_gprs = 23; | ||
394 | num_ls_gprs = 23; | ||
395 | num_ps_threads = 128; | ||
396 | num_vs_threads = 20; | ||
397 | num_gs_threads = 20; | ||
398 | num_es_threads = 20; | ||
399 | num_hs_threads = 20; | ||
400 | num_ls_threads = 20; | ||
401 | num_ps_stack_entries = 42; | ||
402 | num_vs_stack_entries = 42; | ||
403 | num_gs_stack_entries = 42; | ||
404 | num_es_stack_entries = 42; | ||
405 | num_hs_stack_entries = 42; | ||
406 | num_ls_stack_entries = 42; | ||
407 | break; | ||
408 | case CHIP_CAICOS: | ||
409 | num_ps_gprs = 93; | ||
410 | num_vs_gprs = 46; | ||
411 | num_temp_gprs = 4; | ||
412 | num_gs_gprs = 31; | ||
413 | num_es_gprs = 31; | ||
414 | num_hs_gprs = 23; | ||
415 | num_ls_gprs = 23; | ||
416 | num_ps_threads = 128; | ||
417 | num_vs_threads = 10; | ||
418 | num_gs_threads = 10; | ||
419 | num_es_threads = 10; | ||
420 | num_hs_threads = 10; | ||
421 | num_ls_threads = 10; | ||
422 | num_ps_stack_entries = 42; | ||
423 | num_vs_stack_entries = 42; | ||
424 | num_gs_stack_entries = 42; | ||
425 | num_es_stack_entries = 42; | ||
426 | num_hs_stack_entries = 42; | ||
427 | num_ls_stack_entries = 42; | ||
428 | break; | ||
429 | } | ||
430 | |||
431 | if ((rdev->family == CHIP_CEDAR) || | ||
432 | (rdev->family == CHIP_PALM) || | ||
433 | (rdev->family == CHIP_CAICOS)) | ||
434 | sq_config = 0; | ||
435 | else | ||
436 | sq_config = VC_ENABLE; | ||
437 | |||
438 | sq_config |= (EXPORT_SRC_C | | ||
439 | CS_PRIO(0) | | ||
440 | LS_PRIO(0) | | ||
441 | HS_PRIO(0) | | ||
442 | PS_PRIO(0) | | ||
443 | VS_PRIO(1) | | ||
444 | GS_PRIO(2) | | ||
445 | ES_PRIO(3)); | ||
446 | |||
447 | sq_gpr_resource_mgmt_1 = (NUM_PS_GPRS(num_ps_gprs) | | ||
448 | NUM_VS_GPRS(num_vs_gprs) | | ||
449 | NUM_CLAUSE_TEMP_GPRS(num_temp_gprs)); | ||
450 | sq_gpr_resource_mgmt_2 = (NUM_GS_GPRS(num_gs_gprs) | | ||
451 | NUM_ES_GPRS(num_es_gprs)); | ||
452 | sq_gpr_resource_mgmt_3 = (NUM_HS_GPRS(num_hs_gprs) | | ||
453 | NUM_LS_GPRS(num_ls_gprs)); | ||
454 | sq_thread_resource_mgmt = (NUM_PS_THREADS(num_ps_threads) | | ||
455 | NUM_VS_THREADS(num_vs_threads) | | ||
456 | NUM_GS_THREADS(num_gs_threads) | | ||
457 | NUM_ES_THREADS(num_es_threads)); | ||
458 | sq_thread_resource_mgmt_2 = (NUM_HS_THREADS(num_hs_threads) | | ||
459 | NUM_LS_THREADS(num_ls_threads)); | ||
460 | sq_stack_resource_mgmt_1 = (NUM_PS_STACK_ENTRIES(num_ps_stack_entries) | | ||
461 | NUM_VS_STACK_ENTRIES(num_vs_stack_entries)); | ||
462 | sq_stack_resource_mgmt_2 = (NUM_GS_STACK_ENTRIES(num_gs_stack_entries) | | ||
463 | NUM_ES_STACK_ENTRIES(num_es_stack_entries)); | ||
464 | sq_stack_resource_mgmt_3 = (NUM_HS_STACK_ENTRIES(num_hs_stack_entries) | | ||
465 | NUM_LS_STACK_ENTRIES(num_ls_stack_entries)); | ||
466 | |||
467 | /* set clear context state */ | 271 | /* set clear context state */ |
468 | radeon_ring_write(rdev, PACKET3(PACKET3_CLEAR_STATE, 0)); | 272 | radeon_ring_write(rdev, PACKET3(PACKET3_CLEAR_STATE, 0)); |
469 | radeon_ring_write(rdev, 0); | 273 | radeon_ring_write(rdev, 0); |
470 | 274 | ||
471 | /* disable dyn gprs */ | 275 | if (rdev->family < CHIP_CAYMAN) { |
472 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | 276 | switch (rdev->family) { |
473 | radeon_ring_write(rdev, (SQ_DYN_GPR_CNTL_PS_FLUSH_REQ - PACKET3_SET_CONFIG_REG_START) >> 2); | 277 | case CHIP_CEDAR: |
474 | radeon_ring_write(rdev, 0); | 278 | default: |
279 | num_ps_gprs = 93; | ||
280 | num_vs_gprs = 46; | ||
281 | num_temp_gprs = 4; | ||
282 | num_gs_gprs = 31; | ||
283 | num_es_gprs = 31; | ||
284 | num_hs_gprs = 23; | ||
285 | num_ls_gprs = 23; | ||
286 | num_ps_threads = 96; | ||
287 | num_vs_threads = 16; | ||
288 | num_gs_threads = 16; | ||
289 | num_es_threads = 16; | ||
290 | num_hs_threads = 16; | ||
291 | num_ls_threads = 16; | ||
292 | num_ps_stack_entries = 42; | ||
293 | num_vs_stack_entries = 42; | ||
294 | num_gs_stack_entries = 42; | ||
295 | num_es_stack_entries = 42; | ||
296 | num_hs_stack_entries = 42; | ||
297 | num_ls_stack_entries = 42; | ||
298 | break; | ||
299 | case CHIP_REDWOOD: | ||
300 | num_ps_gprs = 93; | ||
301 | num_vs_gprs = 46; | ||
302 | num_temp_gprs = 4; | ||
303 | num_gs_gprs = 31; | ||
304 | num_es_gprs = 31; | ||
305 | num_hs_gprs = 23; | ||
306 | num_ls_gprs = 23; | ||
307 | num_ps_threads = 128; | ||
308 | num_vs_threads = 20; | ||
309 | num_gs_threads = 20; | ||
310 | num_es_threads = 20; | ||
311 | num_hs_threads = 20; | ||
312 | num_ls_threads = 20; | ||
313 | num_ps_stack_entries = 42; | ||
314 | num_vs_stack_entries = 42; | ||
315 | num_gs_stack_entries = 42; | ||
316 | num_es_stack_entries = 42; | ||
317 | num_hs_stack_entries = 42; | ||
318 | num_ls_stack_entries = 42; | ||
319 | break; | ||
320 | case CHIP_JUNIPER: | ||
321 | num_ps_gprs = 93; | ||
322 | num_vs_gprs = 46; | ||
323 | num_temp_gprs = 4; | ||
324 | num_gs_gprs = 31; | ||
325 | num_es_gprs = 31; | ||
326 | num_hs_gprs = 23; | ||
327 | num_ls_gprs = 23; | ||
328 | num_ps_threads = 128; | ||
329 | num_vs_threads = 20; | ||
330 | num_gs_threads = 20; | ||
331 | num_es_threads = 20; | ||
332 | num_hs_threads = 20; | ||
333 | num_ls_threads = 20; | ||
334 | num_ps_stack_entries = 85; | ||
335 | num_vs_stack_entries = 85; | ||
336 | num_gs_stack_entries = 85; | ||
337 | num_es_stack_entries = 85; | ||
338 | num_hs_stack_entries = 85; | ||
339 | num_ls_stack_entries = 85; | ||
340 | break; | ||
341 | case CHIP_CYPRESS: | ||
342 | case CHIP_HEMLOCK: | ||
343 | num_ps_gprs = 93; | ||
344 | num_vs_gprs = 46; | ||
345 | num_temp_gprs = 4; | ||
346 | num_gs_gprs = 31; | ||
347 | num_es_gprs = 31; | ||
348 | num_hs_gprs = 23; | ||
349 | num_ls_gprs = 23; | ||
350 | num_ps_threads = 128; | ||
351 | num_vs_threads = 20; | ||
352 | num_gs_threads = 20; | ||
353 | num_es_threads = 20; | ||
354 | num_hs_threads = 20; | ||
355 | num_ls_threads = 20; | ||
356 | num_ps_stack_entries = 85; | ||
357 | num_vs_stack_entries = 85; | ||
358 | num_gs_stack_entries = 85; | ||
359 | num_es_stack_entries = 85; | ||
360 | num_hs_stack_entries = 85; | ||
361 | num_ls_stack_entries = 85; | ||
362 | break; | ||
363 | case CHIP_PALM: | ||
364 | num_ps_gprs = 93; | ||
365 | num_vs_gprs = 46; | ||
366 | num_temp_gprs = 4; | ||
367 | num_gs_gprs = 31; | ||
368 | num_es_gprs = 31; | ||
369 | num_hs_gprs = 23; | ||
370 | num_ls_gprs = 23; | ||
371 | num_ps_threads = 96; | ||
372 | num_vs_threads = 16; | ||
373 | num_gs_threads = 16; | ||
374 | num_es_threads = 16; | ||
375 | num_hs_threads = 16; | ||
376 | num_ls_threads = 16; | ||
377 | num_ps_stack_entries = 42; | ||
378 | num_vs_stack_entries = 42; | ||
379 | num_gs_stack_entries = 42; | ||
380 | num_es_stack_entries = 42; | ||
381 | num_hs_stack_entries = 42; | ||
382 | num_ls_stack_entries = 42; | ||
383 | break; | ||
384 | case CHIP_SUMO: | ||
385 | num_ps_gprs = 93; | ||
386 | num_vs_gprs = 46; | ||
387 | num_temp_gprs = 4; | ||
388 | num_gs_gprs = 31; | ||
389 | num_es_gprs = 31; | ||
390 | num_hs_gprs = 23; | ||
391 | num_ls_gprs = 23; | ||
392 | num_ps_threads = 96; | ||
393 | num_vs_threads = 25; | ||
394 | num_gs_threads = 25; | ||
395 | num_es_threads = 25; | ||
396 | num_hs_threads = 25; | ||
397 | num_ls_threads = 25; | ||
398 | num_ps_stack_entries = 42; | ||
399 | num_vs_stack_entries = 42; | ||
400 | num_gs_stack_entries = 42; | ||
401 | num_es_stack_entries = 42; | ||
402 | num_hs_stack_entries = 42; | ||
403 | num_ls_stack_entries = 42; | ||
404 | break; | ||
405 | case CHIP_SUMO2: | ||
406 | num_ps_gprs = 93; | ||
407 | num_vs_gprs = 46; | ||
408 | num_temp_gprs = 4; | ||
409 | num_gs_gprs = 31; | ||
410 | num_es_gprs = 31; | ||
411 | num_hs_gprs = 23; | ||
412 | num_ls_gprs = 23; | ||
413 | num_ps_threads = 96; | ||
414 | num_vs_threads = 25; | ||
415 | num_gs_threads = 25; | ||
416 | num_es_threads = 25; | ||
417 | num_hs_threads = 25; | ||
418 | num_ls_threads = 25; | ||
419 | num_ps_stack_entries = 85; | ||
420 | num_vs_stack_entries = 85; | ||
421 | num_gs_stack_entries = 85; | ||
422 | num_es_stack_entries = 85; | ||
423 | num_hs_stack_entries = 85; | ||
424 | num_ls_stack_entries = 85; | ||
425 | break; | ||
426 | case CHIP_BARTS: | ||
427 | num_ps_gprs = 93; | ||
428 | num_vs_gprs = 46; | ||
429 | num_temp_gprs = 4; | ||
430 | num_gs_gprs = 31; | ||
431 | num_es_gprs = 31; | ||
432 | num_hs_gprs = 23; | ||
433 | num_ls_gprs = 23; | ||
434 | num_ps_threads = 128; | ||
435 | num_vs_threads = 20; | ||
436 | num_gs_threads = 20; | ||
437 | num_es_threads = 20; | ||
438 | num_hs_threads = 20; | ||
439 | num_ls_threads = 20; | ||
440 | num_ps_stack_entries = 85; | ||
441 | num_vs_stack_entries = 85; | ||
442 | num_gs_stack_entries = 85; | ||
443 | num_es_stack_entries = 85; | ||
444 | num_hs_stack_entries = 85; | ||
445 | num_ls_stack_entries = 85; | ||
446 | break; | ||
447 | case CHIP_TURKS: | ||
448 | num_ps_gprs = 93; | ||
449 | num_vs_gprs = 46; | ||
450 | num_temp_gprs = 4; | ||
451 | num_gs_gprs = 31; | ||
452 | num_es_gprs = 31; | ||
453 | num_hs_gprs = 23; | ||
454 | num_ls_gprs = 23; | ||
455 | num_ps_threads = 128; | ||
456 | num_vs_threads = 20; | ||
457 | num_gs_threads = 20; | ||
458 | num_es_threads = 20; | ||
459 | num_hs_threads = 20; | ||
460 | num_ls_threads = 20; | ||
461 | num_ps_stack_entries = 42; | ||
462 | num_vs_stack_entries = 42; | ||
463 | num_gs_stack_entries = 42; | ||
464 | num_es_stack_entries = 42; | ||
465 | num_hs_stack_entries = 42; | ||
466 | num_ls_stack_entries = 42; | ||
467 | break; | ||
468 | case CHIP_CAICOS: | ||
469 | num_ps_gprs = 93; | ||
470 | num_vs_gprs = 46; | ||
471 | num_temp_gprs = 4; | ||
472 | num_gs_gprs = 31; | ||
473 | num_es_gprs = 31; | ||
474 | num_hs_gprs = 23; | ||
475 | num_ls_gprs = 23; | ||
476 | num_ps_threads = 128; | ||
477 | num_vs_threads = 10; | ||
478 | num_gs_threads = 10; | ||
479 | num_es_threads = 10; | ||
480 | num_hs_threads = 10; | ||
481 | num_ls_threads = 10; | ||
482 | num_ps_stack_entries = 42; | ||
483 | num_vs_stack_entries = 42; | ||
484 | num_gs_stack_entries = 42; | ||
485 | num_es_stack_entries = 42; | ||
486 | num_hs_stack_entries = 42; | ||
487 | num_ls_stack_entries = 42; | ||
488 | break; | ||
489 | } | ||
475 | 490 | ||
476 | /* SQ config */ | 491 | if ((rdev->family == CHIP_CEDAR) || |
477 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 11)); | 492 | (rdev->family == CHIP_PALM) || |
478 | radeon_ring_write(rdev, (SQ_CONFIG - PACKET3_SET_CONFIG_REG_START) >> 2); | 493 | (rdev->family == CHIP_SUMO) || |
479 | radeon_ring_write(rdev, sq_config); | 494 | (rdev->family == CHIP_SUMO2) || |
480 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_1); | 495 | (rdev->family == CHIP_CAICOS)) |
481 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_2); | 496 | sq_config = 0; |
482 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_3); | 497 | else |
483 | radeon_ring_write(rdev, 0); | 498 | sq_config = VC_ENABLE; |
484 | radeon_ring_write(rdev, 0); | 499 | |
485 | radeon_ring_write(rdev, sq_thread_resource_mgmt); | 500 | sq_config |= (EXPORT_SRC_C | |
486 | radeon_ring_write(rdev, sq_thread_resource_mgmt_2); | 501 | CS_PRIO(0) | |
487 | radeon_ring_write(rdev, sq_stack_resource_mgmt_1); | 502 | LS_PRIO(0) | |
488 | radeon_ring_write(rdev, sq_stack_resource_mgmt_2); | 503 | HS_PRIO(0) | |
489 | radeon_ring_write(rdev, sq_stack_resource_mgmt_3); | 504 | PS_PRIO(0) | |
505 | VS_PRIO(1) | | ||
506 | GS_PRIO(2) | | ||
507 | ES_PRIO(3)); | ||
508 | |||
509 | sq_gpr_resource_mgmt_1 = (NUM_PS_GPRS(num_ps_gprs) | | ||
510 | NUM_VS_GPRS(num_vs_gprs) | | ||
511 | NUM_CLAUSE_TEMP_GPRS(num_temp_gprs)); | ||
512 | sq_gpr_resource_mgmt_2 = (NUM_GS_GPRS(num_gs_gprs) | | ||
513 | NUM_ES_GPRS(num_es_gprs)); | ||
514 | sq_gpr_resource_mgmt_3 = (NUM_HS_GPRS(num_hs_gprs) | | ||
515 | NUM_LS_GPRS(num_ls_gprs)); | ||
516 | sq_thread_resource_mgmt = (NUM_PS_THREADS(num_ps_threads) | | ||
517 | NUM_VS_THREADS(num_vs_threads) | | ||
518 | NUM_GS_THREADS(num_gs_threads) | | ||
519 | NUM_ES_THREADS(num_es_threads)); | ||
520 | sq_thread_resource_mgmt_2 = (NUM_HS_THREADS(num_hs_threads) | | ||
521 | NUM_LS_THREADS(num_ls_threads)); | ||
522 | sq_stack_resource_mgmt_1 = (NUM_PS_STACK_ENTRIES(num_ps_stack_entries) | | ||
523 | NUM_VS_STACK_ENTRIES(num_vs_stack_entries)); | ||
524 | sq_stack_resource_mgmt_2 = (NUM_GS_STACK_ENTRIES(num_gs_stack_entries) | | ||
525 | NUM_ES_STACK_ENTRIES(num_es_stack_entries)); | ||
526 | sq_stack_resource_mgmt_3 = (NUM_HS_STACK_ENTRIES(num_hs_stack_entries) | | ||
527 | NUM_LS_STACK_ENTRIES(num_ls_stack_entries)); | ||
528 | |||
529 | /* disable dyn gprs */ | ||
530 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | ||
531 | radeon_ring_write(rdev, (SQ_DYN_GPR_CNTL_PS_FLUSH_REQ - PACKET3_SET_CONFIG_REG_START) >> 2); | ||
532 | radeon_ring_write(rdev, 0); | ||
533 | |||
534 | /* SQ config */ | ||
535 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 11)); | ||
536 | radeon_ring_write(rdev, (SQ_CONFIG - PACKET3_SET_CONFIG_REG_START) >> 2); | ||
537 | radeon_ring_write(rdev, sq_config); | ||
538 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_1); | ||
539 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_2); | ||
540 | radeon_ring_write(rdev, sq_gpr_resource_mgmt_3); | ||
541 | radeon_ring_write(rdev, 0); | ||
542 | radeon_ring_write(rdev, 0); | ||
543 | radeon_ring_write(rdev, sq_thread_resource_mgmt); | ||
544 | radeon_ring_write(rdev, sq_thread_resource_mgmt_2); | ||
545 | radeon_ring_write(rdev, sq_stack_resource_mgmt_1); | ||
546 | radeon_ring_write(rdev, sq_stack_resource_mgmt_2); | ||
547 | radeon_ring_write(rdev, sq_stack_resource_mgmt_3); | ||
548 | } | ||
490 | 549 | ||
491 | /* CONTEXT_CONTROL */ | 550 | /* CONTEXT_CONTROL */ |
492 | radeon_ring_write(rdev, 0xc0012800); | 551 | radeon_ring_write(rdev, 0xc0012800); |
@@ -560,7 +619,10 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
560 | mutex_init(&rdev->r600_blit.mutex); | 619 | mutex_init(&rdev->r600_blit.mutex); |
561 | rdev->r600_blit.state_offset = 0; | 620 | rdev->r600_blit.state_offset = 0; |
562 | 621 | ||
563 | rdev->r600_blit.state_len = evergreen_default_size; | 622 | if (rdev->family < CHIP_CAYMAN) |
623 | rdev->r600_blit.state_len = evergreen_default_size; | ||
624 | else | ||
625 | rdev->r600_blit.state_len = cayman_default_size; | ||
564 | 626 | ||
565 | dwords = rdev->r600_blit.state_len; | 627 | dwords = rdev->r600_blit.state_len; |
566 | while (dwords & 0xf) { | 628 | while (dwords & 0xf) { |
@@ -572,11 +634,17 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
572 | obj_size = ALIGN(obj_size, 256); | 634 | obj_size = ALIGN(obj_size, 256); |
573 | 635 | ||
574 | rdev->r600_blit.vs_offset = obj_size; | 636 | rdev->r600_blit.vs_offset = obj_size; |
575 | obj_size += evergreen_vs_size * 4; | 637 | if (rdev->family < CHIP_CAYMAN) |
638 | obj_size += evergreen_vs_size * 4; | ||
639 | else | ||
640 | obj_size += cayman_vs_size * 4; | ||
576 | obj_size = ALIGN(obj_size, 256); | 641 | obj_size = ALIGN(obj_size, 256); |
577 | 642 | ||
578 | rdev->r600_blit.ps_offset = obj_size; | 643 | rdev->r600_blit.ps_offset = obj_size; |
579 | obj_size += evergreen_ps_size * 4; | 644 | if (rdev->family < CHIP_CAYMAN) |
645 | obj_size += evergreen_ps_size * 4; | ||
646 | else | ||
647 | obj_size += cayman_ps_size * 4; | ||
580 | obj_size = ALIGN(obj_size, 256); | 648 | obj_size = ALIGN(obj_size, 256); |
581 | 649 | ||
582 | r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, | 650 | r = radeon_bo_create(rdev, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
@@ -599,16 +667,29 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
599 | return r; | 667 | return r; |
600 | } | 668 | } |
601 | 669 | ||
602 | memcpy_toio(ptr + rdev->r600_blit.state_offset, | 670 | if (rdev->family < CHIP_CAYMAN) { |
603 | evergreen_default_state, rdev->r600_blit.state_len * 4); | 671 | memcpy_toio(ptr + rdev->r600_blit.state_offset, |
604 | 672 | evergreen_default_state, rdev->r600_blit.state_len * 4); | |
605 | if (num_packet2s) | 673 | |
606 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), | 674 | if (num_packet2s) |
607 | packet2s, num_packet2s * 4); | 675 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), |
608 | for (i = 0; i < evergreen_vs_size; i++) | 676 | packet2s, num_packet2s * 4); |
609 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]); | 677 | for (i = 0; i < evergreen_vs_size; i++) |
610 | for (i = 0; i < evergreen_ps_size; i++) | 678 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(evergreen_vs[i]); |
611 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]); | 679 | for (i = 0; i < evergreen_ps_size; i++) |
680 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(evergreen_ps[i]); | ||
681 | } else { | ||
682 | memcpy_toio(ptr + rdev->r600_blit.state_offset, | ||
683 | cayman_default_state, rdev->r600_blit.state_len * 4); | ||
684 | |||
685 | if (num_packet2s) | ||
686 | memcpy_toio(ptr + rdev->r600_blit.state_offset + (rdev->r600_blit.state_len * 4), | ||
687 | packet2s, num_packet2s * 4); | ||
688 | for (i = 0; i < cayman_vs_size; i++) | ||
689 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.vs_offset + i * 4) = cpu_to_le32(cayman_vs[i]); | ||
690 | for (i = 0; i < cayman_ps_size; i++) | ||
691 | *(u32 *)((unsigned long)ptr + rdev->r600_blit.ps_offset + i * 4) = cpu_to_le32(cayman_ps[i]); | ||
692 | } | ||
612 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); | 693 | radeon_bo_kunmap(rdev->r600_blit.shader_obj); |
613 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | 694 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
614 | 695 | ||
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index f37e91ee8a11..1636e3449825 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -168,10 +168,16 @@ | |||
168 | #define SE_DB_BUSY (1 << 30) | 168 | #define SE_DB_BUSY (1 << 30) |
169 | #define SE_CB_BUSY (1 << 31) | 169 | #define SE_CB_BUSY (1 << 31) |
170 | /* evergreen */ | 170 | /* evergreen */ |
171 | #define CG_THERMAL_CTRL 0x72c | ||
172 | #define TOFFSET_MASK 0x00003FE0 | ||
173 | #define TOFFSET_SHIFT 5 | ||
171 | #define CG_MULT_THERMAL_STATUS 0x740 | 174 | #define CG_MULT_THERMAL_STATUS 0x740 |
172 | #define ASIC_T(x) ((x) << 16) | 175 | #define ASIC_T(x) ((x) << 16) |
173 | #define ASIC_T_MASK 0x7FF0000 | 176 | #define ASIC_T_MASK 0x07FF0000 |
174 | #define ASIC_T_SHIFT 16 | 177 | #define ASIC_T_SHIFT 16 |
178 | #define CG_TS0_STATUS 0x760 | ||
179 | #define TS0_ADC_DOUT_MASK 0x000003FF | ||
180 | #define TS0_ADC_DOUT_SHIFT 0 | ||
175 | /* APU */ | 181 | /* APU */ |
176 | #define CG_THERMAL_STATUS 0x678 | 182 | #define CG_THERMAL_STATUS 0x678 |
177 | 183 | ||
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index b205ba1cdd8f..16caafeadf5e 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1387,14 +1387,12 @@ static int cayman_startup(struct radeon_device *rdev) | |||
1387 | return r; | 1387 | return r; |
1388 | cayman_gpu_init(rdev); | 1388 | cayman_gpu_init(rdev); |
1389 | 1389 | ||
1390 | #if 0 | 1390 | r = evergreen_blit_init(rdev); |
1391 | r = cayman_blit_init(rdev); | ||
1392 | if (r) { | 1391 | if (r) { |
1393 | cayman_blit_fini(rdev); | 1392 | evergreen_blit_fini(rdev); |
1394 | rdev->asic->copy = NULL; | 1393 | rdev->asic->copy = NULL; |
1395 | dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r); | 1394 | dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r); |
1396 | } | 1395 | } |
1397 | #endif | ||
1398 | 1396 | ||
1399 | /* allocate wb buffer */ | 1397 | /* allocate wb buffer */ |
1400 | r = radeon_wb_init(rdev); | 1398 | r = radeon_wb_init(rdev); |
@@ -1452,7 +1450,7 @@ int cayman_resume(struct radeon_device *rdev) | |||
1452 | 1450 | ||
1453 | int cayman_suspend(struct radeon_device *rdev) | 1451 | int cayman_suspend(struct radeon_device *rdev) |
1454 | { | 1452 | { |
1455 | /* int r; */ | 1453 | int r; |
1456 | 1454 | ||
1457 | /* FIXME: we should wait for ring to be empty */ | 1455 | /* FIXME: we should wait for ring to be empty */ |
1458 | cayman_cp_enable(rdev, false); | 1456 | cayman_cp_enable(rdev, false); |
@@ -1461,14 +1459,13 @@ int cayman_suspend(struct radeon_device *rdev) | |||
1461 | radeon_wb_disable(rdev); | 1459 | radeon_wb_disable(rdev); |
1462 | cayman_pcie_gart_disable(rdev); | 1460 | cayman_pcie_gart_disable(rdev); |
1463 | 1461 | ||
1464 | #if 0 | ||
1465 | /* unpin shaders bo */ | 1462 | /* unpin shaders bo */ |
1466 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); | 1463 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); |
1467 | if (likely(r == 0)) { | 1464 | if (likely(r == 0)) { |
1468 | radeon_bo_unpin(rdev->r600_blit.shader_obj); | 1465 | radeon_bo_unpin(rdev->r600_blit.shader_obj); |
1469 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | 1466 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
1470 | } | 1467 | } |
1471 | #endif | 1468 | |
1472 | return 0; | 1469 | return 0; |
1473 | } | 1470 | } |
1474 | 1471 | ||
@@ -1580,7 +1577,7 @@ int cayman_init(struct radeon_device *rdev) | |||
1580 | 1577 | ||
1581 | void cayman_fini(struct radeon_device *rdev) | 1578 | void cayman_fini(struct radeon_device *rdev) |
1582 | { | 1579 | { |
1583 | /* cayman_blit_fini(rdev); */ | 1580 | evergreen_blit_fini(rdev); |
1584 | cayman_cp_fini(rdev); | 1581 | cayman_cp_fini(rdev); |
1585 | r600_irq_fini(rdev); | 1582 | r600_irq_fini(rdev); |
1586 | radeon_wb_fini(rdev); | 1583 | radeon_wb_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h index 2fef9de7f363..686f9dc5d4bd 100644 --- a/drivers/gpu/drm/radeon/r100_track.h +++ b/drivers/gpu/drm/radeon/r100_track.h | |||
@@ -63,7 +63,7 @@ struct r100_cs_track { | |||
63 | unsigned num_arrays; | 63 | unsigned num_arrays; |
64 | unsigned max_indx; | 64 | unsigned max_indx; |
65 | unsigned color_channel_mask; | 65 | unsigned color_channel_mask; |
66 | struct r100_cs_track_array arrays[11]; | 66 | struct r100_cs_track_array arrays[16]; |
67 | struct r100_cs_track_cb cb[R300_MAX_CB]; | 67 | struct r100_cs_track_cb cb[R300_MAX_CB]; |
68 | struct r100_cs_track_cb zb; | 68 | struct r100_cs_track_cb zb; |
69 | struct r100_cs_track_cb aa; | 69 | struct r100_cs_track_cb aa; |
@@ -146,6 +146,12 @@ static inline int r100_packet3_load_vbpntr(struct radeon_cs_parser *p, | |||
146 | ib = p->ib->ptr; | 146 | ib = p->ib->ptr; |
147 | track = (struct r100_cs_track *)p->track; | 147 | track = (struct r100_cs_track *)p->track; |
148 | c = radeon_get_ib_value(p, idx++) & 0x1F; | 148 | c = radeon_get_ib_value(p, idx++) & 0x1F; |
149 | if (c > 16) { | ||
150 | DRM_ERROR("Only 16 vertex buffers are allowed %d\n", | ||
151 | pkt->opcode); | ||
152 | r100_cs_dump_packet(p, pkt); | ||
153 | return -EINVAL; | ||
154 | } | ||
149 | track->num_arrays = c; | 155 | track->num_arrays = c; |
150 | for (i = 0; i < (c - 1); i+=2, idx+=3) { | 156 | for (i = 0; i < (c - 1); i+=2, idx+=3) { |
151 | r = r100_cs_packet_next_reloc(p, &reloc); | 157 | r = r100_cs_packet_next_reloc(p, &reloc); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 6f27593901c7..f79d2ccb6755 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -87,6 +87,10 @@ MODULE_FIRMWARE("radeon/CYPRESS_rlc.bin"); | |||
87 | MODULE_FIRMWARE("radeon/PALM_pfp.bin"); | 87 | MODULE_FIRMWARE("radeon/PALM_pfp.bin"); |
88 | MODULE_FIRMWARE("radeon/PALM_me.bin"); | 88 | MODULE_FIRMWARE("radeon/PALM_me.bin"); |
89 | MODULE_FIRMWARE("radeon/SUMO_rlc.bin"); | 89 | MODULE_FIRMWARE("radeon/SUMO_rlc.bin"); |
90 | MODULE_FIRMWARE("radeon/SUMO_pfp.bin"); | ||
91 | MODULE_FIRMWARE("radeon/SUMO_me.bin"); | ||
92 | MODULE_FIRMWARE("radeon/SUMO2_pfp.bin"); | ||
93 | MODULE_FIRMWARE("radeon/SUMO2_me.bin"); | ||
90 | 94 | ||
91 | int r600_debugfs_mc_info_init(struct radeon_device *rdev); | 95 | int r600_debugfs_mc_info_init(struct radeon_device *rdev); |
92 | 96 | ||
@@ -586,6 +590,9 @@ void r600_pm_misc(struct radeon_device *rdev) | |||
586 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | 590 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; |
587 | 591 | ||
588 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 592 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
593 | /* 0xff01 is a flag rather then an actual voltage */ | ||
594 | if (voltage->voltage == 0xff01) | ||
595 | return; | ||
589 | if (voltage->voltage != rdev->pm.current_vddc) { | 596 | if (voltage->voltage != rdev->pm.current_vddc) { |
590 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); | 597 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
591 | rdev->pm.current_vddc = voltage->voltage; | 598 | rdev->pm.current_vddc = voltage->voltage; |
@@ -2024,6 +2031,14 @@ int r600_init_microcode(struct radeon_device *rdev) | |||
2024 | chip_name = "PALM"; | 2031 | chip_name = "PALM"; |
2025 | rlc_chip_name = "SUMO"; | 2032 | rlc_chip_name = "SUMO"; |
2026 | break; | 2033 | break; |
2034 | case CHIP_SUMO: | ||
2035 | chip_name = "SUMO"; | ||
2036 | rlc_chip_name = "SUMO"; | ||
2037 | break; | ||
2038 | case CHIP_SUMO2: | ||
2039 | chip_name = "SUMO2"; | ||
2040 | rlc_chip_name = "SUMO"; | ||
2041 | break; | ||
2027 | default: BUG(); | 2042 | default: BUG(); |
2028 | } | 2043 | } |
2029 | 2044 | ||
@@ -3282,27 +3297,26 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
3282 | 3297 | ||
3283 | int r600_irq_process(struct radeon_device *rdev) | 3298 | int r600_irq_process(struct radeon_device *rdev) |
3284 | { | 3299 | { |
3285 | u32 wptr = r600_get_ih_wptr(rdev); | 3300 | u32 wptr; |
3286 | u32 rptr = rdev->ih.rptr; | 3301 | u32 rptr; |
3287 | u32 src_id, src_data; | 3302 | u32 src_id, src_data; |
3288 | u32 ring_index; | 3303 | u32 ring_index; |
3289 | unsigned long flags; | 3304 | unsigned long flags; |
3290 | bool queue_hotplug = false; | 3305 | bool queue_hotplug = false; |
3291 | 3306 | ||
3292 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | 3307 | if (!rdev->ih.enabled || rdev->shutdown) |
3293 | if (!rdev->ih.enabled) | ||
3294 | return IRQ_NONE; | 3308 | return IRQ_NONE; |
3295 | 3309 | ||
3310 | wptr = r600_get_ih_wptr(rdev); | ||
3311 | rptr = rdev->ih.rptr; | ||
3312 | DRM_DEBUG("r600_irq_process start: rptr %d, wptr %d\n", rptr, wptr); | ||
3313 | |||
3296 | spin_lock_irqsave(&rdev->ih.lock, flags); | 3314 | spin_lock_irqsave(&rdev->ih.lock, flags); |
3297 | 3315 | ||
3298 | if (rptr == wptr) { | 3316 | if (rptr == wptr) { |
3299 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | 3317 | spin_unlock_irqrestore(&rdev->ih.lock, flags); |
3300 | return IRQ_NONE; | 3318 | return IRQ_NONE; |
3301 | } | 3319 | } |
3302 | if (rdev->shutdown) { | ||
3303 | spin_unlock_irqrestore(&rdev->ih.lock, flags); | ||
3304 | return IRQ_NONE; | ||
3305 | } | ||
3306 | 3320 | ||
3307 | restart_ih: | 3321 | restart_ih: |
3308 | /* display interrupts */ | 3322 | /* display interrupts */ |
@@ -3432,7 +3446,7 @@ restart_ih: | |||
3432 | radeon_fence_process(rdev); | 3446 | radeon_fence_process(rdev); |
3433 | break; | 3447 | break; |
3434 | case 233: /* GUI IDLE */ | 3448 | case 233: /* GUI IDLE */ |
3435 | DRM_DEBUG("IH: CP EOP\n"); | 3449 | DRM_DEBUG("IH: GUI idle\n"); |
3436 | rdev->pm.gui_idle = true; | 3450 | rdev->pm.gui_idle = true; |
3437 | wake_up(&rdev->irq.idle_queue); | 3451 | wake_up(&rdev->irq.idle_queue); |
3438 | break; | 3452 | break; |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index fd18be9871ab..909bda8dd550 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -71,20 +71,21 @@ struct r600_cs_track { | |||
71 | u64 db_bo_mc; | 71 | u64 db_bo_mc; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | #define FMT_8_BIT(fmt, vc) [fmt] = { 1, 1, 1, vc } | 74 | #define FMT_8_BIT(fmt, vc) [fmt] = { 1, 1, 1, vc, CHIP_R600 } |
75 | #define FMT_16_BIT(fmt, vc) [fmt] = { 1, 1, 2, vc } | 75 | #define FMT_16_BIT(fmt, vc) [fmt] = { 1, 1, 2, vc, CHIP_R600 } |
76 | #define FMT_24_BIT(fmt) [fmt] = { 1, 1, 3, 0 } | 76 | #define FMT_24_BIT(fmt) [fmt] = { 1, 1, 3, 0, CHIP_R600 } |
77 | #define FMT_32_BIT(fmt, vc) [fmt] = { 1, 1, 4, vc } | 77 | #define FMT_32_BIT(fmt, vc) [fmt] = { 1, 1, 4, vc, CHIP_R600 } |
78 | #define FMT_48_BIT(fmt) [fmt] = { 1, 1, 6, 0 } | 78 | #define FMT_48_BIT(fmt) [fmt] = { 1, 1, 6, 0, CHIP_R600 } |
79 | #define FMT_64_BIT(fmt, vc) [fmt] = { 1, 1, 8, vc } | 79 | #define FMT_64_BIT(fmt, vc) [fmt] = { 1, 1, 8, vc, CHIP_R600 } |
80 | #define FMT_96_BIT(fmt) [fmt] = { 1, 1, 12, 0 } | 80 | #define FMT_96_BIT(fmt) [fmt] = { 1, 1, 12, 0, CHIP_R600 } |
81 | #define FMT_128_BIT(fmt, vc) [fmt] = { 1, 1, 16, vc } | 81 | #define FMT_128_BIT(fmt, vc) [fmt] = { 1, 1, 16,vc, CHIP_R600 } |
82 | 82 | ||
83 | struct gpu_formats { | 83 | struct gpu_formats { |
84 | unsigned blockwidth; | 84 | unsigned blockwidth; |
85 | unsigned blockheight; | 85 | unsigned blockheight; |
86 | unsigned blocksize; | 86 | unsigned blocksize; |
87 | unsigned valid_color; | 87 | unsigned valid_color; |
88 | enum radeon_family min_family; | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | static const struct gpu_formats color_formats_table[] = { | 91 | static const struct gpu_formats color_formats_table[] = { |
@@ -154,7 +155,11 @@ static const struct gpu_formats color_formats_table[] = { | |||
154 | [V_038004_FMT_BC3] = { 4, 4, 16, 0 }, | 155 | [V_038004_FMT_BC3] = { 4, 4, 16, 0 }, |
155 | [V_038004_FMT_BC4] = { 4, 4, 8, 0 }, | 156 | [V_038004_FMT_BC4] = { 4, 4, 8, 0 }, |
156 | [V_038004_FMT_BC5] = { 4, 4, 16, 0}, | 157 | [V_038004_FMT_BC5] = { 4, 4, 16, 0}, |
158 | [V_038004_FMT_BC6] = { 4, 4, 16, 0, CHIP_CEDAR}, /* Evergreen-only */ | ||
159 | [V_038004_FMT_BC7] = { 4, 4, 16, 0, CHIP_CEDAR}, /* Evergreen-only */ | ||
157 | 160 | ||
161 | /* The other Evergreen formats */ | ||
162 | [V_038004_FMT_32_AS_32_32_32_32] = { 1, 1, 4, 0, CHIP_CEDAR}, | ||
158 | }; | 163 | }; |
159 | 164 | ||
160 | static inline bool fmt_is_valid_color(u32 format) | 165 | static inline bool fmt_is_valid_color(u32 format) |
@@ -168,11 +173,14 @@ static inline bool fmt_is_valid_color(u32 format) | |||
168 | return false; | 173 | return false; |
169 | } | 174 | } |
170 | 175 | ||
171 | static inline bool fmt_is_valid_texture(u32 format) | 176 | static inline bool fmt_is_valid_texture(u32 format, enum radeon_family family) |
172 | { | 177 | { |
173 | if (format >= ARRAY_SIZE(color_formats_table)) | 178 | if (format >= ARRAY_SIZE(color_formats_table)) |
174 | return false; | 179 | return false; |
175 | 180 | ||
181 | if (family < color_formats_table[format].min_family) | ||
182 | return false; | ||
183 | |||
176 | if (color_formats_table[format].blockwidth > 0) | 184 | if (color_formats_table[format].blockwidth > 0) |
177 | return true; | 185 | return true; |
178 | 186 | ||
@@ -1325,7 +1333,7 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i | |||
1325 | return -EINVAL; | 1333 | return -EINVAL; |
1326 | } | 1334 | } |
1327 | format = G_038004_DATA_FORMAT(word1); | 1335 | format = G_038004_DATA_FORMAT(word1); |
1328 | if (!fmt_is_valid_texture(format)) { | 1336 | if (!fmt_is_valid_texture(format, p->family)) { |
1329 | dev_warn(p->dev, "%s:%d texture invalid format %d\n", | 1337 | dev_warn(p->dev, "%s:%d texture invalid format %d\n", |
1330 | __func__, __LINE__, format); | 1338 | __func__, __LINE__, format); |
1331 | return -EINVAL; | 1339 | return -EINVAL; |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index b2b944bcd05a..f140a0d5cb54 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -1309,6 +1309,9 @@ | |||
1309 | #define V_038004_FMT_BC3 0x00000033 | 1309 | #define V_038004_FMT_BC3 0x00000033 |
1310 | #define V_038004_FMT_BC4 0x00000034 | 1310 | #define V_038004_FMT_BC4 0x00000034 |
1311 | #define V_038004_FMT_BC5 0x00000035 | 1311 | #define V_038004_FMT_BC5 0x00000035 |
1312 | #define V_038004_FMT_BC6 0x00000036 | ||
1313 | #define V_038004_FMT_BC7 0x00000037 | ||
1314 | #define V_038004_FMT_32_AS_32_32_32_32 0x00000038 | ||
1312 | #define R_038010_SQ_TEX_RESOURCE_WORD4_0 0x038010 | 1315 | #define R_038010_SQ_TEX_RESOURCE_WORD4_0 0x038010 |
1313 | #define S_038010_FORMAT_COMP_X(x) (((x) & 0x3) << 0) | 1316 | #define S_038010_FORMAT_COMP_X(x) (((x) & 0x3) << 0) |
1314 | #define G_038010_FORMAT_COMP_X(x) (((x) >> 0) & 0x3) | 1317 | #define G_038010_FORMAT_COMP_X(x) (((x) >> 0) & 0x3) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index ba643b576054..27f45579e64b 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -165,6 +165,7 @@ struct radeon_clock { | |||
165 | uint32_t default_sclk; | 165 | uint32_t default_sclk; |
166 | uint32_t default_dispclk; | 166 | uint32_t default_dispclk; |
167 | uint32_t dp_extclk; | 167 | uint32_t dp_extclk; |
168 | uint32_t max_pixel_clock; | ||
168 | }; | 169 | }; |
169 | 170 | ||
170 | /* | 171 | /* |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index d948265db87e..b2449629537d 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -906,9 +906,9 @@ static struct radeon_asic cayman_asic = { | |||
906 | .get_vblank_counter = &evergreen_get_vblank_counter, | 906 | .get_vblank_counter = &evergreen_get_vblank_counter, |
907 | .fence_ring_emit = &r600_fence_ring_emit, | 907 | .fence_ring_emit = &r600_fence_ring_emit, |
908 | .cs_parse = &evergreen_cs_parse, | 908 | .cs_parse = &evergreen_cs_parse, |
909 | .copy_blit = NULL, | 909 | .copy_blit = &evergreen_copy_blit, |
910 | .copy_dma = NULL, | 910 | .copy_dma = &evergreen_copy_blit, |
911 | .copy = NULL, | 911 | .copy = &evergreen_copy_blit, |
912 | .get_engine_clock = &radeon_atom_get_engine_clock, | 912 | .get_engine_clock = &radeon_atom_get_engine_clock, |
913 | .set_engine_clock = &radeon_atom_set_engine_clock, | 913 | .set_engine_clock = &radeon_atom_set_engine_clock, |
914 | .get_memory_clock = &radeon_atom_get_memory_clock, | 914 | .get_memory_clock = &radeon_atom_get_memory_clock, |
@@ -938,6 +938,13 @@ static struct radeon_asic cayman_asic = { | |||
938 | int radeon_asic_init(struct radeon_device *rdev) | 938 | int radeon_asic_init(struct radeon_device *rdev) |
939 | { | 939 | { |
940 | radeon_register_accessor_init(rdev); | 940 | radeon_register_accessor_init(rdev); |
941 | |||
942 | /* set the number of crtcs */ | ||
943 | if (rdev->flags & RADEON_SINGLE_CRTC) | ||
944 | rdev->num_crtc = 1; | ||
945 | else | ||
946 | rdev->num_crtc = 2; | ||
947 | |||
941 | switch (rdev->family) { | 948 | switch (rdev->family) { |
942 | case CHIP_R100: | 949 | case CHIP_R100: |
943 | case CHIP_RV100: | 950 | case CHIP_RV100: |
@@ -1017,18 +1024,32 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1017 | case CHIP_JUNIPER: | 1024 | case CHIP_JUNIPER: |
1018 | case CHIP_CYPRESS: | 1025 | case CHIP_CYPRESS: |
1019 | case CHIP_HEMLOCK: | 1026 | case CHIP_HEMLOCK: |
1027 | /* set num crtcs */ | ||
1028 | if (rdev->family == CHIP_CEDAR) | ||
1029 | rdev->num_crtc = 4; | ||
1030 | else | ||
1031 | rdev->num_crtc = 6; | ||
1020 | rdev->asic = &evergreen_asic; | 1032 | rdev->asic = &evergreen_asic; |
1021 | break; | 1033 | break; |
1022 | case CHIP_PALM: | 1034 | case CHIP_PALM: |
1035 | case CHIP_SUMO: | ||
1036 | case CHIP_SUMO2: | ||
1023 | rdev->asic = &sumo_asic; | 1037 | rdev->asic = &sumo_asic; |
1024 | break; | 1038 | break; |
1025 | case CHIP_BARTS: | 1039 | case CHIP_BARTS: |
1026 | case CHIP_TURKS: | 1040 | case CHIP_TURKS: |
1027 | case CHIP_CAICOS: | 1041 | case CHIP_CAICOS: |
1042 | /* set num crtcs */ | ||
1043 | if (rdev->family == CHIP_CAICOS) | ||
1044 | rdev->num_crtc = 4; | ||
1045 | else | ||
1046 | rdev->num_crtc = 6; | ||
1028 | rdev->asic = &btc_asic; | 1047 | rdev->asic = &btc_asic; |
1029 | break; | 1048 | break; |
1030 | case CHIP_CAYMAN: | 1049 | case CHIP_CAYMAN: |
1031 | rdev->asic = &cayman_asic; | 1050 | rdev->asic = &cayman_asic; |
1051 | /* set num crtcs */ | ||
1052 | rdev->num_crtc = 6; | ||
1032 | break; | 1053 | break; |
1033 | default: | 1054 | default: |
1034 | /* FIXME: not supported yet */ | 1055 | /* FIXME: not supported yet */ |
@@ -1040,18 +1061,6 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
1040 | rdev->asic->set_memory_clock = NULL; | 1061 | rdev->asic->set_memory_clock = NULL; |
1041 | } | 1062 | } |
1042 | 1063 | ||
1043 | /* set the number of crtcs */ | ||
1044 | if (rdev->flags & RADEON_SINGLE_CRTC) | ||
1045 | rdev->num_crtc = 1; | ||
1046 | else { | ||
1047 | if (ASIC_IS_DCE41(rdev)) | ||
1048 | rdev->num_crtc = 2; | ||
1049 | else if (ASIC_IS_DCE4(rdev)) | ||
1050 | rdev->num_crtc = 6; | ||
1051 | else | ||
1052 | rdev->num_crtc = 2; | ||
1053 | } | ||
1054 | |||
1055 | return 0; | 1064 | return 0; |
1056 | } | 1065 | } |
1057 | 1066 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 90dfb2b8cf03..1e725d9f767f 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -1246,6 +1246,10 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
1246 | } | 1246 | } |
1247 | *dcpll = *p1pll; | 1247 | *dcpll = *p1pll; |
1248 | 1248 | ||
1249 | rdev->clock.max_pixel_clock = le16_to_cpu(firmware_info->info.usMaxPixelClock); | ||
1250 | if (rdev->clock.max_pixel_clock == 0) | ||
1251 | rdev->clock.max_pixel_clock = 40000; | ||
1252 | |||
1249 | return true; | 1253 | return true; |
1250 | } | 1254 | } |
1251 | 1255 | ||
@@ -2603,6 +2607,10 @@ void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 v | |||
2603 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | 2607 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) |
2604 | return; | 2608 | return; |
2605 | 2609 | ||
2610 | /* 0xff01 is a flag rather then an actual voltage */ | ||
2611 | if (voltage_level == 0xff01) | ||
2612 | return; | ||
2613 | |||
2606 | switch (crev) { | 2614 | switch (crev) { |
2607 | case 1: | 2615 | case 1: |
2608 | args.v1.ucVoltageType = voltage_type; | 2616 | args.v1.ucVoltageType = voltage_type; |
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index 5249af8931e6..2d48e7a1474b 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
@@ -117,7 +117,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
117 | p1pll->reference_div = RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff; | 117 | p1pll->reference_div = RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff; |
118 | if (p1pll->reference_div < 2) | 118 | if (p1pll->reference_div < 2) |
119 | p1pll->reference_div = 12; | 119 | p1pll->reference_div = 12; |
120 | p2pll->reference_div = p1pll->reference_div; | 120 | p2pll->reference_div = p1pll->reference_div; |
121 | 121 | ||
122 | /* These aren't in the device-tree */ | 122 | /* These aren't in the device-tree */ |
123 | if (rdev->family >= CHIP_R420) { | 123 | if (rdev->family >= CHIP_R420) { |
@@ -139,6 +139,8 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
139 | p2pll->pll_out_min = 12500; | 139 | p2pll->pll_out_min = 12500; |
140 | p2pll->pll_out_max = 35000; | 140 | p2pll->pll_out_max = 35000; |
141 | } | 141 | } |
142 | /* not sure what the max should be in all cases */ | ||
143 | rdev->clock.max_pixel_clock = 35000; | ||
142 | 144 | ||
143 | spll->reference_freq = mpll->reference_freq = p1pll->reference_freq; | 145 | spll->reference_freq = mpll->reference_freq = p1pll->reference_freq; |
144 | spll->reference_div = mpll->reference_div = | 146 | spll->reference_div = mpll->reference_div = |
@@ -151,7 +153,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
151 | else | 153 | else |
152 | rdev->clock.default_sclk = | 154 | rdev->clock.default_sclk = |
153 | radeon_legacy_get_engine_clock(rdev); | 155 | radeon_legacy_get_engine_clock(rdev); |
154 | 156 | ||
155 | val = of_get_property(dp, "ATY,MCLK", NULL); | 157 | val = of_get_property(dp, "ATY,MCLK", NULL); |
156 | if (val && *val) | 158 | if (val && *val) |
157 | rdev->clock.default_mclk = (*val) / 10; | 159 | rdev->clock.default_mclk = (*val) / 10; |
@@ -160,7 +162,7 @@ static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | |||
160 | radeon_legacy_get_memory_clock(rdev); | 162 | radeon_legacy_get_memory_clock(rdev); |
161 | 163 | ||
162 | DRM_INFO("Using device-tree clock info\n"); | 164 | DRM_INFO("Using device-tree clock info\n"); |
163 | 165 | ||
164 | return true; | 166 | return true; |
165 | } | 167 | } |
166 | #else | 168 | #else |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 5b991f7c6e2a..e4594676a07c 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -866,6 +866,11 @@ bool radeon_combios_get_clock_info(struct drm_device *dev) | |||
866 | rdev->clock.default_sclk = sclk; | 866 | rdev->clock.default_sclk = sclk; |
867 | rdev->clock.default_mclk = mclk; | 867 | rdev->clock.default_mclk = mclk; |
868 | 868 | ||
869 | if (RBIOS32(pll_info + 0x16)) | ||
870 | rdev->clock.max_pixel_clock = RBIOS32(pll_info + 0x16); | ||
871 | else | ||
872 | rdev->clock.max_pixel_clock = 35000; /* might need something asic specific */ | ||
873 | |||
869 | return true; | 874 | return true; |
870 | } | 875 | } |
871 | return false; | 876 | return false; |
@@ -1548,10 +1553,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1548 | (rdev->pdev->subsystem_device == 0x4a48)) { | 1553 | (rdev->pdev->subsystem_device == 0x4a48)) { |
1549 | /* Mac X800 */ | 1554 | /* Mac X800 */ |
1550 | rdev->mode_info.connector_table = CT_MAC_X800; | 1555 | rdev->mode_info.connector_table = CT_MAC_X800; |
1551 | } else if ((rdev->pdev->device == 0x4150) && | 1556 | } else if ((of_machine_is_compatible("PowerMac7,2") || |
1557 | of_machine_is_compatible("PowerMac7,3")) && | ||
1558 | (rdev->pdev->device == 0x4150) && | ||
1552 | (rdev->pdev->subsystem_vendor == 0x1002) && | 1559 | (rdev->pdev->subsystem_vendor == 0x1002) && |
1553 | (rdev->pdev->subsystem_device == 0x4150)) { | 1560 | (rdev->pdev->subsystem_device == 0x4150)) { |
1554 | /* Mac G5 9600 */ | 1561 | /* Mac G5 tower 9600 */ |
1555 | rdev->mode_info.connector_table = CT_MAC_G5_9600; | 1562 | rdev->mode_info.connector_table = CT_MAC_G5_9600; |
1556 | } else | 1563 | } else |
1557 | #endif /* CONFIG_PPC_PMAC */ | 1564 | #endif /* CONFIG_PPC_PMAC */ |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index ee1dccb3fec9..cbfca3a24fdf 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -44,6 +44,8 @@ extern void | |||
44 | radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, | 44 | radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, |
45 | struct drm_connector *drm_connector); | 45 | struct drm_connector *drm_connector); |
46 | 46 | ||
47 | bool radeon_connector_encoder_is_dp_bridge(struct drm_connector *connector); | ||
48 | |||
47 | void radeon_connector_hotplug(struct drm_connector *connector) | 49 | void radeon_connector_hotplug(struct drm_connector *connector) |
48 | { | 50 | { |
49 | struct drm_device *dev = connector->dev; | 51 | struct drm_device *dev = connector->dev; |
@@ -626,8 +628,14 @@ static int radeon_vga_get_modes(struct drm_connector *connector) | |||
626 | static int radeon_vga_mode_valid(struct drm_connector *connector, | 628 | static int radeon_vga_mode_valid(struct drm_connector *connector, |
627 | struct drm_display_mode *mode) | 629 | struct drm_display_mode *mode) |
628 | { | 630 | { |
631 | struct drm_device *dev = connector->dev; | ||
632 | struct radeon_device *rdev = dev->dev_private; | ||
633 | |||
629 | /* XXX check mode bandwidth */ | 634 | /* XXX check mode bandwidth */ |
630 | /* XXX verify against max DAC output frequency */ | 635 | |
636 | if ((mode->clock / 10) > rdev->clock.max_pixel_clock) | ||
637 | return MODE_CLOCK_HIGH; | ||
638 | |||
631 | return MODE_OK; | 639 | return MODE_OK; |
632 | } | 640 | } |
633 | 641 | ||
@@ -830,6 +838,13 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
830 | if (!radeon_connector->edid) { | 838 | if (!radeon_connector->edid) { |
831 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", | 839 | DRM_ERROR("%s: probed a monitor but no|invalid EDID\n", |
832 | drm_get_connector_name(connector)); | 840 | drm_get_connector_name(connector)); |
841 | /* rs690 seems to have a problem with connectors not existing and always | ||
842 | * return a block of 0's. If we see this just stop polling on this output */ | ||
843 | if ((rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) && radeon_connector->base.null_edid_counter) { | ||
844 | ret = connector_status_disconnected; | ||
845 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); | ||
846 | radeon_connector->ddc_bus = NULL; | ||
847 | } | ||
833 | } else { | 848 | } else { |
834 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); | 849 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
835 | 850 | ||
@@ -1015,6 +1030,11 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector, | |||
1015 | } else | 1030 | } else |
1016 | return MODE_CLOCK_HIGH; | 1031 | return MODE_CLOCK_HIGH; |
1017 | } | 1032 | } |
1033 | |||
1034 | /* check against the max pixel clock */ | ||
1035 | if ((mode->clock / 10) > rdev->clock.max_pixel_clock) | ||
1036 | return MODE_CLOCK_HIGH; | ||
1037 | |||
1018 | return MODE_OK; | 1038 | return MODE_OK; |
1019 | } | 1039 | } |
1020 | 1040 | ||
@@ -1052,10 +1072,11 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1052 | { | 1072 | { |
1053 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1073 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1054 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | 1074 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
1075 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
1055 | int ret; | 1076 | int ret; |
1056 | 1077 | ||
1057 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1078 | if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) || |
1058 | struct drm_encoder *encoder; | 1079 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { |
1059 | struct drm_display_mode *mode; | 1080 | struct drm_display_mode *mode; |
1060 | 1081 | ||
1061 | if (!radeon_dig_connector->edp_on) | 1082 | if (!radeon_dig_connector->edp_on) |
@@ -1067,7 +1088,6 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1067 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | 1088 | ATOM_TRANSMITTER_ACTION_POWER_OFF); |
1068 | 1089 | ||
1069 | if (ret > 0) { | 1090 | if (ret > 0) { |
1070 | encoder = radeon_best_single_encoder(connector); | ||
1071 | if (encoder) { | 1091 | if (encoder) { |
1072 | radeon_fixup_lvds_native_mode(encoder, connector); | 1092 | radeon_fixup_lvds_native_mode(encoder, connector); |
1073 | /* add scaled modes */ | 1093 | /* add scaled modes */ |
@@ -1091,8 +1111,14 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
1091 | /* add scaled modes */ | 1111 | /* add scaled modes */ |
1092 | radeon_add_common_modes(encoder, connector); | 1112 | radeon_add_common_modes(encoder, connector); |
1093 | } | 1113 | } |
1094 | } else | 1114 | } else { |
1115 | /* need to setup ddc on the bridge */ | ||
1116 | if (radeon_connector_encoder_is_dp_bridge(connector)) { | ||
1117 | if (encoder) | ||
1118 | radeon_atom_ext_encoder_setup_ddc(encoder); | ||
1119 | } | ||
1095 | ret = radeon_ddc_get_modes(radeon_connector); | 1120 | ret = radeon_ddc_get_modes(radeon_connector); |
1121 | } | ||
1096 | 1122 | ||
1097 | return ret; | 1123 | return ret; |
1098 | } | 1124 | } |
@@ -1176,14 +1202,15 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1176 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1202 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1177 | enum drm_connector_status ret = connector_status_disconnected; | 1203 | enum drm_connector_status ret = connector_status_disconnected; |
1178 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | 1204 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
1205 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
1179 | 1206 | ||
1180 | if (radeon_connector->edid) { | 1207 | if (radeon_connector->edid) { |
1181 | kfree(radeon_connector->edid); | 1208 | kfree(radeon_connector->edid); |
1182 | radeon_connector->edid = NULL; | 1209 | radeon_connector->edid = NULL; |
1183 | } | 1210 | } |
1184 | 1211 | ||
1185 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1212 | if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) || |
1186 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | 1213 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { |
1187 | if (encoder) { | 1214 | if (encoder) { |
1188 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1215 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1189 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; | 1216 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
@@ -1203,6 +1230,11 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1203 | atombios_set_edp_panel_power(connector, | 1230 | atombios_set_edp_panel_power(connector, |
1204 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | 1231 | ATOM_TRANSMITTER_ACTION_POWER_OFF); |
1205 | } else { | 1232 | } else { |
1233 | /* need to setup ddc on the bridge */ | ||
1234 | if (radeon_connector_encoder_is_dp_bridge(connector)) { | ||
1235 | if (encoder) | ||
1236 | radeon_atom_ext_encoder_setup_ddc(encoder); | ||
1237 | } | ||
1206 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); | 1238 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); |
1207 | if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { | 1239 | if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { |
1208 | ret = connector_status_connected; | 1240 | ret = connector_status_connected; |
@@ -1217,6 +1249,16 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
1217 | ret = connector_status_connected; | 1249 | ret = connector_status_connected; |
1218 | } | 1250 | } |
1219 | } | 1251 | } |
1252 | |||
1253 | if ((ret == connector_status_disconnected) && | ||
1254 | radeon_connector->dac_load_detect) { | ||
1255 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | ||
1256 | struct drm_encoder_helper_funcs *encoder_funcs; | ||
1257 | if (encoder) { | ||
1258 | encoder_funcs = encoder->helper_private; | ||
1259 | ret = encoder_funcs->detect(encoder, connector); | ||
1260 | } | ||
1261 | } | ||
1220 | } | 1262 | } |
1221 | 1263 | ||
1222 | radeon_connector_update_scratch_regs(connector, ret); | 1264 | radeon_connector_update_scratch_regs(connector, ret); |
@@ -1231,7 +1273,8 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
1231 | 1273 | ||
1232 | /* XXX check mode bandwidth */ | 1274 | /* XXX check mode bandwidth */ |
1233 | 1275 | ||
1234 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1276 | if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) || |
1277 | (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { | ||
1235 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | 1278 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
1236 | 1279 | ||
1237 | if ((mode->hdisplay < 320) || (mode->vdisplay < 240)) | 1280 | if ((mode->hdisplay < 320) || (mode->vdisplay < 240)) |
@@ -1241,7 +1284,7 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
1241 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1284 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1242 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; | 1285 | struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
1243 | 1286 | ||
1244 | /* AVIVO hardware supports downscaling modes larger than the panel | 1287 | /* AVIVO hardware supports downscaling modes larger than the panel |
1245 | * to the panel size, but I'm not sure this is desirable. | 1288 | * to the panel size, but I'm not sure this is desirable. |
1246 | */ | 1289 | */ |
1247 | if ((mode->hdisplay > native_mode->hdisplay) || | 1290 | if ((mode->hdisplay > native_mode->hdisplay) || |
@@ -1390,6 +1433,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1390 | default: | 1433 | default: |
1391 | connector->interlace_allowed = true; | 1434 | connector->interlace_allowed = true; |
1392 | connector->doublescan_allowed = true; | 1435 | connector->doublescan_allowed = true; |
1436 | radeon_connector->dac_load_detect = true; | ||
1437 | drm_connector_attach_property(&radeon_connector->base, | ||
1438 | rdev->mode_info.load_detect_property, | ||
1439 | 1); | ||
1393 | break; | 1440 | break; |
1394 | case DRM_MODE_CONNECTOR_DVII: | 1441 | case DRM_MODE_CONNECTOR_DVII: |
1395 | case DRM_MODE_CONNECTOR_DVID: | 1442 | case DRM_MODE_CONNECTOR_DVID: |
@@ -1411,6 +1458,12 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1411 | connector->doublescan_allowed = true; | 1458 | connector->doublescan_allowed = true; |
1412 | else | 1459 | else |
1413 | connector->doublescan_allowed = false; | 1460 | connector->doublescan_allowed = false; |
1461 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { | ||
1462 | radeon_connector->dac_load_detect = true; | ||
1463 | drm_connector_attach_property(&radeon_connector->base, | ||
1464 | rdev->mode_info.load_detect_property, | ||
1465 | 1); | ||
1466 | } | ||
1414 | break; | 1467 | break; |
1415 | case DRM_MODE_CONNECTOR_LVDS: | 1468 | case DRM_MODE_CONNECTOR_LVDS: |
1416 | case DRM_MODE_CONNECTOR_eDP: | 1469 | case DRM_MODE_CONNECTOR_eDP: |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 8c1916941871..fae00c0d75aa 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -228,6 +228,7 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
228 | parser.filp = filp; | 228 | parser.filp = filp; |
229 | parser.rdev = rdev; | 229 | parser.rdev = rdev; |
230 | parser.dev = rdev->dev; | 230 | parser.dev = rdev->dev; |
231 | parser.family = rdev->family; | ||
231 | r = radeon_cs_parser_init(&parser, data); | 232 | r = radeon_cs_parser_init(&parser, data); |
232 | if (r) { | 233 | if (r) { |
233 | DRM_ERROR("Failed to initialize parser !\n"); | 234 | DRM_ERROR("Failed to initialize parser !\n"); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 5b61364e31f4..7cfaa7e2f3b5 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -82,6 +82,8 @@ static const char radeon_family_name[][16] = { | |||
82 | "CYPRESS", | 82 | "CYPRESS", |
83 | "HEMLOCK", | 83 | "HEMLOCK", |
84 | "PALM", | 84 | "PALM", |
85 | "SUMO", | ||
86 | "SUMO2", | ||
85 | "BARTS", | 87 | "BARTS", |
86 | "TURKS", | 88 | "TURKS", |
87 | "CAICOS", | 89 | "CAICOS", |
@@ -213,6 +215,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
213 | return r; | 215 | return r; |
214 | } | 216 | } |
215 | 217 | ||
218 | /* clear wb memory */ | ||
219 | memset((char *)rdev->wb.wb, 0, RADEON_GPU_PAGE_SIZE); | ||
216 | /* disable event_write fences */ | 220 | /* disable event_write fences */ |
217 | rdev->wb.use_event = false; | 221 | rdev->wb.use_event = false; |
218 | /* disabled via module param */ | 222 | /* disabled via module param */ |
@@ -752,6 +756,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
752 | dma_bits = rdev->need_dma32 ? 32 : 40; | 756 | dma_bits = rdev->need_dma32 ? 32 : 40; |
753 | r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(dma_bits)); | 757 | r = pci_set_dma_mask(rdev->pdev, DMA_BIT_MASK(dma_bits)); |
754 | if (r) { | 758 | if (r) { |
759 | rdev->need_dma32 = true; | ||
755 | printk(KERN_WARNING "radeon: No suitable DMA available.\n"); | 760 | printk(KERN_WARNING "radeon: No suitable DMA available.\n"); |
756 | } | 761 | } |
757 | 762 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index ae247eec87c0..292f73f0ddbd 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -264,6 +264,8 @@ static void radeon_unpin_work_func(struct work_struct *__work) | |||
264 | radeon_bo_unreserve(work->old_rbo); | 264 | radeon_bo_unreserve(work->old_rbo); |
265 | } else | 265 | } else |
266 | DRM_ERROR("failed to reserve buffer after flip\n"); | 266 | DRM_ERROR("failed to reserve buffer after flip\n"); |
267 | |||
268 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | ||
267 | kfree(work); | 269 | kfree(work); |
268 | } | 270 | } |
269 | 271 | ||
@@ -371,6 +373,8 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
371 | new_radeon_fb = to_radeon_framebuffer(fb); | 373 | new_radeon_fb = to_radeon_framebuffer(fb); |
372 | /* schedule unpin of the old buffer */ | 374 | /* schedule unpin of the old buffer */ |
373 | obj = old_radeon_fb->obj; | 375 | obj = old_radeon_fb->obj; |
376 | /* take a reference to the old object */ | ||
377 | drm_gem_object_reference(obj); | ||
374 | rbo = gem_to_radeon_bo(obj); | 378 | rbo = gem_to_radeon_bo(obj); |
375 | work->old_rbo = rbo; | 379 | work->old_rbo = rbo; |
376 | INIT_WORK(&work->work, radeon_unpin_work_func); | 380 | INIT_WORK(&work->work, radeon_unpin_work_func); |
@@ -378,12 +382,9 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
378 | /* We borrow the event spin lock for protecting unpin_work */ | 382 | /* We borrow the event spin lock for protecting unpin_work */ |
379 | spin_lock_irqsave(&dev->event_lock, flags); | 383 | spin_lock_irqsave(&dev->event_lock, flags); |
380 | if (radeon_crtc->unpin_work) { | 384 | if (radeon_crtc->unpin_work) { |
381 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
382 | kfree(work); | ||
383 | radeon_fence_unref(&fence); | ||
384 | |||
385 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 385 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
386 | return -EBUSY; | 386 | r = -EBUSY; |
387 | goto unlock_free; | ||
387 | } | 388 | } |
388 | radeon_crtc->unpin_work = work; | 389 | radeon_crtc->unpin_work = work; |
389 | radeon_crtc->deferred_flip_completion = 0; | 390 | radeon_crtc->deferred_flip_completion = 0; |
@@ -497,6 +498,8 @@ pflip_cleanup1: | |||
497 | pflip_cleanup: | 498 | pflip_cleanup: |
498 | spin_lock_irqsave(&dev->event_lock, flags); | 499 | spin_lock_irqsave(&dev->event_lock, flags); |
499 | radeon_crtc->unpin_work = NULL; | 500 | radeon_crtc->unpin_work = NULL; |
501 | unlock_free: | ||
502 | drm_gem_object_unreference_unlocked(old_radeon_fb->obj); | ||
500 | spin_unlock_irqrestore(&dev->event_lock, flags); | 503 | spin_unlock_irqrestore(&dev->event_lock, flags); |
501 | radeon_fence_unref(&fence); | 504 | radeon_fence_unref(&fence); |
502 | kfree(work); | 505 | kfree(work); |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 1d330606292f..73dfbe8e5f9e 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -113,7 +113,7 @@ int radeon_benchmarking = 0; | |||
113 | int radeon_testing = 0; | 113 | int radeon_testing = 0; |
114 | int radeon_connector_table = 0; | 114 | int radeon_connector_table = 0; |
115 | int radeon_tv = 1; | 115 | int radeon_tv = 1; |
116 | int radeon_audio = 1; | 116 | int radeon_audio = 0; |
117 | int radeon_disp_priority = 0; | 117 | int radeon_disp_priority = 0; |
118 | int radeon_hw_i2c = 0; | 118 | int radeon_hw_i2c = 0; |
119 | int radeon_pcie_gen2 = 0; | 119 | int radeon_pcie_gen2 = 0; |
@@ -151,7 +151,7 @@ module_param_named(connector_table, radeon_connector_table, int, 0444); | |||
151 | MODULE_PARM_DESC(tv, "TV enable (0 = disable)"); | 151 | MODULE_PARM_DESC(tv, "TV enable (0 = disable)"); |
152 | module_param_named(tv, radeon_tv, int, 0444); | 152 | module_param_named(tv, radeon_tv, int, 0444); |
153 | 153 | ||
154 | MODULE_PARM_DESC(audio, "Audio enable (0 = disable)"); | 154 | MODULE_PARM_DESC(audio, "Audio enable (1 = enable)"); |
155 | module_param_named(audio, radeon_audio, int, 0444); | 155 | module_param_named(audio, radeon_audio, int, 0444); |
156 | 156 | ||
157 | MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)"); | 157 | MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)"); |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 1b557554696e..b293487e5aa3 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -367,7 +367,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, | |||
367 | } | 367 | } |
368 | 368 | ||
369 | if (ASIC_IS_DCE3(rdev) && | 369 | if (ASIC_IS_DCE3(rdev) && |
370 | (radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT))) { | 370 | ((radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) || |
371 | radeon_encoder_is_dp_bridge(encoder))) { | ||
371 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 372 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
372 | radeon_dp_set_link_config(connector, mode); | 373 | radeon_dp_set_link_config(connector, mode); |
373 | } | 374 | } |
@@ -660,21 +661,16 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
660 | if (radeon_encoder_is_dp_bridge(encoder)) | 661 | if (radeon_encoder_is_dp_bridge(encoder)) |
661 | return ATOM_ENCODER_MODE_DP; | 662 | return ATOM_ENCODER_MODE_DP; |
662 | 663 | ||
664 | /* DVO is always DVO */ | ||
665 | if (radeon_encoder->encoder_id == ATOM_ENCODER_MODE_DVO) | ||
666 | return ATOM_ENCODER_MODE_DVO; | ||
667 | |||
663 | connector = radeon_get_connector_for_encoder(encoder); | 668 | connector = radeon_get_connector_for_encoder(encoder); |
664 | if (!connector) { | 669 | /* if we don't have an active device yet, just use one of |
665 | switch (radeon_encoder->encoder_id) { | 670 | * the connectors tied to the encoder. |
666 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | 671 | */ |
667 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | 672 | if (!connector) |
668 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | 673 | connector = radeon_get_connector_for_encoder_init(encoder); |
669 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | ||
670 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
671 | return ATOM_ENCODER_MODE_DVI; | ||
672 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | ||
673 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: | ||
674 | default: | ||
675 | return ATOM_ENCODER_MODE_CRT; | ||
676 | } | ||
677 | } | ||
678 | radeon_connector = to_radeon_connector(connector); | 674 | radeon_connector = to_radeon_connector(connector); |
679 | 675 | ||
680 | switch (connector->connector_type) { | 676 | switch (connector->connector_type) { |
@@ -954,10 +950,15 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
954 | int dp_lane_count = 0; | 950 | int dp_lane_count = 0; |
955 | int connector_object_id = 0; | 951 | int connector_object_id = 0; |
956 | int igp_lane_info = 0; | 952 | int igp_lane_info = 0; |
953 | int dig_encoder = dig->dig_encoder; | ||
957 | 954 | ||
958 | if (action == ATOM_TRANSMITTER_ACTION_INIT) | 955 | if (action == ATOM_TRANSMITTER_ACTION_INIT) { |
959 | connector = radeon_get_connector_for_encoder_init(encoder); | 956 | connector = radeon_get_connector_for_encoder_init(encoder); |
960 | else | 957 | /* just needed to avoid bailing in the encoder check. the encoder |
958 | * isn't used for init | ||
959 | */ | ||
960 | dig_encoder = 0; | ||
961 | } else | ||
961 | connector = radeon_get_connector_for_encoder(encoder); | 962 | connector = radeon_get_connector_for_encoder(encoder); |
962 | 963 | ||
963 | if (connector) { | 964 | if (connector) { |
@@ -973,7 +974,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
973 | } | 974 | } |
974 | 975 | ||
975 | /* no dig encoder assigned */ | 976 | /* no dig encoder assigned */ |
976 | if (dig->dig_encoder == -1) | 977 | if (dig_encoder == -1) |
977 | return; | 978 | return; |
978 | 979 | ||
979 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) | 980 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) |
@@ -1023,7 +1024,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
1023 | 1024 | ||
1024 | if (dig->linkb) | 1025 | if (dig->linkb) |
1025 | args.v3.acConfig.ucLinkSel = 1; | 1026 | args.v3.acConfig.ucLinkSel = 1; |
1026 | if (dig->dig_encoder & 1) | 1027 | if (dig_encoder & 1) |
1027 | args.v3.acConfig.ucEncoderSel = 1; | 1028 | args.v3.acConfig.ucEncoderSel = 1; |
1028 | 1029 | ||
1029 | /* Select the PLL for the PHY | 1030 | /* Select the PLL for the PHY |
@@ -1073,7 +1074,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
1073 | args.v3.acConfig.fDualLinkConnector = 1; | 1074 | args.v3.acConfig.fDualLinkConnector = 1; |
1074 | } | 1075 | } |
1075 | } else if (ASIC_IS_DCE32(rdev)) { | 1076 | } else if (ASIC_IS_DCE32(rdev)) { |
1076 | args.v2.acConfig.ucEncoderSel = dig->dig_encoder; | 1077 | args.v2.acConfig.ucEncoderSel = dig_encoder; |
1077 | if (dig->linkb) | 1078 | if (dig->linkb) |
1078 | args.v2.acConfig.ucLinkSel = 1; | 1079 | args.v2.acConfig.ucLinkSel = 1; |
1079 | 1080 | ||
@@ -1089,9 +1090,10 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
1089 | break; | 1090 | break; |
1090 | } | 1091 | } |
1091 | 1092 | ||
1092 | if (is_dp) | 1093 | if (is_dp) { |
1093 | args.v2.acConfig.fCoherentMode = 1; | 1094 | args.v2.acConfig.fCoherentMode = 1; |
1094 | else if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { | 1095 | args.v2.acConfig.fDPConnector = 1; |
1096 | } else if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { | ||
1095 | if (dig->coherent_mode) | 1097 | if (dig->coherent_mode) |
1096 | args.v2.acConfig.fCoherentMode = 1; | 1098 | args.v2.acConfig.fCoherentMode = 1; |
1097 | if (radeon_encoder->pixel_clock > 165000) | 1099 | if (radeon_encoder->pixel_clock > 165000) |
@@ -1100,7 +1102,7 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
1100 | } else { | 1102 | } else { |
1101 | args.v1.ucConfig = ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL; | 1103 | args.v1.ucConfig = ATOM_TRANSMITTER_CONFIG_CLKSRC_PPLL; |
1102 | 1104 | ||
1103 | if (dig->dig_encoder) | 1105 | if (dig_encoder) |
1104 | args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER; | 1106 | args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG2_ENCODER; |
1105 | else | 1107 | else |
1106 | args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER; | 1108 | args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER; |
@@ -1430,7 +1432,11 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1430 | if (is_dig) { | 1432 | if (is_dig) { |
1431 | switch (mode) { | 1433 | switch (mode) { |
1432 | case DRM_MODE_DPMS_ON: | 1434 | case DRM_MODE_DPMS_ON: |
1433 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); | 1435 | /* some early dce3.2 boards have a bug in their transmitter control table */ |
1436 | if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730)) | ||
1437 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0); | ||
1438 | else | ||
1439 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0); | ||
1434 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { | 1440 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { |
1435 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 1441 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
1436 | 1442 | ||
@@ -1521,26 +1527,29 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
1521 | } | 1527 | } |
1522 | 1528 | ||
1523 | if (ext_encoder) { | 1529 | if (ext_encoder) { |
1524 | int action; | ||
1525 | |||
1526 | switch (mode) { | 1530 | switch (mode) { |
1527 | case DRM_MODE_DPMS_ON: | 1531 | case DRM_MODE_DPMS_ON: |
1528 | default: | 1532 | default: |
1529 | if (ASIC_IS_DCE41(rdev)) | 1533 | if (ASIC_IS_DCE41(rdev)) { |
1530 | action = EXTERNAL_ENCODER_ACTION_V3_ENABLE_OUTPUT; | 1534 | atombios_external_encoder_setup(encoder, ext_encoder, |
1531 | else | 1535 | EXTERNAL_ENCODER_ACTION_V3_ENABLE_OUTPUT); |
1532 | action = ATOM_ENABLE; | 1536 | atombios_external_encoder_setup(encoder, ext_encoder, |
1537 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING_OFF); | ||
1538 | } else | ||
1539 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); | ||
1533 | break; | 1540 | break; |
1534 | case DRM_MODE_DPMS_STANDBY: | 1541 | case DRM_MODE_DPMS_STANDBY: |
1535 | case DRM_MODE_DPMS_SUSPEND: | 1542 | case DRM_MODE_DPMS_SUSPEND: |
1536 | case DRM_MODE_DPMS_OFF: | 1543 | case DRM_MODE_DPMS_OFF: |
1537 | if (ASIC_IS_DCE41(rdev)) | 1544 | if (ASIC_IS_DCE41(rdev)) { |
1538 | action = EXTERNAL_ENCODER_ACTION_V3_DISABLE_OUTPUT; | 1545 | atombios_external_encoder_setup(encoder, ext_encoder, |
1539 | else | 1546 | EXTERNAL_ENCODER_ACTION_V3_ENCODER_BLANKING); |
1540 | action = ATOM_DISABLE; | 1547 | atombios_external_encoder_setup(encoder, ext_encoder, |
1548 | EXTERNAL_ENCODER_ACTION_V3_DISABLE_OUTPUT); | ||
1549 | } else | ||
1550 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_DISABLE); | ||
1541 | break; | 1551 | break; |
1542 | } | 1552 | } |
1543 | atombios_external_encoder_setup(encoder, ext_encoder, action); | ||
1544 | } | 1553 | } |
1545 | 1554 | ||
1546 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); | 1555 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); |
@@ -1999,6 +2008,65 @@ radeon_atom_dac_detect(struct drm_encoder *encoder, struct drm_connector *connec | |||
1999 | return connector_status_disconnected; | 2008 | return connector_status_disconnected; |
2000 | } | 2009 | } |
2001 | 2010 | ||
2011 | static enum drm_connector_status | ||
2012 | radeon_atom_dig_detect(struct drm_encoder *encoder, struct drm_connector *connector) | ||
2013 | { | ||
2014 | struct drm_device *dev = encoder->dev; | ||
2015 | struct radeon_device *rdev = dev->dev_private; | ||
2016 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
2017 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
2018 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
2019 | u32 bios_0_scratch; | ||
2020 | |||
2021 | if (!ASIC_IS_DCE4(rdev)) | ||
2022 | return connector_status_unknown; | ||
2023 | |||
2024 | if (!ext_encoder) | ||
2025 | return connector_status_unknown; | ||
2026 | |||
2027 | if ((radeon_connector->devices & ATOM_DEVICE_CRT_SUPPORT) == 0) | ||
2028 | return connector_status_unknown; | ||
2029 | |||
2030 | /* load detect on the dp bridge */ | ||
2031 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
2032 | EXTERNAL_ENCODER_ACTION_V3_DACLOAD_DETECTION); | ||
2033 | |||
2034 | bios_0_scratch = RREG32(R600_BIOS_0_SCRATCH); | ||
2035 | |||
2036 | DRM_DEBUG_KMS("Bios 0 scratch %x %08x\n", bios_0_scratch, radeon_encoder->devices); | ||
2037 | if (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT) { | ||
2038 | if (bios_0_scratch & ATOM_S0_CRT1_MASK) | ||
2039 | return connector_status_connected; | ||
2040 | } | ||
2041 | if (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT) { | ||
2042 | if (bios_0_scratch & ATOM_S0_CRT2_MASK) | ||
2043 | return connector_status_connected; | ||
2044 | } | ||
2045 | if (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT) { | ||
2046 | if (bios_0_scratch & (ATOM_S0_CV_MASK|ATOM_S0_CV_MASK_A)) | ||
2047 | return connector_status_connected; | ||
2048 | } | ||
2049 | if (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT) { | ||
2050 | if (bios_0_scratch & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A)) | ||
2051 | return connector_status_connected; /* CTV */ | ||
2052 | else if (bios_0_scratch & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A)) | ||
2053 | return connector_status_connected; /* STV */ | ||
2054 | } | ||
2055 | return connector_status_disconnected; | ||
2056 | } | ||
2057 | |||
2058 | void | ||
2059 | radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder) | ||
2060 | { | ||
2061 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
2062 | |||
2063 | if (ext_encoder) | ||
2064 | /* ddc_setup on the dp bridge */ | ||
2065 | atombios_external_encoder_setup(encoder, ext_encoder, | ||
2066 | EXTERNAL_ENCODER_ACTION_V3_DDC_SETUP); | ||
2067 | |||
2068 | } | ||
2069 | |||
2002 | static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) | 2070 | static void radeon_atom_encoder_prepare(struct drm_encoder *encoder) |
2003 | { | 2071 | { |
2004 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 2072 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
@@ -2162,7 +2230,7 @@ static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { | |||
2162 | .mode_set = radeon_atom_encoder_mode_set, | 2230 | .mode_set = radeon_atom_encoder_mode_set, |
2163 | .commit = radeon_atom_encoder_commit, | 2231 | .commit = radeon_atom_encoder_commit, |
2164 | .disable = radeon_atom_encoder_disable, | 2232 | .disable = radeon_atom_encoder_disable, |
2165 | /* no detect for TMDS/LVDS yet */ | 2233 | .detect = radeon_atom_dig_detect, |
2166 | }; | 2234 | }; |
2167 | 2235 | ||
2168 | static const struct drm_encoder_helper_funcs radeon_atom_dac_helper_funcs = { | 2236 | static const struct drm_encoder_helper_funcs radeon_atom_dac_helper_funcs = { |
diff --git a/drivers/gpu/drm/radeon/radeon_family.h b/drivers/gpu/drm/radeon/radeon_family.h index 6f1d9e563e77..ec2f1ea84f81 100644 --- a/drivers/gpu/drm/radeon/radeon_family.h +++ b/drivers/gpu/drm/radeon/radeon_family.h | |||
@@ -81,6 +81,8 @@ enum radeon_family { | |||
81 | CHIP_CYPRESS, | 81 | CHIP_CYPRESS, |
82 | CHIP_HEMLOCK, | 82 | CHIP_HEMLOCK, |
83 | CHIP_PALM, | 83 | CHIP_PALM, |
84 | CHIP_SUMO, | ||
85 | CHIP_SUMO2, | ||
84 | CHIP_BARTS, | 86 | CHIP_BARTS, |
85 | CHIP_TURKS, | 87 | CHIP_TURKS, |
86 | CHIP_CAICOS, | 88 | CHIP_CAICOS, |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 1f8229436570..021d2b6b556f 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -40,6 +40,35 @@ | |||
40 | #include "radeon.h" | 40 | #include "radeon.h" |
41 | #include "radeon_trace.h" | 41 | #include "radeon_trace.h" |
42 | 42 | ||
43 | static void radeon_fence_write(struct radeon_device *rdev, u32 seq) | ||
44 | { | ||
45 | if (rdev->wb.enabled) { | ||
46 | u32 scratch_index; | ||
47 | if (rdev->wb.use_event) | ||
48 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
49 | else | ||
50 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
51 | rdev->wb.wb[scratch_index/4] = cpu_to_le32(seq);; | ||
52 | } else | ||
53 | WREG32(rdev->fence_drv.scratch_reg, seq); | ||
54 | } | ||
55 | |||
56 | static u32 radeon_fence_read(struct radeon_device *rdev) | ||
57 | { | ||
58 | u32 seq; | ||
59 | |||
60 | if (rdev->wb.enabled) { | ||
61 | u32 scratch_index; | ||
62 | if (rdev->wb.use_event) | ||
63 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
64 | else | ||
65 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
66 | seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]); | ||
67 | } else | ||
68 | seq = RREG32(rdev->fence_drv.scratch_reg); | ||
69 | return seq; | ||
70 | } | ||
71 | |||
43 | int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) | 72 | int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) |
44 | { | 73 | { |
45 | unsigned long irq_flags; | 74 | unsigned long irq_flags; |
@@ -50,12 +79,12 @@ int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence) | |||
50 | return 0; | 79 | return 0; |
51 | } | 80 | } |
52 | fence->seq = atomic_add_return(1, &rdev->fence_drv.seq); | 81 | fence->seq = atomic_add_return(1, &rdev->fence_drv.seq); |
53 | if (!rdev->cp.ready) { | 82 | if (!rdev->cp.ready) |
54 | /* FIXME: cp is not running assume everythings is done right | 83 | /* FIXME: cp is not running assume everythings is done right |
55 | * away | 84 | * away |
56 | */ | 85 | */ |
57 | WREG32(rdev->fence_drv.scratch_reg, fence->seq); | 86 | radeon_fence_write(rdev, fence->seq); |
58 | } else | 87 | else |
59 | radeon_fence_ring_emit(rdev, fence); | 88 | radeon_fence_ring_emit(rdev, fence); |
60 | 89 | ||
61 | trace_radeon_fence_emit(rdev->ddev, fence->seq); | 90 | trace_radeon_fence_emit(rdev->ddev, fence->seq); |
@@ -73,15 +102,7 @@ static bool radeon_fence_poll_locked(struct radeon_device *rdev) | |||
73 | bool wake = false; | 102 | bool wake = false; |
74 | unsigned long cjiffies; | 103 | unsigned long cjiffies; |
75 | 104 | ||
76 | if (rdev->wb.enabled) { | 105 | seq = radeon_fence_read(rdev); |
77 | u32 scratch_index; | ||
78 | if (rdev->wb.use_event) | ||
79 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
80 | else | ||
81 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | ||
82 | seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]); | ||
83 | } else | ||
84 | seq = RREG32(rdev->fence_drv.scratch_reg); | ||
85 | if (seq != rdev->fence_drv.last_seq) { | 106 | if (seq != rdev->fence_drv.last_seq) { |
86 | rdev->fence_drv.last_seq = seq; | 107 | rdev->fence_drv.last_seq = seq; |
87 | rdev->fence_drv.last_jiffies = jiffies; | 108 | rdev->fence_drv.last_jiffies = jiffies; |
@@ -251,7 +272,7 @@ retry: | |||
251 | r = radeon_gpu_reset(rdev); | 272 | r = radeon_gpu_reset(rdev); |
252 | if (r) | 273 | if (r) |
253 | return r; | 274 | return r; |
254 | WREG32(rdev->fence_drv.scratch_reg, fence->seq); | 275 | radeon_fence_write(rdev, fence->seq); |
255 | rdev->gpu_lockup = false; | 276 | rdev->gpu_lockup = false; |
256 | } | 277 | } |
257 | timeout = RADEON_FENCE_JIFFIES_TIMEOUT; | 278 | timeout = RADEON_FENCE_JIFFIES_TIMEOUT; |
@@ -351,7 +372,7 @@ int radeon_fence_driver_init(struct radeon_device *rdev) | |||
351 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); | 372 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); |
352 | return r; | 373 | return r; |
353 | } | 374 | } |
354 | WREG32(rdev->fence_drv.scratch_reg, 0); | 375 | radeon_fence_write(rdev, 0); |
355 | atomic_set(&rdev->fence_drv.seq, 0); | 376 | atomic_set(&rdev->fence_drv.seq, 0); |
356 | INIT_LIST_HEAD(&rdev->fence_drv.created); | 377 | INIT_LIST_HEAD(&rdev->fence_drv.created); |
357 | INIT_LIST_HEAD(&rdev->fence_drv.emited); | 378 | INIT_LIST_HEAD(&rdev->fence_drv.emited); |
@@ -391,7 +412,7 @@ static int radeon_debugfs_fence_info(struct seq_file *m, void *data) | |||
391 | struct radeon_fence *fence; | 412 | struct radeon_fence *fence; |
392 | 413 | ||
393 | seq_printf(m, "Last signaled fence 0x%08X\n", | 414 | seq_printf(m, "Last signaled fence 0x%08X\n", |
394 | RREG32(rdev->fence_drv.scratch_reg)); | 415 | radeon_fence_read(rdev)); |
395 | if (!list_empty(&rdev->fence_drv.emited)) { | 416 | if (!list_empty(&rdev->fence_drv.emited)) { |
396 | fence = list_entry(rdev->fence_drv.emited.prev, | 417 | fence = list_entry(rdev->fence_drv.emited.prev, |
397 | struct radeon_fence, list); | 418 | struct radeon_fence, list); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 977a341266b6..6df4e3cec0c2 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -483,6 +483,8 @@ extern void radeon_atom_encoder_init(struct radeon_device *rdev); | |||
483 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, | 483 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, |
484 | int action, uint8_t lane_num, | 484 | int action, uint8_t lane_num, |
485 | uint8_t lane_set); | 485 | uint8_t lane_set); |
486 | extern void radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder); | ||
487 | extern struct drm_encoder *radeon_atom_get_external_encoder(struct drm_encoder *encoder); | ||
486 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | 488 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, |
487 | u8 write_byte, u8 *read_byte); | 489 | u8 write_byte, u8 *read_byte); |
488 | 490 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 86eda1ea94df..aaa19dc418a0 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -487,6 +487,7 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
487 | case THERMAL_TYPE_RV6XX: | 487 | case THERMAL_TYPE_RV6XX: |
488 | case THERMAL_TYPE_RV770: | 488 | case THERMAL_TYPE_RV770: |
489 | case THERMAL_TYPE_EVERGREEN: | 489 | case THERMAL_TYPE_EVERGREEN: |
490 | case THERMAL_TYPE_NI: | ||
490 | case THERMAL_TYPE_SUMO: | 491 | case THERMAL_TYPE_SUMO: |
491 | rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev); | 492 | rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev); |
492 | if (IS_ERR(rdev->pm.int_hwmon_dev)) { | 493 | if (IS_ERR(rdev->pm.int_hwmon_dev)) { |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r600 b/drivers/gpu/drm/radeon/reg_srcs/r600 index 92f1900dc7ca..ea49752ee99c 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/r600 +++ b/drivers/gpu/drm/radeon/reg_srcs/r600 | |||
@@ -758,6 +758,5 @@ r600 0x9400 | |||
758 | 0x00009714 VC_ENHANCE | 758 | 0x00009714 VC_ENHANCE |
759 | 0x00009830 DB_DEBUG | 759 | 0x00009830 DB_DEBUG |
760 | 0x00009838 DB_WATERMARKS | 760 | 0x00009838 DB_WATERMARKS |
761 | 0x00028D28 DB_SRESULTS_COMPARE_STATE0 | ||
762 | 0x00028D44 DB_ALPHA_TO_MASK | 761 | 0x00028D44 DB_ALPHA_TO_MASK |
763 | 0x00009700 VC_CNTL | 762 | 0x00009700 VC_CNTL |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index ef8a5babe9f7..6f508ffd1035 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -105,6 +105,9 @@ void rv770_pm_misc(struct radeon_device *rdev) | |||
105 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | 105 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; |
106 | 106 | ||
107 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 107 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
108 | /* 0xff01 is a flag rather then an actual voltage */ | ||
109 | if (voltage->voltage == 0xff01) | ||
110 | return; | ||
108 | if (voltage->voltage != rdev->pm.current_vddc) { | 111 | if (voltage->voltage != rdev->pm.current_vddc) { |
109 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); | 112 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
110 | rdev->pm.current_vddc = voltage->voltage; | 113 | rdev->pm.current_vddc = voltage->voltage; |
diff --git a/drivers/gpu/drm/savage/savage_bci.c b/drivers/gpu/drm/savage/savage_bci.c index bf5f83ea14fe..cb1ee4e0050a 100644 --- a/drivers/gpu/drm/savage/savage_bci.c +++ b/drivers/gpu/drm/savage/savage_bci.c | |||
@@ -647,9 +647,6 @@ int savage_driver_firstopen(struct drm_device *dev) | |||
647 | ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE, | 647 | ret = drm_addmap(dev, aperture_base, SAVAGE_APERTURE_SIZE, |
648 | _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, | 648 | _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, |
649 | &dev_priv->aperture); | 649 | &dev_priv->aperture); |
650 | if (ret) | ||
651 | return ret; | ||
652 | |||
653 | return ret; | 650 | return ret; |
654 | } | 651 | } |
655 | 652 | ||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 67d2a7585934..36ca465c00ce 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -305,6 +305,7 @@ config HID_MULTITOUCH | |||
305 | - 3M PCT touch screens | 305 | - 3M PCT touch screens |
306 | - ActionStar dual touch panels | 306 | - ActionStar dual touch panels |
307 | - Cando dual touch panels | 307 | - Cando dual touch panels |
308 | - Chunghwa panels | ||
308 | - CVTouch panels | 309 | - CVTouch panels |
309 | - Cypress TrueTouch panels | 310 | - Cypress TrueTouch panels |
310 | - Elo TouchSystems IntelliTouch Plus panels | 311 | - Elo TouchSystems IntelliTouch Plus panels |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index c957c4b4fe70..f7440e8ce3e7 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1359,6 +1359,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1359 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, | 1359 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
1360 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, | 1360 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
1361 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | 1361 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, |
1362 | { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, | ||
1362 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | 1363 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
1363 | { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, | 1364 | { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, |
1364 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, | 1365 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 0b374a6d6db0..aecb5a4b8d6d 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -173,6 +173,9 @@ | |||
173 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d | 173 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d |
174 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 | 174 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 |
175 | 175 | ||
176 | #define USB_VENDOR_ID_CHUNGHWAT 0x2247 | ||
177 | #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 | ||
178 | |||
176 | #define USB_VENDOR_ID_CIDC 0x1677 | 179 | #define USB_VENDOR_ID_CIDC 0x1677 |
177 | 180 | ||
178 | #define USB_VENDOR_ID_CMEDIA 0x0d8c | 181 | #define USB_VENDOR_ID_CMEDIA 0x0d8c |
@@ -622,6 +625,7 @@ | |||
622 | #define USB_VENDOR_ID_UCLOGIC 0x5543 | 625 | #define USB_VENDOR_ID_UCLOGIC 0x5543 |
623 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 | 626 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 |
624 | #define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 | 627 | #define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 |
628 | #define USB_DEVICE_ID_UCLOGIC_TABLET_TWA60 0x0064 | ||
625 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 | 629 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 |
626 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 | 630 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 |
627 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 | 631 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 |
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index a5eda4c8127a..0ec91c18a421 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
@@ -501,17 +501,9 @@ static int magicmouse_probe(struct hid_device *hdev, | |||
501 | } | 501 | } |
502 | report->size = 6; | 502 | report->size = 6; |
503 | 503 | ||
504 | /* | ||
505 | * The device reponds with 'invalid report id' when feature | ||
506 | * report switching it into multitouch mode is sent to it. | ||
507 | * | ||
508 | * This results in -EIO from the _raw low-level transport callback, | ||
509 | * but there seems to be no other way of switching the mode. | ||
510 | * Thus the super-ugly hacky success check below. | ||
511 | */ | ||
512 | ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), | 504 | ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), |
513 | HID_FEATURE_REPORT); | 505 | HID_FEATURE_REPORT); |
514 | if (ret != -EIO) { | 506 | if (ret != sizeof(feature)) { |
515 | hid_err(hdev, "unable to request touch data (%d)\n", ret); | 507 | hid_err(hdev, "unable to request touch data (%d)\n", ret); |
516 | goto err_stop_hw; | 508 | goto err_stop_hw; |
517 | } | 509 | } |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index ecd4d2db9e80..0b2dcd0ee591 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -64,6 +64,7 @@ struct mt_device { | |||
64 | struct mt_class *mtclass; /* our mt device class */ | 64 | struct mt_class *mtclass; /* our mt device class */ |
65 | unsigned last_field_index; /* last field index of the report */ | 65 | unsigned last_field_index; /* last field index of the report */ |
66 | unsigned last_slot_field; /* the last field of a slot */ | 66 | unsigned last_slot_field; /* the last field of a slot */ |
67 | int last_mt_collection; /* last known mt-related collection */ | ||
67 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ | 68 | __s8 inputmode; /* InputMode HID feature, -1 if non-existent */ |
68 | __u8 num_received; /* how many contacts we received */ | 69 | __u8 num_received; /* how many contacts we received */ |
69 | __u8 num_expected; /* expected last contact index */ | 70 | __u8 num_expected; /* expected last contact index */ |
@@ -225,8 +226,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
225 | cls->sn_move); | 226 | cls->sn_move); |
226 | /* touchscreen emulation */ | 227 | /* touchscreen emulation */ |
227 | set_abs(hi->input, ABS_X, field, cls->sn_move); | 228 | set_abs(hi->input, ABS_X, field, cls->sn_move); |
228 | td->last_slot_field = usage->hid; | 229 | if (td->last_mt_collection == usage->collection_index) { |
229 | td->last_field_index = field->index; | 230 | td->last_slot_field = usage->hid; |
231 | td->last_field_index = field->index; | ||
232 | } | ||
230 | return 1; | 233 | return 1; |
231 | case HID_GD_Y: | 234 | case HID_GD_Y: |
232 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) | 235 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) |
@@ -237,8 +240,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
237 | cls->sn_move); | 240 | cls->sn_move); |
238 | /* touchscreen emulation */ | 241 | /* touchscreen emulation */ |
239 | set_abs(hi->input, ABS_Y, field, cls->sn_move); | 242 | set_abs(hi->input, ABS_Y, field, cls->sn_move); |
240 | td->last_slot_field = usage->hid; | 243 | if (td->last_mt_collection == usage->collection_index) { |
241 | td->last_field_index = field->index; | 244 | td->last_slot_field = usage->hid; |
245 | td->last_field_index = field->index; | ||
246 | } | ||
242 | return 1; | 247 | return 1; |
243 | } | 248 | } |
244 | return 0; | 249 | return 0; |
@@ -246,31 +251,40 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
246 | case HID_UP_DIGITIZER: | 251 | case HID_UP_DIGITIZER: |
247 | switch (usage->hid) { | 252 | switch (usage->hid) { |
248 | case HID_DG_INRANGE: | 253 | case HID_DG_INRANGE: |
249 | td->last_slot_field = usage->hid; | 254 | if (td->last_mt_collection == usage->collection_index) { |
250 | td->last_field_index = field->index; | 255 | td->last_slot_field = usage->hid; |
256 | td->last_field_index = field->index; | ||
257 | } | ||
251 | return 1; | 258 | return 1; |
252 | case HID_DG_CONFIDENCE: | 259 | case HID_DG_CONFIDENCE: |
253 | td->last_slot_field = usage->hid; | 260 | if (td->last_mt_collection == usage->collection_index) { |
254 | td->last_field_index = field->index; | 261 | td->last_slot_field = usage->hid; |
262 | td->last_field_index = field->index; | ||
263 | } | ||
255 | return 1; | 264 | return 1; |
256 | case HID_DG_TIPSWITCH: | 265 | case HID_DG_TIPSWITCH: |
257 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); | 266 | hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); |
258 | input_set_capability(hi->input, EV_KEY, BTN_TOUCH); | 267 | input_set_capability(hi->input, EV_KEY, BTN_TOUCH); |
259 | td->last_slot_field = usage->hid; | 268 | if (td->last_mt_collection == usage->collection_index) { |
260 | td->last_field_index = field->index; | 269 | td->last_slot_field = usage->hid; |
270 | td->last_field_index = field->index; | ||
271 | } | ||
261 | return 1; | 272 | return 1; |
262 | case HID_DG_CONTACTID: | 273 | case HID_DG_CONTACTID: |
263 | input_mt_init_slots(hi->input, td->maxcontacts); | 274 | input_mt_init_slots(hi->input, td->maxcontacts); |
264 | td->last_slot_field = usage->hid; | 275 | td->last_slot_field = usage->hid; |
265 | td->last_field_index = field->index; | 276 | td->last_field_index = field->index; |
277 | td->last_mt_collection = usage->collection_index; | ||
266 | return 1; | 278 | return 1; |
267 | case HID_DG_WIDTH: | 279 | case HID_DG_WIDTH: |
268 | hid_map_usage(hi, usage, bit, max, | 280 | hid_map_usage(hi, usage, bit, max, |
269 | EV_ABS, ABS_MT_TOUCH_MAJOR); | 281 | EV_ABS, ABS_MT_TOUCH_MAJOR); |
270 | set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, | 282 | set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field, |
271 | cls->sn_width); | 283 | cls->sn_width); |
272 | td->last_slot_field = usage->hid; | 284 | if (td->last_mt_collection == usage->collection_index) { |
273 | td->last_field_index = field->index; | 285 | td->last_slot_field = usage->hid; |
286 | td->last_field_index = field->index; | ||
287 | } | ||
274 | return 1; | 288 | return 1; |
275 | case HID_DG_HEIGHT: | 289 | case HID_DG_HEIGHT: |
276 | hid_map_usage(hi, usage, bit, max, | 290 | hid_map_usage(hi, usage, bit, max, |
@@ -279,8 +293,10 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
279 | cls->sn_height); | 293 | cls->sn_height); |
280 | input_set_abs_params(hi->input, | 294 | input_set_abs_params(hi->input, |
281 | ABS_MT_ORIENTATION, 0, 1, 0, 0); | 295 | ABS_MT_ORIENTATION, 0, 1, 0, 0); |
282 | td->last_slot_field = usage->hid; | 296 | if (td->last_mt_collection == usage->collection_index) { |
283 | td->last_field_index = field->index; | 297 | td->last_slot_field = usage->hid; |
298 | td->last_field_index = field->index; | ||
299 | } | ||
284 | return 1; | 300 | return 1; |
285 | case HID_DG_TIPPRESSURE: | 301 | case HID_DG_TIPPRESSURE: |
286 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) | 302 | if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) |
@@ -292,16 +308,20 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
292 | /* touchscreen emulation */ | 308 | /* touchscreen emulation */ |
293 | set_abs(hi->input, ABS_PRESSURE, field, | 309 | set_abs(hi->input, ABS_PRESSURE, field, |
294 | cls->sn_pressure); | 310 | cls->sn_pressure); |
295 | td->last_slot_field = usage->hid; | 311 | if (td->last_mt_collection == usage->collection_index) { |
296 | td->last_field_index = field->index; | 312 | td->last_slot_field = usage->hid; |
313 | td->last_field_index = field->index; | ||
314 | } | ||
297 | return 1; | 315 | return 1; |
298 | case HID_DG_CONTACTCOUNT: | 316 | case HID_DG_CONTACTCOUNT: |
299 | td->last_field_index = field->index; | 317 | if (td->last_mt_collection == usage->collection_index) |
318 | td->last_field_index = field->index; | ||
300 | return 1; | 319 | return 1; |
301 | case HID_DG_CONTACTMAX: | 320 | case HID_DG_CONTACTMAX: |
302 | /* we don't set td->last_slot_field as contactcount and | 321 | /* we don't set td->last_slot_field as contactcount and |
303 | * contact max are global to the report */ | 322 | * contact max are global to the report */ |
304 | td->last_field_index = field->index; | 323 | if (td->last_mt_collection == usage->collection_index) |
324 | td->last_field_index = field->index; | ||
305 | return -1; | 325 | return -1; |
306 | } | 326 | } |
307 | /* let hid-input decide for the others */ | 327 | /* let hid-input decide for the others */ |
@@ -516,6 +536,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
516 | } | 536 | } |
517 | td->mtclass = mtclass; | 537 | td->mtclass = mtclass; |
518 | td->inputmode = -1; | 538 | td->inputmode = -1; |
539 | td->last_mt_collection = -1; | ||
519 | hid_set_drvdata(hdev, td); | 540 | hid_set_drvdata(hdev, td); |
520 | 541 | ||
521 | ret = hid_parse(hdev); | 542 | ret = hid_parse(hdev); |
@@ -593,6 +614,11 @@ static const struct hid_device_id mt_devices[] = { | |||
593 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, | 614 | HID_USB_DEVICE(USB_VENDOR_ID_CANDO, |
594 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, | 615 | USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) }, |
595 | 616 | ||
617 | /* Chunghwa Telecom touch panels */ | ||
618 | { .driver_data = MT_CLS_DEFAULT, | ||
619 | HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, | ||
620 | USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, | ||
621 | |||
596 | /* CVTouch panels */ | 622 | /* CVTouch panels */ |
597 | { .driver_data = MT_CLS_DEFAULT, | 623 | { .driver_data = MT_CLS_DEFAULT, |
598 | HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, | 624 | HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 0e30b140edca..621959d5cc42 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -74,6 +74,7 @@ static const struct hid_blacklist { | |||
74 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, | 74 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, |
75 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, | 75 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, |
76 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, | 76 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, |
77 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT }, | ||
77 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, | 78 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, |
78 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, | 79 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, |
79 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, | 80 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index ff3c644888b1..7c1188b53c3e 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -248,12 +248,15 @@ static int hiddev_release(struct inode * inode, struct file * file) | |||
248 | usbhid_close(list->hiddev->hid); | 248 | usbhid_close(list->hiddev->hid); |
249 | usbhid_put_power(list->hiddev->hid); | 249 | usbhid_put_power(list->hiddev->hid); |
250 | } else { | 250 | } else { |
251 | mutex_unlock(&list->hiddev->existancelock); | ||
251 | kfree(list->hiddev); | 252 | kfree(list->hiddev); |
253 | kfree(list); | ||
254 | return 0; | ||
252 | } | 255 | } |
253 | } | 256 | } |
254 | 257 | ||
255 | kfree(list); | ||
256 | mutex_unlock(&list->hiddev->existancelock); | 258 | mutex_unlock(&list->hiddev->existancelock); |
259 | kfree(list); | ||
257 | 260 | ||
258 | return 0; | 261 | return 0; |
259 | } | 262 | } |
@@ -923,10 +926,11 @@ void hiddev_disconnect(struct hid_device *hid) | |||
923 | usb_deregister_dev(usbhid->intf, &hiddev_class); | 926 | usb_deregister_dev(usbhid->intf, &hiddev_class); |
924 | 927 | ||
925 | if (hiddev->open) { | 928 | if (hiddev->open) { |
929 | mutex_unlock(&hiddev->existancelock); | ||
926 | usbhid_close(hiddev->hid); | 930 | usbhid_close(hiddev->hid); |
927 | wake_up_interruptible(&hiddev->wait); | 931 | wake_up_interruptible(&hiddev->wait); |
928 | } else { | 932 | } else { |
933 | mutex_unlock(&hiddev->existancelock); | ||
929 | kfree(hiddev); | 934 | kfree(hiddev); |
930 | } | 935 | } |
931 | mutex_unlock(&hiddev->existancelock); | ||
932 | } | 936 | } |
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c index b5e892017e0c..dcb78a7a8047 100644 --- a/drivers/hwmon/asus_atk0110.c +++ b/drivers/hwmon/asus_atk0110.c | |||
@@ -268,6 +268,7 @@ static struct device_attribute atk_name_attr = | |||
268 | static void atk_init_attribute(struct device_attribute *attr, char *name, | 268 | static void atk_init_attribute(struct device_attribute *attr, char *name, |
269 | sysfs_show_func show) | 269 | sysfs_show_func show) |
270 | { | 270 | { |
271 | sysfs_attr_init(&attr->attr); | ||
271 | attr->attr.name = name; | 272 | attr->attr.name = name; |
272 | attr->attr.mode = 0444; | 273 | attr->attr.mode = 0444; |
273 | attr->show = show; | 274 | attr->show = show; |
@@ -1188,19 +1189,15 @@ static int atk_create_files(struct atk_data *data) | |||
1188 | int err; | 1189 | int err; |
1189 | 1190 | ||
1190 | list_for_each_entry(s, &data->sensor_list, list) { | 1191 | list_for_each_entry(s, &data->sensor_list, list) { |
1191 | sysfs_attr_init(&s->input_attr.attr); | ||
1192 | err = device_create_file(data->hwmon_dev, &s->input_attr); | 1192 | err = device_create_file(data->hwmon_dev, &s->input_attr); |
1193 | if (err) | 1193 | if (err) |
1194 | return err; | 1194 | return err; |
1195 | sysfs_attr_init(&s->label_attr.attr); | ||
1196 | err = device_create_file(data->hwmon_dev, &s->label_attr); | 1195 | err = device_create_file(data->hwmon_dev, &s->label_attr); |
1197 | if (err) | 1196 | if (err) |
1198 | return err; | 1197 | return err; |
1199 | sysfs_attr_init(&s->limit1_attr.attr); | ||
1200 | err = device_create_file(data->hwmon_dev, &s->limit1_attr); | 1198 | err = device_create_file(data->hwmon_dev, &s->limit1_attr); |
1201 | if (err) | 1199 | if (err) |
1202 | return err; | 1200 | return err; |
1203 | sysfs_attr_init(&s->limit2_attr.attr); | ||
1204 | err = device_create_file(data->hwmon_dev, &s->limit2_attr); | 1201 | err = device_create_file(data->hwmon_dev, &s->limit2_attr); |
1205 | if (err) | 1202 | if (err) |
1206 | return err; | 1203 | return err; |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index de3d2465fe24..0070d5476dd0 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -97,9 +97,7 @@ struct platform_data { | |||
97 | struct pdev_entry { | 97 | struct pdev_entry { |
98 | struct list_head list; | 98 | struct list_head list; |
99 | struct platform_device *pdev; | 99 | struct platform_device *pdev; |
100 | unsigned int cpu; | ||
101 | u16 phys_proc_id; | 100 | u16 phys_proc_id; |
102 | u16 cpu_core_id; | ||
103 | }; | 101 | }; |
104 | 102 | ||
105 | static LIST_HEAD(pdev_list); | 103 | static LIST_HEAD(pdev_list); |
@@ -296,7 +294,7 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | |||
296 | * If the TjMax is not plausible, an assumption | 294 | * If the TjMax is not plausible, an assumption |
297 | * will be used | 295 | * will be used |
298 | */ | 296 | */ |
299 | if (val > 80 && val < 120) { | 297 | if (val) { |
300 | dev_info(dev, "TjMax is %d C.\n", val); | 298 | dev_info(dev, "TjMax is %d C.\n", val); |
301 | return val * 1000; | 299 | return val * 1000; |
302 | } | 300 | } |
@@ -304,24 +302,9 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | |||
304 | 302 | ||
305 | /* | 303 | /* |
306 | * An assumption is made for early CPUs and unreadable MSR. | 304 | * An assumption is made for early CPUs and unreadable MSR. |
307 | * NOTE: the given value may not be correct. | 305 | * NOTE: the calculated value may not be correct. |
308 | */ | 306 | */ |
309 | 307 | return adjust_tjmax(c, id, dev); | |
310 | switch (c->x86_model) { | ||
311 | case 0xe: | ||
312 | case 0xf: | ||
313 | case 0x16: | ||
314 | case 0x1a: | ||
315 | dev_warn(dev, "TjMax is assumed as 100 C!\n"); | ||
316 | return 100000; | ||
317 | case 0x17: | ||
318 | case 0x1c: /* Atom CPUs */ | ||
319 | return adjust_tjmax(c, id, dev); | ||
320 | default: | ||
321 | dev_warn(dev, "CPU (model=0x%x) is not supported yet," | ||
322 | " using default TjMax of 100C.\n", c->x86_model); | ||
323 | return 100000; | ||
324 | } | ||
325 | } | 308 | } |
326 | 309 | ||
327 | static void __devinit get_ucode_rev_on_cpu(void *edx) | 310 | static void __devinit get_ucode_rev_on_cpu(void *edx) |
@@ -341,7 +324,7 @@ static int get_pkg_tjmax(unsigned int cpu, struct device *dev) | |||
341 | err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); | 324 | err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); |
342 | if (!err) { | 325 | if (!err) { |
343 | val = (eax >> 16) & 0xff; | 326 | val = (eax >> 16) & 0xff; |
344 | if (val > 80 && val < 120) | 327 | if (val) |
345 | return val * 1000; | 328 | return val * 1000; |
346 | } | 329 | } |
347 | dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu); | 330 | dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu); |
@@ -668,9 +651,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu) | |||
668 | } | 651 | } |
669 | 652 | ||
670 | pdev_entry->pdev = pdev; | 653 | pdev_entry->pdev = pdev; |
671 | pdev_entry->cpu = cpu; | ||
672 | pdev_entry->phys_proc_id = TO_PHYS_ID(cpu); | 654 | pdev_entry->phys_proc_id = TO_PHYS_ID(cpu); |
673 | pdev_entry->cpu_core_id = TO_CORE_ID(cpu); | ||
674 | 655 | ||
675 | list_add_tail(&pdev_entry->list, &pdev_list); | 656 | list_add_tail(&pdev_entry->list, &pdev_list); |
676 | mutex_unlock(&pdev_list_mutex); | 657 | mutex_unlock(&pdev_list_mutex); |
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c index 537409d07ee7..1a409c5bc9bc 100644 --- a/drivers/hwmon/ibmaem.c +++ b/drivers/hwmon/ibmaem.c | |||
@@ -947,6 +947,7 @@ static int aem_register_sensors(struct aem_data *data, | |||
947 | 947 | ||
948 | /* Set up read-only sensors */ | 948 | /* Set up read-only sensors */ |
949 | while (ro->label) { | 949 | while (ro->label) { |
950 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
950 | sensors->dev_attr.attr.name = ro->label; | 951 | sensors->dev_attr.attr.name = ro->label; |
951 | sensors->dev_attr.attr.mode = S_IRUGO; | 952 | sensors->dev_attr.attr.mode = S_IRUGO; |
952 | sensors->dev_attr.show = ro->show; | 953 | sensors->dev_attr.show = ro->show; |
@@ -963,6 +964,7 @@ static int aem_register_sensors(struct aem_data *data, | |||
963 | 964 | ||
964 | /* Set up read-write sensors */ | 965 | /* Set up read-write sensors */ |
965 | while (rw->label) { | 966 | while (rw->label) { |
967 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
966 | sensors->dev_attr.attr.name = rw->label; | 968 | sensors->dev_attr.attr.name = rw->label; |
967 | sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR; | 969 | sensors->dev_attr.attr.mode = S_IRUGO | S_IWUSR; |
968 | sensors->dev_attr.show = rw->show; | 970 | sensors->dev_attr.show = rw->show; |
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index 06d4eafcf76b..41dbf8161ed7 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c | |||
@@ -358,6 +358,7 @@ static int create_sensor(struct ibmpex_bmc_data *data, int type, | |||
358 | else if (type == POWER_SENSOR) | 358 | else if (type == POWER_SENSOR) |
359 | sprintf(n, power_sensor_name_templates[func], "power", counter); | 359 | sprintf(n, power_sensor_name_templates[func], "power", counter); |
360 | 360 | ||
361 | sysfs_attr_init(&data->sensors[sensor].attr[func].dev_attr.attr); | ||
361 | data->sensors[sensor].attr[func].dev_attr.attr.name = n; | 362 | data->sensors[sensor].attr[func].dev_attr.attr.name = n; |
362 | data->sensors[sensor].attr[func].dev_attr.attr.mode = S_IRUGO; | 363 | data->sensors[sensor].attr[func].dev_attr.attr.mode = S_IRUGO; |
363 | data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor; | 364 | data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor; |
diff --git a/drivers/hwmon/max6642.c b/drivers/hwmon/max6642.c index 0f9fc40379cd..e855d3b0bd1f 100644 --- a/drivers/hwmon/max6642.c +++ b/drivers/hwmon/max6642.c | |||
@@ -136,15 +136,29 @@ static int max6642_detect(struct i2c_client *client, | |||
136 | if (man_id != 0x4D) | 136 | if (man_id != 0x4D) |
137 | return -ENODEV; | 137 | return -ENODEV; |
138 | 138 | ||
139 | /* sanity check */ | ||
140 | if (i2c_smbus_read_byte_data(client, 0x04) != 0x4D | ||
141 | || i2c_smbus_read_byte_data(client, 0x06) != 0x4D | ||
142 | || i2c_smbus_read_byte_data(client, 0xff) != 0x4D) | ||
143 | return -ENODEV; | ||
144 | |||
139 | /* | 145 | /* |
140 | * We read the config and status register, the 4 lower bits in the | 146 | * We read the config and status register, the 4 lower bits in the |
141 | * config register should be zero and bit 5, 3, 1 and 0 should be | 147 | * config register should be zero and bit 5, 3, 1 and 0 should be |
142 | * zero in the status register. | 148 | * zero in the status register. |
143 | */ | 149 | */ |
144 | reg_config = i2c_smbus_read_byte_data(client, MAX6642_REG_R_CONFIG); | 150 | reg_config = i2c_smbus_read_byte_data(client, MAX6642_REG_R_CONFIG); |
151 | if ((reg_config & 0x0f) != 0x00) | ||
152 | return -ENODEV; | ||
153 | |||
154 | /* in between, another round of sanity checks */ | ||
155 | if (i2c_smbus_read_byte_data(client, 0x04) != reg_config | ||
156 | || i2c_smbus_read_byte_data(client, 0x06) != reg_config | ||
157 | || i2c_smbus_read_byte_data(client, 0xff) != reg_config) | ||
158 | return -ENODEV; | ||
159 | |||
145 | reg_status = i2c_smbus_read_byte_data(client, MAX6642_REG_R_STATUS); | 160 | reg_status = i2c_smbus_read_byte_data(client, MAX6642_REG_R_STATUS); |
146 | if (((reg_config & 0x0f) != 0x00) || | 161 | if ((reg_status & 0x2b) != 0x00) |
147 | ((reg_status & 0x2b) != 0x00)) | ||
148 | return -ENODEV; | 162 | return -ENODEV; |
149 | 163 | ||
150 | strlcpy(info->type, "max6642", I2C_NAME_SIZE); | 164 | strlcpy(info->type, "max6642", I2C_NAME_SIZE); |
@@ -246,7 +260,7 @@ static SENSOR_DEVICE_ATTR_2(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, | |||
246 | set_temp_max, 0, MAX6642_REG_W_LOCAL_HIGH); | 260 | set_temp_max, 0, MAX6642_REG_W_LOCAL_HIGH); |
247 | static SENSOR_DEVICE_ATTR_2(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, | 261 | static SENSOR_DEVICE_ATTR_2(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, |
248 | set_temp_max, 1, MAX6642_REG_W_REMOTE_HIGH); | 262 | set_temp_max, 1, MAX6642_REG_W_REMOTE_HIGH); |
249 | static SENSOR_DEVICE_ATTR(temp_fault, S_IRUGO, show_alarm, NULL, 2); | 263 | static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); |
250 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); | 264 | static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); |
251 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); | 265 | static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); |
252 | 266 | ||
@@ -256,7 +270,7 @@ static struct attribute *max6642_attributes[] = { | |||
256 | &sensor_dev_attr_temp1_max.dev_attr.attr, | 270 | &sensor_dev_attr_temp1_max.dev_attr.attr, |
257 | &sensor_dev_attr_temp2_max.dev_attr.attr, | 271 | &sensor_dev_attr_temp2_max.dev_attr.attr, |
258 | 272 | ||
259 | &sensor_dev_attr_temp_fault.dev_attr.attr, | 273 | &sensor_dev_attr_temp2_fault.dev_attr.attr, |
260 | &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, | 274 | &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, |
261 | &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, | 275 | &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, |
262 | NULL | 276 | NULL |
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index 92b42db43bcf..b39f52e2752a 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c | |||
@@ -232,6 +232,7 @@ static int s3c_hwmon_create_attr(struct device *dev, | |||
232 | 232 | ||
233 | attr = &attrs->in; | 233 | attr = &attrs->in; |
234 | attr->index = channel; | 234 | attr->index = channel; |
235 | sysfs_attr_init(&attr->dev_attr.attr); | ||
235 | attr->dev_attr.attr.name = attrs->in_name; | 236 | attr->dev_attr.attr.name = attrs->in_name; |
236 | attr->dev_attr.attr.mode = S_IRUGO; | 237 | attr->dev_attr.attr.mode = S_IRUGO; |
237 | attr->dev_attr.show = s3c_hwmon_ch_show; | 238 | attr->dev_attr.show = s3c_hwmon_ch_show; |
@@ -249,6 +250,7 @@ static int s3c_hwmon_create_attr(struct device *dev, | |||
249 | 250 | ||
250 | attr = &attrs->label; | 251 | attr = &attrs->label; |
251 | attr->index = channel; | 252 | attr->index = channel; |
253 | sysfs_attr_init(&attr->dev_attr.attr); | ||
252 | attr->dev_attr.attr.name = attrs->label_name; | 254 | attr->dev_attr.attr.name = attrs->label_name; |
253 | attr->dev_attr.attr.mode = S_IRUGO; | 255 | attr->dev_attr.attr.mode = S_IRUGO; |
254 | attr->dev_attr.show = s3c_hwmon_label_show; | 256 | attr->dev_attr.show = s3c_hwmon_label_show; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 6e5123b1d341..04b09564bfa9 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -778,7 +778,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
778 | sector_t block) | 778 | sector_t block) |
779 | { | 779 | { |
780 | struct ide_cmd cmd; | 780 | struct ide_cmd cmd; |
781 | int uptodate = 0, nsectors; | 781 | int uptodate = 0; |
782 | unsigned int nsectors; | ||
782 | 783 | ||
783 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", | 784 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", |
784 | rq->cmd[0], (unsigned long long)block); | 785 | rq->cmd[0], (unsigned long long)block); |
@@ -1782,7 +1783,6 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1782 | ide_cd_read_toc(drive, &sense); | 1783 | ide_cd_read_toc(drive, &sense); |
1783 | g->fops = &idecd_ops; | 1784 | g->fops = &idecd_ops; |
1784 | g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; | 1785 | g->flags |= GENHD_FL_REMOVABLE | GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE; |
1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
1786 | add_disk(g); | 1786 | add_disk(g); |
1787 | return 0; | 1787 | return 0; |
1788 | 1788 | ||
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index f660cd04ec2f..31fb44085c9b 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -1463,9 +1463,9 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1463 | struct c4iw_qp_attributes attrs; | 1463 | struct c4iw_qp_attributes attrs; |
1464 | int disconnect = 1; | 1464 | int disconnect = 1; |
1465 | int release = 0; | 1465 | int release = 0; |
1466 | int abort = 0; | ||
1467 | struct tid_info *t = dev->rdev.lldi.tids; | 1466 | struct tid_info *t = dev->rdev.lldi.tids; |
1468 | unsigned int tid = GET_TID(hdr); | 1467 | unsigned int tid = GET_TID(hdr); |
1468 | int ret; | ||
1469 | 1469 | ||
1470 | ep = lookup_tid(t, tid); | 1470 | ep = lookup_tid(t, tid); |
1471 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | 1471 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); |
@@ -1501,10 +1501,12 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1501 | start_ep_timer(ep); | 1501 | start_ep_timer(ep); |
1502 | __state_set(&ep->com, CLOSING); | 1502 | __state_set(&ep->com, CLOSING); |
1503 | attrs.next_state = C4IW_QP_STATE_CLOSING; | 1503 | attrs.next_state = C4IW_QP_STATE_CLOSING; |
1504 | abort = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, | 1504 | ret = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
1505 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); | 1505 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); |
1506 | peer_close_upcall(ep); | 1506 | if (ret != -ECONNRESET) { |
1507 | disconnect = 1; | 1507 | peer_close_upcall(ep); |
1508 | disconnect = 1; | ||
1509 | } | ||
1508 | break; | 1510 | break; |
1509 | case ABORTING: | 1511 | case ABORTING: |
1510 | disconnect = 0; | 1512 | disconnect = 0; |
@@ -2109,15 +2111,16 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp) | |||
2109 | break; | 2111 | break; |
2110 | } | 2112 | } |
2111 | 2113 | ||
2112 | mutex_unlock(&ep->com.mutex); | ||
2113 | if (close) { | 2114 | if (close) { |
2114 | if (abrupt) | 2115 | if (abrupt) { |
2115 | ret = abort_connection(ep, NULL, gfp); | 2116 | close_complete_upcall(ep); |
2116 | else | 2117 | ret = send_abort(ep, NULL, gfp); |
2118 | } else | ||
2117 | ret = send_halfclose(ep, gfp); | 2119 | ret = send_halfclose(ep, gfp); |
2118 | if (ret) | 2120 | if (ret) |
2119 | fatal = 1; | 2121 | fatal = 1; |
2120 | } | 2122 | } |
2123 | mutex_unlock(&ep->com.mutex); | ||
2121 | if (fatal) | 2124 | if (fatal) |
2122 | release_ep_resources(ep); | 2125 | release_ep_resources(ep); |
2123 | return ret; | 2126 | return ret; |
@@ -2301,6 +2304,31 @@ static int fw6_msg(struct c4iw_dev *dev, struct sk_buff *skb) | |||
2301 | return 0; | 2304 | return 0; |
2302 | } | 2305 | } |
2303 | 2306 | ||
2307 | static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb) | ||
2308 | { | ||
2309 | struct cpl_abort_req_rss *req = cplhdr(skb); | ||
2310 | struct c4iw_ep *ep; | ||
2311 | struct tid_info *t = dev->rdev.lldi.tids; | ||
2312 | unsigned int tid = GET_TID(req); | ||
2313 | |||
2314 | ep = lookup_tid(t, tid); | ||
2315 | if (is_neg_adv_abort(req->status)) { | ||
2316 | PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep, | ||
2317 | ep->hwtid); | ||
2318 | kfree_skb(skb); | ||
2319 | return 0; | ||
2320 | } | ||
2321 | PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid, | ||
2322 | ep->com.state); | ||
2323 | |||
2324 | /* | ||
2325 | * Wake up any threads in rdma_init() or rdma_fini(). | ||
2326 | */ | ||
2327 | c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET); | ||
2328 | sched(dev, skb); | ||
2329 | return 0; | ||
2330 | } | ||
2331 | |||
2304 | /* | 2332 | /* |
2305 | * Most upcalls from the T4 Core go to sched() to | 2333 | * Most upcalls from the T4 Core go to sched() to |
2306 | * schedule the processing on a work queue. | 2334 | * schedule the processing on a work queue. |
@@ -2317,7 +2345,7 @@ c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS] = { | |||
2317 | [CPL_PASS_ESTABLISH] = sched, | 2345 | [CPL_PASS_ESTABLISH] = sched, |
2318 | [CPL_PEER_CLOSE] = sched, | 2346 | [CPL_PEER_CLOSE] = sched, |
2319 | [CPL_CLOSE_CON_RPL] = sched, | 2347 | [CPL_CLOSE_CON_RPL] = sched, |
2320 | [CPL_ABORT_REQ_RSS] = sched, | 2348 | [CPL_ABORT_REQ_RSS] = peer_abort_intr, |
2321 | [CPL_RDMA_TERMINATE] = sched, | 2349 | [CPL_RDMA_TERMINATE] = sched, |
2322 | [CPL_FW4_ACK] = sched, | 2350 | [CPL_FW4_ACK] = sched, |
2323 | [CPL_SET_TCB_RPL] = set_tcb_rpl, | 2351 | [CPL_SET_TCB_RPL] = set_tcb_rpl, |
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index 8d8f8add6fcd..1720dc790d13 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c | |||
@@ -801,6 +801,10 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries, | |||
801 | if (ucontext) { | 801 | if (ucontext) { |
802 | memsize = roundup(memsize, PAGE_SIZE); | 802 | memsize = roundup(memsize, PAGE_SIZE); |
803 | hwentries = memsize / sizeof *chp->cq.queue; | 803 | hwentries = memsize / sizeof *chp->cq.queue; |
804 | while (hwentries > T4_MAX_IQ_SIZE) { | ||
805 | memsize -= PAGE_SIZE; | ||
806 | hwentries = memsize / sizeof *chp->cq.queue; | ||
807 | } | ||
804 | } | 808 | } |
805 | chp->cq.size = hwentries; | 809 | chp->cq.size = hwentries; |
806 | chp->cq.memsize = memsize; | 810 | chp->cq.memsize = memsize; |
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c index 273ffe49525a..0347eed4a167 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c | |||
@@ -625,7 +625,7 @@ pbl_done: | |||
625 | mhp->attr.perms = c4iw_ib_to_tpt_access(acc); | 625 | mhp->attr.perms = c4iw_ib_to_tpt_access(acc); |
626 | mhp->attr.va_fbo = virt; | 626 | mhp->attr.va_fbo = virt; |
627 | mhp->attr.page_size = shift - 12; | 627 | mhp->attr.page_size = shift - 12; |
628 | mhp->attr.len = (u32) length; | 628 | mhp->attr.len = length; |
629 | 629 | ||
630 | err = register_mem(rhp, php, mhp, shift); | 630 | err = register_mem(rhp, php, mhp, shift); |
631 | if (err) | 631 | if (err) |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 3b773b05a898..a41578e48c7b 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -1207,11 +1207,8 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, | |||
1207 | c4iw_get_ep(&qhp->ep->com); | 1207 | c4iw_get_ep(&qhp->ep->com); |
1208 | } | 1208 | } |
1209 | ret = rdma_fini(rhp, qhp, ep); | 1209 | ret = rdma_fini(rhp, qhp, ep); |
1210 | if (ret) { | 1210 | if (ret) |
1211 | if (internal) | ||
1212 | c4iw_get_ep(&qhp->ep->com); | ||
1213 | goto err; | 1211 | goto err; |
1214 | } | ||
1215 | break; | 1212 | break; |
1216 | case C4IW_QP_STATE_TERMINATE: | 1213 | case C4IW_QP_STATE_TERMINATE: |
1217 | set_state(qhp, C4IW_QP_STATE_TERMINATE); | 1214 | set_state(qhp, C4IW_QP_STATE_TERMINATE); |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 9f53e68a096a..8ec5237031a0 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
@@ -469,6 +469,8 @@ static u8 ib_rate_to_delay[IB_RATE_120_GBPS + 1] = { | |||
469 | #define IB_7322_LT_STATE_RECOVERIDLE 0x0f | 469 | #define IB_7322_LT_STATE_RECOVERIDLE 0x0f |
470 | #define IB_7322_LT_STATE_CFGENH 0x10 | 470 | #define IB_7322_LT_STATE_CFGENH 0x10 |
471 | #define IB_7322_LT_STATE_CFGTEST 0x11 | 471 | #define IB_7322_LT_STATE_CFGTEST 0x11 |
472 | #define IB_7322_LT_STATE_CFGWAITRMTTEST 0x12 | ||
473 | #define IB_7322_LT_STATE_CFGWAITENH 0x13 | ||
472 | 474 | ||
473 | /* link state machine states from IBC */ | 475 | /* link state machine states from IBC */ |
474 | #define IB_7322_L_STATE_DOWN 0x0 | 476 | #define IB_7322_L_STATE_DOWN 0x0 |
@@ -498,8 +500,10 @@ static const u8 qib_7322_physportstate[0x20] = { | |||
498 | IB_PHYSPORTSTATE_LINK_ERR_RECOVER, | 500 | IB_PHYSPORTSTATE_LINK_ERR_RECOVER, |
499 | [IB_7322_LT_STATE_CFGENH] = IB_PHYSPORTSTATE_CFG_ENH, | 501 | [IB_7322_LT_STATE_CFGENH] = IB_PHYSPORTSTATE_CFG_ENH, |
500 | [IB_7322_LT_STATE_CFGTEST] = IB_PHYSPORTSTATE_CFG_TRAIN, | 502 | [IB_7322_LT_STATE_CFGTEST] = IB_PHYSPORTSTATE_CFG_TRAIN, |
501 | [0x12] = IB_PHYSPORTSTATE_CFG_TRAIN, | 503 | [IB_7322_LT_STATE_CFGWAITRMTTEST] = |
502 | [0x13] = IB_PHYSPORTSTATE_CFG_WAIT_ENH, | 504 | IB_PHYSPORTSTATE_CFG_TRAIN, |
505 | [IB_7322_LT_STATE_CFGWAITENH] = | ||
506 | IB_PHYSPORTSTATE_CFG_WAIT_ENH, | ||
503 | [0x14] = IB_PHYSPORTSTATE_CFG_TRAIN, | 507 | [0x14] = IB_PHYSPORTSTATE_CFG_TRAIN, |
504 | [0x15] = IB_PHYSPORTSTATE_CFG_TRAIN, | 508 | [0x15] = IB_PHYSPORTSTATE_CFG_TRAIN, |
505 | [0x16] = IB_PHYSPORTSTATE_CFG_TRAIN, | 509 | [0x16] = IB_PHYSPORTSTATE_CFG_TRAIN, |
@@ -1692,7 +1696,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst) | |||
1692 | break; | 1696 | break; |
1693 | } | 1697 | } |
1694 | 1698 | ||
1695 | if (ibclt == IB_7322_LT_STATE_CFGTEST && | 1699 | if (((ibclt >= IB_7322_LT_STATE_CFGTEST && |
1700 | ibclt <= IB_7322_LT_STATE_CFGWAITENH) || | ||
1701 | ibclt == IB_7322_LT_STATE_LINKUP) && | ||
1696 | (ibcst & SYM_MASK(IBCStatusA_0, LinkSpeedQDR))) { | 1702 | (ibcst & SYM_MASK(IBCStatusA_0, LinkSpeedQDR))) { |
1697 | force_h1(ppd); | 1703 | force_h1(ppd); |
1698 | ppd->cpspec->qdr_reforce = 1; | 1704 | ppd->cpspec->qdr_reforce = 1; |
@@ -7301,12 +7307,17 @@ static void ibsd_wr_allchans(struct qib_pportdata *ppd, int addr, unsigned data, | |||
7301 | static void serdes_7322_los_enable(struct qib_pportdata *ppd, int enable) | 7307 | static void serdes_7322_los_enable(struct qib_pportdata *ppd, int enable) |
7302 | { | 7308 | { |
7303 | u64 data = qib_read_kreg_port(ppd, krp_serdesctrl); | 7309 | u64 data = qib_read_kreg_port(ppd, krp_serdesctrl); |
7304 | printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS %s\n", | 7310 | u8 state = SYM_FIELD(data, IBSerdesCtrl_0, RXLOSEN); |
7305 | ppd->dd->unit, ppd->port, (enable ? "on" : "off")); | 7311 | |
7306 | if (enable) | 7312 | if (enable && !state) { |
7313 | printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS on\n", | ||
7314 | ppd->dd->unit, ppd->port); | ||
7307 | data |= SYM_MASK(IBSerdesCtrl_0, RXLOSEN); | 7315 | data |= SYM_MASK(IBSerdesCtrl_0, RXLOSEN); |
7308 | else | 7316 | } else if (!enable && state) { |
7317 | printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS off\n", | ||
7318 | ppd->dd->unit, ppd->port); | ||
7309 | data &= ~SYM_MASK(IBSerdesCtrl_0, RXLOSEN); | 7319 | data &= ~SYM_MASK(IBSerdesCtrl_0, RXLOSEN); |
7320 | } | ||
7310 | qib_write_kreg_port(ppd, krp_serdesctrl, data); | 7321 | qib_write_kreg_port(ppd, krp_serdesctrl, data); |
7311 | } | 7322 | } |
7312 | 7323 | ||
diff --git a/drivers/infiniband/hw/qib/qib_intr.c b/drivers/infiniband/hw/qib/qib_intr.c index a693c56ec8a6..6ae57d23004a 100644 --- a/drivers/infiniband/hw/qib/qib_intr.c +++ b/drivers/infiniband/hw/qib/qib_intr.c | |||
@@ -96,8 +96,12 @@ void qib_handle_e_ibstatuschanged(struct qib_pportdata *ppd, u64 ibcs) | |||
96 | * states, or if it transitions from any of the up (INIT or better) | 96 | * states, or if it transitions from any of the up (INIT or better) |
97 | * states into any of the down states (except link recovery), then | 97 | * states into any of the down states (except link recovery), then |
98 | * call the chip-specific code to take appropriate actions. | 98 | * call the chip-specific code to take appropriate actions. |
99 | * | ||
100 | * ppd->lflags could be 0 if this is the first time the interrupt | ||
101 | * handlers has been called but the link is already up. | ||
99 | */ | 102 | */ |
100 | if (lstate >= IB_PORT_INIT && (ppd->lflags & QIBL_LINKDOWN) && | 103 | if (lstate >= IB_PORT_INIT && |
104 | (!ppd->lflags || (ppd->lflags & QIBL_LINKDOWN)) && | ||
101 | ltstate == IB_PHYSPORTSTATE_LINKUP) { | 105 | ltstate == IB_PHYSPORTSTATE_LINKUP) { |
102 | /* transitioned to UP */ | 106 | /* transitioned to UP */ |
103 | if (dd->f_ib_updown(ppd, 1, ibcs)) | 107 | if (dd->f_ib_updown(ppd, 1, ibcs)) |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index be0921ef6b52..4cf25347b015 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -111,7 +111,8 @@ static void evdev_event(struct input_handle *handle, | |||
111 | 111 | ||
112 | rcu_read_unlock(); | 112 | rcu_read_unlock(); |
113 | 113 | ||
114 | wake_up_interruptible(&evdev->wait); | 114 | if (type == EV_SYN && code == SYN_REPORT) |
115 | wake_up_interruptible(&evdev->wait); | ||
115 | } | 116 | } |
116 | 117 | ||
117 | static int evdev_fasync(int fd, struct file *file, int on) | 118 | static int evdev_fasync(int fd, struct file *file, int on) |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 75e11c7b70fd..da38d97a51b1 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1756,7 +1756,7 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev) | |||
1756 | } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) { | 1756 | } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) { |
1757 | mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum - | 1757 | mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum - |
1758 | dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1, | 1758 | dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1, |
1759 | clamp(mt_slots, 2, 32); | 1759 | mt_slots = clamp(mt_slots, 2, 32); |
1760 | } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { | 1760 | } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { |
1761 | mt_slots = 2; | 1761 | mt_slots = 2; |
1762 | } else { | 1762 | } else { |
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index f23a743817db..33d0bdc837c0 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c | |||
@@ -209,6 +209,7 @@ static void omap_kp_tasklet(unsigned long data) | |||
209 | #endif | 209 | #endif |
210 | } | 210 | } |
211 | } | 211 | } |
212 | input_sync(omap_kp_data->input); | ||
212 | memcpy(keypad_state, new_state, sizeof(keypad_state)); | 213 | memcpy(keypad_state, new_state, sizeof(keypad_state)); |
213 | 214 | ||
214 | if (key_down) { | 215 | if (key_down) { |
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index 834cf98e7efb..6876700a4469 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c | |||
@@ -32,7 +32,7 @@ static const struct { | |||
32 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, | 32 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, |
33 | [SH_KEYSC_MODE_4] = { 3, 6, 6 }, | 33 | [SH_KEYSC_MODE_4] = { 3, 6, 6 }, |
34 | [SH_KEYSC_MODE_5] = { 4, 6, 7 }, | 34 | [SH_KEYSC_MODE_5] = { 4, 6, 7 }, |
35 | [SH_KEYSC_MODE_6] = { 5, 7, 7 }, | 35 | [SH_KEYSC_MODE_6] = { 5, 8, 8 }, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | struct sh_keysc_priv { | 38 | struct sh_keysc_priv { |
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 257e033986e4..0110b5a3a167 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -187,7 +187,7 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, | |||
187 | if (size == 0) | 187 | if (size == 0) |
188 | size = xres ? : 1; | 188 | size = xres ? : 1; |
189 | 189 | ||
190 | clamp(value, min, max); | 190 | value = clamp(value, min, max); |
191 | 191 | ||
192 | mousedev->packet.x = ((value - min) * xres) / size; | 192 | mousedev->packet.x = ((value - min) * xres) / size; |
193 | mousedev->packet.abs_event = 1; | 193 | mousedev->packet.abs_event = 1; |
@@ -201,7 +201,7 @@ static void mousedev_abs_event(struct input_dev *dev, struct mousedev *mousedev, | |||
201 | if (size == 0) | 201 | if (size == 0) |
202 | size = yres ? : 1; | 202 | size = yres ? : 1; |
203 | 203 | ||
204 | clamp(value, min, max); | 204 | value = clamp(value, min, max); |
205 | 205 | ||
206 | mousedev->packet.y = yres - ((value - min) * yres) / size; | 206 | mousedev->packet.y = yres - ((value - min) * yres) / size; |
207 | mousedev->packet.abs_event = 1; | 207 | mousedev->packet.abs_event = 1; |
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index f3698967edf6..8755f5f3ad37 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -120,21 +120,17 @@ static void serport_ldisc_close(struct tty_struct *tty) | |||
120 | * 'interrupt' routine. | 120 | * 'interrupt' routine. |
121 | */ | 121 | */ |
122 | 122 | ||
123 | static unsigned int serport_ldisc_receive(struct tty_struct *tty, | 123 | static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) |
124 | const unsigned char *cp, char *fp, int count) | ||
125 | { | 124 | { |
126 | struct serport *serport = (struct serport*) tty->disc_data; | 125 | struct serport *serport = (struct serport*) tty->disc_data; |
127 | unsigned long flags; | 126 | unsigned long flags; |
128 | unsigned int ch_flags; | 127 | unsigned int ch_flags; |
129 | int ret = 0; | ||
130 | int i; | 128 | int i; |
131 | 129 | ||
132 | spin_lock_irqsave(&serport->lock, flags); | 130 | spin_lock_irqsave(&serport->lock, flags); |
133 | 131 | ||
134 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) { | 132 | if (!test_bit(SERPORT_ACTIVE, &serport->flags)) |
135 | ret = -EINVAL; | ||
136 | goto out; | 133 | goto out; |
137 | } | ||
138 | 134 | ||
139 | for (i = 0; i < count; i++) { | 135 | for (i = 0; i < count; i++) { |
140 | switch (fp[i]) { | 136 | switch (fp[i]) { |
@@ -156,8 +152,6 @@ static unsigned int serport_ldisc_receive(struct tty_struct *tty, | |||
156 | 152 | ||
157 | out: | 153 | out: |
158 | spin_unlock_irqrestore(&serport->lock, flags); | 154 | spin_unlock_irqrestore(&serport->lock, flags); |
159 | |||
160 | return ret == 0 ? count : ret; | ||
161 | } | 155 | } |
162 | 156 | ||
163 | /* | 157 | /* |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index 59de638225fe..e35058bcd7b9 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -156,8 +156,10 @@ static int if_open(struct tty_struct *tty, struct file *filp) | |||
156 | if (!cs || !try_module_get(cs->driver->owner)) | 156 | if (!cs || !try_module_get(cs->driver->owner)) |
157 | return -ENODEV; | 157 | return -ENODEV; |
158 | 158 | ||
159 | if (mutex_lock_interruptible(&cs->mutex)) | 159 | if (mutex_lock_interruptible(&cs->mutex)) { |
160 | module_put(cs->driver->owner); | ||
160 | return -ERESTARTSYS; | 161 | return -ERESTARTSYS; |
162 | } | ||
161 | tty->driver_data = cs; | 163 | tty->driver_data = cs; |
162 | 164 | ||
163 | ++cs->open_count; | 165 | ++cs->open_count; |
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index 1d44d470897c..86a5c4f7775e 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
@@ -674,7 +674,7 @@ gigaset_tty_ioctl(struct tty_struct *tty, struct file *file, | |||
674 | * cflags buffer containing error flags for received characters (ignored) | 674 | * cflags buffer containing error flags for received characters (ignored) |
675 | * count number of received characters | 675 | * count number of received characters |
676 | */ | 676 | */ |
677 | static unsigned int | 677 | static void |
678 | gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | 678 | gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, |
679 | char *cflags, int count) | 679 | char *cflags, int count) |
680 | { | 680 | { |
@@ -683,12 +683,12 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
683 | struct inbuf_t *inbuf; | 683 | struct inbuf_t *inbuf; |
684 | 684 | ||
685 | if (!cs) | 685 | if (!cs) |
686 | return -ENODEV; | 686 | return; |
687 | inbuf = cs->inbuf; | 687 | inbuf = cs->inbuf; |
688 | if (!inbuf) { | 688 | if (!inbuf) { |
689 | dev_err(cs->dev, "%s: no inbuf\n", __func__); | 689 | dev_err(cs->dev, "%s: no inbuf\n", __func__); |
690 | cs_put(cs); | 690 | cs_put(cs); |
691 | return -EINVAL; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | tail = inbuf->tail; | 694 | tail = inbuf->tail; |
@@ -725,8 +725,6 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
725 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); | 725 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); |
726 | gigaset_schedule_event(cs); | 726 | gigaset_schedule_event(cs); |
727 | cs_put(cs); | 727 | cs_put(cs); |
728 | |||
729 | return count; | ||
730 | } | 728 | } |
731 | 729 | ||
732 | /* | 730 | /* |
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 3ccbff13eaf2..71a8eb6ef71e 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c | |||
@@ -283,6 +283,7 @@ hfcsusb_ph_info(struct hfcsusb *hw) | |||
283 | _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY, | 283 | _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY, |
284 | sizeof(struct ph_info_dch) + dch->dev.nrbchan * | 284 | sizeof(struct ph_info_dch) + dch->dev.nrbchan * |
285 | sizeof(struct ph_info_ch), phi, GFP_ATOMIC); | 285 | sizeof(struct ph_info_ch), phi, GFP_ATOMIC); |
286 | kfree(phi); | ||
286 | } | 287 | } |
287 | 288 | ||
288 | /* | 289 | /* |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 23f0d5e99f35..713d43b4e563 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -1,3 +1,10 @@ | |||
1 | config LEDS_GPIO_REGISTER | ||
2 | bool | ||
3 | help | ||
4 | This option provides the function gpio_led_register_device. | ||
5 | As this function is used by arch code it must not be compiled as a | ||
6 | module. | ||
7 | |||
1 | menuconfig NEW_LEDS | 8 | menuconfig NEW_LEDS |
2 | bool "LED Support" | 9 | bool "LED Support" |
3 | help | 10 | help |
@@ -7,22 +14,14 @@ menuconfig NEW_LEDS | |||
7 | This is not related to standard keyboard LEDs which are controlled | 14 | This is not related to standard keyboard LEDs which are controlled |
8 | via the input system. | 15 | via the input system. |
9 | 16 | ||
17 | if NEW_LEDS | ||
18 | |||
10 | config LEDS_CLASS | 19 | config LEDS_CLASS |
11 | bool "LED Class Support" | 20 | bool "LED Class Support" |
12 | depends on NEW_LEDS | ||
13 | help | 21 | help |
14 | This option enables the led sysfs class in /sys/class/leds. You'll | 22 | This option enables the led sysfs class in /sys/class/leds. You'll |
15 | need this to do anything useful with LEDs. If unsure, say N. | 23 | need this to do anything useful with LEDs. If unsure, say N. |
16 | 24 | ||
17 | config LEDS_GPIO_REGISTER | ||
18 | bool | ||
19 | help | ||
20 | This option provides the function gpio_led_register_device. | ||
21 | As this function is used by arch code it must not be compiled as a | ||
22 | module. | ||
23 | |||
24 | if NEW_LEDS | ||
25 | |||
26 | comment "LED drivers" | 25 | comment "LED drivers" |
27 | 26 | ||
28 | config LEDS_88PM860X | 27 | config LEDS_88PM860X |
@@ -391,6 +390,7 @@ config LEDS_NETXBIG | |||
391 | 390 | ||
392 | config LEDS_ASIC3 | 391 | config LEDS_ASIC3 |
393 | bool "LED support for the HTC ASIC3" | 392 | bool "LED support for the HTC ASIC3" |
393 | depends on LEDS_CLASS | ||
394 | depends on MFD_ASIC3 | 394 | depends on MFD_ASIC3 |
395 | default y | 395 | default y |
396 | help | 396 | help |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 70bd738b8b99..574b09afedd3 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -534,6 +534,82 @@ void bitmap_print_sb(struct bitmap *bitmap) | |||
534 | kunmap_atomic(sb, KM_USER0); | 534 | kunmap_atomic(sb, KM_USER0); |
535 | } | 535 | } |
536 | 536 | ||
537 | /* | ||
538 | * bitmap_new_disk_sb | ||
539 | * @bitmap | ||
540 | * | ||
541 | * This function is somewhat the reverse of bitmap_read_sb. bitmap_read_sb | ||
542 | * reads and verifies the on-disk bitmap superblock and populates bitmap_info. | ||
543 | * This function verifies 'bitmap_info' and populates the on-disk bitmap | ||
544 | * structure, which is to be written to disk. | ||
545 | * | ||
546 | * Returns: 0 on success, -Exxx on error | ||
547 | */ | ||
548 | static int bitmap_new_disk_sb(struct bitmap *bitmap) | ||
549 | { | ||
550 | bitmap_super_t *sb; | ||
551 | unsigned long chunksize, daemon_sleep, write_behind; | ||
552 | int err = -EINVAL; | ||
553 | |||
554 | bitmap->sb_page = alloc_page(GFP_KERNEL); | ||
555 | if (IS_ERR(bitmap->sb_page)) { | ||
556 | err = PTR_ERR(bitmap->sb_page); | ||
557 | bitmap->sb_page = NULL; | ||
558 | return err; | ||
559 | } | ||
560 | bitmap->sb_page->index = 0; | ||
561 | |||
562 | sb = kmap_atomic(bitmap->sb_page, KM_USER0); | ||
563 | |||
564 | sb->magic = cpu_to_le32(BITMAP_MAGIC); | ||
565 | sb->version = cpu_to_le32(BITMAP_MAJOR_HI); | ||
566 | |||
567 | chunksize = bitmap->mddev->bitmap_info.chunksize; | ||
568 | BUG_ON(!chunksize); | ||
569 | if (!is_power_of_2(chunksize)) { | ||
570 | kunmap_atomic(sb, KM_USER0); | ||
571 | printk(KERN_ERR "bitmap chunksize not a power of 2\n"); | ||
572 | return -EINVAL; | ||
573 | } | ||
574 | sb->chunksize = cpu_to_le32(chunksize); | ||
575 | |||
576 | daemon_sleep = bitmap->mddev->bitmap_info.daemon_sleep; | ||
577 | if (!daemon_sleep || | ||
578 | (daemon_sleep < 1) || (daemon_sleep > MAX_SCHEDULE_TIMEOUT)) { | ||
579 | printk(KERN_INFO "Choosing daemon_sleep default (5 sec)\n"); | ||
580 | daemon_sleep = 5 * HZ; | ||
581 | } | ||
582 | sb->daemon_sleep = cpu_to_le32(daemon_sleep); | ||
583 | bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; | ||
584 | |||
585 | /* | ||
586 | * FIXME: write_behind for RAID1. If not specified, what | ||
587 | * is a good choice? We choose COUNTER_MAX / 2 arbitrarily. | ||
588 | */ | ||
589 | write_behind = bitmap->mddev->bitmap_info.max_write_behind; | ||
590 | if (write_behind > COUNTER_MAX) | ||
591 | write_behind = COUNTER_MAX / 2; | ||
592 | sb->write_behind = cpu_to_le32(write_behind); | ||
593 | bitmap->mddev->bitmap_info.max_write_behind = write_behind; | ||
594 | |||
595 | /* keep the array size field of the bitmap superblock up to date */ | ||
596 | sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors); | ||
597 | |||
598 | memcpy(sb->uuid, bitmap->mddev->uuid, 16); | ||
599 | |||
600 | bitmap->flags |= BITMAP_STALE; | ||
601 | sb->state |= cpu_to_le32(BITMAP_STALE); | ||
602 | bitmap->events_cleared = bitmap->mddev->events; | ||
603 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); | ||
604 | |||
605 | bitmap->flags |= BITMAP_HOSTENDIAN; | ||
606 | sb->version = cpu_to_le32(BITMAP_MAJOR_HOSTENDIAN); | ||
607 | |||
608 | kunmap_atomic(sb, KM_USER0); | ||
609 | |||
610 | return 0; | ||
611 | } | ||
612 | |||
537 | /* read the superblock from the bitmap file and initialize some bitmap fields */ | 613 | /* read the superblock from the bitmap file and initialize some bitmap fields */ |
538 | static int bitmap_read_sb(struct bitmap *bitmap) | 614 | static int bitmap_read_sb(struct bitmap *bitmap) |
539 | { | 615 | { |
@@ -575,7 +651,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) | |||
575 | reason = "unrecognized superblock version"; | 651 | reason = "unrecognized superblock version"; |
576 | else if (chunksize < 512) | 652 | else if (chunksize < 512) |
577 | reason = "bitmap chunksize too small"; | 653 | reason = "bitmap chunksize too small"; |
578 | else if ((1 << ffz(~chunksize)) != chunksize) | 654 | else if (!is_power_of_2(chunksize)) |
579 | reason = "bitmap chunksize not a power of 2"; | 655 | reason = "bitmap chunksize not a power of 2"; |
580 | else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT) | 656 | else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT) |
581 | reason = "daemon sleep period out of range"; | 657 | reason = "daemon sleep period out of range"; |
@@ -1076,8 +1152,8 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
1076 | } | 1152 | } |
1077 | 1153 | ||
1078 | printk(KERN_INFO "%s: bitmap initialized from disk: " | 1154 | printk(KERN_INFO "%s: bitmap initialized from disk: " |
1079 | "read %lu/%lu pages, set %lu bits\n", | 1155 | "read %lu/%lu pages, set %lu of %lu bits\n", |
1080 | bmname(bitmap), bitmap->file_pages, num_pages, bit_cnt); | 1156 | bmname(bitmap), bitmap->file_pages, num_pages, bit_cnt, chunks); |
1081 | 1157 | ||
1082 | return 0; | 1158 | return 0; |
1083 | 1159 | ||
@@ -1332,7 +1408,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect | |||
1332 | return 0; | 1408 | return 0; |
1333 | } | 1409 | } |
1334 | 1410 | ||
1335 | if (unlikely((*bmc & COUNTER_MAX) == COUNTER_MAX)) { | 1411 | if (unlikely(COUNTER(*bmc) == COUNTER_MAX)) { |
1336 | DEFINE_WAIT(__wait); | 1412 | DEFINE_WAIT(__wait); |
1337 | /* note that it is safe to do the prepare_to_wait | 1413 | /* note that it is safe to do the prepare_to_wait |
1338 | * after the test as long as we do it before dropping | 1414 | * after the test as long as we do it before dropping |
@@ -1404,10 +1480,10 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto | |||
1404 | sysfs_notify_dirent_safe(bitmap->sysfs_can_clear); | 1480 | sysfs_notify_dirent_safe(bitmap->sysfs_can_clear); |
1405 | } | 1481 | } |
1406 | 1482 | ||
1407 | if (!success && ! (*bmc & NEEDED_MASK)) | 1483 | if (!success && !NEEDED(*bmc)) |
1408 | *bmc |= NEEDED_MASK; | 1484 | *bmc |= NEEDED_MASK; |
1409 | 1485 | ||
1410 | if ((*bmc & COUNTER_MAX) == COUNTER_MAX) | 1486 | if (COUNTER(*bmc) == COUNTER_MAX) |
1411 | wake_up(&bitmap->overflow_wait); | 1487 | wake_up(&bitmap->overflow_wait); |
1412 | 1488 | ||
1413 | (*bmc)--; | 1489 | (*bmc)--; |
@@ -1728,9 +1804,16 @@ int bitmap_create(mddev_t *mddev) | |||
1728 | vfs_fsync(file, 1); | 1804 | vfs_fsync(file, 1); |
1729 | } | 1805 | } |
1730 | /* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */ | 1806 | /* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */ |
1731 | if (!mddev->bitmap_info.external) | 1807 | if (!mddev->bitmap_info.external) { |
1732 | err = bitmap_read_sb(bitmap); | 1808 | /* |
1733 | else { | 1809 | * If 'MD_ARRAY_FIRST_USE' is set, then device-mapper is |
1810 | * instructing us to create a new on-disk bitmap instance. | ||
1811 | */ | ||
1812 | if (test_and_clear_bit(MD_ARRAY_FIRST_USE, &mddev->flags)) | ||
1813 | err = bitmap_new_disk_sb(bitmap); | ||
1814 | else | ||
1815 | err = bitmap_read_sb(bitmap); | ||
1816 | } else { | ||
1734 | err = 0; | 1817 | err = 0; |
1735 | if (mddev->bitmap_info.chunksize == 0 || | 1818 | if (mddev->bitmap_info.chunksize == 0 || |
1736 | mddev->bitmap_info.daemon_sleep == 0) | 1819 | mddev->bitmap_info.daemon_sleep == 0) |
@@ -1754,9 +1837,6 @@ int bitmap_create(mddev_t *mddev) | |||
1754 | bitmap->chunks = chunks; | 1837 | bitmap->chunks = chunks; |
1755 | bitmap->pages = pages; | 1838 | bitmap->pages = pages; |
1756 | bitmap->missing_pages = pages; | 1839 | bitmap->missing_pages = pages; |
1757 | bitmap->counter_bits = COUNTER_BITS; | ||
1758 | |||
1759 | bitmap->syncchunk = ~0UL; | ||
1760 | 1840 | ||
1761 | #ifdef INJECT_FATAL_FAULT_1 | 1841 | #ifdef INJECT_FATAL_FAULT_1 |
1762 | bitmap->bp = NULL; | 1842 | bitmap->bp = NULL; |
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index d0aeaf46d932..b2a127e891ac 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h | |||
@@ -85,7 +85,6 @@ | |||
85 | typedef __u16 bitmap_counter_t; | 85 | typedef __u16 bitmap_counter_t; |
86 | #define COUNTER_BITS 16 | 86 | #define COUNTER_BITS 16 |
87 | #define COUNTER_BIT_SHIFT 4 | 87 | #define COUNTER_BIT_SHIFT 4 |
88 | #define COUNTER_BYTE_RATIO (COUNTER_BITS / 8) | ||
89 | #define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3) | 88 | #define COUNTER_BYTE_SHIFT (COUNTER_BIT_SHIFT - 3) |
90 | 89 | ||
91 | #define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1))) | 90 | #define NEEDED_MASK ((bitmap_counter_t) (1 << (COUNTER_BITS - 1))) |
@@ -196,19 +195,10 @@ struct bitmap { | |||
196 | 195 | ||
197 | mddev_t *mddev; /* the md device that the bitmap is for */ | 196 | mddev_t *mddev; /* the md device that the bitmap is for */ |
198 | 197 | ||
199 | int counter_bits; /* how many bits per block counter */ | ||
200 | |||
201 | /* bitmap chunksize -- how much data does each bit represent? */ | 198 | /* bitmap chunksize -- how much data does each bit represent? */ |
202 | unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */ | 199 | unsigned long chunkshift; /* chunksize = 2^chunkshift (for bitops) */ |
203 | unsigned long chunks; /* total number of data chunks for the array */ | 200 | unsigned long chunks; /* total number of data chunks for the array */ |
204 | 201 | ||
205 | /* We hold a count on the chunk currently being synced, and drop | ||
206 | * it when the last block is started. If the resync is aborted | ||
207 | * midway, we need to be able to drop that count, so we remember | ||
208 | * the counted chunk.. | ||
209 | */ | ||
210 | unsigned long syncchunk; | ||
211 | |||
212 | __u64 events_cleared; | 202 | __u64 events_cleared; |
213 | int need_sync; | 203 | int need_sync; |
214 | 204 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index aa640a85bb21..4332fc2f25d4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -351,6 +351,9 @@ void mddev_resume(mddev_t *mddev) | |||
351 | mddev->suspended = 0; | 351 | mddev->suspended = 0; |
352 | wake_up(&mddev->sb_wait); | 352 | wake_up(&mddev->sb_wait); |
353 | mddev->pers->quiesce(mddev, 0); | 353 | mddev->pers->quiesce(mddev, 0); |
354 | |||
355 | md_wakeup_thread(mddev->thread); | ||
356 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | ||
354 | } | 357 | } |
355 | EXPORT_SYMBOL_GPL(mddev_resume); | 358 | EXPORT_SYMBOL_GPL(mddev_resume); |
356 | 359 | ||
@@ -1750,6 +1753,18 @@ static struct super_type super_types[] = { | |||
1750 | }, | 1753 | }, |
1751 | }; | 1754 | }; |
1752 | 1755 | ||
1756 | static void sync_super(mddev_t *mddev, mdk_rdev_t *rdev) | ||
1757 | { | ||
1758 | if (mddev->sync_super) { | ||
1759 | mddev->sync_super(mddev, rdev); | ||
1760 | return; | ||
1761 | } | ||
1762 | |||
1763 | BUG_ON(mddev->major_version >= ARRAY_SIZE(super_types)); | ||
1764 | |||
1765 | super_types[mddev->major_version].sync_super(mddev, rdev); | ||
1766 | } | ||
1767 | |||
1753 | static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) | 1768 | static int match_mddev_units(mddev_t *mddev1, mddev_t *mddev2) |
1754 | { | 1769 | { |
1755 | mdk_rdev_t *rdev, *rdev2; | 1770 | mdk_rdev_t *rdev, *rdev2; |
@@ -1781,8 +1796,8 @@ int md_integrity_register(mddev_t *mddev) | |||
1781 | 1796 | ||
1782 | if (list_empty(&mddev->disks)) | 1797 | if (list_empty(&mddev->disks)) |
1783 | return 0; /* nothing to do */ | 1798 | return 0; /* nothing to do */ |
1784 | if (blk_get_integrity(mddev->gendisk)) | 1799 | if (!mddev->gendisk || blk_get_integrity(mddev->gendisk)) |
1785 | return 0; /* already registered */ | 1800 | return 0; /* shouldn't register, or already is */ |
1786 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 1801 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
1787 | /* skip spares and non-functional disks */ | 1802 | /* skip spares and non-functional disks */ |
1788 | if (test_bit(Faulty, &rdev->flags)) | 1803 | if (test_bit(Faulty, &rdev->flags)) |
@@ -2168,8 +2183,7 @@ static void sync_sbs(mddev_t * mddev, int nospares) | |||
2168 | /* Don't update this superblock */ | 2183 | /* Don't update this superblock */ |
2169 | rdev->sb_loaded = 2; | 2184 | rdev->sb_loaded = 2; |
2170 | } else { | 2185 | } else { |
2171 | super_types[mddev->major_version]. | 2186 | sync_super(mddev, rdev); |
2172 | sync_super(mddev, rdev); | ||
2173 | rdev->sb_loaded = 1; | 2187 | rdev->sb_loaded = 1; |
2174 | } | 2188 | } |
2175 | } | 2189 | } |
@@ -2462,7 +2476,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
2462 | if (rdev->raid_disk == -1) | 2476 | if (rdev->raid_disk == -1) |
2463 | return -EEXIST; | 2477 | return -EEXIST; |
2464 | /* personality does all needed checks */ | 2478 | /* personality does all needed checks */ |
2465 | if (rdev->mddev->pers->hot_add_disk == NULL) | 2479 | if (rdev->mddev->pers->hot_remove_disk == NULL) |
2466 | return -EINVAL; | 2480 | return -EINVAL; |
2467 | err = rdev->mddev->pers-> | 2481 | err = rdev->mddev->pers-> |
2468 | hot_remove_disk(rdev->mddev, rdev->raid_disk); | 2482 | hot_remove_disk(rdev->mddev, rdev->raid_disk); |
@@ -4619,9 +4633,6 @@ int md_run(mddev_t *mddev) | |||
4619 | if (mddev->flags) | 4633 | if (mddev->flags) |
4620 | md_update_sb(mddev, 0); | 4634 | md_update_sb(mddev, 0); |
4621 | 4635 | ||
4622 | md_wakeup_thread(mddev->thread); | ||
4623 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | ||
4624 | |||
4625 | md_new_event(mddev); | 4636 | md_new_event(mddev); |
4626 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 4637 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
4627 | sysfs_notify_dirent_safe(mddev->sysfs_action); | 4638 | sysfs_notify_dirent_safe(mddev->sysfs_action); |
@@ -4642,6 +4653,10 @@ static int do_md_run(mddev_t *mddev) | |||
4642 | bitmap_destroy(mddev); | 4653 | bitmap_destroy(mddev); |
4643 | goto out; | 4654 | goto out; |
4644 | } | 4655 | } |
4656 | |||
4657 | md_wakeup_thread(mddev->thread); | ||
4658 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | ||
4659 | |||
4645 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4660 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4646 | revalidate_disk(mddev->gendisk); | 4661 | revalidate_disk(mddev->gendisk); |
4647 | mddev->changed = 1; | 4662 | mddev->changed = 1; |
@@ -5259,6 +5274,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) | |||
5259 | if (mddev->degraded) | 5274 | if (mddev->degraded) |
5260 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); | 5275 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); |
5261 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 5276 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
5277 | if (!err) | ||
5278 | md_new_event(mddev); | ||
5262 | md_wakeup_thread(mddev->thread); | 5279 | md_wakeup_thread(mddev->thread); |
5263 | return err; | 5280 | return err; |
5264 | } | 5281 | } |
@@ -6866,8 +6883,8 @@ void md_do_sync(mddev_t *mddev) | |||
6866 | * Tune reconstruction: | 6883 | * Tune reconstruction: |
6867 | */ | 6884 | */ |
6868 | window = 32*(PAGE_SIZE/512); | 6885 | window = 32*(PAGE_SIZE/512); |
6869 | printk(KERN_INFO "md: using %dk window, over a total of %llu blocks.\n", | 6886 | printk(KERN_INFO "md: using %dk window, over a total of %lluk.\n", |
6870 | window/2,(unsigned long long) max_sectors/2); | 6887 | window/2, (unsigned long long)max_sectors/2); |
6871 | 6888 | ||
6872 | atomic_set(&mddev->recovery_active, 0); | 6889 | atomic_set(&mddev->recovery_active, 0); |
6873 | last_check = 0; | 6890 | last_check = 0; |
@@ -7045,7 +7062,6 @@ void md_do_sync(mddev_t *mddev) | |||
7045 | } | 7062 | } |
7046 | EXPORT_SYMBOL_GPL(md_do_sync); | 7063 | EXPORT_SYMBOL_GPL(md_do_sync); |
7047 | 7064 | ||
7048 | |||
7049 | static int remove_and_add_spares(mddev_t *mddev) | 7065 | static int remove_and_add_spares(mddev_t *mddev) |
7050 | { | 7066 | { |
7051 | mdk_rdev_t *rdev; | 7067 | mdk_rdev_t *rdev; |
@@ -7157,6 +7173,9 @@ static void reap_sync_thread(mddev_t *mddev) | |||
7157 | */ | 7173 | */ |
7158 | void md_check_recovery(mddev_t *mddev) | 7174 | void md_check_recovery(mddev_t *mddev) |
7159 | { | 7175 | { |
7176 | if (mddev->suspended) | ||
7177 | return; | ||
7178 | |||
7160 | if (mddev->bitmap) | 7179 | if (mddev->bitmap) |
7161 | bitmap_daemon_work(mddev); | 7180 | bitmap_daemon_work(mddev); |
7162 | 7181 | ||
diff --git a/drivers/md/md.h b/drivers/md/md.h index 0b1fd3f1d85b..1c26c7a08ae6 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -124,6 +124,7 @@ struct mddev_s | |||
124 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ | 124 | #define MD_CHANGE_DEVS 0 /* Some device status has changed */ |
125 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ | 125 | #define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ |
126 | #define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ | 126 | #define MD_CHANGE_PENDING 2 /* switch from 'clean' to 'active' in progress */ |
127 | #define MD_ARRAY_FIRST_USE 3 /* First use of array, needs initialization */ | ||
127 | 128 | ||
128 | int suspended; | 129 | int suspended; |
129 | atomic_t active_io; | 130 | atomic_t active_io; |
@@ -330,6 +331,7 @@ struct mddev_s | |||
330 | atomic_t flush_pending; | 331 | atomic_t flush_pending; |
331 | struct work_struct flush_work; | 332 | struct work_struct flush_work; |
332 | struct work_struct event_work; /* used by dm to report failure event */ | 333 | struct work_struct event_work; /* used by dm to report failure event */ |
334 | void (*sync_super)(mddev_t *mddev, mdk_rdev_t *rdev); | ||
333 | }; | 335 | }; |
334 | 336 | ||
335 | 337 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 5d096096f958..f7431b6d8447 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -497,21 +497,19 @@ static int read_balance(conf_t *conf, r1bio_t *r1_bio) | |||
497 | return best_disk; | 497 | return best_disk; |
498 | } | 498 | } |
499 | 499 | ||
500 | static int raid1_congested(void *data, int bits) | 500 | int md_raid1_congested(mddev_t *mddev, int bits) |
501 | { | 501 | { |
502 | mddev_t *mddev = data; | ||
503 | conf_t *conf = mddev->private; | 502 | conf_t *conf = mddev->private; |
504 | int i, ret = 0; | 503 | int i, ret = 0; |
505 | 504 | ||
506 | if (mddev_congested(mddev, bits)) | ||
507 | return 1; | ||
508 | |||
509 | rcu_read_lock(); | 505 | rcu_read_lock(); |
510 | for (i = 0; i < mddev->raid_disks; i++) { | 506 | for (i = 0; i < mddev->raid_disks; i++) { |
511 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | 507 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); |
512 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | 508 | if (rdev && !test_bit(Faulty, &rdev->flags)) { |
513 | struct request_queue *q = bdev_get_queue(rdev->bdev); | 509 | struct request_queue *q = bdev_get_queue(rdev->bdev); |
514 | 510 | ||
511 | BUG_ON(!q); | ||
512 | |||
515 | /* Note the '|| 1' - when read_balance prefers | 513 | /* Note the '|| 1' - when read_balance prefers |
516 | * non-congested targets, it can be removed | 514 | * non-congested targets, it can be removed |
517 | */ | 515 | */ |
@@ -524,7 +522,15 @@ static int raid1_congested(void *data, int bits) | |||
524 | rcu_read_unlock(); | 522 | rcu_read_unlock(); |
525 | return ret; | 523 | return ret; |
526 | } | 524 | } |
525 | EXPORT_SYMBOL_GPL(md_raid1_congested); | ||
527 | 526 | ||
527 | static int raid1_congested(void *data, int bits) | ||
528 | { | ||
529 | mddev_t *mddev = data; | ||
530 | |||
531 | return mddev_congested(mddev, bits) || | ||
532 | md_raid1_congested(mddev, bits); | ||
533 | } | ||
528 | 534 | ||
529 | static void flush_pending_writes(conf_t *conf) | 535 | static void flush_pending_writes(conf_t *conf) |
530 | { | 536 | { |
@@ -1972,6 +1978,8 @@ static int run(mddev_t *mddev) | |||
1972 | return PTR_ERR(conf); | 1978 | return PTR_ERR(conf); |
1973 | 1979 | ||
1974 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 1980 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
1981 | if (!mddev->gendisk) | ||
1982 | continue; | ||
1975 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 1983 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
1976 | rdev->data_offset << 9); | 1984 | rdev->data_offset << 9); |
1977 | /* as we don't honour merge_bvec_fn, we must never risk | 1985 | /* as we don't honour merge_bvec_fn, we must never risk |
@@ -2013,8 +2021,10 @@ static int run(mddev_t *mddev) | |||
2013 | 2021 | ||
2014 | md_set_array_sectors(mddev, raid1_size(mddev, 0, 0)); | 2022 | md_set_array_sectors(mddev, raid1_size(mddev, 0, 0)); |
2015 | 2023 | ||
2016 | mddev->queue->backing_dev_info.congested_fn = raid1_congested; | 2024 | if (mddev->queue) { |
2017 | mddev->queue->backing_dev_info.congested_data = mddev; | 2025 | mddev->queue->backing_dev_info.congested_fn = raid1_congested; |
2026 | mddev->queue->backing_dev_info.congested_data = mddev; | ||
2027 | } | ||
2018 | return md_integrity_register(mddev); | 2028 | return md_integrity_register(mddev); |
2019 | } | 2029 | } |
2020 | 2030 | ||
diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h index 5fc4ca1af863..e743a64fac4f 100644 --- a/drivers/md/raid1.h +++ b/drivers/md/raid1.h | |||
@@ -126,4 +126,6 @@ struct r1bio_s { | |||
126 | */ | 126 | */ |
127 | #define R1BIO_Returned 6 | 127 | #define R1BIO_Returned 6 |
128 | 128 | ||
129 | extern int md_raid1_congested(mddev_t *mddev, int bits); | ||
130 | |||
129 | #endif | 131 | #endif |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 346e69bfdab3..b72edf35ec54 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -129,7 +129,7 @@ static inline int raid5_dec_bi_hw_segments(struct bio *bio) | |||
129 | 129 | ||
130 | static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt) | 130 | static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt) |
131 | { | 131 | { |
132 | bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16); | 132 | bio->bi_phys_segments = raid5_bi_phys_segments(bio) | (cnt << 16); |
133 | } | 133 | } |
134 | 134 | ||
135 | /* Find first data disk in a raid6 stripe */ | 135 | /* Find first data disk in a raid6 stripe */ |
@@ -514,7 +514,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
514 | bi = &sh->dev[i].req; | 514 | bi = &sh->dev[i].req; |
515 | 515 | ||
516 | bi->bi_rw = rw; | 516 | bi->bi_rw = rw; |
517 | if (rw == WRITE) | 517 | if (rw & WRITE) |
518 | bi->bi_end_io = raid5_end_write_request; | 518 | bi->bi_end_io = raid5_end_write_request; |
519 | else | 519 | else |
520 | bi->bi_end_io = raid5_end_read_request; | 520 | bi->bi_end_io = raid5_end_read_request; |
@@ -548,13 +548,13 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
548 | bi->bi_io_vec[0].bv_offset = 0; | 548 | bi->bi_io_vec[0].bv_offset = 0; |
549 | bi->bi_size = STRIPE_SIZE; | 549 | bi->bi_size = STRIPE_SIZE; |
550 | bi->bi_next = NULL; | 550 | bi->bi_next = NULL; |
551 | if (rw == WRITE && | 551 | if ((rw & WRITE) && |
552 | test_bit(R5_ReWrite, &sh->dev[i].flags)) | 552 | test_bit(R5_ReWrite, &sh->dev[i].flags)) |
553 | atomic_add(STRIPE_SECTORS, | 553 | atomic_add(STRIPE_SECTORS, |
554 | &rdev->corrected_errors); | 554 | &rdev->corrected_errors); |
555 | generic_make_request(bi); | 555 | generic_make_request(bi); |
556 | } else { | 556 | } else { |
557 | if (rw == WRITE) | 557 | if (rw & WRITE) |
558 | set_bit(STRIPE_DEGRADED, &sh->state); | 558 | set_bit(STRIPE_DEGRADED, &sh->state); |
559 | pr_debug("skip op %ld on disc %d for sector %llu\n", | 559 | pr_debug("skip op %ld on disc %d for sector %llu\n", |
560 | bi->bi_rw, i, (unsigned long long)sh->sector); | 560 | bi->bi_rw, i, (unsigned long long)sh->sector); |
@@ -585,7 +585,7 @@ async_copy_data(int frombio, struct bio *bio, struct page *page, | |||
585 | init_async_submit(&submit, flags, tx, NULL, NULL, NULL); | 585 | init_async_submit(&submit, flags, tx, NULL, NULL, NULL); |
586 | 586 | ||
587 | bio_for_each_segment(bvl, bio, i) { | 587 | bio_for_each_segment(bvl, bio, i) { |
588 | int len = bio_iovec_idx(bio, i)->bv_len; | 588 | int len = bvl->bv_len; |
589 | int clen; | 589 | int clen; |
590 | int b_offset = 0; | 590 | int b_offset = 0; |
591 | 591 | ||
@@ -601,8 +601,8 @@ async_copy_data(int frombio, struct bio *bio, struct page *page, | |||
601 | clen = len; | 601 | clen = len; |
602 | 602 | ||
603 | if (clen > 0) { | 603 | if (clen > 0) { |
604 | b_offset += bio_iovec_idx(bio, i)->bv_offset; | 604 | b_offset += bvl->bv_offset; |
605 | bio_page = bio_iovec_idx(bio, i)->bv_page; | 605 | bio_page = bvl->bv_page; |
606 | if (frombio) | 606 | if (frombio) |
607 | tx = async_memcpy(page, bio_page, page_offset, | 607 | tx = async_memcpy(page, bio_page, page_offset, |
608 | b_offset, clen, &submit); | 608 | b_offset, clen, &submit); |
@@ -4858,7 +4858,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) | |||
4858 | printk(KERN_INFO "md/raid:%s: device %s operational as raid" | 4858 | printk(KERN_INFO "md/raid:%s: device %s operational as raid" |
4859 | " disk %d\n", | 4859 | " disk %d\n", |
4860 | mdname(mddev), bdevname(rdev->bdev, b), raid_disk); | 4860 | mdname(mddev), bdevname(rdev->bdev, b), raid_disk); |
4861 | } else | 4861 | } else if (rdev->saved_raid_disk != raid_disk) |
4862 | /* Cannot rely on bitmap to complete recovery */ | 4862 | /* Cannot rely on bitmap to complete recovery */ |
4863 | conf->fullsync = 1; | 4863 | conf->fullsync = 1; |
4864 | } | 4864 | } |
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index 4dc1ca333236..7c327b54308e 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c | |||
@@ -60,8 +60,6 @@ static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, | |||
60 | int act_len, ret; | 60 | int act_len, ret; |
61 | u8 buf[64]; | 61 | u8 buf[64]; |
62 | 62 | ||
63 | if (slen > sizeof(buf)) | ||
64 | slen = sizeof(buf); | ||
65 | memcpy(&buf[0], sbuf, slen); | 63 | memcpy(&buf[0], sbuf, slen); |
66 | buf[60] = state->seq++; | 64 | buf[60] = state->seq++; |
67 | 65 | ||
@@ -180,30 +178,37 @@ static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
180 | { | 178 | { |
181 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 179 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
182 | int ret = 0, inc, i = 0; | 180 | int ret = 0, inc, i = 0; |
181 | u8 buf[52]; /* 4 + 48 (I2C WR USB command header + I2C WR max) */ | ||
183 | 182 | ||
184 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) | 183 | if (mutex_lock_interruptible(&d->i2c_mutex) < 0) |
185 | return -EAGAIN; | 184 | return -EAGAIN; |
186 | 185 | ||
187 | while (i < num) { | 186 | while (i < num) { |
188 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { | 187 | if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { |
189 | u8 buf[6]; | 188 | if (msg[i].len > 2 || msg[i+1].len > 60) { |
189 | ret = -EOPNOTSUPP; | ||
190 | break; | ||
191 | } | ||
190 | buf[0] = CMD_I2C_READ; | 192 | buf[0] = CMD_I2C_READ; |
191 | buf[1] = (msg[i].addr << 1) | 0x01; | 193 | buf[1] = (msg[i].addr << 1) | 0x01; |
192 | buf[2] = msg[i].buf[0]; | 194 | buf[2] = msg[i].buf[0]; |
193 | buf[3] = msg[i].buf[1]; | 195 | buf[3] = msg[i].buf[1]; |
194 | buf[4] = msg[i].len-1; | 196 | buf[4] = msg[i].len-1; |
195 | buf[5] = msg[i+1].len; | 197 | buf[5] = msg[i+1].len; |
196 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), msg[i+1].buf, | 198 | ret = anysee_ctrl_msg(d, buf, 6, msg[i+1].buf, |
197 | msg[i+1].len); | 199 | msg[i+1].len); |
198 | inc = 2; | 200 | inc = 2; |
199 | } else { | 201 | } else { |
200 | u8 buf[4+msg[i].len]; | 202 | if (msg[i].len > 48) { |
203 | ret = -EOPNOTSUPP; | ||
204 | break; | ||
205 | } | ||
201 | buf[0] = CMD_I2C_WRITE; | 206 | buf[0] = CMD_I2C_WRITE; |
202 | buf[1] = (msg[i].addr << 1); | 207 | buf[1] = (msg[i].addr << 1); |
203 | buf[2] = msg[i].len; | 208 | buf[2] = msg[i].len; |
204 | buf[3] = 0x01; | 209 | buf[3] = 0x01; |
205 | memcpy(&buf[4], msg[i].buf, msg[i].len); | 210 | memcpy(&buf[4], msg[i].buf, msg[i].len); |
206 | ret = anysee_ctrl_msg(d, buf, sizeof(buf), NULL, 0); | 211 | ret = anysee_ctrl_msg(d, buf, 4 + msg[i].len, NULL, 0); |
207 | inc = 1; | 212 | inc = 1; |
208 | } | 213 | } |
209 | if (ret) | 214 | if (ret) |
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c index af5263c6625a..7b42ace419d9 100644 --- a/drivers/media/media-devnode.c +++ b/drivers/media/media-devnode.c | |||
@@ -213,14 +213,14 @@ int __must_check media_devnode_register(struct media_devnode *mdev) | |||
213 | 213 | ||
214 | /* Part 1: Find a free minor number */ | 214 | /* Part 1: Find a free minor number */ |
215 | mutex_lock(&media_devnode_lock); | 215 | mutex_lock(&media_devnode_lock); |
216 | minor = find_next_zero_bit(media_devnode_nums, 0, MEDIA_NUM_DEVICES); | 216 | minor = find_next_zero_bit(media_devnode_nums, MEDIA_NUM_DEVICES, 0); |
217 | if (minor == MEDIA_NUM_DEVICES) { | 217 | if (minor == MEDIA_NUM_DEVICES) { |
218 | mutex_unlock(&media_devnode_lock); | 218 | mutex_unlock(&media_devnode_lock); |
219 | printk(KERN_ERR "could not get a free minor\n"); | 219 | printk(KERN_ERR "could not get a free minor\n"); |
220 | return -ENFILE; | 220 | return -ENFILE; |
221 | } | 221 | } |
222 | 222 | ||
223 | set_bit(mdev->minor, media_devnode_nums); | 223 | set_bit(minor, media_devnode_nums); |
224 | mutex_unlock(&media_devnode_lock); | 224 | mutex_unlock(&media_devnode_lock); |
225 | 225 | ||
226 | mdev->minor = minor; | 226 | mdev->minor = minor; |
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 2354336862cf..934185cca758 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <media/cx25840.h> | 26 | #include <media/cx25840.h> |
27 | #include <linux/firmware.h> | 27 | #include <linux/firmware.h> |
28 | #include <staging/altera.h> | ||
29 | 28 | ||
29 | #include "../../../staging/altera-stapl/altera.h" | ||
30 | #include "cx23885.h" | 30 | #include "cx23885.h" |
31 | #include "tuner-xc2028.h" | 31 | #include "tuner-xc2028.h" |
32 | #include "netup-init.h" | 32 | #include "netup-init.h" |
diff --git a/drivers/media/video/gspca/coarse_expo_autogain.h b/drivers/media/video/gspca/coarse_expo_autogain.h deleted file mode 100644 index 1cb9d941eaf6..000000000000 --- a/drivers/media/video/gspca/coarse_expo_autogain.h +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /* | ||
2 | * Auto gain algorithm for camera's with a coarse exposure control | ||
3 | * | ||
4 | * Copyright (C) 2010 Hans de Goede <hdegoede@redhat.com> | ||
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 | /* Autogain + exposure algorithm for cameras with a coarse exposure control | ||
22 | (usually this means we can only control the clockdiv to change exposure) | ||
23 | As changing the clockdiv so that the fps drops from 30 to 15 fps for | ||
24 | example, will lead to a huge exposure change (it effectively doubles), | ||
25 | this algorithm normally tries to only adjust the gain (between 40 and | ||
26 | 80 %) and if that does not help, only then changes exposure. This leads | ||
27 | to a much more stable image then using the knee algorithm which at | ||
28 | certain points of the knee graph will only try to adjust exposure, | ||
29 | which leads to oscilating as one exposure step is huge. | ||
30 | |||
31 | Note this assumes that the sd struct for the cam in question has | ||
32 | exp_too_high_cnt and exp_too_high_cnt int members for use by this function. | ||
33 | |||
34 | Returns 0 if no changes were made, 1 if the gain and or exposure settings | ||
35 | where changed. */ | ||
36 | static int gspca_coarse_grained_expo_autogain(struct gspca_dev *gspca_dev, | ||
37 | int avg_lum, int desired_avg_lum, int deadzone) | ||
38 | { | ||
39 | int i, steps, gain, orig_gain, exposure, orig_exposure; | ||
40 | int gain_low, gain_high; | ||
41 | const struct ctrl *gain_ctrl = NULL; | ||
42 | const struct ctrl *exposure_ctrl = NULL; | ||
43 | struct sd *sd = (struct sd *) gspca_dev; | ||
44 | int retval = 0; | ||
45 | |||
46 | for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) { | ||
47 | if (gspca_dev->ctrl_dis & (1 << i)) | ||
48 | continue; | ||
49 | if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_GAIN) | ||
50 | gain_ctrl = &gspca_dev->sd_desc->ctrls[i]; | ||
51 | if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_EXPOSURE) | ||
52 | exposure_ctrl = &gspca_dev->sd_desc->ctrls[i]; | ||
53 | } | ||
54 | if (!gain_ctrl || !exposure_ctrl) { | ||
55 | PDEBUG(D_ERR, "Error: gspca_coarse_grained_expo_autogain " | ||
56 | "called on cam without gain or exposure"); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | if (gain_ctrl->get(gspca_dev, &gain) || | ||
61 | exposure_ctrl->get(gspca_dev, &exposure)) | ||
62 | return 0; | ||
63 | |||
64 | orig_gain = gain; | ||
65 | orig_exposure = exposure; | ||
66 | gain_low = | ||
67 | (gain_ctrl->qctrl.maximum - gain_ctrl->qctrl.minimum) / 5 * 2; | ||
68 | gain_low += gain_ctrl->qctrl.minimum; | ||
69 | gain_high = | ||
70 | (gain_ctrl->qctrl.maximum - gain_ctrl->qctrl.minimum) / 5 * 4; | ||
71 | gain_high += gain_ctrl->qctrl.minimum; | ||
72 | |||
73 | /* If we are of a multiple of deadzone, do multiple steps to reach the | ||
74 | desired lumination fast (with the risc of a slight overshoot) */ | ||
75 | steps = (desired_avg_lum - avg_lum) / deadzone; | ||
76 | |||
77 | PDEBUG(D_FRAM, "autogain: lum: %d, desired: %d, steps: %d", | ||
78 | avg_lum, desired_avg_lum, steps); | ||
79 | |||
80 | if ((gain + steps) > gain_high && | ||
81 | sd->exposure < exposure_ctrl->qctrl.maximum) { | ||
82 | gain = gain_high; | ||
83 | sd->exp_too_low_cnt++; | ||
84 | } else if ((gain + steps) < gain_low && | ||
85 | sd->exposure > exposure_ctrl->qctrl.minimum) { | ||
86 | gain = gain_low; | ||
87 | sd->exp_too_high_cnt++; | ||
88 | } else { | ||
89 | gain += steps; | ||
90 | if (gain > gain_ctrl->qctrl.maximum) | ||
91 | gain = gain_ctrl->qctrl.maximum; | ||
92 | else if (gain < gain_ctrl->qctrl.minimum) | ||
93 | gain = gain_ctrl->qctrl.minimum; | ||
94 | sd->exp_too_high_cnt = 0; | ||
95 | sd->exp_too_low_cnt = 0; | ||
96 | } | ||
97 | |||
98 | if (sd->exp_too_high_cnt > 3) { | ||
99 | exposure--; | ||
100 | sd->exp_too_high_cnt = 0; | ||
101 | } else if (sd->exp_too_low_cnt > 3) { | ||
102 | exposure++; | ||
103 | sd->exp_too_low_cnt = 0; | ||
104 | } | ||
105 | |||
106 | if (gain != orig_gain) { | ||
107 | gain_ctrl->set(gspca_dev, gain); | ||
108 | retval = 1; | ||
109 | } | ||
110 | if (exposure != orig_exposure) { | ||
111 | exposure_ctrl->set(gspca_dev, exposure); | ||
112 | retval = 1; | ||
113 | } | ||
114 | |||
115 | return retval; | ||
116 | } | ||
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 36a46fc78734..057e287b9152 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c | |||
@@ -609,7 +609,7 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = { | |||
609 | * buffers, there are some pretty strict real time constraints for | 609 | * buffers, there are some pretty strict real time constraints for |
610 | * isochronous transfer for larger frame sizes). | 610 | * isochronous transfer for larger frame sizes). |
611 | */ | 611 | */ |
612 | /*jfm: this value works well for 1600x1200, but not 800x600 - see isoc_init */ | 612 | /*jfm: this value does not work for 800x600 - see isoc_init */ |
613 | #define OVFX2_BULK_SIZE (13 * 4096) | 613 | #define OVFX2_BULK_SIZE (13 * 4096) |
614 | 614 | ||
615 | /* I2C registers */ | 615 | /* I2C registers */ |
@@ -3307,6 +3307,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
3307 | 3307 | ||
3308 | gspca_dev->cam.ctrls = sd->ctrls; | 3308 | gspca_dev->cam.ctrls = sd->ctrls; |
3309 | sd->quality = QUALITY_DEF; | 3309 | sd->quality = QUALITY_DEF; |
3310 | sd->frame_rate = 15; | ||
3310 | 3311 | ||
3311 | return 0; | 3312 | return 0; |
3312 | } | 3313 | } |
@@ -3469,7 +3470,6 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
3469 | ARRAY_SIZE(init_519_ov7660)); | 3470 | ARRAY_SIZE(init_519_ov7660)); |
3470 | write_i2c_regvals(sd, norm_7660, ARRAY_SIZE(norm_7660)); | 3471 | write_i2c_regvals(sd, norm_7660, ARRAY_SIZE(norm_7660)); |
3471 | sd->gspca_dev.curr_mode = 1; /* 640x480 */ | 3472 | sd->gspca_dev.curr_mode = 1; /* 640x480 */ |
3472 | sd->frame_rate = 15; | ||
3473 | ov519_set_mode(sd); | 3473 | ov519_set_mode(sd); |
3474 | ov519_set_fr(sd); | 3474 | ov519_set_fr(sd); |
3475 | sd->ctrls[COLORS].max = 4; /* 0..4 */ | 3475 | sd->ctrls[COLORS].max = 4; /* 0..4 */ |
@@ -3511,7 +3511,7 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev) | |||
3511 | 3511 | ||
3512 | switch (sd->bridge) { | 3512 | switch (sd->bridge) { |
3513 | case BRIDGE_OVFX2: | 3513 | case BRIDGE_OVFX2: |
3514 | if (gspca_dev->width == 1600) | 3514 | if (gspca_dev->width != 800) |
3515 | gspca_dev->cam.bulk_size = OVFX2_BULK_SIZE; | 3515 | gspca_dev->cam.bulk_size = OVFX2_BULK_SIZE; |
3516 | else | 3516 | else |
3517 | gspca_dev->cam.bulk_size = 7 * 4096; | 3517 | gspca_dev->cam.bulk_size = 7 * 4096; |
@@ -4478,7 +4478,7 @@ static void ovfx2_pkt_scan(struct gspca_dev *gspca_dev, | |||
4478 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); | 4478 | gspca_frame_add(gspca_dev, INTER_PACKET, data, len); |
4479 | 4479 | ||
4480 | /* A short read signals EOF */ | 4480 | /* A short read signals EOF */ |
4481 | if (len < OVFX2_BULK_SIZE) { | 4481 | if (len < gspca_dev->cam.bulk_size) { |
4482 | /* If the frame is short, and it is one of the first ones | 4482 | /* If the frame is short, and it is one of the first ones |
4483 | the sensor and bridge are still syncing, so drop it. */ | 4483 | the sensor and bridge are still syncing, so drop it. */ |
4484 | if (sd->first_frame) { | 4484 | if (sd->first_frame) { |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 6415aff5cbd1..81b8a600783b 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -60,7 +60,7 @@ struct sd { | |||
60 | 60 | ||
61 | u32 pktsz; /* (used by pkt_scan) */ | 61 | u32 pktsz; /* (used by pkt_scan) */ |
62 | u16 npkt; | 62 | u16 npkt; |
63 | u8 nchg; | 63 | s8 nchg; |
64 | s8 short_mark; | 64 | s8 short_mark; |
65 | 65 | ||
66 | u8 quality; /* image quality */ | 66 | u8 quality; /* image quality */ |
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.h b/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.h index b538dce96f78..a14a84a5079b 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.h +++ b/drivers/media/video/gspca/stv06xx/stv06xx_hdcs.h | |||
@@ -125,7 +125,7 @@ | |||
125 | #define HDCS_SLEEP_MODE (1 << 1) | 125 | #define HDCS_SLEEP_MODE (1 << 1) |
126 | 126 | ||
127 | #define HDCS_DEFAULT_EXPOSURE 48 | 127 | #define HDCS_DEFAULT_EXPOSURE 48 |
128 | #define HDCS_DEFAULT_GAIN 128 | 128 | #define HDCS_DEFAULT_GAIN 50 |
129 | 129 | ||
130 | static int hdcs_probe_1x00(struct sd *sd); | 130 | static int hdcs_probe_1x00(struct sd *sd); |
131 | static int hdcs_probe_1020(struct sd *sd); | 131 | static int hdcs_probe_1020(struct sd *sd); |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index a4e4dfdbc2f2..0fb75524484d 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -1328,6 +1328,8 @@ int ivtv_init_on_first_open(struct ivtv *itv) | |||
1328 | if (!itv->has_cx23415) | 1328 | if (!itv->has_cx23415) |
1329 | write_reg_sync(0x03, IVTV_REG_DMACONTROL); | 1329 | write_reg_sync(0x03, IVTV_REG_DMACONTROL); |
1330 | 1330 | ||
1331 | ivtv_s_std_enc(itv, &itv->tuner_std); | ||
1332 | |||
1331 | /* Default interrupts enabled. For the PVR350 this includes the | 1333 | /* Default interrupts enabled. For the PVR350 this includes the |
1332 | decoder VSYNC interrupt, which is always on. It is not only used | 1334 | decoder VSYNC interrupt, which is always on. It is not only used |
1333 | during decoding but also by the OSD. | 1335 | during decoding but also by the OSD. |
@@ -1336,12 +1338,10 @@ int ivtv_init_on_first_open(struct ivtv *itv) | |||
1336 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 1338 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { |
1337 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC); | 1339 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC); |
1338 | ivtv_set_osd_alpha(itv); | 1340 | ivtv_set_osd_alpha(itv); |
1339 | } | 1341 | ivtv_s_std_dec(itv, &itv->tuner_std); |
1340 | else | 1342 | } else { |
1341 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT); | 1343 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT); |
1342 | 1344 | } | |
1343 | /* For cards with video out, this call needs interrupts enabled */ | ||
1344 | ivtv_s_std(NULL, &fh, &itv->tuner_std); | ||
1345 | 1345 | ||
1346 | /* Setup initial controls */ | 1346 | /* Setup initial controls */ |
1347 | cx2341x_handler_setup(&itv->cxhdl); | 1347 | cx2341x_handler_setup(&itv->cxhdl); |
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index 14a1cea1d70d..02c5adebf517 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -280,8 +280,6 @@ int ivtv_firmware_restart(struct ivtv *itv) | |||
280 | { | 280 | { |
281 | int rc = 0; | 281 | int rc = 0; |
282 | v4l2_std_id std; | 282 | v4l2_std_id std; |
283 | struct ivtv_open_id fh; | ||
284 | fh.itv = itv; | ||
285 | 283 | ||
286 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | 284 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) |
287 | /* Display test image during restart */ | 285 | /* Display test image during restart */ |
@@ -301,14 +299,19 @@ int ivtv_firmware_restart(struct ivtv *itv) | |||
301 | /* Allow settings to reload */ | 299 | /* Allow settings to reload */ |
302 | ivtv_mailbox_cache_invalidate(itv); | 300 | ivtv_mailbox_cache_invalidate(itv); |
303 | 301 | ||
304 | /* Restore video standard */ | 302 | /* Restore encoder video standard */ |
305 | std = itv->std; | 303 | std = itv->std; |
306 | itv->std = 0; | 304 | itv->std = 0; |
307 | ivtv_s_std(NULL, &fh, &std); | 305 | ivtv_s_std_enc(itv, &std); |
308 | 306 | ||
309 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 307 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { |
310 | ivtv_init_mpeg_decoder(itv); | 308 | ivtv_init_mpeg_decoder(itv); |
311 | 309 | ||
310 | /* Restore decoder video standard */ | ||
311 | std = itv->std_out; | ||
312 | itv->std_out = 0; | ||
313 | ivtv_s_std_dec(itv, &std); | ||
314 | |||
312 | /* Restore framebuffer if active */ | 315 | /* Restore framebuffer if active */ |
313 | if (itv->ivtvfb_restore) | 316 | if (itv->ivtvfb_restore) |
314 | itv->ivtvfb_restore(itv); | 317 | itv->ivtvfb_restore(itv); |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 1689783cd19a..f9e347dae739 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1071,28 +1071,8 @@ static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1071 | return 0; | 1071 | return 0; |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | 1074 | void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std) |
1075 | { | 1075 | { |
1076 | DEFINE_WAIT(wait); | ||
1077 | struct ivtv *itv = fh2id(fh)->itv; | ||
1078 | struct yuv_playback_info *yi = &itv->yuv_info; | ||
1079 | int f; | ||
1080 | |||
1081 | if ((*std & V4L2_STD_ALL) == 0) | ||
1082 | return -EINVAL; | ||
1083 | |||
1084 | if (*std == itv->std) | ||
1085 | return 0; | ||
1086 | |||
1087 | if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) || | ||
1088 | atomic_read(&itv->capturing) > 0 || | ||
1089 | atomic_read(&itv->decoding) > 0) { | ||
1090 | /* Switching standard would turn off the radio or mess | ||
1091 | with already running streams, prevent that by | ||
1092 | returning EBUSY. */ | ||
1093 | return -EBUSY; | ||
1094 | } | ||
1095 | |||
1096 | itv->std = *std; | 1076 | itv->std = *std; |
1097 | itv->is_60hz = (*std & V4L2_STD_525_60) ? 1 : 0; | 1077 | itv->is_60hz = (*std & V4L2_STD_525_60) ? 1 : 0; |
1098 | itv->is_50hz = !itv->is_60hz; | 1078 | itv->is_50hz = !itv->is_60hz; |
@@ -1106,48 +1086,79 @@ int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1106 | if (itv->hw_flags & IVTV_HW_CX25840) | 1086 | if (itv->hw_flags & IVTV_HW_CX25840) |
1107 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; | 1087 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; |
1108 | 1088 | ||
1109 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", (unsigned long long)itv->std); | ||
1110 | |||
1111 | /* Tuner */ | 1089 | /* Tuner */ |
1112 | ivtv_call_all(itv, core, s_std, itv->std); | 1090 | ivtv_call_all(itv, core, s_std, itv->std); |
1091 | } | ||
1113 | 1092 | ||
1114 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 1093 | void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std) |
1115 | /* set display standard */ | 1094 | { |
1116 | itv->std_out = *std; | 1095 | struct yuv_playback_info *yi = &itv->yuv_info; |
1117 | itv->is_out_60hz = itv->is_60hz; | 1096 | DEFINE_WAIT(wait); |
1118 | itv->is_out_50hz = itv->is_50hz; | 1097 | int f; |
1119 | ivtv_call_all(itv, video, s_std_output, itv->std_out); | 1098 | |
1120 | 1099 | /* set display standard */ | |
1121 | /* | 1100 | itv->std_out = *std; |
1122 | * The next firmware call is time sensitive. Time it to | 1101 | itv->is_out_60hz = (*std & V4L2_STD_525_60) ? 1 : 0; |
1123 | * avoid risk of a hard lock, by trying to ensure the call | 1102 | itv->is_out_50hz = !itv->is_out_60hz; |
1124 | * happens within the first 100 lines of the top field. | 1103 | ivtv_call_all(itv, video, s_std_output, itv->std_out); |
1125 | * Make 4 attempts to sync to the decoder before giving up. | 1104 | |
1126 | */ | 1105 | /* |
1127 | for (f = 0; f < 4; f++) { | 1106 | * The next firmware call is time sensitive. Time it to |
1128 | prepare_to_wait(&itv->vsync_waitq, &wait, | 1107 | * avoid risk of a hard lock, by trying to ensure the call |
1129 | TASK_UNINTERRUPTIBLE); | 1108 | * happens within the first 100 lines of the top field. |
1130 | if ((read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16) < 100) | 1109 | * Make 4 attempts to sync to the decoder before giving up. |
1131 | break; | 1110 | */ |
1132 | schedule_timeout(msecs_to_jiffies(25)); | 1111 | for (f = 0; f < 4; f++) { |
1133 | } | 1112 | prepare_to_wait(&itv->vsync_waitq, &wait, |
1134 | finish_wait(&itv->vsync_waitq, &wait); | 1113 | TASK_UNINTERRUPTIBLE); |
1135 | 1114 | if ((read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16) < 100) | |
1136 | if (f == 4) | 1115 | break; |
1137 | IVTV_WARN("Mode change failed to sync to decoder\n"); | 1116 | schedule_timeout(msecs_to_jiffies(25)); |
1138 | |||
1139 | ivtv_vapi(itv, CX2341X_DEC_SET_STANDARD, 1, itv->is_out_50hz); | ||
1140 | itv->main_rect.left = itv->main_rect.top = 0; | ||
1141 | itv->main_rect.width = 720; | ||
1142 | itv->main_rect.height = itv->cxhdl.height; | ||
1143 | ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, | ||
1144 | 720, itv->main_rect.height, 0, 0); | ||
1145 | yi->main_rect = itv->main_rect; | ||
1146 | if (!itv->osd_info) { | ||
1147 | yi->osd_full_w = 720; | ||
1148 | yi->osd_full_h = itv->is_out_50hz ? 576 : 480; | ||
1149 | } | ||
1150 | } | 1117 | } |
1118 | finish_wait(&itv->vsync_waitq, &wait); | ||
1119 | |||
1120 | if (f == 4) | ||
1121 | IVTV_WARN("Mode change failed to sync to decoder\n"); | ||
1122 | |||
1123 | ivtv_vapi(itv, CX2341X_DEC_SET_STANDARD, 1, itv->is_out_50hz); | ||
1124 | itv->main_rect.left = 0; | ||
1125 | itv->main_rect.top = 0; | ||
1126 | itv->main_rect.width = 720; | ||
1127 | itv->main_rect.height = itv->is_out_50hz ? 576 : 480; | ||
1128 | ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, | ||
1129 | 720, itv->main_rect.height, 0, 0); | ||
1130 | yi->main_rect = itv->main_rect; | ||
1131 | if (!itv->osd_info) { | ||
1132 | yi->osd_full_w = 720; | ||
1133 | yi->osd_full_h = itv->is_out_50hz ? 576 : 480; | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | ||
1138 | { | ||
1139 | struct ivtv *itv = fh2id(fh)->itv; | ||
1140 | |||
1141 | if ((*std & V4L2_STD_ALL) == 0) | ||
1142 | return -EINVAL; | ||
1143 | |||
1144 | if (*std == itv->std) | ||
1145 | return 0; | ||
1146 | |||
1147 | if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) || | ||
1148 | atomic_read(&itv->capturing) > 0 || | ||
1149 | atomic_read(&itv->decoding) > 0) { | ||
1150 | /* Switching standard would mess with already running | ||
1151 | streams, prevent that by returning EBUSY. */ | ||
1152 | return -EBUSY; | ||
1153 | } | ||
1154 | |||
1155 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", | ||
1156 | (unsigned long long)itv->std); | ||
1157 | |||
1158 | ivtv_s_std_enc(itv, std); | ||
1159 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | ||
1160 | ivtv_s_std_dec(itv, std); | ||
1161 | |||
1151 | return 0; | 1162 | return 0; |
1152 | } | 1163 | } |
1153 | 1164 | ||
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.h b/drivers/media/video/ivtv/ivtv-ioctl.h index 58f003412afd..89185caeafae 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.h +++ b/drivers/media/video/ivtv/ivtv-ioctl.h | |||
@@ -27,7 +27,8 @@ u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt); | |||
27 | void ivtv_set_osd_alpha(struct ivtv *itv); | 27 | void ivtv_set_osd_alpha(struct ivtv *itv); |
28 | int ivtv_set_speed(struct ivtv *itv, int speed); | 28 | int ivtv_set_speed(struct ivtv *itv, int speed); |
29 | void ivtv_set_funcs(struct video_device *vdev); | 29 | void ivtv_set_funcs(struct video_device *vdev); |
30 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std); | 30 | void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std); |
31 | void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std); | ||
31 | int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); | 32 | int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); |
32 | int ivtv_s_input(struct file *file, void *fh, unsigned int inp); | 33 | int ivtv_s_input(struct file *file, void *fh, unsigned int inp); |
33 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | 34 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 942683336555..e7794dc1330e 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -589,7 +589,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) | |||
589 | v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1); | 589 | v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1); |
590 | /* Avoid unpredictable PCI bus hang - disable video clocks */ | 590 | /* Avoid unpredictable PCI bus hang - disable video clocks */ |
591 | v4l2_subdev_call(itv->sd_video, video, s_stream, 0); | 591 | v4l2_subdev_call(itv->sd_video, video, s_stream, 0); |
592 | ivtv_msleep_timeout(300, 1); | 592 | ivtv_msleep_timeout(300, 0); |
593 | ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); | 593 | ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); |
594 | v4l2_subdev_call(itv->sd_video, video, s_stream, 1); | 594 | v4l2_subdev_call(itv->sd_video, video, s_stream, 1); |
595 | } | 595 | } |
@@ -834,7 +834,7 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) | |||
834 | } | 834 | } |
835 | 835 | ||
836 | /* Handle any pending interrupts */ | 836 | /* Handle any pending interrupts */ |
837 | ivtv_msleep_timeout(100, 1); | 837 | ivtv_msleep_timeout(100, 0); |
838 | } | 838 | } |
839 | 839 | ||
840 | atomic_dec(&itv->capturing); | 840 | atomic_dec(&itv->capturing); |
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index b6eb51ce7735..293db806d936 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
@@ -71,7 +71,7 @@ static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode) | |||
71 | Turning this signal on and off can confuse certain | 71 | Turning this signal on and off can confuse certain |
72 | TVs. As far as I can tell there is no reason not to | 72 | TVs. As far as I can tell there is no reason not to |
73 | transmit this signal. */ | 73 | transmit this signal. */ |
74 | if ((itv->std & V4L2_STD_625_50) && !enabled) { | 74 | if ((itv->std_out & V4L2_STD_625_50) && !enabled) { |
75 | enabled = 1; | 75 | enabled = 1; |
76 | mode = 0x08; /* 4x3 full format */ | 76 | mode = 0x08; /* 4x3 full format */ |
77 | } | 77 | } |
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 17247451c693..6b7c9c823330 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c | |||
@@ -247,7 +247,7 @@ static int ivtvfb_set_osd_coords(struct ivtv *itv, const struct ivtv_osd_coords | |||
247 | 247 | ||
248 | static int ivtvfb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window) | 248 | static int ivtvfb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window) |
249 | { | 249 | { |
250 | int osd_height_limit = itv->is_50hz ? 576 : 480; | 250 | int osd_height_limit = itv->is_out_50hz ? 576 : 480; |
251 | 251 | ||
252 | /* Only fail if resolution too high, otherwise fudge the start coords. */ | 252 | /* Only fail if resolution too high, otherwise fudge the start coords. */ |
253 | if ((ivtv_window->height > osd_height_limit) || (ivtv_window->width > IVTV_OSD_MAX_WIDTH)) | 253 | if ((ivtv_window->height > osd_height_limit) || (ivtv_window->width > IVTV_OSD_MAX_WIDTH)) |
@@ -471,9 +471,9 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar | |||
471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | | 471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | |
472 | FB_VBLANK_HAVE_VSYNC; | 472 | FB_VBLANK_HAVE_VSYNC; |
473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; | 473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; |
474 | if (itv->is_50hz && trace > 312) | 474 | if (itv->is_out_50hz && trace > 312) |
475 | trace -= 312; | 475 | trace -= 312; |
476 | else if (itv->is_60hz && trace > 262) | 476 | else if (itv->is_out_60hz && trace > 262) |
477 | trace -= 262; | 477 | trace -= 262; |
478 | if (trace == 1) | 478 | if (trace == 1) |
479 | vblank.flags |= FB_VBLANK_VSYNCING; | 479 | vblank.flags |= FB_VBLANK_VSYNCING; |
@@ -656,7 +656,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) | |||
656 | IVTVFB_DEBUG_INFO("ivtvfb_check_var\n"); | 656 | IVTVFB_DEBUG_INFO("ivtvfb_check_var\n"); |
657 | 657 | ||
658 | /* Set base references for mode calcs. */ | 658 | /* Set base references for mode calcs. */ |
659 | if (itv->is_50hz) { | 659 | if (itv->is_out_50hz) { |
660 | pixclock = 84316; | 660 | pixclock = 84316; |
661 | hlimit = 776; | 661 | hlimit = 776; |
662 | vlimit = 591; | 662 | vlimit = 591; |
@@ -784,12 +784,12 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) | |||
784 | If the margins are too large, just center the screen | 784 | If the margins are too large, just center the screen |
785 | (enforcing margins causes too many problems) */ | 785 | (enforcing margins causes too many problems) */ |
786 | 786 | ||
787 | if (var->left_margin + var->xres > IVTV_OSD_MAX_WIDTH + 1) { | 787 | if (var->left_margin + var->xres > IVTV_OSD_MAX_WIDTH + 1) |
788 | var->left_margin = 1 + ((IVTV_OSD_MAX_WIDTH - var->xres) / 2); | 788 | var->left_margin = 1 + ((IVTV_OSD_MAX_WIDTH - var->xres) / 2); |
789 | } | 789 | |
790 | if (var->upper_margin + var->yres > (itv->is_50hz ? 577 : 481)) { | 790 | if (var->upper_margin + var->yres > (itv->is_out_50hz ? 577 : 481)) |
791 | var->upper_margin = 1 + (((itv->is_50hz ? 576 : 480) - var->yres) / 2); | 791 | var->upper_margin = 1 + (((itv->is_out_50hz ? 576 : 480) - |
792 | } | 792 | var->yres) / 2); |
793 | 793 | ||
794 | /* Maintain overall 'size' for a constant refresh rate */ | 794 | /* Maintain overall 'size' for a constant refresh rate */ |
795 | var->right_margin = hlimit - var->left_margin - var->xres; | 795 | var->right_margin = hlimit - var->left_margin - var->xres; |
@@ -836,7 +836,12 @@ static int ivtvfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *inf | |||
836 | u32 osd_pan_index; | 836 | u32 osd_pan_index; |
837 | struct ivtv *itv = (struct ivtv *) info->par; | 837 | struct ivtv *itv = (struct ivtv *) info->par; |
838 | 838 | ||
839 | osd_pan_index = (var->xoffset + (var->yoffset * var->xres_virtual))*var->bits_per_pixel/8; | 839 | if (var->yoffset + info->var.yres > info->var.yres_virtual || |
840 | var->xoffset + info->var.xres > info->var.xres_virtual) | ||
841 | return -EINVAL; | ||
842 | |||
843 | osd_pan_index = var->yoffset * info->fix.line_length | ||
844 | + var->xoffset * info->var.bits_per_pixel / 8; | ||
840 | write_reg(osd_pan_index, 0x02A0C); | 845 | write_reg(osd_pan_index, 0x02A0C); |
841 | 846 | ||
842 | /* Pass this info back the yuv handler */ | 847 | /* Pass this info back the yuv handler */ |
@@ -1003,19 +1008,21 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) | |||
1003 | /* Hardware coords start at 0, user coords start at 1. */ | 1008 | /* Hardware coords start at 0, user coords start at 1. */ |
1004 | osd_left--; | 1009 | osd_left--; |
1005 | 1010 | ||
1006 | start_window.left = osd_left >= 0 ? osd_left : ((IVTV_OSD_MAX_WIDTH - start_window.width) / 2); | 1011 | start_window.left = osd_left >= 0 ? |
1012 | osd_left : ((IVTV_OSD_MAX_WIDTH - start_window.width) / 2); | ||
1007 | 1013 | ||
1008 | oi->display_byte_stride = | 1014 | oi->display_byte_stride = |
1009 | start_window.width * oi->bytes_per_pixel; | 1015 | start_window.width * oi->bytes_per_pixel; |
1010 | 1016 | ||
1011 | /* Vertical size & position */ | 1017 | /* Vertical size & position */ |
1012 | 1018 | ||
1013 | max_height = itv->is_50hz ? 576 : 480; | 1019 | max_height = itv->is_out_50hz ? 576 : 480; |
1014 | 1020 | ||
1015 | if (osd_yres > max_height) | 1021 | if (osd_yres > max_height) |
1016 | osd_yres = max_height; | 1022 | osd_yres = max_height; |
1017 | 1023 | ||
1018 | start_window.height = osd_yres ? osd_yres : itv->is_50hz ? 480 : 400; | 1024 | start_window.height = osd_yres ? |
1025 | osd_yres : itv->is_out_50hz ? 480 : 400; | ||
1019 | 1026 | ||
1020 | /* Check vertical start (osd_upper). */ | 1027 | /* Check vertical start (osd_upper). */ |
1021 | if (osd_upper + start_window.height > max_height + 1) { | 1028 | if (osd_upper + start_window.height > max_height + 1) { |
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index 472a69359e60..c9fd04ee70a8 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c | |||
@@ -391,7 +391,7 @@ static inline void isp_isr_dbg(struct isp_device *isp, u32 irqstatus) | |||
391 | }; | 391 | }; |
392 | int i; | 392 | int i; |
393 | 393 | ||
394 | dev_dbg(isp->dev, ""); | 394 | dev_dbg(isp->dev, "ISP IRQ: "); |
395 | 395 | ||
396 | for (i = 0; i < ARRAY_SIZE(name); i++) { | 396 | for (i = 0; i < ARRAY_SIZE(name); i++) { |
397 | if ((1 << i) & irqstatus) | 397 | if ((1 << i) & irqstatus) |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 398864370267..4e4d4122d9a6 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -1512,7 +1512,7 @@ static int video_dev_create(struct soc_camera_device *icd) | |||
1512 | */ | 1512 | */ |
1513 | static int soc_camera_video_start(struct soc_camera_device *icd) | 1513 | static int soc_camera_video_start(struct soc_camera_device *icd) |
1514 | { | 1514 | { |
1515 | struct device_type *type = icd->vdev->dev.type; | 1515 | const struct device_type *type = icd->vdev->dev.type; |
1516 | int ret; | 1516 | int ret; |
1517 | 1517 | ||
1518 | if (!icd->dev.parent) | 1518 | if (!icd->dev.parent) |
diff --git a/drivers/media/video/uvc/uvc_entity.c b/drivers/media/video/uvc/uvc_entity.c index ede7852bb1df..c3ab0c813be2 100644 --- a/drivers/media/video/uvc/uvc_entity.c +++ b/drivers/media/video/uvc/uvc_entity.c | |||
@@ -30,7 +30,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain, | |||
30 | struct uvc_entity *remote; | 30 | struct uvc_entity *remote; |
31 | unsigned int i; | 31 | unsigned int i; |
32 | u8 remote_pad; | 32 | u8 remote_pad; |
33 | int ret; | 33 | int ret = 0; |
34 | 34 | ||
35 | for (i = 0; i < entity->num_pads; ++i) { | 35 | for (i = 0; i < entity->num_pads; ++i) { |
36 | struct media_entity *source; | 36 | struct media_entity *source; |
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c index 200311fea369..e2a52e5cf449 100644 --- a/drivers/misc/apds990x.c +++ b/drivers/misc/apds990x.c | |||
@@ -609,6 +609,7 @@ static int apds990x_detect(struct apds990x_chip *chip) | |||
609 | return ret; | 609 | return ret; |
610 | } | 610 | } |
611 | 611 | ||
612 | #if defined(CONFIG_PM) || defined(CONFIG_PM_RUNTIME) | ||
612 | static int apds990x_chip_on(struct apds990x_chip *chip) | 613 | static int apds990x_chip_on(struct apds990x_chip *chip) |
613 | { | 614 | { |
614 | int err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), | 615 | int err = regulator_bulk_enable(ARRAY_SIZE(chip->regs), |
@@ -624,6 +625,7 @@ static int apds990x_chip_on(struct apds990x_chip *chip) | |||
624 | apds990x_mode_on(chip); | 625 | apds990x_mode_on(chip); |
625 | return 0; | 626 | return 0; |
626 | } | 627 | } |
628 | #endif | ||
627 | 629 | ||
628 | static int apds990x_chip_off(struct apds990x_chip *chip) | 630 | static int apds990x_chip_off(struct apds990x_chip *chip) |
629 | { | 631 | { |
diff --git a/drivers/misc/cs5535-mfgpt.c b/drivers/misc/cs5535-mfgpt.c index e01e08c8c88b..bc685bfc4c33 100644 --- a/drivers/misc/cs5535-mfgpt.c +++ b/drivers/misc/cs5535-mfgpt.c | |||
@@ -174,7 +174,7 @@ struct cs5535_mfgpt_timer *cs5535_mfgpt_alloc_timer(int timer_nr, int domain) | |||
174 | timer_nr = t < max ? (int) t : -1; | 174 | timer_nr = t < max ? (int) t : -1; |
175 | } else { | 175 | } else { |
176 | /* check if the requested timer's available */ | 176 | /* check if the requested timer's available */ |
177 | if (test_bit(timer_nr, mfgpt->avail)) | 177 | if (!test_bit(timer_nr, mfgpt->avail)) |
178 | timer_nr = -1; | 178 | timer_nr = -1; |
179 | } | 179 | } |
180 | 180 | ||
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index b0c56313dbbb..8cebec5e85ee 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -304,7 +304,10 @@ static int check_and_rewind_pc(char *put_str, char *arg) | |||
304 | return 1; | 304 | return 1; |
305 | } | 305 | } |
306 | /* Readjust the instruction pointer if needed */ | 306 | /* Readjust the instruction pointer if needed */ |
307 | instruction_pointer_set(&kgdbts_regs, ip + offset); | 307 | ip += offset; |
308 | #ifdef GDB_ADJUSTS_BREAK_OFFSET | ||
309 | instruction_pointer_set(&kgdbts_regs, ip); | ||
310 | #endif | ||
308 | return 0; | 311 | return 0; |
309 | } | 312 | } |
310 | 313 | ||
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index ee5109a3cd98..42f067347bc7 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c | |||
@@ -495,14 +495,14 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
495 | } | 495 | } |
496 | } | 496 | } |
497 | 497 | ||
498 | dev->stats.tx_packets++; | ||
499 | dev->stats.tx_bytes += skb->len; | ||
500 | |||
498 | if (atomic_dec_return(&queued_msg->use_count) == 0) { | 501 | if (atomic_dec_return(&queued_msg->use_count) == 0) { |
499 | dev_kfree_skb(skb); | 502 | dev_kfree_skb(skb); |
500 | kfree(queued_msg); | 503 | kfree(queued_msg); |
501 | } | 504 | } |
502 | 505 | ||
503 | dev->stats.tx_packets++; | ||
504 | dev->stats.tx_bytes += skb->len; | ||
505 | |||
506 | return NETDEV_TX_OK; | 506 | return NETDEV_TX_OK; |
507 | } | 507 | } |
508 | 508 | ||
diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c index 7aded90f9daa..cfbddbef11de 100644 --- a/drivers/misc/spear13xx_pcie_gadget.c +++ b/drivers/misc/spear13xx_pcie_gadget.c | |||
@@ -845,7 +845,7 @@ err_iounmap: | |||
845 | err_iounmap_app: | 845 | err_iounmap_app: |
846 | iounmap(config->va_app_base); | 846 | iounmap(config->va_app_base); |
847 | err_kzalloc: | 847 | err_kzalloc: |
848 | kfree(config); | 848 | kfree(target); |
849 | err_rel_res: | 849 | err_rel_res: |
850 | release_mem_region(res1->start, resource_size(res1)); | 850 | release_mem_region(res1->start, resource_size(res1)); |
851 | err_rel_res0: | 851 | err_rel_res0: |
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 1a05fe08e2cb..f91f82eabda7 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c | |||
@@ -747,8 +747,8 @@ static void st_tty_close(struct tty_struct *tty) | |||
747 | pr_debug("%s: done ", __func__); | 747 | pr_debug("%s: done ", __func__); |
748 | } | 748 | } |
749 | 749 | ||
750 | static unsigned int st_tty_receive(struct tty_struct *tty, | 750 | static void st_tty_receive(struct tty_struct *tty, const unsigned char *data, |
751 | const unsigned char *data, char *tty_flags, int count) | 751 | char *tty_flags, int count) |
752 | { | 752 | { |
753 | #ifdef VERBOSE | 753 | #ifdef VERBOSE |
754 | print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE, | 754 | print_hex_dump(KERN_DEBUG, ">in>", DUMP_PREFIX_NONE, |
@@ -761,8 +761,6 @@ static unsigned int st_tty_receive(struct tty_struct *tty, | |||
761 | */ | 761 | */ |
762 | st_recv(tty->disc_data, data, count); | 762 | st_recv(tty->disc_data, data, count); |
763 | pr_debug("done %s", __func__); | 763 | pr_debug("done %s", __func__); |
764 | |||
765 | return count; | ||
766 | } | 764 | } |
767 | 765 | ||
768 | /* wake-up function called in from the TTY layer | 766 | /* wake-up function called in from the TTY layer |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 5da5bea0f9f0..7721de942c69 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -1144,9 +1144,17 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
1144 | else if (ret != -ENOSYS) | 1144 | else if (ret != -ENOSYS) |
1145 | goto err_gpio_cd; | 1145 | goto err_gpio_cd; |
1146 | 1146 | ||
1147 | /* | ||
1148 | * A gpio pin that will detect cards when inserted and removed | ||
1149 | * will most likely want to trigger on the edges if it is | ||
1150 | * 0 when ejected and 1 when inserted (or mutatis mutandis | ||
1151 | * for the inverted case) so we request triggers on both | ||
1152 | * edges. | ||
1153 | */ | ||
1147 | ret = request_any_context_irq(gpio_to_irq(plat->gpio_cd), | 1154 | ret = request_any_context_irq(gpio_to_irq(plat->gpio_cd), |
1148 | mmci_cd_irq, 0, | 1155 | mmci_cd_irq, |
1149 | DRIVER_NAME " (cd)", host); | 1156 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
1157 | DRIVER_NAME " (cd)", host); | ||
1150 | if (ret >= 0) | 1158 | if (ret >= 0) |
1151 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); | 1159 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); |
1152 | } | 1160 | } |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 259ece047afc..5b2e2155b413 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -435,6 +435,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) | |||
435 | reg = regulator_get(host->dev, "vmmc_aux"); | 435 | reg = regulator_get(host->dev, "vmmc_aux"); |
436 | host->vcc_aux = IS_ERR(reg) ? NULL : reg; | 436 | host->vcc_aux = IS_ERR(reg) ? NULL : reg; |
437 | 437 | ||
438 | /* For eMMC do not power off when not in sleep state */ | ||
439 | if (mmc_slot(host).no_regulator_off_init) | ||
440 | return 0; | ||
438 | /* | 441 | /* |
439 | * UGLY HACK: workaround regulator framework bugs. | 442 | * UGLY HACK: workaround regulator framework bugs. |
440 | * When the bootloader leaves a supply active, it's | 443 | * When the bootloader leaves a supply active, it's |
diff --git a/drivers/net/3c503.c b/drivers/net/3c503.c index d84f6e8903a5..5b732988d493 100644 --- a/drivers/net/3c503.c +++ b/drivers/net/3c503.c | |||
@@ -412,7 +412,7 @@ el2_open(struct net_device *dev) | |||
412 | outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR); | 412 | outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR); |
413 | outb_p(0x00, E33G_IDCFR); | 413 | outb_p(0x00, E33G_IDCFR); |
414 | msleep(1); | 414 | msleep(1); |
415 | free_irq(*irqp, el2_probe_interrupt); | 415 | free_irq(*irqp, &seen); |
416 | if (!seen) | 416 | if (!seen) |
417 | continue; | 417 | continue; |
418 | 418 | ||
@@ -422,6 +422,7 @@ el2_open(struct net_device *dev) | |||
422 | continue; | 422 | continue; |
423 | if (retval < 0) | 423 | if (retval < 0) |
424 | goto err_disable; | 424 | goto err_disable; |
425 | break; | ||
425 | } while (*++irqp); | 426 | } while (*++irqp); |
426 | 427 | ||
427 | if (*irqp == 0) { | 428 | if (*irqp == 0) { |
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index 5f25889e27ef..44b28b2d7003 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c | |||
@@ -185,7 +185,7 @@ static int max_interrupt_work = 10; | |||
185 | static int nopnp; | 185 | static int nopnp; |
186 | #endif | 186 | #endif |
187 | 187 | ||
188 | static int el3_common_init(struct net_device *dev); | 188 | static int __devinit el3_common_init(struct net_device *dev); |
189 | static void el3_common_remove(struct net_device *dev); | 189 | static void el3_common_remove(struct net_device *dev); |
190 | static ushort id_read_eeprom(int index); | 190 | static ushort id_read_eeprom(int index); |
191 | static ushort read_eeprom(int ioaddr, int index); | 191 | static ushort read_eeprom(int ioaddr, int index); |
@@ -395,7 +395,7 @@ static struct isa_driver el3_isa_driver = { | |||
395 | static int isa_registered; | 395 | static int isa_registered; |
396 | 396 | ||
397 | #ifdef CONFIG_PNP | 397 | #ifdef CONFIG_PNP |
398 | static const struct pnp_device_id el3_pnp_ids[] __devinitconst = { | 398 | static struct pnp_device_id el3_pnp_ids[] = { |
399 | { .id = "TCM5090" }, /* 3Com Etherlink III (TP) */ | 399 | { .id = "TCM5090" }, /* 3Com Etherlink III (TP) */ |
400 | { .id = "TCM5091" }, /* 3Com Etherlink III */ | 400 | { .id = "TCM5091" }, /* 3Com Etherlink III */ |
401 | { .id = "TCM5094" }, /* 3Com Etherlink III (combo) */ | 401 | { .id = "TCM5094" }, /* 3Com Etherlink III (combo) */ |
@@ -478,7 +478,7 @@ static int pnp_registered; | |||
478 | #endif /* CONFIG_PNP */ | 478 | #endif /* CONFIG_PNP */ |
479 | 479 | ||
480 | #ifdef CONFIG_EISA | 480 | #ifdef CONFIG_EISA |
481 | static const struct eisa_device_id el3_eisa_ids[] __devinitconst = { | 481 | static struct eisa_device_id el3_eisa_ids[] = { |
482 | { "TCM5090" }, | 482 | { "TCM5090" }, |
483 | { "TCM5091" }, | 483 | { "TCM5091" }, |
484 | { "TCM5092" }, | 484 | { "TCM5092" }, |
@@ -508,7 +508,7 @@ static int eisa_registered; | |||
508 | #ifdef CONFIG_MCA | 508 | #ifdef CONFIG_MCA |
509 | static int el3_mca_probe(struct device *dev); | 509 | static int el3_mca_probe(struct device *dev); |
510 | 510 | ||
511 | static const short el3_mca_adapter_ids[] __devinitconst = { | 511 | static short el3_mca_adapter_ids[] __initdata = { |
512 | 0x627c, | 512 | 0x627c, |
513 | 0x627d, | 513 | 0x627d, |
514 | 0x62db, | 514 | 0x62db, |
@@ -517,7 +517,7 @@ static const short el3_mca_adapter_ids[] __devinitconst = { | |||
517 | 0x0000 | 517 | 0x0000 |
518 | }; | 518 | }; |
519 | 519 | ||
520 | static const char *const el3_mca_adapter_names[] __devinitconst = { | 520 | static char *el3_mca_adapter_names[] __initdata = { |
521 | "3Com 3c529 EtherLink III (10base2)", | 521 | "3Com 3c529 EtherLink III (10base2)", |
522 | "3Com 3c529 EtherLink III (10baseT)", | 522 | "3Com 3c529 EtherLink III (10baseT)", |
523 | "3Com 3c529 EtherLink III (test mode)", | 523 | "3Com 3c529 EtherLink III (test mode)", |
@@ -601,7 +601,7 @@ static void el3_common_remove (struct net_device *dev) | |||
601 | } | 601 | } |
602 | 602 | ||
603 | #ifdef CONFIG_MCA | 603 | #ifdef CONFIG_MCA |
604 | static int __devinit el3_mca_probe(struct device *device) | 604 | static int __init el3_mca_probe(struct device *device) |
605 | { | 605 | { |
606 | /* Based on Erik Nygren's (nygren@mit.edu) 3c529 patch, | 606 | /* Based on Erik Nygren's (nygren@mit.edu) 3c529 patch, |
607 | * heavily modified by Chris Beauregard | 607 | * heavily modified by Chris Beauregard |
@@ -671,7 +671,7 @@ static int __devinit el3_mca_probe(struct device *device) | |||
671 | #endif /* CONFIG_MCA */ | 671 | #endif /* CONFIG_MCA */ |
672 | 672 | ||
673 | #ifdef CONFIG_EISA | 673 | #ifdef CONFIG_EISA |
674 | static int __devinit el3_eisa_probe (struct device *device) | 674 | static int __init el3_eisa_probe (struct device *device) |
675 | { | 675 | { |
676 | short i; | 676 | short i; |
677 | int ioaddr, irq, if_port; | 677 | int ioaddr, irq, if_port; |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 99f43d275442..8cc22568ebd3 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -901,14 +901,14 @@ static const struct dev_pm_ops vortex_pm_ops = { | |||
901 | #endif /* !CONFIG_PM */ | 901 | #endif /* !CONFIG_PM */ |
902 | 902 | ||
903 | #ifdef CONFIG_EISA | 903 | #ifdef CONFIG_EISA |
904 | static const struct eisa_device_id vortex_eisa_ids[] __devinitconst = { | 904 | static struct eisa_device_id vortex_eisa_ids[] = { |
905 | { "TCM5920", CH_3C592 }, | 905 | { "TCM5920", CH_3C592 }, |
906 | { "TCM5970", CH_3C597 }, | 906 | { "TCM5970", CH_3C597 }, |
907 | { "" } | 907 | { "" } |
908 | }; | 908 | }; |
909 | MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); | 909 | MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids); |
910 | 910 | ||
911 | static int __devinit vortex_eisa_probe(struct device *device) | 911 | static int __init vortex_eisa_probe(struct device *device) |
912 | { | 912 | { |
913 | void __iomem *ioaddr; | 913 | void __iomem *ioaddr; |
914 | struct eisa_device *edev; | 914 | struct eisa_device *edev; |
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index 0c9217f48b72..7b3e23f38913 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c | |||
@@ -50,7 +50,7 @@ static const char version[] = | |||
50 | #ifdef __arm__ | 50 | #ifdef __arm__ |
51 | static void write_rreg(u_long base, u_int reg, u_int val) | 51 | static void write_rreg(u_long base, u_int reg, u_int val) |
52 | { | 52 | { |
53 | __asm__( | 53 | asm volatile( |
54 | "str%?h %1, [%2] @ NET_RAP\n\t" | 54 | "str%?h %1, [%2] @ NET_RAP\n\t" |
55 | "str%?h %0, [%2, #-4] @ NET_RDP" | 55 | "str%?h %0, [%2, #-4] @ NET_RDP" |
56 | : | 56 | : |
@@ -60,7 +60,7 @@ static void write_rreg(u_long base, u_int reg, u_int val) | |||
60 | static inline unsigned short read_rreg(u_long base_addr, u_int reg) | 60 | static inline unsigned short read_rreg(u_long base_addr, u_int reg) |
61 | { | 61 | { |
62 | unsigned short v; | 62 | unsigned short v; |
63 | __asm__( | 63 | asm volatile( |
64 | "str%?h %1, [%2] @ NET_RAP\n\t" | 64 | "str%?h %1, [%2] @ NET_RAP\n\t" |
65 | "ldr%?h %0, [%2, #-4] @ NET_RDP" | 65 | "ldr%?h %0, [%2, #-4] @ NET_RDP" |
66 | : "=r" (v) | 66 | : "=r" (v) |
@@ -70,7 +70,7 @@ static inline unsigned short read_rreg(u_long base_addr, u_int reg) | |||
70 | 70 | ||
71 | static inline void write_ireg(u_long base, u_int reg, u_int val) | 71 | static inline void write_ireg(u_long base, u_int reg, u_int val) |
72 | { | 72 | { |
73 | __asm__( | 73 | asm volatile( |
74 | "str%?h %1, [%2] @ NET_RAP\n\t" | 74 | "str%?h %1, [%2] @ NET_RAP\n\t" |
75 | "str%?h %0, [%2, #8] @ NET_IDP" | 75 | "str%?h %0, [%2, #8] @ NET_IDP" |
76 | : | 76 | : |
@@ -80,7 +80,7 @@ static inline void write_ireg(u_long base, u_int reg, u_int val) | |||
80 | static inline unsigned short read_ireg(u_long base_addr, u_int reg) | 80 | static inline unsigned short read_ireg(u_long base_addr, u_int reg) |
81 | { | 81 | { |
82 | u_short v; | 82 | u_short v; |
83 | __asm__( | 83 | asm volatile( |
84 | "str%?h %1, [%2] @ NAT_RAP\n\t" | 84 | "str%?h %1, [%2] @ NAT_RAP\n\t" |
85 | "ldr%?h %0, [%2, #8] @ NET_IDP\n\t" | 85 | "ldr%?h %0, [%2, #8] @ NET_IDP\n\t" |
86 | : "=r" (v) | 86 | : "=r" (v) |
@@ -91,47 +91,48 @@ static inline unsigned short read_ireg(u_long base_addr, u_int reg) | |||
91 | #define am_writeword(dev,off,val) __raw_writew(val, ISAMEM_BASE + ((off) << 1)) | 91 | #define am_writeword(dev,off,val) __raw_writew(val, ISAMEM_BASE + ((off) << 1)) |
92 | #define am_readword(dev,off) __raw_readw(ISAMEM_BASE + ((off) << 1)) | 92 | #define am_readword(dev,off) __raw_readw(ISAMEM_BASE + ((off) << 1)) |
93 | 93 | ||
94 | static inline void | 94 | static void |
95 | am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length) | 95 | am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length) |
96 | { | 96 | { |
97 | offset = ISAMEM_BASE + (offset << 1); | 97 | offset = ISAMEM_BASE + (offset << 1); |
98 | length = (length + 1) & ~1; | 98 | length = (length + 1) & ~1; |
99 | if ((int)buf & 2) { | 99 | if ((int)buf & 2) { |
100 | __asm__ __volatile__("str%?h %2, [%0], #4" | 100 | asm volatile("str%?h %2, [%0], #4" |
101 | : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8))); | 101 | : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8))); |
102 | buf += 2; | 102 | buf += 2; |
103 | length -= 2; | 103 | length -= 2; |
104 | } | 104 | } |
105 | while (length > 8) { | 105 | while (length > 8) { |
106 | unsigned int tmp, tmp2; | 106 | register unsigned int tmp asm("r2"), tmp2 asm("r3"); |
107 | __asm__ __volatile__( | 107 | asm volatile( |
108 | "ldm%?ia %1!, {%2, %3}\n\t" | 108 | "ldm%?ia %0!, {%1, %2}" |
109 | : "+r" (buf), "=&r" (tmp), "=&r" (tmp2)); | ||
110 | length -= 8; | ||
111 | asm volatile( | ||
112 | "str%?h %1, [%0], #4\n\t" | ||
113 | "mov%? %1, %1, lsr #16\n\t" | ||
114 | "str%?h %1, [%0], #4\n\t" | ||
109 | "str%?h %2, [%0], #4\n\t" | 115 | "str%?h %2, [%0], #4\n\t" |
110 | "mov%? %2, %2, lsr #16\n\t" | 116 | "mov%? %2, %2, lsr #16\n\t" |
111 | "str%?h %2, [%0], #4\n\t" | 117 | "str%?h %2, [%0], #4" |
112 | "str%?h %3, [%0], #4\n\t" | 118 | : "+r" (offset), "=&r" (tmp), "=&r" (tmp2)); |
113 | "mov%? %3, %3, lsr #16\n\t" | ||
114 | "str%?h %3, [%0], #4" | ||
115 | : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2) | ||
116 | : "0" (offset), "1" (buf)); | ||
117 | length -= 8; | ||
118 | } | 119 | } |
119 | while (length > 0) { | 120 | while (length > 0) { |
120 | __asm__ __volatile__("str%?h %2, [%0], #4" | 121 | asm volatile("str%?h %2, [%0], #4" |
121 | : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8))); | 122 | : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8))); |
122 | buf += 2; | 123 | buf += 2; |
123 | length -= 2; | 124 | length -= 2; |
124 | } | 125 | } |
125 | } | 126 | } |
126 | 127 | ||
127 | static inline void | 128 | static void |
128 | am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length) | 129 | am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length) |
129 | { | 130 | { |
130 | offset = ISAMEM_BASE + (offset << 1); | 131 | offset = ISAMEM_BASE + (offset << 1); |
131 | length = (length + 1) & ~1; | 132 | length = (length + 1) & ~1; |
132 | if ((int)buf & 2) { | 133 | if ((int)buf & 2) { |
133 | unsigned int tmp; | 134 | unsigned int tmp; |
134 | __asm__ __volatile__( | 135 | asm volatile( |
135 | "ldr%?h %2, [%0], #4\n\t" | 136 | "ldr%?h %2, [%0], #4\n\t" |
136 | "str%?b %2, [%1], #1\n\t" | 137 | "str%?b %2, [%1], #1\n\t" |
137 | "mov%? %2, %2, lsr #8\n\t" | 138 | "mov%? %2, %2, lsr #8\n\t" |
@@ -140,12 +141,12 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned | |||
140 | length -= 2; | 141 | length -= 2; |
141 | } | 142 | } |
142 | while (length > 8) { | 143 | while (length > 8) { |
143 | unsigned int tmp, tmp2, tmp3; | 144 | register unsigned int tmp asm("r2"), tmp2 asm("r3"), tmp3; |
144 | __asm__ __volatile__( | 145 | asm volatile( |
145 | "ldr%?h %2, [%0], #4\n\t" | 146 | "ldr%?h %2, [%0], #4\n\t" |
147 | "ldr%?h %4, [%0], #4\n\t" | ||
146 | "ldr%?h %3, [%0], #4\n\t" | 148 | "ldr%?h %3, [%0], #4\n\t" |
147 | "orr%? %2, %2, %3, lsl #16\n\t" | 149 | "orr%? %2, %2, %4, lsl #16\n\t" |
148 | "ldr%?h %3, [%0], #4\n\t" | ||
149 | "ldr%?h %4, [%0], #4\n\t" | 150 | "ldr%?h %4, [%0], #4\n\t" |
150 | "orr%? %3, %3, %4, lsl #16\n\t" | 151 | "orr%? %3, %3, %4, lsl #16\n\t" |
151 | "stm%?ia %1!, {%2, %3}" | 152 | "stm%?ia %1!, {%2, %3}" |
@@ -155,7 +156,7 @@ am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned | |||
155 | } | 156 | } |
156 | while (length > 0) { | 157 | while (length > 0) { |
157 | unsigned int tmp; | 158 | unsigned int tmp; |
158 | __asm__ __volatile__( | 159 | asm volatile( |
159 | "ldr%?h %2, [%0], #4\n\t" | 160 | "ldr%?h %2, [%0], #4\n\t" |
160 | "str%?b %2, [%1], #1\n\t" | 161 | "str%?b %2, [%1], #1\n\t" |
161 | "mov%? %2, %2, lsr #8\n\t" | 162 | "mov%? %2, %2, lsr #8\n\t" |
@@ -196,6 +197,42 @@ am79c961_ramtest(struct net_device *dev, unsigned int val) | |||
196 | return errorcount; | 197 | return errorcount; |
197 | } | 198 | } |
198 | 199 | ||
200 | static void am79c961_mc_hash(char *addr, u16 *hash) | ||
201 | { | ||
202 | if (addr[0] & 0x01) { | ||
203 | int idx, bit; | ||
204 | u32 crc; | ||
205 | |||
206 | crc = ether_crc_le(ETH_ALEN, addr); | ||
207 | |||
208 | idx = crc >> 30; | ||
209 | bit = (crc >> 26) & 15; | ||
210 | |||
211 | hash[idx] |= 1 << bit; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | static unsigned int am79c961_get_rx_mode(struct net_device *dev, u16 *hash) | ||
216 | { | ||
217 | unsigned int mode = MODE_PORT_10BT; | ||
218 | |||
219 | if (dev->flags & IFF_PROMISC) { | ||
220 | mode |= MODE_PROMISC; | ||
221 | memset(hash, 0xff, 4 * sizeof(*hash)); | ||
222 | } else if (dev->flags & IFF_ALLMULTI) { | ||
223 | memset(hash, 0xff, 4 * sizeof(*hash)); | ||
224 | } else { | ||
225 | struct netdev_hw_addr *ha; | ||
226 | |||
227 | memset(hash, 0, 4 * sizeof(*hash)); | ||
228 | |||
229 | netdev_for_each_mc_addr(ha, dev) | ||
230 | am79c961_mc_hash(ha->addr, hash); | ||
231 | } | ||
232 | |||
233 | return mode; | ||
234 | } | ||
235 | |||
199 | static void | 236 | static void |
200 | am79c961_init_for_open(struct net_device *dev) | 237 | am79c961_init_for_open(struct net_device *dev) |
201 | { | 238 | { |
@@ -203,6 +240,7 @@ am79c961_init_for_open(struct net_device *dev) | |||
203 | unsigned long flags; | 240 | unsigned long flags; |
204 | unsigned char *p; | 241 | unsigned char *p; |
205 | u_int hdr_addr, first_free_addr; | 242 | u_int hdr_addr, first_free_addr; |
243 | u16 multi_hash[4], mode = am79c961_get_rx_mode(dev, multi_hash); | ||
206 | int i; | 244 | int i; |
207 | 245 | ||
208 | /* | 246 | /* |
@@ -218,16 +256,12 @@ am79c961_init_for_open(struct net_device *dev) | |||
218 | write_ireg (dev->base_addr, 2, 0x0000); /* MODE register selects media */ | 256 | write_ireg (dev->base_addr, 2, 0x0000); /* MODE register selects media */ |
219 | 257 | ||
220 | for (i = LADRL; i <= LADRH; i++) | 258 | for (i = LADRL; i <= LADRH; i++) |
221 | write_rreg (dev->base_addr, i, 0); | 259 | write_rreg (dev->base_addr, i, multi_hash[i - LADRL]); |
222 | 260 | ||
223 | for (i = PADRL, p = dev->dev_addr; i <= PADRH; i++, p += 2) | 261 | for (i = PADRL, p = dev->dev_addr; i <= PADRH; i++, p += 2) |
224 | write_rreg (dev->base_addr, i, p[0] | (p[1] << 8)); | 262 | write_rreg (dev->base_addr, i, p[0] | (p[1] << 8)); |
225 | 263 | ||
226 | i = MODE_PORT_10BT; | 264 | write_rreg (dev->base_addr, MODE, mode); |
227 | if (dev->flags & IFF_PROMISC) | ||
228 | i |= MODE_PROMISC; | ||
229 | |||
230 | write_rreg (dev->base_addr, MODE, i); | ||
231 | write_rreg (dev->base_addr, POLLINT, 0); | 265 | write_rreg (dev->base_addr, POLLINT, 0); |
232 | write_rreg (dev->base_addr, SIZERXR, -RX_BUFFERS); | 266 | write_rreg (dev->base_addr, SIZERXR, -RX_BUFFERS); |
233 | write_rreg (dev->base_addr, SIZETXR, -TX_BUFFERS); | 267 | write_rreg (dev->base_addr, SIZETXR, -TX_BUFFERS); |
@@ -340,21 +374,6 @@ am79c961_close(struct net_device *dev) | |||
340 | return 0; | 374 | return 0; |
341 | } | 375 | } |
342 | 376 | ||
343 | static void am79c961_mc_hash(char *addr, unsigned short *hash) | ||
344 | { | ||
345 | if (addr[0] & 0x01) { | ||
346 | int idx, bit; | ||
347 | u32 crc; | ||
348 | |||
349 | crc = ether_crc_le(ETH_ALEN, addr); | ||
350 | |||
351 | idx = crc >> 30; | ||
352 | bit = (crc >> 26) & 15; | ||
353 | |||
354 | hash[idx] |= 1 << bit; | ||
355 | } | ||
356 | } | ||
357 | |||
358 | /* | 377 | /* |
359 | * Set or clear promiscuous/multicast mode filter for this adapter. | 378 | * Set or clear promiscuous/multicast mode filter for this adapter. |
360 | */ | 379 | */ |
@@ -362,24 +381,9 @@ static void am79c961_setmulticastlist (struct net_device *dev) | |||
362 | { | 381 | { |
363 | struct dev_priv *priv = netdev_priv(dev); | 382 | struct dev_priv *priv = netdev_priv(dev); |
364 | unsigned long flags; | 383 | unsigned long flags; |
365 | unsigned short multi_hash[4], mode; | 384 | u16 multi_hash[4], mode = am79c961_get_rx_mode(dev, multi_hash); |
366 | int i, stopped; | 385 | int i, stopped; |
367 | 386 | ||
368 | mode = MODE_PORT_10BT; | ||
369 | |||
370 | if (dev->flags & IFF_PROMISC) { | ||
371 | mode |= MODE_PROMISC; | ||
372 | } else if (dev->flags & IFF_ALLMULTI) { | ||
373 | memset(multi_hash, 0xff, sizeof(multi_hash)); | ||
374 | } else { | ||
375 | struct netdev_hw_addr *ha; | ||
376 | |||
377 | memset(multi_hash, 0x00, sizeof(multi_hash)); | ||
378 | |||
379 | netdev_for_each_mc_addr(ha, dev) | ||
380 | am79c961_mc_hash(ha->addr, multi_hash); | ||
381 | } | ||
382 | |||
383 | spin_lock_irqsave(&priv->chip_lock, flags); | 387 | spin_lock_irqsave(&priv->chip_lock, flags); |
384 | 388 | ||
385 | stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP; | 389 | stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP; |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 5a77001b6d10..0b46b8ea0e80 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -283,10 +283,14 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) | |||
283 | 283 | ||
284 | skb = dev_alloc_skb(length + 2); | 284 | skb = dev_alloc_skb(length + 2); |
285 | if (likely(skb != NULL)) { | 285 | if (likely(skb != NULL)) { |
286 | struct ep93xx_rdesc *rxd = &ep->descs->rdesc[entry]; | ||
286 | skb_reserve(skb, 2); | 287 | skb_reserve(skb, 2); |
287 | dma_sync_single_for_cpu(NULL, ep->descs->rdesc[entry].buf_addr, | 288 | dma_sync_single_for_cpu(dev->dev.parent, rxd->buf_addr, |
288 | length, DMA_FROM_DEVICE); | 289 | length, DMA_FROM_DEVICE); |
289 | skb_copy_to_linear_data(skb, ep->rx_buf[entry], length); | 290 | skb_copy_to_linear_data(skb, ep->rx_buf[entry], length); |
291 | dma_sync_single_for_device(dev->dev.parent, | ||
292 | rxd->buf_addr, length, | ||
293 | DMA_FROM_DEVICE); | ||
290 | skb_put(skb, length); | 294 | skb_put(skb, length); |
291 | skb->protocol = eth_type_trans(skb, dev); | 295 | skb->protocol = eth_type_trans(skb, dev); |
292 | 296 | ||
@@ -348,6 +352,7 @@ poll_some_more: | |||
348 | static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev) | 352 | static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev) |
349 | { | 353 | { |
350 | struct ep93xx_priv *ep = netdev_priv(dev); | 354 | struct ep93xx_priv *ep = netdev_priv(dev); |
355 | struct ep93xx_tdesc *txd; | ||
351 | int entry; | 356 | int entry; |
352 | 357 | ||
353 | if (unlikely(skb->len > MAX_PKT_SIZE)) { | 358 | if (unlikely(skb->len > MAX_PKT_SIZE)) { |
@@ -359,11 +364,14 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev) | |||
359 | entry = ep->tx_pointer; | 364 | entry = ep->tx_pointer; |
360 | ep->tx_pointer = (ep->tx_pointer + 1) & (TX_QUEUE_ENTRIES - 1); | 365 | ep->tx_pointer = (ep->tx_pointer + 1) & (TX_QUEUE_ENTRIES - 1); |
361 | 366 | ||
362 | ep->descs->tdesc[entry].tdesc1 = | 367 | txd = &ep->descs->tdesc[entry]; |
363 | TDESC1_EOF | (entry << 16) | (skb->len & 0xfff); | 368 | |
369 | txd->tdesc1 = TDESC1_EOF | (entry << 16) | (skb->len & 0xfff); | ||
370 | dma_sync_single_for_cpu(dev->dev.parent, txd->buf_addr, skb->len, | ||
371 | DMA_TO_DEVICE); | ||
364 | skb_copy_and_csum_dev(skb, ep->tx_buf[entry]); | 372 | skb_copy_and_csum_dev(skb, ep->tx_buf[entry]); |
365 | dma_sync_single_for_cpu(NULL, ep->descs->tdesc[entry].buf_addr, | 373 | dma_sync_single_for_device(dev->dev.parent, txd->buf_addr, skb->len, |
366 | skb->len, DMA_TO_DEVICE); | 374 | DMA_TO_DEVICE); |
367 | dev_kfree_skb(skb); | 375 | dev_kfree_skb(skb); |
368 | 376 | ||
369 | spin_lock_irq(&ep->tx_pending_lock); | 377 | spin_lock_irq(&ep->tx_pending_lock); |
@@ -457,89 +465,80 @@ static irqreturn_t ep93xx_irq(int irq, void *dev_id) | |||
457 | 465 | ||
458 | static void ep93xx_free_buffers(struct ep93xx_priv *ep) | 466 | static void ep93xx_free_buffers(struct ep93xx_priv *ep) |
459 | { | 467 | { |
468 | struct device *dev = ep->dev->dev.parent; | ||
460 | int i; | 469 | int i; |
461 | 470 | ||
462 | for (i = 0; i < RX_QUEUE_ENTRIES; i += 2) { | 471 | for (i = 0; i < RX_QUEUE_ENTRIES; i++) { |
463 | dma_addr_t d; | 472 | dma_addr_t d; |
464 | 473 | ||
465 | d = ep->descs->rdesc[i].buf_addr; | 474 | d = ep->descs->rdesc[i].buf_addr; |
466 | if (d) | 475 | if (d) |
467 | dma_unmap_single(NULL, d, PAGE_SIZE, DMA_FROM_DEVICE); | 476 | dma_unmap_single(dev, d, PKT_BUF_SIZE, DMA_FROM_DEVICE); |
468 | 477 | ||
469 | if (ep->rx_buf[i] != NULL) | 478 | if (ep->rx_buf[i] != NULL) |
470 | free_page((unsigned long)ep->rx_buf[i]); | 479 | kfree(ep->rx_buf[i]); |
471 | } | 480 | } |
472 | 481 | ||
473 | for (i = 0; i < TX_QUEUE_ENTRIES; i += 2) { | 482 | for (i = 0; i < TX_QUEUE_ENTRIES; i++) { |
474 | dma_addr_t d; | 483 | dma_addr_t d; |
475 | 484 | ||
476 | d = ep->descs->tdesc[i].buf_addr; | 485 | d = ep->descs->tdesc[i].buf_addr; |
477 | if (d) | 486 | if (d) |
478 | dma_unmap_single(NULL, d, PAGE_SIZE, DMA_TO_DEVICE); | 487 | dma_unmap_single(dev, d, PKT_BUF_SIZE, DMA_TO_DEVICE); |
479 | 488 | ||
480 | if (ep->tx_buf[i] != NULL) | 489 | if (ep->tx_buf[i] != NULL) |
481 | free_page((unsigned long)ep->tx_buf[i]); | 490 | kfree(ep->tx_buf[i]); |
482 | } | 491 | } |
483 | 492 | ||
484 | dma_free_coherent(NULL, sizeof(struct ep93xx_descs), ep->descs, | 493 | dma_free_coherent(dev, sizeof(struct ep93xx_descs), ep->descs, |
485 | ep->descs_dma_addr); | 494 | ep->descs_dma_addr); |
486 | } | 495 | } |
487 | 496 | ||
488 | /* | ||
489 | * The hardware enforces a sub-2K maximum packet size, so we put | ||
490 | * two buffers on every hardware page. | ||
491 | */ | ||
492 | static int ep93xx_alloc_buffers(struct ep93xx_priv *ep) | 497 | static int ep93xx_alloc_buffers(struct ep93xx_priv *ep) |
493 | { | 498 | { |
499 | struct device *dev = ep->dev->dev.parent; | ||
494 | int i; | 500 | int i; |
495 | 501 | ||
496 | ep->descs = dma_alloc_coherent(NULL, sizeof(struct ep93xx_descs), | 502 | ep->descs = dma_alloc_coherent(dev, sizeof(struct ep93xx_descs), |
497 | &ep->descs_dma_addr, GFP_KERNEL | GFP_DMA); | 503 | &ep->descs_dma_addr, GFP_KERNEL); |
498 | if (ep->descs == NULL) | 504 | if (ep->descs == NULL) |
499 | return 1; | 505 | return 1; |
500 | 506 | ||
501 | for (i = 0; i < RX_QUEUE_ENTRIES; i += 2) { | 507 | for (i = 0; i < RX_QUEUE_ENTRIES; i++) { |
502 | void *page; | 508 | void *buf; |
503 | dma_addr_t d; | 509 | dma_addr_t d; |
504 | 510 | ||
505 | page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); | 511 | buf = kmalloc(PKT_BUF_SIZE, GFP_KERNEL); |
506 | if (page == NULL) | 512 | if (buf == NULL) |
507 | goto err; | 513 | goto err; |
508 | 514 | ||
509 | d = dma_map_single(NULL, page, PAGE_SIZE, DMA_FROM_DEVICE); | 515 | d = dma_map_single(dev, buf, PKT_BUF_SIZE, DMA_FROM_DEVICE); |
510 | if (dma_mapping_error(NULL, d)) { | 516 | if (dma_mapping_error(dev, d)) { |
511 | free_page((unsigned long)page); | 517 | kfree(buf); |
512 | goto err; | 518 | goto err; |
513 | } | 519 | } |
514 | 520 | ||
515 | ep->rx_buf[i] = page; | 521 | ep->rx_buf[i] = buf; |
516 | ep->descs->rdesc[i].buf_addr = d; | 522 | ep->descs->rdesc[i].buf_addr = d; |
517 | ep->descs->rdesc[i].rdesc1 = (i << 16) | PKT_BUF_SIZE; | 523 | ep->descs->rdesc[i].rdesc1 = (i << 16) | PKT_BUF_SIZE; |
518 | |||
519 | ep->rx_buf[i + 1] = page + PKT_BUF_SIZE; | ||
520 | ep->descs->rdesc[i + 1].buf_addr = d + PKT_BUF_SIZE; | ||
521 | ep->descs->rdesc[i + 1].rdesc1 = ((i + 1) << 16) | PKT_BUF_SIZE; | ||
522 | } | 524 | } |
523 | 525 | ||
524 | for (i = 0; i < TX_QUEUE_ENTRIES; i += 2) { | 526 | for (i = 0; i < TX_QUEUE_ENTRIES; i++) { |
525 | void *page; | 527 | void *buf; |
526 | dma_addr_t d; | 528 | dma_addr_t d; |
527 | 529 | ||
528 | page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); | 530 | buf = kmalloc(PKT_BUF_SIZE, GFP_KERNEL); |
529 | if (page == NULL) | 531 | if (buf == NULL) |
530 | goto err; | 532 | goto err; |
531 | 533 | ||
532 | d = dma_map_single(NULL, page, PAGE_SIZE, DMA_TO_DEVICE); | 534 | d = dma_map_single(dev, buf, PKT_BUF_SIZE, DMA_TO_DEVICE); |
533 | if (dma_mapping_error(NULL, d)) { | 535 | if (dma_mapping_error(dev, d)) { |
534 | free_page((unsigned long)page); | 536 | kfree(buf); |
535 | goto err; | 537 | goto err; |
536 | } | 538 | } |
537 | 539 | ||
538 | ep->tx_buf[i] = page; | 540 | ep->tx_buf[i] = buf; |
539 | ep->descs->tdesc[i].buf_addr = d; | 541 | ep->descs->tdesc[i].buf_addr = d; |
540 | |||
541 | ep->tx_buf[i + 1] = page + PKT_BUF_SIZE; | ||
542 | ep->descs->tdesc[i + 1].buf_addr = d + PKT_BUF_SIZE; | ||
543 | } | 542 | } |
544 | 543 | ||
545 | return 0; | 544 | return 0; |
@@ -829,6 +828,7 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
829 | } | 828 | } |
830 | ep = netdev_priv(dev); | 829 | ep = netdev_priv(dev); |
831 | ep->dev = dev; | 830 | ep->dev = dev; |
831 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
832 | netif_napi_add(dev, &ep->napi, ep93xx_poll, 64); | 832 | netif_napi_add(dev, &ep->napi, ep93xx_poll, 64); |
833 | 833 | ||
834 | platform_set_drvdata(pdev, dev); | 834 | platform_set_drvdata(pdev, dev); |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 68d45ba2d9b9..6c019e148546 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -52,13 +52,13 @@ MODULE_DESCRIPTION(DRV_DESC); | |||
52 | MODULE_ALIAS("platform:bfin_mac"); | 52 | MODULE_ALIAS("platform:bfin_mac"); |
53 | 53 | ||
54 | #if defined(CONFIG_BFIN_MAC_USE_L1) | 54 | #if defined(CONFIG_BFIN_MAC_USE_L1) |
55 | # define bfin_mac_alloc(dma_handle, size) l1_data_sram_zalloc(size) | 55 | # define bfin_mac_alloc(dma_handle, size, num) l1_data_sram_zalloc(size*num) |
56 | # define bfin_mac_free(dma_handle, ptr) l1_data_sram_free(ptr) | 56 | # define bfin_mac_free(dma_handle, ptr, num) l1_data_sram_free(ptr) |
57 | #else | 57 | #else |
58 | # define bfin_mac_alloc(dma_handle, size) \ | 58 | # define bfin_mac_alloc(dma_handle, size, num) \ |
59 | dma_alloc_coherent(NULL, size, dma_handle, GFP_KERNEL) | 59 | dma_alloc_coherent(NULL, size*num, dma_handle, GFP_KERNEL) |
60 | # define bfin_mac_free(dma_handle, ptr) \ | 60 | # define bfin_mac_free(dma_handle, ptr, num) \ |
61 | dma_free_coherent(NULL, sizeof(*ptr), ptr, dma_handle) | 61 | dma_free_coherent(NULL, sizeof(*ptr)*num, ptr, dma_handle) |
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #define PKT_BUF_SZ 1580 | 64 | #define PKT_BUF_SZ 1580 |
@@ -95,7 +95,7 @@ static void desc_list_free(void) | |||
95 | t = t->next; | 95 | t = t->next; |
96 | } | 96 | } |
97 | } | 97 | } |
98 | bfin_mac_free(dma_handle, tx_desc); | 98 | bfin_mac_free(dma_handle, tx_desc, CONFIG_BFIN_TX_DESC_NUM); |
99 | } | 99 | } |
100 | 100 | ||
101 | if (rx_desc) { | 101 | if (rx_desc) { |
@@ -109,7 +109,7 @@ static void desc_list_free(void) | |||
109 | r = r->next; | 109 | r = r->next; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | bfin_mac_free(dma_handle, rx_desc); | 112 | bfin_mac_free(dma_handle, rx_desc, CONFIG_BFIN_RX_DESC_NUM); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
@@ -126,13 +126,13 @@ static int desc_list_init(void) | |||
126 | #endif | 126 | #endif |
127 | 127 | ||
128 | tx_desc = bfin_mac_alloc(&dma_handle, | 128 | tx_desc = bfin_mac_alloc(&dma_handle, |
129 | sizeof(struct net_dma_desc_tx) * | 129 | sizeof(struct net_dma_desc_tx), |
130 | CONFIG_BFIN_TX_DESC_NUM); | 130 | CONFIG_BFIN_TX_DESC_NUM); |
131 | if (tx_desc == NULL) | 131 | if (tx_desc == NULL) |
132 | goto init_error; | 132 | goto init_error; |
133 | 133 | ||
134 | rx_desc = bfin_mac_alloc(&dma_handle, | 134 | rx_desc = bfin_mac_alloc(&dma_handle, |
135 | sizeof(struct net_dma_desc_rx) * | 135 | sizeof(struct net_dma_desc_rx), |
136 | CONFIG_BFIN_RX_DESC_NUM); | 136 | CONFIG_BFIN_RX_DESC_NUM); |
137 | if (rx_desc == NULL) | 137 | if (rx_desc == NULL) |
138 | goto init_error; | 138 | goto init_error; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 17b4dd94da90..eafe44a528ac 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -388,6 +388,8 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) | |||
388 | return next; | 388 | return next; |
389 | } | 389 | } |
390 | 390 | ||
391 | #define bond_queue_mapping(skb) (*(u16 *)((skb)->cb)) | ||
392 | |||
391 | /** | 393 | /** |
392 | * bond_dev_queue_xmit - Prepare skb for xmit. | 394 | * bond_dev_queue_xmit - Prepare skb for xmit. |
393 | * | 395 | * |
@@ -400,6 +402,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, | |||
400 | { | 402 | { |
401 | skb->dev = slave_dev; | 403 | skb->dev = slave_dev; |
402 | skb->priority = 1; | 404 | skb->priority = 1; |
405 | |||
406 | skb->queue_mapping = bond_queue_mapping(skb); | ||
407 | |||
403 | if (unlikely(netpoll_tx_running(slave_dev))) | 408 | if (unlikely(netpoll_tx_running(slave_dev))) |
404 | bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); | 409 | bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); |
405 | else | 410 | else |
@@ -1292,6 +1297,7 @@ static inline int slave_enable_netpoll(struct slave *slave) | |||
1292 | goto out; | 1297 | goto out; |
1293 | 1298 | ||
1294 | np->dev = slave->dev; | 1299 | np->dev = slave->dev; |
1300 | strlcpy(np->dev_name, slave->dev->name, IFNAMSIZ); | ||
1295 | err = __netpoll_setup(np); | 1301 | err = __netpoll_setup(np); |
1296 | if (err) { | 1302 | if (err) { |
1297 | kfree(np); | 1303 | kfree(np); |
@@ -4206,6 +4212,7 @@ static inline int bond_slave_override(struct bonding *bond, | |||
4206 | return res; | 4212 | return res; |
4207 | } | 4213 | } |
4208 | 4214 | ||
4215 | |||
4209 | static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb) | 4216 | static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb) |
4210 | { | 4217 | { |
4211 | /* | 4218 | /* |
@@ -4216,6 +4223,11 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
4216 | */ | 4223 | */ |
4217 | u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0; | 4224 | u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0; |
4218 | 4225 | ||
4226 | /* | ||
4227 | * Save the original txq to restore before passing to the driver | ||
4228 | */ | ||
4229 | bond_queue_mapping(skb) = skb->queue_mapping; | ||
4230 | |||
4219 | if (unlikely(txq >= dev->real_num_tx_queues)) { | 4231 | if (unlikely(txq >= dev->real_num_tx_queues)) { |
4220 | do { | 4232 | do { |
4221 | txq -= dev->real_num_tx_queues; | 4233 | txq -= dev->real_num_tx_queues; |
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 73c7e03617ec..3df0c0f8b8bf 100644 --- a/drivers/net/caif/caif_serial.c +++ b/drivers/net/caif/caif_serial.c | |||
@@ -167,8 +167,8 @@ static inline void debugfs_tx(struct ser_device *ser, const u8 *data, int size) | |||
167 | 167 | ||
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | static unsigned int ldisc_receive(struct tty_struct *tty, | 170 | static void ldisc_receive(struct tty_struct *tty, const u8 *data, |
171 | const u8 *data, char *flags, int count) | 171 | char *flags, int count) |
172 | { | 172 | { |
173 | struct sk_buff *skb = NULL; | 173 | struct sk_buff *skb = NULL; |
174 | struct ser_device *ser; | 174 | struct ser_device *ser; |
@@ -215,8 +215,6 @@ static unsigned int ldisc_receive(struct tty_struct *tty, | |||
215 | } else | 215 | } else |
216 | ++ser->dev->stats.rx_dropped; | 216 | ++ser->dev->stats.rx_dropped; |
217 | update_tty_status(ser); | 217 | update_tty_status(ser); |
218 | |||
219 | return count; | ||
220 | } | 218 | } |
221 | 219 | ||
222 | static int handle_tx(struct ser_device *ser) | 220 | static int handle_tx(struct ser_device *ser) |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index d4990568baee..17678117ed69 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -923,7 +923,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev) | |||
923 | mem_size = resource_size(mem); | 923 | mem_size = resource_size(mem); |
924 | if (!request_mem_region(mem->start, mem_size, pdev->name)) { | 924 | if (!request_mem_region(mem->start, mem_size, pdev->name)) { |
925 | err = -EBUSY; | 925 | err = -EBUSY; |
926 | goto failed_req; | 926 | goto failed_get; |
927 | } | 927 | } |
928 | 928 | ||
929 | base = ioremap(mem->start, mem_size); | 929 | base = ioremap(mem->start, mem_size); |
@@ -977,9 +977,8 @@ static int __devinit flexcan_probe(struct platform_device *pdev) | |||
977 | iounmap(base); | 977 | iounmap(base); |
978 | failed_map: | 978 | failed_map: |
979 | release_mem_region(mem->start, mem_size); | 979 | release_mem_region(mem->start, mem_size); |
980 | failed_req: | ||
981 | clk_put(clk); | ||
982 | failed_get: | 980 | failed_get: |
981 | clk_put(clk); | ||
983 | failed_clock: | 982 | failed_clock: |
984 | return err; | 983 | return err; |
985 | } | 984 | } |
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 75622d54581f..1b49df6b2470 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -425,17 +425,16 @@ static void slc_setup(struct net_device *dev) | |||
425 | * in parallel | 425 | * in parallel |
426 | */ | 426 | */ |
427 | 427 | ||
428 | static unsigned int slcan_receive_buf(struct tty_struct *tty, | 428 | static void slcan_receive_buf(struct tty_struct *tty, |
429 | const unsigned char *cp, char *fp, int count) | 429 | const unsigned char *cp, char *fp, int count) |
430 | { | 430 | { |
431 | struct slcan *sl = (struct slcan *) tty->disc_data; | 431 | struct slcan *sl = (struct slcan *) tty->disc_data; |
432 | int bytes = count; | ||
433 | 432 | ||
434 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) | 433 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) |
435 | return -ENODEV; | 434 | return; |
436 | 435 | ||
437 | /* Read the characters out of the buffer */ | 436 | /* Read the characters out of the buffer */ |
438 | while (bytes--) { | 437 | while (count--) { |
439 | if (fp && *fp++) { | 438 | if (fp && *fp++) { |
440 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) | 439 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
441 | sl->dev->stats.rx_errors++; | 440 | sl->dev->stats.rx_errors++; |
@@ -444,8 +443,6 @@ static unsigned int slcan_receive_buf(struct tty_struct *tty, | |||
444 | } | 443 | } |
445 | slcan_unesc(sl, *cp++); | 444 | slcan_unesc(sl, *cp++); |
446 | } | 445 | } |
447 | |||
448 | return count; | ||
449 | } | 446 | } |
450 | 447 | ||
451 | /************************************ | 448 | /************************************ |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 29a4f06fbfcf..dcc4a170b0f3 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1781,8 +1781,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
1781 | ndev = alloc_etherdev(sizeof(struct emac_priv)); | 1781 | ndev = alloc_etherdev(sizeof(struct emac_priv)); |
1782 | if (!ndev) { | 1782 | if (!ndev) { |
1783 | dev_err(&pdev->dev, "error allocating net_device\n"); | 1783 | dev_err(&pdev->dev, "error allocating net_device\n"); |
1784 | clk_put(emac_clk); | 1784 | rc = -ENOMEM; |
1785 | return -ENOMEM; | 1785 | goto free_clk; |
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | platform_set_drvdata(pdev, ndev); | 1788 | platform_set_drvdata(pdev, ndev); |
@@ -1796,7 +1796,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
1796 | pdata = pdev->dev.platform_data; | 1796 | pdata = pdev->dev.platform_data; |
1797 | if (!pdata) { | 1797 | if (!pdata) { |
1798 | dev_err(&pdev->dev, "no platform data\n"); | 1798 | dev_err(&pdev->dev, "no platform data\n"); |
1799 | return -ENODEV; | 1799 | rc = -ENODEV; |
1800 | goto probe_quit; | ||
1800 | } | 1801 | } |
1801 | 1802 | ||
1802 | /* MAC addr and PHY mask , RMII enable info from platform_data */ | 1803 | /* MAC addr and PHY mask , RMII enable info from platform_data */ |
@@ -1929,8 +1930,9 @@ no_dma: | |||
1929 | iounmap(priv->remap_addr); | 1930 | iounmap(priv->remap_addr); |
1930 | 1931 | ||
1931 | probe_quit: | 1932 | probe_quit: |
1932 | clk_put(emac_clk); | ||
1933 | free_netdev(ndev); | 1933 | free_netdev(ndev); |
1934 | free_clk: | ||
1935 | clk_put(emac_clk); | ||
1934 | return rc; | 1936 | return rc; |
1935 | } | 1937 | } |
1936 | 1938 | ||
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 17654059922d..8b0084d17c8c 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -331,18 +331,18 @@ static struct { | |||
331 | "DE422",\ | 331 | "DE422",\ |
332 | ""} | 332 | ""} |
333 | 333 | ||
334 | static const char* const depca_signature[] __devinitconst = DEPCA_SIGNATURE; | 334 | static char* __initdata depca_signature[] = DEPCA_SIGNATURE; |
335 | 335 | ||
336 | enum depca_type { | 336 | enum depca_type { |
337 | DEPCA, de100, de101, de200, de201, de202, de210, de212, de422, unknown | 337 | DEPCA, de100, de101, de200, de201, de202, de210, de212, de422, unknown |
338 | }; | 338 | }; |
339 | 339 | ||
340 | static const char depca_string[] = "depca"; | 340 | static char depca_string[] = "depca"; |
341 | 341 | ||
342 | static int depca_device_remove (struct device *device); | 342 | static int depca_device_remove (struct device *device); |
343 | 343 | ||
344 | #ifdef CONFIG_EISA | 344 | #ifdef CONFIG_EISA |
345 | static const struct eisa_device_id depca_eisa_ids[] __devinitconst = { | 345 | static struct eisa_device_id depca_eisa_ids[] = { |
346 | { "DEC4220", de422 }, | 346 | { "DEC4220", de422 }, |
347 | { "" } | 347 | { "" } |
348 | }; | 348 | }; |
@@ -367,19 +367,19 @@ static struct eisa_driver depca_eisa_driver = { | |||
367 | #define DE210_ID 0x628d | 367 | #define DE210_ID 0x628d |
368 | #define DE212_ID 0x6def | 368 | #define DE212_ID 0x6def |
369 | 369 | ||
370 | static const short depca_mca_adapter_ids[] __devinitconst = { | 370 | static short depca_mca_adapter_ids[] = { |
371 | DE210_ID, | 371 | DE210_ID, |
372 | DE212_ID, | 372 | DE212_ID, |
373 | 0x0000 | 373 | 0x0000 |
374 | }; | 374 | }; |
375 | 375 | ||
376 | static const char *depca_mca_adapter_name[] = { | 376 | static char *depca_mca_adapter_name[] = { |
377 | "DEC EtherWORKS MC Adapter (DE210)", | 377 | "DEC EtherWORKS MC Adapter (DE210)", |
378 | "DEC EtherWORKS MC Adapter (DE212)", | 378 | "DEC EtherWORKS MC Adapter (DE212)", |
379 | NULL | 379 | NULL |
380 | }; | 380 | }; |
381 | 381 | ||
382 | static const enum depca_type depca_mca_adapter_type[] = { | 382 | static enum depca_type depca_mca_adapter_type[] = { |
383 | de210, | 383 | de210, |
384 | de212, | 384 | de212, |
385 | 0 | 385 | 0 |
@@ -541,9 +541,10 @@ static void SetMulticastFilter(struct net_device *dev); | |||
541 | static int load_packet(struct net_device *dev, struct sk_buff *skb); | 541 | static int load_packet(struct net_device *dev, struct sk_buff *skb); |
542 | static void depca_dbg_open(struct net_device *dev); | 542 | static void depca_dbg_open(struct net_device *dev); |
543 | 543 | ||
544 | static const u_char de1xx_irq[] __devinitconst = { 2, 3, 4, 5, 7, 9, 0 }; | 544 | static u_char de1xx_irq[] __initdata = { 2, 3, 4, 5, 7, 9, 0 }; |
545 | static const u_char de2xx_irq[] __devinitconst = { 5, 9, 10, 11, 15, 0 }; | 545 | static u_char de2xx_irq[] __initdata = { 5, 9, 10, 11, 15, 0 }; |
546 | static const u_char de422_irq[] __devinitconst = { 5, 9, 10, 11, 0 }; | 546 | static u_char de422_irq[] __initdata = { 5, 9, 10, 11, 0 }; |
547 | static u_char *depca_irq; | ||
547 | 548 | ||
548 | static int irq; | 549 | static int irq; |
549 | static int io; | 550 | static int io; |
@@ -579,7 +580,7 @@ static const struct net_device_ops depca_netdev_ops = { | |||
579 | .ndo_validate_addr = eth_validate_addr, | 580 | .ndo_validate_addr = eth_validate_addr, |
580 | }; | 581 | }; |
581 | 582 | ||
582 | static int __devinit depca_hw_init (struct net_device *dev, struct device *device) | 583 | static int __init depca_hw_init (struct net_device *dev, struct device *device) |
583 | { | 584 | { |
584 | struct depca_private *lp; | 585 | struct depca_private *lp; |
585 | int i, j, offset, netRAM, mem_len, status = 0; | 586 | int i, j, offset, netRAM, mem_len, status = 0; |
@@ -747,7 +748,6 @@ static int __devinit depca_hw_init (struct net_device *dev, struct device *devic | |||
747 | if (dev->irq < 2) { | 748 | if (dev->irq < 2) { |
748 | unsigned char irqnum; | 749 | unsigned char irqnum; |
749 | unsigned long irq_mask, delay; | 750 | unsigned long irq_mask, delay; |
750 | const u_char *depca_irq; | ||
751 | 751 | ||
752 | irq_mask = probe_irq_on(); | 752 | irq_mask = probe_irq_on(); |
753 | 753 | ||
@@ -770,7 +770,6 @@ static int __devinit depca_hw_init (struct net_device *dev, struct device *devic | |||
770 | break; | 770 | break; |
771 | 771 | ||
772 | default: | 772 | default: |
773 | depca_irq = NULL; | ||
774 | break; /* Not reached */ | 773 | break; /* Not reached */ |
775 | } | 774 | } |
776 | 775 | ||
@@ -1303,7 +1302,7 @@ static void SetMulticastFilter(struct net_device *dev) | |||
1303 | } | 1302 | } |
1304 | } | 1303 | } |
1305 | 1304 | ||
1306 | static int __devinit depca_common_init (u_long ioaddr, struct net_device **devp) | 1305 | static int __init depca_common_init (u_long ioaddr, struct net_device **devp) |
1307 | { | 1306 | { |
1308 | int status = 0; | 1307 | int status = 0; |
1309 | 1308 | ||
@@ -1334,7 +1333,7 @@ static int __devinit depca_common_init (u_long ioaddr, struct net_device **devp) | |||
1334 | /* | 1333 | /* |
1335 | ** Microchannel bus I/O device probe | 1334 | ** Microchannel bus I/O device probe |
1336 | */ | 1335 | */ |
1337 | static int __devinit depca_mca_probe(struct device *device) | 1336 | static int __init depca_mca_probe(struct device *device) |
1338 | { | 1337 | { |
1339 | unsigned char pos[2]; | 1338 | unsigned char pos[2]; |
1340 | unsigned char where; | 1339 | unsigned char where; |
@@ -1458,7 +1457,7 @@ static int __devinit depca_mca_probe(struct device *device) | |||
1458 | ** ISA bus I/O device probe | 1457 | ** ISA bus I/O device probe |
1459 | */ | 1458 | */ |
1460 | 1459 | ||
1461 | static void __devinit depca_platform_probe (void) | 1460 | static void __init depca_platform_probe (void) |
1462 | { | 1461 | { |
1463 | int i; | 1462 | int i; |
1464 | struct platform_device *pldev; | 1463 | struct platform_device *pldev; |
@@ -1498,7 +1497,7 @@ static void __devinit depca_platform_probe (void) | |||
1498 | } | 1497 | } |
1499 | } | 1498 | } |
1500 | 1499 | ||
1501 | static enum depca_type __devinit depca_shmem_probe (ulong *mem_start) | 1500 | static enum depca_type __init depca_shmem_probe (ulong *mem_start) |
1502 | { | 1501 | { |
1503 | u_long mem_base[] = DEPCA_RAM_BASE_ADDRESSES; | 1502 | u_long mem_base[] = DEPCA_RAM_BASE_ADDRESSES; |
1504 | enum depca_type adapter = unknown; | 1503 | enum depca_type adapter = unknown; |
@@ -1559,7 +1558,7 @@ static int __devinit depca_isa_probe (struct platform_device *device) | |||
1559 | */ | 1558 | */ |
1560 | 1559 | ||
1561 | #ifdef CONFIG_EISA | 1560 | #ifdef CONFIG_EISA |
1562 | static int __devinit depca_eisa_probe (struct device *device) | 1561 | static int __init depca_eisa_probe (struct device *device) |
1563 | { | 1562 | { |
1564 | enum depca_type adapter = unknown; | 1563 | enum depca_type adapter = unknown; |
1565 | struct eisa_device *edev; | 1564 | struct eisa_device *edev; |
@@ -1630,7 +1629,7 @@ static int __devexit depca_device_remove (struct device *device) | |||
1630 | ** and Boot (readb) ROM. This will also give us a clue to the network RAM | 1629 | ** and Boot (readb) ROM. This will also give us a clue to the network RAM |
1631 | ** base address. | 1630 | ** base address. |
1632 | */ | 1631 | */ |
1633 | static int __devinit DepcaSignature(char *name, u_long base_addr) | 1632 | static int __init DepcaSignature(char *name, u_long base_addr) |
1634 | { | 1633 | { |
1635 | u_int i, j, k; | 1634 | u_int i, j, k; |
1636 | void __iomem *ptr; | 1635 | void __iomem *ptr; |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index c445457b66d5..23179dbcedd2 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -346,7 +346,7 @@ parse_eeprom (struct net_device *dev) | |||
346 | if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */ | 346 | if (np->pdev->vendor == PCI_VENDOR_ID_DLINK) { /* D-Link Only */ |
347 | /* Check CRC */ | 347 | /* Check CRC */ |
348 | crc = ~ether_crc_le (256 - 4, sromdata); | 348 | crc = ~ether_crc_le (256 - 4, sromdata); |
349 | if (psrom->crc != crc) { | 349 | if (psrom->crc != cpu_to_le32(crc)) { |
350 | printk (KERN_ERR "%s: EEPROM data CRC error.\n", | 350 | printk (KERN_ERR "%s: EEPROM data CRC error.\n", |
351 | dev->name); | 351 | dev->name); |
352 | return -1; | 352 | return -1; |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index fbaff3584bd4..ee597e676ee5 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -1157,9 +1157,6 @@ dm9000_open(struct net_device *dev) | |||
1157 | 1157 | ||
1158 | irqflags |= IRQF_SHARED; | 1158 | irqflags |= IRQF_SHARED; |
1159 | 1159 | ||
1160 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) | ||
1161 | return -EAGAIN; | ||
1162 | |||
1163 | /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ | 1160 | /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ |
1164 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ | 1161 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ |
1165 | mdelay(1); /* delay needs by DM9000B */ | 1162 | mdelay(1); /* delay needs by DM9000B */ |
@@ -1168,6 +1165,9 @@ dm9000_open(struct net_device *dev) | |||
1168 | dm9000_reset(db); | 1165 | dm9000_reset(db); |
1169 | dm9000_init_dm9000(dev); | 1166 | dm9000_init_dm9000(dev); |
1170 | 1167 | ||
1168 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) | ||
1169 | return -EAGAIN; | ||
1170 | |||
1171 | /* Init driver variable */ | 1171 | /* Init driver variable */ |
1172 | db->dbug_cnt = 0; | 1172 | db->dbug_cnt = 0; |
1173 | 1173 | ||
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 7a84e45487e8..7583a9572bcc 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
@@ -105,7 +105,7 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
105 | goto out_ep; | 105 | goto out_ep; |
106 | 106 | ||
107 | fep->fcc.mem = (void __iomem *)cpm2_immr; | 107 | fep->fcc.mem = (void __iomem *)cpm2_immr; |
108 | fpi->dpram_offset = cpm_dpalloc(128, 8); | 108 | fpi->dpram_offset = cpm_dpalloc(128, 32); |
109 | if (IS_ERR_VALUE(fpi->dpram_offset)) { | 109 | if (IS_ERR_VALUE(fpi->dpram_offset)) { |
110 | ret = fpi->dpram_offset; | 110 | ret = fpi->dpram_offset; |
111 | goto out_fcccp; | 111 | goto out_fcccp; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index ff60b23a5b74..2dfcc8047847 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * Maintainer: Kumar Gala | 10 | * Maintainer: Kumar Gala |
11 | * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> | 11 | * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> |
12 | * | 12 | * |
13 | * Copyright 2002-2009 Freescale Semiconductor, Inc. | 13 | * Copyright 2002-2009, 2011 Freescale Semiconductor, Inc. |
14 | * Copyright 2007 MontaVista Software, Inc. | 14 | * Copyright 2007 MontaVista Software, Inc. |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or modify it | 16 | * This program is free software; you can redistribute it and/or modify it |
@@ -476,9 +476,6 @@ static const struct net_device_ops gfar_netdev_ops = { | |||
476 | #endif | 476 | #endif |
477 | }; | 477 | }; |
478 | 478 | ||
479 | unsigned int ftp_rqfpr[MAX_FILER_IDX + 1]; | ||
480 | unsigned int ftp_rqfcr[MAX_FILER_IDX + 1]; | ||
481 | |||
482 | void lock_rx_qs(struct gfar_private *priv) | 479 | void lock_rx_qs(struct gfar_private *priv) |
483 | { | 480 | { |
484 | int i = 0x0; | 481 | int i = 0x0; |
@@ -868,28 +865,28 @@ static u32 cluster_entry_per_class(struct gfar_private *priv, u32 rqfar, | |||
868 | 865 | ||
869 | rqfar--; | 866 | rqfar--; |
870 | rqfcr = RQFCR_CLE | RQFCR_PID_MASK | RQFCR_CMP_EXACT; | 867 | rqfcr = RQFCR_CLE | RQFCR_PID_MASK | RQFCR_CMP_EXACT; |
871 | ftp_rqfpr[rqfar] = rqfpr; | 868 | priv->ftp_rqfpr[rqfar] = rqfpr; |
872 | ftp_rqfcr[rqfar] = rqfcr; | 869 | priv->ftp_rqfcr[rqfar] = rqfcr; |
873 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | 870 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); |
874 | 871 | ||
875 | rqfar--; | 872 | rqfar--; |
876 | rqfcr = RQFCR_CMP_NOMATCH; | 873 | rqfcr = RQFCR_CMP_NOMATCH; |
877 | ftp_rqfpr[rqfar] = rqfpr; | 874 | priv->ftp_rqfpr[rqfar] = rqfpr; |
878 | ftp_rqfcr[rqfar] = rqfcr; | 875 | priv->ftp_rqfcr[rqfar] = rqfcr; |
879 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | 876 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); |
880 | 877 | ||
881 | rqfar--; | 878 | rqfar--; |
882 | rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | RQFCR_CLE | RQFCR_AND; | 879 | rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_PARSE | RQFCR_CLE | RQFCR_AND; |
883 | rqfpr = class; | 880 | rqfpr = class; |
884 | ftp_rqfcr[rqfar] = rqfcr; | 881 | priv->ftp_rqfcr[rqfar] = rqfcr; |
885 | ftp_rqfpr[rqfar] = rqfpr; | 882 | priv->ftp_rqfpr[rqfar] = rqfpr; |
886 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | 883 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); |
887 | 884 | ||
888 | rqfar--; | 885 | rqfar--; |
889 | rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | RQFCR_AND; | 886 | rqfcr = RQFCR_CMP_EXACT | RQFCR_PID_MASK | RQFCR_AND; |
890 | rqfpr = class; | 887 | rqfpr = class; |
891 | ftp_rqfcr[rqfar] = rqfcr; | 888 | priv->ftp_rqfcr[rqfar] = rqfcr; |
892 | ftp_rqfpr[rqfar] = rqfpr; | 889 | priv->ftp_rqfpr[rqfar] = rqfpr; |
893 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | 890 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); |
894 | 891 | ||
895 | return rqfar; | 892 | return rqfar; |
@@ -904,8 +901,8 @@ static void gfar_init_filer_table(struct gfar_private *priv) | |||
904 | 901 | ||
905 | /* Default rule */ | 902 | /* Default rule */ |
906 | rqfcr = RQFCR_CMP_MATCH; | 903 | rqfcr = RQFCR_CMP_MATCH; |
907 | ftp_rqfcr[rqfar] = rqfcr; | 904 | priv->ftp_rqfcr[rqfar] = rqfcr; |
908 | ftp_rqfpr[rqfar] = rqfpr; | 905 | priv->ftp_rqfpr[rqfar] = rqfpr; |
909 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); | 906 | gfar_write_filer(priv, rqfar, rqfcr, rqfpr); |
910 | 907 | ||
911 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6); | 908 | rqfar = cluster_entry_per_class(priv, rqfar, RQFPR_IPV6); |
@@ -921,8 +918,8 @@ static void gfar_init_filer_table(struct gfar_private *priv) | |||
921 | /* Rest are masked rules */ | 918 | /* Rest are masked rules */ |
922 | rqfcr = RQFCR_CMP_NOMATCH; | 919 | rqfcr = RQFCR_CMP_NOMATCH; |
923 | for (i = 0; i < rqfar; i++) { | 920 | for (i = 0; i < rqfar; i++) { |
924 | ftp_rqfcr[i] = rqfcr; | 921 | priv->ftp_rqfcr[i] = rqfcr; |
925 | ftp_rqfpr[i] = rqfpr; | 922 | priv->ftp_rqfpr[i] = rqfpr; |
926 | gfar_write_filer(priv, i, rqfcr, rqfpr); | 923 | gfar_write_filer(priv, i, rqfcr, rqfpr); |
927 | } | 924 | } |
928 | } | 925 | } |
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index fc86f5195445..ba36dc7a3435 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * Maintainer: Kumar Gala | 9 | * Maintainer: Kumar Gala |
10 | * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> | 10 | * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> |
11 | * | 11 | * |
12 | * Copyright 2002-2009 Freescale Semiconductor, Inc. | 12 | * Copyright 2002-2009, 2011 Freescale Semiconductor, Inc. |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify it | 14 | * This program is free software; you can redistribute it and/or modify it |
15 | * under the terms of the GNU General Public License as published by the | 15 | * under the terms of the GNU General Public License as published by the |
@@ -1107,10 +1107,12 @@ struct gfar_private { | |||
1107 | /* HW time stamping enabled flag */ | 1107 | /* HW time stamping enabled flag */ |
1108 | int hwts_rx_en; | 1108 | int hwts_rx_en; |
1109 | int hwts_tx_en; | 1109 | int hwts_tx_en; |
1110 | |||
1111 | /*Filer table*/ | ||
1112 | unsigned int ftp_rqfpr[MAX_FILER_IDX + 1]; | ||
1113 | unsigned int ftp_rqfcr[MAX_FILER_IDX + 1]; | ||
1110 | }; | 1114 | }; |
1111 | 1115 | ||
1112 | extern unsigned int ftp_rqfpr[MAX_FILER_IDX + 1]; | ||
1113 | extern unsigned int ftp_rqfcr[MAX_FILER_IDX + 1]; | ||
1114 | 1116 | ||
1115 | static inline int gfar_has_errata(struct gfar_private *priv, | 1117 | static inline int gfar_has_errata(struct gfar_private *priv, |
1116 | enum gfar_errata err) | 1118 | enum gfar_errata err) |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 493d743839d9..239e3330495f 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * Maintainer: Kumar Gala | 9 | * Maintainer: Kumar Gala |
10 | * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> | 10 | * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com> |
11 | * | 11 | * |
12 | * Copyright 2003-2006, 2008-2009 Freescale Semiconductor, Inc. | 12 | * Copyright 2003-2006, 2008-2009, 2011 Freescale Semiconductor, Inc. |
13 | * | 13 | * |
14 | * This software may be used and distributed according to | 14 | * This software may be used and distributed according to |
15 | * the terms of the GNU Public License, Version 2, incorporated herein | 15 | * the terms of the GNU Public License, Version 2, incorporated herein |
@@ -609,15 +609,15 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow) | |||
609 | if (ethflow & RXH_L2DA) { | 609 | if (ethflow & RXH_L2DA) { |
610 | fcr = RQFCR_PID_DAH |RQFCR_CMP_NOMATCH | | 610 | fcr = RQFCR_PID_DAH |RQFCR_CMP_NOMATCH | |
611 | RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; | 611 | RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; |
612 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 612 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
613 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 613 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
614 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 614 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
615 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 615 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
616 | 616 | ||
617 | fcr = RQFCR_PID_DAL | RQFCR_AND | RQFCR_CMP_NOMATCH | | 617 | fcr = RQFCR_PID_DAL | RQFCR_AND | RQFCR_CMP_NOMATCH | |
618 | RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; | 618 | RQFCR_HASH | RQFCR_AND | RQFCR_HASHTBL_0; |
619 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 619 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
620 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 620 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
621 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 621 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
622 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 622 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
623 | } | 623 | } |
@@ -626,16 +626,16 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow) | |||
626 | fcr = RQFCR_PID_VID | RQFCR_CMP_NOMATCH | RQFCR_HASH | | 626 | fcr = RQFCR_PID_VID | RQFCR_CMP_NOMATCH | RQFCR_HASH | |
627 | RQFCR_AND | RQFCR_HASHTBL_0; | 627 | RQFCR_AND | RQFCR_HASHTBL_0; |
628 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 628 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
629 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 629 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
630 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 630 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
631 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 631 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
632 | } | 632 | } |
633 | 633 | ||
634 | if (ethflow & RXH_IP_SRC) { | 634 | if (ethflow & RXH_IP_SRC) { |
635 | fcr = RQFCR_PID_SIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | | 635 | fcr = RQFCR_PID_SIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | |
636 | RQFCR_AND | RQFCR_HASHTBL_0; | 636 | RQFCR_AND | RQFCR_HASHTBL_0; |
637 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 637 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
638 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 638 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
639 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 639 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
640 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 640 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
641 | } | 641 | } |
@@ -643,8 +643,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow) | |||
643 | if (ethflow & (RXH_IP_DST)) { | 643 | if (ethflow & (RXH_IP_DST)) { |
644 | fcr = RQFCR_PID_DIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | | 644 | fcr = RQFCR_PID_DIA | RQFCR_CMP_NOMATCH | RQFCR_HASH | |
645 | RQFCR_AND | RQFCR_HASHTBL_0; | 645 | RQFCR_AND | RQFCR_HASHTBL_0; |
646 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 646 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
647 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 647 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
648 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 648 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
649 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 649 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
650 | } | 650 | } |
@@ -652,8 +652,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow) | |||
652 | if (ethflow & RXH_L3_PROTO) { | 652 | if (ethflow & RXH_L3_PROTO) { |
653 | fcr = RQFCR_PID_L4P | RQFCR_CMP_NOMATCH | RQFCR_HASH | | 653 | fcr = RQFCR_PID_L4P | RQFCR_CMP_NOMATCH | RQFCR_HASH | |
654 | RQFCR_AND | RQFCR_HASHTBL_0; | 654 | RQFCR_AND | RQFCR_HASHTBL_0; |
655 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 655 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
656 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 656 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
657 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 657 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
658 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 658 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
659 | } | 659 | } |
@@ -661,8 +661,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow) | |||
661 | if (ethflow & RXH_L4_B_0_1) { | 661 | if (ethflow & RXH_L4_B_0_1) { |
662 | fcr = RQFCR_PID_SPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | | 662 | fcr = RQFCR_PID_SPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | |
663 | RQFCR_AND | RQFCR_HASHTBL_0; | 663 | RQFCR_AND | RQFCR_HASHTBL_0; |
664 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 664 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
665 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 665 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
666 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 666 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
667 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 667 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
668 | } | 668 | } |
@@ -670,8 +670,8 @@ static void ethflow_to_filer_rules (struct gfar_private *priv, u64 ethflow) | |||
670 | if (ethflow & RXH_L4_B_2_3) { | 670 | if (ethflow & RXH_L4_B_2_3) { |
671 | fcr = RQFCR_PID_DPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | | 671 | fcr = RQFCR_PID_DPT | RQFCR_CMP_NOMATCH | RQFCR_HASH | |
672 | RQFCR_AND | RQFCR_HASHTBL_0; | 672 | RQFCR_AND | RQFCR_HASHTBL_0; |
673 | ftp_rqfpr[priv->cur_filer_idx] = fpr; | 673 | priv->ftp_rqfpr[priv->cur_filer_idx] = fpr; |
674 | ftp_rqfcr[priv->cur_filer_idx] = fcr; | 674 | priv->ftp_rqfcr[priv->cur_filer_idx] = fcr; |
675 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); | 675 | gfar_write_filer(priv, priv->cur_filer_idx, fcr, fpr); |
676 | priv->cur_filer_idx = priv->cur_filer_idx - 1; | 676 | priv->cur_filer_idx = priv->cur_filer_idx - 1; |
677 | } | 677 | } |
@@ -705,12 +705,12 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u | |||
705 | } | 705 | } |
706 | 706 | ||
707 | for (i = 0; i < MAX_FILER_IDX + 1; i++) { | 707 | for (i = 0; i < MAX_FILER_IDX + 1; i++) { |
708 | local_rqfpr[j] = ftp_rqfpr[i]; | 708 | local_rqfpr[j] = priv->ftp_rqfpr[i]; |
709 | local_rqfcr[j] = ftp_rqfcr[i]; | 709 | local_rqfcr[j] = priv->ftp_rqfcr[i]; |
710 | j--; | 710 | j--; |
711 | if ((ftp_rqfcr[i] == (RQFCR_PID_PARSE | | 711 | if ((priv->ftp_rqfcr[i] == (RQFCR_PID_PARSE | |
712 | RQFCR_CLE |RQFCR_AND)) && | 712 | RQFCR_CLE |RQFCR_AND)) && |
713 | (ftp_rqfpr[i] == cmp_rqfpr)) | 713 | (priv->ftp_rqfpr[i] == cmp_rqfpr)) |
714 | break; | 714 | break; |
715 | } | 715 | } |
716 | 716 | ||
@@ -724,20 +724,22 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u | |||
724 | * if it was already programmed, we need to overwrite these rules | 724 | * if it was already programmed, we need to overwrite these rules |
725 | */ | 725 | */ |
726 | for (l = i+1; l < MAX_FILER_IDX; l++) { | 726 | for (l = i+1; l < MAX_FILER_IDX; l++) { |
727 | if ((ftp_rqfcr[l] & RQFCR_CLE) && | 727 | if ((priv->ftp_rqfcr[l] & RQFCR_CLE) && |
728 | !(ftp_rqfcr[l] & RQFCR_AND)) { | 728 | !(priv->ftp_rqfcr[l] & RQFCR_AND)) { |
729 | ftp_rqfcr[l] = RQFCR_CLE | RQFCR_CMP_EXACT | | 729 | priv->ftp_rqfcr[l] = RQFCR_CLE | RQFCR_CMP_EXACT | |
730 | RQFCR_HASHTBL_0 | RQFCR_PID_MASK; | 730 | RQFCR_HASHTBL_0 | RQFCR_PID_MASK; |
731 | ftp_rqfpr[l] = FPR_FILER_MASK; | 731 | priv->ftp_rqfpr[l] = FPR_FILER_MASK; |
732 | gfar_write_filer(priv, l, ftp_rqfcr[l], ftp_rqfpr[l]); | 732 | gfar_write_filer(priv, l, priv->ftp_rqfcr[l], |
733 | priv->ftp_rqfpr[l]); | ||
733 | break; | 734 | break; |
734 | } | 735 | } |
735 | 736 | ||
736 | if (!(ftp_rqfcr[l] & RQFCR_CLE) && (ftp_rqfcr[l] & RQFCR_AND)) | 737 | if (!(priv->ftp_rqfcr[l] & RQFCR_CLE) && |
738 | (priv->ftp_rqfcr[l] & RQFCR_AND)) | ||
737 | continue; | 739 | continue; |
738 | else { | 740 | else { |
739 | local_rqfpr[j] = ftp_rqfpr[l]; | 741 | local_rqfpr[j] = priv->ftp_rqfpr[l]; |
740 | local_rqfcr[j] = ftp_rqfcr[l]; | 742 | local_rqfcr[j] = priv->ftp_rqfcr[l]; |
741 | j--; | 743 | j--; |
742 | } | 744 | } |
743 | } | 745 | } |
@@ -750,8 +752,8 @@ static int gfar_ethflow_to_filer_table(struct gfar_private *priv, u64 ethflow, u | |||
750 | 752 | ||
751 | /* Write back the popped out rules again */ | 753 | /* Write back the popped out rules again */ |
752 | for (k = j+1; k < MAX_FILER_IDX; k++) { | 754 | for (k = j+1; k < MAX_FILER_IDX; k++) { |
753 | ftp_rqfpr[priv->cur_filer_idx] = local_rqfpr[k]; | 755 | priv->ftp_rqfpr[priv->cur_filer_idx] = local_rqfpr[k]; |
754 | ftp_rqfcr[priv->cur_filer_idx] = local_rqfcr[k]; | 756 | priv->ftp_rqfcr[priv->cur_filer_idx] = local_rqfcr[k]; |
755 | gfar_write_filer(priv, priv->cur_filer_idx, | 757 | gfar_write_filer(priv, priv->cur_filer_idx, |
756 | local_rqfcr[k], local_rqfpr[k]); | 758 | local_rqfcr[k], local_rqfpr[k]); |
757 | if (!priv->cur_filer_idx) | 759 | if (!priv->cur_filer_idx) |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 992089639ea4..3e5d0b6b6516 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -456,7 +456,7 @@ out: | |||
456 | * a block of 6pack data has been received, which can now be decapsulated | 456 | * a block of 6pack data has been received, which can now be decapsulated |
457 | * and sent on to some IP layer for further processing. | 457 | * and sent on to some IP layer for further processing. |
458 | */ | 458 | */ |
459 | static unsigned int sixpack_receive_buf(struct tty_struct *tty, | 459 | static void sixpack_receive_buf(struct tty_struct *tty, |
460 | const unsigned char *cp, char *fp, int count) | 460 | const unsigned char *cp, char *fp, int count) |
461 | { | 461 | { |
462 | struct sixpack *sp; | 462 | struct sixpack *sp; |
@@ -464,11 +464,11 @@ static unsigned int sixpack_receive_buf(struct tty_struct *tty, | |||
464 | int count1; | 464 | int count1; |
465 | 465 | ||
466 | if (!count) | 466 | if (!count) |
467 | return 0; | 467 | return; |
468 | 468 | ||
469 | sp = sp_get(tty); | 469 | sp = sp_get(tty); |
470 | if (!sp) | 470 | if (!sp) |
471 | return -ENODEV; | 471 | return; |
472 | 472 | ||
473 | memcpy(buf, cp, count < sizeof(buf) ? count : sizeof(buf)); | 473 | memcpy(buf, cp, count < sizeof(buf) ? count : sizeof(buf)); |
474 | 474 | ||
@@ -487,8 +487,6 @@ static unsigned int sixpack_receive_buf(struct tty_struct *tty, | |||
487 | 487 | ||
488 | sp_put(sp); | 488 | sp_put(sp); |
489 | tty_unthrottle(tty); | 489 | tty_unthrottle(tty); |
490 | |||
491 | return count1; | ||
492 | } | 490 | } |
493 | 491 | ||
494 | /* | 492 | /* |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 0e4f23531140..4c628393c8b1 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -923,14 +923,13 @@ static long mkiss_compat_ioctl(struct tty_struct *tty, struct file *file, | |||
923 | * a block of data has been received, which can now be decapsulated | 923 | * a block of data has been received, which can now be decapsulated |
924 | * and sent on to the AX.25 layer for further processing. | 924 | * and sent on to the AX.25 layer for further processing. |
925 | */ | 925 | */ |
926 | static unsigned int mkiss_receive_buf(struct tty_struct *tty, | 926 | static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
927 | const unsigned char *cp, char *fp, int count) | 927 | char *fp, int count) |
928 | { | 928 | { |
929 | struct mkiss *ax = mkiss_get(tty); | 929 | struct mkiss *ax = mkiss_get(tty); |
930 | int bytes = count; | ||
931 | 930 | ||
932 | if (!ax) | 931 | if (!ax) |
933 | return -ENODEV; | 932 | return; |
934 | 933 | ||
935 | /* | 934 | /* |
936 | * Argh! mtu change time! - costs us the packet part received | 935 | * Argh! mtu change time! - costs us the packet part received |
@@ -940,7 +939,7 @@ static unsigned int mkiss_receive_buf(struct tty_struct *tty, | |||
940 | ax_changedmtu(ax); | 939 | ax_changedmtu(ax); |
941 | 940 | ||
942 | /* Read the characters out of the buffer */ | 941 | /* Read the characters out of the buffer */ |
943 | while (bytes--) { | 942 | while (count--) { |
944 | if (fp != NULL && *fp++) { | 943 | if (fp != NULL && *fp++) { |
945 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) | 944 | if (!test_and_set_bit(AXF_ERROR, &ax->flags)) |
946 | ax->dev->stats.rx_errors++; | 945 | ax->dev->stats.rx_errors++; |
@@ -953,8 +952,6 @@ static unsigned int mkiss_receive_buf(struct tty_struct *tty, | |||
953 | 952 | ||
954 | mkiss_put(ax); | 953 | mkiss_put(ax); |
955 | tty_unthrottle(tty); | 954 | tty_unthrottle(tty); |
956 | |||
957 | return count; | ||
958 | } | 955 | } |
959 | 956 | ||
960 | /* | 957 | /* |
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index c52a1df5d922..c3ecb118c1df 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c | |||
@@ -188,14 +188,14 @@ struct hp100_private { | |||
188 | * variables | 188 | * variables |
189 | */ | 189 | */ |
190 | #ifdef CONFIG_ISA | 190 | #ifdef CONFIG_ISA |
191 | static const char *const hp100_isa_tbl[] __devinitconst = { | 191 | static const char *hp100_isa_tbl[] = { |
192 | "HWPF150", /* HP J2573 rev A */ | 192 | "HWPF150", /* HP J2573 rev A */ |
193 | "HWP1950", /* HP J2573 */ | 193 | "HWP1950", /* HP J2573 */ |
194 | }; | 194 | }; |
195 | #endif | 195 | #endif |
196 | 196 | ||
197 | #ifdef CONFIG_EISA | 197 | #ifdef CONFIG_EISA |
198 | static const struct eisa_device_id hp100_eisa_tbl[] __devinitconst = { | 198 | static struct eisa_device_id hp100_eisa_tbl[] = { |
199 | { "HWPF180" }, /* HP J2577 rev A */ | 199 | { "HWPF180" }, /* HP J2577 rev A */ |
200 | { "HWP1920" }, /* HP 27248B */ | 200 | { "HWP1920" }, /* HP 27248B */ |
201 | { "HWP1940" }, /* HP J2577 */ | 201 | { "HWP1940" }, /* HP J2577 */ |
@@ -336,7 +336,7 @@ static __devinit const char *hp100_read_id(int ioaddr) | |||
336 | } | 336 | } |
337 | 337 | ||
338 | #ifdef CONFIG_ISA | 338 | #ifdef CONFIG_ISA |
339 | static __devinit int hp100_isa_probe1(struct net_device *dev, int ioaddr) | 339 | static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr) |
340 | { | 340 | { |
341 | const char *sig; | 341 | const char *sig; |
342 | int i; | 342 | int i; |
@@ -372,7 +372,7 @@ static __devinit int hp100_isa_probe1(struct net_device *dev, int ioaddr) | |||
372 | * EISA and PCI are handled by device infrastructure. | 372 | * EISA and PCI are handled by device infrastructure. |
373 | */ | 373 | */ |
374 | 374 | ||
375 | static int __devinit hp100_isa_probe(struct net_device *dev, int addr) | 375 | static int __init hp100_isa_probe(struct net_device *dev, int addr) |
376 | { | 376 | { |
377 | int err = -ENODEV; | 377 | int err = -ENODEV; |
378 | 378 | ||
@@ -396,7 +396,7 @@ static int __devinit hp100_isa_probe(struct net_device *dev, int addr) | |||
396 | #endif /* CONFIG_ISA */ | 396 | #endif /* CONFIG_ISA */ |
397 | 397 | ||
398 | #if !defined(MODULE) && defined(CONFIG_ISA) | 398 | #if !defined(MODULE) && defined(CONFIG_ISA) |
399 | struct net_device * __devinit hp100_probe(int unit) | 399 | struct net_device * __init hp100_probe(int unit) |
400 | { | 400 | { |
401 | struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); | 401 | struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); |
402 | int err; | 402 | int err; |
@@ -1580,12 +1580,12 @@ static netdev_tx_t hp100_start_xmit_bm(struct sk_buff *skb, | |||
1580 | hp100_outl(ringptr->pdl_paddr, TX_PDA_L); /* Low Prio. Queue */ | 1580 | hp100_outl(ringptr->pdl_paddr, TX_PDA_L); /* Low Prio. Queue */ |
1581 | 1581 | ||
1582 | lp->txrcommit++; | 1582 | lp->txrcommit++; |
1583 | spin_unlock_irqrestore(&lp->lock, flags); | ||
1584 | 1583 | ||
1585 | /* Update statistics */ | ||
1586 | dev->stats.tx_packets++; | 1584 | dev->stats.tx_packets++; |
1587 | dev->stats.tx_bytes += skb->len; | 1585 | dev->stats.tx_bytes += skb->len; |
1588 | 1586 | ||
1587 | spin_unlock_irqrestore(&lp->lock, flags); | ||
1588 | |||
1589 | return NETDEV_TX_OK; | 1589 | return NETDEV_TX_OK; |
1590 | 1590 | ||
1591 | drop: | 1591 | drop: |
@@ -2843,7 +2843,7 @@ static void cleanup_dev(struct net_device *d) | |||
2843 | } | 2843 | } |
2844 | 2844 | ||
2845 | #ifdef CONFIG_EISA | 2845 | #ifdef CONFIG_EISA |
2846 | static int __devinit hp100_eisa_probe (struct device *gendev) | 2846 | static int __init hp100_eisa_probe (struct device *gendev) |
2847 | { | 2847 | { |
2848 | struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); | 2848 | struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private)); |
2849 | struct eisa_device *edev = to_eisa_device(gendev); | 2849 | struct eisa_device *edev = to_eisa_device(gendev); |
diff --git a/drivers/net/hplance.c b/drivers/net/hplance.c index b6060f7538df..a900d5bf2948 100644 --- a/drivers/net/hplance.c +++ b/drivers/net/hplance.c | |||
@@ -135,7 +135,7 @@ static void __devexit hplance_remove_one(struct dio_dev *d) | |||
135 | } | 135 | } |
136 | 136 | ||
137 | /* Initialise a single lance board at the given DIO device */ | 137 | /* Initialise a single lance board at the given DIO device */ |
138 | static void __init hplance_init(struct net_device *dev, struct dio_dev *d) | 138 | static void __devinit hplance_init(struct net_device *dev, struct dio_dev *d) |
139 | { | 139 | { |
140 | unsigned long va = (d->resource.start + DIO_VIRADDRBASE); | 140 | unsigned long va = (d->resource.start + DIO_VIRADDRBASE); |
141 | struct hplance_private *lp; | 141 | struct hplance_private *lp; |
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 136d7544cc33..a7d6cad32953 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
@@ -895,12 +895,12 @@ static int ibmlana_irq; | |||
895 | static int ibmlana_io; | 895 | static int ibmlana_io; |
896 | static int startslot; /* counts through slots when probing multiple devices */ | 896 | static int startslot; /* counts through slots when probing multiple devices */ |
897 | 897 | ||
898 | static const short ibmlana_adapter_ids[] __devinitconst = { | 898 | static short ibmlana_adapter_ids[] __initdata = { |
899 | IBM_LANA_ID, | 899 | IBM_LANA_ID, |
900 | 0x0000 | 900 | 0x0000 |
901 | }; | 901 | }; |
902 | 902 | ||
903 | static const char *const ibmlana_adapter_names[] __devinitconst = { | 903 | static char *ibmlana_adapter_names[] __devinitdata = { |
904 | "IBM LAN Adapter/A", | 904 | "IBM LAN Adapter/A", |
905 | NULL | 905 | NULL |
906 | }; | 906 | }; |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 18fccf913635..2c28621eb30b 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -2373,6 +2373,9 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter) | |||
2373 | } | 2373 | } |
2374 | #endif /* CONFIG_PCI_IOV */ | 2374 | #endif /* CONFIG_PCI_IOV */ |
2375 | adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus()); | 2375 | adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus()); |
2376 | /* i350 cannot do RSS and SR-IOV at the same time */ | ||
2377 | if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count) | ||
2378 | adapter->rss_queues = 1; | ||
2376 | 2379 | ||
2377 | /* | 2380 | /* |
2378 | * if rss_queues > 4 or vfs are going to be allocated with rss_queues | 2381 | * if rss_queues > 4 or vfs are going to be allocated with rss_queues |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index 035861d8acb1..3352b2443e58 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -216,23 +216,23 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t | |||
216 | * usbserial: urb-complete-interrupt / softint | 216 | * usbserial: urb-complete-interrupt / softint |
217 | */ | 217 | */ |
218 | 218 | ||
219 | static unsigned int irtty_receive_buf(struct tty_struct *tty, | 219 | static void irtty_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
220 | const unsigned char *cp, char *fp, int count) | 220 | char *fp, int count) |
221 | { | 221 | { |
222 | struct sir_dev *dev; | 222 | struct sir_dev *dev; |
223 | struct sirtty_cb *priv = tty->disc_data; | 223 | struct sirtty_cb *priv = tty->disc_data; |
224 | int i; | 224 | int i; |
225 | 225 | ||
226 | IRDA_ASSERT(priv != NULL, return -ENODEV;); | 226 | IRDA_ASSERT(priv != NULL, return;); |
227 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -EINVAL;); | 227 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;); |
228 | 228 | ||
229 | if (unlikely(count==0)) /* yes, this happens */ | 229 | if (unlikely(count==0)) /* yes, this happens */ |
230 | return 0; | 230 | return; |
231 | 231 | ||
232 | dev = priv->dev; | 232 | dev = priv->dev; |
233 | if (!dev) { | 233 | if (!dev) { |
234 | IRDA_WARNING("%s(), not ready yet!\n", __func__); | 234 | IRDA_WARNING("%s(), not ready yet!\n", __func__); |
235 | return -ENODEV; | 235 | return; |
236 | } | 236 | } |
237 | 237 | ||
238 | for (i = 0; i < count; i++) { | 238 | for (i = 0; i < count; i++) { |
@@ -242,13 +242,11 @@ static unsigned int irtty_receive_buf(struct tty_struct *tty, | |||
242 | if (fp && *fp++) { | 242 | if (fp && *fp++) { |
243 | IRDA_DEBUG(0, "Framing or parity error!\n"); | 243 | IRDA_DEBUG(0, "Framing or parity error!\n"); |
244 | sirdev_receive(dev, NULL, 0); /* notify sir_dev (updating stats) */ | 244 | sirdev_receive(dev, NULL, 0); /* notify sir_dev (updating stats) */ |
245 | return -EINVAL; | 245 | return; |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | sirdev_receive(dev, cp, count); | 249 | sirdev_receive(dev, cp, count); |
250 | |||
251 | return count; | ||
252 | } | 250 | } |
253 | 251 | ||
254 | /* | 252 | /* |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 69b5707db369..8800e1fe4129 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -222,19 +222,19 @@ static void smsc_ircc_set_transceiver_for_speed(struct smsc_ircc_cb *self, u32 s | |||
222 | static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self); | 222 | static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self); |
223 | 223 | ||
224 | /* Probing */ | 224 | /* Probing */ |
225 | static int smsc_ircc_look_for_chips(void); | 225 | static int __init smsc_ircc_look_for_chips(void); |
226 | static const struct smsc_chip * smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type); | 226 | static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type); |
227 | static int smsc_superio_flat(const struct smsc_chip *chips, unsigned short cfg_base, char *type); | 227 | static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned short cfg_base, char *type); |
228 | static int smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type); | 228 | static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned short cfg_base, char *type); |
229 | static int smsc_superio_fdc(unsigned short cfg_base); | 229 | static int __init smsc_superio_fdc(unsigned short cfg_base); |
230 | static int smsc_superio_lpc(unsigned short cfg_base); | 230 | static int __init smsc_superio_lpc(unsigned short cfg_base); |
231 | #ifdef CONFIG_PCI | 231 | #ifdef CONFIG_PCI |
232 | static int preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf); | 232 | static int __init preconfigure_smsc_chip(struct smsc_ircc_subsystem_configuration *conf); |
233 | static int preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); | 233 | static int __init preconfigure_through_82801(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); |
234 | static void preconfigure_ali_port(struct pci_dev *dev, | 234 | static void __init preconfigure_ali_port(struct pci_dev *dev, |
235 | unsigned short port); | 235 | unsigned short port); |
236 | static int preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); | 236 | static int __init preconfigure_through_ali(struct pci_dev *dev, struct smsc_ircc_subsystem_configuration *conf); |
237 | static int smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, | 237 | static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, |
238 | unsigned short ircc_fir, | 238 | unsigned short ircc_fir, |
239 | unsigned short ircc_sir, | 239 | unsigned short ircc_sir, |
240 | unsigned char ircc_dma, | 240 | unsigned char ircc_dma, |
@@ -366,7 +366,7 @@ static inline void register_bank(int iobase, int bank) | |||
366 | } | 366 | } |
367 | 367 | ||
368 | /* PNP hotplug support */ | 368 | /* PNP hotplug support */ |
369 | static const struct pnp_device_id smsc_ircc_pnp_table[] __devinitconst = { | 369 | static const struct pnp_device_id smsc_ircc_pnp_table[] = { |
370 | { .id = "SMCf010", .driver_data = 0 }, | 370 | { .id = "SMCf010", .driver_data = 0 }, |
371 | /* and presumably others */ | 371 | /* and presumably others */ |
372 | { } | 372 | { } |
@@ -515,7 +515,7 @@ static const struct net_device_ops smsc_ircc_netdev_ops = { | |||
515 | * Try to open driver instance | 515 | * Try to open driver instance |
516 | * | 516 | * |
517 | */ | 517 | */ |
518 | static int __devinit smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u8 dma, u8 irq) | 518 | static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u8 dma, u8 irq) |
519 | { | 519 | { |
520 | struct smsc_ircc_cb *self; | 520 | struct smsc_ircc_cb *self; |
521 | struct net_device *dev; | 521 | struct net_device *dev; |
@@ -2273,7 +2273,7 @@ static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned sho | |||
2273 | } | 2273 | } |
2274 | 2274 | ||
2275 | 2275 | ||
2276 | static int __devinit smsc_access(unsigned short cfg_base, unsigned char reg) | 2276 | static int __init smsc_access(unsigned short cfg_base, unsigned char reg) |
2277 | { | 2277 | { |
2278 | IRDA_DEBUG(1, "%s\n", __func__); | 2278 | IRDA_DEBUG(1, "%s\n", __func__); |
2279 | 2279 | ||
@@ -2281,7 +2281,7 @@ static int __devinit smsc_access(unsigned short cfg_base, unsigned char reg) | |||
2281 | return inb(cfg_base) != reg ? -1 : 0; | 2281 | return inb(cfg_base) != reg ? -1 : 0; |
2282 | } | 2282 | } |
2283 | 2283 | ||
2284 | static const struct smsc_chip * __devinit smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type) | 2284 | static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base, u8 reg, const struct smsc_chip *chip, char *type) |
2285 | { | 2285 | { |
2286 | u8 devid, xdevid, rev; | 2286 | u8 devid, xdevid, rev; |
2287 | 2287 | ||
@@ -2406,7 +2406,7 @@ static int __init smsc_superio_lpc(unsigned short cfg_base) | |||
2406 | #ifdef CONFIG_PCI | 2406 | #ifdef CONFIG_PCI |
2407 | #define PCIID_VENDOR_INTEL 0x8086 | 2407 | #define PCIID_VENDOR_INTEL 0x8086 |
2408 | #define PCIID_VENDOR_ALI 0x10b9 | 2408 | #define PCIID_VENDOR_ALI 0x10b9 |
2409 | static const struct smsc_ircc_subsystem_configuration subsystem_configurations[] __devinitconst = { | 2409 | static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = { |
2410 | /* | 2410 | /* |
2411 | * Subsystems needing entries: | 2411 | * Subsystems needing entries: |
2412 | * 0x10b9:0x1533 0x103c:0x0850 HP nx9010 family | 2412 | * 0x10b9:0x1533 0x103c:0x0850 HP nx9010 family |
@@ -2532,7 +2532,7 @@ static const struct smsc_ircc_subsystem_configuration subsystem_configurations[] | |||
2532 | * (FIR port, SIR port, FIR DMA, FIR IRQ) | 2532 | * (FIR port, SIR port, FIR DMA, FIR IRQ) |
2533 | * through the chip configuration port. | 2533 | * through the chip configuration port. |
2534 | */ | 2534 | */ |
2535 | static int __devinit preconfigure_smsc_chip(struct | 2535 | static int __init preconfigure_smsc_chip(struct |
2536 | smsc_ircc_subsystem_configuration | 2536 | smsc_ircc_subsystem_configuration |
2537 | *conf) | 2537 | *conf) |
2538 | { | 2538 | { |
@@ -2633,7 +2633,7 @@ static int __devinit preconfigure_smsc_chip(struct | |||
2633 | * or Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge. | 2633 | * or Intel 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge. |
2634 | * They all work the same way! | 2634 | * They all work the same way! |
2635 | */ | 2635 | */ |
2636 | static int __devinit preconfigure_through_82801(struct pci_dev *dev, | 2636 | static int __init preconfigure_through_82801(struct pci_dev *dev, |
2637 | struct | 2637 | struct |
2638 | smsc_ircc_subsystem_configuration | 2638 | smsc_ircc_subsystem_configuration |
2639 | *conf) | 2639 | *conf) |
@@ -2786,7 +2786,7 @@ static int __devinit preconfigure_through_82801(struct pci_dev *dev, | |||
2786 | * This is based on reverse-engineering since ALi does not | 2786 | * This is based on reverse-engineering since ALi does not |
2787 | * provide any data sheet for the 1533 chip. | 2787 | * provide any data sheet for the 1533 chip. |
2788 | */ | 2788 | */ |
2789 | static void __devinit preconfigure_ali_port(struct pci_dev *dev, | 2789 | static void __init preconfigure_ali_port(struct pci_dev *dev, |
2790 | unsigned short port) | 2790 | unsigned short port) |
2791 | { | 2791 | { |
2792 | unsigned char reg; | 2792 | unsigned char reg; |
@@ -2824,7 +2824,7 @@ static void __devinit preconfigure_ali_port(struct pci_dev *dev, | |||
2824 | IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port); | 2824 | IRDA_MESSAGE("Activated ALi 1533 ISA bridge port 0x%04x.\n", port); |
2825 | } | 2825 | } |
2826 | 2826 | ||
2827 | static int __devinit preconfigure_through_ali(struct pci_dev *dev, | 2827 | static int __init preconfigure_through_ali(struct pci_dev *dev, |
2828 | struct | 2828 | struct |
2829 | smsc_ircc_subsystem_configuration | 2829 | smsc_ircc_subsystem_configuration |
2830 | *conf) | 2830 | *conf) |
@@ -2837,7 +2837,7 @@ static int __devinit preconfigure_through_ali(struct pci_dev *dev, | |||
2837 | return preconfigure_smsc_chip(conf); | 2837 | return preconfigure_smsc_chip(conf); |
2838 | } | 2838 | } |
2839 | 2839 | ||
2840 | static int __devinit smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, | 2840 | static int __init smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, |
2841 | unsigned short ircc_fir, | 2841 | unsigned short ircc_fir, |
2842 | unsigned short ircc_sir, | 2842 | unsigned short ircc_sir, |
2843 | unsigned char ircc_dma, | 2843 | unsigned char ircc_dma, |
@@ -2849,7 +2849,7 @@ static int __devinit smsc_ircc_preconfigure_subsystems(unsigned short ircc_cfg, | |||
2849 | int ret = 0; | 2849 | int ret = 0; |
2850 | 2850 | ||
2851 | for_each_pci_dev(dev) { | 2851 | for_each_pci_dev(dev) { |
2852 | const struct smsc_ircc_subsystem_configuration *conf; | 2852 | struct smsc_ircc_subsystem_configuration *conf; |
2853 | 2853 | ||
2854 | /* | 2854 | /* |
2855 | * Cache the subsystem vendor/device: | 2855 | * Cache the subsystem vendor/device: |
diff --git a/drivers/net/ks8842.c b/drivers/net/ks8842.c index 4d40626b3bfa..fc12ac0d9f2e 100644 --- a/drivers/net/ks8842.c +++ b/drivers/net/ks8842.c | |||
@@ -661,7 +661,7 @@ static void ks8842_rx_frame(struct net_device *netdev, | |||
661 | 661 | ||
662 | /* check the status */ | 662 | /* check the status */ |
663 | if ((status & RXSR_VALID) && !(status & RXSR_ERROR)) { | 663 | if ((status & RXSR_VALID) && !(status & RXSR_ERROR)) { |
664 | struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len); | 664 | struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len + 3); |
665 | 665 | ||
666 | if (skb) { | 666 | if (skb) { |
667 | 667 | ||
diff --git a/drivers/net/ne3210.c b/drivers/net/ne3210.c index e8984b0ca521..243ed2aee88e 100644 --- a/drivers/net/ne3210.c +++ b/drivers/net/ne3210.c | |||
@@ -80,20 +80,17 @@ static void ne3210_block_output(struct net_device *dev, int count, const unsigne | |||
80 | 80 | ||
81 | #define NE3210_DEBUG 0x0 | 81 | #define NE3210_DEBUG 0x0 |
82 | 82 | ||
83 | static const unsigned char irq_map[] __devinitconst = | 83 | static unsigned char irq_map[] __initdata = {15, 12, 11, 10, 9, 7, 5, 3}; |
84 | { 15, 12, 11, 10, 9, 7, 5, 3 }; | 84 | static unsigned int shmem_map[] __initdata = {0xff0, 0xfe0, 0xfff0, 0xd8, 0xffe0, 0xffc0, 0xd0, 0x0}; |
85 | static const unsigned int shmem_map[] __devinitconst = | 85 | static const char *ifmap[] __initdata = {"UTP", "?", "BNC", "AUI"}; |
86 | { 0xff0, 0xfe0, 0xfff0, 0xd8, 0xffe0, 0xffc0, 0xd0, 0x0 }; | 86 | static int ifmap_val[] __initdata = { |
87 | static const char *const ifmap[] __devinitconst = | ||
88 | { "UTP", "?", "BNC", "AUI" }; | ||
89 | static const int ifmap_val[] __devinitconst = { | ||
90 | IF_PORT_10BASET, | 87 | IF_PORT_10BASET, |
91 | IF_PORT_UNKNOWN, | 88 | IF_PORT_UNKNOWN, |
92 | IF_PORT_10BASE2, | 89 | IF_PORT_10BASE2, |
93 | IF_PORT_AUI, | 90 | IF_PORT_AUI, |
94 | }; | 91 | }; |
95 | 92 | ||
96 | static int __devinit ne3210_eisa_probe (struct device *device) | 93 | static int __init ne3210_eisa_probe (struct device *device) |
97 | { | 94 | { |
98 | unsigned long ioaddr, phys_mem; | 95 | unsigned long ioaddr, phys_mem; |
99 | int i, retval, port_index; | 96 | int i, retval, port_index; |
@@ -316,7 +313,7 @@ static void ne3210_block_output(struct net_device *dev, int count, | |||
316 | memcpy_toio(shmem, buf, count); | 313 | memcpy_toio(shmem, buf, count); |
317 | } | 314 | } |
318 | 315 | ||
319 | static const struct eisa_device_id ne3210_ids[] __devinitconst = { | 316 | static struct eisa_device_id ne3210_ids[] = { |
320 | { "EGL0101" }, | 317 | { "EGL0101" }, |
321 | { "NVL1801" }, | 318 | { "NVL1801" }, |
322 | { "" }, | 319 | { "" }, |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index b644383017f9..c0788a31ff0f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -1965,11 +1965,11 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1965 | 1965 | ||
1966 | netxen_tso_check(netdev, tx_ring, first_desc, skb); | 1966 | netxen_tso_check(netdev, tx_ring, first_desc, skb); |
1967 | 1967 | ||
1968 | netxen_nic_update_cmd_producer(adapter, tx_ring); | ||
1969 | |||
1970 | adapter->stats.txbytes += skb->len; | 1968 | adapter->stats.txbytes += skb->len; |
1971 | adapter->stats.xmitcalled++; | 1969 | adapter->stats.xmitcalled++; |
1972 | 1970 | ||
1971 | netxen_nic_update_cmd_producer(adapter, tx_ring); | ||
1972 | |||
1973 | return NETDEV_TX_OK; | 1973 | return NETDEV_TX_OK; |
1974 | 1974 | ||
1975 | drop_packet: | 1975 | drop_packet: |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 392a6c4b72e5..a70244306c94 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -58,6 +58,7 @@ config BROADCOM_PHY | |||
58 | 58 | ||
59 | config BCM63XX_PHY | 59 | config BCM63XX_PHY |
60 | tristate "Drivers for Broadcom 63xx SOCs internal PHY" | 60 | tristate "Drivers for Broadcom 63xx SOCs internal PHY" |
61 | depends on BCM63XX | ||
61 | ---help--- | 62 | ---help--- |
62 | Currently supports the 6348 and 6358 PHYs. | 63 | Currently supports the 6348 and 6358 PHYs. |
63 | 64 | ||
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index b0c9522bb535..2cd8dc5847b4 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -543,11 +543,20 @@ static void recalibrate(struct dp83640_clock *clock) | |||
543 | 543 | ||
544 | /* time stamping methods */ | 544 | /* time stamping methods */ |
545 | 545 | ||
546 | static void decode_evnt(struct dp83640_private *dp83640, | 546 | static int decode_evnt(struct dp83640_private *dp83640, |
547 | struct phy_txts *phy_txts, u16 ests) | 547 | void *data, u16 ests) |
548 | { | 548 | { |
549 | struct phy_txts *phy_txts; | ||
549 | struct ptp_clock_event event; | 550 | struct ptp_clock_event event; |
550 | int words = (ests >> EVNT_TS_LEN_SHIFT) & EVNT_TS_LEN_MASK; | 551 | int words = (ests >> EVNT_TS_LEN_SHIFT) & EVNT_TS_LEN_MASK; |
552 | u16 ext_status = 0; | ||
553 | |||
554 | if (ests & MULT_EVNT) { | ||
555 | ext_status = *(u16 *) data; | ||
556 | data += sizeof(ext_status); | ||
557 | } | ||
558 | |||
559 | phy_txts = data; | ||
551 | 560 | ||
552 | switch (words) { /* fall through in every case */ | 561 | switch (words) { /* fall through in every case */ |
553 | case 3: | 562 | case 3: |
@@ -565,6 +574,9 @@ static void decode_evnt(struct dp83640_private *dp83640, | |||
565 | event.timestamp = phy2txts(&dp83640->edata); | 574 | event.timestamp = phy2txts(&dp83640->edata); |
566 | 575 | ||
567 | ptp_clock_event(dp83640->clock->ptp_clock, &event); | 576 | ptp_clock_event(dp83640->clock->ptp_clock, &event); |
577 | |||
578 | words = ext_status ? words + 2 : words + 1; | ||
579 | return words * sizeof(u16); | ||
568 | } | 580 | } |
569 | 581 | ||
570 | static void decode_rxts(struct dp83640_private *dp83640, | 582 | static void decode_rxts(struct dp83640_private *dp83640, |
@@ -643,9 +655,7 @@ static void decode_status_frame(struct dp83640_private *dp83640, | |||
643 | 655 | ||
644 | } else if (PSF_EVNT == type && len >= sizeof(*phy_txts)) { | 656 | } else if (PSF_EVNT == type && len >= sizeof(*phy_txts)) { |
645 | 657 | ||
646 | phy_txts = (struct phy_txts *) ptr; | 658 | size = decode_evnt(dp83640, ptr, ests); |
647 | decode_evnt(dp83640, phy_txts, ests); | ||
648 | size = sizeof(*phy_txts); | ||
649 | 659 | ||
650 | } else { | 660 | } else { |
651 | size = 0; | 661 | size = 0; |
@@ -1034,8 +1044,8 @@ static bool dp83640_rxtstamp(struct phy_device *phydev, | |||
1034 | 1044 | ||
1035 | if (is_status_frame(skb, type)) { | 1045 | if (is_status_frame(skb, type)) { |
1036 | decode_status_frame(dp83640, skb); | 1046 | decode_status_frame(dp83640, skb); |
1037 | /* Let the stack drop this frame. */ | 1047 | kfree_skb(skb); |
1038 | return false; | 1048 | return true; |
1039 | } | 1049 | } |
1040 | 1050 | ||
1041 | SKB_PTP_TYPE(skb) = type; | 1051 | SKB_PTP_TYPE(skb) = type; |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 53872d7d7382..c554a397e558 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -340,7 +340,7 @@ ppp_asynctty_poll(struct tty_struct *tty, struct file *file, poll_table *wait) | |||
340 | } | 340 | } |
341 | 341 | ||
342 | /* May sleep, don't call from interrupt level or with interrupts disabled */ | 342 | /* May sleep, don't call from interrupt level or with interrupts disabled */ |
343 | static unsigned int | 343 | static void |
344 | ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | 344 | ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, |
345 | char *cflags, int count) | 345 | char *cflags, int count) |
346 | { | 346 | { |
@@ -348,7 +348,7 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
348 | unsigned long flags; | 348 | unsigned long flags; |
349 | 349 | ||
350 | if (!ap) | 350 | if (!ap) |
351 | return -ENODEV; | 351 | return; |
352 | spin_lock_irqsave(&ap->recv_lock, flags); | 352 | spin_lock_irqsave(&ap->recv_lock, flags); |
353 | ppp_async_input(ap, buf, cflags, count); | 353 | ppp_async_input(ap, buf, cflags, count); |
354 | spin_unlock_irqrestore(&ap->recv_lock, flags); | 354 | spin_unlock_irqrestore(&ap->recv_lock, flags); |
@@ -356,8 +356,6 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
356 | tasklet_schedule(&ap->tsk); | 356 | tasklet_schedule(&ap->tsk); |
357 | ap_put(ap); | 357 | ap_put(ap); |
358 | tty_unthrottle(tty); | 358 | tty_unthrottle(tty); |
359 | |||
360 | return count; | ||
361 | } | 359 | } |
362 | 360 | ||
363 | static void | 361 | static void |
@@ -525,7 +523,7 @@ static void ppp_async_process(unsigned long arg) | |||
525 | #define PUT_BYTE(ap, buf, c, islcp) do { \ | 523 | #define PUT_BYTE(ap, buf, c, islcp) do { \ |
526 | if ((islcp && c < 0x20) || (ap->xaccm[c >> 5] & (1 << (c & 0x1f)))) {\ | 524 | if ((islcp && c < 0x20) || (ap->xaccm[c >> 5] & (1 << (c & 0x1f)))) {\ |
527 | *buf++ = PPP_ESCAPE; \ | 525 | *buf++ = PPP_ESCAPE; \ |
528 | *buf++ = c ^ 0x20; \ | 526 | *buf++ = c ^ PPP_TRANS; \ |
529 | } else \ | 527 | } else \ |
530 | *buf++ = c; \ | 528 | *buf++ = c; \ |
531 | } while (0) | 529 | } while (0) |
@@ -898,7 +896,7 @@ ppp_async_input(struct asyncppp *ap, const unsigned char *buf, | |||
898 | sp = skb_put(skb, n); | 896 | sp = skb_put(skb, n); |
899 | memcpy(sp, buf, n); | 897 | memcpy(sp, buf, n); |
900 | if (ap->state & SC_ESCAPE) { | 898 | if (ap->state & SC_ESCAPE) { |
901 | sp[0] ^= 0x20; | 899 | sp[0] ^= PPP_TRANS; |
902 | ap->state &= ~SC_ESCAPE; | 900 | ap->state &= ~SC_ESCAPE; |
903 | } | 901 | } |
904 | } | 902 | } |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 0815790a5cf9..2573f525f11c 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -381,7 +381,7 @@ ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait) | |||
381 | } | 381 | } |
382 | 382 | ||
383 | /* May sleep, don't call from interrupt level or with interrupts disabled */ | 383 | /* May sleep, don't call from interrupt level or with interrupts disabled */ |
384 | static unsigned int | 384 | static void |
385 | ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | 385 | ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, |
386 | char *cflags, int count) | 386 | char *cflags, int count) |
387 | { | 387 | { |
@@ -389,7 +389,7 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
389 | unsigned long flags; | 389 | unsigned long flags; |
390 | 390 | ||
391 | if (!ap) | 391 | if (!ap) |
392 | return -ENODEV; | 392 | return; |
393 | spin_lock_irqsave(&ap->recv_lock, flags); | 393 | spin_lock_irqsave(&ap->recv_lock, flags); |
394 | ppp_sync_input(ap, buf, cflags, count); | 394 | ppp_sync_input(ap, buf, cflags, count); |
395 | spin_unlock_irqrestore(&ap->recv_lock, flags); | 395 | spin_unlock_irqrestore(&ap->recv_lock, flags); |
@@ -397,8 +397,6 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
397 | tasklet_schedule(&ap->tsk); | 397 | tasklet_schedule(&ap->tsk); |
398 | sp_put(ap); | 398 | sp_put(ap); |
399 | tty_unthrottle(tty); | 399 | tty_unthrottle(tty); |
400 | |||
401 | return count; | ||
402 | } | 400 | } |
403 | 401 | ||
404 | static void | 402 | static void |
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c index 89f7540d90f9..5f597ca592bb 100644 --- a/drivers/net/pxa168_eth.c +++ b/drivers/net/pxa168_eth.c | |||
@@ -1273,7 +1273,7 @@ static int pxa168_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1273 | wmb(); | 1273 | wmb(); |
1274 | wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD); | 1274 | wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD); |
1275 | 1275 | ||
1276 | stats->tx_bytes += skb->len; | 1276 | stats->tx_bytes += length; |
1277 | stats->tx_packets++; | 1277 | stats->tx_packets++; |
1278 | dev->trans_start = jiffies; | 1278 | dev->trans_start = jiffies; |
1279 | if (pep->tx_ring_size - pep->tx_desc_count <= 1) { | 1279 | if (pep->tx_ring_size - pep->tx_desc_count <= 1) { |
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c index e9656616f2a2..a5d9fbf9d816 100644 --- a/drivers/net/qlcnic/qlcnic_hw.c +++ b/drivers/net/qlcnic/qlcnic_hw.c | |||
@@ -1406,6 +1406,7 @@ qlcnic_dump_que(struct qlcnic_adapter *adapter, struct qlcnic_dump_entry *entry, | |||
1406 | 1406 | ||
1407 | for (loop = 0; loop < que->no_ops; loop++) { | 1407 | for (loop = 0; loop < que->no_ops; loop++) { |
1408 | QLCNIC_WR_DUMP_REG(que->sel_addr, base, que_id); | 1408 | QLCNIC_WR_DUMP_REG(que->sel_addr, base, que_id); |
1409 | addr = que->read_addr; | ||
1409 | for (i = 0; i < cnt; i++) { | 1410 | for (i = 0; i < cnt; i++) { |
1410 | QLCNIC_RD_DUMP_REG(addr, base, &data); | 1411 | QLCNIC_RD_DUMP_REG(addr, base, &data); |
1411 | *buffer++ = cpu_to_le32(data); | 1412 | *buffer++ = cpu_to_le32(data); |
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 3ab7d2c7baf2..0f6af5c61a7c 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -2159,6 +2159,7 @@ qlcnic_unmap_buffers(struct pci_dev *pdev, struct sk_buff *skb, | |||
2159 | 2159 | ||
2160 | nf = &pbuf->frag_array[0]; | 2160 | nf = &pbuf->frag_array[0]; |
2161 | pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); | 2161 | pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); |
2162 | pbuf->skb = NULL; | ||
2162 | } | 2163 | } |
2163 | 2164 | ||
2164 | static inline void | 2165 | static inline void |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index ef1ce2ebeb4a..05d81780d1fd 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1621,7 +1621,7 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp, | |||
1621 | * | 1621 | * |
1622 | * (RTL_R32(TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec | 1622 | * (RTL_R32(TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec |
1623 | */ | 1623 | */ |
1624 | static const struct { | 1624 | static const struct rtl_mac_info { |
1625 | u32 mask; | 1625 | u32 mask; |
1626 | u32 val; | 1626 | u32 val; |
1627 | int mac_version; | 1627 | int mac_version; |
@@ -1689,7 +1689,8 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp, | |||
1689 | 1689 | ||
1690 | /* Catch-all */ | 1690 | /* Catch-all */ |
1691 | { 0x00000000, 0x00000000, RTL_GIGA_MAC_NONE } | 1691 | { 0x00000000, 0x00000000, RTL_GIGA_MAC_NONE } |
1692 | }, *p = mac_info; | 1692 | }; |
1693 | const struct rtl_mac_info *p = mac_info; | ||
1693 | u32 reg; | 1694 | u32 reg; |
1694 | 1695 | ||
1695 | reg = RTL_R32(TxConfig); | 1696 | reg = RTL_R32(TxConfig); |
@@ -3681,7 +3682,7 @@ static void rtl_set_rx_max_size(void __iomem *ioaddr, unsigned int rx_buf_sz) | |||
3681 | 3682 | ||
3682 | static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) | 3683 | static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) |
3683 | { | 3684 | { |
3684 | static const struct { | 3685 | static const struct rtl_cfg2_info { |
3685 | u32 mac_version; | 3686 | u32 mac_version; |
3686 | u32 clk; | 3687 | u32 clk; |
3687 | u32 val; | 3688 | u32 val; |
@@ -3690,7 +3691,8 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version) | |||
3690 | { RTL_GIGA_MAC_VER_05, PCI_Clock_66MHz, 0x000fffff }, | 3691 | { RTL_GIGA_MAC_VER_05, PCI_Clock_66MHz, 0x000fffff }, |
3691 | { RTL_GIGA_MAC_VER_06, PCI_Clock_33MHz, 0x00ffff00 }, // 8110SCe | 3692 | { RTL_GIGA_MAC_VER_06, PCI_Clock_33MHz, 0x00ffff00 }, // 8110SCe |
3692 | { RTL_GIGA_MAC_VER_06, PCI_Clock_66MHz, 0x00ffffff } | 3693 | { RTL_GIGA_MAC_VER_06, PCI_Clock_66MHz, 0x00ffffff } |
3693 | }, *p = cfg2_info; | 3694 | }; |
3695 | const struct rtl_cfg2_info *p = cfg2_info; | ||
3694 | unsigned int i; | 3696 | unsigned int i; |
3695 | u32 clk; | 3697 | u32 clk; |
3696 | 3698 | ||
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 584809c656d5..8ec1a9a0bb9a 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -670,17 +670,16 @@ static void sl_setup(struct net_device *dev) | |||
670 | * in parallel | 670 | * in parallel |
671 | */ | 671 | */ |
672 | 672 | ||
673 | static unsigned int slip_receive_buf(struct tty_struct *tty, | 673 | static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
674 | const unsigned char *cp, char *fp, int count) | 674 | char *fp, int count) |
675 | { | 675 | { |
676 | struct slip *sl = tty->disc_data; | 676 | struct slip *sl = tty->disc_data; |
677 | int bytes = count; | ||
678 | 677 | ||
679 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) | 678 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) |
680 | return -ENODEV; | 679 | return; |
681 | 680 | ||
682 | /* Read the characters out of the buffer */ | 681 | /* Read the characters out of the buffer */ |
683 | while (bytes--) { | 682 | while (count--) { |
684 | if (fp && *fp++) { | 683 | if (fp && *fp++) { |
685 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) | 684 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
686 | sl->dev->stats.rx_errors++; | 685 | sl->dev->stats.rx_errors++; |
@@ -694,8 +693,6 @@ static unsigned int slip_receive_buf(struct tty_struct *tty, | |||
694 | #endif | 693 | #endif |
695 | slip_unesc(sl, *cp++); | 694 | slip_unesc(sl, *cp++); |
696 | } | 695 | } |
697 | |||
698 | return count; | ||
699 | } | 696 | } |
700 | 697 | ||
701 | /************************************ | 698 | /************************************ |
diff --git a/drivers/net/smc-mca.c b/drivers/net/smc-mca.c index 0f29f261fcfe..d07c39cb4daf 100644 --- a/drivers/net/smc-mca.c +++ b/drivers/net/smc-mca.c | |||
@@ -156,7 +156,7 @@ static const struct { | |||
156 | { 14, 15 } | 156 | { 14, 15 } |
157 | }; | 157 | }; |
158 | 158 | ||
159 | static const short smc_mca_adapter_ids[] __devinitconst = { | 159 | static short smc_mca_adapter_ids[] __initdata = { |
160 | 0x61c8, | 160 | 0x61c8, |
161 | 0x61c9, | 161 | 0x61c9, |
162 | 0x6fc0, | 162 | 0x6fc0, |
@@ -168,7 +168,7 @@ static const short smc_mca_adapter_ids[] __devinitconst = { | |||
168 | 0x0000 | 168 | 0x0000 |
169 | }; | 169 | }; |
170 | 170 | ||
171 | static const char *const smc_mca_adapter_names[] __devinitconst = { | 171 | static char *smc_mca_adapter_names[] __initdata = { |
172 | "SMC Ethercard PLUS Elite/A BNC/AUI (WD8013EP/A)", | 172 | "SMC Ethercard PLUS Elite/A BNC/AUI (WD8013EP/A)", |
173 | "SMC Ethercard PLUS Elite/A UTP/AUI (WD8013WP/A)", | 173 | "SMC Ethercard PLUS Elite/A UTP/AUI (WD8013WP/A)", |
174 | "WD Ethercard PLUS/A (WD8003E/A or WD8003ET/A)", | 174 | "WD Ethercard PLUS/A (WD8003E/A or WD8003ET/A)", |
@@ -199,7 +199,7 @@ static const struct net_device_ops ultramca_netdev_ops = { | |||
199 | #endif | 199 | #endif |
200 | }; | 200 | }; |
201 | 201 | ||
202 | static int __devinit ultramca_probe(struct device *gen_dev) | 202 | static int __init ultramca_probe(struct device *gen_dev) |
203 | { | 203 | { |
204 | unsigned short ioaddr; | 204 | unsigned short ioaddr; |
205 | struct net_device *dev; | 205 | struct net_device *dev; |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index dc4805f473e3..f6285748bd3c 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -2400,8 +2400,10 @@ static const struct of_device_id smc91x_match[] = { | |||
2400 | { .compatible = "smsc,lan91c94", }, | 2400 | { .compatible = "smsc,lan91c94", }, |
2401 | { .compatible = "smsc,lan91c111", }, | 2401 | { .compatible = "smsc,lan91c111", }, |
2402 | {}, | 2402 | {}, |
2403 | } | 2403 | }; |
2404 | MODULE_DEVICE_TABLE(of, smc91x_match); | 2404 | MODULE_DEVICE_TABLE(of, smc91x_match); |
2405 | #else | ||
2406 | #define smc91x_match NULL | ||
2405 | #endif | 2407 | #endif |
2406 | 2408 | ||
2407 | static struct dev_pm_ops smc_drv_pm_ops = { | 2409 | static struct dev_pm_ops smc_drv_pm_ops = { |
@@ -2416,9 +2418,7 @@ static struct platform_driver smc_driver = { | |||
2416 | .name = CARDNAME, | 2418 | .name = CARDNAME, |
2417 | .owner = THIS_MODULE, | 2419 | .owner = THIS_MODULE, |
2418 | .pm = &smc_drv_pm_ops, | 2420 | .pm = &smc_drv_pm_ops, |
2419 | #ifdef CONFIG_OF | ||
2420 | .of_match_table = smc91x_match, | 2421 | .of_match_table = smc91x_match, |
2421 | #endif | ||
2422 | }, | 2422 | }, |
2423 | }; | 2423 | }; |
2424 | 2424 | ||
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f4b01c638a33..a1f9f9eef37d 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -5774,7 +5774,7 @@ static void tg3_skb_error_unmap(struct tg3_napi *tnapi, | |||
5774 | dma_unmap_addr(txb, mapping), | 5774 | dma_unmap_addr(txb, mapping), |
5775 | skb_headlen(skb), | 5775 | skb_headlen(skb), |
5776 | PCI_DMA_TODEVICE); | 5776 | PCI_DMA_TODEVICE); |
5777 | for (i = 0; i <= last; i++) { | 5777 | for (i = 0; i < last; i++) { |
5778 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 5778 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
5779 | 5779 | ||
5780 | entry = NEXT_TX(entry); | 5780 | entry = NEXT_TX(entry); |
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c index 1313aa1315f0..2bedc0ace812 100644 --- a/drivers/net/tokenring/madgemc.c +++ b/drivers/net/tokenring/madgemc.c | |||
@@ -727,7 +727,7 @@ static int __devexit madgemc_remove(struct device *device) | |||
727 | return 0; | 727 | return 0; |
728 | } | 728 | } |
729 | 729 | ||
730 | static const short madgemc_adapter_ids[] __devinitconst = { | 730 | static short madgemc_adapter_ids[] __initdata = { |
731 | 0x002d, | 731 | 0x002d, |
732 | 0x0000 | 732 | 0x0000 |
733 | }; | 733 | }; |
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index 45144d5bd11b..efaa1d69b720 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c | |||
@@ -1995,7 +1995,7 @@ SetMulticastFilter(struct net_device *dev) | |||
1995 | 1995 | ||
1996 | static u_char de4x5_irq[] = EISA_ALLOWED_IRQ_LIST; | 1996 | static u_char de4x5_irq[] = EISA_ALLOWED_IRQ_LIST; |
1997 | 1997 | ||
1998 | static int __devinit de4x5_eisa_probe (struct device *gendev) | 1998 | static int __init de4x5_eisa_probe (struct device *gendev) |
1999 | { | 1999 | { |
2000 | struct eisa_device *edev; | 2000 | struct eisa_device *edev; |
2001 | u_long iobase; | 2001 | u_long iobase; |
@@ -2097,7 +2097,7 @@ static int __devexit de4x5_eisa_remove (struct device *device) | |||
2097 | return 0; | 2097 | return 0; |
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | static const struct eisa_device_id de4x5_eisa_ids[] __devinitconst = { | 2100 | static struct eisa_device_id de4x5_eisa_ids[] = { |
2101 | { "DEC4250", 0 }, /* 0 is the board name index... */ | 2101 | { "DEC4250", 0 }, /* 0 is the board name index... */ |
2102 | { "" } | 2102 | { "" } |
2103 | }; | 2103 | }; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 74e94054ab1a..5235f48be1be 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -460,7 +460,23 @@ static u32 tun_net_fix_features(struct net_device *dev, u32 features) | |||
460 | 460 | ||
461 | return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); | 461 | return (features & tun->set_features) | (features & ~TUN_USER_FEATURES); |
462 | } | 462 | } |
463 | 463 | #ifdef CONFIG_NET_POLL_CONTROLLER | |
464 | static void tun_poll_controller(struct net_device *dev) | ||
465 | { | ||
466 | /* | ||
467 | * Tun only receives frames when: | ||
468 | * 1) the char device endpoint gets data from user space | ||
469 | * 2) the tun socket gets a sendmsg call from user space | ||
470 | * Since both of those are syncronous operations, we are guaranteed | ||
471 | * never to have pending data when we poll for it | ||
472 | * so theres nothing to do here but return. | ||
473 | * We need this though so netpoll recognizes us as an interface that | ||
474 | * supports polling, which enables bridge devices in virt setups to | ||
475 | * still use netconsole | ||
476 | */ | ||
477 | return; | ||
478 | } | ||
479 | #endif | ||
464 | static const struct net_device_ops tun_netdev_ops = { | 480 | static const struct net_device_ops tun_netdev_ops = { |
465 | .ndo_uninit = tun_net_uninit, | 481 | .ndo_uninit = tun_net_uninit, |
466 | .ndo_open = tun_net_open, | 482 | .ndo_open = tun_net_open, |
@@ -468,6 +484,9 @@ static const struct net_device_ops tun_netdev_ops = { | |||
468 | .ndo_start_xmit = tun_net_xmit, | 484 | .ndo_start_xmit = tun_net_xmit, |
469 | .ndo_change_mtu = tun_net_change_mtu, | 485 | .ndo_change_mtu = tun_net_change_mtu, |
470 | .ndo_fix_features = tun_net_fix_features, | 486 | .ndo_fix_features = tun_net_fix_features, |
487 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
488 | .ndo_poll_controller = tun_poll_controller, | ||
489 | #endif | ||
471 | }; | 490 | }; |
472 | 491 | ||
473 | static const struct net_device_ops tap_netdev_ops = { | 492 | static const struct net_device_ops tap_netdev_ops = { |
@@ -480,6 +499,9 @@ static const struct net_device_ops tap_netdev_ops = { | |||
480 | .ndo_set_multicast_list = tun_net_mclist, | 499 | .ndo_set_multicast_list = tun_net_mclist, |
481 | .ndo_set_mac_address = eth_mac_addr, | 500 | .ndo_set_mac_address = eth_mac_addr, |
482 | .ndo_validate_addr = eth_validate_addr, | 501 | .ndo_validate_addr = eth_validate_addr, |
502 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
503 | .ndo_poll_controller = tun_poll_controller, | ||
504 | #endif | ||
483 | }; | 505 | }; |
484 | 506 | ||
485 | /* Initialize net device. */ | 507 | /* Initialize net device. */ |
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 9d4f9117260f..84d4608153c9 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig | |||
@@ -385,6 +385,16 @@ config USB_NET_CX82310_ETH | |||
385 | router with USB ethernet port. This driver is for routers only, | 385 | router with USB ethernet port. This driver is for routers only, |
386 | it will not work with ADSL modems (use cxacru driver instead). | 386 | it will not work with ADSL modems (use cxacru driver instead). |
387 | 387 | ||
388 | config USB_NET_KALMIA | ||
389 | tristate "Samsung Kalmia based LTE USB modem" | ||
390 | depends on USB_USBNET | ||
391 | help | ||
392 | Choose this option if you have a Samsung Kalmia based USB modem | ||
393 | as Samsung GT-B3730. | ||
394 | |||
395 | To compile this driver as a module, choose M here: the | ||
396 | module will be called kalmia. | ||
397 | |||
388 | config USB_HSO | 398 | config USB_HSO |
389 | tristate "Option USB High Speed Mobile Devices" | 399 | tristate "Option USB High Speed Mobile Devices" |
390 | depends on USB && RFKILL | 400 | depends on USB && RFKILL |
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile index c7ec8a5f0a90..c203fa21f6b1 100644 --- a/drivers/net/usb/Makefile +++ b/drivers/net/usb/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o | |||
23 | obj-$(CONFIG_USB_USBNET) += usbnet.o | 23 | obj-$(CONFIG_USB_USBNET) += usbnet.o |
24 | obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o | 24 | obj-$(CONFIG_USB_NET_INT51X1) += int51x1.o |
25 | obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o | 25 | obj-$(CONFIG_USB_CDC_PHONET) += cdc-phonet.o |
26 | obj-$(CONFIG_USB_NET_KALMIA) += kalmia.o | ||
26 | obj-$(CONFIG_USB_IPHETH) += ipheth.o | 27 | obj-$(CONFIG_USB_IPHETH) += ipheth.o |
27 | obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o | 28 | obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o |
28 | obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o | 29 | obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o |
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index d7221c4a5dcf..8056f8a27c6a 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -495,7 +495,7 @@ static void catc_ctrl_run(struct catc *catc) | |||
495 | if (!q->dir && q->buf && q->len) | 495 | if (!q->dir && q->buf && q->len) |
496 | memcpy(catc->ctrl_buf, q->buf, q->len); | 496 | memcpy(catc->ctrl_buf, q->buf, q->len); |
497 | 497 | ||
498 | if ((status = usb_submit_urb(catc->ctrl_urb, GFP_KERNEL))) | 498 | if ((status = usb_submit_urb(catc->ctrl_urb, GFP_ATOMIC))) |
499 | err("submit(ctrl_urb) status %d", status); | 499 | err("submit(ctrl_urb) status %d", status); |
500 | } | 500 | } |
501 | 501 | ||
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index cdd3ae486109..f33ca6aa29e9 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #include <linux/usb/usbnet.h> | 54 | #include <linux/usb/usbnet.h> |
55 | #include <linux/usb/cdc.h> | 55 | #include <linux/usb/cdc.h> |
56 | 56 | ||
57 | #define DRIVER_VERSION "24-May-2011" | 57 | #define DRIVER_VERSION "01-June-2011" |
58 | 58 | ||
59 | /* CDC NCM subclass 3.2.1 */ | 59 | /* CDC NCM subclass 3.2.1 */ |
60 | #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 | 60 | #define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 |
@@ -1234,6 +1234,7 @@ static struct usb_driver cdc_ncm_driver = { | |||
1234 | .disconnect = cdc_ncm_disconnect, | 1234 | .disconnect = cdc_ncm_disconnect, |
1235 | .suspend = usbnet_suspend, | 1235 | .suspend = usbnet_suspend, |
1236 | .resume = usbnet_resume, | 1236 | .resume = usbnet_resume, |
1237 | .reset_resume = usbnet_resume, | ||
1237 | .supports_autosuspend = 1, | 1238 | .supports_autosuspend = 1, |
1238 | }; | 1239 | }; |
1239 | 1240 | ||
diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c new file mode 100644 index 000000000000..d965fb1e013e --- /dev/null +++ b/drivers/net/usb/kalmia.c | |||
@@ -0,0 +1,384 @@ | |||
1 | /* | ||
2 | * USB network interface driver for Samsung Kalmia based LTE USB modem like the | ||
3 | * Samsung GT-B3730 and GT-B3710. | ||
4 | * | ||
5 | * Copyright (C) 2011 Marius Bjoernstad Kotsbak <marius@kotsbak.com> | ||
6 | * | ||
7 | * Sponsored by Quicklink Video Distribution Services Ltd. | ||
8 | * | ||
9 | * Based on the cdc_eem module. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/netdevice.h> | ||
20 | #include <linux/etherdevice.h> | ||
21 | #include <linux/ctype.h> | ||
22 | #include <linux/ethtool.h> | ||
23 | #include <linux/workqueue.h> | ||
24 | #include <linux/mii.h> | ||
25 | #include <linux/usb.h> | ||
26 | #include <linux/crc32.h> | ||
27 | #include <linux/usb/cdc.h> | ||
28 | #include <linux/usb/usbnet.h> | ||
29 | #include <linux/gfp.h> | ||
30 | |||
31 | /* | ||
32 | * The Samsung Kalmia based LTE USB modems have a CDC ACM port for modem control | ||
33 | * handled by the "option" module and an ethernet data port handled by this | ||
34 | * module. | ||
35 | * | ||
36 | * The stick must first be switched into modem mode by usb_modeswitch | ||
37 | * or similar tool. Then the modem gets sent two initialization packets by | ||
38 | * this module, which gives the MAC address of the device. User space can then | ||
39 | * connect the modem using AT commands through the ACM port and then use | ||
40 | * DHCP on the network interface exposed by this module. Network packets are | ||
41 | * sent to and from the modem in a proprietary format discovered after watching | ||
42 | * the behavior of the windows driver for the modem. | ||
43 | * | ||
44 | * More information about the use of the modem is available in usb_modeswitch | ||
45 | * forum and the project page: | ||
46 | * | ||
47 | * http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=465 | ||
48 | * https://github.com/mkotsbak/Samsung-GT-B3730-linux-driver | ||
49 | */ | ||
50 | |||
51 | /* #define DEBUG */ | ||
52 | /* #define VERBOSE */ | ||
53 | |||
54 | #define KALMIA_HEADER_LENGTH 6 | ||
55 | #define KALMIA_ALIGN_SIZE 4 | ||
56 | #define KALMIA_USB_TIMEOUT 10000 | ||
57 | |||
58 | /*-------------------------------------------------------------------------*/ | ||
59 | |||
60 | static int | ||
61 | kalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len, | ||
62 | u8 *buffer, u8 expected_len) | ||
63 | { | ||
64 | int act_len; | ||
65 | int status; | ||
66 | |||
67 | netdev_dbg(dev->net, "Sending init packet"); | ||
68 | |||
69 | status = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 0x02), | ||
70 | init_msg, init_msg_len, &act_len, KALMIA_USB_TIMEOUT); | ||
71 | if (status != 0) { | ||
72 | netdev_err(dev->net, | ||
73 | "Error sending init packet. Status %i, length %i\n", | ||
74 | status, act_len); | ||
75 | return status; | ||
76 | } | ||
77 | else if (act_len != init_msg_len) { | ||
78 | netdev_err(dev->net, | ||
79 | "Did not send all of init packet. Bytes sent: %i", | ||
80 | act_len); | ||
81 | } | ||
82 | else { | ||
83 | netdev_dbg(dev->net, "Successfully sent init packet."); | ||
84 | } | ||
85 | |||
86 | status = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, 0x81), | ||
87 | buffer, expected_len, &act_len, KALMIA_USB_TIMEOUT); | ||
88 | |||
89 | if (status != 0) | ||
90 | netdev_err(dev->net, | ||
91 | "Error receiving init result. Status %i, length %i\n", | ||
92 | status, act_len); | ||
93 | else if (act_len != expected_len) | ||
94 | netdev_err(dev->net, "Unexpected init result length: %i\n", | ||
95 | act_len); | ||
96 | |||
97 | return status; | ||
98 | } | ||
99 | |||
100 | static int | ||
101 | kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr) | ||
102 | { | ||
103 | char init_msg_1[] = | ||
104 | { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, | ||
105 | 0x00, 0x00 }; | ||
106 | char init_msg_2[] = | ||
107 | { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4, | ||
108 | 0x00, 0x00 }; | ||
109 | char receive_buf[28]; | ||
110 | int status; | ||
111 | |||
112 | status = kalmia_send_init_packet(dev, init_msg_1, sizeof(init_msg_1) | ||
113 | / sizeof(init_msg_1[0]), receive_buf, 24); | ||
114 | if (status != 0) | ||
115 | return status; | ||
116 | |||
117 | status = kalmia_send_init_packet(dev, init_msg_2, sizeof(init_msg_2) | ||
118 | / sizeof(init_msg_2[0]), receive_buf, 28); | ||
119 | if (status != 0) | ||
120 | return status; | ||
121 | |||
122 | memcpy(ethernet_addr, receive_buf + 10, ETH_ALEN); | ||
123 | |||
124 | return status; | ||
125 | } | ||
126 | |||
127 | static int | ||
128 | kalmia_bind(struct usbnet *dev, struct usb_interface *intf) | ||
129 | { | ||
130 | u8 status; | ||
131 | u8 ethernet_addr[ETH_ALEN]; | ||
132 | |||
133 | /* Don't bind to AT command interface */ | ||
134 | if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) | ||
135 | return -EINVAL; | ||
136 | |||
137 | dev->in = usb_rcvbulkpipe(dev->udev, 0x81 & USB_ENDPOINT_NUMBER_MASK); | ||
138 | dev->out = usb_sndbulkpipe(dev->udev, 0x02 & USB_ENDPOINT_NUMBER_MASK); | ||
139 | dev->status = NULL; | ||
140 | |||
141 | dev->net->hard_header_len += KALMIA_HEADER_LENGTH; | ||
142 | dev->hard_mtu = 1400; | ||
143 | dev->rx_urb_size = dev->hard_mtu * 10; // Found as optimal after testing | ||
144 | |||
145 | status = kalmia_init_and_get_ethernet_addr(dev, ethernet_addr); | ||
146 | |||
147 | if (status < 0) { | ||
148 | usb_set_intfdata(intf, NULL); | ||
149 | usb_driver_release_interface(driver_of(intf), intf); | ||
150 | return status; | ||
151 | } | ||
152 | |||
153 | memcpy(dev->net->dev_addr, ethernet_addr, ETH_ALEN); | ||
154 | memcpy(dev->net->perm_addr, ethernet_addr, ETH_ALEN); | ||
155 | |||
156 | return status; | ||
157 | } | ||
158 | |||
159 | static struct sk_buff * | ||
160 | kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | ||
161 | { | ||
162 | struct sk_buff *skb2 = NULL; | ||
163 | u16 content_len; | ||
164 | unsigned char *header_start; | ||
165 | unsigned char ether_type_1, ether_type_2; | ||
166 | u8 remainder, padlen = 0; | ||
167 | |||
168 | if (!skb_cloned(skb)) { | ||
169 | int headroom = skb_headroom(skb); | ||
170 | int tailroom = skb_tailroom(skb); | ||
171 | |||
172 | if ((tailroom >= KALMIA_ALIGN_SIZE) && (headroom | ||
173 | >= KALMIA_HEADER_LENGTH)) | ||
174 | goto done; | ||
175 | |||
176 | if ((headroom + tailroom) > (KALMIA_HEADER_LENGTH | ||
177 | + KALMIA_ALIGN_SIZE)) { | ||
178 | skb->data = memmove(skb->head + KALMIA_HEADER_LENGTH, | ||
179 | skb->data, skb->len); | ||
180 | skb_set_tail_pointer(skb, skb->len); | ||
181 | goto done; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | skb2 = skb_copy_expand(skb, KALMIA_HEADER_LENGTH, | ||
186 | KALMIA_ALIGN_SIZE, flags); | ||
187 | if (!skb2) | ||
188 | return NULL; | ||
189 | |||
190 | dev_kfree_skb_any(skb); | ||
191 | skb = skb2; | ||
192 | |||
193 | done: header_start = skb_push(skb, KALMIA_HEADER_LENGTH); | ||
194 | ether_type_1 = header_start[KALMIA_HEADER_LENGTH + 12]; | ||
195 | ether_type_2 = header_start[KALMIA_HEADER_LENGTH + 13]; | ||
196 | |||
197 | netdev_dbg(dev->net, "Sending etherType: %02x%02x", ether_type_1, | ||
198 | ether_type_2); | ||
199 | |||
200 | /* According to empiric data for data packages */ | ||
201 | header_start[0] = 0x57; | ||
202 | header_start[1] = 0x44; | ||
203 | content_len = skb->len - KALMIA_HEADER_LENGTH; | ||
204 | header_start[2] = (content_len & 0xff); /* low byte */ | ||
205 | header_start[3] = (content_len >> 8); /* high byte */ | ||
206 | |||
207 | header_start[4] = ether_type_1; | ||
208 | header_start[5] = ether_type_2; | ||
209 | |||
210 | /* Align to 4 bytes by padding with zeros */ | ||
211 | remainder = skb->len % KALMIA_ALIGN_SIZE; | ||
212 | if (remainder > 0) { | ||
213 | padlen = KALMIA_ALIGN_SIZE - remainder; | ||
214 | memset(skb_put(skb, padlen), 0, padlen); | ||
215 | } | ||
216 | |||
217 | netdev_dbg( | ||
218 | dev->net, | ||
219 | "Sending package with length %i and padding %i. Header: %02x:%02x:%02x:%02x:%02x:%02x.", | ||
220 | content_len, padlen, header_start[0], header_start[1], | ||
221 | header_start[2], header_start[3], header_start[4], | ||
222 | header_start[5]); | ||
223 | |||
224 | return skb; | ||
225 | } | ||
226 | |||
227 | static int | ||
228 | kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | ||
229 | { | ||
230 | /* | ||
231 | * Our task here is to strip off framing, leaving skb with one | ||
232 | * data frame for the usbnet framework code to process. | ||
233 | */ | ||
234 | const u8 HEADER_END_OF_USB_PACKET[] = | ||
235 | { 0x57, 0x5a, 0x00, 0x00, 0x08, 0x00 }; | ||
236 | const u8 EXPECTED_UNKNOWN_HEADER_1[] = | ||
237 | { 0x57, 0x43, 0x1e, 0x00, 0x15, 0x02 }; | ||
238 | const u8 EXPECTED_UNKNOWN_HEADER_2[] = | ||
239 | { 0x57, 0x50, 0x0e, 0x00, 0x00, 0x00 }; | ||
240 | u8 i = 0; | ||
241 | |||
242 | /* incomplete header? */ | ||
243 | if (skb->len < KALMIA_HEADER_LENGTH) | ||
244 | return 0; | ||
245 | |||
246 | do { | ||
247 | struct sk_buff *skb2 = NULL; | ||
248 | u8 *header_start; | ||
249 | u16 usb_packet_length, ether_packet_length; | ||
250 | int is_last; | ||
251 | |||
252 | header_start = skb->data; | ||
253 | |||
254 | if (unlikely(header_start[0] != 0x57 || header_start[1] != 0x44)) { | ||
255 | if (!memcmp(header_start, EXPECTED_UNKNOWN_HEADER_1, | ||
256 | sizeof(EXPECTED_UNKNOWN_HEADER_1)) || !memcmp( | ||
257 | header_start, EXPECTED_UNKNOWN_HEADER_2, | ||
258 | sizeof(EXPECTED_UNKNOWN_HEADER_2))) { | ||
259 | netdev_dbg( | ||
260 | dev->net, | ||
261 | "Received expected unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", | ||
262 | header_start[0], header_start[1], | ||
263 | header_start[2], header_start[3], | ||
264 | header_start[4], header_start[5], | ||
265 | skb->len - KALMIA_HEADER_LENGTH); | ||
266 | } | ||
267 | else { | ||
268 | netdev_err( | ||
269 | dev->net, | ||
270 | "Received unknown frame header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", | ||
271 | header_start[0], header_start[1], | ||
272 | header_start[2], header_start[3], | ||
273 | header_start[4], header_start[5], | ||
274 | skb->len - KALMIA_HEADER_LENGTH); | ||
275 | return 0; | ||
276 | } | ||
277 | } | ||
278 | else | ||
279 | netdev_dbg( | ||
280 | dev->net, | ||
281 | "Received header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", | ||
282 | header_start[0], header_start[1], header_start[2], | ||
283 | header_start[3], header_start[4], header_start[5], | ||
284 | skb->len - KALMIA_HEADER_LENGTH); | ||
285 | |||
286 | /* subtract start header and end header */ | ||
287 | usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH); | ||
288 | ether_packet_length = header_start[2] + (header_start[3] << 8); | ||
289 | skb_pull(skb, KALMIA_HEADER_LENGTH); | ||
290 | |||
291 | /* Some small packets misses end marker */ | ||
292 | if (usb_packet_length < ether_packet_length) { | ||
293 | ether_packet_length = usb_packet_length | ||
294 | + KALMIA_HEADER_LENGTH; | ||
295 | is_last = true; | ||
296 | } | ||
297 | else { | ||
298 | netdev_dbg(dev->net, "Correct package length #%i", i | ||
299 | + 1); | ||
300 | |||
301 | is_last = (memcmp(skb->data + ether_packet_length, | ||
302 | HEADER_END_OF_USB_PACKET, | ||
303 | sizeof(HEADER_END_OF_USB_PACKET)) == 0); | ||
304 | if (!is_last) { | ||
305 | header_start = skb->data + ether_packet_length; | ||
306 | netdev_dbg( | ||
307 | dev->net, | ||
308 | "End header: %02x:%02x:%02x:%02x:%02x:%02x. Package length: %i\n", | ||
309 | header_start[0], header_start[1], | ||
310 | header_start[2], header_start[3], | ||
311 | header_start[4], header_start[5], | ||
312 | skb->len - KALMIA_HEADER_LENGTH); | ||
313 | } | ||
314 | } | ||
315 | |||
316 | if (is_last) { | ||
317 | skb2 = skb; | ||
318 | } | ||
319 | else { | ||
320 | skb2 = skb_clone(skb, GFP_ATOMIC); | ||
321 | if (unlikely(!skb2)) | ||
322 | return 0; | ||
323 | } | ||
324 | |||
325 | skb_trim(skb2, ether_packet_length); | ||
326 | |||
327 | if (is_last) { | ||
328 | return 1; | ||
329 | } | ||
330 | else { | ||
331 | usbnet_skb_return(dev, skb2); | ||
332 | skb_pull(skb, ether_packet_length); | ||
333 | } | ||
334 | |||
335 | i++; | ||
336 | } | ||
337 | while (skb->len); | ||
338 | |||
339 | return 1; | ||
340 | } | ||
341 | |||
342 | static const struct driver_info kalmia_info = { | ||
343 | .description = "Samsung Kalmia LTE USB dongle", | ||
344 | .flags = FLAG_WWAN, | ||
345 | .bind = kalmia_bind, | ||
346 | .rx_fixup = kalmia_rx_fixup, | ||
347 | .tx_fixup = kalmia_tx_fixup | ||
348 | }; | ||
349 | |||
350 | /*-------------------------------------------------------------------------*/ | ||
351 | |||
352 | static const struct usb_device_id products[] = { | ||
353 | /* The unswitched USB ID, to get the module auto loaded: */ | ||
354 | { USB_DEVICE(0x04e8, 0x689a) }, | ||
355 | /* The stick swithed into modem (by e.g. usb_modeswitch): */ | ||
356 | { USB_DEVICE(0x04e8, 0x6889), | ||
357 | .driver_info = (unsigned long) &kalmia_info, }, | ||
358 | { /* EMPTY == end of list */} }; | ||
359 | MODULE_DEVICE_TABLE( usb, products); | ||
360 | |||
361 | static struct usb_driver kalmia_driver = { | ||
362 | .name = "kalmia", | ||
363 | .id_table = products, | ||
364 | .probe = usbnet_probe, | ||
365 | .disconnect = usbnet_disconnect, | ||
366 | .suspend = usbnet_suspend, | ||
367 | .resume = usbnet_resume | ||
368 | }; | ||
369 | |||
370 | static int __init kalmia_init(void) | ||
371 | { | ||
372 | return usb_register(&kalmia_driver); | ||
373 | } | ||
374 | module_init( kalmia_init); | ||
375 | |||
376 | static void __exit kalmia_exit(void) | ||
377 | { | ||
378 | usb_deregister(&kalmia_driver); | ||
379 | } | ||
380 | module_exit( kalmia_exit); | ||
381 | |||
382 | MODULE_AUTHOR("Marius Bjoernstad Kotsbak <marius@kotsbak.com>"); | ||
383 | MODULE_DESCRIPTION("Samsung Kalmia USB network driver"); | ||
384 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 0cb0b0632672..f6853247a620 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -609,7 +609,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
609 | * before it gets out of hand. Naturally, this wastes entries. */ | 609 | * before it gets out of hand. Naturally, this wastes entries. */ |
610 | if (capacity < 2+MAX_SKB_FRAGS) { | 610 | if (capacity < 2+MAX_SKB_FRAGS) { |
611 | netif_stop_queue(dev); | 611 | netif_stop_queue(dev); |
612 | if (unlikely(!virtqueue_enable_cb(vi->svq))) { | 612 | if (unlikely(!virtqueue_enable_cb_delayed(vi->svq))) { |
613 | /* More just got used, free them then recheck. */ | 613 | /* More just got used, free them then recheck. */ |
614 | capacity += free_old_xmit_skbs(vi); | 614 | capacity += free_old_xmit_skbs(vi); |
615 | if (capacity >= 2+MAX_SKB_FRAGS) { | 615 | if (capacity >= 2+MAX_SKB_FRAGS) { |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index e050bd65e037..777d1a4e81b2 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2203,8 +2203,10 @@ fst_open(struct net_device *dev) | |||
2203 | 2203 | ||
2204 | if (port->mode != FST_RAW) { | 2204 | if (port->mode != FST_RAW) { |
2205 | err = hdlc_open(dev); | 2205 | err = hdlc_open(dev); |
2206 | if (err) | 2206 | if (err) { |
2207 | module_put(THIS_MODULE); | ||
2207 | return err; | 2208 | return err; |
2209 | } | ||
2208 | } | 2210 | } |
2209 | 2211 | ||
2210 | fst_openport(port); | 2212 | fst_openport(port); |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 40398bf7d036..24297b274cd4 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -517,18 +517,17 @@ static int x25_asy_close(struct net_device *dev) | |||
517 | * and sent on to some IP layer for further processing. | 517 | * and sent on to some IP layer for further processing. |
518 | */ | 518 | */ |
519 | 519 | ||
520 | static unsigned int x25_asy_receive_buf(struct tty_struct *tty, | 520 | static void x25_asy_receive_buf(struct tty_struct *tty, |
521 | const unsigned char *cp, char *fp, int count) | 521 | const unsigned char *cp, char *fp, int count) |
522 | { | 522 | { |
523 | struct x25_asy *sl = tty->disc_data; | 523 | struct x25_asy *sl = tty->disc_data; |
524 | int bytes = count; | ||
525 | 524 | ||
526 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) | 525 | if (!sl || sl->magic != X25_ASY_MAGIC || !netif_running(sl->dev)) |
527 | return; | 526 | return; |
528 | 527 | ||
529 | 528 | ||
530 | /* Read the characters out of the buffer */ | 529 | /* Read the characters out of the buffer */ |
531 | while (bytes--) { | 530 | while (count--) { |
532 | if (fp && *fp++) { | 531 | if (fp && *fp++) { |
533 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) | 532 | if (!test_and_set_bit(SLF_ERROR, &sl->flags)) |
534 | sl->dev->stats.rx_errors++; | 533 | sl->dev->stats.rx_errors++; |
@@ -537,8 +536,6 @@ static unsigned int x25_asy_receive_buf(struct tty_struct *tty, | |||
537 | } | 536 | } |
538 | x25_asy_unesc(sl, *cp++); | 537 | x25_asy_unesc(sl, *cp++); |
539 | } | 538 | } |
540 | |||
541 | return count; | ||
542 | } | 539 | } |
543 | 540 | ||
544 | /* | 541 | /* |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 22047628ccfa..b6c5d3715b96 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -72,6 +72,11 @@ static int modparam_all_channels; | |||
72 | module_param_named(all_channels, modparam_all_channels, bool, S_IRUGO); | 72 | module_param_named(all_channels, modparam_all_channels, bool, S_IRUGO); |
73 | MODULE_PARM_DESC(all_channels, "Expose all channels the device can use."); | 73 | MODULE_PARM_DESC(all_channels, "Expose all channels the device can use."); |
74 | 74 | ||
75 | static int modparam_fastchanswitch; | ||
76 | module_param_named(fastchanswitch, modparam_fastchanswitch, bool, S_IRUGO); | ||
77 | MODULE_PARM_DESC(fastchanswitch, "Enable fast channel switching for AR2413/AR5413 radios."); | ||
78 | |||
79 | |||
75 | /* Module info */ | 80 | /* Module info */ |
76 | MODULE_AUTHOR("Jiri Slaby"); | 81 | MODULE_AUTHOR("Jiri Slaby"); |
77 | MODULE_AUTHOR("Nick Kossifidis"); | 82 | MODULE_AUTHOR("Nick Kossifidis"); |
@@ -2686,6 +2691,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, | |||
2686 | struct ath5k_hw *ah = sc->ah; | 2691 | struct ath5k_hw *ah = sc->ah; |
2687 | struct ath_common *common = ath5k_hw_common(ah); | 2692 | struct ath_common *common = ath5k_hw_common(ah); |
2688 | int ret, ani_mode; | 2693 | int ret, ani_mode; |
2694 | bool fast; | ||
2689 | 2695 | ||
2690 | ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); | 2696 | ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); |
2691 | 2697 | ||
@@ -2705,7 +2711,10 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan, | |||
2705 | ath5k_drain_tx_buffs(sc); | 2711 | ath5k_drain_tx_buffs(sc); |
2706 | if (chan) | 2712 | if (chan) |
2707 | sc->curchan = chan; | 2713 | sc->curchan = chan; |
2708 | ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL, | 2714 | |
2715 | fast = ((chan != NULL) && modparam_fastchanswitch) ? 1 : 0; | ||
2716 | |||
2717 | ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, fast, | ||
2709 | skip_pcu); | 2718 | skip_pcu); |
2710 | if (ret) { | 2719 | if (ret) { |
2711 | ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret); | 2720 | ATH5K_ERR(sc, "can't reset hardware (%d)\n", ret); |
diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c index 3510de2cf622..126a4eab35f3 100644 --- a/drivers/net/wireless/ath/ath5k/reset.c +++ b/drivers/net/wireless/ath/ath5k/reset.c | |||
@@ -1124,8 +1124,11 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, | |||
1124 | /* Non fatal, can happen eg. | 1124 | /* Non fatal, can happen eg. |
1125 | * on mode change */ | 1125 | * on mode change */ |
1126 | ret = 0; | 1126 | ret = 0; |
1127 | } else | 1127 | } else { |
1128 | ATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_RESET, | ||
1129 | "fast chan change successful\n"); | ||
1128 | return 0; | 1130 | return 0; |
1131 | } | ||
1129 | } | 1132 | } |
1130 | 1133 | ||
1131 | /* | 1134 | /* |
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig index d9ff8413ab9a..d9c08c619a3a 100644 --- a/drivers/net/wireless/ath/ath9k/Kconfig +++ b/drivers/net/wireless/ath/ath9k/Kconfig | |||
@@ -26,7 +26,6 @@ config ATH9K | |||
26 | config ATH9K_PCI | 26 | config ATH9K_PCI |
27 | bool "Atheros ath9k PCI/PCIe bus support" | 27 | bool "Atheros ath9k PCI/PCIe bus support" |
28 | depends on ATH9K && PCI | 28 | depends on ATH9K && PCI |
29 | default PCI | ||
30 | ---help--- | 29 | ---help--- |
31 | This option enables the PCI bus support in ath9k. | 30 | This option enables the PCI bus support in ath9k. |
32 | 31 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c index 015d97439935..2d4c0910295b 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c | |||
@@ -829,7 +829,7 @@ static bool ar9002_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan) | |||
829 | if (AR_SREV_9271(ah)) { | 829 | if (AR_SREV_9271(ah)) { |
830 | if (!ar9285_hw_cl_cal(ah, chan)) | 830 | if (!ar9285_hw_cl_cal(ah, chan)) |
831 | return false; | 831 | return false; |
832 | } else if (AR_SREV_9285_12_OR_LATER(ah)) { | 832 | } else if (AR_SREV_9285(ah) && AR_SREV_9285_12_OR_LATER(ah)) { |
833 | if (!ar9285_hw_clc(ah, chan)) | 833 | if (!ar9285_hw_clc(ah, chan)) |
834 | return false; | 834 | return false; |
835 | } else { | 835 | } else { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index 0ca7635d0669..ff8150e46f0e 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -4645,10 +4645,16 @@ static void ar9003_hw_set_power_per_rate_table(struct ath_hw *ah, | |||
4645 | case 1: | 4645 | case 1: |
4646 | break; | 4646 | break; |
4647 | case 2: | 4647 | case 2: |
4648 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | 4648 | if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) |
4649 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | ||
4650 | else | ||
4651 | scaledPower = 0; | ||
4649 | break; | 4652 | break; |
4650 | case 3: | 4653 | case 3: |
4651 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | 4654 | if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) |
4655 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | ||
4656 | else | ||
4657 | scaledPower = 0; | ||
4652 | break; | 4658 | break; |
4653 | } | 4659 | } |
4654 | 4660 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index eee23ecd118a..892c48b15434 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -1381,3 +1381,25 @@ void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah) | |||
1381 | "==== BB update: done ====\n\n"); | 1381 | "==== BB update: done ====\n\n"); |
1382 | } | 1382 | } |
1383 | EXPORT_SYMBOL(ar9003_hw_bb_watchdog_dbg_info); | 1383 | EXPORT_SYMBOL(ar9003_hw_bb_watchdog_dbg_info); |
1384 | |||
1385 | void ar9003_hw_disable_phy_restart(struct ath_hw *ah) | ||
1386 | { | ||
1387 | u32 val; | ||
1388 | |||
1389 | /* While receiving unsupported rate frame rx state machine | ||
1390 | * gets into a state 0xb and if phy_restart happens in that | ||
1391 | * state, BB would go hang. If RXSM is in 0xb state after | ||
1392 | * first bb panic, ensure to disable the phy_restart. | ||
1393 | */ | ||
1394 | if (!((MS(ah->bb_watchdog_last_status, | ||
1395 | AR_PHY_WATCHDOG_RX_OFDM_SM) == 0xb) || | ||
1396 | ah->bb_hang_rx_ofdm)) | ||
1397 | return; | ||
1398 | |||
1399 | ah->bb_hang_rx_ofdm = true; | ||
1400 | val = REG_READ(ah, AR_PHY_RESTART); | ||
1401 | val &= ~AR_PHY_RESTART_ENA; | ||
1402 | |||
1403 | REG_WRITE(ah, AR_PHY_RESTART, val); | ||
1404 | } | ||
1405 | EXPORT_SYMBOL(ar9003_hw_disable_phy_restart); | ||
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 7856f0d4512d..343fc9f946db 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -524,10 +524,16 @@ static void ath9k_hw_set_ar9287_power_per_rate_table(struct ath_hw *ah, | |||
524 | case 1: | 524 | case 1: |
525 | break; | 525 | break; |
526 | case 2: | 526 | case 2: |
527 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | 527 | if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) |
528 | scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; | ||
529 | else | ||
530 | scaledPower = 0; | ||
528 | break; | 531 | break; |
529 | case 3: | 532 | case 3: |
530 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | 533 | if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) |
534 | scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; | ||
535 | else | ||
536 | scaledPower = 0; | ||
531 | break; | 537 | break; |
532 | } | 538 | } |
533 | scaledPower = max((u16)0, scaledPower); | 539 | scaledPower = max((u16)0, scaledPower); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 72543ce8f616..1be7c8bbef84 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1555,9 +1555,12 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1555 | if (ah->btcoex_hw.enabled) | 1555 | if (ah->btcoex_hw.enabled) |
1556 | ath9k_hw_btcoex_enable(ah); | 1556 | ath9k_hw_btcoex_enable(ah); |
1557 | 1557 | ||
1558 | if (AR_SREV_9300_20_OR_LATER(ah)) | 1558 | if (AR_SREV_9300_20_OR_LATER(ah)) { |
1559 | ar9003_hw_bb_watchdog_config(ah); | 1559 | ar9003_hw_bb_watchdog_config(ah); |
1560 | 1560 | ||
1561 | ar9003_hw_disable_phy_restart(ah); | ||
1562 | } | ||
1563 | |||
1561 | ath9k_hw_apply_gpio_override(ah); | 1564 | ath9k_hw_apply_gpio_override(ah); |
1562 | 1565 | ||
1563 | return 0; | 1566 | return 0; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 57435ce62792..4b157c53d1a8 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -842,6 +842,7 @@ struct ath_hw { | |||
842 | 842 | ||
843 | u32 bb_watchdog_last_status; | 843 | u32 bb_watchdog_last_status; |
844 | u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */ | 844 | u32 bb_watchdog_timeout_ms; /* in ms, 0 to disable */ |
845 | u8 bb_hang_rx_ofdm; /* true if bb hang due to rx_ofdm */ | ||
845 | 846 | ||
846 | unsigned int paprd_target_power; | 847 | unsigned int paprd_target_power; |
847 | unsigned int paprd_training_power; | 848 | unsigned int paprd_training_power; |
@@ -990,6 +991,7 @@ void ar9002_hw_enable_wep_aggregation(struct ath_hw *ah); | |||
990 | void ar9003_hw_bb_watchdog_config(struct ath_hw *ah); | 991 | void ar9003_hw_bb_watchdog_config(struct ath_hw *ah); |
991 | void ar9003_hw_bb_watchdog_read(struct ath_hw *ah); | 992 | void ar9003_hw_bb_watchdog_read(struct ath_hw *ah); |
992 | void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah); | 993 | void ar9003_hw_bb_watchdog_dbg_info(struct ath_hw *ah); |
994 | void ar9003_hw_disable_phy_restart(struct ath_hw *ah); | ||
993 | void ar9003_paprd_enable(struct ath_hw *ah, bool val); | 995 | void ar9003_paprd_enable(struct ath_hw *ah, bool val); |
994 | void ar9003_paprd_populate_single_table(struct ath_hw *ah, | 996 | void ar9003_paprd_populate_single_table(struct ath_hw *ah, |
995 | struct ath9k_hw_cal_data *caldata, | 997 | struct ath9k_hw_cal_data *caldata, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index a198ee374b05..2ca351fe6d3c 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -670,7 +670,8 @@ void ath9k_tasklet(unsigned long data) | |||
670 | u32 status = sc->intrstatus; | 670 | u32 status = sc->intrstatus; |
671 | u32 rxmask; | 671 | u32 rxmask; |
672 | 672 | ||
673 | if (status & ATH9K_INT_FATAL) { | 673 | if ((status & ATH9K_INT_FATAL) || |
674 | (status & ATH9K_INT_BB_WATCHDOG)) { | ||
674 | ath_reset(sc, true); | 675 | ath_reset(sc, true); |
675 | return; | 676 | return; |
676 | } | 677 | } |
@@ -737,6 +738,7 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
737 | { | 738 | { |
738 | #define SCHED_INTR ( \ | 739 | #define SCHED_INTR ( \ |
739 | ATH9K_INT_FATAL | \ | 740 | ATH9K_INT_FATAL | \ |
741 | ATH9K_INT_BB_WATCHDOG | \ | ||
740 | ATH9K_INT_RXORN | \ | 742 | ATH9K_INT_RXORN | \ |
741 | ATH9K_INT_RXEOL | \ | 743 | ATH9K_INT_RXEOL | \ |
742 | ATH9K_INT_RX | \ | 744 | ATH9K_INT_RX | \ |
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 17542214c93f..ba7f36ab0a74 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -689,7 +689,8 @@ static void ath_rc_rate_set_series(const struct ath_rate_table *rate_table, | |||
689 | 689 | ||
690 | if (WLAN_RC_PHY_HT(rate_table->info[rix].phy)) { | 690 | if (WLAN_RC_PHY_HT(rate_table->info[rix].phy)) { |
691 | rate->flags |= IEEE80211_TX_RC_MCS; | 691 | rate->flags |= IEEE80211_TX_RC_MCS; |
692 | if (WLAN_RC_PHY_40(rate_table->info[rix].phy)) | 692 | if (WLAN_RC_PHY_40(rate_table->info[rix].phy) && |
693 | conf_is_ht40(&txrc->hw->conf)) | ||
693 | rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; | 694 | rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; |
694 | if (WLAN_RC_PHY_SGI(rate_table->info[rix].phy)) | 695 | if (WLAN_RC_PHY_SGI(rate_table->info[rix].phy)) |
695 | rate->flags |= IEEE80211_TX_RC_SHORT_GI; | 696 | rate->flags |= IEEE80211_TX_RC_SHORT_GI; |
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 9ed65157bef5..05960ddde24e 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c | |||
@@ -3093,7 +3093,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, | |||
3093 | int freq; | 3093 | int freq; |
3094 | bool avoid = false; | 3094 | bool avoid = false; |
3095 | u8 length; | 3095 | u8 length; |
3096 | u16 tmp, core, type, count, max, numb, last, cmd; | 3096 | u16 tmp, core, type, count, max, numb, last = 0, cmd; |
3097 | const u16 *table; | 3097 | const u16 *table; |
3098 | bool phy6or5x; | 3098 | bool phy6or5x; |
3099 | 3099 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c index 7e5e85a017b5..a7a4739880dc 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-lib.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965-lib.c | |||
@@ -628,11 +628,11 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv, | |||
628 | 628 | ||
629 | /* rx_status carries information about the packet to mac80211 */ | 629 | /* rx_status carries information about the packet to mac80211 */ |
630 | rx_status.mactime = le64_to_cpu(phy_res->timestamp); | 630 | rx_status.mactime = le64_to_cpu(phy_res->timestamp); |
631 | rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? | ||
632 | IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; | ||
631 | rx_status.freq = | 633 | rx_status.freq = |
632 | ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel), | 634 | ieee80211_channel_to_frequency(le16_to_cpu(phy_res->channel), |
633 | rx_status.band); | 635 | rx_status.band); |
634 | rx_status.band = (phy_res->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? | ||
635 | IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; | ||
636 | rx_status.rate_idx = | 636 | rx_status.rate_idx = |
637 | iwl4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band); | 637 | iwl4965_hwrate_to_mac80211_idx(rate_n_flags, rx_status.band); |
638 | rx_status.flag = 0; | 638 | rx_status.flag = 0; |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965.c b/drivers/net/wireless/iwlegacy/iwl-4965.c index f5433c74b845..facc94e74b07 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965.c +++ b/drivers/net/wireless/iwlegacy/iwl-4965.c | |||
@@ -1218,10 +1218,10 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c | |||
1218 | * receive commit_rxon request | 1218 | * receive commit_rxon request |
1219 | * abort any previous channel switch if still in process | 1219 | * abort any previous channel switch if still in process |
1220 | */ | 1220 | */ |
1221 | if (priv->switch_rxon.switch_in_progress && | 1221 | if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && |
1222 | (priv->switch_rxon.channel != ctx->staging.channel)) { | 1222 | (priv->switch_channel != ctx->staging.channel)) { |
1223 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", | 1223 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", |
1224 | le16_to_cpu(priv->switch_rxon.channel)); | 1224 | le16_to_cpu(priv->switch_channel)); |
1225 | iwl_legacy_chswitch_done(priv, false); | 1225 | iwl_legacy_chswitch_done(priv, false); |
1226 | } | 1226 | } |
1227 | 1227 | ||
@@ -1237,7 +1237,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c | |||
1237 | 1237 | ||
1238 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); | 1238 | memcpy(active_rxon, &ctx->staging, sizeof(*active_rxon)); |
1239 | iwl_legacy_print_rx_config_cmd(priv, ctx); | 1239 | iwl_legacy_print_rx_config_cmd(priv, ctx); |
1240 | return 0; | 1240 | goto set_tx_power; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | /* If we are currently associated and the new config requires | 1243 | /* If we are currently associated and the new config requires |
@@ -1317,6 +1317,7 @@ static int iwl4965_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *c | |||
1317 | 1317 | ||
1318 | iwl4965_init_sensitivity(priv); | 1318 | iwl4965_init_sensitivity(priv); |
1319 | 1319 | ||
1320 | set_tx_power: | ||
1320 | /* If we issue a new RXON command which required a tune then we must | 1321 | /* If we issue a new RXON command which required a tune then we must |
1321 | * send a new TXPOWER command or we won't be able to Tx any frames */ | 1322 | * send a new TXPOWER command or we won't be able to Tx any frames */ |
1322 | ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); | 1323 | ret = iwl_legacy_set_tx_power(priv, priv->tx_power_next, true); |
@@ -1403,9 +1404,6 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, | |||
1403 | return rc; | 1404 | return rc; |
1404 | } | 1405 | } |
1405 | 1406 | ||
1406 | priv->switch_rxon.channel = cmd.channel; | ||
1407 | priv->switch_rxon.switch_in_progress = true; | ||
1408 | |||
1409 | return iwl_legacy_send_cmd_pdu(priv, | 1407 | return iwl_legacy_send_cmd_pdu(priv, |
1410 | REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); | 1408 | REPLY_CHANNEL_SWITCH, sizeof(cmd), &cmd); |
1411 | } | 1409 | } |
@@ -1543,7 +1541,7 @@ static void iwl4965_temperature_calib(struct iwl_priv *priv) | |||
1543 | s32 temp; | 1541 | s32 temp; |
1544 | 1542 | ||
1545 | temp = iwl4965_hw_get_temperature(priv); | 1543 | temp = iwl4965_hw_get_temperature(priv); |
1546 | if (temp < 0) | 1544 | if (IWL_TX_POWER_TEMPERATURE_OUT_OF_RANGE(temp)) |
1547 | return; | 1545 | return; |
1548 | 1546 | ||
1549 | if (priv->temperature != temp) { | 1547 | if (priv->temperature != temp) { |
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c index 42df8321dae8..3be76bd5499a 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.c +++ b/drivers/net/wireless/iwlegacy/iwl-core.c | |||
@@ -859,12 +859,8 @@ void iwl_legacy_chswitch_done(struct iwl_priv *priv, bool is_success) | |||
859 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 859 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
860 | return; | 860 | return; |
861 | 861 | ||
862 | if (priv->switch_rxon.switch_in_progress) { | 862 | if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) |
863 | ieee80211_chswitch_done(ctx->vif, is_success); | 863 | ieee80211_chswitch_done(ctx->vif, is_success); |
864 | mutex_lock(&priv->mutex); | ||
865 | priv->switch_rxon.switch_in_progress = false; | ||
866 | mutex_unlock(&priv->mutex); | ||
867 | } | ||
868 | } | 864 | } |
869 | EXPORT_SYMBOL(iwl_legacy_chswitch_done); | 865 | EXPORT_SYMBOL(iwl_legacy_chswitch_done); |
870 | 866 | ||
@@ -876,19 +872,19 @@ void iwl_legacy_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
876 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | 872 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; |
877 | struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active; | 873 | struct iwl_legacy_rxon_cmd *rxon = (void *)&ctx->active; |
878 | 874 | ||
879 | if (priv->switch_rxon.switch_in_progress) { | 875 | if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) |
880 | if (!le32_to_cpu(csa->status) && | 876 | return; |
881 | (csa->channel == priv->switch_rxon.channel)) { | 877 | |
882 | rxon->channel = csa->channel; | 878 | if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { |
883 | ctx->staging.channel = csa->channel; | 879 | rxon->channel = csa->channel; |
884 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", | 880 | ctx->staging.channel = csa->channel; |
885 | le16_to_cpu(csa->channel)); | 881 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", |
886 | iwl_legacy_chswitch_done(priv, true); | ||
887 | } else { | ||
888 | IWL_ERR(priv, "CSA notif (fail) : channel %d\n", | ||
889 | le16_to_cpu(csa->channel)); | 882 | le16_to_cpu(csa->channel)); |
890 | iwl_legacy_chswitch_done(priv, false); | 883 | iwl_legacy_chswitch_done(priv, true); |
891 | } | 884 | } else { |
885 | IWL_ERR(priv, "CSA notif (fail) : channel %d\n", | ||
886 | le16_to_cpu(csa->channel)); | ||
887 | iwl_legacy_chswitch_done(priv, false); | ||
892 | } | 888 | } |
893 | } | 889 | } |
894 | EXPORT_SYMBOL(iwl_legacy_rx_csa); | 890 | EXPORT_SYMBOL(iwl_legacy_rx_csa); |
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.h b/drivers/net/wireless/iwlegacy/iwl-core.h index bc66c604106c..c5fbda0760de 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.h +++ b/drivers/net/wireless/iwlegacy/iwl-core.h | |||
@@ -560,7 +560,7 @@ void iwl_legacy_free_geos(struct iwl_priv *priv); | |||
560 | #define STATUS_SCAN_HW 15 | 560 | #define STATUS_SCAN_HW 15 |
561 | #define STATUS_POWER_PMI 16 | 561 | #define STATUS_POWER_PMI 16 |
562 | #define STATUS_FW_ERROR 17 | 562 | #define STATUS_FW_ERROR 17 |
563 | 563 | #define STATUS_CHANNEL_SWITCH_PENDING 18 | |
564 | 564 | ||
565 | static inline int iwl_legacy_is_ready(struct iwl_priv *priv) | 565 | static inline int iwl_legacy_is_ready(struct iwl_priv *priv) |
566 | { | 566 | { |
diff --git a/drivers/net/wireless/iwlegacy/iwl-dev.h b/drivers/net/wireless/iwlegacy/iwl-dev.h index be0106c6a2da..ea30122669ee 100644 --- a/drivers/net/wireless/iwlegacy/iwl-dev.h +++ b/drivers/net/wireless/iwlegacy/iwl-dev.h | |||
@@ -855,17 +855,6 @@ struct traffic_stats { | |||
855 | }; | 855 | }; |
856 | 856 | ||
857 | /* | 857 | /* |
858 | * iwl_switch_rxon: "channel switch" structure | ||
859 | * | ||
860 | * @ switch_in_progress: channel switch in progress | ||
861 | * @ channel: new channel | ||
862 | */ | ||
863 | struct iwl_switch_rxon { | ||
864 | bool switch_in_progress; | ||
865 | __le16 channel; | ||
866 | }; | ||
867 | |||
868 | /* | ||
869 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds | 858 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds |
870 | * to perform continuous uCode event logging operation if enabled | 859 | * to perform continuous uCode event logging operation if enabled |
871 | */ | 860 | */ |
@@ -1115,7 +1104,7 @@ struct iwl_priv { | |||
1115 | 1104 | ||
1116 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; | 1105 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; |
1117 | 1106 | ||
1118 | struct iwl_switch_rxon switch_rxon; | 1107 | __le16 switch_channel; |
1119 | 1108 | ||
1120 | /* 1st responses from initialize and runtime uCode images. | 1109 | /* 1st responses from initialize and runtime uCode images. |
1121 | * _4965's initialize alive response contains some calibration data. */ | 1110 | * _4965's initialize alive response contains some calibration data. */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c index af2ae22fcfd3..7157ba529680 100644 --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c | |||
@@ -2861,16 +2861,13 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, | |||
2861 | goto out; | 2861 | goto out; |
2862 | 2862 | ||
2863 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 2863 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || |
2864 | test_bit(STATUS_SCANNING, &priv->status)) | 2864 | test_bit(STATUS_SCANNING, &priv->status) || |
2865 | test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) | ||
2865 | goto out; | 2866 | goto out; |
2866 | 2867 | ||
2867 | if (!iwl_legacy_is_associated_ctx(ctx)) | 2868 | if (!iwl_legacy_is_associated_ctx(ctx)) |
2868 | goto out; | 2869 | goto out; |
2869 | 2870 | ||
2870 | /* channel switch in progress */ | ||
2871 | if (priv->switch_rxon.switch_in_progress == true) | ||
2872 | goto out; | ||
2873 | |||
2874 | if (priv->cfg->ops->lib->set_channel_switch) { | 2871 | if (priv->cfg->ops->lib->set_channel_switch) { |
2875 | 2872 | ||
2876 | ch = channel->hw_value; | 2873 | ch = channel->hw_value; |
@@ -2919,15 +2916,18 @@ void iwl4965_mac_channel_switch(struct ieee80211_hw *hw, | |||
2919 | * at this point, staging_rxon has the | 2916 | * at this point, staging_rxon has the |
2920 | * configuration for channel switch | 2917 | * configuration for channel switch |
2921 | */ | 2918 | */ |
2922 | if (priv->cfg->ops->lib->set_channel_switch(priv, | 2919 | set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); |
2923 | ch_switch)) | 2920 | priv->switch_channel = cpu_to_le16(ch); |
2924 | priv->switch_rxon.switch_in_progress = false; | 2921 | if (priv->cfg->ops->lib->set_channel_switch(priv, ch_switch)) { |
2922 | clear_bit(STATUS_CHANNEL_SWITCH_PENDING, | ||
2923 | &priv->status); | ||
2924 | priv->switch_channel = 0; | ||
2925 | ieee80211_chswitch_done(ctx->vif, false); | ||
2926 | } | ||
2925 | } | 2927 | } |
2926 | } | 2928 | } |
2927 | out: | 2929 | out: |
2928 | mutex_unlock(&priv->mutex); | 2930 | mutex_unlock(&priv->mutex); |
2929 | if (!priv->switch_rxon.switch_in_progress) | ||
2930 | ieee80211_chswitch_done(ctx->vif, false); | ||
2931 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 2931 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
2932 | } | 2932 | } |
2933 | 2933 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 86feec86d130..2282279cffc4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
@@ -177,79 +177,6 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv) | |||
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
180 | static int iwl2030_hw_channel_switch(struct iwl_priv *priv, | ||
181 | struct ieee80211_channel_switch *ch_switch) | ||
182 | { | ||
183 | /* | ||
184 | * MULTI-FIXME | ||
185 | * See iwl_mac_channel_switch. | ||
186 | */ | ||
187 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | ||
188 | struct iwl6000_channel_switch_cmd cmd; | ||
189 | const struct iwl_channel_info *ch_info; | ||
190 | u32 switch_time_in_usec, ucode_switch_time; | ||
191 | u16 ch; | ||
192 | u32 tsf_low; | ||
193 | u8 switch_count; | ||
194 | u16 beacon_interval = le16_to_cpu(ctx->timing.beacon_interval); | ||
195 | struct ieee80211_vif *vif = ctx->vif; | ||
196 | struct iwl_host_cmd hcmd = { | ||
197 | .id = REPLY_CHANNEL_SWITCH, | ||
198 | .len = { sizeof(cmd), }, | ||
199 | .flags = CMD_SYNC, | ||
200 | .data = { &cmd, }, | ||
201 | }; | ||
202 | |||
203 | cmd.band = priv->band == IEEE80211_BAND_2GHZ; | ||
204 | ch = ch_switch->channel->hw_value; | ||
205 | IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", | ||
206 | ctx->active.channel, ch); | ||
207 | cmd.channel = cpu_to_le16(ch); | ||
208 | cmd.rxon_flags = ctx->staging.flags; | ||
209 | cmd.rxon_filter_flags = ctx->staging.filter_flags; | ||
210 | switch_count = ch_switch->count; | ||
211 | tsf_low = ch_switch->timestamp & 0x0ffffffff; | ||
212 | /* | ||
213 | * calculate the ucode channel switch time | ||
214 | * adding TSF as one of the factor for when to switch | ||
215 | */ | ||
216 | if ((priv->ucode_beacon_time > tsf_low) && beacon_interval) { | ||
217 | if (switch_count > ((priv->ucode_beacon_time - tsf_low) / | ||
218 | beacon_interval)) { | ||
219 | switch_count -= (priv->ucode_beacon_time - | ||
220 | tsf_low) / beacon_interval; | ||
221 | } else | ||
222 | switch_count = 0; | ||
223 | } | ||
224 | if (switch_count <= 1) | ||
225 | cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); | ||
226 | else { | ||
227 | switch_time_in_usec = | ||
228 | vif->bss_conf.beacon_int * switch_count * TIME_UNIT; | ||
229 | ucode_switch_time = iwl_usecs_to_beacons(priv, | ||
230 | switch_time_in_usec, | ||
231 | beacon_interval); | ||
232 | cmd.switch_time = iwl_add_beacon_time(priv, | ||
233 | priv->ucode_beacon_time, | ||
234 | ucode_switch_time, | ||
235 | beacon_interval); | ||
236 | } | ||
237 | IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", | ||
238 | cmd.switch_time); | ||
239 | ch_info = iwl_get_channel_info(priv, priv->band, ch); | ||
240 | if (ch_info) | ||
241 | cmd.expect_beacon = is_channel_radar(ch_info); | ||
242 | else { | ||
243 | IWL_ERR(priv, "invalid channel switch from %u to %u\n", | ||
244 | ctx->active.channel, ch); | ||
245 | return -EFAULT; | ||
246 | } | ||
247 | priv->switch_rxon.channel = cmd.channel; | ||
248 | priv->switch_rxon.switch_in_progress = true; | ||
249 | |||
250 | return iwl_send_cmd_sync(priv, &hcmd); | ||
251 | } | ||
252 | |||
253 | static struct iwl_lib_ops iwl2000_lib = { | 180 | static struct iwl_lib_ops iwl2000_lib = { |
254 | .set_hw_params = iwl2000_hw_set_hw_params, | 181 | .set_hw_params = iwl2000_hw_set_hw_params, |
255 | .rx_handler_setup = iwlagn_rx_handler_setup, | 182 | .rx_handler_setup = iwlagn_rx_handler_setup, |
@@ -258,7 +185,6 @@ static struct iwl_lib_ops iwl2000_lib = { | |||
258 | .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, | 185 | .is_valid_rtc_data_addr = iwlagn_hw_valid_rtc_data_addr, |
259 | .send_tx_power = iwlagn_send_tx_power, | 186 | .send_tx_power = iwlagn_send_tx_power, |
260 | .update_chain_flags = iwl_update_chain_flags, | 187 | .update_chain_flags = iwl_update_chain_flags, |
261 | .set_channel_switch = iwl2030_hw_channel_switch, | ||
262 | .apm_ops = { | 188 | .apm_ops = { |
263 | .init = iwl_apm_init, | 189 | .init = iwl_apm_init, |
264 | .config = iwl2000_nic_config, | 190 | .config = iwl2000_nic_config, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index a70b8cfafda1..f99f9c193352 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -331,8 +331,6 @@ static int iwl5000_hw_channel_switch(struct iwl_priv *priv, | |||
331 | ctx->active.channel, ch); | 331 | ctx->active.channel, ch); |
332 | return -EFAULT; | 332 | return -EFAULT; |
333 | } | 333 | } |
334 | priv->switch_rxon.channel = cmd.channel; | ||
335 | priv->switch_rxon.switch_in_progress = true; | ||
336 | 334 | ||
337 | return iwl_send_cmd_sync(priv, &hcmd); | 335 | return iwl_send_cmd_sync(priv, &hcmd); |
338 | } | 336 | } |
@@ -425,7 +423,6 @@ static struct iwl_base_params iwl5000_base_params = { | |||
425 | }; | 423 | }; |
426 | static struct iwl_ht_params iwl5000_ht_params = { | 424 | static struct iwl_ht_params iwl5000_ht_params = { |
427 | .ht_greenfield_support = true, | 425 | .ht_greenfield_support = true, |
428 | .use_rts_for_aggregation = true, /* use rts/cts protection */ | ||
429 | }; | 426 | }; |
430 | 427 | ||
431 | #define IWL_DEVICE_5000 \ | 428 | #define IWL_DEVICE_5000 \ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index f8c710db6e6f..fbe565c816e3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -270,8 +270,6 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv, | |||
270 | ctx->active.channel, ch); | 270 | ctx->active.channel, ch); |
271 | return -EFAULT; | 271 | return -EFAULT; |
272 | } | 272 | } |
273 | priv->switch_rxon.channel = cmd.channel; | ||
274 | priv->switch_rxon.switch_in_progress = true; | ||
275 | 273 | ||
276 | return iwl_send_cmd_sync(priv, &hcmd); | 274 | return iwl_send_cmd_sync(priv, &hcmd); |
277 | } | 275 | } |
@@ -603,19 +601,27 @@ struct iwl_cfg iwl6050_2abg_cfg = { | |||
603 | IWL_DEVICE_6050, | 601 | IWL_DEVICE_6050, |
604 | }; | 602 | }; |
605 | 603 | ||
604 | #define IWL_DEVICE_6150 \ | ||
605 | .fw_name_pre = IWL6050_FW_PRE, \ | ||
606 | .ucode_api_max = IWL6050_UCODE_API_MAX, \ | ||
607 | .ucode_api_min = IWL6050_UCODE_API_MIN, \ | ||
608 | .ops = &iwl6150_ops, \ | ||
609 | .eeprom_ver = EEPROM_6150_EEPROM_VERSION, \ | ||
610 | .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, \ | ||
611 | .base_params = &iwl6050_base_params, \ | ||
612 | .need_dc_calib = true, \ | ||
613 | .led_mode = IWL_LED_BLINK, \ | ||
614 | .internal_wimax_coex = true | ||
615 | |||
606 | struct iwl_cfg iwl6150_bgn_cfg = { | 616 | struct iwl_cfg iwl6150_bgn_cfg = { |
607 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", | 617 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", |
608 | .fw_name_pre = IWL6050_FW_PRE, | 618 | IWL_DEVICE_6150, |
609 | .ucode_api_max = IWL6050_UCODE_API_MAX, | ||
610 | .ucode_api_min = IWL6050_UCODE_API_MIN, | ||
611 | .eeprom_ver = EEPROM_6150_EEPROM_VERSION, | ||
612 | .eeprom_calib_ver = EEPROM_6150_TX_POWER_VERSION, | ||
613 | .ops = &iwl6150_ops, | ||
614 | .base_params = &iwl6050_base_params, | ||
615 | .ht_params = &iwl6000_ht_params, | 619 | .ht_params = &iwl6000_ht_params, |
616 | .need_dc_calib = true, | 620 | }; |
617 | .led_mode = IWL_LED_RF_STATE, | 621 | |
618 | .internal_wimax_coex = true, | 622 | struct iwl_cfg iwl6150_bg_cfg = { |
623 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BG", | ||
624 | IWL_DEVICE_6150, | ||
619 | }; | 625 | }; |
620 | 626 | ||
621 | struct iwl_cfg iwl6000_3agn_cfg = { | 627 | struct iwl_cfg iwl6000_3agn_cfg = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c index b12c72d63ccb..23fa93deae96 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c | |||
@@ -163,17 +163,9 @@ static void iwlagn_tx_cmd_protection(struct iwl_priv *priv, | |||
163 | __le16 fc, __le32 *tx_flags) | 163 | __le16 fc, __le32 *tx_flags) |
164 | { | 164 | { |
165 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS || | 165 | if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS || |
166 | info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) { | 166 | info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT || |
167 | info->flags & IEEE80211_TX_CTL_AMPDU) | ||
167 | *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK; | 168 | *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK; |
168 | return; | ||
169 | } | ||
170 | |||
171 | if (priv->cfg->ht_params && | ||
172 | priv->cfg->ht_params->use_rts_for_aggregation && | ||
173 | info->flags & IEEE80211_TX_CTL_AMPDU) { | ||
174 | *tx_flags |= TX_CMD_FLG_PROT_REQUIRE_MSK; | ||
175 | return; | ||
176 | } | ||
177 | } | 169 | } |
178 | 170 | ||
179 | /* Calc max signal level (dBm) among 3 possible receivers */ | 171 | /* Calc max signal level (dBm) among 3 possible receivers */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c index a95ad84c5377..09f679d6046f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | |||
@@ -325,6 +325,14 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
327 | 327 | ||
328 | /* | ||
329 | * force CTS-to-self frames protection if RTS-CTS is not preferred | ||
330 | * one aggregation protection method | ||
331 | */ | ||
332 | if (!(priv->cfg->ht_params && | ||
333 | priv->cfg->ht_params->use_rts_for_aggregation)) | ||
334 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
335 | |||
328 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || | 336 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || |
329 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) | 337 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) |
330 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; | 338 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
@@ -342,10 +350,10 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
342 | * receive commit_rxon request | 350 | * receive commit_rxon request |
343 | * abort any previous channel switch if still in process | 351 | * abort any previous channel switch if still in process |
344 | */ | 352 | */ |
345 | if (priv->switch_rxon.switch_in_progress && | 353 | if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) && |
346 | (priv->switch_rxon.channel != ctx->staging.channel)) { | 354 | (priv->switch_channel != ctx->staging.channel)) { |
347 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", | 355 | IWL_DEBUG_11H(priv, "abort channel switch on %d\n", |
348 | le16_to_cpu(priv->switch_rxon.channel)); | 356 | le16_to_cpu(priv->switch_channel)); |
349 | iwl_chswitch_done(priv, false); | 357 | iwl_chswitch_done(priv, false); |
350 | } | 358 | } |
351 | 359 | ||
@@ -362,6 +370,11 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
362 | } | 370 | } |
363 | 371 | ||
364 | memcpy(active, &ctx->staging, sizeof(*active)); | 372 | memcpy(active, &ctx->staging, sizeof(*active)); |
373 | /* | ||
374 | * We do not commit tx power settings while channel changing, | ||
375 | * do it now if after settings changed. | ||
376 | */ | ||
377 | iwl_set_tx_power(priv, priv->tx_power_next, false); | ||
365 | return 0; | 378 | return 0; |
366 | } | 379 | } |
367 | 380 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 11c6c1169e78..8e1942ebd9a0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2843,16 +2843,13 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, | |||
2843 | goto out; | 2843 | goto out; |
2844 | 2844 | ||
2845 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 2845 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || |
2846 | test_bit(STATUS_SCANNING, &priv->status)) | 2846 | test_bit(STATUS_SCANNING, &priv->status) || |
2847 | test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) | ||
2847 | goto out; | 2848 | goto out; |
2848 | 2849 | ||
2849 | if (!iwl_is_associated_ctx(ctx)) | 2850 | if (!iwl_is_associated_ctx(ctx)) |
2850 | goto out; | 2851 | goto out; |
2851 | 2852 | ||
2852 | /* channel switch in progress */ | ||
2853 | if (priv->switch_rxon.switch_in_progress == true) | ||
2854 | goto out; | ||
2855 | |||
2856 | if (priv->cfg->ops->lib->set_channel_switch) { | 2853 | if (priv->cfg->ops->lib->set_channel_switch) { |
2857 | 2854 | ||
2858 | ch = channel->hw_value; | 2855 | ch = channel->hw_value; |
@@ -2901,15 +2898,19 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, | |||
2901 | * at this point, staging_rxon has the | 2898 | * at this point, staging_rxon has the |
2902 | * configuration for channel switch | 2899 | * configuration for channel switch |
2903 | */ | 2900 | */ |
2901 | set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status); | ||
2902 | priv->switch_channel = cpu_to_le16(ch); | ||
2904 | if (priv->cfg->ops->lib->set_channel_switch(priv, | 2903 | if (priv->cfg->ops->lib->set_channel_switch(priv, |
2905 | ch_switch)) | 2904 | ch_switch)) { |
2906 | priv->switch_rxon.switch_in_progress = false; | 2905 | clear_bit(STATUS_CHANNEL_SWITCH_PENDING, |
2906 | &priv->status); | ||
2907 | priv->switch_channel = 0; | ||
2908 | ieee80211_chswitch_done(ctx->vif, false); | ||
2909 | } | ||
2907 | } | 2910 | } |
2908 | } | 2911 | } |
2909 | out: | 2912 | out: |
2910 | mutex_unlock(&priv->mutex); | 2913 | mutex_unlock(&priv->mutex); |
2911 | if (!priv->switch_rxon.switch_in_progress) | ||
2912 | ieee80211_chswitch_done(ctx->vif, false); | ||
2913 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 2914 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
2914 | } | 2915 | } |
2915 | 2916 | ||
@@ -3831,11 +3832,11 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
3831 | 3832 | ||
3832 | /* 6150 WiFi/WiMax Series */ | 3833 | /* 6150 WiFi/WiMax Series */ |
3833 | {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, | 3834 | {IWL_PCI_DEVICE(0x0885, 0x1305, iwl6150_bgn_cfg)}, |
3834 | {IWL_PCI_DEVICE(0x0885, 0x1306, iwl6150_bgn_cfg)}, | 3835 | {IWL_PCI_DEVICE(0x0885, 0x1307, iwl6150_bg_cfg)}, |
3835 | {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, | 3836 | {IWL_PCI_DEVICE(0x0885, 0x1325, iwl6150_bgn_cfg)}, |
3836 | {IWL_PCI_DEVICE(0x0885, 0x1326, iwl6150_bgn_cfg)}, | 3837 | {IWL_PCI_DEVICE(0x0885, 0x1327, iwl6150_bg_cfg)}, |
3837 | {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, | 3838 | {IWL_PCI_DEVICE(0x0886, 0x1315, iwl6150_bgn_cfg)}, |
3838 | {IWL_PCI_DEVICE(0x0886, 0x1316, iwl6150_bgn_cfg)}, | 3839 | {IWL_PCI_DEVICE(0x0886, 0x1317, iwl6150_bg_cfg)}, |
3839 | 3840 | ||
3840 | /* 1000 Series WiFi */ | 3841 | /* 1000 Series WiFi */ |
3841 | {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, | 3842 | {IWL_PCI_DEVICE(0x0083, 0x1205, iwl1000_bgn_cfg)}, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index 2495fe7a58cb..d1716844002e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -89,6 +89,7 @@ extern struct iwl_cfg iwl6000_3agn_cfg; | |||
89 | extern struct iwl_cfg iwl6050_2agn_cfg; | 89 | extern struct iwl_cfg iwl6050_2agn_cfg; |
90 | extern struct iwl_cfg iwl6050_2abg_cfg; | 90 | extern struct iwl_cfg iwl6050_2abg_cfg; |
91 | extern struct iwl_cfg iwl6150_bgn_cfg; | 91 | extern struct iwl_cfg iwl6150_bgn_cfg; |
92 | extern struct iwl_cfg iwl6150_bg_cfg; | ||
92 | extern struct iwl_cfg iwl1000_bgn_cfg; | 93 | extern struct iwl_cfg iwl1000_bgn_cfg; |
93 | extern struct iwl_cfg iwl1000_bg_cfg; | 94 | extern struct iwl_cfg iwl1000_bg_cfg; |
94 | extern struct iwl_cfg iwl100_bgn_cfg; | 95 | extern struct iwl_cfg iwl100_bgn_cfg; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 4653deada05b..213c80c6a668 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -843,12 +843,8 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success) | |||
843 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 843 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
844 | return; | 844 | return; |
845 | 845 | ||
846 | if (priv->switch_rxon.switch_in_progress) { | 846 | if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) |
847 | ieee80211_chswitch_done(ctx->vif, is_success); | 847 | ieee80211_chswitch_done(ctx->vif, is_success); |
848 | mutex_lock(&priv->mutex); | ||
849 | priv->switch_rxon.switch_in_progress = false; | ||
850 | mutex_unlock(&priv->mutex); | ||
851 | } | ||
852 | } | 848 | } |
853 | 849 | ||
854 | #ifdef CONFIG_IWLWIFI_DEBUG | 850 | #ifdef CONFIG_IWLWIFI_DEBUG |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 3bb76f6ea410..a54d416ec345 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -560,6 +560,7 @@ void iwlcore_free_geos(struct iwl_priv *priv); | |||
560 | #define STATUS_POWER_PMI 16 | 560 | #define STATUS_POWER_PMI 16 |
561 | #define STATUS_FW_ERROR 17 | 561 | #define STATUS_FW_ERROR 17 |
562 | #define STATUS_DEVICE_ENABLED 18 | 562 | #define STATUS_DEVICE_ENABLED 18 |
563 | #define STATUS_CHANNEL_SWITCH_PENDING 19 | ||
563 | 564 | ||
564 | 565 | ||
565 | static inline int iwl_is_ready(struct iwl_priv *priv) | 566 | static inline int iwl_is_ready(struct iwl_priv *priv) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 22a6e3ec7094..c8de236c141b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -982,17 +982,6 @@ struct traffic_stats { | |||
982 | }; | 982 | }; |
983 | 983 | ||
984 | /* | 984 | /* |
985 | * iwl_switch_rxon: "channel switch" structure | ||
986 | * | ||
987 | * @ switch_in_progress: channel switch in progress | ||
988 | * @ channel: new channel | ||
989 | */ | ||
990 | struct iwl_switch_rxon { | ||
991 | bool switch_in_progress; | ||
992 | __le16 channel; | ||
993 | }; | ||
994 | |||
995 | /* | ||
996 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds | 985 | * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds |
997 | * to perform continuous uCode event logging operation if enabled | 986 | * to perform continuous uCode event logging operation if enabled |
998 | */ | 987 | */ |
@@ -1287,7 +1276,7 @@ struct iwl_priv { | |||
1287 | 1276 | ||
1288 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; | 1277 | struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX]; |
1289 | 1278 | ||
1290 | struct iwl_switch_rxon switch_rxon; | 1279 | __le16 switch_channel; |
1291 | 1280 | ||
1292 | struct { | 1281 | struct { |
1293 | u32 error_event_table; | 1282 | u32 error_event_table; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 0053e9ea9021..b774517aa9fa 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -250,19 +250,19 @@ static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) | |||
250 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; | 250 | struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; |
251 | struct iwl_rxon_cmd *rxon = (void *)&ctx->active; | 251 | struct iwl_rxon_cmd *rxon = (void *)&ctx->active; |
252 | 252 | ||
253 | if (priv->switch_rxon.switch_in_progress) { | 253 | if (!test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status)) |
254 | if (!le32_to_cpu(csa->status) && | 254 | return; |
255 | (csa->channel == priv->switch_rxon.channel)) { | 255 | |
256 | rxon->channel = csa->channel; | 256 | if (!le32_to_cpu(csa->status) && csa->channel == priv->switch_channel) { |
257 | ctx->staging.channel = csa->channel; | 257 | rxon->channel = csa->channel; |
258 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", | 258 | ctx->staging.channel = csa->channel; |
259 | le16_to_cpu(csa->channel)); | 259 | IWL_DEBUG_11H(priv, "CSA notif: channel %d\n", |
260 | iwl_chswitch_done(priv, true); | ||
261 | } else { | ||
262 | IWL_ERR(priv, "CSA notif (fail) : channel %d\n", | ||
263 | le16_to_cpu(csa->channel)); | 260 | le16_to_cpu(csa->channel)); |
264 | iwl_chswitch_done(priv, false); | 261 | iwl_chswitch_done(priv, true); |
265 | } | 262 | } else { |
263 | IWL_ERR(priv, "CSA notif (fail) : channel %d\n", | ||
264 | le16_to_cpu(csa->channel)); | ||
265 | iwl_chswitch_done(priv, false); | ||
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 84566db486d2..71c8f3fccfa1 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -994,6 +994,8 @@ static void lbs_submit_command(struct lbs_private *priv, | |||
994 | cmd = cmdnode->cmdbuf; | 994 | cmd = cmdnode->cmdbuf; |
995 | 995 | ||
996 | spin_lock_irqsave(&priv->driver_lock, flags); | 996 | spin_lock_irqsave(&priv->driver_lock, flags); |
997 | priv->seqnum++; | ||
998 | cmd->seqnum = cpu_to_le16(priv->seqnum); | ||
997 | priv->cur_cmd = cmdnode; | 999 | priv->cur_cmd = cmdnode; |
998 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 1000 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
999 | 1001 | ||
@@ -1621,11 +1623,9 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, | |||
1621 | /* Copy the incoming command to the buffer */ | 1623 | /* Copy the incoming command to the buffer */ |
1622 | memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); | 1624 | memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size); |
1623 | 1625 | ||
1624 | /* Set sequence number, clean result, move to buffer */ | 1626 | /* Set command, clean result, move to buffer */ |
1625 | priv->seqnum++; | ||
1626 | cmdnode->cmdbuf->command = cpu_to_le16(command); | 1627 | cmdnode->cmdbuf->command = cpu_to_le16(command); |
1627 | cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); | 1628 | cmdnode->cmdbuf->size = cpu_to_le16(in_cmd_size); |
1628 | cmdnode->cmdbuf->seqnum = cpu_to_le16(priv->seqnum); | ||
1629 | cmdnode->cmdbuf->result = 0; | 1629 | cmdnode->cmdbuf->result = 0; |
1630 | 1630 | ||
1631 | lbs_deb_host("PREP_CMD: command 0x%04x\n", command); | 1631 | lbs_deb_host("PREP_CMD: command 0x%04x\n", command); |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index a7b5cb0c2753..224e9853c480 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -907,7 +907,7 @@ static void if_sdio_interrupt(struct sdio_func *func) | |||
907 | card = sdio_get_drvdata(func); | 907 | card = sdio_get_drvdata(func); |
908 | 908 | ||
909 | cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret); | 909 | cause = sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret); |
910 | if (ret) | 910 | if (ret || !cause) |
911 | goto out; | 911 | goto out; |
912 | 912 | ||
913 | lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause); | 913 | lbs_deb_sdio("interrupt: 0x%X\n", (unsigned)cause); |
@@ -1008,10 +1008,6 @@ static int if_sdio_probe(struct sdio_func *func, | |||
1008 | if (ret) | 1008 | if (ret) |
1009 | goto release; | 1009 | goto release; |
1010 | 1010 | ||
1011 | ret = sdio_claim_irq(func, if_sdio_interrupt); | ||
1012 | if (ret) | ||
1013 | goto disable; | ||
1014 | |||
1015 | /* For 1-bit transfers to the 8686 model, we need to enable the | 1011 | /* For 1-bit transfers to the 8686 model, we need to enable the |
1016 | * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0 | 1012 | * interrupt flag in the CCCR register. Set the MMC_QUIRK_LENIENT_FN0 |
1017 | * bit to allow access to non-vendor registers. */ | 1013 | * bit to allow access to non-vendor registers. */ |
@@ -1083,6 +1079,21 @@ static int if_sdio_probe(struct sdio_func *func, | |||
1083 | card->rx_unit = 0; | 1079 | card->rx_unit = 0; |
1084 | 1080 | ||
1085 | /* | 1081 | /* |
1082 | * Set up the interrupt handler late. | ||
1083 | * | ||
1084 | * If we set it up earlier, the (buggy) hardware generates a spurious | ||
1085 | * interrupt, even before the interrupt has been enabled, with | ||
1086 | * CCCR_INTx = 0. | ||
1087 | * | ||
1088 | * We register the interrupt handler late so that we can handle any | ||
1089 | * spurious interrupts, and also to avoid generation of that known | ||
1090 | * spurious interrupt in the first place. | ||
1091 | */ | ||
1092 | ret = sdio_claim_irq(func, if_sdio_interrupt); | ||
1093 | if (ret) | ||
1094 | goto disable; | ||
1095 | |||
1096 | /* | ||
1086 | * Enable interrupts now that everything is set up | 1097 | * Enable interrupts now that everything is set up |
1087 | */ | 1098 | */ |
1088 | sdio_writeb(func, 0x0f, IF_SDIO_H_INT_MASK, &ret); | 1099 | sdio_writeb(func, 0x0f, IF_SDIO_H_INT_MASK, &ret); |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 660831ce293c..687c1f223497 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1288,6 +1288,8 @@ int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac, | |||
1288 | 1288 | ||
1289 | *(unsigned long *) wdev_priv = (unsigned long) priv; | 1289 | *(unsigned long *) wdev_priv = (unsigned long) priv; |
1290 | 1290 | ||
1291 | set_wiphy_dev(wdev->wiphy, (struct device *) priv->adapter->dev); | ||
1292 | |||
1291 | ret = wiphy_register(wdev->wiphy); | 1293 | ret = wiphy_register(wdev->wiphy); |
1292 | if (ret < 0) { | 1294 | if (ret < 0) { |
1293 | dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n", | 1295 | dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n", |
diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h index a0e9bc5253e0..4e97e90aa399 100644 --- a/drivers/net/wireless/mwifiex/sdio.h +++ b/drivers/net/wireless/mwifiex/sdio.h | |||
@@ -167,8 +167,8 @@ | |||
167 | /* Rx unit register */ | 167 | /* Rx unit register */ |
168 | #define CARD_RX_UNIT_REG 0x63 | 168 | #define CARD_RX_UNIT_REG 0x63 |
169 | 169 | ||
170 | /* Event header Len*/ | 170 | /* Event header len w/o 4 bytes of interface header */ |
171 | #define MWIFIEX_EVENT_HEADER_LEN 8 | 171 | #define MWIFIEX_EVENT_HEADER_LEN 4 |
172 | 172 | ||
173 | /* Max retry number of CMD53 write */ | 173 | /* Max retry number of CMD53 write */ |
174 | #define MAX_WRITE_IOMEM_RETRY 2 | 174 | #define MAX_WRITE_IOMEM_RETRY 2 |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 32261189bcef..aeac3cc4dbe4 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -2474,6 +2474,7 @@ struct mwl8k_cmd_set_hw_spec { | |||
2474 | * faster client. | 2474 | * faster client. |
2475 | */ | 2475 | */ |
2476 | #define MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY 0x00000400 | 2476 | #define MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY 0x00000400 |
2477 | #define MWL8K_SET_HW_SPEC_FLAG_GENERATE_CCMP_HDR 0x00000200 | ||
2477 | #define MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT 0x00000080 | 2478 | #define MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT 0x00000080 |
2478 | #define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP 0x00000020 | 2479 | #define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP 0x00000020 |
2479 | #define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON 0x00000010 | 2480 | #define MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON 0x00000010 |
@@ -2510,7 +2511,8 @@ static int mwl8k_cmd_set_hw_spec(struct ieee80211_hw *hw) | |||
2510 | cmd->flags = cpu_to_le32(MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT | | 2511 | cmd->flags = cpu_to_le32(MWL8K_SET_HW_SPEC_FLAG_HOST_DECR_MGMT | |
2511 | MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP | | 2512 | MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_PROBERESP | |
2512 | MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON | | 2513 | MWL8K_SET_HW_SPEC_FLAG_HOSTFORM_BEACON | |
2513 | MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY); | 2514 | MWL8K_SET_HW_SPEC_FLAG_ENABLE_LIFE_TIME_EXPIRY | |
2515 | MWL8K_SET_HW_SPEC_FLAG_GENERATE_CCMP_HDR); | ||
2514 | cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); | 2516 | cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS); |
2515 | cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); | 2517 | cmd->total_rxd = cpu_to_le32(MWL8K_RX_DESCS); |
2516 | 2518 | ||
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 9def1e5369a1..b2f8b8fd4d2d 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -166,7 +166,6 @@ config RT2800USB_RT35XX | |||
166 | config RT2800USB_RT53XX | 166 | config RT2800USB_RT53XX |
167 | bool "rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)" | 167 | bool "rt2800usb - Include support for rt53xx devices (EXPERIMENTAL)" |
168 | depends on EXPERIMENTAL | 168 | depends on EXPERIMENTAL |
169 | default y | ||
170 | ---help--- | 169 | ---help--- |
171 | This adds support for rt53xx wireless chipset family to the | 170 | This adds support for rt53xx wireless chipset family to the |
172 | rt2800pci driver. | 171 | rt2800pci driver. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index 555180d8f4aa..b704e5b183d0 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -250,7 +250,8 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | |||
250 | if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) | 250 | if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) |
251 | rt2x00link_reset_tuner(rt2x00dev, false); | 251 | rt2x00link_reset_tuner(rt2x00dev, false); |
252 | 252 | ||
253 | if (test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) && | 253 | if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) && |
254 | test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) && | ||
254 | (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) && | 255 | (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) && |
255 | (conf->flags & IEEE80211_CONF_PS)) { | 256 | (conf->flags & IEEE80211_CONF_PS)) { |
256 | beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon; | 257 | beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index c018d67aab8e..939821b4af2f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -146,6 +146,9 @@ static void rt2x00lib_autowakeup(struct work_struct *work) | |||
146 | struct rt2x00_dev *rt2x00dev = | 146 | struct rt2x00_dev *rt2x00dev = |
147 | container_of(work, struct rt2x00_dev, autowakeup_work.work); | 147 | container_of(work, struct rt2x00_dev, autowakeup_work.work); |
148 | 148 | ||
149 | if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) | ||
150 | return; | ||
151 | |||
149 | if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) | 152 | if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_AWAKE)) |
150 | ERROR(rt2x00dev, "Device failed to wakeup.\n"); | 153 | ERROR(rt2x00dev, "Device failed to wakeup.\n"); |
151 | clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); | 154 | clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags); |
@@ -1160,6 +1163,7 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1160 | * Stop all work. | 1163 | * Stop all work. |
1161 | */ | 1164 | */ |
1162 | cancel_work_sync(&rt2x00dev->intf_work); | 1165 | cancel_work_sync(&rt2x00dev->intf_work); |
1166 | cancel_delayed_work_sync(&rt2x00dev->autowakeup_work); | ||
1163 | if (rt2x00_is_usb(rt2x00dev)) { | 1167 | if (rt2x00_is_usb(rt2x00dev)) { |
1164 | del_timer_sync(&rt2x00dev->txstatus_timer); | 1168 | del_timer_sync(&rt2x00dev->txstatus_timer); |
1165 | cancel_work_sync(&rt2x00dev->rxdone_work); | 1169 | cancel_work_sync(&rt2x00dev->rxdone_work); |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index a40952845436..9f8ccae93317 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -669,6 +669,14 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
669 | &rx_status, | 669 | &rx_status, |
670 | (u8 *) pdesc, skb); | 670 | (u8 *) pdesc, skb); |
671 | 671 | ||
672 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); | ||
673 | if (unlikely(!new_skb)) { | ||
674 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), | ||
675 | DBG_DMESG, | ||
676 | ("can't alloc skb for rx\n")); | ||
677 | goto done; | ||
678 | } | ||
679 | |||
672 | pci_unmap_single(rtlpci->pdev, | 680 | pci_unmap_single(rtlpci->pdev, |
673 | *((dma_addr_t *) skb->cb), | 681 | *((dma_addr_t *) skb->cb), |
674 | rtlpci->rxbuffersize, | 682 | rtlpci->rxbuffersize, |
@@ -690,7 +698,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
690 | hdr = rtl_get_hdr(skb); | 698 | hdr = rtl_get_hdr(skb); |
691 | fc = rtl_get_fc(skb); | 699 | fc = rtl_get_fc(skb); |
692 | 700 | ||
693 | if (!stats.crc || !stats.hwerror) { | 701 | if (!stats.crc && !stats.hwerror) { |
694 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, | 702 | memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, |
695 | sizeof(rx_status)); | 703 | sizeof(rx_status)); |
696 | 704 | ||
@@ -758,15 +766,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) | |||
758 | rtl_lps_leave(hw); | 766 | rtl_lps_leave(hw); |
759 | } | 767 | } |
760 | 768 | ||
761 | new_skb = dev_alloc_skb(rtlpci->rxbuffersize); | ||
762 | if (unlikely(!new_skb)) { | ||
763 | RT_TRACE(rtlpriv, (COMP_INTR | COMP_RECV), | ||
764 | DBG_DMESG, | ||
765 | ("can't alloc skb for rx\n")); | ||
766 | goto done; | ||
767 | } | ||
768 | skb = new_skb; | 769 | skb = new_skb; |
769 | /*skb->dev = dev; */ | ||
770 | 770 | ||
771 | rtlpci->rx_ring[rx_queue_idx].rx_buf[rtlpci-> | 771 | rtlpci->rx_ring[rx_queue_idx].rx_buf[rtlpci-> |
772 | rx_ring | 772 | rx_ring |
@@ -1113,6 +1113,13 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw) | |||
1113 | 1113 | ||
1114 | rtlpci->rx_ring[rx_queue_idx].idx = 0; | 1114 | rtlpci->rx_ring[rx_queue_idx].idx = 0; |
1115 | 1115 | ||
1116 | /* If amsdu_8k is disabled, set buffersize to 4096. This | ||
1117 | * change will reduce memory fragmentation. | ||
1118 | */ | ||
1119 | if (rtlpci->rxbuffersize > 4096 && | ||
1120 | rtlpriv->rtlhal.disable_amsdu_8k) | ||
1121 | rtlpci->rxbuffersize = 4096; | ||
1122 | |||
1116 | for (i = 0; i < rtlpci->rxringcount; i++) { | 1123 | for (i = 0; i < rtlpci->rxringcount; i++) { |
1117 | struct sk_buff *skb = | 1124 | struct sk_buff *skb = |
1118 | dev_alloc_skb(rtlpci->rxbuffersize); | 1125 | dev_alloc_skb(rtlpci->rxbuffersize); |
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h index 1ab6c86aac40..c83fefb6662f 100644 --- a/drivers/net/wireless/wl12xx/conf.h +++ b/drivers/net/wireless/wl12xx/conf.h | |||
@@ -1157,6 +1157,9 @@ struct conf_sched_scan_settings { | |||
1157 | /* time to wait on the channel for passive scans (in TUs) */ | 1157 | /* time to wait on the channel for passive scans (in TUs) */ |
1158 | u32 dwell_time_passive; | 1158 | u32 dwell_time_passive; |
1159 | 1159 | ||
1160 | /* time to wait on the channel for DFS scans (in TUs) */ | ||
1161 | u32 dwell_time_dfs; | ||
1162 | |||
1160 | /* number of probe requests to send on each channel in active scans */ | 1163 | /* number of probe requests to send on each channel in active scans */ |
1161 | u8 num_probe_reqs; | 1164 | u8 num_probe_reqs; |
1162 | 1165 | ||
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index bc00e52f6445..e6497dc669df 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -311,6 +311,7 @@ static struct conf_drv_settings default_conf = { | |||
311 | .min_dwell_time_active = 8, | 311 | .min_dwell_time_active = 8, |
312 | .max_dwell_time_active = 30, | 312 | .max_dwell_time_active = 30, |
313 | .dwell_time_passive = 100, | 313 | .dwell_time_passive = 100, |
314 | .dwell_time_dfs = 150, | ||
314 | .num_probe_reqs = 2, | 315 | .num_probe_reqs = 2, |
315 | .rssi_threshold = -90, | 316 | .rssi_threshold = -90, |
316 | .snr_threshold = 0, | 317 | .snr_threshold = 0, |
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index f37e5a391976..56f76abc754d 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c | |||
@@ -331,16 +331,22 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, | |||
331 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; | 331 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; |
332 | int i, j; | 332 | int i, j; |
333 | u32 flags; | 333 | u32 flags; |
334 | bool force_passive = !req->n_ssids; | ||
334 | 335 | ||
335 | for (i = 0, j = start; | 336 | for (i = 0, j = start; |
336 | i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS; | 337 | i < req->n_channels && j < MAX_CHANNELS_ALL_BANDS; |
337 | i++) { | 338 | i++) { |
338 | flags = req->channels[i]->flags; | 339 | flags = req->channels[i]->flags; |
339 | 340 | ||
340 | if (!(flags & IEEE80211_CHAN_DISABLED) && | 341 | if (force_passive) |
341 | ((flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive) && | 342 | flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
342 | ((flags & IEEE80211_CHAN_RADAR) == radar) && | 343 | |
343 | (req->channels[i]->band == band)) { | 344 | if ((req->channels[i]->band == band) && |
345 | !(flags & IEEE80211_CHAN_DISABLED) && | ||
346 | (!!(flags & IEEE80211_CHAN_RADAR) == radar) && | ||
347 | /* if radar is set, we ignore the passive flag */ | ||
348 | (radar || | ||
349 | !!(flags & IEEE80211_CHAN_PASSIVE_SCAN) == passive)) { | ||
344 | wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ", | 350 | wl1271_debug(DEBUG_SCAN, "band %d, center_freq %d ", |
345 | req->channels[i]->band, | 351 | req->channels[i]->band, |
346 | req->channels[i]->center_freq); | 352 | req->channels[i]->center_freq); |
@@ -350,7 +356,12 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, | |||
350 | wl1271_debug(DEBUG_SCAN, "max_power %d", | 356 | wl1271_debug(DEBUG_SCAN, "max_power %d", |
351 | req->channels[i]->max_power); | 357 | req->channels[i]->max_power); |
352 | 358 | ||
353 | if (flags & IEEE80211_CHAN_PASSIVE_SCAN) { | 359 | if (flags & IEEE80211_CHAN_RADAR) { |
360 | channels[j].flags |= SCAN_CHANNEL_FLAGS_DFS; | ||
361 | channels[j].passive_duration = | ||
362 | cpu_to_le16(c->dwell_time_dfs); | ||
363 | } | ||
364 | else if (flags & IEEE80211_CHAN_PASSIVE_SCAN) { | ||
354 | channels[j].passive_duration = | 365 | channels[j].passive_duration = |
355 | cpu_to_le16(c->dwell_time_passive); | 366 | cpu_to_le16(c->dwell_time_passive); |
356 | } else { | 367 | } else { |
@@ -359,7 +370,7 @@ wl1271_scan_get_sched_scan_channels(struct wl1271 *wl, | |||
359 | channels[j].max_duration = | 370 | channels[j].max_duration = |
360 | cpu_to_le16(c->max_dwell_time_active); | 371 | cpu_to_le16(c->max_dwell_time_active); |
361 | } | 372 | } |
362 | channels[j].tx_power_att = req->channels[j]->max_power; | 373 | channels[j].tx_power_att = req->channels[i]->max_power; |
363 | channels[j].channel = req->channels[i]->hw_value; | 374 | channels[j].channel = req->channels[i]->hw_value; |
364 | 375 | ||
365 | j++; | 376 | j++; |
@@ -386,7 +397,11 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl, | |||
386 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 397 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
387 | IEEE80211_BAND_2GHZ, | 398 | IEEE80211_BAND_2GHZ, |
388 | false, false, idx); | 399 | false, false, idx); |
389 | idx += cfg->active[0]; | 400 | /* |
401 | * 5GHz channels always start at position 14, not immediately | ||
402 | * after the last 2.4GHz channel | ||
403 | */ | ||
404 | idx = 14; | ||
390 | 405 | ||
391 | cfg->passive[1] = | 406 | cfg->passive[1] = |
392 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 407 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
@@ -394,22 +409,23 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl, | |||
394 | false, true, idx); | 409 | false, true, idx); |
395 | idx += cfg->passive[1]; | 410 | idx += cfg->passive[1]; |
396 | 411 | ||
397 | cfg->active[1] = | 412 | cfg->dfs = |
398 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 413 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
399 | IEEE80211_BAND_5GHZ, | 414 | IEEE80211_BAND_5GHZ, |
400 | false, false, 14); | 415 | true, true, idx); |
401 | idx += cfg->active[1]; | 416 | idx += cfg->dfs; |
402 | 417 | ||
403 | cfg->dfs = | 418 | cfg->active[1] = |
404 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, | 419 | wl1271_scan_get_sched_scan_channels(wl, req, cfg->channels, |
405 | IEEE80211_BAND_5GHZ, | 420 | IEEE80211_BAND_5GHZ, |
406 | true, false, idx); | 421 | false, false, idx); |
407 | idx += cfg->dfs; | 422 | idx += cfg->active[1]; |
408 | 423 | ||
409 | wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", | 424 | wl1271_debug(DEBUG_SCAN, " 2.4GHz: active %d passive %d", |
410 | cfg->active[0], cfg->passive[0]); | 425 | cfg->active[0], cfg->passive[0]); |
411 | wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d", | 426 | wl1271_debug(DEBUG_SCAN, " 5GHz: active %d passive %d", |
412 | cfg->active[1], cfg->passive[1]); | 427 | cfg->active[1], cfg->passive[1]); |
428 | wl1271_debug(DEBUG_SCAN, " DFS: %d", cfg->dfs); | ||
413 | 429 | ||
414 | return idx; | 430 | return idx; |
415 | } | 431 | } |
@@ -421,6 +437,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
421 | struct wl1271_cmd_sched_scan_config *cfg = NULL; | 437 | struct wl1271_cmd_sched_scan_config *cfg = NULL; |
422 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; | 438 | struct conf_sched_scan_settings *c = &wl->conf.sched_scan; |
423 | int i, total_channels, ret; | 439 | int i, total_channels, ret; |
440 | bool force_passive = !req->n_ssids; | ||
424 | 441 | ||
425 | wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); | 442 | wl1271_debug(DEBUG_CMD, "cmd sched_scan scan config"); |
426 | 443 | ||
@@ -444,7 +461,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
444 | for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++) | 461 | for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++) |
445 | cfg->intervals[i] = cpu_to_le32(req->interval); | 462 | cfg->intervals[i] = cpu_to_le32(req->interval); |
446 | 463 | ||
447 | if (req->ssids[0].ssid_len && req->ssids[0].ssid) { | 464 | if (!force_passive && req->ssids[0].ssid_len && req->ssids[0].ssid) { |
448 | cfg->filter_type = SCAN_SSID_FILTER_SPECIFIC; | 465 | cfg->filter_type = SCAN_SSID_FILTER_SPECIFIC; |
449 | cfg->ssid_len = req->ssids[0].ssid_len; | 466 | cfg->ssid_len = req->ssids[0].ssid_len; |
450 | memcpy(cfg->ssid, req->ssids[0].ssid, | 467 | memcpy(cfg->ssid, req->ssids[0].ssid, |
@@ -461,7 +478,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
461 | goto out; | 478 | goto out; |
462 | } | 479 | } |
463 | 480 | ||
464 | if (cfg->active[0]) { | 481 | if (!force_passive && cfg->active[0]) { |
465 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, | 482 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, |
466 | req->ssids[0].ssid_len, | 483 | req->ssids[0].ssid_len, |
467 | ies->ie[IEEE80211_BAND_2GHZ], | 484 | ies->ie[IEEE80211_BAND_2GHZ], |
@@ -473,7 +490,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, | |||
473 | } | 490 | } |
474 | } | 491 | } |
475 | 492 | ||
476 | if (cfg->active[1]) { | 493 | if (!force_passive && cfg->active[1]) { |
477 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, | 494 | ret = wl1271_cmd_build_probe_req(wl, req->ssids[0].ssid, |
478 | req->ssids[0].ssid_len, | 495 | req->ssids[0].ssid_len, |
479 | ies->ie[IEEE80211_BAND_5GHZ], | 496 | ies->ie[IEEE80211_BAND_5GHZ], |
diff --git a/drivers/net/wireless/wl12xx/scan.h b/drivers/net/wireless/wl12xx/scan.h index c83319579ca3..a0b6c5d67b07 100644 --- a/drivers/net/wireless/wl12xx/scan.h +++ b/drivers/net/wireless/wl12xx/scan.h | |||
@@ -137,6 +137,9 @@ enum { | |||
137 | SCAN_BSS_TYPE_ANY, | 137 | SCAN_BSS_TYPE_ANY, |
138 | }; | 138 | }; |
139 | 139 | ||
140 | #define SCAN_CHANNEL_FLAGS_DFS BIT(0) | ||
141 | #define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1) | ||
142 | |||
140 | struct conn_scan_ch_params { | 143 | struct conn_scan_ch_params { |
141 | __le16 min_duration; | 144 | __le16 min_duration; |
142 | __le16 max_duration; | 145 | __le16 max_duration; |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 0e819943b9e4..631194d49828 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -1533,6 +1533,31 @@ static void __exit usb_exit(void) | |||
1533 | module_init(usb_init); | 1533 | module_init(usb_init); |
1534 | module_exit(usb_exit); | 1534 | module_exit(usb_exit); |
1535 | 1535 | ||
1536 | static int zd_ep_regs_out_msg(struct usb_device *udev, void *data, int len, | ||
1537 | int *actual_length, int timeout) | ||
1538 | { | ||
1539 | /* In USB 2.0 mode EP_REGS_OUT endpoint is interrupt type. However in | ||
1540 | * USB 1.1 mode endpoint is bulk. Select correct type URB by endpoint | ||
1541 | * descriptor. | ||
1542 | */ | ||
1543 | struct usb_host_endpoint *ep; | ||
1544 | unsigned int pipe; | ||
1545 | |||
1546 | pipe = usb_sndintpipe(udev, EP_REGS_OUT); | ||
1547 | ep = usb_pipe_endpoint(udev, pipe); | ||
1548 | if (!ep) | ||
1549 | return -EINVAL; | ||
1550 | |||
1551 | if (usb_endpoint_xfer_int(&ep->desc)) { | ||
1552 | return usb_interrupt_msg(udev, pipe, data, len, | ||
1553 | actual_length, timeout); | ||
1554 | } else { | ||
1555 | pipe = usb_sndbulkpipe(udev, EP_REGS_OUT); | ||
1556 | return usb_bulk_msg(udev, pipe, data, len, actual_length, | ||
1557 | timeout); | ||
1558 | } | ||
1559 | } | ||
1560 | |||
1536 | static int usb_int_regs_length(unsigned int count) | 1561 | static int usb_int_regs_length(unsigned int count) |
1537 | { | 1562 | { |
1538 | return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data); | 1563 | return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data); |
@@ -1648,15 +1673,14 @@ int zd_usb_ioread16v(struct zd_usb *usb, u16 *values, | |||
1648 | 1673 | ||
1649 | udev = zd_usb_to_usbdev(usb); | 1674 | udev = zd_usb_to_usbdev(usb); |
1650 | prepare_read_regs_int(usb); | 1675 | prepare_read_regs_int(usb); |
1651 | r = usb_interrupt_msg(udev, usb_sndintpipe(udev, EP_REGS_OUT), | 1676 | r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/); |
1652 | req, req_len, &actual_req_len, 50 /* ms */); | ||
1653 | if (r) { | 1677 | if (r) { |
1654 | dev_dbg_f(zd_usb_dev(usb), | 1678 | dev_dbg_f(zd_usb_dev(usb), |
1655 | "error in usb_interrupt_msg(). Error number %d\n", r); | 1679 | "error in zd_ep_regs_out_msg(). Error number %d\n", r); |
1656 | goto error; | 1680 | goto error; |
1657 | } | 1681 | } |
1658 | if (req_len != actual_req_len) { | 1682 | if (req_len != actual_req_len) { |
1659 | dev_dbg_f(zd_usb_dev(usb), "error in usb_interrupt_msg()\n" | 1683 | dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()\n" |
1660 | " req_len %d != actual_req_len %d\n", | 1684 | " req_len %d != actual_req_len %d\n", |
1661 | req_len, actual_req_len); | 1685 | req_len, actual_req_len); |
1662 | r = -EIO; | 1686 | r = -EIO; |
@@ -1818,9 +1842,17 @@ int zd_usb_iowrite16v_async(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, | |||
1818 | rw->value = cpu_to_le16(ioreqs[i].value); | 1842 | rw->value = cpu_to_le16(ioreqs[i].value); |
1819 | } | 1843 | } |
1820 | 1844 | ||
1821 | usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), | 1845 | /* In USB 2.0 mode endpoint is interrupt type. However in USB 1.1 mode |
1822 | req, req_len, iowrite16v_urb_complete, usb, | 1846 | * endpoint is bulk. Select correct type URB by endpoint descriptor. |
1823 | ep->desc.bInterval); | 1847 | */ |
1848 | if (usb_endpoint_xfer_int(&ep->desc)) | ||
1849 | usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), | ||
1850 | req, req_len, iowrite16v_urb_complete, usb, | ||
1851 | ep->desc.bInterval); | ||
1852 | else | ||
1853 | usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_REGS_OUT), | ||
1854 | req, req_len, iowrite16v_urb_complete, usb); | ||
1855 | |||
1824 | urb->transfer_flags |= URB_FREE_BUFFER; | 1856 | urb->transfer_flags |= URB_FREE_BUFFER; |
1825 | 1857 | ||
1826 | /* Submit previous URB */ | 1858 | /* Submit previous URB */ |
@@ -1924,15 +1956,14 @@ int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits) | |||
1924 | } | 1956 | } |
1925 | 1957 | ||
1926 | udev = zd_usb_to_usbdev(usb); | 1958 | udev = zd_usb_to_usbdev(usb); |
1927 | r = usb_interrupt_msg(udev, usb_sndintpipe(udev, EP_REGS_OUT), | 1959 | r = zd_ep_regs_out_msg(udev, req, req_len, &actual_req_len, 50 /*ms*/); |
1928 | req, req_len, &actual_req_len, 50 /* ms */); | ||
1929 | if (r) { | 1960 | if (r) { |
1930 | dev_dbg_f(zd_usb_dev(usb), | 1961 | dev_dbg_f(zd_usb_dev(usb), |
1931 | "error in usb_interrupt_msg(). Error number %d\n", r); | 1962 | "error in zd_ep_regs_out_msg(). Error number %d\n", r); |
1932 | goto out; | 1963 | goto out; |
1933 | } | 1964 | } |
1934 | if (req_len != actual_req_len) { | 1965 | if (req_len != actual_req_len) { |
1935 | dev_dbg_f(zd_usb_dev(usb), "error in usb_interrupt_msg()" | 1966 | dev_dbg_f(zd_usb_dev(usb), "error in zd_ep_regs_out_msg()" |
1936 | " req_len %d != actual_req_len %d\n", | 1967 | " req_len %d != actual_req_len %d\n", |
1937 | req_len, actual_req_len); | 1968 | req_len, actual_req_len); |
1938 | r = -EIO; | 1969 | r = -EIO; |
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index a3984f4ef192..f34b5b29fb95 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c | |||
@@ -141,6 +141,13 @@ static struct notifier_block module_load_nb = { | |||
141 | .notifier_call = module_load_notify, | 141 | .notifier_call = module_load_notify, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static void free_all_tasks(void) | ||
145 | { | ||
146 | /* make sure we don't leak task structs */ | ||
147 | process_task_mortuary(); | ||
148 | process_task_mortuary(); | ||
149 | } | ||
150 | |||
144 | int sync_start(void) | 151 | int sync_start(void) |
145 | { | 152 | { |
146 | int err; | 153 | int err; |
@@ -148,8 +155,6 @@ int sync_start(void) | |||
148 | if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL)) | 155 | if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL)) |
149 | return -ENOMEM; | 156 | return -ENOMEM; |
150 | 157 | ||
151 | mutex_lock(&buffer_mutex); | ||
152 | |||
153 | err = task_handoff_register(&task_free_nb); | 158 | err = task_handoff_register(&task_free_nb); |
154 | if (err) | 159 | if (err) |
155 | goto out1; | 160 | goto out1; |
@@ -166,7 +171,6 @@ int sync_start(void) | |||
166 | start_cpu_work(); | 171 | start_cpu_work(); |
167 | 172 | ||
168 | out: | 173 | out: |
169 | mutex_unlock(&buffer_mutex); | ||
170 | return err; | 174 | return err; |
171 | out4: | 175 | out4: |
172 | profile_event_unregister(PROFILE_MUNMAP, &munmap_nb); | 176 | profile_event_unregister(PROFILE_MUNMAP, &munmap_nb); |
@@ -174,6 +178,7 @@ out3: | |||
174 | profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); | 178 | profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); |
175 | out2: | 179 | out2: |
176 | task_handoff_unregister(&task_free_nb); | 180 | task_handoff_unregister(&task_free_nb); |
181 | free_all_tasks(); | ||
177 | out1: | 182 | out1: |
178 | free_cpumask_var(marked_cpus); | 183 | free_cpumask_var(marked_cpus); |
179 | goto out; | 184 | goto out; |
@@ -182,20 +187,16 @@ out1: | |||
182 | 187 | ||
183 | void sync_stop(void) | 188 | void sync_stop(void) |
184 | { | 189 | { |
185 | /* flush buffers */ | ||
186 | mutex_lock(&buffer_mutex); | ||
187 | end_cpu_work(); | 190 | end_cpu_work(); |
188 | unregister_module_notifier(&module_load_nb); | 191 | unregister_module_notifier(&module_load_nb); |
189 | profile_event_unregister(PROFILE_MUNMAP, &munmap_nb); | 192 | profile_event_unregister(PROFILE_MUNMAP, &munmap_nb); |
190 | profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); | 193 | profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb); |
191 | task_handoff_unregister(&task_free_nb); | 194 | task_handoff_unregister(&task_free_nb); |
192 | mutex_unlock(&buffer_mutex); | 195 | barrier(); /* do all of the above first */ |
193 | flush_cpu_work(); | ||
194 | 196 | ||
195 | /* make sure we don't leak task structs */ | 197 | flush_cpu_work(); |
196 | process_task_mortuary(); | ||
197 | process_task_mortuary(); | ||
198 | 198 | ||
199 | free_all_tasks(); | ||
199 | free_cpumask_var(marked_cpus); | 200 | free_cpumask_var(marked_cpus); |
200 | } | 201 | } |
201 | 202 | ||
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index c85f744270a5..094308e41be5 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
@@ -51,6 +51,7 @@ obj-$(CONFIG_X86_VISWS) += setup-irq.o | |||
51 | obj-$(CONFIG_MN10300) += setup-bus.o | 51 | obj-$(CONFIG_MN10300) += setup-bus.o |
52 | obj-$(CONFIG_MICROBLAZE) += setup-bus.o | 52 | obj-$(CONFIG_MICROBLAZE) += setup-bus.o |
53 | obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o | 53 | obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o |
54 | obj-$(CONFIG_SPARC_LEON) += setup-bus.o setup-irq.o | ||
54 | 55 | ||
55 | # | 56 | # |
56 | # ACPI Related PCI FW Functions | 57 | # ACPI Related PCI FW Functions |
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 12e02bf92c4a..3dc9befa5aec 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
@@ -698,12 +698,7 @@ int __init detect_intel_iommu(void) | |||
698 | { | 698 | { |
699 | #ifdef CONFIG_INTR_REMAP | 699 | #ifdef CONFIG_INTR_REMAP |
700 | struct acpi_table_dmar *dmar; | 700 | struct acpi_table_dmar *dmar; |
701 | /* | 701 | |
702 | * for now we will disable dma-remapping when interrupt | ||
703 | * remapping is enabled. | ||
704 | * When support for queued invalidation for IOTLB invalidation | ||
705 | * is added, we will not need this any more. | ||
706 | */ | ||
707 | dmar = (struct acpi_table_dmar *) dmar_tbl; | 702 | dmar = (struct acpi_table_dmar *) dmar_tbl; |
708 | if (ret && cpu_has_x2apic && dmar->flags & 0x1) | 703 | if (ret && cpu_has_x2apic && dmar->flags & 0x1) |
709 | printk(KERN_INFO | 704 | printk(KERN_INFO |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 6af6b628175b..f02c34d26d1b 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -47,6 +47,8 @@ | |||
47 | #define ROOT_SIZE VTD_PAGE_SIZE | 47 | #define ROOT_SIZE VTD_PAGE_SIZE |
48 | #define CONTEXT_SIZE VTD_PAGE_SIZE | 48 | #define CONTEXT_SIZE VTD_PAGE_SIZE |
49 | 49 | ||
50 | #define IS_BRIDGE_HOST_DEVICE(pdev) \ | ||
51 | ((pdev->class >> 8) == PCI_CLASS_BRIDGE_HOST) | ||
50 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) | 52 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) |
51 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) | 53 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) |
52 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) | 54 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) |
@@ -116,6 +118,11 @@ static inline unsigned long align_to_level(unsigned long pfn, int level) | |||
116 | return (pfn + level_size(level) - 1) & level_mask(level); | 118 | return (pfn + level_size(level) - 1) & level_mask(level); |
117 | } | 119 | } |
118 | 120 | ||
121 | static inline unsigned long lvl_to_nr_pages(unsigned int lvl) | ||
122 | { | ||
123 | return 1 << ((lvl - 1) * LEVEL_STRIDE); | ||
124 | } | ||
125 | |||
119 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things | 126 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things |
120 | are never going to work. */ | 127 | are never going to work. */ |
121 | static inline unsigned long dma_to_mm_pfn(unsigned long dma_pfn) | 128 | static inline unsigned long dma_to_mm_pfn(unsigned long dma_pfn) |
@@ -143,6 +150,12 @@ static void __init check_tylersburg_isoch(void); | |||
143 | static int rwbf_quirk; | 150 | static int rwbf_quirk; |
144 | 151 | ||
145 | /* | 152 | /* |
153 | * set to 1 to panic kernel if can't successfully enable VT-d | ||
154 | * (used when kernel is launched w/ TXT) | ||
155 | */ | ||
156 | static int force_on = 0; | ||
157 | |||
158 | /* | ||
146 | * 0: Present | 159 | * 0: Present |
147 | * 1-11: Reserved | 160 | * 1-11: Reserved |
148 | * 12-63: Context Ptr (12 - (haw-1)) | 161 | * 12-63: Context Ptr (12 - (haw-1)) |
@@ -338,6 +351,9 @@ struct dmar_domain { | |||
338 | int iommu_coherency;/* indicate coherency of iommu access */ | 351 | int iommu_coherency;/* indicate coherency of iommu access */ |
339 | int iommu_snooping; /* indicate snooping control feature*/ | 352 | int iommu_snooping; /* indicate snooping control feature*/ |
340 | int iommu_count; /* reference count of iommu */ | 353 | int iommu_count; /* reference count of iommu */ |
354 | int iommu_superpage;/* Level of superpages supported: | ||
355 | 0 == 4KiB (no superpages), 1 == 2MiB, | ||
356 | 2 == 1GiB, 3 == 512GiB, 4 == 1TiB */ | ||
341 | spinlock_t iommu_lock; /* protect iommu set in domain */ | 357 | spinlock_t iommu_lock; /* protect iommu set in domain */ |
342 | u64 max_addr; /* maximum mapped address */ | 358 | u64 max_addr; /* maximum mapped address */ |
343 | }; | 359 | }; |
@@ -387,6 +403,7 @@ int dmar_disabled = 1; | |||
387 | static int dmar_map_gfx = 1; | 403 | static int dmar_map_gfx = 1; |
388 | static int dmar_forcedac; | 404 | static int dmar_forcedac; |
389 | static int intel_iommu_strict; | 405 | static int intel_iommu_strict; |
406 | static int intel_iommu_superpage = 1; | ||
390 | 407 | ||
391 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) | 408 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) |
392 | static DEFINE_SPINLOCK(device_domain_lock); | 409 | static DEFINE_SPINLOCK(device_domain_lock); |
@@ -417,6 +434,10 @@ static int __init intel_iommu_setup(char *str) | |||
417 | printk(KERN_INFO | 434 | printk(KERN_INFO |
418 | "Intel-IOMMU: disable batched IOTLB flush\n"); | 435 | "Intel-IOMMU: disable batched IOTLB flush\n"); |
419 | intel_iommu_strict = 1; | 436 | intel_iommu_strict = 1; |
437 | } else if (!strncmp(str, "sp_off", 6)) { | ||
438 | printk(KERN_INFO | ||
439 | "Intel-IOMMU: disable supported super page\n"); | ||
440 | intel_iommu_superpage = 0; | ||
420 | } | 441 | } |
421 | 442 | ||
422 | str += strcspn(str, ","); | 443 | str += strcspn(str, ","); |
@@ -555,11 +576,32 @@ static void domain_update_iommu_snooping(struct dmar_domain *domain) | |||
555 | } | 576 | } |
556 | } | 577 | } |
557 | 578 | ||
579 | static void domain_update_iommu_superpage(struct dmar_domain *domain) | ||
580 | { | ||
581 | int i, mask = 0xf; | ||
582 | |||
583 | if (!intel_iommu_superpage) { | ||
584 | domain->iommu_superpage = 0; | ||
585 | return; | ||
586 | } | ||
587 | |||
588 | domain->iommu_superpage = 4; /* 1TiB */ | ||
589 | |||
590 | for_each_set_bit(i, &domain->iommu_bmp, g_num_of_iommus) { | ||
591 | mask |= cap_super_page_val(g_iommus[i]->cap); | ||
592 | if (!mask) { | ||
593 | break; | ||
594 | } | ||
595 | } | ||
596 | domain->iommu_superpage = fls(mask); | ||
597 | } | ||
598 | |||
558 | /* Some capabilities may be different across iommus */ | 599 | /* Some capabilities may be different across iommus */ |
559 | static void domain_update_iommu_cap(struct dmar_domain *domain) | 600 | static void domain_update_iommu_cap(struct dmar_domain *domain) |
560 | { | 601 | { |
561 | domain_update_iommu_coherency(domain); | 602 | domain_update_iommu_coherency(domain); |
562 | domain_update_iommu_snooping(domain); | 603 | domain_update_iommu_snooping(domain); |
604 | domain_update_iommu_superpage(domain); | ||
563 | } | 605 | } |
564 | 606 | ||
565 | static struct intel_iommu *device_to_iommu(int segment, u8 bus, u8 devfn) | 607 | static struct intel_iommu *device_to_iommu(int segment, u8 bus, u8 devfn) |
@@ -689,23 +731,31 @@ out: | |||
689 | } | 731 | } |
690 | 732 | ||
691 | static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, | 733 | static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, |
692 | unsigned long pfn) | 734 | unsigned long pfn, int large_level) |
693 | { | 735 | { |
694 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; | 736 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; |
695 | struct dma_pte *parent, *pte = NULL; | 737 | struct dma_pte *parent, *pte = NULL; |
696 | int level = agaw_to_level(domain->agaw); | 738 | int level = agaw_to_level(domain->agaw); |
697 | int offset; | 739 | int offset, target_level; |
698 | 740 | ||
699 | BUG_ON(!domain->pgd); | 741 | BUG_ON(!domain->pgd); |
700 | BUG_ON(addr_width < BITS_PER_LONG && pfn >> addr_width); | 742 | BUG_ON(addr_width < BITS_PER_LONG && pfn >> addr_width); |
701 | parent = domain->pgd; | 743 | parent = domain->pgd; |
702 | 744 | ||
745 | /* Search pte */ | ||
746 | if (!large_level) | ||
747 | target_level = 1; | ||
748 | else | ||
749 | target_level = large_level; | ||
750 | |||
703 | while (level > 0) { | 751 | while (level > 0) { |
704 | void *tmp_page; | 752 | void *tmp_page; |
705 | 753 | ||
706 | offset = pfn_level_offset(pfn, level); | 754 | offset = pfn_level_offset(pfn, level); |
707 | pte = &parent[offset]; | 755 | pte = &parent[offset]; |
708 | if (level == 1) | 756 | if (!large_level && (pte->val & DMA_PTE_LARGE_PAGE)) |
757 | break; | ||
758 | if (level == target_level) | ||
709 | break; | 759 | break; |
710 | 760 | ||
711 | if (!dma_pte_present(pte)) { | 761 | if (!dma_pte_present(pte)) { |
@@ -733,10 +783,11 @@ static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, | |||
733 | return pte; | 783 | return pte; |
734 | } | 784 | } |
735 | 785 | ||
786 | |||
736 | /* return address's pte at specific level */ | 787 | /* return address's pte at specific level */ |
737 | static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain, | 788 | static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain, |
738 | unsigned long pfn, | 789 | unsigned long pfn, |
739 | int level) | 790 | int level, int *large_page) |
740 | { | 791 | { |
741 | struct dma_pte *parent, *pte = NULL; | 792 | struct dma_pte *parent, *pte = NULL; |
742 | int total = agaw_to_level(domain->agaw); | 793 | int total = agaw_to_level(domain->agaw); |
@@ -749,8 +800,16 @@ static struct dma_pte *dma_pfn_level_pte(struct dmar_domain *domain, | |||
749 | if (level == total) | 800 | if (level == total) |
750 | return pte; | 801 | return pte; |
751 | 802 | ||
752 | if (!dma_pte_present(pte)) | 803 | if (!dma_pte_present(pte)) { |
804 | *large_page = total; | ||
753 | break; | 805 | break; |
806 | } | ||
807 | |||
808 | if (pte->val & DMA_PTE_LARGE_PAGE) { | ||
809 | *large_page = total; | ||
810 | return pte; | ||
811 | } | ||
812 | |||
754 | parent = phys_to_virt(dma_pte_addr(pte)); | 813 | parent = phys_to_virt(dma_pte_addr(pte)); |
755 | total--; | 814 | total--; |
756 | } | 815 | } |
@@ -763,6 +822,7 @@ static void dma_pte_clear_range(struct dmar_domain *domain, | |||
763 | unsigned long last_pfn) | 822 | unsigned long last_pfn) |
764 | { | 823 | { |
765 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; | 824 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; |
825 | unsigned int large_page = 1; | ||
766 | struct dma_pte *first_pte, *pte; | 826 | struct dma_pte *first_pte, *pte; |
767 | 827 | ||
768 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); | 828 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); |
@@ -771,14 +831,15 @@ static void dma_pte_clear_range(struct dmar_domain *domain, | |||
771 | 831 | ||
772 | /* we don't need lock here; nobody else touches the iova range */ | 832 | /* we don't need lock here; nobody else touches the iova range */ |
773 | do { | 833 | do { |
774 | first_pte = pte = dma_pfn_level_pte(domain, start_pfn, 1); | 834 | large_page = 1; |
835 | first_pte = pte = dma_pfn_level_pte(domain, start_pfn, 1, &large_page); | ||
775 | if (!pte) { | 836 | if (!pte) { |
776 | start_pfn = align_to_level(start_pfn + 1, 2); | 837 | start_pfn = align_to_level(start_pfn + 1, large_page + 1); |
777 | continue; | 838 | continue; |
778 | } | 839 | } |
779 | do { | 840 | do { |
780 | dma_clear_pte(pte); | 841 | dma_clear_pte(pte); |
781 | start_pfn++; | 842 | start_pfn += lvl_to_nr_pages(large_page); |
782 | pte++; | 843 | pte++; |
783 | } while (start_pfn <= last_pfn && !first_pte_in_page(pte)); | 844 | } while (start_pfn <= last_pfn && !first_pte_in_page(pte)); |
784 | 845 | ||
@@ -798,6 +859,7 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain, | |||
798 | int total = agaw_to_level(domain->agaw); | 859 | int total = agaw_to_level(domain->agaw); |
799 | int level; | 860 | int level; |
800 | unsigned long tmp; | 861 | unsigned long tmp; |
862 | int large_page = 2; | ||
801 | 863 | ||
802 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); | 864 | BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); |
803 | BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width); | 865 | BUG_ON(addr_width < BITS_PER_LONG && last_pfn >> addr_width); |
@@ -813,7 +875,10 @@ static void dma_pte_free_pagetable(struct dmar_domain *domain, | |||
813 | return; | 875 | return; |
814 | 876 | ||
815 | do { | 877 | do { |
816 | first_pte = pte = dma_pfn_level_pte(domain, tmp, level); | 878 | large_page = level; |
879 | first_pte = pte = dma_pfn_level_pte(domain, tmp, level, &large_page); | ||
880 | if (large_page > level) | ||
881 | level = large_page + 1; | ||
817 | if (!pte) { | 882 | if (!pte) { |
818 | tmp = align_to_level(tmp + 1, level + 1); | 883 | tmp = align_to_level(tmp + 1, level + 1); |
819 | continue; | 884 | continue; |
@@ -1397,6 +1462,7 @@ static int domain_init(struct dmar_domain *domain, int guest_width) | |||
1397 | else | 1462 | else |
1398 | domain->iommu_snooping = 0; | 1463 | domain->iommu_snooping = 0; |
1399 | 1464 | ||
1465 | domain->iommu_superpage = fls(cap_super_page_val(iommu->cap)); | ||
1400 | domain->iommu_count = 1; | 1466 | domain->iommu_count = 1; |
1401 | domain->nid = iommu->node; | 1467 | domain->nid = iommu->node; |
1402 | 1468 | ||
@@ -1417,6 +1483,10 @@ static void domain_exit(struct dmar_domain *domain) | |||
1417 | if (!domain) | 1483 | if (!domain) |
1418 | return; | 1484 | return; |
1419 | 1485 | ||
1486 | /* Flush any lazy unmaps that may reference this domain */ | ||
1487 | if (!intel_iommu_strict) | ||
1488 | flush_unmaps_timeout(0); | ||
1489 | |||
1420 | domain_remove_dev_info(domain); | 1490 | domain_remove_dev_info(domain); |
1421 | /* destroy iovas */ | 1491 | /* destroy iovas */ |
1422 | put_iova_domain(&domain->iovad); | 1492 | put_iova_domain(&domain->iovad); |
@@ -1648,6 +1718,34 @@ static inline unsigned long aligned_nrpages(unsigned long host_addr, | |||
1648 | return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT; | 1718 | return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT; |
1649 | } | 1719 | } |
1650 | 1720 | ||
1721 | /* Return largest possible superpage level for a given mapping */ | ||
1722 | static inline int hardware_largepage_caps(struct dmar_domain *domain, | ||
1723 | unsigned long iov_pfn, | ||
1724 | unsigned long phy_pfn, | ||
1725 | unsigned long pages) | ||
1726 | { | ||
1727 | int support, level = 1; | ||
1728 | unsigned long pfnmerge; | ||
1729 | |||
1730 | support = domain->iommu_superpage; | ||
1731 | |||
1732 | /* To use a large page, the virtual *and* physical addresses | ||
1733 | must be aligned to 2MiB/1GiB/etc. Lower bits set in either | ||
1734 | of them will mean we have to use smaller pages. So just | ||
1735 | merge them and check both at once. */ | ||
1736 | pfnmerge = iov_pfn | phy_pfn; | ||
1737 | |||
1738 | while (support && !(pfnmerge & ~VTD_STRIDE_MASK)) { | ||
1739 | pages >>= VTD_STRIDE_SHIFT; | ||
1740 | if (!pages) | ||
1741 | break; | ||
1742 | pfnmerge >>= VTD_STRIDE_SHIFT; | ||
1743 | level++; | ||
1744 | support--; | ||
1745 | } | ||
1746 | return level; | ||
1747 | } | ||
1748 | |||
1651 | static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | 1749 | static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, |
1652 | struct scatterlist *sg, unsigned long phys_pfn, | 1750 | struct scatterlist *sg, unsigned long phys_pfn, |
1653 | unsigned long nr_pages, int prot) | 1751 | unsigned long nr_pages, int prot) |
@@ -1656,6 +1754,8 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1656 | phys_addr_t uninitialized_var(pteval); | 1754 | phys_addr_t uninitialized_var(pteval); |
1657 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; | 1755 | int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; |
1658 | unsigned long sg_res; | 1756 | unsigned long sg_res; |
1757 | unsigned int largepage_lvl = 0; | ||
1758 | unsigned long lvl_pages = 0; | ||
1659 | 1759 | ||
1660 | BUG_ON(addr_width < BITS_PER_LONG && (iov_pfn + nr_pages - 1) >> addr_width); | 1760 | BUG_ON(addr_width < BITS_PER_LONG && (iov_pfn + nr_pages - 1) >> addr_width); |
1661 | 1761 | ||
@@ -1671,7 +1771,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1671 | pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | prot; | 1771 | pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | prot; |
1672 | } | 1772 | } |
1673 | 1773 | ||
1674 | while (nr_pages--) { | 1774 | while (nr_pages > 0) { |
1675 | uint64_t tmp; | 1775 | uint64_t tmp; |
1676 | 1776 | ||
1677 | if (!sg_res) { | 1777 | if (!sg_res) { |
@@ -1679,11 +1779,21 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1679 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; | 1779 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; |
1680 | sg->dma_length = sg->length; | 1780 | sg->dma_length = sg->length; |
1681 | pteval = page_to_phys(sg_page(sg)) | prot; | 1781 | pteval = page_to_phys(sg_page(sg)) | prot; |
1782 | phys_pfn = pteval >> VTD_PAGE_SHIFT; | ||
1682 | } | 1783 | } |
1784 | |||
1683 | if (!pte) { | 1785 | if (!pte) { |
1684 | first_pte = pte = pfn_to_dma_pte(domain, iov_pfn); | 1786 | largepage_lvl = hardware_largepage_caps(domain, iov_pfn, phys_pfn, sg_res); |
1787 | |||
1788 | first_pte = pte = pfn_to_dma_pte(domain, iov_pfn, largepage_lvl); | ||
1685 | if (!pte) | 1789 | if (!pte) |
1686 | return -ENOMEM; | 1790 | return -ENOMEM; |
1791 | /* It is large page*/ | ||
1792 | if (largepage_lvl > 1) | ||
1793 | pteval |= DMA_PTE_LARGE_PAGE; | ||
1794 | else | ||
1795 | pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE; | ||
1796 | |||
1687 | } | 1797 | } |
1688 | /* We don't need lock here, nobody else | 1798 | /* We don't need lock here, nobody else |
1689 | * touches the iova range | 1799 | * touches the iova range |
@@ -1699,16 +1809,38 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1699 | } | 1809 | } |
1700 | WARN_ON(1); | 1810 | WARN_ON(1); |
1701 | } | 1811 | } |
1812 | |||
1813 | lvl_pages = lvl_to_nr_pages(largepage_lvl); | ||
1814 | |||
1815 | BUG_ON(nr_pages < lvl_pages); | ||
1816 | BUG_ON(sg_res < lvl_pages); | ||
1817 | |||
1818 | nr_pages -= lvl_pages; | ||
1819 | iov_pfn += lvl_pages; | ||
1820 | phys_pfn += lvl_pages; | ||
1821 | pteval += lvl_pages * VTD_PAGE_SIZE; | ||
1822 | sg_res -= lvl_pages; | ||
1823 | |||
1824 | /* If the next PTE would be the first in a new page, then we | ||
1825 | need to flush the cache on the entries we've just written. | ||
1826 | And then we'll need to recalculate 'pte', so clear it and | ||
1827 | let it get set again in the if (!pte) block above. | ||
1828 | |||
1829 | If we're done (!nr_pages) we need to flush the cache too. | ||
1830 | |||
1831 | Also if we've been setting superpages, we may need to | ||
1832 | recalculate 'pte' and switch back to smaller pages for the | ||
1833 | end of the mapping, if the trailing size is not enough to | ||
1834 | use another superpage (i.e. sg_res < lvl_pages). */ | ||
1702 | pte++; | 1835 | pte++; |
1703 | if (!nr_pages || first_pte_in_page(pte)) { | 1836 | if (!nr_pages || first_pte_in_page(pte) || |
1837 | (largepage_lvl > 1 && sg_res < lvl_pages)) { | ||
1704 | domain_flush_cache(domain, first_pte, | 1838 | domain_flush_cache(domain, first_pte, |
1705 | (void *)pte - (void *)first_pte); | 1839 | (void *)pte - (void *)first_pte); |
1706 | pte = NULL; | 1840 | pte = NULL; |
1707 | } | 1841 | } |
1708 | iov_pfn++; | 1842 | |
1709 | pteval += VTD_PAGE_SIZE; | 1843 | if (!sg_res && nr_pages) |
1710 | sg_res--; | ||
1711 | if (!sg_res) | ||
1712 | sg = sg_next(sg); | 1844 | sg = sg_next(sg); |
1713 | } | 1845 | } |
1714 | return 0; | 1846 | return 0; |
@@ -2016,7 +2148,7 @@ static inline int iommu_prepare_rmrr_dev(struct dmar_rmrr_unit *rmrr, | |||
2016 | if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO) | 2148 | if (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO) |
2017 | return 0; | 2149 | return 0; |
2018 | return iommu_prepare_identity_map(pdev, rmrr->base_address, | 2150 | return iommu_prepare_identity_map(pdev, rmrr->base_address, |
2019 | rmrr->end_address + 1); | 2151 | rmrr->end_address); |
2020 | } | 2152 | } |
2021 | 2153 | ||
2022 | #ifdef CONFIG_DMAR_FLOPPY_WA | 2154 | #ifdef CONFIG_DMAR_FLOPPY_WA |
@@ -2030,7 +2162,7 @@ static inline void iommu_prepare_isa(void) | |||
2030 | return; | 2162 | return; |
2031 | 2163 | ||
2032 | printk(KERN_INFO "IOMMU: Prepare 0-16MiB unity mapping for LPC\n"); | 2164 | printk(KERN_INFO "IOMMU: Prepare 0-16MiB unity mapping for LPC\n"); |
2033 | ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024); | 2165 | ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024 - 1); |
2034 | 2166 | ||
2035 | if (ret) | 2167 | if (ret) |
2036 | printk(KERN_ERR "IOMMU: Failed to create 0-16MiB identity map; " | 2168 | printk(KERN_ERR "IOMMU: Failed to create 0-16MiB identity map; " |
@@ -2106,10 +2238,10 @@ static int identity_mapping(struct pci_dev *pdev) | |||
2106 | if (likely(!iommu_identity_mapping)) | 2238 | if (likely(!iommu_identity_mapping)) |
2107 | return 0; | 2239 | return 0; |
2108 | 2240 | ||
2241 | info = pdev->dev.archdata.iommu; | ||
2242 | if (info && info != DUMMY_DEVICE_DOMAIN_INFO) | ||
2243 | return (info->domain == si_domain); | ||
2109 | 2244 | ||
2110 | list_for_each_entry(info, &si_domain->devices, link) | ||
2111 | if (info->dev == pdev) | ||
2112 | return 1; | ||
2113 | return 0; | 2245 | return 0; |
2114 | } | 2246 | } |
2115 | 2247 | ||
@@ -2187,8 +2319,19 @@ static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | |||
2187 | * Assume that they will -- if they turn out not to be, then we can | 2319 | * Assume that they will -- if they turn out not to be, then we can |
2188 | * take them out of the 1:1 domain later. | 2320 | * take them out of the 1:1 domain later. |
2189 | */ | 2321 | */ |
2190 | if (!startup) | 2322 | if (!startup) { |
2191 | return pdev->dma_mask > DMA_BIT_MASK(32); | 2323 | /* |
2324 | * If the device's dma_mask is less than the system's memory | ||
2325 | * size then this is not a candidate for identity mapping. | ||
2326 | */ | ||
2327 | u64 dma_mask = pdev->dma_mask; | ||
2328 | |||
2329 | if (pdev->dev.coherent_dma_mask && | ||
2330 | pdev->dev.coherent_dma_mask < dma_mask) | ||
2331 | dma_mask = pdev->dev.coherent_dma_mask; | ||
2332 | |||
2333 | return dma_mask >= dma_get_required_mask(&pdev->dev); | ||
2334 | } | ||
2192 | 2335 | ||
2193 | return 1; | 2336 | return 1; |
2194 | } | 2337 | } |
@@ -2203,6 +2346,9 @@ static int __init iommu_prepare_static_identity_mapping(int hw) | |||
2203 | return -EFAULT; | 2346 | return -EFAULT; |
2204 | 2347 | ||
2205 | for_each_pci_dev(pdev) { | 2348 | for_each_pci_dev(pdev) { |
2349 | /* Skip Host/PCI Bridge devices */ | ||
2350 | if (IS_BRIDGE_HOST_DEVICE(pdev)) | ||
2351 | continue; | ||
2206 | if (iommu_should_identity_map(pdev, 1)) { | 2352 | if (iommu_should_identity_map(pdev, 1)) { |
2207 | printk(KERN_INFO "IOMMU: %s identity mapping for device %s\n", | 2353 | printk(KERN_INFO "IOMMU: %s identity mapping for device %s\n", |
2208 | hw ? "hardware" : "software", pci_name(pdev)); | 2354 | hw ? "hardware" : "software", pci_name(pdev)); |
@@ -2218,7 +2364,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw) | |||
2218 | return 0; | 2364 | return 0; |
2219 | } | 2365 | } |
2220 | 2366 | ||
2221 | static int __init init_dmars(int force_on) | 2367 | static int __init init_dmars(void) |
2222 | { | 2368 | { |
2223 | struct dmar_drhd_unit *drhd; | 2369 | struct dmar_drhd_unit *drhd; |
2224 | struct dmar_rmrr_unit *rmrr; | 2370 | struct dmar_rmrr_unit *rmrr; |
@@ -2592,8 +2738,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2592 | iommu = domain_get_iommu(domain); | 2738 | iommu = domain_get_iommu(domain); |
2593 | size = aligned_nrpages(paddr, size); | 2739 | size = aligned_nrpages(paddr, size); |
2594 | 2740 | ||
2595 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), | 2741 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), dma_mask); |
2596 | pdev->dma_mask); | ||
2597 | if (!iova) | 2742 | if (!iova) |
2598 | goto error; | 2743 | goto error; |
2599 | 2744 | ||
@@ -3118,7 +3263,17 @@ static int init_iommu_hw(void) | |||
3118 | if (iommu->qi) | 3263 | if (iommu->qi) |
3119 | dmar_reenable_qi(iommu); | 3264 | dmar_reenable_qi(iommu); |
3120 | 3265 | ||
3121 | for_each_active_iommu(iommu, drhd) { | 3266 | for_each_iommu(iommu, drhd) { |
3267 | if (drhd->ignored) { | ||
3268 | /* | ||
3269 | * we always have to disable PMRs or DMA may fail on | ||
3270 | * this device | ||
3271 | */ | ||
3272 | if (force_on) | ||
3273 | iommu_disable_protect_mem_regions(iommu); | ||
3274 | continue; | ||
3275 | } | ||
3276 | |||
3122 | iommu_flush_write_buffer(iommu); | 3277 | iommu_flush_write_buffer(iommu); |
3123 | 3278 | ||
3124 | iommu_set_root_entry(iommu); | 3279 | iommu_set_root_entry(iommu); |
@@ -3127,7 +3282,8 @@ static int init_iommu_hw(void) | |||
3127 | DMA_CCMD_GLOBAL_INVL); | 3282 | DMA_CCMD_GLOBAL_INVL); |
3128 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, | 3283 | iommu->flush.flush_iotlb(iommu, 0, 0, 0, |
3129 | DMA_TLB_GLOBAL_FLUSH); | 3284 | DMA_TLB_GLOBAL_FLUSH); |
3130 | iommu_enable_translation(iommu); | 3285 | if (iommu_enable_translation(iommu)) |
3286 | return 1; | ||
3131 | iommu_disable_protect_mem_regions(iommu); | 3287 | iommu_disable_protect_mem_regions(iommu); |
3132 | } | 3288 | } |
3133 | 3289 | ||
@@ -3194,7 +3350,10 @@ static void iommu_resume(void) | |||
3194 | unsigned long flag; | 3350 | unsigned long flag; |
3195 | 3351 | ||
3196 | if (init_iommu_hw()) { | 3352 | if (init_iommu_hw()) { |
3197 | WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); | 3353 | if (force_on) |
3354 | panic("tboot: IOMMU setup failed, DMAR can not resume!\n"); | ||
3355 | else | ||
3356 | WARN(1, "IOMMU setup failed, DMAR can not resume!\n"); | ||
3198 | return; | 3357 | return; |
3199 | } | 3358 | } |
3200 | 3359 | ||
@@ -3229,7 +3388,7 @@ static void __init init_iommu_pm_ops(void) | |||
3229 | } | 3388 | } |
3230 | 3389 | ||
3231 | #else | 3390 | #else |
3232 | static inline int init_iommu_pm_ops(void) { } | 3391 | static inline void init_iommu_pm_ops(void) {} |
3233 | #endif /* CONFIG_PM */ | 3392 | #endif /* CONFIG_PM */ |
3234 | 3393 | ||
3235 | /* | 3394 | /* |
@@ -3271,7 +3430,6 @@ static struct notifier_block device_nb = { | |||
3271 | int __init intel_iommu_init(void) | 3430 | int __init intel_iommu_init(void) |
3272 | { | 3431 | { |
3273 | int ret = 0; | 3432 | int ret = 0; |
3274 | int force_on = 0; | ||
3275 | 3433 | ||
3276 | /* VT-d is required for a TXT/tboot launch, so enforce that */ | 3434 | /* VT-d is required for a TXT/tboot launch, so enforce that */ |
3277 | force_on = tboot_force_iommu(); | 3435 | force_on = tboot_force_iommu(); |
@@ -3309,7 +3467,7 @@ int __init intel_iommu_init(void) | |||
3309 | 3467 | ||
3310 | init_no_remapping_devices(); | 3468 | init_no_remapping_devices(); |
3311 | 3469 | ||
3312 | ret = init_dmars(force_on); | 3470 | ret = init_dmars(); |
3313 | if (ret) { | 3471 | if (ret) { |
3314 | if (force_on) | 3472 | if (force_on) |
3315 | panic("tboot: Failed to initialize DMARs\n"); | 3473 | panic("tboot: Failed to initialize DMARs\n"); |
@@ -3380,8 +3538,8 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
3380 | spin_lock_irqsave(&device_domain_lock, flags); | 3538 | spin_lock_irqsave(&device_domain_lock, flags); |
3381 | list_for_each_safe(entry, tmp, &domain->devices) { | 3539 | list_for_each_safe(entry, tmp, &domain->devices) { |
3382 | info = list_entry(entry, struct device_domain_info, link); | 3540 | info = list_entry(entry, struct device_domain_info, link); |
3383 | /* No need to compare PCI domain; it has to be the same */ | 3541 | if (info->segment == pci_domain_nr(pdev->bus) && |
3384 | if (info->bus == pdev->bus->number && | 3542 | info->bus == pdev->bus->number && |
3385 | info->devfn == pdev->devfn) { | 3543 | info->devfn == pdev->devfn) { |
3386 | list_del(&info->link); | 3544 | list_del(&info->link); |
3387 | list_del(&info->global); | 3545 | list_del(&info->global); |
@@ -3419,10 +3577,13 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
3419 | domain_update_iommu_cap(domain); | 3577 | domain_update_iommu_cap(domain); |
3420 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); | 3578 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); |
3421 | 3579 | ||
3422 | spin_lock_irqsave(&iommu->lock, tmp_flags); | 3580 | if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && |
3423 | clear_bit(domain->id, iommu->domain_ids); | 3581 | !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY)) { |
3424 | iommu->domains[domain->id] = NULL; | 3582 | spin_lock_irqsave(&iommu->lock, tmp_flags); |
3425 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | 3583 | clear_bit(domain->id, iommu->domain_ids); |
3584 | iommu->domains[domain->id] = NULL; | ||
3585 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | ||
3586 | } | ||
3426 | } | 3587 | } |
3427 | 3588 | ||
3428 | spin_unlock_irqrestore(&device_domain_lock, flags); | 3589 | spin_unlock_irqrestore(&device_domain_lock, flags); |
@@ -3505,6 +3666,7 @@ static int md_domain_init(struct dmar_domain *domain, int guest_width) | |||
3505 | domain->iommu_count = 0; | 3666 | domain->iommu_count = 0; |
3506 | domain->iommu_coherency = 0; | 3667 | domain->iommu_coherency = 0; |
3507 | domain->iommu_snooping = 0; | 3668 | domain->iommu_snooping = 0; |
3669 | domain->iommu_superpage = 0; | ||
3508 | domain->max_addr = 0; | 3670 | domain->max_addr = 0; |
3509 | domain->nid = -1; | 3671 | domain->nid = -1; |
3510 | 3672 | ||
@@ -3720,7 +3882,7 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, | |||
3720 | struct dma_pte *pte; | 3882 | struct dma_pte *pte; |
3721 | u64 phys = 0; | 3883 | u64 phys = 0; |
3722 | 3884 | ||
3723 | pte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT); | 3885 | pte = pfn_to_dma_pte(dmar_domain, iova >> VTD_PAGE_SHIFT, 0); |
3724 | if (pte) | 3886 | if (pte) |
3725 | phys = dma_pte_addr(pte); | 3887 | phys = dma_pte_addr(pte); |
3726 | 3888 | ||
diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c index 9606e599a475..c5c274ab5c5a 100644 --- a/drivers/pci/iova.c +++ b/drivers/pci/iova.c | |||
@@ -63,8 +63,16 @@ __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free) | |||
63 | curr = iovad->cached32_node; | 63 | curr = iovad->cached32_node; |
64 | cached_iova = container_of(curr, struct iova, node); | 64 | cached_iova = container_of(curr, struct iova, node); |
65 | 65 | ||
66 | if (free->pfn_lo >= cached_iova->pfn_lo) | 66 | if (free->pfn_lo >= cached_iova->pfn_lo) { |
67 | iovad->cached32_node = rb_next(&free->node); | 67 | struct rb_node *node = rb_next(&free->node); |
68 | struct iova *iova = container_of(node, struct iova, node); | ||
69 | |||
70 | /* only cache if it's below 32bit pfn */ | ||
71 | if (node && iova->pfn_lo < iovad->dma_32bit_pfn) | ||
72 | iovad->cached32_node = node; | ||
73 | else | ||
74 | iovad->cached32_node = NULL; | ||
75 | } | ||
68 | } | 76 | } |
69 | 77 | ||
70 | /* Computes the padding size required, to make the | 78 | /* Computes the padding size required, to make the |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 135df164a4c1..46767c53917a 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -624,7 +624,7 @@ static int pci_pm_prepare(struct device *dev) | |||
624 | * system from the sleep state, we'll have to prevent it from signaling | 624 | * system from the sleep state, we'll have to prevent it from signaling |
625 | * wake-up. | 625 | * wake-up. |
626 | */ | 626 | */ |
627 | pm_runtime_resume(dev); | 627 | pm_runtime_get_sync(dev); |
628 | 628 | ||
629 | if (drv && drv->pm && drv->pm->prepare) | 629 | if (drv && drv->pm && drv->pm->prepare) |
630 | error = drv->pm->prepare(dev); | 630 | error = drv->pm->prepare(dev); |
@@ -638,6 +638,8 @@ static void pci_pm_complete(struct device *dev) | |||
638 | 638 | ||
639 | if (drv && drv->pm && drv->pm->complete) | 639 | if (drv && drv->pm && drv->pm->complete) |
640 | drv->pm->complete(dev); | 640 | drv->pm->complete(dev); |
641 | |||
642 | pm_runtime_put_sync(dev); | ||
641 | } | 643 | } |
642 | 644 | ||
643 | #else /* !CONFIG_PM_SLEEP */ | 645 | #else /* !CONFIG_PM_SLEEP */ |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e43a7bbeb28f..2c5b9b991279 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -3271,11 +3271,11 @@ void __init pci_register_set_vga_state(arch_set_vga_state_t func) | |||
3271 | } | 3271 | } |
3272 | 3272 | ||
3273 | static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, | 3273 | static int pci_set_vga_state_arch(struct pci_dev *dev, bool decode, |
3274 | unsigned int command_bits, bool change_bridge) | 3274 | unsigned int command_bits, u32 flags) |
3275 | { | 3275 | { |
3276 | if (arch_set_vga_state) | 3276 | if (arch_set_vga_state) |
3277 | return arch_set_vga_state(dev, decode, command_bits, | 3277 | return arch_set_vga_state(dev, decode, command_bits, |
3278 | change_bridge); | 3278 | flags); |
3279 | return 0; | 3279 | return 0; |
3280 | } | 3280 | } |
3281 | 3281 | ||
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c index 435002dfc3ca..712baab3c83d 100644 --- a/drivers/pcmcia/pxa2xx_vpac270.c +++ b/drivers/pcmcia/pxa2xx_vpac270.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/gpio.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
16 | 17 | ||
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index a8d03aeb4051..e7f301da2902 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c | |||
@@ -46,7 +46,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
46 | caps.n_ext_ts = ptp->info->n_ext_ts; | 46 | caps.n_ext_ts = ptp->info->n_ext_ts; |
47 | caps.n_per_out = ptp->info->n_per_out; | 47 | caps.n_per_out = ptp->info->n_per_out; |
48 | caps.pps = ptp->info->pps; | 48 | caps.pps = ptp->info->pps; |
49 | err = copy_to_user((void __user *)arg, &caps, sizeof(caps)); | 49 | if (copy_to_user((void __user *)arg, &caps, sizeof(caps))) |
50 | err = -EFAULT; | ||
50 | break; | 51 | break; |
51 | 52 | ||
52 | case PTP_EXTTS_REQUEST: | 53 | case PTP_EXTTS_REQUEST: |
@@ -129,8 +130,10 @@ ssize_t ptp_read(struct posix_clock *pc, | |||
129 | return -ERESTARTSYS; | 130 | return -ERESTARTSYS; |
130 | } | 131 | } |
131 | 132 | ||
132 | if (ptp->defunct) | 133 | if (ptp->defunct) { |
134 | mutex_unlock(&ptp->tsevq_mux); | ||
133 | return -ENODEV; | 135 | return -ENODEV; |
136 | } | ||
134 | 137 | ||
135 | spin_lock_irqsave(&queue->lock, flags); | 138 | spin_lock_irqsave(&queue->lock, flags); |
136 | 139 | ||
@@ -150,10 +153,8 @@ ssize_t ptp_read(struct posix_clock *pc, | |||
150 | 153 | ||
151 | mutex_unlock(&ptp->tsevq_mux); | 154 | mutex_unlock(&ptp->tsevq_mux); |
152 | 155 | ||
153 | if (copy_to_user(buf, event, cnt)) { | 156 | if (copy_to_user(buf, event, cnt)) |
154 | mutex_unlock(&ptp->tsevq_mux); | ||
155 | return -EFAULT; | 157 | return -EFAULT; |
156 | } | ||
157 | 158 | ||
158 | return cnt; | 159 | return cnt; |
159 | } | 160 | } |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index f822e13dc04b..ce2aabf5c550 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -1051,4 +1051,13 @@ config RTC_DRV_TILE | |||
1051 | Enable support for the Linux driver side of the Tilera | 1051 | Enable support for the Linux driver side of the Tilera |
1052 | hypervisor's real-time clock interface. | 1052 | hypervisor's real-time clock interface. |
1053 | 1053 | ||
1054 | config RTC_DRV_PUV3 | ||
1055 | tristate "PKUnity v3 RTC support" | ||
1056 | depends on ARCH_PUV3 | ||
1057 | help | ||
1058 | This enables support for the RTC in the PKUnity-v3 SoCs. | ||
1059 | |||
1060 | This drive can also be built as a module. If so, the module | ||
1061 | will be called rtc-puv3. | ||
1062 | |||
1054 | endif # RTC_CLASS | 1063 | endif # RTC_CLASS |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 213d725f16d4..0ffefe877bfa 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
@@ -78,6 +78,7 @@ obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o | |||
78 | obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o | 78 | obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o |
79 | obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o | 79 | obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o |
80 | obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o | 80 | obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o |
81 | obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o | ||
81 | obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o | 82 | obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o |
82 | obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o | 83 | obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o |
83 | obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c01.o | 84 | obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c01.o |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index ef6316acec43..df68618f6dbb 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -318,7 +318,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
318 | } | 318 | } |
319 | EXPORT_SYMBOL_GPL(rtc_read_alarm); | 319 | EXPORT_SYMBOL_GPL(rtc_read_alarm); |
320 | 320 | ||
321 | int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | 321 | static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) |
322 | { | 322 | { |
323 | struct rtc_time tm; | 323 | struct rtc_time tm; |
324 | long now, scheduled; | 324 | long now, scheduled; |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index d0e06edb14c5..cace6d3aed9a 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -421,7 +421,8 @@ static long rtc_dev_ioctl(struct file *file, | |||
421 | err = ops->ioctl(rtc->dev.parent, cmd, arg); | 421 | err = ops->ioctl(rtc->dev.parent, cmd, arg); |
422 | if (err == -ENOIOCTLCMD) | 422 | if (err == -ENOIOCTLCMD) |
423 | err = -ENOTTY; | 423 | err = -ENOTTY; |
424 | } | 424 | } else |
425 | err = -ENOTTY; | ||
425 | break; | 426 | break; |
426 | } | 427 | } |
427 | 428 | ||
diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c index 1a84b3e227d1..7317d3b9a3d5 100644 --- a/drivers/rtc/rtc-m41t93.c +++ b/drivers/rtc/rtc-m41t93.c | |||
@@ -189,7 +189,7 @@ static int __devinit m41t93_probe(struct spi_device *spi) | |||
189 | 189 | ||
190 | static int __devexit m41t93_remove(struct spi_device *spi) | 190 | static int __devexit m41t93_remove(struct spi_device *spi) |
191 | { | 191 | { |
192 | struct rtc_device *rtc = platform_get_drvdata(spi); | 192 | struct rtc_device *rtc = spi_get_drvdata(spi); |
193 | 193 | ||
194 | if (rtc) | 194 | if (rtc) |
195 | rtc_device_unregister(rtc); | 195 | rtc_device_unregister(rtc); |
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c new file mode 100644 index 000000000000..46f14b82f3ab --- /dev/null +++ b/drivers/rtc/rtc-puv3.c | |||
@@ -0,0 +1,359 @@ | |||
1 | /* | ||
2 | * RTC driver code specific to PKUnity SoC and UniCore ISA | ||
3 | * | ||
4 | * Maintained by GUAN Xue-tao <gxt@mprc.pku.edu.cn> | ||
5 | * Copyright (C) 2001-2010 Guan Xuetao | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/fs.h> | ||
14 | #include <linux/string.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/rtc.h> | ||
19 | #include <linux/bcd.h> | ||
20 | #include <linux/clk.h> | ||
21 | #include <linux/log2.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/uaccess.h> | ||
24 | #include <linux/io.h> | ||
25 | |||
26 | #include <asm/irq.h> | ||
27 | #include <mach/hardware.h> | ||
28 | |||
29 | static struct resource *puv3_rtc_mem; | ||
30 | |||
31 | static int puv3_rtc_alarmno = IRQ_RTCAlarm; | ||
32 | static int puv3_rtc_tickno = IRQ_RTC; | ||
33 | |||
34 | static DEFINE_SPINLOCK(puv3_rtc_pie_lock); | ||
35 | |||
36 | /* IRQ Handlers */ | ||
37 | static irqreturn_t puv3_rtc_alarmirq(int irq, void *id) | ||
38 | { | ||
39 | struct rtc_device *rdev = id; | ||
40 | |||
41 | writel(readl(RTC_RTSR) | RTC_RTSR_AL, RTC_RTSR); | ||
42 | rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF); | ||
43 | return IRQ_HANDLED; | ||
44 | } | ||
45 | |||
46 | static irqreturn_t puv3_rtc_tickirq(int irq, void *id) | ||
47 | { | ||
48 | struct rtc_device *rdev = id; | ||
49 | |||
50 | writel(readl(RTC_RTSR) | RTC_RTSR_HZ, RTC_RTSR); | ||
51 | rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF); | ||
52 | return IRQ_HANDLED; | ||
53 | } | ||
54 | |||
55 | /* Update control registers */ | ||
56 | static void puv3_rtc_setaie(int to) | ||
57 | { | ||
58 | unsigned int tmp; | ||
59 | |||
60 | pr_debug("%s: aie=%d\n", __func__, to); | ||
61 | |||
62 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_ALE; | ||
63 | |||
64 | if (to) | ||
65 | tmp |= RTC_RTSR_ALE; | ||
66 | |||
67 | writel(tmp, RTC_RTSR); | ||
68 | } | ||
69 | |||
70 | static int puv3_rtc_setpie(struct device *dev, int enabled) | ||
71 | { | ||
72 | unsigned int tmp; | ||
73 | |||
74 | pr_debug("%s: pie=%d\n", __func__, enabled); | ||
75 | |||
76 | spin_lock_irq(&puv3_rtc_pie_lock); | ||
77 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_HZE; | ||
78 | |||
79 | if (enabled) | ||
80 | tmp |= RTC_RTSR_HZE; | ||
81 | |||
82 | writel(tmp, RTC_RTSR); | ||
83 | spin_unlock_irq(&puv3_rtc_pie_lock); | ||
84 | |||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | /* Time read/write */ | ||
89 | static int puv3_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) | ||
90 | { | ||
91 | rtc_time_to_tm(readl(RTC_RCNR), rtc_tm); | ||
92 | |||
93 | pr_debug("read time %02x.%02x.%02x %02x/%02x/%02x\n", | ||
94 | rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, | ||
95 | rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static int puv3_rtc_settime(struct device *dev, struct rtc_time *tm) | ||
101 | { | ||
102 | unsigned long rtc_count = 0; | ||
103 | |||
104 | pr_debug("set time %02d.%02d.%02d %02d/%02d/%02d\n", | ||
105 | tm->tm_year, tm->tm_mon, tm->tm_mday, | ||
106 | tm->tm_hour, tm->tm_min, tm->tm_sec); | ||
107 | |||
108 | rtc_tm_to_time(tm, &rtc_count); | ||
109 | writel(rtc_count, RTC_RCNR); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int puv3_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm) | ||
115 | { | ||
116 | struct rtc_time *alm_tm = &alrm->time; | ||
117 | |||
118 | rtc_time_to_tm(readl(RTC_RTAR), alm_tm); | ||
119 | |||
120 | alrm->enabled = readl(RTC_RTSR) & RTC_RTSR_ALE; | ||
121 | |||
122 | pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n", | ||
123 | alrm->enabled, | ||
124 | alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday, | ||
125 | alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec); | ||
126 | |||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | static int puv3_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | ||
131 | { | ||
132 | struct rtc_time *tm = &alrm->time; | ||
133 | unsigned long rtcalarm_count = 0; | ||
134 | |||
135 | pr_debug("puv3_rtc_setalarm: %d, %02x/%02x/%02x %02x.%02x.%02x\n", | ||
136 | alrm->enabled, | ||
137 | tm->tm_mday & 0xff, tm->tm_mon & 0xff, tm->tm_year & 0xff, | ||
138 | tm->tm_hour & 0xff, tm->tm_min & 0xff, tm->tm_sec); | ||
139 | |||
140 | rtc_tm_to_time(tm, &rtcalarm_count); | ||
141 | writel(rtcalarm_count, RTC_RTAR); | ||
142 | |||
143 | puv3_rtc_setaie(alrm->enabled); | ||
144 | |||
145 | if (alrm->enabled) | ||
146 | enable_irq_wake(puv3_rtc_alarmno); | ||
147 | else | ||
148 | disable_irq_wake(puv3_rtc_alarmno); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int puv3_rtc_proc(struct device *dev, struct seq_file *seq) | ||
154 | { | ||
155 | seq_printf(seq, "periodic_IRQ\t: %s\n", | ||
156 | (readl(RTC_RTSR) & RTC_RTSR_HZE) ? "yes" : "no"); | ||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static int puv3_rtc_open(struct device *dev) | ||
161 | { | ||
162 | struct platform_device *pdev = to_platform_device(dev); | ||
163 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | ||
164 | int ret; | ||
165 | |||
166 | ret = request_irq(puv3_rtc_alarmno, puv3_rtc_alarmirq, | ||
167 | IRQF_DISABLED, "pkunity-rtc alarm", rtc_dev); | ||
168 | |||
169 | if (ret) { | ||
170 | dev_err(dev, "IRQ%d error %d\n", puv3_rtc_alarmno, ret); | ||
171 | return ret; | ||
172 | } | ||
173 | |||
174 | ret = request_irq(puv3_rtc_tickno, puv3_rtc_tickirq, | ||
175 | IRQF_DISABLED, "pkunity-rtc tick", rtc_dev); | ||
176 | |||
177 | if (ret) { | ||
178 | dev_err(dev, "IRQ%d error %d\n", puv3_rtc_tickno, ret); | ||
179 | goto tick_err; | ||
180 | } | ||
181 | |||
182 | return ret; | ||
183 | |||
184 | tick_err: | ||
185 | free_irq(puv3_rtc_alarmno, rtc_dev); | ||
186 | return ret; | ||
187 | } | ||
188 | |||
189 | static void puv3_rtc_release(struct device *dev) | ||
190 | { | ||
191 | struct platform_device *pdev = to_platform_device(dev); | ||
192 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); | ||
193 | |||
194 | /* do not clear AIE here, it may be needed for wake */ | ||
195 | puv3_rtc_setpie(dev, 0); | ||
196 | free_irq(puv3_rtc_alarmno, rtc_dev); | ||
197 | free_irq(puv3_rtc_tickno, rtc_dev); | ||
198 | } | ||
199 | |||
200 | static const struct rtc_class_ops puv3_rtcops = { | ||
201 | .open = puv3_rtc_open, | ||
202 | .release = puv3_rtc_release, | ||
203 | .read_time = puv3_rtc_gettime, | ||
204 | .set_time = puv3_rtc_settime, | ||
205 | .read_alarm = puv3_rtc_getalarm, | ||
206 | .set_alarm = puv3_rtc_setalarm, | ||
207 | .proc = puv3_rtc_proc, | ||
208 | }; | ||
209 | |||
210 | static void puv3_rtc_enable(struct platform_device *pdev, int en) | ||
211 | { | ||
212 | if (!en) { | ||
213 | writel(readl(RTC_RTSR) & ~RTC_RTSR_HZE, RTC_RTSR); | ||
214 | } else { | ||
215 | /* re-enable the device, and check it is ok */ | ||
216 | if ((readl(RTC_RTSR) & RTC_RTSR_HZE) == 0) { | ||
217 | dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); | ||
218 | writel(readl(RTC_RTSR) | RTC_RTSR_HZE, RTC_RTSR); | ||
219 | } | ||
220 | } | ||
221 | } | ||
222 | |||
223 | static int puv3_rtc_remove(struct platform_device *dev) | ||
224 | { | ||
225 | struct rtc_device *rtc = platform_get_drvdata(dev); | ||
226 | |||
227 | platform_set_drvdata(dev, NULL); | ||
228 | rtc_device_unregister(rtc); | ||
229 | |||
230 | puv3_rtc_setpie(&dev->dev, 0); | ||
231 | puv3_rtc_setaie(0); | ||
232 | |||
233 | release_resource(puv3_rtc_mem); | ||
234 | kfree(puv3_rtc_mem); | ||
235 | |||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | static int puv3_rtc_probe(struct platform_device *pdev) | ||
240 | { | ||
241 | struct rtc_device *rtc; | ||
242 | struct resource *res; | ||
243 | int ret; | ||
244 | |||
245 | pr_debug("%s: probe=%p\n", __func__, pdev); | ||
246 | |||
247 | /* find the IRQs */ | ||
248 | puv3_rtc_tickno = platform_get_irq(pdev, 1); | ||
249 | if (puv3_rtc_tickno < 0) { | ||
250 | dev_err(&pdev->dev, "no irq for rtc tick\n"); | ||
251 | return -ENOENT; | ||
252 | } | ||
253 | |||
254 | puv3_rtc_alarmno = platform_get_irq(pdev, 0); | ||
255 | if (puv3_rtc_alarmno < 0) { | ||
256 | dev_err(&pdev->dev, "no irq for alarm\n"); | ||
257 | return -ENOENT; | ||
258 | } | ||
259 | |||
260 | pr_debug("PKUnity_rtc: tick irq %d, alarm irq %d\n", | ||
261 | puv3_rtc_tickno, puv3_rtc_alarmno); | ||
262 | |||
263 | /* get the memory region */ | ||
264 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
265 | if (res == NULL) { | ||
266 | dev_err(&pdev->dev, "failed to get memory region resource\n"); | ||
267 | return -ENOENT; | ||
268 | } | ||
269 | |||
270 | puv3_rtc_mem = request_mem_region(res->start, | ||
271 | res->end-res->start+1, | ||
272 | pdev->name); | ||
273 | |||
274 | if (puv3_rtc_mem == NULL) { | ||
275 | dev_err(&pdev->dev, "failed to reserve memory region\n"); | ||
276 | ret = -ENOENT; | ||
277 | goto err_nores; | ||
278 | } | ||
279 | |||
280 | puv3_rtc_enable(pdev, 1); | ||
281 | |||
282 | /* register RTC and exit */ | ||
283 | rtc = rtc_device_register("pkunity", &pdev->dev, &puv3_rtcops, | ||
284 | THIS_MODULE); | ||
285 | |||
286 | if (IS_ERR(rtc)) { | ||
287 | dev_err(&pdev->dev, "cannot attach rtc\n"); | ||
288 | ret = PTR_ERR(rtc); | ||
289 | goto err_nortc; | ||
290 | } | ||
291 | |||
292 | /* platform setup code should have handled this; sigh */ | ||
293 | if (!device_can_wakeup(&pdev->dev)) | ||
294 | device_init_wakeup(&pdev->dev, 1); | ||
295 | |||
296 | platform_set_drvdata(pdev, rtc); | ||
297 | return 0; | ||
298 | |||
299 | err_nortc: | ||
300 | puv3_rtc_enable(pdev, 0); | ||
301 | release_resource(puv3_rtc_mem); | ||
302 | |||
303 | err_nores: | ||
304 | return ret; | ||
305 | } | ||
306 | |||
307 | #ifdef CONFIG_PM | ||
308 | |||
309 | static int ticnt_save; | ||
310 | |||
311 | static int puv3_rtc_suspend(struct platform_device *pdev, pm_message_t state) | ||
312 | { | ||
313 | /* save RTAR for anyone using periodic interrupts */ | ||
314 | ticnt_save = readl(RTC_RTAR); | ||
315 | puv3_rtc_enable(pdev, 0); | ||
316 | return 0; | ||
317 | } | ||
318 | |||
319 | static int puv3_rtc_resume(struct platform_device *pdev) | ||
320 | { | ||
321 | puv3_rtc_enable(pdev, 1); | ||
322 | writel(ticnt_save, RTC_RTAR); | ||
323 | return 0; | ||
324 | } | ||
325 | #else | ||
326 | #define puv3_rtc_suspend NULL | ||
327 | #define puv3_rtc_resume NULL | ||
328 | #endif | ||
329 | |||
330 | static struct platform_driver puv3_rtcdrv = { | ||
331 | .probe = puv3_rtc_probe, | ||
332 | .remove = __devexit_p(puv3_rtc_remove), | ||
333 | .suspend = puv3_rtc_suspend, | ||
334 | .resume = puv3_rtc_resume, | ||
335 | .driver = { | ||
336 | .name = "PKUnity-v3-RTC", | ||
337 | .owner = THIS_MODULE, | ||
338 | } | ||
339 | }; | ||
340 | |||
341 | static char __initdata banner[] = "PKUnity-v3 RTC, (c) 2009 PKUnity Co.\n"; | ||
342 | |||
343 | static int __init puv3_rtc_init(void) | ||
344 | { | ||
345 | printk(banner); | ||
346 | return platform_driver_register(&puv3_rtcdrv); | ||
347 | } | ||
348 | |||
349 | static void __exit puv3_rtc_exit(void) | ||
350 | { | ||
351 | platform_driver_unregister(&puv3_rtcdrv); | ||
352 | } | ||
353 | |||
354 | module_init(puv3_rtc_init); | ||
355 | module_exit(puv3_rtc_exit); | ||
356 | |||
357 | MODULE_DESCRIPTION("RTC Driver for the PKUnity v3 chip"); | ||
358 | MODULE_AUTHOR("Hu Dongliang"); | ||
359 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 55e8f721e38a..570d4da10696 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -416,7 +416,7 @@ static void process_buffer_error(struct qdio_q *q, int count) | |||
416 | 416 | ||
417 | /* special handling for no target buffer empty */ | 417 | /* special handling for no target buffer empty */ |
418 | if ((!q->is_input_q && | 418 | if ((!q->is_input_q && |
419 | (q->sbal[q->first_to_check]->element[15].flags & 0xff) == 0x10)) { | 419 | (q->sbal[q->first_to_check]->element[15].sflags) == 0x10)) { |
420 | qperf_inc(q, target_full); | 420 | qperf_inc(q, target_full); |
421 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x", | 421 | DBF_DEV_EVENT(DBF_INFO, q->irq_ptr, "OUTFULL FTC:%02x", |
422 | q->first_to_check); | 422 | q->first_to_check); |
@@ -427,8 +427,8 @@ static void process_buffer_error(struct qdio_q *q, int count) | |||
427 | DBF_ERROR((q->is_input_q) ? "IN:%2d" : "OUT:%2d", q->nr); | 427 | DBF_ERROR((q->is_input_q) ? "IN:%2d" : "OUT:%2d", q->nr); |
428 | DBF_ERROR("FTC:%3d C:%3d", q->first_to_check, count); | 428 | DBF_ERROR("FTC:%3d C:%3d", q->first_to_check, count); |
429 | DBF_ERROR("F14:%2x F15:%2x", | 429 | DBF_ERROR("F14:%2x F15:%2x", |
430 | q->sbal[q->first_to_check]->element[14].flags & 0xff, | 430 | q->sbal[q->first_to_check]->element[14].sflags, |
431 | q->sbal[q->first_to_check]->element[15].flags & 0xff); | 431 | q->sbal[q->first_to_check]->element[15].sflags); |
432 | 432 | ||
433 | /* | 433 | /* |
434 | * Interrupts may be avoided as long as the error is present | 434 | * Interrupts may be avoided as long as the error is present |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 55c6aa1c9704..d3cee33e554c 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -361,7 +361,7 @@ enum qeth_header_ids { | |||
361 | 361 | ||
362 | static inline int qeth_is_last_sbale(struct qdio_buffer_element *sbale) | 362 | static inline int qeth_is_last_sbale(struct qdio_buffer_element *sbale) |
363 | { | 363 | { |
364 | return (sbale->flags & SBAL_FLAGS_LAST_ENTRY); | 364 | return (sbale->eflags & SBAL_EFLAGS_LAST_ENTRY); |
365 | } | 365 | } |
366 | 366 | ||
367 | enum qeth_qdio_buffer_states { | 367 | enum qeth_qdio_buffer_states { |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 503678a30981..dd08f7b42fb8 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -890,7 +890,7 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, | |||
890 | struct sk_buff *skb; | 890 | struct sk_buff *skb; |
891 | 891 | ||
892 | /* is PCI flag set on buffer? */ | 892 | /* is PCI flag set on buffer? */ |
893 | if (buf->buffer->element[0].flags & 0x40) | 893 | if (buf->buffer->element[0].sflags & SBAL_SFLAGS0_PCI_REQ) |
894 | atomic_dec(&queue->set_pci_flags_count); | 894 | atomic_dec(&queue->set_pci_flags_count); |
895 | 895 | ||
896 | skb = skb_dequeue(&buf->skb_list); | 896 | skb = skb_dequeue(&buf->skb_list); |
@@ -906,9 +906,11 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, | |||
906 | buf->is_header[i] = 0; | 906 | buf->is_header[i] = 0; |
907 | buf->buffer->element[i].length = 0; | 907 | buf->buffer->element[i].length = 0; |
908 | buf->buffer->element[i].addr = NULL; | 908 | buf->buffer->element[i].addr = NULL; |
909 | buf->buffer->element[i].flags = 0; | 909 | buf->buffer->element[i].eflags = 0; |
910 | buf->buffer->element[i].sflags = 0; | ||
910 | } | 911 | } |
911 | buf->buffer->element[15].flags = 0; | 912 | buf->buffer->element[15].eflags = 0; |
913 | buf->buffer->element[15].sflags = 0; | ||
912 | buf->next_element_to_fill = 0; | 914 | buf->next_element_to_fill = 0; |
913 | atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY); | 915 | atomic_set(&buf->state, QETH_QDIO_BUF_EMPTY); |
914 | } | 916 | } |
@@ -2368,9 +2370,10 @@ static int qeth_init_input_buffer(struct qeth_card *card, | |||
2368 | buf->buffer->element[i].length = PAGE_SIZE; | 2370 | buf->buffer->element[i].length = PAGE_SIZE; |
2369 | buf->buffer->element[i].addr = pool_entry->elements[i]; | 2371 | buf->buffer->element[i].addr = pool_entry->elements[i]; |
2370 | if (i == QETH_MAX_BUFFER_ELEMENTS(card) - 1) | 2372 | if (i == QETH_MAX_BUFFER_ELEMENTS(card) - 1) |
2371 | buf->buffer->element[i].flags = SBAL_FLAGS_LAST_ENTRY; | 2373 | buf->buffer->element[i].eflags = SBAL_EFLAGS_LAST_ENTRY; |
2372 | else | 2374 | else |
2373 | buf->buffer->element[i].flags = 0; | 2375 | buf->buffer->element[i].eflags = 0; |
2376 | buf->buffer->element[i].sflags = 0; | ||
2374 | } | 2377 | } |
2375 | return 0; | 2378 | return 0; |
2376 | } | 2379 | } |
@@ -2718,11 +2721,11 @@ int qeth_check_qdio_errors(struct qeth_card *card, struct qdio_buffer *buf, | |||
2718 | if (qdio_error) { | 2721 | if (qdio_error) { |
2719 | QETH_CARD_TEXT(card, 2, dbftext); | 2722 | QETH_CARD_TEXT(card, 2, dbftext); |
2720 | QETH_CARD_TEXT_(card, 2, " F15=%02X", | 2723 | QETH_CARD_TEXT_(card, 2, " F15=%02X", |
2721 | buf->element[15].flags & 0xff); | 2724 | buf->element[15].sflags); |
2722 | QETH_CARD_TEXT_(card, 2, " F14=%02X", | 2725 | QETH_CARD_TEXT_(card, 2, " F14=%02X", |
2723 | buf->element[14].flags & 0xff); | 2726 | buf->element[14].sflags); |
2724 | QETH_CARD_TEXT_(card, 2, " qerr=%X", qdio_error); | 2727 | QETH_CARD_TEXT_(card, 2, " qerr=%X", qdio_error); |
2725 | if ((buf->element[15].flags & 0xff) == 0x12) { | 2728 | if ((buf->element[15].sflags) == 0x12) { |
2726 | card->stats.rx_dropped++; | 2729 | card->stats.rx_dropped++; |
2727 | return 0; | 2730 | return 0; |
2728 | } else | 2731 | } else |
@@ -2798,7 +2801,7 @@ EXPORT_SYMBOL_GPL(qeth_queue_input_buffer); | |||
2798 | static int qeth_handle_send_error(struct qeth_card *card, | 2801 | static int qeth_handle_send_error(struct qeth_card *card, |
2799 | struct qeth_qdio_out_buffer *buffer, unsigned int qdio_err) | 2802 | struct qeth_qdio_out_buffer *buffer, unsigned int qdio_err) |
2800 | { | 2803 | { |
2801 | int sbalf15 = buffer->buffer->element[15].flags & 0xff; | 2804 | int sbalf15 = buffer->buffer->element[15].sflags; |
2802 | 2805 | ||
2803 | QETH_CARD_TEXT(card, 6, "hdsnderr"); | 2806 | QETH_CARD_TEXT(card, 6, "hdsnderr"); |
2804 | if (card->info.type == QETH_CARD_TYPE_IQD) { | 2807 | if (card->info.type == QETH_CARD_TYPE_IQD) { |
@@ -2907,8 +2910,8 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, | |||
2907 | 2910 | ||
2908 | for (i = index; i < index + count; ++i) { | 2911 | for (i = index; i < index + count; ++i) { |
2909 | buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; | 2912 | buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q]; |
2910 | buf->buffer->element[buf->next_element_to_fill - 1].flags |= | 2913 | buf->buffer->element[buf->next_element_to_fill - 1].eflags |= |
2911 | SBAL_FLAGS_LAST_ENTRY; | 2914 | SBAL_EFLAGS_LAST_ENTRY; |
2912 | 2915 | ||
2913 | if (queue->card->info.type == QETH_CARD_TYPE_IQD) | 2916 | if (queue->card->info.type == QETH_CARD_TYPE_IQD) |
2914 | continue; | 2917 | continue; |
@@ -2921,7 +2924,7 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, | |||
2921 | /* it's likely that we'll go to packing | 2924 | /* it's likely that we'll go to packing |
2922 | * mode soon */ | 2925 | * mode soon */ |
2923 | atomic_inc(&queue->set_pci_flags_count); | 2926 | atomic_inc(&queue->set_pci_flags_count); |
2924 | buf->buffer->element[0].flags |= 0x40; | 2927 | buf->buffer->element[0].sflags |= SBAL_SFLAGS0_PCI_REQ; |
2925 | } | 2928 | } |
2926 | } else { | 2929 | } else { |
2927 | if (!atomic_read(&queue->set_pci_flags_count)) { | 2930 | if (!atomic_read(&queue->set_pci_flags_count)) { |
@@ -2934,7 +2937,7 @@ static void qeth_flush_buffers(struct qeth_qdio_out_q *queue, int index, | |||
2934 | * further send was requested by the stack | 2937 | * further send was requested by the stack |
2935 | */ | 2938 | */ |
2936 | atomic_inc(&queue->set_pci_flags_count); | 2939 | atomic_inc(&queue->set_pci_flags_count); |
2937 | buf->buffer->element[0].flags |= 0x40; | 2940 | buf->buffer->element[0].sflags |= SBAL_SFLAGS0_PCI_REQ; |
2938 | } | 2941 | } |
2939 | } | 2942 | } |
2940 | } | 2943 | } |
@@ -3180,20 +3183,20 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb, | |||
3180 | if (!length) { | 3183 | if (!length) { |
3181 | if (first_lap) | 3184 | if (first_lap) |
3182 | if (skb_shinfo(skb)->nr_frags) | 3185 | if (skb_shinfo(skb)->nr_frags) |
3183 | buffer->element[element].flags = | 3186 | buffer->element[element].eflags = |
3184 | SBAL_FLAGS_FIRST_FRAG; | 3187 | SBAL_EFLAGS_FIRST_FRAG; |
3185 | else | 3188 | else |
3186 | buffer->element[element].flags = 0; | 3189 | buffer->element[element].eflags = 0; |
3187 | else | 3190 | else |
3188 | buffer->element[element].flags = | 3191 | buffer->element[element].eflags = |
3189 | SBAL_FLAGS_MIDDLE_FRAG; | 3192 | SBAL_EFLAGS_MIDDLE_FRAG; |
3190 | } else { | 3193 | } else { |
3191 | if (first_lap) | 3194 | if (first_lap) |
3192 | buffer->element[element].flags = | 3195 | buffer->element[element].eflags = |
3193 | SBAL_FLAGS_FIRST_FRAG; | 3196 | SBAL_EFLAGS_FIRST_FRAG; |
3194 | else | 3197 | else |
3195 | buffer->element[element].flags = | 3198 | buffer->element[element].eflags = |
3196 | SBAL_FLAGS_MIDDLE_FRAG; | 3199 | SBAL_EFLAGS_MIDDLE_FRAG; |
3197 | } | 3200 | } |
3198 | data += length_here; | 3201 | data += length_here; |
3199 | element++; | 3202 | element++; |
@@ -3205,12 +3208,12 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb, | |||
3205 | buffer->element[element].addr = (char *)page_to_phys(frag->page) | 3208 | buffer->element[element].addr = (char *)page_to_phys(frag->page) |
3206 | + frag->page_offset; | 3209 | + frag->page_offset; |
3207 | buffer->element[element].length = frag->size; | 3210 | buffer->element[element].length = frag->size; |
3208 | buffer->element[element].flags = SBAL_FLAGS_MIDDLE_FRAG; | 3211 | buffer->element[element].eflags = SBAL_EFLAGS_MIDDLE_FRAG; |
3209 | element++; | 3212 | element++; |
3210 | } | 3213 | } |
3211 | 3214 | ||
3212 | if (buffer->element[element - 1].flags) | 3215 | if (buffer->element[element - 1].eflags) |
3213 | buffer->element[element - 1].flags = SBAL_FLAGS_LAST_FRAG; | 3216 | buffer->element[element - 1].eflags = SBAL_EFLAGS_LAST_FRAG; |
3214 | *next_element_to_fill = element; | 3217 | *next_element_to_fill = element; |
3215 | } | 3218 | } |
3216 | 3219 | ||
@@ -3234,7 +3237,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, | |||
3234 | /*fill first buffer entry only with header information */ | 3237 | /*fill first buffer entry only with header information */ |
3235 | buffer->element[element].addr = skb->data; | 3238 | buffer->element[element].addr = skb->data; |
3236 | buffer->element[element].length = hdr_len; | 3239 | buffer->element[element].length = hdr_len; |
3237 | buffer->element[element].flags = SBAL_FLAGS_FIRST_FRAG; | 3240 | buffer->element[element].eflags = SBAL_EFLAGS_FIRST_FRAG; |
3238 | buf->next_element_to_fill++; | 3241 | buf->next_element_to_fill++; |
3239 | skb->data += hdr_len; | 3242 | skb->data += hdr_len; |
3240 | skb->len -= hdr_len; | 3243 | skb->len -= hdr_len; |
@@ -3246,7 +3249,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, | |||
3246 | buffer->element[element].addr = hdr; | 3249 | buffer->element[element].addr = hdr; |
3247 | buffer->element[element].length = sizeof(struct qeth_hdr) + | 3250 | buffer->element[element].length = sizeof(struct qeth_hdr) + |
3248 | hd_len; | 3251 | hd_len; |
3249 | buffer->element[element].flags = SBAL_FLAGS_FIRST_FRAG; | 3252 | buffer->element[element].eflags = SBAL_EFLAGS_FIRST_FRAG; |
3250 | buf->is_header[element] = 1; | 3253 | buf->is_header[element] = 1; |
3251 | buf->next_element_to_fill++; | 3254 | buf->next_element_to_fill++; |
3252 | } | 3255 | } |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 8512b5c0ef82..022fb6a8cb83 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -640,7 +640,7 @@ static struct fsf_qtcb *zfcp_qtcb_alloc(mempool_t *pool) | |||
640 | } | 640 | } |
641 | 641 | ||
642 | static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio, | 642 | static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio, |
643 | u32 fsf_cmd, u32 sbtype, | 643 | u32 fsf_cmd, u8 sbtype, |
644 | mempool_t *pool) | 644 | mempool_t *pool) |
645 | { | 645 | { |
646 | struct zfcp_adapter *adapter = qdio->adapter; | 646 | struct zfcp_adapter *adapter = qdio->adapter; |
@@ -841,7 +841,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd) | |||
841 | if (zfcp_qdio_sbal_get(qdio)) | 841 | if (zfcp_qdio_sbal_get(qdio)) |
842 | goto out; | 842 | goto out; |
843 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND, | 843 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_ABORT_FCP_CMND, |
844 | SBAL_FLAGS0_TYPE_READ, | 844 | SBAL_SFLAGS0_TYPE_READ, |
845 | qdio->adapter->pool.scsi_abort); | 845 | qdio->adapter->pool.scsi_abort); |
846 | if (IS_ERR(req)) { | 846 | if (IS_ERR(req)) { |
847 | req = NULL; | 847 | req = NULL; |
@@ -1012,7 +1012,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port, | |||
1012 | goto out; | 1012 | goto out; |
1013 | 1013 | ||
1014 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_GENERIC, | 1014 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_GENERIC, |
1015 | SBAL_FLAGS0_TYPE_WRITE_READ, pool); | 1015 | SBAL_SFLAGS0_TYPE_WRITE_READ, pool); |
1016 | 1016 | ||
1017 | if (IS_ERR(req)) { | 1017 | if (IS_ERR(req)) { |
1018 | ret = PTR_ERR(req); | 1018 | ret = PTR_ERR(req); |
@@ -1110,7 +1110,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id, | |||
1110 | goto out; | 1110 | goto out; |
1111 | 1111 | ||
1112 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_ELS, | 1112 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_SEND_ELS, |
1113 | SBAL_FLAGS0_TYPE_WRITE_READ, NULL); | 1113 | SBAL_SFLAGS0_TYPE_WRITE_READ, NULL); |
1114 | 1114 | ||
1115 | if (IS_ERR(req)) { | 1115 | if (IS_ERR(req)) { |
1116 | ret = PTR_ERR(req); | 1116 | ret = PTR_ERR(req); |
@@ -1156,7 +1156,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) | |||
1156 | goto out; | 1156 | goto out; |
1157 | 1157 | ||
1158 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, | 1158 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, |
1159 | SBAL_FLAGS0_TYPE_READ, | 1159 | SBAL_SFLAGS0_TYPE_READ, |
1160 | qdio->adapter->pool.erp_req); | 1160 | qdio->adapter->pool.erp_req); |
1161 | 1161 | ||
1162 | if (IS_ERR(req)) { | 1162 | if (IS_ERR(req)) { |
@@ -1198,7 +1198,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio, | |||
1198 | goto out_unlock; | 1198 | goto out_unlock; |
1199 | 1199 | ||
1200 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, | 1200 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_CONFIG_DATA, |
1201 | SBAL_FLAGS0_TYPE_READ, NULL); | 1201 | SBAL_SFLAGS0_TYPE_READ, NULL); |
1202 | 1202 | ||
1203 | if (IS_ERR(req)) { | 1203 | if (IS_ERR(req)) { |
1204 | retval = PTR_ERR(req); | 1204 | retval = PTR_ERR(req); |
@@ -1250,7 +1250,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) | |||
1250 | goto out; | 1250 | goto out; |
1251 | 1251 | ||
1252 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, | 1252 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, |
1253 | SBAL_FLAGS0_TYPE_READ, | 1253 | SBAL_SFLAGS0_TYPE_READ, |
1254 | qdio->adapter->pool.erp_req); | 1254 | qdio->adapter->pool.erp_req); |
1255 | 1255 | ||
1256 | if (IS_ERR(req)) { | 1256 | if (IS_ERR(req)) { |
@@ -1296,7 +1296,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio, | |||
1296 | goto out_unlock; | 1296 | goto out_unlock; |
1297 | 1297 | ||
1298 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, | 1298 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_EXCHANGE_PORT_DATA, |
1299 | SBAL_FLAGS0_TYPE_READ, NULL); | 1299 | SBAL_SFLAGS0_TYPE_READ, NULL); |
1300 | 1300 | ||
1301 | if (IS_ERR(req)) { | 1301 | if (IS_ERR(req)) { |
1302 | retval = PTR_ERR(req); | 1302 | retval = PTR_ERR(req); |
@@ -1412,7 +1412,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) | |||
1412 | goto out; | 1412 | goto out; |
1413 | 1413 | ||
1414 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, | 1414 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, |
1415 | SBAL_FLAGS0_TYPE_READ, | 1415 | SBAL_SFLAGS0_TYPE_READ, |
1416 | qdio->adapter->pool.erp_req); | 1416 | qdio->adapter->pool.erp_req); |
1417 | 1417 | ||
1418 | if (IS_ERR(req)) { | 1418 | if (IS_ERR(req)) { |
@@ -1478,7 +1478,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) | |||
1478 | goto out; | 1478 | goto out; |
1479 | 1479 | ||
1480 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, | 1480 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, |
1481 | SBAL_FLAGS0_TYPE_READ, | 1481 | SBAL_SFLAGS0_TYPE_READ, |
1482 | qdio->adapter->pool.erp_req); | 1482 | qdio->adapter->pool.erp_req); |
1483 | 1483 | ||
1484 | if (IS_ERR(req)) { | 1484 | if (IS_ERR(req)) { |
@@ -1553,7 +1553,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1553 | goto out; | 1553 | goto out; |
1554 | 1554 | ||
1555 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, | 1555 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_PORT_WITH_DID, |
1556 | SBAL_FLAGS0_TYPE_READ, | 1556 | SBAL_SFLAGS0_TYPE_READ, |
1557 | qdio->adapter->pool.erp_req); | 1557 | qdio->adapter->pool.erp_req); |
1558 | 1558 | ||
1559 | if (IS_ERR(req)) { | 1559 | if (IS_ERR(req)) { |
@@ -1606,7 +1606,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1606 | goto out; | 1606 | goto out; |
1607 | 1607 | ||
1608 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, | 1608 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PORT, |
1609 | SBAL_FLAGS0_TYPE_READ, | 1609 | SBAL_SFLAGS0_TYPE_READ, |
1610 | qdio->adapter->pool.erp_req); | 1610 | qdio->adapter->pool.erp_req); |
1611 | 1611 | ||
1612 | if (IS_ERR(req)) { | 1612 | if (IS_ERR(req)) { |
@@ -1698,7 +1698,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) | |||
1698 | goto out; | 1698 | goto out; |
1699 | 1699 | ||
1700 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PHYSICAL_PORT, | 1700 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_PHYSICAL_PORT, |
1701 | SBAL_FLAGS0_TYPE_READ, | 1701 | SBAL_SFLAGS0_TYPE_READ, |
1702 | qdio->adapter->pool.erp_req); | 1702 | qdio->adapter->pool.erp_req); |
1703 | 1703 | ||
1704 | if (IS_ERR(req)) { | 1704 | if (IS_ERR(req)) { |
@@ -1812,7 +1812,7 @@ int zfcp_fsf_open_lun(struct zfcp_erp_action *erp_action) | |||
1812 | goto out; | 1812 | goto out; |
1813 | 1813 | ||
1814 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_LUN, | 1814 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_OPEN_LUN, |
1815 | SBAL_FLAGS0_TYPE_READ, | 1815 | SBAL_SFLAGS0_TYPE_READ, |
1816 | adapter->pool.erp_req); | 1816 | adapter->pool.erp_req); |
1817 | 1817 | ||
1818 | if (IS_ERR(req)) { | 1818 | if (IS_ERR(req)) { |
@@ -1901,7 +1901,7 @@ int zfcp_fsf_close_lun(struct zfcp_erp_action *erp_action) | |||
1901 | goto out; | 1901 | goto out; |
1902 | 1902 | ||
1903 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_LUN, | 1903 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_CLOSE_LUN, |
1904 | SBAL_FLAGS0_TYPE_READ, | 1904 | SBAL_SFLAGS0_TYPE_READ, |
1905 | qdio->adapter->pool.erp_req); | 1905 | qdio->adapter->pool.erp_req); |
1906 | 1906 | ||
1907 | if (IS_ERR(req)) { | 1907 | if (IS_ERR(req)) { |
@@ -2161,7 +2161,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd) | |||
2161 | { | 2161 | { |
2162 | struct zfcp_fsf_req *req; | 2162 | struct zfcp_fsf_req *req; |
2163 | struct fcp_cmnd *fcp_cmnd; | 2163 | struct fcp_cmnd *fcp_cmnd; |
2164 | unsigned int sbtype = SBAL_FLAGS0_TYPE_READ; | 2164 | u8 sbtype = SBAL_SFLAGS0_TYPE_READ; |
2165 | int real_bytes, retval = -EIO, dix_bytes = 0; | 2165 | int real_bytes, retval = -EIO, dix_bytes = 0; |
2166 | struct scsi_device *sdev = scsi_cmnd->device; | 2166 | struct scsi_device *sdev = scsi_cmnd->device; |
2167 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | 2167 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); |
@@ -2181,7 +2181,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd) | |||
2181 | } | 2181 | } |
2182 | 2182 | ||
2183 | if (scsi_cmnd->sc_data_direction == DMA_TO_DEVICE) | 2183 | if (scsi_cmnd->sc_data_direction == DMA_TO_DEVICE) |
2184 | sbtype = SBAL_FLAGS0_TYPE_WRITE; | 2184 | sbtype = SBAL_SFLAGS0_TYPE_WRITE; |
2185 | 2185 | ||
2186 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, | 2186 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, |
2187 | sbtype, adapter->pool.scsi_req); | 2187 | sbtype, adapter->pool.scsi_req); |
@@ -2280,7 +2280,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd, | |||
2280 | goto out; | 2280 | goto out; |
2281 | 2281 | ||
2282 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, | 2282 | req = zfcp_fsf_req_create(qdio, FSF_QTCB_FCP_CMND, |
2283 | SBAL_FLAGS0_TYPE_WRITE, | 2283 | SBAL_SFLAGS0_TYPE_WRITE, |
2284 | qdio->adapter->pool.scsi_req); | 2284 | qdio->adapter->pool.scsi_req); |
2285 | 2285 | ||
2286 | if (IS_ERR(req)) { | 2286 | if (IS_ERR(req)) { |
@@ -2328,17 +2328,18 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, | |||
2328 | struct zfcp_qdio *qdio = adapter->qdio; | 2328 | struct zfcp_qdio *qdio = adapter->qdio; |
2329 | struct zfcp_fsf_req *req = NULL; | 2329 | struct zfcp_fsf_req *req = NULL; |
2330 | struct fsf_qtcb_bottom_support *bottom; | 2330 | struct fsf_qtcb_bottom_support *bottom; |
2331 | int direction, retval = -EIO, bytes; | 2331 | int retval = -EIO, bytes; |
2332 | u8 direction; | ||
2332 | 2333 | ||
2333 | if (!(adapter->adapter_features & FSF_FEATURE_CFDC)) | 2334 | if (!(adapter->adapter_features & FSF_FEATURE_CFDC)) |
2334 | return ERR_PTR(-EOPNOTSUPP); | 2335 | return ERR_PTR(-EOPNOTSUPP); |
2335 | 2336 | ||
2336 | switch (fsf_cfdc->command) { | 2337 | switch (fsf_cfdc->command) { |
2337 | case FSF_QTCB_DOWNLOAD_CONTROL_FILE: | 2338 | case FSF_QTCB_DOWNLOAD_CONTROL_FILE: |
2338 | direction = SBAL_FLAGS0_TYPE_WRITE; | 2339 | direction = SBAL_SFLAGS0_TYPE_WRITE; |
2339 | break; | 2340 | break; |
2340 | case FSF_QTCB_UPLOAD_CONTROL_FILE: | 2341 | case FSF_QTCB_UPLOAD_CONTROL_FILE: |
2341 | direction = SBAL_FLAGS0_TYPE_READ; | 2342 | direction = SBAL_SFLAGS0_TYPE_READ; |
2342 | break; | 2343 | break; |
2343 | default: | 2344 | default: |
2344 | return ERR_PTR(-EINVAL); | 2345 | return ERR_PTR(-EINVAL); |
@@ -2413,7 +2414,7 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx) | |||
2413 | fsf_req->qdio_req.sbal_response = sbal_idx; | 2414 | fsf_req->qdio_req.sbal_response = sbal_idx; |
2414 | zfcp_fsf_req_complete(fsf_req); | 2415 | zfcp_fsf_req_complete(fsf_req); |
2415 | 2416 | ||
2416 | if (likely(sbale->flags & SBAL_FLAGS_LAST_ENTRY)) | 2417 | if (likely(sbale->eflags & SBAL_EFLAGS_LAST_ENTRY)) |
2417 | break; | 2418 | break; |
2418 | } | 2419 | } |
2419 | } | 2420 | } |
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index 98e97d90835b..d9c40ea73eef 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c | |||
@@ -124,7 +124,7 @@ zfcp_qdio_sbal_chain(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req) | |||
124 | 124 | ||
125 | /* set last entry flag in current SBALE of current SBAL */ | 125 | /* set last entry flag in current SBALE of current SBAL */ |
126 | sbale = zfcp_qdio_sbale_curr(qdio, q_req); | 126 | sbale = zfcp_qdio_sbale_curr(qdio, q_req); |
127 | sbale->flags |= SBAL_FLAGS_LAST_ENTRY; | 127 | sbale->eflags |= SBAL_EFLAGS_LAST_ENTRY; |
128 | 128 | ||
129 | /* don't exceed last allowed SBAL */ | 129 | /* don't exceed last allowed SBAL */ |
130 | if (q_req->sbal_last == q_req->sbal_limit) | 130 | if (q_req->sbal_last == q_req->sbal_limit) |
@@ -132,7 +132,7 @@ zfcp_qdio_sbal_chain(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req) | |||
132 | 132 | ||
133 | /* set chaining flag in first SBALE of current SBAL */ | 133 | /* set chaining flag in first SBALE of current SBAL */ |
134 | sbale = zfcp_qdio_sbale_req(qdio, q_req); | 134 | sbale = zfcp_qdio_sbale_req(qdio, q_req); |
135 | sbale->flags |= SBAL_FLAGS0_MORE_SBALS; | 135 | sbale->sflags |= SBAL_SFLAGS0_MORE_SBALS; |
136 | 136 | ||
137 | /* calculate index of next SBAL */ | 137 | /* calculate index of next SBAL */ |
138 | q_req->sbal_last++; | 138 | q_req->sbal_last++; |
@@ -147,7 +147,7 @@ zfcp_qdio_sbal_chain(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req) | |||
147 | 147 | ||
148 | /* set storage-block type for new SBAL */ | 148 | /* set storage-block type for new SBAL */ |
149 | sbale = zfcp_qdio_sbale_curr(qdio, q_req); | 149 | sbale = zfcp_qdio_sbale_curr(qdio, q_req); |
150 | sbale->flags |= q_req->sbtype; | 150 | sbale->sflags |= q_req->sbtype; |
151 | 151 | ||
152 | return sbale; | 152 | return sbale; |
153 | } | 153 | } |
@@ -177,7 +177,7 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req, | |||
177 | 177 | ||
178 | /* set storage-block type for this request */ | 178 | /* set storage-block type for this request */ |
179 | sbale = zfcp_qdio_sbale_req(qdio, q_req); | 179 | sbale = zfcp_qdio_sbale_req(qdio, q_req); |
180 | sbale->flags |= q_req->sbtype; | 180 | sbale->sflags |= q_req->sbtype; |
181 | 181 | ||
182 | for (; sg; sg = sg_next(sg)) { | 182 | for (; sg; sg = sg_next(sg)) { |
183 | sbale = zfcp_qdio_sbale_next(qdio, q_req); | 183 | sbale = zfcp_qdio_sbale_next(qdio, q_req); |
@@ -384,7 +384,8 @@ int zfcp_qdio_open(struct zfcp_qdio *qdio) | |||
384 | for (cc = 0; cc < QDIO_MAX_BUFFERS_PER_Q; cc++) { | 384 | for (cc = 0; cc < QDIO_MAX_BUFFERS_PER_Q; cc++) { |
385 | sbale = &(qdio->res_q[cc]->element[0]); | 385 | sbale = &(qdio->res_q[cc]->element[0]); |
386 | sbale->length = 0; | 386 | sbale->length = 0; |
387 | sbale->flags = SBAL_FLAGS_LAST_ENTRY; | 387 | sbale->eflags = SBAL_EFLAGS_LAST_ENTRY; |
388 | sbale->sflags = 0; | ||
388 | sbale->addr = NULL; | 389 | sbale->addr = NULL; |
389 | } | 390 | } |
390 | 391 | ||
diff --git a/drivers/s390/scsi/zfcp_qdio.h b/drivers/s390/scsi/zfcp_qdio.h index 2297d8d3e947..54e22ace012b 100644 --- a/drivers/s390/scsi/zfcp_qdio.h +++ b/drivers/s390/scsi/zfcp_qdio.h | |||
@@ -67,7 +67,7 @@ struct zfcp_qdio { | |||
67 | * @qdio_outb_usage: usage of outbound queue | 67 | * @qdio_outb_usage: usage of outbound queue |
68 | */ | 68 | */ |
69 | struct zfcp_qdio_req { | 69 | struct zfcp_qdio_req { |
70 | u32 sbtype; | 70 | u8 sbtype; |
71 | u8 sbal_number; | 71 | u8 sbal_number; |
72 | u8 sbal_first; | 72 | u8 sbal_first; |
73 | u8 sbal_last; | 73 | u8 sbal_last; |
@@ -116,7 +116,7 @@ zfcp_qdio_sbale_curr(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req) | |||
116 | */ | 116 | */ |
117 | static inline | 117 | static inline |
118 | void zfcp_qdio_req_init(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req, | 118 | void zfcp_qdio_req_init(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req, |
119 | unsigned long req_id, u32 sbtype, void *data, u32 len) | 119 | unsigned long req_id, u8 sbtype, void *data, u32 len) |
120 | { | 120 | { |
121 | struct qdio_buffer_element *sbale; | 121 | struct qdio_buffer_element *sbale; |
122 | int count = min(atomic_read(&qdio->req_q_free), | 122 | int count = min(atomic_read(&qdio->req_q_free), |
@@ -131,7 +131,8 @@ void zfcp_qdio_req_init(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req, | |||
131 | 131 | ||
132 | sbale = zfcp_qdio_sbale_req(qdio, q_req); | 132 | sbale = zfcp_qdio_sbale_req(qdio, q_req); |
133 | sbale->addr = (void *) req_id; | 133 | sbale->addr = (void *) req_id; |
134 | sbale->flags = SBAL_FLAGS0_COMMAND | sbtype; | 134 | sbale->eflags = 0; |
135 | sbale->sflags = SBAL_SFLAGS0_COMMAND | sbtype; | ||
135 | 136 | ||
136 | if (unlikely(!data)) | 137 | if (unlikely(!data)) |
137 | return; | 138 | return; |
@@ -173,7 +174,7 @@ void zfcp_qdio_set_sbale_last(struct zfcp_qdio *qdio, | |||
173 | struct qdio_buffer_element *sbale; | 174 | struct qdio_buffer_element *sbale; |
174 | 175 | ||
175 | sbale = zfcp_qdio_sbale_curr(qdio, q_req); | 176 | sbale = zfcp_qdio_sbale_curr(qdio, q_req); |
176 | sbale->flags |= SBAL_FLAGS_LAST_ENTRY; | 177 | sbale->eflags |= SBAL_EFLAGS_LAST_ENTRY; |
177 | } | 178 | } |
178 | 179 | ||
179 | /** | 180 | /** |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 58584dc0724a..44e8ca398efa 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -297,7 +297,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
297 | kfree(sdev); | 297 | kfree(sdev); |
298 | goto out; | 298 | goto out; |
299 | } | 299 | } |
300 | 300 | blk_get_queue(sdev->request_queue); | |
301 | sdev->request_queue->queuedata = sdev; | 301 | sdev->request_queue->queuedata = sdev; |
302 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); | 302 | scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); |
303 | 303 | ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index e63912510fb9..e0bd3f790fca 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -322,6 +322,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) | |||
322 | kfree(evt); | 322 | kfree(evt); |
323 | } | 323 | } |
324 | 324 | ||
325 | blk_put_queue(sdev->request_queue); | ||
325 | /* NULL queue means the device can't be used */ | 326 | /* NULL queue means the device can't be used */ |
326 | sdev->request_queue = NULL; | 327 | sdev->request_queue = NULL; |
327 | 328 | ||
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index 4f64183b27fa..7e9c39951ecb 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c | |||
@@ -635,7 +635,7 @@ static void clks_core_resume(void) | |||
635 | struct clk *clkp; | 635 | struct clk *clkp; |
636 | 636 | ||
637 | list_for_each_entry(clkp, &clock_list, node) { | 637 | list_for_each_entry(clkp, &clock_list, node) { |
638 | if (likely(clkp->ops)) { | 638 | if (likely(clkp->usecount && clkp->ops)) { |
639 | unsigned long rate = clkp->rate; | 639 | unsigned long rate = clkp->rate; |
640 | 640 | ||
641 | if (likely(clkp->ops->set_parent)) | 641 | if (likely(clkp->ops->set_parent)) |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index 6a9e58dd36c7..d18ce9e946d8 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -1861,6 +1861,7 @@ static int pl022_setup(struct spi_device *spi) | |||
1861 | } | 1861 | } |
1862 | if ((clk_freq.cpsdvsr < CPSDVR_MIN) | 1862 | if ((clk_freq.cpsdvsr < CPSDVR_MIN) |
1863 | || (clk_freq.cpsdvsr > CPSDVR_MAX)) { | 1863 | || (clk_freq.cpsdvsr > CPSDVR_MAX)) { |
1864 | status = -EINVAL; | ||
1864 | dev_err(&spi->dev, | 1865 | dev_err(&spi->dev, |
1865 | "cpsdvsr is configured incorrectly\n"); | 1866 | "cpsdvsr is configured incorrectly\n"); |
1866 | goto err_config_params; | 1867 | goto err_config_params; |
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 6f86ba0175ac..969cdd2fe124 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
@@ -298,7 +298,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) | |||
298 | unsigned int count, c; | 298 | unsigned int count, c; |
299 | unsigned long base, tx_reg, rx_reg; | 299 | unsigned long base, tx_reg, rx_reg; |
300 | int word_len, data_type, element_count; | 300 | int word_len, data_type, element_count; |
301 | int elements; | 301 | int elements = 0; |
302 | u32 l; | 302 | u32 l; |
303 | u8 * rx; | 303 | u8 * rx; |
304 | const u8 * tx; | 304 | const u8 * tx; |
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index f706dba165cf..cc880c95e7de 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -681,13 +681,14 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
681 | drv_data->cs_change = transfer->cs_change; | 681 | drv_data->cs_change = transfer->cs_change; |
682 | 682 | ||
683 | /* Bits per word setup */ | 683 | /* Bits per word setup */ |
684 | bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word; | 684 | bits_per_word = transfer->bits_per_word ? : |
685 | if ((bits_per_word > 0) && (bits_per_word % 16 == 0)) { | 685 | message->spi->bits_per_word ? : 8; |
686 | if (bits_per_word % 16 == 0) { | ||
686 | drv_data->n_bytes = bits_per_word/8; | 687 | drv_data->n_bytes = bits_per_word/8; |
687 | drv_data->len = (transfer->len) >> 1; | 688 | drv_data->len = (transfer->len) >> 1; |
688 | cr_width = BIT_CTL_WORDSIZE; | 689 | cr_width = BIT_CTL_WORDSIZE; |
689 | drv_data->ops = &bfin_bfin_spi_transfer_ops_u16; | 690 | drv_data->ops = &bfin_bfin_spi_transfer_ops_u16; |
690 | } else if ((bits_per_word > 0) && (bits_per_word % 8 == 0)) { | 691 | } else if (bits_per_word % 8 == 0) { |
691 | drv_data->n_bytes = bits_per_word/8; | 692 | drv_data->n_bytes = bits_per_word/8; |
692 | drv_data->len = transfer->len; | 693 | drv_data->len = transfer->len; |
693 | cr_width = 0; | 694 | cr_width = 0; |
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c index 82feb348c8bb..2a20dabec76d 100644 --- a/drivers/ssb/driver_pcicore.c +++ b/drivers/ssb/driver_pcicore.c | |||
@@ -539,10 +539,12 @@ void ssb_pcicore_init(struct ssb_pcicore *pc) | |||
539 | if (!pc->hostmode) | 539 | if (!pc->hostmode) |
540 | ssb_pcicore_init_clientmode(pc); | 540 | ssb_pcicore_init_clientmode(pc); |
541 | 541 | ||
542 | /* Additional always once-executed workarounds */ | 542 | /* Additional PCIe always once-executed workarounds */ |
543 | ssb_pcicore_serdes_workaround(pc); | 543 | if (dev->id.coreid == SSB_DEV_PCIE) { |
544 | /* TODO: ASPM */ | 544 | ssb_pcicore_serdes_workaround(pc); |
545 | /* TODO: Clock Request Update */ | 545 | /* TODO: ASPM */ |
546 | /* TODO: Clock Request Update */ | ||
547 | } | ||
546 | } | 548 | } |
547 | 549 | ||
548 | static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address) | 550 | static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address) |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index dfc16f955eb8..196284dc2f36 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -24,23 +24,6 @@ menuconfig STAGING | |||
24 | 24 | ||
25 | if STAGING | 25 | if STAGING |
26 | 26 | ||
27 | config STAGING_EXCLUDE_BUILD | ||
28 | bool "Exclude Staging drivers from being built" if STAGING | ||
29 | default y | ||
30 | ---help--- | ||
31 | Are you sure you really want to build the staging drivers? | ||
32 | They taint your kernel, don't live up to the normal Linux | ||
33 | kernel quality standards, are a bit crufty around the edges, | ||
34 | and might go off and kick your dog when you aren't paying | ||
35 | attention. | ||
36 | |||
37 | Say N here to be able to select and build the Staging drivers. | ||
38 | This option is primarily here to prevent them from being built | ||
39 | when selecting 'make allyesconfg' and 'make allmodconfig' so | ||
40 | don't be all that put off, your dog will be just fine. | ||
41 | |||
42 | if !STAGING_EXCLUDE_BUILD | ||
43 | |||
44 | source "drivers/staging/tty/Kconfig" | 27 | source "drivers/staging/tty/Kconfig" |
45 | 28 | ||
46 | source "drivers/staging/generic_serial/Kconfig" | 29 | source "drivers/staging/generic_serial/Kconfig" |
@@ -177,5 +160,4 @@ source "drivers/staging/mei/Kconfig" | |||
177 | 160 | ||
178 | source "drivers/staging/nvec/Kconfig" | 161 | source "drivers/staging/nvec/Kconfig" |
179 | 162 | ||
180 | endif # !STAGING_EXCLUDE_BUILD | ||
181 | endif # STAGING | 163 | endif # STAGING |
diff --git a/drivers/staging/altera-stapl/altera-jtag.c b/drivers/staging/altera-stapl/altera-jtag.c index 876308858b82..8b1620b1b2d0 100644 --- a/drivers/staging/altera-stapl/altera-jtag.c +++ b/drivers/staging/altera-stapl/altera-jtag.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/firmware.h> | 27 | #include <linux/firmware.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <staging/altera.h> | 29 | #include "altera.h" |
30 | #include "altera-exprt.h" | 30 | #include "altera-exprt.h" |
31 | #include "altera-jtag.h" | 31 | #include "altera-jtag.h" |
32 | 32 | ||
diff --git a/drivers/staging/altera-stapl/altera.c b/drivers/staging/altera-stapl/altera.c index 05aad351b120..9cd5e76880c0 100644 --- a/drivers/staging/altera-stapl/altera.c +++ b/drivers/staging/altera-stapl/altera.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/firmware.h> | 29 | #include <linux/firmware.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <staging/altera.h> | 31 | #include "altera.h" |
32 | #include "altera-exprt.h" | 32 | #include "altera-exprt.h" |
33 | #include "altera-jtag.h" | 33 | #include "altera-jtag.h" |
34 | 34 | ||
diff --git a/drivers/staging/altera-stapl/altera.h b/drivers/staging/altera-stapl/altera.h new file mode 100644 index 000000000000..94c0c6181daf --- /dev/null +++ b/drivers/staging/altera-stapl/altera.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * altera.h | ||
3 | * | ||
4 | * altera FPGA driver | ||
5 | * | ||
6 | * Copyright (C) Altera Corporation 1998-2001 | ||
7 | * Copyright (C) 2010 NetUP Inc. | ||
8 | * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | ||
25 | |||
26 | #ifndef _ALTERA_H_ | ||
27 | #define _ALTERA_H_ | ||
28 | |||
29 | struct altera_config { | ||
30 | void *dev; | ||
31 | u8 *action; | ||
32 | int (*jtag_io) (void *dev, int tms, int tdi, int tdo); | ||
33 | }; | ||
34 | |||
35 | #if defined(CONFIG_ALTERA_STAPL) || \ | ||
36 | (defined(CONFIG_ALTERA_STAPL_MODULE) && defined(MODULE)) | ||
37 | |||
38 | extern int altera_init(struct altera_config *config, const struct firmware *fw); | ||
39 | #else | ||
40 | |||
41 | static inline int altera_init(struct altera_config *config, | ||
42 | const struct firmware *fw) | ||
43 | { | ||
44 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
45 | return 0; | ||
46 | } | ||
47 | #endif /* CONFIG_ALTERA_STAPL */ | ||
48 | |||
49 | #endif /* _ALTERA_H_ */ | ||
diff --git a/drivers/staging/ath6kl/Kconfig b/drivers/staging/ath6kl/Kconfig index 1f15e1fb1ab2..afd6cc16a2b8 100644 --- a/drivers/staging/ath6kl/Kconfig +++ b/drivers/staging/ath6kl/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config ATH6K_LEGACY | 1 | config ATH6K_LEGACY |
2 | tristate "Atheros AR6003 support (non mac80211)" | 2 | tristate "Atheros AR6003 support (non mac80211)" |
3 | depends on MMC && WLAN | 3 | depends on MMC && WLAN |
4 | depends on CFG80211 | ||
4 | select WIRELESS_EXT | 5 | select WIRELESS_EXT |
5 | select WEXT_PRIV | 6 | select WEXT_PRIV |
6 | help | 7 | help |
diff --git a/drivers/staging/ath6kl/os/linux/cfg80211.c b/drivers/staging/ath6kl/os/linux/cfg80211.c index 77dfb4070c1d..d3a774dbb7e8 100644 --- a/drivers/staging/ath6kl/os/linux/cfg80211.c +++ b/drivers/staging/ath6kl/os/linux/cfg80211.c | |||
@@ -870,7 +870,8 @@ ar6k_cfg80211_scanComplete_event(struct ar6_softc *ar, int status) | |||
870 | if(ar->scan_request) | 870 | if(ar->scan_request) |
871 | { | 871 | { |
872 | /* Translate data to cfg80211 mgmt format */ | 872 | /* Translate data to cfg80211 mgmt format */ |
873 | wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy); | 873 | if (ar->arWmi) |
874 | wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy); | ||
874 | 875 | ||
875 | cfg80211_scan_done(ar->scan_request, | 876 | cfg80211_scan_done(ar->scan_request, |
876 | ((status & A_ECANCELED) || (status & A_EBUSY)) ? true : false); | 877 | ((status & A_ECANCELED) || (status & A_EBUSY)) ? true : false); |
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c index 929ceaf363be..15e1b05ca92d 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c | |||
@@ -64,8 +64,6 @@ wl_iw_extra_params_t g_wl_iw_params; | |||
64 | extern bool wl_iw_conn_status_str(u32 event_type, u32 status, | 64 | extern bool wl_iw_conn_status_str(u32 event_type, u32 status, |
65 | u32 reason, char *stringBuf, uint buflen); | 65 | u32 reason, char *stringBuf, uint buflen); |
66 | 66 | ||
67 | uint wl_msg_level = WL_ERROR_VAL; | ||
68 | |||
69 | #define MAX_WLIW_IOCTL_LEN 1024 | 67 | #define MAX_WLIW_IOCTL_LEN 1024 |
70 | 68 | ||
71 | #ifdef CONFIG_WIRELESS_EXT | 69 | #ifdef CONFIG_WIRELESS_EXT |
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c index 1c45c11a774e..aa87b1b6a44a 100644 --- a/drivers/staging/gma500/psb_drv.c +++ b/drivers/staging/gma500/psb_drv.c | |||
@@ -542,6 +542,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) | |||
542 | unsigned long irqflags; | 542 | unsigned long irqflags; |
543 | int ret = -ENOMEM; | 543 | int ret = -ENOMEM; |
544 | uint32_t tt_pages; | 544 | uint32_t tt_pages; |
545 | struct drm_connector *connector; | ||
546 | struct psb_intel_output *psb_intel_output; | ||
545 | 547 | ||
546 | dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); | 548 | dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); |
547 | if (dev_priv == NULL) | 549 | if (dev_priv == NULL) |
@@ -663,7 +665,18 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) | |||
663 | drm_kms_helper_poll_init(dev); | 665 | drm_kms_helper_poll_init(dev); |
664 | } | 666 | } |
665 | 667 | ||
666 | ret = psb_backlight_init(dev); | 668 | /* Only add backlight support if we have LVDS output */ |
669 | list_for_each_entry(connector, &dev->mode_config.connector_list, | ||
670 | head) { | ||
671 | psb_intel_output = to_psb_intel_output(connector); | ||
672 | |||
673 | switch (psb_intel_output->type) { | ||
674 | case INTEL_OUTPUT_LVDS: | ||
675 | ret = psb_backlight_init(dev); | ||
676 | break; | ||
677 | } | ||
678 | } | ||
679 | |||
667 | if (ret) | 680 | if (ret) |
668 | return ret; | 681 | return ret; |
669 | #if 0 | 682 | #if 0 |
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c index 99c03a2e06bd..084c36bbfe86 100644 --- a/drivers/staging/gma500/psb_fb.c +++ b/drivers/staging/gma500/psb_fb.c | |||
@@ -441,6 +441,16 @@ static int psbfb_create(struct psb_fbdev *fbdev, | |||
441 | info->screen_size = size; | 441 | info->screen_size = size; |
442 | memset(info->screen_base, 0, size); | 442 | memset(info->screen_base, 0, size); |
443 | 443 | ||
444 | if (dev_priv->pg->stolen_size) { | ||
445 | info->apertures = alloc_apertures(1); | ||
446 | if (!info->apertures) { | ||
447 | ret = -ENOMEM; | ||
448 | goto out_err0; | ||
449 | } | ||
450 | info->apertures->ranges[0].base = dev->mode_config.fb_base; | ||
451 | info->apertures->ranges[0].size = dev_priv->pg->stolen_size; | ||
452 | } | ||
453 | |||
444 | drm_fb_helper_fill_fix(info, fb->pitch, fb->depth); | 454 | drm_fb_helper_fill_fix(info, fb->pitch, fb->depth); |
445 | drm_fb_helper_fill_var(info, &fbdev->psb_fb_helper, | 455 | drm_fb_helper_fill_var(info, &fbdev->psb_fb_helper, |
446 | sizes->fb_width, sizes->fb_height); | 456 | sizes->fb_width, sizes->fb_height); |
diff --git a/drivers/staging/gma500/psb_intel_bios.c b/drivers/staging/gma500/psb_intel_bios.c index 48ac8ba7f40b..417965da5e24 100644 --- a/drivers/staging/gma500/psb_intel_bios.c +++ b/drivers/staging/gma500/psb_intel_bios.c | |||
@@ -154,10 +154,15 @@ static void parse_lfp_panel_data(struct drm_psb_private *dev_priv, | |||
154 | 154 | ||
155 | fill_detail_timing_data(panel_fixed_mode, dvo_timing); | 155 | fill_detail_timing_data(panel_fixed_mode, dvo_timing); |
156 | 156 | ||
157 | dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode; | 157 | if (panel_fixed_mode->htotal > 0 && panel_fixed_mode->vtotal > 0) { |
158 | 158 | dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode; | |
159 | DRM_DEBUG("Found panel mode in BIOS VBT tables:\n"); | 159 | DRM_DEBUG("Found panel mode in BIOS VBT tables:\n"); |
160 | drm_mode_debug_printmodeline(panel_fixed_mode); | 160 | drm_mode_debug_printmodeline(panel_fixed_mode); |
161 | } else { | ||
162 | DRM_DEBUG("Ignoring bogus LVDS VBT mode.\n"); | ||
163 | dev_priv->lvds_vbt = 0; | ||
164 | kfree(panel_fixed_mode); | ||
165 | } | ||
161 | 166 | ||
162 | return; | 167 | return; |
163 | } | 168 | } |
diff --git a/drivers/staging/iio/accel/adis16201.h b/drivers/staging/iio/accel/adis16201.h index 0b9b85424dfa..4cc1a5bfab40 100644 --- a/drivers/staging/iio/accel/adis16201.h +++ b/drivers/staging/iio/accel/adis16201.h | |||
@@ -81,7 +81,6 @@ struct adis16201_state { | |||
81 | 81 | ||
82 | int adis16201_set_irq(struct iio_dev *indio_dev, bool enable); | 82 | int adis16201_set_irq(struct iio_dev *indio_dev, bool enable); |
83 | 83 | ||
84 | #ifdef CONFIG_IIO_RING_BUFFER | ||
85 | enum adis16201_scan { | 84 | enum adis16201_scan { |
86 | ADIS16201_SCAN_SUPPLY, | 85 | ADIS16201_SCAN_SUPPLY, |
87 | ADIS16201_SCAN_ACC_X, | 86 | ADIS16201_SCAN_ACC_X, |
@@ -92,6 +91,7 @@ enum adis16201_scan { | |||
92 | ADIS16201_SCAN_INCLI_Y, | 91 | ADIS16201_SCAN_INCLI_Y, |
93 | }; | 92 | }; |
94 | 93 | ||
94 | #ifdef CONFIG_IIO_RING_BUFFER | ||
95 | void adis16201_remove_trigger(struct iio_dev *indio_dev); | 95 | void adis16201_remove_trigger(struct iio_dev *indio_dev); |
96 | int adis16201_probe_trigger(struct iio_dev *indio_dev); | 96 | int adis16201_probe_trigger(struct iio_dev *indio_dev); |
97 | 97 | ||
diff --git a/drivers/staging/iio/accel/adis16203.h b/drivers/staging/iio/accel/adis16203.h index 8bb8ce50c248..175e21bb9b40 100644 --- a/drivers/staging/iio/accel/adis16203.h +++ b/drivers/staging/iio/accel/adis16203.h | |||
@@ -76,7 +76,6 @@ struct adis16203_state { | |||
76 | 76 | ||
77 | int adis16203_set_irq(struct iio_dev *indio_dev, bool enable); | 77 | int adis16203_set_irq(struct iio_dev *indio_dev, bool enable); |
78 | 78 | ||
79 | #ifdef CONFIG_IIO_RING_BUFFER | ||
80 | enum adis16203_scan { | 79 | enum adis16203_scan { |
81 | ADIS16203_SCAN_SUPPLY, | 80 | ADIS16203_SCAN_SUPPLY, |
82 | ADIS16203_SCAN_AUX_ADC, | 81 | ADIS16203_SCAN_AUX_ADC, |
@@ -85,6 +84,7 @@ enum adis16203_scan { | |||
85 | ADIS16203_SCAN_INCLI_Y, | 84 | ADIS16203_SCAN_INCLI_Y, |
86 | }; | 85 | }; |
87 | 86 | ||
87 | #ifdef CONFIG_IIO_RING_BUFFER | ||
88 | void adis16203_remove_trigger(struct iio_dev *indio_dev); | 88 | void adis16203_remove_trigger(struct iio_dev *indio_dev); |
89 | int adis16203_probe_trigger(struct iio_dev *indio_dev); | 89 | int adis16203_probe_trigger(struct iio_dev *indio_dev); |
90 | 90 | ||
diff --git a/drivers/staging/iio/dac/max517.c b/drivers/staging/iio/dac/max517.c index 881768df47a6..2fe34d21b6aa 100644 --- a/drivers/staging/iio/dac/max517.c +++ b/drivers/staging/iio/dac/max517.c | |||
@@ -195,7 +195,7 @@ static const struct iio_info max517_info = { | |||
195 | }; | 195 | }; |
196 | 196 | ||
197 | static const struct iio_info max518_info = { | 197 | static const struct iio_info max518_info = { |
198 | .attrs = &max517_attribute_group, | 198 | .attrs = &max518_attribute_group, |
199 | .driver_module = THIS_MODULE, | 199 | .driver_module = THIS_MODULE, |
200 | }; | 200 | }; |
201 | 201 | ||
diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c index 2589a7e167e4..3612373ddede 100644 --- a/drivers/staging/iio/imu/adis16400_ring.c +++ b/drivers/staging/iio/imu/adis16400_ring.c | |||
@@ -137,13 +137,13 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p) | |||
137 | if (st->variant->flags & ADIS16400_NO_BURST) { | 137 | if (st->variant->flags & ADIS16400_NO_BURST) { |
138 | ret = adis16350_spi_read_all(&indio_dev->dev, st->rx); | 138 | ret = adis16350_spi_read_all(&indio_dev->dev, st->rx); |
139 | if (ret < 0) | 139 | if (ret < 0) |
140 | return ret; | 140 | goto err; |
141 | for (; i < ring->scan_count; i++) | 141 | for (; i < ring->scan_count; i++) |
142 | data[i] = *(s16 *)(st->rx + i*2); | 142 | data[i] = *(s16 *)(st->rx + i*2); |
143 | } else { | 143 | } else { |
144 | ret = adis16400_spi_read_burst(&indio_dev->dev, st->rx); | 144 | ret = adis16400_spi_read_burst(&indio_dev->dev, st->rx); |
145 | if (ret < 0) | 145 | if (ret < 0) |
146 | return ret; | 146 | goto err; |
147 | for (; i < indio_dev->ring->scan_count; i++) { | 147 | for (; i < indio_dev->ring->scan_count; i++) { |
148 | j = __ffs(mask); | 148 | j = __ffs(mask); |
149 | mask &= ~(1 << j); | 149 | mask &= ~(1 << j); |
@@ -158,9 +158,13 @@ static irqreturn_t adis16400_trigger_handler(int irq, void *p) | |||
158 | ring->access->store_to(indio_dev->ring, (u8 *) data, pf->timestamp); | 158 | ring->access->store_to(indio_dev->ring, (u8 *) data, pf->timestamp); |
159 | 159 | ||
160 | iio_trigger_notify_done(indio_dev->trig); | 160 | iio_trigger_notify_done(indio_dev->trig); |
161 | kfree(data); | ||
162 | 161 | ||
162 | kfree(data); | ||
163 | return IRQ_HANDLED; | 163 | return IRQ_HANDLED; |
164 | |||
165 | err: | ||
166 | kfree(data); | ||
167 | return ret; | ||
164 | } | 168 | } |
165 | 169 | ||
166 | void adis16400_unconfigure_ring(struct iio_dev *indio_dev) | 170 | void adis16400_unconfigure_ring(struct iio_dev *indio_dev) |
diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c index 615902333fb0..d504aa251ced 100644 --- a/drivers/staging/iio/industrialio-trigger.c +++ b/drivers/staging/iio/industrialio-trigger.c | |||
@@ -294,6 +294,7 @@ struct iio_poll_func | |||
294 | pf->h = h; | 294 | pf->h = h; |
295 | pf->thread = thread; | 295 | pf->thread = thread; |
296 | pf->type = type; | 296 | pf->type = type; |
297 | pf->private_data = private; | ||
297 | 298 | ||
298 | return pf; | 299 | return pf; |
299 | } | 300 | } |
diff --git a/drivers/staging/mei/init.c b/drivers/staging/mei/init.c index 2818851c0761..d1ffa32cd141 100644 --- a/drivers/staging/mei/init.c +++ b/drivers/staging/mei/init.c | |||
@@ -205,10 +205,10 @@ int mei_hw_init(struct mei_device *dev) | |||
205 | "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", | 205 | "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", |
206 | dev->host_hw_state, dev->me_hw_state); | 206 | dev->host_hw_state, dev->me_hw_state); |
207 | 207 | ||
208 | if (!(dev->host_hw_state & H_RDY) != H_RDY) | 208 | if (!(dev->host_hw_state & H_RDY)) |
209 | dev_dbg(&dev->pdev->dev, "host turn off H_RDY.\n"); | 209 | dev_dbg(&dev->pdev->dev, "host turn off H_RDY.\n"); |
210 | 210 | ||
211 | if (!(dev->me_hw_state & ME_RDY_HRA) != ME_RDY_HRA) | 211 | if (!(dev->me_hw_state & ME_RDY_HRA)) |
212 | dev_dbg(&dev->pdev->dev, "ME turn off ME_RDY.\n"); | 212 | dev_dbg(&dev->pdev->dev, "ME turn off ME_RDY.\n"); |
213 | 213 | ||
214 | printk(KERN_ERR "mei: link layer initialization failed.\n"); | 214 | printk(KERN_ERR "mei: link layer initialization failed.\n"); |
diff --git a/drivers/staging/olpc_dcon/Kconfig b/drivers/staging/olpc_dcon/Kconfig index b05306766870..fe40e0b6f675 100644 --- a/drivers/staging/olpc_dcon/Kconfig +++ b/drivers/staging/olpc_dcon/Kconfig | |||
@@ -2,6 +2,7 @@ config FB_OLPC_DCON | |||
2 | tristate "One Laptop Per Child Display CONtroller support" | 2 | tristate "One Laptop Per Child Display CONtroller support" |
3 | depends on OLPC && FB | 3 | depends on OLPC && FB |
4 | select I2C | 4 | select I2C |
5 | select BACKLIGHT_CLASS_DEVICE | ||
5 | ---help--- | 6 | ---help--- |
6 | Add support for the OLPC XO DCON controller. This controller is | 7 | Add support for the OLPC XO DCON controller. This controller is |
7 | only available on OLPC platforms. Unless you have one of these | 8 | only available on OLPC platforms. Unless you have one of these |
diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c index bddb0312b31e..cdae497d5467 100644 --- a/drivers/staging/rts_pstor/sd.c +++ b/drivers/staging/rts_pstor/sd.c | |||
@@ -2328,7 +2328,7 @@ Switch_Fail: | |||
2328 | 2328 | ||
2329 | retval = sd_send_cmd_get_rsp(chip, IO_SEND_OP_COND, 0, SD_RSP_TYPE_R4, rsp, 5); | 2329 | retval = sd_send_cmd_get_rsp(chip, IO_SEND_OP_COND, 0, SD_RSP_TYPE_R4, rsp, 5); |
2330 | if (retval == STATUS_SUCCESS) { | 2330 | if (retval == STATUS_SUCCESS) { |
2331 | int func_num = (rsp[1] >> 4) && 0x07; | 2331 | int func_num = (rsp[1] >> 4) & 0x07; |
2332 | if (func_num) { | 2332 | if (func_num) { |
2333 | RTSX_DEBUGP("SD_IO card (Function number: %d)!\n", func_num); | 2333 | RTSX_DEBUGP("SD_IO card (Function number: %d)!\n", func_num); |
2334 | chip->sd_io = 1; | 2334 | chip->sd_io = 1; |
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index 6e99ec87fee0..8cbea42b69bc 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c | |||
@@ -26,6 +26,8 @@ | |||
26 | static int stub_probe(struct usb_interface *interface, | 26 | static int stub_probe(struct usb_interface *interface, |
27 | const struct usb_device_id *id); | 27 | const struct usb_device_id *id); |
28 | static void stub_disconnect(struct usb_interface *interface); | 28 | static void stub_disconnect(struct usb_interface *interface); |
29 | static int stub_pre_reset(struct usb_interface *interface); | ||
30 | static int stub_post_reset(struct usb_interface *interface); | ||
29 | 31 | ||
30 | /* | 32 | /* |
31 | * Define device IDs here if you want to explicitly limit exportable devices. | 33 | * Define device IDs here if you want to explicitly limit exportable devices. |
@@ -59,6 +61,8 @@ struct usb_driver stub_driver = { | |||
59 | .probe = stub_probe, | 61 | .probe = stub_probe, |
60 | .disconnect = stub_disconnect, | 62 | .disconnect = stub_disconnect, |
61 | .id_table = stub_table, | 63 | .id_table = stub_table, |
64 | .pre_reset = stub_pre_reset, | ||
65 | .post_reset = stub_post_reset, | ||
62 | }; | 66 | }; |
63 | 67 | ||
64 | /* | 68 | /* |
@@ -541,3 +545,20 @@ static void stub_disconnect(struct usb_interface *interface) | |||
541 | del_match_busid((char *)udev_busid); | 545 | del_match_busid((char *)udev_busid); |
542 | } | 546 | } |
543 | } | 547 | } |
548 | |||
549 | /* | ||
550 | * Presence of pre_reset and post_reset prevents the driver from being unbound | ||
551 | * when the device is being reset | ||
552 | */ | ||
553 | |||
554 | int stub_pre_reset(struct usb_interface *interface) | ||
555 | { | ||
556 | dev_dbg(&interface->dev, "pre_reset\n"); | ||
557 | return 0; | ||
558 | } | ||
559 | |||
560 | int stub_post_reset(struct usb_interface *interface) | ||
561 | { | ||
562 | dev_dbg(&interface->dev, "post_reset\n"); | ||
563 | return 0; | ||
564 | } | ||
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index a5c1fa1f0430..bc57844600b9 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c | |||
@@ -175,16 +175,18 @@ static int tweak_reset_device_cmd(struct urb *urb) | |||
175 | dev_info(&urb->dev->dev, "usb_queue_reset_device\n"); | 175 | dev_info(&urb->dev->dev, "usb_queue_reset_device\n"); |
176 | 176 | ||
177 | /* | 177 | /* |
178 | * usb_lock_device_for_reset caused a deadlock: it causes the driver | 178 | * With the implementation of pre_reset and post_reset the driver no |
179 | * to unbind. In the shutdown the rx thread is signalled to shut down | 179 | * longer unbinds. This allows the use of synchronous reset. |
180 | * but this thread is pending in the usb_lock_device_for_reset. | ||
181 | * | ||
182 | * Instead queue the reset. | ||
183 | * | ||
184 | * Unfortunatly an existing usbip connection will be dropped due to | ||
185 | * driver unbinding. | ||
186 | */ | 180 | */ |
187 | usb_queue_reset_device(sdev->interface); | 181 | |
182 | if (usb_lock_device_for_reset(sdev->udev, sdev->interface)<0) | ||
183 | { | ||
184 | dev_err(&urb->dev->dev, "could not obtain lock to reset device\n"); | ||
185 | return 0; | ||
186 | } | ||
187 | usb_reset_device(sdev->udev); | ||
188 | usb_unlock_device(sdev->udev); | ||
189 | |||
188 | return 0; | 190 | return 0; |
189 | } | 191 | } |
190 | 192 | ||
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index a4c42a75a3bf..09e8c7d53af3 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -2128,8 +2128,8 @@ static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) | |||
2128 | gsm->tty = NULL; | 2128 | gsm->tty = NULL; |
2129 | } | 2129 | } |
2130 | 2130 | ||
2131 | static unsigned int gsmld_receive_buf(struct tty_struct *tty, | 2131 | static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
2132 | const unsigned char *cp, char *fp, int count) | 2132 | char *fp, int count) |
2133 | { | 2133 | { |
2134 | struct gsm_mux *gsm = tty->disc_data; | 2134 | struct gsm_mux *gsm = tty->disc_data; |
2135 | const unsigned char *dp; | 2135 | const unsigned char *dp; |
@@ -2162,8 +2162,6 @@ static unsigned int gsmld_receive_buf(struct tty_struct *tty, | |||
2162 | } | 2162 | } |
2163 | /* FASYNC if needed ? */ | 2163 | /* FASYNC if needed ? */ |
2164 | /* If clogged call tty_throttle(tty); */ | 2164 | /* If clogged call tty_throttle(tty); */ |
2165 | |||
2166 | return count; | ||
2167 | } | 2165 | } |
2168 | 2166 | ||
2169 | /** | 2167 | /** |
diff --git a/drivers/tty/n_hdlc.c b/drivers/tty/n_hdlc.c index cac666314aef..cea56033b34c 100644 --- a/drivers/tty/n_hdlc.c +++ b/drivers/tty/n_hdlc.c | |||
@@ -188,8 +188,8 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, | |||
188 | poll_table *wait); | 188 | poll_table *wait); |
189 | static int n_hdlc_tty_open(struct tty_struct *tty); | 189 | static int n_hdlc_tty_open(struct tty_struct *tty); |
190 | static void n_hdlc_tty_close(struct tty_struct *tty); | 190 | static void n_hdlc_tty_close(struct tty_struct *tty); |
191 | static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | 191 | static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp, |
192 | const __u8 *cp, char *fp, int count); | 192 | char *fp, int count); |
193 | static void n_hdlc_tty_wakeup(struct tty_struct *tty); | 193 | static void n_hdlc_tty_wakeup(struct tty_struct *tty); |
194 | 194 | ||
195 | #define bset(p,b) ((p)[(b) >> 5] |= (1 << ((b) & 0x1f))) | 195 | #define bset(p,b) ((p)[(b) >> 5] |= (1 << ((b) & 0x1f))) |
@@ -509,8 +509,8 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) | |||
509 | * Called by tty low level driver when receive data is available. Data is | 509 | * Called by tty low level driver when receive data is available. Data is |
510 | * interpreted as one HDLC frame. | 510 | * interpreted as one HDLC frame. |
511 | */ | 511 | */ |
512 | static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | 512 | static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data, |
513 | const __u8 *data, char *flags, int count) | 513 | char *flags, int count) |
514 | { | 514 | { |
515 | register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); | 515 | register struct n_hdlc *n_hdlc = tty2n_hdlc (tty); |
516 | register struct n_hdlc_buf *buf; | 516 | register struct n_hdlc_buf *buf; |
@@ -521,20 +521,20 @@ static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | |||
521 | 521 | ||
522 | /* This can happen if stuff comes in on the backup tty */ | 522 | /* This can happen if stuff comes in on the backup tty */ |
523 | if (!n_hdlc || tty != n_hdlc->tty) | 523 | if (!n_hdlc || tty != n_hdlc->tty) |
524 | return -ENODEV; | 524 | return; |
525 | 525 | ||
526 | /* verify line is using HDLC discipline */ | 526 | /* verify line is using HDLC discipline */ |
527 | if (n_hdlc->magic != HDLC_MAGIC) { | 527 | if (n_hdlc->magic != HDLC_MAGIC) { |
528 | printk("%s(%d) line not using HDLC discipline\n", | 528 | printk("%s(%d) line not using HDLC discipline\n", |
529 | __FILE__,__LINE__); | 529 | __FILE__,__LINE__); |
530 | return -EINVAL; | 530 | return; |
531 | } | 531 | } |
532 | 532 | ||
533 | if ( count>maxframe ) { | 533 | if ( count>maxframe ) { |
534 | if (debuglevel >= DEBUG_LEVEL_INFO) | 534 | if (debuglevel >= DEBUG_LEVEL_INFO) |
535 | printk("%s(%d) rx count>maxframesize, data discarded\n", | 535 | printk("%s(%d) rx count>maxframesize, data discarded\n", |
536 | __FILE__,__LINE__); | 536 | __FILE__,__LINE__); |
537 | return -EINVAL; | 537 | return; |
538 | } | 538 | } |
539 | 539 | ||
540 | /* get a free HDLC buffer */ | 540 | /* get a free HDLC buffer */ |
@@ -550,7 +550,7 @@ static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | |||
550 | if (debuglevel >= DEBUG_LEVEL_INFO) | 550 | if (debuglevel >= DEBUG_LEVEL_INFO) |
551 | printk("%s(%d) no more rx buffers, data discarded\n", | 551 | printk("%s(%d) no more rx buffers, data discarded\n", |
552 | __FILE__,__LINE__); | 552 | __FILE__,__LINE__); |
553 | return -EINVAL; | 553 | return; |
554 | } | 554 | } |
555 | 555 | ||
556 | /* copy received data to HDLC buffer */ | 556 | /* copy received data to HDLC buffer */ |
@@ -565,8 +565,6 @@ static unsigned int n_hdlc_tty_receive(struct tty_struct *tty, | |||
565 | if (n_hdlc->tty->fasync != NULL) | 565 | if (n_hdlc->tty->fasync != NULL) |
566 | kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); | 566 | kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN); |
567 | 567 | ||
568 | return count; | ||
569 | |||
570 | } /* end of n_hdlc_tty_receive() */ | 568 | } /* end of n_hdlc_tty_receive() */ |
571 | 569 | ||
572 | /** | 570 | /** |
diff --git a/drivers/tty/n_r3964.c b/drivers/tty/n_r3964.c index a4bc39c21a43..5c6c31459a2f 100644 --- a/drivers/tty/n_r3964.c +++ b/drivers/tty/n_r3964.c | |||
@@ -139,8 +139,8 @@ static int r3964_ioctl(struct tty_struct *tty, struct file *file, | |||
139 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old); | 139 | static void r3964_set_termios(struct tty_struct *tty, struct ktermios *old); |
140 | static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, | 140 | static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, |
141 | struct poll_table_struct *wait); | 141 | struct poll_table_struct *wait); |
142 | static unsigned int r3964_receive_buf(struct tty_struct *tty, | 142 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
143 | const unsigned char *cp, char *fp, int count); | 143 | char *fp, int count); |
144 | 144 | ||
145 | static struct tty_ldisc_ops tty_ldisc_N_R3964 = { | 145 | static struct tty_ldisc_ops tty_ldisc_N_R3964 = { |
146 | .owner = THIS_MODULE, | 146 | .owner = THIS_MODULE, |
@@ -1239,8 +1239,8 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file, | |||
1239 | return result; | 1239 | return result; |
1240 | } | 1240 | } |
1241 | 1241 | ||
1242 | static unsigned int r3964_receive_buf(struct tty_struct *tty, | 1242 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
1243 | const unsigned char *cp, char *fp, int count) | 1243 | char *fp, int count) |
1244 | { | 1244 | { |
1245 | struct r3964_info *pInfo = tty->disc_data; | 1245 | struct r3964_info *pInfo = tty->disc_data; |
1246 | const unsigned char *p; | 1246 | const unsigned char *p; |
@@ -1257,8 +1257,6 @@ static unsigned int r3964_receive_buf(struct tty_struct *tty, | |||
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | } | 1259 | } |
1260 | |||
1261 | return count; | ||
1262 | } | 1260 | } |
1263 | 1261 | ||
1264 | MODULE_LICENSE("GPL"); | 1262 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 95d0a9c2dd13..0ad32888091c 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -81,6 +81,38 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x, | |||
81 | return put_user(x, ptr); | 81 | return put_user(x, ptr); |
82 | } | 82 | } |
83 | 83 | ||
84 | /** | ||
85 | * n_tty_set__room - receive space | ||
86 | * @tty: terminal | ||
87 | * | ||
88 | * Called by the driver to find out how much data it is | ||
89 | * permitted to feed to the line discipline without any being lost | ||
90 | * and thus to manage flow control. Not serialized. Answers for the | ||
91 | * "instant". | ||
92 | */ | ||
93 | |||
94 | static void n_tty_set_room(struct tty_struct *tty) | ||
95 | { | ||
96 | /* tty->read_cnt is not read locked ? */ | ||
97 | int left = N_TTY_BUF_SIZE - tty->read_cnt - 1; | ||
98 | int old_left; | ||
99 | |||
100 | /* | ||
101 | * If we are doing input canonicalization, and there are no | ||
102 | * pending newlines, let characters through without limit, so | ||
103 | * that erase characters will be handled. Other excess | ||
104 | * characters will be beeped. | ||
105 | */ | ||
106 | if (left <= 0) | ||
107 | left = tty->icanon && !tty->canon_data; | ||
108 | old_left = tty->receive_room; | ||
109 | tty->receive_room = left; | ||
110 | |||
111 | /* Did this open up the receive buffer? We may need to flip */ | ||
112 | if (left && !old_left) | ||
113 | schedule_work(&tty->buf.work); | ||
114 | } | ||
115 | |||
84 | static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) | 116 | static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) |
85 | { | 117 | { |
86 | if (tty->read_cnt < N_TTY_BUF_SIZE) { | 118 | if (tty->read_cnt < N_TTY_BUF_SIZE) { |
@@ -152,6 +184,7 @@ static void reset_buffer_flags(struct tty_struct *tty) | |||
152 | 184 | ||
153 | tty->canon_head = tty->canon_data = tty->erasing = 0; | 185 | tty->canon_head = tty->canon_data = tty->erasing = 0; |
154 | memset(&tty->read_flags, 0, sizeof tty->read_flags); | 186 | memset(&tty->read_flags, 0, sizeof tty->read_flags); |
187 | n_tty_set_room(tty); | ||
155 | check_unthrottle(tty); | 188 | check_unthrottle(tty); |
156 | } | 189 | } |
157 | 190 | ||
@@ -1327,19 +1360,17 @@ static void n_tty_write_wakeup(struct tty_struct *tty) | |||
1327 | * calls one at a time and in order (or using flush_to_ldisc) | 1360 | * calls one at a time and in order (or using flush_to_ldisc) |
1328 | */ | 1361 | */ |
1329 | 1362 | ||
1330 | static unsigned int n_tty_receive_buf(struct tty_struct *tty, | 1363 | static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
1331 | const unsigned char *cp, char *fp, int count) | 1364 | char *fp, int count) |
1332 | { | 1365 | { |
1333 | const unsigned char *p; | 1366 | const unsigned char *p; |
1334 | char *f, flags = TTY_NORMAL; | 1367 | char *f, flags = TTY_NORMAL; |
1335 | int i; | 1368 | int i; |
1336 | char buf[64]; | 1369 | char buf[64]; |
1337 | unsigned long cpuflags; | 1370 | unsigned long cpuflags; |
1338 | int left; | ||
1339 | int ret = 0; | ||
1340 | 1371 | ||
1341 | if (!tty->read_buf) | 1372 | if (!tty->read_buf) |
1342 | return 0; | 1373 | return; |
1343 | 1374 | ||
1344 | if (tty->real_raw) { | 1375 | if (tty->real_raw) { |
1345 | spin_lock_irqsave(&tty->read_lock, cpuflags); | 1376 | spin_lock_irqsave(&tty->read_lock, cpuflags); |
@@ -1349,7 +1380,6 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1349 | memcpy(tty->read_buf + tty->read_head, cp, i); | 1380 | memcpy(tty->read_buf + tty->read_head, cp, i); |
1350 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); | 1381 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); |
1351 | tty->read_cnt += i; | 1382 | tty->read_cnt += i; |
1352 | ret += i; | ||
1353 | cp += i; | 1383 | cp += i; |
1354 | count -= i; | 1384 | count -= i; |
1355 | 1385 | ||
@@ -1359,10 +1389,8 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1359 | memcpy(tty->read_buf + tty->read_head, cp, i); | 1389 | memcpy(tty->read_buf + tty->read_head, cp, i); |
1360 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); | 1390 | tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1); |
1361 | tty->read_cnt += i; | 1391 | tty->read_cnt += i; |
1362 | ret += i; | ||
1363 | spin_unlock_irqrestore(&tty->read_lock, cpuflags); | 1392 | spin_unlock_irqrestore(&tty->read_lock, cpuflags); |
1364 | } else { | 1393 | } else { |
1365 | ret = count; | ||
1366 | for (i = count, p = cp, f = fp; i; i--, p++) { | 1394 | for (i = count, p = cp, f = fp; i; i--, p++) { |
1367 | if (f) | 1395 | if (f) |
1368 | flags = *f++; | 1396 | flags = *f++; |
@@ -1390,6 +1418,8 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1390 | tty->ops->flush_chars(tty); | 1418 | tty->ops->flush_chars(tty); |
1391 | } | 1419 | } |
1392 | 1420 | ||
1421 | n_tty_set_room(tty); | ||
1422 | |||
1393 | if ((!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) || | 1423 | if ((!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) || |
1394 | L_EXTPROC(tty)) { | 1424 | L_EXTPROC(tty)) { |
1395 | kill_fasync(&tty->fasync, SIGIO, POLL_IN); | 1425 | kill_fasync(&tty->fasync, SIGIO, POLL_IN); |
@@ -1402,12 +1432,8 @@ static unsigned int n_tty_receive_buf(struct tty_struct *tty, | |||
1402 | * mode. We don't want to throttle the driver if we're in | 1432 | * mode. We don't want to throttle the driver if we're in |
1403 | * canonical mode and don't have a newline yet! | 1433 | * canonical mode and don't have a newline yet! |
1404 | */ | 1434 | */ |
1405 | left = N_TTY_BUF_SIZE - tty->read_cnt - 1; | 1435 | if (tty->receive_room < TTY_THRESHOLD_THROTTLE) |
1406 | |||
1407 | if (left < TTY_THRESHOLD_THROTTLE) | ||
1408 | tty_throttle(tty); | 1436 | tty_throttle(tty); |
1409 | |||
1410 | return ret; | ||
1411 | } | 1437 | } |
1412 | 1438 | ||
1413 | int is_ignored(int sig) | 1439 | int is_ignored(int sig) |
@@ -1451,6 +1477,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
1451 | if (test_bit(TTY_HW_COOK_IN, &tty->flags)) { | 1477 | if (test_bit(TTY_HW_COOK_IN, &tty->flags)) { |
1452 | tty->raw = 1; | 1478 | tty->raw = 1; |
1453 | tty->real_raw = 1; | 1479 | tty->real_raw = 1; |
1480 | n_tty_set_room(tty); | ||
1454 | return; | 1481 | return; |
1455 | } | 1482 | } |
1456 | if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) || | 1483 | if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) || |
@@ -1503,6 +1530,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) | |||
1503 | else | 1530 | else |
1504 | tty->real_raw = 0; | 1531 | tty->real_raw = 0; |
1505 | } | 1532 | } |
1533 | n_tty_set_room(tty); | ||
1506 | /* The termios change make the tty ready for I/O */ | 1534 | /* The termios change make the tty ready for I/O */ |
1507 | wake_up_interruptible(&tty->write_wait); | 1535 | wake_up_interruptible(&tty->write_wait); |
1508 | wake_up_interruptible(&tty->read_wait); | 1536 | wake_up_interruptible(&tty->read_wait); |
@@ -1784,6 +1812,8 @@ do_it_again: | |||
1784 | retval = -ERESTARTSYS; | 1812 | retval = -ERESTARTSYS; |
1785 | break; | 1813 | break; |
1786 | } | 1814 | } |
1815 | /* FIXME: does n_tty_set_room need locking ? */ | ||
1816 | n_tty_set_room(tty); | ||
1787 | timeout = schedule_timeout(timeout); | 1817 | timeout = schedule_timeout(timeout); |
1788 | continue; | 1818 | continue; |
1789 | } | 1819 | } |
@@ -1855,8 +1885,10 @@ do_it_again: | |||
1855 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, | 1885 | * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, |
1856 | * we won't get any more characters. | 1886 | * we won't get any more characters. |
1857 | */ | 1887 | */ |
1858 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) | 1888 | if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) { |
1889 | n_tty_set_room(tty); | ||
1859 | check_unthrottle(tty); | 1890 | check_unthrottle(tty); |
1891 | } | ||
1860 | 1892 | ||
1861 | if (b - buf >= minimum) | 1893 | if (b - buf >= minimum) |
1862 | break; | 1894 | break; |
@@ -1878,6 +1910,7 @@ do_it_again: | |||
1878 | } else if (test_and_clear_bit(TTY_PUSH, &tty->flags)) | 1910 | } else if (test_and_clear_bit(TTY_PUSH, &tty->flags)) |
1879 | goto do_it_again; | 1911 | goto do_it_again; |
1880 | 1912 | ||
1913 | n_tty_set_room(tty); | ||
1881 | return retval; | 1914 | return retval; |
1882 | } | 1915 | } |
1883 | 1916 | ||
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c index 1bd28450ca40..a764bf99743b 100644 --- a/drivers/tty/serial/mrst_max3110.c +++ b/drivers/tty/serial/mrst_max3110.c | |||
@@ -421,7 +421,6 @@ static int max3110_main_thread(void *_max) | |||
421 | int ret = 0; | 421 | int ret = 0; |
422 | struct circ_buf *xmit = &max->con_xmit; | 422 | struct circ_buf *xmit = &max->con_xmit; |
423 | 423 | ||
424 | init_waitqueue_head(wq); | ||
425 | pr_info(PR_FMT "start main thread\n"); | 424 | pr_info(PR_FMT "start main thread\n"); |
426 | 425 | ||
427 | do { | 426 | do { |
@@ -823,7 +822,7 @@ static int __devinit serial_m3110_probe(struct spi_device *spi) | |||
823 | res = RC_TAG; | 822 | res = RC_TAG; |
824 | ret = max3110_write_then_read(max, (u8 *)&res, (u8 *)&res, 2, 0); | 823 | ret = max3110_write_then_read(max, (u8 *)&res, (u8 *)&res, 2, 0); |
825 | if (ret < 0 || res == 0 || res == 0xffff) { | 824 | if (ret < 0 || res == 0 || res == 0xffff) { |
826 | printk(KERN_ERR "MAX3111 deemed not present (conf reg %04x)", | 825 | dev_dbg(&spi->dev, "MAX3111 deemed not present (conf reg %04x)", |
827 | res); | 826 | res); |
828 | ret = -ENODEV; | 827 | ret = -ENODEV; |
829 | goto err_get_page; | 828 | goto err_get_page; |
@@ -838,6 +837,8 @@ static int __devinit serial_m3110_probe(struct spi_device *spi) | |||
838 | max->con_xmit.head = 0; | 837 | max->con_xmit.head = 0; |
839 | max->con_xmit.tail = 0; | 838 | max->con_xmit.tail = 0; |
840 | 839 | ||
840 | init_waitqueue_head(&max->wq); | ||
841 | |||
841 | max->main_thread = kthread_run(max3110_main_thread, | 842 | max->main_thread = kthread_run(max3110_main_thread, |
842 | max, "max3110_main"); | 843 | max, "max3110_main"); |
843 | if (IS_ERR(max->main_thread)) { | 844 | if (IS_ERR(max->main_thread)) { |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index f2cb7503fcb2..465210930890 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -1397,6 +1397,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, | |||
1397 | int fifosize, base_baud; | 1397 | int fifosize, base_baud; |
1398 | int port_type; | 1398 | int port_type; |
1399 | struct pch_uart_driver_data *board; | 1399 | struct pch_uart_driver_data *board; |
1400 | const char *board_name; | ||
1400 | 1401 | ||
1401 | board = &drv_dat[id->driver_data]; | 1402 | board = &drv_dat[id->driver_data]; |
1402 | port_type = board->port_type; | 1403 | port_type = board->port_type; |
@@ -1412,7 +1413,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, | |||
1412 | base_baud = 1843200; /* 1.8432MHz */ | 1413 | base_baud = 1843200; /* 1.8432MHz */ |
1413 | 1414 | ||
1414 | /* quirk for CM-iTC board */ | 1415 | /* quirk for CM-iTC board */ |
1415 | if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC")) | 1416 | board_name = dmi_get_system_info(DMI_BOARD_NAME); |
1417 | if (board_name && strstr(board_name, "CM-iTC")) | ||
1416 | base_baud = 192000000; /* 192.0MHz */ | 1418 | base_baud = 192000000; /* 192.0MHz */ |
1417 | 1419 | ||
1418 | switch (port_type) { | 1420 | switch (port_type) { |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 46de2e075dac..6c9b7cd6778a 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -413,10 +413,8 @@ static void flush_to_ldisc(struct work_struct *work) | |||
413 | spin_lock_irqsave(&tty->buf.lock, flags); | 413 | spin_lock_irqsave(&tty->buf.lock, flags); |
414 | 414 | ||
415 | if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { | 415 | if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { |
416 | struct tty_buffer *head, *tail = tty->buf.tail; | 416 | struct tty_buffer *head; |
417 | int seen_tail = 0; | ||
418 | while ((head = tty->buf.head) != NULL) { | 417 | while ((head = tty->buf.head) != NULL) { |
419 | int copied; | ||
420 | int count; | 418 | int count; |
421 | char *char_buf; | 419 | char *char_buf; |
422 | unsigned char *flag_buf; | 420 | unsigned char *flag_buf; |
@@ -425,15 +423,6 @@ static void flush_to_ldisc(struct work_struct *work) | |||
425 | if (!count) { | 423 | if (!count) { |
426 | if (head->next == NULL) | 424 | if (head->next == NULL) |
427 | break; | 425 | break; |
428 | /* | ||
429 | There's a possibility tty might get new buffer | ||
430 | added during the unlock window below. We could | ||
431 | end up spinning in here forever hogging the CPU | ||
432 | completely. To avoid this let's have a rest each | ||
433 | time we processed the tail buffer. | ||
434 | */ | ||
435 | if (tail == head) | ||
436 | seen_tail = 1; | ||
437 | tty->buf.head = head->next; | 426 | tty->buf.head = head->next; |
438 | tty_buffer_free(tty, head); | 427 | tty_buffer_free(tty, head); |
439 | continue; | 428 | continue; |
@@ -443,19 +432,17 @@ static void flush_to_ldisc(struct work_struct *work) | |||
443 | line discipline as we want to empty the queue */ | 432 | line discipline as we want to empty the queue */ |
444 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) | 433 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) |
445 | break; | 434 | break; |
435 | if (!tty->receive_room) | ||
436 | break; | ||
437 | if (count > tty->receive_room) | ||
438 | count = tty->receive_room; | ||
446 | char_buf = head->char_buf_ptr + head->read; | 439 | char_buf = head->char_buf_ptr + head->read; |
447 | flag_buf = head->flag_buf_ptr + head->read; | 440 | flag_buf = head->flag_buf_ptr + head->read; |
441 | head->read += count; | ||
448 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 442 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
449 | copied = disc->ops->receive_buf(tty, char_buf, | 443 | disc->ops->receive_buf(tty, char_buf, |
450 | flag_buf, count); | 444 | flag_buf, count); |
451 | spin_lock_irqsave(&tty->buf.lock, flags); | 445 | spin_lock_irqsave(&tty->buf.lock, flags); |
452 | |||
453 | head->read += copied; | ||
454 | |||
455 | if (copied == 0 || seen_tail) { | ||
456 | schedule_work(&tty->buf.work); | ||
457 | break; | ||
458 | } | ||
459 | } | 446 | } |
460 | clear_bit(TTY_FLUSHING, &tty->flags); | 447 | clear_bit(TTY_FLUSHING, &tty->flags); |
461 | } | 448 | } |
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c index 67b1d0d7c8ac..fb864e7fcd13 100644 --- a/drivers/tty/vt/selection.c +++ b/drivers/tty/vt/selection.c | |||
@@ -332,7 +332,8 @@ int paste_selection(struct tty_struct *tty) | |||
332 | continue; | 332 | continue; |
333 | } | 333 | } |
334 | count = sel_buffer_lth - pasted; | 334 | count = sel_buffer_lth - pasted; |
335 | count = tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted, | 335 | count = min(count, tty->receive_room); |
336 | tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted, | ||
336 | NULL, count); | 337 | NULL, count); |
337 | pasted += count; | 338 | pasted += count; |
338 | } | 339 | } |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 395a347f2ebb..dac7676ce21b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1530,6 +1530,8 @@ static const struct usb_device_id acm_ids[] = { | |||
1530 | { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ | 1530 | { NOKIA_PCSUITE_ACM_INFO(0x04ce), }, /* Nokia E90 */ |
1531 | { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ | 1531 | { NOKIA_PCSUITE_ACM_INFO(0x01d4), }, /* Nokia E55 */ |
1532 | { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */ | 1532 | { NOKIA_PCSUITE_ACM_INFO(0x0302), }, /* Nokia N8 */ |
1533 | { NOKIA_PCSUITE_ACM_INFO(0x0335), }, /* Nokia E7 */ | ||
1534 | { NOKIA_PCSUITE_ACM_INFO(0x03cd), }, /* Nokia C7 */ | ||
1533 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ | 1535 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ |
1534 | 1536 | ||
1535 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ | 1537 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index e35a17687c05..aa3cc465a601 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -375,7 +375,7 @@ static int usb_unbind_interface(struct device *dev) | |||
375 | * Just re-enable it without affecting the endpoint toggles. | 375 | * Just re-enable it without affecting the endpoint toggles. |
376 | */ | 376 | */ |
377 | usb_enable_interface(udev, intf, false); | 377 | usb_enable_interface(udev, intf, false); |
378 | } else if (!error && !intf->dev.power.in_suspend) { | 378 | } else if (!error && !intf->dev.power.is_prepared) { |
379 | r = usb_set_interface(udev, intf->altsetting[0]. | 379 | r = usb_set_interface(udev, intf->altsetting[0]. |
380 | desc.bInterfaceNumber, 0); | 380 | desc.bInterfaceNumber, 0); |
381 | if (r < 0) | 381 | if (r < 0) |
@@ -960,7 +960,7 @@ void usb_rebind_intf(struct usb_interface *intf) | |||
960 | } | 960 | } |
961 | 961 | ||
962 | /* Try to rebind the interface */ | 962 | /* Try to rebind the interface */ |
963 | if (!intf->dev.power.in_suspend) { | 963 | if (!intf->dev.power.is_prepared) { |
964 | intf->needs_binding = 0; | 964 | intf->needs_binding = 0; |
965 | rc = device_attach(&intf->dev); | 965 | rc = device_attach(&intf->dev); |
966 | if (rc < 0) | 966 | if (rc < 0) |
@@ -1107,7 +1107,7 @@ static int usb_resume_interface(struct usb_device *udev, | |||
1107 | if (intf->condition == USB_INTERFACE_UNBOUND) { | 1107 | if (intf->condition == USB_INTERFACE_UNBOUND) { |
1108 | 1108 | ||
1109 | /* Carry out a deferred switch to altsetting 0 */ | 1109 | /* Carry out a deferred switch to altsetting 0 */ |
1110 | if (intf->needs_altsetting0 && !intf->dev.power.in_suspend) { | 1110 | if (intf->needs_altsetting0 && !intf->dev.power.is_prepared) { |
1111 | usb_set_interface(udev, intf->altsetting[0]. | 1111 | usb_set_interface(udev, intf->altsetting[0]. |
1112 | desc.bInterfaceNumber, 0); | 1112 | desc.bInterfaceNumber, 0); |
1113 | intf->needs_altsetting0 = 0; | 1113 | intf->needs_altsetting0 = 0; |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 79a58c3a2e2a..90ae1753dda1 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -339,7 +339,8 @@ static int get_hub_status(struct usb_device *hdev, | |||
339 | { | 339 | { |
340 | int i, status = -ETIMEDOUT; | 340 | int i, status = -ETIMEDOUT; |
341 | 341 | ||
342 | for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) { | 342 | for (i = 0; i < USB_STS_RETRIES && |
343 | (status == -ETIMEDOUT || status == -EPIPE); i++) { | ||
343 | status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), | 344 | status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), |
344 | USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0, | 345 | USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0, |
345 | data, sizeof(*data), USB_STS_TIMEOUT); | 346 | data, sizeof(*data), USB_STS_TIMEOUT); |
@@ -355,7 +356,8 @@ static int get_port_status(struct usb_device *hdev, int port1, | |||
355 | { | 356 | { |
356 | int i, status = -ETIMEDOUT; | 357 | int i, status = -ETIMEDOUT; |
357 | 358 | ||
358 | for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++) { | 359 | for (i = 0; i < USB_STS_RETRIES && |
360 | (status == -ETIMEDOUT || status == -EPIPE); i++) { | ||
359 | status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), | 361 | status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), |
360 | USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port1, | 362 | USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port1, |
361 | data, sizeof(*data), USB_STS_TIMEOUT); | 363 | data, sizeof(*data), USB_STS_TIMEOUT); |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 1b125c224dcf..2278dad886e2 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -389,7 +389,6 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
389 | mutex_unlock(&inode->i_mutex); | 389 | mutex_unlock(&inode->i_mutex); |
390 | if (!error) | 390 | if (!error) |
391 | d_delete(dentry); | 391 | d_delete(dentry); |
392 | dput(dentry); | ||
393 | return error; | 392 | return error; |
394 | } | 393 | } |
395 | 394 | ||
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 58456d1aec21..029e288805b6 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -632,13 +632,10 @@ config USB_DUMMY_HCD | |||
632 | 632 | ||
633 | endchoice | 633 | endchoice |
634 | 634 | ||
635 | # Selected by UDC drivers that support high-speed operation. | ||
635 | config USB_GADGET_DUALSPEED | 636 | config USB_GADGET_DUALSPEED |
636 | bool | 637 | bool |
637 | depends on USB_GADGET | 638 | depends on USB_GADGET |
638 | default n | ||
639 | help | ||
640 | Means that gadget drivers should include extra descriptors | ||
641 | and code to handle dual-speed controllers. | ||
642 | 639 | ||
643 | # | 640 | # |
644 | # USB Gadget Drivers | 641 | # USB Gadget Drivers |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 6e42aab75806..95e8138cd48f 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/device.h> | 60 | #include <linux/device.h> |
61 | #include <linux/io.h> | 61 | #include <linux/io.h> |
62 | #include <linux/irq.h> | 62 | #include <linux/irq.h> |
63 | #include <linux/prefetch.h> | ||
63 | 64 | ||
64 | #include <asm/byteorder.h> | 65 | #include <asm/byteorder.h> |
65 | #include <asm/system.h> | 66 | #include <asm/system.h> |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 41dc093c0a1b..f4690ffcb489 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/clk.h> | 38 | #include <linux/clk.h> |
39 | #include <linux/usb/ch9.h> | 39 | #include <linux/usb/ch9.h> |
40 | #include <linux/usb/gadget.h> | 40 | #include <linux/usb/gadget.h> |
41 | #include <linux/prefetch.h> | ||
41 | 42 | ||
42 | #include <asm/byteorder.h> | 43 | #include <asm/byteorder.h> |
43 | #include <mach/hardware.h> | 44 | #include <mach/hardware.h> |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 61ff927928ab..d3dcabc1a5fc 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -1906,6 +1906,7 @@ static int dummy_hcd_probe(struct platform_device *pdev) | |||
1906 | if (!hcd) | 1906 | if (!hcd) |
1907 | return -ENOMEM; | 1907 | return -ENOMEM; |
1908 | the_controller = hcd_to_dummy (hcd); | 1908 | the_controller = hcd_to_dummy (hcd); |
1909 | hcd->has_tt = 1; | ||
1909 | 1910 | ||
1910 | retval = usb_add_hcd(hcd, 0, 0); | 1911 | retval = usb_add_hcd(hcd, 0, 0); |
1911 | if (retval != 0) { | 1912 | if (retval != 0) { |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index a01383f71f38..a56876aaf76c 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -431,8 +431,10 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
431 | 431 | ||
432 | /* halt any endpoint by doing a "wrong direction" i/o call */ | 432 | /* halt any endpoint by doing a "wrong direction" i/o call */ |
433 | if (!usb_endpoint_dir_in(&data->desc)) { | 433 | if (!usb_endpoint_dir_in(&data->desc)) { |
434 | if (usb_endpoint_xfer_isoc(&data->desc)) | 434 | if (usb_endpoint_xfer_isoc(&data->desc)) { |
435 | mutex_unlock(&data->lock); | ||
435 | return -EINVAL; | 436 | return -EINVAL; |
437 | } | ||
436 | DBG (data->dev, "%s halt\n", data->name); | 438 | DBG (data->dev, "%s halt\n", data->name); |
437 | spin_lock_irq (&data->dev->lock); | 439 | spin_lock_irq (&data->dev->lock); |
438 | if (likely (data->ep != NULL)) | 440 | if (likely (data->ep != NULL)) |
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c index b62b2640deb0..b1a8146b9d50 100644 --- a/drivers/usb/gadget/mv_udc_core.c +++ b/drivers/usb/gadget/mv_udc_core.c | |||
@@ -2083,7 +2083,7 @@ out: | |||
2083 | } | 2083 | } |
2084 | 2084 | ||
2085 | #ifdef CONFIG_PM | 2085 | #ifdef CONFIG_PM |
2086 | static int mv_udc_suspend(struct platform_device *_dev, pm_message_t state) | 2086 | static int mv_udc_suspend(struct device *_dev) |
2087 | { | 2087 | { |
2088 | struct mv_udc *udc = the_controller; | 2088 | struct mv_udc *udc = the_controller; |
2089 | 2089 | ||
@@ -2092,7 +2092,7 @@ static int mv_udc_suspend(struct platform_device *_dev, pm_message_t state) | |||
2092 | return 0; | 2092 | return 0; |
2093 | } | 2093 | } |
2094 | 2094 | ||
2095 | static int mv_udc_resume(struct platform_device *_dev) | 2095 | static int mv_udc_resume(struct device *_dev) |
2096 | { | 2096 | { |
2097 | struct mv_udc *udc = the_controller; | 2097 | struct mv_udc *udc = the_controller; |
2098 | int retval; | 2098 | int retval; |
@@ -2100,7 +2100,7 @@ static int mv_udc_resume(struct platform_device *_dev) | |||
2100 | retval = mv_udc_phy_init(udc->phy_regs); | 2100 | retval = mv_udc_phy_init(udc->phy_regs); |
2101 | if (retval) { | 2101 | if (retval) { |
2102 | dev_err(_dev, "phy initialization error %d\n", retval); | 2102 | dev_err(_dev, "phy initialization error %d\n", retval); |
2103 | goto error; | 2103 | return retval; |
2104 | } | 2104 | } |
2105 | udc_reset(udc); | 2105 | udc_reset(udc); |
2106 | ep0_reset(udc); | 2106 | ep0_reset(udc); |
@@ -2122,7 +2122,7 @@ static struct platform_driver udc_driver = { | |||
2122 | .owner = THIS_MODULE, | 2122 | .owner = THIS_MODULE, |
2123 | .name = "pxa-u2o", | 2123 | .name = "pxa-u2o", |
2124 | #ifdef CONFIG_PM | 2124 | #ifdef CONFIG_PM |
2125 | .pm = mv_udc_pm_ops, | 2125 | .pm = &mv_udc_pm_ops, |
2126 | #endif | 2126 | #endif |
2127 | }, | 2127 | }, |
2128 | }; | 2128 | }; |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 24696f7fa6a9..476d88e1ae97 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <linux/device.h> | 63 | #include <linux/device.h> |
64 | #include <linux/usb/ch9.h> | 64 | #include <linux/usb/ch9.h> |
65 | #include <linux/usb/gadget.h> | 65 | #include <linux/usb/gadget.h> |
66 | #include <linux/prefetch.h> | ||
66 | 67 | ||
67 | #include <asm/byteorder.h> | 68 | #include <asm/byteorder.h> |
68 | #include <asm/io.h> | 69 | #include <asm/io.h> |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 365c02fc25fc..774545494cf2 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -2216,7 +2216,6 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2216 | if (retval != 0) { | 2216 | if (retval != 0) { |
2217 | pr_err("%s: can't get irq %i, err %d\n", | 2217 | pr_err("%s: can't get irq %i, err %d\n", |
2218 | driver_name, LUBBOCK_USB_DISC_IRQ, retval); | 2218 | driver_name, LUBBOCK_USB_DISC_IRQ, retval); |
2219 | lubbock_fail0: | ||
2220 | goto err_irq_lub; | 2219 | goto err_irq_lub; |
2221 | } | 2220 | } |
2222 | retval = request_irq(LUBBOCK_USB_IRQ, | 2221 | retval = request_irq(LUBBOCK_USB_IRQ, |
@@ -2226,7 +2225,6 @@ lubbock_fail0: | |||
2226 | if (retval != 0) { | 2225 | if (retval != 0) { |
2227 | pr_err("%s: can't get irq %i, err %d\n", | 2226 | pr_err("%s: can't get irq %i, err %d\n", |
2228 | driver_name, LUBBOCK_USB_IRQ, retval); | 2227 | driver_name, LUBBOCK_USB_IRQ, retval); |
2229 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); | ||
2230 | goto lubbock_fail0; | 2228 | goto lubbock_fail0; |
2231 | } | 2229 | } |
2232 | } else | 2230 | } else |
@@ -2236,10 +2234,11 @@ lubbock_fail0: | |||
2236 | return 0; | 2234 | return 0; |
2237 | 2235 | ||
2238 | #ifdef CONFIG_ARCH_LUBBOCK | 2236 | #ifdef CONFIG_ARCH_LUBBOCK |
2237 | lubbock_fail0: | ||
2239 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); | 2238 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); |
2240 | err_irq_lub: | 2239 | err_irq_lub: |
2241 | #endif | ||
2242 | free_irq(irq, dev); | 2240 | free_irq(irq, dev); |
2241 | #endif | ||
2243 | err_irq1: | 2242 | err_irq1: |
2244 | if (gpio_is_valid(dev->mach->gpio_pullup)) | 2243 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2245 | gpio_free(dev->mach->gpio_pullup); | 2244 | gpio_free(dev->mach->gpio_pullup); |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index acb9cc418df9..0dfee282878a 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -2680,9 +2680,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2680 | 2680 | ||
2681 | writel(0, hsotg->regs + S3C_DAINTMSK); | 2681 | writel(0, hsotg->regs + S3C_DAINTMSK); |
2682 | 2682 | ||
2683 | dev_info(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n", | 2683 | dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n", |
2684 | readl(hsotg->regs + S3C_DIEPCTL0), | 2684 | readl(hsotg->regs + S3C_DIEPCTL0), |
2685 | readl(hsotg->regs + S3C_DOEPCTL0)); | 2685 | readl(hsotg->regs + S3C_DOEPCTL0)); |
2686 | 2686 | ||
2687 | /* enable in and out endpoint interrupts */ | 2687 | /* enable in and out endpoint interrupts */ |
2688 | s3c_hsotg_en_gsint(hsotg, S3C_GINTSTS_OEPInt | S3C_GINTSTS_IEPInt); | 2688 | s3c_hsotg_en_gsint(hsotg, S3C_GINTSTS_OEPInt | S3C_GINTSTS_IEPInt); |
@@ -2701,7 +2701,7 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2701 | udelay(10); /* see openiboot */ | 2701 | udelay(10); /* see openiboot */ |
2702 | __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_PWROnPrgDone); | 2702 | __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_PWROnPrgDone); |
2703 | 2703 | ||
2704 | dev_info(hsotg->dev, "DCTL=0x%08x\n", readl(hsotg->regs + S3C_DCTL)); | 2704 | dev_dbg(hsotg->dev, "DCTL=0x%08x\n", readl(hsotg->regs + S3C_DCTL)); |
2705 | 2705 | ||
2706 | /* S3C_DxEPCTL_USBActEp says RO in manual, but seems to be set by | 2706 | /* S3C_DxEPCTL_USBActEp says RO in manual, but seems to be set by |
2707 | writing to the EPCTL register.. */ | 2707 | writing to the EPCTL register.. */ |
@@ -2721,9 +2721,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
2721 | 2721 | ||
2722 | s3c_hsotg_enqueue_setup(hsotg); | 2722 | s3c_hsotg_enqueue_setup(hsotg); |
2723 | 2723 | ||
2724 | dev_info(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n", | 2724 | dev_dbg(hsotg->dev, "EP0: DIEPCTL0=0x%08x, DOEPCTL0=0x%08x\n", |
2725 | readl(hsotg->regs + S3C_DIEPCTL0), | 2725 | readl(hsotg->regs + S3C_DIEPCTL0), |
2726 | readl(hsotg->regs + S3C_DOEPCTL0)); | 2726 | readl(hsotg->regs + S3C_DOEPCTL0)); |
2727 | 2727 | ||
2728 | /* clear global NAKs */ | 2728 | /* clear global NAKs */ |
2729 | writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK, | 2729 | writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK, |
@@ -2921,9 +2921,9 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg) | |||
2921 | 2921 | ||
2922 | /* setup fifos */ | 2922 | /* setup fifos */ |
2923 | 2923 | ||
2924 | dev_info(hsotg->dev, "GRXFSIZ=0x%08x, GNPTXFSIZ=0x%08x\n", | 2924 | dev_dbg(hsotg->dev, "GRXFSIZ=0x%08x, GNPTXFSIZ=0x%08x\n", |
2925 | readl(hsotg->regs + S3C_GRXFSIZ), | 2925 | readl(hsotg->regs + S3C_GRXFSIZ), |
2926 | readl(hsotg->regs + S3C_GNPTXFSIZ)); | 2926 | readl(hsotg->regs + S3C_GNPTXFSIZ)); |
2927 | 2927 | ||
2928 | s3c_hsotg_init_fifo(hsotg); | 2928 | s3c_hsotg_init_fifo(hsotg); |
2929 | 2929 | ||
@@ -2945,6 +2945,7 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg) | |||
2945 | 2945 | ||
2946 | static void s3c_hsotg_dump(struct s3c_hsotg *hsotg) | 2946 | static void s3c_hsotg_dump(struct s3c_hsotg *hsotg) |
2947 | { | 2947 | { |
2948 | #ifdef DEBUG | ||
2948 | struct device *dev = hsotg->dev; | 2949 | struct device *dev = hsotg->dev; |
2949 | void __iomem *regs = hsotg->regs; | 2950 | void __iomem *regs = hsotg->regs; |
2950 | u32 val; | 2951 | u32 val; |
@@ -2987,6 +2988,7 @@ static void s3c_hsotg_dump(struct s3c_hsotg *hsotg) | |||
2987 | 2988 | ||
2988 | dev_info(dev, "DVBUSDIS=0x%08x, DVBUSPULSE=%08x\n", | 2989 | dev_info(dev, "DVBUSDIS=0x%08x, DVBUSPULSE=%08x\n", |
2989 | readl(regs + S3C_DVBUSDIS), readl(regs + S3C_DVBUSPULSE)); | 2990 | readl(regs + S3C_DVBUSDIS), readl(regs + S3C_DVBUSPULSE)); |
2991 | #endif | ||
2990 | } | 2992 | } |
2991 | 2993 | ||
2992 | 2994 | ||
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c index cfe3cf56d6bd..d5e3e1e58626 100644 --- a/drivers/usb/gadget/s3c-hsudc.c +++ b/drivers/usb/gadget/s3c-hsudc.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/usb/ch9.h> | 27 | #include <linux/usb/ch9.h> |
28 | #include <linux/usb/gadget.h> | 28 | #include <linux/usb/gadget.h> |
29 | #include <linux/prefetch.h> | ||
29 | 30 | ||
30 | #include <mach/regs-s3c2443-clock.h> | 31 | #include <mach/regs-s3c2443-clock.h> |
31 | #include <plat/udc.h> | 32 | #include <plat/udc.h> |
@@ -1301,7 +1302,8 @@ static int s3c_hsudc_probe(struct platform_device *pdev) | |||
1301 | hsudc->uclk = clk_get(&pdev->dev, "usb-device"); | 1302 | hsudc->uclk = clk_get(&pdev->dev, "usb-device"); |
1302 | if (IS_ERR(hsudc->uclk)) { | 1303 | if (IS_ERR(hsudc->uclk)) { |
1303 | dev_err(dev, "failed to find usb-device clock source\n"); | 1304 | dev_err(dev, "failed to find usb-device clock source\n"); |
1304 | return PTR_ERR(hsudc->uclk); | 1305 | ret = PTR_ERR(hsudc->uclk); |
1306 | goto err_clk; | ||
1305 | } | 1307 | } |
1306 | clk_enable(hsudc->uclk); | 1308 | clk_enable(hsudc->uclk); |
1307 | 1309 | ||
@@ -1310,7 +1312,8 @@ static int s3c_hsudc_probe(struct platform_device *pdev) | |||
1310 | disable_irq(hsudc->irq); | 1312 | disable_irq(hsudc->irq); |
1311 | local_irq_enable(); | 1313 | local_irq_enable(); |
1312 | return 0; | 1314 | return 0; |
1313 | 1315 | err_clk: | |
1316 | free_irq(hsudc->irq, hsudc); | ||
1314 | err_irq: | 1317 | err_irq: |
1315 | iounmap(hsudc->regs); | 1318 | iounmap(hsudc->regs); |
1316 | 1319 | ||
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index 6d8b04061d5d..100f2635cf0a 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
37 | #include <linux/clk.h> | 37 | #include <linux/clk.h> |
38 | #include <linux/gpio.h> | 38 | #include <linux/gpio.h> |
39 | #include <linux/prefetch.h> | ||
39 | 40 | ||
40 | #include <linux/debugfs.h> | 41 | #include <linux/debugfs.h> |
41 | #include <linux/seq_file.h> | 42 | #include <linux/seq_file.h> |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index afef7b0a4195..80be5472783a 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -312,8 +312,10 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
312 | return PTR_ERR(usb_clk); | 312 | return PTR_ERR(usb_clk); |
313 | 313 | ||
314 | hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); | 314 | hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); |
315 | if (!hcd) | 315 | if (!hcd) { |
316 | return -ENOMEM; | 316 | retval = -ENOMEM; |
317 | goto err0; | ||
318 | } | ||
317 | 319 | ||
318 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 320 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
319 | if (!r) { | 321 | if (!r) { |
@@ -368,6 +370,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
368 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 370 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
369 | err1: | 371 | err1: |
370 | usb_put_hcd(hcd); | 372 | usb_put_hcd(hcd); |
373 | err0: | ||
371 | clk_put(usb_clk); | 374 | clk_put(usb_clk); |
372 | return retval; | 375 | return retval; |
373 | } | 376 | } |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 2e0486178dbe..1f50b4468e87 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -438,13 +438,13 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci, | |||
438 | struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx); | 438 | struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx); |
439 | 439 | ||
440 | switch (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state))) { | 440 | switch (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state))) { |
441 | case 0: | 441 | case SLOT_STATE_ENABLED: |
442 | return "enabled/disabled"; | 442 | return "enabled/disabled"; |
443 | case 1: | 443 | case SLOT_STATE_DEFAULT: |
444 | return "default"; | 444 | return "default"; |
445 | case 2: | 445 | case SLOT_STATE_ADDRESSED: |
446 | return "addressed"; | 446 | return "addressed"; |
447 | case 3: | 447 | case SLOT_STATE_CONFIGURED: |
448 | return "configured"; | 448 | return "configured"; |
449 | default: | 449 | default: |
450 | return "reserved"; | 450 | return "reserved"; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 26caba4c1950..0f8e1d29a858 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -985,9 +985,19 @@ static unsigned int xhci_parse_exponent_interval(struct usb_device *udev, | |||
985 | interval = clamp_val(ep->desc.bInterval, 1, 16) - 1; | 985 | interval = clamp_val(ep->desc.bInterval, 1, 16) - 1; |
986 | if (interval != ep->desc.bInterval - 1) | 986 | if (interval != ep->desc.bInterval - 1) |
987 | dev_warn(&udev->dev, | 987 | dev_warn(&udev->dev, |
988 | "ep %#x - rounding interval to %d microframes\n", | 988 | "ep %#x - rounding interval to %d %sframes\n", |
989 | ep->desc.bEndpointAddress, | 989 | ep->desc.bEndpointAddress, |
990 | 1 << interval); | 990 | 1 << interval, |
991 | udev->speed == USB_SPEED_FULL ? "" : "micro"); | ||
992 | |||
993 | if (udev->speed == USB_SPEED_FULL) { | ||
994 | /* | ||
995 | * Full speed isoc endpoints specify interval in frames, | ||
996 | * not microframes. We are using microframes everywhere, | ||
997 | * so adjust accordingly. | ||
998 | */ | ||
999 | interval += 3; /* 1 frame = 2^3 uframes */ | ||
1000 | } | ||
991 | 1001 | ||
992 | return interval; | 1002 | return interval; |
993 | } | 1003 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index c408e9f6a707..17541d09eabb 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -106,12 +106,22 @@ static int xhci_pci_setup(struct usb_hcd *hcd) | |||
106 | 106 | ||
107 | /* Look for vendor-specific quirks */ | 107 | /* Look for vendor-specific quirks */ |
108 | if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && | 108 | if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC && |
109 | pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK && | 109 | pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) { |
110 | pdev->revision == 0x0) { | 110 | if (pdev->revision == 0x0) { |
111 | xhci->quirks |= XHCI_RESET_EP_QUIRK; | 111 | xhci->quirks |= XHCI_RESET_EP_QUIRK; |
112 | xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" | 112 | xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" |
113 | " endpoint cmd after reset endpoint\n"); | 113 | " endpoint cmd after reset endpoint\n"); |
114 | } | ||
115 | /* Fresco Logic confirms: all revisions of this chip do not | ||
116 | * support MSI, even though some of them claim to in their PCI | ||
117 | * capabilities. | ||
118 | */ | ||
119 | xhci->quirks |= XHCI_BROKEN_MSI; | ||
120 | xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u " | ||
121 | "has broken MSI implementation\n", | ||
122 | pdev->revision); | ||
114 | } | 123 | } |
124 | |||
115 | if (pdev->vendor == PCI_VENDOR_ID_NEC) | 125 | if (pdev->vendor == PCI_VENDOR_ID_NEC) |
116 | xhci->quirks |= XHCI_NEC_HOST; | 126 | xhci->quirks |= XHCI_NEC_HOST; |
117 | 127 | ||
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index cc1485bfed38..800f417c7309 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1782,7 +1782,7 @@ static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1782 | struct usb_iso_packet_descriptor *frame; | 1782 | struct usb_iso_packet_descriptor *frame; |
1783 | int idx; | 1783 | int idx; |
1784 | 1784 | ||
1785 | ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); | 1785 | ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer)); |
1786 | urb_priv = td->urb->hcpriv; | 1786 | urb_priv = td->urb->hcpriv; |
1787 | idx = urb_priv->td_cnt; | 1787 | idx = urb_priv->td_cnt; |
1788 | frame = &td->urb->iso_frame_desc[idx]; | 1788 | frame = &td->urb->iso_frame_desc[idx]; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index d9660eb97eb9..06e7023258d0 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -430,12 +430,19 @@ int xhci_run(struct usb_hcd *hcd) | |||
430 | free_irq(hcd->irq, hcd); | 430 | free_irq(hcd->irq, hcd); |
431 | hcd->irq = -1; | 431 | hcd->irq = -1; |
432 | 432 | ||
433 | /* Some Fresco Logic host controllers advertise MSI, but fail to | ||
434 | * generate interrupts. Don't even try to enable MSI. | ||
435 | */ | ||
436 | if (xhci->quirks & XHCI_BROKEN_MSI) | ||
437 | goto legacy_irq; | ||
438 | |||
433 | ret = xhci_setup_msix(xhci); | 439 | ret = xhci_setup_msix(xhci); |
434 | if (ret) | 440 | if (ret) |
435 | /* fall back to msi*/ | 441 | /* fall back to msi*/ |
436 | ret = xhci_setup_msi(xhci); | 442 | ret = xhci_setup_msi(xhci); |
437 | 443 | ||
438 | if (ret) { | 444 | if (ret) { |
445 | legacy_irq: | ||
439 | /* fall back to legacy interrupt*/ | 446 | /* fall back to legacy interrupt*/ |
440 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | 447 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
441 | hcd->irq_descr, hcd); | 448 | hcd->irq_descr, hcd); |
@@ -1849,8 +1856,8 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) | |||
1849 | 1856 | ||
1850 | /* Free any rings that were dropped, but not changed. */ | 1857 | /* Free any rings that were dropped, but not changed. */ |
1851 | for (i = 1; i < 31; ++i) { | 1858 | for (i = 1; i < 31; ++i) { |
1852 | if ((ctrl_ctx->drop_flags & (1 << (i + 1))) && | 1859 | if ((le32_to_cpu(ctrl_ctx->drop_flags) & (1 << (i + 1))) && |
1853 | !(ctrl_ctx->add_flags & (1 << (i + 1)))) | 1860 | !(le32_to_cpu(ctrl_ctx->add_flags) & (1 << (i + 1)))) |
1854 | xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); | 1861 | xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); |
1855 | } | 1862 | } |
1856 | xhci_zero_in_ctx(xhci, virt_dev); | 1863 | xhci_zero_in_ctx(xhci, virt_dev); |
@@ -2467,6 +2474,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
2467 | struct xhci_command *reset_device_cmd; | 2474 | struct xhci_command *reset_device_cmd; |
2468 | int timeleft; | 2475 | int timeleft; |
2469 | int last_freed_endpoint; | 2476 | int last_freed_endpoint; |
2477 | struct xhci_slot_ctx *slot_ctx; | ||
2470 | 2478 | ||
2471 | ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__); | 2479 | ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__); |
2472 | if (ret <= 0) | 2480 | if (ret <= 0) |
@@ -2499,6 +2507,12 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
2499 | return -EINVAL; | 2507 | return -EINVAL; |
2500 | } | 2508 | } |
2501 | 2509 | ||
2510 | /* If device is not setup, there is no point in resetting it */ | ||
2511 | slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx); | ||
2512 | if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) == | ||
2513 | SLOT_STATE_DISABLED) | ||
2514 | return 0; | ||
2515 | |||
2502 | xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id); | 2516 | xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id); |
2503 | /* Allocate the command structure that holds the struct completion. | 2517 | /* Allocate the command structure that holds the struct completion. |
2504 | * Assume we're in process context, since the normal device reset | 2518 | * Assume we're in process context, since the normal device reset |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index ac0196e7fcf1..7d1ea3bf5e1f 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -560,6 +560,11 @@ struct xhci_slot_ctx { | |||
560 | #define SLOT_STATE (0x1f << 27) | 560 | #define SLOT_STATE (0x1f << 27) |
561 | #define GET_SLOT_STATE(p) (((p) & (0x1f << 27)) >> 27) | 561 | #define GET_SLOT_STATE(p) (((p) & (0x1f << 27)) >> 27) |
562 | 562 | ||
563 | #define SLOT_STATE_DISABLED 0 | ||
564 | #define SLOT_STATE_ENABLED SLOT_STATE_DISABLED | ||
565 | #define SLOT_STATE_DEFAULT 1 | ||
566 | #define SLOT_STATE_ADDRESSED 2 | ||
567 | #define SLOT_STATE_CONFIGURED 3 | ||
563 | 568 | ||
564 | /** | 569 | /** |
565 | * struct xhci_ep_ctx | 570 | * struct xhci_ep_ctx |
@@ -1302,6 +1307,7 @@ struct xhci_hcd { | |||
1302 | * commands. | 1307 | * commands. |
1303 | */ | 1308 | */ |
1304 | #define XHCI_EP_LIMIT_QUIRK (1 << 5) | 1309 | #define XHCI_EP_LIMIT_QUIRK (1 << 5) |
1310 | #define XHCI_BROKEN_MSI (1 << 6) | ||
1305 | unsigned int num_active_eps; | 1311 | unsigned int num_active_eps; |
1306 | unsigned int limit_active_eps; | 1312 | unsigned int limit_active_eps; |
1307 | /* There are two roothubs to keep track of bus suspend info for */ | 1313 | /* There are two roothubs to keep track of bus suspend info for */ |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index ab8e1001e5e2..c71b0372786e 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -96,6 +96,7 @@ | |||
96 | #include <linux/init.h> | 96 | #include <linux/init.h> |
97 | #include <linux/list.h> | 97 | #include <linux/list.h> |
98 | #include <linux/kobject.h> | 98 | #include <linux/kobject.h> |
99 | #include <linux/prefetch.h> | ||
99 | #include <linux/platform_device.h> | 100 | #include <linux/platform_device.h> |
100 | #include <linux/io.h> | 101 | #include <linux/io.h> |
101 | 102 | ||
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 206cfabc9286..547486ccd059 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -1380,5 +1380,6 @@ void __devexit usbhs_mod_gadget_remove(struct usbhs_priv *priv) | |||
1380 | { | 1380 | { |
1381 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); | 1381 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); |
1382 | 1382 | ||
1383 | kfree(gpriv->uep); | ||
1383 | kfree(gpriv); | 1384 | kfree(gpriv); |
1384 | } | 1385 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index e8dbde55f6c5..162728977553 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -647,6 +647,7 @@ static struct usb_device_id id_table_combined [] = { | |||
647 | { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, | 647 | { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, |
648 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, | 648 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, |
649 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, | 649 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, |
650 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_3_PID) }, | ||
650 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, | 651 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_0_PID) }, |
651 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) }, | 652 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_1_PID) }, |
652 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) }, | 653 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_2_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 1d946cd238ba..ab1fcdf3c378 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -351,6 +351,7 @@ | |||
351 | */ | 351 | */ |
352 | #define FTDI_4N_GALAXY_DE_1_PID 0xF3C0 | 352 | #define FTDI_4N_GALAXY_DE_1_PID 0xF3C0 |
353 | #define FTDI_4N_GALAXY_DE_2_PID 0xF3C1 | 353 | #define FTDI_4N_GALAXY_DE_2_PID 0xF3C1 |
354 | #define FTDI_4N_GALAXY_DE_3_PID 0xF3C2 | ||
354 | 355 | ||
355 | /* | 356 | /* |
356 | * Linx Technologies product ids | 357 | * Linx Technologies product ids |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 318dd00040a3..60b25d8ea0e2 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -311,10 +311,6 @@ static void option_instat_callback(struct urb *urb); | |||
311 | #define ZTE_PRODUCT_AC2726 0xfff5 | 311 | #define ZTE_PRODUCT_AC2726 0xfff5 |
312 | #define ZTE_PRODUCT_AC8710T 0xffff | 312 | #define ZTE_PRODUCT_AC8710T 0xffff |
313 | 313 | ||
314 | /* ZTE PRODUCTS -- alternate vendor ID */ | ||
315 | #define ZTE_VENDOR_ID2 0x1d6b | ||
316 | #define ZTE_PRODUCT_MF_330 0x0002 | ||
317 | |||
318 | #define BENQ_VENDOR_ID 0x04a5 | 314 | #define BENQ_VENDOR_ID 0x04a5 |
319 | #define BENQ_PRODUCT_H10 0x4068 | 315 | #define BENQ_PRODUCT_H10 0x4068 |
320 | 316 | ||
@@ -340,11 +336,12 @@ static void option_instat_callback(struct urb *urb); | |||
340 | #define TOSHIBA_PRODUCT_G450 0x0d45 | 336 | #define TOSHIBA_PRODUCT_G450 0x0d45 |
341 | 337 | ||
342 | #define ALINK_VENDOR_ID 0x1e0e | 338 | #define ALINK_VENDOR_ID 0x1e0e |
339 | #define ALINK_PRODUCT_PH300 0x9100 | ||
343 | #define ALINK_PRODUCT_3GU 0x9200 | 340 | #define ALINK_PRODUCT_3GU 0x9200 |
344 | 341 | ||
345 | /* ALCATEL PRODUCTS */ | 342 | /* ALCATEL PRODUCTS */ |
346 | #define ALCATEL_VENDOR_ID 0x1bbb | 343 | #define ALCATEL_VENDOR_ID 0x1bbb |
347 | #define ALCATEL_PRODUCT_X060S 0x0000 | 344 | #define ALCATEL_PRODUCT_X060S_X200 0x0000 |
348 | 345 | ||
349 | #define PIRELLI_VENDOR_ID 0x1266 | 346 | #define PIRELLI_VENDOR_ID 0x1266 |
350 | #define PIRELLI_PRODUCT_C100_1 0x1002 | 347 | #define PIRELLI_PRODUCT_C100_1 0x1002 |
@@ -379,6 +376,9 @@ static void option_instat_callback(struct urb *urb); | |||
379 | * It seems to contain a Qualcomm QSC6240/6290 chipset */ | 376 | * It seems to contain a Qualcomm QSC6240/6290 chipset */ |
380 | #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 | 377 | #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 |
381 | 378 | ||
379 | /* Zoom */ | ||
380 | #define ZOOM_PRODUCT_4597 0x9607 | ||
381 | |||
382 | /* Haier products */ | 382 | /* Haier products */ |
383 | #define HAIER_VENDOR_ID 0x201e | 383 | #define HAIER_VENDOR_ID 0x201e |
384 | #define HAIER_PRODUCT_CE100 0x2009 | 384 | #define HAIER_PRODUCT_CE100 0x2009 |
@@ -432,6 +432,20 @@ static const struct option_blacklist_info four_g_w14_blacklist = { | |||
432 | .reason = OPTION_BLACKLIST_SENDSETUP | 432 | .reason = OPTION_BLACKLIST_SENDSETUP |
433 | }; | 433 | }; |
434 | 434 | ||
435 | static const u8 alcatel_x200_no_sendsetup[] = { 0, 1 }; | ||
436 | static const struct option_blacklist_info alcatel_x200_blacklist = { | ||
437 | .infolen = ARRAY_SIZE(alcatel_x200_no_sendsetup), | ||
438 | .ifaceinfo = alcatel_x200_no_sendsetup, | ||
439 | .reason = OPTION_BLACKLIST_SENDSETUP | ||
440 | }; | ||
441 | |||
442 | static const u8 zte_k3765_z_no_sendsetup[] = { 0, 1, 2 }; | ||
443 | static const struct option_blacklist_info zte_k3765_z_blacklist = { | ||
444 | .infolen = ARRAY_SIZE(zte_k3765_z_no_sendsetup), | ||
445 | .ifaceinfo = zte_k3765_z_no_sendsetup, | ||
446 | .reason = OPTION_BLACKLIST_SENDSETUP | ||
447 | }; | ||
448 | |||
435 | static const struct usb_device_id option_ids[] = { | 449 | static const struct usb_device_id option_ids[] = { |
436 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 450 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
437 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 451 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -916,13 +930,13 @@ static const struct usb_device_id option_ids[] = { | |||
916 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, | 930 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, |
917 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, | 931 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, |
918 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, | 932 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, |
919 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) }, | 933 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, |
934 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, | ||
920 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, | 935 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, |
921 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, | 936 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, |
922 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, | 937 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, |
923 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, | 938 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, |
924 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, | 939 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, |
925 | { USB_DEVICE(ZTE_VENDOR_ID2, ZTE_PRODUCT_MF_330) }, | ||
926 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | 940 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, |
927 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, | 941 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, |
928 | { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ | 942 | { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */ |
@@ -935,13 +949,17 @@ static const struct usb_device_id option_ids[] = { | |||
935 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, | 949 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, |
936 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ | 950 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ |
937 | { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, | 951 | { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, |
952 | { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) }, | ||
938 | { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, | 953 | { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, |
939 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) }, | 954 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), |
955 | .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist | ||
956 | }, | ||
940 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, | 957 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, |
941 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, | 958 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, |
942 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), | 959 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
943 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist | 960 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
944 | }, | 961 | }, |
962 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, | ||
945 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, | 963 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
946 | /* Pirelli */ | 964 | /* Pirelli */ |
947 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)}, | 965 | { USB_DEVICE(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1)}, |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 00418995d8e9..e8ae21b2d387 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -819,6 +819,35 @@ Retry_Sense: | |||
819 | } | 819 | } |
820 | } | 820 | } |
821 | 821 | ||
822 | /* | ||
823 | * Some devices don't work or return incorrect data the first | ||
824 | * time they get a READ(10) command, or for the first READ(10) | ||
825 | * after a media change. If the INITIAL_READ10 flag is set, | ||
826 | * keep track of whether READ(10) commands succeed. If the | ||
827 | * previous one succeeded and this one failed, set the REDO_READ10 | ||
828 | * flag to force a retry. | ||
829 | */ | ||
830 | if (unlikely((us->fflags & US_FL_INITIAL_READ10) && | ||
831 | srb->cmnd[0] == READ_10)) { | ||
832 | if (srb->result == SAM_STAT_GOOD) { | ||
833 | set_bit(US_FLIDX_READ10_WORKED, &us->dflags); | ||
834 | } else if (test_bit(US_FLIDX_READ10_WORKED, &us->dflags)) { | ||
835 | clear_bit(US_FLIDX_READ10_WORKED, &us->dflags); | ||
836 | set_bit(US_FLIDX_REDO_READ10, &us->dflags); | ||
837 | } | ||
838 | |||
839 | /* | ||
840 | * Next, if the REDO_READ10 flag is set, return a result | ||
841 | * code that will cause the SCSI core to retry the READ(10) | ||
842 | * command immediately. | ||
843 | */ | ||
844 | if (test_bit(US_FLIDX_REDO_READ10, &us->dflags)) { | ||
845 | clear_bit(US_FLIDX_REDO_READ10, &us->dflags); | ||
846 | srb->result = DID_IMM_RETRY << 16; | ||
847 | srb->sense_buffer[0] = 0; | ||
848 | } | ||
849 | } | ||
850 | |||
822 | /* Did we transfer less than the minimum amount required? */ | 851 | /* Did we transfer less than the minimum amount required? */ |
823 | if ((srb->result == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) && | 852 | if ((srb->result == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) && |
824 | scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow) | 853 | scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow) |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index c1602b8c5594..ccff3483eebc 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1114,6 +1114,16 @@ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, | |||
1114 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1114 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1115 | US_FL_FIX_CAPACITY ), | 1115 | US_FL_FIX_CAPACITY ), |
1116 | 1116 | ||
1117 | /* Reported by Paul Hartman <paul.hartman+linux@gmail.com> | ||
1118 | * This card reader returns "Illegal Request, Logical Block Address | ||
1119 | * Out of Range" for the first READ(10) after a new card is inserted. | ||
1120 | */ | ||
1121 | UNUSUAL_DEV( 0x090c, 0x6000, 0x0100, 0x0100, | ||
1122 | "Feiya", | ||
1123 | "SD/SDHC Card Reader", | ||
1124 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1125 | US_FL_INITIAL_READ10 ), | ||
1126 | |||
1117 | /* This Pentax still camera is not conformant | 1127 | /* This Pentax still camera is not conformant |
1118 | * to the USB storage specification: - | 1128 | * to the USB storage specification: - |
1119 | * - It does not like the INQUIRY command. So we must handle this command | 1129 | * - It does not like the INQUIRY command. So we must handle this command |
@@ -1888,6 +1898,15 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, | |||
1888 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1898 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1889 | US_FL_NO_READ_DISC_INFO ), | 1899 | US_FL_NO_READ_DISC_INFO ), |
1890 | 1900 | ||
1901 | /* Reported by Sven Geggus <sven-usbst@geggus.net> | ||
1902 | * This encrypted pen drive returns bogus data for the initial READ(10). | ||
1903 | */ | ||
1904 | UNUSUAL_DEV( 0x1b1c, 0x1ab5, 0x0200, 0x0200, | ||
1905 | "Corsair", | ||
1906 | "Padlock v2", | ||
1907 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1908 | US_FL_INITIAL_READ10 ), | ||
1909 | |||
1891 | /* Patch by Richard Schütz <r.schtz@t-online.de> | 1910 | /* Patch by Richard Schütz <r.schtz@t-online.de> |
1892 | * This external hard drive enclosure uses a JMicron chip which | 1911 | * This external hard drive enclosure uses a JMicron chip which |
1893 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ | 1912 | * needs the US_FL_IGNORE_RESIDUE flag to work properly. */ |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 5ee7ac42e08f..0ca095820f3e 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -440,7 +440,8 @@ static void adjust_quirks(struct us_data *us) | |||
440 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | | 440 | US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 | |
441 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | | 441 | US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE | |
442 | US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT | | 442 | US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT | |
443 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16); | 443 | US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 | |
444 | US_FL_INITIAL_READ10); | ||
444 | 445 | ||
445 | p = quirks; | 446 | p = quirks; |
446 | while (*p) { | 447 | while (*p) { |
@@ -490,6 +491,9 @@ static void adjust_quirks(struct us_data *us) | |||
490 | case 'm': | 491 | case 'm': |
491 | f |= US_FL_MAX_SECTORS_64; | 492 | f |= US_FL_MAX_SECTORS_64; |
492 | break; | 493 | break; |
494 | case 'n': | ||
495 | f |= US_FL_INITIAL_READ10; | ||
496 | break; | ||
493 | case 'o': | 497 | case 'o': |
494 | f |= US_FL_CAPACITY_OK; | 498 | f |= US_FL_CAPACITY_OK; |
495 | break; | 499 | break; |
@@ -953,6 +957,13 @@ int usb_stor_probe2(struct us_data *us) | |||
953 | if (result) | 957 | if (result) |
954 | goto BadDevice; | 958 | goto BadDevice; |
955 | 959 | ||
960 | /* | ||
961 | * If the device returns invalid data for the first READ(10) | ||
962 | * command, indicate the command should be retried. | ||
963 | */ | ||
964 | if (us->fflags & US_FL_INITIAL_READ10) | ||
965 | set_bit(US_FLIDX_REDO_READ10, &us->dflags); | ||
966 | |||
956 | /* Acquire all the other resources and add the host */ | 967 | /* Acquire all the other resources and add the host */ |
957 | result = usb_stor_acquire_resources(us); | 968 | result = usb_stor_acquire_resources(us); |
958 | if (result) | 969 | if (result) |
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 89d3bfff98df..7b0f2113632e 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h | |||
@@ -73,6 +73,8 @@ struct us_unusual_dev { | |||
73 | #define US_FLIDX_RESETTING 4 /* device reset in progress */ | 73 | #define US_FLIDX_RESETTING 4 /* device reset in progress */ |
74 | #define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */ | 74 | #define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */ |
75 | #define US_FLIDX_DONT_SCAN 6 /* don't scan (disconnect) */ | 75 | #define US_FLIDX_DONT_SCAN 6 /* don't scan (disconnect) */ |
76 | #define US_FLIDX_REDO_READ10 7 /* redo READ(10) command */ | ||
77 | #define US_FLIDX_READ10_WORKED 8 /* previous READ(10) succeeded */ | ||
76 | 78 | ||
77 | #define USB_STOR_STRING_LEN 32 | 79 | #define USB_STOR_STRING_LEN 32 |
78 | 80 | ||
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 2f7c76a85e53..e224a92baa16 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -144,7 +144,7 @@ static void handle_tx(struct vhost_net *net) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | mutex_lock(&vq->mutex); | 146 | mutex_lock(&vq->mutex); |
147 | vhost_disable_notify(vq); | 147 | vhost_disable_notify(&net->dev, vq); |
148 | 148 | ||
149 | if (wmem < sock->sk->sk_sndbuf / 2) | 149 | if (wmem < sock->sk->sk_sndbuf / 2) |
150 | tx_poll_stop(net); | 150 | tx_poll_stop(net); |
@@ -166,8 +166,8 @@ static void handle_tx(struct vhost_net *net) | |||
166 | set_bit(SOCK_ASYNC_NOSPACE, &sock->flags); | 166 | set_bit(SOCK_ASYNC_NOSPACE, &sock->flags); |
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | if (unlikely(vhost_enable_notify(vq))) { | 169 | if (unlikely(vhost_enable_notify(&net->dev, vq))) { |
170 | vhost_disable_notify(vq); | 170 | vhost_disable_notify(&net->dev, vq); |
171 | continue; | 171 | continue; |
172 | } | 172 | } |
173 | break; | 173 | break; |
@@ -315,7 +315,7 @@ static void handle_rx(struct vhost_net *net) | |||
315 | return; | 315 | return; |
316 | 316 | ||
317 | mutex_lock(&vq->mutex); | 317 | mutex_lock(&vq->mutex); |
318 | vhost_disable_notify(vq); | 318 | vhost_disable_notify(&net->dev, vq); |
319 | vhost_hlen = vq->vhost_hlen; | 319 | vhost_hlen = vq->vhost_hlen; |
320 | sock_hlen = vq->sock_hlen; | 320 | sock_hlen = vq->sock_hlen; |
321 | 321 | ||
@@ -334,10 +334,10 @@ static void handle_rx(struct vhost_net *net) | |||
334 | break; | 334 | break; |
335 | /* OK, now we need to know about added descriptors. */ | 335 | /* OK, now we need to know about added descriptors. */ |
336 | if (!headcount) { | 336 | if (!headcount) { |
337 | if (unlikely(vhost_enable_notify(vq))) { | 337 | if (unlikely(vhost_enable_notify(&net->dev, vq))) { |
338 | /* They have slipped one in as we were | 338 | /* They have slipped one in as we were |
339 | * doing that: check again. */ | 339 | * doing that: check again. */ |
340 | vhost_disable_notify(vq); | 340 | vhost_disable_notify(&net->dev, vq); |
341 | continue; | 341 | continue; |
342 | } | 342 | } |
343 | /* Nothing new? Wait for eventfd to tell us | 343 | /* Nothing new? Wait for eventfd to tell us |
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index 099f30230d06..734e1d74ad80 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c | |||
@@ -49,7 +49,7 @@ static void handle_vq(struct vhost_test *n) | |||
49 | return; | 49 | return; |
50 | 50 | ||
51 | mutex_lock(&vq->mutex); | 51 | mutex_lock(&vq->mutex); |
52 | vhost_disable_notify(vq); | 52 | vhost_disable_notify(&n->dev, vq); |
53 | 53 | ||
54 | for (;;) { | 54 | for (;;) { |
55 | head = vhost_get_vq_desc(&n->dev, vq, vq->iov, | 55 | head = vhost_get_vq_desc(&n->dev, vq, vq->iov, |
@@ -61,8 +61,8 @@ static void handle_vq(struct vhost_test *n) | |||
61 | break; | 61 | break; |
62 | /* Nothing new? Wait for eventfd to tell us they refilled. */ | 62 | /* Nothing new? Wait for eventfd to tell us they refilled. */ |
63 | if (head == vq->num) { | 63 | if (head == vq->num) { |
64 | if (unlikely(vhost_enable_notify(vq))) { | 64 | if (unlikely(vhost_enable_notify(&n->dev, vq))) { |
65 | vhost_disable_notify(vq); | 65 | vhost_disable_notify(&n->dev, vq); |
66 | continue; | 66 | continue; |
67 | } | 67 | } |
68 | break; | 68 | break; |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 7aa4eea930f1..ea966b356352 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -37,6 +37,9 @@ enum { | |||
37 | VHOST_MEMORY_F_LOG = 0x1, | 37 | VHOST_MEMORY_F_LOG = 0x1, |
38 | }; | 38 | }; |
39 | 39 | ||
40 | #define vhost_used_event(vq) ((u16 __user *)&vq->avail->ring[vq->num]) | ||
41 | #define vhost_avail_event(vq) ((u16 __user *)&vq->used->ring[vq->num]) | ||
42 | |||
40 | static void vhost_poll_func(struct file *file, wait_queue_head_t *wqh, | 43 | static void vhost_poll_func(struct file *file, wait_queue_head_t *wqh, |
41 | poll_table *pt) | 44 | poll_table *pt) |
42 | { | 45 | { |
@@ -161,6 +164,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, | |||
161 | vq->last_avail_idx = 0; | 164 | vq->last_avail_idx = 0; |
162 | vq->avail_idx = 0; | 165 | vq->avail_idx = 0; |
163 | vq->last_used_idx = 0; | 166 | vq->last_used_idx = 0; |
167 | vq->signalled_used = 0; | ||
168 | vq->signalled_used_valid = false; | ||
164 | vq->used_flags = 0; | 169 | vq->used_flags = 0; |
165 | vq->log_used = false; | 170 | vq->log_used = false; |
166 | vq->log_addr = -1ull; | 171 | vq->log_addr = -1ull; |
@@ -489,16 +494,17 @@ static int memory_access_ok(struct vhost_dev *d, struct vhost_memory *mem, | |||
489 | return 1; | 494 | return 1; |
490 | } | 495 | } |
491 | 496 | ||
492 | static int vq_access_ok(unsigned int num, | 497 | static int vq_access_ok(struct vhost_dev *d, unsigned int num, |
493 | struct vring_desc __user *desc, | 498 | struct vring_desc __user *desc, |
494 | struct vring_avail __user *avail, | 499 | struct vring_avail __user *avail, |
495 | struct vring_used __user *used) | 500 | struct vring_used __user *used) |
496 | { | 501 | { |
502 | size_t s = vhost_has_feature(d, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0; | ||
497 | return access_ok(VERIFY_READ, desc, num * sizeof *desc) && | 503 | return access_ok(VERIFY_READ, desc, num * sizeof *desc) && |
498 | access_ok(VERIFY_READ, avail, | 504 | access_ok(VERIFY_READ, avail, |
499 | sizeof *avail + num * sizeof *avail->ring) && | 505 | sizeof *avail + num * sizeof *avail->ring + s) && |
500 | access_ok(VERIFY_WRITE, used, | 506 | access_ok(VERIFY_WRITE, used, |
501 | sizeof *used + num * sizeof *used->ring); | 507 | sizeof *used + num * sizeof *used->ring + s); |
502 | } | 508 | } |
503 | 509 | ||
504 | /* Can we log writes? */ | 510 | /* Can we log writes? */ |
@@ -514,9 +520,11 @@ int vhost_log_access_ok(struct vhost_dev *dev) | |||
514 | 520 | ||
515 | /* Verify access for write logging. */ | 521 | /* Verify access for write logging. */ |
516 | /* Caller should have vq mutex and device mutex */ | 522 | /* Caller should have vq mutex and device mutex */ |
517 | static int vq_log_access_ok(struct vhost_virtqueue *vq, void __user *log_base) | 523 | static int vq_log_access_ok(struct vhost_dev *d, struct vhost_virtqueue *vq, |
524 | void __user *log_base) | ||
518 | { | 525 | { |
519 | struct vhost_memory *mp; | 526 | struct vhost_memory *mp; |
527 | size_t s = vhost_has_feature(d, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0; | ||
520 | 528 | ||
521 | mp = rcu_dereference_protected(vq->dev->memory, | 529 | mp = rcu_dereference_protected(vq->dev->memory, |
522 | lockdep_is_held(&vq->mutex)); | 530 | lockdep_is_held(&vq->mutex)); |
@@ -524,15 +532,15 @@ static int vq_log_access_ok(struct vhost_virtqueue *vq, void __user *log_base) | |||
524 | vhost_has_feature(vq->dev, VHOST_F_LOG_ALL)) && | 532 | vhost_has_feature(vq->dev, VHOST_F_LOG_ALL)) && |
525 | (!vq->log_used || log_access_ok(log_base, vq->log_addr, | 533 | (!vq->log_used || log_access_ok(log_base, vq->log_addr, |
526 | sizeof *vq->used + | 534 | sizeof *vq->used + |
527 | vq->num * sizeof *vq->used->ring)); | 535 | vq->num * sizeof *vq->used->ring + s)); |
528 | } | 536 | } |
529 | 537 | ||
530 | /* Can we start vq? */ | 538 | /* Can we start vq? */ |
531 | /* Caller should have vq mutex and device mutex */ | 539 | /* Caller should have vq mutex and device mutex */ |
532 | int vhost_vq_access_ok(struct vhost_virtqueue *vq) | 540 | int vhost_vq_access_ok(struct vhost_virtqueue *vq) |
533 | { | 541 | { |
534 | return vq_access_ok(vq->num, vq->desc, vq->avail, vq->used) && | 542 | return vq_access_ok(vq->dev, vq->num, vq->desc, vq->avail, vq->used) && |
535 | vq_log_access_ok(vq, vq->log_base); | 543 | vq_log_access_ok(vq->dev, vq, vq->log_base); |
536 | } | 544 | } |
537 | 545 | ||
538 | static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) | 546 | static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) |
@@ -577,6 +585,7 @@ static int init_used(struct vhost_virtqueue *vq, | |||
577 | 585 | ||
578 | if (r) | 586 | if (r) |
579 | return r; | 587 | return r; |
588 | vq->signalled_used_valid = false; | ||
580 | return get_user(vq->last_used_idx, &used->idx); | 589 | return get_user(vq->last_used_idx, &used->idx); |
581 | } | 590 | } |
582 | 591 | ||
@@ -674,7 +683,7 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
674 | * If it is not, we don't as size might not have been setup. | 683 | * If it is not, we don't as size might not have been setup. |
675 | * We will verify when backend is configured. */ | 684 | * We will verify when backend is configured. */ |
676 | if (vq->private_data) { | 685 | if (vq->private_data) { |
677 | if (!vq_access_ok(vq->num, | 686 | if (!vq_access_ok(d, vq->num, |
678 | (void __user *)(unsigned long)a.desc_user_addr, | 687 | (void __user *)(unsigned long)a.desc_user_addr, |
679 | (void __user *)(unsigned long)a.avail_user_addr, | 688 | (void __user *)(unsigned long)a.avail_user_addr, |
680 | (void __user *)(unsigned long)a.used_user_addr)) { | 689 | (void __user *)(unsigned long)a.used_user_addr)) { |
@@ -818,7 +827,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, unsigned long arg) | |||
818 | vq = d->vqs + i; | 827 | vq = d->vqs + i; |
819 | mutex_lock(&vq->mutex); | 828 | mutex_lock(&vq->mutex); |
820 | /* If ring is inactive, will check when it's enabled. */ | 829 | /* If ring is inactive, will check when it's enabled. */ |
821 | if (vq->private_data && !vq_log_access_ok(vq, base)) | 830 | if (vq->private_data && !vq_log_access_ok(d, vq, base)) |
822 | r = -EFAULT; | 831 | r = -EFAULT; |
823 | else | 832 | else |
824 | vq->log_base = base; | 833 | vq->log_base = base; |
@@ -1219,6 +1228,10 @@ int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq, | |||
1219 | 1228 | ||
1220 | /* On success, increment avail index. */ | 1229 | /* On success, increment avail index. */ |
1221 | vq->last_avail_idx++; | 1230 | vq->last_avail_idx++; |
1231 | |||
1232 | /* Assume notifications from guest are disabled at this point, | ||
1233 | * if they aren't we would need to update avail_event index. */ | ||
1234 | BUG_ON(!(vq->used_flags & VRING_USED_F_NO_NOTIFY)); | ||
1222 | return head; | 1235 | return head; |
1223 | } | 1236 | } |
1224 | 1237 | ||
@@ -1267,6 +1280,12 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) | |||
1267 | eventfd_signal(vq->log_ctx, 1); | 1280 | eventfd_signal(vq->log_ctx, 1); |
1268 | } | 1281 | } |
1269 | vq->last_used_idx++; | 1282 | vq->last_used_idx++; |
1283 | /* If the driver never bothers to signal in a very long while, | ||
1284 | * used index might wrap around. If that happens, invalidate | ||
1285 | * signalled_used index we stored. TODO: make sure driver | ||
1286 | * signals at least once in 2^16 and remove this. */ | ||
1287 | if (unlikely(vq->last_used_idx == vq->signalled_used)) | ||
1288 | vq->signalled_used_valid = false; | ||
1270 | return 0; | 1289 | return 0; |
1271 | } | 1290 | } |
1272 | 1291 | ||
@@ -1275,6 +1294,7 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, | |||
1275 | unsigned count) | 1294 | unsigned count) |
1276 | { | 1295 | { |
1277 | struct vring_used_elem __user *used; | 1296 | struct vring_used_elem __user *used; |
1297 | u16 old, new; | ||
1278 | int start; | 1298 | int start; |
1279 | 1299 | ||
1280 | start = vq->last_used_idx % vq->num; | 1300 | start = vq->last_used_idx % vq->num; |
@@ -1292,7 +1312,14 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, | |||
1292 | ((void __user *)used - (void __user *)vq->used), | 1312 | ((void __user *)used - (void __user *)vq->used), |
1293 | count * sizeof *used); | 1313 | count * sizeof *used); |
1294 | } | 1314 | } |
1295 | vq->last_used_idx += count; | 1315 | old = vq->last_used_idx; |
1316 | new = (vq->last_used_idx += count); | ||
1317 | /* If the driver never bothers to signal in a very long while, | ||
1318 | * used index might wrap around. If that happens, invalidate | ||
1319 | * signalled_used index we stored. TODO: make sure driver | ||
1320 | * signals at least once in 2^16 and remove this. */ | ||
1321 | if (unlikely((u16)(new - vq->signalled_used) < (u16)(new - old))) | ||
1322 | vq->signalled_used_valid = false; | ||
1296 | return 0; | 1323 | return 0; |
1297 | } | 1324 | } |
1298 | 1325 | ||
@@ -1331,29 +1358,47 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, | |||
1331 | return r; | 1358 | return r; |
1332 | } | 1359 | } |
1333 | 1360 | ||
1334 | /* This actually signals the guest, using eventfd. */ | 1361 | static bool vhost_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) |
1335 | void vhost_signal(struct vhost_dev *dev, struct vhost_virtqueue *vq) | ||
1336 | { | 1362 | { |
1337 | __u16 flags; | 1363 | __u16 old, new, event; |
1338 | 1364 | bool v; | |
1339 | /* Flush out used index updates. This is paired | 1365 | /* Flush out used index updates. This is paired |
1340 | * with the barrier that the Guest executes when enabling | 1366 | * with the barrier that the Guest executes when enabling |
1341 | * interrupts. */ | 1367 | * interrupts. */ |
1342 | smp_mb(); | 1368 | smp_mb(); |
1343 | 1369 | ||
1344 | if (__get_user(flags, &vq->avail->flags)) { | 1370 | if (vhost_has_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY) && |
1345 | vq_err(vq, "Failed to get flags"); | 1371 | unlikely(vq->avail_idx == vq->last_avail_idx)) |
1346 | return; | 1372 | return true; |
1373 | |||
1374 | if (!vhost_has_feature(dev, VIRTIO_RING_F_EVENT_IDX)) { | ||
1375 | __u16 flags; | ||
1376 | if (__get_user(flags, &vq->avail->flags)) { | ||
1377 | vq_err(vq, "Failed to get flags"); | ||
1378 | return true; | ||
1379 | } | ||
1380 | return !(flags & VRING_AVAIL_F_NO_INTERRUPT); | ||
1347 | } | 1381 | } |
1382 | old = vq->signalled_used; | ||
1383 | v = vq->signalled_used_valid; | ||
1384 | new = vq->signalled_used = vq->last_used_idx; | ||
1385 | vq->signalled_used_valid = true; | ||
1348 | 1386 | ||
1349 | /* If they don't want an interrupt, don't signal, unless empty. */ | 1387 | if (unlikely(!v)) |
1350 | if ((flags & VRING_AVAIL_F_NO_INTERRUPT) && | 1388 | return true; |
1351 | (vq->avail_idx != vq->last_avail_idx || | ||
1352 | !vhost_has_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY))) | ||
1353 | return; | ||
1354 | 1389 | ||
1390 | if (get_user(event, vhost_used_event(vq))) { | ||
1391 | vq_err(vq, "Failed to get used event idx"); | ||
1392 | return true; | ||
1393 | } | ||
1394 | return vring_need_event(event, new, old); | ||
1395 | } | ||
1396 | |||
1397 | /* This actually signals the guest, using eventfd. */ | ||
1398 | void vhost_signal(struct vhost_dev *dev, struct vhost_virtqueue *vq) | ||
1399 | { | ||
1355 | /* Signal the Guest tell them we used something up. */ | 1400 | /* Signal the Guest tell them we used something up. */ |
1356 | if (vq->call_ctx) | 1401 | if (vq->call_ctx && vhost_notify(dev, vq)) |
1357 | eventfd_signal(vq->call_ctx, 1); | 1402 | eventfd_signal(vq->call_ctx, 1); |
1358 | } | 1403 | } |
1359 | 1404 | ||
@@ -1376,7 +1421,7 @@ void vhost_add_used_and_signal_n(struct vhost_dev *dev, | |||
1376 | } | 1421 | } |
1377 | 1422 | ||
1378 | /* OK, now we need to know about added descriptors. */ | 1423 | /* OK, now we need to know about added descriptors. */ |
1379 | bool vhost_enable_notify(struct vhost_virtqueue *vq) | 1424 | bool vhost_enable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) |
1380 | { | 1425 | { |
1381 | u16 avail_idx; | 1426 | u16 avail_idx; |
1382 | int r; | 1427 | int r; |
@@ -1384,11 +1429,34 @@ bool vhost_enable_notify(struct vhost_virtqueue *vq) | |||
1384 | if (!(vq->used_flags & VRING_USED_F_NO_NOTIFY)) | 1429 | if (!(vq->used_flags & VRING_USED_F_NO_NOTIFY)) |
1385 | return false; | 1430 | return false; |
1386 | vq->used_flags &= ~VRING_USED_F_NO_NOTIFY; | 1431 | vq->used_flags &= ~VRING_USED_F_NO_NOTIFY; |
1387 | r = put_user(vq->used_flags, &vq->used->flags); | 1432 | if (!vhost_has_feature(dev, VIRTIO_RING_F_EVENT_IDX)) { |
1388 | if (r) { | 1433 | r = put_user(vq->used_flags, &vq->used->flags); |
1389 | vq_err(vq, "Failed to enable notification at %p: %d\n", | 1434 | if (r) { |
1390 | &vq->used->flags, r); | 1435 | vq_err(vq, "Failed to enable notification at %p: %d\n", |
1391 | return false; | 1436 | &vq->used->flags, r); |
1437 | return false; | ||
1438 | } | ||
1439 | } else { | ||
1440 | r = put_user(vq->avail_idx, vhost_avail_event(vq)); | ||
1441 | if (r) { | ||
1442 | vq_err(vq, "Failed to update avail event index at %p: %d\n", | ||
1443 | vhost_avail_event(vq), r); | ||
1444 | return false; | ||
1445 | } | ||
1446 | } | ||
1447 | if (unlikely(vq->log_used)) { | ||
1448 | void __user *used; | ||
1449 | /* Make sure data is seen before log. */ | ||
1450 | smp_wmb(); | ||
1451 | used = vhost_has_feature(dev, VIRTIO_RING_F_EVENT_IDX) ? | ||
1452 | &vq->used->flags : vhost_avail_event(vq); | ||
1453 | /* Log used flags or event index entry write. Both are 16 bit | ||
1454 | * fields. */ | ||
1455 | log_write(vq->log_base, vq->log_addr + | ||
1456 | (used - (void __user *)vq->used), | ||
1457 | sizeof(u16)); | ||
1458 | if (vq->log_ctx) | ||
1459 | eventfd_signal(vq->log_ctx, 1); | ||
1392 | } | 1460 | } |
1393 | /* They could have slipped one in as we were doing that: make | 1461 | /* They could have slipped one in as we were doing that: make |
1394 | * sure it's written, then check again. */ | 1462 | * sure it's written, then check again. */ |
@@ -1404,15 +1472,17 @@ bool vhost_enable_notify(struct vhost_virtqueue *vq) | |||
1404 | } | 1472 | } |
1405 | 1473 | ||
1406 | /* We don't need to be notified again. */ | 1474 | /* We don't need to be notified again. */ |
1407 | void vhost_disable_notify(struct vhost_virtqueue *vq) | 1475 | void vhost_disable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) |
1408 | { | 1476 | { |
1409 | int r; | 1477 | int r; |
1410 | 1478 | ||
1411 | if (vq->used_flags & VRING_USED_F_NO_NOTIFY) | 1479 | if (vq->used_flags & VRING_USED_F_NO_NOTIFY) |
1412 | return; | 1480 | return; |
1413 | vq->used_flags |= VRING_USED_F_NO_NOTIFY; | 1481 | vq->used_flags |= VRING_USED_F_NO_NOTIFY; |
1414 | r = put_user(vq->used_flags, &vq->used->flags); | 1482 | if (!vhost_has_feature(dev, VIRTIO_RING_F_EVENT_IDX)) { |
1415 | if (r) | 1483 | r = put_user(vq->used_flags, &vq->used->flags); |
1416 | vq_err(vq, "Failed to enable notification at %p: %d\n", | 1484 | if (r) |
1417 | &vq->used->flags, r); | 1485 | vq_err(vq, "Failed to enable notification at %p: %d\n", |
1486 | &vq->used->flags, r); | ||
1487 | } | ||
1418 | } | 1488 | } |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index b3363ae38518..8e03379dd30f 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -84,6 +84,12 @@ struct vhost_virtqueue { | |||
84 | /* Used flags */ | 84 | /* Used flags */ |
85 | u16 used_flags; | 85 | u16 used_flags; |
86 | 86 | ||
87 | /* Last used index value we have signalled on */ | ||
88 | u16 signalled_used; | ||
89 | |||
90 | /* Last used index value we have signalled on */ | ||
91 | bool signalled_used_valid; | ||
92 | |||
87 | /* Log writes to used structure. */ | 93 | /* Log writes to used structure. */ |
88 | bool log_used; | 94 | bool log_used; |
89 | u64 log_addr; | 95 | u64 log_addr; |
@@ -149,8 +155,8 @@ void vhost_add_used_and_signal(struct vhost_dev *, struct vhost_virtqueue *, | |||
149 | void vhost_add_used_and_signal_n(struct vhost_dev *, struct vhost_virtqueue *, | 155 | void vhost_add_used_and_signal_n(struct vhost_dev *, struct vhost_virtqueue *, |
150 | struct vring_used_elem *heads, unsigned count); | 156 | struct vring_used_elem *heads, unsigned count); |
151 | void vhost_signal(struct vhost_dev *, struct vhost_virtqueue *); | 157 | void vhost_signal(struct vhost_dev *, struct vhost_virtqueue *); |
152 | void vhost_disable_notify(struct vhost_virtqueue *); | 158 | void vhost_disable_notify(struct vhost_dev *, struct vhost_virtqueue *); |
153 | bool vhost_enable_notify(struct vhost_virtqueue *); | 159 | bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); |
154 | 160 | ||
155 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, | 161 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
156 | unsigned int log_num, u64 len); | 162 | unsigned int log_num, u64 len); |
@@ -162,11 +168,12 @@ int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, | |||
162 | } while (0) | 168 | } while (0) |
163 | 169 | ||
164 | enum { | 170 | enum { |
165 | VHOST_FEATURES = (1 << VIRTIO_F_NOTIFY_ON_EMPTY) | | 171 | VHOST_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | |
166 | (1 << VIRTIO_RING_F_INDIRECT_DESC) | | 172 | (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | |
167 | (1 << VHOST_F_LOG_ALL) | | 173 | (1ULL << VIRTIO_RING_F_EVENT_IDX) | |
168 | (1 << VHOST_NET_F_VIRTIO_NET_HDR) | | 174 | (1ULL << VHOST_F_LOG_ALL) | |
169 | (1 << VIRTIO_NET_F_MRG_RXBUF), | 175 | (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | |
176 | (1ULL << VIRTIO_NET_F_MRG_RXBUF), | ||
170 | }; | 177 | }; |
171 | 178 | ||
172 | static inline int vhost_has_feature(struct vhost_dev *dev, int bit) | 179 | static inline int vhost_has_feature(struct vhost_dev *dev, int bit) |
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index 3ec4923c2d84..c22e8d39a2cb 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
@@ -515,11 +515,10 @@ static int __devinit arcfb_probe(struct platform_device *dev) | |||
515 | 515 | ||
516 | /* We need a flat backing store for the Arc's | 516 | /* We need a flat backing store for the Arc's |
517 | less-flat actual paged framebuffer */ | 517 | less-flat actual paged framebuffer */ |
518 | if (!(videomemory = vmalloc(videomemorysize))) | 518 | videomemory = vzalloc(videomemorysize); |
519 | if (!videomemory) | ||
519 | return retval; | 520 | return retval; |
520 | 521 | ||
521 | memset(videomemory, 0, videomemorysize); | ||
522 | |||
523 | info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev); | 522 | info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev); |
524 | if (!info) | 523 | if (!info) |
525 | goto err; | 524 | goto err; |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index ebb893c49e90..d7aaec5667bf 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -248,10 +248,6 @@ static int atyfb_sync(struct fb_info *info); | |||
248 | 248 | ||
249 | static int aty_init(struct fb_info *info); | 249 | static int aty_init(struct fb_info *info); |
250 | 250 | ||
251 | #ifdef CONFIG_ATARI | ||
252 | static int store_video_par(char *videopar, unsigned char m64_num); | ||
253 | #endif | ||
254 | |||
255 | static void aty_get_crtc(const struct atyfb_par *par, struct crtc *crtc); | 251 | static void aty_get_crtc(const struct atyfb_par *par, struct crtc *crtc); |
256 | 252 | ||
257 | static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc); | 253 | static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc); |
@@ -2268,11 +2264,13 @@ error: | |||
2268 | return; | 2264 | return; |
2269 | } | 2265 | } |
2270 | 2266 | ||
2267 | #ifdef CONFIG_PCI | ||
2271 | static void aty_bl_exit(struct backlight_device *bd) | 2268 | static void aty_bl_exit(struct backlight_device *bd) |
2272 | { | 2269 | { |
2273 | backlight_device_unregister(bd); | 2270 | backlight_device_unregister(bd); |
2274 | printk("aty: Backlight unloaded\n"); | 2271 | printk("aty: Backlight unloaded\n"); |
2275 | } | 2272 | } |
2273 | #endif /* CONFIG_PCI */ | ||
2276 | 2274 | ||
2277 | #endif /* CONFIG_FB_ATY_BACKLIGHT */ | 2275 | #endif /* CONFIG_FB_ATY_BACKLIGHT */ |
2278 | 2276 | ||
@@ -2789,7 +2787,7 @@ aty_init_exit: | |||
2789 | return ret; | 2787 | return ret; |
2790 | } | 2788 | } |
2791 | 2789 | ||
2792 | #ifdef CONFIG_ATARI | 2790 | #if defined(CONFIG_ATARI) && !defined(MODULE) |
2793 | static int __devinit store_video_par(char *video_str, unsigned char m64_num) | 2791 | static int __devinit store_video_par(char *video_str, unsigned char m64_num) |
2794 | { | 2792 | { |
2795 | char *p; | 2793 | char *p; |
@@ -2818,7 +2816,7 @@ static int __devinit store_video_par(char *video_str, unsigned char m64_num) | |||
2818 | phys_vmembase[m64_num] = 0; | 2816 | phys_vmembase[m64_num] = 0; |
2819 | return -1; | 2817 | return -1; |
2820 | } | 2818 | } |
2821 | #endif /* CONFIG_ATARI */ | 2819 | #endif /* CONFIG_ATARI && !MODULE */ |
2822 | 2820 | ||
2823 | /* | 2821 | /* |
2824 | * Blank the display. | 2822 | * Blank the display. |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 0c9373bedd1f..2d93c8d61ad5 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -302,6 +302,18 @@ config BACKLIGHT_ADP8860 | |||
302 | To compile this driver as a module, choose M here: the module will | 302 | To compile this driver as a module, choose M here: the module will |
303 | be called adp8860_bl. | 303 | be called adp8860_bl. |
304 | 304 | ||
305 | config BACKLIGHT_ADP8870 | ||
306 | tristate "Backlight Driver for ADP8870 using WLED" | ||
307 | depends on BACKLIGHT_CLASS_DEVICE && I2C | ||
308 | select NEW_LEDS | ||
309 | select LEDS_CLASS | ||
310 | help | ||
311 | If you have a LCD backlight connected to the ADP8870, | ||
312 | say Y here to enable this driver. | ||
313 | |||
314 | To compile this driver as a module, choose M here: the module will | ||
315 | be called adp8870_bl. | ||
316 | |||
305 | config BACKLIGHT_88PM860X | 317 | config BACKLIGHT_88PM860X |
306 | tristate "Backlight Driver for 88PM8606 using WLED" | 318 | tristate "Backlight Driver for 88PM8606 using WLED" |
307 | depends on MFD_88PM860X | 319 | depends on MFD_88PM860X |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index b9ca8490df87..ee72adb8786e 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -34,6 +34,7 @@ obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o | |||
34 | obj-$(CONFIG_BACKLIGHT_ADX) += adx_bl.o | 34 | obj-$(CONFIG_BACKLIGHT_ADX) += adx_bl.o |
35 | obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o | 35 | obj-$(CONFIG_BACKLIGHT_ADP5520) += adp5520_bl.o |
36 | obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o | 36 | obj-$(CONFIG_BACKLIGHT_ADP8860) += adp8860_bl.o |
37 | obj-$(CONFIG_BACKLIGHT_ADP8870) += adp8870_bl.o | ||
37 | obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o | 38 | obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o |
38 | obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o | 39 | obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o |
39 | 40 | ||
diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c new file mode 100644 index 000000000000..05a8832bb3eb --- /dev/null +++ b/drivers/video/backlight/adp8870_bl.c | |||
@@ -0,0 +1,1012 @@ | |||
1 | /* | ||
2 | * Backlight driver for Analog Devices ADP8870 Backlight Devices | ||
3 | * | ||
4 | * Copyright 2009-2011 Analog Devices Inc. | ||
5 | * | ||
6 | * Licensed under the GPL-2 or later. | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/version.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/pm.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/i2c.h> | ||
16 | #include <linux/fb.h> | ||
17 | #include <linux/backlight.h> | ||
18 | #include <linux/leds.h> | ||
19 | #include <linux/workqueue.h> | ||
20 | #include <linux/slab.h> | ||
21 | |||
22 | #include <linux/i2c/adp8870.h> | ||
23 | #define ADP8870_EXT_FEATURES | ||
24 | #define ADP8870_USE_LEDS | ||
25 | |||
26 | |||
27 | #define ADP8870_MFDVID 0x00 /* Manufacturer and device ID */ | ||
28 | #define ADP8870_MDCR 0x01 /* Device mode and status */ | ||
29 | #define ADP8870_INT_STAT 0x02 /* Interrupts status */ | ||
30 | #define ADP8870_INT_EN 0x03 /* Interrupts enable */ | ||
31 | #define ADP8870_CFGR 0x04 /* Configuration register */ | ||
32 | #define ADP8870_BLSEL 0x05 /* Sink enable backlight or independent */ | ||
33 | #define ADP8870_PWMLED 0x06 /* PWM Enable Selection Register */ | ||
34 | #define ADP8870_BLOFF 0x07 /* Backlight off timeout */ | ||
35 | #define ADP8870_BLDIM 0x08 /* Backlight dim timeout */ | ||
36 | #define ADP8870_BLFR 0x09 /* Backlight fade in and out rates */ | ||
37 | #define ADP8870_BLMX1 0x0A /* Backlight (Brightness Level 1-daylight) maximum current */ | ||
38 | #define ADP8870_BLDM1 0x0B /* Backlight (Brightness Level 1-daylight) dim current */ | ||
39 | #define ADP8870_BLMX2 0x0C /* Backlight (Brightness Level 2-bright) maximum current */ | ||
40 | #define ADP8870_BLDM2 0x0D /* Backlight (Brightness Level 2-bright) dim current */ | ||
41 | #define ADP8870_BLMX3 0x0E /* Backlight (Brightness Level 3-office) maximum current */ | ||
42 | #define ADP8870_BLDM3 0x0F /* Backlight (Brightness Level 3-office) dim current */ | ||
43 | #define ADP8870_BLMX4 0x10 /* Backlight (Brightness Level 4-indoor) maximum current */ | ||
44 | #define ADP8870_BLDM4 0x11 /* Backlight (Brightness Level 4-indoor) dim current */ | ||
45 | #define ADP8870_BLMX5 0x12 /* Backlight (Brightness Level 5-dark) maximum current */ | ||
46 | #define ADP8870_BLDM5 0x13 /* Backlight (Brightness Level 5-dark) dim current */ | ||
47 | #define ADP8870_ISCLAW 0x1A /* Independent sink current fade law register */ | ||
48 | #define ADP8870_ISCC 0x1B /* Independent sink current control register */ | ||
49 | #define ADP8870_ISCT1 0x1C /* Independent Sink Current Timer Register LED[7:5] */ | ||
50 | #define ADP8870_ISCT2 0x1D /* Independent Sink Current Timer Register LED[4:1] */ | ||
51 | #define ADP8870_ISCF 0x1E /* Independent sink current fade register */ | ||
52 | #define ADP8870_ISC1 0x1F /* Independent Sink Current LED1 */ | ||
53 | #define ADP8870_ISC2 0x20 /* Independent Sink Current LED2 */ | ||
54 | #define ADP8870_ISC3 0x21 /* Independent Sink Current LED3 */ | ||
55 | #define ADP8870_ISC4 0x22 /* Independent Sink Current LED4 */ | ||
56 | #define ADP8870_ISC5 0x23 /* Independent Sink Current LED5 */ | ||
57 | #define ADP8870_ISC6 0x24 /* Independent Sink Current LED6 */ | ||
58 | #define ADP8870_ISC7 0x25 /* Independent Sink Current LED7 (Brightness Level 1-daylight) */ | ||
59 | #define ADP8870_ISC7_L2 0x26 /* Independent Sink Current LED7 (Brightness Level 2-bright) */ | ||
60 | #define ADP8870_ISC7_L3 0x27 /* Independent Sink Current LED7 (Brightness Level 3-office) */ | ||
61 | #define ADP8870_ISC7_L4 0x28 /* Independent Sink Current LED7 (Brightness Level 4-indoor) */ | ||
62 | #define ADP8870_ISC7_L5 0x29 /* Independent Sink Current LED7 (Brightness Level 5-dark) */ | ||
63 | #define ADP8870_CMP_CTL 0x2D /* ALS Comparator Control Register */ | ||
64 | #define ADP8870_ALS1_EN 0x2E /* Main ALS comparator level enable */ | ||
65 | #define ADP8870_ALS2_EN 0x2F /* Second ALS comparator level enable */ | ||
66 | #define ADP8870_ALS1_STAT 0x30 /* Main ALS Comparator Status Register */ | ||
67 | #define ADP8870_ALS2_STAT 0x31 /* Second ALS Comparator Status Register */ | ||
68 | #define ADP8870_L2TRP 0x32 /* L2 comparator reference */ | ||
69 | #define ADP8870_L2HYS 0x33 /* L2 hysteresis */ | ||
70 | #define ADP8870_L3TRP 0x34 /* L3 comparator reference */ | ||
71 | #define ADP8870_L3HYS 0x35 /* L3 hysteresis */ | ||
72 | #define ADP8870_L4TRP 0x36 /* L4 comparator reference */ | ||
73 | #define ADP8870_L4HYS 0x37 /* L4 hysteresis */ | ||
74 | #define ADP8870_L5TRP 0x38 /* L5 comparator reference */ | ||
75 | #define ADP8870_L5HYS 0x39 /* L5 hysteresis */ | ||
76 | #define ADP8870_PH1LEVL 0x40 /* First phototransistor ambient light level-low byte register */ | ||
77 | #define ADP8870_PH1LEVH 0x41 /* First phototransistor ambient light level-high byte register */ | ||
78 | #define ADP8870_PH2LEVL 0x42 /* Second phototransistor ambient light level-low byte register */ | ||
79 | #define ADP8870_PH2LEVH 0x43 /* Second phototransistor ambient light level-high byte register */ | ||
80 | |||
81 | #define ADP8870_MANUFID 0x3 /* Analog Devices AD8870 Manufacturer and device ID */ | ||
82 | #define ADP8870_DEVID(x) ((x) & 0xF) | ||
83 | #define ADP8870_MANID(x) ((x) >> 4) | ||
84 | |||
85 | /* MDCR Device mode and status */ | ||
86 | #define D7ALSEN (1 << 7) | ||
87 | #define INT_CFG (1 << 6) | ||
88 | #define NSTBY (1 << 5) | ||
89 | #define DIM_EN (1 << 4) | ||
90 | #define GDWN_DIS (1 << 3) | ||
91 | #define SIS_EN (1 << 2) | ||
92 | #define CMP_AUTOEN (1 << 1) | ||
93 | #define BLEN (1 << 0) | ||
94 | |||
95 | /* ADP8870_ALS1_EN Main ALS comparator level enable */ | ||
96 | #define L5_EN (1 << 3) | ||
97 | #define L4_EN (1 << 2) | ||
98 | #define L3_EN (1 << 1) | ||
99 | #define L2_EN (1 << 0) | ||
100 | |||
101 | #define CFGR_BLV_SHIFT 3 | ||
102 | #define CFGR_BLV_MASK 0x7 | ||
103 | #define ADP8870_FLAG_LED_MASK 0xFF | ||
104 | |||
105 | #define FADE_VAL(in, out) ((0xF & (in)) | ((0xF & (out)) << 4)) | ||
106 | #define BL_CFGR_VAL(law, blv) ((((blv) & CFGR_BLV_MASK) << CFGR_BLV_SHIFT) | ((0x3 & (law)) << 1)) | ||
107 | #define ALS_CMPR_CFG_VAL(filt) ((0x7 & (filt)) << 1) | ||
108 | |||
109 | struct adp8870_bl { | ||
110 | struct i2c_client *client; | ||
111 | struct backlight_device *bl; | ||
112 | struct adp8870_led *led; | ||
113 | struct adp8870_backlight_platform_data *pdata; | ||
114 | struct mutex lock; | ||
115 | unsigned long cached_daylight_max; | ||
116 | int id; | ||
117 | int revid; | ||
118 | int current_brightness; | ||
119 | }; | ||
120 | |||
121 | struct adp8870_led { | ||
122 | struct led_classdev cdev; | ||
123 | struct work_struct work; | ||
124 | struct i2c_client *client; | ||
125 | enum led_brightness new_brightness; | ||
126 | int id; | ||
127 | int flags; | ||
128 | }; | ||
129 | |||
130 | static int adp8870_read(struct i2c_client *client, int reg, uint8_t *val) | ||
131 | { | ||
132 | int ret; | ||
133 | |||
134 | ret = i2c_smbus_read_byte_data(client, reg); | ||
135 | if (ret < 0) { | ||
136 | dev_err(&client->dev, "failed reading at 0x%02x\n", reg); | ||
137 | return ret; | ||
138 | } | ||
139 | |||
140 | *val = ret; | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | |||
145 | static int adp8870_write(struct i2c_client *client, u8 reg, u8 val) | ||
146 | { | ||
147 | int ret = i2c_smbus_write_byte_data(client, reg, val); | ||
148 | if (ret) | ||
149 | dev_err(&client->dev, "failed to write\n"); | ||
150 | |||
151 | return ret; | ||
152 | } | ||
153 | |||
154 | static int adp8870_set_bits(struct i2c_client *client, int reg, uint8_t bit_mask) | ||
155 | { | ||
156 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
157 | uint8_t reg_val; | ||
158 | int ret; | ||
159 | |||
160 | mutex_lock(&data->lock); | ||
161 | |||
162 | ret = adp8870_read(client, reg, ®_val); | ||
163 | |||
164 | if (!ret && ((reg_val & bit_mask) == 0)) { | ||
165 | reg_val |= bit_mask; | ||
166 | ret = adp8870_write(client, reg, reg_val); | ||
167 | } | ||
168 | |||
169 | mutex_unlock(&data->lock); | ||
170 | return ret; | ||
171 | } | ||
172 | |||
173 | static int adp8870_clr_bits(struct i2c_client *client, int reg, uint8_t bit_mask) | ||
174 | { | ||
175 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
176 | uint8_t reg_val; | ||
177 | int ret; | ||
178 | |||
179 | mutex_lock(&data->lock); | ||
180 | |||
181 | ret = adp8870_read(client, reg, ®_val); | ||
182 | |||
183 | if (!ret && (reg_val & bit_mask)) { | ||
184 | reg_val &= ~bit_mask; | ||
185 | ret = adp8870_write(client, reg, reg_val); | ||
186 | } | ||
187 | |||
188 | mutex_unlock(&data->lock); | ||
189 | return ret; | ||
190 | } | ||
191 | |||
192 | /* | ||
193 | * Independent sink / LED | ||
194 | */ | ||
195 | #if defined(ADP8870_USE_LEDS) | ||
196 | static void adp8870_led_work(struct work_struct *work) | ||
197 | { | ||
198 | struct adp8870_led *led = container_of(work, struct adp8870_led, work); | ||
199 | adp8870_write(led->client, ADP8870_ISC1 + led->id - 1, | ||
200 | led->new_brightness >> 1); | ||
201 | } | ||
202 | |||
203 | static void adp8870_led_set(struct led_classdev *led_cdev, | ||
204 | enum led_brightness value) | ||
205 | { | ||
206 | struct adp8870_led *led; | ||
207 | |||
208 | led = container_of(led_cdev, struct adp8870_led, cdev); | ||
209 | led->new_brightness = value; | ||
210 | /* | ||
211 | * Use workqueue for IO since I2C operations can sleep. | ||
212 | */ | ||
213 | schedule_work(&led->work); | ||
214 | } | ||
215 | |||
216 | static int adp8870_led_setup(struct adp8870_led *led) | ||
217 | { | ||
218 | struct i2c_client *client = led->client; | ||
219 | int ret = 0; | ||
220 | |||
221 | ret = adp8870_write(client, ADP8870_ISC1 + led->id - 1, 0); | ||
222 | if (ret) | ||
223 | return ret; | ||
224 | |||
225 | ret = adp8870_set_bits(client, ADP8870_ISCC, 1 << (led->id - 1)); | ||
226 | if (ret) | ||
227 | return ret; | ||
228 | |||
229 | if (led->id > 4) | ||
230 | ret = adp8870_set_bits(client, ADP8870_ISCT1, | ||
231 | (led->flags & 0x3) << ((led->id - 5) * 2)); | ||
232 | else | ||
233 | ret = adp8870_set_bits(client, ADP8870_ISCT2, | ||
234 | (led->flags & 0x3) << ((led->id - 1) * 2)); | ||
235 | |||
236 | return ret; | ||
237 | } | ||
238 | |||
239 | static int __devinit adp8870_led_probe(struct i2c_client *client) | ||
240 | { | ||
241 | struct adp8870_backlight_platform_data *pdata = | ||
242 | client->dev.platform_data; | ||
243 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
244 | struct adp8870_led *led, *led_dat; | ||
245 | struct led_info *cur_led; | ||
246 | int ret, i; | ||
247 | |||
248 | |||
249 | led = kcalloc(pdata->num_leds, sizeof(*led), GFP_KERNEL); | ||
250 | if (led == NULL) { | ||
251 | dev_err(&client->dev, "failed to alloc memory\n"); | ||
252 | return -ENOMEM; | ||
253 | } | ||
254 | |||
255 | ret = adp8870_write(client, ADP8870_ISCLAW, pdata->led_fade_law); | ||
256 | if (ret) | ||
257 | goto err_free; | ||
258 | |||
259 | ret = adp8870_write(client, ADP8870_ISCT1, | ||
260 | (pdata->led_on_time & 0x3) << 6); | ||
261 | if (ret) | ||
262 | goto err_free; | ||
263 | |||
264 | ret = adp8870_write(client, ADP8870_ISCF, | ||
265 | FADE_VAL(pdata->led_fade_in, pdata->led_fade_out)); | ||
266 | if (ret) | ||
267 | goto err_free; | ||
268 | |||
269 | for (i = 0; i < pdata->num_leds; ++i) { | ||
270 | cur_led = &pdata->leds[i]; | ||
271 | led_dat = &led[i]; | ||
272 | |||
273 | led_dat->id = cur_led->flags & ADP8870_FLAG_LED_MASK; | ||
274 | |||
275 | if (led_dat->id > 7 || led_dat->id < 1) { | ||
276 | dev_err(&client->dev, "Invalid LED ID %d\n", | ||
277 | led_dat->id); | ||
278 | goto err; | ||
279 | } | ||
280 | |||
281 | if (pdata->bl_led_assign & (1 << (led_dat->id - 1))) { | ||
282 | dev_err(&client->dev, "LED %d used by Backlight\n", | ||
283 | led_dat->id); | ||
284 | goto err; | ||
285 | } | ||
286 | |||
287 | led_dat->cdev.name = cur_led->name; | ||
288 | led_dat->cdev.default_trigger = cur_led->default_trigger; | ||
289 | led_dat->cdev.brightness_set = adp8870_led_set; | ||
290 | led_dat->cdev.brightness = LED_OFF; | ||
291 | led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT; | ||
292 | led_dat->client = client; | ||
293 | led_dat->new_brightness = LED_OFF; | ||
294 | INIT_WORK(&led_dat->work, adp8870_led_work); | ||
295 | |||
296 | ret = led_classdev_register(&client->dev, &led_dat->cdev); | ||
297 | if (ret) { | ||
298 | dev_err(&client->dev, "failed to register LED %d\n", | ||
299 | led_dat->id); | ||
300 | goto err; | ||
301 | } | ||
302 | |||
303 | ret = adp8870_led_setup(led_dat); | ||
304 | if (ret) { | ||
305 | dev_err(&client->dev, "failed to write\n"); | ||
306 | i++; | ||
307 | goto err; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | data->led = led; | ||
312 | |||
313 | return 0; | ||
314 | |||
315 | err: | ||
316 | for (i = i - 1; i >= 0; --i) { | ||
317 | led_classdev_unregister(&led[i].cdev); | ||
318 | cancel_work_sync(&led[i].work); | ||
319 | } | ||
320 | |||
321 | err_free: | ||
322 | kfree(led); | ||
323 | |||
324 | return ret; | ||
325 | } | ||
326 | |||
327 | static int __devexit adp8870_led_remove(struct i2c_client *client) | ||
328 | { | ||
329 | struct adp8870_backlight_platform_data *pdata = | ||
330 | client->dev.platform_data; | ||
331 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
332 | int i; | ||
333 | |||
334 | for (i = 0; i < pdata->num_leds; i++) { | ||
335 | led_classdev_unregister(&data->led[i].cdev); | ||
336 | cancel_work_sync(&data->led[i].work); | ||
337 | } | ||
338 | |||
339 | kfree(data->led); | ||
340 | return 0; | ||
341 | } | ||
342 | #else | ||
343 | static int __devinit adp8870_led_probe(struct i2c_client *client) | ||
344 | { | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | static int __devexit adp8870_led_remove(struct i2c_client *client) | ||
349 | { | ||
350 | return 0; | ||
351 | } | ||
352 | #endif | ||
353 | |||
354 | static int adp8870_bl_set(struct backlight_device *bl, int brightness) | ||
355 | { | ||
356 | struct adp8870_bl *data = bl_get_data(bl); | ||
357 | struct i2c_client *client = data->client; | ||
358 | int ret = 0; | ||
359 | |||
360 | if (data->pdata->en_ambl_sens) { | ||
361 | if ((brightness > 0) && (brightness < ADP8870_MAX_BRIGHTNESS)) { | ||
362 | /* Disable Ambient Light auto adjust */ | ||
363 | ret = adp8870_clr_bits(client, ADP8870_MDCR, | ||
364 | CMP_AUTOEN); | ||
365 | if (ret) | ||
366 | return ret; | ||
367 | ret = adp8870_write(client, ADP8870_BLMX1, brightness); | ||
368 | if (ret) | ||
369 | return ret; | ||
370 | } else { | ||
371 | /* | ||
372 | * MAX_BRIGHTNESS -> Enable Ambient Light auto adjust | ||
373 | * restore daylight l1 sysfs brightness | ||
374 | */ | ||
375 | ret = adp8870_write(client, ADP8870_BLMX1, | ||
376 | data->cached_daylight_max); | ||
377 | if (ret) | ||
378 | return ret; | ||
379 | |||
380 | ret = adp8870_set_bits(client, ADP8870_MDCR, | ||
381 | CMP_AUTOEN); | ||
382 | if (ret) | ||
383 | return ret; | ||
384 | } | ||
385 | } else { | ||
386 | ret = adp8870_write(client, ADP8870_BLMX1, brightness); | ||
387 | if (ret) | ||
388 | return ret; | ||
389 | } | ||
390 | |||
391 | if (data->current_brightness && brightness == 0) | ||
392 | ret = adp8870_set_bits(client, | ||
393 | ADP8870_MDCR, DIM_EN); | ||
394 | else if (data->current_brightness == 0 && brightness) | ||
395 | ret = adp8870_clr_bits(client, | ||
396 | ADP8870_MDCR, DIM_EN); | ||
397 | |||
398 | if (!ret) | ||
399 | data->current_brightness = brightness; | ||
400 | |||
401 | return ret; | ||
402 | } | ||
403 | |||
404 | static int adp8870_bl_update_status(struct backlight_device *bl) | ||
405 | { | ||
406 | int brightness = bl->props.brightness; | ||
407 | if (bl->props.power != FB_BLANK_UNBLANK) | ||
408 | brightness = 0; | ||
409 | |||
410 | if (bl->props.fb_blank != FB_BLANK_UNBLANK) | ||
411 | brightness = 0; | ||
412 | |||
413 | return adp8870_bl_set(bl, brightness); | ||
414 | } | ||
415 | |||
416 | static int adp8870_bl_get_brightness(struct backlight_device *bl) | ||
417 | { | ||
418 | struct adp8870_bl *data = bl_get_data(bl); | ||
419 | |||
420 | return data->current_brightness; | ||
421 | } | ||
422 | |||
423 | static const struct backlight_ops adp8870_bl_ops = { | ||
424 | .update_status = adp8870_bl_update_status, | ||
425 | .get_brightness = adp8870_bl_get_brightness, | ||
426 | }; | ||
427 | |||
428 | static int adp8870_bl_setup(struct backlight_device *bl) | ||
429 | { | ||
430 | struct adp8870_bl *data = bl_get_data(bl); | ||
431 | struct i2c_client *client = data->client; | ||
432 | struct adp8870_backlight_platform_data *pdata = data->pdata; | ||
433 | int ret = 0; | ||
434 | |||
435 | ret = adp8870_write(client, ADP8870_BLSEL, ~pdata->bl_led_assign); | ||
436 | if (ret) | ||
437 | return ret; | ||
438 | |||
439 | ret = adp8870_write(client, ADP8870_PWMLED, pdata->pwm_assign); | ||
440 | if (ret) | ||
441 | return ret; | ||
442 | |||
443 | ret = adp8870_write(client, ADP8870_BLMX1, pdata->l1_daylight_max); | ||
444 | if (ret) | ||
445 | return ret; | ||
446 | |||
447 | ret = adp8870_write(client, ADP8870_BLDM1, pdata->l1_daylight_dim); | ||
448 | if (ret) | ||
449 | return ret; | ||
450 | |||
451 | if (pdata->en_ambl_sens) { | ||
452 | data->cached_daylight_max = pdata->l1_daylight_max; | ||
453 | ret = adp8870_write(client, ADP8870_BLMX2, | ||
454 | pdata->l2_bright_max); | ||
455 | if (ret) | ||
456 | return ret; | ||
457 | ret = adp8870_write(client, ADP8870_BLDM2, | ||
458 | pdata->l2_bright_dim); | ||
459 | if (ret) | ||
460 | return ret; | ||
461 | |||
462 | ret = adp8870_write(client, ADP8870_BLMX3, | ||
463 | pdata->l3_office_max); | ||
464 | if (ret) | ||
465 | return ret; | ||
466 | ret = adp8870_write(client, ADP8870_BLDM3, | ||
467 | pdata->l3_office_dim); | ||
468 | if (ret) | ||
469 | return ret; | ||
470 | |||
471 | ret = adp8870_write(client, ADP8870_BLMX4, | ||
472 | pdata->l4_indoor_max); | ||
473 | if (ret) | ||
474 | return ret; | ||
475 | |||
476 | ret = adp8870_write(client, ADP8870_BLDM4, | ||
477 | pdata->l4_indor_dim); | ||
478 | if (ret) | ||
479 | return ret; | ||
480 | |||
481 | ret = adp8870_write(client, ADP8870_BLMX5, | ||
482 | pdata->l5_dark_max); | ||
483 | if (ret) | ||
484 | return ret; | ||
485 | |||
486 | ret = adp8870_write(client, ADP8870_BLDM5, | ||
487 | pdata->l5_dark_dim); | ||
488 | if (ret) | ||
489 | return ret; | ||
490 | |||
491 | ret = adp8870_write(client, ADP8870_L2TRP, pdata->l2_trip); | ||
492 | if (ret) | ||
493 | return ret; | ||
494 | |||
495 | ret = adp8870_write(client, ADP8870_L2HYS, pdata->l2_hyst); | ||
496 | if (ret) | ||
497 | return ret; | ||
498 | |||
499 | ret = adp8870_write(client, ADP8870_L3TRP, pdata->l3_trip); | ||
500 | if (ret) | ||
501 | return ret; | ||
502 | |||
503 | ret = adp8870_write(client, ADP8870_L3HYS, pdata->l3_hyst); | ||
504 | if (ret) | ||
505 | return ret; | ||
506 | |||
507 | ret = adp8870_write(client, ADP8870_L4TRP, pdata->l4_trip); | ||
508 | if (ret) | ||
509 | return ret; | ||
510 | |||
511 | ret = adp8870_write(client, ADP8870_L4HYS, pdata->l4_hyst); | ||
512 | if (ret) | ||
513 | return ret; | ||
514 | |||
515 | ret = adp8870_write(client, ADP8870_L5TRP, pdata->l5_trip); | ||
516 | if (ret) | ||
517 | return ret; | ||
518 | |||
519 | ret = adp8870_write(client, ADP8870_L5HYS, pdata->l5_hyst); | ||
520 | if (ret) | ||
521 | return ret; | ||
522 | |||
523 | ret = adp8870_write(client, ADP8870_ALS1_EN, L5_EN | L4_EN | | ||
524 | L3_EN | L2_EN); | ||
525 | if (ret) | ||
526 | return ret; | ||
527 | |||
528 | ret = adp8870_write(client, ADP8870_CMP_CTL, | ||
529 | ALS_CMPR_CFG_VAL(pdata->abml_filt)); | ||
530 | if (ret) | ||
531 | return ret; | ||
532 | } | ||
533 | |||
534 | ret = adp8870_write(client, ADP8870_CFGR, | ||
535 | BL_CFGR_VAL(pdata->bl_fade_law, 0)); | ||
536 | if (ret) | ||
537 | return ret; | ||
538 | |||
539 | ret = adp8870_write(client, ADP8870_BLFR, FADE_VAL(pdata->bl_fade_in, | ||
540 | pdata->bl_fade_out)); | ||
541 | if (ret) | ||
542 | return ret; | ||
543 | /* | ||
544 | * ADP8870 Rev0 requires GDWN_DIS bit set | ||
545 | */ | ||
546 | |||
547 | ret = adp8870_set_bits(client, ADP8870_MDCR, BLEN | DIM_EN | NSTBY | | ||
548 | (data->revid == 0 ? GDWN_DIS : 0)); | ||
549 | |||
550 | return ret; | ||
551 | } | ||
552 | |||
553 | static ssize_t adp8870_show(struct device *dev, char *buf, int reg) | ||
554 | { | ||
555 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
556 | int error; | ||
557 | uint8_t reg_val; | ||
558 | |||
559 | mutex_lock(&data->lock); | ||
560 | error = adp8870_read(data->client, reg, ®_val); | ||
561 | mutex_unlock(&data->lock); | ||
562 | |||
563 | if (error < 0) | ||
564 | return error; | ||
565 | |||
566 | return sprintf(buf, "%u\n", reg_val); | ||
567 | } | ||
568 | |||
569 | static ssize_t adp8870_store(struct device *dev, const char *buf, | ||
570 | size_t count, int reg) | ||
571 | { | ||
572 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
573 | unsigned long val; | ||
574 | int ret; | ||
575 | |||
576 | ret = strict_strtoul(buf, 10, &val); | ||
577 | if (ret) | ||
578 | return ret; | ||
579 | |||
580 | mutex_lock(&data->lock); | ||
581 | adp8870_write(data->client, reg, val); | ||
582 | mutex_unlock(&data->lock); | ||
583 | |||
584 | return count; | ||
585 | } | ||
586 | |||
587 | static ssize_t adp8870_bl_l5_dark_max_show(struct device *dev, | ||
588 | struct device_attribute *attr, char *buf) | ||
589 | { | ||
590 | return adp8870_show(dev, buf, ADP8870_BLMX5); | ||
591 | } | ||
592 | |||
593 | static ssize_t adp8870_bl_l5_dark_max_store(struct device *dev, | ||
594 | struct device_attribute *attr, const char *buf, size_t count) | ||
595 | { | ||
596 | return adp8870_store(dev, buf, count, ADP8870_BLMX5); | ||
597 | } | ||
598 | static DEVICE_ATTR(l5_dark_max, 0664, adp8870_bl_l5_dark_max_show, | ||
599 | adp8870_bl_l5_dark_max_store); | ||
600 | |||
601 | |||
602 | static ssize_t adp8870_bl_l4_indoor_max_show(struct device *dev, | ||
603 | struct device_attribute *attr, char *buf) | ||
604 | { | ||
605 | return adp8870_show(dev, buf, ADP8870_BLMX4); | ||
606 | } | ||
607 | |||
608 | static ssize_t adp8870_bl_l4_indoor_max_store(struct device *dev, | ||
609 | struct device_attribute *attr, const char *buf, size_t count) | ||
610 | { | ||
611 | return adp8870_store(dev, buf, count, ADP8870_BLMX4); | ||
612 | } | ||
613 | static DEVICE_ATTR(l4_indoor_max, 0664, adp8870_bl_l4_indoor_max_show, | ||
614 | adp8870_bl_l4_indoor_max_store); | ||
615 | |||
616 | |||
617 | static ssize_t adp8870_bl_l3_office_max_show(struct device *dev, | ||
618 | struct device_attribute *attr, char *buf) | ||
619 | { | ||
620 | return adp8870_show(dev, buf, ADP8870_BLMX3); | ||
621 | } | ||
622 | |||
623 | static ssize_t adp8870_bl_l3_office_max_store(struct device *dev, | ||
624 | struct device_attribute *attr, const char *buf, size_t count) | ||
625 | { | ||
626 | return adp8870_store(dev, buf, count, ADP8870_BLMX3); | ||
627 | } | ||
628 | |||
629 | static DEVICE_ATTR(l3_office_max, 0664, adp8870_bl_l3_office_max_show, | ||
630 | adp8870_bl_l3_office_max_store); | ||
631 | |||
632 | static ssize_t adp8870_bl_l2_bright_max_show(struct device *dev, | ||
633 | struct device_attribute *attr, char *buf) | ||
634 | { | ||
635 | return adp8870_show(dev, buf, ADP8870_BLMX2); | ||
636 | } | ||
637 | |||
638 | static ssize_t adp8870_bl_l2_bright_max_store(struct device *dev, | ||
639 | struct device_attribute *attr, const char *buf, size_t count) | ||
640 | { | ||
641 | return adp8870_store(dev, buf, count, ADP8870_BLMX2); | ||
642 | } | ||
643 | static DEVICE_ATTR(l2_bright_max, 0664, adp8870_bl_l2_bright_max_show, | ||
644 | adp8870_bl_l2_bright_max_store); | ||
645 | |||
646 | static ssize_t adp8870_bl_l1_daylight_max_show(struct device *dev, | ||
647 | struct device_attribute *attr, char *buf) | ||
648 | { | ||
649 | return adp8870_show(dev, buf, ADP8870_BLMX1); | ||
650 | } | ||
651 | |||
652 | static ssize_t adp8870_bl_l1_daylight_max_store(struct device *dev, | ||
653 | struct device_attribute *attr, const char *buf, size_t count) | ||
654 | { | ||
655 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
656 | int ret = strict_strtoul(buf, 10, &data->cached_daylight_max); | ||
657 | if (ret) | ||
658 | return ret; | ||
659 | |||
660 | return adp8870_store(dev, buf, count, ADP8870_BLMX1); | ||
661 | } | ||
662 | static DEVICE_ATTR(l1_daylight_max, 0664, adp8870_bl_l1_daylight_max_show, | ||
663 | adp8870_bl_l1_daylight_max_store); | ||
664 | |||
665 | static ssize_t adp8870_bl_l5_dark_dim_show(struct device *dev, | ||
666 | struct device_attribute *attr, char *buf) | ||
667 | { | ||
668 | return adp8870_show(dev, buf, ADP8870_BLDM5); | ||
669 | } | ||
670 | |||
671 | static ssize_t adp8870_bl_l5_dark_dim_store(struct device *dev, | ||
672 | struct device_attribute *attr, | ||
673 | const char *buf, size_t count) | ||
674 | { | ||
675 | return adp8870_store(dev, buf, count, ADP8870_BLDM5); | ||
676 | } | ||
677 | static DEVICE_ATTR(l5_dark_dim, 0664, adp8870_bl_l5_dark_dim_show, | ||
678 | adp8870_bl_l5_dark_dim_store); | ||
679 | |||
680 | static ssize_t adp8870_bl_l4_indoor_dim_show(struct device *dev, | ||
681 | struct device_attribute *attr, char *buf) | ||
682 | { | ||
683 | return adp8870_show(dev, buf, ADP8870_BLDM4); | ||
684 | } | ||
685 | |||
686 | static ssize_t adp8870_bl_l4_indoor_dim_store(struct device *dev, | ||
687 | struct device_attribute *attr, | ||
688 | const char *buf, size_t count) | ||
689 | { | ||
690 | return adp8870_store(dev, buf, count, ADP8870_BLDM4); | ||
691 | } | ||
692 | static DEVICE_ATTR(l4_indoor_dim, 0664, adp8870_bl_l4_indoor_dim_show, | ||
693 | adp8870_bl_l4_indoor_dim_store); | ||
694 | |||
695 | |||
696 | static ssize_t adp8870_bl_l3_office_dim_show(struct device *dev, | ||
697 | struct device_attribute *attr, char *buf) | ||
698 | { | ||
699 | return adp8870_show(dev, buf, ADP8870_BLDM3); | ||
700 | } | ||
701 | |||
702 | static ssize_t adp8870_bl_l3_office_dim_store(struct device *dev, | ||
703 | struct device_attribute *attr, | ||
704 | const char *buf, size_t count) | ||
705 | { | ||
706 | return adp8870_store(dev, buf, count, ADP8870_BLDM3); | ||
707 | } | ||
708 | static DEVICE_ATTR(l3_office_dim, 0664, adp8870_bl_l3_office_dim_show, | ||
709 | adp8870_bl_l3_office_dim_store); | ||
710 | |||
711 | static ssize_t adp8870_bl_l2_bright_dim_show(struct device *dev, | ||
712 | struct device_attribute *attr, char *buf) | ||
713 | { | ||
714 | return adp8870_show(dev, buf, ADP8870_BLDM2); | ||
715 | } | ||
716 | |||
717 | static ssize_t adp8870_bl_l2_bright_dim_store(struct device *dev, | ||
718 | struct device_attribute *attr, | ||
719 | const char *buf, size_t count) | ||
720 | { | ||
721 | return adp8870_store(dev, buf, count, ADP8870_BLDM2); | ||
722 | } | ||
723 | static DEVICE_ATTR(l2_bright_dim, 0664, adp8870_bl_l2_bright_dim_show, | ||
724 | adp8870_bl_l2_bright_dim_store); | ||
725 | |||
726 | static ssize_t adp8870_bl_l1_daylight_dim_show(struct device *dev, | ||
727 | struct device_attribute *attr, char *buf) | ||
728 | { | ||
729 | return adp8870_show(dev, buf, ADP8870_BLDM1); | ||
730 | } | ||
731 | |||
732 | static ssize_t adp8870_bl_l1_daylight_dim_store(struct device *dev, | ||
733 | struct device_attribute *attr, | ||
734 | const char *buf, size_t count) | ||
735 | { | ||
736 | return adp8870_store(dev, buf, count, ADP8870_BLDM1); | ||
737 | } | ||
738 | static DEVICE_ATTR(l1_daylight_dim, 0664, adp8870_bl_l1_daylight_dim_show, | ||
739 | adp8870_bl_l1_daylight_dim_store); | ||
740 | |||
741 | #ifdef ADP8870_EXT_FEATURES | ||
742 | static ssize_t adp8870_bl_ambient_light_level_show(struct device *dev, | ||
743 | struct device_attribute *attr, char *buf) | ||
744 | { | ||
745 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
746 | int error; | ||
747 | uint8_t reg_val; | ||
748 | uint16_t ret_val; | ||
749 | |||
750 | mutex_lock(&data->lock); | ||
751 | error = adp8870_read(data->client, ADP8870_PH1LEVL, ®_val); | ||
752 | if (error < 0) { | ||
753 | mutex_unlock(&data->lock); | ||
754 | return error; | ||
755 | } | ||
756 | ret_val = reg_val; | ||
757 | error = adp8870_read(data->client, ADP8870_PH1LEVH, ®_val); | ||
758 | mutex_unlock(&data->lock); | ||
759 | |||
760 | if (error < 0) | ||
761 | return error; | ||
762 | |||
763 | /* Return 13-bit conversion value for the first light sensor */ | ||
764 | ret_val += (reg_val & 0x1F) << 8; | ||
765 | |||
766 | return sprintf(buf, "%u\n", ret_val); | ||
767 | } | ||
768 | static DEVICE_ATTR(ambient_light_level, 0444, | ||
769 | adp8870_bl_ambient_light_level_show, NULL); | ||
770 | |||
771 | static ssize_t adp8870_bl_ambient_light_zone_show(struct device *dev, | ||
772 | struct device_attribute *attr, char *buf) | ||
773 | { | ||
774 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
775 | int error; | ||
776 | uint8_t reg_val; | ||
777 | |||
778 | mutex_lock(&data->lock); | ||
779 | error = adp8870_read(data->client, ADP8870_CFGR, ®_val); | ||
780 | mutex_unlock(&data->lock); | ||
781 | |||
782 | if (error < 0) | ||
783 | return error; | ||
784 | |||
785 | return sprintf(buf, "%u\n", | ||
786 | ((reg_val >> CFGR_BLV_SHIFT) & CFGR_BLV_MASK) + 1); | ||
787 | } | ||
788 | |||
789 | static ssize_t adp8870_bl_ambient_light_zone_store(struct device *dev, | ||
790 | struct device_attribute *attr, | ||
791 | const char *buf, size_t count) | ||
792 | { | ||
793 | struct adp8870_bl *data = dev_get_drvdata(dev); | ||
794 | unsigned long val; | ||
795 | uint8_t reg_val; | ||
796 | int ret; | ||
797 | |||
798 | ret = strict_strtoul(buf, 10, &val); | ||
799 | if (ret) | ||
800 | return ret; | ||
801 | |||
802 | if (val == 0) { | ||
803 | /* Enable automatic ambient light sensing */ | ||
804 | adp8870_set_bits(data->client, ADP8870_MDCR, CMP_AUTOEN); | ||
805 | } else if ((val > 0) && (val < 6)) { | ||
806 | /* Disable automatic ambient light sensing */ | ||
807 | adp8870_clr_bits(data->client, ADP8870_MDCR, CMP_AUTOEN); | ||
808 | |||
809 | /* Set user supplied ambient light zone */ | ||
810 | mutex_lock(&data->lock); | ||
811 | adp8870_read(data->client, ADP8870_CFGR, ®_val); | ||
812 | reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT); | ||
813 | reg_val |= (val - 1) << CFGR_BLV_SHIFT; | ||
814 | adp8870_write(data->client, ADP8870_CFGR, reg_val); | ||
815 | mutex_unlock(&data->lock); | ||
816 | } | ||
817 | |||
818 | return count; | ||
819 | } | ||
820 | static DEVICE_ATTR(ambient_light_zone, 0664, | ||
821 | adp8870_bl_ambient_light_zone_show, | ||
822 | adp8870_bl_ambient_light_zone_store); | ||
823 | #endif | ||
824 | |||
825 | static struct attribute *adp8870_bl_attributes[] = { | ||
826 | &dev_attr_l5_dark_max.attr, | ||
827 | &dev_attr_l5_dark_dim.attr, | ||
828 | &dev_attr_l4_indoor_max.attr, | ||
829 | &dev_attr_l4_indoor_dim.attr, | ||
830 | &dev_attr_l3_office_max.attr, | ||
831 | &dev_attr_l3_office_dim.attr, | ||
832 | &dev_attr_l2_bright_max.attr, | ||
833 | &dev_attr_l2_bright_dim.attr, | ||
834 | &dev_attr_l1_daylight_max.attr, | ||
835 | &dev_attr_l1_daylight_dim.attr, | ||
836 | #ifdef ADP8870_EXT_FEATURES | ||
837 | &dev_attr_ambient_light_level.attr, | ||
838 | &dev_attr_ambient_light_zone.attr, | ||
839 | #endif | ||
840 | NULL | ||
841 | }; | ||
842 | |||
843 | static const struct attribute_group adp8870_bl_attr_group = { | ||
844 | .attrs = adp8870_bl_attributes, | ||
845 | }; | ||
846 | |||
847 | static int __devinit adp8870_probe(struct i2c_client *client, | ||
848 | const struct i2c_device_id *id) | ||
849 | { | ||
850 | struct backlight_properties props; | ||
851 | struct backlight_device *bl; | ||
852 | struct adp8870_bl *data; | ||
853 | struct adp8870_backlight_platform_data *pdata = | ||
854 | client->dev.platform_data; | ||
855 | uint8_t reg_val; | ||
856 | int ret; | ||
857 | |||
858 | if (!i2c_check_functionality(client->adapter, | ||
859 | I2C_FUNC_SMBUS_BYTE_DATA)) { | ||
860 | dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); | ||
861 | return -EIO; | ||
862 | } | ||
863 | |||
864 | if (!pdata) { | ||
865 | dev_err(&client->dev, "no platform data?\n"); | ||
866 | return -EINVAL; | ||
867 | } | ||
868 | |||
869 | ret = adp8870_read(client, ADP8870_MFDVID, ®_val); | ||
870 | if (ret < 0) | ||
871 | return -EIO; | ||
872 | |||
873 | if (ADP8870_MANID(reg_val) != ADP8870_MANUFID) { | ||
874 | dev_err(&client->dev, "failed to probe\n"); | ||
875 | return -ENODEV; | ||
876 | } | ||
877 | |||
878 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
879 | if (data == NULL) | ||
880 | return -ENOMEM; | ||
881 | |||
882 | data->revid = ADP8870_DEVID(reg_val); | ||
883 | data->client = client; | ||
884 | data->pdata = pdata; | ||
885 | data->id = id->driver_data; | ||
886 | data->current_brightness = 0; | ||
887 | i2c_set_clientdata(client, data); | ||
888 | |||
889 | mutex_init(&data->lock); | ||
890 | |||
891 | memset(&props, 0, sizeof(props)); | ||
892 | props.type = BACKLIGHT_RAW; | ||
893 | props.max_brightness = props.brightness = ADP8870_MAX_BRIGHTNESS; | ||
894 | bl = backlight_device_register(dev_driver_string(&client->dev), | ||
895 | &client->dev, data, &adp8870_bl_ops, &props); | ||
896 | if (IS_ERR(bl)) { | ||
897 | dev_err(&client->dev, "failed to register backlight\n"); | ||
898 | ret = PTR_ERR(bl); | ||
899 | goto out2; | ||
900 | } | ||
901 | |||
902 | data->bl = bl; | ||
903 | |||
904 | if (pdata->en_ambl_sens) | ||
905 | ret = sysfs_create_group(&bl->dev.kobj, | ||
906 | &adp8870_bl_attr_group); | ||
907 | |||
908 | if (ret) { | ||
909 | dev_err(&client->dev, "failed to register sysfs\n"); | ||
910 | goto out1; | ||
911 | } | ||
912 | |||
913 | ret = adp8870_bl_setup(bl); | ||
914 | if (ret) { | ||
915 | ret = -EIO; | ||
916 | goto out; | ||
917 | } | ||
918 | |||
919 | backlight_update_status(bl); | ||
920 | |||
921 | dev_info(&client->dev, "Rev.%d Backlight\n", data->revid); | ||
922 | |||
923 | if (pdata->num_leds) | ||
924 | adp8870_led_probe(client); | ||
925 | |||
926 | return 0; | ||
927 | |||
928 | out: | ||
929 | if (data->pdata->en_ambl_sens) | ||
930 | sysfs_remove_group(&data->bl->dev.kobj, | ||
931 | &adp8870_bl_attr_group); | ||
932 | out1: | ||
933 | backlight_device_unregister(bl); | ||
934 | out2: | ||
935 | i2c_set_clientdata(client, NULL); | ||
936 | kfree(data); | ||
937 | |||
938 | return ret; | ||
939 | } | ||
940 | |||
941 | static int __devexit adp8870_remove(struct i2c_client *client) | ||
942 | { | ||
943 | struct adp8870_bl *data = i2c_get_clientdata(client); | ||
944 | |||
945 | adp8870_clr_bits(client, ADP8870_MDCR, NSTBY); | ||
946 | |||
947 | if (data->led) | ||
948 | adp8870_led_remove(client); | ||
949 | |||
950 | if (data->pdata->en_ambl_sens) | ||
951 | sysfs_remove_group(&data->bl->dev.kobj, | ||
952 | &adp8870_bl_attr_group); | ||
953 | |||
954 | backlight_device_unregister(data->bl); | ||
955 | i2c_set_clientdata(client, NULL); | ||
956 | kfree(data); | ||
957 | |||
958 | return 0; | ||
959 | } | ||
960 | |||
961 | #ifdef CONFIG_PM | ||
962 | static int adp8870_i2c_suspend(struct i2c_client *client, pm_message_t message) | ||
963 | { | ||
964 | adp8870_clr_bits(client, ADP8870_MDCR, NSTBY); | ||
965 | |||
966 | return 0; | ||
967 | } | ||
968 | |||
969 | static int adp8870_i2c_resume(struct i2c_client *client) | ||
970 | { | ||
971 | adp8870_set_bits(client, ADP8870_MDCR, NSTBY); | ||
972 | |||
973 | return 0; | ||
974 | } | ||
975 | #else | ||
976 | #define adp8870_i2c_suspend NULL | ||
977 | #define adp8870_i2c_resume NULL | ||
978 | #endif | ||
979 | |||
980 | static const struct i2c_device_id adp8870_id[] = { | ||
981 | { "adp8870", 0 }, | ||
982 | { } | ||
983 | }; | ||
984 | MODULE_DEVICE_TABLE(i2c, adp8870_id); | ||
985 | |||
986 | static struct i2c_driver adp8870_driver = { | ||
987 | .driver = { | ||
988 | .name = KBUILD_MODNAME, | ||
989 | }, | ||
990 | .probe = adp8870_probe, | ||
991 | .remove = __devexit_p(adp8870_remove), | ||
992 | .suspend = adp8870_i2c_suspend, | ||
993 | .resume = adp8870_i2c_resume, | ||
994 | .id_table = adp8870_id, | ||
995 | }; | ||
996 | |||
997 | static int __init adp8870_init(void) | ||
998 | { | ||
999 | return i2c_add_driver(&adp8870_driver); | ||
1000 | } | ||
1001 | module_init(adp8870_init); | ||
1002 | |||
1003 | static void __exit adp8870_exit(void) | ||
1004 | { | ||
1005 | i2c_del_driver(&adp8870_driver); | ||
1006 | } | ||
1007 | module_exit(adp8870_exit); | ||
1008 | |||
1009 | MODULE_LICENSE("GPL v2"); | ||
1010 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | ||
1011 | MODULE_DESCRIPTION("ADP8870 Backlight driver"); | ||
1012 | MODULE_ALIAS("platform:adp8870-backlight"); | ||
diff --git a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c index 47c21fb2c82f..bea53c1a4950 100644 --- a/drivers/video/bf537-lq035.c +++ b/drivers/video/bf537-lq035.c | |||
@@ -789,6 +789,7 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
789 | i2c_add_driver(&ad5280_driver); | 789 | i2c_add_driver(&ad5280_driver); |
790 | 790 | ||
791 | memset(&props, 0, sizeof(props)); | 791 | memset(&props, 0, sizeof(props)); |
792 | props.type = BACKLIGHT_RAW; | ||
792 | props.max_brightness = MAX_BRIGHENESS; | 793 | props.max_brightness = MAX_BRIGHENESS; |
793 | bl_dev = backlight_device_register("bf537-bl", NULL, NULL, | 794 | bl_dev = backlight_device_register("bf537-bl", NULL, NULL, |
794 | &bfin_lq035fb_bl_ops, &props); | 795 | &bfin_lq035fb_bl_ops, &props); |
diff --git a/drivers/video/broadsheetfb.c b/drivers/video/broadsheetfb.c index ebda6876d3a9..377dde3d5bfc 100644 --- a/drivers/video/broadsheetfb.c +++ b/drivers/video/broadsheetfb.c | |||
@@ -1101,12 +1101,10 @@ static int __devinit broadsheetfb_probe(struct platform_device *dev) | |||
1101 | 1101 | ||
1102 | videomemorysize = roundup((dpyw*dpyh), PAGE_SIZE); | 1102 | videomemorysize = roundup((dpyw*dpyh), PAGE_SIZE); |
1103 | 1103 | ||
1104 | videomemory = vmalloc(videomemorysize); | 1104 | videomemory = vzalloc(videomemorysize); |
1105 | if (!videomemory) | 1105 | if (!videomemory) |
1106 | goto err_fb_rel; | 1106 | goto err_fb_rel; |
1107 | 1107 | ||
1108 | memset(videomemory, 0, videomemorysize); | ||
1109 | |||
1110 | info->screen_base = (char *)videomemory; | 1108 | info->screen_base = (char *)videomemory; |
1111 | info->fbops = &broadsheetfb_ops; | 1109 | info->fbops = &broadsheetfb_ops; |
1112 | 1110 | ||
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index fb205843c2c7..784139aed079 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/pci.h> | 16 | #include <linux/pci.h> |
17 | #include <video/vga.h> | 17 | #include <video/vga.h> |
18 | 18 | ||
19 | static bool request_mem_succeeded = false; | ||
20 | |||
19 | static struct fb_var_screeninfo efifb_defined __devinitdata = { | 21 | static struct fb_var_screeninfo efifb_defined __devinitdata = { |
20 | .activate = FB_ACTIVATE_NOW, | 22 | .activate = FB_ACTIVATE_NOW, |
21 | .height = -1, | 23 | .height = -1, |
@@ -281,7 +283,9 @@ static void efifb_destroy(struct fb_info *info) | |||
281 | { | 283 | { |
282 | if (info->screen_base) | 284 | if (info->screen_base) |
283 | iounmap(info->screen_base); | 285 | iounmap(info->screen_base); |
284 | release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); | 286 | if (request_mem_succeeded) |
287 | release_mem_region(info->apertures->ranges[0].base, | ||
288 | info->apertures->ranges[0].size); | ||
285 | framebuffer_release(info); | 289 | framebuffer_release(info); |
286 | } | 290 | } |
287 | 291 | ||
@@ -326,14 +330,13 @@ static int __init efifb_setup(char *options) | |||
326 | return 0; | 330 | return 0; |
327 | } | 331 | } |
328 | 332 | ||
329 | static int __devinit efifb_probe(struct platform_device *dev) | 333 | static int __init efifb_probe(struct platform_device *dev) |
330 | { | 334 | { |
331 | struct fb_info *info; | 335 | struct fb_info *info; |
332 | int err; | 336 | int err; |
333 | unsigned int size_vmode; | 337 | unsigned int size_vmode; |
334 | unsigned int size_remap; | 338 | unsigned int size_remap; |
335 | unsigned int size_total; | 339 | unsigned int size_total; |
336 | int request_succeeded = 0; | ||
337 | 340 | ||
338 | if (!screen_info.lfb_depth) | 341 | if (!screen_info.lfb_depth) |
339 | screen_info.lfb_depth = 32; | 342 | screen_info.lfb_depth = 32; |
@@ -387,7 +390,7 @@ static int __devinit efifb_probe(struct platform_device *dev) | |||
387 | efifb_fix.smem_len = size_remap; | 390 | efifb_fix.smem_len = size_remap; |
388 | 391 | ||
389 | if (request_mem_region(efifb_fix.smem_start, size_remap, "efifb")) { | 392 | if (request_mem_region(efifb_fix.smem_start, size_remap, "efifb")) { |
390 | request_succeeded = 1; | 393 | request_mem_succeeded = true; |
391 | } else { | 394 | } else { |
392 | /* We cannot make this fatal. Sometimes this comes from magic | 395 | /* We cannot make this fatal. Sometimes this comes from magic |
393 | spaces our resource handlers simply don't know about */ | 396 | spaces our resource handlers simply don't know about */ |
@@ -413,7 +416,7 @@ static int __devinit efifb_probe(struct platform_device *dev) | |||
413 | info->apertures->ranges[0].base = efifb_fix.smem_start; | 416 | info->apertures->ranges[0].base = efifb_fix.smem_start; |
414 | info->apertures->ranges[0].size = size_remap; | 417 | info->apertures->ranges[0].size = size_remap; |
415 | 418 | ||
416 | info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len); | 419 | info->screen_base = ioremap_wc(efifb_fix.smem_start, efifb_fix.smem_len); |
417 | if (!info->screen_base) { | 420 | if (!info->screen_base) { |
418 | printk(KERN_ERR "efifb: abort, cannot ioremap video memory " | 421 | printk(KERN_ERR "efifb: abort, cannot ioremap video memory " |
419 | "0x%x @ 0x%lx\n", | 422 | "0x%x @ 0x%lx\n", |
@@ -491,13 +494,12 @@ err_unmap: | |||
491 | err_release_fb: | 494 | err_release_fb: |
492 | framebuffer_release(info); | 495 | framebuffer_release(info); |
493 | err_release_mem: | 496 | err_release_mem: |
494 | if (request_succeeded) | 497 | if (request_mem_succeeded) |
495 | release_mem_region(efifb_fix.smem_start, size_total); | 498 | release_mem_region(efifb_fix.smem_start, size_total); |
496 | return err; | 499 | return err; |
497 | } | 500 | } |
498 | 501 | ||
499 | static struct platform_driver efifb_driver = { | 502 | static struct platform_driver efifb_driver = { |
500 | .probe = efifb_probe, | ||
501 | .driver = { | 503 | .driver = { |
502 | .name = "efifb", | 504 | .name = "efifb", |
503 | }, | 505 | }, |
@@ -528,13 +530,21 @@ static int __init efifb_init(void) | |||
528 | if (!screen_info.lfb_linelength) | 530 | if (!screen_info.lfb_linelength) |
529 | return -ENODEV; | 531 | return -ENODEV; |
530 | 532 | ||
531 | ret = platform_driver_register(&efifb_driver); | 533 | ret = platform_device_register(&efifb_device); |
534 | if (ret) | ||
535 | return ret; | ||
532 | 536 | ||
533 | if (!ret) { | 537 | /* |
534 | ret = platform_device_register(&efifb_device); | 538 | * This is not just an optimization. We will interfere |
535 | if (ret) | 539 | * with a real driver if we get reprobed, so don't allow |
536 | platform_driver_unregister(&efifb_driver); | 540 | * it. |
541 | */ | ||
542 | ret = platform_driver_probe(&efifb_driver, efifb_probe); | ||
543 | if (ret) { | ||
544 | platform_device_unregister(&efifb_device); | ||
545 | return ret; | ||
537 | } | 546 | } |
547 | |||
538 | return ret; | 548 | return ret; |
539 | } | 549 | } |
540 | module_init(efifb_init); | 550 | module_init(efifb_init); |
diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c index 1b94643ecbcf..fbef15f7a218 100644 --- a/drivers/video/hecubafb.c +++ b/drivers/video/hecubafb.c | |||
@@ -231,11 +231,10 @@ static int __devinit hecubafb_probe(struct platform_device *dev) | |||
231 | 231 | ||
232 | videomemorysize = (DPY_W*DPY_H)/8; | 232 | videomemorysize = (DPY_W*DPY_H)/8; |
233 | 233 | ||
234 | if (!(videomemory = vmalloc(videomemorysize))) | 234 | videomemory = vzalloc(videomemorysize); |
235 | if (!videomemory) | ||
235 | return retval; | 236 | return retval; |
236 | 237 | ||
237 | memset(videomemory, 0, videomemorysize); | ||
238 | |||
239 | info = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev); | 238 | info = framebuffer_alloc(sizeof(struct hecubafb_par), &dev->dev); |
240 | if (!info) | 239 | if (!info) |
241 | goto err_fballoc; | 240 | goto err_fballoc; |
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index d2ccfd6e662c..f135dbead07d 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -856,10 +856,10 @@ failed_platform_init: | |||
856 | dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu, | 856 | dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu, |
857 | fbi->map_dma); | 857 | fbi->map_dma); |
858 | failed_map: | 858 | failed_map: |
859 | clk_put(fbi->clk); | ||
860 | failed_getclock: | ||
861 | iounmap(fbi->regs); | 859 | iounmap(fbi->regs); |
862 | failed_ioremap: | 860 | failed_ioremap: |
861 | clk_put(fbi->clk); | ||
862 | failed_getclock: | ||
863 | release_mem_region(res->start, resource_size(res)); | 863 | release_mem_region(res->start, resource_size(res)); |
864 | failed_req: | 864 | failed_req: |
865 | kfree(info->pseudo_palette); | 865 | kfree(info->pseudo_palette); |
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c index ed64edfd2c43..97d45e5115e2 100644 --- a/drivers/video/metronomefb.c +++ b/drivers/video/metronomefb.c | |||
@@ -628,12 +628,10 @@ static int __devinit metronomefb_probe(struct platform_device *dev) | |||
628 | /* we need to add a spare page because our csum caching scheme walks | 628 | /* we need to add a spare page because our csum caching scheme walks |
629 | * to the end of the page */ | 629 | * to the end of the page */ |
630 | videomemorysize = PAGE_SIZE + (fw * fh); | 630 | videomemorysize = PAGE_SIZE + (fw * fh); |
631 | videomemory = vmalloc(videomemorysize); | 631 | videomemory = vzalloc(videomemorysize); |
632 | if (!videomemory) | 632 | if (!videomemory) |
633 | goto err_fb_rel; | 633 | goto err_fb_rel; |
634 | 634 | ||
635 | memset(videomemory, 0, videomemorysize); | ||
636 | |||
637 | info->screen_base = (char __force __iomem *)videomemory; | 635 | info->screen_base = (char __force __iomem *)videomemory; |
638 | info->fbops = &metronomefb_ops; | 636 | info->fbops = &metronomefb_ops; |
639 | 637 | ||
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 48c3ea8652b6..cb175fe7abc0 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c | |||
@@ -1128,3 +1128,4 @@ EXPORT_SYMBOL(fb_find_best_mode); | |||
1128 | EXPORT_SYMBOL(fb_find_nearest_mode); | 1128 | EXPORT_SYMBOL(fb_find_nearest_mode); |
1129 | EXPORT_SYMBOL(fb_videomode_to_modelist); | 1129 | EXPORT_SYMBOL(fb_videomode_to_modelist); |
1130 | EXPORT_SYMBOL(fb_find_mode); | 1130 | EXPORT_SYMBOL(fb_find_mode); |
1131 | EXPORT_SYMBOL(fb_find_mode_cvt); | ||
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c index 35f61dd0cb3a..bb95ec56d25d 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/pxa168fb.c | |||
@@ -623,19 +623,21 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev) | |||
623 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 623 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
624 | if (res == NULL) { | 624 | if (res == NULL) { |
625 | dev_err(&pdev->dev, "no IO memory defined\n"); | 625 | dev_err(&pdev->dev, "no IO memory defined\n"); |
626 | return -ENOENT; | 626 | ret = -ENOENT; |
627 | goto failed_put_clk; | ||
627 | } | 628 | } |
628 | 629 | ||
629 | irq = platform_get_irq(pdev, 0); | 630 | irq = platform_get_irq(pdev, 0); |
630 | if (irq < 0) { | 631 | if (irq < 0) { |
631 | dev_err(&pdev->dev, "no IRQ defined\n"); | 632 | dev_err(&pdev->dev, "no IRQ defined\n"); |
632 | return -ENOENT; | 633 | ret = -ENOENT; |
634 | goto failed_put_clk; | ||
633 | } | 635 | } |
634 | 636 | ||
635 | info = framebuffer_alloc(sizeof(struct pxa168fb_info), &pdev->dev); | 637 | info = framebuffer_alloc(sizeof(struct pxa168fb_info), &pdev->dev); |
636 | if (info == NULL) { | 638 | if (info == NULL) { |
637 | clk_put(clk); | 639 | ret = -ENOMEM; |
638 | return -ENOMEM; | 640 | goto failed_put_clk; |
639 | } | 641 | } |
640 | 642 | ||
641 | /* Initialize private data */ | 643 | /* Initialize private data */ |
@@ -671,7 +673,7 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev) | |||
671 | fbi->reg_base = ioremap_nocache(res->start, resource_size(res)); | 673 | fbi->reg_base = ioremap_nocache(res->start, resource_size(res)); |
672 | if (fbi->reg_base == NULL) { | 674 | if (fbi->reg_base == NULL) { |
673 | ret = -ENOMEM; | 675 | ret = -ENOMEM; |
674 | goto failed; | 676 | goto failed_free_info; |
675 | } | 677 | } |
676 | 678 | ||
677 | /* | 679 | /* |
@@ -683,7 +685,7 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev) | |||
683 | &fbi->fb_start_dma, GFP_KERNEL); | 685 | &fbi->fb_start_dma, GFP_KERNEL); |
684 | if (info->screen_base == NULL) { | 686 | if (info->screen_base == NULL) { |
685 | ret = -ENOMEM; | 687 | ret = -ENOMEM; |
686 | goto failed; | 688 | goto failed_free_info; |
687 | } | 689 | } |
688 | 690 | ||
689 | info->fix.smem_start = (unsigned long)fbi->fb_start_dma; | 691 | info->fix.smem_start = (unsigned long)fbi->fb_start_dma; |
@@ -772,8 +774,9 @@ failed_free_clk: | |||
772 | failed_free_fbmem: | 774 | failed_free_fbmem: |
773 | dma_free_coherent(fbi->dev, info->fix.smem_len, | 775 | dma_free_coherent(fbi->dev, info->fix.smem_len, |
774 | info->screen_base, fbi->fb_start_dma); | 776 | info->screen_base, fbi->fb_start_dma); |
775 | failed: | 777 | failed_free_info: |
776 | kfree(info); | 778 | kfree(info); |
779 | failed_put_clk: | ||
777 | clk_put(clk); | 780 | clk_put(clk); |
778 | 781 | ||
779 | dev_err(&pdev->dev, "frame buffer device init failed with %d\n", ret); | 782 | dev_err(&pdev->dev, "frame buffer device init failed with %d\n", ret); |
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 0352afa49a39..4aecf213c9be 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -235,13 +235,12 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var, | |||
235 | struct fb_info *info) | 235 | struct fb_info *info) |
236 | { | 236 | { |
237 | struct s3c_fb_win *win = info->par; | 237 | struct s3c_fb_win *win = info->par; |
238 | struct s3c_fb_pd_win *windata = win->windata; | ||
239 | struct s3c_fb *sfb = win->parent; | 238 | struct s3c_fb *sfb = win->parent; |
240 | 239 | ||
241 | dev_dbg(sfb->dev, "checking parameters\n"); | 240 | dev_dbg(sfb->dev, "checking parameters\n"); |
242 | 241 | ||
243 | var->xres_virtual = max((unsigned int)windata->virtual_x, var->xres); | 242 | var->xres_virtual = max(var->xres_virtual, var->xres); |
244 | var->yres_virtual = max((unsigned int)windata->virtual_y, var->yres); | 243 | var->yres_virtual = max(var->yres_virtual, var->yres); |
245 | 244 | ||
246 | if (!s3c_fb_validate_win_bpp(win, var->bits_per_pixel)) { | 245 | if (!s3c_fb_validate_win_bpp(win, var->bits_per_pixel)) { |
247 | dev_dbg(sfb->dev, "win %d: unsupported bpp %d\n", | 246 | dev_dbg(sfb->dev, "win %d: unsupported bpp %d\n", |
@@ -558,6 +557,13 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
558 | vidosd_set_alpha(win, alpha); | 557 | vidosd_set_alpha(win, alpha); |
559 | vidosd_set_size(win, data); | 558 | vidosd_set_size(win, data); |
560 | 559 | ||
560 | /* Enable DMA channel for this window */ | ||
561 | if (sfb->variant.has_shadowcon) { | ||
562 | data = readl(sfb->regs + SHADOWCON); | ||
563 | data |= SHADOWCON_CHx_ENABLE(win_no); | ||
564 | writel(data, sfb->regs + SHADOWCON); | ||
565 | } | ||
566 | |||
561 | data = WINCONx_ENWIN; | 567 | data = WINCONx_ENWIN; |
562 | 568 | ||
563 | /* note, since we have to round up the bits-per-pixel, we end up | 569 | /* note, since we have to round up the bits-per-pixel, we end up |
@@ -637,13 +643,6 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
637 | writel(data, regs + sfb->variant.wincon + (win_no * 4)); | 643 | writel(data, regs + sfb->variant.wincon + (win_no * 4)); |
638 | writel(0x0, regs + sfb->variant.winmap + (win_no * 4)); | 644 | writel(0x0, regs + sfb->variant.winmap + (win_no * 4)); |
639 | 645 | ||
640 | /* Enable DMA channel for this window */ | ||
641 | if (sfb->variant.has_shadowcon) { | ||
642 | data = readl(sfb->regs + SHADOWCON); | ||
643 | data |= SHADOWCON_CHx_ENABLE(win_no); | ||
644 | writel(data, sfb->regs + SHADOWCON); | ||
645 | } | ||
646 | |||
647 | shadow_protect_win(win, 0); | 646 | shadow_protect_win(win, 0); |
648 | 647 | ||
649 | return 0; | 648 | return 0; |
@@ -1487,11 +1486,10 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev) | |||
1487 | 1486 | ||
1488 | release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res)); | 1487 | release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res)); |
1489 | 1488 | ||
1490 | kfree(sfb); | ||
1491 | |||
1492 | pm_runtime_put_sync(sfb->dev); | 1489 | pm_runtime_put_sync(sfb->dev); |
1493 | pm_runtime_disable(sfb->dev); | 1490 | pm_runtime_disable(sfb->dev); |
1494 | 1491 | ||
1492 | kfree(sfb); | ||
1495 | return 0; | 1493 | return 0; |
1496 | } | 1494 | } |
1497 | 1495 | ||
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 3b7f2f5bae71..4de541ca9c52 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -2237,6 +2237,22 @@ static int __devinit savagefb_probe(struct pci_dev* dev, | |||
2237 | &info->modelist); | 2237 | &info->modelist); |
2238 | #endif | 2238 | #endif |
2239 | info->var = savagefb_var800x600x8; | 2239 | info->var = savagefb_var800x600x8; |
2240 | /* if a panel was detected, default to a CVT mode instead */ | ||
2241 | if (par->SavagePanelWidth) { | ||
2242 | struct fb_videomode cvt_mode; | ||
2243 | |||
2244 | memset(&cvt_mode, 0, sizeof(cvt_mode)); | ||
2245 | cvt_mode.xres = par->SavagePanelWidth; | ||
2246 | cvt_mode.yres = par->SavagePanelHeight; | ||
2247 | cvt_mode.refresh = 60; | ||
2248 | /* FIXME: if we know there is only the panel | ||
2249 | * we can enable reduced blanking as well */ | ||
2250 | if (fb_find_mode_cvt(&cvt_mode, 0, 0)) | ||
2251 | printk(KERN_WARNING "No CVT mode found for panel\n"); | ||
2252 | else if (fb_find_mode(&info->var, info, NULL, NULL, 0, | ||
2253 | &cvt_mode, 0) != 3) | ||
2254 | info->var = savagefb_var800x600x8; | ||
2255 | } | ||
2240 | 2256 | ||
2241 | if (mode_option) { | 2257 | if (mode_option) { |
2242 | fb_find_mode(&info->var, info, mode_option, | 2258 | fb_find_mode(&info->var, info, mode_option, |
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c index 6ae40b630dc9..7d54e2c612f7 100644 --- a/drivers/video/sh_mobile_hdmi.c +++ b/drivers/video/sh_mobile_hdmi.c | |||
@@ -1127,23 +1127,16 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1127 | struct fb_info *info = hdmi->info; | 1127 | struct fb_info *info = hdmi->info; |
1128 | unsigned long parent_rate = 0, hdmi_rate; | 1128 | unsigned long parent_rate = 0, hdmi_rate; |
1129 | 1129 | ||
1130 | /* A device has been plugged in */ | ||
1131 | pm_runtime_get_sync(hdmi->dev); | ||
1132 | |||
1133 | ret = sh_hdmi_read_edid(hdmi, &hdmi_rate, &parent_rate); | 1130 | ret = sh_hdmi_read_edid(hdmi, &hdmi_rate, &parent_rate); |
1134 | if (ret < 0) { | 1131 | if (ret < 0) |
1135 | pm_runtime_put(hdmi->dev); | ||
1136 | goto out; | 1132 | goto out; |
1137 | } | ||
1138 | 1133 | ||
1139 | hdmi->hp_state = HDMI_HOTPLUG_EDID_DONE; | 1134 | hdmi->hp_state = HDMI_HOTPLUG_EDID_DONE; |
1140 | 1135 | ||
1141 | /* Reconfigure the clock */ | 1136 | /* Reconfigure the clock */ |
1142 | ret = sh_hdmi_clk_configure(hdmi, hdmi_rate, parent_rate); | 1137 | ret = sh_hdmi_clk_configure(hdmi, hdmi_rate, parent_rate); |
1143 | if (ret < 0) { | 1138 | if (ret < 0) |
1144 | pm_runtime_put(hdmi->dev); | ||
1145 | goto out; | 1139 | goto out; |
1146 | } | ||
1147 | 1140 | ||
1148 | msleep(10); | 1141 | msleep(10); |
1149 | sh_hdmi_configure(hdmi); | 1142 | sh_hdmi_configure(hdmi); |
@@ -1191,7 +1184,6 @@ static void sh_hdmi_edid_work_fn(struct work_struct *work) | |||
1191 | fb_set_suspend(hdmi->info, 1); | 1184 | fb_set_suspend(hdmi->info, 1); |
1192 | 1185 | ||
1193 | console_unlock(); | 1186 | console_unlock(); |
1194 | pm_runtime_put(hdmi->dev); | ||
1195 | } | 1187 | } |
1196 | 1188 | ||
1197 | out: | 1189 | out: |
@@ -1312,7 +1304,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) | |||
1312 | INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn); | 1304 | INIT_DELAYED_WORK(&hdmi->edid_work, sh_hdmi_edid_work_fn); |
1313 | 1305 | ||
1314 | pm_runtime_enable(&pdev->dev); | 1306 | pm_runtime_enable(&pdev->dev); |
1315 | pm_runtime_resume(&pdev->dev); | 1307 | pm_runtime_get_sync(&pdev->dev); |
1316 | 1308 | ||
1317 | /* Product and revision IDs are 0 in sh-mobile version */ | 1309 | /* Product and revision IDs are 0 in sh-mobile version */ |
1318 | dev_info(&pdev->dev, "Detected HDMI controller 0x%x:0x%x\n", | 1310 | dev_info(&pdev->dev, "Detected HDMI controller 0x%x:0x%x\n", |
@@ -1340,7 +1332,7 @@ static int __init sh_hdmi_probe(struct platform_device *pdev) | |||
1340 | ecodec: | 1332 | ecodec: |
1341 | free_irq(irq, hdmi); | 1333 | free_irq(irq, hdmi); |
1342 | ereqirq: | 1334 | ereqirq: |
1343 | pm_runtime_suspend(&pdev->dev); | 1335 | pm_runtime_put(&pdev->dev); |
1344 | pm_runtime_disable(&pdev->dev); | 1336 | pm_runtime_disable(&pdev->dev); |
1345 | iounmap(hdmi->base); | 1337 | iounmap(hdmi->base); |
1346 | emap: | 1338 | emap: |
@@ -1377,7 +1369,7 @@ static int __exit sh_hdmi_remove(struct platform_device *pdev) | |||
1377 | free_irq(irq, hdmi); | 1369 | free_irq(irq, hdmi); |
1378 | /* Wait for already scheduled work */ | 1370 | /* Wait for already scheduled work */ |
1379 | cancel_delayed_work_sync(&hdmi->edid_work); | 1371 | cancel_delayed_work_sync(&hdmi->edid_work); |
1380 | pm_runtime_suspend(&pdev->dev); | 1372 | pm_runtime_put(&pdev->dev); |
1381 | pm_runtime_disable(&pdev->dev); | 1373 | pm_runtime_disable(&pdev->dev); |
1382 | clk_disable(hdmi->hdmi_clk); | 1374 | clk_disable(hdmi->hdmi_clk); |
1383 | clk_put(hdmi->hdmi_clk); | 1375 | clk_put(hdmi->hdmi_clk); |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 404c03b4b7c7..019dbd3f12b2 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -470,7 +470,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
470 | unsigned long tmp; | 470 | unsigned long tmp; |
471 | int bpp = 0; | 471 | int bpp = 0; |
472 | unsigned long ldddsr; | 472 | unsigned long ldddsr; |
473 | int k, m; | 473 | int k, m, ret; |
474 | 474 | ||
475 | /* enable clocks before accessing the hardware */ | 475 | /* enable clocks before accessing the hardware */ |
476 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 476 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
@@ -540,7 +540,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
540 | 540 | ||
541 | board_cfg = &ch->cfg.board_cfg; | 541 | board_cfg = &ch->cfg.board_cfg; |
542 | if (board_cfg->setup_sys) { | 542 | if (board_cfg->setup_sys) { |
543 | int ret = board_cfg->setup_sys(board_cfg->board_data, | 543 | ret = board_cfg->setup_sys(board_cfg->board_data, |
544 | ch, &sh_mobile_lcdc_sys_bus_ops); | 544 | ch, &sh_mobile_lcdc_sys_bus_ops); |
545 | if (ret) | 545 | if (ret) |
546 | return ret; | 546 | return ret; |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 53b2c5aae067..305c975b1787 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
@@ -1265,9 +1265,11 @@ static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image | |||
1265 | 1265 | ||
1266 | static void vga16fb_destroy(struct fb_info *info) | 1266 | static void vga16fb_destroy(struct fb_info *info) |
1267 | { | 1267 | { |
1268 | struct platform_device *dev = container_of(info->device, struct platform_device, dev); | ||
1268 | iounmap(info->screen_base); | 1269 | iounmap(info->screen_base); |
1269 | fb_dealloc_cmap(&info->cmap); | 1270 | fb_dealloc_cmap(&info->cmap); |
1270 | /* XXX unshare VGA regions */ | 1271 | /* XXX unshare VGA regions */ |
1272 | platform_set_drvdata(dev, NULL); | ||
1271 | framebuffer_release(info); | 1273 | framebuffer_release(info); |
1272 | } | 1274 | } |
1273 | 1275 | ||
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index a20218c2fda8..beac52fc1c0e 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -395,10 +395,9 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, | |||
395 | spin_lock_init(&info->dirty_lock); | 395 | spin_lock_init(&info->dirty_lock); |
396 | spin_lock_init(&info->resize_lock); | 396 | spin_lock_init(&info->resize_lock); |
397 | 397 | ||
398 | info->fb = vmalloc(fb_size); | 398 | info->fb = vzalloc(fb_size); |
399 | if (info->fb == NULL) | 399 | if (info->fb == NULL) |
400 | goto error_nomem; | 400 | goto error_nomem; |
401 | memset(info->fb, 0, fb_size); | ||
402 | 401 | ||
403 | info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT; | 402 | info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT; |
404 | 403 | ||
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 0f1da45ba47d..e058ace2a4ad 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -40,9 +40,6 @@ struct virtio_balloon | |||
40 | /* Waiting for host to ack the pages we released. */ | 40 | /* Waiting for host to ack the pages we released. */ |
41 | struct completion acked; | 41 | struct completion acked; |
42 | 42 | ||
43 | /* Do we have to tell Host *before* we reuse pages? */ | ||
44 | bool tell_host_first; | ||
45 | |||
46 | /* The pages we've told the Host we're not using. */ | 43 | /* The pages we've told the Host we're not using. */ |
47 | unsigned int num_pages; | 44 | unsigned int num_pages; |
48 | struct list_head pages; | 45 | struct list_head pages; |
@@ -151,13 +148,14 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) | |||
151 | vb->num_pages--; | 148 | vb->num_pages--; |
152 | } | 149 | } |
153 | 150 | ||
154 | if (vb->tell_host_first) { | 151 | |
155 | tell_host(vb, vb->deflate_vq); | 152 | /* |
156 | release_pages_by_pfn(vb->pfns, vb->num_pfns); | 153 | * Note that if |
157 | } else { | 154 | * virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); |
158 | release_pages_by_pfn(vb->pfns, vb->num_pfns); | 155 | * is true, we *have* to do it in this order |
159 | tell_host(vb, vb->deflate_vq); | 156 | */ |
160 | } | 157 | tell_host(vb, vb->deflate_vq); |
158 | release_pages_by_pfn(vb->pfns, vb->num_pfns); | ||
161 | } | 159 | } |
162 | 160 | ||
163 | static inline void update_stat(struct virtio_balloon *vb, int idx, | 161 | static inline void update_stat(struct virtio_balloon *vb, int idx, |
@@ -325,9 +323,6 @@ static int virtballoon_probe(struct virtio_device *vdev) | |||
325 | goto out_del_vqs; | 323 | goto out_del_vqs; |
326 | } | 324 | } |
327 | 325 | ||
328 | vb->tell_host_first | ||
329 | = virtio_has_feature(vdev, VIRTIO_BALLOON_F_MUST_TELL_HOST); | ||
330 | |||
331 | return 0; | 326 | return 0; |
332 | 327 | ||
333 | out_del_vqs: | 328 | out_del_vqs: |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index b0043fb26a4d..68b9136847af 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -82,6 +82,9 @@ struct vring_virtqueue | |||
82 | /* Host supports indirect buffers */ | 82 | /* Host supports indirect buffers */ |
83 | bool indirect; | 83 | bool indirect; |
84 | 84 | ||
85 | /* Host publishes avail event idx */ | ||
86 | bool event; | ||
87 | |||
85 | /* Number of free buffers */ | 88 | /* Number of free buffers */ |
86 | unsigned int num_free; | 89 | unsigned int num_free; |
87 | /* Head of free buffer list. */ | 90 | /* Head of free buffer list. */ |
@@ -237,18 +240,22 @@ EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp); | |||
237 | void virtqueue_kick(struct virtqueue *_vq) | 240 | void virtqueue_kick(struct virtqueue *_vq) |
238 | { | 241 | { |
239 | struct vring_virtqueue *vq = to_vvq(_vq); | 242 | struct vring_virtqueue *vq = to_vvq(_vq); |
243 | u16 new, old; | ||
240 | START_USE(vq); | 244 | START_USE(vq); |
241 | /* Descriptors and available array need to be set before we expose the | 245 | /* Descriptors and available array need to be set before we expose the |
242 | * new available array entries. */ | 246 | * new available array entries. */ |
243 | virtio_wmb(); | 247 | virtio_wmb(); |
244 | 248 | ||
245 | vq->vring.avail->idx += vq->num_added; | 249 | old = vq->vring.avail->idx; |
250 | new = vq->vring.avail->idx = old + vq->num_added; | ||
246 | vq->num_added = 0; | 251 | vq->num_added = 0; |
247 | 252 | ||
248 | /* Need to update avail index before checking if we should notify */ | 253 | /* Need to update avail index before checking if we should notify */ |
249 | virtio_mb(); | 254 | virtio_mb(); |
250 | 255 | ||
251 | if (!(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY)) | 256 | if (vq->event ? |
257 | vring_need_event(vring_avail_event(&vq->vring), new, old) : | ||
258 | !(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY)) | ||
252 | /* Prod other side to tell it about changes. */ | 259 | /* Prod other side to tell it about changes. */ |
253 | vq->notify(&vq->vq); | 260 | vq->notify(&vq->vq); |
254 | 261 | ||
@@ -324,6 +331,14 @@ void *virtqueue_get_buf(struct virtqueue *_vq, unsigned int *len) | |||
324 | ret = vq->data[i]; | 331 | ret = vq->data[i]; |
325 | detach_buf(vq, i); | 332 | detach_buf(vq, i); |
326 | vq->last_used_idx++; | 333 | vq->last_used_idx++; |
334 | /* If we expect an interrupt for the next entry, tell host | ||
335 | * by writing event index and flush out the write before | ||
336 | * the read in the next get_buf call. */ | ||
337 | if (!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) { | ||
338 | vring_used_event(&vq->vring) = vq->last_used_idx; | ||
339 | virtio_mb(); | ||
340 | } | ||
341 | |||
327 | END_USE(vq); | 342 | END_USE(vq); |
328 | return ret; | 343 | return ret; |
329 | } | 344 | } |
@@ -345,7 +360,11 @@ bool virtqueue_enable_cb(struct virtqueue *_vq) | |||
345 | 360 | ||
346 | /* We optimistically turn back on interrupts, then check if there was | 361 | /* We optimistically turn back on interrupts, then check if there was |
347 | * more to do. */ | 362 | * more to do. */ |
363 | /* Depending on the VIRTIO_RING_F_EVENT_IDX feature, we need to | ||
364 | * either clear the flags bit or point the event index at the next | ||
365 | * entry. Always do both to keep code simple. */ | ||
348 | vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; | 366 | vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; |
367 | vring_used_event(&vq->vring) = vq->last_used_idx; | ||
349 | virtio_mb(); | 368 | virtio_mb(); |
350 | if (unlikely(more_used(vq))) { | 369 | if (unlikely(more_used(vq))) { |
351 | END_USE(vq); | 370 | END_USE(vq); |
@@ -357,6 +376,33 @@ bool virtqueue_enable_cb(struct virtqueue *_vq) | |||
357 | } | 376 | } |
358 | EXPORT_SYMBOL_GPL(virtqueue_enable_cb); | 377 | EXPORT_SYMBOL_GPL(virtqueue_enable_cb); |
359 | 378 | ||
379 | bool virtqueue_enable_cb_delayed(struct virtqueue *_vq) | ||
380 | { | ||
381 | struct vring_virtqueue *vq = to_vvq(_vq); | ||
382 | u16 bufs; | ||
383 | |||
384 | START_USE(vq); | ||
385 | |||
386 | /* We optimistically turn back on interrupts, then check if there was | ||
387 | * more to do. */ | ||
388 | /* Depending on the VIRTIO_RING_F_USED_EVENT_IDX feature, we need to | ||
389 | * either clear the flags bit or point the event index at the next | ||
390 | * entry. Always do both to keep code simple. */ | ||
391 | vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; | ||
392 | /* TODO: tune this threshold */ | ||
393 | bufs = (u16)(vq->vring.avail->idx - vq->last_used_idx) * 3 / 4; | ||
394 | vring_used_event(&vq->vring) = vq->last_used_idx + bufs; | ||
395 | virtio_mb(); | ||
396 | if (unlikely((u16)(vq->vring.used->idx - vq->last_used_idx) > bufs)) { | ||
397 | END_USE(vq); | ||
398 | return false; | ||
399 | } | ||
400 | |||
401 | END_USE(vq); | ||
402 | return true; | ||
403 | } | ||
404 | EXPORT_SYMBOL_GPL(virtqueue_enable_cb_delayed); | ||
405 | |||
360 | void *virtqueue_detach_unused_buf(struct virtqueue *_vq) | 406 | void *virtqueue_detach_unused_buf(struct virtqueue *_vq) |
361 | { | 407 | { |
362 | struct vring_virtqueue *vq = to_vvq(_vq); | 408 | struct vring_virtqueue *vq = to_vvq(_vq); |
@@ -438,6 +484,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
438 | #endif | 484 | #endif |
439 | 485 | ||
440 | vq->indirect = virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC); | 486 | vq->indirect = virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC); |
487 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); | ||
441 | 488 | ||
442 | /* No callback? Tell other side not to bother us. */ | 489 | /* No callback? Tell other side not to bother us. */ |
443 | if (!callback) | 490 | if (!callback) |
@@ -472,6 +519,8 @@ void vring_transport_features(struct virtio_device *vdev) | |||
472 | switch (i) { | 519 | switch (i) { |
473 | case VIRTIO_RING_F_INDIRECT_DESC: | 520 | case VIRTIO_RING_F_INDIRECT_DESC: |
474 | break; | 521 | break; |
522 | case VIRTIO_RING_F_EVENT_IDX: | ||
523 | break; | ||
475 | default: | 524 | default: |
476 | /* We don't understand this bit. */ | 525 | /* We don't understand this bit. */ |
477 | clear_bit(i, vdev->features); | 526 | clear_bit(i, vdev->features); |
diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig index 00d615d7aa21..979d6eed9a0f 100644 --- a/drivers/w1/masters/Kconfig +++ b/drivers/w1/masters/Kconfig | |||
@@ -42,7 +42,7 @@ config W1_MASTER_MXC | |||
42 | 42 | ||
43 | config W1_MASTER_DS1WM | 43 | config W1_MASTER_DS1WM |
44 | tristate "Maxim DS1WM 1-wire busmaster" | 44 | tristate "Maxim DS1WM 1-wire busmaster" |
45 | depends on W1 | 45 | depends on W1 && GENERIC_HARDIRQS |
46 | help | 46 | help |
47 | Say Y here to enable the DS1WM 1-wire driver, such as that | 47 | Say Y here to enable the DS1WM 1-wire driver, such as that |
48 | in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like | 48 | in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 3ff822b48145..30df85d8fca8 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -395,9 +395,9 @@ static void unmask_evtchn(int port) | |||
395 | static void xen_irq_init(unsigned irq) | 395 | static void xen_irq_init(unsigned irq) |
396 | { | 396 | { |
397 | struct irq_info *info; | 397 | struct irq_info *info; |
398 | #ifdef CONFIG_SMP | ||
398 | struct irq_desc *desc = irq_to_desc(irq); | 399 | struct irq_desc *desc = irq_to_desc(irq); |
399 | 400 | ||
400 | #ifdef CONFIG_SMP | ||
401 | /* By default all event channels notify CPU#0. */ | 401 | /* By default all event channels notify CPU#0. */ |
402 | cpumask_copy(desc->irq_data.affinity, cpumask_of(0)); | 402 | cpumask_copy(desc->irq_data.affinity, cpumask_of(0)); |
403 | #endif | 403 | #endif |
@@ -626,6 +626,9 @@ int xen_allocate_pirq_gsi(unsigned gsi) | |||
626 | * | 626 | * |
627 | * Note: We don't assign an event channel until the irq actually started | 627 | * Note: We don't assign an event channel until the irq actually started |
628 | * up. Return an existing irq if we've already got one for the gsi. | 628 | * up. Return an existing irq if we've already got one for the gsi. |
629 | * | ||
630 | * Shareable implies level triggered, not shareable implies edge | ||
631 | * triggered here. | ||
629 | */ | 632 | */ |
630 | int xen_bind_pirq_gsi_to_irq(unsigned gsi, | 633 | int xen_bind_pirq_gsi_to_irq(unsigned gsi, |
631 | unsigned pirq, int shareable, char *name) | 634 | unsigned pirq, int shareable, char *name) |
@@ -664,16 +667,13 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi, | |||
664 | 667 | ||
665 | pirq_query_unmask(irq); | 668 | pirq_query_unmask(irq); |
666 | /* We try to use the handler with the appropriate semantic for the | 669 | /* We try to use the handler with the appropriate semantic for the |
667 | * type of interrupt: if the interrupt doesn't need an eoi | 670 | * type of interrupt: if the interrupt is an edge triggered |
668 | * (pirq_needs_eoi returns false), we treat it like an edge | 671 | * interrupt we use handle_edge_irq. |
669 | * triggered interrupt so we use handle_edge_irq. | ||
670 | * As a matter of fact this only happens when the corresponding | ||
671 | * physical interrupt is edge triggered or an msi. | ||
672 | * | 672 | * |
673 | * On the other hand if the interrupt needs an eoi (pirq_needs_eoi | 673 | * On the other hand if the interrupt is level triggered we use |
674 | * returns true) we treat it like a level triggered interrupt so we | 674 | * handle_fasteoi_irq like the native code does for this kind of |
675 | * use handle_fasteoi_irq like the native code does for this kind of | ||
676 | * interrupts. | 675 | * interrupts. |
676 | * | ||
677 | * Depending on the Xen version, pirq_needs_eoi might return true | 677 | * Depending on the Xen version, pirq_needs_eoi might return true |
678 | * not only for level triggered interrupts but for edge triggered | 678 | * not only for level triggered interrupts but for edge triggered |
679 | * interrupts too. In any case Xen always honors the eoi mechanism, | 679 | * interrupts too. In any case Xen always honors the eoi mechanism, |
@@ -681,7 +681,7 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi, | |||
681 | * hasn't received an eoi yet. Therefore using the fasteoi handler | 681 | * hasn't received an eoi yet. Therefore using the fasteoi handler |
682 | * is the right choice either way. | 682 | * is the right choice either way. |
683 | */ | 683 | */ |
684 | if (pirq_needs_eoi(irq)) | 684 | if (shareable) |
685 | irq_set_chip_and_handler_name(irq, &xen_pirq_chip, | 685 | irq_set_chip_and_handler_name(irq, &xen_pirq_chip, |
686 | handle_fasteoi_irq, name); | 686 | handle_fasteoi_irq, name); |
687 | else | 687 | else |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 65ea21a97492..6e8c15a23201 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
@@ -147,9 +147,15 @@ void __init xen_swiotlb_init(int verbose) | |||
147 | { | 147 | { |
148 | unsigned long bytes; | 148 | unsigned long bytes; |
149 | int rc; | 149 | int rc; |
150 | 150 | unsigned long nr_tbl; | |
151 | xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT); | 151 | |
152 | xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE); | 152 | nr_tbl = swioltb_nr_tbl(); |
153 | if (nr_tbl) | ||
154 | xen_io_tlb_nslabs = nr_tbl; | ||
155 | else { | ||
156 | xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT); | ||
157 | xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE); | ||
158 | } | ||
153 | 159 | ||
154 | bytes = xen_io_tlb_nslabs << IO_TLB_SHIFT; | 160 | bytes = xen_io_tlb_nslabs << IO_TLB_SHIFT; |
155 | 161 | ||