aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig1
-rw-r--r--drivers/acpi/hardware/hwsleep.c10
-rw-r--r--drivers/acpi/sleep/main.c5
-rw-r--r--drivers/acpi/tables/tbutils.c2
-rw-r--r--drivers/acpi/thermal.c28
-rw-r--r--drivers/acpi/video.c30
-rw-r--r--drivers/ata/ata_piix.c7
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c3
-rw-r--r--drivers/ata/pata_marvell.c4
-rw-r--r--drivers/ata/sata_mv.c35
-rw-r--r--drivers/base/core.c10
-rw-r--r--drivers/char/Makefile2
-rw-r--r--drivers/char/agp/intel-agp.c5
-rw-r--r--drivers/char/drm/i915_drv.h6
-rw-r--r--drivers/char/drm/i915_irq.c12
-rw-r--r--drivers/char/random.c10
-rw-r--r--drivers/char/vt_ioctl.c19
-rw-r--r--drivers/firewire/Kconfig3
-rw-r--r--drivers/ide/ppc/pmac.c1
-rw-r--r--drivers/input/joystick/Kconfig2
-rw-r--r--drivers/isdn/i4l/isdn_common.c5
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c6
-rw-r--r--drivers/misc/Kconfig17
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/fujitsu-laptop.c358
-rw-r--r--drivers/misc/sony-laptop.c204
-rw-r--r--drivers/misc/thinkpad_acpi.c207
-rw-r--r--drivers/misc/thinkpad_acpi.h37
-rw-r--r--drivers/net/e1000/e1000_ethtool.c1
-rw-r--r--drivers/net/e1000/e1000_hw.c1
-rw-r--r--drivers/net/e1000/e1000_hw.h1
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/mv643xx_eth.c3
-rw-r--r--drivers/net/mv643xx_eth.h4
-rwxr-xr-xdrivers/net/qla3xxx.c7
-rw-r--r--drivers/net/r8169.c16
-rw-r--r--drivers/net/sky2.c50
-rw-r--r--drivers/net/usb/dm9601.c2
-rw-r--r--drivers/net/wireless/Makefile2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c2
-rw-r--r--drivers/pci/quirks.c7
-rw-r--r--drivers/scsi/aic94xx/aic94xx_task.c4
-rw-r--r--drivers/scsi/megaraid.c8
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.h2
-rw-r--r--drivers/serial/serial_cs.c1
45 files changed, 940 insertions, 203 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index a858bc528ec3..b83389145f28 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -117,6 +117,7 @@ config ACPI_BUTTON
117config ACPI_VIDEO 117config ACPI_VIDEO
118 tristate "Video" 118 tristate "Video"
119 depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL 119 depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
120 depends on INPUT
120 help 121 help
121 This driver implement the ACPI Extensions For Display Adapters 122 This driver implement the ACPI Extensions For Display Adapters
122 for integrated graphics devices on motherboard, as specified in 123 for integrated graphics devices on motherboard, as specified in
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index cf69c0040a39..8181afbd1d4d 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -234,15 +234,11 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
234 "While executing method _SST")); 234 "While executing method _SST"));
235 } 235 }
236 236
237 /* 237 /* Disable/Clear all GPEs */
238 * 1) Disable/Clear all GPEs 238
239 */
240 status = acpi_hw_disable_all_gpes(); 239 status = acpi_hw_disable_all_gpes();
241 if (ACPI_FAILURE(status)) {
242 return_ACPI_STATUS(status);
243 }
244 240
245 return_ACPI_STATUS(AE_OK); 241 return_ACPI_STATUS(status);
246} 242}
247 243
248ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 244ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index 2cbb9aabd00e..caf8721ae6fb 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -256,6 +256,11 @@ static int acpi_hibernation_enter(void)
256 256
257static void acpi_hibernation_finish(void) 257static void acpi_hibernation_finish(void)
258{ 258{
259 /*
260 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
261 * enable it here.
262 */
263 acpi_enable();
259 acpi_leave_sleep_state(ACPI_STATE_S4); 264 acpi_leave_sleep_state(ACPI_STATE_S4);
260 acpi_disable_wakeup_device(ACPI_STATE_S4); 265 acpi_disable_wakeup_device(ACPI_STATE_S4);
261 266
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 8cc9492ffbf2..5f1d85f2ffe4 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -400,7 +400,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
400 u32 table_count; 400 u32 table_count;
401 struct acpi_table_header *table; 401 struct acpi_table_header *table;
402 acpi_physical_address address; 402 acpi_physical_address address;
403 acpi_physical_address rsdt_address; 403 acpi_physical_address uninitialized_var(rsdt_address);
404 u32 length; 404 u32 length;
405 u8 *table_entry; 405 u8 *table_entry;
406 acpi_status status; 406 acpi_status status;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index bc6d5866ef98..69ec73b0239d 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -195,6 +195,7 @@ struct acpi_thermal {
195 struct acpi_thermal_trips trips; 195 struct acpi_thermal_trips trips;
196 struct acpi_handle_list devices; 196 struct acpi_handle_list devices;
197 struct timer_list timer; 197 struct timer_list timer;
198 struct mutex lock;
198}; 199};
199 200
200static const struct file_operations acpi_thermal_state_fops = { 201static const struct file_operations acpi_thermal_state_fops = {
@@ -711,6 +712,7 @@ static void acpi_thermal_check(void *data)
711 int result = 0; 712 int result = 0;
712 struct acpi_thermal *tz = data; 713 struct acpi_thermal *tz = data;
713 unsigned long sleep_time = 0; 714 unsigned long sleep_time = 0;
715 unsigned long timeout_jiffies = 0;
714 int i = 0; 716 int i = 0;
715 struct acpi_thermal_state state; 717 struct acpi_thermal_state state;
716 718
@@ -720,11 +722,15 @@ static void acpi_thermal_check(void *data)
720 return; 722 return;
721 } 723 }
722 724
725 /* Check if someone else is already running */
726 if (!mutex_trylock(&tz->lock))
727 return;
728
723 state = tz->state; 729 state = tz->state;
724 730
725 result = acpi_thermal_get_temperature(tz); 731 result = acpi_thermal_get_temperature(tz);
726 if (result) 732 if (result)
727 return; 733 goto unlock;
728 734
729 memset(&tz->state, 0, sizeof(tz->state)); 735 memset(&tz->state, 0, sizeof(tz->state));
730 736
@@ -787,10 +793,13 @@ static void acpi_thermal_check(void *data)
787 * a thermal event occurs). Note that _TSP and _TZD values are 793 * a thermal event occurs). Note that _TSP and _TZD values are
788 * given in 1/10th seconds (we must covert to milliseconds). 794 * given in 1/10th seconds (we must covert to milliseconds).
789 */ 795 */
790 if (tz->state.passive) 796 if (tz->state.passive) {
791 sleep_time = tz->trips.passive.tsp * 100; 797 sleep_time = tz->trips.passive.tsp * 100;
792 else if (tz->polling_frequency > 0) 798 timeout_jiffies = jiffies + (HZ * sleep_time) / 1000;
799 } else if (tz->polling_frequency > 0) {
793 sleep_time = tz->polling_frequency * 100; 800 sleep_time = tz->polling_frequency * 100;
801 timeout_jiffies = round_jiffies(jiffies + (HZ * sleep_time) / 1000);
802 }
794 803
795 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", 804 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n",
796 tz->name, tz->temperature, sleep_time)); 805 tz->name, tz->temperature, sleep_time));
@@ -804,17 +813,16 @@ static void acpi_thermal_check(void *data)
804 del_timer(&(tz->timer)); 813 del_timer(&(tz->timer));
805 } else { 814 } else {
806 if (timer_pending(&(tz->timer))) 815 if (timer_pending(&(tz->timer)))
807 mod_timer(&(tz->timer), 816 mod_timer(&(tz->timer), timeout_jiffies);
808 jiffies + (HZ * sleep_time) / 1000);
809 else { 817 else {
810 tz->timer.data = (unsigned long)tz; 818 tz->timer.data = (unsigned long)tz;
811 tz->timer.function = acpi_thermal_run; 819 tz->timer.function = acpi_thermal_run;
812 tz->timer.expires = jiffies + (HZ * sleep_time) / 1000; 820 tz->timer.expires = timeout_jiffies;
813 add_timer(&(tz->timer)); 821 add_timer(&(tz->timer));
814 } 822 }
815 } 823 }
816 824 unlock:
817 return; 825 mutex_unlock(&tz->lock);
818} 826}
819 827
820/* -------------------------------------------------------------------------- 828/* --------------------------------------------------------------------------
@@ -1251,7 +1259,7 @@ static int acpi_thermal_add(struct acpi_device *device)
1251 strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); 1259 strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
1252 strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); 1260 strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
1253 acpi_driver_data(device) = tz; 1261 acpi_driver_data(device) = tz;
1254 1262 mutex_init(&tz->lock);
1255 result = acpi_thermal_get_info(tz); 1263 result = acpi_thermal_get_info(tz);
1256 if (result) 1264 if (result)
1257 goto end; 1265 goto end;
@@ -1321,7 +1329,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1321 } 1329 }
1322 1330
1323 acpi_thermal_remove_fs(device); 1331 acpi_thermal_remove_fs(device);
1324 1332 mutex_destroy(&tz->lock);
1325 kfree(tz); 1333 kfree(tz);
1326 return 0; 1334 return 0;
1327} 1335}
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index d05891f16282..f31e3c8749e0 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -409,14 +409,17 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
409static int 409static int
410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) 410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
411{ 411{
412 int status; 412 int status = AE_OK;
413 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 413 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
414 struct acpi_object_list args = { 1, &arg0 }; 414 struct acpi_object_list args = { 1, &arg0 };
415 415
416 416
417 arg0.integer.value = level; 417 arg0.integer.value = level;
418 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
419 418
419 if (device->cap._BCM)
420 status = acpi_evaluate_object(device->dev->handle, "_BCM",
421 &args, NULL);
422 device->brightness->curr = level;
420 return status; 423 return status;
421} 424}
422 425
@@ -424,11 +427,11 @@ static int
424acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, 427acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
425 unsigned long *level) 428 unsigned long *level)
426{ 429{
427 int status; 430 if (device->cap._BQC)
428 431 return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
429 status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); 432 level);
430 433 *level = device->brightness->curr;
431 return status; 434 return AE_OK;
432} 435}
433 436
434static int 437static int
@@ -1633,9 +1636,20 @@ static int
1633acpi_video_get_next_level(struct acpi_video_device *device, 1636acpi_video_get_next_level(struct acpi_video_device *device,
1634 u32 level_current, u32 event) 1637 u32 level_current, u32 event)
1635{ 1638{
1636 int min, max, min_above, max_below, i, l; 1639 int min, max, min_above, max_below, i, l, delta = 255;
1637 max = max_below = 0; 1640 max = max_below = 0;
1638 min = min_above = 255; 1641 min = min_above = 255;
1642 /* Find closest level to level_current */
1643 for (i = 0; i < device->brightness->count; i++) {
1644 l = device->brightness->levels[i];
1645 if (abs(l - level_current) < abs(delta)) {
1646 delta = l - level_current;
1647 if (!delta)
1648 break;
1649 }
1650 }
1651 /* Ajust level_current to closest available level */
1652 level_current += delta;
1639 for (i = 0; i < device->brightness->count; i++) { 1653 for (i = 0; i < device->brightness->count; i++) {
1640 l = device->brightness->levels[i]; 1654 l = device->brightness->levels[i];
1641 if (l < min) 1655 if (l < min)
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 3b8bf1812dc8..6996eb5b7506 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -921,6 +921,13 @@ static int piix_broken_suspend(void)
921{ 921{
922 static struct dmi_system_id sysids[] = { 922 static struct dmi_system_id sysids[] = {
923 { 923 {
924 .ident = "TECRA M3",
925 .matches = {
926 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
927 DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M3"),
928 },
929 },
930 {
924 .ident = "TECRA M5", 931 .ident = "TECRA M5",
925 .matches = { 932 .matches = {
926 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 933 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 4ca7fd6118d5..5dea3584c6c2 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -189,6 +189,9 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
189 data->cs0 = devm_ioremap(&pdev->dev, cs0->start, 0x1000); 189 data->cs0 = devm_ioremap(&pdev->dev, cs0->start, 0x1000);
190 data->cs1 = devm_ioremap(&pdev->dev, cs1->start, 0x1000); 190 data->cs1 = devm_ioremap(&pdev->dev, cs1->start, 0x1000);
191 191
192 if (!data->cs0 || !data->cs1)
193 return -ENOMEM;
194
192 irq = platform_get_irq(pdev, 0); 195 irq = platform_get_irq(pdev, 0);
193 if (irq) 196 if (irq)
194 set_irq_type(irq, IRQT_RISING); 197 set_irq_type(irq, IRQT_RISING);
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index ae206f35f747..b45506f1ef73 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -44,10 +44,10 @@ static int marvell_pre_reset(struct ata_port *ap, unsigned long deadline)
44 return -ENOMEM; 44 return -ENOMEM;
45 printk("BAR5:"); 45 printk("BAR5:");
46 for(i = 0; i <= 0x0F; i++) 46 for(i = 0; i <= 0x0F; i++)
47 printk("%02X:%02X ", i, readb(barp + i)); 47 printk("%02X:%02X ", i, ioread8(barp + i));
48 printk("\n"); 48 printk("\n");
49 49
50 devices = readl(barp + 0x0C); 50 devices = ioread32(barp + 0x0C);
51 pci_iounmap(pdev, barp); 51 pci_iounmap(pdev, barp);
52 52
53 if ((pdev->device == 0x6145) && (ap->port_no == 0) && 53 if ((pdev->device == 0x6145) && (ap->port_no == 0) &&
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 11bf6c7ac122..cb7dec97fee6 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -313,7 +313,10 @@ enum {
313#define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) 313#define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE)
314 314
315enum { 315enum {
316 MV_DMA_BOUNDARY = 0xffffffffU, 316 /* DMA boundary 0xffff is required by the s/g splitting
317 * we need on /length/ in mv_fill-sg().
318 */
319 MV_DMA_BOUNDARY = 0xffffU,
317 320
318 /* mask of register bits containing lower 32 bits 321 /* mask of register bits containing lower 32 bits
319 * of EDMA request queue DMA address 322 * of EDMA request queue DMA address
@@ -448,7 +451,7 @@ static struct scsi_host_template mv5_sht = {
448 .queuecommand = ata_scsi_queuecmd, 451 .queuecommand = ata_scsi_queuecmd,
449 .can_queue = ATA_DEF_QUEUE, 452 .can_queue = ATA_DEF_QUEUE,
450 .this_id = ATA_SHT_THIS_ID, 453 .this_id = ATA_SHT_THIS_ID,
451 .sg_tablesize = MV_MAX_SG_CT, 454 .sg_tablesize = MV_MAX_SG_CT / 2,
452 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 455 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
453 .emulated = ATA_SHT_EMULATED, 456 .emulated = ATA_SHT_EMULATED,
454 .use_clustering = 1, 457 .use_clustering = 1,
@@ -466,7 +469,7 @@ static struct scsi_host_template mv6_sht = {
466 .queuecommand = ata_scsi_queuecmd, 469 .queuecommand = ata_scsi_queuecmd,
467 .can_queue = ATA_DEF_QUEUE, 470 .can_queue = ATA_DEF_QUEUE,
468 .this_id = ATA_SHT_THIS_ID, 471 .this_id = ATA_SHT_THIS_ID,
469 .sg_tablesize = MV_MAX_SG_CT, 472 .sg_tablesize = MV_MAX_SG_CT / 2,
470 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 473 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
471 .emulated = ATA_SHT_EMULATED, 474 .emulated = ATA_SHT_EMULATED,
472 .use_clustering = 1, 475 .use_clustering = 1,
@@ -1139,15 +1142,27 @@ static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
1139 dma_addr_t addr = sg_dma_address(sg); 1142 dma_addr_t addr = sg_dma_address(sg);
1140 u32 sg_len = sg_dma_len(sg); 1143 u32 sg_len = sg_dma_len(sg);
1141 1144
1142 mv_sg->addr = cpu_to_le32(addr & 0xffffffff); 1145 while (sg_len) {
1143 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); 1146 u32 offset = addr & 0xffff;
1144 mv_sg->flags_size = cpu_to_le32(sg_len & 0xffff); 1147 u32 len = sg_len;
1148
1149 if ((offset + sg_len > 0x10000))
1150 len = 0x10000 - offset;
1151
1152 mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
1153 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
1154 mv_sg->flags_size = cpu_to_le32(len);
1145 1155
1146 if (ata_sg_is_last(sg, qc)) 1156 sg_len -= len;
1147 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); 1157 addr += len;
1158
1159 if (!sg_len && ata_sg_is_last(sg, qc))
1160 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1161
1162 mv_sg++;
1163 n_sg++;
1164 }
1148 1165
1149 mv_sg++;
1150 n_sg++;
1151 } 1166 }
1152 1167
1153 return n_sg; 1168 return n_sg;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 67c92582d6ef..ec86d6fc2360 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -586,9 +586,13 @@ void device_initialize(struct device *dev)
586static struct kobject * get_device_parent(struct device *dev, 586static struct kobject * get_device_parent(struct device *dev,
587 struct device *parent) 587 struct device *parent)
588{ 588{
589 /* Set the parent to the class, not the parent device */ 589 /*
590 /* this keeps sysfs from having a symlink to make old udevs happy */ 590 * Set the parent to the class, not the parent device
591 if (dev->class) 591 * for topmost devices in class hierarchy.
592 * This keeps sysfs from having a symlink to make old
593 * udevs happy
594 */
595 if (dev->class && (!parent || parent->class != dev->class))
592 return &dev->class->subsys.kobj; 596 return &dev->class->subsys.kobj;
593 else if (parent) 597 else if (parent)
594 return &parent->kobj; 598 return &parent->kobj;
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index d68ddbe70f73..c78ff26647ee 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -129,7 +129,7 @@ $(obj)/defkeymap.o: $(obj)/defkeymap.c
129 129
130ifdef GENERATE_KEYMAP 130ifdef GENERATE_KEYMAP
131 131
132$(obj)/defkeymap.c $(obj)/%.c: $(src)/%.map 132$(obj)/defkeymap.c: $(obj)/%.c: $(src)/%.map
133 loadkeys --mktable $< > $@.tmp 133 loadkeys --mktable $< > $@.tmp
134 sed -e 's/^static *//' $@.tmp > $@ 134 sed -e 's/^static *//' $@.tmp > $@
135 rm $@.tmp 135 rm $@.tmp
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index a5d0e95a227a..141ca176c397 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -506,11 +506,6 @@ static void intel_i830_init_gtt_entries(void)
506 break; 506 break;
507 } 507 }
508 } else { 508 } else {
509 /* G33's GTT stolen memory is separate from gfx data
510 * stolen memory.
511 */
512 if (IS_G33)
513 size = 0;
514 switch (gmch_ctrl & I855_GMCH_GMS_MASK) { 509 switch (gmch_ctrl & I855_GMCH_GMS_MASK) {
515 case I855_GMCH_GMS_STOLEN_1M: 510 case I855_GMCH_GMS_STOLEN_1M:
516 gtt_entries = MB(1) - KB(size); 511 gtt_entries = MB(1) - KB(size);
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index 737088bd0780..28b98733beb8 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -210,6 +210,12 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
210#define I915REG_INT_MASK_R 0x020a8 210#define I915REG_INT_MASK_R 0x020a8
211#define I915REG_INT_ENABLE_R 0x020a0 211#define I915REG_INT_ENABLE_R 0x020a0
212 212
213#define I915REG_PIPEASTAT 0x70024
214#define I915REG_PIPEBSTAT 0x71024
215
216#define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
217#define I915_VBLANK_CLEAR (1UL<<1)
218
213#define SRX_INDEX 0x3c4 219#define SRX_INDEX 0x3c4
214#define SRX_DATA 0x3c5 220#define SRX_DATA 0x3c5
215#define SR01 1 221#define SR01 1
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index 4b4b2ce89863..bb8e9e9c8201 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -214,6 +214,10 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
214 struct drm_device *dev = (struct drm_device *) arg; 214 struct drm_device *dev = (struct drm_device *) arg;
215 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 215 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
216 u16 temp; 216 u16 temp;
217 u32 pipea_stats, pipeb_stats;
218
219 pipea_stats = I915_READ(I915REG_PIPEASTAT);
220 pipeb_stats = I915_READ(I915REG_PIPEBSTAT);
217 221
218 temp = I915_READ16(I915REG_INT_IDENTITY_R); 222 temp = I915_READ16(I915REG_INT_IDENTITY_R);
219 223
@@ -225,6 +229,8 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
225 return IRQ_NONE; 229 return IRQ_NONE;
226 230
227 I915_WRITE16(I915REG_INT_IDENTITY_R, temp); 231 I915_WRITE16(I915REG_INT_IDENTITY_R, temp);
232 (void) I915_READ16(I915REG_INT_IDENTITY_R);
233 DRM_READMEMORYBARRIER();
228 234
229 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 235 dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
230 236
@@ -252,6 +258,12 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
252 258
253 if (dev_priv->swaps_pending > 0) 259 if (dev_priv->swaps_pending > 0)
254 drm_locked_tasklet(dev, i915_vblank_tasklet); 260 drm_locked_tasklet(dev, i915_vblank_tasklet);
261 I915_WRITE(I915REG_PIPEASTAT,
262 pipea_stats|I915_VBLANK_INTERRUPT_ENABLE|
263 I915_VBLANK_CLEAR);
264 I915_WRITE(I915REG_PIPEBSTAT,
265 pipeb_stats|I915_VBLANK_INTERRUPT_ENABLE|
266 I915_VBLANK_CLEAR);
255 } 267 }
256 268
257 return IRQ_HANDLED; 269 return IRQ_HANDLED;
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 397c714cf2ba..af274e5a25ee 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1550,11 +1550,13 @@ __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
1550 * As close as possible to RFC 793, which 1550 * As close as possible to RFC 793, which
1551 * suggests using a 250 kHz clock. 1551 * suggests using a 250 kHz clock.
1552 * Further reading shows this assumes 2 Mb/s networks. 1552 * Further reading shows this assumes 2 Mb/s networks.
1553 * For 10 Gb/s Ethernet, a 1 GHz clock is appropriate. 1553 * For 10 Mb/s Ethernet, a 1 MHz clock is appropriate.
1554 * That's funny, Linux has one built in! Use it! 1554 * For 10 Gb/s Ethernet, a 1 GHz clock should be ok, but
1555 * (Networks are faster now - should this be increased?) 1555 * we also need to limit the resolution so that the u32 seq
1556 * overlaps less than one time per MSL (2 minutes).
1557 * Choosing a clock of 64 ns period is OK. (period of 274 s)
1556 */ 1558 */
1557 seq += ktime_get_real().tv64; 1559 seq += ktime_get_real().tv64 >> 6;
1558#if 0 1560#if 0
1559 printk("init_seq(%lx, %lx, %d, %d) = %d\n", 1561 printk("init_seq(%lx, %lx, %d, %d) = %d\n",
1560 saddr, daddr, sport, dport, seq); 1562 saddr, daddr, sport, dport, seq);
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index c6f6f4209739..7a61a2a9aafe 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -770,6 +770,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
770 /* 770 /*
771 * Switching-from response 771 * Switching-from response
772 */ 772 */
773 acquire_console_sem();
773 if (vc->vt_newvt >= 0) { 774 if (vc->vt_newvt >= 0) {
774 if (arg == 0) 775 if (arg == 0)
775 /* 776 /*
@@ -784,7 +785,6 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
784 * complete the switch. 785 * complete the switch.
785 */ 786 */
786 int newvt; 787 int newvt;
787 acquire_console_sem();
788 newvt = vc->vt_newvt; 788 newvt = vc->vt_newvt;
789 vc->vt_newvt = -1; 789 vc->vt_newvt = -1;
790 i = vc_allocate(newvt); 790 i = vc_allocate(newvt);
@@ -798,7 +798,6 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
798 * other console switches.. 798 * other console switches..
799 */ 799 */
800 complete_change_console(vc_cons[newvt].d); 800 complete_change_console(vc_cons[newvt].d);
801 release_console_sem();
802 } 801 }
803 } 802 }
804 803
@@ -810,9 +809,12 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
810 /* 809 /*
811 * If it's just an ACK, ignore it 810 * If it's just an ACK, ignore it
812 */ 811 */
813 if (arg != VT_ACKACQ) 812 if (arg != VT_ACKACQ) {
813 release_console_sem();
814 return -EINVAL; 814 return -EINVAL;
815 }
815 } 816 }
817 release_console_sem();
816 818
817 return 0; 819 return 0;
818 820
@@ -1030,7 +1032,7 @@ static DECLARE_WAIT_QUEUE_HEAD(vt_activate_queue);
1030 1032
1031/* 1033/*
1032 * Sleeps until a vt is activated, or the task is interrupted. Returns 1034 * Sleeps until a vt is activated, or the task is interrupted. Returns
1033 * 0 if activation, -EINTR if interrupted. 1035 * 0 if activation, -EINTR if interrupted by a signal handler.
1034 */ 1036 */
1035int vt_waitactive(int vt) 1037int vt_waitactive(int vt)
1036{ 1038{
@@ -1055,7 +1057,7 @@ int vt_waitactive(int vt)
1055 break; 1057 break;
1056 } 1058 }
1057 release_console_sem(); 1059 release_console_sem();
1058 retval = -EINTR; 1060 retval = -ERESTARTNOHAND;
1059 if (signal_pending(current)) 1061 if (signal_pending(current))
1060 break; 1062 break;
1061 schedule(); 1063 schedule();
@@ -1208,15 +1210,18 @@ void change_console(struct vc_data *new_vc)
1208 /* 1210 /*
1209 * Send the signal as privileged - kill_pid() will 1211 * Send the signal as privileged - kill_pid() will
1210 * tell us if the process has gone or something else 1212 * tell us if the process has gone or something else
1211 * is awry 1213 * is awry.
1214 *
1215 * We need to set vt_newvt *before* sending the signal or we
1216 * have a race.
1212 */ 1217 */
1218 vc->vt_newvt = new_vc->vc_num;
1213 if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) { 1219 if (kill_pid(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) {
1214 /* 1220 /*
1215 * It worked. Mark the vt to switch to and 1221 * It worked. Mark the vt to switch to and
1216 * return. The process needs to send us a 1222 * return. The process needs to send us a
1217 * VT_RELDISP ioctl to complete the switch. 1223 * VT_RELDISP ioctl to complete the switch.
1218 */ 1224 */
1219 vc->vt_newvt = new_vc->vc_num;
1220 return; 1225 return;
1221 } 1226 }
1222 1227
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig
index d011a76f8e7a..fe9e768cfbc4 100644
--- a/drivers/firewire/Kconfig
+++ b/drivers/firewire/Kconfig
@@ -11,7 +11,8 @@ config FIREWIRE
11 This is the "Juju" FireWire stack, a new alternative implementation 11 This is the "Juju" FireWire stack, a new alternative implementation
12 designed for robustness and simplicity. You can build either this 12 designed for robustness and simplicity. You can build either this
13 stack, or the classic stack (the ieee1394 driver, ohci1394 etc.) 13 stack, or the classic stack (the ieee1394 driver, ohci1394 etc.)
14 or both. 14 or both. Please read http://wiki.linux1394.org/JujuMigration before
15 you enable the new stack.
15 16
16 To compile this driver as a module, say M here: the module will be 17 To compile this driver as a module, say M here: the module will be
17 called firewire-core. It functionally replaces ieee1394, raw1394, 18 called firewire-core. It functionally replaces ieee1394, raw1394,
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index f19eb6daeefd..2fb047b898aa 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1546,6 +1546,7 @@ static struct pci_device_id pmac_ide_pci_match[] = {
1546 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 1546 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1547 { PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_IPID2_ATA, 1547 { PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_IPID2_ATA,
1548 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 1548 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1549 {},
1549}; 1550};
1550 1551
1551static struct pci_driver pmac_ide_pci_driver = { 1552static struct pci_driver pmac_ide_pci_driver = {
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
index e2abe18e575d..7c662ee594a3 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -277,7 +277,7 @@ config JOYSTICK_XPAD_FF
277 277
278config JOYSTICK_XPAD_LEDS 278config JOYSTICK_XPAD_LEDS
279 bool "LED Support for Xbox360 controller 'BigX' LED" 279 bool "LED Support for Xbox360 controller 'BigX' LED"
280 depends on LEDS_CLASS && JOYSTICK_XPAD 280 depends on JOYSTICK_XPAD && (LEDS_CLASS=y || LEDS_CLASS=JOYSTICK_XPAD)
281 ---help--- 281 ---help---
282 This option enables support for the LED which surrounds the Big X on 282 This option enables support for the LED which surrounds the Big X on
283 XBox 360 controller. 283 XBox 360 controller.
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index ec5f4046412f..4910bca52640 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1135,7 +1135,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
1135 if (count > dev->drv[drvidx]->stavail) 1135 if (count > dev->drv[drvidx]->stavail)
1136 count = dev->drv[drvidx]->stavail; 1136 count = dev->drv[drvidx]->stavail;
1137 len = dev->drv[drvidx]->interface->readstat(buf, count, 1137 len = dev->drv[drvidx]->interface->readstat(buf, count,
1138 drvidx, isdn_minor2chan(minor)); 1138 drvidx, isdn_minor2chan(minor - ISDN_MINOR_CTRL));
1139 if (len < 0) { 1139 if (len < 0) {
1140 retval = len; 1140 retval = len;
1141 goto out; 1141 goto out;
@@ -1207,7 +1207,8 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
1207 */ 1207 */
1208 if (dev->drv[drvidx]->interface->writecmd) 1208 if (dev->drv[drvidx]->interface->writecmd)
1209 retval = dev->drv[drvidx]->interface-> 1209 retval = dev->drv[drvidx]->interface->
1210 writecmd(buf, count, drvidx, isdn_minor2chan(minor)); 1210 writecmd(buf, count, drvidx,
1211 isdn_minor2chan(minor - ISDN_MINOR_CTRL));
1211 else 1212 else
1212 retval = count; 1213 retval = count;
1213 goto out; 1214 goto out;
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 0285c4a830eb..66ea3cbc369c 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -754,9 +754,11 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
754 ivtv_yuv_close(itv); 754 ivtv_yuv_close(itv);
755 } 755 }
756 if (s->type == IVTV_DEC_STREAM_TYPE_YUV && itv->output_mode == OUT_YUV) 756 if (s->type == IVTV_DEC_STREAM_TYPE_YUV && itv->output_mode == OUT_YUV)
757 itv->output_mode = OUT_NONE; 757 itv->output_mode = OUT_NONE;
758 else if (s->type == IVTV_DEC_STREAM_TYPE_YUV && itv->output_mode == OUT_UDMA_YUV)
759 itv->output_mode = OUT_NONE;
758 else if (s->type == IVTV_DEC_STREAM_TYPE_MPG && itv->output_mode == OUT_MPG) 760 else if (s->type == IVTV_DEC_STREAM_TYPE_MPG && itv->output_mode == OUT_MPG)
759 itv->output_mode = OUT_NONE; 761 itv->output_mode = OUT_NONE;
760 762
761 itv->speed = 0; 763 itv->speed = 0;
762 clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags); 764 clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 73e248fb2ff1..e0a1ff927a5b 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -111,6 +111,21 @@ config ASUS_LAPTOP
111 111
112 If you have an ACPI-compatible ASUS laptop, say Y or M here. 112 If you have an ACPI-compatible ASUS laptop, say Y or M here.
113 113
114config FUJITSU_LAPTOP
115 tristate "Fujitsu Laptop Extras"
116 depends on X86
117 depends on ACPI
118 depends on BACKLIGHT_CLASS_DEVICE
119 ---help---
120 This is a driver for laptops built by Fujitsu:
121
122 * P2xxx/P5xxx/S6xxx/S7xxx series Lifebooks
123 * Possibly other Fujitsu laptop models
124
125 It adds support for LCD brightness control.
126
127 If you have a Fujitsu laptop, say Y or M here.
128
114config MSI_LAPTOP 129config MSI_LAPTOP
115 tristate "MSI Laptop Extras" 130 tristate "MSI Laptop Extras"
116 depends on X86 131 depends on X86
@@ -134,6 +149,7 @@ config SONY_LAPTOP
134 tristate "Sony Laptop Extras" 149 tristate "Sony Laptop Extras"
135 depends on X86 && ACPI 150 depends on X86 && ACPI
136 select BACKLIGHT_CLASS_DEVICE 151 select BACKLIGHT_CLASS_DEVICE
152 depends on INPUT
137 ---help--- 153 ---help---
138 This mini-driver drives the SNC and SPIC devices present in the ACPI 154 This mini-driver drives the SNC and SPIC devices present in the ACPI
139 BIOS of the Sony Vaio laptops. 155 BIOS of the Sony Vaio laptops.
@@ -156,6 +172,7 @@ config THINKPAD_ACPI
156 select BACKLIGHT_CLASS_DEVICE 172 select BACKLIGHT_CLASS_DEVICE
157 select HWMON 173 select HWMON
158 select NVRAM 174 select NVRAM
175 depends on INPUT
159 ---help--- 176 ---help---
160 This is a driver for the IBM and Lenovo ThinkPad laptops. It adds 177 This is a driver for the IBM and Lenovo ThinkPad laptops. It adds
161 support for Fn-Fx key combinations, Bluetooth control, video 178 support for Fn-Fx key combinations, Bluetooth control, video
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b5ce0e3dba86..be90d483d2f9 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -14,4 +14,5 @@ obj-$(CONFIG_PHANTOM) += phantom.o
14obj-$(CONFIG_SGI_IOC4) += ioc4.o 14obj-$(CONFIG_SGI_IOC4) += ioc4.o
15obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o 15obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o
16obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o 16obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o
17obj-$(CONFIG_FUJITSU_LAPTOP) += fujitsu-laptop.o
17obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o 18obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c
new file mode 100644
index 000000000000..d366a6cc1fd9
--- /dev/null
+++ b/drivers/misc/fujitsu-laptop.c
@@ -0,0 +1,358 @@
1/*-*-linux-c-*-*/
2
3/*
4 Copyright (C) 2007 Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
5 Based on earlier work:
6 Copyright (C) 2003 Shane Spencer <shane@bogomip.com>
7 Adrian Yee <brewt-fujitsu@brewt.org>
8
9 Templated from msi-laptop.c which is copyright by its respective authors.
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 02110-1301, USA.
25 */
26
27/*
28 * fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
29 * features made available on a range of Fujitsu laptops including the
30 * P2xxx/P5xxx/S6xxx/S7xxx series.
31 *
32 * This driver exports a few files in /sys/devices/platform/fujitsu-laptop/;
33 * others may be added at a later date.
34 *
35 * lcd_level - Screen brightness: contains a single integer in the
36 * range 0..7. (rw)
37 *
38 * In addition to these platform device attributes the driver
39 * registers itself in the Linux backlight control subsystem and is
40 * available to userspace under /sys/class/backlight/fujitsu-laptop/.
41 *
42 * This driver has been tested on a Fujitsu Lifebook S7020. It should
43 * work on most P-series and S-series Lifebooks, but YMMV.
44 */
45
46#include <linux/module.h>
47#include <linux/kernel.h>
48#include <linux/init.h>
49#include <linux/acpi.h>
50#include <linux/dmi.h>
51#include <linux/backlight.h>
52#include <linux/platform_device.h>
53#include <linux/autoconf.h>
54
55#define FUJITSU_DRIVER_VERSION "0.3"
56
57#define FUJITSU_LCD_N_LEVELS 8
58
59#define ACPI_FUJITSU_CLASS "fujitsu"
60#define ACPI_FUJITSU_HID "FUJ02B1"
61#define ACPI_FUJITSU_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI extras driver"
62#define ACPI_FUJITSU_DEVICE_NAME "Fujitsu FUJ02B1"
63
64struct fujitsu_t {
65 acpi_handle acpi_handle;
66 struct backlight_device *bl_device;
67 struct platform_device *pf_device;
68
69 unsigned long fuj02b1_state;
70 unsigned int brightness_changed;
71 unsigned int brightness_level;
72};
73
74static struct fujitsu_t *fujitsu;
75
76/* Hardware access */
77
78static int set_lcd_level(int level)
79{
80 acpi_status status = AE_OK;
81 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
82 struct acpi_object_list arg_list = { 1, &arg0 };
83 acpi_handle handle = NULL;
84
85 if (level < 0 || level >= FUJITSU_LCD_N_LEVELS)
86 return -EINVAL;
87
88 if (!fujitsu)
89 return -EINVAL;
90
91 status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle);
92 if (ACPI_FAILURE(status)) {
93 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SBLL not present\n"));
94 return -ENODEV;
95 }
96
97 arg0.integer.value = level;
98
99 status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
100 if (ACPI_FAILURE(status))
101 return -ENODEV;
102
103 return 0;
104}
105
106static int get_lcd_level(void)
107{
108 unsigned long state = 0;
109 acpi_status status = AE_OK;
110
111 // Get the Brightness
112 status =
113 acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);
114 if (status < 0)
115 return status;
116
117 fujitsu->fuj02b1_state = state;
118 fujitsu->brightness_level = state & 0x0fffffff;
119
120 if (state & 0x80000000)
121 fujitsu->brightness_changed = 1;
122 else
123 fujitsu->brightness_changed = 0;
124
125 if (status < 0)
126 return status;
127
128 return fujitsu->brightness_level;
129}
130
131/* Backlight device stuff */
132
133static int bl_get_brightness(struct backlight_device *b)
134{
135 return get_lcd_level();
136}
137
138static int bl_update_status(struct backlight_device *b)
139{
140 return set_lcd_level(b->props.brightness);
141}
142
143static struct backlight_ops fujitsubl_ops = {
144 .get_brightness = bl_get_brightness,
145 .update_status = bl_update_status,
146};
147
148/* Platform device */
149
150static ssize_t show_lcd_level(struct device *dev,
151 struct device_attribute *attr, char *buf)
152{
153
154 int ret;
155
156 ret = get_lcd_level();
157 if (ret < 0)
158 return ret;
159
160 return sprintf(buf, "%i\n", ret);
161}
162
163static ssize_t store_lcd_level(struct device *dev,
164 struct device_attribute *attr, const char *buf,
165 size_t count)
166{
167
168 int level, ret;
169
170 if (sscanf(buf, "%i", &level) != 1
171 || (level < 0 || level >= FUJITSU_LCD_N_LEVELS))
172 return -EINVAL;
173
174 ret = set_lcd_level(level);
175 if (ret < 0)
176 return ret;
177
178 return count;
179}
180
181static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
182
183static struct attribute *fujitsupf_attributes[] = {
184 &dev_attr_lcd_level.attr,
185 NULL
186};
187
188static struct attribute_group fujitsupf_attribute_group = {
189 .attrs = fujitsupf_attributes
190};
191
192static struct platform_driver fujitsupf_driver = {
193 .driver = {
194 .name = "fujitsu-laptop",
195 .owner = THIS_MODULE,
196 }
197};
198
199/* ACPI device */
200
201int acpi_fujitsu_add(struct acpi_device *device)
202{
203 int result = 0;
204 int state = 0;
205
206 ACPI_FUNCTION_TRACE("acpi_fujitsu_add");
207
208 if (!device)
209 return -EINVAL;
210
211 fujitsu->acpi_handle = device->handle;
212 sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_DEVICE_NAME);
213 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
214 acpi_driver_data(device) = fujitsu;
215
216 result = acpi_bus_get_power(fujitsu->acpi_handle, &state);
217 if (result) {
218 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
219 "Error reading power state\n"));
220 goto end;
221 }
222
223 printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
224 acpi_device_name(device), acpi_device_bid(device),
225 !device->power.state ? "on" : "off");
226
227 end:
228
229 return result;
230}
231
232int acpi_fujitsu_remove(struct acpi_device *device, int type)
233{
234 ACPI_FUNCTION_TRACE("acpi_fujitsu_remove");
235
236 if (!device || !acpi_driver_data(device))
237 return -EINVAL;
238 fujitsu->acpi_handle = 0;
239
240 return 0;
241}
242
243static const struct acpi_device_id fujitsu_device_ids[] = {
244 {ACPI_FUJITSU_HID, 0},
245 {"", 0},
246};
247
248static struct acpi_driver acpi_fujitsu_driver = {
249 .name = ACPI_FUJITSU_DRIVER_NAME,
250 .class = ACPI_FUJITSU_CLASS,
251 .ids = fujitsu_device_ids,
252 .ops = {
253 .add = acpi_fujitsu_add,
254 .remove = acpi_fujitsu_remove,
255 },
256};
257
258/* Initialization */
259
260static int __init fujitsu_init(void)
261{
262 int ret, result;
263
264 if (acpi_disabled)
265 return -ENODEV;
266
267 fujitsu = kmalloc(sizeof(struct fujitsu_t), GFP_KERNEL);
268 if (!fujitsu)
269 return -ENOMEM;
270 memset(fujitsu, 0, sizeof(struct fujitsu_t));
271
272 result = acpi_bus_register_driver(&acpi_fujitsu_driver);
273 if (result < 0) {
274 ret = -ENODEV;
275 goto fail_acpi;
276 }
277
278 /* Register backlight stuff */
279
280 fujitsu->bl_device =
281 backlight_device_register("fujitsu-laptop", NULL, NULL,
282 &fujitsubl_ops);
283 if (IS_ERR(fujitsu->bl_device))
284 return PTR_ERR(fujitsu->bl_device);
285
286 fujitsu->bl_device->props.max_brightness = FUJITSU_LCD_N_LEVELS - 1;
287 ret = platform_driver_register(&fujitsupf_driver);
288 if (ret)
289 goto fail_backlight;
290
291 /* Register platform stuff */
292
293 fujitsu->pf_device = platform_device_alloc("fujitsu-laptop", -1);
294 if (!fujitsu->pf_device) {
295 ret = -ENOMEM;
296 goto fail_platform_driver;
297 }
298
299 ret = platform_device_add(fujitsu->pf_device);
300 if (ret)
301 goto fail_platform_device1;
302
303 ret =
304 sysfs_create_group(&fujitsu->pf_device->dev.kobj,
305 &fujitsupf_attribute_group);
306 if (ret)
307 goto fail_platform_device2;
308
309 printk(KERN_INFO "fujitsu-laptop: driver " FUJITSU_DRIVER_VERSION
310 " successfully loaded.\n");
311
312 return 0;
313
314 fail_platform_device2:
315
316 platform_device_del(fujitsu->pf_device);
317
318 fail_platform_device1:
319
320 platform_device_put(fujitsu->pf_device);
321
322 fail_platform_driver:
323
324 platform_driver_unregister(&fujitsupf_driver);
325
326 fail_backlight:
327
328 backlight_device_unregister(fujitsu->bl_device);
329
330 fail_acpi:
331
332 kfree(fujitsu);
333
334 return ret;
335}
336
337static void __exit fujitsu_cleanup(void)
338{
339 sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
340 &fujitsupf_attribute_group);
341 platform_device_unregister(fujitsu->pf_device);
342 platform_driver_unregister(&fujitsupf_driver);
343 backlight_device_unregister(fujitsu->bl_device);
344
345 acpi_bus_unregister_driver(&acpi_fujitsu_driver);
346
347 kfree(fujitsu);
348
349 printk(KERN_INFO "fujitsu-laptop: driver unloaded.\n");
350}
351
352module_init(fujitsu_init);
353module_exit(fujitsu_cleanup);
354
355MODULE_AUTHOR("Jonathan Woithe");
356MODULE_DESCRIPTION("Fujitsu laptop extras support");
357MODULE_VERSION(FUJITSU_DRIVER_VERSION);
358MODULE_LICENSE("GPL");
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index d38ddce592c0..f248080828f2 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1173,7 +1173,8 @@ static struct acpi_driver sony_nc_driver = {
1173#define SONYPI_TYPE3_OFFSET 0x12 1173#define SONYPI_TYPE3_OFFSET 0x12
1174 1174
1175struct sony_pic_ioport { 1175struct sony_pic_ioport {
1176 struct acpi_resource_io io; 1176 struct acpi_resource_io io1;
1177 struct acpi_resource_io io2;
1177 struct list_head list; 1178 struct list_head list;
1178}; 1179};
1179 1180
@@ -1443,11 +1444,11 @@ static u8 sony_pic_call1(u8 dev)
1443{ 1444{
1444 u8 v1, v2; 1445 u8 v1, v2;
1445 1446
1446 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, 1447 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2,
1447 ITERATIONS_LONG); 1448 ITERATIONS_LONG);
1448 outb(dev, spic_dev.cur_ioport->io.minimum + 4); 1449 outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
1449 v1 = inb_p(spic_dev.cur_ioport->io.minimum + 4); 1450 v1 = inb_p(spic_dev.cur_ioport->io1.minimum + 4);
1450 v2 = inb_p(spic_dev.cur_ioport->io.minimum); 1451 v2 = inb_p(spic_dev.cur_ioport->io1.minimum);
1451 dprintk("sony_pic_call1: 0x%.4x\n", (v2 << 8) | v1); 1452 dprintk("sony_pic_call1: 0x%.4x\n", (v2 << 8) | v1);
1452 return v2; 1453 return v2;
1453} 1454}
@@ -1456,13 +1457,13 @@ static u8 sony_pic_call2(u8 dev, u8 fn)
1456{ 1457{
1457 u8 v1; 1458 u8 v1;
1458 1459
1459 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, 1460 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2,
1460 ITERATIONS_LONG); 1461 ITERATIONS_LONG);
1461 outb(dev, spic_dev.cur_ioport->io.minimum + 4); 1462 outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
1462 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, 1463 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2,
1463 ITERATIONS_LONG); 1464 ITERATIONS_LONG);
1464 outb(fn, spic_dev.cur_ioport->io.minimum); 1465 outb(fn, spic_dev.cur_ioport->io1.minimum);
1465 v1 = inb_p(spic_dev.cur_ioport->io.minimum); 1466 v1 = inb_p(spic_dev.cur_ioport->io1.minimum);
1466 dprintk("sony_pic_call2: 0x%.4x\n", v1); 1467 dprintk("sony_pic_call2: 0x%.4x\n", v1);
1467 return v1; 1468 return v1;
1468} 1469}
@@ -1471,13 +1472,13 @@ static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)
1471{ 1472{
1472 u8 v1; 1473 u8 v1;
1473 1474
1474 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, ITERATIONS_LONG); 1475 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
1475 outb(dev, spic_dev.cur_ioport->io.minimum + 4); 1476 outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
1476 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, ITERATIONS_LONG); 1477 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
1477 outb(fn, spic_dev.cur_ioport->io.minimum); 1478 outb(fn, spic_dev.cur_ioport->io1.minimum);
1478 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, ITERATIONS_LONG); 1479 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
1479 outb(v, spic_dev.cur_ioport->io.minimum); 1480 outb(v, spic_dev.cur_ioport->io1.minimum);
1480 v1 = inb_p(spic_dev.cur_ioport->io.minimum); 1481 v1 = inb_p(spic_dev.cur_ioport->io1.minimum);
1481 dprintk("sony_pic_call3: 0x%.4x\n", v1); 1482 dprintk("sony_pic_call3: 0x%.4x\n", v1);
1482 return v1; 1483 return v1;
1483} 1484}
@@ -2074,7 +2075,18 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2074 2075
2075 switch (resource->type) { 2076 switch (resource->type) {
2076 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 2077 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
2078 {
2079 /* start IO enumeration */
2080 struct sony_pic_ioport *ioport = kzalloc(sizeof(*ioport), GFP_KERNEL);
2081 if (!ioport)
2082 return AE_ERROR;
2083
2084 list_add(&ioport->list, &dev->ioports);
2085 return AE_OK;
2086 }
2087
2077 case ACPI_RESOURCE_TYPE_END_DEPENDENT: 2088 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
2089 /* end IO enumeration */
2078 return AE_OK; 2090 return AE_OK;
2079 2091
2080 case ACPI_RESOURCE_TYPE_IRQ: 2092 case ACPI_RESOURCE_TYPE_IRQ:
@@ -2101,7 +2113,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2101 if (!interrupt) 2113 if (!interrupt)
2102 return AE_ERROR; 2114 return AE_ERROR;
2103 2115
2104 list_add_tail(&interrupt->list, &dev->interrupts); 2116 list_add(&interrupt->list, &dev->interrupts);
2105 interrupt->irq.triggering = p->triggering; 2117 interrupt->irq.triggering = p->triggering;
2106 interrupt->irq.polarity = p->polarity; 2118 interrupt->irq.polarity = p->polarity;
2107 interrupt->irq.sharable = p->sharable; 2119 interrupt->irq.sharable = p->sharable;
@@ -2113,18 +2125,27 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2113 case ACPI_RESOURCE_TYPE_IO: 2125 case ACPI_RESOURCE_TYPE_IO:
2114 { 2126 {
2115 struct acpi_resource_io *io = &resource->data.io; 2127 struct acpi_resource_io *io = &resource->data.io;
2116 struct sony_pic_ioport *ioport = NULL; 2128 struct sony_pic_ioport *ioport =
2129 list_first_entry(&dev->ioports, struct sony_pic_ioport, list);
2117 if (!io) { 2130 if (!io) {
2118 dprintk("Blank IO resource\n"); 2131 dprintk("Blank IO resource\n");
2119 return AE_OK; 2132 return AE_OK;
2120 } 2133 }
2121 2134
2122 ioport = kzalloc(sizeof(*ioport), GFP_KERNEL); 2135 if (!ioport->io1.minimum) {
2123 if (!ioport) 2136 memcpy(&ioport->io1, io, sizeof(*io));
2137 dprintk("IO1 at 0x%.4x (0x%.2x)\n", ioport->io1.minimum,
2138 ioport->io1.address_length);
2139 }
2140 else if (!ioport->io2.minimum) {
2141 memcpy(&ioport->io2, io, sizeof(*io));
2142 dprintk("IO2 at 0x%.4x (0x%.2x)\n", ioport->io2.minimum,
2143 ioport->io2.address_length);
2144 }
2145 else {
2146 printk(KERN_ERR DRV_PFX "Unknown SPIC Type, more than 2 IO Ports\n");
2124 return AE_ERROR; 2147 return AE_ERROR;
2125 2148 }
2126 list_add_tail(&ioport->list, &dev->ioports);
2127 memcpy(&ioport->io, io, sizeof(*io));
2128 return AE_OK; 2149 return AE_OK;
2129 } 2150 }
2130 default: 2151 default:
@@ -2199,10 +2220,22 @@ static int sony_pic_enable(struct acpi_device *device,
2199{ 2220{
2200 acpi_status status; 2221 acpi_status status;
2201 int result = 0; 2222 int result = 0;
2223 /* Type 1 resource layout is:
2224 * IO
2225 * IO
2226 * IRQNoFlags
2227 * End
2228 *
2229 * Type 2 and 3 resource layout is:
2230 * IO
2231 * IRQNoFlags
2232 * End
2233 */
2202 struct { 2234 struct {
2203 struct acpi_resource io_res; 2235 struct acpi_resource res1;
2204 struct acpi_resource irq_res; 2236 struct acpi_resource res2;
2205 struct acpi_resource end; 2237 struct acpi_resource res3;
2238 struct acpi_resource res4;
2206 } *resource; 2239 } *resource;
2207 struct acpi_buffer buffer = { 0, NULL }; 2240 struct acpi_buffer buffer = { 0, NULL };
2208 2241
@@ -2217,21 +2250,49 @@ static int sony_pic_enable(struct acpi_device *device,
2217 buffer.length = sizeof(*resource) + 1; 2250 buffer.length = sizeof(*resource) + 1;
2218 buffer.pointer = resource; 2251 buffer.pointer = resource;
2219 2252
2220 /* setup io resource */ 2253 /* setup Type 1 resources */
2221 resource->io_res.type = ACPI_RESOURCE_TYPE_IO; 2254 if (spic_dev.model == SONYPI_DEVICE_TYPE1) {
2222 resource->io_res.length = sizeof(struct acpi_resource);
2223 memcpy(&resource->io_res.data.io, &ioport->io,
2224 sizeof(struct acpi_resource_io));
2225 2255
2226 /* setup irq resource */ 2256 /* setup io resources */
2227 resource->irq_res.type = ACPI_RESOURCE_TYPE_IRQ; 2257 resource->res1.type = ACPI_RESOURCE_TYPE_IO;
2228 resource->irq_res.length = sizeof(struct acpi_resource); 2258 resource->res1.length = sizeof(struct acpi_resource);
2229 memcpy(&resource->irq_res.data.irq, &irq->irq, 2259 memcpy(&resource->res1.data.io, &ioport->io1,
2230 sizeof(struct acpi_resource_irq)); 2260 sizeof(struct acpi_resource_io));
2231 /* we requested a shared irq */
2232 resource->irq_res.data.irq.sharable = ACPI_SHARED;
2233 2261
2234 resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; 2262 resource->res2.type = ACPI_RESOURCE_TYPE_IO;
2263 resource->res2.length = sizeof(struct acpi_resource);
2264 memcpy(&resource->res2.data.io, &ioport->io2,
2265 sizeof(struct acpi_resource_io));
2266
2267 /* setup irq resource */
2268 resource->res3.type = ACPI_RESOURCE_TYPE_IRQ;
2269 resource->res3.length = sizeof(struct acpi_resource);
2270 memcpy(&resource->res3.data.irq, &irq->irq,
2271 sizeof(struct acpi_resource_irq));
2272 /* we requested a shared irq */
2273 resource->res3.data.irq.sharable = ACPI_SHARED;
2274
2275 resource->res4.type = ACPI_RESOURCE_TYPE_END_TAG;
2276
2277 }
2278 /* setup Type 2/3 resources */
2279 else {
2280 /* setup io resource */
2281 resource->res1.type = ACPI_RESOURCE_TYPE_IO;
2282 resource->res1.length = sizeof(struct acpi_resource);
2283 memcpy(&resource->res1.data.io, &ioport->io1,
2284 sizeof(struct acpi_resource_io));
2285
2286 /* setup irq resource */
2287 resource->res2.type = ACPI_RESOURCE_TYPE_IRQ;
2288 resource->res2.length = sizeof(struct acpi_resource);
2289 memcpy(&resource->res2.data.irq, &irq->irq,
2290 sizeof(struct acpi_resource_irq));
2291 /* we requested a shared irq */
2292 resource->res2.data.irq.sharable = ACPI_SHARED;
2293
2294 resource->res3.type = ACPI_RESOURCE_TYPE_END_TAG;
2295 }
2235 2296
2236 /* Attempt to set the resource */ 2297 /* Attempt to set the resource */
2237 dprintk("Evaluating _SRS\n"); 2298 dprintk("Evaluating _SRS\n");
@@ -2239,7 +2300,7 @@ static int sony_pic_enable(struct acpi_device *device,
2239 2300
2240 /* check for total failure */ 2301 /* check for total failure */
2241 if (ACPI_FAILURE(status)) { 2302 if (ACPI_FAILURE(status)) {
2242 printk(KERN_ERR DRV_PFX "Error evaluating _SRS"); 2303 printk(KERN_ERR DRV_PFX "Error evaluating _SRS\n");
2243 result = -ENODEV; 2304 result = -ENODEV;
2244 goto end; 2305 goto end;
2245 } 2306 }
@@ -2268,11 +2329,14 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id)
2268 2329
2269 struct sony_pic_dev *dev = (struct sony_pic_dev *) dev_id; 2330 struct sony_pic_dev *dev = (struct sony_pic_dev *) dev_id;
2270 2331
2271 ev = inb_p(dev->cur_ioport->io.minimum); 2332 ev = inb_p(dev->cur_ioport->io1.minimum);
2272 data_mask = inb_p(dev->cur_ioport->io.minimum + dev->evport_offset); 2333 if (dev->cur_ioport->io2.minimum)
2334 data_mask = inb_p(dev->cur_ioport->io2.minimum);
2335 else
2336 data_mask = inb_p(dev->cur_ioport->io1.minimum + dev->evport_offset);
2273 2337
2274 dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n", 2338 dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n",
2275 ev, data_mask, dev->cur_ioport->io.minimum, dev->evport_offset); 2339 ev, data_mask, dev->cur_ioport->io1.minimum, dev->evport_offset);
2276 2340
2277 if (ev == 0x00 || ev == 0xff) 2341 if (ev == 0x00 || ev == 0xff)
2278 return IRQ_HANDLED; 2342 return IRQ_HANDLED;
@@ -2323,8 +2387,11 @@ static int sony_pic_remove(struct acpi_device *device, int type)
2323 } 2387 }
2324 2388
2325 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev); 2389 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev);
2326 release_region(spic_dev.cur_ioport->io.minimum, 2390 release_region(spic_dev.cur_ioport->io1.minimum,
2327 spic_dev.cur_ioport->io.address_length); 2391 spic_dev.cur_ioport->io1.address_length);
2392 if (spic_dev.cur_ioport->io2.minimum)
2393 release_region(spic_dev.cur_ioport->io2.minimum,
2394 spic_dev.cur_ioport->io2.address_length);
2328 2395
2329 sonypi_compat_exit(); 2396 sonypi_compat_exit();
2330 2397
@@ -2397,14 +2464,36 @@ static int sony_pic_add(struct acpi_device *device)
2397 goto err_remove_input; 2464 goto err_remove_input;
2398 2465
2399 /* request io port */ 2466 /* request io port */
2400 list_for_each_entry(io, &spic_dev.ioports, list) { 2467 list_for_each_entry_reverse(io, &spic_dev.ioports, list) {
2401 if (request_region(io->io.minimum, io->io.address_length, 2468 if (request_region(io->io1.minimum, io->io1.address_length,
2402 "Sony Programable I/O Device")) { 2469 "Sony Programable I/O Device")) {
2403 dprintk("I/O port: 0x%.4x (0x%.4x) + 0x%.2x\n", 2470 dprintk("I/O port1: 0x%.4x (0x%.4x) + 0x%.2x\n",
2404 io->io.minimum, io->io.maximum, 2471 io->io1.minimum, io->io1.maximum,
2405 io->io.address_length); 2472 io->io1.address_length);
2406 spic_dev.cur_ioport = io; 2473 /* Type 1 have 2 ioports */
2407 break; 2474 if (io->io2.minimum) {
2475 if (request_region(io->io2.minimum,
2476 io->io2.address_length,
2477 "Sony Programable I/O Device")) {
2478 dprintk("I/O port2: 0x%.4x (0x%.4x) + 0x%.2x\n",
2479 io->io2.minimum, io->io2.maximum,
2480 io->io2.address_length);
2481 spic_dev.cur_ioport = io;
2482 break;
2483 }
2484 else {
2485 dprintk("Unable to get I/O port2: "
2486 "0x%.4x (0x%.4x) + 0x%.2x\n",
2487 io->io2.minimum, io->io2.maximum,
2488 io->io2.address_length);
2489 release_region(io->io1.minimum,
2490 io->io1.address_length);
2491 }
2492 }
2493 else {
2494 spic_dev.cur_ioport = io;
2495 break;
2496 }
2408 } 2497 }
2409 } 2498 }
2410 if (!spic_dev.cur_ioport) { 2499 if (!spic_dev.cur_ioport) {
@@ -2414,7 +2503,7 @@ static int sony_pic_add(struct acpi_device *device)
2414 } 2503 }
2415 2504
2416 /* request IRQ */ 2505 /* request IRQ */
2417 list_for_each_entry(irq, &spic_dev.interrupts, list) { 2506 list_for_each_entry_reverse(irq, &spic_dev.interrupts, list) {
2418 if (!request_irq(irq->irq.interrupts[0], sony_pic_irq, 2507 if (!request_irq(irq->irq.interrupts[0], sony_pic_irq,
2419 IRQF_SHARED, "sony-laptop", &spic_dev)) { 2508 IRQF_SHARED, "sony-laptop", &spic_dev)) {
2420 dprintk("IRQ: %d - triggering: %d - " 2509 dprintk("IRQ: %d - triggering: %d - "
@@ -2462,8 +2551,11 @@ err_free_irq:
2462 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev); 2551 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev);
2463 2552
2464err_release_region: 2553err_release_region:
2465 release_region(spic_dev.cur_ioport->io.minimum, 2554 release_region(spic_dev.cur_ioport->io1.minimum,
2466 spic_dev.cur_ioport->io.address_length); 2555 spic_dev.cur_ioport->io1.address_length);
2556 if (spic_dev.cur_ioport->io2.minimum)
2557 release_region(spic_dev.cur_ioport->io2.minimum,
2558 spic_dev.cur_ioport->io2.address_length);
2467 2559
2468err_remove_compat: 2560err_remove_compat:
2469 sonypi_compat_exit(); 2561 sonypi_compat_exit();
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 0222bbaf7b76..37891a8c030a 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24#define IBM_VERSION "0.16" 24#define IBM_VERSION "0.16"
25#define TPACPI_SYSFS_VERSION 0x010000 25#define TPACPI_SYSFS_VERSION 0x020000
26 26
27/* 27/*
28 * Changelog: 28 * Changelog:
@@ -117,6 +117,12 @@ IBM_BIOS_MODULE_ALIAS("K[U,X-Z]");
117 117
118#define __unused __attribute__ ((unused)) 118#define __unused __attribute__ ((unused))
119 119
120static enum {
121 TPACPI_LIFE_INIT = 0,
122 TPACPI_LIFE_RUNNING,
123 TPACPI_LIFE_EXITING,
124} tpacpi_lifecycle;
125
120/**************************************************************************** 126/****************************************************************************
121 **************************************************************************** 127 ****************************************************************************
122 * 128 *
@@ -342,6 +348,9 @@ static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
342{ 348{
343 struct ibm_struct *ibm = data; 349 struct ibm_struct *ibm = data;
344 350
351 if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING)
352 return;
353
345 if (!ibm || !ibm->acpi || !ibm->acpi->notify) 354 if (!ibm || !ibm->acpi || !ibm->acpi->notify)
346 return; 355 return;
347 356
@@ -517,8 +526,10 @@ static char *next_cmd(char **cmds)
517 ****************************************************************************/ 526 ****************************************************************************/
518 527
519static struct platform_device *tpacpi_pdev; 528static struct platform_device *tpacpi_pdev;
529static struct platform_device *tpacpi_sensors_pdev;
520static struct class_device *tpacpi_hwmon; 530static struct class_device *tpacpi_hwmon;
521static struct input_dev *tpacpi_inputdev; 531static struct input_dev *tpacpi_inputdev;
532static struct mutex tpacpi_inputdev_send_mutex;
522 533
523 534
524static int tpacpi_resume_handler(struct platform_device *pdev) 535static int tpacpi_resume_handler(struct platform_device *pdev)
@@ -543,6 +554,12 @@ static struct platform_driver tpacpi_pdriver = {
543 .resume = tpacpi_resume_handler, 554 .resume = tpacpi_resume_handler,
544}; 555};
545 556
557static struct platform_driver tpacpi_hwmon_pdriver = {
558 .driver = {
559 .name = IBM_HWMON_DRVR_NAME,
560 .owner = THIS_MODULE,
561 },
562};
546 563
547/************************************************************************* 564/*************************************************************************
548 * thinkpad-acpi driver attributes 565 * thinkpad-acpi driver attributes
@@ -692,6 +709,8 @@ static int parse_strtoul(const char *buf,
692{ 709{
693 char *endp; 710 char *endp;
694 711
712 while (*buf && isspace(*buf))
713 buf++;
695 *value = simple_strtoul(buf, &endp, 0); 714 *value = simple_strtoul(buf, &endp, 0);
696 while (*endp && isspace(*endp)) 715 while (*endp && isspace(*endp))
697 endp++; 716 endp++;
@@ -989,6 +1008,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
989 1008
990 int res, i; 1009 int res, i;
991 int status; 1010 int status;
1011 int hkeyv;
992 1012
993 vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n"); 1013 vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n");
994 1014
@@ -1014,18 +1034,35 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
1014 return res; 1034 return res;
1015 1035
1016 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, 1036 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
1017 A30, R30, R31, T20-22, X20-21, X22-24 */ 1037 A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking
1018 tp_features.hotkey_mask = 1038 for HKEY interface version 0x100 */
1019 acpi_evalf(hkey_handle, NULL, "DHKN", "qv"); 1039 if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
1040 if ((hkeyv >> 8) != 1) {
1041 printk(IBM_ERR "unknown version of the "
1042 "HKEY interface: 0x%x\n", hkeyv);
1043 printk(IBM_ERR "please report this to %s\n",
1044 IBM_MAIL);
1045 } else {
1046 /*
1047 * MHKV 0x100 in A31, R40, R40e,
1048 * T4x, X31, and later
1049 * */
1050 tp_features.hotkey_mask = 1;
1051 }
1052 }
1020 1053
1021 vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", 1054 vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n",
1022 str_supported(tp_features.hotkey_mask)); 1055 str_supported(tp_features.hotkey_mask));
1023 1056
1024 if (tp_features.hotkey_mask) { 1057 if (tp_features.hotkey_mask) {
1025 /* MHKA available in A31, R40, R40e, T4x, X31, and later */
1026 if (!acpi_evalf(hkey_handle, &hotkey_all_mask, 1058 if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
1027 "MHKA", "qd")) 1059 "MHKA", "qd")) {
1060 printk(IBM_ERR
1061 "missing MHKA handler, "
1062 "please report this to %s\n",
1063 IBM_MAIL);
1028 hotkey_all_mask = 0x080cU; /* FN+F12, FN+F4, FN+F3 */ 1064 hotkey_all_mask = 0x080cU; /* FN+F12, FN+F4, FN+F3 */
1065 }
1029 } 1066 }
1030 1067
1031 res = hotkey_get(&hotkey_orig_status, &hotkey_orig_mask); 1068 res = hotkey_get(&hotkey_orig_status, &hotkey_orig_mask);
@@ -1131,6 +1168,8 @@ static void tpacpi_input_send_key(unsigned int scancode,
1131 unsigned int keycode) 1168 unsigned int keycode)
1132{ 1169{
1133 if (keycode != KEY_RESERVED) { 1170 if (keycode != KEY_RESERVED) {
1171 mutex_lock(&tpacpi_inputdev_send_mutex);
1172
1134 input_report_key(tpacpi_inputdev, keycode, 1); 1173 input_report_key(tpacpi_inputdev, keycode, 1);
1135 if (keycode == KEY_UNKNOWN) 1174 if (keycode == KEY_UNKNOWN)
1136 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, 1175 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
@@ -1142,6 +1181,8 @@ static void tpacpi_input_send_key(unsigned int scancode,
1142 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, 1181 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
1143 scancode); 1182 scancode);
1144 input_sync(tpacpi_inputdev); 1183 input_sync(tpacpi_inputdev);
1184
1185 mutex_unlock(&tpacpi_inputdev_send_mutex);
1145 } 1186 }
1146} 1187}
1147 1188
@@ -1149,18 +1190,47 @@ static void tpacpi_input_send_radiosw(void)
1149{ 1190{
1150 int wlsw; 1191 int wlsw;
1151 1192
1152 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) 1193 mutex_lock(&tpacpi_inputdev_send_mutex);
1194
1195 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1153 input_report_switch(tpacpi_inputdev, 1196 input_report_switch(tpacpi_inputdev,
1154 SW_RADIO, !!wlsw); 1197 SW_RADIO, !!wlsw);
1198 input_sync(tpacpi_inputdev);
1199 }
1200
1201 mutex_unlock(&tpacpi_inputdev_send_mutex);
1155} 1202}
1156 1203
1157static void hotkey_notify(struct ibm_struct *ibm, u32 event) 1204static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1158{ 1205{
1159 u32 hkey; 1206 u32 hkey;
1160 unsigned int keycode, scancode; 1207 unsigned int keycode, scancode;
1161 int send_acpi_ev = 0; 1208 int send_acpi_ev;
1209 int ignore_acpi_ev;
1210
1211 if (event != 0x80) {
1212 printk(IBM_ERR "unknown HKEY notification event %d\n", event);
1213 /* forward it to userspace, maybe it knows how to handle it */
1214 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
1215 ibm->acpi->device->dev.bus_id,
1216 event, 0);
1217 return;
1218 }
1219
1220 while (1) {
1221 if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
1222 printk(IBM_ERR "failed to retrieve HKEY event\n");
1223 return;
1224 }
1225
1226 if (hkey == 0) {
1227 /* queue empty */
1228 return;
1229 }
1230
1231 send_acpi_ev = 0;
1232 ignore_acpi_ev = 0;
1162 1233
1163 if (event == 0x80 && acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
1164 switch (hkey >> 12) { 1234 switch (hkey >> 12) {
1165 case 1: 1235 case 1:
1166 /* 0x1000-0x1FFF: key presses */ 1236 /* 0x1000-0x1FFF: key presses */
@@ -1182,9 +1252,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1182 * eat up known LID events */ 1252 * eat up known LID events */
1183 if (hkey != 0x5001 && hkey != 0x5002) { 1253 if (hkey != 0x5001 && hkey != 0x5002) {
1184 printk(IBM_ERR 1254 printk(IBM_ERR
1185 "unknown LID-related hotkey event: 0x%04x\n", 1255 "unknown LID-related HKEY event: 0x%04x\n",
1186 hkey); 1256 hkey);
1187 send_acpi_ev = 1; 1257 send_acpi_ev = 1;
1258 } else {
1259 ignore_acpi_ev = 1;
1188 } 1260 }
1189 break; 1261 break;
1190 case 7: 1262 case 7:
@@ -1202,21 +1274,18 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1202 printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey); 1274 printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey);
1203 send_acpi_ev = 1; 1275 send_acpi_ev = 1;
1204 } 1276 }
1205 } else {
1206 printk(IBM_ERR "unknown hotkey notification event %d\n", event);
1207 hkey = 0;
1208 send_acpi_ev = 1;
1209 }
1210 1277
1211 /* Legacy events */ 1278 /* Legacy events */
1212 if (send_acpi_ev || hotkey_report_mode < 2) 1279 if (!ignore_acpi_ev && (send_acpi_ev || hotkey_report_mode < 2)) {
1213 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey); 1280 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
1281 }
1214 1282
1215 /* netlink events */ 1283 /* netlink events */
1216 if (send_acpi_ev) { 1284 if (!ignore_acpi_ev && send_acpi_ev) {
1217 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 1285 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
1218 ibm->acpi->device->dev.bus_id, 1286 ibm->acpi->device->dev.bus_id,
1219 event, hkey); 1287 event, hkey);
1288 }
1220 } 1289 }
1221} 1290}
1222 1291
@@ -2812,7 +2881,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
2812 2881
2813 switch(thermal_read_mode) { 2882 switch(thermal_read_mode) {
2814 case TPACPI_THERMAL_TPEC_16: 2883 case TPACPI_THERMAL_TPEC_16:
2815 res = sysfs_create_group(&tpacpi_pdev->dev.kobj, 2884 res = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
2816 &thermal_temp_input16_group); 2885 &thermal_temp_input16_group);
2817 if (res) 2886 if (res)
2818 return res; 2887 return res;
@@ -2820,7 +2889,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
2820 case TPACPI_THERMAL_TPEC_8: 2889 case TPACPI_THERMAL_TPEC_8:
2821 case TPACPI_THERMAL_ACPI_TMP07: 2890 case TPACPI_THERMAL_ACPI_TMP07:
2822 case TPACPI_THERMAL_ACPI_UPDT: 2891 case TPACPI_THERMAL_ACPI_UPDT:
2823 res = sysfs_create_group(&tpacpi_pdev->dev.kobj, 2892 res = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
2824 &thermal_temp_input8_group); 2893 &thermal_temp_input8_group);
2825 if (res) 2894 if (res)
2826 return res; 2895 return res;
@@ -2837,13 +2906,13 @@ static void thermal_exit(void)
2837{ 2906{
2838 switch(thermal_read_mode) { 2907 switch(thermal_read_mode) {
2839 case TPACPI_THERMAL_TPEC_16: 2908 case TPACPI_THERMAL_TPEC_16:
2840 sysfs_remove_group(&tpacpi_pdev->dev.kobj, 2909 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj,
2841 &thermal_temp_input16_group); 2910 &thermal_temp_input16_group);
2842 break; 2911 break;
2843 case TPACPI_THERMAL_TPEC_8: 2912 case TPACPI_THERMAL_TPEC_8:
2844 case TPACPI_THERMAL_ACPI_TMP07: 2913 case TPACPI_THERMAL_ACPI_TMP07:
2845 case TPACPI_THERMAL_ACPI_UPDT: 2914 case TPACPI_THERMAL_ACPI_UPDT:
2846 sysfs_remove_group(&tpacpi_pdev->dev.kobj, 2915 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj,
2847 &thermal_temp_input16_group); 2916 &thermal_temp_input16_group);
2848 break; 2917 break;
2849 case TPACPI_THERMAL_NONE: 2918 case TPACPI_THERMAL_NONE:
@@ -3626,7 +3695,7 @@ static struct device_attribute dev_attr_fan_fan1_input =
3626 __ATTR(fan1_input, S_IRUGO, 3695 __ATTR(fan1_input, S_IRUGO,
3627 fan_fan1_input_show, NULL); 3696 fan_fan1_input_show, NULL);
3628 3697
3629/* sysfs fan fan_watchdog (driver) ------------------------------------- */ 3698/* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */
3630static ssize_t fan_fan_watchdog_show(struct device_driver *drv, 3699static ssize_t fan_fan_watchdog_show(struct device_driver *drv,
3631 char *buf) 3700 char *buf)
3632{ 3701{
@@ -3768,10 +3837,10 @@ static int __init fan_init(struct ibm_init_struct *iibm)
3768 3837
3769 if (fan_status_access_mode != TPACPI_FAN_NONE || 3838 if (fan_status_access_mode != TPACPI_FAN_NONE ||
3770 fan_control_access_mode != TPACPI_FAN_WR_NONE) { 3839 fan_control_access_mode != TPACPI_FAN_WR_NONE) {
3771 rc = sysfs_create_group(&tpacpi_pdev->dev.kobj, 3840 rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
3772 &fan_attr_group); 3841 &fan_attr_group);
3773 if (!(rc < 0)) 3842 if (!(rc < 0))
3774 rc = driver_create_file(&tpacpi_pdriver.driver, 3843 rc = driver_create_file(&tpacpi_hwmon_pdriver.driver,
3775 &driver_attr_fan_watchdog); 3844 &driver_attr_fan_watchdog);
3776 if (rc < 0) 3845 if (rc < 0)
3777 return rc; 3846 return rc;
@@ -3854,8 +3923,8 @@ static void fan_exit(void)
3854 vdbg_printk(TPACPI_DBG_EXIT, "cancelling any pending fan watchdog tasks\n"); 3923 vdbg_printk(TPACPI_DBG_EXIT, "cancelling any pending fan watchdog tasks\n");
3855 3924
3856 /* FIXME: can we really do this unconditionally? */ 3925 /* FIXME: can we really do this unconditionally? */
3857 sysfs_remove_group(&tpacpi_pdev->dev.kobj, &fan_attr_group); 3926 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, &fan_attr_group);
3858 driver_remove_file(&tpacpi_pdriver.driver, &driver_attr_fan_watchdog); 3927 driver_remove_file(&tpacpi_hwmon_pdriver.driver, &driver_attr_fan_watchdog);
3859 3928
3860 cancel_delayed_work(&fan_watchdog_task); 3929 cancel_delayed_work(&fan_watchdog_task);
3861 flush_scheduled_work(); 3930 flush_scheduled_work();
@@ -3888,6 +3957,9 @@ static void fan_watchdog_fire(struct work_struct *ignored)
3888{ 3957{
3889 int rc; 3958 int rc;
3890 3959
3960 if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING)
3961 return;
3962
3891 printk(IBM_NOTICE "fan watchdog: enabling fan\n"); 3963 printk(IBM_NOTICE "fan watchdog: enabling fan\n");
3892 rc = fan_set_enable(); 3964 rc = fan_set_enable();
3893 if (rc < 0) { 3965 if (rc < 0) {
@@ -3908,7 +3980,8 @@ static void fan_watchdog_reset(void)
3908 if (fan_watchdog_active) 3980 if (fan_watchdog_active)
3909 cancel_delayed_work(&fan_watchdog_task); 3981 cancel_delayed_work(&fan_watchdog_task);
3910 3982
3911 if (fan_watchdog_maxinterval > 0) { 3983 if (fan_watchdog_maxinterval > 0 &&
3984 tpacpi_lifecycle != TPACPI_LIFE_EXITING) {
3912 fan_watchdog_active = 1; 3985 fan_watchdog_active = 1;
3913 if (!schedule_delayed_work(&fan_watchdog_task, 3986 if (!schedule_delayed_work(&fan_watchdog_task,
3914 msecs_to_jiffies(fan_watchdog_maxinterval 3987 msecs_to_jiffies(fan_watchdog_maxinterval
@@ -4302,6 +4375,19 @@ static struct ibm_struct fan_driver_data = {
4302 **************************************************************************** 4375 ****************************************************************************
4303 ****************************************************************************/ 4376 ****************************************************************************/
4304 4377
4378/* sysfs name ---------------------------------------------------------- */
4379static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev,
4380 struct device_attribute *attr,
4381 char *buf)
4382{
4383 return snprintf(buf, PAGE_SIZE, "%s\n", IBM_NAME);
4384}
4385
4386static struct device_attribute dev_attr_thinkpad_acpi_pdev_name =
4387 __ATTR(name, S_IRUGO, thinkpad_acpi_pdev_name_show, NULL);
4388
4389/* --------------------------------------------------------------------- */
4390
4305/* /proc support */ 4391/* /proc support */
4306static struct proc_dir_entry *proc_dir; 4392static struct proc_dir_entry *proc_dir;
4307 4393
@@ -4674,6 +4760,8 @@ static int __init thinkpad_acpi_module_init(void)
4674{ 4760{
4675 int ret, i; 4761 int ret, i;
4676 4762
4763 tpacpi_lifecycle = TPACPI_LIFE_INIT;
4764
4677 /* Parameter checking */ 4765 /* Parameter checking */
4678 if (hotkey_report_mode > 2) 4766 if (hotkey_report_mode > 2)
4679 return -EINVAL; 4767 return -EINVAL;
@@ -4702,19 +4790,31 @@ static int __init thinkpad_acpi_module_init(void)
4702 4790
4703 ret = platform_driver_register(&tpacpi_pdriver); 4791 ret = platform_driver_register(&tpacpi_pdriver);
4704 if (ret) { 4792 if (ret) {
4705 printk(IBM_ERR "unable to register platform driver\n"); 4793 printk(IBM_ERR "unable to register main platform driver\n");
4706 thinkpad_acpi_module_exit(); 4794 thinkpad_acpi_module_exit();
4707 return ret; 4795 return ret;
4708 } 4796 }
4709 tp_features.platform_drv_registered = 1; 4797 tp_features.platform_drv_registered = 1;
4710 4798
4799 ret = platform_driver_register(&tpacpi_hwmon_pdriver);
4800 if (ret) {
4801 printk(IBM_ERR "unable to register hwmon platform driver\n");
4802 thinkpad_acpi_module_exit();
4803 return ret;
4804 }
4805 tp_features.sensors_pdrv_registered = 1;
4806
4711 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver); 4807 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
4808 if (!ret) {
4809 tp_features.platform_drv_attrs_registered = 1;
4810 ret = tpacpi_create_driver_attributes(&tpacpi_hwmon_pdriver.driver);
4811 }
4712 if (ret) { 4812 if (ret) {
4713 printk(IBM_ERR "unable to create sysfs driver attributes\n"); 4813 printk(IBM_ERR "unable to create sysfs driver attributes\n");
4714 thinkpad_acpi_module_exit(); 4814 thinkpad_acpi_module_exit();
4715 return ret; 4815 return ret;
4716 } 4816 }
4717 tp_features.platform_drv_attrs_registered = 1; 4817 tp_features.sensors_pdrv_attrs_registered = 1;
4718 4818
4719 4819
4720 /* Device initialization */ 4820 /* Device initialization */
@@ -4727,7 +4827,26 @@ static int __init thinkpad_acpi_module_init(void)
4727 thinkpad_acpi_module_exit(); 4827 thinkpad_acpi_module_exit();
4728 return ret; 4828 return ret;
4729 } 4829 }
4730 tpacpi_hwmon = hwmon_device_register(&tpacpi_pdev->dev); 4830 tpacpi_sensors_pdev = platform_device_register_simple(
4831 IBM_HWMON_DRVR_NAME,
4832 -1, NULL, 0);
4833 if (IS_ERR(tpacpi_sensors_pdev)) {
4834 ret = PTR_ERR(tpacpi_sensors_pdev);
4835 tpacpi_sensors_pdev = NULL;
4836 printk(IBM_ERR "unable to register hwmon platform device\n");
4837 thinkpad_acpi_module_exit();
4838 return ret;
4839 }
4840 ret = device_create_file(&tpacpi_sensors_pdev->dev,
4841 &dev_attr_thinkpad_acpi_pdev_name);
4842 if (ret) {
4843 printk(IBM_ERR
4844 "unable to create sysfs hwmon device attributes\n");
4845 thinkpad_acpi_module_exit();
4846 return ret;
4847 }
4848 tp_features.sensors_pdev_attrs_registered = 1;
4849 tpacpi_hwmon = hwmon_device_register(&tpacpi_sensors_pdev->dev);
4731 if (IS_ERR(tpacpi_hwmon)) { 4850 if (IS_ERR(tpacpi_hwmon)) {
4732 ret = PTR_ERR(tpacpi_hwmon); 4851 ret = PTR_ERR(tpacpi_hwmon);
4733 tpacpi_hwmon = NULL; 4852 tpacpi_hwmon = NULL;
@@ -4735,6 +4854,7 @@ static int __init thinkpad_acpi_module_init(void)
4735 thinkpad_acpi_module_exit(); 4854 thinkpad_acpi_module_exit();
4736 return ret; 4855 return ret;
4737 } 4856 }
4857 mutex_init(&tpacpi_inputdev_send_mutex);
4738 tpacpi_inputdev = input_allocate_device(); 4858 tpacpi_inputdev = input_allocate_device();
4739 if (!tpacpi_inputdev) { 4859 if (!tpacpi_inputdev) {
4740 printk(IBM_ERR "unable to allocate input device\n"); 4860 printk(IBM_ERR "unable to allocate input device\n");
@@ -4769,6 +4889,7 @@ static int __init thinkpad_acpi_module_init(void)
4769 tp_features.input_device_registered = 1; 4889 tp_features.input_device_registered = 1;
4770 } 4890 }
4771 4891
4892 tpacpi_lifecycle = TPACPI_LIFE_RUNNING;
4772 return 0; 4893 return 0;
4773} 4894}
4774 4895
@@ -4776,6 +4897,8 @@ static void thinkpad_acpi_module_exit(void)
4776{ 4897{
4777 struct ibm_struct *ibm, *itmp; 4898 struct ibm_struct *ibm, *itmp;
4778 4899
4900 tpacpi_lifecycle = TPACPI_LIFE_EXITING;
4901
4779 list_for_each_entry_safe_reverse(ibm, itmp, 4902 list_for_each_entry_safe_reverse(ibm, itmp,
4780 &tpacpi_all_drivers, 4903 &tpacpi_all_drivers,
4781 all_drivers) { 4904 all_drivers) {
@@ -4794,12 +4917,22 @@ static void thinkpad_acpi_module_exit(void)
4794 if (tpacpi_hwmon) 4917 if (tpacpi_hwmon)
4795 hwmon_device_unregister(tpacpi_hwmon); 4918 hwmon_device_unregister(tpacpi_hwmon);
4796 4919
4920 if (tp_features.sensors_pdev_attrs_registered)
4921 device_remove_file(&tpacpi_sensors_pdev->dev,
4922 &dev_attr_thinkpad_acpi_pdev_name);
4923 if (tpacpi_sensors_pdev)
4924 platform_device_unregister(tpacpi_sensors_pdev);
4797 if (tpacpi_pdev) 4925 if (tpacpi_pdev)
4798 platform_device_unregister(tpacpi_pdev); 4926 platform_device_unregister(tpacpi_pdev);
4799 4927
4928 if (tp_features.sensors_pdrv_attrs_registered)
4929 tpacpi_remove_driver_attributes(&tpacpi_hwmon_pdriver.driver);
4800 if (tp_features.platform_drv_attrs_registered) 4930 if (tp_features.platform_drv_attrs_registered)
4801 tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); 4931 tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver);
4802 4932
4933 if (tp_features.sensors_pdrv_registered)
4934 platform_driver_unregister(&tpacpi_hwmon_pdriver);
4935
4803 if (tp_features.platform_drv_registered) 4936 if (tp_features.platform_drv_registered)
4804 platform_driver_unregister(&tpacpi_pdriver); 4937 platform_driver_unregister(&tpacpi_pdriver);
4805 4938
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 082a1cbc16c0..c5fdd688cc99 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -58,13 +58,14 @@
58 58
59#define IBM_NAME "thinkpad" 59#define IBM_NAME "thinkpad"
60#define IBM_DESC "ThinkPad ACPI Extras" 60#define IBM_DESC "ThinkPad ACPI Extras"
61#define IBM_FILE "thinkpad_acpi" 61#define IBM_FILE IBM_NAME "_acpi"
62#define IBM_URL "http://ibm-acpi.sf.net/" 62#define IBM_URL "http://ibm-acpi.sf.net/"
63#define IBM_MAIL "ibm-acpi-devel@lists.sourceforge.net" 63#define IBM_MAIL "ibm-acpi-devel@lists.sourceforge.net"
64 64
65#define IBM_PROC_DIR "ibm" 65#define IBM_PROC_DIR "ibm"
66#define IBM_ACPI_EVENT_PREFIX "ibm" 66#define IBM_ACPI_EVENT_PREFIX "ibm"
67#define IBM_DRVR_NAME IBM_FILE 67#define IBM_DRVR_NAME IBM_FILE
68#define IBM_HWMON_DRVR_NAME IBM_NAME "_hwmon"
68 69
69#define IBM_LOG IBM_FILE ": " 70#define IBM_LOG IBM_FILE ": "
70#define IBM_ERR KERN_ERR IBM_LOG 71#define IBM_ERR KERN_ERR IBM_LOG
@@ -171,6 +172,7 @@ static int parse_strtoul(const char *buf, unsigned long max,
171 172
172/* Device model */ 173/* Device model */
173static struct platform_device *tpacpi_pdev; 174static struct platform_device *tpacpi_pdev;
175static struct platform_device *tpacpi_sensors_pdev;
174static struct class_device *tpacpi_hwmon; 176static struct class_device *tpacpi_hwmon;
175static struct platform_driver tpacpi_pdriver; 177static struct platform_driver tpacpi_pdriver;
176static struct input_dev *tpacpi_inputdev; 178static struct input_dev *tpacpi_inputdev;
@@ -233,22 +235,25 @@ struct ibm_init_struct {
233 235
234static struct { 236static struct {
235#ifdef CONFIG_THINKPAD_ACPI_BAY 237#ifdef CONFIG_THINKPAD_ACPI_BAY
236 u16 bay_status:1; 238 u32 bay_status:1;
237 u16 bay_eject:1; 239 u32 bay_eject:1;
238 u16 bay_status2:1; 240 u32 bay_status2:1;
239 u16 bay_eject2:1; 241 u32 bay_eject2:1;
240#endif 242#endif
241 u16 bluetooth:1; 243 u32 bluetooth:1;
242 u16 hotkey:1; 244 u32 hotkey:1;
243 u16 hotkey_mask:1; 245 u32 hotkey_mask:1;
244 u16 hotkey_wlsw:1; 246 u32 hotkey_wlsw:1;
245 u16 light:1; 247 u32 light:1;
246 u16 light_status:1; 248 u32 light_status:1;
247 u16 wan:1; 249 u32 wan:1;
248 u16 fan_ctrl_status_undef:1; 250 u32 fan_ctrl_status_undef:1;
249 u16 input_device_registered:1; 251 u32 input_device_registered:1;
250 u16 platform_drv_registered:1; 252 u32 platform_drv_registered:1;
251 u16 platform_drv_attrs_registered:1; 253 u32 platform_drv_attrs_registered:1;
254 u32 sensors_pdrv_registered:1;
255 u32 sensors_pdrv_attrs_registered:1;
256 u32 sensors_pdev_attrs_registered:1;
252} tp_features; 257} tp_features;
253 258
254struct thinkpad_id_data { 259struct thinkpad_id_data {
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 4c3785c9d4b8..9ecc3adcf6c1 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1726,6 +1726,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol
1726 case E1000_DEV_ID_82571EB_QUAD_COPPER: 1726 case E1000_DEV_ID_82571EB_QUAD_COPPER:
1727 case E1000_DEV_ID_82571EB_QUAD_FIBER: 1727 case E1000_DEV_ID_82571EB_QUAD_FIBER:
1728 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 1728 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
1729 case E1000_DEV_ID_82571PT_QUAD_COPPER:
1729 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 1730 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
1730 /* quad port adapters only support WoL on port A */ 1731 /* quad port adapters only support WoL on port A */
1731 if (!adapter->quad_port_a) { 1732 if (!adapter->quad_port_a) {
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index ba120f7fb0be..8604adbe351c 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -387,6 +387,7 @@ e1000_set_mac_type(struct e1000_hw *hw)
387 case E1000_DEV_ID_82571EB_SERDES_DUAL: 387 case E1000_DEV_ID_82571EB_SERDES_DUAL:
388 case E1000_DEV_ID_82571EB_SERDES_QUAD: 388 case E1000_DEV_ID_82571EB_SERDES_QUAD:
389 case E1000_DEV_ID_82571EB_QUAD_COPPER: 389 case E1000_DEV_ID_82571EB_QUAD_COPPER:
390 case E1000_DEV_ID_82571PT_QUAD_COPPER:
390 case E1000_DEV_ID_82571EB_QUAD_FIBER: 391 case E1000_DEV_ID_82571EB_QUAD_FIBER:
391 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 392 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
392 hw->mac_type = e1000_82571; 393 hw->mac_type = e1000_82571;
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index fe8714655c90..07f0ea73676e 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -475,6 +475,7 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
475#define E1000_DEV_ID_82571EB_FIBER 0x105F 475#define E1000_DEV_ID_82571EB_FIBER 0x105F
476#define E1000_DEV_ID_82571EB_SERDES 0x1060 476#define E1000_DEV_ID_82571EB_SERDES 0x1060
477#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 477#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
478#define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5
478#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 479#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5
479#define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC 480#define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE 0x10BC
480#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9 481#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4a225950fb43..e7c8951f47fa 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -108,6 +108,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
108 INTEL_E1000_ETHERNET_DEVICE(0x10BC), 108 INTEL_E1000_ETHERNET_DEVICE(0x10BC),
109 INTEL_E1000_ETHERNET_DEVICE(0x10C4), 109 INTEL_E1000_ETHERNET_DEVICE(0x10C4),
110 INTEL_E1000_ETHERNET_DEVICE(0x10C5), 110 INTEL_E1000_ETHERNET_DEVICE(0x10C5),
111 INTEL_E1000_ETHERNET_DEVICE(0x10D5),
111 INTEL_E1000_ETHERNET_DEVICE(0x10D9), 112 INTEL_E1000_ETHERNET_DEVICE(0x10D9),
112 INTEL_E1000_ETHERNET_DEVICE(0x10DA), 113 INTEL_E1000_ETHERNET_DEVICE(0x10DA),
113 /* required last entry */ 114 /* required last entry */
@@ -1101,6 +1102,7 @@ e1000_probe(struct pci_dev *pdev,
1101 case E1000_DEV_ID_82571EB_QUAD_COPPER: 1102 case E1000_DEV_ID_82571EB_QUAD_COPPER:
1102 case E1000_DEV_ID_82571EB_QUAD_FIBER: 1103 case E1000_DEV_ID_82571EB_QUAD_FIBER:
1103 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE: 1104 case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
1105 case E1000_DEV_ID_82571PT_QUAD_COPPER:
1104 /* if quad port adapter, disable WoL on all but port A */ 1106 /* if quad port adapter, disable WoL on all but port A */
1105 if (global_quad_port_a != 0) 1107 if (global_quad_port_a != 0)
1106 adapter->eeprom_wol = 0; 1108 adapter->eeprom_wol = 0;
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 456d1e1c98bd..315335671f0f 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -534,7 +534,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id)
534 } 534 }
535 535
536 /* PHY status changed */ 536 /* PHY status changed */
537 if (eth_int_cause_ext & ETH_INT_CAUSE_PHY) { 537 if (eth_int_cause_ext & (ETH_INT_CAUSE_PHY | ETH_INT_CAUSE_STATE)) {
538 struct ethtool_cmd cmd; 538 struct ethtool_cmd cmd;
539 539
540 if (mii_link_ok(&mp->mii)) { 540 if (mii_link_ok(&mp->mii)) {
@@ -1357,7 +1357,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1357#endif 1357#endif
1358 1358
1359 dev->watchdog_timeo = 2 * HZ; 1359 dev->watchdog_timeo = 2 * HZ;
1360 dev->tx_queue_len = mp->tx_ring_size;
1361 dev->base_addr = 0; 1360 dev->base_addr = 0;
1362 dev->change_mtu = mv643xx_eth_change_mtu; 1361 dev->change_mtu = mv643xx_eth_change_mtu;
1363 dev->do_ioctl = mv643xx_eth_do_ioctl; 1362 dev->do_ioctl = mv643xx_eth_do_ioctl;
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h
index 82f8c0cbfb64..565b96696aca 100644
--- a/drivers/net/mv643xx_eth.h
+++ b/drivers/net/mv643xx_eth.h
@@ -64,7 +64,9 @@
64#define ETH_INT_CAUSE_TX_ERROR (ETH_TX_QUEUES_ENABLED << 8) 64#define ETH_INT_CAUSE_TX_ERROR (ETH_TX_QUEUES_ENABLED << 8)
65#define ETH_INT_CAUSE_TX (ETH_INT_CAUSE_TX_DONE | ETH_INT_CAUSE_TX_ERROR) 65#define ETH_INT_CAUSE_TX (ETH_INT_CAUSE_TX_DONE | ETH_INT_CAUSE_TX_ERROR)
66#define ETH_INT_CAUSE_PHY 0x00010000 66#define ETH_INT_CAUSE_PHY 0x00010000
67#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY) 67#define ETH_INT_CAUSE_STATE 0x00100000
68#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY | \
69 ETH_INT_CAUSE_STATE)
68 70
69#define ETH_INT_MASK_ALL 0x00000000 71#define ETH_INT_MASK_ALL 0x00000000
70#define ETH_INT_MASK_ALL_EXT 0x00000000 72#define ETH_INT_MASK_ALL_EXT 0x00000000
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 69da95b5ad0c..ea151315050c 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2248,6 +2248,13 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
2248 qdev->rsp_consumer_index) && (work_done < work_to_do)) { 2248 qdev->rsp_consumer_index) && (work_done < work_to_do)) {
2249 2249
2250 net_rsp = qdev->rsp_current; 2250 net_rsp = qdev->rsp_current;
2251 rmb();
2252 /*
2253 * Fix 4032 chipe undocumented "feature" where bit-8 is set if the
2254 * inbound completion is for a VLAN.
2255 */
2256 if (qdev->device_id == QL3032_DEVICE_ID)
2257 net_rsp->opcode &= 0x7f;
2251 switch (net_rsp->opcode) { 2258 switch (net_rsp->opcode) {
2252 2259
2253 case OPCODE_OB_MAC_IOCB_FN0: 2260 case OPCODE_OB_MAC_IOCB_FN0:
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index c921ec32c232..c76dd29c8e9a 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1918,7 +1918,11 @@ static void rtl_hw_start_8169(struct net_device *dev)
1918 1918
1919 rtl_set_rx_max_size(ioaddr); 1919 rtl_set_rx_max_size(ioaddr);
1920 1920
1921 rtl_set_rx_tx_config_registers(tp); 1921 if ((tp->mac_version == RTL_GIGA_MAC_VER_01) ||
1922 (tp->mac_version == RTL_GIGA_MAC_VER_02) ||
1923 (tp->mac_version == RTL_GIGA_MAC_VER_03) ||
1924 (tp->mac_version == RTL_GIGA_MAC_VER_04))
1925 rtl_set_rx_tx_config_registers(tp);
1922 1926
1923 tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW; 1927 tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW;
1924 1928
@@ -1941,6 +1945,14 @@ static void rtl_hw_start_8169(struct net_device *dev)
1941 1945
1942 rtl_set_rx_tx_desc_registers(tp, ioaddr); 1946 rtl_set_rx_tx_desc_registers(tp, ioaddr);
1943 1947
1948 if ((tp->mac_version != RTL_GIGA_MAC_VER_01) &&
1949 (tp->mac_version != RTL_GIGA_MAC_VER_02) &&
1950 (tp->mac_version != RTL_GIGA_MAC_VER_03) &&
1951 (tp->mac_version != RTL_GIGA_MAC_VER_04)) {
1952 RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
1953 rtl_set_rx_tx_config_registers(tp);
1954 }
1955
1944 RTL_W8(Cfg9346, Cfg9346_Lock); 1956 RTL_W8(Cfg9346, Cfg9346_Lock);
1945 1957
1946 /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ 1958 /* Initially a 10 us delay. Turned it into a PCI commit. - FR */
@@ -1955,8 +1967,6 @@ static void rtl_hw_start_8169(struct net_device *dev)
1955 1967
1956 /* Enable all known interrupts by setting the interrupt mask. */ 1968 /* Enable all known interrupts by setting the interrupt mask. */
1957 RTL_W16(IntrMask, tp->intr_event); 1969 RTL_W16(IntrMask, tp->intr_event);
1958
1959 RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
1960} 1970}
1961 1971
1962static void rtl_hw_start_8168(struct net_device *dev) 1972static void rtl_hw_start_8168(struct net_device *dev)
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 0792031a5cf9..ea117fc3d5e3 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -910,6 +910,20 @@ static inline struct sky2_tx_le *get_tx_le(struct sky2_port *sky2)
910 return le; 910 return le;
911} 911}
912 912
913static void tx_init(struct sky2_port *sky2)
914{
915 struct sky2_tx_le *le;
916
917 sky2->tx_prod = sky2->tx_cons = 0;
918 sky2->tx_tcpsum = 0;
919 sky2->tx_last_mss = 0;
920
921 le = get_tx_le(sky2);
922 le->addr = 0;
923 le->opcode = OP_ADDR64 | HW_OWNER;
924 sky2->tx_addr64 = 0;
925}
926
913static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, 927static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
914 struct sky2_tx_le *le) 928 struct sky2_tx_le *le)
915{ 929{
@@ -1320,7 +1334,8 @@ static int sky2_up(struct net_device *dev)
1320 GFP_KERNEL); 1334 GFP_KERNEL);
1321 if (!sky2->tx_ring) 1335 if (!sky2->tx_ring)
1322 goto err_out; 1336 goto err_out;
1323 sky2->tx_prod = sky2->tx_cons = 0; 1337
1338 tx_init(sky2);
1324 1339
1325 sky2->rx_le = pci_alloc_consistent(hw->pdev, RX_LE_BYTES, 1340 sky2->rx_le = pci_alloc_consistent(hw->pdev, RX_LE_BYTES,
1326 &sky2->rx_le_map); 1341 &sky2->rx_le_map);
@@ -2148,6 +2163,15 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2148 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; 2163 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
2149 prefetch(sky2->rx_ring + sky2->rx_next); 2164 prefetch(sky2->rx_ring + sky2->rx_next);
2150 2165
2166 /* This chip has hardware problems that generates bogus status.
2167 * So do only marginal checking and expect higher level protocols
2168 * to handle crap frames.
2169 */
2170 if (sky2->hw->chip_id == CHIP_ID_YUKON_FE_P &&
2171 sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0 &&
2172 length != count)
2173 goto okay;
2174
2151 if (status & GMR_FS_ANY_ERR) 2175 if (status & GMR_FS_ANY_ERR)
2152 goto error; 2176 goto error;
2153 2177
@@ -2156,8 +2180,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
2156 2180
2157 /* if length reported by DMA does not match PHY, packet was truncated */ 2181 /* if length reported by DMA does not match PHY, packet was truncated */
2158 if (length != count) 2182 if (length != count)
2159 goto len_mismatch; 2183 goto len_error;
2160 2184
2185okay:
2161 if (length < copybreak) 2186 if (length < copybreak)
2162 skb = receive_copy(sky2, re, length); 2187 skb = receive_copy(sky2, re, length);
2163 else 2188 else
@@ -2167,13 +2192,13 @@ resubmit:
2167 2192
2168 return skb; 2193 return skb;
2169 2194
2170len_mismatch: 2195len_error:
2171 /* Truncation of overlength packets 2196 /* Truncation of overlength packets
2172 causes PHY length to not match MAC length */ 2197 causes PHY length to not match MAC length */
2173 ++sky2->net_stats.rx_length_errors; 2198 ++sky2->net_stats.rx_length_errors;
2174 if (netif_msg_rx_err(sky2) && net_ratelimit()) 2199 if (netif_msg_rx_err(sky2) && net_ratelimit())
2175 pr_info(PFX "%s: rx length mismatch: length %d status %#x\n", 2200 pr_info(PFX "%s: rx length error: status %#x length %d\n",
2176 dev->name, length, status); 2201 dev->name, status, length);
2177 goto resubmit; 2202 goto resubmit;
2178 2203
2179error: 2204error:
@@ -3934,13 +3959,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3934 sky2->hw = hw; 3959 sky2->hw = hw;
3935 sky2->msg_enable = netif_msg_init(debug, default_msg); 3960 sky2->msg_enable = netif_msg_init(debug, default_msg);
3936 3961
3937 /* This chip has hardware problems that generates
3938 * bogus PHY receive status so by default shut up the message.
3939 */
3940 if (hw->chip_id == CHIP_ID_YUKON_FE_P &&
3941 hw->chip_rev == CHIP_REV_YU_FE2_A0)
3942 sky2->msg_enable &= ~NETIF_MSG_RX_ERR;
3943
3944 /* Auto speed and flow control */ 3962 /* Auto speed and flow control */
3945 sky2->autoneg = AUTONEG_ENABLE; 3963 sky2->autoneg = AUTONEG_ENABLE;
3946 sky2->flow_mode = FC_BOTH; 3964 sky2->flow_mode = FC_BOTH;
@@ -3964,8 +3982,12 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3964 dev->features |= NETIF_F_HIGHDMA; 3982 dev->features |= NETIF_F_HIGHDMA;
3965 3983
3966#ifdef SKY2_VLAN_TAG_USED 3984#ifdef SKY2_VLAN_TAG_USED
3967 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 3985 /* The workaround for FE+ status conflicts with VLAN tag detection. */
3968 dev->vlan_rx_register = sky2_vlan_rx_register; 3986 if (!(sky2->hw->chip_id == CHIP_ID_YUKON_FE_P &&
3987 sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0)) {
3988 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
3989 dev->vlan_rx_register = sky2_vlan_rx_register;
3990 }
3969#endif 3991#endif
3970 3992
3971 /* read the mac address */ 3993 /* read the mac address */
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 16c7a0e87850..a2de32fabc17 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -405,7 +405,7 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
405 dev->net->ethtool_ops = &dm9601_ethtool_ops; 405 dev->net->ethtool_ops = &dm9601_ethtool_ops;
406 dev->net->hard_header_len += DM_TX_OVERHEAD; 406 dev->net->hard_header_len += DM_TX_OVERHEAD;
407 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 407 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
408 dev->rx_urb_size = dev->net->mtu + DM_RX_OVERHEAD; 408 dev->rx_urb_size = dev->net->mtu + ETH_HLEN + DM_RX_OVERHEAD;
409 409
410 dev->mii.dev = dev->net; 410 dev->mii.dev = dev->net;
411 dev->mii.mdio_read = dm9601_mdio_read; 411 dev->mii.mdio_read = dm9601_mdio_read;
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index ef35bc6c4a22..4eb6d9752881 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -43,7 +43,7 @@ obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
43obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o 43obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
44 44
45obj-$(CONFIG_USB_ZD1201) += zd1201.o 45obj-$(CONFIG_USB_ZD1201) += zd1201.o
46obj-$(CONFIG_LIBERTAS_USB) += libertas/ 46obj-$(CONFIG_LIBERTAS) += libertas/
47 47
48rtl8187-objs := rtl8187_dev.o rtl8187_rtl8225.o 48rtl8187-objs := rtl8187_dev.o rtl8187_rtl8225.o
49obj-$(CONFIG_RTL8187) += rtl8187.o 49obj-$(CONFIG_RTL8187) += rtl8187.o
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index d6d9413d7f23..6acfdc49dccd 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -444,7 +444,7 @@ static int bcm43xx_wx_set_xmitpower(struct net_device *net_dev,
444 u16 maxpower; 444 u16 maxpower;
445 445
446 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) { 446 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) {
447 printk(PFX KERN_ERR "TX power not in dBm.\n"); 447 printk(KERN_ERR PFX "TX power not in dBm.\n");
448 return -EOPNOTSUPP; 448 return -EOPNOTSUPP;
449 } 449 }
450 450
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7dcaa09b3c20..50f2dd9e1bb2 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1444,7 +1444,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos);
1444static void __devinit quirk_e100_interrupt(struct pci_dev *dev) 1444static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1445{ 1445{
1446 u16 command; 1446 u16 command;
1447 u32 bar;
1448 u8 __iomem *csr; 1447 u8 __iomem *csr;
1449 u8 cmd_hi; 1448 u8 cmd_hi;
1450 1449
@@ -1476,12 +1475,12 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1476 * re-enable them when it's ready. 1475 * re-enable them when it's ready.
1477 */ 1476 */
1478 pci_read_config_word(dev, PCI_COMMAND, &command); 1477 pci_read_config_word(dev, PCI_COMMAND, &command);
1479 pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar);
1480 1478
1481 if (!(command & PCI_COMMAND_MEMORY) || !bar) 1479 if (!(command & PCI_COMMAND_MEMORY) || !pci_resource_start(dev, 0))
1482 return; 1480 return;
1483 1481
1484 csr = ioremap(bar, 8); 1482 /* Convert from PCI bus to resource space. */
1483 csr = ioremap(pci_resource_start(dev, 0), 8);
1485 if (!csr) { 1484 if (!csr) {
1486 printk(KERN_WARNING "PCI: Can't map %s e100 registers\n", 1485 printk(KERN_WARNING "PCI: Can't map %s e100 registers\n",
1487 pci_name(dev)); 1486 pci_name(dev));
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c
index d5d8caba3560..ab13824df856 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -451,7 +451,7 @@ static int asd_build_smp_ascb(struct asd_ascb *ascb, struct sas_task *task,
451 struct scb *scb; 451 struct scb *scb;
452 452
453 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1, 453 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_req, 1,
454 PCI_DMA_FROMDEVICE); 454 PCI_DMA_TODEVICE);
455 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1, 455 pci_map_sg(asd_ha->pcidev, &task->smp_task.smp_resp, 1,
456 PCI_DMA_FROMDEVICE); 456 PCI_DMA_FROMDEVICE);
457 457
@@ -486,7 +486,7 @@ static void asd_unbuild_smp_ascb(struct asd_ascb *a)
486 486
487 BUG_ON(!task); 487 BUG_ON(!task);
488 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1, 488 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_req, 1,
489 PCI_DMA_FROMDEVICE); 489 PCI_DMA_TODEVICE);
490 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1, 490 pci_unmap_sg(a->ha->pcidev, &task->smp_task.smp_resp, 1,
491 PCI_DMA_FROMDEVICE); 491 PCI_DMA_FROMDEVICE);
492} 492}
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 3907f6718ede..da56163c30a8 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1753,6 +1753,14 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len)
1753 1753
1754 *len = 0; 1754 *len = 0;
1755 1755
1756 if (scsi_sg_count(cmd) == 1 && !adapter->has_64bit_addr) {
1757 sg = scsi_sglist(cmd);
1758 scb->dma_h_bulkdata = sg_dma_address(sg);
1759 *buf = (u32)scb->dma_h_bulkdata;
1760 *len = sg_dma_len(sg);
1761 return 0;
1762 }
1763
1756 scsi_for_each_sg(cmd, sg, sgcnt, idx) { 1764 scsi_for_each_sg(cmd, sg, sgcnt, idx) {
1757 if (adapter->has_64bit_addr) { 1765 if (adapter->has_64bit_addr) {
1758 scb->sgl64[idx].address = sg_dma_address(sg); 1766 scb->sgl64[idx].address = sg_dma_address(sg);
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
index a99e45e2b6d8..2a6477834c3e 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
@@ -37,6 +37,6 @@ static inline void cpm_set_smc_fcr(volatile smc_uart_t * up)
37 up->smc_tfcr = SMC_EB; 37 up->smc_tfcr = SMC_EB;
38} 38}
39 39
40#define DPRAM_BASE ((unsigned char *)&cpmp->cp_dpmem[0]) 40#define DPRAM_BASE ((unsigned char *)cpm_dpram_addr(0))
41 41
42#endif 42#endif
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index a0ea43598515..7c8d78fbbbfb 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -943,6 +943,7 @@ static struct pcmcia_device_id serial_ids[] = {
943 PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), 943 PCMCIA_MFC_DEVICE_PROD_ID12(1,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4),
944 PCMCIA_MFC_DEVICE_PROD_ID12(2,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), 944 PCMCIA_MFC_DEVICE_PROD_ID12(2,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4),
945 PCMCIA_MFC_DEVICE_PROD_ID12(3,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4), 945 PCMCIA_MFC_DEVICE_PROD_ID12(3,"Elan","Serial Port: SL432",0x3beb8cf2,0x1cce7ac4),
946 PCMCIA_DEVICE_MANF_CARD(0x0279, 0x950b),
946 /* too generic */ 947 /* too generic */
947 /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */ 948 /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */
948 /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */ 949 /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */