aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-05-21 11:49:57 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-21 11:49:57 -0400
commitff5f149b6aec8edbfa3698721667acd043009a33 (patch)
treed052553eb296dfee3f01b1cb2b717cb7ccf3127a /drivers
parentf0218b3e9974f06014b61be8987159f4a20e011e (diff)
parent580d607cd666dfabfc1c7b0fb08c8ac690c7c87f (diff)
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into trace/tip/tracing/core-7
Conflicts: include/linux/ftrace_event.h include/trace/ftrace.h kernel/trace/trace_event_perf.c kernel/trace/trace_kprobe.c kernel/trace/trace_syscalls.c Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/acpi/acpi_pad.c2
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/hest.c4
-rw-r--r--drivers/acpi/pci_irq.c8
-rw-r--r--drivers/acpi/power_meter.c2
-rw-r--r--drivers/acpi/sbshc.c2
-rw-r--r--drivers/acpi/sleep.c56
-rw-r--r--drivers/base/iommu.c43
-rw-r--r--drivers/base/platform.c4
-rw-r--r--drivers/block/amiflop.c47
-rw-r--r--drivers/block/drbd/drbd_worker.c2
-rw-r--r--drivers/block/hd.c4
-rw-r--r--drivers/char/serial167.c2
-rw-r--r--drivers/char/tty_io.c1
-rw-r--r--drivers/cpufreq/cpufreq.c40
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c48
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c42
-rw-r--r--drivers/cpuidle/governors/menu.c9
-rw-r--r--drivers/dma/shdma.c27
-rw-r--r--drivers/gpio/it8761e_gpio.c18
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_state.c19
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c30
-rw-r--r--drivers/gpu/drm/ttm/ttm_lock.c5
-rw-r--r--drivers/hid/hid-cherry.c1
-rw-r--r--drivers/hid/hid-core.c10
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-ntrig.c72
-rw-r--r--drivers/hid/hid-sony.c2
-rw-r--r--drivers/hid/hid-wacom.c1
-rw-r--r--drivers/hid/usbhid/hid-core.c13
-rw-r--r--drivers/hwmon/applesmc.c61
-rw-r--r--drivers/hwmon/asc7621.c63
-rw-r--r--drivers/hwmon/hp_accel.c2
-rw-r--r--drivers/input/gameport/gameport.c4
-rw-r--r--drivers/input/joystick/analog.c4
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c6
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c1
-rw-r--r--drivers/input/misc/pcspkr.c6
-rw-r--r--drivers/input/mouse/elantech.c24
-rw-r--r--drivers/input/mouse/elantech.h5
-rw-r--r--drivers/input/mouse/psmouse-base.c14
-rw-r--r--drivers/input/touchscreen/ad7877.c15
-rw-r--r--drivers/md/md.c10
-rw-r--r--drivers/md/raid5.c2
-rw-r--r--drivers/media/common/saa7146_fops.c11
-rw-r--r--drivers/media/common/saa7146_video.c8
-rw-r--r--drivers/media/dvb/frontends/stv090x.c4
-rw-r--r--drivers/media/dvb/ttpci/budget.c3
-rw-r--r--drivers/media/video/Kconfig4
-rw-r--r--drivers/media/video/Makefile2
-rw-r--r--drivers/media/video/davinci/vpfe_capture.c38
-rw-r--r--drivers/media/video/gspca/sn9c20x.c2
-rw-r--r--drivers/media/video/gspca/spca508.c1
-rw-r--r--drivers/media/video/gspca/spca561.c1
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx.c2
-rw-r--r--drivers/media/video/hexium_gemini.c3
-rw-r--r--drivers/media/video/hexium_orion.c4
-rw-r--r--drivers/media/video/mx1_camera.c8
-rw-r--r--drivers/media/video/mxb.c17
-rw-r--r--drivers/media/video/omap24xxcam.c2
-rw-r--r--drivers/media/video/pxa_camera.c11
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c2
-rw-r--r--drivers/mfd/wm831x-core.c3
-rw-r--r--drivers/mfd/wm8350-core.c4
-rw-r--r--drivers/misc/vmware_balloon.c4
-rw-r--r--drivers/mmc/host/at91_mci.c2
-rw-r--r--drivers/mmc/host/atmel-mci.c18
-rw-r--r--drivers/net/a2065.c1
-rw-r--r--drivers/net/ariadne.c1
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/hydra.c1
-rw-r--r--drivers/net/phy/micrel.c1
-rw-r--r--drivers/net/veth.c1
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.c11
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c3
-rw-r--r--drivers/net/zorro8390.c1
-rw-r--r--drivers/oprofile/cpu_buffer.c75
-rw-r--r--drivers/oprofile/oprof.c12
-rw-r--r--drivers/oprofile/oprof.h3
-rw-r--r--drivers/oprofile/timer_int.c78
-rw-r--r--drivers/pci/intel-iommu.c22
-rw-r--r--drivers/pci/setup-bus.c114
-rw-r--r--drivers/pcmcia/cs.c16
-rw-r--r--drivers/pcmcia/ds.c1
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c7
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c26
-rw-r--r--drivers/pnp/resource.c4
-rw-r--r--drivers/s390/block/dasd.c17
-rw-r--r--drivers/scsi/advansys.c50
-rw-r--r--drivers/scsi/libiscsi.c2
-rw-r--r--drivers/scsi/libsas/sas_ata.c4
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c4
-rw-r--r--drivers/scsi/scsi_debug.c3
-rw-r--r--drivers/scsi/scsi_error.c15
-rw-r--r--drivers/scsi/sd.c1
-rw-r--r--drivers/scsi/zorro7xx.c1
-rw-r--r--drivers/serial/imx.c10
-rw-r--r--drivers/serial/mpc52xx_uart.c2
-rw-r--r--drivers/usb/core/inode.c1
-rw-r--r--drivers/vhost/vhost.c7
-rw-r--r--drivers/video/amifb.c49
-rw-r--r--drivers/video/bfin-t350mcqb-fb.c15
-rw-r--r--drivers/video/cirrusfb.c1
-rw-r--r--drivers/video/fm2fb.c1
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c27
-rw-r--r--drivers/watchdog/Kconfig2
-rw-r--r--drivers/watchdog/mpcore_wdt.c21
-rw-r--r--drivers/zorro/proc.c6
-rw-r--r--drivers/zorro/zorro-driver.c24
-rw-r--r--drivers/zorro/zorro-sysfs.c11
-rw-r--r--drivers/zorro/zorro.c243
117 files changed, 962 insertions, 863 deletions
diff --git a/drivers/Makefile b/drivers/Makefile
index 34f1e1064dbc..f42a03029b7c 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_SFI) += sfi/
17obj-$(CONFIG_PNP) += pnp/ 17obj-$(CONFIG_PNP) += pnp/
18obj-$(CONFIG_ARM_AMBA) += amba/ 18obj-$(CONFIG_ARM_AMBA) += amba/
19 19
20obj-$(CONFIG_VIRTIO) += virtio/
20obj-$(CONFIG_XEN) += xen/ 21obj-$(CONFIG_XEN) += xen/
21 22
22# regulators early, since some subsystems rely on them to initialize 23# regulators early, since some subsystems rely on them to initialize
@@ -108,7 +109,6 @@ obj-$(CONFIG_PPC_PS3) += ps3/
108obj-$(CONFIG_OF) += of/ 109obj-$(CONFIG_OF) += of/
109obj-$(CONFIG_SSB) += ssb/ 110obj-$(CONFIG_SSB) += ssb/
110obj-$(CONFIG_VHOST_NET) += vhost/ 111obj-$(CONFIG_VHOST_NET) += vhost/
111obj-$(CONFIG_VIRTIO) += virtio/
112obj-$(CONFIG_VLYNQ) += vlynq/ 112obj-$(CONFIG_VLYNQ) += vlynq/
113obj-$(CONFIG_STAGING) += staging/ 113obj-$(CONFIG_STAGING) += staging/
114obj-y += platform/ 114obj-y += platform/
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 19dacfd43163..62122134693b 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -31,7 +31,7 @@
31#include <acpi/acpi_bus.h> 31#include <acpi/acpi_bus.h>
32#include <acpi/acpi_drivers.h> 32#include <acpi/acpi_drivers.h>
33 33
34#define ACPI_PROCESSOR_AGGREGATOR_CLASS "processor_aggregator" 34#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad"
35#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" 35#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
36#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 36#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
37static DEFINE_MUTEX(isolated_cpus_lock); 37static DEFINE_MUTEX(isolated_cpus_lock);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 37132dc2da03..743576bf1bd7 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -527,7 +527,7 @@ int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id,
527 if (!event_is_open) 527 if (!event_is_open)
528 return 0; 528 return 0;
529 529
530 event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC); 530 event = kzalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
531 if (!event) 531 if (!event)
532 return -ENOMEM; 532 return -ENOMEM;
533 533
diff --git a/drivers/acpi/hest.c b/drivers/acpi/hest.c
index 4bb18c980ac6..1c527a192872 100644
--- a/drivers/acpi/hest.c
+++ b/drivers/acpi/hest.c
@@ -123,6 +123,10 @@ int acpi_hest_firmware_first_pci(struct pci_dev *pci)
123{ 123{
124 acpi_status status = AE_NOT_FOUND; 124 acpi_status status = AE_NOT_FOUND;
125 struct acpi_table_header *hest = NULL; 125 struct acpi_table_header *hest = NULL;
126
127 if (acpi_disabled)
128 return 0;
129
126 status = acpi_get_table(ACPI_SIG_HEST, 1, &hest); 130 status = acpi_get_table(ACPI_SIG_HEST, 1, &hest);
127 131
128 if (ACPI_SUCCESS(status)) { 132 if (ACPI_SUCCESS(status)) {
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index b0a71ecee682..e4804fb05e23 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -401,11 +401,13 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
401 * driver reported one, then use it. Exit in any case. 401 * driver reported one, then use it. Exit in any case.
402 */ 402 */
403 if (gsi < 0) { 403 if (gsi < 0) {
404 u32 dev_gsi;
404 dev_warn(&dev->dev, "PCI INT %c: no GSI", pin_name(pin)); 405 dev_warn(&dev->dev, "PCI INT %c: no GSI", pin_name(pin));
405 /* Interrupt Line values above 0xF are forbidden */ 406 /* Interrupt Line values above 0xF are forbidden */
406 if (dev->irq > 0 && (dev->irq <= 0xF)) { 407 if (dev->irq > 0 && (dev->irq <= 0xF) &&
407 printk(" - using IRQ %d\n", dev->irq); 408 (acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) {
408 acpi_register_gsi(&dev->dev, dev->irq, 409 printk(" - using ISA IRQ %d\n", dev->irq);
410 acpi_register_gsi(&dev->dev, dev_gsi,
409 ACPI_LEVEL_SENSITIVE, 411 ACPI_LEVEL_SENSITIVE,
410 ACPI_ACTIVE_LOW); 412 ACPI_ACTIVE_LOW);
411 return 0; 413 return 0;
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
index e8c32a49f14e..66f67293341e 100644
--- a/drivers/acpi/power_meter.c
+++ b/drivers/acpi/power_meter.c
@@ -35,7 +35,7 @@
35#define ACPI_POWER_METER_NAME "power_meter" 35#define ACPI_POWER_METER_NAME "power_meter"
36ACPI_MODULE_NAME(ACPI_POWER_METER_NAME); 36ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
37#define ACPI_POWER_METER_DEVICE_NAME "Power Meter" 37#define ACPI_POWER_METER_DEVICE_NAME "Power Meter"
38#define ACPI_POWER_METER_CLASS "power_meter_resource" 38#define ACPI_POWER_METER_CLASS "pwr_meter_resource"
39 39
40#define NUM_SENSORS 17 40#define NUM_SENSORS 17
41 41
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index 36704b887ccf..f8be23b6c129 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -18,7 +18,7 @@
18 18
19#define PREFIX "ACPI: " 19#define PREFIX "ACPI: "
20 20
21#define ACPI_SMB_HC_CLASS "smbus_host_controller" 21#define ACPI_SMB_HC_CLASS "smbus_host_ctl"
22#define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC" 22#define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC"
23 23
24struct acpi_smb_hc { 24struct acpi_smb_hc {
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index f74834a544fd..baa76bbf244a 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -450,6 +450,38 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
450 }, 450 },
451 }, 451 },
452 { 452 {
453 .callback = init_set_sci_en_on_resume,
454 .ident = "Lenovo ThinkPad T410",
455 .matches = {
456 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
457 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T410"),
458 },
459 },
460 {
461 .callback = init_set_sci_en_on_resume,
462 .ident = "Lenovo ThinkPad T510",
463 .matches = {
464 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
465 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T510"),
466 },
467 },
468 {
469 .callback = init_set_sci_en_on_resume,
470 .ident = "Lenovo ThinkPad W510",
471 .matches = {
472 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
473 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W510"),
474 },
475 },
476 {
477 .callback = init_set_sci_en_on_resume,
478 .ident = "Lenovo ThinkPad X201[s]",
479 .matches = {
480 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
481 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201"),
482 },
483 },
484 {
453 .callback = init_old_suspend_ordering, 485 .callback = init_old_suspend_ordering,
454 .ident = "Panasonic CF51-2L", 486 .ident = "Panasonic CF51-2L",
455 .matches = { 487 .matches = {
@@ -458,6 +490,30 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
458 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), 490 DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"),
459 }, 491 },
460 }, 492 },
493 {
494 .callback = init_set_sci_en_on_resume,
495 .ident = "Dell Studio 1558",
496 .matches = {
497 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
498 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1558"),
499 },
500 },
501 {
502 .callback = init_set_sci_en_on_resume,
503 .ident = "Dell Studio 1557",
504 .matches = {
505 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
506 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1557"),
507 },
508 },
509 {
510 .callback = init_set_sci_en_on_resume,
511 .ident = "Dell Studio 1555",
512 .matches = {
513 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
514 DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1555"),
515 },
516 },
461 {}, 517 {},
462}; 518};
463#endif /* CONFIG_SUSPEND */ 519#endif /* CONFIG_SUSPEND */
diff --git a/drivers/base/iommu.c b/drivers/base/iommu.c
index 8ad4ffea6920..6e6b6a11b3ce 100644
--- a/drivers/base/iommu.c
+++ b/drivers/base/iommu.c
@@ -80,20 +80,6 @@ void iommu_detach_device(struct iommu_domain *domain, struct device *dev)
80} 80}
81EXPORT_SYMBOL_GPL(iommu_detach_device); 81EXPORT_SYMBOL_GPL(iommu_detach_device);
82 82
83int iommu_map_range(struct iommu_domain *domain, unsigned long iova,
84 phys_addr_t paddr, size_t size, int prot)
85{
86 return iommu_ops->map(domain, iova, paddr, size, prot);
87}
88EXPORT_SYMBOL_GPL(iommu_map_range);
89
90void iommu_unmap_range(struct iommu_domain *domain, unsigned long iova,
91 size_t size)
92{
93 iommu_ops->unmap(domain, iova, size);
94}
95EXPORT_SYMBOL_GPL(iommu_unmap_range);
96
97phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 83phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
98 unsigned long iova) 84 unsigned long iova)
99{ 85{
@@ -107,3 +93,32 @@ int iommu_domain_has_cap(struct iommu_domain *domain,
107 return iommu_ops->domain_has_cap(domain, cap); 93 return iommu_ops->domain_has_cap(domain, cap);
108} 94}
109EXPORT_SYMBOL_GPL(iommu_domain_has_cap); 95EXPORT_SYMBOL_GPL(iommu_domain_has_cap);
96
97int iommu_map(struct iommu_domain *domain, unsigned long iova,
98 phys_addr_t paddr, int gfp_order, int prot)
99{
100 unsigned long invalid_mask;
101 size_t size;
102
103 size = 0x1000UL << gfp_order;
104 invalid_mask = size - 1;
105
106 BUG_ON((iova | paddr) & invalid_mask);
107
108 return iommu_ops->map(domain, iova, paddr, gfp_order, prot);
109}
110EXPORT_SYMBOL_GPL(iommu_map);
111
112int iommu_unmap(struct iommu_domain *domain, unsigned long iova, int gfp_order)
113{
114 unsigned long invalid_mask;
115 size_t size;
116
117 size = 0x1000UL << gfp_order;
118 invalid_mask = size - 1;
119
120 BUG_ON(iova & invalid_mask);
121
122 return iommu_ops->unmap(domain, iova, gfp_order);
123}
124EXPORT_SYMBOL_GPL(iommu_unmap);
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 4b4b565c835f..c5fbe198fbdb 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(platform_device_alloc);
187 * released. 187 * released.
188 */ 188 */
189int platform_device_add_resources(struct platform_device *pdev, 189int platform_device_add_resources(struct platform_device *pdev,
190 struct resource *res, unsigned int num) 190 const struct resource *res, unsigned int num)
191{ 191{
192 struct resource *r; 192 struct resource *r;
193 193
@@ -367,7 +367,7 @@ EXPORT_SYMBOL_GPL(platform_device_unregister);
367 */ 367 */
368struct platform_device *platform_device_register_simple(const char *name, 368struct platform_device *platform_device_register_simple(const char *name,
369 int id, 369 int id,
370 struct resource *res, 370 const struct resource *res,
371 unsigned int num) 371 unsigned int num)
372{ 372{
373 struct platform_device *pdev; 373 struct platform_device *pdev;
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 0182a22c423a..832798aa14f6 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -66,6 +66,7 @@
66#include <linux/blkdev.h> 66#include <linux/blkdev.h>
67#include <linux/elevator.h> 67#include <linux/elevator.h>
68#include <linux/interrupt.h> 68#include <linux/interrupt.h>
69#include <linux/platform_device.h>
69 70
70#include <asm/setup.h> 71#include <asm/setup.h>
71#include <asm/uaccess.h> 72#include <asm/uaccess.h>
@@ -1696,34 +1697,18 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
1696 return get_disk(unit[drive].gendisk); 1697 return get_disk(unit[drive].gendisk);
1697} 1698}
1698 1699
1699static int __init amiga_floppy_init(void) 1700static int __init amiga_floppy_probe(struct platform_device *pdev)
1700{ 1701{
1701 int i, ret; 1702 int i, ret;
1702 1703
1703 if (!MACH_IS_AMIGA)
1704 return -ENODEV;
1705
1706 if (!AMIGAHW_PRESENT(AMI_FLOPPY))
1707 return -ENODEV;
1708
1709 if (register_blkdev(FLOPPY_MAJOR,"fd")) 1704 if (register_blkdev(FLOPPY_MAJOR,"fd"))
1710 return -EBUSY; 1705 return -EBUSY;
1711 1706
1712 /*
1713 * We request DSKPTR, DSKLEN and DSKDATA only, because the other
1714 * floppy registers are too spreaded over the custom register space
1715 */
1716 ret = -EBUSY;
1717 if (!request_mem_region(CUSTOM_PHYSADDR+0x20, 8, "amiflop [Paula]")) {
1718 printk("fd: cannot get floppy registers\n");
1719 goto out_blkdev;
1720 }
1721
1722 ret = -ENOMEM; 1707 ret = -ENOMEM;
1723 if ((raw_buf = (char *)amiga_chip_alloc (RAW_BUF_SIZE, "Floppy")) == 1708 if ((raw_buf = (char *)amiga_chip_alloc (RAW_BUF_SIZE, "Floppy")) ==
1724 NULL) { 1709 NULL) {
1725 printk("fd: cannot get chip mem buffer\n"); 1710 printk("fd: cannot get chip mem buffer\n");
1726 goto out_memregion; 1711 goto out_blkdev;
1727 } 1712 }
1728 1713
1729 ret = -EBUSY; 1714 ret = -EBUSY;
@@ -1792,18 +1777,13 @@ out_irq2:
1792 free_irq(IRQ_AMIGA_DSKBLK, NULL); 1777 free_irq(IRQ_AMIGA_DSKBLK, NULL);
1793out_irq: 1778out_irq:
1794 amiga_chip_free(raw_buf); 1779 amiga_chip_free(raw_buf);
1795out_memregion:
1796 release_mem_region(CUSTOM_PHYSADDR+0x20, 8);
1797out_blkdev: 1780out_blkdev:
1798 unregister_blkdev(FLOPPY_MAJOR,"fd"); 1781 unregister_blkdev(FLOPPY_MAJOR,"fd");
1799 return ret; 1782 return ret;
1800} 1783}
1801 1784
1802module_init(amiga_floppy_init);
1803#ifdef MODULE
1804
1805#if 0 /* not safe to unload */ 1785#if 0 /* not safe to unload */
1806void cleanup_module(void) 1786static int __exit amiga_floppy_remove(struct platform_device *pdev)
1807{ 1787{
1808 int i; 1788 int i;
1809 1789
@@ -1820,12 +1800,25 @@ void cleanup_module(void)
1820 custom.dmacon = DMAF_DISK; /* disable DMA */ 1800 custom.dmacon = DMAF_DISK; /* disable DMA */
1821 amiga_chip_free(raw_buf); 1801 amiga_chip_free(raw_buf);
1822 blk_cleanup_queue(floppy_queue); 1802 blk_cleanup_queue(floppy_queue);
1823 release_mem_region(CUSTOM_PHYSADDR+0x20, 8);
1824 unregister_blkdev(FLOPPY_MAJOR, "fd"); 1803 unregister_blkdev(FLOPPY_MAJOR, "fd");
1825} 1804}
1826#endif 1805#endif
1827 1806
1828#else 1807static struct platform_driver amiga_floppy_driver = {
1808 .driver = {
1809 .name = "amiga-floppy",
1810 .owner = THIS_MODULE,
1811 },
1812};
1813
1814static int __init amiga_floppy_init(void)
1815{
1816 return platform_driver_probe(&amiga_floppy_driver, amiga_floppy_probe);
1817}
1818
1819module_init(amiga_floppy_init);
1820
1821#ifndef MODULE
1829static int __init amiga_floppy_setup (char *str) 1822static int __init amiga_floppy_setup (char *str)
1830{ 1823{
1831 int n; 1824 int n;
@@ -1840,3 +1833,5 @@ static int __init amiga_floppy_setup (char *str)
1840 1833
1841__setup("floppy=", amiga_floppy_setup); 1834__setup("floppy=", amiga_floppy_setup);
1842#endif 1835#endif
1836
1837MODULE_ALIAS("platform:amiga-floppy");
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 44bf6d11197e..d48a1dfd7b24 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -235,7 +235,7 @@ void drbd_endio_pri(struct bio *bio, int error)
235 if (unlikely(error)) { 235 if (unlikely(error)) {
236 what = (bio_data_dir(bio) == WRITE) 236 what = (bio_data_dir(bio) == WRITE)
237 ? write_completed_with_error 237 ? write_completed_with_error
238 : (bio_rw(bio) == READA) 238 : (bio_rw(bio) == READ)
239 ? read_completed_with_error 239 ? read_completed_with_error
240 : read_ahead_completed_with_error; 240 : read_ahead_completed_with_error;
241 } else 241 } else
diff --git a/drivers/block/hd.c b/drivers/block/hd.c
index 034e6dfc878c..81c78b3ce2df 100644
--- a/drivers/block/hd.c
+++ b/drivers/block/hd.c
@@ -164,12 +164,12 @@ unsigned long read_timer(void)
164 unsigned long t, flags; 164 unsigned long t, flags;
165 int i; 165 int i;
166 166
167 spin_lock_irqsave(&i8253_lock, flags); 167 raw_spin_lock_irqsave(&i8253_lock, flags);
168 t = jiffies * 11932; 168 t = jiffies * 11932;
169 outb_p(0, 0x43); 169 outb_p(0, 0x43);
170 i = inb_p(0x40); 170 i = inb_p(0x40);
171 i |= inb(0x40) << 8; 171 i |= inb(0x40) << 8;
172 spin_unlock_irqrestore(&i8253_lock, flags); 172 raw_spin_unlock_irqrestore(&i8253_lock, flags);
173 return(t - i); 173 return(t - i);
174} 174}
175#endif 175#endif
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c
index 8dfd24721a82..78a62ebe75c7 100644
--- a/drivers/char/serial167.c
+++ b/drivers/char/serial167.c
@@ -627,7 +627,6 @@ static irqreturn_t cd2401_rx_interrupt(int irq, void *dev_id)
627 char data; 627 char data;
628 int char_count; 628 int char_count;
629 int save_cnt; 629 int save_cnt;
630 int len;
631 630
632 /* determine the channel and change to that context */ 631 /* determine the channel and change to that context */
633 channel = (u_short) (base_addr[CyLICR] >> 2); 632 channel = (u_short) (base_addr[CyLICR] >> 2);
@@ -1528,7 +1527,6 @@ static int
1528cy_ioctl(struct tty_struct *tty, struct file *file, 1527cy_ioctl(struct tty_struct *tty, struct file *file,
1529 unsigned int cmd, unsigned long arg) 1528 unsigned int cmd, unsigned long arg)
1530{ 1529{
1531 unsigned long val;
1532 struct cyclades_port *info = tty->driver_data; 1530 struct cyclades_port *info = tty->driver_data;
1533 int ret_val = 0; 1531 int ret_val = 0;
1534 void __user *argp = (void __user *)arg; 1532 void __user *argp = (void __user *)arg;
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 6da962c9b21c..d71f0fc34b46 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1875,6 +1875,7 @@ got_driver:
1875 */ 1875 */
1876 if (filp->f_op == &hung_up_tty_fops) 1876 if (filp->f_op == &hung_up_tty_fops)
1877 filp->f_op = &tty_fops; 1877 filp->f_op = &tty_fops;
1878 unlock_kernel();
1878 goto retry_open; 1879 goto retry_open;
1879 } 1880 }
1880 unlock_kernel(); 1881 unlock_kernel();
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 75d293eeb3ee..063b2184caf5 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -662,32 +662,20 @@ static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
662 return sprintf(buf, "%u\n", policy->cpuinfo.max_freq); 662 return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
663} 663}
664 664
665#define define_one_ro(_name) \ 665cpufreq_freq_attr_ro_perm(cpuinfo_cur_freq, 0400);
666static struct freq_attr _name = \ 666cpufreq_freq_attr_ro(cpuinfo_min_freq);
667__ATTR(_name, 0444, show_##_name, NULL) 667cpufreq_freq_attr_ro(cpuinfo_max_freq);
668 668cpufreq_freq_attr_ro(cpuinfo_transition_latency);
669#define define_one_ro0400(_name) \ 669cpufreq_freq_attr_ro(scaling_available_governors);
670static struct freq_attr _name = \ 670cpufreq_freq_attr_ro(scaling_driver);
671__ATTR(_name, 0400, show_##_name, NULL) 671cpufreq_freq_attr_ro(scaling_cur_freq);
672 672cpufreq_freq_attr_ro(bios_limit);
673#define define_one_rw(_name) \ 673cpufreq_freq_attr_ro(related_cpus);
674static struct freq_attr _name = \ 674cpufreq_freq_attr_ro(affected_cpus);
675__ATTR(_name, 0644, show_##_name, store_##_name) 675cpufreq_freq_attr_rw(scaling_min_freq);
676 676cpufreq_freq_attr_rw(scaling_max_freq);
677define_one_ro0400(cpuinfo_cur_freq); 677cpufreq_freq_attr_rw(scaling_governor);
678define_one_ro(cpuinfo_min_freq); 678cpufreq_freq_attr_rw(scaling_setspeed);
679define_one_ro(cpuinfo_max_freq);
680define_one_ro(cpuinfo_transition_latency);
681define_one_ro(scaling_available_governors);
682define_one_ro(scaling_driver);
683define_one_ro(scaling_cur_freq);
684define_one_ro(bios_limit);
685define_one_ro(related_cpus);
686define_one_ro(affected_cpus);
687define_one_rw(scaling_min_freq);
688define_one_rw(scaling_max_freq);
689define_one_rw(scaling_governor);
690define_one_rw(scaling_setspeed);
691 679
692static struct attribute *default_attrs[] = { 680static struct attribute *default_attrs[] = {
693 &cpuinfo_min_freq.attr, 681 &cpuinfo_min_freq.attr,
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 3a147874a465..526bfbf69611 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -178,12 +178,8 @@ static ssize_t show_sampling_rate_min(struct kobject *kobj,
178 return sprintf(buf, "%u\n", min_sampling_rate); 178 return sprintf(buf, "%u\n", min_sampling_rate);
179} 179}
180 180
181#define define_one_ro(_name) \ 181define_one_global_ro(sampling_rate_max);
182static struct global_attr _name = \ 182define_one_global_ro(sampling_rate_min);
183__ATTR(_name, 0444, show_##_name, NULL)
184
185define_one_ro(sampling_rate_max);
186define_one_ro(sampling_rate_min);
187 183
188/* cpufreq_conservative Governor Tunables */ 184/* cpufreq_conservative Governor Tunables */
189#define show_one(file_name, object) \ 185#define show_one(file_name, object) \
@@ -221,12 +217,8 @@ show_one_old(freq_step);
221show_one_old(sampling_rate_min); 217show_one_old(sampling_rate_min);
222show_one_old(sampling_rate_max); 218show_one_old(sampling_rate_max);
223 219
224#define define_one_ro_old(object, _name) \ 220cpufreq_freq_attr_ro_old(sampling_rate_min);
225static struct freq_attr object = \ 221cpufreq_freq_attr_ro_old(sampling_rate_max);
226__ATTR(_name, 0444, show_##_name##_old, NULL)
227
228define_one_ro_old(sampling_rate_min_old, sampling_rate_min);
229define_one_ro_old(sampling_rate_max_old, sampling_rate_max);
230 222
231/*** delete after deprecation time ***/ 223/*** delete after deprecation time ***/
232 224
@@ -364,16 +356,12 @@ static ssize_t store_freq_step(struct kobject *a, struct attribute *b,
364 return count; 356 return count;
365} 357}
366 358
367#define define_one_rw(_name) \ 359define_one_global_rw(sampling_rate);
368static struct global_attr _name = \ 360define_one_global_rw(sampling_down_factor);
369__ATTR(_name, 0644, show_##_name, store_##_name) 361define_one_global_rw(up_threshold);
370 362define_one_global_rw(down_threshold);
371define_one_rw(sampling_rate); 363define_one_global_rw(ignore_nice_load);
372define_one_rw(sampling_down_factor); 364define_one_global_rw(freq_step);
373define_one_rw(up_threshold);
374define_one_rw(down_threshold);
375define_one_rw(ignore_nice_load);
376define_one_rw(freq_step);
377 365
378static struct attribute *dbs_attributes[] = { 366static struct attribute *dbs_attributes[] = {
379 &sampling_rate_max.attr, 367 &sampling_rate_max.attr,
@@ -409,16 +397,12 @@ write_one_old(down_threshold);
409write_one_old(ignore_nice_load); 397write_one_old(ignore_nice_load);
410write_one_old(freq_step); 398write_one_old(freq_step);
411 399
412#define define_one_rw_old(object, _name) \ 400cpufreq_freq_attr_rw_old(sampling_rate);
413static struct freq_attr object = \ 401cpufreq_freq_attr_rw_old(sampling_down_factor);
414__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old) 402cpufreq_freq_attr_rw_old(up_threshold);
415 403cpufreq_freq_attr_rw_old(down_threshold);
416define_one_rw_old(sampling_rate_old, sampling_rate); 404cpufreq_freq_attr_rw_old(ignore_nice_load);
417define_one_rw_old(sampling_down_factor_old, sampling_down_factor); 405cpufreq_freq_attr_rw_old(freq_step);
418define_one_rw_old(up_threshold_old, up_threshold);
419define_one_rw_old(down_threshold_old, down_threshold);
420define_one_rw_old(ignore_nice_load_old, ignore_nice_load);
421define_one_rw_old(freq_step_old, freq_step);
422 406
423static struct attribute *dbs_attributes_old[] = { 407static struct attribute *dbs_attributes_old[] = {
424 &sampling_rate_max_old.attr, 408 &sampling_rate_max_old.attr,
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 8e9dbdc6c700..e1314212d8d4 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -246,12 +246,8 @@ static ssize_t show_sampling_rate_min(struct kobject *kobj,
246 return sprintf(buf, "%u\n", min_sampling_rate); 246 return sprintf(buf, "%u\n", min_sampling_rate);
247} 247}
248 248
249#define define_one_ro(_name) \ 249define_one_global_ro(sampling_rate_max);
250static struct global_attr _name = \ 250define_one_global_ro(sampling_rate_min);
251__ATTR(_name, 0444, show_##_name, NULL)
252
253define_one_ro(sampling_rate_max);
254define_one_ro(sampling_rate_min);
255 251
256/* cpufreq_ondemand Governor Tunables */ 252/* cpufreq_ondemand Governor Tunables */
257#define show_one(file_name, object) \ 253#define show_one(file_name, object) \
@@ -287,12 +283,8 @@ show_one_old(powersave_bias);
287show_one_old(sampling_rate_min); 283show_one_old(sampling_rate_min);
288show_one_old(sampling_rate_max); 284show_one_old(sampling_rate_max);
289 285
290#define define_one_ro_old(object, _name) \ 286cpufreq_freq_attr_ro_old(sampling_rate_min);
291static struct freq_attr object = \ 287cpufreq_freq_attr_ro_old(sampling_rate_max);
292__ATTR(_name, 0444, show_##_name##_old, NULL)
293
294define_one_ro_old(sampling_rate_min_old, sampling_rate_min);
295define_one_ro_old(sampling_rate_max_old, sampling_rate_max);
296 288
297/*** delete after deprecation time ***/ 289/*** delete after deprecation time ***/
298 290
@@ -406,15 +398,11 @@ static ssize_t store_powersave_bias(struct kobject *a, struct attribute *b,
406 return count; 398 return count;
407} 399}
408 400
409#define define_one_rw(_name) \ 401define_one_global_rw(sampling_rate);
410static struct global_attr _name = \ 402define_one_global_rw(io_is_busy);
411__ATTR(_name, 0644, show_##_name, store_##_name) 403define_one_global_rw(up_threshold);
412 404define_one_global_rw(ignore_nice_load);
413define_one_rw(sampling_rate); 405define_one_global_rw(powersave_bias);
414define_one_rw(io_is_busy);
415define_one_rw(up_threshold);
416define_one_rw(ignore_nice_load);
417define_one_rw(powersave_bias);
418 406
419static struct attribute *dbs_attributes[] = { 407static struct attribute *dbs_attributes[] = {
420 &sampling_rate_max.attr, 408 &sampling_rate_max.attr,
@@ -447,14 +435,10 @@ write_one_old(up_threshold);
447write_one_old(ignore_nice_load); 435write_one_old(ignore_nice_load);
448write_one_old(powersave_bias); 436write_one_old(powersave_bias);
449 437
450#define define_one_rw_old(object, _name) \ 438cpufreq_freq_attr_rw_old(sampling_rate);
451static struct freq_attr object = \ 439cpufreq_freq_attr_rw_old(up_threshold);
452__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old) 440cpufreq_freq_attr_rw_old(ignore_nice_load);
453 441cpufreq_freq_attr_rw_old(powersave_bias);
454define_one_rw_old(sampling_rate_old, sampling_rate);
455define_one_rw_old(up_threshold_old, up_threshold);
456define_one_rw_old(ignore_nice_load_old, ignore_nice_load);
457define_one_rw_old(powersave_bias_old, powersave_bias);
458 442
459static struct attribute *dbs_attributes_old[] = { 443static struct attribute *dbs_attributes_old[] = {
460 &sampling_rate_max_old.attr, 444 &sampling_rate_max_old.attr,
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 1aea7157d8ff..f8e57c6303f2 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -100,7 +100,6 @@ struct menu_device {
100 int needs_update; 100 int needs_update;
101 101
102 unsigned int expected_us; 102 unsigned int expected_us;
103 unsigned int measured_us;
104 u64 predicted_us; 103 u64 predicted_us;
105 unsigned int exit_us; 104 unsigned int exit_us;
106 unsigned int bucket; 105 unsigned int bucket;
@@ -187,14 +186,14 @@ static int menu_select(struct cpuidle_device *dev)
187 int i; 186 int i;
188 int multiplier; 187 int multiplier;
189 188
190 data->last_state_idx = 0;
191 data->exit_us = 0;
192
193 if (data->needs_update) { 189 if (data->needs_update) {
194 menu_update(dev); 190 menu_update(dev);
195 data->needs_update = 0; 191 data->needs_update = 0;
196 } 192 }
197 193
194 data->last_state_idx = 0;
195 data->exit_us = 0;
196
198 /* Special case when user has set very strict latency requirement */ 197 /* Special case when user has set very strict latency requirement */
199 if (unlikely(latency_req == 0)) 198 if (unlikely(latency_req == 0))
200 return 0; 199 return 0;
@@ -294,7 +293,7 @@ static void menu_update(struct cpuidle_device *dev)
294 new_factor = data->correction_factor[data->bucket] 293 new_factor = data->correction_factor[data->bucket]
295 * (DECAY - 1) / DECAY; 294 * (DECAY - 1) / DECAY;
296 295
297 if (data->expected_us > 0 && data->measured_us < MAX_INTERESTING) 296 if (data->expected_us > 0 && measured_us < MAX_INTERESTING)
298 new_factor += RESOLUTION * measured_us / data->expected_us; 297 new_factor += RESOLUTION * measured_us / data->expected_us;
299 else 298 else
300 /* 299 /*
diff --git a/drivers/dma/shdma.c b/drivers/dma/shdma.c
index 7cc31b3f40d8..6f25a20de99f 100644
--- a/drivers/dma/shdma.c
+++ b/drivers/dma/shdma.c
@@ -290,6 +290,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
290 struct sh_dmae_chan *sh_chan = to_sh_chan(chan); 290 struct sh_dmae_chan *sh_chan = to_sh_chan(chan);
291 struct sh_desc *desc; 291 struct sh_desc *desc;
292 struct sh_dmae_slave *param = chan->private; 292 struct sh_dmae_slave *param = chan->private;
293 int ret;
293 294
294 pm_runtime_get_sync(sh_chan->dev); 295 pm_runtime_get_sync(sh_chan->dev);
295 296
@@ -301,11 +302,15 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
301 struct sh_dmae_slave_config *cfg; 302 struct sh_dmae_slave_config *cfg;
302 303
303 cfg = sh_dmae_find_slave(sh_chan, param->slave_id); 304 cfg = sh_dmae_find_slave(sh_chan, param->slave_id);
304 if (!cfg) 305 if (!cfg) {
305 return -EINVAL; 306 ret = -EINVAL;
307 goto efindslave;
308 }
306 309
307 if (test_and_set_bit(param->slave_id, sh_dmae_slave_used)) 310 if (test_and_set_bit(param->slave_id, sh_dmae_slave_used)) {
308 return -EBUSY; 311 ret = -EBUSY;
312 goto etestused;
313 }
309 314
310 param->config = cfg; 315 param->config = cfg;
311 316
@@ -334,10 +339,20 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
334 } 339 }
335 spin_unlock_bh(&sh_chan->desc_lock); 340 spin_unlock_bh(&sh_chan->desc_lock);
336 341
337 if (!sh_chan->descs_allocated) 342 if (!sh_chan->descs_allocated) {
338 pm_runtime_put(sh_chan->dev); 343 ret = -ENOMEM;
344 goto edescalloc;
345 }
339 346
340 return sh_chan->descs_allocated; 347 return sh_chan->descs_allocated;
348
349edescalloc:
350 if (param)
351 clear_bit(param->slave_id, sh_dmae_slave_used);
352etestused:
353efindslave:
354 pm_runtime_put(sh_chan->dev);
355 return ret;
341} 356}
342 357
343/* 358/*
diff --git a/drivers/gpio/it8761e_gpio.c b/drivers/gpio/it8761e_gpio.c
index 753219cf993a..41a9388f2fde 100644
--- a/drivers/gpio/it8761e_gpio.c
+++ b/drivers/gpio/it8761e_gpio.c
@@ -80,8 +80,8 @@ static int it8761e_gpio_get(struct gpio_chip *gc, unsigned gpio_num)
80 u16 reg; 80 u16 reg;
81 u8 bit; 81 u8 bit;
82 82
83 bit = gpio_num % 7; 83 bit = gpio_num % 8;
84 reg = (gpio_num >= 7) ? gpio_ba + 1 : gpio_ba; 84 reg = (gpio_num >= 8) ? gpio_ba + 1 : gpio_ba;
85 85
86 return !!(inb(reg) & (1 << bit)); 86 return !!(inb(reg) & (1 << bit));
87} 87}
@@ -91,8 +91,8 @@ static int it8761e_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num)
91 u8 curr_dirs; 91 u8 curr_dirs;
92 u8 io_reg, bit; 92 u8 io_reg, bit;
93 93
94 bit = gpio_num % 7; 94 bit = gpio_num % 8;
95 io_reg = (gpio_num >= 7) ? GPIO2X_IO : GPIO1X_IO; 95 io_reg = (gpio_num >= 8) ? GPIO2X_IO : GPIO1X_IO;
96 96
97 spin_lock(&sio_lock); 97 spin_lock(&sio_lock);
98 98
@@ -116,8 +116,8 @@ static void it8761e_gpio_set(struct gpio_chip *gc,
116 u8 curr_vals, bit; 116 u8 curr_vals, bit;
117 u16 reg; 117 u16 reg;
118 118
119 bit = gpio_num % 7; 119 bit = gpio_num % 8;
120 reg = (gpio_num >= 7) ? gpio_ba + 1 : gpio_ba; 120 reg = (gpio_num >= 8) ? gpio_ba + 1 : gpio_ba;
121 121
122 spin_lock(&sio_lock); 122 spin_lock(&sio_lock);
123 123
@@ -135,8 +135,8 @@ static int it8761e_gpio_direction_out(struct gpio_chip *gc,
135{ 135{
136 u8 curr_dirs, io_reg, bit; 136 u8 curr_dirs, io_reg, bit;
137 137
138 bit = gpio_num % 7; 138 bit = gpio_num % 8;
139 io_reg = (gpio_num >= 7) ? GPIO2X_IO : GPIO1X_IO; 139 io_reg = (gpio_num >= 8) ? GPIO2X_IO : GPIO1X_IO;
140 140
141 it8761e_gpio_set(gc, gpio_num, val); 141 it8761e_gpio_set(gc, gpio_num, val);
142 142
@@ -200,7 +200,7 @@ static int __init it8761e_gpio_init(void)
200 return -EBUSY; 200 return -EBUSY;
201 201
202 it8761e_gpio_chip.base = -1; 202 it8761e_gpio_chip.base = -1;
203 it8761e_gpio_chip.ngpio = 14; 203 it8761e_gpio_chip.ngpio = 16;
204 204
205 err = gpiochip_add(&it8761e_gpio_chip); 205 err = gpiochip_add(&it8761e_gpio_chip);
206 if (err < 0) 206 if (err < 0)
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 2b8b969d0c15..df6a9cd82c4d 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -456,11 +456,15 @@ i915_error_object_create(struct drm_device *dev,
456 456
457 for (page = 0; page < page_count; page++) { 457 for (page = 0; page < page_count; page++) {
458 void *s, *d = kmalloc(PAGE_SIZE, GFP_ATOMIC); 458 void *s, *d = kmalloc(PAGE_SIZE, GFP_ATOMIC);
459 unsigned long flags;
460
459 if (d == NULL) 461 if (d == NULL)
460 goto unwind; 462 goto unwind;
461 s = kmap_atomic(src_priv->pages[page], KM_USER0); 463 local_irq_save(flags);
464 s = kmap_atomic(src_priv->pages[page], KM_IRQ0);
462 memcpy(d, s, PAGE_SIZE); 465 memcpy(d, s, PAGE_SIZE);
463 kunmap_atomic(s, KM_USER0); 466 kunmap_atomic(s, KM_IRQ0);
467 local_irq_restore(flags);
464 dst->pages[page] = d; 468 dst->pages[page] = d;
465 } 469 }
466 dst->page_count = page_count; 470 dst->page_count = page_count;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 4b05563d99e1..b3749d47be7b 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -216,6 +216,7 @@ static struct drm_driver driver_old = {
216 .mmap = drm_mmap, 216 .mmap = drm_mmap,
217 .poll = drm_poll, 217 .poll = drm_poll,
218 .fasync = drm_fasync, 218 .fasync = drm_fasync,
219 .read = drm_read,
219#ifdef CONFIG_COMPAT 220#ifdef CONFIG_COMPAT
220 .compat_ioctl = radeon_compat_ioctl, 221 .compat_ioctl = radeon_compat_ioctl,
221#endif 222#endif
@@ -304,6 +305,7 @@ static struct drm_driver kms_driver = {
304 .mmap = radeon_mmap, 305 .mmap = radeon_mmap,
305 .poll = drm_poll, 306 .poll = drm_poll,
306 .fasync = drm_fasync, 307 .fasync = drm_fasync,
308 .read = drm_read,
307#ifdef CONFIG_COMPAT 309#ifdef CONFIG_COMPAT
308 .compat_ioctl = radeon_kms_compat_ioctl, 310 .compat_ioctl = radeon_kms_compat_ioctl,
309#endif 311#endif
diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c
index 40ab6d9c3736..cc5316dcf580 100644
--- a/drivers/gpu/drm/radeon/radeon_state.c
+++ b/drivers/gpu/drm/radeon/radeon_state.c
@@ -424,7 +424,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
424 if ((*cmd & RADEON_GMC_SRC_PITCH_OFFSET_CNTL) && 424 if ((*cmd & RADEON_GMC_SRC_PITCH_OFFSET_CNTL) &&
425 (*cmd & RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { 425 (*cmd & RADEON_GMC_DST_PITCH_OFFSET_CNTL)) {
426 u32 *cmd3 = drm_buffer_pointer_to_dword(cmdbuf->buffer, 3); 426 u32 *cmd3 = drm_buffer_pointer_to_dword(cmdbuf->buffer, 3);
427 offset = *cmd << 10; 427 offset = *cmd3 << 10;
428 if (radeon_check_and_fixup_offset 428 if (radeon_check_and_fixup_offset
429 (dev_priv, file_priv, &offset)) { 429 (dev_priv, file_priv, &offset)) {
430 DRM_ERROR("Invalid second packet offset\n"); 430 DRM_ERROR("Invalid second packet offset\n");
@@ -2895,9 +2895,12 @@ static int radeon_cp_cmdbuf(struct drm_device *dev, void *data,
2895 return rv; 2895 return rv;
2896 rv = drm_buffer_copy_from_user(cmdbuf->buffer, buffer, 2896 rv = drm_buffer_copy_from_user(cmdbuf->buffer, buffer,
2897 cmdbuf->bufsz); 2897 cmdbuf->bufsz);
2898 if (rv) 2898 if (rv) {
2899 drm_buffer_free(cmdbuf->buffer);
2899 return rv; 2900 return rv;
2900 } 2901 }
2902 } else
2903 goto done;
2901 2904
2902 orig_nbox = cmdbuf->nbox; 2905 orig_nbox = cmdbuf->nbox;
2903 2906
@@ -2905,8 +2908,7 @@ static int radeon_cp_cmdbuf(struct drm_device *dev, void *data,
2905 int temp; 2908 int temp;
2906 temp = r300_do_cp_cmdbuf(dev, file_priv, cmdbuf); 2909 temp = r300_do_cp_cmdbuf(dev, file_priv, cmdbuf);
2907 2910
2908 if (cmdbuf->bufsz != 0) 2911 drm_buffer_free(cmdbuf->buffer);
2909 drm_buffer_free(cmdbuf->buffer);
2910 2912
2911 return temp; 2913 return temp;
2912 } 2914 }
@@ -3012,16 +3014,15 @@ static int radeon_cp_cmdbuf(struct drm_device *dev, void *data,
3012 } 3014 }
3013 } 3015 }
3014 3016
3015 if (cmdbuf->bufsz != 0) 3017 drm_buffer_free(cmdbuf->buffer);
3016 drm_buffer_free(cmdbuf->buffer);
3017 3018
3019 done:
3018 DRM_DEBUG("DONE\n"); 3020 DRM_DEBUG("DONE\n");
3019 COMMIT_RING(); 3021 COMMIT_RING();
3020 return 0; 3022 return 0;
3021 3023
3022 err: 3024 err:
3023 if (cmdbuf->bufsz != 0) 3025 drm_buffer_free(cmdbuf->buffer);
3024 drm_buffer_free(cmdbuf->buffer);
3025 return -EINVAL; 3026 return -EINVAL;
3026} 3027}
3027 3028
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index dd47b2a9a791..0e3754a3a303 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1716,40 +1716,12 @@ int ttm_bo_wait(struct ttm_buffer_object *bo,
1716} 1716}
1717EXPORT_SYMBOL(ttm_bo_wait); 1717EXPORT_SYMBOL(ttm_bo_wait);
1718 1718
1719void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo)
1720{
1721 atomic_set(&bo->reserved, 0);
1722 wake_up_all(&bo->event_queue);
1723}
1724
1725int ttm_bo_block_reservation(struct ttm_buffer_object *bo, bool interruptible,
1726 bool no_wait)
1727{
1728 int ret;
1729
1730 while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) {
1731 if (no_wait)
1732 return -EBUSY;
1733 else if (interruptible) {
1734 ret = wait_event_interruptible
1735 (bo->event_queue, atomic_read(&bo->reserved) == 0);
1736 if (unlikely(ret != 0))
1737 return ret;
1738 } else {
1739 wait_event(bo->event_queue,
1740 atomic_read(&bo->reserved) == 0);
1741 }
1742 }
1743 return 0;
1744}
1745
1746int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait) 1719int ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait)
1747{ 1720{
1748 int ret = 0; 1721 int ret = 0;
1749 1722
1750 /* 1723 /*
1751 * Using ttm_bo_reserve instead of ttm_bo_block_reservation 1724 * Using ttm_bo_reserve makes sure the lru lists are updated.
1752 * makes sure the lru lists are updated.
1753 */ 1725 */
1754 1726
1755 ret = ttm_bo_reserve(bo, true, no_wait, false, 0); 1727 ret = ttm_bo_reserve(bo, true, no_wait, false, 0);
diff --git a/drivers/gpu/drm/ttm/ttm_lock.c b/drivers/gpu/drm/ttm/ttm_lock.c
index 3d172ef04ee1..de41e55a944a 100644
--- a/drivers/gpu/drm/ttm/ttm_lock.c
+++ b/drivers/gpu/drm/ttm/ttm_lock.c
@@ -204,7 +204,6 @@ static int __ttm_vt_unlock(struct ttm_lock *lock)
204 lock->flags &= ~TTM_VT_LOCK; 204 lock->flags &= ~TTM_VT_LOCK;
205 wake_up_all(&lock->queue); 205 wake_up_all(&lock->queue);
206 spin_unlock(&lock->lock); 206 spin_unlock(&lock->lock);
207 printk(KERN_INFO TTM_PFX "vt unlock.\n");
208 207
209 return ret; 208 return ret;
210} 209}
@@ -265,10 +264,8 @@ int ttm_vt_lock(struct ttm_lock *lock,
265 ttm_lock_type, &ttm_vt_lock_remove, NULL); 264 ttm_lock_type, &ttm_vt_lock_remove, NULL);
266 if (ret) 265 if (ret)
267 (void)__ttm_vt_unlock(lock); 266 (void)__ttm_vt_unlock(lock);
268 else { 267 else
269 lock->vt_holder = tfile; 268 lock->vt_holder = tfile;
270 printk(KERN_INFO TTM_PFX "vt lock.\n");
271 }
272 269
273 return ret; 270 return ret;
274} 271}
diff --git a/drivers/hid/hid-cherry.c b/drivers/hid/hid-cherry.c
index 7e597d7f770f..24663a8717b1 100644
--- a/drivers/hid/hid-cherry.c
+++ b/drivers/hid/hid-cherry.c
@@ -59,6 +59,7 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
59 59
60static const struct hid_device_id ch_devices[] = { 60static const struct hid_device_id ch_devices[] = {
61 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 61 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
62 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
62 { } 63 { }
63}; 64};
64MODULE_DEVICE_TABLE(hid, ch_devices); 65MODULE_DEVICE_TABLE(hid, ch_devices);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2e2aa759d230..143e788b729b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1043,13 +1043,8 @@ void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1043 1043
1044 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) 1044 if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event)
1045 hid->hiddev_report_event(hid, report); 1045 hid->hiddev_report_event(hid, report);
1046 if (hid->claimed & HID_CLAIMED_HIDRAW) { 1046 if (hid->claimed & HID_CLAIMED_HIDRAW)
1047 /* numbered reports need to be passed with the report num */ 1047 hidraw_report_event(hid, data, size);
1048 if (report_enum->numbered)
1049 hidraw_report_event(hid, data - 1, size + 1);
1050 else
1051 hidraw_report_event(hid, data, size);
1052 }
1053 1048
1054 for (a = 0; a < report->maxfield; a++) 1049 for (a = 0; a < report->maxfield; a++)
1055 hid_input_field(hid, report->field[a], cdata, interrupt); 1050 hid_input_field(hid, report->field[a], cdata, interrupt);
@@ -1296,6 +1291,7 @@ static const struct hid_device_id hid_blacklist[] = {
1296 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1291 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1292 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1298 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1293 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1294 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1295 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1300 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1296 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 797e06470356..09d27649a0f7 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -131,6 +131,7 @@
131 131
132#define USB_VENDOR_ID_CHERRY 0x046a 132#define USB_VENDOR_ID_CHERRY 0x046a
133#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 133#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
134#define USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR 0x0027
134 135
135#define USB_VENDOR_ID_CHIC 0x05fe 136#define USB_VENDOR_ID_CHIC 0x05fe
136#define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014 137#define USB_DEVICE_ID_CHIC_GAMEPAD 0x0014
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 9b24fc510712..4777bbfa1cc2 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * HID driver for N-Trig touchscreens 2 * HID driver for N-Trig touchscreens
3 * 3 *
4 * Copyright (c) 2008 Rafi Rubin 4 * Copyright (c) 2008-2010 Rafi Rubin
5 * Copyright (c) 2009 Stephane Chatty 5 * Copyright (c) 2009-2010 Stephane Chatty
6 * 6 *
7 */ 7 */
8 8
@@ -15,6 +15,8 @@
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/hid.h> 17#include <linux/hid.h>
18#include <linux/usb.h>
19#include "usbhid/usbhid.h"
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/slab.h> 21#include <linux/slab.h>
20 22
@@ -22,17 +24,16 @@
22 24
23#define NTRIG_DUPLICATE_USAGES 0x001 25#define NTRIG_DUPLICATE_USAGES 0x001
24 26
25#define nt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
26 EV_KEY, (c))
27
28struct ntrig_data { 27struct ntrig_data {
29 /* Incoming raw values for a single contact */ 28 /* Incoming raw values for a single contact */
30 __u16 x, y, w, h; 29 __u16 x, y, w, h;
31 __u16 id; 30 __u16 id;
32 __u8 confidence; 31
32 bool tipswitch;
33 bool confidence;
34 bool first_contact_touch;
33 35
34 bool reading_mt; 36 bool reading_mt;
35 __u8 first_contact_confidence;
36 37
37 __u8 mt_footer[4]; 38 __u8 mt_footer[4];
38 __u8 mt_foot_count; 39 __u8 mt_foot_count;
@@ -139,9 +140,10 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
139 case 0xff000001: 140 case 0xff000001:
140 /* Tag indicating the start of a multitouch group */ 141 /* Tag indicating the start of a multitouch group */
141 nd->reading_mt = 1; 142 nd->reading_mt = 1;
142 nd->first_contact_confidence = 0; 143 nd->first_contact_touch = 0;
143 break; 144 break;
144 case HID_DG_TIPSWITCH: 145 case HID_DG_TIPSWITCH:
146 nd->tipswitch = value;
145 /* Prevent emission of touch until validated */ 147 /* Prevent emission of touch until validated */
146 return 1; 148 return 1;
147 case HID_DG_CONFIDENCE: 149 case HID_DG_CONFIDENCE:
@@ -169,8 +171,14 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
169 * to emit a normal (X, Y) position 171 * to emit a normal (X, Y) position
170 */ 172 */
171 if (!nd->reading_mt) { 173 if (!nd->reading_mt) {
174 /*
175 * TipSwitch indicates the presence of a
176 * finger in single touch mode.
177 */
178 input_report_key(input, BTN_TOUCH,
179 nd->tipswitch);
172 input_report_key(input, BTN_TOOL_DOUBLETAP, 180 input_report_key(input, BTN_TOOL_DOUBLETAP,
173 (nd->confidence != 0)); 181 nd->tipswitch);
174 input_event(input, EV_ABS, ABS_X, nd->x); 182 input_event(input, EV_ABS, ABS_X, nd->x);
175 input_event(input, EV_ABS, ABS_Y, nd->y); 183 input_event(input, EV_ABS, ABS_Y, nd->y);
176 } 184 }
@@ -209,7 +217,13 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
209 217
210 /* emit a normal (X, Y) for the first point only */ 218 /* emit a normal (X, Y) for the first point only */
211 if (nd->id == 0) { 219 if (nd->id == 0) {
212 nd->first_contact_confidence = nd->confidence; 220 /*
221 * TipSwitch is superfluous in multitouch
222 * mode. The footer events tell us
223 * if there is a finger on the screen or
224 * not.
225 */
226 nd->first_contact_touch = nd->confidence;
213 input_event(input, EV_ABS, ABS_X, nd->x); 227 input_event(input, EV_ABS, ABS_X, nd->x);
214 input_event(input, EV_ABS, ABS_Y, nd->y); 228 input_event(input, EV_ABS, ABS_Y, nd->y);
215 } 229 }
@@ -239,30 +253,11 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
239 253
240 nd->reading_mt = 0; 254 nd->reading_mt = 0;
241 255
242 if (nd->first_contact_confidence) { 256 if (nd->first_contact_touch) {
243 switch (value) { 257 input_report_key(input, BTN_TOOL_DOUBLETAP, 1);
244 case 0: /* for single touch devices */
245 case 1:
246 input_report_key(input,
247 BTN_TOOL_DOUBLETAP, 1);
248 break;
249 case 2:
250 input_report_key(input,
251 BTN_TOOL_TRIPLETAP, 1);
252 break;
253 case 3:
254 default:
255 input_report_key(input,
256 BTN_TOOL_QUADTAP, 1);
257 }
258 input_report_key(input, BTN_TOUCH, 1); 258 input_report_key(input, BTN_TOUCH, 1);
259 } else { 259 } else {
260 input_report_key(input, 260 input_report_key(input, BTN_TOOL_DOUBLETAP, 0);
261 BTN_TOOL_DOUBLETAP, 0);
262 input_report_key(input,
263 BTN_TOOL_TRIPLETAP, 0);
264 input_report_key(input,
265 BTN_TOOL_QUADTAP, 0);
266 input_report_key(input, BTN_TOUCH, 0); 261 input_report_key(input, BTN_TOUCH, 0);
267 } 262 }
268 break; 263 break;
@@ -286,6 +281,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
286 struct ntrig_data *nd; 281 struct ntrig_data *nd;
287 struct hid_input *hidinput; 282 struct hid_input *hidinput;
288 struct input_dev *input; 283 struct input_dev *input;
284 struct hid_report *report;
289 285
290 if (id->driver_data) 286 if (id->driver_data)
291 hdev->quirks |= HID_QUIRK_MULTI_INPUT; 287 hdev->quirks |= HID_QUIRK_MULTI_INPUT;
@@ -327,13 +323,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
327 __clear_bit(BTN_TOOL_PEN, input->keybit); 323 __clear_bit(BTN_TOOL_PEN, input->keybit);
328 __clear_bit(BTN_TOOL_FINGER, input->keybit); 324 __clear_bit(BTN_TOOL_FINGER, input->keybit);
329 __clear_bit(BTN_0, input->keybit); 325 __clear_bit(BTN_0, input->keybit);
330 /*
331 * A little something special to enable
332 * two and three finger taps.
333 */
334 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); 326 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
335 __set_bit(BTN_TOOL_TRIPLETAP, input->keybit);
336 __set_bit(BTN_TOOL_QUADTAP, input->keybit);
337 /* 327 /*
338 * The physical touchscreen (single touch) 328 * The physical touchscreen (single touch)
339 * input has a value for physical, whereas 329 * input has a value for physical, whereas
@@ -349,6 +339,12 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
349 } 339 }
350 } 340 }
351 341
342 /* This is needed for devices with more recent firmware versions */
343 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
344 if (report)
345 usbhid_submit_report(hdev, report, USB_DIR_OUT);
346
347
352 return 0; 348 return 0;
353err_free: 349err_free:
354 kfree(nd); 350 kfree(nd);
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 7502a4b2fa86..402d5574b574 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -76,7 +76,7 @@ static int sony_set_operational_usb(struct hid_device *hdev)
76 76
77static int sony_set_operational_bt(struct hid_device *hdev) 77static int sony_set_operational_bt(struct hid_device *hdev)
78{ 78{
79 unsigned char buf[] = { 0x53, 0xf4, 0x42, 0x03, 0x00, 0x00 }; 79 unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
80 return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); 80 return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT);
81} 81}
82 82
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index f7700cf49721..f947d8337e21 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -277,7 +277,6 @@ static int __init wacom_init(void)
277 ret = hid_register_driver(&wacom_driver); 277 ret = hid_register_driver(&wacom_driver);
278 if (ret) 278 if (ret)
279 printk(KERN_ERR "can't register wacom driver\n"); 279 printk(KERN_ERR "can't register wacom driver\n");
280 printk(KERN_ERR "wacom driver registered\n");
281 return ret; 280 return ret;
282} 281}
283 282
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 56d06cd8075b..7b85b696fdab 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -999,13 +999,6 @@ static int usbhid_start(struct hid_device *hid)
999 } 999 }
1000 } 1000 }
1001 1001
1002 init_waitqueue_head(&usbhid->wait);
1003 INIT_WORK(&usbhid->reset_work, hid_reset);
1004 INIT_WORK(&usbhid->restart_work, __usbhid_restart_queues);
1005 setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
1006
1007 spin_lock_init(&usbhid->lock);
1008
1009 usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL); 1002 usbhid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
1010 if (!usbhid->urbctrl) { 1003 if (!usbhid->urbctrl) {
1011 ret = -ENOMEM; 1004 ret = -ENOMEM;
@@ -1179,6 +1172,12 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1179 usbhid->intf = intf; 1172 usbhid->intf = intf;
1180 usbhid->ifnum = interface->desc.bInterfaceNumber; 1173 usbhid->ifnum = interface->desc.bInterfaceNumber;
1181 1174
1175 init_waitqueue_head(&usbhid->wait);
1176 INIT_WORK(&usbhid->reset_work, hid_reset);
1177 INIT_WORK(&usbhid->restart_work, __usbhid_restart_queues);
1178 setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
1179 spin_lock_init(&usbhid->lock);
1180
1182 ret = hid_add_device(hid); 1181 ret = hid_add_device(hid);
1183 if (ret) { 1182 if (ret) {
1184 if (ret != -ENODEV) 1183 if (ret != -ENODEV)
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0f28d91f29d8..f085c18d2905 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -195,6 +195,9 @@ static unsigned int applesmc_accelerometer;
195/* Indicates whether this computer has light sensors and keyboard backlight. */ 195/* Indicates whether this computer has light sensors and keyboard backlight. */
196static unsigned int applesmc_light; 196static unsigned int applesmc_light;
197 197
198/* The number of fans handled by the driver */
199static unsigned int fans_handled;
200
198/* Indicates which temperature sensors set to use. */ 201/* Indicates which temperature sensors set to use. */
199static unsigned int applesmc_temperature_set; 202static unsigned int applesmc_temperature_set;
200 203
@@ -1492,39 +1495,24 @@ static int __init applesmc_init(void)
1492 1495
1493 /* create fan files */ 1496 /* create fan files */
1494 count = applesmc_get_fan_count(); 1497 count = applesmc_get_fan_count();
1495 if (count < 0) { 1498 if (count < 0)
1496 printk(KERN_ERR "applesmc: Cannot get the number of fans.\n"); 1499 printk(KERN_ERR "applesmc: Cannot get the number of fans.\n");
1497 } else { 1500 else
1498 printk(KERN_INFO "applesmc: %d fans found.\n", count); 1501 printk(KERN_INFO "applesmc: %d fans found.\n", count);
1499 1502
1500 switch (count) { 1503 if (count > 4) {
1501 default: 1504 count = 4;
1502 printk(KERN_WARNING "applesmc: More than 4 fans found," 1505 printk(KERN_WARNING "applesmc: More than 4 fans found,"
1503 " but at most 4 fans are supported" 1506 " but at most 4 fans are supported"
1504 " by the driver.\n"); 1507 " by the driver.\n");
1505 case 4: 1508 }
1506 ret = sysfs_create_group(&pdev->dev.kobj, 1509
1507 &fan_attribute_groups[3]); 1510 while (fans_handled < count) {
1508 if (ret) 1511 ret = sysfs_create_group(&pdev->dev.kobj,
1509 goto out_key_enumeration; 1512 &fan_attribute_groups[fans_handled]);
1510 case 3: 1513 if (ret)
1511 ret = sysfs_create_group(&pdev->dev.kobj, 1514 goto out_fans;
1512 &fan_attribute_groups[2]); 1515 fans_handled++;
1513 if (ret)
1514 goto out_key_enumeration;
1515 case 2:
1516 ret = sysfs_create_group(&pdev->dev.kobj,
1517 &fan_attribute_groups[1]);
1518 if (ret)
1519 goto out_key_enumeration;
1520 case 1:
1521 ret = sysfs_create_group(&pdev->dev.kobj,
1522 &fan_attribute_groups[0]);
1523 if (ret)
1524 goto out_fan_1;
1525 case 0:
1526 ;
1527 }
1528 } 1516 }
1529 1517
1530 for (i = 0; 1518 for (i = 0;
@@ -1593,10 +1581,10 @@ out_accelerometer:
1593 applesmc_release_accelerometer(); 1581 applesmc_release_accelerometer();
1594out_temperature: 1582out_temperature:
1595 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); 1583 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group);
1596 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); 1584out_fans:
1597out_fan_1: 1585 while (fans_handled)
1598 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1586 sysfs_remove_group(&pdev->dev.kobj,
1599out_key_enumeration: 1587 &fan_attribute_groups[--fans_handled]);
1600 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1588 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
1601out_name: 1589out_name:
1602 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); 1590 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
@@ -1622,8 +1610,9 @@ static void __exit applesmc_exit(void)
1622 if (applesmc_accelerometer) 1610 if (applesmc_accelerometer)
1623 applesmc_release_accelerometer(); 1611 applesmc_release_accelerometer();
1624 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group); 1612 sysfs_remove_group(&pdev->dev.kobj, &temperature_attributes_group);
1625 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[0]); 1613 while (fans_handled)
1626 sysfs_remove_group(&pdev->dev.kobj, &fan_attribute_groups[1]); 1614 sysfs_remove_group(&pdev->dev.kobj,
1615 &fan_attribute_groups[--fans_handled]);
1627 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group); 1616 sysfs_remove_group(&pdev->dev.kobj, &key_enumeration_group);
1628 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr); 1617 sysfs_remove_file(&pdev->dev.kobj, &dev_attr_name.attr);
1629 platform_device_unregister(pdev); 1618 platform_device_unregister(pdev);
diff --git a/drivers/hwmon/asc7621.c b/drivers/hwmon/asc7621.c
index 7f948105d8ad..0f388adc6187 100644
--- a/drivers/hwmon/asc7621.c
+++ b/drivers/hwmon/asc7621.c
@@ -268,8 +268,11 @@ static ssize_t store_fan16(struct device *dev,
268 if (strict_strtol(buf, 10, &reqval)) 268 if (strict_strtol(buf, 10, &reqval))
269 return -EINVAL; 269 return -EINVAL;
270 270
271 /* If a minimum RPM of zero is requested, then we set the register to
272 0xffff. This value allows the fan to be stopped completely without
273 generating an alarm. */
271 reqval = 274 reqval =
272 (SENSORS_LIMIT((reqval) <= 0 ? 0 : 5400000 / (reqval), 0, 65534)); 275 (reqval <= 0 ? 0xffff : SENSORS_LIMIT(5400000 / reqval, 0, 0xfffe));
273 276
274 mutex_lock(&data->update_lock); 277 mutex_lock(&data->update_lock);
275 data->reg[param->msb[0]] = (reqval >> 8) & 0xff; 278 data->reg[param->msb[0]] = (reqval >> 8) & 0xff;
@@ -285,8 +288,9 @@ static ssize_t store_fan16(struct device *dev,
285 * Voltages are scaled in the device so that the nominal voltage 288 * Voltages are scaled in the device so that the nominal voltage
286 * is 3/4ths of the 0-255 range (i.e. 192). 289 * is 3/4ths of the 0-255 range (i.e. 192).
287 * If all voltages are 'normal' then all voltage registers will 290 * If all voltages are 'normal' then all voltage registers will
288 * read 0xC0. This doesn't help us if we don't have a point of refernce. 291 * read 0xC0.
289 * The data sheet however provides us with the full scale value for each 292 *
293 * The data sheet provides us with the 3/4 scale value for each voltage
290 * which is stored in in_scaling. The sda->index parameter value provides 294 * which is stored in in_scaling. The sda->index parameter value provides
291 * the index into in_scaling. 295 * the index into in_scaling.
292 * 296 *
@@ -295,7 +299,7 @@ static ssize_t store_fan16(struct device *dev,
295 */ 299 */
296 300
297static int asc7621_in_scaling[] = { 301static int asc7621_in_scaling[] = {
298 3320, 3000, 4380, 6640, 16000 302 2500, 2250, 3300, 5000, 12000
299}; 303};
300 304
301static ssize_t show_in10(struct device *dev, struct device_attribute *attr, 305static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
@@ -306,19 +310,12 @@ static ssize_t show_in10(struct device *dev, struct device_attribute *attr,
306 u8 nr = sda->index; 310 u8 nr = sda->index;
307 311
308 mutex_lock(&data->update_lock); 312 mutex_lock(&data->update_lock);
309 regval = (data->reg[param->msb[0]] * asc7621_in_scaling[nr]) / 256; 313 regval = (data->reg[param->msb[0]] << 8) | (data->reg[param->lsb[0]]);
310
311 /* The LSB value is a 2-bit scaling of the MSB's LSbit value.
312 * I.E. If the maximim voltage for this input is 6640 millivolts then
313 * a MSB register value of 0 = 0mv and 255 = 6640mv.
314 * A 1 step change therefore represents 25.9mv (6640 / 256).
315 * The extra 2-bits therefore represent increments of 6.48mv.
316 */
317 regval += ((asc7621_in_scaling[nr] / 256) / 4) *
318 (data->reg[param->lsb[0]] >> 6);
319
320 mutex_unlock(&data->update_lock); 314 mutex_unlock(&data->update_lock);
321 315
316 /* The LSB value is a 2-bit scaling of the MSB's LSbit value. */
317 regval = (regval >> 6) * asc7621_in_scaling[nr] / (0xc0 << 2);
318
322 return sprintf(buf, "%u\n", regval); 319 return sprintf(buf, "%u\n", regval);
323} 320}
324 321
@@ -331,7 +328,7 @@ static ssize_t show_in8(struct device *dev, struct device_attribute *attr,
331 328
332 return sprintf(buf, "%u\n", 329 return sprintf(buf, "%u\n",
333 ((data->reg[param->msb[0]] * 330 ((data->reg[param->msb[0]] *
334 asc7621_in_scaling[nr]) / 256)); 331 asc7621_in_scaling[nr]) / 0xc0));
335} 332}
336 333
337static ssize_t store_in8(struct device *dev, struct device_attribute *attr, 334static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
@@ -344,9 +341,11 @@ static ssize_t store_in8(struct device *dev, struct device_attribute *attr,
344 if (strict_strtol(buf, 10, &reqval)) 341 if (strict_strtol(buf, 10, &reqval))
345 return -EINVAL; 342 return -EINVAL;
346 343
347 reqval = SENSORS_LIMIT(reqval, 0, asc7621_in_scaling[nr]); 344 reqval = SENSORS_LIMIT(reqval, 0, 0xffff);
345
346 reqval = reqval * 0xc0 / asc7621_in_scaling[nr];
348 347
349 reqval = (reqval * 255 + 128) / asc7621_in_scaling[nr]; 348 reqval = SENSORS_LIMIT(reqval, 0, 0xff);
350 349
351 mutex_lock(&data->update_lock); 350 mutex_lock(&data->update_lock);
352 data->reg[param->msb[0]] = reqval; 351 data->reg[param->msb[0]] = reqval;
@@ -846,11 +845,11 @@ static struct asc7621_param asc7621_params[] = {
846 PWRITE(in3_max, 3, PRI_LOW, 0x4b, 0, 0, 0, in8), 845 PWRITE(in3_max, 3, PRI_LOW, 0x4b, 0, 0, 0, in8),
847 PWRITE(in4_max, 4, PRI_LOW, 0x4d, 0, 0, 0, in8), 846 PWRITE(in4_max, 4, PRI_LOW, 0x4d, 0, 0, 0, in8),
848 847
849 PREAD(in0_alarm, 0, PRI_LOW, 0x41, 0, 0x01, 0, bitmask), 848 PREAD(in0_alarm, 0, PRI_HIGH, 0x41, 0, 0x01, 0, bitmask),
850 PREAD(in1_alarm, 1, PRI_LOW, 0x41, 0, 0x01, 1, bitmask), 849 PREAD(in1_alarm, 1, PRI_HIGH, 0x41, 0, 0x01, 1, bitmask),
851 PREAD(in2_alarm, 2, PRI_LOW, 0x41, 0, 0x01, 2, bitmask), 850 PREAD(in2_alarm, 2, PRI_HIGH, 0x41, 0, 0x01, 2, bitmask),
852 PREAD(in3_alarm, 3, PRI_LOW, 0x41, 0, 0x01, 3, bitmask), 851 PREAD(in3_alarm, 3, PRI_HIGH, 0x41, 0, 0x01, 3, bitmask),
853 PREAD(in4_alarm, 4, PRI_LOW, 0x42, 0, 0x01, 0, bitmask), 852 PREAD(in4_alarm, 4, PRI_HIGH, 0x42, 0, 0x01, 0, bitmask),
854 853
855 PREAD(fan1_input, 0, PRI_HIGH, 0x29, 0x28, 0, 0, fan16), 854 PREAD(fan1_input, 0, PRI_HIGH, 0x29, 0x28, 0, 0, fan16),
856 PREAD(fan2_input, 1, PRI_HIGH, 0x2b, 0x2a, 0, 0, fan16), 855 PREAD(fan2_input, 1, PRI_HIGH, 0x2b, 0x2a, 0, 0, fan16),
@@ -862,10 +861,10 @@ static struct asc7621_param asc7621_params[] = {
862 PWRITE(fan3_min, 2, PRI_LOW, 0x59, 0x58, 0, 0, fan16), 861 PWRITE(fan3_min, 2, PRI_LOW, 0x59, 0x58, 0, 0, fan16),
863 PWRITE(fan4_min, 3, PRI_LOW, 0x5b, 0x5a, 0, 0, fan16), 862 PWRITE(fan4_min, 3, PRI_LOW, 0x5b, 0x5a, 0, 0, fan16),
864 863
865 PREAD(fan1_alarm, 0, PRI_LOW, 0x42, 0, 0x01, 0, bitmask), 864 PREAD(fan1_alarm, 0, PRI_HIGH, 0x42, 0, 0x01, 2, bitmask),
866 PREAD(fan2_alarm, 1, PRI_LOW, 0x42, 0, 0x01, 1, bitmask), 865 PREAD(fan2_alarm, 1, PRI_HIGH, 0x42, 0, 0x01, 3, bitmask),
867 PREAD(fan3_alarm, 2, PRI_LOW, 0x42, 0, 0x01, 2, bitmask), 866 PREAD(fan3_alarm, 2, PRI_HIGH, 0x42, 0, 0x01, 4, bitmask),
868 PREAD(fan4_alarm, 3, PRI_LOW, 0x42, 0, 0x01, 3, bitmask), 867 PREAD(fan4_alarm, 3, PRI_HIGH, 0x42, 0, 0x01, 5, bitmask),
869 868
870 PREAD(temp1_input, 0, PRI_HIGH, 0x25, 0x10, 0, 0, temp10), 869 PREAD(temp1_input, 0, PRI_HIGH, 0x25, 0x10, 0, 0, temp10),
871 PREAD(temp2_input, 1, PRI_HIGH, 0x26, 0x15, 0, 0, temp10), 870 PREAD(temp2_input, 1, PRI_HIGH, 0x26, 0x15, 0, 0, temp10),
@@ -886,10 +885,10 @@ static struct asc7621_param asc7621_params[] = {
886 PWRITE(temp3_max, 2, PRI_LOW, 0x53, 0, 0, 0, temp8), 885 PWRITE(temp3_max, 2, PRI_LOW, 0x53, 0, 0, 0, temp8),
887 PWRITE(temp4_max, 3, PRI_LOW, 0x35, 0, 0, 0, temp8), 886 PWRITE(temp4_max, 3, PRI_LOW, 0x35, 0, 0, 0, temp8),
888 887
889 PREAD(temp1_alarm, 0, PRI_LOW, 0x41, 0, 0x01, 4, bitmask), 888 PREAD(temp1_alarm, 0, PRI_HIGH, 0x41, 0, 0x01, 4, bitmask),
890 PREAD(temp2_alarm, 1, PRI_LOW, 0x41, 0, 0x01, 5, bitmask), 889 PREAD(temp2_alarm, 1, PRI_HIGH, 0x41, 0, 0x01, 5, bitmask),
891 PREAD(temp3_alarm, 2, PRI_LOW, 0x41, 0, 0x01, 6, bitmask), 890 PREAD(temp3_alarm, 2, PRI_HIGH, 0x41, 0, 0x01, 6, bitmask),
892 PREAD(temp4_alarm, 3, PRI_LOW, 0x43, 0, 0x01, 0, bitmask), 891 PREAD(temp4_alarm, 3, PRI_HIGH, 0x43, 0, 0x01, 0, bitmask),
893 892
894 PWRITE(temp1_source, 0, PRI_LOW, 0x02, 0, 0x07, 4, bitmask), 893 PWRITE(temp1_source, 0, PRI_LOW, 0x02, 0, 0x07, 4, bitmask),
895 PWRITE(temp2_source, 1, PRI_LOW, 0x02, 0, 0x07, 0, bitmask), 894 PWRITE(temp2_source, 1, PRI_LOW, 0x02, 0, 0x07, 0, bitmask),
@@ -898,7 +897,7 @@ static struct asc7621_param asc7621_params[] = {
898 897
899 PWRITE(temp1_smoothing_enable, 0, PRI_LOW, 0x62, 0, 0x01, 3, bitmask), 898 PWRITE(temp1_smoothing_enable, 0, PRI_LOW, 0x62, 0, 0x01, 3, bitmask),
900 PWRITE(temp2_smoothing_enable, 1, PRI_LOW, 0x63, 0, 0x01, 7, bitmask), 899 PWRITE(temp2_smoothing_enable, 1, PRI_LOW, 0x63, 0, 0x01, 7, bitmask),
901 PWRITE(temp3_smoothing_enable, 2, PRI_LOW, 0x64, 0, 0x01, 3, bitmask), 900 PWRITE(temp3_smoothing_enable, 2, PRI_LOW, 0x63, 0, 0x01, 3, bitmask),
902 PWRITE(temp4_smoothing_enable, 3, PRI_LOW, 0x3c, 0, 0x01, 3, bitmask), 901 PWRITE(temp4_smoothing_enable, 3, PRI_LOW, 0x3c, 0, 0x01, 3, bitmask),
903 902
904 PWRITE(temp1_smoothing_time, 0, PRI_LOW, 0x62, 0, 0x07, 0, temp_st), 903 PWRITE(temp1_smoothing_time, 0, PRI_LOW, 0x62, 0, 0x07, 0, temp_st),
diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index c8ab50516672..7580f55e67e3 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -328,8 +328,8 @@ static int lis3lv02d_remove(struct acpi_device *device, int type)
328 lis3lv02d_joystick_disable(); 328 lis3lv02d_joystick_disable();
329 lis3lv02d_poweroff(&lis3_dev); 329 lis3lv02d_poweroff(&lis3_dev);
330 330
331 flush_work(&hpled_led.work);
332 led_classdev_unregister(&hpled_led.led_classdev); 331 led_classdev_unregister(&hpled_led.led_classdev);
332 flush_work(&hpled_led.work);
333 333
334 return lis3lv02d_remove_fs(&lis3_dev); 334 return lis3lv02d_remove_fs(&lis3_dev);
335} 335}
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 7e18bcf05a66..46239e47a260 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -59,11 +59,11 @@ static unsigned int get_time_pit(void)
59 unsigned long flags; 59 unsigned long flags;
60 unsigned int count; 60 unsigned int count;
61 61
62 spin_lock_irqsave(&i8253_lock, flags); 62 raw_spin_lock_irqsave(&i8253_lock, flags);
63 outb_p(0x00, 0x43); 63 outb_p(0x00, 0x43);
64 count = inb_p(0x40); 64 count = inb_p(0x40);
65 count |= inb_p(0x40) << 8; 65 count |= inb_p(0x40) << 8;
66 spin_unlock_irqrestore(&i8253_lock, flags); 66 raw_spin_unlock_irqrestore(&i8253_lock, flags);
67 67
68 return count; 68 return count;
69} 69}
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 1c0b529c06aa..4afe0a3b4884 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -146,11 +146,11 @@ static unsigned int get_time_pit(void)
146 unsigned long flags; 146 unsigned long flags;
147 unsigned int count; 147 unsigned int count;
148 148
149 spin_lock_irqsave(&i8253_lock, flags); 149 raw_spin_lock_irqsave(&i8253_lock, flags);
150 outb_p(0x00, 0x43); 150 outb_p(0x00, 0x43);
151 count = inb_p(0x40); 151 count = inb_p(0x40);
152 count |= inb_p(0x40) << 8; 152 count |= inb_p(0x40) << 8;
153 spin_unlock_irqrestore(&i8253_lock, flags); 153 raw_spin_unlock_irqrestore(&i8253_lock, flags);
154 154
155 return count; 155 return count;
156} 156}
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index b1edd778639c..405febd94f24 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -54,6 +54,9 @@ static signed short btn_avb_wheel[] =
54static signed short abs_joystick[] = 54static signed short abs_joystick[] =
55{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_HAT0X, ABS_HAT0Y, -1 }; 55{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_HAT0X, ABS_HAT0Y, -1 };
56 56
57static signed short abs_joystick_rudder[] =
58{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, ABS_HAT0X, ABS_HAT0Y, -1 };
59
57static signed short abs_avb_pegasus[] = 60static signed short abs_avb_pegasus[] =
58{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, ABS_HAT0X, ABS_HAT0Y, 61{ ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, ABS_HAT0X, ABS_HAT0Y,
59 ABS_HAT1X, ABS_HAT1Y, -1 }; 62 ABS_HAT1X, ABS_HAT1Y, -1 };
@@ -76,8 +79,9 @@ static struct iforce_device iforce_device[] = {
76 { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //? 79 { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //?
77 { 0x061c, 0xc084, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, 80 { 0x061c, 0xc084, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce },
78 { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? 81 { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //?
82 { 0x06f8, 0x0001, "Guillemot Jet Leader Force Feedback", btn_joystick, abs_joystick_rudder, ff_iforce },
79 { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? 83 { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //?
80 { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? 84 { 0x06f8, 0xa302, "Guillemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //?
81 { 0x06d6, 0x29bc, "Trust Force Feedback Race Master", btn_wheel, abs_wheel, ff_iforce }, 85 { 0x06d6, 0x29bc, "Trust Force Feedback Race Master", btn_wheel, abs_wheel, ff_iforce },
82 { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce } 86 { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce }
83}; 87};
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index b41303d3ec54..6c96631ae5d9 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -212,6 +212,7 @@ static struct usb_device_id iforce_usb_ids [] = {
212 { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */ 212 { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */
213 { USB_DEVICE(0x061c, 0xc084) }, /* ACT LABS Force RS */ 213 { USB_DEVICE(0x061c, 0xc084) }, /* ACT LABS Force RS */
214 { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ 214 { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */
215 { USB_DEVICE(0x06f8, 0x0003) }, /* Guillemot Jet Leader Force Feedback */
215 { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ 216 { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */
216 { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ 217 { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */
217 { } /* Terminating entry */ 218 { } /* Terminating entry */
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index ea4e1fd12651..f080dd31499b 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -30,7 +30,7 @@ MODULE_ALIAS("platform:pcspkr");
30#include <asm/i8253.h> 30#include <asm/i8253.h>
31#else 31#else
32#include <asm/8253pit.h> 32#include <asm/8253pit.h>
33static DEFINE_SPINLOCK(i8253_lock); 33static DEFINE_RAW_SPINLOCK(i8253_lock);
34#endif 34#endif
35 35
36static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 36static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
@@ -50,7 +50,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
50 if (value > 20 && value < 32767) 50 if (value > 20 && value < 32767)
51 count = PIT_TICK_RATE / value; 51 count = PIT_TICK_RATE / value;
52 52
53 spin_lock_irqsave(&i8253_lock, flags); 53 raw_spin_lock_irqsave(&i8253_lock, flags);
54 54
55 if (count) { 55 if (count) {
56 /* set command for counter 2, 2 byte write */ 56 /* set command for counter 2, 2 byte write */
@@ -65,7 +65,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
65 outb(inb_p(0x61) & 0xFC, 0x61); 65 outb(inb_p(0x61) & 0xFC, 0x61);
66 } 66 }
67 67
68 spin_unlock_irqrestore(&i8253_lock, flags); 68 raw_spin_unlock_irqrestore(&i8253_lock, flags);
69 69
70 return 0; 70 return 0;
71} 71}
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 0520c2e19927..112b4ee52ff2 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -185,7 +185,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
185 int fingers; 185 int fingers;
186 static int old_fingers; 186 static int old_fingers;
187 187
188 if (etd->fw_version_maj == 0x01) { 188 if (etd->fw_version < 0x020000) {
189 /* 189 /*
190 * byte 0: D U p1 p2 1 p3 R L 190 * byte 0: D U p1 p2 1 p3 R L
191 * byte 1: f 0 th tw x9 x8 y9 y8 191 * byte 1: f 0 th tw x9 x8 y9 y8
@@ -227,7 +227,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
227 input_report_key(dev, BTN_LEFT, packet[0] & 0x01); 227 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
228 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); 228 input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
229 229
230 if ((etd->fw_version_maj == 0x01) && 230 if (etd->fw_version < 0x020000 &&
231 (etd->capabilities & ETP_CAP_HAS_ROCKER)) { 231 (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
232 /* rocker up */ 232 /* rocker up */
233 input_report_key(dev, BTN_FORWARD, packet[0] & 0x40); 233 input_report_key(dev, BTN_FORWARD, packet[0] & 0x40);
@@ -321,7 +321,7 @@ static int elantech_check_parity_v1(struct psmouse *psmouse)
321 unsigned char p1, p2, p3; 321 unsigned char p1, p2, p3;
322 322
323 /* Parity bits are placed differently */ 323 /* Parity bits are placed differently */
324 if (etd->fw_version_maj == 0x01) { 324 if (etd->fw_version < 0x020000) {
325 /* byte 0: D U p1 p2 1 p3 R L */ 325 /* byte 0: D U p1 p2 1 p3 R L */
326 p1 = (packet[0] & 0x20) >> 5; 326 p1 = (packet[0] & 0x20) >> 5;
327 p2 = (packet[0] & 0x10) >> 4; 327 p2 = (packet[0] & 0x10) >> 4;
@@ -457,7 +457,7 @@ static void elantech_set_input_params(struct psmouse *psmouse)
457 switch (etd->hw_version) { 457 switch (etd->hw_version) {
458 case 1: 458 case 1:
459 /* Rocker button */ 459 /* Rocker button */
460 if ((etd->fw_version_maj == 0x01) && 460 if (etd->fw_version < 0x020000 &&
461 (etd->capabilities & ETP_CAP_HAS_ROCKER)) { 461 (etd->capabilities & ETP_CAP_HAS_ROCKER)) {
462 __set_bit(BTN_FORWARD, dev->keybit); 462 __set_bit(BTN_FORWARD, dev->keybit);
463 __set_bit(BTN_BACK, dev->keybit); 463 __set_bit(BTN_BACK, dev->keybit);
@@ -686,15 +686,14 @@ int elantech_init(struct psmouse *psmouse)
686 pr_err("elantech.c: failed to query firmware version.\n"); 686 pr_err("elantech.c: failed to query firmware version.\n");
687 goto init_fail; 687 goto init_fail;
688 } 688 }
689 etd->fw_version_maj = param[0]; 689
690 etd->fw_version_min = param[2]; 690 etd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
691 691
692 /* 692 /*
693 * Assume every version greater than this is new EeePC style 693 * Assume every version greater than this is new EeePC style
694 * hardware with 6 byte packets 694 * hardware with 6 byte packets
695 */ 695 */
696 if ((etd->fw_version_maj == 0x02 && etd->fw_version_min >= 0x30) || 696 if (etd->fw_version >= 0x020030) {
697 etd->fw_version_maj > 0x02) {
698 etd->hw_version = 2; 697 etd->hw_version = 2;
699 /* For now show extra debug information */ 698 /* For now show extra debug information */
700 etd->debug = 1; 699 etd->debug = 1;
@@ -704,8 +703,9 @@ int elantech_init(struct psmouse *psmouse)
704 etd->hw_version = 1; 703 etd->hw_version = 1;
705 etd->paritycheck = 1; 704 etd->paritycheck = 1;
706 } 705 }
707 pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d\n", 706
708 etd->hw_version, etd->fw_version_maj, etd->fw_version_min); 707 pr_info("elantech.c: assuming hardware version %d, firmware version %d.%d.%d\n",
708 etd->hw_version, param[0], param[1], param[2]);
709 709
710 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) { 710 if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, param)) {
711 pr_err("elantech.c: failed to query capabilities.\n"); 711 pr_err("elantech.c: failed to query capabilities.\n");
@@ -720,8 +720,8 @@ int elantech_init(struct psmouse *psmouse)
720 * a touch action starts causing the mouse cursor or scrolled page 720 * a touch action starts causing the mouse cursor or scrolled page
721 * to jump. Enable a workaround. 721 * to jump. Enable a workaround.
722 */ 722 */
723 if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) { 723 if (etd->fw_version == 0x020022) {
724 pr_info("elantech.c: firmware version 2.34 detected, " 724 pr_info("elantech.c: firmware version 2.0.34 detected, "
725 "enabling jumpy cursor workaround\n"); 725 "enabling jumpy cursor workaround\n");
726 etd->jumpy_cursor = 1; 726 etd->jumpy_cursor = 1;
727 } 727 }
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index feac5f7af966..ac57bde1bb9f 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -100,11 +100,10 @@ struct elantech_data {
100 unsigned char reg_26; 100 unsigned char reg_26;
101 unsigned char debug; 101 unsigned char debug;
102 unsigned char capabilities; 102 unsigned char capabilities;
103 unsigned char fw_version_maj;
104 unsigned char fw_version_min;
105 unsigned char hw_version;
106 unsigned char paritycheck; 103 unsigned char paritycheck;
107 unsigned char jumpy_cursor; 104 unsigned char jumpy_cursor;
105 unsigned char hw_version;
106 unsigned int fw_version;
108 unsigned char parity[256]; 107 unsigned char parity[256];
109}; 108};
110 109
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index cbc807264940..a3c97315a473 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1394,6 +1394,7 @@ static int psmouse_reconnect(struct serio *serio)
1394 struct psmouse *psmouse = serio_get_drvdata(serio); 1394 struct psmouse *psmouse = serio_get_drvdata(serio);
1395 struct psmouse *parent = NULL; 1395 struct psmouse *parent = NULL;
1396 struct serio_driver *drv = serio->drv; 1396 struct serio_driver *drv = serio->drv;
1397 unsigned char type;
1397 int rc = -1; 1398 int rc = -1;
1398 1399
1399 if (!drv || !psmouse) { 1400 if (!drv || !psmouse) {
@@ -1413,10 +1414,15 @@ static int psmouse_reconnect(struct serio *serio)
1413 if (psmouse->reconnect) { 1414 if (psmouse->reconnect) {
1414 if (psmouse->reconnect(psmouse)) 1415 if (psmouse->reconnect(psmouse))
1415 goto out; 1416 goto out;
1416 } else if (psmouse_probe(psmouse) < 0 || 1417 } else {
1417 psmouse->type != psmouse_extensions(psmouse, 1418 psmouse_reset(psmouse);
1418 psmouse_max_proto, false)) { 1419
1419 goto out; 1420 if (psmouse_probe(psmouse) < 0)
1421 goto out;
1422
1423 type = psmouse_extensions(psmouse, psmouse_max_proto, false);
1424 if (psmouse->type != type)
1425 goto out;
1420 } 1426 }
1421 1427
1422 /* ok, the device type (and capabilities) match the old one, 1428 /* ok, the device type (and capabilities) match the old one,
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index e019d53d1ab4..0d2d7e54b465 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -156,9 +156,14 @@ struct ser_req {
156 u16 reset; 156 u16 reset;
157 u16 ref_on; 157 u16 ref_on;
158 u16 command; 158 u16 command;
159 u16 sample;
160 struct spi_message msg; 159 struct spi_message msg;
161 struct spi_transfer xfer[6]; 160 struct spi_transfer xfer[6];
161
162 /*
163 * DMA (thus cache coherency maintenance) requires the
164 * transfer buffers to live in their own cache lines.
165 */
166 u16 sample ____cacheline_aligned;
162}; 167};
163 168
164struct ad7877 { 169struct ad7877 {
@@ -182,8 +187,6 @@ struct ad7877 {
182 u8 averaging; 187 u8 averaging;
183 u8 pen_down_acc_interval; 188 u8 pen_down_acc_interval;
184 189
185 u16 conversion_data[AD7877_NR_SENSE];
186
187 struct spi_transfer xfer[AD7877_NR_SENSE + 2]; 190 struct spi_transfer xfer[AD7877_NR_SENSE + 2];
188 struct spi_message msg; 191 struct spi_message msg;
189 192
@@ -195,6 +198,12 @@ struct ad7877 {
195 spinlock_t lock; 198 spinlock_t lock;
196 struct timer_list timer; /* P: lock */ 199 struct timer_list timer; /* P: lock */
197 unsigned pending:1; /* P: lock */ 200 unsigned pending:1; /* P: lock */
201
202 /*
203 * DMA (thus cache coherency maintenance) requires the
204 * transfer buffers to live in their own cache lines.
205 */
206 u16 conversion_data[AD7877_NR_SENSE] ____cacheline_aligned;
198}; 207};
199 208
200static int gpio3; 209static int gpio3;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9712b2e97be4..cefd63daff31 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2109,12 +2109,18 @@ repeat:
2109 if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */ 2109 if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */
2110 /* .. if the array isn't clean, an 'even' event must also go 2110 /* .. if the array isn't clean, an 'even' event must also go
2111 * to spares. */ 2111 * to spares. */
2112 if ((mddev->events&1)==0) 2112 if ((mddev->events&1)==0) {
2113 nospares = 0; 2113 nospares = 0;
2114 sync_req = 2; /* force a second update to get the
2115 * even/odd in sync */
2116 }
2114 } else { 2117 } else {
2115 /* otherwise an 'odd' event must go to spares */ 2118 /* otherwise an 'odd' event must go to spares */
2116 if ((mddev->events&1)) 2119 if ((mddev->events&1)) {
2117 nospares = 0; 2120 nospares = 0;
2121 sync_req = 2; /* force a second update to get the
2122 * even/odd in sync */
2123 }
2118 } 2124 }
2119 } 2125 }
2120 2126
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 58ea0ecae7c3..15348c393b5d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -1527,7 +1527,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
1527 1527
1528 clear_bit(R5_UPTODATE, &sh->dev[i].flags); 1528 clear_bit(R5_UPTODATE, &sh->dev[i].flags);
1529 atomic_inc(&rdev->read_errors); 1529 atomic_inc(&rdev->read_errors);
1530 if (conf->mddev->degraded) 1530 if (conf->mddev->degraded >= conf->max_degraded)
1531 printk_rl(KERN_WARNING 1531 printk_rl(KERN_WARNING
1532 "raid5:%s: read error not correctable " 1532 "raid5:%s: read error not correctable "
1533 "(sector %llu on %s).\n", 1533 "(sector %llu on %s).\n",
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index fd8e1f45be36..7364b9642d00 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -423,15 +423,14 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status)
423 } 423 }
424} 424}
425 425
426int saa7146_vv_devinit(struct saa7146_dev *dev)
427{
428 return v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
429}
430EXPORT_SYMBOL_GPL(saa7146_vv_devinit);
431
432int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) 426int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
433{ 427{
434 struct saa7146_vv *vv; 428 struct saa7146_vv *vv;
429 int err;
430
431 err = v4l2_device_register(&dev->pci->dev, &dev->v4l2_dev);
432 if (err)
433 return err;
435 434
436 vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); 435 vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
437 if (vv == NULL) { 436 if (vv == NULL) {
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 5ed75263340a..b8b2c551a1e2 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -558,9 +558,11 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
558 /* ok, accept it */ 558 /* ok, accept it */
559 vv->ov_fb = *fb; 559 vv->ov_fb = *fb;
560 vv->ov_fmt = fmt; 560 vv->ov_fmt = fmt;
561 if (0 == vv->ov_fb.fmt.bytesperline) 561
562 vv->ov_fb.fmt.bytesperline = 562 if (vv->ov_fb.fmt.bytesperline < vv->ov_fb.fmt.width) {
563 vv->ov_fb.fmt.width * fmt->depth / 8; 563 vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8;
564 DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline));
565 }
564 566
565 mutex_unlock(&dev->lock); 567 mutex_unlock(&dev->lock);
566 return 0; 568 return 0;
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index a3c07fe0e6c4..96972804f4ad 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -4470,6 +4470,10 @@ static int stv090x_setup(struct dvb_frontend *fe)
4470 if (stv090x_write_reg(state, STV090x_TSTRES0, 0x00) < 0) 4470 if (stv090x_write_reg(state, STV090x_TSTRES0, 0x00) < 0)
4471 goto err; 4471 goto err;
4472 4472
4473 /* workaround for stuck DiSEqC output */
4474 if (config->diseqc_envelope_mode)
4475 stv090x_send_diseqc_burst(fe, SEC_MINI_A);
4476
4473 return 0; 4477 return 0;
4474err: 4478err:
4475 dprintk(FE_ERROR, 1, "I/O error"); 4479 dprintk(FE_ERROR, 1, "I/O error");
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 9fdf26cc6998..1500210c06cf 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -643,9 +643,6 @@ static void frontend_init(struct budget *budget)
643 &budget->i2c_adap, 643 &budget->i2c_adap,
644 &tt1600_isl6423_config); 644 &tt1600_isl6423_config);
645 645
646 } else {
647 dvb_frontend_detach(budget->dvb_frontend);
648 budget->dvb_frontend = NULL;
649 } 646 }
650 } 647 }
651 break; 648 break;
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f8fc8654693d..9644cf760aaa 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -361,7 +361,7 @@ config VIDEO_SAA717X
361 361
362config VIDEO_SAA7191 362config VIDEO_SAA7191
363 tristate "Philips SAA7191 video decoder" 363 tristate "Philips SAA7191 video decoder"
364 depends on VIDEO_V4L1 && I2C 364 depends on VIDEO_V4L2 && I2C
365 ---help--- 365 ---help---
366 Support for the Philips SAA7191 video decoder. 366 Support for the Philips SAA7191 video decoder.
367 367
@@ -756,7 +756,7 @@ source "drivers/media/video/saa7134/Kconfig"
756 756
757config VIDEO_MXB 757config VIDEO_MXB
758 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" 758 tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"
759 depends on PCI && VIDEO_V4L1 && I2C 759 depends on PCI && VIDEO_V4L2 && I2C
760 select VIDEO_SAA7146_VV 760 select VIDEO_SAA7146_VV
761 select VIDEO_TUNER 761 select VIDEO_TUNER
762 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO 762 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index b88b6174a331..c51c386559f2 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -160,8 +160,6 @@ obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o
160obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o 160obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
161obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o 161obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o
162 162
163obj-$(CONFIG_ARCH_DAVINCI) += davinci/
164
165obj-$(CONFIG_VIDEO_AU0828) += au0828/ 163obj-$(CONFIG_VIDEO_AU0828) += au0828/
166 164
167obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/ 165obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index 7cf042f9b377..398dbe71cb82 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -223,7 +223,6 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
223 BUG_ON(!dev->hw_ops.get_frame_format); 223 BUG_ON(!dev->hw_ops.get_frame_format);
224 BUG_ON(!dev->hw_ops.get_pixel_format); 224 BUG_ON(!dev->hw_ops.get_pixel_format);
225 BUG_ON(!dev->hw_ops.set_pixel_format); 225 BUG_ON(!dev->hw_ops.set_pixel_format);
226 BUG_ON(!dev->hw_ops.set_params);
227 BUG_ON(!dev->hw_ops.set_image_window); 226 BUG_ON(!dev->hw_ops.set_image_window);
228 BUG_ON(!dev->hw_ops.get_image_window); 227 BUG_ON(!dev->hw_ops.get_image_window);
229 BUG_ON(!dev->hw_ops.get_line_length); 228 BUG_ON(!dev->hw_ops.get_line_length);
@@ -1689,11 +1688,12 @@ static long vpfe_param_handler(struct file *file, void *priv,
1689 struct vpfe_device *vpfe_dev = video_drvdata(file); 1688 struct vpfe_device *vpfe_dev = video_drvdata(file);
1690 int ret = 0; 1689 int ret = 0;
1691 1690
1692 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n"); 1691 v4l2_dbg(2, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n");
1693 1692
1694 if (vpfe_dev->started) { 1693 if (vpfe_dev->started) {
1695 /* only allowed if streaming is not started */ 1694 /* only allowed if streaming is not started */
1696 v4l2_err(&vpfe_dev->v4l2_dev, "device already started\n"); 1695 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1696 "device already started\n");
1697 return -EBUSY; 1697 return -EBUSY;
1698 } 1698 }
1699 1699
@@ -1705,16 +1705,23 @@ static long vpfe_param_handler(struct file *file, void *priv,
1705 case VPFE_CMD_S_CCDC_RAW_PARAMS: 1705 case VPFE_CMD_S_CCDC_RAW_PARAMS:
1706 v4l2_warn(&vpfe_dev->v4l2_dev, 1706 v4l2_warn(&vpfe_dev->v4l2_dev,
1707 "VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n"); 1707 "VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n");
1708 ret = ccdc_dev->hw_ops.set_params(param); 1708 if (ccdc_dev->hw_ops.set_params) {
1709 if (ret) { 1709 ret = ccdc_dev->hw_ops.set_params(param);
1710 v4l2_err(&vpfe_dev->v4l2_dev, 1710 if (ret) {
1711 "Error in setting parameters in CCDC\n"); 1711 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1712 goto unlock_out; 1712 "Error setting parameters in CCDC\n");
1713 } 1713 goto unlock_out;
1714 if (vpfe_get_ccdc_image_format(vpfe_dev, &vpfe_dev->fmt) < 0) { 1714 }
1715 v4l2_err(&vpfe_dev->v4l2_dev, 1715 if (vpfe_get_ccdc_image_format(vpfe_dev,
1716 "Invalid image format at CCDC\n"); 1716 &vpfe_dev->fmt) < 0) {
1717 goto unlock_out; 1717 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1718 "Invalid image format at CCDC\n");
1719 goto unlock_out;
1720 }
1721 } else {
1722 ret = -EINVAL;
1723 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
1724 "VPFE_CMD_S_CCDC_RAW_PARAMS not supported\n");
1718 } 1725 }
1719 break; 1726 break;
1720 default: 1727 default:
@@ -1830,7 +1837,7 @@ static __init int vpfe_probe(struct platform_device *pdev)
1830 if (NULL == ccdc_cfg) { 1837 if (NULL == ccdc_cfg) {
1831 v4l2_err(pdev->dev.driver, 1838 v4l2_err(pdev->dev.driver,
1832 "Memory allocation failed for ccdc_cfg\n"); 1839 "Memory allocation failed for ccdc_cfg\n");
1833 goto probe_free_dev_mem; 1840 goto probe_free_lock;
1834 } 1841 }
1835 1842
1836 strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); 1843 strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
@@ -1982,8 +1989,9 @@ probe_out_video_release:
1982probe_out_release_irq: 1989probe_out_release_irq:
1983 free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); 1990 free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
1984probe_free_ccdc_cfg_mem: 1991probe_free_ccdc_cfg_mem:
1985 mutex_unlock(&ccdc_lock);
1986 kfree(ccdc_cfg); 1992 kfree(ccdc_cfg);
1993probe_free_lock:
1994 mutex_unlock(&ccdc_lock);
1987probe_free_dev_mem: 1995probe_free_dev_mem:
1988 kfree(vpfe_dev); 1996 kfree(vpfe_dev);
1989 return ret; 1997 return ret;
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index 38a6e15e096b..3dee3e5844b6 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -1427,7 +1427,7 @@ static int input_kthread(void *data)
1427 struct gspca_dev *gspca_dev = (struct gspca_dev *)data; 1427 struct gspca_dev *gspca_dev = (struct gspca_dev *)data;
1428 struct sd *sd = (struct sd *) gspca_dev; 1428 struct sd *sd = (struct sd *) gspca_dev;
1429 1429
1430 DECLARE_WAIT_QUEUE_HEAD(wait); 1430 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait);
1431 set_freezable(); 1431 set_freezable();
1432 for (;;) { 1432 for (;;) {
1433 if (kthread_should_stop()) 1433 if (kthread_should_stop())
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index 15b2eef8a3f6..edf0fe157501 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -1513,7 +1513,6 @@ static const struct sd_desc sd_desc = {
1513static const __devinitdata struct usb_device_id device_table[] = { 1513static const __devinitdata struct usb_device_id device_table[] = {
1514 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam}, 1514 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
1515 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista}, 1515 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
1516 {USB_DEVICE(0x0461, 0x0815), .driver_info = MicroInnovationIC200},
1517 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110}, 1516 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
1518 {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam}, 1517 {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam},
1519 {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2}, 1518 {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2},
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index dc7f2b0fbc79..b9c80e2103b9 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -1053,6 +1053,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
1053 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A}, 1053 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A},
1054 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A}, 1054 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A},
1055 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A}, 1055 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A},
1056 {USB_DEVICE(0x0461, 0x0815), .driver_info = Rev072A},
1056 {USB_DEVICE(0x046d, 0x0928), .driver_info = Rev012A}, 1057 {USB_DEVICE(0x046d, 0x0928), .driver_info = Rev012A},
1057 {USB_DEVICE(0x046d, 0x0929), .driver_info = Rev012A}, 1058 {USB_DEVICE(0x046d, 0x0929), .driver_info = Rev012A},
1058 {USB_DEVICE(0x046d, 0x092a), .driver_info = Rev012A}, 1059 {USB_DEVICE(0x046d, 0x092a), .driver_info = Rev012A},
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c
index af73da34c83f..14f179a19485 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx.c
@@ -524,8 +524,6 @@ static const __devinitdata struct usb_device_id device_table[] = {
524 {USB_DEVICE(0x046D, 0x08F5), .driver_info = BRIDGE_ST6422 }, 524 {USB_DEVICE(0x046D, 0x08F5), .driver_info = BRIDGE_ST6422 },
525 /* QuickCam Messenger (new) */ 525 /* QuickCam Messenger (new) */
526 {USB_DEVICE(0x046D, 0x08F6), .driver_info = BRIDGE_ST6422 }, 526 {USB_DEVICE(0x046D, 0x08F6), .driver_info = BRIDGE_ST6422 },
527 /* QuickCam Messenger (new) */
528 {USB_DEVICE(0x046D, 0x08DA), .driver_info = BRIDGE_ST6422 },
529 {} 527 {}
530}; 528};
531MODULE_DEVICE_TABLE(usb, device_table); 529MODULE_DEVICE_TABLE(usb, device_table);
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
index e620a3a92f25..ad2c232baa6d 100644
--- a/drivers/media/video/hexium_gemini.c
+++ b/drivers/media/video/hexium_gemini.c
@@ -356,9 +356,6 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
356 356
357 DEB_EE((".\n")); 357 DEB_EE((".\n"));
358 358
359 ret = saa7146_vv_devinit(dev);
360 if (ret)
361 return ret;
362 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 359 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
363 if (NULL == hexium) { 360 if (NULL == hexium) {
364 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); 361 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n");
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c
index fe596a1c12a8..938a1f8f880a 100644
--- a/drivers/media/video/hexium_orion.c
+++ b/drivers/media/video/hexium_orion.c
@@ -216,10 +216,6 @@ static int hexium_probe(struct saa7146_dev *dev)
216 return -EFAULT; 216 return -EFAULT;
217 } 217 }
218 218
219 err = saa7146_vv_devinit(dev);
220 if (err)
221 return err;
222
223 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 219 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
224 if (NULL == hexium) { 220 if (NULL == hexium) {
225 printk("hexium_orion: hexium_probe: not enough kernel memory.\n"); 221 printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c
index 3c8ebfcb742e..34a66019190e 100644
--- a/drivers/media/video/mx1_camera.c
+++ b/drivers/media/video/mx1_camera.c
@@ -49,8 +49,6 @@
49/* 49/*
50 * CSI registers 50 * CSI registers
51 */ 51 */
52#define DMA_CCR(x) (0x8c + ((x) << 6)) /* Control Registers */
53#define DMA_DIMR 0x08 /* Interrupt mask Register */
54#define CSICR1 0x00 /* CSI Control Register 1 */ 52#define CSICR1 0x00 /* CSI Control Register 1 */
55#define CSISR 0x08 /* CSI Status Register */ 53#define CSISR 0x08 /* CSI Status Register */
56#define CSIRXR 0x10 /* CSI RxFIFO Register */ 54#define CSIRXR 0x10 /* CSI RxFIFO Register */
@@ -784,7 +782,7 @@ static int __init mx1_camera_probe(struct platform_device *pdev)
784 pcdev); 782 pcdev);
785 783
786 imx_dma_config_channel(pcdev->dma_chan, IMX_DMA_TYPE_FIFO, 784 imx_dma_config_channel(pcdev->dma_chan, IMX_DMA_TYPE_FIFO,
787 IMX_DMA_MEMSIZE_32, DMA_REQ_CSI_R, 0); 785 IMX_DMA_MEMSIZE_32, MX1_DMA_REQ_CSI_R, 0);
788 /* burst length : 16 words = 64 bytes */ 786 /* burst length : 16 words = 64 bytes */
789 imx_dma_config_burstlen(pcdev->dma_chan, 0); 787 imx_dma_config_burstlen(pcdev->dma_chan, 0);
790 788
@@ -798,8 +796,8 @@ static int __init mx1_camera_probe(struct platform_device *pdev)
798 set_fiq_handler(&mx1_camera_sof_fiq_start, &mx1_camera_sof_fiq_end - 796 set_fiq_handler(&mx1_camera_sof_fiq_start, &mx1_camera_sof_fiq_end -
799 &mx1_camera_sof_fiq_start); 797 &mx1_camera_sof_fiq_start);
800 798
801 regs.ARM_r8 = DMA_BASE + DMA_DIMR; 799 regs.ARM_r8 = (long)MX1_DMA_DIMR;
802 regs.ARM_r9 = DMA_BASE + DMA_CCR(pcdev->dma_chan); 800 regs.ARM_r9 = (long)MX1_DMA_CCR(pcdev->dma_chan);
803 regs.ARM_r10 = (long)pcdev->base + CSICR1; 801 regs.ARM_r10 = (long)pcdev->base + CSICR1;
804 regs.ARM_fp = (long)pcdev->base + CSISR; 802 regs.ARM_fp = (long)pcdev->base + CSISR;
805 regs.ARM_sp = 1 << pcdev->dma_chan; 803 regs.ARM_sp = 1 << pcdev->dma_chan;
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 9f01f14e4aa2..ef0c8178f255 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -169,11 +169,7 @@ static struct saa7146_extension extension;
169static int mxb_probe(struct saa7146_dev *dev) 169static int mxb_probe(struct saa7146_dev *dev)
170{ 170{
171 struct mxb *mxb = NULL; 171 struct mxb *mxb = NULL;
172 int err;
173 172
174 err = saa7146_vv_devinit(dev);
175 if (err)
176 return err;
177 mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); 173 mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
178 if (mxb == NULL) { 174 if (mxb == NULL) {
179 DEB_D(("not enough kernel memory.\n")); 175 DEB_D(("not enough kernel memory.\n"));
@@ -699,14 +695,17 @@ static struct saa7146_ext_vv vv_data;
699/* this function only gets called when the probing was successful */ 695/* this function only gets called when the probing was successful */
700static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) 696static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
701{ 697{
702 struct mxb *mxb = (struct mxb *)dev->ext_priv; 698 struct mxb *mxb;
703 699
704 DEB_EE(("dev:%p\n", dev)); 700 DEB_EE(("dev:%p\n", dev));
705 701
706 /* checking for i2c-devices can be omitted here, because we
707 already did this in "mxb_vl42_probe" */
708
709 saa7146_vv_init(dev, &vv_data); 702 saa7146_vv_init(dev, &vv_data);
703 if (mxb_probe(dev)) {
704 saa7146_vv_release(dev);
705 return -1;
706 }
707 mxb = (struct mxb *)dev->ext_priv;
708
710 vv_data.ops.vidioc_queryctrl = vidioc_queryctrl; 709 vv_data.ops.vidioc_queryctrl = vidioc_queryctrl;
711 vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl; 710 vv_data.ops.vidioc_g_ctrl = vidioc_g_ctrl;
712 vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl; 711 vv_data.ops.vidioc_s_ctrl = vidioc_s_ctrl;
@@ -726,6 +725,7 @@ static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data
726 vv_data.ops.vidioc_default = vidioc_default; 725 vv_data.ops.vidioc_default = vidioc_default;
727 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) { 726 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) {
728 ERR(("cannot register capture v4l2 device. skipping.\n")); 727 ERR(("cannot register capture v4l2 device. skipping.\n"));
728 saa7146_vv_release(dev);
729 return -1; 729 return -1;
730 } 730 }
731 731
@@ -846,7 +846,6 @@ static struct saa7146_extension extension = {
846 .pci_tbl = &pci_tbl[0], 846 .pci_tbl = &pci_tbl[0],
847 .module = THIS_MODULE, 847 .module = THIS_MODULE,
848 848
849 .probe = mxb_probe,
850 .attach = mxb_attach, 849 .attach = mxb_attach,
851 .detach = mxb_detach, 850 .detach = mxb_detach,
852 851
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index b189fe63394b..ce76d952e161 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -1405,7 +1405,7 @@ static int omap24xxcam_mmap_buffers(struct file *file,
1405 } 1405 }
1406 1406
1407 size = 0; 1407 size = 0;
1408 for (i = first; i <= last; i++) { 1408 for (i = first; i <= last && i < VIDEO_MAX_FRAME; i++) {
1409 struct videobuf_dmabuf *dma = videobuf_to_dma(vbq->bufs[i]); 1409 struct videobuf_dmabuf *dma = videobuf_to_dma(vbq->bufs[i]);
1410 1410
1411 for (j = 0; j < dma->sglen; j++) { 1411 for (j = 0; j < dma->sglen; j++) {
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index 5ecc30daef2d..04bf5c11308d 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -609,12 +609,9 @@ static void pxa_dma_add_tail_buf(struct pxa_camera_dev *pcdev,
609 */ 609 */
610static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev) 610static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev)
611{ 611{
612 unsigned long cicr0, cifr; 612 unsigned long cicr0;
613 613
614 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__); 614 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__);
615 /* Reset the FIFOs */
616 cifr = __raw_readl(pcdev->base + CIFR) | CIFR_RESET_F;
617 __raw_writel(cifr, pcdev->base + CIFR);
618 /* Enable End-Of-Frame Interrupt */ 615 /* Enable End-Of-Frame Interrupt */
619 cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_ENB; 616 cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_ENB;
620 cicr0 &= ~CICR0_EOFM; 617 cicr0 &= ~CICR0_EOFM;
@@ -935,7 +932,7 @@ static void pxa_camera_deactivate(struct pxa_camera_dev *pcdev)
935static irqreturn_t pxa_camera_irq(int irq, void *data) 932static irqreturn_t pxa_camera_irq(int irq, void *data)
936{ 933{
937 struct pxa_camera_dev *pcdev = data; 934 struct pxa_camera_dev *pcdev = data;
938 unsigned long status, cicr0; 935 unsigned long status, cifr, cicr0;
939 struct pxa_buffer *buf; 936 struct pxa_buffer *buf;
940 struct videobuf_buffer *vb; 937 struct videobuf_buffer *vb;
941 938
@@ -949,6 +946,10 @@ static irqreturn_t pxa_camera_irq(int irq, void *data)
949 __raw_writel(status, pcdev->base + CISR); 946 __raw_writel(status, pcdev->base + CISR);
950 947
951 if (status & CISR_EOF) { 948 if (status & CISR_EOF) {
949 /* Reset the FIFOs */
950 cifr = __raw_readl(pcdev->base + CIFR) | CIFR_RESET_F;
951 __raw_writel(cifr, pcdev->base + CIFR);
952
952 pcdev->active = list_first_entry(&pcdev->capture, 953 pcdev->active = list_first_entry(&pcdev->capture,
953 struct pxa_buffer, vb.queue); 954 struct pxa_buffer, vb.queue);
954 vb = &pcdev->active->vb; 955 vb = &pcdev->active->vb;
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 6e16b3979326..1ad980f8e770 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -1633,7 +1633,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
1633 height = pix->height; 1633 height = pix->height;
1634 1634
1635 pix->bytesperline = soc_mbus_bytes_per_line(width, xlate->host_fmt); 1635 pix->bytesperline = soc_mbus_bytes_per_line(width, xlate->host_fmt);
1636 if (pix->bytesperline < 0) 1636 if ((int)pix->bytesperline < 0)
1637 return pix->bytesperline; 1637 return pix->bytesperline;
1638 pix->sizeimage = height * pix->bytesperline; 1638 pix->sizeimage = height * pix->bytesperline;
1639 1639
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index a3d5728b6449..f2ab025ad97a 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -349,6 +349,9 @@ int wm831x_auxadc_read(struct wm831x *wm831x, enum wm831x_auxadc input)
349 goto disable; 349 goto disable;
350 } 350 }
351 351
352 /* If an interrupt arrived late clean up after it */
353 try_wait_for_completion(&wm831x->auxadc_done);
354
352 /* Ignore the result to allow us to soldier on without IRQ hookup */ 355 /* Ignore the result to allow us to soldier on without IRQ hookup */
353 wait_for_completion_timeout(&wm831x->auxadc_done, msecs_to_jiffies(5)); 356 wait_for_completion_timeout(&wm831x->auxadc_done, msecs_to_jiffies(5));
354 357
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index e400a3bed063..b5807484b4c9 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -363,6 +363,10 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref)
363 reg |= 1 << channel | WM8350_AUXADC_POLL; 363 reg |= 1 << channel | WM8350_AUXADC_POLL;
364 wm8350_reg_write(wm8350, WM8350_DIGITISER_CONTROL_1, reg); 364 wm8350_reg_write(wm8350, WM8350_DIGITISER_CONTROL_1, reg);
365 365
366 /* If a late IRQ left the completion signalled then consume
367 * the completion. */
368 try_wait_for_completion(&wm8350->auxadc_done);
369
366 /* We ignore the result of the completion and just check for a 370 /* We ignore the result of the completion and just check for a
367 * conversion result, allowing us to soldier on if the IRQ 371 * conversion result, allowing us to soldier on if the IRQ
368 * infrastructure is not set up for the chip. */ 372 * infrastructure is not set up for the chip. */
diff --git a/drivers/misc/vmware_balloon.c b/drivers/misc/vmware_balloon.c
index e7161c4e3798..db9cd0240c6f 100644
--- a/drivers/misc/vmware_balloon.c
+++ b/drivers/misc/vmware_balloon.c
@@ -41,7 +41,7 @@
41#include <linux/workqueue.h> 41#include <linux/workqueue.h>
42#include <linux/debugfs.h> 42#include <linux/debugfs.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <asm/vmware.h> 44#include <asm/hypervisor.h>
45 45
46MODULE_AUTHOR("VMware, Inc."); 46MODULE_AUTHOR("VMware, Inc.");
47MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver"); 47MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
@@ -767,7 +767,7 @@ static int __init vmballoon_init(void)
767 * Check if we are running on VMware's hypervisor and bail out 767 * Check if we are running on VMware's hypervisor and bail out
768 * if we are not. 768 * if we are not.
769 */ 769 */
770 if (!vmware_platform()) 770 if (x86_hyper != &x86_hyper_vmware)
771 return -ENODEV; 771 return -ENODEV;
772 772
773 vmballoon_wq = create_freezeable_workqueue("vmmemctl"); 773 vmballoon_wq = create_freezeable_workqueue("vmmemctl");
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index a6dd7da37357..336d9f553f3e 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -314,8 +314,8 @@ static void at91_mci_post_dma_read(struct at91mci_host *host)
314 dmabuf = (unsigned *)tmpv; 314 dmabuf = (unsigned *)tmpv;
315 } 315 }
316 316
317 flush_kernel_dcache_page(sg_page(sg));
317 kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ); 318 kunmap_atomic(sgbuffer, KM_BIO_SRC_IRQ);
318 dmac_flush_range((void *)sgbuffer, ((void *)sgbuffer) + amount);
319 data->bytes_xfered += amount; 319 data->bytes_xfered += amount;
320 if (size == 0) 320 if (size == 0)
321 break; 321 break;
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 88be37d9e9a5..fb279f4ed8b3 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -266,7 +266,7 @@ static int atmci_req_show(struct seq_file *s, void *v)
266 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n", 266 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n",
267 cmd->opcode, cmd->arg, cmd->flags, 267 cmd->opcode, cmd->arg, cmd->flags,
268 cmd->resp[0], cmd->resp[1], cmd->resp[2], 268 cmd->resp[0], cmd->resp[1], cmd->resp[2],
269 cmd->resp[2], cmd->error); 269 cmd->resp[3], cmd->error);
270 if (data) 270 if (data)
271 seq_printf(s, "DATA %u / %u * %u flg %x err %d\n", 271 seq_printf(s, "DATA %u / %u * %u flg %x err %d\n",
272 data->bytes_xfered, data->blocks, 272 data->bytes_xfered, data->blocks,
@@ -276,7 +276,7 @@ static int atmci_req_show(struct seq_file *s, void *v)
276 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n", 276 "CMD%u(0x%x) flg %x rsp %x %x %x %x err %d\n",
277 stop->opcode, stop->arg, stop->flags, 277 stop->opcode, stop->arg, stop->flags,
278 stop->resp[0], stop->resp[1], stop->resp[2], 278 stop->resp[0], stop->resp[1], stop->resp[2],
279 stop->resp[2], stop->error); 279 stop->resp[3], stop->error);
280 } 280 }
281 281
282 spin_unlock_bh(&slot->host->lock); 282 spin_unlock_bh(&slot->host->lock);
@@ -569,9 +569,10 @@ static void atmci_dma_cleanup(struct atmel_mci *host)
569{ 569{
570 struct mmc_data *data = host->data; 570 struct mmc_data *data = host->data;
571 571
572 dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len, 572 if (data)
573 ((data->flags & MMC_DATA_WRITE) 573 dma_unmap_sg(&host->pdev->dev, data->sg, data->sg_len,
574 ? DMA_TO_DEVICE : DMA_FROM_DEVICE)); 574 ((data->flags & MMC_DATA_WRITE)
575 ? DMA_TO_DEVICE : DMA_FROM_DEVICE));
575} 576}
576 577
577static void atmci_stop_dma(struct atmel_mci *host) 578static void atmci_stop_dma(struct atmel_mci *host)
@@ -1099,8 +1100,8 @@ static void atmci_command_complete(struct atmel_mci *host,
1099 "command error: status=0x%08x\n", status); 1100 "command error: status=0x%08x\n", status);
1100 1101
1101 if (cmd->data) { 1102 if (cmd->data) {
1102 host->data = NULL;
1103 atmci_stop_dma(host); 1103 atmci_stop_dma(host);
1104 host->data = NULL;
1104 mci_writel(host, IDR, MCI_NOTBUSY 1105 mci_writel(host, IDR, MCI_NOTBUSY
1105 | MCI_TXRDY | MCI_RXRDY 1106 | MCI_TXRDY | MCI_RXRDY
1106 | ATMCI_DATA_ERROR_FLAGS); 1107 | ATMCI_DATA_ERROR_FLAGS);
@@ -1293,6 +1294,7 @@ static void atmci_tasklet_func(unsigned long priv)
1293 } else { 1294 } else {
1294 data->bytes_xfered = data->blocks * data->blksz; 1295 data->bytes_xfered = data->blocks * data->blksz;
1295 data->error = 0; 1296 data->error = 0;
1297 mci_writel(host, IDR, ATMCI_DATA_ERROR_FLAGS);
1296 } 1298 }
1297 1299
1298 if (!data->stop) { 1300 if (!data->stop) {
@@ -1751,13 +1753,13 @@ static int __init atmci_probe(struct platform_device *pdev)
1751 ret = -ENODEV; 1753 ret = -ENODEV;
1752 if (pdata->slot[0].bus_width) { 1754 if (pdata->slot[0].bus_width) {
1753 ret = atmci_init_slot(host, &pdata->slot[0], 1755 ret = atmci_init_slot(host, &pdata->slot[0],
1754 MCI_SDCSEL_SLOT_A, 0); 1756 0, MCI_SDCSEL_SLOT_A);
1755 if (!ret) 1757 if (!ret)
1756 nr_slots++; 1758 nr_slots++;
1757 } 1759 }
1758 if (pdata->slot[1].bus_width) { 1760 if (pdata->slot[1].bus_width) {
1759 ret = atmci_init_slot(host, &pdata->slot[1], 1761 ret = atmci_init_slot(host, &pdata->slot[1],
1760 MCI_SDCSEL_SLOT_B, 1); 1762 1, MCI_SDCSEL_SLOT_B);
1761 if (!ret) 1763 if (!ret)
1762 nr_slots++; 1764 nr_slots++;
1763 } 1765 }
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index ed5e9742be2c..a8f0512bad38 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -674,6 +674,7 @@ static struct zorro_device_id a2065_zorro_tbl[] __devinitdata = {
674 { ZORRO_PROD_AMERISTAR_A2065 }, 674 { ZORRO_PROD_AMERISTAR_A2065 },
675 { 0 } 675 { 0 }
676}; 676};
677MODULE_DEVICE_TABLE(zorro, a2065_zorro_tbl);
677 678
678static struct zorro_driver a2065_driver = { 679static struct zorro_driver a2065_driver = {
679 .name = "a2065", 680 .name = "a2065",
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index fa1a2354f5f9..4b30a46486e2 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -145,6 +145,7 @@ static struct zorro_device_id ariadne_zorro_tbl[] __devinitdata = {
145 { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE }, 145 { ZORRO_PROD_VILLAGE_TRONIC_ARIADNE },
146 { 0 } 146 { 0 }
147}; 147};
148MODULE_DEVICE_TABLE(zorro, ariadne_zorro_tbl);
148 149
149static struct zorro_driver ariadne_driver = { 150static struct zorro_driver ariadne_driver = {
150 .name = "ariadne", 151 .name = "ariadne",
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 4e97ca182997..5d3763fb3472 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1649,6 +1649,7 @@ static void free_skb_resources(struct gfar_private *priv)
1649 sizeof(struct rxbd8) * priv->total_rx_ring_size, 1649 sizeof(struct rxbd8) * priv->total_rx_ring_size,
1650 priv->tx_queue[0]->tx_bd_base, 1650 priv->tx_queue[0]->tx_bd_base,
1651 priv->tx_queue[0]->tx_bd_dma_base); 1651 priv->tx_queue[0]->tx_bd_dma_base);
1652 skb_queue_purge(&priv->rx_recycle);
1652} 1653}
1653 1654
1654void gfar_start(struct net_device *dev) 1655void gfar_start(struct net_device *dev)
@@ -2088,7 +2089,6 @@ static int gfar_close(struct net_device *dev)
2088 2089
2089 disable_napi(priv); 2090 disable_napi(priv);
2090 2091
2091 skb_queue_purge(&priv->rx_recycle);
2092 cancel_work_sync(&priv->reset_task); 2092 cancel_work_sync(&priv->reset_task);
2093 stop_gfar(dev); 2093 stop_gfar(dev);
2094 2094
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c
index 24724b4ad709..07d8e5b634f3 100644
--- a/drivers/net/hydra.c
+++ b/drivers/net/hydra.c
@@ -71,6 +71,7 @@ static struct zorro_device_id hydra_zorro_tbl[] __devinitdata = {
71 { ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET }, 71 { ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET },
72 { 0 } 72 { 0 }
73}; 73};
74MODULE_DEVICE_TABLE(zorro, hydra_zorro_tbl);
74 75
75static struct zorro_driver hydra_driver = { 76static struct zorro_driver hydra_driver = {
76 .name = "hydra", 77 .name = "hydra",
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 0cd80e4d71d9..e67691dca4ab 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -32,6 +32,7 @@ static int kszphy_config_init(struct phy_device *phydev)
32 32
33static struct phy_driver ks8001_driver = { 33static struct phy_driver ks8001_driver = {
34 .phy_id = PHY_ID_KS8001, 34 .phy_id = PHY_ID_KS8001,
35 .name = "Micrel KS8001",
35 .phy_id_mask = 0x00fffff0, 36 .phy_id_mask = 0x00fffff0,
36 .features = PHY_BASIC_FEATURES, 37 .features = PHY_BASIC_FEATURES,
37 .flags = PHY_POLL, 38 .flags = PHY_POLL,
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index f9f0730b53d5..5ec542dd5b50 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -187,7 +187,6 @@ tx_drop:
187 return NETDEV_TX_OK; 187 return NETDEV_TX_OK;
188 188
189rx_drop: 189rx_drop:
190 kfree_skb(skb);
191 rcv_stats->rx_dropped++; 190 rcv_stats->rx_dropped++;
192 return NETDEV_TX_OK; 191 return NETDEV_TX_OK;
193} 192}
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index 99a6da464bd3..e1c2fcaa8bed 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -727,12 +727,16 @@ static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
727{ 727{
728 struct device *parent = aru->udev->dev.parent; 728 struct device *parent = aru->udev->dev.parent;
729 729
730 complete(&aru->firmware_loading_complete);
731
730 /* unbind anything failed */ 732 /* unbind anything failed */
731 if (parent) 733 if (parent)
732 down(&parent->sem); 734 down(&parent->sem);
733 device_release_driver(&aru->udev->dev); 735 device_release_driver(&aru->udev->dev);
734 if (parent) 736 if (parent)
735 up(&parent->sem); 737 up(&parent->sem);
738
739 usb_put_dev(aru->udev);
736} 740}
737 741
738static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context) 742static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
@@ -761,6 +765,8 @@ static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
761 if (err) 765 if (err)
762 goto err_unrx; 766 goto err_unrx;
763 767
768 complete(&aru->firmware_loading_complete);
769 usb_put_dev(aru->udev);
764 return; 770 return;
765 771
766 err_unrx: 772 err_unrx:
@@ -858,6 +864,7 @@ static int ar9170_usb_probe(struct usb_interface *intf,
858 init_usb_anchor(&aru->tx_pending); 864 init_usb_anchor(&aru->tx_pending);
859 init_usb_anchor(&aru->tx_submitted); 865 init_usb_anchor(&aru->tx_submitted);
860 init_completion(&aru->cmd_wait); 866 init_completion(&aru->cmd_wait);
867 init_completion(&aru->firmware_loading_complete);
861 spin_lock_init(&aru->tx_urb_lock); 868 spin_lock_init(&aru->tx_urb_lock);
862 869
863 aru->tx_pending_urbs = 0; 870 aru->tx_pending_urbs = 0;
@@ -877,6 +884,7 @@ static int ar9170_usb_probe(struct usb_interface *intf,
877 if (err) 884 if (err)
878 goto err_freehw; 885 goto err_freehw;
879 886
887 usb_get_dev(aru->udev);
880 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw", 888 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw",
881 &aru->udev->dev, GFP_KERNEL, aru, 889 &aru->udev->dev, GFP_KERNEL, aru,
882 ar9170_usb_firmware_step2); 890 ar9170_usb_firmware_step2);
@@ -896,6 +904,9 @@ static void ar9170_usb_disconnect(struct usb_interface *intf)
896 return; 904 return;
897 905
898 aru->common.state = AR9170_IDLE; 906 aru->common.state = AR9170_IDLE;
907
908 wait_for_completion(&aru->firmware_loading_complete);
909
899 ar9170_unregister(&aru->common); 910 ar9170_unregister(&aru->common);
900 ar9170_usb_cancel_urbs(aru); 911 ar9170_usb_cancel_urbs(aru);
901 912
diff --git a/drivers/net/wireless/ath/ar9170/usb.h b/drivers/net/wireless/ath/ar9170/usb.h
index a2ce3b169ceb..919b06046eb3 100644
--- a/drivers/net/wireless/ath/ar9170/usb.h
+++ b/drivers/net/wireless/ath/ar9170/usb.h
@@ -71,6 +71,7 @@ struct ar9170_usb {
71 unsigned int tx_pending_urbs; 71 unsigned int tx_pending_urbs;
72 72
73 struct completion cmd_wait; 73 struct completion cmd_wait;
74 struct completion firmware_loading_complete;
74 int readlen; 75 int readlen;
75 u8 *readbuf; 76 u8 *readbuf;
76 77
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 6383d9f8c9b3..f4e59ae07f8e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -2621,7 +2621,9 @@ struct iwl_ssid_ie {
2621#define PROBE_OPTION_MAX_3945 4 2621#define PROBE_OPTION_MAX_3945 4
2622#define PROBE_OPTION_MAX 20 2622#define PROBE_OPTION_MAX 20
2623#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) 2623#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
2624#define IWL_GOOD_CRC_TH cpu_to_le16(1) 2624#define IWL_GOOD_CRC_TH_DISABLED 0
2625#define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2626#define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
2625#define IWL_MAX_SCAN_SIZE 1024 2627#define IWL_MAX_SCAN_SIZE 1024
2626#define IWL_MAX_CMD_SIZE 4096 2628#define IWL_MAX_CMD_SIZE 4096
2627#define IWL_MAX_PROBE_REQUEST 200 2629#define IWL_MAX_PROBE_REQUEST 200
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 12e455a4b90e..741e65ec8301 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -813,16 +813,29 @@ static void iwl_bg_request_scan(struct work_struct *data)
813 rate = IWL_RATE_1M_PLCP; 813 rate = IWL_RATE_1M_PLCP;
814 rate_flags = RATE_MCS_CCK_MSK; 814 rate_flags = RATE_MCS_CCK_MSK;
815 } 815 }
816 scan->good_CRC_th = 0; 816 scan->good_CRC_th = IWL_GOOD_CRC_TH_DISABLED;
817 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { 817 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) {
818 band = IEEE80211_BAND_5GHZ; 818 band = IEEE80211_BAND_5GHZ;
819 rate = IWL_RATE_6M_PLCP; 819 rate = IWL_RATE_6M_PLCP;
820 /* 820 /*
821 * If active scaning is requested but a certain channel 821 * If active scanning is requested but a certain channel is
822 * is marked passive, we can do active scanning if we 822 * marked passive, we can do active scanning if we detect
823 * detect transmissions. 823 * transmissions.
824 *
825 * There is an issue with some firmware versions that triggers
826 * a sysassert on a "good CRC threshold" of zero (== disabled),
827 * on a radar channel even though this means that we should NOT
828 * send probes.
829 *
830 * The "good CRC threshold" is the number of frames that we
831 * need to receive during our dwell time on a channel before
832 * sending out probes -- setting this to a huge value will
833 * mean we never reach it, but at the same time work around
834 * the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER
835 * here instead of IWL_GOOD_CRC_TH_DISABLED.
824 */ 836 */
825 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; 837 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT :
838 IWL_GOOD_CRC_TH_NEVER;
826 839
827 /* Force use of chains B and C (0x6) for scan Rx for 4965 840 /* Force use of chains B and C (0x6) for scan Rx for 4965
828 * Avoid A (0x1) because of its off-channel reception on A-band. 841 * Avoid A (0x1) because of its off-channel reception on A-band.
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index b55e4f39a9e1..b74a56c48d26 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2967,7 +2967,8 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2967 * is marked passive, we can do active scanning if we 2967 * is marked passive, we can do active scanning if we
2968 * detect transmissions. 2968 * detect transmissions.
2969 */ 2969 */
2970 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; 2970 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT :
2971 IWL_GOOD_CRC_TH_DISABLED;
2971 band = IEEE80211_BAND_5GHZ; 2972 band = IEEE80211_BAND_5GHZ;
2972 } else { 2973 } else {
2973 IWL_WARN(priv, "Invalid scan band count\n"); 2974 IWL_WARN(priv, "Invalid scan band count\n");
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index 81c753a617ab..9548cbb5012a 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -102,6 +102,7 @@ static struct zorro_device_id zorro8390_zorro_tbl[] __devinitdata = {
102 { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, }, 102 { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, },
103 { 0 } 103 { 0 }
104}; 104};
105MODULE_DEVICE_TABLE(zorro, zorro8390_zorro_tbl);
105 106
106static struct zorro_driver zorro8390_driver = { 107static struct zorro_driver zorro8390_driver = {
107 .name = "zorro8390", 108 .name = "zorro8390",
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index 7581dbe456da..219f79e2210a 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -30,23 +30,7 @@
30 30
31#define OP_BUFFER_FLAGS 0 31#define OP_BUFFER_FLAGS 0
32 32
33/* 33static struct ring_buffer *op_ring_buffer;
34 * Read and write access is using spin locking. Thus, writing to the
35 * buffer by NMI handler (x86) could occur also during critical
36 * sections when reading the buffer. To avoid this, there are 2
37 * buffers for independent read and write access. Read access is in
38 * process context only, write access only in the NMI handler. If the
39 * read buffer runs empty, both buffers are swapped atomically. There
40 * is potentially a small window during swapping where the buffers are
41 * disabled and samples could be lost.
42 *
43 * Using 2 buffers is a little bit overhead, but the solution is clear
44 * and does not require changes in the ring buffer implementation. It
45 * can be changed to a single buffer solution when the ring buffer
46 * access is implemented as non-locking atomic code.
47 */
48static struct ring_buffer *op_ring_buffer_read;
49static struct ring_buffer *op_ring_buffer_write;
50DEFINE_PER_CPU(struct oprofile_cpu_buffer, op_cpu_buffer); 34DEFINE_PER_CPU(struct oprofile_cpu_buffer, op_cpu_buffer);
51 35
52static void wq_sync_buffer(struct work_struct *work); 36static void wq_sync_buffer(struct work_struct *work);
@@ -68,12 +52,9 @@ void oprofile_cpu_buffer_inc_smpl_lost(void)
68 52
69void free_cpu_buffers(void) 53void free_cpu_buffers(void)
70{ 54{
71 if (op_ring_buffer_read) 55 if (op_ring_buffer)
72 ring_buffer_free(op_ring_buffer_read); 56 ring_buffer_free(op_ring_buffer);
73 op_ring_buffer_read = NULL; 57 op_ring_buffer = NULL;
74 if (op_ring_buffer_write)
75 ring_buffer_free(op_ring_buffer_write);
76 op_ring_buffer_write = NULL;
77} 58}
78 59
79#define RB_EVENT_HDR_SIZE 4 60#define RB_EVENT_HDR_SIZE 4
@@ -86,11 +67,8 @@ int alloc_cpu_buffers(void)
86 unsigned long byte_size = buffer_size * (sizeof(struct op_sample) + 67 unsigned long byte_size = buffer_size * (sizeof(struct op_sample) +
87 RB_EVENT_HDR_SIZE); 68 RB_EVENT_HDR_SIZE);
88 69
89 op_ring_buffer_read = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS); 70 op_ring_buffer = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS);
90 if (!op_ring_buffer_read) 71 if (!op_ring_buffer)
91 goto fail;
92 op_ring_buffer_write = ring_buffer_alloc(byte_size, OP_BUFFER_FLAGS);
93 if (!op_ring_buffer_write)
94 goto fail; 72 goto fail;
95 73
96 for_each_possible_cpu(i) { 74 for_each_possible_cpu(i) {
@@ -162,16 +140,11 @@ struct op_sample
162*op_cpu_buffer_write_reserve(struct op_entry *entry, unsigned long size) 140*op_cpu_buffer_write_reserve(struct op_entry *entry, unsigned long size)
163{ 141{
164 entry->event = ring_buffer_lock_reserve 142 entry->event = ring_buffer_lock_reserve
165 (op_ring_buffer_write, sizeof(struct op_sample) + 143 (op_ring_buffer, sizeof(struct op_sample) +
166 size * sizeof(entry->sample->data[0])); 144 size * sizeof(entry->sample->data[0]));
167 if (entry->event) 145 if (!entry->event)
168 entry->sample = ring_buffer_event_data(entry->event);
169 else
170 entry->sample = NULL;
171
172 if (!entry->sample)
173 return NULL; 146 return NULL;
174 147 entry->sample = ring_buffer_event_data(entry->event);
175 entry->size = size; 148 entry->size = size;
176 entry->data = entry->sample->data; 149 entry->data = entry->sample->data;
177 150
@@ -180,25 +153,16 @@ struct op_sample
180 153
181int op_cpu_buffer_write_commit(struct op_entry *entry) 154int op_cpu_buffer_write_commit(struct op_entry *entry)
182{ 155{
183 return ring_buffer_unlock_commit(op_ring_buffer_write, entry->event); 156 return ring_buffer_unlock_commit(op_ring_buffer, entry->event);
184} 157}
185 158
186struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu) 159struct op_sample *op_cpu_buffer_read_entry(struct op_entry *entry, int cpu)
187{ 160{
188 struct ring_buffer_event *e; 161 struct ring_buffer_event *e;
189 e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL, NULL); 162 e = ring_buffer_consume(op_ring_buffer, cpu, NULL, NULL);
190 if (e) 163 if (!e)
191 goto event;
192 if (ring_buffer_swap_cpu(op_ring_buffer_read,
193 op_ring_buffer_write,
194 cpu))
195 return NULL; 164 return NULL;
196 e = ring_buffer_consume(op_ring_buffer_read, cpu, NULL, NULL);
197 if (e)
198 goto event;
199 return NULL;
200 165
201event:
202 entry->event = e; 166 entry->event = e;
203 entry->sample = ring_buffer_event_data(e); 167 entry->sample = ring_buffer_event_data(e);
204 entry->size = (ring_buffer_event_length(e) - sizeof(struct op_sample)) 168 entry->size = (ring_buffer_event_length(e) - sizeof(struct op_sample))
@@ -209,8 +173,7 @@ event:
209 173
210unsigned long op_cpu_buffer_entries(int cpu) 174unsigned long op_cpu_buffer_entries(int cpu)
211{ 175{
212 return ring_buffer_entries_cpu(op_ring_buffer_read, cpu) 176 return ring_buffer_entries_cpu(op_ring_buffer, cpu);
213 + ring_buffer_entries_cpu(op_ring_buffer_write, cpu);
214} 177}
215 178
216static int 179static int
@@ -356,8 +319,16 @@ void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
356 319
357void oprofile_add_sample(struct pt_regs * const regs, unsigned long event) 320void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
358{ 321{
359 int is_kernel = !user_mode(regs); 322 int is_kernel;
360 unsigned long pc = profile_pc(regs); 323 unsigned long pc;
324
325 if (likely(regs)) {
326 is_kernel = !user_mode(regs);
327 pc = profile_pc(regs);
328 } else {
329 is_kernel = 0; /* This value will not be used */
330 pc = ESCAPE_CODE; /* as this causes an early return. */
331 }
361 332
362 __oprofile_add_ext_sample(pc, regs, event, is_kernel); 333 __oprofile_add_ext_sample(pc, regs, event, is_kernel);
363} 334}
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c
index dc8a0428260d..b336cd9ee7a1 100644
--- a/drivers/oprofile/oprof.c
+++ b/drivers/oprofile/oprof.c
@@ -253,22 +253,26 @@ static int __init oprofile_init(void)
253 int err; 253 int err;
254 254
255 err = oprofile_arch_init(&oprofile_ops); 255 err = oprofile_arch_init(&oprofile_ops);
256
257 if (err < 0 || timer) { 256 if (err < 0 || timer) {
258 printk(KERN_INFO "oprofile: using timer interrupt.\n"); 257 printk(KERN_INFO "oprofile: using timer interrupt.\n");
259 oprofile_timer_init(&oprofile_ops); 258 err = oprofile_timer_init(&oprofile_ops);
259 if (err)
260 goto out_arch;
260 } 261 }
261
262 err = oprofilefs_register(); 262 err = oprofilefs_register();
263 if (err) 263 if (err)
264 oprofile_arch_exit(); 264 goto out_arch;
265 return 0;
265 266
267out_arch:
268 oprofile_arch_exit();
266 return err; 269 return err;
267} 270}
268 271
269 272
270static void __exit oprofile_exit(void) 273static void __exit oprofile_exit(void)
271{ 274{
275 oprofile_timer_exit();
272 oprofilefs_unregister(); 276 oprofilefs_unregister();
273 oprofile_arch_exit(); 277 oprofile_arch_exit();
274} 278}
diff --git a/drivers/oprofile/oprof.h b/drivers/oprofile/oprof.h
index cb92f5c98c1a..47e12cb4ee8b 100644
--- a/drivers/oprofile/oprof.h
+++ b/drivers/oprofile/oprof.h
@@ -34,7 +34,8 @@ struct super_block;
34struct dentry; 34struct dentry;
35 35
36void oprofile_create_files(struct super_block *sb, struct dentry *root); 36void oprofile_create_files(struct super_block *sb, struct dentry *root);
37void oprofile_timer_init(struct oprofile_operations *ops); 37int oprofile_timer_init(struct oprofile_operations *ops);
38void oprofile_timer_exit(void);
38 39
39int oprofile_set_backtrace(unsigned long depth); 40int oprofile_set_backtrace(unsigned long depth);
40int oprofile_set_timeout(unsigned long time); 41int oprofile_set_timeout(unsigned long time);
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c
index 333f915568c7..dc0ae4d14dff 100644
--- a/drivers/oprofile/timer_int.c
+++ b/drivers/oprofile/timer_int.c
@@ -13,34 +13,94 @@
13#include <linux/oprofile.h> 13#include <linux/oprofile.h>
14#include <linux/profile.h> 14#include <linux/profile.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/cpu.h>
17#include <linux/hrtimer.h>
18#include <asm/irq_regs.h>
16#include <asm/ptrace.h> 19#include <asm/ptrace.h>
17 20
18#include "oprof.h" 21#include "oprof.h"
19 22
20static int timer_notify(struct pt_regs *regs) 23static DEFINE_PER_CPU(struct hrtimer, oprofile_hrtimer);
24
25static enum hrtimer_restart oprofile_hrtimer_notify(struct hrtimer *hrtimer)
26{
27 oprofile_add_sample(get_irq_regs(), 0);
28 hrtimer_forward_now(hrtimer, ns_to_ktime(TICK_NSEC));
29 return HRTIMER_RESTART;
30}
31
32static void __oprofile_hrtimer_start(void *unused)
33{
34 struct hrtimer *hrtimer = &__get_cpu_var(oprofile_hrtimer);
35
36 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
37 hrtimer->function = oprofile_hrtimer_notify;
38
39 hrtimer_start(hrtimer, ns_to_ktime(TICK_NSEC),
40 HRTIMER_MODE_REL_PINNED);
41}
42
43static int oprofile_hrtimer_start(void)
21{ 44{
22 oprofile_add_sample(regs, 0); 45 on_each_cpu(__oprofile_hrtimer_start, NULL, 1);
23 return 0; 46 return 0;
24} 47}
25 48
26static int timer_start(void) 49static void __oprofile_hrtimer_stop(int cpu)
27{ 50{
28 return register_timer_hook(timer_notify); 51 struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu);
52
53 hrtimer_cancel(hrtimer);
29} 54}
30 55
56static void oprofile_hrtimer_stop(void)
57{
58 int cpu;
59
60 for_each_online_cpu(cpu)
61 __oprofile_hrtimer_stop(cpu);
62}
31 63
32static void timer_stop(void) 64static int __cpuinit oprofile_cpu_notify(struct notifier_block *self,
65 unsigned long action, void *hcpu)
33{ 66{
34 unregister_timer_hook(timer_notify); 67 long cpu = (long) hcpu;
68
69 switch (action) {
70 case CPU_ONLINE:
71 case CPU_ONLINE_FROZEN:
72 smp_call_function_single(cpu, __oprofile_hrtimer_start,
73 NULL, 1);
74 break;
75 case CPU_DEAD:
76 case CPU_DEAD_FROZEN:
77 __oprofile_hrtimer_stop(cpu);
78 break;
79 }
80 return NOTIFY_OK;
35} 81}
36 82
83static struct notifier_block __refdata oprofile_cpu_notifier = {
84 .notifier_call = oprofile_cpu_notify,
85};
37 86
38void __init oprofile_timer_init(struct oprofile_operations *ops) 87int __init oprofile_timer_init(struct oprofile_operations *ops)
39{ 88{
89 int rc;
90
91 rc = register_hotcpu_notifier(&oprofile_cpu_notifier);
92 if (rc)
93 return rc;
40 ops->create_files = NULL; 94 ops->create_files = NULL;
41 ops->setup = NULL; 95 ops->setup = NULL;
42 ops->shutdown = NULL; 96 ops->shutdown = NULL;
43 ops->start = timer_start; 97 ops->start = oprofile_hrtimer_start;
44 ops->stop = timer_stop; 98 ops->stop = oprofile_hrtimer_stop;
45 ops->cpu_type = "timer"; 99 ops->cpu_type = "timer";
100 return 0;
101}
102
103void __exit oprofile_timer_exit(void)
104{
105 unregister_hotcpu_notifier(&oprofile_cpu_notifier);
46} 106}
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 417312528ddf..371dc564e2e4 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -3626,14 +3626,15 @@ static void intel_iommu_detach_device(struct iommu_domain *domain,
3626 domain_remove_one_dev_info(dmar_domain, pdev); 3626 domain_remove_one_dev_info(dmar_domain, pdev);
3627} 3627}
3628 3628
3629static int intel_iommu_map_range(struct iommu_domain *domain, 3629static int intel_iommu_map(struct iommu_domain *domain,
3630 unsigned long iova, phys_addr_t hpa, 3630 unsigned long iova, phys_addr_t hpa,
3631 size_t size, int iommu_prot) 3631 int gfp_order, int iommu_prot)
3632{ 3632{
3633 struct dmar_domain *dmar_domain = domain->priv; 3633 struct dmar_domain *dmar_domain = domain->priv;
3634 u64 max_addr; 3634 u64 max_addr;
3635 int addr_width; 3635 int addr_width;
3636 int prot = 0; 3636 int prot = 0;
3637 size_t size;
3637 int ret; 3638 int ret;
3638 3639
3639 if (iommu_prot & IOMMU_READ) 3640 if (iommu_prot & IOMMU_READ)
@@ -3643,6 +3644,7 @@ static int intel_iommu_map_range(struct iommu_domain *domain,
3643 if ((iommu_prot & IOMMU_CACHE) && dmar_domain->iommu_snooping) 3644 if ((iommu_prot & IOMMU_CACHE) && dmar_domain->iommu_snooping)
3644 prot |= DMA_PTE_SNP; 3645 prot |= DMA_PTE_SNP;
3645 3646
3647 size = PAGE_SIZE << gfp_order;
3646 max_addr = iova + size; 3648 max_addr = iova + size;
3647 if (dmar_domain->max_addr < max_addr) { 3649 if (dmar_domain->max_addr < max_addr) {
3648 int min_agaw; 3650 int min_agaw;
@@ -3669,19 +3671,19 @@ static int intel_iommu_map_range(struct iommu_domain *domain,
3669 return ret; 3671 return ret;
3670} 3672}
3671 3673
3672static void intel_iommu_unmap_range(struct iommu_domain *domain, 3674static int intel_iommu_unmap(struct iommu_domain *domain,
3673 unsigned long iova, size_t size) 3675 unsigned long iova, int gfp_order)
3674{ 3676{
3675 struct dmar_domain *dmar_domain = domain->priv; 3677 struct dmar_domain *dmar_domain = domain->priv;
3676 3678 size_t size = PAGE_SIZE << gfp_order;
3677 if (!size)
3678 return;
3679 3679
3680 dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, 3680 dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT,
3681 (iova + size - 1) >> VTD_PAGE_SHIFT); 3681 (iova + size - 1) >> VTD_PAGE_SHIFT);
3682 3682
3683 if (dmar_domain->max_addr == iova + size) 3683 if (dmar_domain->max_addr == iova + size)
3684 dmar_domain->max_addr = iova; 3684 dmar_domain->max_addr = iova;
3685
3686 return gfp_order;
3685} 3687}
3686 3688
3687static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, 3689static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain,
@@ -3714,8 +3716,8 @@ static struct iommu_ops intel_iommu_ops = {
3714 .domain_destroy = intel_iommu_domain_destroy, 3716 .domain_destroy = intel_iommu_domain_destroy,
3715 .attach_dev = intel_iommu_attach_device, 3717 .attach_dev = intel_iommu_attach_device,
3716 .detach_dev = intel_iommu_detach_device, 3718 .detach_dev = intel_iommu_detach_device,
3717 .map = intel_iommu_map_range, 3719 .map = intel_iommu_map,
3718 .unmap = intel_iommu_unmap_range, 3720 .unmap = intel_iommu_unmap,
3719 .iova_to_phys = intel_iommu_iova_to_phys, 3721 .iova_to_phys = intel_iommu_iova_to_phys,
3720 .domain_has_cap = intel_iommu_domain_has_cap, 3722 .domain_has_cap = intel_iommu_domain_has_cap,
3721}; 3723};
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 4fe36d2e1049..19b111383f62 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -838,65 +838,11 @@ static void pci_bus_dump_resources(struct pci_bus *bus)
838 } 838 }
839} 839}
840 840
841static int __init pci_bus_get_depth(struct pci_bus *bus)
842{
843 int depth = 0;
844 struct pci_dev *dev;
845
846 list_for_each_entry(dev, &bus->devices, bus_list) {
847 int ret;
848 struct pci_bus *b = dev->subordinate;
849 if (!b)
850 continue;
851
852 ret = pci_bus_get_depth(b);
853 if (ret + 1 > depth)
854 depth = ret + 1;
855 }
856
857 return depth;
858}
859static int __init pci_get_max_depth(void)
860{
861 int depth = 0;
862 struct pci_bus *bus;
863
864 list_for_each_entry(bus, &pci_root_buses, node) {
865 int ret;
866
867 ret = pci_bus_get_depth(bus);
868 if (ret > depth)
869 depth = ret;
870 }
871
872 return depth;
873}
874
875/*
876 * first try will not touch pci bridge res
877 * second and later try will clear small leaf bridge res
878 * will stop till to the max deepth if can not find good one
879 */
880void __init 841void __init
881pci_assign_unassigned_resources(void) 842pci_assign_unassigned_resources(void)
882{ 843{
883 struct pci_bus *bus; 844 struct pci_bus *bus;
884 int tried_times = 0;
885 enum release_type rel_type = leaf_only;
886 struct resource_list_x head, *list;
887 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
888 IORESOURCE_PREFETCH;
889 unsigned long failed_type;
890 int max_depth = pci_get_max_depth();
891 int pci_try_num;
892 845
893 head.next = NULL;
894
895 pci_try_num = max_depth + 1;
896 printk(KERN_DEBUG "PCI: max bus depth: %d pci_try_num: %d\n",
897 max_depth, pci_try_num);
898
899again:
900 /* Depth first, calculate sizes and alignments of all 846 /* Depth first, calculate sizes and alignments of all
901 subordinate buses. */ 847 subordinate buses. */
902 list_for_each_entry(bus, &pci_root_buses, node) { 848 list_for_each_entry(bus, &pci_root_buses, node) {
@@ -904,65 +850,9 @@ again:
904 } 850 }
905 /* Depth last, allocate resources and update the hardware. */ 851 /* Depth last, allocate resources and update the hardware. */
906 list_for_each_entry(bus, &pci_root_buses, node) { 852 list_for_each_entry(bus, &pci_root_buses, node) {
907 __pci_bus_assign_resources(bus, &head); 853 pci_bus_assign_resources(bus);
908 }
909 tried_times++;
910
911 /* any device complain? */
912 if (!head.next)
913 goto enable_and_dump;
914 failed_type = 0;
915 for (list = head.next; list;) {
916 failed_type |= list->flags;
917 list = list->next;
918 }
919 /*
920 * io port are tight, don't try extra
921 * or if reach the limit, don't want to try more
922 */
923 failed_type &= type_mask;
924 if ((failed_type == IORESOURCE_IO) || (tried_times >= pci_try_num)) {
925 free_failed_list(&head);
926 goto enable_and_dump;
927 }
928
929 printk(KERN_DEBUG "PCI: No. %d try to assign unassigned res\n",
930 tried_times + 1);
931
932 /* third times and later will not check if it is leaf */
933 if ((tried_times + 1) > 2)
934 rel_type = whole_subtree;
935
936 /*
937 * Try to release leaf bridge's resources that doesn't fit resource of
938 * child device under that bridge
939 */
940 for (list = head.next; list;) {
941 bus = list->dev->bus;
942 pci_bus_release_bridge_resources(bus, list->flags & type_mask,
943 rel_type);
944 list = list->next;
945 }
946 /* restore size and flags */
947 for (list = head.next; list;) {
948 struct resource *res = list->res;
949
950 res->start = list->start;
951 res->end = list->end;
952 res->flags = list->flags;
953 if (list->dev->subordinate)
954 res->flags = 0;
955
956 list = list->next;
957 }
958 free_failed_list(&head);
959
960 goto again;
961
962enable_and_dump:
963 /* Depth last, update the hardware. */
964 list_for_each_entry(bus, &pci_root_buses, node)
965 pci_enable_bridges(bus); 854 pci_enable_bridges(bus);
855 }
966 856
967 /* dump the resource on buses */ 857 /* dump the resource on buses */
968 list_for_each_entry(bus, &pci_root_buses, node) { 858 list_for_each_entry(bus, &pci_root_buses, node) {
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 75ed866e6953..c3383750e333 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -671,20 +671,22 @@ static int pccardd(void *__skt)
671 socket_remove(skt); 671 socket_remove(skt);
672 if (sysfs_events & PCMCIA_UEVENT_INSERT) 672 if (sysfs_events & PCMCIA_UEVENT_INSERT)
673 socket_insert(skt); 673 socket_insert(skt);
674 if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
675 !(skt->state & SOCKET_CARDBUS)) {
676 ret = socket_resume(skt);
677 if (!ret && skt->callback)
678 skt->callback->resume(skt);
679 }
680 if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) && 674 if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) &&
681 !(skt->state & SOCKET_CARDBUS)) { 675 !(skt->state & SOCKET_CARDBUS)) {
682 if (skt->callback) 676 if (skt->callback)
683 ret = skt->callback->suspend(skt); 677 ret = skt->callback->suspend(skt);
684 else 678 else
685 ret = 0; 679 ret = 0;
686 if (!ret) 680 if (!ret) {
687 socket_suspend(skt); 681 socket_suspend(skt);
682 msleep(100);
683 }
684 }
685 if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
686 !(skt->state & SOCKET_CARDBUS)) {
687 ret = socket_resume(skt);
688 if (!ret && skt->callback)
689 skt->callback->resume(skt);
688 } 690 }
689 if ((sysfs_events & PCMCIA_UEVENT_REQUERY) && 691 if ((sysfs_events & PCMCIA_UEVENT_REQUERY) &&
690 !(skt->state & SOCKET_CARDBUS)) { 692 !(skt->state & SOCKET_CARDBUS)) {
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 508f94a2a78d..041eee43fd8d 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -1283,6 +1283,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1283 destroy_cis_cache(skt); 1283 destroy_cis_cache(skt);
1284 kfree(skt->fake_cis); 1284 kfree(skt->fake_cis);
1285 skt->fake_cis = NULL; 1285 skt->fake_cis = NULL;
1286 s->functions = 0;
1286 mutex_unlock(&s->ops_mutex); 1287 mutex_unlock(&s->ops_mutex);
1287 /* now, add the new card */ 1288 /* now, add the new card */
1288 ds_event(skt, CS_EVENT_CARD_INSERTION, 1289 ds_event(skt, CS_EVENT_CARD_INSERTION,
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 104e73d5d86c..7631faa0cadd 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -711,7 +711,7 @@ static int ds_open(struct inode *inode, struct file *file)
711 warning_printed = 1; 711 warning_printed = 1;
712 } 712 }
713 713
714 if (s->pcmcia_state.present) 714 if (atomic_read(&s->present))
715 queue_event(user, CS_EVENT_CARD_INSERTION); 715 queue_event(user, CS_EVENT_CARD_INSERTION);
716out: 716out:
717 unlock_kernel(); 717 unlock_kernel();
@@ -770,9 +770,6 @@ static ssize_t ds_read(struct file *file, char __user *buf,
770 return -EIO; 770 return -EIO;
771 771
772 s = user->socket; 772 s = user->socket;
773 if (s->pcmcia_state.dead)
774 return -EIO;
775
776 ret = wait_event_interruptible(s->queue, !queue_empty(user)); 773 ret = wait_event_interruptible(s->queue, !queue_empty(user));
777 if (ret == 0) 774 if (ret == 0)
778 ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; 775 ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4;
@@ -838,8 +835,6 @@ static int ds_ioctl(struct inode *inode, struct file *file,
838 return -EIO; 835 return -EIO;
839 836
840 s = user->socket; 837 s = user->socket;
841 if (s->pcmcia_state.dead)
842 return -EIO;
843 838
844 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 839 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
845 if (size > sizeof(ds_ioctl_arg_t)) 840 if (size > sizeof(ds_ioctl_arg_t))
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 35bb44af49b3..100e4d9372f1 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -274,26 +274,6 @@ static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev,
274 pnp_add_bus_resource(dev, start, end); 274 pnp_add_bus_resource(dev, start, end);
275} 275}
276 276
277static u64 addr_space_length(struct pnp_dev *dev, u64 min, u64 max, u64 len)
278{
279 u64 max_len;
280
281 max_len = max - min + 1;
282 if (len <= max_len)
283 return len;
284
285 /*
286 * Per 6.4.3.5, _LEN cannot exceed _MAX - _MIN + 1, but some BIOSes
287 * don't do this correctly, e.g.,
288 * https://bugzilla.kernel.org/show_bug.cgi?id=15480
289 */
290 dev_info(&dev->dev,
291 "resource length %#llx doesn't fit in %#llx-%#llx, trimming\n",
292 (unsigned long long) len, (unsigned long long) min,
293 (unsigned long long) max);
294 return max_len;
295}
296
297static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, 277static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
298 struct acpi_resource *res) 278 struct acpi_resource *res)
299{ 279{
@@ -309,7 +289,8 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
309 return; 289 return;
310 } 290 }
311 291
312 len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); 292 /* Windows apparently computes length rather than using _LEN */
293 len = p->maximum - p->minimum + 1;
313 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; 294 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
314 295
315 if (p->resource_type == ACPI_MEMORY_RANGE) 296 if (p->resource_type == ACPI_MEMORY_RANGE)
@@ -330,7 +311,8 @@ static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev,
330 int window; 311 int window;
331 u64 len; 312 u64 len;
332 313
333 len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); 314 /* Windows apparently computes length rather than using _LEN */
315 len = p->maximum - p->minimum + 1;
334 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; 316 window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0;
335 317
336 if (p->resource_type == ACPI_MEMORY_RANGE) 318 if (p->resource_type == ACPI_MEMORY_RANGE)
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 2e54e6a23c72..e3446ab8b563 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -211,6 +211,8 @@ int pnp_check_port(struct pnp_dev *dev, struct resource *res)
211 if (tres->flags & IORESOURCE_IO) { 211 if (tres->flags & IORESOURCE_IO) {
212 if (cannot_compare(tres->flags)) 212 if (cannot_compare(tres->flags))
213 continue; 213 continue;
214 if (tres->flags & IORESOURCE_WINDOW)
215 continue;
214 tport = &tres->start; 216 tport = &tres->start;
215 tend = &tres->end; 217 tend = &tres->end;
216 if (ranged_conflict(port, end, tport, tend)) 218 if (ranged_conflict(port, end, tport, tend))
@@ -271,6 +273,8 @@ int pnp_check_mem(struct pnp_dev *dev, struct resource *res)
271 if (tres->flags & IORESOURCE_MEM) { 273 if (tres->flags & IORESOURCE_MEM) {
272 if (cannot_compare(tres->flags)) 274 if (cannot_compare(tres->flags))
273 continue; 275 continue;
276 if (tres->flags & IORESOURCE_WINDOW)
277 continue;
274 taddr = &tres->start; 278 taddr = &tres->start;
275 tend = &tres->end; 279 tend = &tres->end;
276 if (ranged_conflict(addr, end, taddr, tend)) 280 if (ranged_conflict(addr, end, taddr, tend))
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index acf222f91f5a..fa2339cb1681 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -37,6 +37,9 @@
37 */ 37 */
38#define DASD_CHANQ_MAX_SIZE 4 38#define DASD_CHANQ_MAX_SIZE 4
39 39
40#define DASD_SLEEPON_START_TAG (void *) 1
41#define DASD_SLEEPON_END_TAG (void *) 2
42
40/* 43/*
41 * SECTION: exported variables of dasd.c 44 * SECTION: exported variables of dasd.c
42 */ 45 */
@@ -1472,7 +1475,10 @@ void dasd_add_request_tail(struct dasd_ccw_req *cqr)
1472 */ 1475 */
1473static void dasd_wakeup_cb(struct dasd_ccw_req *cqr, void *data) 1476static void dasd_wakeup_cb(struct dasd_ccw_req *cqr, void *data)
1474{ 1477{
1475 wake_up((wait_queue_head_t *) data); 1478 spin_lock_irq(get_ccwdev_lock(cqr->startdev->cdev));
1479 cqr->callback_data = DASD_SLEEPON_END_TAG;
1480 spin_unlock_irq(get_ccwdev_lock(cqr->startdev->cdev));
1481 wake_up(&generic_waitq);
1476} 1482}
1477 1483
1478static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr) 1484static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr)
@@ -1482,10 +1488,7 @@ static inline int _wait_for_wakeup(struct dasd_ccw_req *cqr)
1482 1488
1483 device = cqr->startdev; 1489 device = cqr->startdev;
1484 spin_lock_irq(get_ccwdev_lock(device->cdev)); 1490 spin_lock_irq(get_ccwdev_lock(device->cdev));
1485 rc = ((cqr->status == DASD_CQR_DONE || 1491 rc = (cqr->callback_data == DASD_SLEEPON_END_TAG);
1486 cqr->status == DASD_CQR_NEED_ERP ||
1487 cqr->status == DASD_CQR_TERMINATED) &&
1488 list_empty(&cqr->devlist));
1489 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 1492 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1490 return rc; 1493 return rc;
1491} 1494}
@@ -1573,7 +1576,7 @@ static int _dasd_sleep_on(struct dasd_ccw_req *maincqr, int interruptible)
1573 wait_event(generic_waitq, !(device->stopped)); 1576 wait_event(generic_waitq, !(device->stopped));
1574 1577
1575 cqr->callback = dasd_wakeup_cb; 1578 cqr->callback = dasd_wakeup_cb;
1576 cqr->callback_data = (void *) &generic_waitq; 1579 cqr->callback_data = DASD_SLEEPON_START_TAG;
1577 dasd_add_request_tail(cqr); 1580 dasd_add_request_tail(cqr);
1578 if (interruptible) { 1581 if (interruptible) {
1579 rc = wait_event_interruptible( 1582 rc = wait_event_interruptible(
@@ -1652,7 +1655,7 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
1652 } 1655 }
1653 1656
1654 cqr->callback = dasd_wakeup_cb; 1657 cqr->callback = dasd_wakeup_cb;
1655 cqr->callback_data = (void *) &generic_waitq; 1658 cqr->callback_data = DASD_SLEEPON_START_TAG;
1656 cqr->status = DASD_CQR_QUEUED; 1659 cqr->status = DASD_CQR_QUEUED;
1657 list_add(&cqr->devlist, &device->ccw_queue); 1660 list_add(&cqr->devlist, &device->ccw_queue);
1658 1661
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 9201afe65609..7f87979da22d 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -4724,6 +4724,10 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
4724 BUG_ON((unsigned long)asc_dvc->overrun_buf & 7); 4724 BUG_ON((unsigned long)asc_dvc->overrun_buf & 7);
4725 asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf, 4725 asc_dvc->overrun_dma = dma_map_single(board->dev, asc_dvc->overrun_buf,
4726 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE); 4726 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
4727 if (dma_mapping_error(board->dev, asc_dvc->overrun_dma)) {
4728 warn_code = -ENOMEM;
4729 goto err_dma_map;
4730 }
4727 phy_addr = cpu_to_le32(asc_dvc->overrun_dma); 4731 phy_addr = cpu_to_le32(asc_dvc->overrun_dma);
4728 AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D, 4732 AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D,
4729 (uchar *)&phy_addr, 1); 4733 (uchar *)&phy_addr, 1);
@@ -4739,14 +4743,23 @@ static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
4739 AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR); 4743 AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR);
4740 if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) { 4744 if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) {
4741 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR; 4745 asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
4742 return warn_code; 4746 warn_code = UW_ERR;
4747 goto err_mcode_start;
4743 } 4748 }
4744 if (AscStartChip(iop_base) != 1) { 4749 if (AscStartChip(iop_base) != 1) {
4745 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP; 4750 asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
4746 return warn_code; 4751 warn_code = UW_ERR;
4752 goto err_mcode_start;
4747 } 4753 }
4748 4754
4749 return warn_code; 4755 return warn_code;
4756
4757err_mcode_start:
4758 dma_unmap_single(board->dev, asc_dvc->overrun_dma,
4759 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
4760err_dma_map:
4761 asc_dvc->overrun_dma = 0;
4762 return warn_code;
4750} 4763}
4751 4764
4752static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc) 4765static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
@@ -4802,6 +4815,8 @@ static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
4802 } 4815 }
4803 release_firmware(fw); 4816 release_firmware(fw);
4804 warn_code |= AscInitMicroCodeVar(asc_dvc); 4817 warn_code |= AscInitMicroCodeVar(asc_dvc);
4818 if (!asc_dvc->overrun_dma)
4819 return warn_code;
4805 asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC; 4820 asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC;
4806 AscEnableInterrupt(iop_base); 4821 AscEnableInterrupt(iop_base);
4807 return warn_code; 4822 return warn_code;
@@ -7978,9 +7993,10 @@ static int advansys_reset(struct scsi_cmnd *scp)
7978 status = AscInitAsc1000Driver(asc_dvc); 7993 status = AscInitAsc1000Driver(asc_dvc);
7979 7994
7980 /* Refer to ASC_IERR_* definitions for meaning of 'err_code'. */ 7995 /* Refer to ASC_IERR_* definitions for meaning of 'err_code'. */
7981 if (asc_dvc->err_code) { 7996 if (asc_dvc->err_code || !asc_dvc->overrun_dma) {
7982 scmd_printk(KERN_INFO, scp, "SCSI bus reset error: " 7997 scmd_printk(KERN_INFO, scp, "SCSI bus reset error: "
7983 "0x%x\n", asc_dvc->err_code); 7998 "0x%x, status: 0x%x\n", asc_dvc->err_code,
7999 status);
7984 ret = FAILED; 8000 ret = FAILED;
7985 } else if (status) { 8001 } else if (status) {
7986 scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: " 8002 scmd_printk(KERN_INFO, scp, "SCSI bus reset warning: "
@@ -12311,7 +12327,7 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
12311 asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL); 12327 asc_dvc_varp->overrun_buf = kzalloc(ASC_OVERRUN_BSIZE, GFP_KERNEL);
12312 if (!asc_dvc_varp->overrun_buf) { 12328 if (!asc_dvc_varp->overrun_buf) {
12313 ret = -ENOMEM; 12329 ret = -ENOMEM;
12314 goto err_free_wide_mem; 12330 goto err_free_irq;
12315 } 12331 }
12316 warn_code = AscInitAsc1000Driver(asc_dvc_varp); 12332 warn_code = AscInitAsc1000Driver(asc_dvc_varp);
12317 12333
@@ -12320,30 +12336,36 @@ static int __devinit advansys_board_found(struct Scsi_Host *shost,
12320 "warn 0x%x, error 0x%x\n", 12336 "warn 0x%x, error 0x%x\n",
12321 asc_dvc_varp->init_state, warn_code, 12337 asc_dvc_varp->init_state, warn_code,
12322 asc_dvc_varp->err_code); 12338 asc_dvc_varp->err_code);
12323 if (asc_dvc_varp->err_code) { 12339 if (!asc_dvc_varp->overrun_dma) {
12324 ret = -ENODEV; 12340 ret = -ENODEV;
12325 kfree(asc_dvc_varp->overrun_buf); 12341 goto err_free_mem;
12326 } 12342 }
12327 } 12343 }
12328 } else { 12344 } else {
12329 if (advansys_wide_init_chip(shost)) 12345 if (advansys_wide_init_chip(shost)) {
12330 ret = -ENODEV; 12346 ret = -ENODEV;
12347 goto err_free_mem;
12348 }
12331 } 12349 }
12332 12350
12333 if (ret)
12334 goto err_free_wide_mem;
12335
12336 ASC_DBG_PRT_SCSI_HOST(2, shost); 12351 ASC_DBG_PRT_SCSI_HOST(2, shost);
12337 12352
12338 ret = scsi_add_host(shost, boardp->dev); 12353 ret = scsi_add_host(shost, boardp->dev);
12339 if (ret) 12354 if (ret)
12340 goto err_free_wide_mem; 12355 goto err_free_mem;
12341 12356
12342 scsi_scan_host(shost); 12357 scsi_scan_host(shost);
12343 return 0; 12358 return 0;
12344 12359
12345 err_free_wide_mem: 12360 err_free_mem:
12346 advansys_wide_free_mem(boardp); 12361 if (ASC_NARROW_BOARD(boardp)) {
12362 if (asc_dvc_varp->overrun_dma)
12363 dma_unmap_single(boardp->dev, asc_dvc_varp->overrun_dma,
12364 ASC_OVERRUN_BSIZE, DMA_FROM_DEVICE);
12365 kfree(asc_dvc_varp->overrun_buf);
12366 } else
12367 advansys_wide_free_mem(boardp);
12368 err_free_irq:
12347 free_irq(boardp->irq, shost); 12369 free_irq(boardp->irq, shost);
12348 err_free_dma: 12370 err_free_dma:
12349#ifdef CONFIG_ISA 12371#ifdef CONFIG_ISA
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 6d5ae4474bb3..633e09036357 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -471,12 +471,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
471 471
472 WARN_ON(hdrlength >= 256); 472 WARN_ON(hdrlength >= 256);
473 hdr->hlength = hdrlength & 0xFF; 473 hdr->hlength = hdrlength & 0xFF;
474 hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
474 475
475 if (session->tt->init_task && session->tt->init_task(task)) 476 if (session->tt->init_task && session->tt->init_task(task))
476 return -EIO; 477 return -EIO;
477 478
478 task->state = ISCSI_TASK_RUNNING; 479 task->state = ISCSI_TASK_RUNNING;
479 hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
480 session->cmdsn++; 480 session->cmdsn++;
481 481
482 conn->scsicmd_pdus_cnt++; 482 conn->scsicmd_pdus_cnt++;
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index b00efd19aadb..88f744672576 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -395,11 +395,15 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
395void sas_ata_task_abort(struct sas_task *task) 395void sas_ata_task_abort(struct sas_task *task)
396{ 396{
397 struct ata_queued_cmd *qc = task->uldd_task; 397 struct ata_queued_cmd *qc = task->uldd_task;
398 struct request_queue *q = qc->scsicmd->device->request_queue;
398 struct completion *waiting; 399 struct completion *waiting;
400 unsigned long flags;
399 401
400 /* Bounce SCSI-initiated commands to the SCSI EH */ 402 /* Bounce SCSI-initiated commands to the SCSI EH */
401 if (qc->scsicmd) { 403 if (qc->scsicmd) {
404 spin_lock_irqsave(q->queue_lock, flags);
402 blk_abort_request(qc->scsicmd->request); 405 blk_abort_request(qc->scsicmd->request);
406 spin_unlock_irqrestore(q->queue_lock, flags);
403 scsi_schedule_eh(qc->scsicmd->device->host); 407 scsi_schedule_eh(qc->scsicmd->device->host);
404 return; 408 return;
405 } 409 }
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 2660e1b4569a..822835055cef 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1030,6 +1030,8 @@ int __sas_task_abort(struct sas_task *task)
1030void sas_task_abort(struct sas_task *task) 1030void sas_task_abort(struct sas_task *task)
1031{ 1031{
1032 struct scsi_cmnd *sc = task->uldd_task; 1032 struct scsi_cmnd *sc = task->uldd_task;
1033 struct request_queue *q = sc->device->request_queue;
1034 unsigned long flags;
1033 1035
1034 /* Escape for libsas internal commands */ 1036 /* Escape for libsas internal commands */
1035 if (!sc) { 1037 if (!sc) {
@@ -1044,7 +1046,9 @@ void sas_task_abort(struct sas_task *task)
1044 return; 1046 return;
1045 } 1047 }
1046 1048
1049 spin_lock_irqsave(q->queue_lock, flags);
1047 blk_abort_request(sc->request); 1050 blk_abort_request(sc->request);
1051 spin_unlock_irqrestore(q->queue_lock, flags);
1048 scsi_schedule_eh(sc->device->host); 1052 scsi_schedule_eh(sc->device->host);
1049} 1053}
1050 1054
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 3e10c306de94..3a5bfd10b2cb 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -957,7 +957,8 @@ static int resp_start_stop(struct scsi_cmnd * scp,
957static sector_t get_sdebug_capacity(void) 957static sector_t get_sdebug_capacity(void)
958{ 958{
959 if (scsi_debug_virtual_gb > 0) 959 if (scsi_debug_virtual_gb > 0)
960 return 2048 * 1024 * (sector_t)scsi_debug_virtual_gb; 960 return (sector_t)scsi_debug_virtual_gb *
961 (1073741824 / scsi_debug_sector_size);
961 else 962 else
962 return sdebug_store_sectors; 963 return sdebug_store_sectors;
963} 964}
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index d45c69ca5737..7ad53fa42766 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -302,7 +302,20 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
302 if (scmd->device->allow_restart && 302 if (scmd->device->allow_restart &&
303 (sshdr.asc == 0x04) && (sshdr.ascq == 0x02)) 303 (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
304 return FAILED; 304 return FAILED;
305 return SUCCESS; 305
306 if (blk_barrier_rq(scmd->request))
307 /*
308 * barrier requests should always retry on UA
309 * otherwise block will get a spurious error
310 */
311 return NEEDS_RETRY;
312 else
313 /*
314 * for normal (non barrier) commands, pass the
315 * UA upwards for a determination in the
316 * completion functions
317 */
318 return SUCCESS;
306 319
307 /* these three are not supported */ 320 /* these three are not supported */
308 case COPY_ABORTED: 321 case COPY_ABORTED:
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8b827f37b03e..de6c60320f6f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1040,6 +1040,7 @@ static void sd_prepare_flush(struct request_queue *q, struct request *rq)
1040{ 1040{
1041 rq->cmd_type = REQ_TYPE_BLOCK_PC; 1041 rq->cmd_type = REQ_TYPE_BLOCK_PC;
1042 rq->timeout = SD_TIMEOUT; 1042 rq->timeout = SD_TIMEOUT;
1043 rq->retries = SD_MAX_RETRIES;
1043 rq->cmd[0] = SYNCHRONIZE_CACHE; 1044 rq->cmd[0] = SYNCHRONIZE_CACHE;
1044 rq->cmd_len = 10; 1045 rq->cmd_len = 10;
1045} 1046}
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index 105449c15fa9..e17764d71476 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -69,6 +69,7 @@ static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = {
69 }, 69 },
70 { 0 } 70 { 0 }
71}; 71};
72MODULE_DEVICE_TABLE(zorro, zorro7xx_zorro_tbl);
72 73
73static int __devinit zorro7xx_init_one(struct zorro_dev *z, 74static int __devinit zorro7xx_init_one(struct zorro_dev *z,
74 const struct zorro_device_id *ent) 75 const struct zorro_device_id *ent)
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 4315b23590bd..eacb588a9345 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -120,7 +120,8 @@
120#define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */ 120#define MX2_UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */
121#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ 121#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */
122#define UCR3_BPEN (1<<0) /* Preset registers enable */ 122#define UCR3_BPEN (1<<0) /* Preset registers enable */
123#define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ 123#define UCR4_CTSTL_SHF 10 /* CTS trigger level shift */
124#define UCR4_CTSTL_MASK 0x3F /* CTS trigger is 6 bits wide */
124#define UCR4_INVR (1<<9) /* Inverted infrared reception */ 125#define UCR4_INVR (1<<9) /* Inverted infrared reception */
125#define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */ 126#define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */
126#define UCR4_WKEN (1<<7) /* Wake interrupt enable */ 127#define UCR4_WKEN (1<<7) /* Wake interrupt enable */
@@ -591,6 +592,9 @@ static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
591 return 0; 592 return 0;
592} 593}
593 594
595/* half the RX buffer size */
596#define CTSTL 16
597
594static int imx_startup(struct uart_port *port) 598static int imx_startup(struct uart_port *port)
595{ 599{
596 struct imx_port *sport = (struct imx_port *)port; 600 struct imx_port *sport = (struct imx_port *)port;
@@ -607,6 +611,10 @@ static int imx_startup(struct uart_port *port)
607 if (USE_IRDA(sport)) 611 if (USE_IRDA(sport))
608 temp |= UCR4_IRSC; 612 temp |= UCR4_IRSC;
609 613
614 /* set the trigger level for CTS */
615 temp &= ~(UCR4_CTSTL_MASK<< UCR4_CTSTL_SHF);
616 temp |= CTSTL<< UCR4_CTSTL_SHF;
617
610 writel(temp & ~UCR4_DREN, sport->port.membase + UCR4); 618 writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
611 619
612 if (USE_IRDA(sport)) { 620 if (USE_IRDA(sport)) {
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index a176ab4bd65b..02469c31bf0b 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -1467,7 +1467,7 @@ mpc52xx_uart_init(void)
1467 /* 1467 /*
1468 * Map the PSC FIFO Controller and init if on MPC512x. 1468 * Map the PSC FIFO Controller and init if on MPC512x.
1469 */ 1469 */
1470 if (psc_ops->fifoc_init) { 1470 if (psc_ops && psc_ops->fifoc_init) {
1471 ret = psc_ops->fifoc_init(); 1471 ret = psc_ops->fifoc_init();
1472 if (ret) 1472 if (ret)
1473 return ret; 1473 return ret;
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 4a6366a42129..111a01a747fc 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -380,6 +380,7 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry)
380 mutex_lock(&inode->i_mutex); 380 mutex_lock(&inode->i_mutex);
381 dentry_unhash(dentry); 381 dentry_unhash(dentry);
382 if (usbfs_empty(dentry)) { 382 if (usbfs_empty(dentry)) {
383 dont_mount(dentry);
383 drop_nlink(dentry->d_inode); 384 drop_nlink(dentry->d_inode);
384 drop_nlink(dentry->d_inode); 385 drop_nlink(dentry->d_inode);
385 dput(dentry); 386 dput(dentry);
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index e69d238c5af0..49fa953aaf6e 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -1035,7 +1035,12 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len)
1035/* This actually signals the guest, using eventfd. */ 1035/* This actually signals the guest, using eventfd. */
1036void vhost_signal(struct vhost_dev *dev, struct vhost_virtqueue *vq) 1036void vhost_signal(struct vhost_dev *dev, struct vhost_virtqueue *vq)
1037{ 1037{
1038 __u16 flags = 0; 1038 __u16 flags;
1039 /* Flush out used index updates. This is paired
1040 * with the barrier that the Guest executes when enabling
1041 * interrupts. */
1042 smp_mb();
1043
1039 if (get_user(flags, &vq->avail->flags)) { 1044 if (get_user(flags, &vq->avail->flags)) {
1040 vq_err(vq, "Failed to get flags"); 1045 vq_err(vq, "Failed to get flags");
1041 return; 1046 return;
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c
index dca48df98444..e5d6b56d4447 100644
--- a/drivers/video/amifb.c
+++ b/drivers/video/amifb.c
@@ -50,8 +50,9 @@
50#include <linux/fb.h> 50#include <linux/fb.h>
51#include <linux/init.h> 51#include <linux/init.h>
52#include <linux/ioport.h> 52#include <linux/ioport.h>
53 53#include <linux/platform_device.h>
54#include <linux/uaccess.h> 54#include <linux/uaccess.h>
55
55#include <asm/system.h> 56#include <asm/system.h>
56#include <asm/irq.h> 57#include <asm/irq.h>
57#include <asm/amigahw.h> 58#include <asm/amigahw.h>
@@ -1135,7 +1136,7 @@ static int amifb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg
1135 * Interface to the low level console driver 1136 * Interface to the low level console driver
1136 */ 1137 */
1137 1138
1138static void amifb_deinit(void); 1139static void amifb_deinit(struct platform_device *pdev);
1139 1140
1140 /* 1141 /*
1141 * Internal routines 1142 * Internal routines
@@ -2246,7 +2247,7 @@ static inline void chipfree(void)
2246 * Initialisation 2247 * Initialisation
2247 */ 2248 */
2248 2249
2249static int __init amifb_init(void) 2250static int __init amifb_probe(struct platform_device *pdev)
2250{ 2251{
2251 int tag, i, err = 0; 2252 int tag, i, err = 0;
2252 u_long chipptr; 2253 u_long chipptr;
@@ -2261,16 +2262,6 @@ static int __init amifb_init(void)
2261 } 2262 }
2262 amifb_setup(option); 2263 amifb_setup(option);
2263#endif 2264#endif
2264 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_VIDEO))
2265 return -ENODEV;
2266
2267 /*
2268 * We request all registers starting from bplpt[0]
2269 */
2270 if (!request_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120,
2271 "amifb [Denise/Lisa]"))
2272 return -EBUSY;
2273
2274 custom.dmacon = DMAF_ALL | DMAF_MASTER; 2265 custom.dmacon = DMAF_ALL | DMAF_MASTER;
2275 2266
2276 switch (amiga_chipset) { 2267 switch (amiga_chipset) {
@@ -2377,6 +2368,7 @@ default_chipset:
2377 fb_info.fbops = &amifb_ops; 2368 fb_info.fbops = &amifb_ops;
2378 fb_info.par = &currentpar; 2369 fb_info.par = &currentpar;
2379 fb_info.flags = FBINFO_DEFAULT; 2370 fb_info.flags = FBINFO_DEFAULT;
2371 fb_info.device = &pdev->dev;
2380 2372
2381 if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, ami_modedb, 2373 if (!fb_find_mode(&fb_info.var, &fb_info, mode_option, ami_modedb,
2382 NUM_TOTAL_MODES, &ami_modedb[defmode], 4)) { 2374 NUM_TOTAL_MODES, &ami_modedb[defmode], 4)) {
@@ -2451,18 +2443,18 @@ default_chipset:
2451 return 0; 2443 return 0;
2452 2444
2453amifb_error: 2445amifb_error:
2454 amifb_deinit(); 2446 amifb_deinit(pdev);
2455 return err; 2447 return err;
2456} 2448}
2457 2449
2458static void amifb_deinit(void) 2450static void amifb_deinit(struct platform_device *pdev)
2459{ 2451{
2460 if (fb_info.cmap.len) 2452 if (fb_info.cmap.len)
2461 fb_dealloc_cmap(&fb_info.cmap); 2453 fb_dealloc_cmap(&fb_info.cmap);
2454 fb_dealloc_cmap(&fb_info.cmap);
2462 chipfree(); 2455 chipfree();
2463 if (videomemory) 2456 if (videomemory)
2464 iounmap((void*)videomemory); 2457 iounmap((void*)videomemory);
2465 release_mem_region(CUSTOM_PHYSADDR+0xe0, 0x120);
2466 custom.dmacon = DMAF_ALL | DMAF_MASTER; 2458 custom.dmacon = DMAF_ALL | DMAF_MASTER;
2467} 2459}
2468 2460
@@ -3794,14 +3786,35 @@ static void ami_rebuild_copper(void)
3794 } 3786 }
3795} 3787}
3796 3788
3797static void __exit amifb_exit(void) 3789static int __exit amifb_remove(struct platform_device *pdev)
3798{ 3790{
3799 unregister_framebuffer(&fb_info); 3791 unregister_framebuffer(&fb_info);
3800 amifb_deinit(); 3792 amifb_deinit(pdev);
3801 amifb_video_off(); 3793 amifb_video_off();
3794 return 0;
3795}
3796
3797static struct platform_driver amifb_driver = {
3798 .remove = __exit_p(amifb_remove),
3799 .driver = {
3800 .name = "amiga-video",
3801 .owner = THIS_MODULE,
3802 },
3803};
3804
3805static int __init amifb_init(void)
3806{
3807 return platform_driver_probe(&amifb_driver, amifb_probe);
3802} 3808}
3803 3809
3804module_init(amifb_init); 3810module_init(amifb_init);
3811
3812static void __exit amifb_exit(void)
3813{
3814 platform_driver_unregister(&amifb_driver);
3815}
3816
3805module_exit(amifb_exit); 3817module_exit(amifb_exit);
3806 3818
3807MODULE_LICENSE("GPL"); 3819MODULE_LICENSE("GPL");
3820MODULE_ALIAS("platform:amiga-video");
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
index 44e49c28b2a7..c2ec3dcd4e91 100644
--- a/drivers/video/bfin-t350mcqb-fb.c
+++ b/drivers/video/bfin-t350mcqb-fb.c
@@ -488,9 +488,9 @@ static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
488 fbinfo->fbops = &bfin_t350mcqb_fb_ops; 488 fbinfo->fbops = &bfin_t350mcqb_fb_ops;
489 fbinfo->flags = FBINFO_FLAG_DEFAULT; 489 fbinfo->flags = FBINFO_FLAG_DEFAULT;
490 490
491 info->fb_buffer = 491 info->fb_buffer = dma_alloc_coherent(NULL, fbinfo->fix.smem_len +
492 dma_alloc_coherent(NULL, fbinfo->fix.smem_len, &info->dma_handle, 492 ACTIVE_VIDEO_MEM_OFFSET,
493 GFP_KERNEL); 493 &info->dma_handle, GFP_KERNEL);
494 494
495 if (NULL == info->fb_buffer) { 495 if (NULL == info->fb_buffer) {
496 printk(KERN_ERR DRIVER_NAME 496 printk(KERN_ERR DRIVER_NAME
@@ -568,8 +568,8 @@ out7:
568out6: 568out6:
569 fb_dealloc_cmap(&fbinfo->cmap); 569 fb_dealloc_cmap(&fbinfo->cmap);
570out4: 570out4:
571 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 571 dma_free_coherent(NULL, fbinfo->fix.smem_len + ACTIVE_VIDEO_MEM_OFFSET,
572 info->dma_handle); 572 info->fb_buffer, info->dma_handle);
573out3: 573out3:
574 framebuffer_release(fbinfo); 574 framebuffer_release(fbinfo);
575out2: 575out2:
@@ -592,8 +592,9 @@ static int __devexit bfin_t350mcqb_remove(struct platform_device *pdev)
592 free_irq(info->irq, info); 592 free_irq(info->irq, info);
593 593
594 if (info->fb_buffer != NULL) 594 if (info->fb_buffer != NULL)
595 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 595 dma_free_coherent(NULL, fbinfo->fix.smem_len +
596 info->dma_handle); 596 ACTIVE_VIDEO_MEM_OFFSET, info->fb_buffer,
597 info->dma_handle);
597 598
598 fb_dealloc_cmap(&fbinfo->cmap); 599 fb_dealloc_cmap(&fbinfo->cmap);
599 600
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index 8d8dfda2f868..6df7c54db0a3 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -299,6 +299,7 @@ static const struct zorro_device_id cirrusfb_zorro_table[] = {
299 }, 299 },
300 { 0 } 300 { 0 }
301}; 301};
302MODULE_DEVICE_TABLE(zorro, cirrusfb_zorro_table);
302 303
303static const struct { 304static const struct {
304 zorro_id id2; 305 zorro_id id2;
diff --git a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c
index 6c91c61cdb63..1b0feb8e7244 100644
--- a/drivers/video/fm2fb.c
+++ b/drivers/video/fm2fb.c
@@ -219,6 +219,7 @@ static struct zorro_device_id fm2fb_devices[] __devinitdata = {
219 { ZORRO_PROD_HELFRICH_RAINBOW_II }, 219 { ZORRO_PROD_HELFRICH_RAINBOW_II },
220 { 0 } 220 { 0 }
221}; 221};
222MODULE_DEVICE_TABLE(zorro, fm2fb_devices);
222 223
223static struct zorro_driver fm2fb_driver = { 224static struct zorro_driver fm2fb_driver = {
224 .name = "fm2fb", 225 .name = "fm2fb",
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e14bd0749129..e8c769944812 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -695,6 +695,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
695 * 1) Enable Runtime PM 695 * 1) Enable Runtime PM
696 * 2) Force Runtime PM Resume since hardware is accessed from probe() 696 * 2) Force Runtime PM Resume since hardware is accessed from probe()
697 */ 697 */
698 priv->dev = &pdev->dev;
698 pm_runtime_enable(priv->dev); 699 pm_runtime_enable(priv->dev);
699 pm_runtime_resume(priv->dev); 700 pm_runtime_resume(priv->dev);
700 return 0; 701 return 0;
@@ -957,25 +958,24 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
957 958
958 if (!pdev->dev.platform_data) { 959 if (!pdev->dev.platform_data) {
959 dev_err(&pdev->dev, "no platform data defined\n"); 960 dev_err(&pdev->dev, "no platform data defined\n");
960 error = -EINVAL; 961 return -EINVAL;
961 goto err0;
962 } 962 }
963 963
964 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 964 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
965 i = platform_get_irq(pdev, 0); 965 i = platform_get_irq(pdev, 0);
966 if (!res || i < 0) { 966 if (!res || i < 0) {
967 dev_err(&pdev->dev, "cannot get platform resources\n"); 967 dev_err(&pdev->dev, "cannot get platform resources\n");
968 error = -ENOENT; 968 return -ENOENT;
969 goto err0;
970 } 969 }
971 970
972 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 971 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
973 if (!priv) { 972 if (!priv) {
974 dev_err(&pdev->dev, "cannot allocate device data\n"); 973 dev_err(&pdev->dev, "cannot allocate device data\n");
975 error = -ENOMEM; 974 return -ENOMEM;
976 goto err0;
977 } 975 }
978 976
977 platform_set_drvdata(pdev, priv);
978
979 error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED, 979 error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
980 dev_name(&pdev->dev), priv); 980 dev_name(&pdev->dev), priv);
981 if (error) { 981 if (error) {
@@ -984,8 +984,6 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
984 } 984 }
985 985
986 priv->irq = i; 986 priv->irq = i;
987 priv->dev = &pdev->dev;
988 platform_set_drvdata(pdev, priv);
989 pdata = pdev->dev.platform_data; 987 pdata = pdev->dev.platform_data;
990 988
991 j = 0; 989 j = 0;
@@ -1099,9 +1097,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1099 info = ch->info; 1097 info = ch->info;
1100 1098
1101 if (info->fbdefio) { 1099 if (info->fbdefio) {
1102 priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * 1100 ch->sglist = vmalloc(sizeof(struct scatterlist) *
1103 info->fix.smem_len >> PAGE_SHIFT); 1101 info->fix.smem_len >> PAGE_SHIFT);
1104 if (!priv->ch->sglist) { 1102 if (!ch->sglist) {
1105 dev_err(&pdev->dev, "cannot allocate sglist\n"); 1103 dev_err(&pdev->dev, "cannot allocate sglist\n");
1106 goto err1; 1104 goto err1;
1107 } 1105 }
@@ -1126,9 +1124,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1126 } 1124 }
1127 1125
1128 return 0; 1126 return 0;
1129 err1: 1127err1:
1130 sh_mobile_lcdc_remove(pdev); 1128 sh_mobile_lcdc_remove(pdev);
1131 err0: 1129
1132 return error; 1130 return error;
1133} 1131}
1134 1132
@@ -1139,7 +1137,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
1139 int i; 1137 int i;
1140 1138
1141 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) 1139 for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
1142 if (priv->ch[i].info->dev) 1140 if (priv->ch[i].info && priv->ch[i].info->dev)
1143 unregister_framebuffer(priv->ch[i].info); 1141 unregister_framebuffer(priv->ch[i].info);
1144 1142
1145 sh_mobile_lcdc_stop(priv); 1143 sh_mobile_lcdc_stop(priv);
@@ -1162,7 +1160,8 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
1162 if (priv->dot_clk) 1160 if (priv->dot_clk)
1163 clk_put(priv->dot_clk); 1161 clk_put(priv->dot_clk);
1164 1162
1165 pm_runtime_disable(priv->dev); 1163 if (priv->dev)
1164 pm_runtime_disable(priv->dev);
1166 1165
1167 if (priv->base) 1166 if (priv->base)
1168 iounmap(priv->base); 1167 iounmap(priv->base);
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 0bf5020d0d32..b87ba23442d2 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -175,7 +175,7 @@ config SA1100_WATCHDOG
175 175
176config MPCORE_WATCHDOG 176config MPCORE_WATCHDOG
177 tristate "MPcore watchdog" 177 tristate "MPcore watchdog"
178 depends on ARM_MPCORE_PLATFORM && LOCAL_TIMERS 178 depends on HAVE_ARM_TWD
179 help 179 help
180 Watchdog timer embedded into the MPcore system. 180 Watchdog timer embedded into the MPcore system.
181 181
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 016c6a791cab..b8ec7aca3c8e 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -31,8 +31,9 @@
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/uaccess.h> 32#include <linux/uaccess.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/io.h>
34 35
35#include <asm/hardware/arm_twd.h> 36#include <asm/smp_twd.h>
36 37
37struct mpcore_wdt { 38struct mpcore_wdt {
38 unsigned long timer_alive; 39 unsigned long timer_alive;
@@ -44,7 +45,7 @@ struct mpcore_wdt {
44}; 45};
45 46
46static struct platform_device *mpcore_wdt_dev; 47static struct platform_device *mpcore_wdt_dev;
47extern unsigned int mpcore_timer_rate; 48static DEFINE_SPINLOCK(wdt_lock);
48 49
49#define TIMER_MARGIN 60 50#define TIMER_MARGIN 60
50static int mpcore_margin = TIMER_MARGIN; 51static int mpcore_margin = TIMER_MARGIN;
@@ -94,13 +95,15 @@ static irqreturn_t mpcore_wdt_fire(int irq, void *arg)
94 */ 95 */
95static void mpcore_wdt_keepalive(struct mpcore_wdt *wdt) 96static void mpcore_wdt_keepalive(struct mpcore_wdt *wdt)
96{ 97{
97 unsigned int count; 98 unsigned long count;
98 99
100 spin_lock(&wdt_lock);
99 /* Assume prescale is set to 256 */ 101 /* Assume prescale is set to 256 */
100 count = (mpcore_timer_rate / 256) * mpcore_margin; 102 count = __raw_readl(wdt->base + TWD_WDOG_COUNTER);
103 count = (0xFFFFFFFFU - count) * (HZ / 5);
104 count = (count / 256) * mpcore_margin;
101 105
102 /* Reload the counter */ 106 /* Reload the counter */
103 spin_lock(&wdt_lock);
104 writel(count + wdt->perturb, wdt->base + TWD_WDOG_LOAD); 107 writel(count + wdt->perturb, wdt->base + TWD_WDOG_LOAD);
105 wdt->perturb = wdt->perturb ? 0 : 1; 108 wdt->perturb = wdt->perturb ? 0 : 1;
106 spin_unlock(&wdt_lock); 109 spin_unlock(&wdt_lock);
@@ -119,7 +122,6 @@ static void mpcore_wdt_start(struct mpcore_wdt *wdt)
119{ 122{
120 dev_printk(KERN_INFO, wdt->dev, "enabling watchdog.\n"); 123 dev_printk(KERN_INFO, wdt->dev, "enabling watchdog.\n");
121 124
122 spin_lock(&wdt_lock);
123 /* This loads the count register but does NOT start the count yet */ 125 /* This loads the count register but does NOT start the count yet */
124 mpcore_wdt_keepalive(wdt); 126 mpcore_wdt_keepalive(wdt);
125 127
@@ -130,7 +132,6 @@ static void mpcore_wdt_start(struct mpcore_wdt *wdt)
130 /* Enable watchdog - prescale=256, watchdog mode=1, enable=1 */ 132 /* Enable watchdog - prescale=256, watchdog mode=1, enable=1 */
131 writel(0x0000FF09, wdt->base + TWD_WDOG_CONTROL); 133 writel(0x0000FF09, wdt->base + TWD_WDOG_CONTROL);
132 } 134 }
133 spin_unlock(&wdt_lock);
134} 135}
135 136
136static int mpcore_wdt_set_heartbeat(int t) 137static int mpcore_wdt_set_heartbeat(int t)
@@ -360,7 +361,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
360 mpcore_wdt_miscdev.parent = &dev->dev; 361 mpcore_wdt_miscdev.parent = &dev->dev;
361 ret = misc_register(&mpcore_wdt_miscdev); 362 ret = misc_register(&mpcore_wdt_miscdev);
362 if (ret) { 363 if (ret) {
363 dev_printk(KERN_ERR, _dev, 364 dev_printk(KERN_ERR, wdt->dev,
364 "cannot register miscdev on minor=%d (err=%d)\n", 365 "cannot register miscdev on minor=%d (err=%d)\n",
365 WATCHDOG_MINOR, ret); 366 WATCHDOG_MINOR, ret);
366 goto err_misc; 367 goto err_misc;
@@ -369,13 +370,13 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
369 ret = request_irq(wdt->irq, mpcore_wdt_fire, IRQF_DISABLED, 370 ret = request_irq(wdt->irq, mpcore_wdt_fire, IRQF_DISABLED,
370 "mpcore_wdt", wdt); 371 "mpcore_wdt", wdt);
371 if (ret) { 372 if (ret) {
372 dev_printk(KERN_ERR, _dev, 373 dev_printk(KERN_ERR, wdt->dev,
373 "cannot register IRQ%d for watchdog\n", wdt->irq); 374 "cannot register IRQ%d for watchdog\n", wdt->irq);
374 goto err_irq; 375 goto err_irq;
375 } 376 }
376 377
377 mpcore_wdt_stop(wdt); 378 mpcore_wdt_stop(wdt);
378 platform_set_drvdata(&dev->dev, wdt); 379 platform_set_drvdata(dev, wdt);
379 mpcore_wdt_dev = dev; 380 mpcore_wdt_dev = dev;
380 381
381 return 0; 382 return 0;
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c
index d47c47fc048f..3c7046d79654 100644
--- a/drivers/zorro/proc.c
+++ b/drivers/zorro/proc.c
@@ -97,7 +97,7 @@ static void zorro_seq_stop(struct seq_file *m, void *v)
97 97
98static int zorro_seq_show(struct seq_file *m, void *v) 98static int zorro_seq_show(struct seq_file *m, void *v)
99{ 99{
100 u_int slot = *(loff_t *)v; 100 unsigned int slot = *(loff_t *)v;
101 struct zorro_dev *z = &zorro_autocon[slot]; 101 struct zorro_dev *z = &zorro_autocon[slot];
102 102
103 seq_printf(m, "%02x\t%08x\t%08lx\t%08lx\t%02x\n", slot, z->id, 103 seq_printf(m, "%02x\t%08x\t%08lx\t%08lx\t%02x\n", slot, z->id,
@@ -129,7 +129,7 @@ static const struct file_operations zorro_devices_proc_fops = {
129 129
130static struct proc_dir_entry *proc_bus_zorro_dir; 130static struct proc_dir_entry *proc_bus_zorro_dir;
131 131
132static int __init zorro_proc_attach_device(u_int slot) 132static int __init zorro_proc_attach_device(unsigned int slot)
133{ 133{
134 struct proc_dir_entry *entry; 134 struct proc_dir_entry *entry;
135 char name[4]; 135 char name[4];
@@ -146,7 +146,7 @@ static int __init zorro_proc_attach_device(u_int slot)
146 146
147static int __init zorro_proc_init(void) 147static int __init zorro_proc_init(void)
148{ 148{
149 u_int slot; 149 unsigned int slot;
150 150
151 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) { 151 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(ZORRO)) {
152 proc_bus_zorro_dir = proc_mkdir("bus/zorro", NULL); 152 proc_bus_zorro_dir = proc_mkdir("bus/zorro", NULL);
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index 53180a37cc9a..7ee2b6e71786 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -137,10 +137,34 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)
137 return 0; 137 return 0;
138} 138}
139 139
140static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
141{
142#ifdef CONFIG_HOTPLUG
143 struct zorro_dev *z;
144
145 if (!dev)
146 return -ENODEV;
147
148 z = to_zorro_dev(dev);
149 if (!z)
150 return -ENODEV;
151
152 if (add_uevent_var(env, "ZORRO_ID=%08X", z->id) ||
153 add_uevent_var(env, "ZORRO_SLOT_NAME=%s", dev_name(dev)) ||
154 add_uevent_var(env, "ZORRO_SLOT_ADDR=%04X", z->slotaddr) ||
155 add_uevent_var(env, "MODALIAS=" ZORRO_DEVICE_MODALIAS_FMT, z->id))
156 return -ENOMEM;
157
158 return 0;
159#else /* !CONFIG_HOTPLUG */
160 return -ENODEV;
161#endif /* !CONFIG_HOTPLUG */
162}
140 163
141struct bus_type zorro_bus_type = { 164struct bus_type zorro_bus_type = {
142 .name = "zorro", 165 .name = "zorro",
143 .match = zorro_bus_match, 166 .match = zorro_bus_match,
167 .uevent = zorro_uevent,
144 .probe = zorro_device_probe, 168 .probe = zorro_device_probe,
145 .remove = zorro_device_remove, 169 .remove = zorro_device_remove,
146}; 170};
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index 1d2a772ea14c..eb924e0a64ce 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -77,6 +77,16 @@ static struct bin_attribute zorro_config_attr = {
77 .read = zorro_read_config, 77 .read = zorro_read_config,
78}; 78};
79 79
80static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
81 char *buf)
82{
83 struct zorro_dev *z = to_zorro_dev(dev);
84
85 return sprintf(buf, ZORRO_DEVICE_MODALIAS_FMT "\n", z->id);
86}
87
88static DEVICE_ATTR(modalias, S_IRUGO, modalias_show, NULL);
89
80int zorro_create_sysfs_dev_files(struct zorro_dev *z) 90int zorro_create_sysfs_dev_files(struct zorro_dev *z)
81{ 91{
82 struct device *dev = &z->dev; 92 struct device *dev = &z->dev;
@@ -89,6 +99,7 @@ int zorro_create_sysfs_dev_files(struct zorro_dev *z)
89 (error = device_create_file(dev, &dev_attr_slotaddr)) || 99 (error = device_create_file(dev, &dev_attr_slotaddr)) ||
90 (error = device_create_file(dev, &dev_attr_slotsize)) || 100 (error = device_create_file(dev, &dev_attr_slotsize)) ||
91 (error = device_create_file(dev, &dev_attr_resource)) || 101 (error = device_create_file(dev, &dev_attr_resource)) ||
102 (error = device_create_file(dev, &dev_attr_modalias)) ||
92 (error = sysfs_create_bin_file(&dev->kobj, &zorro_config_attr))) 103 (error = sysfs_create_bin_file(&dev->kobj, &zorro_config_attr)))
93 return error; 104 return error;
94 105
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index d45fb34e2d23..6455f3a244c5 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -15,6 +15,8 @@
15#include <linux/zorro.h> 15#include <linux/zorro.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/platform_device.h>
19#include <linux/slab.h>
18 20
19#include <asm/setup.h> 21#include <asm/setup.h>
20#include <asm/amigahw.h> 22#include <asm/amigahw.h>
@@ -26,24 +28,17 @@
26 * Zorro Expansion Devices 28 * Zorro Expansion Devices
27 */ 29 */
28 30
29u_int zorro_num_autocon = 0; 31unsigned int zorro_num_autocon;
30struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO]; 32struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];
31 33
32 34
33 /* 35 /*
34 * Single Zorro bus 36 * Zorro bus
35 */ 37 */
36 38
37struct zorro_bus zorro_bus = {\ 39struct zorro_bus {
38 .resources = { 40 struct list_head devices; /* list of devices on this bus */
39 /* Zorro II regions (on Zorro II/III) */ 41 struct device dev;
40 { .name = "Zorro II exp", .start = 0x00e80000, .end = 0x00efffff },
41 { .name = "Zorro II mem", .start = 0x00200000, .end = 0x009fffff },
42 /* Zorro III regions (on Zorro III only) */
43 { .name = "Zorro III exp", .start = 0xff000000, .end = 0xffffffff },
44 { .name = "Zorro III cfg", .start = 0x40000000, .end = 0x7fffffff }
45 },
46 .name = "Zorro bus"
47}; 42};
48 43
49 44
@@ -53,18 +48,19 @@ struct zorro_bus zorro_bus = {\
53 48
54struct zorro_dev *zorro_find_device(zorro_id id, struct zorro_dev *from) 49struct zorro_dev *zorro_find_device(zorro_id id, struct zorro_dev *from)
55{ 50{
56 struct zorro_dev *z; 51 struct zorro_dev *z;
57 52
58 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) 53 if (!zorro_num_autocon)
59 return NULL; 54 return NULL;
60 55
61 for (z = from ? from+1 : &zorro_autocon[0]; 56 for (z = from ? from+1 : &zorro_autocon[0];
62 z < zorro_autocon+zorro_num_autocon; 57 z < zorro_autocon+zorro_num_autocon;
63 z++) 58 z++)
64 if (id == ZORRO_WILDCARD || id == z->id) 59 if (id == ZORRO_WILDCARD || id == z->id)
65 return z; 60 return z;
66 return NULL; 61 return NULL;
67} 62}
63EXPORT_SYMBOL(zorro_find_device);
68 64
69 65
70 /* 66 /*
@@ -83,121 +79,138 @@ struct zorro_dev *zorro_find_device(zorro_id id, struct zorro_dev *from)
83 */ 79 */
84 80
85DECLARE_BITMAP(zorro_unused_z2ram, 128); 81DECLARE_BITMAP(zorro_unused_z2ram, 128);
82EXPORT_SYMBOL(zorro_unused_z2ram);
86 83
87 84
88static void __init mark_region(unsigned long start, unsigned long end, 85static void __init mark_region(unsigned long start, unsigned long end,
89 int flag) 86 int flag)
90{ 87{
91 if (flag)
92 start += Z2RAM_CHUNKMASK;
93 else
94 end += Z2RAM_CHUNKMASK;
95 start &= ~Z2RAM_CHUNKMASK;
96 end &= ~Z2RAM_CHUNKMASK;
97
98 if (end <= Z2RAM_START || start >= Z2RAM_END)
99 return;
100 start = start < Z2RAM_START ? 0x00000000 : start-Z2RAM_START;
101 end = end > Z2RAM_END ? Z2RAM_SIZE : end-Z2RAM_START;
102 while (start < end) {
103 u32 chunk = start>>Z2RAM_CHUNKSHIFT;
104 if (flag) 88 if (flag)
105 set_bit(chunk, zorro_unused_z2ram); 89 start += Z2RAM_CHUNKMASK;
106 else 90 else
107 clear_bit(chunk, zorro_unused_z2ram); 91 end += Z2RAM_CHUNKMASK;
108 start += Z2RAM_CHUNKSIZE; 92 start &= ~Z2RAM_CHUNKMASK;
109 } 93 end &= ~Z2RAM_CHUNKMASK;
94
95 if (end <= Z2RAM_START || start >= Z2RAM_END)
96 return;
97 start = start < Z2RAM_START ? 0x00000000 : start-Z2RAM_START;
98 end = end > Z2RAM_END ? Z2RAM_SIZE : end-Z2RAM_START;
99 while (start < end) {
100 u32 chunk = start>>Z2RAM_CHUNKSHIFT;
101 if (flag)
102 set_bit(chunk, zorro_unused_z2ram);
103 else
104 clear_bit(chunk, zorro_unused_z2ram);
105 start += Z2RAM_CHUNKSIZE;
106 }
110} 107}
111 108
112 109
113static struct resource __init *zorro_find_parent_resource(struct zorro_dev *z) 110static struct resource __init *zorro_find_parent_resource(
111 struct platform_device *bridge, struct zorro_dev *z)
114{ 112{
115 int i; 113 int i;
116 114
117 for (i = 0; i < zorro_bus.num_resources; i++) 115 for (i = 0; i < bridge->num_resources; i++) {
118 if (zorro_resource_start(z) >= zorro_bus.resources[i].start && 116 struct resource *r = &bridge->resource[i];
119 zorro_resource_end(z) <= zorro_bus.resources[i].end) 117 if (zorro_resource_start(z) >= r->start &&
120 return &zorro_bus.resources[i]; 118 zorro_resource_end(z) <= r->end)
121 return &iomem_resource; 119 return r;
120 }
121 return &iomem_resource;
122} 122}
123 123
124 124
125 /*
126 * Initialization
127 */
128 125
129static int __init zorro_init(void) 126static int __init amiga_zorro_probe(struct platform_device *pdev)
130{ 127{
131 struct zorro_dev *z; 128 struct zorro_bus *bus;
132 unsigned int i; 129 struct zorro_dev *z;
133 int error; 130 struct resource *r;
134 131 unsigned int i;
135 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO)) 132 int error;
136 return 0; 133
137 134 /* Initialize the Zorro bus */
138 pr_info("Zorro: Probing AutoConfig expansion devices: %d device%s\n", 135 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
139 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s"); 136 if (!bus)
140 137 return -ENOMEM;
141 /* Initialize the Zorro bus */ 138
142 INIT_LIST_HEAD(&zorro_bus.devices); 139 INIT_LIST_HEAD(&bus->devices);
143 dev_set_name(&zorro_bus.dev, "zorro"); 140 bus->dev.parent = &pdev->dev;
144 error = device_register(&zorro_bus.dev); 141 dev_set_name(&bus->dev, "zorro");
145 if (error) { 142 error = device_register(&bus->dev);
146 pr_err("Zorro: Error registering zorro_bus\n");
147 return error;
148 }
149
150 /* Request the resources */
151 zorro_bus.num_resources = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
152 for (i = 0; i < zorro_bus.num_resources; i++)
153 request_resource(&iomem_resource, &zorro_bus.resources[i]);
154
155 /* Register all devices */
156 for (i = 0; i < zorro_num_autocon; i++) {
157 z = &zorro_autocon[i];
158 z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8);
159 if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
160 /* GVP quirk */
161 unsigned long magic = zorro_resource_start(z)+0x8000;
162 z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;
163 }
164 sprintf(z->name, "Zorro device %08x", z->id);
165 zorro_name_device(z);
166 z->resource.name = z->name;
167 if (request_resource(zorro_find_parent_resource(z), &z->resource))
168 pr_err("Zorro: Address space collision on device %s %pR\n",
169 z->name, &z->resource);
170 dev_set_name(&z->dev, "%02x", i);
171 z->dev.parent = &zorro_bus.dev;
172 z->dev.bus = &zorro_bus_type;
173 error = device_register(&z->dev);
174 if (error) { 143 if (error) {
175 pr_err("Zorro: Error registering device %s\n", z->name); 144 pr_err("Zorro: Error registering zorro_bus\n");
176 continue; 145 kfree(bus);
146 return error;
177 } 147 }
178 error = zorro_create_sysfs_dev_files(z); 148 platform_set_drvdata(pdev, bus);
179 if (error) 149
180 dev_err(&z->dev, "Error creating sysfs files\n"); 150 /* Register all devices */
181 } 151 pr_info("Zorro: Probing AutoConfig expansion devices: %u device%s\n",
182 152 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
183 /* Mark all available Zorro II memory */ 153
184 zorro_for_each_dev(z) { 154 for (i = 0; i < zorro_num_autocon; i++) {
185 if (z->rom.er_Type & ERTF_MEMLIST) 155 z = &zorro_autocon[i];
186 mark_region(zorro_resource_start(z), zorro_resource_end(z)+1, 1); 156 z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8);
187 } 157 if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
188 158 /* GVP quirk */
189 /* Unmark all used Zorro II memory */ 159 unsigned long magic = zorro_resource_start(z)+0x8000;
190 for (i = 0; i < m68k_num_memory; i++) 160 z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;
191 if (m68k_memory[i].addr < 16*1024*1024) 161 }
192 mark_region(m68k_memory[i].addr, 162 sprintf(z->name, "Zorro device %08x", z->id);
193 m68k_memory[i].addr+m68k_memory[i].size, 0); 163 zorro_name_device(z);
194 164 z->resource.name = z->name;
195 return 0; 165 r = zorro_find_parent_resource(pdev, z);
166 error = request_resource(r, &z->resource);
167 if (error)
168 dev_err(&bus->dev,
169 "Address space collision on device %s %pR\n",
170 z->name, &z->resource);
171 dev_set_name(&z->dev, "%02x", i);
172 z->dev.parent = &bus->dev;
173 z->dev.bus = &zorro_bus_type;
174 error = device_register(&z->dev);
175 if (error) {
176 dev_err(&bus->dev, "Error registering device %s\n",
177 z->name);
178 continue;
179 }
180 error = zorro_create_sysfs_dev_files(z);
181 if (error)
182 dev_err(&z->dev, "Error creating sysfs files\n");
183 }
184
185 /* Mark all available Zorro II memory */
186 zorro_for_each_dev(z) {
187 if (z->rom.er_Type & ERTF_MEMLIST)
188 mark_region(zorro_resource_start(z),
189 zorro_resource_end(z)+1, 1);
190 }
191
192 /* Unmark all used Zorro II memory */
193 for (i = 0; i < m68k_num_memory; i++)
194 if (m68k_memory[i].addr < 16*1024*1024)
195 mark_region(m68k_memory[i].addr,
196 m68k_memory[i].addr+m68k_memory[i].size,
197 0);
198
199 return 0;
196} 200}
197 201
198subsys_initcall(zorro_init); 202static struct platform_driver amiga_zorro_driver = {
203 .driver = {
204 .name = "amiga-zorro",
205 .owner = THIS_MODULE,
206 },
207};
199 208
200EXPORT_SYMBOL(zorro_find_device); 209static int __init amiga_zorro_init(void)
201EXPORT_SYMBOL(zorro_unused_z2ram); 210{
211 return platform_driver_probe(&amiga_zorro_driver, amiga_zorro_probe);
212}
213
214module_init(amiga_zorro_init);
202 215
203MODULE_LICENSE("GPL"); 216MODULE_LICENSE("GPL");