aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig11
-rw-r--r--drivers/acpi/asus_acpi.c2
-rw-r--r--drivers/acpi/battery.c11
-rw-r--r--drivers/acpi/osl.c84
-rw-r--r--drivers/acpi/video.c60
-rw-r--r--drivers/ata/Kconfig1
-rw-r--r--drivers/ata/ahci.c72
-rw-r--r--drivers/ata/libata-acpi.c96
-rw-r--r--drivers/ata/pata_ali.c2
-rw-r--r--drivers/block/virtio_blk.c1
-rw-r--r--drivers/firewire/Kconfig50
-rw-r--r--drivers/firewire/fw-ohci.c108
-rw-r--r--drivers/firewire/fw-sbp2.c36
-rw-r--r--drivers/firewire/fw-topology.c3
-rw-r--r--drivers/firewire/fw-transaction.c2
-rw-r--r--drivers/firewire/fw-transaction.h6
-rw-r--r--drivers/ieee1394/sbp2.c5
-rw-r--r--drivers/mmc/host/tifm_sd.c2
-rw-r--r--drivers/net/virtio_net.c22
-rw-r--r--drivers/parisc/pdc_stable.c6
-rw-r--r--drivers/parisc/sba_iommu.c4
-rw-r--r--drivers/thermal/Kconfig2
-rw-r--r--drivers/thermal/thermal.c169
-rw-r--r--drivers/virtio/virtio_balloon.c4
-rw-r--r--drivers/virtio/virtio_pci.c15
-rw-r--r--drivers/virtio/virtio_ring.c1
26 files changed, 332 insertions, 443 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index fbcaa069be86..b4f5e8542829 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -300,17 +300,6 @@ config ACPI_CUSTOM_DSDT
300 bool 300 bool
301 default ACPI_CUSTOM_DSDT_FILE != "" 301 default ACPI_CUSTOM_DSDT_FILE != ""
302 302
303config ACPI_CUSTOM_DSDT_INITRD
304 bool "Read Custom DSDT from initramfs"
305 depends on BLK_DEV_INITRD
306 default n
307 help
308 This option supports a custom DSDT by optionally loading it from initrd.
309 See Documentation/acpi/dsdt-override.txt
310
311 If you are not using this feature now, but may use it later,
312 it is safe to say Y here.
313
314config ACPI_BLACKLIST_YEAR 303config ACPI_BLACKLIST_YEAR
315 int "Disable ACPI for systems before Jan 1st this year" if X86_32 304 int "Disable ACPI for systems before Jan 1st this year" if X86_32
316 default 0 305 default 0
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d25ef961415c..44ad90c03c2e 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -610,7 +610,7 @@ write_led(const char __user * buffer, unsigned long count,
610 (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); 610 (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask);
611 611
612 if (invert) /* invert target value */ 612 if (invert) /* invert target value */
613 led_out = !led_out & 0x1; 613 led_out = !led_out;
614 614
615 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) 615 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
616 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", 616 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n",
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index f6215e809808..d5729d5dc190 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -293,13 +293,12 @@ static int extract_package(struct acpi_battery *battery,
293 strncpy(ptr, (u8 *)&element->integer.value, 293 strncpy(ptr, (u8 *)&element->integer.value,
294 sizeof(acpi_integer)); 294 sizeof(acpi_integer));
295 ptr[sizeof(acpi_integer)] = 0; 295 ptr[sizeof(acpi_integer)] = 0;
296 } else return -EFAULT; 296 } else
297 *ptr = 0; /* don't have value */
297 } else { 298 } else {
298 if (element->type == ACPI_TYPE_INTEGER) { 299 int *x = (int *)((u8 *)battery + offsets[i].offset);
299 int *x = (int *)((u8 *)battery + 300 *x = (element->type == ACPI_TYPE_INTEGER) ?
300 offsets[i].offset); 301 element->integer.value : -1;
301 *x = element->integer.value;
302 } else return -EFAULT;
303 } 302 }
304 } 303 }
305 return 0; 304 return 0;
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 065819ba87c7..a697fb6cf050 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -91,10 +91,6 @@ static DEFINE_SPINLOCK(acpi_res_lock);
91#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ 91#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
92static char osi_additional_string[OSI_STRING_LENGTH_MAX]; 92static char osi_additional_string[OSI_STRING_LENGTH_MAX];
93 93
94#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
95static int acpi_no_initrd_override;
96#endif
97
98/* 94/*
99 * "Ode to _OSI(Linux)" 95 * "Ode to _OSI(Linux)"
100 * 96 *
@@ -324,67 +320,6 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
324 return AE_OK; 320 return AE_OK;
325} 321}
326 322
327#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
328static struct acpi_table_header *acpi_find_dsdt_initrd(void)
329{
330 struct file *firmware_file;
331 mm_segment_t oldfs;
332 unsigned long len, len2;
333 struct acpi_table_header *dsdt_buffer, *ret = NULL;
334 struct kstat stat;
335 char *ramfs_dsdt_name = "/DSDT.aml";
336
337 printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT\n");
338
339 /*
340 * Never do this at home, only the user-space is allowed to open a file.
341 * The clean way would be to use the firmware loader.
342 * But this code must be run before there is any userspace available.
343 * A static/init firmware infrastructure doesn't exist yet...
344 */
345 if (vfs_stat(ramfs_dsdt_name, &stat) < 0)
346 return ret;
347
348 len = stat.size;
349 /* check especially against empty files */
350 if (len <= 4) {
351 printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len);
352 return ret;
353 }
354
355 firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0);
356 if (IS_ERR(firmware_file)) {
357 printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name);
358 return ret;
359 }
360
361 dsdt_buffer = kmalloc(len, GFP_ATOMIC);
362 if (!dsdt_buffer) {
363 printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len);
364 goto err;
365 }
366
367 oldfs = get_fs();
368 set_fs(KERNEL_DS);
369 len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len,
370 &firmware_file->f_pos);
371 set_fs(oldfs);
372 if (len2 < len) {
373 printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n",
374 len, ramfs_dsdt_name);
375 ACPI_FREE(dsdt_buffer);
376 goto err;
377 }
378
379 printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n",
380 len, ramfs_dsdt_name);
381 ret = dsdt_buffer;
382err:
383 filp_close(firmware_file, NULL);
384 return ret;
385}
386#endif
387
388acpi_status 323acpi_status
389acpi_os_table_override(struct acpi_table_header * existing_table, 324acpi_os_table_override(struct acpi_table_header * existing_table,
390 struct acpi_table_header ** new_table) 325 struct acpi_table_header ** new_table)
@@ -398,16 +333,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
398 if (strncmp(existing_table->signature, "DSDT", 4) == 0) 333 if (strncmp(existing_table->signature, "DSDT", 4) == 0)
399 *new_table = (struct acpi_table_header *)AmlCode; 334 *new_table = (struct acpi_table_header *)AmlCode;
400#endif 335#endif
401#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
402 if ((strncmp(existing_table->signature, "DSDT", 4) == 0) &&
403 !acpi_no_initrd_override) {
404 struct acpi_table_header *initrd_table;
405
406 initrd_table = acpi_find_dsdt_initrd();
407 if (initrd_table)
408 *new_table = initrd_table;
409 }
410#endif
411 if (*new_table != NULL) { 336 if (*new_table != NULL) {
412 printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " 337 printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], "
413 "this is unsafe: tainting kernel\n", 338 "this is unsafe: tainting kernel\n",
@@ -418,15 +343,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table,
418 return AE_OK; 343 return AE_OK;
419} 344}
420 345
421#ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD
422static int __init acpi_no_initrd_override_setup(char *s)
423{
424 acpi_no_initrd_override = 1;
425 return 1;
426}
427__setup("acpi_no_initrd_override", acpi_no_initrd_override_setup);
428#endif
429
430static irqreturn_t acpi_irq(int irq, void *dev_id) 346static irqreturn_t acpi_irq(int irq, void *dev_id)
431{ 347{
432 u32 handled; 348 u32 handled;
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 1bc0c74f2755..12fb44f16766 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -807,40 +807,11 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
807static int acpi_video_bus_check(struct acpi_video_bus *video) 807static int acpi_video_bus_check(struct acpi_video_bus *video)
808{ 808{
809 acpi_status status = -ENOENT; 809 acpi_status status = -ENOENT;
810 long device_id; 810
811 struct device *dev;
812 struct acpi_device *device;
813 811
814 if (!video) 812 if (!video)
815 return -EINVAL; 813 return -EINVAL;
816 814
817 device = video->device;
818
819 status =
820 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
821
822 if (!ACPI_SUCCESS(status))
823 return -ENODEV;
824
825 /* We need to attempt to determine whether the _ADR refers to a
826 PCI device or not. There's no terribly good way to do this,
827 so the best we can hope for is to assume that there'll never
828 be a video device in the host bridge */
829 if (device_id >= 0x10000) {
830 /* It looks like a PCI device. Does it exist? */
831 dev = acpi_get_physical_device(device->handle);
832 } else {
833 /* It doesn't look like a PCI device. Does its parent
834 exist? */
835 acpi_handle phandle;
836 if (acpi_get_parent(device->handle, &phandle))
837 return -ENODEV;
838 dev = acpi_get_physical_device(phandle);
839 }
840 if (!dev)
841 return -ENODEV;
842 put_device(dev);
843
844 /* Since there is no HID, CID and so on for VGA driver, we have 815 /* Since there is no HID, CID and so on for VGA driver, we have
845 * to check well known required nodes. 816 * to check well known required nodes.
846 */ 817 */
@@ -1366,37 +1337,8 @@ acpi_video_bus_write_DOS(struct file *file,
1366 1337
1367static int acpi_video_bus_add_fs(struct acpi_device *device) 1338static int acpi_video_bus_add_fs(struct acpi_device *device)
1368{ 1339{
1369 long device_id;
1370 int status;
1371 struct proc_dir_entry *entry = NULL; 1340 struct proc_dir_entry *entry = NULL;
1372 struct acpi_video_bus *video; 1341 struct acpi_video_bus *video;
1373 struct device *dev;
1374
1375 status =
1376 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1377
1378 if (!ACPI_SUCCESS(status))
1379 return -ENODEV;
1380
1381 /* We need to attempt to determine whether the _ADR refers to a
1382 PCI device or not. There's no terribly good way to do this,
1383 so the best we can hope for is to assume that there'll never
1384 be a video device in the host bridge */
1385 if (device_id >= 0x10000) {
1386 /* It looks like a PCI device. Does it exist? */
1387 dev = acpi_get_physical_device(device->handle);
1388 } else {
1389 /* It doesn't look like a PCI device. Does its parent
1390 exist? */
1391 acpi_handle phandle;
1392 if (acpi_get_parent(device->handle, &phandle))
1393 return -ENODEV;
1394 dev = acpi_get_physical_device(phandle);
1395 }
1396 if (!dev)
1397 return -ENODEV;
1398 put_device(dev);
1399
1400 1342
1401 1343
1402 video = acpi_driver_data(device); 1344 video = acpi_driver_data(device);
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index e469647330de..25aba69b59b4 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -30,6 +30,7 @@ config ATA_NONSTANDARD
30config ATA_ACPI 30config ATA_ACPI
31 bool 31 bool
32 depends on ACPI && PCI 32 depends on ACPI && PCI
33 select ACPI_DOCK
33 default y 34 default y
34 help 35 help
35 This option adds support for ATA-related ACPI objects. 36 This option adds support for ATA-related ACPI objects.
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 6978469eb16d..17ee6ed985d9 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -49,6 +49,10 @@
49#define DRV_NAME "ahci" 49#define DRV_NAME "ahci"
50#define DRV_VERSION "3.0" 50#define DRV_VERSION "3.0"
51 51
52static int ahci_skip_host_reset;
53module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444);
54MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)");
55
52static int ahci_enable_alpm(struct ata_port *ap, 56static int ahci_enable_alpm(struct ata_port *ap,
53 enum link_pm policy); 57 enum link_pm policy);
54static void ahci_disable_alpm(struct ata_port *ap); 58static void ahci_disable_alpm(struct ata_port *ap);
@@ -587,6 +591,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
587 591
588 /* Marvell */ 592 /* Marvell */
589 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ 593 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
594 { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */
590 595
591 /* Generic, PCI class code for AHCI */ 596 /* Generic, PCI class code for AHCI */
592 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 597 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -661,6 +666,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev,
661 void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; 666 void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR];
662 u32 cap, port_map; 667 u32 cap, port_map;
663 int i; 668 int i;
669 int mv;
664 670
665 /* make sure AHCI mode is enabled before accessing CAP */ 671 /* make sure AHCI mode is enabled before accessing CAP */
666 ahci_enable_ahci(mmio); 672 ahci_enable_ahci(mmio);
@@ -696,12 +702,16 @@ static void ahci_save_initial_config(struct pci_dev *pdev,
696 * presence register, as bit 4 (counting from 0) 702 * presence register, as bit 4 (counting from 0)
697 */ 703 */
698 if (hpriv->flags & AHCI_HFLAG_MV_PATA) { 704 if (hpriv->flags & AHCI_HFLAG_MV_PATA) {
705 if (pdev->device == 0x6121)
706 mv = 0x3;
707 else
708 mv = 0xf;
699 dev_printk(KERN_ERR, &pdev->dev, 709 dev_printk(KERN_ERR, &pdev->dev,
700 "MV_AHCI HACK: port_map %x -> %x\n", 710 "MV_AHCI HACK: port_map %x -> %x\n",
701 hpriv->port_map, 711 port_map,
702 hpriv->port_map & 0xf); 712 port_map & mv);
703 713
704 port_map &= 0xf; 714 port_map &= mv;
705 } 715 }
706 716
707 /* cross check port_map and cap.n_ports */ 717 /* cross check port_map and cap.n_ports */
@@ -1088,29 +1098,35 @@ static int ahci_reset_controller(struct ata_host *host)
1088 ahci_enable_ahci(mmio); 1098 ahci_enable_ahci(mmio);
1089 1099
1090 /* global controller reset */ 1100 /* global controller reset */
1091 tmp = readl(mmio + HOST_CTL); 1101 if (!ahci_skip_host_reset) {
1092 if ((tmp & HOST_RESET) == 0) { 1102 tmp = readl(mmio + HOST_CTL);
1093 writel(tmp | HOST_RESET, mmio + HOST_CTL); 1103 if ((tmp & HOST_RESET) == 0) {
1094 readl(mmio + HOST_CTL); /* flush */ 1104 writel(tmp | HOST_RESET, mmio + HOST_CTL);
1095 } 1105 readl(mmio + HOST_CTL); /* flush */
1106 }
1096 1107
1097 /* reset must complete within 1 second, or 1108 /* reset must complete within 1 second, or
1098 * the hardware should be considered fried. 1109 * the hardware should be considered fried.
1099 */ 1110 */
1100 ssleep(1); 1111 ssleep(1);
1101 1112
1102 tmp = readl(mmio + HOST_CTL); 1113 tmp = readl(mmio + HOST_CTL);
1103 if (tmp & HOST_RESET) { 1114 if (tmp & HOST_RESET) {
1104 dev_printk(KERN_ERR, host->dev, 1115 dev_printk(KERN_ERR, host->dev,
1105 "controller reset failed (0x%x)\n", tmp); 1116 "controller reset failed (0x%x)\n", tmp);
1106 return -EIO; 1117 return -EIO;
1107 } 1118 }
1108 1119
1109 /* turn on AHCI mode */ 1120 /* turn on AHCI mode */
1110 ahci_enable_ahci(mmio); 1121 ahci_enable_ahci(mmio);
1111 1122
1112 /* some registers might be cleared on reset. restore initial values */ 1123 /* Some registers might be cleared on reset. Restore
1113 ahci_restore_initial_config(host); 1124 * initial values.
1125 */
1126 ahci_restore_initial_config(host);
1127 } else
1128 dev_printk(KERN_INFO, host->dev,
1129 "skipping global host reset\n");
1114 1130
1115 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { 1131 if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
1116 u16 tmp16; 1132 u16 tmp16;
@@ -1162,9 +1178,14 @@ static void ahci_init_controller(struct ata_host *host)
1162 int i; 1178 int i;
1163 void __iomem *port_mmio; 1179 void __iomem *port_mmio;
1164 u32 tmp; 1180 u32 tmp;
1181 int mv;
1165 1182
1166 if (hpriv->flags & AHCI_HFLAG_MV_PATA) { 1183 if (hpriv->flags & AHCI_HFLAG_MV_PATA) {
1167 port_mmio = __ahci_port_base(host, 4); 1184 if (pdev->device == 0x6121)
1185 mv = 2;
1186 else
1187 mv = 4;
1188 port_mmio = __ahci_port_base(host, mv);
1168 1189
1169 writel(0, port_mmio + PORT_IRQ_MASK); 1190 writel(0, port_mmio + PORT_IRQ_MASK);
1170 1191
@@ -2241,7 +2262,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2241 if (rc) 2262 if (rc)
2242 return rc; 2263 return rc;
2243 2264
2244 rc = pcim_iomap_regions(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); 2265 /* AHCI controllers often implement SFF compatible interface.
2266 * Grab all PCI BARs just in case.
2267 */
2268 rc = pcim_iomap_regions_request_all(pdev, 1 << AHCI_PCI_BAR, DRV_NAME);
2245 if (rc == -EBUSY) 2269 if (rc == -EBUSY)
2246 pcim_pin_device(pdev); 2270 pcim_pin_device(pdev);
2247 if (rc) 2271 if (rc)
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 0770cb7391a4..bf98a566adac 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -118,45 +118,77 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap)
118 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; 118 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
119} 119}
120 120
121static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj, 121static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
122 u32 event) 122 u32 event)
123{ 123{
124 char event_string[12]; 124 char event_string[12];
125 char *envp[] = { event_string, NULL }; 125 char *envp[] = { event_string, NULL };
126 struct ata_eh_info *ehi = &ap->link.eh_info; 126 struct ata_eh_info *ehi;
127 127 struct kobject *kobj = NULL;
128 if (event == 0 || event == 1) { 128 int wait = 0;
129 unsigned long flags; 129 unsigned long flags;
130 spin_lock_irqsave(ap->lock, flags); 130
131 ata_ehi_clear_desc(ehi); 131 if (!ap)
132 ata_ehi_push_desc(ehi, "ACPI event"); 132 ap = dev->link->ap;
133 ata_ehi_hotplugged(ehi); 133 ehi = &ap->link.eh_info;
134 ata_port_freeze(ap); 134
135 spin_unlock_irqrestore(ap->lock, flags); 135 spin_lock_irqsave(ap->lock, flags);
136
137 switch (event) {
138 case ACPI_NOTIFY_BUS_CHECK:
139 case ACPI_NOTIFY_DEVICE_CHECK:
140 ata_ehi_push_desc(ehi, "ACPI event");
141 ata_ehi_hotplugged(ehi);
142 ata_port_freeze(ap);
143 break;
144
145 case ACPI_NOTIFY_EJECT_REQUEST:
146 ata_ehi_push_desc(ehi, "ACPI event");
147 if (dev)
148 dev->flags |= ATA_DFLAG_DETACH;
149 else {
150 struct ata_link *tlink;
151 struct ata_device *tdev;
152
153 ata_port_for_each_link(tlink, ap)
154 ata_link_for_each_dev(tdev, tlink)
155 tdev->flags |= ATA_DFLAG_DETACH;
156 }
157
158 ata_port_schedule_eh(ap);
159 wait = 1;
160 break;
136 } 161 }
137 162
163 if (dev) {
164 if (dev->sdev)
165 kobj = &dev->sdev->sdev_gendev.kobj;
166 } else
167 kobj = &ap->dev->kobj;
168
138 if (kobj) { 169 if (kobj) {
139 sprintf(event_string, "BAY_EVENT=%d", event); 170 sprintf(event_string, "BAY_EVENT=%d", event);
140 kobject_uevent_env(kobj, KOBJ_CHANGE, envp); 171 kobject_uevent_env(kobj, KOBJ_CHANGE, envp);
141 } 172 }
173
174 spin_unlock_irqrestore(ap->lock, flags);
175
176 if (wait)
177 ata_port_wait_eh(ap);
142} 178}
143 179
144static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) 180static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data)
145{ 181{
146 struct ata_device *dev = data; 182 struct ata_device *dev = data;
147 struct kobject *kobj = NULL;
148 183
149 if (dev->sdev) 184 ata_acpi_handle_hotplug(NULL, dev, event);
150 kobj = &dev->sdev->sdev_gendev.kobj;
151
152 ata_acpi_handle_hotplug(dev->link->ap, kobj, event);
153} 185}
154 186
155static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) 187static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data)
156{ 188{
157 struct ata_port *ap = data; 189 struct ata_port *ap = data;
158 190
159 ata_acpi_handle_hotplug(ap, &ap->dev->kobj, event); 191 ata_acpi_handle_hotplug(ap, NULL, event);
160} 192}
161 193
162/** 194/**
@@ -191,20 +223,30 @@ void ata_acpi_associate(struct ata_host *host)
191 else 223 else
192 ata_acpi_associate_ide_port(ap); 224 ata_acpi_associate_ide_port(ap);
193 225
194 if (ap->acpi_handle) 226 if (ap->acpi_handle) {
195 acpi_install_notify_handler (ap->acpi_handle, 227 acpi_install_notify_handler(ap->acpi_handle,
196 ACPI_SYSTEM_NOTIFY, 228 ACPI_SYSTEM_NOTIFY,
197 ata_acpi_ap_notify, 229 ata_acpi_ap_notify, ap);
198 ap); 230#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE)
231 /* we might be on a docking station */
232 register_hotplug_dock_device(ap->acpi_handle,
233 ata_acpi_ap_notify, ap);
234#endif
235 }
199 236
200 for (j = 0; j < ata_link_max_devices(&ap->link); j++) { 237 for (j = 0; j < ata_link_max_devices(&ap->link); j++) {
201 struct ata_device *dev = &ap->link.device[j]; 238 struct ata_device *dev = &ap->link.device[j];
202 239
203 if (dev->acpi_handle) 240 if (dev->acpi_handle) {
204 acpi_install_notify_handler (dev->acpi_handle, 241 acpi_install_notify_handler(dev->acpi_handle,
205 ACPI_SYSTEM_NOTIFY, 242 ACPI_SYSTEM_NOTIFY,
206 ata_acpi_dev_notify, 243 ata_acpi_dev_notify, dev);
207 dev); 244#if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE)
245 /* we might be on a docking station */
246 register_hotplug_dock_device(dev->acpi_handle,
247 ata_acpi_dev_notify, dev);
248#endif
249 }
208 } 250 }
209 } 251 }
210} 252}
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 7e68edf3c0f3..8786455c901d 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -295,7 +295,7 @@ static void ali_lock_sectors(struct ata_device *adev)
295static int ali_check_atapi_dma(struct ata_queued_cmd *qc) 295static int ali_check_atapi_dma(struct ata_queued_cmd *qc)
296{ 296{
297 /* If its not a media command, its not worth it */ 297 /* If its not a media command, its not worth it */
298 if (qc->nbytes < 2048) 298 if (atapi_cmd_type(qc->cdb[0]) == ATAPI_MISC)
299 return -EOPNOTSUPP; 299 return -EOPNOTSUPP;
300 return 0; 300 return 0;
301} 301}
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 3b1a68d6eddb..0cfbe8c594a5 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -238,6 +238,7 @@ static int virtblk_probe(struct virtio_device *vdev)
238 vblk->disk->first_minor = index_to_minor(index); 238 vblk->disk->first_minor = index_to_minor(index);
239 vblk->disk->private_data = vblk; 239 vblk->disk->private_data = vblk;
240 vblk->disk->fops = &virtblk_fops; 240 vblk->disk->fops = &virtblk_fops;
241 vblk->disk->driverfs_dev = &vdev->dev;
241 index++; 242 index++;
242 243
243 /* If barriers are supported, tell block layer that queue is ordered */ 244 /* If barriers are supported, tell block layer that queue is ordered */
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig
index fe9e768cfbc4..25bdc2dd9ce1 100644
--- a/drivers/firewire/Kconfig
+++ b/drivers/firewire/Kconfig
@@ -1,5 +1,3 @@
1# -*- shell-script -*-
2
3comment "An alternative FireWire stack is available with EXPERIMENTAL=y" 1comment "An alternative FireWire stack is available with EXPERIMENTAL=y"
4 depends on EXPERIMENTAL=n 2 depends on EXPERIMENTAL=n
5 3
@@ -21,27 +19,7 @@ config FIREWIRE
21 NOTE: 19 NOTE:
22 20
23 You should only build ONE of the stacks, unless you REALLY know what 21 You should only build ONE of the stacks, unless you REALLY know what
24 you are doing. If you install both, you should configure them only as 22 you are doing.
25 modules rather than link them statically, and you should blacklist one
26 of the concurrent low-level drivers in /etc/modprobe.conf. Add either
27
28 blacklist firewire-ohci
29 or
30 blacklist ohci1394
31
32 there depending on which driver you DON'T want to have auto-loaded.
33 You can optionally do the same with the other IEEE 1394/ FireWire
34 drivers.
35
36 If you have an old modprobe which doesn't implement the blacklist
37 directive, use either
38
39 install firewire-ohci /bin/true
40 or
41 install ohci1394 /bin/true
42
43 and so on, depending on which modules you DON't want to have
44 auto-loaded.
45 23
46config FIREWIRE_OHCI 24config FIREWIRE_OHCI
47 tristate "Support for OHCI FireWire host controllers" 25 tristate "Support for OHCI FireWire host controllers"
@@ -57,8 +35,24 @@ config FIREWIRE_OHCI
57 35
58 NOTE: 36 NOTE:
59 37
60 If you also build ohci1394 of the classic stack, blacklist either 38 You should only build ohci1394 or firewire-ohci, but not both.
61 ohci1394 or firewire-ohci to let hotplug load only the desired driver. 39 If you nevertheless want to install both, you should configure them
40 only as modules and blacklist the driver(s) which you don't want to
41 have auto-loaded. Add either
42
43 blacklist firewire-ohci
44 or
45 blacklist ohci1394
46 blacklist video1394
47 blacklist dv1394
48
49 to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf
50 depending on your distribution. The latter two modules should be
51 blacklisted together with ohci1394 because they depend on ohci1394.
52
53 If you have an old modprobe which doesn't implement the blacklist
54 directive, use "install modulename /bin/true" for the modules to be
55 blacklisted.
62 56
63config FIREWIRE_SBP2 57config FIREWIRE_SBP2
64 tristate "Support for storage devices (SBP-2 protocol driver)" 58 tristate "Support for storage devices (SBP-2 protocol driver)"
@@ -75,9 +69,3 @@ config FIREWIRE_SBP2
75 69
76 You should also enable support for disks, CD-ROMs, etc. in the SCSI 70 You should also enable support for disks, CD-ROMs, etc. in the SCSI
77 configuration section. 71 configuration section.
78
79 NOTE:
80
81 If you also build sbp2 of the classic stack, blacklist either sbp2
82 or firewire-sbp2 to let hotplug load only the desired driver.
83
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 7ebad3c14cb8..996d61f0d460 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -33,6 +33,10 @@
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/system.h> 34#include <asm/system.h>
35 35
36#ifdef CONFIG_PPC_PMAC
37#include <asm/pmac_feature.h>
38#endif
39
36#include "fw-ohci.h" 40#include "fw-ohci.h"
37#include "fw-transaction.h" 41#include "fw-transaction.h"
38 42
@@ -175,6 +179,7 @@ struct fw_ohci {
175 int generation; 179 int generation;
176 int request_generation; 180 int request_generation;
177 u32 bus_seconds; 181 u32 bus_seconds;
182 bool old_uninorth;
178 183
179 /* 184 /*
180 * Spinlock for accessing fw_ohci data. Never call out of 185 * Spinlock for accessing fw_ohci data. Never call out of
@@ -276,19 +281,13 @@ static int ar_context_add_page(struct ar_context *ctx)
276{ 281{
277 struct device *dev = ctx->ohci->card.device; 282 struct device *dev = ctx->ohci->card.device;
278 struct ar_buffer *ab; 283 struct ar_buffer *ab;
279 dma_addr_t ab_bus; 284 dma_addr_t uninitialized_var(ab_bus);
280 size_t offset; 285 size_t offset;
281 286
282 ab = (struct ar_buffer *) __get_free_page(GFP_ATOMIC); 287 ab = dma_alloc_coherent(dev, PAGE_SIZE, &ab_bus, GFP_ATOMIC);
283 if (ab == NULL) 288 if (ab == NULL)
284 return -ENOMEM; 289 return -ENOMEM;
285 290
286 ab_bus = dma_map_single(dev, ab, PAGE_SIZE, DMA_BIDIRECTIONAL);
287 if (dma_mapping_error(ab_bus)) {
288 free_page((unsigned long) ab);
289 return -ENOMEM;
290 }
291
292 memset(&ab->descriptor, 0, sizeof(ab->descriptor)); 291 memset(&ab->descriptor, 0, sizeof(ab->descriptor));
293 ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | 292 ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE |
294 DESCRIPTOR_STATUS | 293 DESCRIPTOR_STATUS |
@@ -299,8 +298,6 @@ static int ar_context_add_page(struct ar_context *ctx)
299 ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset); 298 ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset);
300 ab->descriptor.branch_address = 0; 299 ab->descriptor.branch_address = 0;
301 300
302 dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
303
304 ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); 301 ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1);
305 ctx->last_buffer->next = ab; 302 ctx->last_buffer->next = ab;
306 ctx->last_buffer = ab; 303 ctx->last_buffer = ab;
@@ -311,15 +308,22 @@ static int ar_context_add_page(struct ar_context *ctx)
311 return 0; 308 return 0;
312} 309}
313 310
311#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
312#define cond_le32_to_cpu(v) \
313 (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v))
314#else
315#define cond_le32_to_cpu(v) le32_to_cpu(v)
316#endif
317
314static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) 318static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer)
315{ 319{
316 struct fw_ohci *ohci = ctx->ohci; 320 struct fw_ohci *ohci = ctx->ohci;
317 struct fw_packet p; 321 struct fw_packet p;
318 u32 status, length, tcode; 322 u32 status, length, tcode;
319 323
320 p.header[0] = le32_to_cpu(buffer[0]); 324 p.header[0] = cond_le32_to_cpu(buffer[0]);
321 p.header[1] = le32_to_cpu(buffer[1]); 325 p.header[1] = cond_le32_to_cpu(buffer[1]);
322 p.header[2] = le32_to_cpu(buffer[2]); 326 p.header[2] = cond_le32_to_cpu(buffer[2]);
323 327
324 tcode = (p.header[0] >> 4) & 0x0f; 328 tcode = (p.header[0] >> 4) & 0x0f;
325 switch (tcode) { 329 switch (tcode) {
@@ -331,7 +335,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer)
331 break; 335 break;
332 336
333 case TCODE_READ_BLOCK_REQUEST : 337 case TCODE_READ_BLOCK_REQUEST :
334 p.header[3] = le32_to_cpu(buffer[3]); 338 p.header[3] = cond_le32_to_cpu(buffer[3]);
335 p.header_length = 16; 339 p.header_length = 16;
336 p.payload_length = 0; 340 p.payload_length = 0;
337 break; 341 break;
@@ -340,7 +344,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer)
340 case TCODE_READ_BLOCK_RESPONSE: 344 case TCODE_READ_BLOCK_RESPONSE:
341 case TCODE_LOCK_REQUEST: 345 case TCODE_LOCK_REQUEST:
342 case TCODE_LOCK_RESPONSE: 346 case TCODE_LOCK_RESPONSE:
343 p.header[3] = le32_to_cpu(buffer[3]); 347 p.header[3] = cond_le32_to_cpu(buffer[3]);
344 p.header_length = 16; 348 p.header_length = 16;
345 p.payload_length = p.header[3] >> 16; 349 p.payload_length = p.header[3] >> 16;
346 break; 350 break;
@@ -357,7 +361,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer)
357 361
358 /* FIXME: What to do about evt_* errors? */ 362 /* FIXME: What to do about evt_* errors? */
359 length = (p.header_length + p.payload_length + 3) / 4; 363 length = (p.header_length + p.payload_length + 3) / 4;
360 status = le32_to_cpu(buffer[length]); 364 status = cond_le32_to_cpu(buffer[length]);
361 365
362 p.ack = ((status >> 16) & 0x1f) - 16; 366 p.ack = ((status >> 16) & 0x1f) - 16;
363 p.speed = (status >> 21) & 0x7; 367 p.speed = (status >> 21) & 0x7;
@@ -375,7 +379,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer)
375 */ 379 */
376 380
377 if (p.ack + 16 == 0x09) 381 if (p.ack + 16 == 0x09)
378 ohci->request_generation = (buffer[2] >> 16) & 0xff; 382 ohci->request_generation = (p.header[2] >> 16) & 0xff;
379 else if (ctx == &ohci->ar_request_ctx) 383 else if (ctx == &ohci->ar_request_ctx)
380 fw_core_handle_request(&ohci->card, &p); 384 fw_core_handle_request(&ohci->card, &p);
381 else 385 else
@@ -397,6 +401,7 @@ static void ar_context_tasklet(unsigned long data)
397 401
398 if (d->res_count == 0) { 402 if (d->res_count == 0) {
399 size_t size, rest, offset; 403 size_t size, rest, offset;
404 dma_addr_t buffer_bus;
400 405
401 /* 406 /*
402 * This descriptor is finished and we may have a 407 * This descriptor is finished and we may have a
@@ -405,9 +410,7 @@ static void ar_context_tasklet(unsigned long data)
405 */ 410 */
406 411
407 offset = offsetof(struct ar_buffer, data); 412 offset = offsetof(struct ar_buffer, data);
408 dma_unmap_single(ohci->card.device, 413 buffer_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
409 le32_to_cpu(ab->descriptor.data_address) - offset,
410 PAGE_SIZE, DMA_BIDIRECTIONAL);
411 414
412 buffer = ab; 415 buffer = ab;
413 ab = ab->next; 416 ab = ab->next;
@@ -423,7 +426,8 @@ static void ar_context_tasklet(unsigned long data)
423 while (buffer < end) 426 while (buffer < end)
424 buffer = handle_ar_packet(ctx, buffer); 427 buffer = handle_ar_packet(ctx, buffer);
425 428
426 free_page((unsigned long)buffer); 429 dma_free_coherent(ohci->card.device, PAGE_SIZE,
430 buffer, buffer_bus);
427 ar_context_add_page(ctx); 431 ar_context_add_page(ctx);
428 } else { 432 } else {
429 buffer = ctx->pointer; 433 buffer = ctx->pointer;
@@ -532,7 +536,7 @@ static int
532context_add_buffer(struct context *ctx) 536context_add_buffer(struct context *ctx)
533{ 537{
534 struct descriptor_buffer *desc; 538 struct descriptor_buffer *desc;
535 dma_addr_t bus_addr; 539 dma_addr_t uninitialized_var(bus_addr);
536 int offset; 540 int offset;
537 541
538 /* 542 /*
@@ -1022,13 +1026,14 @@ static void bus_reset_tasklet(unsigned long data)
1022 */ 1026 */
1023 1027
1024 self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff; 1028 self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff;
1025 generation = (le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; 1029 generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff;
1026 rmb(); 1030 rmb();
1027 1031
1028 for (i = 1, j = 0; j < self_id_count; i += 2, j++) { 1032 for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
1029 if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) 1033 if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1])
1030 fw_error("inconsistent self IDs\n"); 1034 fw_error("inconsistent self IDs\n");
1031 ohci->self_id_buffer[j] = le32_to_cpu(ohci->self_id_cpu[i]); 1035 ohci->self_id_buffer[j] =
1036 cond_le32_to_cpu(ohci->self_id_cpu[i]);
1032 } 1037 }
1033 rmb(); 1038 rmb();
1034 1039
@@ -1316,7 +1321,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
1316 unsigned long flags; 1321 unsigned long flags;
1317 int retval = -EBUSY; 1322 int retval = -EBUSY;
1318 __be32 *next_config_rom; 1323 __be32 *next_config_rom;
1319 dma_addr_t next_config_rom_bus; 1324 dma_addr_t uninitialized_var(next_config_rom_bus);
1320 1325
1321 ohci = fw_ohci(card); 1326 ohci = fw_ohci(card);
1322 1327
@@ -1487,7 +1492,7 @@ static int handle_ir_dualbuffer_packet(struct context *context,
1487 void *p, *end; 1492 void *p, *end;
1488 int i; 1493 int i;
1489 1494
1490 if (db->first_res_count > 0 && db->second_res_count > 0) { 1495 if (db->first_res_count != 0 && db->second_res_count != 0) {
1491 if (ctx->excess_bytes <= le16_to_cpu(db->second_req_count)) { 1496 if (ctx->excess_bytes <= le16_to_cpu(db->second_req_count)) {
1492 /* This descriptor isn't done yet, stop iteration. */ 1497 /* This descriptor isn't done yet, stop iteration. */
1493 return 0; 1498 return 0;
@@ -1513,7 +1518,7 @@ static int handle_ir_dualbuffer_packet(struct context *context,
1513 memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4); 1518 memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4);
1514 i += ctx->base.header_size; 1519 i += ctx->base.header_size;
1515 ctx->excess_bytes += 1520 ctx->excess_bytes +=
1516 (le32_to_cpu(*(u32 *)(p + 4)) >> 16) & 0xffff; 1521 (le32_to_cpu(*(__le32 *)(p + 4)) >> 16) & 0xffff;
1517 p += ctx->base.header_size + 4; 1522 p += ctx->base.header_size + 4;
1518 } 1523 }
1519 ctx->header_length = i; 1524 ctx->header_length = i;
@@ -2048,6 +2053,18 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
2048 int err; 2053 int err;
2049 size_t size; 2054 size_t size;
2050 2055
2056#ifdef CONFIG_PPC_PMAC
2057 /* Necessary on some machines if fw-ohci was loaded/ unloaded before */
2058 if (machine_is(powermac)) {
2059 struct device_node *ofn = pci_device_to_OF_node(dev);
2060
2061 if (ofn) {
2062 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 1);
2063 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1);
2064 }
2065 }
2066#endif /* CONFIG_PPC_PMAC */
2067
2051 ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); 2068 ohci = kzalloc(sizeof(*ohci), GFP_KERNEL);
2052 if (ohci == NULL) { 2069 if (ohci == NULL) {
2053 fw_error("Could not malloc fw_ohci data.\n"); 2070 fw_error("Could not malloc fw_ohci data.\n");
@@ -2066,6 +2083,10 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
2066 pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0); 2083 pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0);
2067 pci_set_drvdata(dev, ohci); 2084 pci_set_drvdata(dev, ohci);
2068 2085
2086#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
2087 ohci->old_uninorth = dev->vendor == PCI_VENDOR_ID_APPLE &&
2088 dev->device == PCI_DEVICE_ID_APPLE_UNI_N_FW;
2089#endif
2069 spin_lock_init(&ohci->lock); 2090 spin_lock_init(&ohci->lock);
2070 2091
2071 tasklet_init(&ohci->bus_reset_tasklet, 2092 tasklet_init(&ohci->bus_reset_tasklet,
@@ -2182,6 +2203,19 @@ static void pci_remove(struct pci_dev *dev)
2182 pci_disable_device(dev); 2203 pci_disable_device(dev);
2183 fw_card_put(&ohci->card); 2204 fw_card_put(&ohci->card);
2184 2205
2206#ifdef CONFIG_PPC_PMAC
2207 /* On UniNorth, power down the cable and turn off the chip clock
2208 * to save power on laptops */
2209 if (machine_is(powermac)) {
2210 struct device_node *ofn = pci_device_to_OF_node(dev);
2211
2212 if (ofn) {
2213 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
2214 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0);
2215 }
2216 }
2217#endif /* CONFIG_PPC_PMAC */
2218
2185 fw_notify("Removed fw-ohci device.\n"); 2219 fw_notify("Removed fw-ohci device.\n");
2186} 2220}
2187 2221
@@ -2202,6 +2236,16 @@ static int pci_suspend(struct pci_dev *pdev, pm_message_t state)
2202 if (err) 2236 if (err)
2203 fw_error("pci_set_power_state failed with %d\n", err); 2237 fw_error("pci_set_power_state failed with %d\n", err);
2204 2238
2239/* PowerMac suspend code comes last */
2240#ifdef CONFIG_PPC_PMAC
2241 if (machine_is(powermac)) {
2242 struct device_node *ofn = pci_device_to_OF_node(pdev);
2243
2244 if (ofn)
2245 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
2246 }
2247#endif /* CONFIG_PPC_PMAC */
2248
2205 return 0; 2249 return 0;
2206} 2250}
2207 2251
@@ -2210,6 +2254,16 @@ static int pci_resume(struct pci_dev *pdev)
2210 struct fw_ohci *ohci = pci_get_drvdata(pdev); 2254 struct fw_ohci *ohci = pci_get_drvdata(pdev);
2211 int err; 2255 int err;
2212 2256
2257/* PowerMac resume code comes first */
2258#ifdef CONFIG_PPC_PMAC
2259 if (machine_is(powermac)) {
2260 struct device_node *ofn = pci_device_to_OF_node(pdev);
2261
2262 if (ofn)
2263 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1);
2264 }
2265#endif /* CONFIG_PPC_PMAC */
2266
2213 pci_set_power_state(pdev, PCI_D0); 2267 pci_set_power_state(pdev, PCI_D0);
2214 pci_restore_state(pdev); 2268 pci_restore_state(pdev);
2215 err = pci_enable_device(pdev); 2269 err = pci_enable_device(pdev);
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 03069a454c07..62b4e47d0cc0 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -173,6 +173,7 @@ struct sbp2_target {
173#define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ 173#define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */
174#define SBP2_ORB_NULL 0x80000000 174#define SBP2_ORB_NULL 0x80000000
175#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 175#define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000
176#define SBP2_RETRY_LIMIT 0xf /* 15 retries */
176 177
177#define SBP2_DIRECTION_TO_MEDIA 0x0 178#define SBP2_DIRECTION_TO_MEDIA 0x0
178#define SBP2_DIRECTION_FROM_MEDIA 0x1 179#define SBP2_DIRECTION_FROM_MEDIA 0x1
@@ -330,6 +331,11 @@ static const struct {
330 .model = ~0, 331 .model = ~0,
331 .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, 332 .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS,
332 }, 333 },
334 /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ {
335 .firmware_revision = 0x002600,
336 .model = ~0,
337 .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS,
338 },
333 339
334 /* 340 /*
335 * There are iPods (2nd gen, 3rd gen) with model_id == 0, but 341 * There are iPods (2nd gen, 3rd gen) with model_id == 0, but
@@ -812,6 +818,30 @@ static void sbp2_target_put(struct sbp2_target *tgt)
812 kref_put(&tgt->kref, sbp2_release_target); 818 kref_put(&tgt->kref, sbp2_release_target);
813} 819}
814 820
821static void
822complete_set_busy_timeout(struct fw_card *card, int rcode,
823 void *payload, size_t length, void *done)
824{
825 complete(done);
826}
827
828static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
829{
830 struct fw_device *device = fw_device(lu->tgt->unit->device.parent);
831 DECLARE_COMPLETION_ONSTACK(done);
832 struct fw_transaction t;
833 static __be32 busy_timeout;
834
835 /* FIXME: we should try to set dual-phase cycle_limit too */
836 busy_timeout = cpu_to_be32(SBP2_RETRY_LIMIT);
837
838 fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST,
839 lu->tgt->node_id, lu->generation, device->max_speed,
840 CSR_REGISTER_BASE + CSR_BUSY_TIMEOUT, &busy_timeout,
841 sizeof(busy_timeout), complete_set_busy_timeout, &done);
842 wait_for_completion(&done);
843}
844
815static void sbp2_reconnect(struct work_struct *work); 845static void sbp2_reconnect(struct work_struct *work);
816 846
817static void sbp2_login(struct work_struct *work) 847static void sbp2_login(struct work_struct *work)
@@ -864,10 +894,8 @@ static void sbp2_login(struct work_struct *work)
864 fw_notify("%s: logged in to LUN %04x (%d retries)\n", 894 fw_notify("%s: logged in to LUN %04x (%d retries)\n",
865 tgt->bus_id, lu->lun, lu->retries); 895 tgt->bus_id, lu->lun, lu->retries);
866 896
867#if 0 897 /* set appropriate retry limit(s) in BUSY_TIMEOUT register */
868 /* FIXME: The linux1394 sbp2 does this last step. */ 898 sbp2_set_busy_timeout(lu);
869 sbp2_set_busy_timeout(scsi_id);
870#endif
871 899
872 PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); 900 PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect);
873 sbp2_agent_reset(lu); 901 sbp2_agent_reset(lu);
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c
index e47bb040197a..d2c7a3d7e1cb 100644
--- a/drivers/firewire/fw-topology.c
+++ b/drivers/firewire/fw-topology.c
@@ -21,6 +21,7 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <asm/bug.h>
24#include <asm/system.h> 25#include <asm/system.h>
25#include "fw-transaction.h" 26#include "fw-transaction.h"
26#include "fw-topology.h" 27#include "fw-topology.h"
@@ -424,8 +425,8 @@ update_tree(struct fw_card *card, struct fw_node *root)
424 node1 = fw_node(list1.next); 425 node1 = fw_node(list1.next);
425 426
426 while (&node0->link != &list0) { 427 while (&node0->link != &list0) {
428 WARN_ON(node0->port_count != node1->port_count);
427 429
428 /* assert(node0->port_count == node1->port_count); */
429 if (node0->link_on && !node1->link_on) 430 if (node0->link_on && !node1->link_on)
430 event = FW_NODE_LINK_OFF; 431 event = FW_NODE_LINK_OFF;
431 else if (!node0->link_on && node1->link_on) 432 else if (!node0->link_on && node1->link_on)
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 7fcc59dedf08..99529e59a0b1 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -751,7 +751,7 @@ handle_topology_map(struct fw_card *card, struct fw_request *request,
751 void *payload, size_t length, void *callback_data) 751 void *payload, size_t length, void *callback_data)
752{ 752{
753 int i, start, end; 753 int i, start, end;
754 u32 *map; 754 __be32 *map;
755 755
756 if (!TCODE_IS_READ_REQUEST(tcode)) { 756 if (!TCODE_IS_READ_REQUEST(tcode)) {
757 fw_send_response(card, request, RCODE_TYPE_ERROR); 757 fw_send_response(card, request, RCODE_TYPE_ERROR);
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 09cb72870454..a43bb22912f9 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -86,12 +86,12 @@
86static inline void 86static inline void
87fw_memcpy_from_be32(void *_dst, void *_src, size_t size) 87fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
88{ 88{
89 u32 *dst = _dst; 89 u32 *dst = _dst;
90 u32 *src = _src; 90 __be32 *src = _src;
91 int i; 91 int i;
92 92
93 for (i = 0; i < size / 4; i++) 93 for (i = 0; i < size / 4; i++)
94 dst[i] = cpu_to_be32(src[i]); 94 dst[i] = be32_to_cpu(src[i]);
95} 95}
96 96
97static inline void 97static inline void
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 9e2b1964d71a..f53f72daae34 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -376,6 +376,11 @@ static const struct {
376 .model_id = SBP2_ROM_VALUE_WILDCARD, 376 .model_id = SBP2_ROM_VALUE_WILDCARD,
377 .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, 377 .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS,
378 }, 378 },
379 /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ {
380 .firmware_revision = 0x002600,
381 .model_id = SBP2_ROM_VALUE_WILDCARD,
382 .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS,
383 },
379 /* iPod 4th generation */ { 384 /* iPod 4th generation */ {
380 .firmware_revision = 0x0a2700, 385 .firmware_revision = 0x0a2700,
381 .model_id = 0x000021, 386 .model_id = 0x000021,
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c
index 20d5c7bd940a..1c14a186f000 100644
--- a/drivers/mmc/host/tifm_sd.c
+++ b/drivers/mmc/host/tifm_sd.c
@@ -180,7 +180,7 @@ static void tifm_sd_transfer_data(struct tifm_sd *host)
180 host->sg_pos++; 180 host->sg_pos++;
181 if (host->sg_pos == host->sg_len) { 181 if (host->sg_pos == host->sg_len) {
182 if ((r_data->flags & MMC_DATA_WRITE) 182 if ((r_data->flags & MMC_DATA_WRITE)
183 && DATA_CARRY) 183 && (host->cmd_flags & DATA_CARRY))
184 writel(host->bounce_buf_data[0], 184 writel(host->bounce_buf_data[0],
185 host->dev->addr 185 host->dev->addr
186 + SOCK_MMCSD_DATA); 186 + SOCK_MMCSD_DATA);
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 19fd4cb0ddf8..b58472cf76f8 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -203,8 +203,11 @@ again:
203 if (received < budget) { 203 if (received < budget) {
204 netif_rx_complete(vi->dev, napi); 204 netif_rx_complete(vi->dev, napi);
205 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) 205 if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
206 && netif_rx_reschedule(vi->dev, napi)) 206 && napi_schedule_prep(napi)) {
207 vi->rvq->vq_ops->disable_cb(vi->rvq);
208 __netif_rx_schedule(vi->dev, napi);
207 goto again; 209 goto again;
210 }
208 } 211 }
209 212
210 return received; 213 return received;
@@ -278,10 +281,11 @@ again:
278 pr_debug("%s: virtio not prepared to send\n", dev->name); 281 pr_debug("%s: virtio not prepared to send\n", dev->name);
279 netif_stop_queue(dev); 282 netif_stop_queue(dev);
280 283
281 /* Activate callback for using skbs: if this fails it 284 /* Activate callback for using skbs: if this returns false it
282 * means some were used in the meantime. */ 285 * means some were used in the meantime. */
283 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { 286 if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
284 printk("Unlikely: restart svq failed\n"); 287 printk("Unlikely: restart svq race\n");
288 vi->svq->vq_ops->disable_cb(vi->svq);
285 netif_start_queue(dev); 289 netif_start_queue(dev);
286 goto again; 290 goto again;
287 } 291 }
@@ -294,6 +298,15 @@ again:
294 return 0; 298 return 0;
295} 299}
296 300
301#ifdef CONFIG_NET_POLL_CONTROLLER
302static void virtnet_netpoll(struct net_device *dev)
303{
304 struct virtnet_info *vi = netdev_priv(dev);
305
306 napi_schedule(&vi->napi);
307}
308#endif
309
297static int virtnet_open(struct net_device *dev) 310static int virtnet_open(struct net_device *dev)
298{ 311{
299 struct virtnet_info *vi = netdev_priv(dev); 312 struct virtnet_info *vi = netdev_priv(dev);
@@ -336,6 +349,9 @@ static int virtnet_probe(struct virtio_device *vdev)
336 dev->stop = virtnet_close; 349 dev->stop = virtnet_close;
337 dev->hard_start_xmit = start_xmit; 350 dev->hard_start_xmit = start_xmit;
338 dev->features = NETIF_F_HIGHDMA; 351 dev->features = NETIF_F_HIGHDMA;
352#ifdef CONFIG_NET_POLL_CONTROLLER
353 dev->poll_controller = virtnet_netpoll;
354#endif
339 SET_NETDEV_DEV(dev, &vdev->dev); 355 SET_NETDEV_DEV(dev, &vdev->dev);
340 356
341 /* Do we support "hardware" checksums? */ 357 /* Do we support "hardware" checksums? */
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index de34aa9d3136..f9f9a5f1bbd0 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -829,7 +829,7 @@ static ssize_t pdcs_autoboot_write(struct kobject *kobj,
829 struct kobj_attribute *attr, 829 struct kobj_attribute *attr,
830 const char *buf, size_t count) 830 const char *buf, size_t count)
831{ 831{
832 return pdcs_auto_write(kset, attr, buf, count, PF_AUTOBOOT); 832 return pdcs_auto_write(kobj, attr, buf, count, PF_AUTOBOOT);
833} 833}
834 834
835/** 835/**
@@ -845,7 +845,7 @@ static ssize_t pdcs_autosearch_write(struct kobject *kobj,
845 struct kobj_attribute *attr, 845 struct kobj_attribute *attr,
846 const char *buf, size_t count) 846 const char *buf, size_t count)
847{ 847{
848 return pdcs_auto_write(kset, attr, buf, count, PF_AUTOSEARCH); 848 return pdcs_auto_write(kobj, attr, buf, count, PF_AUTOSEARCH);
849} 849}
850 850
851/** 851/**
@@ -1066,7 +1066,7 @@ pdc_stable_init(void)
1066 } 1066 }
1067 1067
1068 /* Don't forget the root entries */ 1068 /* Don't forget the root entries */
1069 error = sysfs_create_group(stable_kobj, pdcs_attr_group); 1069 error = sysfs_create_group(stable_kobj, &pdcs_attr_group);
1070 1070
1071 /* register the paths kset as a child of the stable kset */ 1071 /* register the paths kset as a child of the stable kset */
1072 paths_kset = kset_create_and_add("paths", NULL, stable_kobj); 1072 paths_kset = kset_create_and_add("paths", NULL, stable_kobj);
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index bdbe780e21c5..8c4d2c13d5f2 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -314,8 +314,8 @@ sba_dump_sg( struct ioc *ioc, struct scatterlist *startsg, int nents)
314#define RESMAP_MASK(n) (~0UL << (BITS_PER_LONG - (n))) 314#define RESMAP_MASK(n) (~0UL << (BITS_PER_LONG - (n)))
315#define RESMAP_IDX_MASK (sizeof(unsigned long) - 1) 315#define RESMAP_IDX_MASK (sizeof(unsigned long) - 1)
316 316
317unsigned long ptr_to_pide(struct ioc *ioc, unsigned long *res_ptr, 317static unsigned long ptr_to_pide(struct ioc *ioc, unsigned long *res_ptr,
318 unsigned int bitshiftcnt) 318 unsigned int bitshiftcnt)
319{ 319{
320 return (((unsigned long)res_ptr - (unsigned long)ioc->res_map) << 3) 320 return (((unsigned long)res_ptr - (unsigned long)ioc->res_map) << 3)
321 + bitshiftcnt; 321 + bitshiftcnt;
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 3ab313ed441c..17e71d56f31e 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -4,8 +4,6 @@
4 4
5menuconfig THERMAL 5menuconfig THERMAL
6 bool "Generic Thermal sysfs driver" 6 bool "Generic Thermal sysfs driver"
7 select HWMON
8 default y
9 help 7 help
10 Generic Thermal Sysfs driver offers a generic mechanism for 8 Generic Thermal Sysfs driver offers a generic mechanism for
11 thermal management. Usually it's made up of one or more thermal 9 thermal management. Usually it's made up of one or more thermal
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c
index 41bd4c805ace..8b86e53ccf7a 100644
--- a/drivers/thermal/thermal.c
+++ b/drivers/thermal/thermal.c
@@ -30,10 +30,8 @@
30#include <linux/idr.h> 30#include <linux/idr.h>
31#include <linux/thermal.h> 31#include <linux/thermal.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/hwmon.h>
34#include <linux/hwmon-sysfs.h>
35 33
36MODULE_AUTHOR("Zhang Rui"); 34MODULE_AUTHOR("Zhang Rui")
37MODULE_DESCRIPTION("Generic thermal management sysfs support"); 35MODULE_DESCRIPTION("Generic thermal management sysfs support");
38MODULE_LICENSE("GPL"); 36MODULE_LICENSE("GPL");
39 37
@@ -58,9 +56,6 @@ static LIST_HEAD(thermal_tz_list);
58static LIST_HEAD(thermal_cdev_list); 56static LIST_HEAD(thermal_cdev_list);
59static DEFINE_MUTEX(thermal_list_lock); 57static DEFINE_MUTEX(thermal_list_lock);
60 58
61static struct device *thermal_hwmon;
62#define MAX_THERMAL_ZONES 10
63
64static int get_idr(struct idr *idr, struct mutex *lock, int *id) 59static int get_idr(struct idr *idr, struct mutex *lock, int *id)
65{ 60{
66 int err; 61 int err;
@@ -92,67 +87,7 @@ static void release_idr(struct idr *idr, struct mutex *lock, int id)
92 mutex_unlock(lock); 87 mutex_unlock(lock);
93} 88}
94 89
95/* hwmon sys I/F*/ 90/* sys I/F for thermal zone */
96static ssize_t
97name_show(struct device *dev, struct device_attribute *attr, char *buf)
98{
99 return sprintf(buf, "thermal_sys_class\n");
100}
101
102static ssize_t
103temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
104{
105 struct thermal_zone_device *tz;
106 struct sensor_device_attribute *sensor_attr
107 = to_sensor_dev_attr(attr);
108
109 list_for_each_entry(tz, &thermal_tz_list, node)
110 if (tz->id == sensor_attr->index)
111 return tz->ops->get_temp(tz, buf);
112
113 return -ENODEV;
114}
115
116static ssize_t
117temp_crit_show(struct device *dev, struct device_attribute *attr,
118 char *buf)
119{
120 struct thermal_zone_device *tz;
121 struct sensor_device_attribute *sensor_attr
122 = to_sensor_dev_attr(attr);
123
124 list_for_each_entry(tz, &thermal_tz_list, node)
125 if (tz->id == sensor_attr->index)
126 return tz->ops->get_trip_temp(tz, 0, buf);
127
128 return -ENODEV;
129}
130
131static DEVICE_ATTR(name, 0444, name_show, NULL);
132static struct sensor_device_attribute sensor_attrs[] = {
133 SENSOR_ATTR(temp1_input, 0444, temp_input_show, NULL, 0),
134 SENSOR_ATTR(temp1_crit, 0444, temp_crit_show, NULL, 0),
135 SENSOR_ATTR(temp2_input, 0444, temp_input_show, NULL, 1),
136 SENSOR_ATTR(temp2_crit, 0444, temp_crit_show, NULL, 1),
137 SENSOR_ATTR(temp3_input, 0444, temp_input_show, NULL, 2),
138 SENSOR_ATTR(temp3_crit, 0444, temp_crit_show, NULL, 2),
139 SENSOR_ATTR(temp4_input, 0444, temp_input_show, NULL, 3),
140 SENSOR_ATTR(temp4_crit, 0444, temp_crit_show, NULL, 3),
141 SENSOR_ATTR(temp5_input, 0444, temp_input_show, NULL, 4),
142 SENSOR_ATTR(temp5_crit, 0444, temp_crit_show, NULL, 4),
143 SENSOR_ATTR(temp6_input, 0444, temp_input_show, NULL, 5),
144 SENSOR_ATTR(temp6_crit, 0444, temp_crit_show, NULL, 5),
145 SENSOR_ATTR(temp7_input, 0444, temp_input_show, NULL, 6),
146 SENSOR_ATTR(temp7_crit, 0444, temp_crit_show, NULL, 6),
147 SENSOR_ATTR(temp8_input, 0444, temp_input_show, NULL, 7),
148 SENSOR_ATTR(temp8_crit, 0444, temp_crit_show, NULL, 7),
149 SENSOR_ATTR(temp9_input, 0444, temp_input_show, NULL, 8),
150 SENSOR_ATTR(temp9_crit, 0444, temp_crit_show, NULL, 8),
151 SENSOR_ATTR(temp10_input, 0444, temp_input_show, NULL, 9),
152 SENSOR_ATTR(temp10_crit, 0444, temp_crit_show, NULL, 9),
153};
154
155/* thermal zone sys I/F */
156 91
157#define to_thermal_zone(_dev) \ 92#define to_thermal_zone(_dev) \
158 container_of(_dev, struct thermal_zone_device, device) 93 container_of(_dev, struct thermal_zone_device, device)
@@ -279,7 +214,7 @@ do { \
279 device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \ 214 device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \
280} while (0) 215} while (0)
281 216
282/* cooling device sys I/F */ 217/* sys I/F for cooling device */
283#define to_cooling_device(_dev) \ 218#define to_cooling_device(_dev) \
284 container_of(_dev, struct thermal_cooling_device, device) 219 container_of(_dev, struct thermal_cooling_device, device)
285 220
@@ -512,9 +447,6 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
512 struct thermal_zone_device *pos; 447 struct thermal_zone_device *pos;
513 int result; 448 int result;
514 449
515 if (!type)
516 return ERR_PTR(-EINVAL);
517
518 if (strlen(type) >= THERMAL_NAME_LENGTH) 450 if (strlen(type) >= THERMAL_NAME_LENGTH)
519 return ERR_PTR(-EINVAL); 451 return ERR_PTR(-EINVAL);
520 452
@@ -545,9 +477,11 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
545 } 477 }
546 478
547 /* sys I/F */ 479 /* sys I/F */
548 result = device_create_file(&cdev->device, &dev_attr_cdev_type); 480 if (type) {
549 if (result) 481 result = device_create_file(&cdev->device, &dev_attr_cdev_type);
550 goto unregister; 482 if (result)
483 goto unregister;
484 }
551 485
552 result = device_create_file(&cdev->device, &dev_attr_max_state); 486 result = device_create_file(&cdev->device, &dev_attr_max_state);
553 if (result) 487 if (result)
@@ -613,8 +547,8 @@ void thermal_cooling_device_unregister(struct
613 tz->ops->unbind(tz, cdev); 547 tz->ops->unbind(tz, cdev);
614 } 548 }
615 mutex_unlock(&thermal_list_lock); 549 mutex_unlock(&thermal_list_lock);
616 550 if (cdev->type[0])
617 device_remove_file(&cdev->device, &dev_attr_cdev_type); 551 device_remove_file(&cdev->device, &dev_attr_cdev_type);
618 device_remove_file(&cdev->device, &dev_attr_max_state); 552 device_remove_file(&cdev->device, &dev_attr_max_state);
619 device_remove_file(&cdev->device, &dev_attr_cur_state); 553 device_remove_file(&cdev->device, &dev_attr_cur_state);
620 554
@@ -646,9 +580,6 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
646 int result; 580 int result;
647 int count; 581 int count;
648 582
649 if (!type)
650 return ERR_PTR(-EINVAL);
651
652 if (strlen(type) >= THERMAL_NAME_LENGTH) 583 if (strlen(type) >= THERMAL_NAME_LENGTH)
653 return ERR_PTR(-EINVAL); 584 return ERR_PTR(-EINVAL);
654 585
@@ -670,13 +601,6 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
670 kfree(tz); 601 kfree(tz);
671 return ERR_PTR(result); 602 return ERR_PTR(result);
672 } 603 }
673 if (tz->id >= MAX_THERMAL_ZONES) {
674 printk(KERN_ERR PREFIX
675 "Too many thermal zones\n");
676 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
677 kfree(tz);
678 return ERR_PTR(-EINVAL);
679 }
680 604
681 strcpy(tz->type, type); 605 strcpy(tz->type, type);
682 tz->ops = ops; 606 tz->ops = ops;
@@ -691,27 +615,12 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
691 return ERR_PTR(result); 615 return ERR_PTR(result);
692 } 616 }
693 617
694 /* hwmon sys I/F */
695 result = device_create_file(thermal_hwmon,
696 &sensor_attrs[tz->id * 2].dev_attr);
697 if (result)
698 goto unregister;
699
700 if (trips > 0) {
701 char buf[40];
702 result = tz->ops->get_trip_type(tz, 0, buf);
703 if (result > 0 && !strcmp(buf, "critical\n")) {
704 result = device_create_file(thermal_hwmon,
705 &sensor_attrs[tz->id * 2 + 1].dev_attr);
706 if (result)
707 goto unregister;
708 }
709 }
710
711 /* sys I/F */ 618 /* sys I/F */
712 result = device_create_file(&tz->device, &dev_attr_type); 619 if (type) {
713 if (result) 620 result = device_create_file(&tz->device, &dev_attr_type);
714 goto unregister; 621 if (result)
622 goto unregister;
623 }
715 624
716 result = device_create_file(&tz->device, &dev_attr_temp); 625 result = device_create_file(&tz->device, &dev_attr_temp);
717 if (result) 626 if (result)
@@ -778,17 +687,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
778 tz->ops->unbind(tz, cdev); 687 tz->ops->unbind(tz, cdev);
779 mutex_unlock(&thermal_list_lock); 688 mutex_unlock(&thermal_list_lock);
780 689
781 device_remove_file(thermal_hwmon, 690 if (tz->type[0])
782 &sensor_attrs[tz->id * 2].dev_attr); 691 device_remove_file(&tz->device, &dev_attr_type);
783 if (tz->trips > 0) {
784 char buf[40];
785 if (tz->ops->get_trip_type(tz, 0, buf) > 0)
786 if (!strcmp(buf, "critical\n"))
787 device_remove_file(thermal_hwmon,
788 &sensor_attrs[tz->id * 2 + 1].dev_attr);
789 }
790
791 device_remove_file(&tz->device, &dev_attr_type);
792 device_remove_file(&tz->device, &dev_attr_temp); 692 device_remove_file(&tz->device, &dev_attr_temp);
793 if (tz->ops->get_mode) 693 if (tz->ops->get_mode)
794 device_remove_file(&tz->device, &dev_attr_mode); 694 device_remove_file(&tz->device, &dev_attr_mode);
@@ -805,19 +705,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
805 705
806EXPORT_SYMBOL(thermal_zone_device_unregister); 706EXPORT_SYMBOL(thermal_zone_device_unregister);
807 707
808static void thermal_exit(void)
809{
810 if (thermal_hwmon) {
811 device_remove_file(thermal_hwmon, &dev_attr_name);
812 hwmon_device_unregister(thermal_hwmon);
813 }
814 class_unregister(&thermal_class);
815 idr_destroy(&thermal_tz_idr);
816 idr_destroy(&thermal_cdev_idr);
817 mutex_destroy(&thermal_idr_lock);
818 mutex_destroy(&thermal_list_lock);
819}
820
821static int __init thermal_init(void) 708static int __init thermal_init(void)
822{ 709{
823 int result = 0; 710 int result = 0;
@@ -829,21 +716,17 @@ static int __init thermal_init(void)
829 mutex_destroy(&thermal_idr_lock); 716 mutex_destroy(&thermal_idr_lock);
830 mutex_destroy(&thermal_list_lock); 717 mutex_destroy(&thermal_list_lock);
831 } 718 }
832
833 thermal_hwmon = hwmon_device_register(NULL);
834 if (IS_ERR(thermal_hwmon)) {
835 result = PTR_ERR(thermal_hwmon);
836 thermal_hwmon = NULL;
837 printk(KERN_ERR PREFIX
838 "unable to register hwmon device\n");
839 thermal_exit();
840 return result;
841 }
842
843 result = device_create_file(thermal_hwmon, &dev_attr_name);
844
845 return result; 719 return result;
846} 720}
847 721
722static void __exit thermal_exit(void)
723{
724 class_unregister(&thermal_class);
725 idr_destroy(&thermal_tz_idr);
726 idr_destroy(&thermal_cdev_idr);
727 mutex_destroy(&thermal_idr_lock);
728 mutex_destroy(&thermal_list_lock);
729}
730
848subsys_initcall(thermal_init); 731subsys_initcall(thermal_init);
849module_exit(thermal_exit); 732module_exit(thermal_exit);
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index c8a4332d1132..0b3efc31ee6d 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev)
152 wake_up(&vb->config_change); 152 wake_up(&vb->config_change);
153} 153}
154 154
155static inline int towards_target(struct virtio_balloon *vb) 155static inline s64 towards_target(struct virtio_balloon *vb)
156{ 156{
157 u32 v; 157 u32 v;
158 __virtio_config_val(vb->vdev, 158 __virtio_config_val(vb->vdev,
@@ -176,7 +176,7 @@ static int balloon(void *_vballoon)
176 176
177 set_freezable(); 177 set_freezable();
178 while (!kthread_should_stop()) { 178 while (!kthread_should_stop()) {
179 int diff; 179 s64 diff;
180 180
181 try_to_freeze(); 181 try_to_freeze();
182 wait_event_interruptible(vb->config_change, 182 wait_event_interruptible(vb->config_change,
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 26f787ddd5ff..59a8f73dec73 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -177,6 +177,7 @@ static irqreturn_t vp_interrupt(int irq, void *opaque)
177 struct virtio_pci_device *vp_dev = opaque; 177 struct virtio_pci_device *vp_dev = opaque;
178 struct virtio_pci_vq_info *info; 178 struct virtio_pci_vq_info *info;
179 irqreturn_t ret = IRQ_NONE; 179 irqreturn_t ret = IRQ_NONE;
180 unsigned long flags;
180 u8 isr; 181 u8 isr;
181 182
182 /* reading the ISR has the effect of also clearing it so it's very 183 /* reading the ISR has the effect of also clearing it so it's very
@@ -197,12 +198,12 @@ static irqreturn_t vp_interrupt(int irq, void *opaque)
197 drv->config_changed(&vp_dev->vdev); 198 drv->config_changed(&vp_dev->vdev);
198 } 199 }
199 200
200 spin_lock(&vp_dev->lock); 201 spin_lock_irqsave(&vp_dev->lock, flags);
201 list_for_each_entry(info, &vp_dev->virtqueues, node) { 202 list_for_each_entry(info, &vp_dev->virtqueues, node) {
202 if (vring_interrupt(irq, info->vq) == IRQ_HANDLED) 203 if (vring_interrupt(irq, info->vq) == IRQ_HANDLED)
203 ret = IRQ_HANDLED; 204 ret = IRQ_HANDLED;
204 } 205 }
205 spin_unlock(&vp_dev->lock); 206 spin_unlock_irqrestore(&vp_dev->lock, flags);
206 207
207 return ret; 208 return ret;
208} 209}
@@ -214,6 +215,7 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
214 struct virtio_pci_device *vp_dev = to_vp_device(vdev); 215 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
215 struct virtio_pci_vq_info *info; 216 struct virtio_pci_vq_info *info;
216 struct virtqueue *vq; 217 struct virtqueue *vq;
218 unsigned long flags;
217 u16 num; 219 u16 num;
218 int err; 220 int err;
219 221
@@ -255,9 +257,9 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
255 vq->priv = info; 257 vq->priv = info;
256 info->vq = vq; 258 info->vq = vq;
257 259
258 spin_lock(&vp_dev->lock); 260 spin_lock_irqsave(&vp_dev->lock, flags);
259 list_add(&info->node, &vp_dev->virtqueues); 261 list_add(&info->node, &vp_dev->virtqueues);
260 spin_unlock(&vp_dev->lock); 262 spin_unlock_irqrestore(&vp_dev->lock, flags);
261 263
262 return vq; 264 return vq;
263 265
@@ -274,10 +276,11 @@ static void vp_del_vq(struct virtqueue *vq)
274{ 276{
275 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); 277 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
276 struct virtio_pci_vq_info *info = vq->priv; 278 struct virtio_pci_vq_info *info = vq->priv;
279 unsigned long flags;
277 280
278 spin_lock(&vp_dev->lock); 281 spin_lock_irqsave(&vp_dev->lock, flags);
279 list_del(&info->node); 282 list_del(&info->node);
280 spin_unlock(&vp_dev->lock); 283 spin_unlock_irqrestore(&vp_dev->lock, flags);
281 284
282 vring_del_virtqueue(vq); 285 vring_del_virtqueue(vq);
283 286
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 3a28c1382131..aa714028641e 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -232,7 +232,6 @@ static bool vring_enable_cb(struct virtqueue *_vq)
232 vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; 232 vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
233 mb(); 233 mb();
234 if (unlikely(more_used(vq))) { 234 if (unlikely(more_used(vq))) {
235 vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
236 END_USE(vq); 235 END_USE(vq);
237 return false; 236 return false;
238 } 237 }