aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/pci_irq.c2
-rw-r--r--drivers/base/base.h1
-rw-r--r--drivers/base/bus.c117
-rw-r--r--drivers/base/core.c2
-rw-r--r--drivers/base/dd.c2
-rw-r--r--drivers/base/driver.c35
-rw-r--r--drivers/char/tpm/tpm.c2
-rw-r--r--drivers/ide/Makefile1
-rw-r--r--drivers/ide/ide-lib.c13
-rw-r--r--drivers/ide/legacy/hd.c4
-rw-r--r--drivers/ide/pci/alim15x3.c10
-rw-r--r--drivers/ide/pci/amd74xx.c7
-rw-r--r--drivers/ide/pci/cs5530.c4
-rw-r--r--drivers/ide/pci/cy82c693.c8
-rw-r--r--drivers/ide/pci/it8172.c4
-rw-r--r--drivers/ide/pci/ns87415.c2
-rw-r--r--drivers/ide/pci/opti621.c2
-rw-r--r--drivers/ide/pci/sc1200.c2
-rw-r--r--drivers/ide/pci/sl82c105.c6
-rw-r--r--drivers/ide/pci/slc90e66.c2
-rw-r--r--drivers/ide/pci/triflex.c2
-rw-r--r--drivers/ide/pci/via82cxxx.c4
-rw-r--r--drivers/input/gameport/gameport.c3
-rw-r--r--drivers/input/joystick/analog.c4
-rw-r--r--drivers/mmc/mmci.c9
-rw-r--r--drivers/mmc/wbsd.c80
-rw-r--r--drivers/mmc/wbsd.h9
-rw-r--r--drivers/mtd/afs.c16
-rw-r--r--drivers/pcmcia/ds.c2
-rw-r--r--drivers/serial/8250.c3
-rw-r--r--drivers/serial/s3c2410.c5
-rw-r--r--drivers/serial/serial_core.c14
-rw-r--r--drivers/video/console/fbcon.c8
33 files changed, 255 insertions, 130 deletions
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 8dbf802ee7f8..d1f42b972821 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -433,7 +433,7 @@ acpi_pci_irq_enable (
433 printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", 433 printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",
434 pci_name(dev), ('A' + pin)); 434 pci_name(dev), ('A' + pin));
435 /* Interrupt Line values above 0xF are forbidden */ 435 /* Interrupt Line values above 0xF are forbidden */
436 if (dev->irq >= 0 && (dev->irq <= 0xF)) { 436 if (dev->irq > 0 && (dev->irq <= 0xF)) {
437 printk(" - using IRQ %d\n", dev->irq); 437 printk(" - using IRQ %d\n", dev->irq);
438 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); 438 acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
439 return_VALUE(0); 439 return_VALUE(0);
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 645f62692920..783752b68a9a 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -5,6 +5,7 @@ extern int bus_add_driver(struct device_driver *);
5extern void bus_remove_driver(struct device_driver *); 5extern void bus_remove_driver(struct device_driver *);
6 6
7extern void driver_detach(struct device_driver * drv); 7extern void driver_detach(struct device_driver * drv);
8extern int driver_probe_device(struct device_driver *, struct device *);
8 9
9static inline struct class_device *to_class_dev(struct kobject *obj) 10static inline struct class_device *to_class_dev(struct kobject *obj)
10{ 11{
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index c3fac7fd555e..96fe2f956754 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -133,6 +133,58 @@ static struct kobj_type ktype_bus = {
133decl_subsys(bus, &ktype_bus, NULL); 133decl_subsys(bus, &ktype_bus, NULL);
134 134
135 135
136/* Manually detach a device from it's associated driver. */
137static int driver_helper(struct device *dev, void *data)
138{
139 const char *name = data;
140
141 if (strcmp(name, dev->bus_id) == 0)
142 return 1;
143 return 0;
144}
145
146static ssize_t driver_unbind(struct device_driver *drv,
147 const char *buf, size_t count)
148{
149 struct bus_type *bus = get_bus(drv->bus);
150 struct device *dev;
151 int err = -ENODEV;
152
153 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
154 if ((dev) &&
155 (dev->driver == drv)) {
156 device_release_driver(dev);
157 err = count;
158 }
159 return err;
160}
161static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
162
163/*
164 * Manually attach a device to a driver.
165 * Note: the driver must want to bind to the device,
166 * it is not possible to override the driver's id table.
167 */
168static ssize_t driver_bind(struct device_driver *drv,
169 const char *buf, size_t count)
170{
171 struct bus_type *bus = get_bus(drv->bus);
172 struct device *dev;
173 int err = -ENODEV;
174
175 dev = bus_find_device(bus, NULL, (void *)buf, driver_helper);
176 if ((dev) &&
177 (dev->driver == NULL)) {
178 down(&dev->sem);
179 err = driver_probe_device(drv, dev);
180 up(&dev->sem);
181 put_device(dev);
182 }
183 return err;
184}
185static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
186
187
136static struct device * next_device(struct klist_iter * i) 188static struct device * next_device(struct klist_iter * i)
137{ 189{
138 struct klist_node * n = klist_next(i); 190 struct klist_node * n = klist_next(i);
@@ -177,6 +229,39 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start,
177 return error; 229 return error;
178} 230}
179 231
232/**
233 * bus_find_device - device iterator for locating a particular device.
234 * @bus: bus type
235 * @start: Device to begin with
236 * @data: Data to pass to match function
237 * @match: Callback function to check device
238 *
239 * This is similar to the bus_for_each_dev() function above, but it
240 * returns a reference to a device that is 'found' for later use, as
241 * determined by the @match callback.
242 *
243 * The callback should return 0 if the device doesn't match and non-zero
244 * if it does. If the callback returns non-zero, this function will
245 * return to the caller and not iterate over any more devices.
246 */
247struct device * bus_find_device(struct bus_type *bus,
248 struct device *start, void *data,
249 int (*match)(struct device *, void *))
250{
251 struct klist_iter i;
252 struct device *dev;
253
254 if (!bus)
255 return NULL;
256
257 klist_iter_init_node(&bus->klist_devices, &i,
258 (start ? &start->knode_bus : NULL));
259 while ((dev = next_device(&i)))
260 if (match(dev, data) && get_device(dev))
261 break;
262 klist_iter_exit(&i);
263 return dev;
264}
180 265
181 266
182static struct device_driver * next_driver(struct klist_iter * i) 267static struct device_driver * next_driver(struct klist_iter * i)
@@ -363,6 +448,8 @@ int bus_add_driver(struct device_driver * drv)
363 module_add_driver(drv->owner, drv); 448 module_add_driver(drv->owner, drv);
364 449
365 driver_add_attrs(bus, drv); 450 driver_add_attrs(bus, drv);
451 driver_create_file(drv, &driver_attr_unbind);
452 driver_create_file(drv, &driver_attr_bind);
366 } 453 }
367 return error; 454 return error;
368} 455}
@@ -380,6 +467,8 @@ int bus_add_driver(struct device_driver * drv)
380void bus_remove_driver(struct device_driver * drv) 467void bus_remove_driver(struct device_driver * drv)
381{ 468{
382 if (drv->bus) { 469 if (drv->bus) {
470 driver_remove_file(drv, &driver_attr_bind);
471 driver_remove_file(drv, &driver_attr_unbind);
383 driver_remove_attrs(drv->bus, drv); 472 driver_remove_attrs(drv->bus, drv);
384 klist_remove(&drv->knode_bus); 473 klist_remove(&drv->knode_bus);
385 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); 474 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
@@ -394,31 +483,22 @@ void bus_remove_driver(struct device_driver * drv)
394/* Helper for bus_rescan_devices's iter */ 483/* Helper for bus_rescan_devices's iter */
395static int bus_rescan_devices_helper(struct device *dev, void *data) 484static int bus_rescan_devices_helper(struct device *dev, void *data)
396{ 485{
397 int *count = data; 486 if (!dev->driver)
398 487 device_attach(dev);
399 if (!dev->driver && (device_attach(dev) > 0))
400 (*count)++;
401
402 return 0; 488 return 0;
403} 489}
404 490
405
406/** 491/**
407 * bus_rescan_devices - rescan devices on the bus for possible drivers 492 * bus_rescan_devices - rescan devices on the bus for possible drivers
408 * @bus: the bus to scan. 493 * @bus: the bus to scan.
409 * 494 *
410 * This function will look for devices on the bus with no driver 495 * This function will look for devices on the bus with no driver
411 * attached and rescan it against existing drivers to see if it 496 * attached and rescan it against existing drivers to see if it matches
412 * matches any. Calls device_attach(). Returns the number of devices 497 * any by calling device_attach() for the unbound devices.
413 * that were sucessfully bound to a driver.
414 */ 498 */
415int bus_rescan_devices(struct bus_type * bus) 499void bus_rescan_devices(struct bus_type * bus)
416{ 500{
417 int count = 0; 501 bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);
418
419 bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper);
420
421 return count;
422} 502}
423 503
424 504
@@ -557,6 +637,7 @@ int __init buses_init(void)
557 637
558 638
559EXPORT_SYMBOL_GPL(bus_for_each_dev); 639EXPORT_SYMBOL_GPL(bus_for_each_dev);
640EXPORT_SYMBOL_GPL(bus_find_device);
560EXPORT_SYMBOL_GPL(bus_for_each_drv); 641EXPORT_SYMBOL_GPL(bus_for_each_drv);
561 642
562EXPORT_SYMBOL_GPL(bus_add_device); 643EXPORT_SYMBOL_GPL(bus_add_device);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 86d79755fbfb..efe03a024a5b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -333,7 +333,7 @@ void device_del(struct device * dev)
333 struct device * parent = dev->parent; 333 struct device * parent = dev->parent;
334 334
335 if (parent) 335 if (parent)
336 klist_remove(&dev->knode_parent); 336 klist_del(&dev->knode_parent);
337 337
338 /* Notify the platform of the removal, in case they 338 /* Notify the platform of the removal, in case they
339 * need to do anything... 339 * need to do anything...
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 6db3a789c54f..16323f9cbff0 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -65,7 +65,7 @@ void device_bind_driver(struct device * dev)
65 * 65 *
66 * This function must be called with @dev->sem held. 66 * This function must be called with @dev->sem held.
67 */ 67 */
68static int driver_probe_device(struct device_driver * drv, struct device * dev) 68int driver_probe_device(struct device_driver * drv, struct device * dev)
69{ 69{
70 int ret = 0; 70 int ret = 0;
71 71
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 1b645886e9eb..291c5954a3af 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -56,6 +56,41 @@ EXPORT_SYMBOL_GPL(driver_for_each_device);
56 56
57 57
58/** 58/**
59 * driver_find_device - device iterator for locating a particular device.
60 * @driver: The device's driver
61 * @start: Device to begin with
62 * @data: Data to pass to match function
63 * @match: Callback function to check device
64 *
65 * This is similar to the driver_for_each_device() function above, but
66 * it returns a reference to a device that is 'found' for later use, as
67 * determined by the @match callback.
68 *
69 * The callback should return 0 if the device doesn't match and non-zero
70 * if it does. If the callback returns non-zero, this function will
71 * return to the caller and not iterate over any more devices.
72 */
73struct device * driver_find_device(struct device_driver *drv,
74 struct device * start, void * data,
75 int (*match)(struct device *, void *))
76{
77 struct klist_iter i;
78 struct device *dev;
79
80 if (!drv)
81 return NULL;
82
83 klist_iter_init_node(&drv->klist_devices, &i,
84 (start ? &start->knode_driver : NULL));
85 while ((dev = next_device(&i)))
86 if (match(dev, data) && get_device(dev))
87 break;
88 klist_iter_exit(&i);
89 return dev;
90}
91EXPORT_SYMBOL_GPL(driver_find_device);
92
93/**
59 * driver_create_file - create sysfs file for driver. 94 * driver_create_file - create sysfs file for driver.
60 * @drv: driver. 95 * @drv: driver.
61 * @attr: driver attribute descriptor. 96 * @attr: driver attribute descriptor.
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 854475c54f0e..049d128ae7f0 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -464,7 +464,7 @@ void __devexit tpm_remove(struct pci_dev *pci_dev)
464 464
465 pci_set_drvdata(pci_dev, NULL); 465 pci_set_drvdata(pci_dev, NULL);
466 misc_deregister(&chip->vendor->miscdev); 466 misc_deregister(&chip->vendor->miscdev);
467 kfree(&chip->vendor->miscdev.name); 467 kfree(chip->vendor->miscdev.name);
468 468
469 sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group); 469 sysfs_remove_group(&pci_dev->dev.kobj, chip->vendor->attr_group);
470 470
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile
index 5be8ad6dc9ed..cca9c075966d 100644
--- a/drivers/ide/Makefile
+++ b/drivers/ide/Makefile
@@ -20,7 +20,6 @@ ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o
20# Core IDE code - must come before legacy 20# Core IDE code - must come before legacy
21ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o 21ide-core-$(CONFIG_BLK_DEV_IDEPCI) += setup-pci.o
22ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o 22ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o
23ide-core-$(CONFIG_BLK_DEV_IDE_TCQ) += ide-tcq.o
24ide-core-$(CONFIG_PROC_FS) += ide-proc.o 23ide-core-$(CONFIG_PROC_FS) += ide-proc.o
25ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o 24ide-core-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o
26 25
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 6806d407e9c1..b09a6537c7a8 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -487,8 +487,7 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
487 u8 err = 0; 487 u8 err = 0;
488 488
489 local_irq_set(flags); 489 local_irq_set(flags);
490 printk("%s: %s: status=0x%02x", drive->name, msg, stat); 490 printk("%s: %s: status=0x%02x { ", drive->name, msg, stat);
491 printk(" { ");
492 if (stat & BUSY_STAT) 491 if (stat & BUSY_STAT)
493 printk("Busy "); 492 printk("Busy ");
494 else { 493 else {
@@ -500,15 +499,13 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
500 if (stat & INDEX_STAT) printk("Index "); 499 if (stat & INDEX_STAT) printk("Index ");
501 if (stat & ERR_STAT) printk("Error "); 500 if (stat & ERR_STAT) printk("Error ");
502 } 501 }
503 printk("}"); 502 printk("}\n");
504 printk("\n");
505 if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { 503 if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) {
506 err = hwif->INB(IDE_ERROR_REG); 504 err = hwif->INB(IDE_ERROR_REG);
507 printk("%s: %s: error=0x%02x", drive->name, msg, err); 505 printk("%s: %s: error=0x%02x { ", drive->name, msg, err);
508 printk(" { ");
509 if (err & ABRT_ERR) printk("DriveStatusError "); 506 if (err & ABRT_ERR) printk("DriveStatusError ");
510 if (err & ICRC_ERR) 507 if (err & ICRC_ERR)
511 printk("Bad%s ", (err & ABRT_ERR) ? "CRC" : "Sector"); 508 printk((err & ABRT_ERR) ? "BadCRC " : "BadSector ");
512 if (err & ECC_ERR) printk("UncorrectableError "); 509 if (err & ECC_ERR) printk("UncorrectableError ");
513 if (err & ID_ERR) printk("SectorIdNotFound "); 510 if (err & ID_ERR) printk("SectorIdNotFound ");
514 if (err & TRK0_ERR) printk("TrackZeroNotFound "); 511 if (err & TRK0_ERR) printk("TrackZeroNotFound ");
@@ -546,8 +543,8 @@ static u8 ide_dump_ata_status(ide_drive_t *drive, const char *msg, u8 stat)
546 printk(", sector=%llu", 543 printk(", sector=%llu",
547 (unsigned long long)HWGROUP(drive)->rq->sector); 544 (unsigned long long)HWGROUP(drive)->rq->sector);
548 } 545 }
546 printk("\n");
549 } 547 }
550 printk("\n");
551 ide_dump_opcode(drive); 548 ide_dump_opcode(drive);
552 local_irq_restore(flags); 549 local_irq_restore(flags);
553 return err; 550 return err;
diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
index e884cd4b22fd..242029c9c0ca 100644
--- a/drivers/ide/legacy/hd.c
+++ b/drivers/ide/legacy/hd.c
@@ -156,11 +156,13 @@ else \
156 156
157 157
158#if (HD_DELAY > 0) 158#if (HD_DELAY > 0)
159
160#include <asm/i8253.h>
161
159unsigned long last_req; 162unsigned long last_req;
160 163
161unsigned long read_timer(void) 164unsigned long read_timer(void)
162{ 165{
163 extern spinlock_t i8253_lock;
164 unsigned long t, flags; 166 unsigned long t, flags;
165 int i; 167 int i;
166 168
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 67efb38a9f6c..6cf49394a80f 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -583,7 +583,7 @@ static int ali15x3_dma_setup(ide_drive_t *drive)
583 * appropriate also sets up the 1533 southbridge. 583 * appropriate also sets up the 1533 southbridge.
584 */ 584 */
585 585
586static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char *name) 586static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const char *name)
587{ 587{
588 unsigned long flags; 588 unsigned long flags;
589 u8 tmpbyte; 589 u8 tmpbyte;
@@ -677,7 +677,7 @@ static unsigned int __init init_chipset_ali15x3 (struct pci_dev *dev, const char
677 * FIXME: frobs bits that are not defined on newer ALi devicea 677 * FIXME: frobs bits that are not defined on newer ALi devicea
678 */ 678 */
679 679
680static unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif) 680static unsigned int __devinit ata66_ali15x3 (ide_hwif_t *hwif)
681{ 681{
682 struct pci_dev *dev = hwif->pci_dev; 682 struct pci_dev *dev = hwif->pci_dev;
683 unsigned int ata66 = 0; 683 unsigned int ata66 = 0;
@@ -748,7 +748,7 @@ static unsigned int __init ata66_ali15x3 (ide_hwif_t *hwif)
748 * Initialize the IDE structure side of the ALi 15x3 driver. 748 * Initialize the IDE structure side of the ALi 15x3 driver.
749 */ 749 */
750 750
751static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif) 751static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
752{ 752{
753 hwif->autodma = 0; 753 hwif->autodma = 0;
754 hwif->tuneproc = &ali15x3_tune_drive; 754 hwif->tuneproc = &ali15x3_tune_drive;
@@ -794,7 +794,7 @@ static void __init init_hwif_common_ali15x3 (ide_hwif_t *hwif)
794 * Sparc systems 794 * Sparc systems
795 */ 795 */
796 796
797static void __init init_hwif_ali15x3 (ide_hwif_t *hwif) 797static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif)
798{ 798{
799 u8 ideic, inmir; 799 u8 ideic, inmir;
800 s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, 800 s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
@@ -847,7 +847,7 @@ static void __init init_hwif_ali15x3 (ide_hwif_t *hwif)
847 * the actual work. 847 * the actual work.
848 */ 848 */
849 849
850static void __init init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase) 850static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase)
851{ 851{
852 if (m5229_revision < 0x20) 852 if (m5229_revision < 0x20)
853 return; 853 return;
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 4e0f13d1d060..844a6c9fb949 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -73,6 +73,7 @@ static struct amd_ide_chip {
73 { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, AMD_UDMA_133 }, 73 { PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, 0x50, AMD_UDMA_133 },
74 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, AMD_UDMA_133 }, 74 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, 0x50, AMD_UDMA_133 },
75 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, 0x50, AMD_UDMA_133 }, 75 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, 0x50, AMD_UDMA_133 },
76 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, 0x50, AMD_UDMA_133 },
76 { 0 } 77 { 0 }
77}; 78};
78 79
@@ -309,7 +310,7 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive)
309 * and initialize its drive independent registers. 310 * and initialize its drive independent registers.
310 */ 311 */
311 312
312static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char *name) 313static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const char *name)
313{ 314{
314 unsigned char t; 315 unsigned char t;
315 unsigned int u; 316 unsigned int u;
@@ -413,7 +414,7 @@ static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char
413 return dev->irq; 414 return dev->irq;
414} 415}
415 416
416static void __init init_hwif_amd74xx(ide_hwif_t *hwif) 417static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
417{ 418{
418 int i; 419 int i;
419 420
@@ -489,6 +490,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
489 /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"), 490 /* 13 */ DECLARE_NV_DEV("NFORCE-CK804"),
490 /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"), 491 /* 14 */ DECLARE_NV_DEV("NFORCE-MCP04"),
491 /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51"), 492 /* 15 */ DECLARE_NV_DEV("NFORCE-MCP51"),
493 /* 16 */ DECLARE_NV_DEV("NFORCE-MCP55"),
492}; 494};
493 495
494static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) 496static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
@@ -524,6 +526,7 @@ static struct pci_device_id amd74xx_pci_tbl[] = {
524 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 }, 526 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13 },
525 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 }, 527 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14 },
526 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 }, 528 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15 },
529 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16 },
527 { 0, }, 530 { 0, },
528}; 531};
529MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl); 532MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 0381961db263..09269e574b3e 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -217,7 +217,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
217 * Initialize the cs5530 bridge for reliable IDE DMA operation. 217 * Initialize the cs5530 bridge for reliable IDE DMA operation.
218 */ 218 */
219 219
220static unsigned int __init init_chipset_cs5530 (struct pci_dev *dev, const char *name) 220static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name)
221{ 221{
222 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 222 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
223 unsigned long flags; 223 unsigned long flags;
@@ -308,7 +308,7 @@ static unsigned int __init init_chipset_cs5530 (struct pci_dev *dev, const char
308 * performs channel-specific pre-initialization before drive probing. 308 * performs channel-specific pre-initialization before drive probing.
309 */ 309 */
310 310
311static void __init init_hwif_cs5530 (ide_hwif_t *hwif) 311static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
312{ 312{
313 unsigned long basereg; 313 unsigned long basereg;
314 u32 d0_timings; 314 u32 d0_timings;
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 80d67e99ccb5..5a33513f3dd1 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -391,7 +391,7 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio)
391/* 391/*
392 * this function is called during init and is used to setup the cy82c693 chip 392 * this function is called during init and is used to setup the cy82c693 chip
393 */ 393 */
394static unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char *name) 394static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const char *name)
395{ 395{
396 if (PCI_FUNC(dev->devfn) != 1) 396 if (PCI_FUNC(dev->devfn) != 1)
397 return 0; 397 return 0;
@@ -443,7 +443,7 @@ static unsigned int __init init_chipset_cy82c693(struct pci_dev *dev, const char
443/* 443/*
444 * the init function - called for each ide channel once 444 * the init function - called for each ide channel once
445 */ 445 */
446static void __init init_hwif_cy82c693(ide_hwif_t *hwif) 446static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
447{ 447{
448 hwif->autodma = 0; 448 hwif->autodma = 0;
449 449
@@ -467,9 +467,9 @@ static void __init init_hwif_cy82c693(ide_hwif_t *hwif)
467 hwif->drives[1].autodma = hwif->autodma; 467 hwif->drives[1].autodma = hwif->autodma;
468} 468}
469 469
470static __initdata ide_hwif_t *primary; 470static __devinitdata ide_hwif_t *primary;
471 471
472void __init init_iops_cy82c693(ide_hwif_t *hwif) 472void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
473{ 473{
474 if (PCI_FUNC(hwif->pci_dev->devfn) == 1) 474 if (PCI_FUNC(hwif->pci_dev->devfn) == 1)
475 primary = hwif; 475 primary = hwif;
diff --git a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
index 631927cf17d4..93462926b9d5 100644
--- a/drivers/ide/pci/it8172.c
+++ b/drivers/ide/pci/it8172.c
@@ -216,7 +216,7 @@ fast_ata_pio:
216 return 0; 216 return 0;
217} 217}
218 218
219static unsigned int __init init_chipset_it8172 (struct pci_dev *dev, const char *name) 219static unsigned int __devinit init_chipset_it8172 (struct pci_dev *dev, const char *name)
220{ 220{
221 unsigned char progif; 221 unsigned char progif;
222 222
@@ -230,7 +230,7 @@ static unsigned int __init init_chipset_it8172 (struct pci_dev *dev, const char
230} 230}
231 231
232 232
233static void __init init_hwif_it8172 (ide_hwif_t *hwif) 233static void __devinit init_hwif_it8172 (ide_hwif_t *hwif)
234{ 234{
235 struct pci_dev* dev = hwif->pci_dev; 235 struct pci_dev* dev = hwif->pci_dev;
236 unsigned long cmdBase, ctrlBase; 236 unsigned long cmdBase, ctrlBase;
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 205a32fbc2f0..fcd5142f5cfe 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -195,7 +195,7 @@ static int ns87415_ide_dma_check (ide_drive_t *drive)
195 return __ide_dma_check(drive); 195 return __ide_dma_check(drive);
196} 196}
197 197
198static void __init init_hwif_ns87415 (ide_hwif_t *hwif) 198static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
199{ 199{
200 struct pci_dev *dev = hwif->pci_dev; 200 struct pci_dev *dev = hwif->pci_dev;
201 unsigned int ctrl, using_inta; 201 unsigned int ctrl, using_inta;
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index cf4fd91d396a..7a7c2ef78ac2 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -326,7 +326,7 @@ static void opti621_tune_drive (ide_drive_t *drive, u8 pio)
326/* 326/*
327 * init_hwif_opti621() is called once for each hwif found at boot. 327 * init_hwif_opti621() is called once for each hwif found at boot.
328 */ 328 */
329static void __init init_hwif_opti621 (ide_hwif_t *hwif) 329static void __devinit init_hwif_opti621 (ide_hwif_t *hwif)
330{ 330{
331 hwif->autodma = 0; 331 hwif->autodma = 0;
332 hwif->drives[0].drive_data = PIO_DONT_KNOW; 332 hwif->drives[0].drive_data = PIO_DONT_KNOW;
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 3bc3bf1be49b..10592cec6c43 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -459,7 +459,7 @@ printk("%s: SC1200: resume\n", hwif->name);
459 * This gets invoked by the IDE driver once for each channel, 459 * This gets invoked by the IDE driver once for each channel,
460 * and performs channel-specific pre-initialization before drive probing. 460 * and performs channel-specific pre-initialization before drive probing.
461 */ 461 */
462static void __init init_hwif_sc1200 (ide_hwif_t *hwif) 462static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif)
463{ 463{
464 if (hwif->mate) 464 if (hwif->mate)
465 hwif->serialized = hwif->mate->serialized = 1; 465 hwif->serialized = hwif->mate->serialized = 1;
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 1d970a0de21a..ea0806c82be0 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -386,7 +386,7 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev)
386 * channel 0 here at least, but channel 1 has to be enabled by 386 * channel 0 here at least, but channel 1 has to be enabled by
387 * firmware or arch code. We still set both to 16 bits mode. 387 * firmware or arch code. We still set both to 16 bits mode.
388 */ 388 */
389static unsigned int __init init_chipset_sl82c105(struct pci_dev *dev, const char *msg) 389static unsigned int __devinit init_chipset_sl82c105(struct pci_dev *dev, const char *msg)
390{ 390{
391 u32 val; 391 u32 val;
392 392
@@ -399,7 +399,7 @@ static unsigned int __init init_chipset_sl82c105(struct pci_dev *dev, const char
399 return dev->irq; 399 return dev->irq;
400} 400}
401 401
402static void __init init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base) 402static void __devinit init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base)
403{ 403{
404 unsigned int rev; 404 unsigned int rev;
405 u8 dma_state; 405 u8 dma_state;
@@ -431,7 +431,7 @@ static void __init init_dma_sl82c105(ide_hwif_t *hwif, unsigned long dma_base)
431 * Initialise the chip 431 * Initialise the chip
432 */ 432 */
433 433
434static void __init init_hwif_sl82c105(ide_hwif_t *hwif) 434static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
435{ 435{
436 struct pci_dev *dev = hwif->pci_dev; 436 struct pci_dev *dev = hwif->pci_dev;
437 u32 val; 437 u32 val;
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 7fbf36342f73..5112c726633b 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -196,7 +196,7 @@ fast_ata_pio:
196} 196}
197#endif /* CONFIG_BLK_DEV_IDEDMA */ 197#endif /* CONFIG_BLK_DEV_IDEDMA */
198 198
199static void __init init_hwif_slc90e66 (ide_hwif_t *hwif) 199static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
200{ 200{
201 u8 reg47 = 0; 201 u8 reg47 = 0;
202 u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ 202 u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index a1df2bfe3631..f96b56838f33 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -130,7 +130,7 @@ static int triflex_config_drive_xfer_rate(ide_drive_t *drive)
130 return hwif->ide_dma_off_quietly(drive); 130 return hwif->ide_dma_off_quietly(drive);
131} 131}
132 132
133static void __init init_hwif_triflex(ide_hwif_t *hwif) 133static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
134{ 134{
135 hwif->tuneproc = &triflex_tune_drive; 135 hwif->tuneproc = &triflex_tune_drive;
136 hwif->speedproc = &triflex_tune_chipset; 136 hwif->speedproc = &triflex_tune_chipset;
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 069dbffe2116..a4d099c937ff 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -415,7 +415,7 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive)
415 * and initialize its drive independent registers. 415 * and initialize its drive independent registers.
416 */ 416 */
417 417
418static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const char *name) 418static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name)
419{ 419{
420 struct pci_dev *isa = NULL; 420 struct pci_dev *isa = NULL;
421 u8 t, v; 421 u8 t, v;
@@ -576,7 +576,7 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha
576 return 0; 576 return 0;
577} 577}
578 578
579static void __init init_hwif_via82cxxx(ide_hwif_t *hwif) 579static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
580{ 580{
581 int i; 581 int i;
582 582
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 3e72c9b1461e..ab09cf4093e3 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -60,12 +60,13 @@ static void gameport_disconnect_port(struct gameport *gameport);
60 60
61#if defined(__i386__) 61#if defined(__i386__)
62 62
63#include <asm/i8253.h>
64
63#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0)) 65#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0))
64#define GET_TIME(x) do { x = get_time_pit(); } while (0) 66#define GET_TIME(x) do { x = get_time_pit(); } while (0)
65 67
66static unsigned int get_time_pit(void) 68static unsigned int get_time_pit(void)
67{ 69{
68 extern spinlock_t i8253_lock;
69 unsigned long flags; 70 unsigned long flags;
70 unsigned int count; 71 unsigned int count;
71 72
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 504b7d550567..c3a5739030c3 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -140,12 +140,14 @@ struct analog_port {
140 */ 140 */
141 141
142#ifdef __i386__ 142#ifdef __i386__
143
144#include <asm/i8253.h>
145
143#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0) 146#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
144#define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0))) 147#define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))
145#define TIME_NAME (cpu_has_tsc?"TSC":"PIT") 148#define TIME_NAME (cpu_has_tsc?"TSC":"PIT")
146static unsigned int get_time_pit(void) 149static unsigned int get_time_pit(void)
147{ 150{
148 extern spinlock_t i8253_lock;
149 unsigned long flags; 151 unsigned long flags;
150 unsigned int count; 152 unsigned int count;
151 153
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index 3a5f6ac5b364..7a42966d755b 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -20,6 +20,7 @@
20#include <linux/mmc/host.h> 20#include <linux/mmc/host.h>
21#include <linux/mmc/protocol.h> 21#include <linux/mmc/protocol.h>
22 22
23#include <asm/div64.h>
23#include <asm/io.h> 24#include <asm/io.h>
24#include <asm/irq.h> 25#include <asm/irq.h>
25#include <asm/scatterlist.h> 26#include <asm/scatterlist.h>
@@ -70,6 +71,7 @@ static void mmci_stop_data(struct mmci_host *host)
70static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) 71static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
71{ 72{
72 unsigned int datactrl, timeout, irqmask; 73 unsigned int datactrl, timeout, irqmask;
74 unsigned long long clks;
73 void __iomem *base; 75 void __iomem *base;
74 76
75 DBG(host, "blksz %04x blks %04x flags %08x\n", 77 DBG(host, "blksz %04x blks %04x flags %08x\n",
@@ -81,9 +83,10 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
81 83
82 mmci_init_sg(host, data); 84 mmci_init_sg(host, data);
83 85
84 timeout = data->timeout_clks + 86 clks = (unsigned long long)data->timeout_ns * host->cclk;
85 ((unsigned long long)data->timeout_ns * host->cclk) / 87 do_div(clks, 1000000000UL);
86 1000000000ULL; 88
89 timeout = data->timeout_clks + (unsigned int)clks;
87 90
88 base = host->base; 91 base = host->base;
89 writel(timeout, base + MMCIDATATIMER); 92 writel(timeout, base + MMCIDATATIMER);
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index b7fbd30b49a0..0c41d4b41a65 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -54,28 +54,6 @@
54#define DBGF(x...) do { } while (0) 54#define DBGF(x...) do { } while (0)
55#endif 55#endif
56 56
57#ifdef CONFIG_MMC_DEBUG
58void DBG_REG(int reg, u8 value)
59{
60 int i;
61
62 printk(KERN_DEBUG "wbsd: Register %d: 0x%02X %3d '%c' ",
63 reg, (int)value, (int)value, (value < 0x20)?'.':value);
64
65 for (i = 7;i >= 0;i--)
66 {
67 if (value & (1 << i))
68 printk("x");
69 else
70 printk(".");
71 }
72
73 printk("\n");
74}
75#else
76#define DBG_REG(r, v) do {} while (0)
77#endif
78
79/* 57/*
80 * Device resources 58 * Device resources
81 */ 59 */
@@ -92,6 +70,13 @@ MODULE_DEVICE_TABLE(pnp, pnp_dev_table);
92 70
93#endif /* CONFIG_PNP */ 71#endif /* CONFIG_PNP */
94 72
73static const int config_ports[] = { 0x2E, 0x4E };
74static const int unlock_codes[] = { 0x83, 0x87 };
75
76static const int valid_ids[] = {
77 0x7112,
78 };
79
95#ifdef CONFIG_PNP 80#ifdef CONFIG_PNP
96static unsigned int nopnp = 0; 81static unsigned int nopnp = 0;
97#else 82#else
@@ -1051,6 +1036,20 @@ static struct mmc_host_ops wbsd_ops = {
1051\*****************************************************************************/ 1036\*****************************************************************************/
1052 1037
1053/* 1038/*
1039 * Helper function for card detection
1040 */
1041static void wbsd_detect_card(unsigned long data)
1042{
1043 struct wbsd_host *host = (struct wbsd_host*)data;
1044
1045 BUG_ON(host == NULL);
1046
1047 DBG("Executing card detection\n");
1048
1049 mmc_detect_change(host->mmc);
1050}
1051
1052/*
1054 * Tasklets 1053 * Tasklets
1055 */ 1054 */
1056 1055
@@ -1075,7 +1074,6 @@ static void wbsd_tasklet_card(unsigned long param)
1075{ 1074{
1076 struct wbsd_host* host = (struct wbsd_host*)param; 1075 struct wbsd_host* host = (struct wbsd_host*)param;
1077 u8 csr; 1076 u8 csr;
1078 int change = 0;
1079 1077
1080 spin_lock(&host->lock); 1078 spin_lock(&host->lock);
1081 1079
@@ -1094,14 +1092,20 @@ static void wbsd_tasklet_card(unsigned long param)
1094 { 1092 {
1095 DBG("Card inserted\n"); 1093 DBG("Card inserted\n");
1096 host->flags |= WBSD_FCARD_PRESENT; 1094 host->flags |= WBSD_FCARD_PRESENT;
1097 change = 1; 1095
1096 /*
1097 * Delay card detection to allow electrical connections
1098 * to stabilise.
1099 */
1100 mod_timer(&host->timer, jiffies + HZ/2);
1098 } 1101 }
1102
1103 spin_unlock(&host->lock);
1099 } 1104 }
1100 else if (host->flags & WBSD_FCARD_PRESENT) 1105 else if (host->flags & WBSD_FCARD_PRESENT)
1101 { 1106 {
1102 DBG("Card removed\n"); 1107 DBG("Card removed\n");
1103 host->flags &= ~WBSD_FCARD_PRESENT; 1108 host->flags &= ~WBSD_FCARD_PRESENT;
1104 change = 1;
1105 1109
1106 if (host->mrq) 1110 if (host->mrq)
1107 { 1111 {
@@ -1112,15 +1116,14 @@ static void wbsd_tasklet_card(unsigned long param)
1112 host->mrq->cmd->error = MMC_ERR_FAILED; 1116 host->mrq->cmd->error = MMC_ERR_FAILED;
1113 tasklet_schedule(&host->finish_tasklet); 1117 tasklet_schedule(&host->finish_tasklet);
1114 } 1118 }
1115 } 1119
1116 1120 /*
1117 /* 1121 * Unlock first since we might get a call back.
1118 * Unlock first since we might get a call back. 1122 */
1119 */ 1123 spin_unlock(&host->lock);
1120 spin_unlock(&host->lock);
1121 1124
1122 if (change)
1123 mmc_detect_change(host->mmc); 1125 mmc_detect_change(host->mmc);
1126 }
1124} 1127}
1125 1128
1126static void wbsd_tasklet_fifo(unsigned long param) 1129static void wbsd_tasklet_fifo(unsigned long param)
@@ -1325,6 +1328,13 @@ static int __devinit wbsd_alloc_mmc(struct device* dev)
1325 spin_lock_init(&host->lock); 1328 spin_lock_init(&host->lock);
1326 1329
1327 /* 1330 /*
1331 * Set up detection timer
1332 */
1333 init_timer(&host->timer);
1334 host->timer.data = (unsigned long)host;
1335 host->timer.function = wbsd_detect_card;
1336
1337 /*
1328 * Maximum number of segments. Worst case is one sector per segment 1338 * Maximum number of segments. Worst case is one sector per segment
1329 * so this will be 64kB/512. 1339 * so this will be 64kB/512.
1330 */ 1340 */
@@ -1351,11 +1361,17 @@ static int __devinit wbsd_alloc_mmc(struct device* dev)
1351static void __devexit wbsd_free_mmc(struct device* dev) 1361static void __devexit wbsd_free_mmc(struct device* dev)
1352{ 1362{
1353 struct mmc_host* mmc; 1363 struct mmc_host* mmc;
1364 struct wbsd_host* host;
1354 1365
1355 mmc = dev_get_drvdata(dev); 1366 mmc = dev_get_drvdata(dev);
1356 if (!mmc) 1367 if (!mmc)
1357 return; 1368 return;
1358 1369
1370 host = mmc_priv(mmc);
1371 BUG_ON(host == NULL);
1372
1373 del_timer_sync(&host->timer);
1374
1359 mmc_free_host(mmc); 1375 mmc_free_host(mmc);
1360 1376
1361 dev_set_drvdata(dev, NULL); 1377 dev_set_drvdata(dev, NULL);
diff --git a/drivers/mmc/wbsd.h b/drivers/mmc/wbsd.h
index 864f30828d01..661a9f6a6e6f 100644
--- a/drivers/mmc/wbsd.h
+++ b/drivers/mmc/wbsd.h
@@ -8,13 +8,6 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11const int config_ports[] = { 0x2E, 0x4E };
12const int unlock_codes[] = { 0x83, 0x87 };
13
14const int valid_ids[] = {
15 0x7112,
16 };
17
18#define LOCK_CODE 0xAA 11#define LOCK_CODE 0xAA
19 12
20#define WBSD_CONF_SWRST 0x02 13#define WBSD_CONF_SWRST 0x02
@@ -187,4 +180,6 @@ struct wbsd_host
187 struct tasklet_struct timeout_tasklet; 180 struct tasklet_struct timeout_tasklet;
188 struct tasklet_struct finish_tasklet; 181 struct tasklet_struct finish_tasklet;
189 struct tasklet_struct block_tasklet; 182 struct tasklet_struct block_tasklet;
183
184 struct timer_list timer; /* Card detection timer */
190}; 185};
diff --git a/drivers/mtd/afs.c b/drivers/mtd/afs.c
index 801e6c7d0892..7363e101eb0f 100644
--- a/drivers/mtd/afs.c
+++ b/drivers/mtd/afs.c
@@ -219,7 +219,7 @@ static int parse_afs_partitions(struct mtd_info *mtd,
219 */ 219 */
220 for (idx = off = 0; off < mtd->size; off += mtd->erasesize) { 220 for (idx = off = 0; off < mtd->size; off += mtd->erasesize) {
221 struct image_info_struct iis; 221 struct image_info_struct iis;
222 u_int iis_ptr, img_ptr, size; 222 u_int iis_ptr, img_ptr;
223 223
224 /* Read the footer. */ 224 /* Read the footer. */
225 ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask); 225 ret = afs_read_footer(mtd, &img_ptr, &iis_ptr, off, mask);
@@ -236,21 +236,9 @@ static int parse_afs_partitions(struct mtd_info *mtd,
236 continue; 236 continue;
237 237
238 strcpy(str, iis.name); 238 strcpy(str, iis.name);
239 size = mtd->erasesize + off - img_ptr;
240
241 /*
242 * In order to support JFFS2 partitions on this layout,
243 * we must lie to MTD about the real size of JFFS2
244 * partitions; this ensures that the AFS flash footer
245 * won't be erased by JFFS2. Please ensure that your
246 * JFFS2 partitions are given image numbers between
247 * 1000 and 2000 inclusive.
248 */
249 if (iis.imageNumber >= 1000 && iis.imageNumber < 2000)
250 size -= mtd->erasesize;
251 239
252 parts[idx].name = str; 240 parts[idx].name = str;
253 parts[idx].size = size; 241 parts[idx].size = (iis.length + mtd->erasesize - 1) & ~(mtd->erasesize - 1);
254 parts[idx].offset = img_ptr; 242 parts[idx].offset = img_ptr;
255 parts[idx].mask_flags = 0; 243 parts[idx].mask_flags = 0;
256 244
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index cabddd49f6ff..d5afd557fe37 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -847,7 +847,7 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]);
847pcmcia_device_stringattr(prod_id3, prod_id[2]); 847pcmcia_device_stringattr(prod_id3, prod_id[2]);
848pcmcia_device_stringattr(prod_id4, prod_id[3]); 848pcmcia_device_stringattr(prod_id4, prod_id[3]);
849 849
850static ssize_t modalias_show(struct device *dev, char *buf) 850static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
851{ 851{
852 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 852 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
853 int i; 853 int i;
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 9224fc3184ea..7e8fc7c1d4cc 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2061,7 +2061,8 @@ static void __init serial8250_isa_init_ports(void)
2061 up->port.ops = &serial8250_pops; 2061 up->port.ops = &serial8250_pops;
2062 } 2062 }
2063 2063
2064 for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port); 2064 for (i = 0, up = serial8250_ports;
2065 i < ARRAY_SIZE(old_serial_port) && i < UART_NR;
2065 i++, up++) { 2066 i++, up++) {
2066 up->port.iobase = old_serial_port[i].port; 2067 up->port.iobase = old_serial_port[i].port;
2067 up->port.irq = irq_canonicalize(old_serial_port[i].irq); 2068 up->port.irq = irq_canonicalize(old_serial_port[i].irq);
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 5c4678478b1d..7365d4b50b95 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -522,14 +522,11 @@ static void s3c24xx_serial_shutdown(struct uart_port *port)
522static int s3c24xx_serial_startup(struct uart_port *port) 522static int s3c24xx_serial_startup(struct uart_port *port)
523{ 523{
524 struct s3c24xx_uart_port *ourport = to_ourport(port); 524 struct s3c24xx_uart_port *ourport = to_ourport(port);
525 unsigned long flags;
526 int ret; 525 int ret;
527 526
528 dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n", 527 dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
529 port->mapbase, port->membase); 528 port->mapbase, port->membase);
530 529
531 local_irq_save(flags);
532
533 rx_enabled(port) = 1; 530 rx_enabled(port) = 1;
534 531
535 ret = request_irq(RX_IRQ(port), 532 ret = request_irq(RX_IRQ(port),
@@ -563,12 +560,10 @@ static int s3c24xx_serial_startup(struct uart_port *port)
563 /* the port reset code should have done the correct 560 /* the port reset code should have done the correct
564 * register setup for the port controls */ 561 * register setup for the port controls */
565 562
566 local_irq_restore(flags);
567 return ret; 563 return ret;
568 564
569 err: 565 err:
570 s3c24xx_serial_shutdown(port); 566 s3c24xx_serial_shutdown(port);
571 local_irq_restore(flags);
572 return ret; 567 return ret;
573} 568}
574 569
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 139863a787f3..54699c3a00ab 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1808,6 +1808,12 @@ uart_set_options(struct uart_port *port, struct console *co,
1808 struct termios termios; 1808 struct termios termios;
1809 int i; 1809 int i;
1810 1810
1811 /*
1812 * Ensure that the serial console lock is initialised
1813 * early.
1814 */
1815 spin_lock_init(&port->lock);
1816
1811 memset(&termios, 0, sizeof(struct termios)); 1817 memset(&termios, 0, sizeof(struct termios));
1812 1818
1813 termios.c_cflag = CREAD | HUPCL | CLOCAL; 1819 termios.c_cflag = CREAD | HUPCL | CLOCAL;
@@ -2196,10 +2202,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
2196 2202
2197 state->port = port; 2203 state->port = port;
2198 2204
2199 spin_lock_init(&port->lock);
2200 port->cons = drv->cons; 2205 port->cons = drv->cons;
2201 port->info = state->info; 2206 port->info = state->info;
2202 2207
2208 /*
2209 * If this port is a console, then the spinlock is already
2210 * initialised.
2211 */
2212 if (!uart_console(port))
2213 spin_lock_init(&port->lock);
2214
2203 uart_configure_port(drv, state, port); 2215 uart_configure_port(drv, state, port);
2204 2216
2205 /* 2217 /*
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index b209adbd508a..9dd0fbccf994 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -142,7 +142,6 @@ static int fbcon_set_origin(struct vc_data *);
142#define CURSOR_DRAW_DELAY (1) 142#define CURSOR_DRAW_DELAY (1)
143 143
144/* # VBL ints between cursor state changes */ 144/* # VBL ints between cursor state changes */
145#define ARM_CURSOR_BLINK_RATE (10)
146#define ATARI_CURSOR_BLINK_RATE (42) 145#define ATARI_CURSOR_BLINK_RATE (42)
147#define MAC_CURSOR_BLINK_RATE (32) 146#define MAC_CURSOR_BLINK_RATE (32)
148#define DEFAULT_CURSOR_BLINK_RATE (20) 147#define DEFAULT_CURSOR_BLINK_RATE (20)
@@ -288,7 +287,7 @@ static void fb_flashcursor(void *private)
288 release_console_sem(); 287 release_console_sem();
289} 288}
290 289
291#if (defined(__arm__) && defined(IRQ_VSYNCPULSE)) || defined(CONFIG_ATARI) || defined(CONFIG_MAC) 290#if defined(CONFIG_ATARI) || defined(CONFIG_MAC)
292static int cursor_blink_rate; 291static int cursor_blink_rate;
293static irqreturn_t fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp) 292static irqreturn_t fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp)
294{ 293{
@@ -878,11 +877,6 @@ static const char *fbcon_startup(void)
878 } 877 }
879#endif /* CONFIG_MAC */ 878#endif /* CONFIG_MAC */
880 879
881#if defined(__arm__) && defined(IRQ_VSYNCPULSE)
882 cursor_blink_rate = ARM_CURSOR_BLINK_RATE;
883 irqres = request_irq(IRQ_VSYNCPULSE, fb_vbl_handler, SA_SHIRQ,
884 "framebuffer vbl", info);
885#endif
886 /* Initialize the work queue. If the driver provides its 880 /* Initialize the work queue. If the driver provides its
887 * own work queue this means it will use something besides 881 * own work queue this means it will use something besides
888 * default timer to flash the cursor. */ 882 * default timer to flash the cursor. */