diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-11-08 11:51:52 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-11-08 11:51:52 -0500 |
commit | fa8e2458ecfc959cd627e25ba86d8eddcb63c887 (patch) | |
tree | d8c9dec3dac8e97e8591e6507a619959449d6344 /drivers | |
parent | d56a289be2ce01d1aa426a6cf45dede14a8db41e (diff) | |
parent | 3d70f8c617a436c7146ecb81df2265b4626dfe89 (diff) |
Merge tag 'v3.7-rc4' into next to sync up Wacom bits
Linux 3.7-rc4
Diffstat (limited to 'drivers')
103 files changed, 1038 insertions, 610 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f94d4c818fc..0230cb6cbb3 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1345,12 +1345,15 @@ static int | |||
1345 | acpi_video_bus_get_devices(struct acpi_video_bus *video, | 1345 | acpi_video_bus_get_devices(struct acpi_video_bus *video, |
1346 | struct acpi_device *device) | 1346 | struct acpi_device *device) |
1347 | { | 1347 | { |
1348 | int status; | 1348 | int status = 0; |
1349 | struct acpi_device *dev; | 1349 | struct acpi_device *dev; |
1350 | 1350 | ||
1351 | status = acpi_video_device_enumerate(video); | 1351 | /* |
1352 | if (status) | 1352 | * There are systems where video module known to work fine regardless |
1353 | return status; | 1353 | * of broken _DOD and ignoring returned value here doesn't cause |
1354 | * any issues later. | ||
1355 | */ | ||
1356 | acpi_video_device_enumerate(video); | ||
1354 | 1357 | ||
1355 | list_for_each_entry(dev, &device->children, node) { | 1358 | list_for_each_entry(dev, &device->children, node) { |
1356 | 1359 | ||
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index f529407db93..824e09c4d0d 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -131,6 +131,7 @@ config BLK_CPQ_DA | |||
131 | config BLK_CPQ_CISS_DA | 131 | config BLK_CPQ_CISS_DA |
132 | tristate "Compaq Smart Array 5xxx support" | 132 | tristate "Compaq Smart Array 5xxx support" |
133 | depends on PCI | 133 | depends on PCI |
134 | select CHECK_SIGNATURE | ||
134 | help | 135 | help |
135 | This is the driver for Compaq Smart Array 5xxx controllers. | 136 | This is the driver for Compaq Smart Array 5xxx controllers. |
136 | Everyone using these boards should say Y here. | 137 | Everyone using these boards should say Y here. |
@@ -166,8 +167,8 @@ config BLK_DEV_DAC960 | |||
166 | module will be called DAC960. | 167 | module will be called DAC960. |
167 | 168 | ||
168 | config BLK_DEV_UMEM | 169 | config BLK_DEV_UMEM |
169 | tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)" | 170 | tristate "Micro Memory MM5415 Battery Backed RAM support" |
170 | depends on PCI && EXPERIMENTAL | 171 | depends on PCI |
171 | ---help--- | 172 | ---help--- |
172 | Saying Y here will include support for the MM5415 family of | 173 | Saying Y here will include support for the MM5415 family of |
173 | battery backed (Non-volatile) RAM cards. | 174 | battery backed (Non-volatile) RAM cards. |
@@ -430,8 +431,8 @@ config CDROM_PKTCDVD_BUFFERS | |||
430 | a disc is opened for writing. | 431 | a disc is opened for writing. |
431 | 432 | ||
432 | config CDROM_PKTCDVD_WCACHE | 433 | config CDROM_PKTCDVD_WCACHE |
433 | bool "Enable write caching (EXPERIMENTAL)" | 434 | bool "Enable write caching" |
434 | depends on CDROM_PKTCDVD && EXPERIMENTAL | 435 | depends on CDROM_PKTCDVD |
435 | help | 436 | help |
436 | If enabled, write caching will be set for the CD-R/W device. For now | 437 | If enabled, write caching will be set for the CD-R/W device. For now |
437 | this option is dangerous unless the CD-RW media is known good, as we | 438 | this option is dangerous unless the CD-RW media is known good, as we |
@@ -508,8 +509,8 @@ config XEN_BLKDEV_BACKEND | |||
508 | 509 | ||
509 | 510 | ||
510 | config VIRTIO_BLK | 511 | config VIRTIO_BLK |
511 | tristate "Virtio block driver (EXPERIMENTAL)" | 512 | tristate "Virtio block driver" |
512 | depends on EXPERIMENTAL && VIRTIO | 513 | depends on VIRTIO |
513 | ---help--- | 514 | ---help--- |
514 | This is the virtual block driver for virtio. It can be used with | 515 | This is the virtual block driver for virtio. It can be used with |
515 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. | 516 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. |
@@ -528,7 +529,7 @@ config BLK_DEV_HD | |||
528 | 529 | ||
529 | config BLK_DEV_RBD | 530 | config BLK_DEV_RBD |
530 | tristate "Rados block device (RBD)" | 531 | tristate "Rados block device (RBD)" |
531 | depends on INET && EXPERIMENTAL && BLOCK | 532 | depends on INET && BLOCK |
532 | select CEPH_LIB | 533 | select CEPH_LIB |
533 | select LIBCRC32C | 534 | select LIBCRC32C |
534 | select CRYPTO_AES | 535 | select CRYPTO_AES |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index b0f553b26d0..ca83f96756a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -5205,7 +5205,6 @@ static void cciss_shutdown(struct pci_dev *pdev) | |||
5205 | return; | 5205 | return; |
5206 | } | 5206 | } |
5207 | /* write all data in the battery backed cache to disk */ | 5207 | /* write all data in the battery backed cache to disk */ |
5208 | memset(flush_buf, 0, 4); | ||
5209 | return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf, | 5208 | return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf, |
5210 | 4, 0, CTLR_LUNID, TYPE_CMD); | 5209 | 4, 0, CTLR_LUNID, TYPE_CMD); |
5211 | kfree(flush_buf); | 5210 | kfree(flush_buf); |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 17c675c5229..1c49d717396 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4109,12 +4109,19 @@ static struct platform_driver floppy_driver = { | |||
4109 | 4109 | ||
4110 | static struct platform_device floppy_device[N_DRIVE]; | 4110 | static struct platform_device floppy_device[N_DRIVE]; |
4111 | 4111 | ||
4112 | static bool floppy_available(int drive) | ||
4113 | { | ||
4114 | if (!(allowed_drive_mask & (1 << drive))) | ||
4115 | return false; | ||
4116 | if (fdc_state[FDC(drive)].version == FDC_NONE) | ||
4117 | return false; | ||
4118 | return true; | ||
4119 | } | ||
4120 | |||
4112 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) | 4121 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) |
4113 | { | 4122 | { |
4114 | int drive = (*part & 3) | ((*part & 0x80) >> 5); | 4123 | int drive = (*part & 3) | ((*part & 0x80) >> 5); |
4115 | if (drive >= N_DRIVE || | 4124 | if (drive >= N_DRIVE || !floppy_available(drive)) |
4116 | !(allowed_drive_mask & (1 << drive)) || | ||
4117 | fdc_state[FDC(drive)].version == FDC_NONE) | ||
4118 | return NULL; | 4125 | return NULL; |
4119 | if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type)) | 4126 | if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type)) |
4120 | return NULL; | 4127 | return NULL; |
@@ -4124,8 +4131,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data) | |||
4124 | 4131 | ||
4125 | static int __init do_floppy_init(void) | 4132 | static int __init do_floppy_init(void) |
4126 | { | 4133 | { |
4127 | int i, unit, drive; | 4134 | int i, unit, drive, err; |
4128 | int err, dr; | ||
4129 | 4135 | ||
4130 | set_debugt(); | 4136 | set_debugt(); |
4131 | interruptjiffies = resultjiffies = jiffies; | 4137 | interruptjiffies = resultjiffies = jiffies; |
@@ -4137,34 +4143,32 @@ static int __init do_floppy_init(void) | |||
4137 | 4143 | ||
4138 | raw_cmd = NULL; | 4144 | raw_cmd = NULL; |
4139 | 4145 | ||
4140 | for (dr = 0; dr < N_DRIVE; dr++) { | 4146 | floppy_wq = alloc_ordered_workqueue("floppy", 0); |
4141 | disks[dr] = alloc_disk(1); | 4147 | if (!floppy_wq) |
4142 | if (!disks[dr]) { | 4148 | return -ENOMEM; |
4143 | err = -ENOMEM; | ||
4144 | goto out_put_disk; | ||
4145 | } | ||
4146 | 4149 | ||
4147 | floppy_wq = alloc_ordered_workqueue("floppy", 0); | 4150 | for (drive = 0; drive < N_DRIVE; drive++) { |
4148 | if (!floppy_wq) { | 4151 | disks[drive] = alloc_disk(1); |
4152 | if (!disks[drive]) { | ||
4149 | err = -ENOMEM; | 4153 | err = -ENOMEM; |
4150 | goto out_put_disk; | 4154 | goto out_put_disk; |
4151 | } | 4155 | } |
4152 | 4156 | ||
4153 | disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock); | 4157 | disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock); |
4154 | if (!disks[dr]->queue) { | 4158 | if (!disks[drive]->queue) { |
4155 | err = -ENOMEM; | 4159 | err = -ENOMEM; |
4156 | goto out_destroy_workq; | 4160 | goto out_put_disk; |
4157 | } | 4161 | } |
4158 | 4162 | ||
4159 | blk_queue_max_hw_sectors(disks[dr]->queue, 64); | 4163 | blk_queue_max_hw_sectors(disks[drive]->queue, 64); |
4160 | disks[dr]->major = FLOPPY_MAJOR; | 4164 | disks[drive]->major = FLOPPY_MAJOR; |
4161 | disks[dr]->first_minor = TOMINOR(dr); | 4165 | disks[drive]->first_minor = TOMINOR(drive); |
4162 | disks[dr]->fops = &floppy_fops; | 4166 | disks[drive]->fops = &floppy_fops; |
4163 | sprintf(disks[dr]->disk_name, "fd%d", dr); | 4167 | sprintf(disks[drive]->disk_name, "fd%d", drive); |
4164 | 4168 | ||
4165 | init_timer(&motor_off_timer[dr]); | 4169 | init_timer(&motor_off_timer[drive]); |
4166 | motor_off_timer[dr].data = dr; | 4170 | motor_off_timer[drive].data = drive; |
4167 | motor_off_timer[dr].function = motor_off_callback; | 4171 | motor_off_timer[drive].function = motor_off_callback; |
4168 | } | 4172 | } |
4169 | 4173 | ||
4170 | err = register_blkdev(FLOPPY_MAJOR, "fd"); | 4174 | err = register_blkdev(FLOPPY_MAJOR, "fd"); |
@@ -4282,9 +4286,7 @@ static int __init do_floppy_init(void) | |||
4282 | } | 4286 | } |
4283 | 4287 | ||
4284 | for (drive = 0; drive < N_DRIVE; drive++) { | 4288 | for (drive = 0; drive < N_DRIVE; drive++) { |
4285 | if (!(allowed_drive_mask & (1 << drive))) | 4289 | if (!floppy_available(drive)) |
4286 | continue; | ||
4287 | if (fdc_state[FDC(drive)].version == FDC_NONE) | ||
4288 | continue; | 4290 | continue; |
4289 | 4291 | ||
4290 | floppy_device[drive].name = floppy_device_name; | 4292 | floppy_device[drive].name = floppy_device_name; |
@@ -4293,7 +4295,7 @@ static int __init do_floppy_init(void) | |||
4293 | 4295 | ||
4294 | err = platform_device_register(&floppy_device[drive]); | 4296 | err = platform_device_register(&floppy_device[drive]); |
4295 | if (err) | 4297 | if (err) |
4296 | goto out_release_dma; | 4298 | goto out_remove_drives; |
4297 | 4299 | ||
4298 | err = device_create_file(&floppy_device[drive].dev, | 4300 | err = device_create_file(&floppy_device[drive].dev, |
4299 | &dev_attr_cmos); | 4301 | &dev_attr_cmos); |
@@ -4311,29 +4313,34 @@ static int __init do_floppy_init(void) | |||
4311 | 4313 | ||
4312 | out_unreg_platform_dev: | 4314 | out_unreg_platform_dev: |
4313 | platform_device_unregister(&floppy_device[drive]); | 4315 | platform_device_unregister(&floppy_device[drive]); |
4316 | out_remove_drives: | ||
4317 | while (drive--) { | ||
4318 | if (floppy_available(drive)) { | ||
4319 | del_gendisk(disks[drive]); | ||
4320 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); | ||
4321 | platform_device_unregister(&floppy_device[drive]); | ||
4322 | } | ||
4323 | } | ||
4314 | out_release_dma: | 4324 | out_release_dma: |
4315 | if (atomic_read(&usage_count)) | 4325 | if (atomic_read(&usage_count)) |
4316 | floppy_release_irq_and_dma(); | 4326 | floppy_release_irq_and_dma(); |
4317 | out_unreg_region: | 4327 | out_unreg_region: |
4318 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 4328 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
4319 | platform_driver_unregister(&floppy_driver); | 4329 | platform_driver_unregister(&floppy_driver); |
4320 | out_destroy_workq: | ||
4321 | destroy_workqueue(floppy_wq); | ||
4322 | out_unreg_blkdev: | 4330 | out_unreg_blkdev: |
4323 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4331 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4324 | out_put_disk: | 4332 | out_put_disk: |
4325 | while (dr--) { | 4333 | for (drive = 0; drive < N_DRIVE; drive++) { |
4326 | del_timer_sync(&motor_off_timer[dr]); | 4334 | if (!disks[drive]) |
4327 | if (disks[dr]->queue) { | 4335 | break; |
4328 | blk_cleanup_queue(disks[dr]->queue); | 4336 | if (disks[drive]->queue) { |
4329 | /* | 4337 | del_timer_sync(&motor_off_timer[drive]); |
4330 | * put_disk() is not paired with add_disk() and | 4338 | blk_cleanup_queue(disks[drive]->queue); |
4331 | * will put queue reference one extra time. fix it. | 4339 | disks[drive]->queue = NULL; |
4332 | */ | ||
4333 | disks[dr]->queue = NULL; | ||
4334 | } | 4340 | } |
4335 | put_disk(disks[dr]); | 4341 | put_disk(disks[drive]); |
4336 | } | 4342 | } |
4343 | destroy_workqueue(floppy_wq); | ||
4337 | return err; | 4344 | return err; |
4338 | } | 4345 | } |
4339 | 4346 | ||
@@ -4551,8 +4558,7 @@ static void __exit floppy_module_exit(void) | |||
4551 | for (drive = 0; drive < N_DRIVE; drive++) { | 4558 | for (drive = 0; drive < N_DRIVE; drive++) { |
4552 | del_timer_sync(&motor_off_timer[drive]); | 4559 | del_timer_sync(&motor_off_timer[drive]); |
4553 | 4560 | ||
4554 | if ((allowed_drive_mask & (1 << drive)) && | 4561 | if (floppy_available(drive)) { |
4555 | fdc_state[FDC(drive)].version != FDC_NONE) { | ||
4556 | del_gendisk(disks[drive]); | 4562 | del_gendisk(disks[drive]); |
4557 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); | 4563 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); |
4558 | platform_device_unregister(&floppy_device[drive]); | 4564 | platform_device_unregister(&floppy_device[drive]); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e9d594fd12c..54046e51160 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo) | |||
976 | if (lo->lo_state != Lo_bound) | 976 | if (lo->lo_state != Lo_bound) |
977 | return -ENXIO; | 977 | return -ENXIO; |
978 | 978 | ||
979 | if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ | 979 | /* |
980 | return -EBUSY; | 980 | * If we've explicitly asked to tear down the loop device, |
981 | * and it has an elevated reference count, set it for auto-teardown when | ||
982 | * the last reference goes away. This stops $!~#$@ udev from | ||
983 | * preventing teardown because it decided that it needs to run blkid on | ||
984 | * the loopback device whenever they appear. xfstests is notorious for | ||
985 | * failing tests because blkid via udev races with a losetup | ||
986 | * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d | ||
987 | * command to fail with EBUSY. | ||
988 | */ | ||
989 | if (lo->lo_refcnt > 1) { | ||
990 | lo->lo_flags |= LO_FLAGS_AUTOCLEAR; | ||
991 | mutex_unlock(&lo->lo_ctl_mutex); | ||
992 | return 0; | ||
993 | } | ||
981 | 994 | ||
982 | if (filp == NULL) | 995 | if (filp == NULL) |
983 | return -EINVAL; | 996 | return -EINVAL; |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index f946d31d691..adc6f36564c 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -2035,8 +2035,9 @@ static unsigned int implicit_sector(unsigned char command, | |||
2035 | } | 2035 | } |
2036 | return rv; | 2036 | return rv; |
2037 | } | 2037 | } |
2038 | 2038 | static void mtip_set_timeout(struct driver_data *dd, | |
2039 | static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) | 2039 | struct host_to_dev_fis *fis, |
2040 | unsigned int *timeout, u8 erasemode) | ||
2040 | { | 2041 | { |
2041 | switch (fis->command) { | 2042 | switch (fis->command) { |
2042 | case ATA_CMD_DOWNLOAD_MICRO: | 2043 | case ATA_CMD_DOWNLOAD_MICRO: |
@@ -2044,7 +2045,10 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) | |||
2044 | break; | 2045 | break; |
2045 | case ATA_CMD_SEC_ERASE_UNIT: | 2046 | case ATA_CMD_SEC_ERASE_UNIT: |
2046 | case 0xFC: | 2047 | case 0xFC: |
2047 | *timeout = 240000; /* 4 minutes */ | 2048 | if (erasemode) |
2049 | *timeout = ((*(dd->port->identify + 90) * 2) * 60000); | ||
2050 | else | ||
2051 | *timeout = ((*(dd->port->identify + 89) * 2) * 60000); | ||
2048 | break; | 2052 | break; |
2049 | case ATA_CMD_STANDBYNOW1: | 2053 | case ATA_CMD_STANDBYNOW1: |
2050 | *timeout = 120000; /* 2 minutes */ | 2054 | *timeout = 120000; /* 2 minutes */ |
@@ -2087,6 +2091,7 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
2087 | unsigned int transfer_size; | 2091 | unsigned int transfer_size; |
2088 | unsigned long task_file_data; | 2092 | unsigned long task_file_data; |
2089 | int intotal = outtotal + req_task->out_size; | 2093 | int intotal = outtotal + req_task->out_size; |
2094 | int erasemode = 0; | ||
2090 | 2095 | ||
2091 | taskout = req_task->out_size; | 2096 | taskout = req_task->out_size; |
2092 | taskin = req_task->in_size; | 2097 | taskin = req_task->in_size; |
@@ -2212,7 +2217,13 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
2212 | fis.lba_hi, | 2217 | fis.lba_hi, |
2213 | fis.device); | 2218 | fis.device); |
2214 | 2219 | ||
2215 | mtip_set_timeout(&fis, &timeout); | 2220 | /* check for erase mode support during secure erase.*/ |
2221 | if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) | ||
2222 | && (outbuf[0] & MTIP_SEC_ERASE_MODE)) { | ||
2223 | erasemode = 1; | ||
2224 | } | ||
2225 | |||
2226 | mtip_set_timeout(dd, &fis, &timeout, erasemode); | ||
2216 | 2227 | ||
2217 | /* Determine the correct transfer size.*/ | 2228 | /* Determine the correct transfer size.*/ |
2218 | if (force_single_sector) | 2229 | if (force_single_sector) |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 18627a1d04c..5f4a917bd8b 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -33,6 +33,9 @@ | |||
33 | /* offset of Device Control register in PCIe extended capabilites space */ | 33 | /* offset of Device Control register in PCIe extended capabilites space */ |
34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 | 34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 |
35 | 35 | ||
36 | /* check for erase mode support during secure erase */ | ||
37 | #define MTIP_SEC_ERASE_MODE 0x3 | ||
38 | |||
36 | /* # of times to retry timed out/failed IOs */ | 39 | /* # of times to retry timed out/failed IOs */ |
37 | #define MTIP_MAX_RETRIES 2 | 40 | #define MTIP_MAX_RETRIES 2 |
38 | 41 | ||
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 9ad3b5ec1dc..9a54623e52d 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -158,8 +158,8 @@ struct xen_vbd { | |||
158 | struct block_device *bdev; | 158 | struct block_device *bdev; |
159 | /* Cached size parameter. */ | 159 | /* Cached size parameter. */ |
160 | sector_t size; | 160 | sector_t size; |
161 | bool flush_support; | 161 | unsigned int flush_support:1; |
162 | bool discard_secure; | 162 | unsigned int discard_secure:1; |
163 | }; | 163 | }; |
164 | 164 | ||
165 | struct backend_info; | 165 | struct backend_info; |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 4f66171c668..f58434c2617 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) | |||
105 | { | 105 | { |
106 | struct xen_blkif *blkif; | 106 | struct xen_blkif *blkif; |
107 | 107 | ||
108 | blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL); | 108 | blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL); |
109 | if (!blkif) | 109 | if (!blkif) |
110 | return ERR_PTR(-ENOMEM); | 110 | return ERR_PTR(-ENOMEM); |
111 | 111 | ||
112 | memset(blkif, 0, sizeof(*blkif)); | ||
113 | blkif->domid = domid; | 112 | blkif->domid = domid; |
114 | spin_lock_init(&blkif->blk_ring_lock); | 113 | spin_lock_init(&blkif->blk_ring_lock); |
115 | atomic_set(&blkif->refcnt, 1); | 114 | atomic_set(&blkif->refcnt, 1); |
@@ -196,7 +195,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif) | |||
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | void xen_blkif_free(struct xen_blkif *blkif) | 198 | static void xen_blkif_free(struct xen_blkif *blkif) |
200 | { | 199 | { |
201 | if (!atomic_dec_and_test(&blkif->refcnt)) | 200 | if (!atomic_dec_and_test(&blkif->refcnt)) |
202 | BUG(); | 201 | BUG(); |
@@ -257,7 +256,7 @@ static struct attribute_group xen_vbdstat_group = { | |||
257 | VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); | 256 | VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); |
258 | VBD_SHOW(mode, "%s\n", be->mode); | 257 | VBD_SHOW(mode, "%s\n", be->mode); |
259 | 258 | ||
260 | int xenvbd_sysfs_addif(struct xenbus_device *dev) | 259 | static int xenvbd_sysfs_addif(struct xenbus_device *dev) |
261 | { | 260 | { |
262 | int error; | 261 | int error; |
263 | 262 | ||
@@ -281,7 +280,7 @@ fail1: device_remove_file(&dev->dev, &dev_attr_physical_device); | |||
281 | return error; | 280 | return error; |
282 | } | 281 | } |
283 | 282 | ||
284 | void xenvbd_sysfs_delif(struct xenbus_device *dev) | 283 | static void xenvbd_sysfs_delif(struct xenbus_device *dev) |
285 | { | 284 | { |
286 | sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); | 285 | sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); |
287 | device_remove_file(&dev->dev, &dev_attr_mode); | 286 | device_remove_file(&dev->dev, &dev_attr_mode); |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index c16a3a593ba..e3ebb4fa2c3 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
6 | * | 6 | * |
7 | * Maintainer: | 7 | * Maintainer: |
8 | * Andreas Herrmann <andreas.herrmann3@amd.com> | 8 | * Andreas Herrmann <herrmann.der.user@googlemail.com> |
9 | * | 9 | * |
10 | * Based on the powernow-k7.c module written by Dave Jones. | 10 | * Based on the powernow-k7.c module written by Dave Jones. |
11 | * (C) 2003 Dave Jones on behalf of SuSE Labs | 11 | * (C) 2003 Dave Jones on behalf of SuSE Labs |
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index ed3e55161bd..f05e54258ff 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c | |||
@@ -153,7 +153,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; | 155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; |
156 | chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL); | 156 | chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL); |
157 | if (!chip->buffer) { | 157 | if (!chip->buffer) { |
158 | ret = -ENOMEM; | 158 | ret = -ENOMEM; |
159 | goto exit_destroy; | 159 | goto exit_destroy; |
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 7a874129e5d..cf7afb9eb61 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -244,6 +244,8 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, | |||
244 | if (ret) | 244 | if (ret) |
245 | return ret; | 245 | return ret; |
246 | 246 | ||
247 | mvebu_gpio_set(chip, pin, value); | ||
248 | |||
247 | spin_lock_irqsave(&mvchip->lock, flags); | 249 | spin_lock_irqsave(&mvchip->lock, flags); |
248 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); | 250 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); |
249 | u &= ~(1 << pin); | 251 | u &= ~(1 << pin); |
@@ -644,7 +646,7 @@ static int __devinit mvebu_gpio_probe(struct platform_device *pdev) | |||
644 | ct->handler = handle_edge_irq; | 646 | ct->handler = handle_edge_irq; |
645 | ct->chip.name = mvchip->chip.label; | 647 | ct->chip.name = mvchip->chip.label; |
646 | 648 | ||
647 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE, | 649 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0, |
648 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); | 650 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); |
649 | 651 | ||
650 | /* Setup irq domain on top of the generic chip. */ | 652 | /* Setup irq domain on top of the generic chip. */ |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94cbc842fbc..d335af1d4d8 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -251,6 +251,40 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio, | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /** | ||
255 | * _clear_gpio_debounce - clear debounce settings for a gpio | ||
256 | * @bank: the gpio bank we're acting upon | ||
257 | * @gpio: the gpio number on this @gpio | ||
258 | * | ||
259 | * If a gpio is using debounce, then clear the debounce enable bit and if | ||
260 | * this is the only gpio in this bank using debounce, then clear the debounce | ||
261 | * time too. The debounce clock will also be disabled when calling this function | ||
262 | * if this is the only gpio in the bank using debounce. | ||
263 | */ | ||
264 | static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio) | ||
265 | { | ||
266 | u32 gpio_bit = GPIO_BIT(bank, gpio); | ||
267 | |||
268 | if (!bank->dbck_flag) | ||
269 | return; | ||
270 | |||
271 | if (!(bank->dbck_enable_mask & gpio_bit)) | ||
272 | return; | ||
273 | |||
274 | bank->dbck_enable_mask &= ~gpio_bit; | ||
275 | bank->context.debounce_en &= ~gpio_bit; | ||
276 | __raw_writel(bank->context.debounce_en, | ||
277 | bank->base + bank->regs->debounce_en); | ||
278 | |||
279 | if (!bank->dbck_enable_mask) { | ||
280 | bank->context.debounce = 0; | ||
281 | __raw_writel(bank->context.debounce, bank->base + | ||
282 | bank->regs->debounce); | ||
283 | clk_disable(bank->dbck); | ||
284 | bank->dbck_enabled = false; | ||
285 | } | ||
286 | } | ||
287 | |||
254 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, | 288 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, |
255 | unsigned trigger) | 289 | unsigned trigger) |
256 | { | 290 | { |
@@ -539,6 +573,7 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio) | |||
539 | _set_gpio_irqenable(bank, gpio, 0); | 573 | _set_gpio_irqenable(bank, gpio, 0); |
540 | _clear_gpio_irqstatus(bank, gpio); | 574 | _clear_gpio_irqstatus(bank, gpio); |
541 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); | 575 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); |
576 | _clear_gpio_debounce(bank, gpio); | ||
542 | } | 577 | } |
543 | 578 | ||
544 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ | 579 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ |
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c index 031c6adf5b6..1a3e2b9b477 100644 --- a/drivers/gpio/gpio-timberdale.c +++ b/drivers/gpio/gpio-timberdale.c | |||
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d) | |||
116 | unsigned long flags; | 116 | unsigned long flags; |
117 | 117 | ||
118 | spin_lock_irqsave(&tgpio->lock, flags); | 118 | spin_lock_irqsave(&tgpio->lock, flags); |
119 | tgpio->last_ier &= ~(1 << offset); | 119 | tgpio->last_ier &= ~(1UL << offset); |
120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
121 | spin_unlock_irqrestore(&tgpio->lock, flags); | 121 | spin_unlock_irqrestore(&tgpio->lock, flags); |
122 | } | 122 | } |
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d) | |||
128 | unsigned long flags; | 128 | unsigned long flags; |
129 | 129 | ||
130 | spin_lock_irqsave(&tgpio->lock, flags); | 130 | spin_lock_irqsave(&tgpio->lock, flags); |
131 | tgpio->last_ier |= 1 << offset; | 131 | tgpio->last_ier |= 1UL << offset; |
132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
133 | spin_unlock_irqrestore(&tgpio->lock, flags); | 133 | spin_unlock_irqrestore(&tgpio->lock, flags); |
134 | } | 134 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5d6c71edc73..1c8d9e3380e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class, | |||
623 | */ | 623 | */ |
624 | 624 | ||
625 | status = gpio_request(gpio, "sysfs"); | 625 | status = gpio_request(gpio, "sysfs"); |
626 | if (status < 0) | 626 | if (status < 0) { |
627 | if (status == -EPROBE_DEFER) | ||
628 | status = -ENODEV; | ||
627 | goto done; | 629 | goto done; |
628 | 630 | } | |
629 | status = gpio_export(gpio, true); | 631 | status = gpio_export(gpio, true); |
630 | if (status < 0) | 632 | if (status < 0) |
631 | gpio_free(gpio); | 633 | gpio_free(gpio); |
@@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label) | |||
1191 | 1193 | ||
1192 | spin_lock_irqsave(&gpio_lock, flags); | 1194 | spin_lock_irqsave(&gpio_lock, flags); |
1193 | 1195 | ||
1194 | if (!gpio_is_valid(gpio)) | 1196 | if (!gpio_is_valid(gpio)) { |
1197 | status = -EINVAL; | ||
1195 | goto done; | 1198 | goto done; |
1199 | } | ||
1196 | desc = &gpio_desc[gpio]; | 1200 | desc = &gpio_desc[gpio]; |
1197 | chip = desc->chip; | 1201 | chip = desc->chip; |
1198 | if (chip == NULL) | 1202 | if (chip == NULL) |
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 59a26e577b5..fc345d4ebb0 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DRM_EXYNOS | 1 | config DRM_EXYNOS |
2 | tristate "DRM Support for Samsung SoC EXYNOS Series" | 2 | tristate "DRM Support for Samsung SoC EXYNOS Series" |
3 | depends on DRM && PLAT_SAMSUNG | 3 | depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) |
4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
5 | select FB_CFB_FILLRECT | 5 | select FB_CFB_FILLRECT |
6 | select FB_CFB_COPYAREA | 6 | select FB_CFB_COPYAREA |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 18c271862ca..0f68a287267 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
@@ -374,6 +374,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
374 | exynos_connector->encoder_id = encoder->base.id; | 374 | exynos_connector->encoder_id = encoder->base.id; |
375 | exynos_connector->manager = manager; | 375 | exynos_connector->manager = manager; |
376 | exynos_connector->dpms = DRM_MODE_DPMS_OFF; | 376 | exynos_connector->dpms = DRM_MODE_DPMS_OFF; |
377 | connector->dpms = DRM_MODE_DPMS_OFF; | ||
377 | connector->encoder = encoder; | 378 | connector->encoder = encoder; |
378 | 379 | ||
379 | err = drm_mode_connector_attach_encoder(connector, encoder); | 380 | err = drm_mode_connector_attach_encoder(connector, encoder); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index e51503fbaf2..241ad1eeec6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
@@ -43,12 +43,14 @@ | |||
43 | * @manager: specific encoder has its own manager to control a hardware | 43 | * @manager: specific encoder has its own manager to control a hardware |
44 | * appropriately and we can access a hardware drawing on this manager. | 44 | * appropriately and we can access a hardware drawing on this manager. |
45 | * @dpms: store the encoder dpms value. | 45 | * @dpms: store the encoder dpms value. |
46 | * @updated: indicate whether overlay data updating is needed or not. | ||
46 | */ | 47 | */ |
47 | struct exynos_drm_encoder { | 48 | struct exynos_drm_encoder { |
48 | struct drm_crtc *old_crtc; | 49 | struct drm_crtc *old_crtc; |
49 | struct drm_encoder drm_encoder; | 50 | struct drm_encoder drm_encoder; |
50 | struct exynos_drm_manager *manager; | 51 | struct exynos_drm_manager *manager; |
51 | int dpms; | 52 | int dpms; |
53 | bool updated; | ||
52 | }; | 54 | }; |
53 | 55 | ||
54 | static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) | 56 | static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) |
@@ -85,7 +87,9 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
85 | switch (mode) { | 87 | switch (mode) { |
86 | case DRM_MODE_DPMS_ON: | 88 | case DRM_MODE_DPMS_ON: |
87 | if (manager_ops && manager_ops->apply) | 89 | if (manager_ops && manager_ops->apply) |
88 | manager_ops->apply(manager->dev); | 90 | if (!exynos_encoder->updated) |
91 | manager_ops->apply(manager->dev); | ||
92 | |||
89 | exynos_drm_connector_power(encoder, mode); | 93 | exynos_drm_connector_power(encoder, mode); |
90 | exynos_encoder->dpms = mode; | 94 | exynos_encoder->dpms = mode; |
91 | break; | 95 | break; |
@@ -94,6 +98,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
94 | case DRM_MODE_DPMS_OFF: | 98 | case DRM_MODE_DPMS_OFF: |
95 | exynos_drm_connector_power(encoder, mode); | 99 | exynos_drm_connector_power(encoder, mode); |
96 | exynos_encoder->dpms = mode; | 100 | exynos_encoder->dpms = mode; |
101 | exynos_encoder->updated = false; | ||
97 | break; | 102 | break; |
98 | default: | 103 | default: |
99 | DRM_ERROR("unspecified mode %d\n", mode); | 104 | DRM_ERROR("unspecified mode %d\n", mode); |
@@ -205,13 +210,22 @@ static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) | |||
205 | 210 | ||
206 | static void exynos_drm_encoder_commit(struct drm_encoder *encoder) | 211 | static void exynos_drm_encoder_commit(struct drm_encoder *encoder) |
207 | { | 212 | { |
208 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); | 213 | struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); |
214 | struct exynos_drm_manager *manager = exynos_encoder->manager; | ||
209 | struct exynos_drm_manager_ops *manager_ops = manager->ops; | 215 | struct exynos_drm_manager_ops *manager_ops = manager->ops; |
210 | 216 | ||
211 | DRM_DEBUG_KMS("%s\n", __FILE__); | 217 | DRM_DEBUG_KMS("%s\n", __FILE__); |
212 | 218 | ||
213 | if (manager_ops && manager_ops->commit) | 219 | if (manager_ops && manager_ops->commit) |
214 | manager_ops->commit(manager->dev); | 220 | manager_ops->commit(manager->dev); |
221 | |||
222 | /* | ||
223 | * this will avoid one issue that overlay data is updated to | ||
224 | * real hardware two times. | ||
225 | * And this variable will be used to check if the data was | ||
226 | * already updated or not by exynos_drm_encoder_dpms function. | ||
227 | */ | ||
228 | exynos_encoder->updated = true; | ||
215 | } | 229 | } |
216 | 230 | ||
217 | static void exynos_drm_encoder_disable(struct drm_encoder *encoder) | 231 | static void exynos_drm_encoder_disable(struct drm_encoder *encoder) |
@@ -401,19 +415,6 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) | |||
401 | manager_ops->dpms(manager->dev, mode); | 415 | manager_ops->dpms(manager->dev, mode); |
402 | 416 | ||
403 | /* | 417 | /* |
404 | * set current mode to new one so that data aren't updated into | ||
405 | * registers by drm_helper_connector_dpms two times. | ||
406 | * | ||
407 | * in case that drm_crtc_helper_set_mode() is called, | ||
408 | * overlay_ops->commit() and manager_ops->commit() callbacks | ||
409 | * can be called two times, first at drm_crtc_helper_set_mode() | ||
410 | * and second at drm_helper_connector_dpms(). | ||
411 | * so with this setting, when drm_helper_connector_dpms() is called | ||
412 | * encoder->funcs->dpms() will be ignored. | ||
413 | */ | ||
414 | exynos_encoder->dpms = mode; | ||
415 | |||
416 | /* | ||
417 | * if this condition is ok then it means that the crtc is already | 418 | * if this condition is ok then it means that the crtc is already |
418 | * detached from encoder and last function for detaching is properly | 419 | * detached from encoder and last function for detaching is properly |
419 | * done, so clear pipe from manager to prevent repeated call. | 420 | * done, so clear pipe from manager to prevent repeated call. |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 614b2e9ac46..e7fbb823fd8 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -1142,7 +1142,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) | |||
1142 | const struct of_device_id *match; | 1142 | const struct of_device_id *match; |
1143 | match = of_match_node(of_match_ptr(mixer_match_types), | 1143 | match = of_match_node(of_match_ptr(mixer_match_types), |
1144 | pdev->dev.of_node); | 1144 | pdev->dev.of_node); |
1145 | drv = match->data; | 1145 | drv = (struct mixer_drv_data *)match->data; |
1146 | } else { | 1146 | } else { |
1147 | drv = (struct mixer_drv_data *) | 1147 | drv = (struct mixer_drv_data *) |
1148 | platform_get_device_id(pdev)->driver_data; | 1148 | platform_get_device_id(pdev)->driver_data; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index c9bfd83dde6..61ae104dca8 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1505,7 +1505,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1505 | goto put_gmch; | 1505 | goto put_gmch; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | i915_kick_out_firmware_fb(dev_priv); | 1508 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
1509 | i915_kick_out_firmware_fb(dev_priv); | ||
1509 | 1510 | ||
1510 | pci_set_master(dev->pdev); | 1511 | pci_set_master(dev->pdev); |
1511 | 1512 | ||
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index f78061af704..b726b478a4f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -729,7 +729,7 @@ void intel_crt_init(struct drm_device *dev) | |||
729 | 729 | ||
730 | crt->base.type = INTEL_OUTPUT_ANALOG; | 730 | crt->base.type = INTEL_OUTPUT_ANALOG; |
731 | crt->base.cloneable = true; | 731 | crt->base.cloneable = true; |
732 | if (IS_HASWELL(dev)) | 732 | if (IS_HASWELL(dev) || IS_I830(dev)) |
733 | crt->base.crtc_mask = (1 << 0); | 733 | crt->base.crtc_mask = (1 << 0); |
734 | else | 734 | else |
735 | crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); | 735 | crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); |
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 495625914e4..d7bc817f51a 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -341,9 +341,17 @@ static int intel_overlay_off(struct intel_overlay *overlay) | |||
341 | intel_ring_emit(ring, flip_addr); | 341 | intel_ring_emit(ring, flip_addr); |
342 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | 342 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); |
343 | /* turn overlay off */ | 343 | /* turn overlay off */ |
344 | intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF); | 344 | if (IS_I830(dev)) { |
345 | intel_ring_emit(ring, flip_addr); | 345 | /* Workaround: Don't disable the overlay fully, since otherwise |
346 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | 346 | * it dies on the next OVERLAY_ON cmd. */ |
347 | intel_ring_emit(ring, MI_NOOP); | ||
348 | intel_ring_emit(ring, MI_NOOP); | ||
349 | intel_ring_emit(ring, MI_NOOP); | ||
350 | } else { | ||
351 | intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF); | ||
352 | intel_ring_emit(ring, flip_addr); | ||
353 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | ||
354 | } | ||
347 | intel_ring_advance(ring); | 355 | intel_ring_advance(ring); |
348 | 356 | ||
349 | return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail); | 357 | return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail); |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index e019b236986..e2aacd32954 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -435,7 +435,7 @@ int intel_panel_setup_backlight(struct drm_device *dev) | |||
435 | props.type = BACKLIGHT_RAW; | 435 | props.type = BACKLIGHT_RAW; |
436 | props.max_brightness = _intel_panel_get_max_backlight(dev); | 436 | props.max_brightness = _intel_panel_get_max_backlight(dev); |
437 | if (props.max_brightness == 0) { | 437 | if (props.max_brightness == 0) { |
438 | DRM_ERROR("Failed to get maximum backlight value\n"); | 438 | DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n"); |
439 | return -ENODEV; | 439 | return -ENODEV; |
440 | } | 440 | } |
441 | dev_priv->backlight = | 441 | dev_priv->backlight = |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index c01d97db006..79d308da29f 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -894,6 +894,45 @@ static void intel_sdvo_dump_hdmi_buf(struct intel_sdvo *intel_sdvo) | |||
894 | } | 894 | } |
895 | #endif | 895 | #endif |
896 | 896 | ||
897 | static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo, | ||
898 | unsigned if_index, uint8_t tx_rate, | ||
899 | uint8_t *data, unsigned length) | ||
900 | { | ||
901 | uint8_t set_buf_index[2] = { if_index, 0 }; | ||
902 | uint8_t hbuf_size, tmp[8]; | ||
903 | int i; | ||
904 | |||
905 | if (!intel_sdvo_set_value(intel_sdvo, | ||
906 | SDVO_CMD_SET_HBUF_INDEX, | ||
907 | set_buf_index, 2)) | ||
908 | return false; | ||
909 | |||
910 | if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO, | ||
911 | &hbuf_size, 1)) | ||
912 | return false; | ||
913 | |||
914 | /* Buffer size is 0 based, hooray! */ | ||
915 | hbuf_size++; | ||
916 | |||
917 | DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n", | ||
918 | if_index, length, hbuf_size); | ||
919 | |||
920 | for (i = 0; i < hbuf_size; i += 8) { | ||
921 | memset(tmp, 0, 8); | ||
922 | if (i < length) | ||
923 | memcpy(tmp, data + i, min_t(unsigned, 8, length - i)); | ||
924 | |||
925 | if (!intel_sdvo_set_value(intel_sdvo, | ||
926 | SDVO_CMD_SET_HBUF_DATA, | ||
927 | tmp, 8)) | ||
928 | return false; | ||
929 | } | ||
930 | |||
931 | return intel_sdvo_set_value(intel_sdvo, | ||
932 | SDVO_CMD_SET_HBUF_TXRATE, | ||
933 | &tx_rate, 1); | ||
934 | } | ||
935 | |||
897 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | 936 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) |
898 | { | 937 | { |
899 | struct dip_infoframe avi_if = { | 938 | struct dip_infoframe avi_if = { |
@@ -901,11 +940,7 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
901 | .ver = DIP_VERSION_AVI, | 940 | .ver = DIP_VERSION_AVI, |
902 | .len = DIP_LEN_AVI, | 941 | .len = DIP_LEN_AVI, |
903 | }; | 942 | }; |
904 | uint8_t tx_rate = SDVO_HBUF_TX_VSYNC; | ||
905 | uint8_t set_buf_index[2] = { 1, 0 }; | ||
906 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; | 943 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; |
907 | uint64_t *data = (uint64_t *)sdvo_data; | ||
908 | unsigned i; | ||
909 | 944 | ||
910 | intel_dip_infoframe_csum(&avi_if); | 945 | intel_dip_infoframe_csum(&avi_if); |
911 | 946 | ||
@@ -915,22 +950,9 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
915 | sdvo_data[3] = avi_if.checksum; | 950 | sdvo_data[3] = avi_if.checksum; |
916 | memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi)); | 951 | memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi)); |
917 | 952 | ||
918 | if (!intel_sdvo_set_value(intel_sdvo, | 953 | return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF, |
919 | SDVO_CMD_SET_HBUF_INDEX, | 954 | SDVO_HBUF_TX_VSYNC, |
920 | set_buf_index, 2)) | 955 | sdvo_data, sizeof(sdvo_data)); |
921 | return false; | ||
922 | |||
923 | for (i = 0; i < sizeof(sdvo_data); i += 8) { | ||
924 | if (!intel_sdvo_set_value(intel_sdvo, | ||
925 | SDVO_CMD_SET_HBUF_DATA, | ||
926 | data, 8)) | ||
927 | return false; | ||
928 | data++; | ||
929 | } | ||
930 | |||
931 | return intel_sdvo_set_value(intel_sdvo, | ||
932 | SDVO_CMD_SET_HBUF_TXRATE, | ||
933 | &tx_rate, 1); | ||
934 | } | 956 | } |
935 | 957 | ||
936 | static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo) | 958 | static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo) |
diff --git a/drivers/gpu/drm/i915/intel_sdvo_regs.h b/drivers/gpu/drm/i915/intel_sdvo_regs.h index 9d030142ee4..770bdd6ecd9 100644 --- a/drivers/gpu/drm/i915/intel_sdvo_regs.h +++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h | |||
@@ -708,6 +708,8 @@ struct intel_sdvo_enhancements_arg { | |||
708 | #define SDVO_CMD_SET_AUDIO_STAT 0x91 | 708 | #define SDVO_CMD_SET_AUDIO_STAT 0x91 |
709 | #define SDVO_CMD_GET_AUDIO_STAT 0x92 | 709 | #define SDVO_CMD_GET_AUDIO_STAT 0x92 |
710 | #define SDVO_CMD_SET_HBUF_INDEX 0x93 | 710 | #define SDVO_CMD_SET_HBUF_INDEX 0x93 |
711 | #define SDVO_HBUF_INDEX_ELD 0 | ||
712 | #define SDVO_HBUF_INDEX_AVI_IF 1 | ||
711 | #define SDVO_CMD_GET_HBUF_INDEX 0x94 | 713 | #define SDVO_CMD_GET_HBUF_INDEX 0x94 |
712 | #define SDVO_CMD_GET_HBUF_INFO 0x95 | 714 | #define SDVO_CMD_GET_HBUF_INFO 0x95 |
713 | #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96 | 715 | #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96 |
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c index 4d620644867..a6d3cd6490f 100644 --- a/drivers/gpu/drm/nouveau/core/core/mm.c +++ b/drivers/gpu/drm/nouveau/core/core/mm.c | |||
@@ -218,13 +218,16 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) | |||
218 | node = kzalloc(sizeof(*node), GFP_KERNEL); | 218 | node = kzalloc(sizeof(*node), GFP_KERNEL); |
219 | if (!node) | 219 | if (!node) |
220 | return -ENOMEM; | 220 | return -ENOMEM; |
221 | node->offset = roundup(offset, mm->block_size); | 221 | |
222 | node->length = rounddown(offset + length, mm->block_size) - node->offset; | 222 | if (length) { |
223 | node->offset = roundup(offset, mm->block_size); | ||
224 | node->length = rounddown(offset + length, mm->block_size); | ||
225 | node->length -= node->offset; | ||
226 | } | ||
223 | 227 | ||
224 | list_add_tail(&node->nl_entry, &mm->nodes); | 228 | list_add_tail(&node->nl_entry, &mm->nodes); |
225 | list_add_tail(&node->fl_entry, &mm->free); | 229 | list_add_tail(&node->fl_entry, &mm->free); |
226 | mm->heap_nodes++; | 230 | mm->heap_nodes++; |
227 | mm->heap_size += length; | ||
228 | return 0; | 231 | return 0; |
229 | } | 232 | } |
230 | 233 | ||
diff --git a/drivers/gpu/drm/nouveau/core/include/core/mm.h b/drivers/gpu/drm/nouveau/core/include/core/mm.h index 9ee9bf4028c..975137ba34a 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/mm.h +++ b/drivers/gpu/drm/nouveau/core/include/core/mm.h | |||
@@ -19,7 +19,6 @@ struct nouveau_mm { | |||
19 | 19 | ||
20 | u32 block_size; | 20 | u32 block_size; |
21 | int heap_nodes; | 21 | int heap_nodes; |
22 | u32 heap_size; | ||
23 | }; | 22 | }; |
24 | 23 | ||
25 | int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); | 24 | int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c index 27fb1af7a77..5f570806143 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | |||
@@ -219,13 +219,11 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
219 | ((priv->base.ram.size & 0x000000ff) << 32); | 219 | ((priv->base.ram.size & 0x000000ff) << 32); |
220 | 220 | ||
221 | tags = nv_rd32(priv, 0x100320); | 221 | tags = nv_rd32(priv, 0x100320); |
222 | if (tags) { | 222 | ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); |
223 | ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); | 223 | if (ret) |
224 | if (ret) | 224 | return ret; |
225 | return ret; | ||
226 | 225 | ||
227 | nv_debug(priv, "%d compression tags\n", tags); | 226 | nv_debug(priv, "%d compression tags\n", tags); |
228 | } | ||
229 | 227 | ||
230 | size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail; | 228 | size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail; |
231 | switch (device->chipset) { | 229 | switch (device->chipset) { |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c index 3d2c88310f9..dbfc2abf0cf 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c | |||
@@ -292,7 +292,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
292 | case DCB_I2C_NVIO_BIT: | 292 | case DCB_I2C_NVIO_BIT: |
293 | port->drive = info.drive & 0x0f; | 293 | port->drive = info.drive & 0x0f; |
294 | if (device->card_type < NV_D0) { | 294 | if (device->card_type < NV_D0) { |
295 | if (info.drive >= ARRAY_SIZE(nv50_i2c_port)) | 295 | if (port->drive >= ARRAY_SIZE(nv50_i2c_port)) |
296 | break; | 296 | break; |
297 | port->drive = nv50_i2c_port[port->drive]; | 297 | port->drive = nv50_i2c_port[port->drive]; |
298 | port->sense = port->drive; | 298 | port->sense = port->drive; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index d2f8ffeed74..86124b131f4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -290,6 +290,7 @@ nouveau_display_create(struct drm_device *dev) | |||
290 | struct nouveau_drm *drm = nouveau_drm(dev); | 290 | struct nouveau_drm *drm = nouveau_drm(dev); |
291 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 291 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
292 | struct nouveau_display *disp; | 292 | struct nouveau_display *disp; |
293 | u32 pclass = dev->pdev->class >> 8; | ||
293 | int ret, gen; | 294 | int ret, gen; |
294 | 295 | ||
295 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); | 296 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); |
@@ -360,23 +361,27 @@ nouveau_display_create(struct drm_device *dev) | |||
360 | drm_kms_helper_poll_init(dev); | 361 | drm_kms_helper_poll_init(dev); |
361 | drm_kms_helper_poll_disable(dev); | 362 | drm_kms_helper_poll_disable(dev); |
362 | 363 | ||
363 | if (nv_device(drm->device)->card_type < NV_50) | 364 | if (nouveau_modeset == 1 || |
364 | ret = nv04_display_create(dev); | 365 | (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { |
365 | else | 366 | if (nv_device(drm->device)->card_type < NV_50) |
366 | if (nv_device(drm->device)->card_type < NV_D0) | 367 | ret = nv04_display_create(dev); |
367 | ret = nv50_display_create(dev); | 368 | else |
368 | else | 369 | if (nv_device(drm->device)->card_type < NV_D0) |
369 | ret = nvd0_display_create(dev); | 370 | ret = nv50_display_create(dev); |
370 | if (ret) | 371 | else |
371 | goto disp_create_err; | 372 | ret = nvd0_display_create(dev); |
372 | |||
373 | if (dev->mode_config.num_crtc) { | ||
374 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
375 | if (ret) | 373 | if (ret) |
376 | goto vblank_err; | 374 | goto disp_create_err; |
375 | |||
376 | if (dev->mode_config.num_crtc) { | ||
377 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
378 | if (ret) | ||
379 | goto vblank_err; | ||
380 | } | ||
381 | |||
382 | nouveau_backlight_init(dev); | ||
377 | } | 383 | } |
378 | 384 | ||
379 | nouveau_backlight_init(dev); | ||
380 | return 0; | 385 | return 0; |
381 | 386 | ||
382 | vblank_err: | 387 | vblank_err: |
@@ -395,7 +400,8 @@ nouveau_display_destroy(struct drm_device *dev) | |||
395 | nouveau_backlight_exit(dev); | 400 | nouveau_backlight_exit(dev); |
396 | drm_vblank_cleanup(dev); | 401 | drm_vblank_cleanup(dev); |
397 | 402 | ||
398 | disp->dtor(dev); | 403 | if (disp->dtor) |
404 | disp->dtor(dev); | ||
399 | 405 | ||
400 | drm_kms_helper_poll_fini(dev); | 406 | drm_kms_helper_poll_fini(dev); |
401 | drm_mode_config_cleanup(dev); | 407 | drm_mode_config_cleanup(dev); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ccae8c26ae2..0910125cbbc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -63,8 +63,9 @@ MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration"); | |||
63 | static int nouveau_noaccel = 0; | 63 | static int nouveau_noaccel = 0; |
64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); | 64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); |
65 | 65 | ||
66 | MODULE_PARM_DESC(modeset, "enable driver"); | 66 | MODULE_PARM_DESC(modeset, "enable driver (default: auto, " |
67 | static int nouveau_modeset = -1; | 67 | "0 = disabled, 1 = enabled, 2 = headless)"); |
68 | int nouveau_modeset = -1; | ||
68 | module_param_named(modeset, nouveau_modeset, int, 0400); | 69 | module_param_named(modeset, nouveau_modeset, int, 0400); |
69 | 70 | ||
70 | static struct drm_driver driver; | 71 | static struct drm_driver driver; |
@@ -363,7 +364,8 @@ nouveau_drm_unload(struct drm_device *dev) | |||
363 | 364 | ||
364 | nouveau_pm_fini(dev); | 365 | nouveau_pm_fini(dev); |
365 | 366 | ||
366 | nouveau_display_fini(dev); | 367 | if (dev->mode_config.num_crtc) |
368 | nouveau_display_fini(dev); | ||
367 | nouveau_display_destroy(dev); | 369 | nouveau_display_destroy(dev); |
368 | 370 | ||
369 | nouveau_irq_fini(dev); | 371 | nouveau_irq_fini(dev); |
@@ -403,13 +405,15 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
403 | pm_state.event == PM_EVENT_PRETHAW) | 405 | pm_state.event == PM_EVENT_PRETHAW) |
404 | return 0; | 406 | return 0; |
405 | 407 | ||
406 | NV_INFO(drm, "suspending fbcon...\n"); | 408 | if (dev->mode_config.num_crtc) { |
407 | nouveau_fbcon_set_suspend(dev, 1); | 409 | NV_INFO(drm, "suspending fbcon...\n"); |
410 | nouveau_fbcon_set_suspend(dev, 1); | ||
408 | 411 | ||
409 | NV_INFO(drm, "suspending display...\n"); | 412 | NV_INFO(drm, "suspending display...\n"); |
410 | ret = nouveau_display_suspend(dev); | 413 | ret = nouveau_display_suspend(dev); |
411 | if (ret) | 414 | if (ret) |
412 | return ret; | 415 | return ret; |
416 | } | ||
413 | 417 | ||
414 | NV_INFO(drm, "evicting buffers...\n"); | 418 | NV_INFO(drm, "evicting buffers...\n"); |
415 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); | 419 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); |
@@ -445,8 +449,10 @@ fail_client: | |||
445 | nouveau_client_init(&cli->base); | 449 | nouveau_client_init(&cli->base); |
446 | } | 450 | } |
447 | 451 | ||
448 | NV_INFO(drm, "resuming display...\n"); | 452 | if (dev->mode_config.num_crtc) { |
449 | nouveau_display_resume(dev); | 453 | NV_INFO(drm, "resuming display...\n"); |
454 | nouveau_display_resume(dev); | ||
455 | } | ||
450 | return ret; | 456 | return ret; |
451 | } | 457 | } |
452 | 458 | ||
@@ -486,8 +492,10 @@ nouveau_drm_resume(struct pci_dev *pdev) | |||
486 | nouveau_irq_postinstall(dev); | 492 | nouveau_irq_postinstall(dev); |
487 | nouveau_pm_resume(dev); | 493 | nouveau_pm_resume(dev); |
488 | 494 | ||
489 | NV_INFO(drm, "resuming display...\n"); | 495 | if (dev->mode_config.num_crtc) { |
490 | nouveau_display_resume(dev); | 496 | NV_INFO(drm, "resuming display...\n"); |
497 | nouveau_display_resume(dev); | ||
498 | } | ||
491 | return 0; | 499 | return 0; |
492 | } | 500 | } |
493 | 501 | ||
@@ -662,9 +670,7 @@ nouveau_drm_init(void) | |||
662 | #ifdef CONFIG_VGA_CONSOLE | 670 | #ifdef CONFIG_VGA_CONSOLE |
663 | if (vgacon_text_force()) | 671 | if (vgacon_text_force()) |
664 | nouveau_modeset = 0; | 672 | nouveau_modeset = 0; |
665 | else | ||
666 | #endif | 673 | #endif |
667 | nouveau_modeset = 1; | ||
668 | } | 674 | } |
669 | 675 | ||
670 | if (!nouveau_modeset) | 676 | if (!nouveau_modeset) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index 81947121754..a1016992708 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
@@ -141,4 +141,6 @@ int nouveau_drm_resume(struct pci_dev *); | |||
141 | nv_info((cli), fmt, ##args); \ | 141 | nv_info((cli), fmt, ##args); \ |
142 | } while (0) | 142 | } while (0) |
143 | 143 | ||
144 | extern int nouveau_modeset; | ||
145 | |||
144 | #endif | 146 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 9ca8afdb554..1d8cb506a28 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -61,13 +61,15 @@ nouveau_irq_handler(DRM_IRQ_ARGS) | |||
61 | 61 | ||
62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); | 62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); |
63 | 63 | ||
64 | if (device->card_type >= NV_D0) { | 64 | if (dev->mode_config.num_crtc) { |
65 | if (nv_rd32(device, 0x000100) & 0x04000000) | 65 | if (device->card_type >= NV_D0) { |
66 | nvd0_display_intr(dev); | 66 | if (nv_rd32(device, 0x000100) & 0x04000000) |
67 | } else | 67 | nvd0_display_intr(dev); |
68 | if (device->card_type >= NV_50) { | 68 | } else |
69 | if (nv_rd32(device, 0x000100) & 0x04000000) | 69 | if (device->card_type >= NV_50) { |
70 | nv50_display_intr(dev); | 70 | if (nv_rd32(device, 0x000100) & 0x04000000) |
71 | nv50_display_intr(dev); | ||
72 | } | ||
71 | } | 73 | } |
72 | 74 | ||
73 | return IRQ_HANDLED; | 75 | return IRQ_HANDLED; |
diff --git a/drivers/gpu/drm/nouveau/nv04_dac.c b/drivers/gpu/drm/nouveau/nv04_dac.c index 347a3bd78d0..64f7020fb60 100644 --- a/drivers/gpu/drm/nouveau/nv04_dac.c +++ b/drivers/gpu/drm/nouveau/nv04_dac.c | |||
@@ -220,7 +220,7 @@ out: | |||
220 | NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode); | 220 | NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode); |
221 | 221 | ||
222 | if (blue == 0x18) { | 222 | if (blue == 0x18) { |
223 | NV_INFO(drm, "Load detected on head A\n"); | 223 | NV_DEBUG(drm, "Load detected on head A\n"); |
224 | return connector_status_connected; | 224 | return connector_status_connected; |
225 | } | 225 | } |
226 | 226 | ||
@@ -338,8 +338,8 @@ nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | |||
338 | 338 | ||
339 | if (nv17_dac_sample_load(encoder) & | 339 | if (nv17_dac_sample_load(encoder) & |
340 | NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { | 340 | NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { |
341 | NV_INFO(drm, "Load detected on output %c\n", | 341 | NV_DEBUG(drm, "Load detected on output %c\n", |
342 | '@' + ffs(dcb->or)); | 342 | '@' + ffs(dcb->or)); |
343 | return connector_status_connected; | 343 | return connector_status_connected; |
344 | } else { | 344 | } else { |
345 | return connector_status_disconnected; | 345 | return connector_status_disconnected; |
@@ -413,9 +413,9 @@ static void nv04_dac_commit(struct drm_encoder *encoder) | |||
413 | 413 | ||
414 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 414 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
415 | 415 | ||
416 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 416 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
417 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), | 417 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), |
418 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); | 418 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
419 | } | 419 | } |
420 | 420 | ||
421 | void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable) | 421 | void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable) |
@@ -461,8 +461,8 @@ static void nv04_dac_dpms(struct drm_encoder *encoder, int mode) | |||
461 | return; | 461 | return; |
462 | nv_encoder->last_dpms = mode; | 462 | nv_encoder->last_dpms = mode; |
463 | 463 | ||
464 | NV_INFO(drm, "Setting dpms mode %d on vga encoder (output %d)\n", | 464 | NV_DEBUG(drm, "Setting dpms mode %d on vga encoder (output %d)\n", |
465 | mode, nv_encoder->dcb->index); | 465 | mode, nv_encoder->dcb->index); |
466 | 466 | ||
467 | nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); | 467 | nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); |
468 | } | 468 | } |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index da55d7642c8..184cdf80676 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -476,9 +476,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) | |||
476 | 476 | ||
477 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 477 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
478 | 478 | ||
479 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 479 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
480 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), | 480 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), |
481 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); | 481 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
482 | } | 482 | } |
483 | 483 | ||
484 | static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) | 484 | static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) |
@@ -520,8 +520,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) | |||
520 | return; | 520 | return; |
521 | nv_encoder->last_dpms = mode; | 521 | nv_encoder->last_dpms = mode; |
522 | 522 | ||
523 | NV_INFO(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", | 523 | NV_DEBUG(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", |
524 | mode, nv_encoder->dcb->index); | 524 | mode, nv_encoder->dcb->index); |
525 | 525 | ||
526 | if (was_powersaving && is_powersaving_dpms(mode)) | 526 | if (was_powersaving && is_powersaving_dpms(mode)) |
527 | return; | 527 | return; |
@@ -565,8 +565,8 @@ static void nv04_tmds_dpms(struct drm_encoder *encoder, int mode) | |||
565 | return; | 565 | return; |
566 | nv_encoder->last_dpms = mode; | 566 | nv_encoder->last_dpms = mode; |
567 | 567 | ||
568 | NV_INFO(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", | 568 | NV_DEBUG(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", |
569 | mode, nv_encoder->dcb->index); | 569 | mode, nv_encoder->dcb->index); |
570 | 570 | ||
571 | nv04_dfp_update_backlight(encoder, mode); | 571 | nv04_dfp_update_backlight(encoder, mode); |
572 | nv04_dfp_update_fp_control(encoder, mode); | 572 | nv04_dfp_update_fp_control(encoder, mode); |
diff --git a/drivers/gpu/drm/nouveau/nv04_tv.c b/drivers/gpu/drm/nouveau/nv04_tv.c index 099fbeda6e2..62e826a139b 100644 --- a/drivers/gpu/drm/nouveau/nv04_tv.c +++ b/drivers/gpu/drm/nouveau/nv04_tv.c | |||
@@ -75,8 +75,8 @@ static void nv04_tv_dpms(struct drm_encoder *encoder, int mode) | |||
75 | struct nv04_mode_state *state = &nv04_display(dev)->mode_reg; | 75 | struct nv04_mode_state *state = &nv04_display(dev)->mode_reg; |
76 | uint8_t crtc1A; | 76 | uint8_t crtc1A; |
77 | 77 | ||
78 | NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n", | 78 | NV_DEBUG(drm, "Setting dpms mode %d on TV encoder (output %d)\n", |
79 | mode, nv_encoder->dcb->index); | 79 | mode, nv_encoder->dcb->index); |
80 | 80 | ||
81 | state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK); | 81 | state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK); |
82 | 82 | ||
@@ -167,9 +167,8 @@ static void nv04_tv_commit(struct drm_encoder *encoder) | |||
167 | 167 | ||
168 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 168 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
169 | 169 | ||
170 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 170 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
171 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, | 171 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
172 | '@' + ffs(nv_encoder->dcb->or)); | ||
173 | } | 172 | } |
174 | 173 | ||
175 | static void nv04_tv_destroy(struct drm_encoder *encoder) | 174 | static void nv04_tv_destroy(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 30271b64191..95e6318b626 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -264,7 +264,7 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, | |||
264 | /* macro tile width & height */ | 264 | /* macro tile width & height */ |
265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; | 265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; |
266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; | 266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; |
267 | mtileb = (palign / 8) * (halign / 8) * tileb;; | 267 | mtileb = (palign / 8) * (halign / 8) * tileb; |
268 | mtile_pr = surf->nbx / palign; | 268 | mtile_pr = surf->nbx / palign; |
269 | mtile_ps = (mtile_pr * surf->nby) / halign; | 269 | mtile_ps = (mtile_pr * surf->nby) / halign; |
270 | surf->layer_size = mtile_ps * mtileb * slice_pt; | 270 | surf->layer_size = mtile_ps * mtileb * slice_pt; |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 37f6a907aea..15f5ded65e0 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -352,9 +352,9 @@ static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) | |||
352 | } | 352 | } |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * radeon_atpx_switchto - switch to the requested GPU | 355 | * radeon_atpx_power_state - power down/up the requested GPU |
356 | * | 356 | * |
357 | * @id: GPU to switch to | 357 | * @id: GPU to power down/up |
358 | * @state: requested power state (0 = off, 1 = on) | 358 | * @state: requested power state (0 = off, 1 = on) |
359 | * | 359 | * |
360 | * Execute the necessary ATPX function to power down/up the discrete GPU | 360 | * Execute the necessary ATPX function to power down/up the discrete GPU |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 67cfc1795ec..b884c362a8c 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -941,7 +941,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
941 | struct drm_mode_object *obj; | 941 | struct drm_mode_object *obj; |
942 | int i; | 942 | int i; |
943 | enum drm_connector_status ret = connector_status_disconnected; | 943 | enum drm_connector_status ret = connector_status_disconnected; |
944 | bool dret = false; | 944 | bool dret = false, broken_edid = false; |
945 | 945 | ||
946 | if (!force && radeon_check_hpd_status_unchanged(connector)) | 946 | if (!force && radeon_check_hpd_status_unchanged(connector)) |
947 | return connector->status; | 947 | return connector->status; |
@@ -965,6 +965,9 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
965 | ret = connector_status_disconnected; | 965 | ret = connector_status_disconnected; |
966 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); | 966 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); |
967 | radeon_connector->ddc_bus = NULL; | 967 | radeon_connector->ddc_bus = NULL; |
968 | } else { | ||
969 | ret = connector_status_connected; | ||
970 | broken_edid = true; /* defer use_digital to later */ | ||
968 | } | 971 | } |
969 | } else { | 972 | } else { |
970 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); | 973 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
@@ -1047,13 +1050,24 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1047 | 1050 | ||
1048 | encoder_funcs = encoder->helper_private; | 1051 | encoder_funcs = encoder->helper_private; |
1049 | if (encoder_funcs->detect) { | 1052 | if (encoder_funcs->detect) { |
1050 | if (ret != connector_status_connected) { | 1053 | if (!broken_edid) { |
1051 | ret = encoder_funcs->detect(encoder, connector); | 1054 | if (ret != connector_status_connected) { |
1052 | if (ret == connector_status_connected) { | 1055 | /* deal with analog monitors without DDC */ |
1053 | radeon_connector->use_digital = false; | 1056 | ret = encoder_funcs->detect(encoder, connector); |
1057 | if (ret == connector_status_connected) { | ||
1058 | radeon_connector->use_digital = false; | ||
1059 | } | ||
1060 | if (ret != connector_status_disconnected) | ||
1061 | radeon_connector->detected_by_load = true; | ||
1054 | } | 1062 | } |
1055 | if (ret != connector_status_disconnected) | 1063 | } else { |
1056 | radeon_connector->detected_by_load = true; | 1064 | enum drm_connector_status lret; |
1065 | /* assume digital unless load detected otherwise */ | ||
1066 | radeon_connector->use_digital = true; | ||
1067 | lret = encoder_funcs->detect(encoder, connector); | ||
1068 | DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder->encoder_type,lret); | ||
1069 | if (lret == connector_status_connected) | ||
1070 | radeon_connector->use_digital = false; | ||
1057 | } | 1071 | } |
1058 | break; | 1072 | break; |
1059 | } | 1073 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 5677a424b58..6857cb4efb7 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -295,6 +295,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
295 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 295 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
296 | struct drm_device *dev = crtc->dev; | 296 | struct drm_device *dev = crtc->dev; |
297 | struct radeon_device *rdev = dev->dev_private; | 297 | struct radeon_device *rdev = dev->dev_private; |
298 | uint32_t crtc_ext_cntl = 0; | ||
298 | uint32_t mask; | 299 | uint32_t mask; |
299 | 300 | ||
300 | if (radeon_crtc->crtc_id) | 301 | if (radeon_crtc->crtc_id) |
@@ -307,6 +308,16 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
307 | RADEON_CRTC_VSYNC_DIS | | 308 | RADEON_CRTC_VSYNC_DIS | |
308 | RADEON_CRTC_HSYNC_DIS); | 309 | RADEON_CRTC_HSYNC_DIS); |
309 | 310 | ||
311 | /* | ||
312 | * On all dual CRTC GPUs this bit controls the CRTC of the primary DAC. | ||
313 | * Therefore it is set in the DAC DMPS function. | ||
314 | * This is different for GPU's with a single CRTC but a primary and a | ||
315 | * TV DAC: here it controls the single CRTC no matter where it is | ||
316 | * routed. Therefore we set it here. | ||
317 | */ | ||
318 | if (rdev->flags & RADEON_SINGLE_CRTC) | ||
319 | crtc_ext_cntl = RADEON_CRTC_CRT_ON; | ||
320 | |||
310 | switch (mode) { | 321 | switch (mode) { |
311 | case DRM_MODE_DPMS_ON: | 322 | case DRM_MODE_DPMS_ON: |
312 | radeon_crtc->enabled = true; | 323 | radeon_crtc->enabled = true; |
@@ -317,7 +328,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
317 | else { | 328 | else { |
318 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | | 329 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | |
319 | RADEON_CRTC_DISP_REQ_EN_B)); | 330 | RADEON_CRTC_DISP_REQ_EN_B)); |
320 | WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); | 331 | WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl)); |
321 | } | 332 | } |
322 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); | 333 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); |
323 | radeon_crtc_load_lut(crtc); | 334 | radeon_crtc_load_lut(crtc); |
@@ -331,7 +342,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
331 | else { | 342 | else { |
332 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | | 343 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | |
333 | RADEON_CRTC_DISP_REQ_EN_B)); | 344 | RADEON_CRTC_DISP_REQ_EN_B)); |
334 | WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~mask); | 345 | WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~(mask | crtc_ext_cntl)); |
335 | } | 346 | } |
336 | radeon_crtc->enabled = false; | 347 | radeon_crtc->enabled = false; |
337 | /* adjust pm to dpms changes AFTER disabling crtcs */ | 348 | /* adjust pm to dpms changes AFTER disabling crtcs */ |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 0063df9d166..f5ba2241dac 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -537,7 +537,9 @@ static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode | |||
537 | break; | 537 | break; |
538 | } | 538 | } |
539 | 539 | ||
540 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); | 540 | /* handled in radeon_crtc_dpms() */ |
541 | if (!(rdev->flags & RADEON_SINGLE_CRTC)) | ||
542 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); | ||
541 | WREG32(RADEON_DAC_CNTL, dac_cntl); | 543 | WREG32(RADEON_DAC_CNTL, dac_cntl); |
542 | WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl); | 544 | WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl); |
543 | 545 | ||
@@ -662,6 +664,8 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
662 | 664 | ||
663 | if (ASIC_IS_R300(rdev)) | 665 | if (ASIC_IS_R300(rdev)) |
664 | tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT); | 666 | tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT); |
667 | else if (ASIC_IS_RV100(rdev)) | ||
668 | tmp |= (0x1ac << RADEON_DAC_FORCE_DATA_SHIFT); | ||
665 | else | 669 | else |
666 | tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT); | 670 | tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT); |
667 | 671 | ||
@@ -671,6 +675,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
671 | tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN; | 675 | tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN; |
672 | WREG32(RADEON_DAC_CNTL, tmp); | 676 | WREG32(RADEON_DAC_CNTL, tmp); |
673 | 677 | ||
678 | tmp = dac_macro_cntl; | ||
674 | tmp &= ~(RADEON_DAC_PDWN_R | | 679 | tmp &= ~(RADEON_DAC_PDWN_R | |
675 | RADEON_DAC_PDWN_G | | 680 | RADEON_DAC_PDWN_G | |
676 | RADEON_DAC_PDWN_B); | 681 | RADEON_DAC_PDWN_B); |
@@ -1092,7 +1097,8 @@ static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode) | |||
1092 | } else { | 1097 | } else { |
1093 | if (is_tv) | 1098 | if (is_tv) |
1094 | WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl); | 1099 | WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl); |
1095 | else | 1100 | /* handled in radeon_crtc_dpms() */ |
1101 | else if (!(rdev->flags & RADEON_SINGLE_CRTC)) | ||
1096 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | 1102 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); |
1097 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); | 1103 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); |
1098 | } | 1104 | } |
@@ -1416,13 +1422,104 @@ static bool radeon_legacy_tv_detect(struct drm_encoder *encoder, | |||
1416 | return found; | 1422 | return found; |
1417 | } | 1423 | } |
1418 | 1424 | ||
1425 | static bool radeon_legacy_ext_dac_detect(struct drm_encoder *encoder, | ||
1426 | struct drm_connector *connector) | ||
1427 | { | ||
1428 | struct drm_device *dev = encoder->dev; | ||
1429 | struct radeon_device *rdev = dev->dev_private; | ||
1430 | uint32_t gpio_monid, fp2_gen_cntl, disp_output_cntl, crtc2_gen_cntl; | ||
1431 | uint32_t disp_lin_trans_grph_a, disp_lin_trans_grph_b, disp_lin_trans_grph_c; | ||
1432 | uint32_t disp_lin_trans_grph_d, disp_lin_trans_grph_e, disp_lin_trans_grph_f; | ||
1433 | uint32_t tmp, crtc2_h_total_disp, crtc2_v_total_disp; | ||
1434 | uint32_t crtc2_h_sync_strt_wid, crtc2_v_sync_strt_wid; | ||
1435 | bool found = false; | ||
1436 | int i; | ||
1437 | |||
1438 | /* save the regs we need */ | ||
1439 | gpio_monid = RREG32(RADEON_GPIO_MONID); | ||
1440 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); | ||
1441 | disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); | ||
1442 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | ||
1443 | disp_lin_trans_grph_a = RREG32(RADEON_DISP_LIN_TRANS_GRPH_A); | ||
1444 | disp_lin_trans_grph_b = RREG32(RADEON_DISP_LIN_TRANS_GRPH_B); | ||
1445 | disp_lin_trans_grph_c = RREG32(RADEON_DISP_LIN_TRANS_GRPH_C); | ||
1446 | disp_lin_trans_grph_d = RREG32(RADEON_DISP_LIN_TRANS_GRPH_D); | ||
1447 | disp_lin_trans_grph_e = RREG32(RADEON_DISP_LIN_TRANS_GRPH_E); | ||
1448 | disp_lin_trans_grph_f = RREG32(RADEON_DISP_LIN_TRANS_GRPH_F); | ||
1449 | crtc2_h_total_disp = RREG32(RADEON_CRTC2_H_TOTAL_DISP); | ||
1450 | crtc2_v_total_disp = RREG32(RADEON_CRTC2_V_TOTAL_DISP); | ||
1451 | crtc2_h_sync_strt_wid = RREG32(RADEON_CRTC2_H_SYNC_STRT_WID); | ||
1452 | crtc2_v_sync_strt_wid = RREG32(RADEON_CRTC2_V_SYNC_STRT_WID); | ||
1453 | |||
1454 | tmp = RREG32(RADEON_GPIO_MONID); | ||
1455 | tmp &= ~RADEON_GPIO_A_0; | ||
1456 | WREG32(RADEON_GPIO_MONID, tmp); | ||
1457 | |||
1458 | WREG32(RADEON_FP2_GEN_CNTL, (RADEON_FP2_ON | | ||
1459 | RADEON_FP2_PANEL_FORMAT | | ||
1460 | R200_FP2_SOURCE_SEL_TRANS_UNIT | | ||
1461 | RADEON_FP2_DVO_EN | | ||
1462 | R200_FP2_DVO_RATE_SEL_SDR)); | ||
1463 | |||
1464 | WREG32(RADEON_DISP_OUTPUT_CNTL, (RADEON_DISP_DAC_SOURCE_RMX | | ||
1465 | RADEON_DISP_TRANS_MATRIX_GRAPHICS)); | ||
1466 | |||
1467 | WREG32(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_EN | | ||
1468 | RADEON_CRTC2_DISP_REQ_EN_B)); | ||
1469 | |||
1470 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, 0x00000000); | ||
1471 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, 0x000003f0); | ||
1472 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, 0x00000000); | ||
1473 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, 0x000003f0); | ||
1474 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, 0x00000000); | ||
1475 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, 0x000003f0); | ||
1476 | |||
1477 | WREG32(RADEON_CRTC2_H_TOTAL_DISP, 0x01000008); | ||
1478 | WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, 0x00000800); | ||
1479 | WREG32(RADEON_CRTC2_V_TOTAL_DISP, 0x00080001); | ||
1480 | WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, 0x00000080); | ||
1481 | |||
1482 | for (i = 0; i < 200; i++) { | ||
1483 | tmp = RREG32(RADEON_GPIO_MONID); | ||
1484 | if (tmp & RADEON_GPIO_Y_0) | ||
1485 | found = true; | ||
1486 | |||
1487 | if (found) | ||
1488 | break; | ||
1489 | |||
1490 | if (!drm_can_sleep()) | ||
1491 | mdelay(1); | ||
1492 | else | ||
1493 | msleep(1); | ||
1494 | } | ||
1495 | |||
1496 | /* restore the regs we used */ | ||
1497 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, disp_lin_trans_grph_a); | ||
1498 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, disp_lin_trans_grph_b); | ||
1499 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, disp_lin_trans_grph_c); | ||
1500 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, disp_lin_trans_grph_d); | ||
1501 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, disp_lin_trans_grph_e); | ||
1502 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, disp_lin_trans_grph_f); | ||
1503 | WREG32(RADEON_CRTC2_H_TOTAL_DISP, crtc2_h_total_disp); | ||
1504 | WREG32(RADEON_CRTC2_V_TOTAL_DISP, crtc2_v_total_disp); | ||
1505 | WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, crtc2_h_sync_strt_wid); | ||
1506 | WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, crtc2_v_sync_strt_wid); | ||
1507 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | ||
1508 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | ||
1509 | WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl); | ||
1510 | WREG32(RADEON_GPIO_MONID, gpio_monid); | ||
1511 | |||
1512 | return found; | ||
1513 | } | ||
1514 | |||
1419 | static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder, | 1515 | static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder, |
1420 | struct drm_connector *connector) | 1516 | struct drm_connector *connector) |
1421 | { | 1517 | { |
1422 | struct drm_device *dev = encoder->dev; | 1518 | struct drm_device *dev = encoder->dev; |
1423 | struct radeon_device *rdev = dev->dev_private; | 1519 | struct radeon_device *rdev = dev->dev_private; |
1424 | uint32_t crtc2_gen_cntl, tv_dac_cntl, dac_cntl2, dac_ext_cntl; | 1520 | uint32_t crtc2_gen_cntl = 0, tv_dac_cntl, dac_cntl2, dac_ext_cntl; |
1425 | uint32_t disp_hw_debug, disp_output_cntl, gpiopad_a, pixclks_cntl, tmp; | 1521 | uint32_t gpiopad_a = 0, pixclks_cntl, tmp; |
1522 | uint32_t disp_output_cntl = 0, disp_hw_debug = 0, crtc_ext_cntl = 0; | ||
1426 | enum drm_connector_status found = connector_status_disconnected; | 1523 | enum drm_connector_status found = connector_status_disconnected; |
1427 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1524 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1428 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; | 1525 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; |
@@ -1459,12 +1556,27 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1459 | return connector_status_disconnected; | 1556 | return connector_status_disconnected; |
1460 | } | 1557 | } |
1461 | 1558 | ||
1559 | /* R200 uses an external DAC for secondary DAC */ | ||
1560 | if (rdev->family == CHIP_R200) { | ||
1561 | if (radeon_legacy_ext_dac_detect(encoder, connector)) | ||
1562 | found = connector_status_connected; | ||
1563 | return found; | ||
1564 | } | ||
1565 | |||
1462 | /* save the regs we need */ | 1566 | /* save the regs we need */ |
1463 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 1567 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
1464 | gpiopad_a = ASIC_IS_R300(rdev) ? RREG32(RADEON_GPIOPAD_A) : 0; | 1568 | |
1465 | disp_output_cntl = ASIC_IS_R300(rdev) ? RREG32(RADEON_DISP_OUTPUT_CNTL) : 0; | 1569 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1466 | disp_hw_debug = ASIC_IS_R300(rdev) ? 0 : RREG32(RADEON_DISP_HW_DEBUG); | 1570 | crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); |
1467 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | 1571 | } else { |
1572 | if (ASIC_IS_R300(rdev)) { | ||
1573 | gpiopad_a = RREG32(RADEON_GPIOPAD_A); | ||
1574 | disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); | ||
1575 | } else { | ||
1576 | disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG); | ||
1577 | } | ||
1578 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | ||
1579 | } | ||
1468 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); | 1580 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); |
1469 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); | 1581 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); |
1470 | dac_cntl2 = RREG32(RADEON_DAC_CNTL2); | 1582 | dac_cntl2 = RREG32(RADEON_DAC_CNTL2); |
@@ -1473,22 +1585,24 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1473 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); | 1585 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); |
1474 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 1586 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
1475 | 1587 | ||
1476 | if (ASIC_IS_R300(rdev)) | 1588 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1477 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | 1589 | tmp = crtc_ext_cntl | RADEON_CRTC_CRT_ON; |
1478 | 1590 | WREG32(RADEON_CRTC_EXT_CNTL, tmp); | |
1479 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; | ||
1480 | tmp |= RADEON_CRTC2_CRT2_ON | | ||
1481 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); | ||
1482 | |||
1483 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); | ||
1484 | |||
1485 | if (ASIC_IS_R300(rdev)) { | ||
1486 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; | ||
1487 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; | ||
1488 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); | ||
1489 | } else { | 1591 | } else { |
1490 | tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL; | 1592 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; |
1491 | WREG32(RADEON_DISP_HW_DEBUG, tmp); | 1593 | tmp |= RADEON_CRTC2_CRT2_ON | |
1594 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); | ||
1595 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); | ||
1596 | |||
1597 | if (ASIC_IS_R300(rdev)) { | ||
1598 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | ||
1599 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; | ||
1600 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; | ||
1601 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); | ||
1602 | } else { | ||
1603 | tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL; | ||
1604 | WREG32(RADEON_DISP_HW_DEBUG, tmp); | ||
1605 | } | ||
1492 | } | 1606 | } |
1493 | 1607 | ||
1494 | tmp = RADEON_TV_DAC_NBLANK | | 1608 | tmp = RADEON_TV_DAC_NBLANK | |
@@ -1530,14 +1644,19 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1530 | WREG32(RADEON_DAC_CNTL2, dac_cntl2); | 1644 | WREG32(RADEON_DAC_CNTL2, dac_cntl2); |
1531 | WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl); | 1645 | WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl); |
1532 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); | 1646 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); |
1533 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | ||
1534 | 1647 | ||
1535 | if (ASIC_IS_R300(rdev)) { | 1648 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1536 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | 1649 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); |
1537 | WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1); | ||
1538 | } else { | 1650 | } else { |
1539 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); | 1651 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); |
1652 | if (ASIC_IS_R300(rdev)) { | ||
1653 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | ||
1654 | WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1); | ||
1655 | } else { | ||
1656 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); | ||
1657 | } | ||
1540 | } | 1658 | } |
1659 | |||
1541 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); | 1660 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); |
1542 | 1661 | ||
1543 | return found; | 1662 | return found; |
diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index fccd361f7b5..87aa5f5d3c8 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h | |||
@@ -104,7 +104,7 @@ udl_fb_user_fb_create(struct drm_device *dev, | |||
104 | 104 | ||
105 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, | 105 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, |
106 | const char *front, char **urb_buf_ptr, | 106 | const char *front, char **urb_buf_ptr, |
107 | u32 byte_offset, u32 byte_width, | 107 | u32 byte_offset, u32 device_byte_offset, u32 byte_width, |
108 | int *ident_ptr, int *sent_ptr); | 108 | int *ident_ptr, int *sent_ptr); |
109 | 109 | ||
110 | int udl_dumb_create(struct drm_file *file_priv, | 110 | int udl_dumb_create(struct drm_file *file_priv, |
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c index 69a2b16f42a..d4ab3beaada 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c | |||
@@ -114,9 +114,10 @@ static void udlfb_dpy_deferred_io(struct fb_info *info, | |||
114 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { | 114 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { |
115 | 115 | ||
116 | if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8), | 116 | if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8), |
117 | &urb, (char *) info->fix.smem_start, | 117 | &urb, (char *) info->fix.smem_start, |
118 | &cmd, cur->index << PAGE_SHIFT, | 118 | &cmd, cur->index << PAGE_SHIFT, |
119 | PAGE_SIZE, &bytes_identical, &bytes_sent)) | 119 | cur->index << PAGE_SHIFT, |
120 | PAGE_SIZE, &bytes_identical, &bytes_sent)) | ||
120 | goto error; | 121 | goto error; |
121 | bytes_rendered += PAGE_SIZE; | 122 | bytes_rendered += PAGE_SIZE; |
122 | } | 123 | } |
@@ -187,10 +188,11 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, | |||
187 | for (i = y; i < y + height ; i++) { | 188 | for (i = y; i < y + height ; i++) { |
188 | const int line_offset = fb->base.pitches[0] * i; | 189 | const int line_offset = fb->base.pitches[0] * i; |
189 | const int byte_offset = line_offset + (x * bpp); | 190 | const int byte_offset = line_offset + (x * bpp); |
190 | 191 | const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp); | |
191 | if (udl_render_hline(dev, bpp, &urb, | 192 | if (udl_render_hline(dev, bpp, &urb, |
192 | (char *) fb->obj->vmapping, | 193 | (char *) fb->obj->vmapping, |
193 | &cmd, byte_offset, width * bpp, | 194 | &cmd, byte_offset, dev_byte_offset, |
195 | width * bpp, | ||
194 | &bytes_identical, &bytes_sent)) | 196 | &bytes_identical, &bytes_sent)) |
195 | goto error; | 197 | goto error; |
196 | } | 198 | } |
diff --git a/drivers/gpu/drm/udl/udl_transfer.c b/drivers/gpu/drm/udl/udl_transfer.c index dc095526ffb..142fee5f983 100644 --- a/drivers/gpu/drm/udl/udl_transfer.c +++ b/drivers/gpu/drm/udl/udl_transfer.c | |||
@@ -213,11 +213,12 @@ static void udl_compress_hline16( | |||
213 | */ | 213 | */ |
214 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, | 214 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, |
215 | const char *front, char **urb_buf_ptr, | 215 | const char *front, char **urb_buf_ptr, |
216 | u32 byte_offset, u32 byte_width, | 216 | u32 byte_offset, u32 device_byte_offset, |
217 | u32 byte_width, | ||
217 | int *ident_ptr, int *sent_ptr) | 218 | int *ident_ptr, int *sent_ptr) |
218 | { | 219 | { |
219 | const u8 *line_start, *line_end, *next_pixel; | 220 | const u8 *line_start, *line_end, *next_pixel; |
220 | u32 base16 = 0 + (byte_offset / bpp) * 2; | 221 | u32 base16 = 0 + (device_byte_offset / bpp) * 2; |
221 | struct urb *urb = *urb_ptr; | 222 | struct urb *urb = *urb_ptr; |
222 | u8 *cmd = *urb_buf_ptr; | 223 | u8 *cmd = *urb_buf_ptr; |
223 | u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length; | 224 | u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length; |
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 06ebdbb6ea0..fd7722aecf7 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -522,6 +522,12 @@ static const struct hid_device_id apple_devices[] = { | |||
522 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | 522 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
523 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | 523 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
524 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | 524 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
525 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | ||
526 | .driver_data = APPLE_HAS_FN }, | ||
527 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), | ||
528 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | ||
529 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), | ||
530 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | ||
525 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), | 531 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
526 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 532 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
527 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), | 533 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index bd3971bf31b..f4109fd657f 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1532,6 +1532,9 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1532 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 1532 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
1533 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 1533 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
1534 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 1534 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
1535 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | ||
1536 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | ||
1537 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | ||
1535 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | 1538 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
1536 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | 1539 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
1537 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1540 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
@@ -2139,6 +2142,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { | |||
2139 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 2142 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
2140 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 2143 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
2141 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 2144 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
2145 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | ||
2146 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | ||
2147 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | ||
2142 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 2148 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
2143 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 2149 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
2144 | { } | 2150 | { } |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 269b50912a4..9d7a42857ea 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -118,6 +118,9 @@ | |||
118 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 | 118 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 |
119 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 | 119 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 |
120 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 | 120 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 |
121 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | ||
122 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | ||
123 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | ||
121 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 | 124 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 |
122 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a | 125 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a |
123 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b | 126 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b |
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index 3acdcfcc17d..f676c01bb47 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c | |||
@@ -28,22 +28,30 @@ | |||
28 | #define MS_RDESC 0x08 | 28 | #define MS_RDESC 0x08 |
29 | #define MS_NOGET 0x10 | 29 | #define MS_NOGET 0x10 |
30 | #define MS_DUPLICATE_USAGES 0x20 | 30 | #define MS_DUPLICATE_USAGES 0x20 |
31 | #define MS_RDESC_3K 0x40 | ||
31 | 32 | ||
32 | /* | ||
33 | * Microsoft Wireless Desktop Receiver (Model 1028) has | ||
34 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
35 | */ | ||
36 | static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 33 | static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
37 | unsigned int *rsize) | 34 | unsigned int *rsize) |
38 | { | 35 | { |
39 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | 36 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
40 | 37 | ||
38 | /* | ||
39 | * Microsoft Wireless Desktop Receiver (Model 1028) has | ||
40 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
41 | */ | ||
41 | if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && | 42 | if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && |
42 | rdesc[559] == 0x29) { | 43 | rdesc[559] == 0x29) { |
43 | hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); | 44 | hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); |
44 | rdesc[557] = 0x35; | 45 | rdesc[557] = 0x35; |
45 | rdesc[559] = 0x45; | 46 | rdesc[559] = 0x45; |
46 | } | 47 | } |
48 | /* the same as above (s/usage/physical/) */ | ||
49 | if ((quirks & MS_RDESC_3K) && *rsize == 106 && | ||
50 | !memcmp((char []){ 0x19, 0x00, 0x29, 0xff }, | ||
51 | &rdesc[94], 4)) { | ||
52 | rdesc[94] = 0x35; | ||
53 | rdesc[96] = 0x45; | ||
54 | } | ||
47 | return rdesc; | 55 | return rdesc; |
48 | } | 56 | } |
49 | 57 | ||
@@ -192,7 +200,7 @@ static const struct hid_device_id ms_devices[] = { | |||
192 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), | 200 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), |
193 | .driver_data = MS_PRESENTER }, | 201 | .driver_data = MS_PRESENTER }, |
194 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K), | 202 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K), |
195 | .driver_data = MS_ERGONOMY }, | 203 | .driver_data = MS_ERGONOMY | MS_RDESC_3K }, |
196 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), | 204 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), |
197 | .driver_data = MS_NOGET }, | 205 | .driver_data = MS_NOGET }, |
198 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), | 206 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 3eb02b94fc8..7867d69f0ef 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -210,8 +210,7 @@ static struct mt_class mt_classes[] = { | |||
210 | }, | 210 | }, |
211 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | 211 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
212 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | 212 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | |
213 | MT_QUIRK_SLOT_IS_CONTACTNUMBER, | 213 | MT_QUIRK_SLOT_IS_CONTACTNUMBER |
214 | .maxcontacts = 10 | ||
215 | }, | 214 | }, |
216 | 215 | ||
217 | { .name = MT_CLS_FLATFROG, | 216 | { .name = MT_CLS_FLATFROG, |
@@ -421,11 +420,11 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
421 | * contact max are global to the report */ | 420 | * contact max are global to the report */ |
422 | td->last_field_index = field->index; | 421 | td->last_field_index = field->index; |
423 | return -1; | 422 | return -1; |
424 | } | ||
425 | case HID_DG_TOUCH: | 423 | case HID_DG_TOUCH: |
426 | /* Legacy devices use TIPSWITCH and not TOUCH. | 424 | /* Legacy devices use TIPSWITCH and not TOUCH. |
427 | * Let's just ignore this field. */ | 425 | * Let's just ignore this field. */ |
428 | return -1; | 426 | return -1; |
427 | } | ||
429 | /* let hid-input decide for the others */ | 428 | /* let hid-input decide for the others */ |
430 | return 0; | 429 | return 0; |
431 | 430 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 68ad7d25551..4f411040738 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * fam15h_power.c - AMD Family 15h processor power monitoring | 2 | * fam15h_power.c - AMD Family 15h processor power monitoring |
3 | * | 3 | * |
4 | * Copyright (c) 2011 Advanced Micro Devices, Inc. | 4 | * Copyright (c) 2011 Advanced Micro Devices, Inc. |
5 | * Author: Andreas Herrmann <andreas.herrmann3@amd.com> | 5 | * Author: Andreas Herrmann <herrmann.der.user@googlemail.com> |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * This driver is free software; you can redistribute it and/or | 8 | * This driver is free software; you can redistribute it and/or |
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/processor.h> | 28 | #include <asm/processor.h> |
29 | 29 | ||
30 | MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor"); | 30 | MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor"); |
31 | MODULE_AUTHOR("Andreas Herrmann <andreas.herrmann3@amd.com>"); | 31 | MODULE_AUTHOR("Andreas Herrmann <herrmann.der.user@googlemail.com>"); |
32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
33 | 33 | ||
34 | /* D18F3 */ | 34 | /* D18F3 */ |
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 36509ae3208..1381a2e3bbd 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
@@ -630,7 +630,9 @@ static struct platform_driver gpio_fan_driver = { | |||
630 | .driver = { | 630 | .driver = { |
631 | .name = "gpio-fan", | 631 | .name = "gpio-fan", |
632 | .pm = GPIO_FAN_PM, | 632 | .pm = GPIO_FAN_PM, |
633 | #ifdef CONFIG_OF_GPIO | ||
633 | .of_match_table = of_match_ptr(of_gpio_fan_match), | 634 | .of_match_table = of_match_ptr(of_gpio_fan_match), |
635 | #endif | ||
634 | }, | 636 | }, |
635 | }; | 637 | }; |
636 | 638 | ||
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index beee6b2d361..1722f50f247 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o | |||
8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | 8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o |
9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o | 9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o |
10 | obj-y += algos/ busses/ muxes/ | 10 | obj-y += algos/ busses/ muxes/ |
11 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | ||
11 | 12 | ||
12 | ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG | 13 | ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG |
13 | CFLAGS_i2c-core.o := -Wno-deprecated-declarations | 14 | CFLAGS_i2c-core.o := -Wno-deprecated-declarations |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 65dd599a026..e9df4612b7e 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -81,7 +81,6 @@ config I2C_I801 | |||
81 | tristate "Intel 82801 (ICH/PCH)" | 81 | tristate "Intel 82801 (ICH/PCH)" |
82 | depends on PCI | 82 | depends on PCI |
83 | select CHECK_SIGNATURE if X86 && DMI | 83 | select CHECK_SIGNATURE if X86 && DMI |
84 | select GPIOLIB if I2C_MUX | ||
85 | help | 84 | help |
86 | If you say yes to this option, support will be included for the Intel | 85 | If you say yes to this option, support will be included for the Intel |
87 | 801 family of mainboard I2C interfaces. Specifically, the following | 86 | 801 family of mainboard I2C interfaces. Specifically, the following |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 2d33d62952c..395b516ffa0 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -85,7 +85,6 @@ obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o | |||
85 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o | 85 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o |
86 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o | 86 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o |
87 | obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o | 87 | obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o |
88 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | ||
89 | obj-$(CONFIG_SCx200_ACB) += scx200_acb.o | 88 | obj-$(CONFIG_SCx200_ACB) += scx200_acb.o |
90 | obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o | 89 | obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o |
91 | 90 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 37793156bd9..6abc00d5988 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -82,7 +82,8 @@ | |||
82 | #include <linux/wait.h> | 82 | #include <linux/wait.h> |
83 | #include <linux/err.h> | 83 | #include <linux/err.h> |
84 | 84 | ||
85 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 85 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
86 | defined CONFIG_DMI | ||
86 | #include <linux/gpio.h> | 87 | #include <linux/gpio.h> |
87 | #include <linux/i2c-mux-gpio.h> | 88 | #include <linux/i2c-mux-gpio.h> |
88 | #include <linux/platform_device.h> | 89 | #include <linux/platform_device.h> |
@@ -192,7 +193,8 @@ struct i801_priv { | |||
192 | int len; | 193 | int len; |
193 | u8 *data; | 194 | u8 *data; |
194 | 195 | ||
195 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 196 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
197 | defined CONFIG_DMI | ||
196 | const struct i801_mux_config *mux_drvdata; | 198 | const struct i801_mux_config *mux_drvdata; |
197 | struct platform_device *mux_pdev; | 199 | struct platform_device *mux_pdev; |
198 | #endif | 200 | #endif |
@@ -921,7 +923,8 @@ static void __init input_apanel_init(void) {} | |||
921 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} | 923 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} |
922 | #endif /* CONFIG_X86 && CONFIG_DMI */ | 924 | #endif /* CONFIG_X86 && CONFIG_DMI */ |
923 | 925 | ||
924 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 926 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
927 | defined CONFIG_DMI | ||
925 | static struct i801_mux_config i801_mux_config_asus_z8_d12 = { | 928 | static struct i801_mux_config i801_mux_config_asus_z8_d12 = { |
926 | .gpio_chip = "gpio_ich", | 929 | .gpio_chip = "gpio_ich", |
927 | .values = { 0x02, 0x03 }, | 930 | .values = { 0x02, 0x03 }, |
@@ -1059,7 +1062,7 @@ static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) | |||
1059 | 1062 | ||
1060 | id = dmi_first_match(mux_dmi_table); | 1063 | id = dmi_first_match(mux_dmi_table); |
1061 | if (id) { | 1064 | if (id) { |
1062 | /* Remove from branch classes from trunk */ | 1065 | /* Remove branch classes from trunk */ |
1063 | mux_config = id->driver_data; | 1066 | mux_config = id->driver_data; |
1064 | for (i = 0; i < mux_config->n_values; i++) | 1067 | for (i = 0; i < mux_config->n_values; i++) |
1065 | class &= ~mux_config->classes[i]; | 1068 | class &= ~mux_config->classes[i]; |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 1f58197062c..286ca191782 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Freescale MXS I2C bus driver | 2 | * Freescale MXS I2C bus driver |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K. | 4 | * Copyright (C) 2011-2012 Wolfram Sang, Pengutronix e.K. |
5 | * | 5 | * |
6 | * based on a (non-working) driver which was: | 6 | * based on a (non-working) driver which was: |
7 | * | 7 | * |
@@ -35,10 +35,6 @@ | |||
35 | 35 | ||
36 | #define DRIVER_NAME "mxs-i2c" | 36 | #define DRIVER_NAME "mxs-i2c" |
37 | 37 | ||
38 | static bool use_pioqueue; | ||
39 | module_param(use_pioqueue, bool, 0); | ||
40 | MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA"); | ||
41 | |||
42 | #define MXS_I2C_CTRL0 (0x00) | 38 | #define MXS_I2C_CTRL0 (0x00) |
43 | #define MXS_I2C_CTRL0_SET (0x04) | 39 | #define MXS_I2C_CTRL0_SET (0x04) |
44 | 40 | ||
@@ -75,23 +71,6 @@ MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA"); | |||
75 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \ | 71 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \ |
76 | MXS_I2C_CTRL1_SLAVE_IRQ) | 72 | MXS_I2C_CTRL1_SLAVE_IRQ) |
77 | 73 | ||
78 | #define MXS_I2C_QUEUECTRL (0x60) | ||
79 | #define MXS_I2C_QUEUECTRL_SET (0x64) | ||
80 | #define MXS_I2C_QUEUECTRL_CLR (0x68) | ||
81 | |||
82 | #define MXS_I2C_QUEUECTRL_QUEUE_RUN 0x20 | ||
83 | #define MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE 0x04 | ||
84 | |||
85 | #define MXS_I2C_QUEUESTAT (0x70) | ||
86 | #define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000 | ||
87 | #define MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK 0x0000001F | ||
88 | |||
89 | #define MXS_I2C_QUEUECMD (0x80) | ||
90 | |||
91 | #define MXS_I2C_QUEUEDATA (0x90) | ||
92 | |||
93 | #define MXS_I2C_DATA (0xa0) | ||
94 | |||
95 | 74 | ||
96 | #define MXS_CMD_I2C_SELECT (MXS_I2C_CTRL0_RETAIN_CLOCK | \ | 75 | #define MXS_CMD_I2C_SELECT (MXS_I2C_CTRL0_RETAIN_CLOCK | \ |
97 | MXS_I2C_CTRL0_PRE_SEND_START | \ | 76 | MXS_I2C_CTRL0_PRE_SEND_START | \ |
@@ -153,7 +132,6 @@ struct mxs_i2c_dev { | |||
153 | const struct mxs_i2c_speed_config *speed; | 132 | const struct mxs_i2c_speed_config *speed; |
154 | 133 | ||
155 | /* DMA support components */ | 134 | /* DMA support components */ |
156 | bool dma_mode; | ||
157 | int dma_channel; | 135 | int dma_channel; |
158 | struct dma_chan *dmach; | 136 | struct dma_chan *dmach; |
159 | struct mxs_dma_data dma_data; | 137 | struct mxs_dma_data dma_data; |
@@ -172,99 +150,6 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c) | |||
172 | writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2); | 150 | writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2); |
173 | 151 | ||
174 | writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET); | 152 | writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET); |
175 | if (i2c->dma_mode) | ||
176 | writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE, | ||
177 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
178 | else | ||
179 | writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE, | ||
180 | i2c->regs + MXS_I2C_QUEUECTRL_SET); | ||
181 | } | ||
182 | |||
183 | static void mxs_i2c_pioq_setup_read(struct mxs_i2c_dev *i2c, u8 addr, int len, | ||
184 | int flags) | ||
185 | { | ||
186 | u32 data; | ||
187 | |||
188 | writel(MXS_CMD_I2C_SELECT, i2c->regs + MXS_I2C_QUEUECMD); | ||
189 | |||
190 | data = (addr << 1) | I2C_SMBUS_READ; | ||
191 | writel(data, i2c->regs + MXS_I2C_DATA); | ||
192 | |||
193 | data = MXS_CMD_I2C_READ | MXS_I2C_CTRL0_XFER_COUNT(len) | flags; | ||
194 | writel(data, i2c->regs + MXS_I2C_QUEUECMD); | ||
195 | } | ||
196 | |||
197 | static void mxs_i2c_pioq_setup_write(struct mxs_i2c_dev *i2c, | ||
198 | u8 addr, u8 *buf, int len, int flags) | ||
199 | { | ||
200 | u32 data; | ||
201 | int i, shifts_left; | ||
202 | |||
203 | data = MXS_CMD_I2C_WRITE | MXS_I2C_CTRL0_XFER_COUNT(len + 1) | flags; | ||
204 | writel(data, i2c->regs + MXS_I2C_QUEUECMD); | ||
205 | |||
206 | /* | ||
207 | * We have to copy the slave address (u8) and buffer (arbitrary number | ||
208 | * of u8) into the data register (u32). To achieve that, the u8 are put | ||
209 | * into the MSBs of 'data' which is then shifted for the next u8. When | ||
210 | * appropriate, 'data' is written to MXS_I2C_DATA. So, the first u32 | ||
211 | * looks like this: | ||
212 | * | ||
213 | * 3 2 1 0 | ||
214 | * 10987654|32109876|54321098|76543210 | ||
215 | * --------+--------+--------+-------- | ||
216 | * buffer+2|buffer+1|buffer+0|slave_addr | ||
217 | */ | ||
218 | |||
219 | data = ((addr << 1) | I2C_SMBUS_WRITE) << 24; | ||
220 | |||
221 | for (i = 0; i < len; i++) { | ||
222 | data >>= 8; | ||
223 | data |= buf[i] << 24; | ||
224 | if ((i & 3) == 2) | ||
225 | writel(data, i2c->regs + MXS_I2C_DATA); | ||
226 | } | ||
227 | |||
228 | /* Write out the remaining bytes if any */ | ||
229 | shifts_left = 24 - (i & 3) * 8; | ||
230 | if (shifts_left) | ||
231 | writel(data >> shifts_left, i2c->regs + MXS_I2C_DATA); | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | * TODO: should be replaceable with a waitqueue and RD_QUEUE_IRQ (setting the | ||
236 | * rd_threshold to 1). Couldn't get this to work, though. | ||
237 | */ | ||
238 | static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c) | ||
239 | { | ||
240 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | ||
241 | |||
242 | while (readl(i2c->regs + MXS_I2C_QUEUESTAT) | ||
243 | & MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY) { | ||
244 | if (time_after(jiffies, timeout)) | ||
245 | return -ETIMEDOUT; | ||
246 | cond_resched(); | ||
247 | } | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len) | ||
253 | { | ||
254 | u32 uninitialized_var(data); | ||
255 | int i; | ||
256 | |||
257 | for (i = 0; i < len; i++) { | ||
258 | if ((i & 3) == 0) { | ||
259 | if (mxs_i2c_wait_for_data(i2c)) | ||
260 | return -ETIMEDOUT; | ||
261 | data = readl(i2c->regs + MXS_I2C_QUEUEDATA); | ||
262 | } | ||
263 | buf[i] = data & 0xff; | ||
264 | data >>= 8; | ||
265 | } | ||
266 | |||
267 | return 0; | ||
268 | } | 153 | } |
269 | 154 | ||
270 | static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c) | 155 | static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c) |
@@ -432,39 +317,17 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
432 | init_completion(&i2c->cmd_complete); | 317 | init_completion(&i2c->cmd_complete); |
433 | i2c->cmd_err = 0; | 318 | i2c->cmd_err = 0; |
434 | 319 | ||
435 | if (i2c->dma_mode) { | 320 | ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); |
436 | ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); | 321 | if (ret) |
437 | if (ret) | 322 | return ret; |
438 | return ret; | ||
439 | } else { | ||
440 | if (msg->flags & I2C_M_RD) { | ||
441 | mxs_i2c_pioq_setup_read(i2c, msg->addr, | ||
442 | msg->len, flags); | ||
443 | } else { | ||
444 | mxs_i2c_pioq_setup_write(i2c, msg->addr, msg->buf, | ||
445 | msg->len, flags); | ||
446 | } | ||
447 | |||
448 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
449 | i2c->regs + MXS_I2C_QUEUECTRL_SET); | ||
450 | } | ||
451 | 323 | ||
452 | ret = wait_for_completion_timeout(&i2c->cmd_complete, | 324 | ret = wait_for_completion_timeout(&i2c->cmd_complete, |
453 | msecs_to_jiffies(1000)); | 325 | msecs_to_jiffies(1000)); |
454 | if (ret == 0) | 326 | if (ret == 0) |
455 | goto timeout; | 327 | goto timeout; |
456 | 328 | ||
457 | if (!i2c->dma_mode && !i2c->cmd_err && (msg->flags & I2C_M_RD)) { | ||
458 | ret = mxs_i2c_finish_read(i2c, msg->buf, msg->len); | ||
459 | if (ret) | ||
460 | goto timeout; | ||
461 | } | ||
462 | |||
463 | if (i2c->cmd_err == -ENXIO) | 329 | if (i2c->cmd_err == -ENXIO) |
464 | mxs_i2c_reset(i2c); | 330 | mxs_i2c_reset(i2c); |
465 | else | ||
466 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
467 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
468 | 331 | ||
469 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); | 332 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); |
470 | 333 | ||
@@ -472,8 +335,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
472 | 335 | ||
473 | timeout: | 336 | timeout: |
474 | dev_dbg(i2c->dev, "Timeout!\n"); | 337 | dev_dbg(i2c->dev, "Timeout!\n"); |
475 | if (i2c->dma_mode) | 338 | mxs_i2c_dma_finish(i2c); |
476 | mxs_i2c_dma_finish(i2c); | ||
477 | mxs_i2c_reset(i2c); | 339 | mxs_i2c_reset(i2c); |
478 | return -ETIMEDOUT; | 340 | return -ETIMEDOUT; |
479 | } | 341 | } |
@@ -502,7 +364,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
502 | { | 364 | { |
503 | struct mxs_i2c_dev *i2c = dev_id; | 365 | struct mxs_i2c_dev *i2c = dev_id; |
504 | u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; | 366 | u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; |
505 | bool is_last_cmd; | ||
506 | 367 | ||
507 | if (!stat) | 368 | if (!stat) |
508 | return IRQ_NONE; | 369 | return IRQ_NONE; |
@@ -515,14 +376,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
515 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ | 376 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ |
516 | i2c->cmd_err = -EIO; | 377 | i2c->cmd_err = -EIO; |
517 | 378 | ||
518 | if (!i2c->dma_mode) { | ||
519 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & | ||
520 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; | ||
521 | |||
522 | if (is_last_cmd || i2c->cmd_err) | ||
523 | complete(&i2c->cmd_complete); | ||
524 | } | ||
525 | |||
526 | writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); | 379 | writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); |
527 | 380 | ||
528 | return IRQ_HANDLED; | 381 | return IRQ_HANDLED; |
@@ -556,23 +409,14 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) | |||
556 | int ret; | 409 | int ret; |
557 | 410 | ||
558 | /* | 411 | /* |
559 | * The MXS I2C DMA mode is prefered and enabled by default. | ||
560 | * The PIO mode is still supported, but should be used only | ||
561 | * for debuging purposes etc. | ||
562 | */ | ||
563 | i2c->dma_mode = !use_pioqueue; | ||
564 | if (!i2c->dma_mode) | ||
565 | dev_info(dev, "Using PIOQUEUE mode for I2C transfers!\n"); | ||
566 | |||
567 | /* | ||
568 | * TODO: This is a temporary solution and should be changed | 412 | * TODO: This is a temporary solution and should be changed |
569 | * to use generic DMA binding later when the helpers get in. | 413 | * to use generic DMA binding later when the helpers get in. |
570 | */ | 414 | */ |
571 | ret = of_property_read_u32(node, "fsl,i2c-dma-channel", | 415 | ret = of_property_read_u32(node, "fsl,i2c-dma-channel", |
572 | &i2c->dma_channel); | 416 | &i2c->dma_channel); |
573 | if (ret) { | 417 | if (ret) { |
574 | dev_warn(dev, "Failed to get DMA channel, using PIOQUEUE!\n"); | 418 | dev_err(dev, "Failed to get DMA channel!\n"); |
575 | i2c->dma_mode = 0; | 419 | return -ENODEV; |
576 | } | 420 | } |
577 | 421 | ||
578 | ret = of_property_read_u32(node, "clock-frequency", &speed); | 422 | ret = of_property_read_u32(node, "clock-frequency", &speed); |
@@ -634,15 +478,13 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev) | |||
634 | } | 478 | } |
635 | 479 | ||
636 | /* Setup the DMA */ | 480 | /* Setup the DMA */ |
637 | if (i2c->dma_mode) { | 481 | dma_cap_zero(mask); |
638 | dma_cap_zero(mask); | 482 | dma_cap_set(DMA_SLAVE, mask); |
639 | dma_cap_set(DMA_SLAVE, mask); | 483 | i2c->dma_data.chan_irq = dmairq; |
640 | i2c->dma_data.chan_irq = dmairq; | 484 | i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c); |
641 | i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c); | 485 | if (!i2c->dmach) { |
642 | if (!i2c->dmach) { | 486 | dev_err(dev, "Failed to request dma\n"); |
643 | dev_err(dev, "Failed to request dma\n"); | 487 | return -ENODEV; |
644 | return -ENODEV; | ||
645 | } | ||
646 | } | 488 | } |
647 | 489 | ||
648 | platform_set_drvdata(pdev, i2c); | 490 | platform_set_drvdata(pdev, i2c); |
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 698d7acb0f0..02c3115a2df 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c | |||
@@ -644,7 +644,11 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
644 | 644 | ||
645 | pm_runtime_get_sync(&dev->adev->dev); | 645 | pm_runtime_get_sync(&dev->adev->dev); |
646 | 646 | ||
647 | clk_enable(dev->clk); | 647 | status = clk_prepare_enable(dev->clk); |
648 | if (status) { | ||
649 | dev_err(&dev->adev->dev, "can't prepare_enable clock\n"); | ||
650 | goto out_clk; | ||
651 | } | ||
648 | 652 | ||
649 | status = init_hw(dev); | 653 | status = init_hw(dev); |
650 | if (status) | 654 | if (status) |
@@ -671,7 +675,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
671 | } | 675 | } |
672 | 676 | ||
673 | out: | 677 | out: |
674 | clk_disable(dev->clk); | 678 | clk_disable_unprepare(dev->clk); |
679 | out_clk: | ||
675 | pm_runtime_put_sync(&dev->adev->dev); | 680 | pm_runtime_put_sync(&dev->adev->dev); |
676 | 681 | ||
677 | dev->busy = false; | 682 | dev->busy = false; |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index f981ac4e678..dcea77bf6f5 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -742,7 +742,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
742 | } | 742 | } |
743 | 743 | ||
744 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, | 744 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, |
745 | tegra_i2c_isr, 0, pdev->name, i2c_dev); | 745 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); |
746 | if (ret) { | 746 | if (ret) { |
747 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); | 747 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); |
748 | return ret; | 748 | return ret; |
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/i2c-stub.c index b1b3447942c..d0a9c590c3c 100644 --- a/drivers/i2c/busses/i2c-stub.c +++ b/drivers/i2c/i2c-stub.c | |||
@@ -2,7 +2,7 @@ | |||
2 | i2c-stub.c - I2C/SMBus chip emulator | 2 | i2c-stub.c - I2C/SMBus chip emulator |
3 | 3 | ||
4 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> | 4 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> |
5 | Copyright (C) 2007 Jean Delvare <khali@linux-fr.org> | 5 | Copyright (C) 2007, 2012 Jean Delvare <khali@linux-fr.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
@@ -51,8 +51,8 @@ struct stub_chip { | |||
51 | static struct stub_chip *stub_chips; | 51 | static struct stub_chip *stub_chips; |
52 | 52 | ||
53 | /* Return negative errno on error. */ | 53 | /* Return negative errno on error. */ |
54 | static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | 54 | static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags, |
55 | char read_write, u8 command, int size, union i2c_smbus_data * data) | 55 | char read_write, u8 command, int size, union i2c_smbus_data *data) |
56 | { | 56 | { |
57 | s32 ret; | 57 | s32 ret; |
58 | int i, len; | 58 | int i, len; |
@@ -78,14 +78,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
78 | case I2C_SMBUS_BYTE: | 78 | case I2C_SMBUS_BYTE: |
79 | if (read_write == I2C_SMBUS_WRITE) { | 79 | if (read_write == I2C_SMBUS_WRITE) { |
80 | chip->pointer = command; | 80 | chip->pointer = command; |
81 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " | 81 | dev_dbg(&adap->dev, |
82 | "wrote 0x%02x.\n", | 82 | "smbus byte - addr 0x%02x, wrote 0x%02x.\n", |
83 | addr, command); | 83 | addr, command); |
84 | } else { | 84 | } else { |
85 | data->byte = chip->words[chip->pointer++] & 0xff; | 85 | data->byte = chip->words[chip->pointer++] & 0xff; |
86 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " | 86 | dev_dbg(&adap->dev, |
87 | "read 0x%02x.\n", | 87 | "smbus byte - addr 0x%02x, read 0x%02x.\n", |
88 | addr, data->byte); | 88 | addr, data->byte); |
89 | } | 89 | } |
90 | 90 | ||
91 | ret = 0; | 91 | ret = 0; |
@@ -95,14 +95,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
95 | if (read_write == I2C_SMBUS_WRITE) { | 95 | if (read_write == I2C_SMBUS_WRITE) { |
96 | chip->words[command] &= 0xff00; | 96 | chip->words[command] &= 0xff00; |
97 | chip->words[command] |= data->byte; | 97 | chip->words[command] |= data->byte; |
98 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 98 | dev_dbg(&adap->dev, |
99 | "wrote 0x%02x at 0x%02x.\n", | 99 | "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n", |
100 | addr, data->byte, command); | 100 | addr, data->byte, command); |
101 | } else { | 101 | } else { |
102 | data->byte = chip->words[command] & 0xff; | 102 | data->byte = chip->words[command] & 0xff; |
103 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 103 | dev_dbg(&adap->dev, |
104 | "read 0x%02x at 0x%02x.\n", | 104 | "smbus byte data - addr 0x%02x, read 0x%02x at 0x%02x.\n", |
105 | addr, data->byte, command); | 105 | addr, data->byte, command); |
106 | } | 106 | } |
107 | chip->pointer = command + 1; | 107 | chip->pointer = command + 1; |
108 | 108 | ||
@@ -112,14 +112,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
112 | case I2C_SMBUS_WORD_DATA: | 112 | case I2C_SMBUS_WORD_DATA: |
113 | if (read_write == I2C_SMBUS_WRITE) { | 113 | if (read_write == I2C_SMBUS_WRITE) { |
114 | chip->words[command] = data->word; | 114 | chip->words[command] = data->word; |
115 | dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " | 115 | dev_dbg(&adap->dev, |
116 | "wrote 0x%04x at 0x%02x.\n", | 116 | "smbus word data - addr 0x%02x, wrote 0x%04x at 0x%02x.\n", |
117 | addr, data->word, command); | 117 | addr, data->word, command); |
118 | } else { | 118 | } else { |
119 | data->word = chip->words[command]; | 119 | data->word = chip->words[command]; |
120 | dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " | 120 | dev_dbg(&adap->dev, |
121 | "read 0x%04x at 0x%02x.\n", | 121 | "smbus word data - addr 0x%02x, read 0x%04x at 0x%02x.\n", |
122 | addr, data->word, command); | 122 | addr, data->word, command); |
123 | } | 123 | } |
124 | 124 | ||
125 | ret = 0; | 125 | ret = 0; |
@@ -132,17 +132,17 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
132 | chip->words[command + i] &= 0xff00; | 132 | chip->words[command + i] &= 0xff00; |
133 | chip->words[command + i] |= data->block[1 + i]; | 133 | chip->words[command + i] |= data->block[1 + i]; |
134 | } | 134 | } |
135 | dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " | 135 | dev_dbg(&adap->dev, |
136 | "wrote %d bytes at 0x%02x.\n", | 136 | "i2c block data - addr 0x%02x, wrote %d bytes at 0x%02x.\n", |
137 | addr, len, command); | 137 | addr, len, command); |
138 | } else { | 138 | } else { |
139 | for (i = 0; i < len; i++) { | 139 | for (i = 0; i < len; i++) { |
140 | data->block[1 + i] = | 140 | data->block[1 + i] = |
141 | chip->words[command + i] & 0xff; | 141 | chip->words[command + i] & 0xff; |
142 | } | 142 | } |
143 | dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " | 143 | dev_dbg(&adap->dev, |
144 | "read %d bytes at 0x%02x.\n", | 144 | "i2c block data - addr 0x%02x, read %d bytes at 0x%02x.\n", |
145 | addr, len, command); | 145 | addr, len, command); |
146 | } | 146 | } |
147 | 147 | ||
148 | ret = 0; | 148 | ret = 0; |
@@ -179,25 +179,24 @@ static int __init i2c_stub_init(void) | |||
179 | int i, ret; | 179 | int i, ret; |
180 | 180 | ||
181 | if (!chip_addr[0]) { | 181 | if (!chip_addr[0]) { |
182 | printk(KERN_ERR "i2c-stub: Please specify a chip address\n"); | 182 | pr_err("i2c-stub: Please specify a chip address\n"); |
183 | return -ENODEV; | 183 | return -ENODEV; |
184 | } | 184 | } |
185 | 185 | ||
186 | for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { | 186 | for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { |
187 | if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) { | 187 | if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) { |
188 | printk(KERN_ERR "i2c-stub: Invalid chip address " | 188 | pr_err("i2c-stub: Invalid chip address 0x%02x\n", |
189 | "0x%02x\n", chip_addr[i]); | 189 | chip_addr[i]); |
190 | return -EINVAL; | 190 | return -EINVAL; |
191 | } | 191 | } |
192 | 192 | ||
193 | printk(KERN_INFO "i2c-stub: Virtual chip at 0x%02x\n", | 193 | pr_info("i2c-stub: Virtual chip at 0x%02x\n", chip_addr[i]); |
194 | chip_addr[i]); | ||
195 | } | 194 | } |
196 | 195 | ||
197 | /* Allocate memory for all chips at once */ | 196 | /* Allocate memory for all chips at once */ |
198 | stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); | 197 | stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); |
199 | if (!stub_chips) { | 198 | if (!stub_chips) { |
200 | printk(KERN_ERR "i2c-stub: Out of memory\n"); | 199 | pr_err("i2c-stub: Out of memory\n"); |
201 | return -ENOMEM; | 200 | return -ENOMEM; |
202 | } | 201 | } |
203 | 202 | ||
@@ -219,4 +218,3 @@ MODULE_LICENSE("GPL"); | |||
219 | 218 | ||
220 | module_init(i2c_stub_init); | 219 | module_init(i2c_stub_init); |
221 | module_exit(i2c_stub_exit); | 220 | module_exit(i2c_stub_exit); |
222 | |||
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 5a83afb3121..48309641b1b 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -335,6 +335,7 @@ config KEYBOARD_LOCOMO | |||
335 | config KEYBOARD_LPC32XX | 335 | config KEYBOARD_LPC32XX |
336 | tristate "LPC32XX matrix key scanner support" | 336 | tristate "LPC32XX matrix key scanner support" |
337 | depends on ARCH_LPC32XX && OF | 337 | depends on ARCH_LPC32XX && OF |
338 | select INPUT_MATRIXKMAP | ||
338 | help | 339 | help |
339 | Say Y here if you want to use NXP LPC32XX SoC key scanner interface, | 340 | Say Y here if you want to use NXP LPC32XX SoC key scanner interface, |
340 | connected to a key matrix. | 341 | connected to a key matrix. |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 803ff6fe021..cad9d5dd597 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -368,6 +368,9 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) | |||
368 | unsigned int mask = 0, direct_key_num = 0; | 368 | unsigned int mask = 0, direct_key_num = 0; |
369 | unsigned long kpc = 0; | 369 | unsigned long kpc = 0; |
370 | 370 | ||
371 | /* clear pending interrupt bit */ | ||
372 | keypad_readl(KPC); | ||
373 | |||
371 | /* enable matrix keys with automatic scan */ | 374 | /* enable matrix keys with automatic scan */ |
372 | if (pdata->matrix_key_rows && pdata->matrix_key_cols) { | 375 | if (pdata->matrix_key_rows && pdata->matrix_key_cols) { |
373 | kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL; | 376 | kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL; |
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c index 02ca8680ea5..6f7d9901303 100644 --- a/drivers/input/misc/xen-kbdfront.c +++ b/drivers/input/misc/xen-kbdfront.c | |||
@@ -311,7 +311,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, | |||
311 | case XenbusStateReconfiguring: | 311 | case XenbusStateReconfiguring: |
312 | case XenbusStateReconfigured: | 312 | case XenbusStateReconfigured: |
313 | case XenbusStateUnknown: | 313 | case XenbusStateUnknown: |
314 | case XenbusStateClosed: | ||
315 | break; | 314 | break; |
316 | 315 | ||
317 | case XenbusStateInitWait: | 316 | case XenbusStateInitWait: |
@@ -350,6 +349,10 @@ InitWait: | |||
350 | 349 | ||
351 | break; | 350 | break; |
352 | 351 | ||
352 | case XenbusStateClosed: | ||
353 | if (dev->state == XenbusStateClosed) | ||
354 | break; | ||
355 | /* Missed the backend's CLOSING state -- fallthrough */ | ||
353 | case XenbusStateClosing: | 356 | case XenbusStateClosing: |
354 | xenbus_frontend_closed(dev); | 357 | xenbus_frontend_closed(dev); |
355 | break; | 358 | break; |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 3a78f235fa3..2baff1b79a5 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -84,6 +84,10 @@ | |||
84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | 84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 |
85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | 85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 |
86 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | 86 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 |
87 | /* MacbookPro10,2 (unibody, October 2012) */ | ||
88 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | ||
89 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | ||
90 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | ||
87 | 91 | ||
88 | #define BCM5974_DEVICE(prod) { \ | 92 | #define BCM5974_DEVICE(prod) { \ |
89 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 93 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
@@ -137,6 +141,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
137 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), | 141 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), |
138 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), | 142 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), |
139 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | 143 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
144 | /* MacbookPro10,2 */ | ||
145 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | ||
146 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), | ||
147 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), | ||
140 | /* Terminating entry */ | 148 | /* Terminating entry */ |
141 | {} | 149 | {} |
142 | }; | 150 | }; |
@@ -379,6 +387,19 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
379 | { SN_COORD, -150, 6730 }, | 387 | { SN_COORD, -150, 6730 }, |
380 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | 388 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } |
381 | }, | 389 | }, |
390 | { | ||
391 | USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI, | ||
392 | USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO, | ||
393 | USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS, | ||
394 | HAS_INTEGRATED_BUTTON, | ||
395 | 0x84, sizeof(struct bt_data), | ||
396 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
397 | { SN_PRESSURE, 0, 300 }, | ||
398 | { SN_WIDTH, 0, 2048 }, | ||
399 | { SN_COORD, -4750, 5280 }, | ||
400 | { SN_COORD, -150, 6730 }, | ||
401 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | ||
402 | }, | ||
382 | {} | 403 | {} |
383 | }; | 404 | }; |
384 | 405 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 2c1e12bf2ab..858ad446de9 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -391,7 +391,7 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
391 | features->pktlen = WACOM_PKGLEN_TPC2FG; | 391 | features->pktlen = WACOM_PKGLEN_TPC2FG; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (features->type == MTSCREEN || WACOM_24HDT) | 394 | if (features->type == MTSCREEN || features->type == WACOM_24HDT) |
395 | features->pktlen = WACOM_PKGLEN_MTOUCH; | 395 | features->pktlen = WACOM_PKGLEN_MTOUCH; |
396 | 396 | ||
397 | if (features->type == BAMBOO_PT) { | 397 | if (features->type == BAMBOO_PT) { |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index aa601013117..0a67031ffc1 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -1518,6 +1518,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1518 | 1518 | ||
1519 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1519 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
1520 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | 1520 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); |
1521 | |||
1522 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
1523 | |||
1521 | wacom_setup_cintiq(wacom_wac); | 1524 | wacom_setup_cintiq(wacom_wac); |
1522 | break; | 1525 | break; |
1523 | 1526 | ||
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 1ba232cbc09..f7668b24c37 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -239,7 +239,7 @@ config TOUCHSCREEN_EETI | |||
239 | 239 | ||
240 | config TOUCHSCREEN_EGALAX | 240 | config TOUCHSCREEN_EGALAX |
241 | tristate "EETI eGalax multi-touch panel support" | 241 | tristate "EETI eGalax multi-touch panel support" |
242 | depends on I2C | 242 | depends on I2C && OF |
243 | help | 243 | help |
244 | Say Y here to enable support for I2C connected EETI | 244 | Say Y here to enable support for I2C connected EETI |
245 | eGalax multi-touch panels. | 245 | eGalax multi-touch panels. |
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index c1e3460f119..13fa62fdfb0 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/bitops.h> | 29 | #include <linux/bitops.h> |
30 | #include <linux/input/mt.h> | 30 | #include <linux/input/mt.h> |
31 | #include <linux/of_gpio.h> | ||
31 | 32 | ||
32 | /* | 33 | /* |
33 | * Mouse Mode: some panel may configure the controller to mouse mode, | 34 | * Mouse Mode: some panel may configure the controller to mouse mode, |
@@ -122,9 +123,17 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id) | |||
122 | /* wake up controller by an falling edge of interrupt gpio. */ | 123 | /* wake up controller by an falling edge of interrupt gpio. */ |
123 | static int egalax_wake_up_device(struct i2c_client *client) | 124 | static int egalax_wake_up_device(struct i2c_client *client) |
124 | { | 125 | { |
125 | int gpio = irq_to_gpio(client->irq); | 126 | struct device_node *np = client->dev.of_node; |
127 | int gpio; | ||
126 | int ret; | 128 | int ret; |
127 | 129 | ||
130 | if (!np) | ||
131 | return -ENODEV; | ||
132 | |||
133 | gpio = of_get_named_gpio(np, "wakeup-gpios", 0); | ||
134 | if (!gpio_is_valid(gpio)) | ||
135 | return -ENODEV; | ||
136 | |||
128 | ret = gpio_request(gpio, "egalax_irq"); | 137 | ret = gpio_request(gpio, "egalax_irq"); |
129 | if (ret < 0) { | 138 | if (ret < 0) { |
130 | dev_err(&client->dev, | 139 | dev_err(&client->dev, |
@@ -181,7 +190,11 @@ static int __devinit egalax_ts_probe(struct i2c_client *client, | |||
181 | ts->input_dev = input_dev; | 190 | ts->input_dev = input_dev; |
182 | 191 | ||
183 | /* controller may be in sleep, wake it up. */ | 192 | /* controller may be in sleep, wake it up. */ |
184 | egalax_wake_up_device(client); | 193 | error = egalax_wake_up_device(client); |
194 | if (error) { | ||
195 | dev_err(&client->dev, "Failed to wake up the controller\n"); | ||
196 | goto err_free_dev; | ||
197 | } | ||
185 | 198 | ||
186 | ret = egalax_firmware_version(client); | 199 | ret = egalax_firmware_version(client); |
187 | if (ret < 0) { | 200 | if (ret < 0) { |
@@ -274,11 +287,17 @@ static int egalax_ts_resume(struct device *dev) | |||
274 | 287 | ||
275 | static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); | 288 | static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); |
276 | 289 | ||
290 | static struct of_device_id egalax_ts_dt_ids[] = { | ||
291 | { .compatible = "eeti,egalax_ts" }, | ||
292 | { /* sentinel */ } | ||
293 | }; | ||
294 | |||
277 | static struct i2c_driver egalax_ts_driver = { | 295 | static struct i2c_driver egalax_ts_driver = { |
278 | .driver = { | 296 | .driver = { |
279 | .name = "egalax_ts", | 297 | .name = "egalax_ts", |
280 | .owner = THIS_MODULE, | 298 | .owner = THIS_MODULE, |
281 | .pm = &egalax_ts_pm_ops, | 299 | .pm = &egalax_ts_pm_ops, |
300 | .of_match_table = of_match_ptr(egalax_ts_dt_ids), | ||
282 | }, | 301 | }, |
283 | .id_table = egalax_ts_id, | 302 | .id_table = egalax_ts_id, |
284 | .probe = egalax_ts_probe, | 303 | .probe = egalax_ts_probe, |
diff --git a/drivers/input/touchscreen/tsc40.c b/drivers/input/touchscreen/tsc40.c index 63209aaa55f..eb96f168fb9 100644 --- a/drivers/input/touchscreen/tsc40.c +++ b/drivers/input/touchscreen/tsc40.c | |||
@@ -107,7 +107,6 @@ static int tsc_connect(struct serio *serio, struct serio_driver *drv) | |||
107 | __set_bit(BTN_TOUCH, input_dev->keybit); | 107 | __set_bit(BTN_TOUCH, input_dev->keybit); |
108 | input_set_abs_params(ptsc->dev, ABS_X, 0, 0x3ff, 0, 0); | 108 | input_set_abs_params(ptsc->dev, ABS_X, 0, 0x3ff, 0, 0); |
109 | input_set_abs_params(ptsc->dev, ABS_Y, 0, 0x3ff, 0, 0); | 109 | input_set_abs_params(ptsc->dev, ABS_Y, 0, 0x3ff, 0, 0); |
110 | input_set_abs_params(ptsc->dev, ABS_PRESSURE, 0, 0, 0, 0); | ||
111 | 110 | ||
112 | serio_set_drvdata(serio, ptsc); | 111 | serio_set_drvdata(serio, ptsc); |
113 | 112 | ||
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 45135f69509..5e7dc772f5d 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -315,8 +315,11 @@ static int run(struct mddev *mddev) | |||
315 | } | 315 | } |
316 | conf->nfaults = 0; | 316 | conf->nfaults = 0; |
317 | 317 | ||
318 | rdev_for_each(rdev, mddev) | 318 | rdev_for_each(rdev, mddev) { |
319 | conf->rdev = rdev; | 319 | conf->rdev = rdev; |
320 | disk_stack_limits(mddev->gendisk, rdev->bdev, | ||
321 | rdev->data_offset << 9); | ||
322 | } | ||
320 | 323 | ||
321 | md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); | 324 | md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); |
322 | mddev->private = conf; | 325 | mddev->private = conf; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 8034fbd6190..636bae0405e 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2710,7 +2710,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2710 | || disk_idx < 0) | 2710 | || disk_idx < 0) |
2711 | continue; | 2711 | continue; |
2712 | if (test_bit(Replacement, &rdev->flags)) | 2712 | if (test_bit(Replacement, &rdev->flags)) |
2713 | disk = conf->mirrors + conf->raid_disks + disk_idx; | 2713 | disk = conf->mirrors + mddev->raid_disks + disk_idx; |
2714 | else | 2714 | else |
2715 | disk = conf->mirrors + disk_idx; | 2715 | disk = conf->mirrors + disk_idx; |
2716 | 2716 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 906ccbd0f7d..d1295aff417 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1783,7 +1783,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
1783 | clear_bit(Unmerged, &rdev->flags); | 1783 | clear_bit(Unmerged, &rdev->flags); |
1784 | } | 1784 | } |
1785 | md_integrity_add_rdev(rdev, mddev); | 1785 | md_integrity_add_rdev(rdev, mddev); |
1786 | if (blk_queue_discard(bdev_get_queue(rdev->bdev))) | 1786 | if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev))) |
1787 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 1787 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); |
1788 | 1788 | ||
1789 | print_conf(conf); | 1789 | print_conf(conf); |
@@ -3613,11 +3613,14 @@ static int run(struct mddev *mddev) | |||
3613 | discard_supported = true; | 3613 | discard_supported = true; |
3614 | } | 3614 | } |
3615 | 3615 | ||
3616 | if (discard_supported) | 3616 | if (mddev->queue) { |
3617 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 3617 | if (discard_supported) |
3618 | else | 3618 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, |
3619 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 3619 | mddev->queue); |
3620 | 3620 | else | |
3621 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, | ||
3622 | mddev->queue); | ||
3623 | } | ||
3621 | /* need to check that every block has at least one working mirror */ | 3624 | /* need to check that every block has at least one working mirror */ |
3622 | if (!enough(conf, -1)) { | 3625 | if (!enough(conf, -1)) { |
3623 | printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n", | 3626 | printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n", |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index dc15d248443..ef8d2a080d1 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1060,7 +1060,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1060 | goto out; | 1060 | goto out; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | sscanf(buf, "%16s", ifname); /* IFNAMSIZ */ | 1063 | sscanf(buf, "%15s", ifname); /* IFNAMSIZ */ |
1064 | 1064 | ||
1065 | /* check to see if we are clearing primary */ | 1065 | /* check to see if we are clearing primary */ |
1066 | if (!strlen(ifname) || buf[0] == '\n') { | 1066 | if (!strlen(ifname) || buf[0] == '\n') { |
@@ -1237,7 +1237,7 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1237 | goto out; | 1237 | goto out; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | sscanf(buf, "%16s", ifname); /* IFNAMSIZ */ | 1240 | sscanf(buf, "%15s", ifname); /* IFNAMSIZ */ |
1241 | 1241 | ||
1242 | /* check to see if we are clearing active */ | 1242 | /* check to see if we are clearing active */ |
1243 | if (!strlen(ifname) || buf[0] == '\n') { | 1243 | if (!strlen(ifname) || buf[0] == '\n') { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index e2e45ee5df3..6dd0dd076cc 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -137,7 +137,16 @@ | |||
137 | #define LINK_20GTFD LINK_STATUS_SPEED_AND_DUPLEX_20GTFD | 137 | #define LINK_20GTFD LINK_STATUS_SPEED_AND_DUPLEX_20GTFD |
138 | #define LINK_20GXFD LINK_STATUS_SPEED_AND_DUPLEX_20GXFD | 138 | #define LINK_20GXFD LINK_STATUS_SPEED_AND_DUPLEX_20GXFD |
139 | 139 | ||
140 | 140 | #define LINK_UPDATE_MASK \ | |
141 | (LINK_STATUS_SPEED_AND_DUPLEX_MASK | \ | ||
142 | LINK_STATUS_LINK_UP | \ | ||
143 | LINK_STATUS_PHYSICAL_LINK_FLAG | \ | ||
144 | LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | \ | ||
145 | LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | \ | ||
146 | LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | \ | ||
147 | LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | \ | ||
148 | LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | \ | ||
149 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) | ||
141 | 150 | ||
142 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 | 151 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 |
143 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 | 152 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 |
@@ -3295,6 +3304,21 @@ static void bnx2x_serdes_deassert(struct bnx2x *bp, u8 port) | |||
3295 | DEFAULT_PHY_DEV_ADDR); | 3304 | DEFAULT_PHY_DEV_ADDR); |
3296 | } | 3305 | } |
3297 | 3306 | ||
3307 | static void bnx2x_xgxs_specific_func(struct bnx2x_phy *phy, | ||
3308 | struct link_params *params, | ||
3309 | u32 action) | ||
3310 | { | ||
3311 | struct bnx2x *bp = params->bp; | ||
3312 | switch (action) { | ||
3313 | case PHY_INIT: | ||
3314 | /* Set correct devad */ | ||
3315 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + params->port*0x18, 0); | ||
3316 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18, | ||
3317 | phy->def_md_devad); | ||
3318 | break; | ||
3319 | } | ||
3320 | } | ||
3321 | |||
3298 | static void bnx2x_xgxs_deassert(struct link_params *params) | 3322 | static void bnx2x_xgxs_deassert(struct link_params *params) |
3299 | { | 3323 | { |
3300 | struct bnx2x *bp = params->bp; | 3324 | struct bnx2x *bp = params->bp; |
@@ -3309,10 +3333,8 @@ static void bnx2x_xgxs_deassert(struct link_params *params) | |||
3309 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val); | 3333 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val); |
3310 | udelay(500); | 3334 | udelay(500); |
3311 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); | 3335 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); |
3312 | 3336 | bnx2x_xgxs_specific_func(¶ms->phy[INT_PHY], params, | |
3313 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + port*0x18, 0); | 3337 | PHY_INIT); |
3314 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, | ||
3315 | params->phy[INT_PHY].def_md_devad); | ||
3316 | } | 3338 | } |
3317 | 3339 | ||
3318 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, | 3340 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, |
@@ -3545,14 +3567,11 @@ static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, | |||
3545 | static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | 3567 | static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, |
3546 | struct link_params *params, | 3568 | struct link_params *params, |
3547 | struct link_vars *vars) { | 3569 | struct link_vars *vars) { |
3548 | u16 val16 = 0, lane, i; | 3570 | u16 lane, i, cl72_ctrl, an_adv = 0; |
3571 | u16 ucode_ver; | ||
3549 | struct bnx2x *bp = params->bp; | 3572 | struct bnx2x *bp = params->bp; |
3550 | static struct bnx2x_reg_set reg_set[] = { | 3573 | static struct bnx2x_reg_set reg_set[] = { |
3551 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, | 3574 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, |
3552 | {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0}, | ||
3553 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0}, | ||
3554 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff}, | ||
3555 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555}, | ||
3556 | {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0}, | 3575 | {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0}, |
3557 | {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415}, | 3576 | {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415}, |
3558 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190}, | 3577 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190}, |
@@ -3565,12 +3584,19 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3565 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3584 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3566 | reg_set[i].val); | 3585 | reg_set[i].val); |
3567 | 3586 | ||
3587 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3588 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &cl72_ctrl); | ||
3589 | cl72_ctrl &= 0xf8ff; | ||
3590 | cl72_ctrl |= 0x3800; | ||
3591 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3592 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, cl72_ctrl); | ||
3593 | |||
3568 | /* Check adding advertisement for 1G KX */ | 3594 | /* Check adding advertisement for 1G KX */ |
3569 | if (((vars->line_speed == SPEED_AUTO_NEG) && | 3595 | if (((vars->line_speed == SPEED_AUTO_NEG) && |
3570 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) || | 3596 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) || |
3571 | (vars->line_speed == SPEED_1000)) { | 3597 | (vars->line_speed == SPEED_1000)) { |
3572 | u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2; | 3598 | u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2; |
3573 | val16 |= (1<<5); | 3599 | an_adv |= (1<<5); |
3574 | 3600 | ||
3575 | /* Enable CL37 1G Parallel Detect */ | 3601 | /* Enable CL37 1G Parallel Detect */ |
3576 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1); | 3602 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1); |
@@ -3580,11 +3606,14 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3580 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) || | 3606 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) || |
3581 | (vars->line_speed == SPEED_10000)) { | 3607 | (vars->line_speed == SPEED_10000)) { |
3582 | /* Check adding advertisement for 10G KR */ | 3608 | /* Check adding advertisement for 10G KR */ |
3583 | val16 |= (1<<7); | 3609 | an_adv |= (1<<7); |
3584 | /* Enable 10G Parallel Detect */ | 3610 | /* Enable 10G Parallel Detect */ |
3611 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | ||
3612 | MDIO_AER_BLOCK_AER_REG, 0); | ||
3613 | |||
3585 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3614 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3586 | MDIO_WC_REG_PAR_DET_10G_CTRL, 1); | 3615 | MDIO_WC_REG_PAR_DET_10G_CTRL, 1); |
3587 | 3616 | bnx2x_set_aer_mmd(params, phy); | |
3588 | DP(NETIF_MSG_LINK, "Advertize 10G\n"); | 3617 | DP(NETIF_MSG_LINK, "Advertize 10G\n"); |
3589 | } | 3618 | } |
3590 | 3619 | ||
@@ -3604,7 +3633,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3604 | 3633 | ||
3605 | /* Advertised speeds */ | 3634 | /* Advertised speeds */ |
3606 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3635 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3607 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, val16); | 3636 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, an_adv); |
3608 | 3637 | ||
3609 | /* Advertised and set FEC (Forward Error Correction) */ | 3638 | /* Advertised and set FEC (Forward Error Correction) */ |
3610 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3639 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
@@ -3628,9 +3657,10 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3628 | /* Set KR Autoneg Work-Around flag for Warpcore version older than D108 | 3657 | /* Set KR Autoneg Work-Around flag for Warpcore version older than D108 |
3629 | */ | 3658 | */ |
3630 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | 3659 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
3631 | MDIO_WC_REG_UC_INFO_B1_VERSION, &val16); | 3660 | MDIO_WC_REG_UC_INFO_B1_VERSION, &ucode_ver); |
3632 | if (val16 < 0xd108) { | 3661 | if (ucode_ver < 0xd108) { |
3633 | DP(NETIF_MSG_LINK, "Enable AN KR work-around\n"); | 3662 | DP(NETIF_MSG_LINK, "Enable AN KR work-around. WC ver:0x%x\n", |
3663 | ucode_ver); | ||
3634 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; | 3664 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; |
3635 | } | 3665 | } |
3636 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | 3666 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, |
@@ -3651,21 +3681,16 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, | |||
3651 | struct link_vars *vars) | 3681 | struct link_vars *vars) |
3652 | { | 3682 | { |
3653 | struct bnx2x *bp = params->bp; | 3683 | struct bnx2x *bp = params->bp; |
3654 | u16 i; | 3684 | u16 val16, i, lane; |
3655 | static struct bnx2x_reg_set reg_set[] = { | 3685 | static struct bnx2x_reg_set reg_set[] = { |
3656 | /* Disable Autoneg */ | 3686 | /* Disable Autoneg */ |
3657 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, | 3687 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, |
3658 | {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0}, | ||
3659 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, | 3688 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, |
3660 | 0x3f00}, | 3689 | 0x3f00}, |
3661 | {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0}, | 3690 | {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0}, |
3662 | {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0}, | 3691 | {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0}, |
3663 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1}, | 3692 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1}, |
3664 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa}, | 3693 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa}, |
3665 | /* Disable CL36 PCS Tx */ | ||
3666 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0x0}, | ||
3667 | /* Double Wide Single Data Rate @ pll rate */ | ||
3668 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0xFFFF}, | ||
3669 | /* Leave cl72 training enable, needed for KR */ | 3694 | /* Leave cl72 training enable, needed for KR */ |
3670 | {MDIO_PMA_DEVAD, | 3695 | {MDIO_PMA_DEVAD, |
3671 | MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150, | 3696 | MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150, |
@@ -3676,11 +3701,24 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, | |||
3676 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3701 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3677 | reg_set[i].val); | 3702 | reg_set[i].val); |
3678 | 3703 | ||
3679 | /* Leave CL72 enabled */ | 3704 | lane = bnx2x_get_warpcore_lane(phy, params); |
3680 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | 3705 | /* Global registers */ |
3681 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, | 3706 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
3682 | 0x3800); | 3707 | MDIO_AER_BLOCK_AER_REG, 0); |
3708 | /* Disable CL36 PCS Tx */ | ||
3709 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3710 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16); | ||
3711 | val16 &= ~(0x0011 << lane); | ||
3712 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3713 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16); | ||
3683 | 3714 | ||
3715 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3716 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16); | ||
3717 | val16 |= (0x0303 << (lane << 1)); | ||
3718 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3719 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16); | ||
3720 | /* Restore AER */ | ||
3721 | bnx2x_set_aer_mmd(params, phy); | ||
3684 | /* Set speed via PMA/PMD register */ | 3722 | /* Set speed via PMA/PMD register */ |
3685 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, | 3723 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, |
3686 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040); | 3724 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040); |
@@ -4303,7 +4341,7 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, | |||
4303 | struct link_params *params) | 4341 | struct link_params *params) |
4304 | { | 4342 | { |
4305 | struct bnx2x *bp = params->bp; | 4343 | struct bnx2x *bp = params->bp; |
4306 | u16 val16; | 4344 | u16 val16, lane; |
4307 | bnx2x_sfp_e3_set_transmitter(params, phy, 0); | 4345 | bnx2x_sfp_e3_set_transmitter(params, phy, 0); |
4308 | bnx2x_set_mdio_clk(bp, params->chip_id, params->port); | 4346 | bnx2x_set_mdio_clk(bp, params->chip_id, params->port); |
4309 | bnx2x_set_aer_mmd(params, phy); | 4347 | bnx2x_set_aer_mmd(params, phy); |
@@ -4340,6 +4378,30 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, | |||
4340 | MDIO_WC_REG_XGXSBLK1_LANECTRL2, | 4378 | MDIO_WC_REG_XGXSBLK1_LANECTRL2, |
4341 | val16 & 0xff00); | 4379 | val16 & 0xff00); |
4342 | 4380 | ||
4381 | lane = bnx2x_get_warpcore_lane(phy, params); | ||
4382 | /* Disable CL36 PCS Tx */ | ||
4383 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
4384 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16); | ||
4385 | val16 |= (0x11 << lane); | ||
4386 | if (phy->flags & FLAGS_WC_DUAL_MODE) | ||
4387 | val16 |= (0x22 << lane); | ||
4388 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
4389 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16); | ||
4390 | |||
4391 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
4392 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16); | ||
4393 | val16 &= ~(0x0303 << (lane << 1)); | ||
4394 | val16 |= (0x0101 << (lane << 1)); | ||
4395 | if (phy->flags & FLAGS_WC_DUAL_MODE) { | ||
4396 | val16 &= ~(0x0c0c << (lane << 1)); | ||
4397 | val16 |= (0x0404 << (lane << 1)); | ||
4398 | } | ||
4399 | |||
4400 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
4401 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16); | ||
4402 | /* Restore AER */ | ||
4403 | bnx2x_set_aer_mmd(params, phy); | ||
4404 | |||
4343 | } | 4405 | } |
4344 | 4406 | ||
4345 | static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, | 4407 | static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, |
@@ -6296,15 +6358,7 @@ static int bnx2x_update_link_down(struct link_params *params, | |||
6296 | vars->mac_type = MAC_TYPE_NONE; | 6358 | vars->mac_type = MAC_TYPE_NONE; |
6297 | 6359 | ||
6298 | /* Update shared memory */ | 6360 | /* Update shared memory */ |
6299 | vars->link_status &= ~(LINK_STATUS_SPEED_AND_DUPLEX_MASK | | 6361 | vars->link_status &= ~LINK_UPDATE_MASK; |
6300 | LINK_STATUS_LINK_UP | | ||
6301 | LINK_STATUS_PHYSICAL_LINK_FLAG | | ||
6302 | LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | | ||
6303 | LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | | ||
6304 | LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | | ||
6305 | LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | | ||
6306 | LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | | ||
6307 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE); | ||
6308 | vars->line_speed = 0; | 6362 | vars->line_speed = 0; |
6309 | bnx2x_update_mng(params, vars->link_status); | 6363 | bnx2x_update_mng(params, vars->link_status); |
6310 | 6364 | ||
@@ -6452,6 +6506,7 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
6452 | u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; | 6506 | u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; |
6453 | u8 active_external_phy = INT_PHY; | 6507 | u8 active_external_phy = INT_PHY; |
6454 | vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; | 6508 | vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; |
6509 | vars->link_status &= ~LINK_UPDATE_MASK; | ||
6455 | for (phy_index = INT_PHY; phy_index < params->num_phys; | 6510 | for (phy_index = INT_PHY; phy_index < params->num_phys; |
6456 | phy_index++) { | 6511 | phy_index++) { |
6457 | phy_vars[phy_index].flow_ctrl = 0; | 6512 | phy_vars[phy_index].flow_ctrl = 0; |
@@ -7579,7 +7634,7 @@ static void bnx2x_warpcore_power_module(struct link_params *params, | |||
7579 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 7634 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
7580 | struct link_params *params, | 7635 | struct link_params *params, |
7581 | u16 addr, u8 byte_cnt, | 7636 | u16 addr, u8 byte_cnt, |
7582 | u8 *o_buf) | 7637 | u8 *o_buf, u8 is_init) |
7583 | { | 7638 | { |
7584 | int rc = 0; | 7639 | int rc = 0; |
7585 | u8 i, j = 0, cnt = 0; | 7640 | u8 i, j = 0, cnt = 0; |
@@ -7596,10 +7651,10 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7596 | /* 4 byte aligned address */ | 7651 | /* 4 byte aligned address */ |
7597 | addr32 = addr & (~0x3); | 7652 | addr32 = addr & (~0x3); |
7598 | do { | 7653 | do { |
7599 | if (cnt == I2C_WA_PWR_ITER) { | 7654 | if ((!is_init) && (cnt == I2C_WA_PWR_ITER)) { |
7600 | bnx2x_warpcore_power_module(params, phy, 0); | 7655 | bnx2x_warpcore_power_module(params, phy, 0); |
7601 | /* Note that 100us are not enough here */ | 7656 | /* Note that 100us are not enough here */ |
7602 | usleep_range(1000,1000); | 7657 | usleep_range(1000, 2000); |
7603 | bnx2x_warpcore_power_module(params, phy, 1); | 7658 | bnx2x_warpcore_power_module(params, phy, 1); |
7604 | } | 7659 | } |
7605 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, | 7660 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, |
@@ -7719,7 +7774,7 @@ int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7719 | break; | 7774 | break; |
7720 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: | 7775 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: |
7721 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr, | 7776 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr, |
7722 | byte_cnt, o_buf); | 7777 | byte_cnt, o_buf, 0); |
7723 | break; | 7778 | break; |
7724 | } | 7779 | } |
7725 | return rc; | 7780 | return rc; |
@@ -7923,6 +7978,7 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7923 | 7978 | ||
7924 | { | 7979 | { |
7925 | u8 val; | 7980 | u8 val; |
7981 | int rc; | ||
7926 | struct bnx2x *bp = params->bp; | 7982 | struct bnx2x *bp = params->bp; |
7927 | u16 timeout; | 7983 | u16 timeout; |
7928 | /* Initialization time after hot-plug may take up to 300ms for | 7984 | /* Initialization time after hot-plug may take up to 300ms for |
@@ -7930,8 +7986,14 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7930 | */ | 7986 | */ |
7931 | 7987 | ||
7932 | for (timeout = 0; timeout < 60; timeout++) { | 7988 | for (timeout = 0; timeout < 60; timeout++) { |
7933 | if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) | 7989 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) |
7934 | == 0) { | 7990 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, |
7991 | params, 1, | ||
7992 | 1, &val, 1); | ||
7993 | else | ||
7994 | rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, | ||
7995 | &val); | ||
7996 | if (rc == 0) { | ||
7935 | DP(NETIF_MSG_LINK, | 7997 | DP(NETIF_MSG_LINK, |
7936 | "SFP+ module initialization took %d ms\n", | 7998 | "SFP+ module initialization took %d ms\n", |
7937 | timeout * 5); | 7999 | timeout * 5); |
@@ -7939,7 +8001,8 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7939 | } | 8001 | } |
7940 | usleep_range(5000, 10000); | 8002 | usleep_range(5000, 10000); |
7941 | } | 8003 | } |
7942 | return -EINVAL; | 8004 | rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val); |
8005 | return rc; | ||
7943 | } | 8006 | } |
7944 | 8007 | ||
7945 | static void bnx2x_8727_power_module(struct bnx2x *bp, | 8008 | static void bnx2x_8727_power_module(struct bnx2x *bp, |
@@ -10993,7 +11056,7 @@ static struct bnx2x_phy phy_xgxs = { | |||
10993 | .format_fw_ver = (format_fw_ver_t)NULL, | 11056 | .format_fw_ver = (format_fw_ver_t)NULL, |
10994 | .hw_reset = (hw_reset_t)NULL, | 11057 | .hw_reset = (hw_reset_t)NULL, |
10995 | .set_link_led = (set_link_led_t)NULL, | 11058 | .set_link_led = (set_link_led_t)NULL, |
10996 | .phy_specific_func = (phy_specific_func_t)NULL | 11059 | .phy_specific_func = (phy_specific_func_t)bnx2x_xgxs_specific_func |
10997 | }; | 11060 | }; |
10998 | static struct bnx2x_phy phy_warpcore = { | 11061 | static struct bnx2x_phy phy_warpcore = { |
10999 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, | 11062 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, |
@@ -11465,6 +11528,11 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, | |||
11465 | phy->media_type = ETH_PHY_BASE_T; | 11528 | phy->media_type = ETH_PHY_BASE_T; |
11466 | break; | 11529 | break; |
11467 | case PORT_HW_CFG_NET_SERDES_IF_XFI: | 11530 | case PORT_HW_CFG_NET_SERDES_IF_XFI: |
11531 | phy->supported &= (SUPPORTED_1000baseT_Full | | ||
11532 | SUPPORTED_10000baseT_Full | | ||
11533 | SUPPORTED_FIBRE | | ||
11534 | SUPPORTED_Pause | | ||
11535 | SUPPORTED_Asym_Pause); | ||
11468 | phy->media_type = ETH_PHY_XFP_FIBER; | 11536 | phy->media_type = ETH_PHY_XFP_FIBER; |
11469 | break; | 11537 | break; |
11470 | case PORT_HW_CFG_NET_SERDES_IF_SFI: | 11538 | case PORT_HW_CFG_NET_SERDES_IF_SFI: |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index d5648fc666b..bd1fd3d87c2 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -6794,8 +6794,9 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) | |||
6794 | 6794 | ||
6795 | bnx2x_init_block(bp, BLOCK_DORQ, init_phase); | 6795 | bnx2x_init_block(bp, BLOCK_DORQ, init_phase); |
6796 | 6796 | ||
6797 | bnx2x_init_block(bp, BLOCK_BRB1, init_phase); | ||
6798 | |||
6797 | if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) { | 6799 | if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) { |
6798 | bnx2x_init_block(bp, BLOCK_BRB1, init_phase); | ||
6799 | 6800 | ||
6800 | if (IS_MF(bp)) | 6801 | if (IS_MF(bp)) |
6801 | low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246); | 6802 | low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246); |
@@ -11902,7 +11903,15 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
11902 | /* disable FCOE L2 queue for E1x */ | 11903 | /* disable FCOE L2 queue for E1x */ |
11903 | if (CHIP_IS_E1x(bp)) | 11904 | if (CHIP_IS_E1x(bp)) |
11904 | bp->flags |= NO_FCOE_FLAG; | 11905 | bp->flags |= NO_FCOE_FLAG; |
11905 | 11906 | /* disable FCOE for 57840 device, until FW supports it */ | |
11907 | switch (ent->driver_data) { | ||
11908 | case BCM57840_O: | ||
11909 | case BCM57840_4_10: | ||
11910 | case BCM57840_2_20: | ||
11911 | case BCM57840_MFO: | ||
11912 | case BCM57840_MF: | ||
11913 | bp->flags |= NO_FCOE_FLAG; | ||
11914 | } | ||
11906 | #endif | 11915 | #endif |
11907 | 11916 | ||
11908 | 11917 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c1cde11b0c6..0df1284df49 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -3416,16 +3416,6 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
3416 | finicsum, cfcsum); | 3416 | finicsum, cfcsum); |
3417 | 3417 | ||
3418 | /* | 3418 | /* |
3419 | * If we're a pure NIC driver then disable all offloading facilities. | ||
3420 | * This will allow the firmware to optimize aspects of the hardware | ||
3421 | * configuration which will result in improved performance. | ||
3422 | */ | ||
3423 | caps_cmd.ofldcaps = 0; | ||
3424 | caps_cmd.iscsicaps = 0; | ||
3425 | caps_cmd.rdmacaps = 0; | ||
3426 | caps_cmd.fcoecaps = 0; | ||
3427 | |||
3428 | /* | ||
3429 | * And now tell the firmware to use the configuration we just loaded. | 3419 | * And now tell the firmware to use the configuration we just loaded. |
3430 | */ | 3420 | */ |
3431 | caps_cmd.op_to_write = | 3421 | caps_cmd.op_to_write = |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 56b20d17d0e..116f0e901be 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -2673,6 +2673,9 @@ static int ixgbe_get_ts_info(struct net_device *dev, | |||
2673 | case ixgbe_mac_X540: | 2673 | case ixgbe_mac_X540: |
2674 | case ixgbe_mac_82599EB: | 2674 | case ixgbe_mac_82599EB: |
2675 | info->so_timestamping = | 2675 | info->so_timestamping = |
2676 | SOF_TIMESTAMPING_TX_SOFTWARE | | ||
2677 | SOF_TIMESTAMPING_RX_SOFTWARE | | ||
2678 | SOF_TIMESTAMPING_SOFTWARE | | ||
2676 | SOF_TIMESTAMPING_TX_HARDWARE | | 2679 | SOF_TIMESTAMPING_TX_HARDWARE | |
2677 | SOF_TIMESTAMPING_RX_HARDWARE | | 2680 | SOF_TIMESTAMPING_RX_HARDWARE | |
2678 | SOF_TIMESTAMPING_RAW_HARDWARE; | 2681 | SOF_TIMESTAMPING_RAW_HARDWARE; |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 53743f7a2ca..af8b4142088 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1524,6 +1524,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev) | |||
1524 | pldat->dma_buff_base_p); | 1524 | pldat->dma_buff_base_p); |
1525 | free_irq(ndev->irq, ndev); | 1525 | free_irq(ndev->irq, ndev); |
1526 | iounmap(pldat->net_base); | 1526 | iounmap(pldat->net_base); |
1527 | mdiobus_unregister(pldat->mii_bus); | ||
1527 | mdiobus_free(pldat->mii_bus); | 1528 | mdiobus_free(pldat->mii_bus); |
1528 | clk_disable(pldat->clk); | 1529 | clk_disable(pldat->clk); |
1529 | clk_put(pldat->clk); | 1530 | clk_put(pldat->clk); |
diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c index daec9b05d16..6428fcbbdd4 100644 --- a/drivers/net/phy/mdio-bitbang.c +++ b/drivers/net/phy/mdio-bitbang.c | |||
@@ -234,6 +234,7 @@ void free_mdio_bitbang(struct mii_bus *bus) | |||
234 | struct mdiobb_ctrl *ctrl = bus->priv; | 234 | struct mdiobb_ctrl *ctrl = bus->priv; |
235 | 235 | ||
236 | module_put(ctrl->ops->owner); | 236 | module_put(ctrl->ops->owner); |
237 | mdiobus_unregister(bus); | ||
237 | mdiobus_free(bus); | 238 | mdiobus_free(bus); |
238 | } | 239 | } |
239 | EXPORT_SYMBOL(free_mdio_bitbang); | 240 | EXPORT_SYMBOL(free_mdio_bitbang); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index ce9d4f2c977..0ae1bcc6da7 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx, | |||
744 | 744 | ||
745 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 745 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
746 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; | 746 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; |
747 | u32 buf_size; | ||
747 | 748 | ||
748 | tbi = tq->buf_info + tq->tx_ring.next2fill; | 749 | buf_offset = 0; |
749 | tbi->map_type = VMXNET3_MAP_PAGE; | 750 | len = skb_frag_size(frag); |
750 | tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag, | 751 | while (len) { |
751 | 0, skb_frag_size(frag), | 752 | tbi = tq->buf_info + tq->tx_ring.next2fill; |
752 | DMA_TO_DEVICE); | 753 | if (len < VMXNET3_MAX_TX_BUF_SIZE) { |
754 | buf_size = len; | ||
755 | dw2 |= len; | ||
756 | } else { | ||
757 | buf_size = VMXNET3_MAX_TX_BUF_SIZE; | ||
758 | /* spec says that for TxDesc.len, 0 == 2^14 */ | ||
759 | } | ||
760 | tbi->map_type = VMXNET3_MAP_PAGE; | ||
761 | tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag, | ||
762 | buf_offset, buf_size, | ||
763 | DMA_TO_DEVICE); | ||
753 | 764 | ||
754 | tbi->len = skb_frag_size(frag); | 765 | tbi->len = buf_size; |
755 | 766 | ||
756 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; | 767 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; |
757 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); | 768 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); |
758 | 769 | ||
759 | gdesc->txd.addr = cpu_to_le64(tbi->dma_addr); | 770 | gdesc->txd.addr = cpu_to_le64(tbi->dma_addr); |
760 | gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag)); | 771 | gdesc->dword[2] = cpu_to_le32(dw2); |
761 | gdesc->dword[3] = 0; | 772 | gdesc->dword[3] = 0; |
762 | 773 | ||
763 | dev_dbg(&adapter->netdev->dev, | 774 | dev_dbg(&adapter->netdev->dev, |
764 | "txd[%u]: 0x%llu %u %u\n", | 775 | "txd[%u]: 0x%llu %u %u\n", |
765 | tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr), | 776 | tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr), |
766 | le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]); | 777 | le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]); |
767 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); | 778 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); |
768 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; | 779 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; |
780 | |||
781 | len -= buf_size; | ||
782 | buf_offset += buf_size; | ||
783 | } | ||
769 | } | 784 | } |
770 | 785 | ||
771 | ctx->eop_txd = gdesc; | 786 | ctx->eop_txd = gdesc; |
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb, | |||
886 | } | 901 | } |
887 | } | 902 | } |
888 | 903 | ||
904 | static int txd_estimate(const struct sk_buff *skb) | ||
905 | { | ||
906 | int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1; | ||
907 | int i; | ||
908 | |||
909 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | ||
910 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; | ||
911 | |||
912 | count += VMXNET3_TXD_NEEDED(skb_frag_size(frag)); | ||
913 | } | ||
914 | return count; | ||
915 | } | ||
889 | 916 | ||
890 | /* | 917 | /* |
891 | * Transmits a pkt thru a given tq | 918 | * Transmits a pkt thru a given tq |
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | |||
914 | union Vmxnet3_GenericDesc tempTxDesc; | 941 | union Vmxnet3_GenericDesc tempTxDesc; |
915 | #endif | 942 | #endif |
916 | 943 | ||
917 | /* conservatively estimate # of descriptors to use */ | 944 | count = txd_estimate(skb); |
918 | count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + | ||
919 | skb_shinfo(skb)->nr_frags + 1; | ||
920 | 945 | ||
921 | ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP)); | 946 | ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP)); |
922 | 947 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 607976c0016..7b4adde93c0 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -816,7 +816,7 @@ static void vxlan_cleanup(unsigned long arg) | |||
816 | = container_of(p, struct vxlan_fdb, hlist); | 816 | = container_of(p, struct vxlan_fdb, hlist); |
817 | unsigned long timeout; | 817 | unsigned long timeout; |
818 | 818 | ||
819 | if (f->state == NUD_PERMANENT) | 819 | if (f->state & NUD_PERMANENT) |
820 | continue; | 820 | continue; |
821 | 821 | ||
822 | timeout = f->used + vxlan->age_interval * HZ; | 822 | timeout = f->used + vxlan->age_interval * HZ; |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 378bd70256b..741918a2027 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -312,6 +312,7 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) | |||
312 | } | 312 | } |
313 | 313 | ||
314 | bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); | 314 | bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); |
315 | bf->bf_next = NULL; | ||
315 | list_del(&bf->list); | 316 | list_del(&bf->list); |
316 | 317 | ||
317 | spin_unlock_bh(&sc->tx.txbuflock); | 318 | spin_unlock_bh(&sc->tx.txbuflock); |
@@ -393,7 +394,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
393 | u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; | 394 | u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; |
394 | u32 ba[WME_BA_BMP_SIZE >> 5]; | 395 | u32 ba[WME_BA_BMP_SIZE >> 5]; |
395 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; | 396 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; |
396 | bool rc_update = true; | 397 | bool rc_update = true, isba; |
397 | struct ieee80211_tx_rate rates[4]; | 398 | struct ieee80211_tx_rate rates[4]; |
398 | struct ath_frame_info *fi; | 399 | struct ath_frame_info *fi; |
399 | int nframes; | 400 | int nframes; |
@@ -437,13 +438,17 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
437 | tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; | 438 | tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; |
438 | tid = ATH_AN_2_TID(an, tidno); | 439 | tid = ATH_AN_2_TID(an, tidno); |
439 | seq_first = tid->seq_start; | 440 | seq_first = tid->seq_start; |
441 | isba = ts->ts_flags & ATH9K_TX_BA; | ||
440 | 442 | ||
441 | /* | 443 | /* |
442 | * The hardware occasionally sends a tx status for the wrong TID. | 444 | * The hardware occasionally sends a tx status for the wrong TID. |
443 | * In this case, the BA status cannot be considered valid and all | 445 | * In this case, the BA status cannot be considered valid and all |
444 | * subframes need to be retransmitted | 446 | * subframes need to be retransmitted |
447 | * | ||
448 | * Only BlockAcks have a TID and therefore normal Acks cannot be | ||
449 | * checked | ||
445 | */ | 450 | */ |
446 | if (tidno != ts->tid) | 451 | if (isba && tidno != ts->tid) |
447 | txok = false; | 452 | txok = false; |
448 | 453 | ||
449 | isaggr = bf_isaggr(bf); | 454 | isaggr = bf_isaggr(bf); |
@@ -1774,6 +1779,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | |||
1774 | list_add_tail(&bf->list, &bf_head); | 1779 | list_add_tail(&bf->list, &bf_head); |
1775 | bf->bf_state.bf_type = 0; | 1780 | bf->bf_state.bf_type = 0; |
1776 | 1781 | ||
1782 | bf->bf_next = NULL; | ||
1777 | bf->bf_lastbf = bf; | 1783 | bf->bf_lastbf = bf; |
1778 | ath_tx_fill_desc(sc, bf, txq, fi->framelen); | 1784 | ath_tx_fill_desc(sc, bf, txq, fi->framelen); |
1779 | ath_tx_txqaddbuf(sc, txq, &bf_head, false); | 1785 | ath_tx_txqaddbuf(sc, txq, &bf_head, false); |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 01dc8891070..59474ae0aec 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -2449,7 +2449,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev) | |||
2449 | /* | 2449 | /* |
2450 | * Check if temperature compensation is supported. | 2450 | * Check if temperature compensation is supported. |
2451 | */ | 2451 | */ |
2452 | if (tssi_bounds[4] == 0xff) | 2452 | if (tssi_bounds[4] == 0xff || step == 0xff) |
2453 | return 0; | 2453 | return 0; |
2454 | 2454 | ||
2455 | /* | 2455 | /* |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index bd4708a422c..20fd974f903 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -149,6 +149,7 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha) | |||
149 | int | 149 | int |
150 | qla24xx_disable_vp(scsi_qla_host_t *vha) | 150 | qla24xx_disable_vp(scsi_qla_host_t *vha) |
151 | { | 151 | { |
152 | unsigned long flags; | ||
152 | int ret; | 153 | int ret; |
153 | 154 | ||
154 | ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); | 155 | ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); |
@@ -156,7 +157,9 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) | |||
156 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); | 157 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
157 | 158 | ||
158 | /* Remove port id from vp target map */ | 159 | /* Remove port id from vp target map */ |
160 | spin_lock_irqsave(&vha->hw->vport_slock, flags); | ||
159 | qlt_update_vp_map(vha, RESET_AL_PA); | 161 | qlt_update_vp_map(vha, RESET_AL_PA); |
162 | spin_unlock_irqrestore(&vha->hw->vport_slock, flags); | ||
160 | 163 | ||
161 | qla2x00_mark_vp_devices_dead(vha); | 164 | qla2x00_mark_vp_devices_dead(vha); |
162 | atomic_set(&vha->vp_state, VP_FAILED); | 165 | atomic_set(&vha->vp_state, VP_FAILED); |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 0e09d8f433d..62aa5584f64 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -557,6 +557,7 @@ static bool qlt_check_fcport_exist(struct scsi_qla_host *vha, | |||
557 | int pmap_len; | 557 | int pmap_len; |
558 | fc_port_t *fcport; | 558 | fc_port_t *fcport; |
559 | int global_resets; | 559 | int global_resets; |
560 | unsigned long flags; | ||
560 | 561 | ||
561 | retry: | 562 | retry: |
562 | global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count); | 563 | global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count); |
@@ -625,10 +626,10 @@ retry: | |||
625 | sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain, | 626 | sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain, |
626 | fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); | 627 | fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); |
627 | 628 | ||
628 | sess->s_id = fcport->d_id; | 629 | spin_lock_irqsave(&ha->hardware_lock, flags); |
629 | sess->loop_id = fcport->loop_id; | 630 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
630 | sess->conf_compl_supported = !!(fcport->flags & | 631 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
631 | FCF_CONF_COMP_SUPPORTED); | 632 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
632 | 633 | ||
633 | res = true; | 634 | res = true; |
634 | 635 | ||
@@ -740,10 +741,9 @@ static struct qla_tgt_sess *qlt_create_sess( | |||
740 | qlt_undelete_sess(sess); | 741 | qlt_undelete_sess(sess); |
741 | 742 | ||
742 | kref_get(&sess->se_sess->sess_kref); | 743 | kref_get(&sess->se_sess->sess_kref); |
743 | sess->s_id = fcport->d_id; | 744 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
744 | sess->loop_id = fcport->loop_id; | 745 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
745 | sess->conf_compl_supported = !!(fcport->flags & | 746 | |
746 | FCF_CONF_COMP_SUPPORTED); | ||
747 | if (sess->local && !local) | 747 | if (sess->local && !local) |
748 | sess->local = 0; | 748 | sess->local = 0; |
749 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 749 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
@@ -796,8 +796,7 @@ static struct qla_tgt_sess *qlt_create_sess( | |||
796 | */ | 796 | */ |
797 | kref_get(&sess->se_sess->sess_kref); | 797 | kref_get(&sess->se_sess->sess_kref); |
798 | 798 | ||
799 | sess->conf_compl_supported = !!(fcport->flags & | 799 | sess->conf_compl_supported = (fcport->flags & FCF_CONF_COMP_SUPPORTED); |
800 | FCF_CONF_COMP_SUPPORTED); | ||
801 | BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name)); | 800 | BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name)); |
802 | memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name)); | 801 | memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name)); |
803 | 802 | ||
@@ -869,10 +868,8 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport) | |||
869 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007, | 868 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007, |
870 | "Reappeared sess %p\n", sess); | 869 | "Reappeared sess %p\n", sess); |
871 | } | 870 | } |
872 | sess->s_id = fcport->d_id; | 871 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
873 | sess->loop_id = fcport->loop_id; | 872 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
874 | sess->conf_compl_supported = !!(fcport->flags & | ||
875 | FCF_CONF_COMP_SUPPORTED); | ||
876 | } | 873 | } |
877 | 874 | ||
878 | if (sess && sess->local) { | 875 | if (sess && sess->local) { |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 170af157121..bad749561ec 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -648,6 +648,7 @@ struct qla_tgt_func_tmpl { | |||
648 | 648 | ||
649 | int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, | 649 | int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, |
650 | void *, uint8_t *, uint16_t); | 650 | void *, uint8_t *, uint16_t); |
651 | void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool); | ||
651 | struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, | 652 | struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, |
652 | const uint16_t); | 653 | const uint16_t); |
653 | struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, | 654 | struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 2358c16c4c8..3d74f2f39ae 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -237,7 +237,7 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) | |||
237 | struct tcm_qla2xxx_tpg, se_tpg); | 237 | struct tcm_qla2xxx_tpg, se_tpg); |
238 | struct tcm_qla2xxx_lport *lport = tpg->lport; | 238 | struct tcm_qla2xxx_lport *lport = tpg->lport; |
239 | 239 | ||
240 | return &lport->lport_name[0]; | 240 | return lport->lport_naa_name; |
241 | } | 241 | } |
242 | 242 | ||
243 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) | 243 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) |
@@ -1457,6 +1457,78 @@ static int tcm_qla2xxx_check_initiator_node_acl( | |||
1457 | return 0; | 1457 | return 0; |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id, | ||
1461 | uint16_t loop_id, bool conf_compl_supported) | ||
1462 | { | ||
1463 | struct qla_tgt *tgt = sess->tgt; | ||
1464 | struct qla_hw_data *ha = tgt->ha; | ||
1465 | struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr; | ||
1466 | struct se_node_acl *se_nacl = sess->se_sess->se_node_acl; | ||
1467 | struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl, | ||
1468 | struct tcm_qla2xxx_nacl, se_node_acl); | ||
1469 | u32 key; | ||
1470 | |||
1471 | |||
1472 | if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24) | ||
1473 | pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n", | ||
1474 | sess, | ||
1475 | sess->port_name[0], sess->port_name[1], | ||
1476 | sess->port_name[2], sess->port_name[3], | ||
1477 | sess->port_name[4], sess->port_name[5], | ||
1478 | sess->port_name[6], sess->port_name[7], | ||
1479 | sess->loop_id, loop_id, | ||
1480 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa, | ||
1481 | s_id.b.domain, s_id.b.area, s_id.b.al_pa); | ||
1482 | |||
1483 | if (sess->loop_id != loop_id) { | ||
1484 | /* | ||
1485 | * Because we can shuffle loop IDs around and we | ||
1486 | * update different sessions non-atomically, we might | ||
1487 | * have overwritten this session's old loop ID | ||
1488 | * already, and we might end up overwriting some other | ||
1489 | * session that will be updated later. So we have to | ||
1490 | * be extra careful and we can't warn about those things... | ||
1491 | */ | ||
1492 | if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl) | ||
1493 | lport->lport_loopid_map[sess->loop_id].se_nacl = NULL; | ||
1494 | |||
1495 | lport->lport_loopid_map[loop_id].se_nacl = se_nacl; | ||
1496 | |||
1497 | sess->loop_id = loop_id; | ||
1498 | } | ||
1499 | |||
1500 | if (sess->s_id.b24 != s_id.b24) { | ||
1501 | key = (((u32) sess->s_id.b.domain << 16) | | ||
1502 | ((u32) sess->s_id.b.area << 8) | | ||
1503 | ((u32) sess->s_id.b.al_pa)); | ||
1504 | |||
1505 | if (btree_lookup32(&lport->lport_fcport_map, key)) | ||
1506 | WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl, | ||
1507 | "Found wrong se_nacl when updating s_id %x:%x:%x\n", | ||
1508 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); | ||
1509 | else | ||
1510 | WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n", | ||
1511 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); | ||
1512 | |||
1513 | key = (((u32) s_id.b.domain << 16) | | ||
1514 | ((u32) s_id.b.area << 8) | | ||
1515 | ((u32) s_id.b.al_pa)); | ||
1516 | |||
1517 | if (btree_lookup32(&lport->lport_fcport_map, key)) { | ||
1518 | WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n", | ||
1519 | s_id.b.domain, s_id.b.area, s_id.b.al_pa); | ||
1520 | btree_update32(&lport->lport_fcport_map, key, se_nacl); | ||
1521 | } else { | ||
1522 | btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC); | ||
1523 | } | ||
1524 | |||
1525 | sess->s_id = s_id; | ||
1526 | nacl->nport_id = key; | ||
1527 | } | ||
1528 | |||
1529 | sess->conf_compl_supported = conf_compl_supported; | ||
1530 | } | ||
1531 | |||
1460 | /* | 1532 | /* |
1461 | * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. | 1533 | * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. |
1462 | */ | 1534 | */ |
@@ -1467,6 +1539,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = { | |||
1467 | .free_cmd = tcm_qla2xxx_free_cmd, | 1539 | .free_cmd = tcm_qla2xxx_free_cmd, |
1468 | .free_mcmd = tcm_qla2xxx_free_mcmd, | 1540 | .free_mcmd = tcm_qla2xxx_free_mcmd, |
1469 | .free_session = tcm_qla2xxx_free_session, | 1541 | .free_session = tcm_qla2xxx_free_session, |
1542 | .update_sess = tcm_qla2xxx_update_sess, | ||
1470 | .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, | 1543 | .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, |
1471 | .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, | 1544 | .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, |
1472 | .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, | 1545 | .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, |
@@ -1534,6 +1607,7 @@ static struct se_wwn *tcm_qla2xxx_make_lport( | |||
1534 | lport->lport_wwpn = wwpn; | 1607 | lport->lport_wwpn = wwpn; |
1535 | tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, | 1608 | tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, |
1536 | wwpn); | 1609 | wwpn); |
1610 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn); | ||
1537 | 1611 | ||
1538 | ret = tcm_qla2xxx_init_lport(lport); | 1612 | ret = tcm_qla2xxx_init_lport(lport); |
1539 | if (ret != 0) | 1613 | if (ret != 0) |
@@ -1601,6 +1675,7 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport( | |||
1601 | lport->lport_npiv_wwnn = npiv_wwnn; | 1675 | lport->lport_npiv_wwnn = npiv_wwnn; |
1602 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], | 1676 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], |
1603 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); | 1677 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); |
1678 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); | ||
1604 | 1679 | ||
1605 | /* FIXME: tcm_qla2xxx_npiv_make_lport */ | 1680 | /* FIXME: tcm_qla2xxx_npiv_make_lport */ |
1606 | ret = -ENOSYS; | 1681 | ret = -ENOSYS; |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 82549810335..9ba075fe978 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h | |||
@@ -61,6 +61,8 @@ struct tcm_qla2xxx_lport { | |||
61 | u64 lport_npiv_wwnn; | 61 | u64 lport_npiv_wwnn; |
62 | /* ASCII formatted WWPN for FC Target Lport */ | 62 | /* ASCII formatted WWPN for FC Target Lport */ |
63 | char lport_name[TCM_QLA2XXX_NAMELEN]; | 63 | char lport_name[TCM_QLA2XXX_NAMELEN]; |
64 | /* ASCII formatted naa WWPN for VPD page 83 etc */ | ||
65 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; | ||
64 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ | 66 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ |
65 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; | 67 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; |
66 | /* map for fc_port pointers in 24-bit FC Port ID space */ | 68 | /* map for fc_port pointers in 24-bit FC Port ID space */ |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index d6ce2182e67..035c2c76253 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3719,7 +3719,9 @@ restart: | |||
3719 | */ | 3719 | */ |
3720 | iscsit_thread_check_cpumask(conn, current, 1); | 3720 | iscsit_thread_check_cpumask(conn, current, 1); |
3721 | 3721 | ||
3722 | schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT); | 3722 | wait_event_interruptible(conn->queues_wq, |
3723 | !iscsit_conn_all_queues_empty(conn) || | ||
3724 | ts->status == ISCSI_THREAD_SET_RESET); | ||
3723 | 3725 | ||
3724 | if ((ts->status == ISCSI_THREAD_SET_RESET) || | 3726 | if ((ts->status == ISCSI_THREAD_SET_RESET) || |
3725 | signal_pending(current)) | 3727 | signal_pending(current)) |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 2ba9f9b9435..21048dbf7d1 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -486,6 +486,7 @@ struct iscsi_tmr_req { | |||
486 | }; | 486 | }; |
487 | 487 | ||
488 | struct iscsi_conn { | 488 | struct iscsi_conn { |
489 | wait_queue_head_t queues_wq; | ||
489 | /* Authentication Successful for this connection */ | 490 | /* Authentication Successful for this connection */ |
490 | u8 auth_complete; | 491 | u8 auth_complete; |
491 | /* State connection is currently in */ | 492 | /* State connection is currently in */ |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index cdc8a10939c..f8dbec05d5e 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | static int iscsi_login_init_conn(struct iscsi_conn *conn) | 42 | static int iscsi_login_init_conn(struct iscsi_conn *conn) |
43 | { | 43 | { |
44 | init_waitqueue_head(&conn->queues_wq); | ||
44 | INIT_LIST_HEAD(&conn->conn_list); | 45 | INIT_LIST_HEAD(&conn->conn_list); |
45 | INIT_LIST_HEAD(&conn->conn_cmd_list); | 46 | INIT_LIST_HEAD(&conn->conn_cmd_list); |
46 | INIT_LIST_HEAD(&conn->immed_queue_list); | 47 | INIT_LIST_HEAD(&conn->immed_queue_list); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index afd98ccd40a..1a91195ab61 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -488,7 +488,7 @@ void iscsit_add_cmd_to_immediate_queue( | |||
488 | atomic_set(&conn->check_immediate_queue, 1); | 488 | atomic_set(&conn->check_immediate_queue, 1); |
489 | spin_unlock_bh(&conn->immed_queue_lock); | 489 | spin_unlock_bh(&conn->immed_queue_lock); |
490 | 490 | ||
491 | wake_up_process(conn->thread_set->tx_thread); | 491 | wake_up(&conn->queues_wq); |
492 | } | 492 | } |
493 | 493 | ||
494 | struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn) | 494 | struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn) |
@@ -562,7 +562,7 @@ void iscsit_add_cmd_to_response_queue( | |||
562 | atomic_inc(&cmd->response_queue_count); | 562 | atomic_inc(&cmd->response_queue_count); |
563 | spin_unlock_bh(&conn->response_queue_lock); | 563 | spin_unlock_bh(&conn->response_queue_lock); |
564 | 564 | ||
565 | wake_up_process(conn->thread_set->tx_thread); | 565 | wake_up(&conn->queues_wq); |
566 | } | 566 | } |
567 | 567 | ||
568 | struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn) | 568 | struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn) |
@@ -616,6 +616,24 @@ static void iscsit_remove_cmd_from_response_queue( | |||
616 | } | 616 | } |
617 | } | 617 | } |
618 | 618 | ||
619 | bool iscsit_conn_all_queues_empty(struct iscsi_conn *conn) | ||
620 | { | ||
621 | bool empty; | ||
622 | |||
623 | spin_lock_bh(&conn->immed_queue_lock); | ||
624 | empty = list_empty(&conn->immed_queue_list); | ||
625 | spin_unlock_bh(&conn->immed_queue_lock); | ||
626 | |||
627 | if (!empty) | ||
628 | return empty; | ||
629 | |||
630 | spin_lock_bh(&conn->response_queue_lock); | ||
631 | empty = list_empty(&conn->response_queue_list); | ||
632 | spin_unlock_bh(&conn->response_queue_lock); | ||
633 | |||
634 | return empty; | ||
635 | } | ||
636 | |||
619 | void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn) | 637 | void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn) |
620 | { | 638 | { |
621 | struct iscsi_queue_req *qr, *qr_tmp; | 639 | struct iscsi_queue_req *qr, *qr_tmp; |
diff --git a/drivers/target/iscsi/iscsi_target_util.h b/drivers/target/iscsi/iscsi_target_util.h index 44054bd3543..894d0f83792 100644 --- a/drivers/target/iscsi/iscsi_target_util.h +++ b/drivers/target/iscsi/iscsi_target_util.h | |||
@@ -25,6 +25,7 @@ extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_ | |||
25 | extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); | 25 | extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); |
26 | extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); | 26 | extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); |
27 | extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); | 27 | extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); |
28 | extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); | ||
28 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); | 29 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); |
29 | extern void iscsit_release_cmd(struct iscsi_cmd *); | 30 | extern void iscsit_release_cmd(struct iscsi_cmd *); |
30 | extern void iscsit_free_cmd(struct iscsi_cmd *); | 31 | extern void iscsit_free_cmd(struct iscsi_cmd *); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 015f5be27bf..c123327499a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -3206,7 +3206,8 @@ static int __init target_core_init_configfs(void) | |||
3206 | if (ret < 0) | 3206 | if (ret < 0) |
3207 | goto out; | 3207 | goto out; |
3208 | 3208 | ||
3209 | if (core_dev_setup_virtual_lun0() < 0) | 3209 | ret = core_dev_setup_virtual_lun0(); |
3210 | if (ret < 0) | ||
3210 | goto out; | 3211 | goto out; |
3211 | 3212 | ||
3212 | return 0; | 3213 | return 0; |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 8d774da1632..9abef9f8eb7 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev) | |||
850 | 850 | ||
851 | static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) | 851 | static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) |
852 | { | 852 | { |
853 | u32 tmp, aligned_max_sectors; | 853 | u32 aligned_max_sectors; |
854 | u32 alignment; | ||
854 | /* | 855 | /* |
855 | * Limit max_sectors to a PAGE_SIZE aligned value for modern | 856 | * Limit max_sectors to a PAGE_SIZE aligned value for modern |
856 | * transport_allocate_data_tasks() operation. | 857 | * transport_allocate_data_tasks() operation. |
857 | */ | 858 | */ |
858 | tmp = rounddown((max_sectors * block_size), PAGE_SIZE); | 859 | alignment = max(1ul, PAGE_SIZE / block_size); |
859 | aligned_max_sectors = (tmp / block_size); | 860 | aligned_max_sectors = rounddown(max_sectors, alignment); |
860 | if (max_sectors != aligned_max_sectors) { | 861 | |
861 | printk(KERN_INFO "Rounding down aligned max_sectors from %u" | 862 | if (max_sectors != aligned_max_sectors) |
862 | " to %u\n", max_sectors, aligned_max_sectors); | 863 | pr_info("Rounding down aligned max_sectors from %u to %u\n", |
863 | return aligned_max_sectors; | 864 | max_sectors, aligned_max_sectors); |
864 | } | ||
865 | 865 | ||
866 | return max_sectors; | 866 | return aligned_max_sectors; |
867 | } | 867 | } |
868 | 868 | ||
869 | void se_dev_set_default_attribs( | 869 | void se_dev_set_default_attribs( |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 868f8aa04f1..a6e27d967c7 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -135,6 +135,12 @@ static int sbc_emulate_verify(struct se_cmd *cmd) | |||
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | static int sbc_emulate_noop(struct se_cmd *cmd) | ||
139 | { | ||
140 | target_complete_cmd(cmd, GOOD); | ||
141 | return 0; | ||
142 | } | ||
143 | |||
138 | static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) | 144 | static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) |
139 | { | 145 | { |
140 | return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors; | 146 | return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors; |
@@ -531,6 +537,18 @@ int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops) | |||
531 | size = 0; | 537 | size = 0; |
532 | cmd->execute_cmd = sbc_emulate_verify; | 538 | cmd->execute_cmd = sbc_emulate_verify; |
533 | break; | 539 | break; |
540 | case REZERO_UNIT: | ||
541 | case SEEK_6: | ||
542 | case SEEK_10: | ||
543 | /* | ||
544 | * There are still clients out there which use these old SCSI-2 | ||
545 | * commands. This mainly happens when running VMs with legacy | ||
546 | * guest systems, connected via SCSI command pass-through to | ||
547 | * iSCSI targets. Make them happy and return status GOOD. | ||
548 | */ | ||
549 | size = 0; | ||
550 | cmd->execute_cmd = sbc_emulate_noop; | ||
551 | break; | ||
534 | default: | 552 | default: |
535 | ret = spc_parse_cdb(cmd, &size); | 553 | ret = spc_parse_cdb(cmd, &size); |
536 | if (ret) | 554 | if (ret) |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 9229bd9ad61..6fd434d3d7e 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -605,6 +605,8 @@ static int spc_emulate_inquiry(struct se_cmd *cmd) | |||
605 | unsigned char buf[SE_INQUIRY_BUF]; | 605 | unsigned char buf[SE_INQUIRY_BUF]; |
606 | int p, ret; | 606 | int p, ret; |
607 | 607 | ||
608 | memset(buf, 0, SE_INQUIRY_BUF); | ||
609 | |||
608 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) | 610 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) |
609 | buf[0] = 0x3f; /* Not connected */ | 611 | buf[0] = 0x3f; /* Not connected */ |
610 | else | 612 | else |
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 1c59a3c23b2..be75c4331a9 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -140,15 +140,15 @@ void core_tmr_abort_task( | |||
140 | printk("ABORT_TASK: Found referenced %s task_tag: %u\n", | 140 | printk("ABORT_TASK: Found referenced %s task_tag: %u\n", |
141 | se_cmd->se_tfo->get_fabric_name(), ref_tag); | 141 | se_cmd->se_tfo->get_fabric_name(), ref_tag); |
142 | 142 | ||
143 | spin_lock_irq(&se_cmd->t_state_lock); | 143 | spin_lock(&se_cmd->t_state_lock); |
144 | if (se_cmd->transport_state & CMD_T_COMPLETE) { | 144 | if (se_cmd->transport_state & CMD_T_COMPLETE) { |
145 | printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag); | 145 | printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag); |
146 | spin_unlock_irq(&se_cmd->t_state_lock); | 146 | spin_unlock(&se_cmd->t_state_lock); |
147 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 147 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
148 | goto out; | 148 | goto out; |
149 | } | 149 | } |
150 | se_cmd->transport_state |= CMD_T_ABORTED; | 150 | se_cmd->transport_state |= CMD_T_ABORTED; |
151 | spin_unlock_irq(&se_cmd->t_state_lock); | 151 | spin_unlock(&se_cmd->t_state_lock); |
152 | 152 | ||
153 | list_del_init(&se_cmd->se_cmd_list); | 153 | list_del_init(&se_cmd->se_cmd_list); |
154 | kref_get(&se_cmd->cmd_kref); | 154 | kref_get(&se_cmd->cmd_kref); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index c33baff86aa..9097155e9eb 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1616,7 +1616,6 @@ static void target_complete_tmr_failure(struct work_struct *work) | |||
1616 | 1616 | ||
1617 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; | 1617 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; |
1618 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); | 1618 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); |
1619 | transport_generic_free_cmd(se_cmd, 0); | ||
1620 | } | 1619 | } |
1621 | 1620 | ||
1622 | /** | 1621 | /** |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index fd03e8581af..6dd29e4ce36 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -815,7 +815,7 @@ static struct platform_device_id exynos_tmu_driver_ids[] = { | |||
815 | }, | 815 | }, |
816 | { }, | 816 | { }, |
817 | }; | 817 | }; |
818 | MODULE_DEVICE_TABLE(platform, exynos4_tmu_driver_ids); | 818 | MODULE_DEVICE_TABLE(platform, exynos_tmu_driver_ids); |
819 | 819 | ||
820 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( | 820 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( |
821 | struct platform_device *pdev) | 821 | struct platform_device *pdev) |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index d4452716aaa..f7a1b574a30 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -210,7 +210,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
210 | goto error_free_priv; | 210 | goto error_free_priv; |
211 | } | 211 | } |
212 | 212 | ||
213 | zone = thermal_zone_device_register("rcar_thermal", 0, priv, | 213 | zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv, |
214 | &rcar_thermal_zone_ops, 0, 0); | 214 | &rcar_thermal_zone_ops, 0, 0); |
215 | if (IS_ERR(zone)) { | 215 | if (IS_ERR(zone)) { |
216 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); | 216 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); |
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index b7f5173ff9e..917bb568168 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -641,7 +641,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev, | |||
641 | case XenbusStateReconfiguring: | 641 | case XenbusStateReconfiguring: |
642 | case XenbusStateReconfigured: | 642 | case XenbusStateReconfigured: |
643 | case XenbusStateUnknown: | 643 | case XenbusStateUnknown: |
644 | case XenbusStateClosed: | ||
645 | break; | 644 | break; |
646 | 645 | ||
647 | case XenbusStateInitWait: | 646 | case XenbusStateInitWait: |
@@ -670,6 +669,10 @@ InitWait: | |||
670 | info->feature_resize = val; | 669 | info->feature_resize = val; |
671 | break; | 670 | break; |
672 | 671 | ||
672 | case XenbusStateClosed: | ||
673 | if (dev->state == XenbusStateClosed) | ||
674 | break; | ||
675 | /* Missed the backend's CLOSING state -- fallthrough */ | ||
673 | case XenbusStateClosing: | 676 | case XenbusStateClosing: |
674 | xenbus_frontend_closed(dev); | 677 | xenbus_frontend_closed(dev); |
675 | break; | 678 | break; |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 610bfc6be17..2e22df2f7a3 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -105,6 +105,21 @@ static void gntdev_print_maps(struct gntdev_priv *priv, | |||
105 | #endif | 105 | #endif |
106 | } | 106 | } |
107 | 107 | ||
108 | static void gntdev_free_map(struct grant_map *map) | ||
109 | { | ||
110 | if (map == NULL) | ||
111 | return; | ||
112 | |||
113 | if (map->pages) | ||
114 | free_xenballooned_pages(map->count, map->pages); | ||
115 | kfree(map->pages); | ||
116 | kfree(map->grants); | ||
117 | kfree(map->map_ops); | ||
118 | kfree(map->unmap_ops); | ||
119 | kfree(map->kmap_ops); | ||
120 | kfree(map); | ||
121 | } | ||
122 | |||
108 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | 123 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) |
109 | { | 124 | { |
110 | struct grant_map *add; | 125 | struct grant_map *add; |
@@ -142,12 +157,7 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | |||
142 | return add; | 157 | return add; |
143 | 158 | ||
144 | err: | 159 | err: |
145 | kfree(add->pages); | 160 | gntdev_free_map(add); |
146 | kfree(add->grants); | ||
147 | kfree(add->map_ops); | ||
148 | kfree(add->unmap_ops); | ||
149 | kfree(add->kmap_ops); | ||
150 | kfree(add); | ||
151 | return NULL; | 161 | return NULL; |
152 | } | 162 | } |
153 | 163 | ||
@@ -198,17 +208,9 @@ static void gntdev_put_map(struct grant_map *map) | |||
198 | evtchn_put(map->notify.event); | 208 | evtchn_put(map->notify.event); |
199 | } | 209 | } |
200 | 210 | ||
201 | if (map->pages) { | 211 | if (map->pages && !use_ptemod) |
202 | if (!use_ptemod) | 212 | unmap_grant_pages(map, 0, map->count); |
203 | unmap_grant_pages(map, 0, map->count); | 213 | gntdev_free_map(map); |
204 | |||
205 | free_xenballooned_pages(map->count, map->pages); | ||
206 | } | ||
207 | kfree(map->pages); | ||
208 | kfree(map->grants); | ||
209 | kfree(map->map_ops); | ||
210 | kfree(map->unmap_ops); | ||
211 | kfree(map); | ||
212 | } | 214 | } |
213 | 215 | ||
214 | /* ------------------------------------------------------------------ */ | 216 | /* ------------------------------------------------------------------ */ |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 89f76252a16..ac727028e65 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
@@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp, | |||
458 | goto out; | 458 | goto out; |
459 | 459 | ||
460 | /* Can't write a xenbus message larger we can buffer */ | 460 | /* Can't write a xenbus message larger we can buffer */ |
461 | if ((len + u->len) > sizeof(u->u.buffer)) { | 461 | if (len > sizeof(u->u.buffer) - u->len) { |
462 | /* On error, dump existing buffer */ | 462 | /* On error, dump existing buffer */ |
463 | u->len = 0; | 463 | u->len = 0; |
464 | rc = -EINVAL; | 464 | rc = -EINVAL; |