diff options
Diffstat (limited to 'drivers')
50 files changed, 1216 insertions, 734 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index e239a6c2923..a9e33db46e6 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1017,10 +1017,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
1017 | status = -ENOMEM; | 1017 | status = -ENOMEM; |
1018 | goto cleanup1; | 1018 | goto cleanup1; |
1019 | } | 1019 | } |
1020 | if (ioc->Request.Type.Direction == XFER_WRITE && | 1020 | if (ioc->Request.Type.Direction == XFER_WRITE) { |
1021 | copy_from_user(buff[sg_used], data_ptr, sz)) { | 1021 | if (copy_from_user(buff[sg_used], data_ptr, sz)) { |
1022 | status = -ENOMEM; | 1022 | status = -ENOMEM; |
1023 | goto cleanup1; | 1023 | goto cleanup1; |
1024 | } | ||
1024 | } else { | 1025 | } else { |
1025 | memset(buff[sg_used], 0, sz); | 1026 | memset(buff[sg_used], 0, sz); |
1026 | } | 1027 | } |
@@ -1138,8 +1139,15 @@ static int revalidate_allvol(ctlr_info_t *host) | |||
1138 | 1139 | ||
1139 | for(i=0; i< NWD; i++) { | 1140 | for(i=0; i< NWD; i++) { |
1140 | struct gendisk *disk = host->gendisk[i]; | 1141 | struct gendisk *disk = host->gendisk[i]; |
1141 | if (disk->flags & GENHD_FL_UP) | 1142 | if (disk) { |
1142 | del_gendisk(disk); | 1143 | request_queue_t *q = disk->queue; |
1144 | |||
1145 | if (disk->flags & GENHD_FL_UP) | ||
1146 | del_gendisk(disk); | ||
1147 | if (q) | ||
1148 | blk_cleanup_queue(q); | ||
1149 | put_disk(disk); | ||
1150 | } | ||
1143 | } | 1151 | } |
1144 | 1152 | ||
1145 | /* | 1153 | /* |
@@ -1453,10 +1461,13 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1453 | * allows us to delete disk zero but keep the controller registered. | 1461 | * allows us to delete disk zero but keep the controller registered. |
1454 | */ | 1462 | */ |
1455 | if (h->gendisk[0] != disk){ | 1463 | if (h->gendisk[0] != disk){ |
1456 | if (disk->flags & GENHD_FL_UP){ | 1464 | if (disk) { |
1457 | blk_cleanup_queue(disk->queue); | 1465 | request_queue_t *q = disk->queue; |
1458 | del_gendisk(disk); | 1466 | if (disk->flags & GENHD_FL_UP) |
1459 | drv->queue = NULL; | 1467 | del_gendisk(disk); |
1468 | if (q) | ||
1469 | blk_cleanup_queue(q); | ||
1470 | put_disk(disk); | ||
1460 | } | 1471 | } |
1461 | } | 1472 | } |
1462 | 1473 | ||
@@ -3225,9 +3236,14 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev) | |||
3225 | /* remove it from the disk list */ | 3236 | /* remove it from the disk list */ |
3226 | for (j = 0; j < NWD; j++) { | 3237 | for (j = 0; j < NWD; j++) { |
3227 | struct gendisk *disk = hba[i]->gendisk[j]; | 3238 | struct gendisk *disk = hba[i]->gendisk[j]; |
3228 | if (disk->flags & GENHD_FL_UP) { | 3239 | if (disk) { |
3229 | del_gendisk(disk); | 3240 | request_queue_t *q = disk->queue; |
3230 | blk_cleanup_queue(disk->queue); | 3241 | |
3242 | if (disk->flags & GENHD_FL_UP) | ||
3243 | del_gendisk(disk); | ||
3244 | if (q) | ||
3245 | blk_cleanup_queue(q); | ||
3246 | put_disk(disk); | ||
3231 | } | 3247 | } |
3232 | } | 3248 | } |
3233 | 3249 | ||
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 76589782adc..810679dcbbb 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -416,7 +416,7 @@ static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data | |||
416 | } | 416 | } |
417 | 417 | ||
418 | 418 | ||
419 | static struct aper_size_info_32 uli_sizes[7] = | 419 | static const struct aper_size_info_32 uli_sizes[7] = |
420 | { | 420 | { |
421 | {256, 65536, 6, 10}, | 421 | {256, 65536, 6, 10}, |
422 | {128, 32768, 5, 9}, | 422 | {128, 32768, 5, 9}, |
@@ -470,7 +470,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | static struct aper_size_info_32 nforce3_sizes[5] = | 473 | static const struct aper_size_info_32 nforce3_sizes[5] = |
474 | { | 474 | { |
475 | {512, 131072, 7, 0x00000000 }, | 475 | {512, 131072, 7, 0x00000000 }, |
476 | {256, 65536, 6, 0x00000008 }, | 476 | {256, 65536, 6, 0x00000008 }, |
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 27bca34b4a6..80ee17a8fc2 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -97,7 +97,7 @@ void agp_backend_release(struct agp_bridge_data *bridge) | |||
97 | EXPORT_SYMBOL(agp_backend_release); | 97 | EXPORT_SYMBOL(agp_backend_release); |
98 | 98 | ||
99 | 99 | ||
100 | static struct { int mem, agp; } maxes_table[] = { | 100 | static const struct { int mem, agp; } maxes_table[] = { |
101 | {0, 0}, | 101 | {0, 0}, |
102 | {32, 4}, | 102 | {32, 4}, |
103 | {64, 28}, | 103 | {64, 28}, |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index c847df575cf..97b0a890ba7 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -371,6 +371,11 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata = | |||
371 | .device_id = PCI_DEVICE_ID_VIA_3296_0, | 371 | .device_id = PCI_DEVICE_ID_VIA_3296_0, |
372 | .chipset_name = "P4M800", | 372 | .chipset_name = "P4M800", |
373 | }, | 373 | }, |
374 | /* P4M800CE */ | ||
375 | { | ||
376 | .device_id = PCI_DEVICE_ID_VIA_P4M800CE, | ||
377 | .chipset_name = "P4M800CE", | ||
378 | }, | ||
374 | 379 | ||
375 | { }, /* dummy final entry, always present */ | 380 | { }, /* dummy final entry, always present */ |
376 | }; | 381 | }; |
@@ -511,6 +516,7 @@ static struct pci_device_id agp_via_pci_table[] = { | |||
511 | ID(PCI_DEVICE_ID_VIA_3269_0), | 516 | ID(PCI_DEVICE_ID_VIA_3269_0), |
512 | ID(PCI_DEVICE_ID_VIA_83_87XX_1), | 517 | ID(PCI_DEVICE_ID_VIA_83_87XX_1), |
513 | ID(PCI_DEVICE_ID_VIA_3296_0), | 518 | ID(PCI_DEVICE_ID_VIA_3296_0), |
519 | ID(PCI_DEVICE_ID_VIA_P4M800CE), | ||
514 | { } | 520 | { } |
515 | }; | 521 | }; |
516 | 522 | ||
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index cef024a7d04..cd6f45d186a 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -36,8 +36,6 @@ | |||
36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ | 36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ |
37 | #include <asm/arch/gpio.h> | 37 | #include <asm/arch/gpio.h> |
38 | 38 | ||
39 | static struct device_driver ixp2000_i2c_driver; | ||
40 | |||
41 | static inline int ixp2000_scl_pin(void *data) | 39 | static inline int ixp2000_scl_pin(void *data) |
42 | { | 40 | { |
43 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; | 41 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; |
@@ -120,7 +118,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) | |||
120 | drv_data->algo_data.timeout = 100; | 118 | drv_data->algo_data.timeout = 100; |
121 | 119 | ||
122 | drv_data->adapter.id = I2C_HW_B_IXP2000, | 120 | drv_data->adapter.id = I2C_HW_B_IXP2000, |
123 | strlcpy(drv_data->adapter.name, ixp2000_i2c_driver.name, | 121 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, |
124 | I2C_NAME_SIZE); | 122 | I2C_NAME_SIZE); |
125 | drv_data->adapter.algo_data = &drv_data->algo_data, | 123 | drv_data->adapter.algo_data = &drv_data->algo_data, |
126 | 124 | ||
@@ -132,7 +130,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) | |||
132 | gpio_line_set(gpio->sda_pin, 0); | 130 | gpio_line_set(gpio->sda_pin, 0); |
133 | 131 | ||
134 | if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { | 132 | if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { |
135 | dev_err(dev, "Could not install, error %d\n", err); | 133 | dev_err(&plat_dev->dev, "Could not install, error %d\n", err); |
136 | kfree(drv_data); | 134 | kfree(drv_data); |
137 | return err; | 135 | return err; |
138 | } | 136 | } |
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index f87220be3c8..e422d8b2d4d 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ | 36 | #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ |
37 | 37 | ||
38 | static struct platform_driver ixp4xx_i2c_driver; | ||
39 | |||
40 | static inline int ixp4xx_scl_pin(void *data) | 38 | static inline int ixp4xx_scl_pin(void *data) |
41 | { | 39 | { |
42 | return ((struct ixp4xx_i2c_pins*)data)->scl_pin; | 40 | return ((struct ixp4xx_i2c_pins*)data)->scl_pin; |
@@ -128,7 +126,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) | |||
128 | drv_data->algo_data.timeout = 100; | 126 | drv_data->algo_data.timeout = 100; |
129 | 127 | ||
130 | drv_data->adapter.id = I2C_HW_B_IXP4XX; | 128 | drv_data->adapter.id = I2C_HW_B_IXP4XX; |
131 | strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.driver.name, | 129 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, |
132 | I2C_NAME_SIZE); | 130 | I2C_NAME_SIZE); |
133 | drv_data->adapter.algo_data = &drv_data->algo_data; | 131 | drv_data->adapter.algo_data = &drv_data->algo_data; |
134 | 132 | ||
@@ -140,8 +138,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) | |||
140 | gpio_line_set(gpio->sda_pin, 0); | 138 | gpio_line_set(gpio->sda_pin, 0); |
141 | 139 | ||
142 | if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { | 140 | if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { |
143 | printk(KERN_ERR "ERROR: Could not install %s\n", | 141 | printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id); |
144 | plat_dev->dev.bus_id); | ||
145 | 142 | ||
146 | kfree(drv_data); | 143 | kfree(drv_data); |
147 | return err; | 144 | return err; |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index ed2bc87f475..31e649a9ff7 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -625,7 +625,7 @@ config BLK_DEV_NS87415 | |||
625 | tristate "NS87415 chipset support" | 625 | tristate "NS87415 chipset support" |
626 | help | 626 | help |
627 | This driver adds detection and support for the NS87415 chip | 627 | This driver adds detection and support for the NS87415 chip |
628 | (used in SPARC64, among others). | 628 | (used mainly on SPARC64 and PA-RISC machines). |
629 | 629 | ||
630 | Please read the comments at the top of <file:drivers/ide/pci/ns87415.c>. | 630 | Please read the comments at the top of <file:drivers/ide/pci/ns87415.c>. |
631 | 631 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c2f47923d17..9455e42abb2 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -3328,8 +3328,8 @@ static ide_proc_entry_t idecd_proc[] = { | |||
3328 | #endif | 3328 | #endif |
3329 | 3329 | ||
3330 | static ide_driver_t ide_cdrom_driver = { | 3330 | static ide_driver_t ide_cdrom_driver = { |
3331 | .owner = THIS_MODULE, | ||
3332 | .gen_driver = { | 3331 | .gen_driver = { |
3332 | .owner = THIS_MODULE, | ||
3333 | .name = "ide-cdrom", | 3333 | .name = "ide-cdrom", |
3334 | .bus = &ide_bus_type, | 3334 | .bus = &ide_bus_type, |
3335 | .probe = ide_cd_probe, | 3335 | .probe = ide_cd_probe, |
@@ -3510,8 +3510,8 @@ static void __exit ide_cdrom_exit(void) | |||
3510 | { | 3510 | { |
3511 | driver_unregister(&ide_cdrom_driver.gen_driver); | 3511 | driver_unregister(&ide_cdrom_driver.gen_driver); |
3512 | } | 3512 | } |
3513 | 3513 | ||
3514 | static int ide_cdrom_init(void) | 3514 | static int __init ide_cdrom_init(void) |
3515 | { | 3515 | { |
3516 | return driver_register(&ide_cdrom_driver.gen_driver); | 3516 | return driver_register(&ide_cdrom_driver.gen_driver); |
3517 | } | 3517 | } |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index e827b39e4b3..f4e3d3527b0 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -1089,8 +1089,8 @@ static void ide_device_shutdown(struct device *dev) | |||
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | static ide_driver_t idedisk_driver = { | 1091 | static ide_driver_t idedisk_driver = { |
1092 | .owner = THIS_MODULE, | ||
1093 | .gen_driver = { | 1092 | .gen_driver = { |
1093 | .owner = THIS_MODULE, | ||
1094 | .name = "ide-disk", | 1094 | .name = "ide-disk", |
1095 | .bus = &ide_bus_type, | 1095 | .bus = &ide_bus_type, |
1096 | .probe = ide_disk_probe, | 1096 | .probe = ide_disk_probe, |
@@ -1266,7 +1266,7 @@ static void __exit idedisk_exit (void) | |||
1266 | driver_unregister(&idedisk_driver.gen_driver); | 1266 | driver_unregister(&idedisk_driver.gen_driver); |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | static int idedisk_init (void) | 1269 | static int __init idedisk_init(void) |
1270 | { | 1270 | { |
1271 | return driver_register(&idedisk_driver.gen_driver); | 1271 | return driver_register(&idedisk_driver.gen_driver); |
1272 | } | 1272 | } |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f615ab75996..9e293c8063d 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -1925,8 +1925,8 @@ static ide_proc_entry_t idefloppy_proc[] = { | |||
1925 | static int ide_floppy_probe(struct device *); | 1925 | static int ide_floppy_probe(struct device *); |
1926 | 1926 | ||
1927 | static ide_driver_t idefloppy_driver = { | 1927 | static ide_driver_t idefloppy_driver = { |
1928 | .owner = THIS_MODULE, | ||
1929 | .gen_driver = { | 1928 | .gen_driver = { |
1929 | .owner = THIS_MODULE, | ||
1930 | .name = "ide-floppy", | 1930 | .name = "ide-floppy", |
1931 | .bus = &ide_bus_type, | 1931 | .bus = &ide_bus_type, |
1932 | .probe = ide_floppy_probe, | 1932 | .probe = ide_floppy_probe, |
@@ -2191,10 +2191,7 @@ static void __exit idefloppy_exit (void) | |||
2191 | driver_unregister(&idefloppy_driver.gen_driver); | 2191 | driver_unregister(&idefloppy_driver.gen_driver); |
2192 | } | 2192 | } |
2193 | 2193 | ||
2194 | /* | 2194 | static int __init idefloppy_init(void) |
2195 | * idefloppy_init will register the driver for each floppy. | ||
2196 | */ | ||
2197 | static int idefloppy_init (void) | ||
2198 | { | 2195 | { |
2199 | printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); | 2196 | printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); |
2200 | return driver_register(&idefloppy_driver.gen_driver); | 2197 | return driver_register(&idefloppy_driver.gen_driver); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 5275cbb1afe..ecfafcdafea 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -1629,12 +1629,6 @@ EXPORT_SYMBOL(ide_init_drive_cmd); | |||
1629 | * for the new rq to be completed. This is VERY DANGEROUS, and is | 1629 | * for the new rq to be completed. This is VERY DANGEROUS, and is |
1630 | * intended for careful use by the ATAPI tape/cdrom driver code. | 1630 | * intended for careful use by the ATAPI tape/cdrom driver code. |
1631 | * | 1631 | * |
1632 | * If action is ide_next, then the rq is queued immediately after | ||
1633 | * the currently-being-processed-request (if any), and the function | ||
1634 | * returns without waiting for the new rq to be completed. As above, | ||
1635 | * This is VERY DANGEROUS, and is intended for careful use by the | ||
1636 | * ATAPI tape/cdrom driver code. | ||
1637 | * | ||
1638 | * If action is ide_end, then the rq is queued at the end of the | 1632 | * If action is ide_end, then the rq is queued at the end of the |
1639 | * request queue, and the function returns immediately without waiting | 1633 | * request queue, and the function returns immediately without waiting |
1640 | * for the new rq to be completed. This is again intended for careful | 1634 | * for the new rq to be completed. This is again intended for careful |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index b09a6537c7a..41d46dbe6c2 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) | |||
410 | { | 410 | { |
411 | u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ | 411 | u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ |
412 | 412 | ||
413 | if (on && drive->media == ide_disk) { | 413 | if (!PCI_DMA_BUS_IS_PHYS) { |
414 | if (!PCI_DMA_BUS_IS_PHYS) | 414 | addr = BLK_BOUNCE_ANY; |
415 | addr = BLK_BOUNCE_ANY; | 415 | } else if (on && drive->media == ide_disk) { |
416 | else if (HWIF(drive)->pci_dev) | 416 | if (HWIF(drive)->pci_dev) |
417 | addr = HWIF(drive)->pci_dev->dma_mask; | 417 | addr = HWIF(drive)->pci_dev->dma_mask; |
418 | } | 418 | } |
419 | 419 | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 0ac7eb8f40d..7d7944ed415 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -4748,8 +4748,8 @@ static ide_proc_entry_t idetape_proc[] = { | |||
4748 | static int ide_tape_probe(struct device *); | 4748 | static int ide_tape_probe(struct device *); |
4749 | 4749 | ||
4750 | static ide_driver_t idetape_driver = { | 4750 | static ide_driver_t idetape_driver = { |
4751 | .owner = THIS_MODULE, | ||
4752 | .gen_driver = { | 4751 | .gen_driver = { |
4752 | .owner = THIS_MODULE, | ||
4753 | .name = "ide-tape", | 4753 | .name = "ide-tape", |
4754 | .bus = &ide_bus_type, | 4754 | .bus = &ide_bus_type, |
4755 | .probe = ide_tape_probe, | 4755 | .probe = ide_tape_probe, |
@@ -4916,10 +4916,7 @@ static void __exit idetape_exit (void) | |||
4916 | unregister_chrdev(IDETAPE_MAJOR, "ht"); | 4916 | unregister_chrdev(IDETAPE_MAJOR, "ht"); |
4917 | } | 4917 | } |
4918 | 4918 | ||
4919 | /* | 4919 | static int __init idetape_init(void) |
4920 | * idetape_init will register the driver for each tape. | ||
4921 | */ | ||
4922 | static int idetape_init (void) | ||
4923 | { | 4920 | { |
4924 | int error = 1; | 4921 | int error = 1; |
4925 | idetape_sysfs_class = class_create(THIS_MODULE, "ide_tape"); | 4922 | idetape_sysfs_class = class_create(THIS_MODULE, "ide_tape"); |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 54f9639c2a8..62ebefd6394 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -51,8 +51,6 @@ | |||
51 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
52 | #include <asm/io.h> | 52 | #include <asm/io.h> |
53 | 53 | ||
54 | #define DEBUG_TASKFILE 0 /* unset when fixed */ | ||
55 | |||
56 | static void ata_bswap_data (void *buffer, int wcount) | 54 | static void ata_bswap_data (void *buffer, int wcount) |
57 | { | 55 | { |
58 | u16 *p = buffer; | 56 | u16 *p = buffer; |
@@ -765,9 +763,6 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
765 | ide_hwif_t *hwif = HWIF(drive); | 763 | ide_hwif_t *hwif = HWIF(drive); |
766 | task_struct_t *taskfile = (task_struct_t *) task->tfRegister; | 764 | task_struct_t *taskfile = (task_struct_t *) task->tfRegister; |
767 | hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister; | 765 | hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister; |
768 | #if DEBUG_TASKFILE | ||
769 | u8 status; | ||
770 | #endif | ||
771 | 766 | ||
772 | if (task->data_phase == TASKFILE_MULTI_IN || | 767 | if (task->data_phase == TASKFILE_MULTI_IN || |
773 | task->data_phase == TASKFILE_MULTI_OUT) { | 768 | task->data_phase == TASKFILE_MULTI_OUT) { |
@@ -778,19 +773,13 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
778 | } | 773 | } |
779 | 774 | ||
780 | /* | 775 | /* |
781 | * (ks) Check taskfile in/out flags. | 776 | * (ks) Check taskfile in flags. |
782 | * If set, then execute as it is defined. | 777 | * If set, then execute as it is defined. |
783 | * If not set, then define default settings. | 778 | * If not set, then define default settings. |
784 | * The default values are: | 779 | * The default values are: |
785 | * write and read all taskfile registers (except data) | 780 | * read all taskfile registers (except data) |
786 | * write and read the hob registers (sector,nsector,lcyl,hcyl) | 781 | * read the hob registers (sector, nsector, lcyl, hcyl) |
787 | */ | 782 | */ |
788 | if (task->tf_out_flags.all == 0) { | ||
789 | task->tf_out_flags.all = IDE_TASKFILE_STD_OUT_FLAGS; | ||
790 | if (drive->addressing == 1) | ||
791 | task->tf_out_flags.all |= (IDE_HOB_STD_OUT_FLAGS << 8); | ||
792 | } | ||
793 | |||
794 | if (task->tf_in_flags.all == 0) { | 783 | if (task->tf_in_flags.all == 0) { |
795 | task->tf_in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; | 784 | task->tf_in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; |
796 | if (drive->addressing == 1) | 785 | if (drive->addressing == 1) |
@@ -803,16 +792,6 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
803 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | 792 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); |
804 | SELECT_MASK(drive, 0); | 793 | SELECT_MASK(drive, 0); |
805 | 794 | ||
806 | #if DEBUG_TASKFILE | ||
807 | status = hwif->INB(IDE_STATUS_REG); | ||
808 | if (status & 0x80) { | ||
809 | printk("flagged_taskfile -> Bad status. Status = %02x. wait 100 usec ...\n", status); | ||
810 | udelay(100); | ||
811 | status = hwif->INB(IDE_STATUS_REG); | ||
812 | printk("flagged_taskfile -> Status = %02x\n", status); | ||
813 | } | ||
814 | #endif | ||
815 | |||
816 | if (task->tf_out_flags.b.data) { | 795 | if (task->tf_out_flags.b.data) { |
817 | u16 data = taskfile->data + (hobfile->data << 8); | 796 | u16 data = taskfile->data + (hobfile->data << 8); |
818 | hwif->OUTW(data, IDE_DATA_REG); | 797 | hwif->OUTW(data, IDE_DATA_REG); |
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 52cadc005d7..a21b1e11eef 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -65,23 +65,6 @@ static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { | |||
65 | #define BUSCLOCK(D) \ | 65 | #define BUSCLOCK(D) \ |
66 | ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) | 66 | ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) |
67 | 67 | ||
68 | #if 0 | ||
69 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { | ||
70 | (void) pci_read_config_byte(dev, 0x54, &art); | ||
71 | p += sprintf(p, "DMA Mode: %s(%s)", | ||
72 | (c0&0x20)?((art&0x03)?"UDMA":" DMA"):" PIO", | ||
73 | (art&0x02)?"2":(art&0x01)?"1":"0"); | ||
74 | p += sprintf(p, " %s(%s)", | ||
75 | (c0&0x40)?((art&0x0c)?"UDMA":" DMA"):" PIO", | ||
76 | (art&0x08)?"2":(art&0x04)?"1":"0"); | ||
77 | p += sprintf(p, " %s(%s)", | ||
78 | (c1&0x20)?((art&0x30)?"UDMA":" DMA"):" PIO", | ||
79 | (art&0x20)?"2":(art&0x10)?"1":"0"); | ||
80 | p += sprintf(p, " %s(%s)\n", | ||
81 | (c1&0x40)?((art&0xc0)?"UDMA":" DMA"):" PIO", | ||
82 | (art&0x80)?"2":(art&0x40)?"1":"0"); | ||
83 | } else { | ||
84 | #endif | ||
85 | 68 | ||
86 | /* | 69 | /* |
87 | * TO DO: active tuning and correction of cards without a bios. | 70 | * TO DO: active tuning and correction of cards without a bios. |
@@ -112,13 +95,9 @@ static u8 aec62xx_ratemask (ide_drive_t *drive) | |||
112 | switch(hwif->pci_dev->device) { | 95 | switch(hwif->pci_dev->device) { |
113 | case PCI_DEVICE_ID_ARTOP_ATP865: | 96 | case PCI_DEVICE_ID_ARTOP_ATP865: |
114 | case PCI_DEVICE_ID_ARTOP_ATP865R: | 97 | case PCI_DEVICE_ID_ARTOP_ATP865R: |
115 | #if 0 | ||
116 | mode = (hwif->INB(hwif->dma_master) & 0x10) ? 4 : 3; | ||
117 | #else | ||
118 | mode = (hwif->INB(((hwif->channel) ? | 98 | mode = (hwif->INB(((hwif->channel) ? |
119 | hwif->mate->dma_status : | 99 | hwif->mate->dma_status : |
120 | hwif->dma_status)) & 0x10) ? 4 : 3; | 100 | hwif->dma_status)) & 0x10) ? 4 : 3; |
121 | #endif | ||
122 | break; | 101 | break; |
123 | case PCI_DEVICE_ID_ARTOP_ATP860: | 102 | case PCI_DEVICE_ID_ARTOP_ATP860: |
124 | case PCI_DEVICE_ID_ARTOP_ATP860R: | 103 | case PCI_DEVICE_ID_ARTOP_ATP860R: |
@@ -263,35 +242,9 @@ static int aec62xx_irq_timeout (ide_drive_t *drive) | |||
263 | case PCI_DEVICE_ID_ARTOP_ATP865: | 242 | case PCI_DEVICE_ID_ARTOP_ATP865: |
264 | case PCI_DEVICE_ID_ARTOP_ATP865R: | 243 | case PCI_DEVICE_ID_ARTOP_ATP865R: |
265 | printk(" AEC62XX time out "); | 244 | printk(" AEC62XX time out "); |
266 | #if 0 | ||
267 | { | ||
268 | int i = 0; | ||
269 | u8 reg49h = 0; | ||
270 | pci_read_config_byte(HWIF(drive)->pci_dev, 0x49, ®49h); | ||
271 | for (i=0;i<256;i++) | ||
272 | pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h|0x10); | ||
273 | pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h & ~0x10); | ||
274 | } | ||
275 | return 0; | ||
276 | #endif | ||
277 | default: | 245 | default: |
278 | break; | 246 | break; |
279 | } | 247 | } |
280 | #if 0 | ||
281 | { | ||
282 | ide_hwif_t *hwif = HWIF(drive); | ||
283 | struct pci_dev *dev = hwif->pci_dev; | ||
284 | u8 tmp1 = 0, tmp2 = 0, mode6 = 0; | ||
285 | |||
286 | pci_read_config_byte(dev, 0x44, &tmp1); | ||
287 | pci_read_config_byte(dev, 0x45, &tmp2); | ||
288 | printk(" AEC6280 r44=%x r45=%x ",tmp1,tmp2); | ||
289 | mode6 = HWIF(drive)->INB(((hwif->channel) ? | ||
290 | hwif->mate->dma_status : | ||
291 | hwif->dma_status)); | ||
292 | printk(" AEC6280 133=%x ", (mode6 & 0x10)); | ||
293 | } | ||
294 | #endif | ||
295 | return 0; | 248 | return 0; |
296 | } | 249 | } |
297 | 250 | ||
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 6cf49394a80..cf84350efc5 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -876,10 +876,15 @@ static ide_pci_device_t ali15x3_chipset __devinitdata = { | |||
876 | 876 | ||
877 | static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 877 | static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
878 | { | 878 | { |
879 | static struct pci_device_id ati_rs100[] = { | ||
880 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100) }, | ||
881 | { }, | ||
882 | }; | ||
883 | |||
879 | ide_pci_device_t *d = &ali15x3_chipset; | 884 | ide_pci_device_t *d = &ali15x3_chipset; |
880 | 885 | ||
881 | if(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, NULL)) | 886 | if (pci_dev_present(ati_rs100)) |
882 | printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n"); | 887 | printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); |
883 | 888 | ||
884 | #if defined(CONFIG_SPARC64) | 889 | #if defined(CONFIG_SPARC64) |
885 | d->init_hwif = init_hwif_common_ali15x3; | 890 | d->init_hwif = init_hwif_common_ali15x3; |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 7dc24682d19..ea3c52cc8ac 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -222,10 +222,9 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
222 | 222 | ||
223 | /* We must not grab the entire device, it has 'ISA' space in its | 223 | /* We must not grab the entire device, it has 'ISA' space in its |
224 | BARS too and we will freak out other bits of the kernel */ | 224 | BARS too and we will freak out other bits of the kernel */ |
225 | if(pci_enable_device_bars(dev, 1<<2)) | 225 | if (pci_enable_device_bars(dev, 1<<2)) { |
226 | { | ||
227 | printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name); | 226 | printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name); |
228 | return 1; | 227 | return -ENODEV; |
229 | } | 228 | } |
230 | pci_set_master(dev); | 229 | pci_set_master(dev); |
231 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { | 230 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 022d244f2eb..f1ca154dd52 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -6,7 +6,13 @@ | |||
6 | * | 6 | * |
7 | * May be copied or modified under the terms of the GNU General Public License | 7 | * May be copied or modified under the terms of the GNU General Public License |
8 | * | 8 | * |
9 | * Documentation available under NDA only | 9 | * Documentation for CMD680: |
10 | * http://gkernel.sourceforge.net/specs/sii/sii-0680a-v1.31.pdf.bz2 | ||
11 | * | ||
12 | * Documentation for SiI 3112: | ||
13 | * http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2 | ||
14 | * | ||
15 | * Errata and other documentation only available under NDA. | ||
10 | * | 16 | * |
11 | * | 17 | * |
12 | * FAQ Items: | 18 | * FAQ Items: |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 16b3e2d8bfb..75a2253a3e6 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -87,6 +87,7 @@ static const struct { | |||
87 | u8 chipset_family; | 87 | u8 chipset_family; |
88 | u8 flags; | 88 | u8 flags; |
89 | } SiSHostChipInfo[] = { | 89 | } SiSHostChipInfo[] = { |
90 | { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 }, | ||
90 | { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, | 91 | { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, |
91 | { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, | 92 | { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, |
92 | { "SiS733", PCI_DEVICE_ID_SI_733, ATA_100 }, | 93 | { "SiS733", PCI_DEVICE_ID_SI_733, ATA_100 }, |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index a4d099c937f..7161ce0ef5a 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -79,6 +79,7 @@ static struct via_isa_bridge { | |||
79 | u8 rev_max; | 79 | u8 rev_max; |
80 | u16 flags; | 80 | u16 flags; |
81 | } via_isa_bridges[] = { | 81 | } via_isa_bridges[] = { |
82 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | ||
82 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 83 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
83 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 84 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
84 | { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 85 | { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
@@ -100,185 +101,14 @@ static struct via_isa_bridge { | |||
100 | { NULL } | 101 | { NULL } |
101 | }; | 102 | }; |
102 | 103 | ||
103 | static struct via_isa_bridge *via_config; | ||
104 | static unsigned int via_80w; | ||
105 | static unsigned int via_clock; | 104 | static unsigned int via_clock; |
106 | static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; | 105 | static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; |
107 | 106 | ||
108 | /* | 107 | struct via82cxxx_dev |
109 | * VIA /proc entry. | ||
110 | */ | ||
111 | |||
112 | #if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) | ||
113 | |||
114 | #include <linux/stat.h> | ||
115 | #include <linux/proc_fs.h> | ||
116 | |||
117 | static u8 via_proc = 0; | ||
118 | static unsigned long via_base; | ||
119 | static struct pci_dev *bmide_dev, *isa_dev; | ||
120 | |||
121 | static char *via_control3[] = { "No limit", "64", "128", "192" }; | ||
122 | |||
123 | #define via_print(format, arg...) p += sprintf(p, format "\n" , ## arg) | ||
124 | #define via_print_drive(name, format, arg...)\ | ||
125 | p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n"); | ||
126 | |||
127 | |||
128 | /** | ||
129 | * via_get_info - generate via /proc file | ||
130 | * @buffer: buffer for data | ||
131 | * @addr: set to start of data to use | ||
132 | * @offset: current file offset | ||
133 | * @count: size of read | ||
134 | * | ||
135 | * Fills in buffer with the debugging/configuration information for | ||
136 | * the VIA chipset tuning and attached drives | ||
137 | */ | ||
138 | |||
139 | static int via_get_info(char *buffer, char **addr, off_t offset, int count) | ||
140 | { | 108 | { |
141 | int speed[4], cycle[4], setup[4], active[4], recover[4], den[4], | 109 | struct via_isa_bridge *via_config; |
142 | uen[4], udma[4], umul[4], active8b[4], recover8b[4]; | 110 | unsigned int via_80w; |
143 | struct pci_dev *dev = bmide_dev; | 111 | }; |
144 | unsigned int v, u, i; | ||
145 | int len; | ||
146 | u16 c, w; | ||
147 | u8 t, x; | ||
148 | char *p = buffer; | ||
149 | |||
150 | via_print("----------VIA BusMastering IDE Configuration" | ||
151 | "----------------"); | ||
152 | |||
153 | via_print("Driver Version: 3.38"); | ||
154 | via_print("South Bridge: VIA %s", | ||
155 | via_config->name); | ||
156 | |||
157 | pci_read_config_byte(isa_dev, PCI_REVISION_ID, &t); | ||
158 | pci_read_config_byte(dev, PCI_REVISION_ID, &x); | ||
159 | via_print("Revision: ISA %#x IDE %#x", t, x); | ||
160 | via_print("Highest DMA rate: %s", | ||
161 | via_dma[via_config->flags & VIA_UDMA]); | ||
162 | |||
163 | via_print("BM-DMA base: %#lx", via_base); | ||
164 | via_print("PCI clock: %d.%dMHz", | ||
165 | via_clock / 1000, via_clock / 100 % 10); | ||
166 | |||
167 | pci_read_config_byte(dev, VIA_MISC_1, &t); | ||
168 | via_print("Master Read Cycle IRDY: %dws", | ||
169 | (t & 64) >> 6); | ||
170 | via_print("Master Write Cycle IRDY: %dws", | ||
171 | (t & 32) >> 5); | ||
172 | via_print("BM IDE Status Register Read Retry: %s", | ||
173 | (t & 8) ? "yes" : "no"); | ||
174 | |||
175 | pci_read_config_byte(dev, VIA_MISC_3, &t); | ||
176 | via_print("Max DRDY Pulse Width: %s%s", | ||
177 | via_control3[(t & 0x03)], (t & 0x03) ? " PCI clocks" : ""); | ||
178 | |||
179 | via_print("-----------------------Primary IDE" | ||
180 | "-------Secondary IDE------"); | ||
181 | via_print("Read DMA FIFO flush: %10s%20s", | ||
182 | (t & 0x80) ? "yes" : "no", (t & 0x40) ? "yes" : "no"); | ||
183 | via_print("End Sector FIFO flush: %10s%20s", | ||
184 | (t & 0x20) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); | ||
185 | |||
186 | pci_read_config_byte(dev, VIA_IDE_CONFIG, &t); | ||
187 | via_print("Prefetch Buffer: %10s%20s", | ||
188 | (t & 0x80) ? "yes" : "no", (t & 0x20) ? "yes" : "no"); | ||
189 | via_print("Post Write Buffer: %10s%20s", | ||
190 | (t & 0x40) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); | ||
191 | |||
192 | pci_read_config_byte(dev, VIA_IDE_ENABLE, &t); | ||
193 | via_print("Enabled: %10s%20s", | ||
194 | (t & 0x02) ? "yes" : "no", (t & 0x01) ? "yes" : "no"); | ||
195 | |||
196 | c = inb(via_base + 0x02) | (inb(via_base + 0x0a) << 8); | ||
197 | via_print("Simplex only: %10s%20s", | ||
198 | (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no"); | ||
199 | |||
200 | via_print("Cable Type: %10s%20s", | ||
201 | (via_80w & 1) ? "80w" : "40w", (via_80w & 2) ? "80w" : "40w"); | ||
202 | |||
203 | via_print("-------------------drive0----drive1" | ||
204 | "----drive2----drive3-----"); | ||
205 | |||
206 | pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); | ||
207 | pci_read_config_dword(dev, VIA_DRIVE_TIMING, &v); | ||
208 | pci_read_config_word(dev, VIA_8BIT_TIMING, &w); | ||
209 | |||
210 | if (via_config->flags & VIA_UDMA) | ||
211 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
212 | else u = 0; | ||
213 | |||
214 | for (i = 0; i < 4; i++) { | ||
215 | |||
216 | setup[i] = ((t >> ((3 - i) << 1)) & 0x3) + 1; | ||
217 | recover8b[i] = ((w >> ((1 - (i >> 1)) << 3)) & 0xf) + 1; | ||
218 | active8b[i] = ((w >> (((1 - (i >> 1)) << 3) + 4)) & 0xf) + 1; | ||
219 | active[i] = ((v >> (((3 - i) << 3) + 4)) & 0xf) + 1; | ||
220 | recover[i] = ((v >> ((3 - i) << 3)) & 0xf) + 1; | ||
221 | udma[i] = ((u >> ((3 - i) << 3)) & 0x7) + 2; | ||
222 | umul[i] = ((u >> (((3 - i) & 2) << 3)) & 0x8) ? 1 : 2; | ||
223 | uen[i] = ((u >> ((3 - i) << 3)) & 0x20); | ||
224 | den[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2)); | ||
225 | |||
226 | speed[i] = 2 * via_clock / (active[i] + recover[i]); | ||
227 | cycle[i] = 1000000 * (active[i] + recover[i]) / via_clock; | ||
228 | |||
229 | if (!uen[i] || !den[i]) | ||
230 | continue; | ||
231 | |||
232 | switch (via_config->flags & VIA_UDMA) { | ||
233 | |||
234 | case VIA_UDMA_33: | ||
235 | speed[i] = 2 * via_clock / udma[i]; | ||
236 | cycle[i] = 1000000 * udma[i] / via_clock; | ||
237 | break; | ||
238 | |||
239 | case VIA_UDMA_66: | ||
240 | speed[i] = 4 * via_clock / (udma[i] * umul[i]); | ||
241 | cycle[i] = 500000 * (udma[i] * umul[i]) / via_clock; | ||
242 | break; | ||
243 | |||
244 | case VIA_UDMA_100: | ||
245 | speed[i] = 6 * via_clock / udma[i]; | ||
246 | cycle[i] = 333333 * udma[i] / via_clock; | ||
247 | break; | ||
248 | |||
249 | case VIA_UDMA_133: | ||
250 | speed[i] = 8 * via_clock / udma[i]; | ||
251 | cycle[i] = 250000 * udma[i] / via_clock; | ||
252 | break; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | via_print_drive("Transfer Mode: ", "%10s", | ||
257 | den[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO"); | ||
258 | |||
259 | via_print_drive("Address Setup: ", "%8dns", | ||
260 | 1000000 * setup[i] / via_clock); | ||
261 | via_print_drive("Cmd Active: ", "%8dns", | ||
262 | 1000000 * active8b[i] / via_clock); | ||
263 | via_print_drive("Cmd Recovery: ", "%8dns", | ||
264 | 1000000 * recover8b[i] / via_clock); | ||
265 | via_print_drive("Data Active: ", "%8dns", | ||
266 | 1000000 * active[i] / via_clock); | ||
267 | via_print_drive("Data Recovery: ", "%8dns", | ||
268 | 1000000 * recover[i] / via_clock); | ||
269 | via_print_drive("Cycle Time: ", "%8dns", | ||
270 | cycle[i]); | ||
271 | via_print_drive("Transfer Rate: ", "%4d.%dMB/s", | ||
272 | speed[i] / 1000, speed[i] / 100 % 10); | ||
273 | |||
274 | /* hoping it is less than 4K... */ | ||
275 | len = (p - buffer) - offset; | ||
276 | *addr = buffer + offset; | ||
277 | |||
278 | return len > count ? count : len; | ||
279 | } | ||
280 | |||
281 | #endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ | ||
282 | 112 | ||
283 | /** | 113 | /** |
284 | * via_set_speed - write timing registers | 114 | * via_set_speed - write timing registers |
@@ -289,11 +119,13 @@ static int via_get_info(char *buffer, char **addr, off_t offset, int count) | |||
289 | * via_set_speed writes timing values to the chipset registers | 119 | * via_set_speed writes timing values to the chipset registers |
290 | */ | 120 | */ |
291 | 121 | ||
292 | static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) | 122 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) |
293 | { | 123 | { |
124 | struct pci_dev *dev = hwif->pci_dev; | ||
125 | struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); | ||
294 | u8 t; | 126 | u8 t; |
295 | 127 | ||
296 | if (~via_config->flags & VIA_BAD_AST) { | 128 | if (~vdev->via_config->flags & VIA_BAD_AST) { |
297 | pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); | 129 | pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); |
298 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); | 130 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); |
299 | pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t); | 131 | pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t); |
@@ -305,7 +137,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) | |||
305 | pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), | 137 | pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), |
306 | ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); | 138 | ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); |
307 | 139 | ||
308 | switch (via_config->flags & VIA_UDMA) { | 140 | switch (vdev->via_config->flags & VIA_UDMA) { |
309 | case VIA_UDMA_33: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; | 141 | case VIA_UDMA_33: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; |
310 | case VIA_UDMA_66: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; | 142 | case VIA_UDMA_66: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; |
311 | case VIA_UDMA_100: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; | 143 | case VIA_UDMA_100: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; |
@@ -329,6 +161,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) | |||
329 | static int via_set_drive(ide_drive_t *drive, u8 speed) | 161 | static int via_set_drive(ide_drive_t *drive, u8 speed) |
330 | { | 162 | { |
331 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 163 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); |
164 | struct via82cxxx_dev *vdev = ide_get_hwifdata(drive->hwif); | ||
332 | struct ide_timing t, p; | 165 | struct ide_timing t, p; |
333 | unsigned int T, UT; | 166 | unsigned int T, UT; |
334 | 167 | ||
@@ -337,7 +170,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) | |||
337 | 170 | ||
338 | T = 1000000000 / via_clock; | 171 | T = 1000000000 / via_clock; |
339 | 172 | ||
340 | switch (via_config->flags & VIA_UDMA) { | 173 | switch (vdev->via_config->flags & VIA_UDMA) { |
341 | case VIA_UDMA_33: UT = T; break; | 174 | case VIA_UDMA_33: UT = T; break; |
342 | case VIA_UDMA_66: UT = T/2; break; | 175 | case VIA_UDMA_66: UT = T/2; break; |
343 | case VIA_UDMA_100: UT = T/3; break; | 176 | case VIA_UDMA_100: UT = T/3; break; |
@@ -352,7 +185,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) | |||
352 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); | 185 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); |
353 | } | 186 | } |
354 | 187 | ||
355 | via_set_speed(HWIF(drive)->pci_dev, drive->dn, &t); | 188 | via_set_speed(HWIF(drive), drive->dn, &t); |
356 | 189 | ||
357 | if (!drive->init_speed) | 190 | if (!drive->init_speed) |
358 | drive->init_speed = speed; | 191 | drive->init_speed = speed; |
@@ -390,20 +223,41 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) | |||
390 | 223 | ||
391 | static int via82cxxx_ide_dma_check (ide_drive_t *drive) | 224 | static int via82cxxx_ide_dma_check (ide_drive_t *drive) |
392 | { | 225 | { |
393 | u16 w80 = HWIF(drive)->udma_four; | 226 | ide_hwif_t *hwif = HWIF(drive); |
227 | struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); | ||
228 | u16 w80 = hwif->udma_four; | ||
394 | 229 | ||
395 | u16 speed = ide_find_best_mode(drive, | 230 | u16 speed = ide_find_best_mode(drive, |
396 | XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | | 231 | XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | |
397 | (via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | | 232 | (vdev->via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | |
398 | (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | | 233 | (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | |
399 | (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | | 234 | (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | |
400 | (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); | 235 | (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); |
401 | 236 | ||
402 | via_set_drive(drive, speed); | 237 | via_set_drive(drive, speed); |
403 | 238 | ||
404 | if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) | 239 | if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) |
405 | return HWIF(drive)->ide_dma_on(drive); | 240 | return hwif->ide_dma_on(drive); |
406 | return HWIF(drive)->ide_dma_off_quietly(drive); | 241 | return hwif->ide_dma_off_quietly(drive); |
242 | } | ||
243 | |||
244 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) | ||
245 | { | ||
246 | struct via_isa_bridge *via_config; | ||
247 | u8 t; | ||
248 | |||
249 | for (via_config = via_isa_bridges; via_config->id; via_config++) | ||
250 | if ((*isa = pci_find_device(PCI_VENDOR_ID_VIA + | ||
251 | !!(via_config->flags & VIA_BAD_ID), | ||
252 | via_config->id, NULL))) { | ||
253 | |||
254 | pci_read_config_byte(*isa, PCI_REVISION_ID, &t); | ||
255 | if (t >= via_config->rev_min && | ||
256 | t <= via_config->rev_max) | ||
257 | break; | ||
258 | } | ||
259 | |||
260 | return via_config; | ||
407 | } | 261 | } |
408 | 262 | ||
409 | /** | 263 | /** |
@@ -418,82 +272,28 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) | |||
418 | static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) | 272 | static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) |
419 | { | 273 | { |
420 | struct pci_dev *isa = NULL; | 274 | struct pci_dev *isa = NULL; |
275 | struct via_isa_bridge *via_config; | ||
421 | u8 t, v; | 276 | u8 t, v; |
422 | unsigned int u; | 277 | unsigned int u; |
423 | int i; | ||
424 | 278 | ||
425 | /* | 279 | /* |
426 | * Find the ISA bridge to see how good the IDE is. | 280 | * Find the ISA bridge to see how good the IDE is. |
427 | */ | 281 | */ |
428 | 282 | via_config = via_config_find(&isa); | |
429 | for (via_config = via_isa_bridges; via_config->id; via_config++) | ||
430 | if ((isa = pci_find_device(PCI_VENDOR_ID_VIA + | ||
431 | !!(via_config->flags & VIA_BAD_ID), | ||
432 | via_config->id, NULL))) { | ||
433 | |||
434 | pci_read_config_byte(isa, PCI_REVISION_ID, &t); | ||
435 | if (t >= via_config->rev_min && | ||
436 | t <= via_config->rev_max) | ||
437 | break; | ||
438 | } | ||
439 | |||
440 | if (!via_config->id) { | 283 | if (!via_config->id) { |
441 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); | 284 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); |
442 | return -ENODEV; | 285 | return -ENODEV; |
443 | } | 286 | } |
444 | 287 | ||
445 | /* | 288 | /* |
446 | * Check 80-wire cable presence and setup Clk66. | 289 | * Setup or disable Clk66 if appropriate |
447 | */ | 290 | */ |
448 | 291 | ||
449 | switch (via_config->flags & VIA_UDMA) { | 292 | if ((via_config->flags & VIA_UDMA) == VIA_UDMA_66) { |
450 | 293 | /* Enable Clk66 */ | |
451 | case VIA_UDMA_66: | 294 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); |
452 | /* Enable Clk66 */ | 295 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); |
453 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | 296 | } else if (via_config->flags & VIA_BAD_CLK66) { |
454 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); | ||
455 | for (i = 24; i >= 0; i -= 8) | ||
456 | if (((u >> (i & 16)) & 8) && | ||
457 | ((u >> i) & 0x20) && | ||
458 | (((u >> i) & 7) < 2)) { | ||
459 | /* | ||
460 | * 2x PCI clock and | ||
461 | * UDMA w/ < 3T/cycle | ||
462 | */ | ||
463 | via_80w |= (1 << (1 - (i >> 4))); | ||
464 | } | ||
465 | break; | ||
466 | |||
467 | case VIA_UDMA_100: | ||
468 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
469 | for (i = 24; i >= 0; i -= 8) | ||
470 | if (((u >> i) & 0x10) || | ||
471 | (((u >> i) & 0x20) && | ||
472 | (((u >> i) & 7) < 4))) { | ||
473 | /* BIOS 80-wire bit or | ||
474 | * UDMA w/ < 60ns/cycle | ||
475 | */ | ||
476 | via_80w |= (1 << (1 - (i >> 4))); | ||
477 | } | ||
478 | break; | ||
479 | |||
480 | case VIA_UDMA_133: | ||
481 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
482 | for (i = 24; i >= 0; i -= 8) | ||
483 | if (((u >> i) & 0x10) || | ||
484 | (((u >> i) & 0x20) && | ||
485 | (((u >> i) & 7) < 6))) { | ||
486 | /* BIOS 80-wire bit or | ||
487 | * UDMA w/ < 60ns/cycle | ||
488 | */ | ||
489 | via_80w |= (1 << (1 - (i >> 4))); | ||
490 | } | ||
491 | break; | ||
492 | |||
493 | } | ||
494 | |||
495 | /* Disable Clk66 */ | ||
496 | if (via_config->flags & VIA_BAD_CLK66) { | ||
497 | /* Would cause trouble on 596a and 686 */ | 297 | /* Would cause trouble on 596a and 686 */ |
498 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | 298 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); |
499 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u & ~0x80008); | 299 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u & ~0x80008); |
@@ -560,26 +360,78 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const | |||
560 | via_dma[via_config->flags & VIA_UDMA], | 360 | via_dma[via_config->flags & VIA_UDMA], |
561 | pci_name(dev)); | 361 | pci_name(dev)); |
562 | 362 | ||
563 | /* | 363 | return 0; |
564 | * Setup /proc/ide/via entry. | 364 | } |
565 | */ | 365 | |
366 | /* | ||
367 | * Check and handle 80-wire cable presence | ||
368 | */ | ||
369 | static void __devinit via_cable_detect(struct pci_dev *dev, struct via82cxxx_dev *vdev) | ||
370 | { | ||
371 | unsigned int u; | ||
372 | int i; | ||
373 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
374 | |||
375 | switch (vdev->via_config->flags & VIA_UDMA) { | ||
376 | |||
377 | case VIA_UDMA_66: | ||
378 | for (i = 24; i >= 0; i -= 8) | ||
379 | if (((u >> (i & 16)) & 8) && | ||
380 | ((u >> i) & 0x20) && | ||
381 | (((u >> i) & 7) < 2)) { | ||
382 | /* | ||
383 | * 2x PCI clock and | ||
384 | * UDMA w/ < 3T/cycle | ||
385 | */ | ||
386 | vdev->via_80w |= (1 << (1 - (i >> 4))); | ||
387 | } | ||
388 | break; | ||
389 | |||
390 | case VIA_UDMA_100: | ||
391 | for (i = 24; i >= 0; i -= 8) | ||
392 | if (((u >> i) & 0x10) || | ||
393 | (((u >> i) & 0x20) && | ||
394 | (((u >> i) & 7) < 4))) { | ||
395 | /* BIOS 80-wire bit or | ||
396 | * UDMA w/ < 60ns/cycle | ||
397 | */ | ||
398 | vdev->via_80w |= (1 << (1 - (i >> 4))); | ||
399 | } | ||
400 | break; | ||
401 | |||
402 | case VIA_UDMA_133: | ||
403 | for (i = 24; i >= 0; i -= 8) | ||
404 | if (((u >> i) & 0x10) || | ||
405 | (((u >> i) & 0x20) && | ||
406 | (((u >> i) & 7) < 6))) { | ||
407 | /* BIOS 80-wire bit or | ||
408 | * UDMA w/ < 60ns/cycle | ||
409 | */ | ||
410 | vdev->via_80w |= (1 << (1 - (i >> 4))); | ||
411 | } | ||
412 | break; | ||
566 | 413 | ||
567 | #if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) | ||
568 | if (!via_proc) { | ||
569 | via_base = pci_resource_start(dev, 4); | ||
570 | bmide_dev = dev; | ||
571 | isa_dev = isa; | ||
572 | ide_pci_create_host_proc("via", via_get_info); | ||
573 | via_proc = 1; | ||
574 | } | 414 | } |
575 | #endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ | ||
576 | return 0; | ||
577 | } | 415 | } |
578 | 416 | ||
579 | static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | 417 | static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) |
580 | { | 418 | { |
419 | struct via82cxxx_dev *vdev = kmalloc(sizeof(struct via82cxxx_dev), | ||
420 | GFP_KERNEL); | ||
421 | struct pci_dev *isa = NULL; | ||
581 | int i; | 422 | int i; |
582 | 423 | ||
424 | if (vdev == NULL) { | ||
425 | printk(KERN_ERR "VP_IDE: out of memory :(\n"); | ||
426 | return; | ||
427 | } | ||
428 | |||
429 | memset(vdev, 0, sizeof(struct via82cxxx_dev)); | ||
430 | ide_set_hwifdata(hwif, vdev); | ||
431 | |||
432 | vdev->via_config = via_config_find(&isa); | ||
433 | via_cable_detect(hwif->pci_dev, vdev); | ||
434 | |||
583 | hwif->autodma = 0; | 435 | hwif->autodma = 0; |
584 | 436 | ||
585 | hwif->tuneproc = &via82cxxx_tune_drive; | 437 | hwif->tuneproc = &via82cxxx_tune_drive; |
@@ -594,7 +446,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
594 | 446 | ||
595 | for (i = 0; i < 2; i++) { | 447 | for (i = 0; i < 2; i++) { |
596 | hwif->drives[i].io_32bit = 1; | 448 | hwif->drives[i].io_32bit = 1; |
597 | hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1; | 449 | hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; |
598 | hwif->drives[i].autotune = 1; | 450 | hwif->drives[i].autotune = 1; |
599 | hwif->drives[i].dn = hwif->channel * 2 + i; | 451 | hwif->drives[i].dn = hwif->channel * 2 + i; |
600 | } | 452 | } |
@@ -608,7 +460,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
608 | hwif->swdma_mask = 0x07; | 460 | hwif->swdma_mask = 0x07; |
609 | 461 | ||
610 | if (!hwif->udma_four) | 462 | if (!hwif->udma_four) |
611 | hwif->udma_four = (via_80w >> hwif->channel) & 1; | 463 | hwif->udma_four = (vdev->via_80w >> hwif->channel) & 1; |
612 | hwif->ide_dma_check = &via82cxxx_ide_dma_check; | 464 | hwif->ide_dma_check = &via82cxxx_ide_dma_check; |
613 | if (!noautodma) | 465 | if (!noautodma) |
614 | hwif->autodma = 1; | 466 | hwif->autodma = 1; |
@@ -616,24 +468,35 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
616 | hwif->drives[1].autodma = hwif->autodma; | 468 | hwif->drives[1].autodma = hwif->autodma; |
617 | } | 469 | } |
618 | 470 | ||
619 | static ide_pci_device_t via82cxxx_chipset __devinitdata = { | 471 | static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { |
620 | .name = "VP_IDE", | 472 | { /* 0 */ |
621 | .init_chipset = init_chipset_via82cxxx, | 473 | .name = "VP_IDE", |
622 | .init_hwif = init_hwif_via82cxxx, | 474 | .init_chipset = init_chipset_via82cxxx, |
623 | .channels = 2, | 475 | .init_hwif = init_hwif_via82cxxx, |
624 | .autodma = NOAUTODMA, | 476 | .channels = 2, |
625 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, | 477 | .autodma = NOAUTODMA, |
626 | .bootable = ON_BOARD, | 478 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, |
479 | .bootable = ON_BOARD | ||
480 | },{ /* 1 */ | ||
481 | .name = "VP_IDE", | ||
482 | .init_chipset = init_chipset_via82cxxx, | ||
483 | .init_hwif = init_hwif_via82cxxx, | ||
484 | .channels = 2, | ||
485 | .autodma = AUTODMA, | ||
486 | .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, | ||
487 | .bootable = ON_BOARD, | ||
488 | } | ||
627 | }; | 489 | }; |
628 | 490 | ||
629 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 491 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
630 | { | 492 | { |
631 | return ide_setup_pci_device(dev, &via82cxxx_chipset); | 493 | return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); |
632 | } | 494 | } |
633 | 495 | ||
634 | static struct pci_device_id via_pci_tbl[] = { | 496 | static struct pci_device_id via_pci_tbl[] = { |
635 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 497 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
636 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 498 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
499 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_6410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, | ||
637 | { 0, }, | 500 | { 0, }, |
638 | }; | 501 | }; |
639 | MODULE_DEVICE_TABLE(pci, via_pci_tbl); | 502 | MODULE_DEVICE_TABLE(pci, via_pci_tbl); |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 136911a86e8..16b28357885 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1401,20 +1401,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1401 | /* We probe the hwif now */ | 1401 | /* We probe the hwif now */ |
1402 | probe_hwif_init(hwif); | 1402 | probe_hwif_init(hwif); |
1403 | 1403 | ||
1404 | /* The code IDE code will have set hwif->present if we have devices attached, | ||
1405 | * if we don't, the discard the interface except if we are on a media bay slot | ||
1406 | */ | ||
1407 | if (!hwif->present && !pmif->mediabay) { | ||
1408 | printk(KERN_INFO "ide%d: Bus empty, interface released.\n", | ||
1409 | hwif->index); | ||
1410 | default_hwif_iops(hwif); | ||
1411 | for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i) | ||
1412 | hwif->io_ports[i] = 0; | ||
1413 | hwif->chipset = ide_unknown; | ||
1414 | hwif->noprobe = 1; | ||
1415 | return -ENODEV; | ||
1416 | } | ||
1417 | |||
1418 | return 0; | 1404 | return 0; |
1419 | } | 1405 | } |
1420 | 1406 | ||
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index d4f2111d436..7ebf992e8c2 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -787,7 +787,7 @@ static int pre_init = 1; /* Before first ordered IDE scan */ | |||
787 | static LIST_HEAD(ide_pci_drivers); | 787 | static LIST_HEAD(ide_pci_drivers); |
788 | 788 | ||
789 | /* | 789 | /* |
790 | * __ide_register_pci_driver - attach IDE driver | 790 | * __ide_pci_register_driver - attach IDE driver |
791 | * @driver: pci driver | 791 | * @driver: pci driver |
792 | * @module: owner module of the driver | 792 | * @module: owner module of the driver |
793 | * | 793 | * |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 5ea741f47fc..e73f81c2238 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -312,7 +312,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, | |||
312 | int ret, length, hdr_len, copy_offset; | 312 | int ret, length, hdr_len, copy_offset; |
313 | int rmpp_active = 0; | 313 | int rmpp_active = 0; |
314 | 314 | ||
315 | if (count < sizeof (struct ib_user_mad)) | 315 | if (count < sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR) |
316 | return -EINVAL; | 316 | return -EINVAL; |
317 | 317 | ||
318 | length = count - sizeof (struct ib_user_mad); | 318 | length = count - sizeof (struct ib_user_mad); |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 760c418d5bc..dd4e13303e9 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -730,15 +730,16 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
730 | } | 730 | } |
731 | 731 | ||
732 | if (attr_mask & IB_QP_ACCESS_FLAGS) { | 732 | if (attr_mask & IB_QP_ACCESS_FLAGS) { |
733 | qp_context->params2 |= | ||
734 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_WRITE ? | ||
735 | MTHCA_QP_BIT_RWE : 0); | ||
736 | |||
733 | /* | 737 | /* |
734 | * Only enable RDMA/atomics if we have responder | 738 | * Only enable RDMA reads and atomics if we have |
735 | * resources set to a non-zero value. | 739 | * responder resources set to a non-zero value. |
736 | */ | 740 | */ |
737 | if (qp->resp_depth) { | 741 | if (qp->resp_depth) { |
738 | qp_context->params2 |= | 742 | qp_context->params2 |= |
739 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_WRITE ? | ||
740 | MTHCA_QP_BIT_RWE : 0); | ||
741 | qp_context->params2 |= | ||
742 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_READ ? | 743 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_READ ? |
743 | MTHCA_QP_BIT_RRE : 0); | 744 | MTHCA_QP_BIT_RRE : 0); |
744 | qp_context->params2 |= | 745 | qp_context->params2 |= |
@@ -759,31 +760,27 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
759 | if (qp->resp_depth && !attr->max_dest_rd_atomic) { | 760 | if (qp->resp_depth && !attr->max_dest_rd_atomic) { |
760 | /* | 761 | /* |
761 | * Lowering our responder resources to zero. | 762 | * Lowering our responder resources to zero. |
762 | * Turn off RDMA/atomics as responder. | 763 | * Turn off reads RDMA and atomics as responder. |
763 | * (RWE/RRE/RAE in params2 already zero) | 764 | * (RRE/RAE in params2 already zero) |
764 | */ | 765 | */ |
765 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RWE | | 766 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RRE | |
766 | MTHCA_QP_OPTPAR_RRE | | ||
767 | MTHCA_QP_OPTPAR_RAE); | 767 | MTHCA_QP_OPTPAR_RAE); |
768 | } | 768 | } |
769 | 769 | ||
770 | if (!qp->resp_depth && attr->max_dest_rd_atomic) { | 770 | if (!qp->resp_depth && attr->max_dest_rd_atomic) { |
771 | /* | 771 | /* |
772 | * Increasing our responder resources from | 772 | * Increasing our responder resources from |
773 | * zero. Turn on RDMA/atomics as appropriate. | 773 | * zero. Turn on RDMA reads and atomics as |
774 | * appropriate. | ||
774 | */ | 775 | */ |
775 | qp_context->params2 |= | 776 | qp_context->params2 |= |
776 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_WRITE ? | ||
777 | MTHCA_QP_BIT_RWE : 0); | ||
778 | qp_context->params2 |= | ||
779 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_READ ? | 777 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_READ ? |
780 | MTHCA_QP_BIT_RRE : 0); | 778 | MTHCA_QP_BIT_RRE : 0); |
781 | qp_context->params2 |= | 779 | qp_context->params2 |= |
782 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_ATOMIC ? | 780 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_ATOMIC ? |
783 | MTHCA_QP_BIT_RAE : 0); | 781 | MTHCA_QP_BIT_RAE : 0); |
784 | 782 | ||
785 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RWE | | 783 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RRE | |
786 | MTHCA_QP_OPTPAR_RRE | | ||
787 | MTHCA_QP_OPTPAR_RAE); | 784 | MTHCA_QP_OPTPAR_RAE); |
788 | } | 785 | } |
789 | 786 | ||
@@ -921,10 +918,12 @@ static void mthca_adjust_qp_caps(struct mthca_dev *dev, | |||
921 | else | 918 | else |
922 | qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE; | 919 | qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE; |
923 | 920 | ||
924 | qp->sq.max_gs = max_data_size / sizeof (struct mthca_data_seg); | 921 | qp->sq.max_gs = min_t(int, dev->limits.max_sg, |
925 | qp->rq.max_gs = (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - | 922 | max_data_size / sizeof (struct mthca_data_seg)); |
926 | sizeof (struct mthca_next_seg)) / | 923 | qp->rq.max_gs = min_t(int, dev->limits.max_sg, |
927 | sizeof (struct mthca_data_seg); | 924 | (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - |
925 | sizeof (struct mthca_next_seg)) / | ||
926 | sizeof (struct mthca_data_seg)); | ||
928 | } | 927 | } |
929 | 928 | ||
930 | /* | 929 | /* |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 321a3a10e69..ee9fe226ae9 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -802,13 +802,21 @@ static int srp_post_recv(struct srp_target_port *target) | |||
802 | 802 | ||
803 | /* | 803 | /* |
804 | * Must be called with target->scsi_host->host_lock held to protect | 804 | * Must be called with target->scsi_host->host_lock held to protect |
805 | * req_lim and tx_head. | 805 | * req_lim and tx_head. Lock cannot be dropped between call here and |
806 | * call to __srp_post_send(). | ||
806 | */ | 807 | */ |
807 | static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target) | 808 | static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target) |
808 | { | 809 | { |
809 | if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE) | 810 | if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE) |
810 | return NULL; | 811 | return NULL; |
811 | 812 | ||
813 | if (unlikely(target->req_lim < 1)) { | ||
814 | if (printk_ratelimit()) | ||
815 | printk(KERN_DEBUG PFX "Target has req_lim %d\n", | ||
816 | target->req_lim); | ||
817 | return NULL; | ||
818 | } | ||
819 | |||
812 | return target->tx_ring[target->tx_head & SRP_SQ_SIZE]; | 820 | return target->tx_ring[target->tx_head & SRP_SQ_SIZE]; |
813 | } | 821 | } |
814 | 822 | ||
@@ -823,11 +831,6 @@ static int __srp_post_send(struct srp_target_port *target, | |||
823 | struct ib_send_wr wr, *bad_wr; | 831 | struct ib_send_wr wr, *bad_wr; |
824 | int ret = 0; | 832 | int ret = 0; |
825 | 833 | ||
826 | if (target->req_lim < 1) { | ||
827 | printk(KERN_ERR PFX "Target has req_lim %d\n", target->req_lim); | ||
828 | return -EAGAIN; | ||
829 | } | ||
830 | |||
831 | list.addr = iu->dma; | 834 | list.addr = iu->dma; |
832 | list.length = len; | 835 | list.length = len; |
833 | list.lkey = target->srp_host->mr->lkey; | 836 | list.lkey = target->srp_host->mr->lkey; |
@@ -1417,6 +1420,8 @@ static ssize_t srp_create_target(struct class_device *class_dev, | |||
1417 | if (!target_host) | 1420 | if (!target_host) |
1418 | return -ENOMEM; | 1421 | return -ENOMEM; |
1419 | 1422 | ||
1423 | target_host->max_lun = SRP_MAX_LUN; | ||
1424 | |||
1420 | target = host_to_target(target_host); | 1425 | target = host_to_target(target_host); |
1421 | memset(target, 0, sizeof *target); | 1426 | memset(target, 0, sizeof *target); |
1422 | 1427 | ||
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 4fec28a7136..b564f18caf7 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -54,6 +54,7 @@ enum { | |||
54 | SRP_PORT_REDIRECT = 1, | 54 | SRP_PORT_REDIRECT = 1, |
55 | SRP_DLID_REDIRECT = 2, | 55 | SRP_DLID_REDIRECT = 2, |
56 | 56 | ||
57 | SRP_MAX_LUN = 512, | ||
57 | SRP_MAX_IU_LEN = 256, | 58 | SRP_MAX_IU_LEN = 256, |
58 | 59 | ||
59 | SRP_RQ_SHIFT = 6, | 60 | SRP_RQ_SHIFT = 6, |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 0506934244f..caac6d63d46 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -339,14 +339,20 @@ static struct gameport_event *gameport_get_event(void) | |||
339 | return event; | 339 | return event; |
340 | } | 340 | } |
341 | 341 | ||
342 | static void gameport_handle_events(void) | 342 | static void gameport_handle_event(void) |
343 | { | 343 | { |
344 | struct gameport_event *event; | 344 | struct gameport_event *event; |
345 | struct gameport_driver *gameport_drv; | 345 | struct gameport_driver *gameport_drv; |
346 | 346 | ||
347 | down(&gameport_sem); | 347 | down(&gameport_sem); |
348 | 348 | ||
349 | while ((event = gameport_get_event())) { | 349 | /* |
350 | * Note that we handle only one event here to give swsusp | ||
351 | * a chance to freeze kgameportd thread. Gameport events | ||
352 | * should be pretty rare so we are not concerned about | ||
353 | * taking performance hit. | ||
354 | */ | ||
355 | if ((event = gameport_get_event())) { | ||
350 | 356 | ||
351 | switch (event->type) { | 357 | switch (event->type) { |
352 | case GAMEPORT_REGISTER_PORT: | 358 | case GAMEPORT_REGISTER_PORT: |
@@ -433,7 +439,7 @@ static struct gameport *gameport_get_pending_child(struct gameport *parent) | |||
433 | static int gameport_thread(void *nothing) | 439 | static int gameport_thread(void *nothing) |
434 | { | 440 | { |
435 | do { | 441 | do { |
436 | gameport_handle_events(); | 442 | gameport_handle_event(); |
437 | wait_event_interruptible(gameport_wait, | 443 | wait_event_interruptible(gameport_wait, |
438 | kthread_should_stop() || !list_empty(&gameport_event_list)); | 444 | kthread_should_stop() || !list_empty(&gameport_event_list)); |
439 | try_to_freeze(); | 445 | try_to_freeze(); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index c8ae2bb054e..bdd2a7fc268 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -536,7 +536,7 @@ static struct attribute *input_dev_attrs[] = { | |||
536 | NULL | 536 | NULL |
537 | }; | 537 | }; |
538 | 538 | ||
539 | static struct attribute_group input_dev_group = { | 539 | static struct attribute_group input_dev_attr_group = { |
540 | .attrs = input_dev_attrs, | 540 | .attrs = input_dev_attrs, |
541 | }; | 541 | }; |
542 | 542 | ||
@@ -717,35 +717,14 @@ struct input_dev *input_allocate_device(void) | |||
717 | return dev; | 717 | return dev; |
718 | } | 718 | } |
719 | 719 | ||
720 | static void input_register_classdevice(struct input_dev *dev) | ||
721 | { | ||
722 | static atomic_t input_no = ATOMIC_INIT(0); | ||
723 | const char *path; | ||
724 | |||
725 | __module_get(THIS_MODULE); | ||
726 | |||
727 | dev->dev = dev->cdev.dev; | ||
728 | |||
729 | snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), | ||
730 | "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); | ||
731 | |||
732 | path = kobject_get_path(&dev->cdev.class->subsys.kset.kobj, GFP_KERNEL); | ||
733 | printk(KERN_INFO "input: %s as %s/%s\n", | ||
734 | dev->name ? dev->name : "Unspecified device", | ||
735 | path ? path : "", dev->cdev.class_id); | ||
736 | kfree(path); | ||
737 | |||
738 | class_device_add(&dev->cdev); | ||
739 | sysfs_create_group(&dev->cdev.kobj, &input_dev_group); | ||
740 | sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
741 | sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | ||
742 | } | ||
743 | |||
744 | int input_register_device(struct input_dev *dev) | 720 | int input_register_device(struct input_dev *dev) |
745 | { | 721 | { |
722 | static atomic_t input_no = ATOMIC_INIT(0); | ||
746 | struct input_handle *handle; | 723 | struct input_handle *handle; |
747 | struct input_handler *handler; | 724 | struct input_handler *handler; |
748 | struct input_device_id *id; | 725 | struct input_device_id *id; |
726 | const char *path; | ||
727 | int error; | ||
749 | 728 | ||
750 | if (!dev->dynalloc) { | 729 | if (!dev->dynalloc) { |
751 | printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" | 730 | printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" |
@@ -773,7 +752,32 @@ int input_register_device(struct input_dev *dev) | |||
773 | INIT_LIST_HEAD(&dev->h_list); | 752 | INIT_LIST_HEAD(&dev->h_list); |
774 | list_add_tail(&dev->node, &input_dev_list); | 753 | list_add_tail(&dev->node, &input_dev_list); |
775 | 754 | ||
776 | input_register_classdevice(dev); | 755 | dev->cdev.class = &input_class; |
756 | snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), | ||
757 | "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); | ||
758 | |||
759 | error = class_device_add(&dev->cdev); | ||
760 | if (error) | ||
761 | return error; | ||
762 | |||
763 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_attr_group); | ||
764 | if (error) | ||
765 | goto fail1; | ||
766 | |||
767 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
768 | if (error) | ||
769 | goto fail2; | ||
770 | |||
771 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | ||
772 | if (error) | ||
773 | goto fail3; | ||
774 | |||
775 | __module_get(THIS_MODULE); | ||
776 | |||
777 | path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL); | ||
778 | printk(KERN_INFO "input: %s as %s\n", | ||
779 | dev->name ? dev->name : "Unspecified device", path ? path : "N/A"); | ||
780 | kfree(path); | ||
777 | 781 | ||
778 | list_for_each_entry(handler, &input_handler_list, node) | 782 | list_for_each_entry(handler, &input_handler_list, node) |
779 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 783 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
@@ -784,6 +788,11 @@ int input_register_device(struct input_dev *dev) | |||
784 | input_wakeup_procfs_readers(); | 788 | input_wakeup_procfs_readers(); |
785 | 789 | ||
786 | return 0; | 790 | return 0; |
791 | |||
792 | fail3: sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
793 | fail2: sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); | ||
794 | fail1: class_device_del(&dev->cdev); | ||
795 | return error; | ||
787 | } | 796 | } |
788 | 797 | ||
789 | void input_unregister_device(struct input_dev *dev) | 798 | void input_unregister_device(struct input_dev *dev) |
@@ -805,7 +814,7 @@ void input_unregister_device(struct input_dev *dev) | |||
805 | 814 | ||
806 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | 815 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); |
807 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); | 816 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); |
808 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_group); | 817 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); |
809 | class_device_unregister(&dev->cdev); | 818 | class_device_unregister(&dev->cdev); |
810 | 819 | ||
811 | input_wakeup_procfs_readers(); | 820 | input_wakeup_procfs_readers(); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 820c7fd9a60..a0256f8de8e 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -166,6 +166,9 @@ static unsigned char atkbd_unxlate_table[128] = { | |||
166 | 166 | ||
167 | #define ATKBD_SPECIAL 248 | 167 | #define ATKBD_SPECIAL 248 |
168 | 168 | ||
169 | #define ATKBD_LED_EVENT_BIT 0 | ||
170 | #define ATKBD_REP_EVENT_BIT 1 | ||
171 | |||
169 | static struct { | 172 | static struct { |
170 | unsigned char keycode; | 173 | unsigned char keycode; |
171 | unsigned char set2; | 174 | unsigned char set2; |
@@ -211,6 +214,10 @@ struct atkbd { | |||
211 | unsigned char err_xl; | 214 | unsigned char err_xl; |
212 | unsigned int last; | 215 | unsigned int last; |
213 | unsigned long time; | 216 | unsigned long time; |
217 | |||
218 | struct work_struct event_work; | ||
219 | struct semaphore event_sem; | ||
220 | unsigned long event_mask; | ||
214 | }; | 221 | }; |
215 | 222 | ||
216 | static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, | 223 | static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, |
@@ -424,58 +431,86 @@ out: | |||
424 | } | 431 | } |
425 | 432 | ||
426 | /* | 433 | /* |
427 | * Event callback from the input module. Events that change the state of | 434 | * atkbd_event_work() is used to complete processing of events that |
428 | * the hardware are processed here. | 435 | * can not be processed by input_event() which is often called from |
436 | * interrupt context. | ||
429 | */ | 437 | */ |
430 | 438 | ||
431 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 439 | static void atkbd_event_work(void *data) |
432 | { | 440 | { |
433 | struct atkbd *atkbd = dev->private; | ||
434 | const short period[32] = | 441 | const short period[32] = |
435 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, | 442 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, |
436 | 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; | 443 | 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; |
437 | const short delay[4] = | 444 | const short delay[4] = |
438 | { 250, 500, 750, 1000 }; | 445 | { 250, 500, 750, 1000 }; |
446 | |||
447 | struct atkbd *atkbd = data; | ||
448 | struct input_dev *dev = atkbd->dev; | ||
439 | unsigned char param[2]; | 449 | unsigned char param[2]; |
440 | int i, j; | 450 | int i, j; |
441 | 451 | ||
452 | down(&atkbd->event_sem); | ||
453 | |||
454 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { | ||
455 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | ||
456 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | ||
457 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
458 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | ||
459 | |||
460 | if (atkbd->extra) { | ||
461 | param[0] = 0; | ||
462 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | ||
463 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
464 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
465 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
466 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
467 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
468 | } | ||
469 | } | ||
470 | |||
471 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) { | ||
472 | i = j = 0; | ||
473 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | ||
474 | i++; | ||
475 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | ||
476 | j++; | ||
477 | dev->rep[REP_PERIOD] = period[i]; | ||
478 | dev->rep[REP_DELAY] = delay[j]; | ||
479 | param[0] = i | (j << 5); | ||
480 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | ||
481 | } | ||
482 | |||
483 | up(&atkbd->event_sem); | ||
484 | } | ||
485 | |||
486 | /* | ||
487 | * Event callback from the input module. Events that change the state of | ||
488 | * the hardware are processed here. If action can not be performed in | ||
489 | * interrupt context it is offloaded to atkbd_event_work. | ||
490 | */ | ||
491 | |||
492 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | ||
493 | { | ||
494 | struct atkbd *atkbd = dev->private; | ||
495 | |||
442 | if (!atkbd->write) | 496 | if (!atkbd->write) |
443 | return -1; | 497 | return -1; |
444 | 498 | ||
445 | switch (type) { | 499 | switch (type) { |
446 | 500 | ||
447 | case EV_LED: | 501 | case EV_LED: |
448 | 502 | set_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask); | |
449 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | 503 | wmb(); |
450 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | 504 | schedule_work(&atkbd->event_work); |
451 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
452 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | ||
453 | |||
454 | if (atkbd->extra) { | ||
455 | param[0] = 0; | ||
456 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | ||
457 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
458 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
459 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
460 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
461 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
462 | } | ||
463 | |||
464 | return 0; | 505 | return 0; |
465 | 506 | ||
466 | case EV_REP: | 507 | case EV_REP: |
467 | 508 | ||
468 | if (atkbd->softrepeat) return 0; | 509 | if (!atkbd->softrepeat) { |
469 | 510 | set_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask); | |
470 | i = j = 0; | 511 | wmb(); |
471 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | 512 | schedule_work(&atkbd->event_work); |
472 | i++; | 513 | } |
473 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | ||
474 | j++; | ||
475 | dev->rep[REP_PERIOD] = period[i]; | ||
476 | dev->rep[REP_DELAY] = delay[j]; | ||
477 | param[0] = i | (j << 5); | ||
478 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | ||
479 | 514 | ||
480 | return 0; | 515 | return 0; |
481 | } | 516 | } |
@@ -810,6 +845,8 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
810 | 845 | ||
811 | atkbd->dev = dev; | 846 | atkbd->dev = dev; |
812 | ps2_init(&atkbd->ps2dev, serio); | 847 | ps2_init(&atkbd->ps2dev, serio); |
848 | INIT_WORK(&atkbd->event_work, atkbd_event_work, atkbd); | ||
849 | init_MUTEX(&atkbd->event_sem); | ||
813 | 850 | ||
814 | switch (serio->id.type) { | 851 | switch (serio->id.type) { |
815 | 852 | ||
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index b3eaac1b35b..07813fc0523 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -40,6 +40,16 @@ config INPUT_M68K_BEEP | |||
40 | tristate "M68k Beeper support" | 40 | tristate "M68k Beeper support" |
41 | depends on M68K | 41 | depends on M68K |
42 | 42 | ||
43 | config INPUT_WISTRON_BTNS | ||
44 | tristate "x86 Wistron laptop button interface" | ||
45 | depends on X86 && !X86_64 | ||
46 | help | ||
47 | Say Y here for support of Winstron laptop button interface, used on | ||
48 | laptops of various brands, including Acer and Fujitsu-Siemens. | ||
49 | |||
50 | To compile this driver as a module, choose M here: the module will | ||
51 | be called wistron_btns. | ||
52 | |||
43 | config INPUT_UINPUT | 53 | config INPUT_UINPUT |
44 | tristate "User level driver support" | 54 | tristate "User level driver support" |
45 | help | 55 | help |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index f8d01c69f34..ce44cce0128 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -9,4 +9,5 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o | |||
9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o | 9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o |
10 | obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o | 10 | obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o |
11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o | 11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o |
12 | obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o | ||
12 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o | 13 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 948c1cc01bc..546ed9b4901 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -92,24 +92,19 @@ static void uinput_request_done(struct uinput_device *udev, struct uinput_reques | |||
92 | { | 92 | { |
93 | /* Mark slot as available */ | 93 | /* Mark slot as available */ |
94 | udev->requests[request->id] = NULL; | 94 | udev->requests[request->id] = NULL; |
95 | wake_up_interruptible(&udev->requests_waitq); | 95 | wake_up(&udev->requests_waitq); |
96 | 96 | ||
97 | complete(&request->done); | 97 | complete(&request->done); |
98 | } | 98 | } |
99 | 99 | ||
100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) | 100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) |
101 | { | 101 | { |
102 | int retval; | ||
103 | |||
104 | /* Tell our userspace app about this new request by queueing an input event */ | 102 | /* Tell our userspace app about this new request by queueing an input event */ |
105 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); | 103 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); |
106 | 104 | ||
107 | /* Wait for the request to complete */ | 105 | /* Wait for the request to complete */ |
108 | retval = wait_for_completion_interruptible(&request->done); | 106 | wait_for_completion(&request->done); |
109 | if (!retval) | 107 | return request->retval; |
110 | retval = request->retval; | ||
111 | |||
112 | return retval; | ||
113 | } | 108 | } |
114 | 109 | ||
115 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) | 110 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) |
@@ -152,67 +147,62 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) | |||
152 | return retval; | 147 | return retval; |
153 | } | 148 | } |
154 | 149 | ||
155 | static int uinput_create_device(struct uinput_device *udev) | 150 | static void uinput_destroy_device(struct uinput_device *udev) |
156 | { | 151 | { |
157 | if (!udev->dev->name) { | 152 | const char *name, *phys; |
158 | printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); | 153 | |
159 | return -EINVAL; | 154 | if (udev->dev) { |
155 | name = udev->dev->name; | ||
156 | phys = udev->dev->phys; | ||
157 | if (udev->state == UIST_CREATED) | ||
158 | input_unregister_device(udev->dev); | ||
159 | else | ||
160 | input_free_device(udev->dev); | ||
161 | kfree(name); | ||
162 | kfree(phys); | ||
163 | udev->dev = NULL; | ||
160 | } | 164 | } |
161 | 165 | ||
162 | udev->dev->event = uinput_dev_event; | 166 | udev->state = UIST_NEW_DEVICE; |
163 | udev->dev->upload_effect = uinput_dev_upload_effect; | ||
164 | udev->dev->erase_effect = uinput_dev_erase_effect; | ||
165 | udev->dev->private = udev; | ||
166 | |||
167 | init_waitqueue_head(&udev->waitq); | ||
168 | |||
169 | input_register_device(udev->dev); | ||
170 | |||
171 | set_bit(UIST_CREATED, &udev->state); | ||
172 | |||
173 | return 0; | ||
174 | } | 167 | } |
175 | 168 | ||
176 | static int uinput_destroy_device(struct uinput_device *udev) | 169 | static int uinput_create_device(struct uinput_device *udev) |
177 | { | 170 | { |
178 | if (!test_bit(UIST_CREATED, &udev->state)) { | 171 | int error; |
179 | printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); | 172 | |
173 | if (udev->state != UIST_SETUP_COMPLETE) { | ||
174 | printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); | ||
180 | return -EINVAL; | 175 | return -EINVAL; |
181 | } | 176 | } |
182 | 177 | ||
183 | input_unregister_device(udev->dev); | 178 | error = input_register_device(udev->dev); |
179 | if (error) { | ||
180 | uinput_destroy_device(udev); | ||
181 | return error; | ||
182 | } | ||
184 | 183 | ||
185 | clear_bit(UIST_CREATED, &udev->state); | 184 | udev->state = UIST_CREATED; |
186 | 185 | ||
187 | return 0; | 186 | return 0; |
188 | } | 187 | } |
189 | 188 | ||
190 | static int uinput_open(struct inode *inode, struct file *file) | 189 | static int uinput_open(struct inode *inode, struct file *file) |
191 | { | 190 | { |
192 | struct uinput_device *newdev; | 191 | struct uinput_device *newdev; |
193 | struct input_dev *newinput; | ||
194 | 192 | ||
195 | newdev = kmalloc(sizeof(struct uinput_device), GFP_KERNEL); | 193 | newdev = kzalloc(sizeof(struct uinput_device), GFP_KERNEL); |
196 | if (!newdev) | 194 | if (!newdev) |
197 | goto error; | 195 | return -ENOMEM; |
198 | memset(newdev, 0, sizeof(struct uinput_device)); | 196 | |
197 | init_MUTEX(&newdev->sem); | ||
199 | spin_lock_init(&newdev->requests_lock); | 198 | spin_lock_init(&newdev->requests_lock); |
200 | init_waitqueue_head(&newdev->requests_waitq); | 199 | init_waitqueue_head(&newdev->requests_waitq); |
201 | 200 | init_waitqueue_head(&newdev->waitq); | |
202 | newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); | 201 | newdev->state = UIST_NEW_DEVICE; |
203 | if (!newinput) | ||
204 | goto cleanup; | ||
205 | memset(newinput, 0, sizeof(struct input_dev)); | ||
206 | |||
207 | newdev->dev = newinput; | ||
208 | 202 | ||
209 | file->private_data = newdev; | 203 | file->private_data = newdev; |
210 | 204 | ||
211 | return 0; | 205 | return 0; |
212 | cleanup: | ||
213 | kfree(newdev); | ||
214 | error: | ||
215 | return -ENOMEM; | ||
216 | } | 206 | } |
217 | 207 | ||
218 | static int uinput_validate_absbits(struct input_dev *dev) | 208 | static int uinput_validate_absbits(struct input_dev *dev) |
@@ -246,34 +236,55 @@ static int uinput_validate_absbits(struct input_dev *dev) | |||
246 | return retval; | 236 | return retval; |
247 | } | 237 | } |
248 | 238 | ||
249 | static int uinput_alloc_device(struct file *file, const char __user *buffer, size_t count) | 239 | static int uinput_allocate_device(struct uinput_device *udev) |
240 | { | ||
241 | udev->dev = input_allocate_device(); | ||
242 | if (!udev->dev) | ||
243 | return -ENOMEM; | ||
244 | |||
245 | udev->dev->event = uinput_dev_event; | ||
246 | udev->dev->upload_effect = uinput_dev_upload_effect; | ||
247 | udev->dev->erase_effect = uinput_dev_erase_effect; | ||
248 | udev->dev->private = udev; | ||
249 | |||
250 | return 0; | ||
251 | } | ||
252 | |||
253 | static int uinput_setup_device(struct uinput_device *udev, const char __user *buffer, size_t count) | ||
250 | { | 254 | { |
251 | struct uinput_user_dev *user_dev; | 255 | struct uinput_user_dev *user_dev; |
252 | struct input_dev *dev; | 256 | struct input_dev *dev; |
253 | struct uinput_device *udev; | ||
254 | char *name; | 257 | char *name; |
255 | int size; | 258 | int size; |
256 | int retval; | 259 | int retval; |
257 | 260 | ||
258 | retval = count; | 261 | if (count != sizeof(struct uinput_user_dev)) |
262 | return -EINVAL; | ||
263 | |||
264 | if (!udev->dev) { | ||
265 | retval = uinput_allocate_device(udev); | ||
266 | if (retval) | ||
267 | return retval; | ||
268 | } | ||
259 | 269 | ||
260 | udev = file->private_data; | ||
261 | dev = udev->dev; | 270 | dev = udev->dev; |
262 | 271 | ||
263 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); | 272 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); |
264 | if (!user_dev) { | 273 | if (!user_dev) |
265 | retval = -ENOMEM; | 274 | return -ENOMEM; |
266 | goto exit; | ||
267 | } | ||
268 | 275 | ||
269 | if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { | 276 | if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { |
270 | retval = -EFAULT; | 277 | retval = -EFAULT; |
271 | goto exit; | 278 | goto exit; |
272 | } | 279 | } |
273 | 280 | ||
274 | kfree(dev->name); | ||
275 | |||
276 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; | 281 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; |
282 | if (!size) { | ||
283 | retval = -EINVAL; | ||
284 | goto exit; | ||
285 | } | ||
286 | |||
287 | kfree(dev->name); | ||
277 | dev->name = name = kmalloc(size, GFP_KERNEL); | 288 | dev->name = name = kmalloc(size, GFP_KERNEL); |
278 | if (!name) { | 289 | if (!name) { |
279 | retval = -ENOMEM; | 290 | retval = -ENOMEM; |
@@ -296,32 +307,50 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz | |||
296 | /* check if absmin/absmax/absfuzz/absflat are filled as | 307 | /* check if absmin/absmax/absfuzz/absflat are filled as |
297 | * told in Documentation/input/input-programming.txt */ | 308 | * told in Documentation/input/input-programming.txt */ |
298 | if (test_bit(EV_ABS, dev->evbit)) { | 309 | if (test_bit(EV_ABS, dev->evbit)) { |
299 | int err = uinput_validate_absbits(dev); | 310 | retval = uinput_validate_absbits(dev); |
300 | if (err < 0) { | 311 | if (retval < 0) |
301 | retval = err; | 312 | goto exit; |
302 | kfree(dev->name); | ||
303 | } | ||
304 | } | 313 | } |
305 | 314 | ||
306 | exit: | 315 | udev->state = UIST_SETUP_COMPLETE; |
316 | retval = count; | ||
317 | |||
318 | exit: | ||
307 | kfree(user_dev); | 319 | kfree(user_dev); |
308 | return retval; | 320 | return retval; |
309 | } | 321 | } |
310 | 322 | ||
323 | static inline ssize_t uinput_inject_event(struct uinput_device *udev, const char __user *buffer, size_t count) | ||
324 | { | ||
325 | struct input_event ev; | ||
326 | |||
327 | if (count != sizeof(struct input_event)) | ||
328 | return -EINVAL; | ||
329 | |||
330 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | ||
331 | return -EFAULT; | ||
332 | |||
333 | input_event(udev->dev, ev.type, ev.code, ev.value); | ||
334 | |||
335 | return sizeof(struct input_event); | ||
336 | } | ||
337 | |||
311 | static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 338 | static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
312 | { | 339 | { |
313 | struct uinput_device *udev = file->private_data; | 340 | struct uinput_device *udev = file->private_data; |
341 | int retval; | ||
342 | |||
343 | retval = down_interruptible(&udev->sem); | ||
344 | if (retval) | ||
345 | return retval; | ||
314 | 346 | ||
315 | if (test_bit(UIST_CREATED, &udev->state)) { | 347 | retval = udev->state == UIST_CREATED ? |
316 | struct input_event ev; | 348 | uinput_inject_event(udev, buffer, count) : |
349 | uinput_setup_device(udev, buffer, count); | ||
317 | 350 | ||
318 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | 351 | up(&udev->sem); |
319 | return -EFAULT; | ||
320 | input_event(udev->dev, ev.type, ev.code, ev.value); | ||
321 | } else | ||
322 | count = uinput_alloc_device(file, buffer, count); | ||
323 | 352 | ||
324 | return count; | 353 | return retval; |
325 | } | 354 | } |
326 | 355 | ||
327 | static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 356 | static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
@@ -329,28 +358,38 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, | |||
329 | struct uinput_device *udev = file->private_data; | 358 | struct uinput_device *udev = file->private_data; |
330 | int retval = 0; | 359 | int retval = 0; |
331 | 360 | ||
332 | if (!test_bit(UIST_CREATED, &udev->state)) | 361 | if (udev->state != UIST_CREATED) |
333 | return -ENODEV; | 362 | return -ENODEV; |
334 | 363 | ||
335 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) | 364 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) |
336 | return -EAGAIN; | 365 | return -EAGAIN; |
337 | 366 | ||
338 | retval = wait_event_interruptible(udev->waitq, | 367 | retval = wait_event_interruptible(udev->waitq, |
339 | udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state)); | 368 | udev->head != udev->tail || udev->state != UIST_CREATED); |
340 | if (retval) | 369 | if (retval) |
341 | return retval; | 370 | return retval; |
342 | 371 | ||
343 | if (!test_bit(UIST_CREATED, &udev->state)) | 372 | retval = down_interruptible(&udev->sem); |
344 | return -ENODEV; | 373 | if (retval) |
374 | return retval; | ||
345 | 375 | ||
346 | while ((udev->head != udev->tail) && | 376 | if (udev->state != UIST_CREATED) { |
347 | (retval + sizeof(struct input_event) <= count)) { | 377 | retval = -ENODEV; |
348 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) | 378 | goto out; |
349 | return -EFAULT; | 379 | } |
380 | |||
381 | while (udev->head != udev->tail && retval + sizeof(struct input_event) <= count) { | ||
382 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) { | ||
383 | retval = -EFAULT; | ||
384 | goto out; | ||
385 | } | ||
350 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; | 386 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; |
351 | retval += sizeof(struct input_event); | 387 | retval += sizeof(struct input_event); |
352 | } | 388 | } |
353 | 389 | ||
390 | out: | ||
391 | up(&udev->sem); | ||
392 | |||
354 | return retval; | 393 | return retval; |
355 | } | 394 | } |
356 | 395 | ||
@@ -366,28 +405,30 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) | |||
366 | return 0; | 405 | return 0; |
367 | } | 406 | } |
368 | 407 | ||
369 | static int uinput_burn_device(struct uinput_device *udev) | 408 | static int uinput_release(struct inode *inode, struct file *file) |
370 | { | 409 | { |
371 | if (test_bit(UIST_CREATED, &udev->state)) | 410 | struct uinput_device *udev = file->private_data; |
372 | uinput_destroy_device(udev); | ||
373 | 411 | ||
374 | kfree(udev->dev->name); | 412 | uinput_destroy_device(udev); |
375 | kfree(udev->dev->phys); | ||
376 | kfree(udev->dev); | ||
377 | kfree(udev); | 413 | kfree(udev); |
378 | 414 | ||
379 | return 0; | 415 | return 0; |
380 | } | 416 | } |
381 | 417 | ||
382 | static int uinput_close(struct inode *inode, struct file *file) | 418 | #define uinput_set_bit(_arg, _bit, _max) \ |
419 | ({ \ | ||
420 | int __ret = 0; \ | ||
421 | if (udev->state == UIST_CREATED) \ | ||
422 | __ret = -EINVAL; \ | ||
423 | else if ((_arg) > (_max)) \ | ||
424 | __ret = -EINVAL; \ | ||
425 | else set_bit((_arg), udev->dev->_bit); \ | ||
426 | __ret; \ | ||
427 | }) | ||
428 | |||
429 | static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
383 | { | 430 | { |
384 | uinput_burn_device(file->private_data); | 431 | int retval; |
385 | return 0; | ||
386 | } | ||
387 | |||
388 | static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | ||
389 | { | ||
390 | int retval = 0; | ||
391 | struct uinput_device *udev; | 432 | struct uinput_device *udev; |
392 | void __user *p = (void __user *)arg; | 433 | void __user *p = (void __user *)arg; |
393 | struct uinput_ff_upload ff_up; | 434 | struct uinput_ff_upload ff_up; |
@@ -398,19 +439,14 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
398 | 439 | ||
399 | udev = file->private_data; | 440 | udev = file->private_data; |
400 | 441 | ||
401 | /* device attributes can not be changed after the device is created */ | 442 | retval = down_interruptible(&udev->sem); |
402 | switch (cmd) { | 443 | if (retval) |
403 | case UI_SET_EVBIT: | 444 | return retval; |
404 | case UI_SET_KEYBIT: | 445 | |
405 | case UI_SET_RELBIT: | 446 | if (!udev->dev) { |
406 | case UI_SET_ABSBIT: | 447 | retval = uinput_allocate_device(udev); |
407 | case UI_SET_MSCBIT: | 448 | if (retval) |
408 | case UI_SET_LEDBIT: | 449 | goto out; |
409 | case UI_SET_SNDBIT: | ||
410 | case UI_SET_FFBIT: | ||
411 | case UI_SET_PHYS: | ||
412 | if (test_bit(UIST_CREATED, &udev->state)) | ||
413 | return -EINVAL; | ||
414 | } | 450 | } |
415 | 451 | ||
416 | switch (cmd) { | 452 | switch (cmd) { |
@@ -419,74 +455,50 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
419 | break; | 455 | break; |
420 | 456 | ||
421 | case UI_DEV_DESTROY: | 457 | case UI_DEV_DESTROY: |
422 | retval = uinput_destroy_device(udev); | 458 | uinput_destroy_device(udev); |
423 | break; | 459 | break; |
424 | 460 | ||
425 | case UI_SET_EVBIT: | 461 | case UI_SET_EVBIT: |
426 | if (arg > EV_MAX) { | 462 | retval = uinput_set_bit(arg, evbit, EV_MAX); |
427 | retval = -EINVAL; | ||
428 | break; | ||
429 | } | ||
430 | set_bit(arg, udev->dev->evbit); | ||
431 | break; | 463 | break; |
432 | 464 | ||
433 | case UI_SET_KEYBIT: | 465 | case UI_SET_KEYBIT: |
434 | if (arg > KEY_MAX) { | 466 | retval = uinput_set_bit(arg, keybit, KEY_MAX); |
435 | retval = -EINVAL; | ||
436 | break; | ||
437 | } | ||
438 | set_bit(arg, udev->dev->keybit); | ||
439 | break; | 467 | break; |
440 | 468 | ||
441 | case UI_SET_RELBIT: | 469 | case UI_SET_RELBIT: |
442 | if (arg > REL_MAX) { | 470 | retval = uinput_set_bit(arg, relbit, REL_MAX); |
443 | retval = -EINVAL; | ||
444 | break; | ||
445 | } | ||
446 | set_bit(arg, udev->dev->relbit); | ||
447 | break; | 471 | break; |
448 | 472 | ||
449 | case UI_SET_ABSBIT: | 473 | case UI_SET_ABSBIT: |
450 | if (arg > ABS_MAX) { | 474 | retval = uinput_set_bit(arg, absbit, ABS_MAX); |
451 | retval = -EINVAL; | ||
452 | break; | ||
453 | } | ||
454 | set_bit(arg, udev->dev->absbit); | ||
455 | break; | 475 | break; |
456 | 476 | ||
457 | case UI_SET_MSCBIT: | 477 | case UI_SET_MSCBIT: |
458 | if (arg > MSC_MAX) { | 478 | retval = uinput_set_bit(arg, mscbit, MSC_MAX); |
459 | retval = -EINVAL; | ||
460 | break; | ||
461 | } | ||
462 | set_bit(arg, udev->dev->mscbit); | ||
463 | break; | 479 | break; |
464 | 480 | ||
465 | case UI_SET_LEDBIT: | 481 | case UI_SET_LEDBIT: |
466 | if (arg > LED_MAX) { | 482 | retval = uinput_set_bit(arg, ledbit, LED_MAX); |
467 | retval = -EINVAL; | ||
468 | break; | ||
469 | } | ||
470 | set_bit(arg, udev->dev->ledbit); | ||
471 | break; | 483 | break; |
472 | 484 | ||
473 | case UI_SET_SNDBIT: | 485 | case UI_SET_SNDBIT: |
474 | if (arg > SND_MAX) { | 486 | retval = uinput_set_bit(arg, sndbit, SND_MAX); |
475 | retval = -EINVAL; | ||
476 | break; | ||
477 | } | ||
478 | set_bit(arg, udev->dev->sndbit); | ||
479 | break; | 487 | break; |
480 | 488 | ||
481 | case UI_SET_FFBIT: | 489 | case UI_SET_FFBIT: |
482 | if (arg > FF_MAX) { | 490 | retval = uinput_set_bit(arg, ffbit, FF_MAX); |
483 | retval = -EINVAL; | 491 | break; |
484 | break; | 492 | |
485 | } | 493 | case UI_SET_SWBIT: |
486 | set_bit(arg, udev->dev->ffbit); | 494 | retval = uinput_set_bit(arg, swbit, SW_MAX); |
487 | break; | 495 | break; |
488 | 496 | ||
489 | case UI_SET_PHYS: | 497 | case UI_SET_PHYS: |
498 | if (udev->state == UIST_CREATED) { | ||
499 | retval = -EINVAL; | ||
500 | goto out; | ||
501 | } | ||
490 | length = strnlen_user(p, 1024); | 502 | length = strnlen_user(p, 1024); |
491 | if (length <= 0) { | 503 | if (length <= 0) { |
492 | retval = -EFAULT; | 504 | retval = -EFAULT; |
@@ -575,23 +587,26 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
575 | default: | 587 | default: |
576 | retval = -EINVAL; | 588 | retval = -EINVAL; |
577 | } | 589 | } |
590 | |||
591 | out: | ||
592 | up(&udev->sem); | ||
578 | return retval; | 593 | return retval; |
579 | } | 594 | } |
580 | 595 | ||
581 | static struct file_operations uinput_fops = { | 596 | static struct file_operations uinput_fops = { |
582 | .owner = THIS_MODULE, | 597 | .owner = THIS_MODULE, |
583 | .open = uinput_open, | 598 | .open = uinput_open, |
584 | .release = uinput_close, | 599 | .release = uinput_release, |
585 | .read = uinput_read, | 600 | .read = uinput_read, |
586 | .write = uinput_write, | 601 | .write = uinput_write, |
587 | .poll = uinput_poll, | 602 | .poll = uinput_poll, |
588 | .ioctl = uinput_ioctl, | 603 | .unlocked_ioctl = uinput_ioctl, |
589 | }; | 604 | }; |
590 | 605 | ||
591 | static struct miscdevice uinput_misc = { | 606 | static struct miscdevice uinput_misc = { |
592 | .fops = &uinput_fops, | 607 | .fops = &uinput_fops, |
593 | .minor = UINPUT_MINOR, | 608 | .minor = UINPUT_MINOR, |
594 | .name = UINPUT_NAME, | 609 | .name = UINPUT_NAME, |
595 | }; | 610 | }; |
596 | 611 | ||
597 | static int __init uinput_init(void) | 612 | static int __init uinput_init(void) |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c new file mode 100644 index 00000000000..49d0416a2a9 --- /dev/null +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -0,0 +1,561 @@ | |||
1 | /* | ||
2 | * Wistron laptop button driver | ||
3 | * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> | ||
4 | * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> | ||
5 | * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> | ||
6 | * | ||
7 | * You can redistribute and/or modify this program under the terms of the | ||
8 | * GNU General Public License version 2 as published by the Free Software | ||
9 | * Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
14 | * Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | #include <asm/io.h> | ||
21 | #include <linux/dmi.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/mc146818rtc.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/preempt.h> | ||
29 | #include <linux/string.h> | ||
30 | #include <linux/timer.h> | ||
31 | #include <linux/types.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | |||
34 | /* | ||
35 | * Number of attempts to read data from queue per poll; | ||
36 | * the queue can hold up to 31 entries | ||
37 | */ | ||
38 | #define MAX_POLL_ITERATIONS 64 | ||
39 | |||
40 | #define POLL_FREQUENCY 10 /* Number of polls per second */ | ||
41 | |||
42 | #if POLL_FREQUENCY > HZ | ||
43 | #error "POLL_FREQUENCY too high" | ||
44 | #endif | ||
45 | |||
46 | /* BIOS subsystem IDs */ | ||
47 | #define WIFI 0x35 | ||
48 | #define BLUETOOTH 0x34 | ||
49 | |||
50 | MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>"); | ||
51 | MODULE_DESCRIPTION("Wistron laptop button driver"); | ||
52 | MODULE_LICENSE("GPL v2"); | ||
53 | MODULE_VERSION("0.1"); | ||
54 | |||
55 | static int force; /* = 0; */ | ||
56 | module_param(force, bool, 0); | ||
57 | MODULE_PARM_DESC(force, "Load even if computer is not in database"); | ||
58 | |||
59 | static char *keymap_name; /* = NULL; */ | ||
60 | module_param_named(keymap, keymap_name, charp, 0); | ||
61 | MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected"); | ||
62 | |||
63 | static struct platform_device *wistron_device; | ||
64 | |||
65 | /* BIOS interface implementation */ | ||
66 | |||
67 | static void __iomem *bios_entry_point; /* BIOS routine entry point */ | ||
68 | static void __iomem *bios_code_map_base; | ||
69 | static void __iomem *bios_data_map_base; | ||
70 | |||
71 | static u8 cmos_address; | ||
72 | |||
73 | struct regs { | ||
74 | u32 eax, ebx, ecx; | ||
75 | }; | ||
76 | |||
77 | static void call_bios(struct regs *regs) | ||
78 | { | ||
79 | unsigned long flags; | ||
80 | |||
81 | preempt_disable(); | ||
82 | local_irq_save(flags); | ||
83 | asm volatile ("pushl %%ebp;" | ||
84 | "movl %7, %%ebp;" | ||
85 | "call *%6;" | ||
86 | "popl %%ebp" | ||
87 | : "=a" (regs->eax), "=b" (regs->ebx), "=c" (regs->ecx) | ||
88 | : "0" (regs->eax), "1" (regs->ebx), "2" (regs->ecx), | ||
89 | "m" (bios_entry_point), "m" (bios_data_map_base) | ||
90 | : "edx", "edi", "esi", "memory"); | ||
91 | local_irq_restore(flags); | ||
92 | preempt_enable(); | ||
93 | } | ||
94 | |||
95 | static size_t __init locate_wistron_bios(void __iomem *base) | ||
96 | { | ||
97 | static const unsigned char __initdata signature[] = | ||
98 | { 0x42, 0x21, 0x55, 0x30 }; | ||
99 | size_t offset; | ||
100 | |||
101 | for (offset = 0; offset < 0x10000; offset += 0x10) { | ||
102 | if (check_signature(base + offset, signature, | ||
103 | sizeof(signature)) != 0) | ||
104 | return offset; | ||
105 | } | ||
106 | return -1; | ||
107 | } | ||
108 | |||
109 | static int __init map_bios(void) | ||
110 | { | ||
111 | void __iomem *base; | ||
112 | size_t offset; | ||
113 | u32 entry_point; | ||
114 | |||
115 | base = ioremap(0xF0000, 0x10000); /* Can't fail */ | ||
116 | offset = locate_wistron_bios(base); | ||
117 | if (offset < 0) { | ||
118 | printk(KERN_ERR "wistron_btns: BIOS entry point not found\n"); | ||
119 | iounmap(base); | ||
120 | return -ENODEV; | ||
121 | } | ||
122 | |||
123 | entry_point = readl(base + offset + 5); | ||
124 | printk(KERN_DEBUG | ||
125 | "wistron_btns: BIOS signature found at %p, entry point %08X\n", | ||
126 | base + offset, entry_point); | ||
127 | |||
128 | if (entry_point >= 0xF0000) { | ||
129 | bios_code_map_base = base; | ||
130 | bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF); | ||
131 | } else { | ||
132 | iounmap(base); | ||
133 | bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000); | ||
134 | if (bios_code_map_base == NULL) { | ||
135 | printk(KERN_ERR | ||
136 | "wistron_btns: Can't map BIOS code at %08X\n", | ||
137 | entry_point & ~0x3FFF); | ||
138 | goto err; | ||
139 | } | ||
140 | bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF); | ||
141 | } | ||
142 | /* The Windows driver maps 0x10000 bytes, we keep only one page... */ | ||
143 | bios_data_map_base = ioremap(0x400, 0xc00); | ||
144 | if (bios_data_map_base == NULL) { | ||
145 | printk(KERN_ERR "wistron_btns: Can't map BIOS data\n"); | ||
146 | goto err_code; | ||
147 | } | ||
148 | return 0; | ||
149 | |||
150 | err_code: | ||
151 | iounmap(bios_code_map_base); | ||
152 | err: | ||
153 | return -ENOMEM; | ||
154 | } | ||
155 | |||
156 | static inline void unmap_bios(void) | ||
157 | { | ||
158 | iounmap(bios_code_map_base); | ||
159 | iounmap(bios_data_map_base); | ||
160 | } | ||
161 | |||
162 | /* BIOS calls */ | ||
163 | |||
164 | static u16 bios_pop_queue(void) | ||
165 | { | ||
166 | struct regs regs; | ||
167 | |||
168 | memset(®s, 0, sizeof (regs)); | ||
169 | regs.eax = 0x9610; | ||
170 | regs.ebx = 0x061C; | ||
171 | regs.ecx = 0x0000; | ||
172 | call_bios(®s); | ||
173 | |||
174 | return regs.eax; | ||
175 | } | ||
176 | |||
177 | static void __init bios_attach(void) | ||
178 | { | ||
179 | struct regs regs; | ||
180 | |||
181 | memset(®s, 0, sizeof (regs)); | ||
182 | regs.eax = 0x9610; | ||
183 | regs.ebx = 0x012E; | ||
184 | call_bios(®s); | ||
185 | } | ||
186 | |||
187 | static void bios_detach(void) | ||
188 | { | ||
189 | struct regs regs; | ||
190 | |||
191 | memset(®s, 0, sizeof (regs)); | ||
192 | regs.eax = 0x9610; | ||
193 | regs.ebx = 0x002E; | ||
194 | call_bios(®s); | ||
195 | } | ||
196 | |||
197 | static u8 __init bios_get_cmos_address(void) | ||
198 | { | ||
199 | struct regs regs; | ||
200 | |||
201 | memset(®s, 0, sizeof (regs)); | ||
202 | regs.eax = 0x9610; | ||
203 | regs.ebx = 0x051C; | ||
204 | call_bios(®s); | ||
205 | |||
206 | return regs.ecx; | ||
207 | } | ||
208 | |||
209 | static u16 __init bios_get_default_setting(u8 subsys) | ||
210 | { | ||
211 | struct regs regs; | ||
212 | |||
213 | memset(®s, 0, sizeof (regs)); | ||
214 | regs.eax = 0x9610; | ||
215 | regs.ebx = 0x0200 | subsys; | ||
216 | call_bios(®s); | ||
217 | |||
218 | return regs.eax; | ||
219 | } | ||
220 | |||
221 | static void bios_set_state(u8 subsys, int enable) | ||
222 | { | ||
223 | struct regs regs; | ||
224 | |||
225 | memset(®s, 0, sizeof (regs)); | ||
226 | regs.eax = 0x9610; | ||
227 | regs.ebx = (enable ? 0x0100 : 0x0000) | subsys; | ||
228 | call_bios(®s); | ||
229 | } | ||
230 | |||
231 | /* Hardware database */ | ||
232 | |||
233 | struct key_entry { | ||
234 | char type; /* See KE_* below */ | ||
235 | u8 code; | ||
236 | unsigned keycode; /* For KE_KEY */ | ||
237 | }; | ||
238 | |||
239 | enum { KE_END, KE_KEY, KE_WIFI, KE_BLUETOOTH }; | ||
240 | |||
241 | static const struct key_entry *keymap; /* = NULL; Current key map */ | ||
242 | static int have_wifi; | ||
243 | static int have_bluetooth; | ||
244 | |||
245 | static int __init dmi_matched(struct dmi_system_id *dmi) | ||
246 | { | ||
247 | const struct key_entry *key; | ||
248 | |||
249 | keymap = dmi->driver_data; | ||
250 | for (key = keymap; key->type != KE_END; key++) { | ||
251 | if (key->type == KE_WIFI) { | ||
252 | have_wifi = 1; | ||
253 | break; | ||
254 | } else if (key->type == KE_BLUETOOTH) { | ||
255 | have_bluetooth = 1; | ||
256 | break; | ||
257 | } | ||
258 | } | ||
259 | return 1; | ||
260 | } | ||
261 | |||
262 | static struct key_entry keymap_empty[] = { | ||
263 | { KE_END, 0 } | ||
264 | }; | ||
265 | |||
266 | static struct key_entry keymap_fs_amilo_pro_v2000[] = { | ||
267 | { KE_KEY, 0x01, KEY_HELP }, | ||
268 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
269 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
270 | { KE_WIFI, 0x30, 0 }, | ||
271 | { KE_KEY, 0x31, KEY_MAIL }, | ||
272 | { KE_KEY, 0x36, KEY_WWW }, | ||
273 | { KE_END, 0 } | ||
274 | }; | ||
275 | |||
276 | static struct key_entry keymap_wistron_ms2141[] = { | ||
277 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
278 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
279 | { KE_WIFI, 0x30, 0 }, | ||
280 | { KE_KEY, 0x22, KEY_REWIND }, | ||
281 | { KE_KEY, 0x23, KEY_FORWARD }, | ||
282 | { KE_KEY, 0x24, KEY_PLAYPAUSE }, | ||
283 | { KE_KEY, 0x25, KEY_STOPCD }, | ||
284 | { KE_KEY, 0x31, KEY_MAIL }, | ||
285 | { KE_KEY, 0x36, KEY_WWW }, | ||
286 | { KE_END, 0 } | ||
287 | }; | ||
288 | |||
289 | static struct key_entry keymap_acer_aspire_1500[] = { | ||
290 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
291 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
292 | { KE_WIFI, 0x30, 0 }, | ||
293 | { KE_KEY, 0x31, KEY_MAIL }, | ||
294 | { KE_KEY, 0x36, KEY_WWW }, | ||
295 | { KE_BLUETOOTH, 0x44, 0 }, | ||
296 | { KE_END, 0 } | ||
297 | }; | ||
298 | |||
299 | /* | ||
300 | * If your machine is not here (which is currently rather likely), please send | ||
301 | * a list of buttons and their key codes (reported when loading this module | ||
302 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. | ||
303 | */ | ||
304 | static struct dmi_system_id dmi_ids[] = { | ||
305 | { | ||
306 | .callback = dmi_matched, | ||
307 | .ident = "Fujitsu-Siemens Amilo Pro V2000", | ||
308 | .matches = { | ||
309 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
310 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"), | ||
311 | }, | ||
312 | .driver_data = keymap_fs_amilo_pro_v2000 | ||
313 | }, | ||
314 | { | ||
315 | .callback = dmi_matched, | ||
316 | .ident = "Acer Aspire 1500", | ||
317 | .matches = { | ||
318 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
319 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"), | ||
320 | }, | ||
321 | .driver_data = keymap_acer_aspire_1500 | ||
322 | }, | ||
323 | { 0, } | ||
324 | }; | ||
325 | |||
326 | static int __init select_keymap(void) | ||
327 | { | ||
328 | if (keymap_name != NULL) { | ||
329 | if (strcmp (keymap_name, "1557/MS2141") == 0) | ||
330 | keymap = keymap_wistron_ms2141; | ||
331 | else { | ||
332 | printk(KERN_ERR "wistron_btns: Keymap unknown\n"); | ||
333 | return -EINVAL; | ||
334 | } | ||
335 | } | ||
336 | dmi_check_system(dmi_ids); | ||
337 | if (keymap == NULL) { | ||
338 | if (!force) { | ||
339 | printk(KERN_ERR "wistron_btns: System unknown\n"); | ||
340 | return -ENODEV; | ||
341 | } | ||
342 | keymap = keymap_empty; | ||
343 | } | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | /* Input layer interface */ | ||
348 | |||
349 | static struct input_dev *input_dev; | ||
350 | |||
351 | static int __init setup_input_dev(void) | ||
352 | { | ||
353 | const struct key_entry *key; | ||
354 | int error; | ||
355 | |||
356 | input_dev = input_allocate_device(); | ||
357 | if (!input_dev) | ||
358 | return -ENOMEM; | ||
359 | |||
360 | input_dev->name = "Wistron laptop buttons"; | ||
361 | input_dev->phys = "wistron/input0"; | ||
362 | input_dev->id.bustype = BUS_HOST; | ||
363 | input_dev->cdev.dev = &wistron_device->dev; | ||
364 | |||
365 | for (key = keymap; key->type != KE_END; key++) { | ||
366 | if (key->type == KE_KEY) { | ||
367 | input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY); | ||
368 | set_bit(key->keycode, input_dev->keybit); | ||
369 | } | ||
370 | } | ||
371 | |||
372 | error = input_register_device(input_dev); | ||
373 | if (error) { | ||
374 | input_free_device(input_dev); | ||
375 | return error; | ||
376 | } | ||
377 | |||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static void report_key(unsigned keycode) | ||
382 | { | ||
383 | input_report_key(input_dev, keycode, 1); | ||
384 | input_sync(input_dev); | ||
385 | input_report_key(input_dev, keycode, 0); | ||
386 | input_sync(input_dev); | ||
387 | } | ||
388 | |||
389 | /* Driver core */ | ||
390 | |||
391 | static int wifi_enabled; | ||
392 | static int bluetooth_enabled; | ||
393 | |||
394 | static void poll_bios(unsigned long); | ||
395 | |||
396 | static struct timer_list poll_timer = TIMER_INITIALIZER(poll_bios, 0, 0); | ||
397 | |||
398 | static void handle_key(u8 code) | ||
399 | { | ||
400 | const struct key_entry *key; | ||
401 | |||
402 | for (key = keymap; key->type != KE_END; key++) { | ||
403 | if (code == key->code) { | ||
404 | switch (key->type) { | ||
405 | case KE_KEY: | ||
406 | report_key(key->keycode); | ||
407 | break; | ||
408 | |||
409 | case KE_WIFI: | ||
410 | if (have_wifi) { | ||
411 | wifi_enabled = !wifi_enabled; | ||
412 | bios_set_state(WIFI, wifi_enabled); | ||
413 | } | ||
414 | break; | ||
415 | |||
416 | case KE_BLUETOOTH: | ||
417 | if (have_bluetooth) { | ||
418 | bluetooth_enabled = !bluetooth_enabled; | ||
419 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
420 | } | ||
421 | break; | ||
422 | |||
423 | case KE_END: | ||
424 | default: | ||
425 | BUG(); | ||
426 | } | ||
427 | return; | ||
428 | } | ||
429 | } | ||
430 | printk(KERN_NOTICE "wistron_btns: Unknown key code %02X\n", code); | ||
431 | } | ||
432 | |||
433 | static void poll_bios(unsigned long discard) | ||
434 | { | ||
435 | u8 qlen; | ||
436 | u16 val; | ||
437 | |||
438 | for (;;) { | ||
439 | qlen = CMOS_READ(cmos_address); | ||
440 | if (qlen == 0) | ||
441 | break; | ||
442 | val = bios_pop_queue(); | ||
443 | if (val != 0 && !discard) | ||
444 | handle_key((u8)val); | ||
445 | } | ||
446 | |||
447 | mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY); | ||
448 | } | ||
449 | |||
450 | static int wistron_suspend(struct platform_device *dev, pm_message_t state) | ||
451 | { | ||
452 | del_timer_sync(&poll_timer); | ||
453 | |||
454 | if (have_wifi) | ||
455 | bios_set_state(WIFI, 0); | ||
456 | |||
457 | if (have_bluetooth) | ||
458 | bios_set_state(BLUETOOTH, 0); | ||
459 | |||
460 | return 0; | ||
461 | } | ||
462 | |||
463 | static int wistron_resume(struct platform_device *dev) | ||
464 | { | ||
465 | if (have_wifi) | ||
466 | bios_set_state(WIFI, wifi_enabled); | ||
467 | |||
468 | if (have_bluetooth) | ||
469 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
470 | |||
471 | poll_bios(1); | ||
472 | |||
473 | return 0; | ||
474 | } | ||
475 | |||
476 | static struct platform_driver wistron_driver = { | ||
477 | .suspend = wistron_suspend, | ||
478 | .resume = wistron_resume, | ||
479 | .driver = { | ||
480 | .name = "wistron-bios", | ||
481 | }, | ||
482 | }; | ||
483 | |||
484 | static int __init wb_module_init(void) | ||
485 | { | ||
486 | int err; | ||
487 | |||
488 | err = select_keymap(); | ||
489 | if (err) | ||
490 | return err; | ||
491 | |||
492 | err = map_bios(); | ||
493 | if (err) | ||
494 | return err; | ||
495 | |||
496 | bios_attach(); | ||
497 | cmos_address = bios_get_cmos_address(); | ||
498 | |||
499 | err = platform_driver_register(&wistron_driver); | ||
500 | if (err) | ||
501 | goto err_detach_bios; | ||
502 | |||
503 | wistron_device = platform_device_register_simple("wistron-bios", -1, NULL, 0); | ||
504 | if (IS_ERR(wistron_device)) { | ||
505 | err = PTR_ERR(wistron_device); | ||
506 | goto err_unregister_driver; | ||
507 | } | ||
508 | |||
509 | if (have_wifi) { | ||
510 | u16 wifi = bios_get_default_setting(WIFI); | ||
511 | if (wifi & 1) | ||
512 | wifi_enabled = (wifi & 2) ? 1 : 0; | ||
513 | else | ||
514 | have_wifi = 0; | ||
515 | |||
516 | if (have_wifi) | ||
517 | bios_set_state(WIFI, wifi_enabled); | ||
518 | } | ||
519 | |||
520 | if (have_bluetooth) { | ||
521 | u16 bt = bios_get_default_setting(BLUETOOTH); | ||
522 | if (bt & 1) | ||
523 | bluetooth_enabled = (bt & 2) ? 1 : 0; | ||
524 | else | ||
525 | have_bluetooth = 0; | ||
526 | |||
527 | if (have_bluetooth) | ||
528 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
529 | } | ||
530 | |||
531 | err = setup_input_dev(); | ||
532 | if (err) | ||
533 | goto err_unregister_device; | ||
534 | |||
535 | poll_bios(1); /* Flush stale event queue and arm timer */ | ||
536 | |||
537 | return 0; | ||
538 | |||
539 | err_unregister_device: | ||
540 | platform_device_unregister(wistron_device); | ||
541 | err_unregister_driver: | ||
542 | platform_driver_unregister(&wistron_driver); | ||
543 | err_detach_bios: | ||
544 | bios_detach(); | ||
545 | unmap_bios(); | ||
546 | |||
547 | return err; | ||
548 | } | ||
549 | |||
550 | static void __exit wb_module_exit(void) | ||
551 | { | ||
552 | del_timer_sync(&poll_timer); | ||
553 | input_unregister_device(input_dev); | ||
554 | platform_device_unregister(wistron_device); | ||
555 | platform_driver_unregister(&wistron_driver); | ||
556 | bios_detach(); | ||
557 | unmap_bios(); | ||
558 | } | ||
559 | |||
560 | module_init(wb_module_init); | ||
561 | module_exit(wb_module_exit); | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index edd15db1771..fbb69ef6a77 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -269,14 +269,20 @@ static struct serio_event *serio_get_event(void) | |||
269 | return event; | 269 | return event; |
270 | } | 270 | } |
271 | 271 | ||
272 | static void serio_handle_events(void) | 272 | static void serio_handle_event(void) |
273 | { | 273 | { |
274 | struct serio_event *event; | 274 | struct serio_event *event; |
275 | struct serio_driver *serio_drv; | 275 | struct serio_driver *serio_drv; |
276 | 276 | ||
277 | down(&serio_sem); | 277 | down(&serio_sem); |
278 | 278 | ||
279 | while ((event = serio_get_event())) { | 279 | /* |
280 | * Note that we handle only one event here to give swsusp | ||
281 | * a chance to freeze kseriod thread. Serio events should | ||
282 | * be pretty rare so we are not concerned about taking | ||
283 | * performance hit. | ||
284 | */ | ||
285 | if ((event = serio_get_event())) { | ||
280 | 286 | ||
281 | switch (event->type) { | 287 | switch (event->type) { |
282 | case SERIO_REGISTER_PORT: | 288 | case SERIO_REGISTER_PORT: |
@@ -368,7 +374,7 @@ static struct serio *serio_get_pending_child(struct serio *parent) | |||
368 | static int serio_thread(void *nothing) | 374 | static int serio_thread(void *nothing) |
369 | { | 375 | { |
370 | do { | 376 | do { |
371 | serio_handle_events(); | 377 | serio_handle_event(); |
372 | wait_event_interruptible(serio_wait, | 378 | wait_event_interruptible(serio_wait, |
373 | kthread_should_stop() || !list_empty(&serio_event_list)); | 379 | kthread_should_stop() || !list_empty(&serio_event_list)); |
374 | try_to_freeze(); | 380 | try_to_freeze(); |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index 801c98f30e5..c82105920d7 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
@@ -110,7 +110,7 @@ config HISAX_16_3 | |||
110 | 110 | ||
111 | config HISAX_TELESPCI | 111 | config HISAX_TELESPCI |
112 | bool "Teles PCI" | 112 | bool "Teles PCI" |
113 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 113 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
114 | help | 114 | help |
115 | This enables HiSax support for the Teles PCI. | 115 | This enables HiSax support for the Teles PCI. |
116 | See <file:Documentation/isdn/README.HiSax> on how to configure it. | 116 | See <file:Documentation/isdn/README.HiSax> on how to configure it. |
@@ -238,7 +238,7 @@ config HISAX_MIC | |||
238 | 238 | ||
239 | config HISAX_NETJET | 239 | config HISAX_NETJET |
240 | bool "NETjet card" | 240 | bool "NETjet card" |
241 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 241 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
242 | help | 242 | help |
243 | This enables HiSax support for the NetJet from Traverse | 243 | This enables HiSax support for the NetJet from Traverse |
244 | Technologies. | 244 | Technologies. |
@@ -249,7 +249,7 @@ config HISAX_NETJET | |||
249 | 249 | ||
250 | config HISAX_NETJET_U | 250 | config HISAX_NETJET_U |
251 | bool "NETspider U card" | 251 | bool "NETspider U card" |
252 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 252 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
253 | help | 253 | help |
254 | This enables HiSax support for the Netspider U interface ISDN card | 254 | This enables HiSax support for the Netspider U interface ISDN card |
255 | from Traverse Technologies. | 255 | from Traverse Technologies. |
@@ -317,7 +317,7 @@ config HISAX_GAZEL | |||
317 | 317 | ||
318 | config HISAX_HFC_PCI | 318 | config HISAX_HFC_PCI |
319 | bool "HFC PCI-Bus cards" | 319 | bool "HFC PCI-Bus cards" |
320 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 320 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
321 | help | 321 | help |
322 | This enables HiSax support for the HFC-S PCI 2BDS0 based cards. | 322 | This enables HiSax support for the HFC-S PCI 2BDS0 based cards. |
323 | 323 | ||
@@ -344,14 +344,14 @@ config HISAX_HFC_SX | |||
344 | 344 | ||
345 | config HISAX_ENTERNOW_PCI | 345 | config HISAX_ENTERNOW_PCI |
346 | bool "Formula-n enter:now PCI card" | 346 | bool "Formula-n enter:now PCI card" |
347 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 347 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
348 | help | 348 | help |
349 | This enables HiSax support for the Formula-n enter:now PCI | 349 | This enables HiSax support for the Formula-n enter:now PCI |
350 | ISDN card. | 350 | ISDN card. |
351 | 351 | ||
352 | config HISAX_AMD7930 | 352 | config HISAX_AMD7930 |
353 | bool "Am7930 (EXPERIMENTAL)" | 353 | bool "Am7930 (EXPERIMENTAL)" |
354 | depends on EXPERIMENTAL && (SPARC32 || SPARC64) | 354 | depends on EXPERIMENTAL && SPARC |
355 | help | 355 | help |
356 | This enables HiSax support for the AMD7930 chips on some SPARCs. | 356 | This enables HiSax support for the AMD7930 chips on some SPARCs. |
357 | This code is not finished yet. | 357 | This code is not finished yet. |
diff --git a/drivers/isdn/pcbit/Kconfig b/drivers/isdn/pcbit/Kconfig index f06997faef1..0933881ab0c 100644 --- a/drivers/isdn/pcbit/Kconfig +++ b/drivers/isdn/pcbit/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | config ISDN_DRV_PCBIT | 4 | config ISDN_DRV_PCBIT |
5 | tristate "PCBIT-D support" | 5 | tristate "PCBIT-D support" |
6 | depends on ISDN_I4L && ISA && (BROKEN || !PPC) | 6 | depends on ISDN_I4L && ISA && (BROKEN || X86) |
7 | help | 7 | help |
8 | This enables support for the PCBIT ISDN-card. This card is | 8 | This enables support for the PCBIT ISDN-card. This card is |
9 | manufactured in Portugal by Octal. For running this card, | 9 | manufactured in Portugal by Octal. For running this card, |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index fb394a0d838..336fc284fa5 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -772,7 +772,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) | |||
772 | input_dev->name = DRIVER_NAME " remote control"; | 772 | input_dev->name = DRIVER_NAME " remote control"; |
773 | input_dev->phys = cinergyt2->phys; | 773 | input_dev->phys = cinergyt2->phys; |
774 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 774 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
775 | for (i = 0; ARRAY_SIZE(rc_keys); i += 3) | 775 | for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3) |
776 | set_bit(rc_keys[i + 2], input_dev->keybit); | 776 | set_bit(rc_keys[i + 2], input_dev->keybit); |
777 | input_dev->keycodesize = 0; | 777 | input_dev->keycodesize = 0; |
778 | input_dev->keycodemax = 0; | 778 | input_dev->keycodemax = 0; |
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index 5abfc0fbf6d..6345e29e495 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c | |||
@@ -673,7 +673,6 @@ static int ir_probe(struct device *dev) | |||
673 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 673 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
674 | pci_name(sub->core->pci)); | 674 | pci_name(sub->core->pci)); |
675 | 675 | ||
676 | ir->sub = sub; | ||
677 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); | 676 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
678 | input_dev->name = ir->name; | 677 | input_dev->name = ir->name; |
679 | input_dev->phys = ir->phys; | 678 | input_dev->phys = ir->phys; |
@@ -688,6 +687,9 @@ static int ir_probe(struct device *dev) | |||
688 | } | 687 | } |
689 | input_dev->cdev.dev = &sub->core->pci->dev; | 688 | input_dev->cdev.dev = &sub->core->pci->dev; |
690 | 689 | ||
690 | ir->input = input_dev; | ||
691 | ir->sub = sub; | ||
692 | |||
691 | if (ir->polling) { | 693 | if (ir->polling) { |
692 | INIT_WORK(&ir->work, ir_work, ir); | 694 | INIT_WORK(&ir->work, ir_work, ir); |
693 | init_timer(&ir->timer); | 695 | init_timer(&ir->timer); |
@@ -708,7 +710,6 @@ static int ir_probe(struct device *dev) | |||
708 | /* all done */ | 710 | /* all done */ |
709 | dev_set_drvdata(dev, ir); | 711 | dev_set_drvdata(dev, ir); |
710 | input_register_device(ir->input); | 712 | input_register_device(ir->input); |
711 | printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys); | ||
712 | 713 | ||
713 | /* the remote isn't as bouncy as a keyboard */ | 714 | /* the remote isn't as bouncy as a keyboard */ |
714 | ir->input->rep[REP_DELAY] = repeat_delay; | 715 | ir->input->rep[REP_DELAY] = repeat_delay; |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index e648cc3bc96..ab75ca5ac35 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -713,6 +713,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
713 | return -ENOMEM; | 713 | return -ENOMEM; |
714 | } | 714 | } |
715 | 715 | ||
716 | ir->dev = input_dev; | ||
717 | |||
716 | /* init hardware-specific stuff */ | 718 | /* init hardware-specific stuff */ |
717 | ir->mask_keycode = mask_keycode; | 719 | ir->mask_keycode = mask_keycode; |
718 | ir->mask_keydown = mask_keydown; | 720 | ir->mask_keydown = mask_keydown; |
diff --git a/drivers/mtd/maps/ipaq-flash.c b/drivers/mtd/maps/ipaq-flash.c index 35097c9bbf5..b8ccb0a9578 100644 --- a/drivers/mtd/maps/ipaq-flash.c +++ b/drivers/mtd/maps/ipaq-flash.c | |||
@@ -246,7 +246,7 @@ int __init ipaq_mtd_init(void) | |||
246 | ipaq_map[i].size = h3xxx_max_flash_size; | 246 | ipaq_map[i].size = h3xxx_max_flash_size; |
247 | ipaq_map[i].set_vpp = h3xxx_set_vpp; | 247 | ipaq_map[i].set_vpp = h3xxx_set_vpp; |
248 | ipaq_map[i].phys = cs_phys[i]; | 248 | ipaq_map[i].phys = cs_phys[i]; |
249 | ipaq_map[i].virt = __ioremap(cs_phys[i], 0x04000000, 0, 1); | 249 | ipaq_map[i].virt = ioremap(cs_phys[i], 0x04000000); |
250 | if (machine_is_h3100 () || machine_is_h1900()) | 250 | if (machine_is_h3100 () || machine_is_h1900()) |
251 | ipaq_map[i].bankwidth = 2; | 251 | ipaq_map[i].bankwidth = 2; |
252 | } | 252 | } |
@@ -280,7 +280,7 @@ int __init ipaq_mtd_init(void) | |||
280 | nb_parts = ARRAY_SIZE(jornada_partitions); | 280 | nb_parts = ARRAY_SIZE(jornada_partitions); |
281 | ipaq_map[0].size = jornada_max_flash_size; | 281 | ipaq_map[0].size = jornada_max_flash_size; |
282 | ipaq_map[0].set_vpp = jornada56x_set_vpp; | 282 | ipaq_map[0].set_vpp = jornada56x_set_vpp; |
283 | ipaq_map[0].virt = (__u32)__ioremap(0x0, 0x04000000, 0, 1); | 283 | ipaq_map[0].virt = (__u32)ioremap(0x0, 0x04000000); |
284 | } | 284 | } |
285 | #endif | 285 | #endif |
286 | #ifdef CONFIG_SA1100_JORNADA720 | 286 | #ifdef CONFIG_SA1100_JORNADA720 |
@@ -442,7 +442,7 @@ static int __init h1900_special_case(void) | |||
442 | ipaq_map[0].size = 0x80000; | 442 | ipaq_map[0].size = 0x80000; |
443 | ipaq_map[0].set_vpp = h3xxx_set_vpp; | 443 | ipaq_map[0].set_vpp = h3xxx_set_vpp; |
444 | ipaq_map[0].phys = 0x0; | 444 | ipaq_map[0].phys = 0x0; |
445 | ipaq_map[0].virt = __ioremap(0x0, 0x04000000, 0, 1); | 445 | ipaq_map[0].virt = ioremap(0x0, 0x04000000); |
446 | ipaq_map[0].bankwidth = 2; | 446 | ipaq_map[0].bankwidth = 2; |
447 | 447 | ||
448 | printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt); | 448 | printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt); |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index fc7a78e3173..2c9cc7f37e9 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -159,12 +159,12 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
159 | return -ENODEV; | 159 | return -ENODEV; |
160 | 160 | ||
161 | window_size = dev->resource->end - dev->resource->start + 1; | 161 | window_size = dev->resource->end - dev->resource->start + 1; |
162 | dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", | 162 | dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", |
163 | ixp_data->nr_banks, ((u32)window_size >> 20)); | 163 | ixp_data->nr_banks, ((u32)window_size >> 20)); |
164 | 164 | ||
165 | if (plat->width != 1) { | 165 | if (plat->width != 1) { |
166 | dev_err(_dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", | 166 | dev_err(&dev->dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", |
167 | plat->width * 8); | 167 | plat->width * 8); |
168 | return -EIO; | 168 | return -EIO; |
169 | } | 169 | } |
170 | 170 | ||
@@ -202,7 +202,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
202 | dev->resource->end - dev->resource->start + 1, | 202 | dev->resource->end - dev->resource->start + 1, |
203 | dev->dev.bus_id); | 203 | dev->dev.bus_id); |
204 | if (!info->res) { | 204 | if (!info->res) { |
205 | dev_err(_dev, "Could not reserve memory region\n"); | 205 | dev_err(&dev->dev, "Could not reserve memory region\n"); |
206 | err = -ENOMEM; | 206 | err = -ENOMEM; |
207 | goto Error; | 207 | goto Error; |
208 | } | 208 | } |
@@ -210,7 +210,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
210 | info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, | 210 | info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, |
211 | dev->resource->end - dev->resource->start + 1); | 211 | dev->resource->end - dev->resource->start + 1); |
212 | if (!info->map.map_priv_1) { | 212 | if (!info->map.map_priv_1) { |
213 | dev_err(_dev, "Failed to ioremap flash region\n"); | 213 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); |
214 | err = -EIO; | 214 | err = -EIO; |
215 | goto Error; | 215 | goto Error; |
216 | } | 216 | } |
@@ -221,13 +221,13 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
221 | */ | 221 | */ |
222 | 222 | ||
223 | erratum44_workaround = ixp2000_has_broken_slowport(); | 223 | erratum44_workaround = ixp2000_has_broken_slowport(); |
224 | dev_info(_dev, "Erratum 44 workaround %s\n", | 224 | dev_info(&dev->dev, "Erratum 44 workaround %s\n", |
225 | erratum44_workaround ? "enabled" : "disabled"); | 225 | erratum44_workaround ? "enabled" : "disabled"); |
226 | #endif | 226 | #endif |
227 | 227 | ||
228 | info->mtd = do_map_probe(plat->map_name, &info->map); | 228 | info->mtd = do_map_probe(plat->map_name, &info->map); |
229 | if (!info->mtd) { | 229 | if (!info->mtd) { |
230 | dev_err(_dev, "map_probe failed\n"); | 230 | dev_err(&dev->dev, "map_probe failed\n"); |
231 | err = -ENXIO; | 231 | err = -ENXIO; |
232 | goto Error; | 232 | goto Error; |
233 | } | 233 | } |
@@ -237,7 +237,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
237 | if (err > 0) { | 237 | if (err > 0) { |
238 | err = add_mtd_partitions(info->mtd, info->partitions, err); | 238 | err = add_mtd_partitions(info->mtd, info->partitions, err); |
239 | if(err) | 239 | if(err) |
240 | dev_err(_dev, "Could not parse partitions\n"); | 240 | dev_err(&dev->dev, "Could not parse partitions\n"); |
241 | } | 241 | } |
242 | 242 | ||
243 | if (err) | 243 | if (err) |
@@ -251,8 +251,8 @@ Error: | |||
251 | } | 251 | } |
252 | 252 | ||
253 | static struct platform_driver ixp2000_flash_driver = { | 253 | static struct platform_driver ixp2000_flash_driver = { |
254 | .probe = &ixp2000_flash_probe, | 254 | .probe = ixp2000_flash_probe, |
255 | .remove = &ixp2000_flash_remove | 255 | .remove = ixp2000_flash_remove, |
256 | .driver = { | 256 | .driver = { |
257 | .name = "IXP2000-Flash", | 257 | .name = "IXP2000-Flash", |
258 | }, | 258 | }, |
diff --git a/drivers/mtd/nand/h1910.c b/drivers/mtd/nand/h1910.c index 041e4b3358f..f68f7a99a63 100644 --- a/drivers/mtd/nand/h1910.c +++ b/drivers/mtd/nand/h1910.c | |||
@@ -112,7 +112,7 @@ static int __init h1910_init (void) | |||
112 | if (!machine_is_h1900()) | 112 | if (!machine_is_h1900()) |
113 | return -ENODEV; | 113 | return -ENODEV; |
114 | 114 | ||
115 | nandaddr = __ioremap(0x08000000, 0x1000, 0, 1); | 115 | nandaddr = ioremap(0x08000000, 0x1000); |
116 | if (!nandaddr) { | 116 | if (!nandaddr) { |
117 | printk("Failed to ioremap nand flash.\n"); | 117 | printk("Failed to ioremap nand flash.\n"); |
118 | return -ENOMEM; | 118 | return -ENOMEM; |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index a39fbfef789..19657efa8dc 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -700,6 +700,28 @@ static unsigned int iosapic_startup_irq(unsigned int irq) | |||
700 | return 0; | 700 | return 0; |
701 | } | 701 | } |
702 | 702 | ||
703 | #ifdef CONFIG_SMP | ||
704 | static void iosapic_set_affinity_irq(unsigned int irq, cpumask_t dest) | ||
705 | { | ||
706 | struct vector_info *vi = iosapic_get_vector(irq); | ||
707 | u32 d0, d1, dummy_d0; | ||
708 | unsigned long flags; | ||
709 | |||
710 | if (cpu_check_affinity(irq, &dest)) | ||
711 | return; | ||
712 | |||
713 | vi->txn_addr = txn_affinity_addr(irq, first_cpu(dest)); | ||
714 | |||
715 | spin_lock_irqsave(&iosapic_lock, flags); | ||
716 | /* d1 contains the destination CPU, so only want to set that | ||
717 | * entry */ | ||
718 | iosapic_rd_irt_entry(vi, &d0, &d1); | ||
719 | iosapic_set_irt_data(vi, &dummy_d0, &d1); | ||
720 | iosapic_wr_irt_entry(vi, d0, d1); | ||
721 | spin_unlock_irqrestore(&iosapic_lock, flags); | ||
722 | } | ||
723 | #endif | ||
724 | |||
703 | static struct hw_interrupt_type iosapic_interrupt_type = { | 725 | static struct hw_interrupt_type iosapic_interrupt_type = { |
704 | .typename = "IO-SAPIC-level", | 726 | .typename = "IO-SAPIC-level", |
705 | .startup = iosapic_startup_irq, | 727 | .startup = iosapic_startup_irq, |
@@ -708,7 +730,9 @@ static struct hw_interrupt_type iosapic_interrupt_type = { | |||
708 | .disable = iosapic_disable_irq, | 730 | .disable = iosapic_disable_irq, |
709 | .ack = no_ack_irq, | 731 | .ack = no_ack_irq, |
710 | .end = iosapic_end_irq, | 732 | .end = iosapic_end_irq, |
711 | // .set_affinity = iosapic_set_affinity_irq, | 733 | #ifdef CONFIG_SMP |
734 | .set_affinity = iosapic_set_affinity_irq, | ||
735 | #endif | ||
712 | }; | 736 | }; |
713 | 737 | ||
714 | int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) | 738 | int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) |
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index bab3bcabcb6..d14888e149b 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c | |||
@@ -24,6 +24,9 @@ | |||
24 | * Major changes to get basic interrupt infrastructure working to | 24 | * Major changes to get basic interrupt infrastructure working to |
25 | * hopefully be able to support all SuperIO devices. Currently | 25 | * hopefully be able to support all SuperIO devices. Currently |
26 | * works with serial. -- John Marvin <jsm@fc.hp.com> | 26 | * works with serial. -- John Marvin <jsm@fc.hp.com> |
27 | * | ||
28 | * Converted superio_init() to be a PCI_FIXUP_FINAL callee. | ||
29 | * -- Kyle McMartin <kyle@parisc-linux.org> | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | 32 | ||
@@ -141,10 +144,10 @@ superio_interrupt(int parent_irq, void *devp, struct pt_regs *regs) | |||
141 | } | 144 | } |
142 | 145 | ||
143 | /* Initialize Super I/O device */ | 146 | /* Initialize Super I/O device */ |
144 | 147 | static void | |
145 | static void __devinit | 148 | superio_init(struct pci_dev *pcidev) |
146 | superio_init(struct superio_device *sio) | ||
147 | { | 149 | { |
150 | struct superio_device *sio = &sio_dev; | ||
148 | struct pci_dev *pdev = sio->lio_pdev; | 151 | struct pci_dev *pdev = sio->lio_pdev; |
149 | u16 word; | 152 | u16 word; |
150 | 153 | ||
@@ -160,8 +163,8 @@ superio_init(struct superio_device *sio) | |||
160 | /* ...then properly fixup the USB to point at suckyio PIC */ | 163 | /* ...then properly fixup the USB to point at suckyio PIC */ |
161 | sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev); | 164 | sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev); |
162 | 165 | ||
163 | printk (KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n", | 166 | printk(KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n", |
164 | pci_name(pdev),pdev->irq); | 167 | pci_name(pdev), pdev->irq); |
165 | 168 | ||
166 | pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base); | 169 | pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base); |
167 | sio->sp1_base &= ~1; | 170 | sio->sp1_base &= ~1; |
@@ -274,7 +277,7 @@ superio_init(struct superio_device *sio) | |||
274 | 277 | ||
275 | sio->suckyio_irq_enabled = 1; | 278 | sio->suckyio_irq_enabled = 1; |
276 | } | 279 | } |
277 | 280 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO, superio_init); | |
278 | 281 | ||
279 | static void superio_disable_irq(unsigned int irq) | 282 | static void superio_disable_irq(unsigned int irq) |
280 | { | 283 | { |
@@ -452,8 +455,10 @@ static void superio_fixup_pci(struct pci_dev *pdev) | |||
452 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci); | 455 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci); |
453 | 456 | ||
454 | 457 | ||
455 | static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_id *id) | 458 | static int __devinit |
459 | superio_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
456 | { | 460 | { |
461 | struct superio_device *sio = &sio_dev; | ||
457 | 462 | ||
458 | /* | 463 | /* |
459 | ** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a | 464 | ** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a |
@@ -466,7 +471,8 @@ static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_ | |||
466 | dev->subsystem_vendor, dev->subsystem_device, | 471 | dev->subsystem_vendor, dev->subsystem_device, |
467 | dev->class); | 472 | dev->class); |
468 | 473 | ||
469 | superio_init(&sio_dev); | 474 | if (!sio->suckyio_irq_enabled) |
475 | BUG(); /* Enabled by PCI_FIXUP_FINAL */ | ||
470 | 476 | ||
471 | if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */ | 477 | if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */ |
472 | superio_parport_init(); | 478 | superio_parport_init(); |
@@ -481,19 +487,21 @@ static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_ | |||
481 | DBG_INIT("superio_probe: WTF? Fire Extinguisher?\n"); | 487 | DBG_INIT("superio_probe: WTF? Fire Extinguisher?\n"); |
482 | } | 488 | } |
483 | 489 | ||
484 | /* Let appropriate other driver claim this device. */ | 490 | /* Let appropriate other driver claim this device. */ |
485 | return -ENODEV; | 491 | return -ENODEV; |
486 | } | 492 | } |
487 | 493 | ||
488 | static struct pci_device_id superio_tbl[] = { | 494 | static struct pci_device_id superio_tbl[] = { |
489 | { PCI_VENDOR_ID_NS, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 495 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) }, |
496 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) }, | ||
497 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) }, | ||
490 | { 0, } | 498 | { 0, } |
491 | }; | 499 | }; |
492 | 500 | ||
493 | static struct pci_driver superio_driver = { | 501 | static struct pci_driver superio_driver = { |
494 | .name = "SuperIO", | 502 | .name = "SuperIO", |
495 | .id_table = superio_tbl, | 503 | .id_table = superio_tbl, |
496 | .probe = superio_probe, | 504 | .probe = superio_probe, |
497 | }; | 505 | }; |
498 | 506 | ||
499 | static int __init superio_modinit(void) | 507 | static int __init superio_modinit(void) |
@@ -506,6 +514,5 @@ static void __exit superio_exit(void) | |||
506 | pci_unregister_driver(&superio_driver); | 514 | pci_unregister_driver(&superio_driver); |
507 | } | 515 | } |
508 | 516 | ||
509 | |||
510 | module_init(superio_modinit); | 517 | module_init(superio_modinit); |
511 | module_exit(superio_exit); | 518 | module_exit(superio_exit); |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index e1960d69fb9..4cb1f3ed910 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -784,8 +784,8 @@ static ide_proc_entry_t idescsi_proc[] = { | |||
784 | #endif | 784 | #endif |
785 | 785 | ||
786 | static ide_driver_t idescsi_driver = { | 786 | static ide_driver_t idescsi_driver = { |
787 | .owner = THIS_MODULE, | ||
788 | .gen_driver = { | 787 | .gen_driver = { |
788 | .owner = THIS_MODULE, | ||
789 | .name = "ide-scsi", | 789 | .name = "ide-scsi", |
790 | .bus = &ide_bus_type, | 790 | .bus = &ide_bus_type, |
791 | .probe = ide_scsi_probe, | 791 | .probe = ide_scsi_probe, |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ff36f0c9fda..ad47c1b84c3 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -507,7 +507,7 @@ config SERIAL_SUNSU_CONSOLE | |||
507 | 507 | ||
508 | config SERIAL_MUX | 508 | config SERIAL_MUX |
509 | tristate "Serial MUX support" | 509 | tristate "Serial MUX support" |
510 | depends on PARISC | 510 | depends on GSC |
511 | select SERIAL_CORE | 511 | select SERIAL_CORE |
512 | default y | 512 | default y |
513 | ---help--- | 513 | ---help--- |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 938d185841c..89d7bd3eaee 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/serial.h> | 49 | #include <linux/serial.h> |
50 | 50 | ||
51 | #include <asm/io.h> | 51 | #include <asm/io.h> |
52 | #include <asm/irq.h> | ||
53 | #include <asm/sizes.h> | 52 | #include <asm/sizes.h> |
54 | #include <asm/hardware/amba.h> | 53 | #include <asm/hardware/amba.h> |
55 | #include <asm/hardware/clock.h> | 54 | #include <asm/hardware/clock.h> |
@@ -63,7 +62,8 @@ | |||
63 | 62 | ||
64 | #define AMBA_ISR_PASS_LIMIT 256 | 63 | #define AMBA_ISR_PASS_LIMIT 256 |
65 | 64 | ||
66 | #define UART_DUMMY_RSR_RX 256 | 65 | #define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE) |
66 | #define UART_DUMMY_DR_RX (1 << 16) | ||
67 | 67 | ||
68 | /* | 68 | /* |
69 | * We wrap our port structure around the generic uart_port. | 69 | * We wrap our port structure around the generic uart_port. |
@@ -116,7 +116,7 @@ pl011_rx_chars(struct uart_amba_port *uap) | |||
116 | #endif | 116 | #endif |
117 | { | 117 | { |
118 | struct tty_struct *tty = uap->port.info->tty; | 118 | struct tty_struct *tty = uap->port.info->tty; |
119 | unsigned int status, ch, flag, rsr, max_count = 256; | 119 | unsigned int status, ch, flag, max_count = 256; |
120 | 120 | ||
121 | status = readw(uap->port.membase + UART01x_FR); | 121 | status = readw(uap->port.membase + UART01x_FR); |
122 | while ((status & UART01x_FR_RXFE) == 0 && max_count--) { | 122 | while ((status & UART01x_FR_RXFE) == 0 && max_count--) { |
@@ -129,7 +129,7 @@ pl011_rx_chars(struct uart_amba_port *uap) | |||
129 | */ | 129 | */ |
130 | } | 130 | } |
131 | 131 | ||
132 | ch = readw(uap->port.membase + UART01x_DR); | 132 | ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX; |
133 | flag = TTY_NORMAL; | 133 | flag = TTY_NORMAL; |
134 | uap->port.icount.rx++; | 134 | uap->port.icount.rx++; |
135 | 135 | ||
@@ -137,34 +137,33 @@ pl011_rx_chars(struct uart_amba_port *uap) | |||
137 | * Note that the error handling code is | 137 | * Note that the error handling code is |
138 | * out of the main execution path | 138 | * out of the main execution path |
139 | */ | 139 | */ |
140 | rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; | 140 | if (unlikely(ch & UART_DR_ERROR)) { |
141 | if (unlikely(rsr & UART01x_RSR_ANY)) { | 141 | if (ch & UART011_DR_BE) { |
142 | if (rsr & UART01x_RSR_BE) { | 142 | ch &= ~(UART011_DR_FE | UART011_DR_PE); |
143 | rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); | ||
144 | uap->port.icount.brk++; | 143 | uap->port.icount.brk++; |
145 | if (uart_handle_break(&uap->port)) | 144 | if (uart_handle_break(&uap->port)) |
146 | goto ignore_char; | 145 | goto ignore_char; |
147 | } else if (rsr & UART01x_RSR_PE) | 146 | } else if (ch & UART011_DR_PE) |
148 | uap->port.icount.parity++; | 147 | uap->port.icount.parity++; |
149 | else if (rsr & UART01x_RSR_FE) | 148 | else if (ch & UART011_DR_FE) |
150 | uap->port.icount.frame++; | 149 | uap->port.icount.frame++; |
151 | if (rsr & UART01x_RSR_OE) | 150 | if (ch & UART011_DR_OE) |
152 | uap->port.icount.overrun++; | 151 | uap->port.icount.overrun++; |
153 | 152 | ||
154 | rsr &= uap->port.read_status_mask; | 153 | ch &= uap->port.read_status_mask; |
155 | 154 | ||
156 | if (rsr & UART01x_RSR_BE) | 155 | if (ch & UART011_DR_BE) |
157 | flag = TTY_BREAK; | 156 | flag = TTY_BREAK; |
158 | else if (rsr & UART01x_RSR_PE) | 157 | else if (ch & UART011_DR_PE) |
159 | flag = TTY_PARITY; | 158 | flag = TTY_PARITY; |
160 | else if (rsr & UART01x_RSR_FE) | 159 | else if (ch & UART011_DR_FE) |
161 | flag = TTY_FRAME; | 160 | flag = TTY_FRAME; |
162 | } | 161 | } |
163 | 162 | ||
164 | if (uart_handle_sysrq_char(&uap->port, ch, regs)) | 163 | if (uart_handle_sysrq_char(&uap->port, ch, regs)) |
165 | goto ignore_char; | 164 | goto ignore_char; |
166 | 165 | ||
167 | uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); | 166 | uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag); |
168 | 167 | ||
169 | ignore_char: | 168 | ignore_char: |
170 | status = readw(uap->port.membase + UART01x_FR); | 169 | status = readw(uap->port.membase + UART01x_FR); |
@@ -476,33 +475,33 @@ pl011_set_termios(struct uart_port *port, struct termios *termios, | |||
476 | */ | 475 | */ |
477 | uart_update_timeout(port, termios->c_cflag, baud); | 476 | uart_update_timeout(port, termios->c_cflag, baud); |
478 | 477 | ||
479 | port->read_status_mask = UART01x_RSR_OE; | 478 | port->read_status_mask = UART011_DR_OE | 255; |
480 | if (termios->c_iflag & INPCK) | 479 | if (termios->c_iflag & INPCK) |
481 | port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; | 480 | port->read_status_mask |= UART011_DR_FE | UART011_DR_PE; |
482 | if (termios->c_iflag & (BRKINT | PARMRK)) | 481 | if (termios->c_iflag & (BRKINT | PARMRK)) |
483 | port->read_status_mask |= UART01x_RSR_BE; | 482 | port->read_status_mask |= UART011_DR_BE; |
484 | 483 | ||
485 | /* | 484 | /* |
486 | * Characters to ignore | 485 | * Characters to ignore |
487 | */ | 486 | */ |
488 | port->ignore_status_mask = 0; | 487 | port->ignore_status_mask = 0; |
489 | if (termios->c_iflag & IGNPAR) | 488 | if (termios->c_iflag & IGNPAR) |
490 | port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; | 489 | port->ignore_status_mask |= UART011_DR_FE | UART011_DR_PE; |
491 | if (termios->c_iflag & IGNBRK) { | 490 | if (termios->c_iflag & IGNBRK) { |
492 | port->ignore_status_mask |= UART01x_RSR_BE; | 491 | port->ignore_status_mask |= UART011_DR_BE; |
493 | /* | 492 | /* |
494 | * If we're ignoring parity and break indicators, | 493 | * If we're ignoring parity and break indicators, |
495 | * ignore overruns too (for real raw support). | 494 | * ignore overruns too (for real raw support). |
496 | */ | 495 | */ |
497 | if (termios->c_iflag & IGNPAR) | 496 | if (termios->c_iflag & IGNPAR) |
498 | port->ignore_status_mask |= UART01x_RSR_OE; | 497 | port->ignore_status_mask |= UART011_DR_OE; |
499 | } | 498 | } |
500 | 499 | ||
501 | /* | 500 | /* |
502 | * Ignore all characters if CREAD is not set. | 501 | * Ignore all characters if CREAD is not set. |
503 | */ | 502 | */ |
504 | if ((termios->c_cflag & CREAD) == 0) | 503 | if ((termios->c_cflag & CREAD) == 0) |
505 | port->ignore_status_mask |= UART_DUMMY_RSR_RX; | 504 | port->ignore_status_mask |= UART_DUMMY_DR_RX; |
506 | 505 | ||
507 | if (UART_ENABLE_MS(port, termios->c_cflag)) | 506 | if (UART_ENABLE_MS(port, termios->c_cflag)) |
508 | pl011_enable_ms(port); | 507 | pl011_enable_ms(port); |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 355cd93a8a8..83c4c121658 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -994,7 +994,7 @@ static int __init imx_serial_init(void) | |||
994 | static void __exit imx_serial_exit(void) | 994 | static void __exit imx_serial_exit(void) |
995 | { | 995 | { |
996 | uart_unregister_driver(&imx_reg); | 996 | uart_unregister_driver(&imx_reg); |
997 | driver_unregister(&serial_imx_driver); | 997 | platform_driver_unregister(&serial_imx_driver); |
998 | } | 998 | } |
999 | 999 | ||
1000 | module_init(imx_serial_init); | 1000 | module_init(imx_serial_init); |
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 660bae5ba17..7633132a10a 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c | |||
@@ -65,8 +65,8 @@ static struct uart_driver mux_driver = { | |||
65 | 65 | ||
66 | static struct timer_list mux_timer; | 66 | static struct timer_list mux_timer; |
67 | 67 | ||
68 | #define UART_PUT_CHAR(p, c) __raw_writel((c), (unsigned long)(p)->membase + IO_DATA_REG_OFFSET) | 68 | #define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) |
69 | #define UART_GET_FIFO_CNT(p) __raw_readl((unsigned long)(p)->membase + IO_DCOUNT_REG_OFFSET) | 69 | #define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET) |
70 | #define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 | 70 | #define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 |
71 | 71 | ||
72 | /** | 72 | /** |
@@ -79,10 +79,7 @@ static struct timer_list mux_timer; | |||
79 | */ | 79 | */ |
80 | static unsigned int mux_tx_empty(struct uart_port *port) | 80 | static unsigned int mux_tx_empty(struct uart_port *port) |
81 | { | 81 | { |
82 | unsigned int cnt = __raw_readl((unsigned long)port->membase | 82 | return UART_GET_FIFO_CNT(port) ? 0 : TIOCSER_TEMT; |
83 | + IO_DCOUNT_REG_OFFSET); | ||
84 | |||
85 | return cnt ? 0 : TIOCSER_TEMT; | ||
86 | } | 83 | } |
87 | 84 | ||
88 | /** | 85 | /** |
@@ -218,8 +215,7 @@ static void mux_read(struct uart_port *port) | |||
218 | __u32 start_count = port->icount.rx; | 215 | __u32 start_count = port->icount.rx; |
219 | 216 | ||
220 | while(1) { | 217 | while(1) { |
221 | data = __raw_readl((unsigned long)port->membase | 218 | data = __raw_readl(port->membase + IO_DATA_REG_OFFSET); |
222 | + IO_DATA_REG_OFFSET); | ||
223 | 219 | ||
224 | if (MUX_STATUS(data)) | 220 | if (MUX_STATUS(data)) |
225 | continue; | 221 | continue; |
@@ -481,6 +477,13 @@ static int __init mux_probe(struct parisc_device *dev) | |||
481 | port->ops = &mux_pops; | 477 | port->ops = &mux_pops; |
482 | port->flags = UPF_BOOT_AUTOCONF; | 478 | port->flags = UPF_BOOT_AUTOCONF; |
483 | port->line = port_cnt; | 479 | port->line = port_cnt; |
480 | |||
481 | /* The port->timeout needs to match what is present in | ||
482 | * uart_wait_until_sent in serial_core.c. Otherwise | ||
483 | * the time spent in msleep_interruptable will be very | ||
484 | * long, causing the appearance of a console hang. | ||
485 | */ | ||
486 | port->timeout = HZ / 50; | ||
484 | spin_lock_init(&port->lock); | 487 | spin_lock_init(&port->lock); |
485 | status = uart_add_one_port(&mux_driver, port); | 488 | status = uart_add_one_port(&mux_driver, port); |
486 | BUG_ON(status); | 489 | BUG_ON(status); |
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 0e3daf6d7b5..25a086458ab 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -161,7 +161,6 @@ static void sa1100_stop_tx(struct uart_port *port) | |||
161 | static void sa1100_start_tx(struct uart_port *port) | 161 | static void sa1100_start_tx(struct uart_port *port) |
162 | { | 162 | { |
163 | struct sa1100_port *sport = (struct sa1100_port *)port; | 163 | struct sa1100_port *sport = (struct sa1100_port *)port; |
164 | unsigned long flags; | ||
165 | u32 utcr3; | 164 | u32 utcr3; |
166 | 165 | ||
167 | utcr3 = UART_GET_UTCR3(sport); | 166 | utcr3 = UART_GET_UTCR3(sport); |