aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ata_piix.c1
-rw-r--r--drivers/ata/libata-core.c77
-rw-r--r--drivers/ata/libata-eh.c148
-rw-r--r--drivers/ata/libata-scsi.c10
-rw-r--r--drivers/ata/pata_hpt37x.c49
-rw-r--r--drivers/ata/pata_serverworks.c11
-rw-r--r--drivers/ata/sata_fsl.c159
-rw-r--r--drivers/ata/sata_promise.c2
-rw-r--r--drivers/base/dmapool.c1
-rw-r--r--drivers/block/paride/pt.c2
-rw-r--r--drivers/char/drm/drmP.h2
-rw-r--r--drivers/char/drm/drm_ioctl.c2
-rw-r--r--drivers/char/drm/drm_os_linux.h8
-rw-r--r--drivers/char/drm/radeon_cp.c5
-rw-r--r--drivers/char/drm/radeon_drv.h1
-rw-r--r--drivers/char/drm/savage_bci.c3
-rw-r--r--drivers/char/drm/sis_mm.c1
-rw-r--r--drivers/char/tty_ioctl.c170
-rw-r--r--drivers/char/virtio_console.c2
-rw-r--r--drivers/firewire/fw-sbp2.c11
-rw-r--r--drivers/hid/hid-input.c22
-rw-r--r--drivers/hid/usbhid/hid-quirks.c8
-rw-r--r--drivers/hid/usbhid/hiddev.c2
-rw-r--r--drivers/ide/Kconfig22
-rw-r--r--drivers/ide/ide-dma.c5
-rw-r--r--drivers/ide/ide-io.c5
-rw-r--r--drivers/ide/ide-iops.c8
-rw-r--r--drivers/ide/ide-probe.c5
-rw-r--r--drivers/ide/ide-taskfile.c3
-rw-r--r--drivers/ide/pci/piix.c1
-rw-r--r--drivers/ieee1394/dma.c3
-rw-r--r--drivers/ieee1394/sbp2.c2
-rw-r--r--drivers/input/joystick/xpad.c2
-rw-r--r--drivers/input/misc/pcspkr.c2
-rw-r--r--drivers/input/mouse/appletouch.c125
-rw-r--r--drivers/input/mouse/inport.c2
-rw-r--r--drivers/input/mouse/logibm.c2
-rw-r--r--drivers/input/serio/hp_sdc.c4
-rw-r--r--drivers/isdn/hisax/Kconfig18
-rw-r--r--drivers/isdn/hisax/avm_pci.c4
-rw-r--r--drivers/isdn/hisax/diva.c6
-rw-r--r--drivers/isdn/hisax/elsa.c6
-rw-r--r--drivers/isdn/hisax/gazel.c4
-rw-r--r--drivers/isdn/hisax/niccy.c7
-rw-r--r--drivers/isdn/hisax/sedlbauer.c4
-rw-r--r--drivers/leds/leds-gpio.c20
-rw-r--r--drivers/md/dm-table.c7
-rw-r--r--drivers/md/raid5.c14
-rw-r--r--drivers/media/Kconfig1
-rw-r--r--drivers/media/common/saa7146_core.c70
-rw-r--r--drivers/media/dvb/frontends/mt2131.c2
-rw-r--r--drivers/media/dvb/frontends/s5h1409.c96
-rw-r--r--drivers/media/dvb/frontends/stv0297.c22
-rw-r--r--drivers/media/dvb/frontends/tda10021.c6
-rw-r--r--drivers/media/dvb/frontends/ves1820.c2
-rw-r--r--drivers/media/dvb/ttpci/Kconfig2
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c6
-rw-r--r--drivers/media/video/bt8xx/bttvp.h2
-rw-r--r--drivers/media/video/cafe_ccic.c6
-rw-r--r--drivers/media/video/cx23885/Kconfig2
-rw-r--r--drivers/media/video/cx88/Kconfig2
-rw-r--r--drivers/media/video/em28xx/Kconfig2
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c6
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c1
-rw-r--r--drivers/media/video/planb.c8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-main.c5
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c8
-rw-r--r--drivers/media/video/saa7134/Kconfig2
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c4
-rw-r--r--drivers/media/video/tuner-core.c6
-rw-r--r--drivers/media/video/tvp5150.c16
-rw-r--r--drivers/message/i2o/i2o_block.c4
-rw-r--r--drivers/mmc/core/core.c1
-rw-r--r--drivers/mmc/core/mmc_ops.c1
-rw-r--r--drivers/mmc/core/sd_ops.c1
-rw-r--r--drivers/mmc/core/sdio_ops.c1
-rw-r--r--drivers/net/82596.c3
-rw-r--r--drivers/net/Kconfig11
-rw-r--r--drivers/net/fec_mpc52xx.c4
-rw-r--r--drivers/net/hamradio/6pack.c26
-rw-r--r--drivers/net/irda/irtty-sir.c7
-rw-r--r--drivers/net/meth.c1
-rw-r--r--drivers/net/myri10ge/myri10ge.c6
-rw-r--r--drivers/net/phy/marvell.c23
-rw-r--r--drivers/net/phy/phy_device.c2
-rw-r--r--drivers/net/ppp_async.c10
-rw-r--r--drivers/net/ppp_synctty.c10
-rw-r--r--drivers/net/pppol2tp.c25
-rw-r--r--drivers/net/rrunner.c18
-rw-r--r--drivers/net/slip.c8
-rw-r--r--drivers/net/sunhme.c4
-rw-r--r--drivers/net/tg3.c9
-rw-r--r--drivers/net/usb/Kconfig9
-rw-r--r--drivers/net/usb/usbnet.c7
-rw-r--r--drivers/net/wan/x25_asy.c6
-rw-r--r--drivers/net/wireless/strip.c10
-rw-r--r--drivers/pci/Kconfig11
-rw-r--r--drivers/pci/hotplug/Kconfig6
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c16
-rw-r--r--drivers/pci/msi.c18
-rw-r--r--drivers/pci/pci-driver.c5
-rw-r--r--drivers/pci/quirks.c51
-rw-r--r--drivers/pci/search.c9
-rw-r--r--drivers/rtc/rtc-cmos.c3
-rw-r--r--drivers/rtc/rtc-m48t59.c6
-rw-r--r--drivers/s390/block/dcssblk.c9
-rw-r--r--drivers/s390/cio/cmf.c4
-rw-r--r--drivers/s390/cio/device.c2
-rw-r--r--drivers/s390/net/smsgiucv.c4
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c19
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c5
-rw-r--r--drivers/scsi/osst.c6
-rw-r--r--drivers/scsi/scsi_lib.c138
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/scsi_sysfs.c47
-rw-r--r--drivers/serial/8250_early.c4
-rw-r--r--drivers/serial/8250_pci.c5
-rw-r--r--drivers/sh/maple/maple.c3
-rw-r--r--drivers/telephony/phonedev.c5
-rw-r--r--drivers/usb/core/buffer.c1
-rw-r--r--drivers/usb/core/hcd.c1
-rw-r--r--drivers/usb/core/usb.c2
-rw-r--r--drivers/watchdog/alim1535_wdt.c4
-rw-r--r--drivers/watchdog/davinci_wdt.c6
-rw-r--r--drivers/watchdog/i6300esb.c4
-rw-r--r--drivers/watchdog/iTCO_wdt.c114
-rw-r--r--drivers/watchdog/ib700wdt.c4
-rw-r--r--drivers/watchdog/machzwd.c7
-rw-r--r--drivers/watchdog/mpc83xx_wdt.c5
-rw-r--r--drivers/watchdog/pc87413_wdt.c4
-rw-r--r--drivers/watchdog/pnx4008_wdt.c6
-rw-r--r--drivers/watchdog/sbc8360.c3
-rw-r--r--drivers/watchdog/sc1200wdt.c3
-rw-r--r--drivers/watchdog/sc520_wdt.c4
-rw-r--r--drivers/watchdog/smsc37b787_wdt.c4
-rw-r--r--drivers/watchdog/w83627hf_wdt.c4
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
-rw-r--r--drivers/watchdog/w83877f_wdt.c4
-rw-r--r--drivers/watchdog/w83977f_wdt.c4
-rw-r--r--drivers/watchdog/wafer5823wdt.c4
-rw-r--r--drivers/watchdog/wdt.c3
-rw-r--r--drivers/watchdog/wdt977.c4
-rw-r--r--drivers/watchdog/wdt_pci.c6
147 files changed, 1255 insertions, 813 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index a4b2cb29f46..f08cca21702 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -621,6 +621,7 @@ struct ich_laptop {
621static const struct ich_laptop ich_laptop[] = { 621static const struct ich_laptop ich_laptop[] = {
622 /* devid, subvendor, subdev */ 622 /* devid, subvendor, subdev */
623 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ 623 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */
624 { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */
624 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 625 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
625 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 626 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
626 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ 627 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 63035d71a61..ec3ce120a51 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -676,10 +676,11 @@ static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
676 if (rc) 676 if (rc)
677 return rc; 677 return rc;
678 678
679 /* disable DIPM */ 679 /*
680 if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM)) 680 * we don't have to disable DIPM since IPM flags
681 err_mask = ata_dev_set_feature(dev, 681 * disallow transitions to SLUMBER, which effectively
682 SETFEATURES_SATA_DISABLE, SATA_DIPM); 682 * disable DIPM if it does not support PARTIAL
683 */
683 break; 684 break;
684 case NOT_AVAILABLE: 685 case NOT_AVAILABLE:
685 case MAX_PERFORMANCE: 686 case MAX_PERFORMANCE:
@@ -689,10 +690,11 @@ static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
689 if (rc) 690 if (rc)
690 return rc; 691 return rc;
691 692
692 /* disable DIPM */ 693 /*
693 if (ata_dev_enabled(dev) && (dev->flags & ATA_DFLAG_DIPM)) 694 * we don't have to disable DIPM since IPM flags
694 err_mask = ata_dev_set_feature(dev, 695 * disallow all transitions which effectively
695 SETFEATURES_SATA_DISABLE, SATA_DIPM); 696 * disable DIPM anyway.
697 */
696 break; 698 break;
697 } 699 }
698 700
@@ -704,8 +706,8 @@ static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
704 706
705/** 707/**
706 * ata_dev_enable_pm - enable SATA interface power management 708 * ata_dev_enable_pm - enable SATA interface power management
707 * @device - device to enable ipm for 709 * @dev: device to enable power management
708 * @policy - the link power management policy 710 * @policy: the link power management policy
709 * 711 *
710 * Enable SATA Interface power management. This will enable 712 * Enable SATA Interface power management. This will enable
711 * Device Interface Power Management (DIPM) for min_power 713 * Device Interface Power Management (DIPM) for min_power
@@ -735,9 +737,10 @@ enable_pm_out:
735 return /* rc */; /* hopefully we can use 'rc' eventually */ 737 return /* rc */; /* hopefully we can use 'rc' eventually */
736} 738}
737 739
740#ifdef CONFIG_PM
738/** 741/**
739 * ata_dev_disable_pm - disable SATA interface power management 742 * ata_dev_disable_pm - disable SATA interface power management
740 * @device - device to enable ipm for 743 * @dev: device to disable power management
741 * 744 *
742 * Disable SATA Interface power management. This will disable 745 * Disable SATA Interface power management. This will disable
743 * Device Interface Power Management (DIPM) without changing 746 * Device Interface Power Management (DIPM) without changing
@@ -755,6 +758,7 @@ static void ata_dev_disable_pm(struct ata_device *dev)
755 if (ap->ops->disable_pm) 758 if (ap->ops->disable_pm)
756 ap->ops->disable_pm(ap); 759 ap->ops->disable_pm(ap);
757} 760}
761#endif /* CONFIG_PM */
758 762
759void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy) 763void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
760{ 764{
@@ -764,6 +768,7 @@ void ata_lpm_schedule(struct ata_port *ap, enum link_pm policy)
764 ata_port_schedule_eh(ap); 768 ata_port_schedule_eh(ap);
765} 769}
766 770
771#ifdef CONFIG_PM
767static void ata_lpm_enable(struct ata_host *host) 772static void ata_lpm_enable(struct ata_host *host)
768{ 773{
769 struct ata_link *link; 774 struct ata_link *link;
@@ -789,6 +794,7 @@ static void ata_lpm_disable(struct ata_host *host)
789 ata_lpm_schedule(ap, ap->pm_policy); 794 ata_lpm_schedule(ap, ap->pm_policy);
790 } 795 }
791} 796}
797#endif /* CONFIG_PM */
792 798
793 799
794/** 800/**
@@ -2300,6 +2306,10 @@ int ata_dev_configure(struct ata_device *dev)
2300 dev->max_sectors = ATA_MAX_SECTORS; 2306 dev->max_sectors = ATA_MAX_SECTORS;
2301 } 2307 }
2302 2308
2309 if ((dev->class == ATA_DEV_ATAPI) &&
2310 (atapi_command_packet_set(id) == TYPE_TAPE))
2311 dev->max_sectors = ATA_MAX_SECTORS_TAPE;
2312
2303 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) 2313 if (dev->horkage & ATA_HORKAGE_MAX_SEC_128)
2304 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, 2314 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
2305 dev->max_sectors); 2315 dev->max_sectors);
@@ -2743,17 +2753,27 @@ int sata_down_spd_limit(struct ata_link *link)
2743 2753
2744static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol) 2754static int __sata_set_spd_needed(struct ata_link *link, u32 *scontrol)
2745{ 2755{
2746 u32 spd, limit; 2756 struct ata_link *host_link = &link->ap->link;
2757 u32 limit, target, spd;
2758
2759 limit = link->sata_spd_limit;
2760
2761 /* Don't configure downstream link faster than upstream link.
2762 * It doesn't speed up anything and some PMPs choke on such
2763 * configuration.
2764 */
2765 if (!ata_is_host_link(link) && host_link->sata_spd)
2766 limit &= (1 << host_link->sata_spd) - 1;
2747 2767
2748 if (link->sata_spd_limit == UINT_MAX) 2768 if (limit == UINT_MAX)
2749 limit = 0; 2769 target = 0;
2750 else 2770 else
2751 limit = fls(link->sata_spd_limit); 2771 target = fls(limit);
2752 2772
2753 spd = (*scontrol >> 4) & 0xf; 2773 spd = (*scontrol >> 4) & 0xf;
2754 *scontrol = (*scontrol & ~0xf0) | ((limit & 0xf) << 4); 2774 *scontrol = (*scontrol & ~0xf0) | ((target & 0xf) << 4);
2755 2775
2756 return spd != limit; 2776 return spd != target;
2757} 2777}
2758 2778
2759/** 2779/**
@@ -2776,7 +2796,7 @@ int sata_set_spd_needed(struct ata_link *link)
2776 u32 scontrol; 2796 u32 scontrol;
2777 2797
2778 if (sata_scr_read(link, SCR_CONTROL, &scontrol)) 2798 if (sata_scr_read(link, SCR_CONTROL, &scontrol))
2779 return 0; 2799 return 1;
2780 2800
2781 return __sata_set_spd_needed(link, &scontrol); 2801 return __sata_set_spd_needed(link, &scontrol);
2782} 2802}
@@ -4221,6 +4241,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4221 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4241 { "ST340823A", NULL, ATA_HORKAGE_HPA_SIZE, },
4222 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, }, 4242 { "ST320413A", NULL, ATA_HORKAGE_HPA_SIZE, },
4223 4243
4244 /* Devices which get the IVB wrong */
4245 { "QUANTUM FIREBALLlct10 05", "A03.0900", ATA_HORKAGE_IVB, },
4246 { "TSSTcorp CDDVDW SH-S202J", "SB00", ATA_HORKAGE_IVB, },
4247
4224 /* End Marker */ 4248 /* End Marker */
4225 { } 4249 { }
4226}; 4250};
@@ -4282,6 +4306,21 @@ static int ata_dma_blacklisted(const struct ata_device *dev)
4282} 4306}
4283 4307
4284/** 4308/**
4309 * ata_is_40wire - check drive side detection
4310 * @dev: device
4311 *
4312 * Perform drive side detection decoding, allowing for device vendors
4313 * who can't follow the documentation.
4314 */
4315
4316static int ata_is_40wire(struct ata_device *dev)
4317{
4318 if (dev->horkage & ATA_HORKAGE_IVB)
4319 return ata_drive_40wire_relaxed(dev->id);
4320 return ata_drive_40wire(dev->id);
4321}
4322
4323/**
4285 * ata_dev_xfermask - Compute supported xfermask of the given device 4324 * ata_dev_xfermask - Compute supported xfermask of the given device
4286 * @dev: Device to compute xfermask for 4325 * @dev: Device to compute xfermask for
4287 * 4326 *
@@ -4350,7 +4389,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
4350 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) 4389 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA))
4351 /* UDMA/44 or higher would be available */ 4390 /* UDMA/44 or higher would be available */
4352 if ((ap->cbl == ATA_CBL_PATA40) || 4391 if ((ap->cbl == ATA_CBL_PATA40) ||
4353 (ata_drive_40wire(dev->id) && 4392 (ata_is_40wire(dev) &&
4354 (ap->cbl == ATA_CBL_PATA_UNK || 4393 (ap->cbl == ATA_CBL_PATA_UNK ||
4355 ap->cbl == ATA_CBL_PATA80))) { 4394 ap->cbl == ATA_CBL_PATA80))) {
4356 ata_dev_printk(dev, KERN_WARNING, 4395 ata_dev_printk(dev, KERN_WARNING,
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 8d64f8fd8f1..ed8813b222a 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1747,6 +1747,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1747{ 1747{
1748 struct ata_port *ap = link->ap; 1748 struct ata_port *ap = link->ap;
1749 struct ata_eh_context *ehc = &link->eh_context; 1749 struct ata_eh_context *ehc = &link->eh_context;
1750 struct ata_device *dev;
1750 unsigned int all_err_mask = 0; 1751 unsigned int all_err_mask = 0;
1751 int tag, is_io = 0; 1752 int tag, is_io = 0;
1752 u32 serror; 1753 u32 serror;
@@ -1818,18 +1819,24 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1818 (!is_io && (all_err_mask & ~AC_ERR_DEV))) 1819 (!is_io && (all_err_mask & ~AC_ERR_DEV)))
1819 ehc->i.action |= ATA_EH_REVALIDATE; 1820 ehc->i.action |= ATA_EH_REVALIDATE;
1820 1821
1821 /* if we have offending qcs and the associated failed device */ 1822 /* If we have offending qcs and the associated failed device,
1823 * perform per-dev EH action only on the offending device.
1824 */
1822 if (ehc->i.dev) { 1825 if (ehc->i.dev) {
1823 /* speed down */
1824 ehc->i.action |= ata_eh_speed_down(ehc->i.dev, is_io,
1825 all_err_mask);
1826
1827 /* perform per-dev EH action only on the offending device */
1828 ehc->i.dev_action[ehc->i.dev->devno] |= 1826 ehc->i.dev_action[ehc->i.dev->devno] |=
1829 ehc->i.action & ATA_EH_PERDEV_MASK; 1827 ehc->i.action & ATA_EH_PERDEV_MASK;
1830 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1828 ehc->i.action &= ~ATA_EH_PERDEV_MASK;
1831 } 1829 }
1832 1830
1831 /* consider speeding down */
1832 dev = ehc->i.dev;
1833 if (!dev && ata_link_max_devices(link) == 1 &&
1834 ata_dev_enabled(link->device))
1835 dev = link->device;
1836
1837 if (dev)
1838 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
1839
1833 DPRINTK("EXIT\n"); 1840 DPRINTK("EXIT\n");
1834} 1841}
1835 1842
@@ -2065,16 +2072,19 @@ int ata_eh_reset(struct ata_link *link, int classify,
2065 ata_prereset_fn_t prereset, ata_reset_fn_t softreset, 2072 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
2066 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 2073 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
2067{ 2074{
2075 const int max_tries = ARRAY_SIZE(ata_eh_reset_timeouts);
2068 struct ata_port *ap = link->ap; 2076 struct ata_port *ap = link->ap;
2069 struct ata_eh_context *ehc = &link->eh_context; 2077 struct ata_eh_context *ehc = &link->eh_context;
2070 unsigned int *classes = ehc->classes; 2078 unsigned int *classes = ehc->classes;
2079 unsigned int lflags = link->flags;
2071 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 2080 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
2072 int try = 0; 2081 int try = 0;
2073 struct ata_device *dev; 2082 struct ata_device *dev;
2074 unsigned long deadline; 2083 unsigned long deadline, now;
2075 unsigned int tmp_action; 2084 unsigned int tmp_action;
2076 ata_reset_fn_t reset; 2085 ata_reset_fn_t reset;
2077 unsigned long flags; 2086 unsigned long flags;
2087 u32 sstatus;
2078 int rc; 2088 int rc;
2079 2089
2080 /* about to reset */ 2090 /* about to reset */
@@ -2106,7 +2116,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
2106 /* Determine which reset to use and record in ehc->i.action. 2116 /* Determine which reset to use and record in ehc->i.action.
2107 * prereset() may examine and modify it. 2117 * prereset() may examine and modify it.
2108 */ 2118 */
2109 if (softreset && (!hardreset || (!(link->flags & ATA_LFLAG_NO_SRST) && 2119 if (softreset && (!hardreset || (!(lflags & ATA_LFLAG_NO_SRST) &&
2110 !sata_set_spd_needed(link) && 2120 !sata_set_spd_needed(link) &&
2111 !(ehc->i.action & ATA_EH_HARDRESET)))) 2121 !(ehc->i.action & ATA_EH_HARDRESET))))
2112 tmp_action = ATA_EH_SOFTRESET; 2122 tmp_action = ATA_EH_SOFTRESET;
@@ -2181,82 +2191,64 @@ int ata_eh_reset(struct ata_link *link, int classify,
2181 "follow-up softreset required " 2191 "follow-up softreset required "
2182 "but no softreset avaliable\n"); 2192 "but no softreset avaliable\n");
2183 rc = -EINVAL; 2193 rc = -EINVAL;
2184 goto out; 2194 goto fail;
2185 } 2195 }
2186 2196
2187 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK); 2197 ata_eh_about_to_do(link, NULL, ATA_EH_RESET_MASK);
2188 rc = ata_do_reset(link, reset, classes, deadline); 2198 rc = ata_do_reset(link, reset, classes, deadline);
2189
2190 if (rc == 0 && classify && classes[0] == ATA_DEV_UNKNOWN &&
2191 !(link->flags & ATA_LFLAG_ASSUME_CLASS)) {
2192 ata_link_printk(link, KERN_ERR,
2193 "classification failed\n");
2194 rc = -EINVAL;
2195 goto out;
2196 }
2197 } 2199 }
2198 2200
2199 /* if we skipped follow-up srst, clear rc */ 2201 /* -EAGAIN can happen if we skipped followup SRST */
2200 if (rc == -EAGAIN) 2202 if (rc && rc != -EAGAIN)
2201 rc = 0; 2203 goto fail;
2202
2203 if (rc && rc != -ERESTART && try < ARRAY_SIZE(ata_eh_reset_timeouts)) {
2204 unsigned long now = jiffies;
2205
2206 if (time_before(now, deadline)) {
2207 unsigned long delta = deadline - jiffies;
2208
2209 ata_link_printk(link, KERN_WARNING, "reset failed "
2210 "(errno=%d), retrying in %u secs\n",
2211 rc, (jiffies_to_msecs(delta) + 999) / 1000);
2212 2204
2213 while (delta) 2205 /* was classification successful? */
2214 delta = schedule_timeout_uninterruptible(delta); 2206 if (classify && classes[0] == ATA_DEV_UNKNOWN &&
2207 !(lflags & ATA_LFLAG_ASSUME_CLASS)) {
2208 if (try < max_tries) {
2209 ata_link_printk(link, KERN_WARNING,
2210 "classification failed\n");
2211 rc = -EINVAL;
2212 goto fail;
2215 } 2213 }
2216 2214
2217 if (rc == -EPIPE || 2215 ata_link_printk(link, KERN_WARNING,
2218 try == ARRAY_SIZE(ata_eh_reset_timeouts) - 1) 2216 "classfication failed, assuming ATA\n");
2219 sata_down_spd_limit(link); 2217 lflags |= ATA_LFLAG_ASSUME_ATA;
2220 if (hardreset)
2221 reset = hardreset;
2222 goto retry;
2223 } 2218 }
2224 2219
2225 if (rc == 0) { 2220 ata_link_for_each_dev(dev, link) {
2226 u32 sstatus; 2221 /* After the reset, the device state is PIO 0 and the
2222 * controller state is undefined. Reset also wakes up
2223 * drives from sleeping mode.
2224 */
2225 dev->pio_mode = XFER_PIO_0;
2226 dev->flags &= ~ATA_DFLAG_SLEEPING;
2227 2227
2228 ata_link_for_each_dev(dev, link) { 2228 if (ata_link_offline(link))
2229 /* After the reset, the device state is PIO 0 2229 continue;
2230 * and the controller state is undefined.
2231 * Reset also wakes up drives from sleeping
2232 * mode.
2233 */
2234 dev->pio_mode = XFER_PIO_0;
2235 dev->flags &= ~ATA_DFLAG_SLEEPING;
2236 2230
2237 if (ata_link_offline(link)) 2231 /* apply class override and convert UNKNOWN to NONE */
2238 continue; 2232 if (lflags & ATA_LFLAG_ASSUME_ATA)
2233 classes[dev->devno] = ATA_DEV_ATA;
2234 else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2235 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2236 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2237 classes[dev->devno] = ATA_DEV_NONE;
2238 }
2239 2239
2240 /* apply class override and convert UNKNOWN to NONE */ 2240 /* record current link speed */
2241 if (link->flags & ATA_LFLAG_ASSUME_ATA) 2241 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
2242 classes[dev->devno] = ATA_DEV_ATA; 2242 link->sata_spd = (sstatus >> 4) & 0xf;
2243 else if (link->flags & ATA_LFLAG_ASSUME_SEMB)
2244 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2245 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2246 classes[dev->devno] = ATA_DEV_NONE;
2247 }
2248 2243
2249 /* record current link speed */ 2244 if (postreset)
2250 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) 2245 postreset(link, classes);
2251 link->sata_spd = (sstatus >> 4) & 0xf;
2252 2246
2253 if (postreset) 2247 /* reset successful, schedule revalidation */
2254 postreset(link, classes); 2248 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2249 ehc->i.action |= ATA_EH_REVALIDATE;
2255 2250
2256 /* reset successful, schedule revalidation */ 2251 rc = 0;
2257 ata_eh_done(link, NULL, ehc->i.action & ATA_EH_RESET_MASK);
2258 ehc->i.action |= ATA_EH_REVALIDATE;
2259 }
2260 out: 2252 out:
2261 /* clear hotplug flag */ 2253 /* clear hotplug flag */
2262 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; 2254 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
@@ -2266,6 +2258,28 @@ int ata_eh_reset(struct ata_link *link, int classify,
2266 spin_unlock_irqrestore(ap->lock, flags); 2258 spin_unlock_irqrestore(ap->lock, flags);
2267 2259
2268 return rc; 2260 return rc;
2261
2262 fail:
2263 if (rc == -ERESTART || try >= max_tries)
2264 goto out;
2265
2266 now = jiffies;
2267 if (time_before(now, deadline)) {
2268 unsigned long delta = deadline - now;
2269
2270 ata_link_printk(link, KERN_WARNING, "reset failed "
2271 "(errno=%d), retrying in %u secs\n",
2272 rc, (jiffies_to_msecs(delta) + 999) / 1000);
2273
2274 while (delta)
2275 delta = schedule_timeout_uninterruptible(delta);
2276 }
2277
2278 if (rc == -EPIPE || try == max_tries - 1)
2279 sata_down_spd_limit(link);
2280 if (hardreset)
2281 reset = hardreset;
2282 goto retry;
2269} 2283}
2270 2284
2271static int ata_eh_revalidate_and_attach(struct ata_link *link, 2285static int ata_eh_revalidate_and_attach(struct ata_link *link,
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index fc89590d377..94144ed50a6 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -120,7 +120,7 @@ static const struct {
120 { MEDIUM_POWER, "medium_power" }, 120 { MEDIUM_POWER, "medium_power" },
121}; 121};
122 122
123const char *ata_scsi_lpm_get(enum link_pm policy) 123static const char *ata_scsi_lpm_get(enum link_pm policy)
124{ 124{
125 int i; 125 int i;
126 126
@@ -841,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1); 841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
842 } 842 }
843 843
844 if (dev->flags & ATA_DFLAG_AN)
845 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
846
844 if (dev->flags & ATA_DFLAG_NCQ) { 847 if (dev->flags & ATA_DFLAG_NCQ) {
845 int depth; 848 int depth;
846 849
@@ -3296,10 +3299,9 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
3296 */ 3299 */
3297void ata_scsi_media_change_notify(struct ata_device *dev) 3300void ata_scsi_media_change_notify(struct ata_device *dev)
3298{ 3301{
3299#ifdef OTHER_AN_PATCHES_HAVE_BEEN_APPLIED
3300 if (dev->sdev) 3302 if (dev->sdev)
3301 scsi_device_event_notify(dev->sdev, SDEV_MEDIA_CHANGE); 3303 sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE,
3302#endif 3304 GFP_ATOMIC);
3303} 3305}
3304 3306
3305/** 3307/**
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index e61cb1fd57b..3816b8605e0 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -295,7 +295,7 @@ static unsigned long hpt370_filter(struct ata_device *adev, unsigned long mask)
295 295
296static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask) 296static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask)
297{ 297{
298 if (adev->class != ATA_DEV_ATA) { 298 if (adev->class == ATA_DEV_ATA) {
299 if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5)) 299 if (hpt_dma_blacklisted(adev, "UDMA100", bad_ata100_5))
300 mask &= ~ (0x1F << ATA_SHIFT_UDMA); 300 mask &= ~ (0x1F << ATA_SHIFT_UDMA);
301 } 301 }
@@ -359,28 +359,25 @@ static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline)
359 { 0x50, 1, 0x04, 0x04 }, 359 { 0x50, 1, 0x04, 0x04 },
360 { 0x54, 1, 0x04, 0x04 } 360 { 0x54, 1, 0x04, 0x04 }
361 }; 361 };
362 u16 mcr3, mcr6; 362 u16 mcr3;
363 u8 ata66; 363 u8 ata66;
364 struct ata_port *ap = link->ap; 364 struct ata_port *ap = link->ap;
365 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 365 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
366 unsigned int mcrbase = 0x50 + 4 * ap->port_no;
366 367
367 if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) 368 if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no]))
368 return -ENOENT; 369 return -ENOENT;
369 370
370 /* Do the extra channel work */ 371 /* Do the extra channel work */
371 pci_read_config_word(pdev, 0x52, &mcr3); 372 pci_read_config_word(pdev, mcrbase + 2, &mcr3);
372 pci_read_config_word(pdev, 0x56, &mcr6);
373 /* Set bit 15 of 0x52 to enable TCBLID as input 373 /* Set bit 15 of 0x52 to enable TCBLID as input
374 Set bit 15 of 0x56 to enable FCBLID as input
375 */ 374 */
376 pci_write_config_word(pdev, 0x52, mcr3 | 0x8000); 375 pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000);
377 pci_write_config_word(pdev, 0x56, mcr6 | 0x8000);
378 pci_read_config_byte(pdev, 0x5A, &ata66); 376 pci_read_config_byte(pdev, 0x5A, &ata66);
379 /* Reset TCBLID/FCBLID to output */ 377 /* Reset TCBLID/FCBLID to output */
380 pci_write_config_word(pdev, 0x52, mcr3); 378 pci_write_config_word(pdev, 0x52, mcr3);
381 pci_write_config_word(pdev, 0x56, mcr6);
382 379
383 if (ata66 & (1 << ap->port_no)) 380 if (ata66 & (2 >> ap->port_no))
384 ap->cbl = ATA_CBL_PATA40; 381 ap->cbl = ATA_CBL_PATA40;
385 else 382 else
386 ap->cbl = ATA_CBL_PATA80; 383 ap->cbl = ATA_CBL_PATA80;
@@ -844,6 +841,25 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev)
844 /* Never went stable */ 841 /* Never went stable */
845 return 0; 842 return 0;
846} 843}
844
845static u32 hpt374_read_freq(struct pci_dev *pdev)
846{
847 u32 freq;
848 unsigned long io_base = pci_resource_start(pdev, 4);
849 if (PCI_FUNC(pdev->devfn) & 1) {
850 struct pci_dev *pdev_0 = pci_get_slot(pdev->bus, pdev->devfn - 1);
851 /* Someone hot plugged the controller on us ? */
852 if (pdev_0 == NULL)
853 return 0;
854 io_base = pci_resource_start(pdev_0, 4);
855 freq = inl(io_base + 0x90);
856 pci_dev_put(pdev_0);
857 }
858 else
859 freq = inl(io_base + 0x90);
860 return freq;
861}
862
847/** 863/**
848 * hpt37x_init_one - Initialise an HPT37X/302 864 * hpt37x_init_one - Initialise an HPT37X/302
849 * @dev: PCI device 865 * @dev: PCI device
@@ -902,7 +918,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
902 .flags = ATA_FLAG_SLAVE_POSS, 918 .flags = ATA_FLAG_SLAVE_POSS,
903 .pio_mask = 0x1f, 919 .pio_mask = 0x1f,
904 .mwdma_mask = 0x07, 920 .mwdma_mask = 0x07,
905 .udma_mask = 0x0f, 921 .udma_mask = ATA_UDMA5,
906 .port_ops = &hpt370_port_ops 922 .port_ops = &hpt370_port_ops
907 }; 923 };
908 /* HPT370A - UDMA100 */ 924 /* HPT370A - UDMA100 */
@@ -911,7 +927,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
911 .flags = ATA_FLAG_SLAVE_POSS, 927 .flags = ATA_FLAG_SLAVE_POSS,
912 .pio_mask = 0x1f, 928 .pio_mask = 0x1f,
913 .mwdma_mask = 0x07, 929 .mwdma_mask = 0x07,
914 .udma_mask = 0x0f, 930 .udma_mask = ATA_UDMA5,
915 .port_ops = &hpt370a_port_ops 931 .port_ops = &hpt370a_port_ops
916 }; 932 };
917 /* HPT371, 372 and friends - UDMA133 */ 933 /* HPT371, 372 and friends - UDMA133 */
@@ -1047,9 +1063,16 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1047 outb(0x0e, iobase + 0x9c); 1063 outb(0x0e, iobase + 0x9c);
1048 1064
1049 /* Some devices do not let this value be accessed via PCI space 1065 /* Some devices do not let this value be accessed via PCI space
1050 according to the old driver */ 1066 according to the old driver. In addition we must use the value
1067 from FN 0 on the HPT374 */
1068
1069 if (chip_table == &hpt374) {
1070 freq = hpt374_read_freq(dev);
1071 if (freq == 0)
1072 return -ENODEV;
1073 } else
1074 freq = inl(iobase + 0x90);
1051 1075
1052 freq = inl(iobase + 0x90);
1053 if ((freq >> 12) != 0xABCDE) { 1076 if ((freq >> 12) != 0xABCDE) {
1054 int i; 1077 int i;
1055 u8 sr; 1078 u8 sr;
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index df68806df4b..8bed8887372 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -274,28 +274,27 @@ static void serverworks_set_dmamode(struct ata_port *ap, struct ata_device *adev
274{ 274{
275 static const u8 dma_mode[] = { 0x77, 0x21, 0x20 }; 275 static const u8 dma_mode[] = { 0x77, 0x21, 0x20 };
276 int offset = 1 + 2 * ap->port_no - adev->devno; 276 int offset = 1 + 2 * ap->port_no - adev->devno;
277 int devbits = (2 * ap->port_no + adev->devno); 277 int devbits = 2 * ap->port_no + adev->devno;
278 u8 ultra; 278 u8 ultra;
279 u8 ultra_cfg; 279 u8 ultra_cfg;
280 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 280 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
281 281
282 pci_read_config_byte(pdev, 0x54, &ultra_cfg); 282 pci_read_config_byte(pdev, 0x54, &ultra_cfg);
283 pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra);
284 ultra &= ~(0x0F << (adev->devno * 4));
283 285
284 if (adev->dma_mode >= XFER_UDMA_0) { 286 if (adev->dma_mode >= XFER_UDMA_0) {
285 pci_write_config_byte(pdev, 0x44 + offset, 0x20); 287 pci_write_config_byte(pdev, 0x44 + offset, 0x20);
286 288
287 pci_read_config_byte(pdev, 0x56 + ap->port_no, &ultra);
288 ultra &= ~(0x0F << (ap->port_no * 4));
289 ultra |= (adev->dma_mode - XFER_UDMA_0) 289 ultra |= (adev->dma_mode - XFER_UDMA_0)
290 << (ap->port_no * 4); 290 << (adev->devno * 4);
291 pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra);
292
293 ultra_cfg |= (1 << devbits); 291 ultra_cfg |= (1 << devbits);
294 } else { 292 } else {
295 pci_write_config_byte(pdev, 0x44 + offset, 293 pci_write_config_byte(pdev, 0x44 + offset,
296 dma_mode[adev->dma_mode - XFER_MW_DMA_0]); 294 dma_mode[adev->dma_mode - XFER_MW_DMA_0]);
297 ultra_cfg &= ~(1 << devbits); 295 ultra_cfg &= ~(1 << devbits);
298 } 296 }
297 pci_write_config_byte(pdev, 0x56 + ap->port_no, ultra);
299 pci_write_config_byte(pdev, 0x54, ultra_cfg); 298 pci_write_config_byte(pdev, 0x54, ultra_cfg);
300} 299}
301 300
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b4c37b9e413..d015b4adcfe 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -34,7 +34,8 @@ enum {
34 34
35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
37 ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY), 37 ATA_FLAG_NCQ),
38 SATA_FSL_HOST_LFLAGS = ATA_LFLAG_SKIP_D2H_BSY,
38 39
39 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH, 40 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH,
40 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */ 41 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */
@@ -264,10 +265,11 @@ struct sata_fsl_host_priv {
264 void __iomem *hcr_base; 265 void __iomem *hcr_base;
265 void __iomem *ssr_base; 266 void __iomem *ssr_base;
266 void __iomem *csr_base; 267 void __iomem *csr_base;
268 int irq;
267}; 269};
268 270
269static inline unsigned int sata_fsl_tag(unsigned int tag, 271static inline unsigned int sata_fsl_tag(unsigned int tag,
270 void __iomem * hcr_base) 272 void __iomem *hcr_base)
271{ 273{
272 /* We let libATA core do actual (queue) tag allocation */ 274 /* We let libATA core do actual (queue) tag allocation */
273 275
@@ -306,7 +308,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
306 pp->cmdslot[tag].prde_fis_len = 308 pp->cmdslot[tag].prde_fis_len =
307 cpu_to_le32((num_prde << 16) | (fis_len << 2)); 309 cpu_to_le32((num_prde << 16) | (fis_len << 2));
308 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03); 310 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03);
309 pp->cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag & 0x1F))); 311 pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F));
310 312
311 VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n", 313 VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n",
312 pp->cmdslot[tag].cda, 314 pp->cmdslot[tag].cda,
@@ -316,7 +318,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
316} 318}
317 319
318static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, 320static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
319 u32 * ttl, dma_addr_t cmd_desc_paddr) 321 u32 *ttl, dma_addr_t cmd_desc_paddr)
320{ 322{
321 struct scatterlist *sg; 323 struct scatterlist *sg;
322 unsigned int num_prde = 0; 324 unsigned int num_prde = 0;
@@ -353,7 +355,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
353 "s/g len unaligned : 0x%x\n", sg_len); 355 "s/g len unaligned : 0x%x\n", sg_len);
354 356
355 if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) && 357 if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) &&
356 !ata_sg_is_last(sg, qc)) { 358 (qc->n_iter + 1 != qc->n_elem)) {
357 VPRINTK("setting indirect prde\n"); 359 VPRINTK("setting indirect prde\n");
358 prd_ptr_to_indirect_ext = prd; 360 prd_ptr_to_indirect_ext = prd;
359 prd->dba = cpu_to_le32(indirect_ext_segment_paddr); 361 prd->dba = cpu_to_le32(indirect_ext_segment_paddr);
@@ -404,7 +406,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
404 cd = (struct command_desc *)pp->cmdentry + tag; 406 cd = (struct command_desc *)pp->cmdentry + tag;
405 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE; 407 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE;
406 408
407 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) & cd->cfis); 409 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis);
408 410
409 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n", 411 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
410 cd->cfis[0], cd->cfis[1], cd->cfis[2]); 412 cd->cfis[0], cd->cfis[1], cd->cfis[2]);
@@ -470,16 +472,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
470 472
471 switch (sc_reg_in) { 473 switch (sc_reg_in) {
472 case SCR_STATUS: 474 case SCR_STATUS:
473 sc_reg = 0;
474 break;
475 case SCR_ERROR: 475 case SCR_ERROR:
476 sc_reg = 1;
477 break;
478 case SCR_CONTROL: 476 case SCR_CONTROL:
479 sc_reg = 2;
480 break;
481 case SCR_ACTIVE: 477 case SCR_ACTIVE:
482 sc_reg = 3; 478 sc_reg = sc_reg_in;
483 break; 479 break;
484 default: 480 default:
485 return -EINVAL; 481 return -EINVAL;
@@ -487,7 +483,7 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
487 483
488 VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg); 484 VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg);
489 485
490 iowrite32(val, (void __iomem *)ssr_base + (sc_reg * 4)); 486 iowrite32(val, ssr_base + (sc_reg * 4));
491 return 0; 487 return 0;
492} 488}
493 489
@@ -500,16 +496,10 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
500 496
501 switch (sc_reg_in) { 497 switch (sc_reg_in) {
502 case SCR_STATUS: 498 case SCR_STATUS:
503 sc_reg = 0;
504 break;
505 case SCR_ERROR: 499 case SCR_ERROR:
506 sc_reg = 1;
507 break;
508 case SCR_CONTROL: 500 case SCR_CONTROL:
509 sc_reg = 2;
510 break;
511 case SCR_ACTIVE: 501 case SCR_ACTIVE:
512 sc_reg = 3; 502 sc_reg = sc_reg_in;
513 break; 503 break;
514 default: 504 default:
515 return -EINVAL; 505 return -EINVAL;
@@ -517,7 +507,7 @@ static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
517 507
518 VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg); 508 VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg);
519 509
520 *val = ioread32((void __iomem *)ssr_base + (sc_reg * 4)); 510 *val = ioread32(ssr_base + (sc_reg * 4));
521 return 0; 511 return 0;
522} 512}
523 513
@@ -571,7 +561,6 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
571 struct ata_port *ap) 561 struct ata_port *ap)
572{ 562{
573 struct sata_fsl_port_priv *pp = ap->private_data; 563 struct sata_fsl_port_priv *pp = ap->private_data;
574 u8 fis[6 * 4];
575 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 564 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
576 void __iomem *hcr_base = host_priv->hcr_base; 565 void __iomem *hcr_base = host_priv->hcr_base;
577 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); 566 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
@@ -579,8 +568,7 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
579 568
580 cd = pp->cmdentry + tag; 569 cd = pp->cmdentry + tag;
581 570
582 memcpy(fis, &cd->sfis, 6 * 4); /* should we use memcpy_from_io() */ 571 ata_tf_from_fis(cd->sfis, &pp->tf);
583 ata_tf_from_fis(fis, &pp->tf);
584} 572}
585 573
586static u8 sata_fsl_check_status(struct ata_port *ap) 574static u8 sata_fsl_check_status(struct ata_port *ap)
@@ -664,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
664 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); 652 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
665 VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA)); 653 VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA));
666 654
655#ifdef CONFIG_MPC8315_DS
667 /* 656 /*
668 * Workaround for 8315DS board 3gbps link-up issue, 657 * Workaround for 8315DS board 3gbps link-up issue,
669 * currently limit SATA port to GEN1 speed 658 * currently limit SATA port to GEN1 speed
@@ -676,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
676 sata_fsl_scr_read(ap, SCR_CONTROL, &temp); 665 sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
677 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", 666 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
678 temp); 667 temp);
668#endif
679 669
680 return 0; 670 return 0;
681} 671}
@@ -728,9 +718,10 @@ static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
728 return ata_dev_classify(&tf); 718 return ata_dev_classify(&tf);
729} 719}
730 720
731static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class, 721static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
732 unsigned long deadline) 722 unsigned long deadline)
733{ 723{
724 struct ata_port *ap = link->ap;
734 struct sata_fsl_port_priv *pp = ap->private_data; 725 struct sata_fsl_port_priv *pp = ap->private_data;
735 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 726 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
736 void __iomem *hcr_base = host_priv->hcr_base; 727 void __iomem *hcr_base = host_priv->hcr_base;
@@ -739,10 +730,6 @@ static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class,
739 u8 *cfis; 730 u8 *cfis;
740 u32 Serror; 731 u32 Serror;
741 int i = 0; 732 int i = 0;
742 struct ata_queued_cmd qc;
743 u8 *buf;
744 dma_addr_t dma_address;
745 struct scatterlist *sg;
746 unsigned long start_jiffies; 733 unsigned long start_jiffies;
747 734
748 DPRINTK("in xx_softreset\n"); 735 DPRINTK("in xx_softreset\n");
@@ -811,7 +798,7 @@ try_offline_again:
811 */ 798 */
812 799
813 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500); 800 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500);
814 if ((!(temp & 0x10)) || ata_port_offline(ap)) { 801 if ((!(temp & 0x10)) || ata_link_offline(link)) {
815 ata_port_printk(ap, KERN_WARNING, 802 ata_port_printk(ap, KERN_WARNING,
816 "No Device OR PHYRDY change,Hstatus = 0x%x\n", 803 "No Device OR PHYRDY change,Hstatus = 0x%x\n",
817 ioread32(hcr_base + HSTATUS)); 804 ioread32(hcr_base + HSTATUS));
@@ -842,13 +829,10 @@ try_offline_again:
842 * reached here, we can send a command to the target device 829 * reached here, we can send a command to the target device
843 */ 830 */
844 831
845 if (ap->sactive)
846 goto skip_srst_do_ncq_error_handling;
847
848 DPRINTK("Sending SRST/device reset\n"); 832 DPRINTK("Sending SRST/device reset\n");
849 833
850 ata_tf_init(ap->device, &tf); 834 ata_tf_init(link->device, &tf);
851 cfis = (u8 *) & pp->cmdentry->cfis; 835 cfis = (u8 *) &pp->cmdentry->cfis;
852 836
853 /* device reset/SRST is a control register update FIS, uses tag0 */ 837 /* device reset/SRST is a control register update FIS, uses tag0 */
854 sata_fsl_setup_cmd_hdr_entry(pp, 0, 838 sata_fsl_setup_cmd_hdr_entry(pp, 0,
@@ -912,76 +896,13 @@ try_offline_again:
912 * command bit of the CCreg 896 * command bit of the CCreg
913 */ 897 */
914 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */ 898 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
915 goto check_device_signature;
916
917skip_srst_do_ncq_error_handling:
918
919 VPRINTK("Sending read log ext(10h) command\n");
920
921 memset(&qc, 0, sizeof(struct ata_queued_cmd));
922 ata_tf_init(ap->device, &tf);
923
924 tf.command = ATA_CMD_READ_LOG_EXT;
925 tf.lbal = ATA_LOG_SATA_NCQ;
926 tf.nsect = 1;
927 tf.hob_nsect = 0;
928 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
929 tf.protocol = ATA_PROT_PIO;
930
931 qc.tag = ATA_TAG_INTERNAL;
932 qc.scsicmd = NULL;
933 qc.ap = ap;
934 qc.dev = ap->device;
935
936 qc.tf = tf;
937 qc.flags |= ATA_QCFLAG_RESULT_TF;
938 qc.dma_dir = DMA_FROM_DEVICE;
939
940 buf = ap->sector_buf;
941 ata_sg_init_one(&qc, buf, 1 * ATA_SECT_SIZE);
942
943 /*
944 * Need to DMA-map the memory buffer associated with the command
945 */
946
947 sg = qc.__sg;
948 dma_address = dma_map_single(ap->dev, qc.buf_virt,
949 sg->length, DMA_FROM_DEVICE);
950
951 sg_dma_address(sg) = dma_address;
952 sg_dma_len(sg) = sg->length;
953
954 VPRINTK("EH, addr = 0x%x, len = 0x%x\n", dma_address, sg->length);
955
956 sata_fsl_qc_prep(&qc);
957 sata_fsl_qc_issue(&qc);
958
959 temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
960 if (temp & 0x1) {
961 VPRINTK("READ_LOG_EXT_10H issue failed\n");
962
963 VPRINTK("READ_LOG@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
964 ioread32(CQ + hcr_base),
965 ioread32(CA + hcr_base), ioread32(CC + hcr_base));
966
967 sata_fsl_scr_read(ap, SCR_ERROR, &Serror);
968
969 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
970 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
971 VPRINTK("Serror = 0x%x\n", Serror);
972 goto err;
973 }
974
975 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
976
977 check_device_signature:
978 899
979 DPRINTK("SATA FSL : Now checking device signature\n"); 900 DPRINTK("SATA FSL : Now checking device signature\n");
980 901
981 *class = ATA_DEV_NONE; 902 *class = ATA_DEV_NONE;
982 903
983 /* Verify if SStatus indicates device presence */ 904 /* Verify if SStatus indicates device presence */
984 if (ata_port_online(ap)) { 905 if (ata_link_online(link)) {
985 /* 906 /*
986 * if we are here, device presence has been detected, 907 * if we are here, device presence has been detected,
987 * 1st D2H FIS would have been received, but sfis in 908 * 1st D2H FIS would have been received, but sfis in
@@ -1002,25 +923,13 @@ err:
1002 return -EIO; 923 return -EIO;
1003} 924}
1004 925
1005static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class,
1006 unsigned long deadline)
1007{
1008 int retval;
1009
1010 retval = sata_std_hardreset(ap, class, deadline);
1011
1012 DPRINTK("SATA FSL : in xx_hardreset, retval = 0x%d\n", retval);
1013
1014 return retval;
1015}
1016
1017static void sata_fsl_error_handler(struct ata_port *ap) 926static void sata_fsl_error_handler(struct ata_port *ap)
1018{ 927{
1019 928
1020 DPRINTK("in xx_error_handler\n"); 929 DPRINTK("in xx_error_handler\n");
1021 930
1022 /* perform recovery */ 931 /* perform recovery */
1023 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset, 932 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset,
1024 ata_std_postreset); 933 ata_std_postreset);
1025} 934}
1026 935
@@ -1042,7 +951,8 @@ static void sata_fsl_irq_clear(struct ata_port *ap)
1042 951
1043static void sata_fsl_error_intr(struct ata_port *ap) 952static void sata_fsl_error_intr(struct ata_port *ap)
1044{ 953{
1045 struct ata_eh_info *ehi = &ap->eh_info; 954 struct ata_link *link = &ap->link;
955 struct ata_eh_info *ehi = &link->eh_info;
1046 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 956 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1047 void __iomem *hcr_base = host_priv->hcr_base; 957 void __iomem *hcr_base = host_priv->hcr_base;
1048 u32 hstatus, dereg, cereg = 0, SError = 0; 958 u32 hstatus, dereg, cereg = 0, SError = 0;
@@ -1111,7 +1021,7 @@ static void sata_fsl_error_intr(struct ata_port *ap)
1111 } 1021 }
1112 1022
1113 /* record error info */ 1023 /* record error info */
1114 qc = ata_qc_from_tag(ap, ap->active_tag); 1024 qc = ata_qc_from_tag(ap, link->active_tag);
1115 1025
1116 if (qc) { 1026 if (qc) {
1117 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap); 1027 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
@@ -1139,6 +1049,7 @@ static void sata_fsl_qc_complete(struct ata_queued_cmd *qc)
1139 1049
1140static void sata_fsl_host_intr(struct ata_port *ap) 1050static void sata_fsl_host_intr(struct ata_port *ap)
1141{ 1051{
1052 struct ata_link *link = &ap->link;
1142 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 1053 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1143 void __iomem *hcr_base = host_priv->hcr_base; 1054 void __iomem *hcr_base = host_priv->hcr_base;
1144 u32 hstatus, qc_active = 0; 1055 u32 hstatus, qc_active = 0;
@@ -1161,7 +1072,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1161 return; 1072 return;
1162 } 1073 }
1163 1074
1164 if (ap->sactive) { /* only true for NCQ commands */ 1075 if (link->sactive) { /* only true for NCQ commands */
1165 int i; 1076 int i;
1166 /* Read command completed register */ 1077 /* Read command completed register */
1167 qc_active = ioread32(hcr_base + CC); 1078 qc_active = ioread32(hcr_base + CC);
@@ -1190,10 +1101,10 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1190 1101
1191 } else if (ap->qc_active) { 1102 } else if (ap->qc_active) {
1192 iowrite32(1, hcr_base + CC); 1103 iowrite32(1, hcr_base + CC);
1193 qc = ata_qc_from_tag(ap, ap->active_tag); 1104 qc = ata_qc_from_tag(ap, link->active_tag);
1194 1105
1195 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n", 1106 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n",
1196 ap->active_tag, ioread32(hcr_base + CC)); 1107 link->active_tag, ioread32(hcr_base + CC));
1197 1108
1198 if (qc) { 1109 if (qc) {
1199 sata_fsl_qc_complete(qc); 1110 sata_fsl_qc_complete(qc);
@@ -1312,15 +1223,9 @@ static struct scsi_host_template sata_fsl_sht = {
1312 .slave_configure = ata_scsi_slave_config, 1223 .slave_configure = ata_scsi_slave_config,
1313 .slave_destroy = ata_scsi_slave_destroy, 1224 .slave_destroy = ata_scsi_slave_destroy,
1314 .bios_param = ata_std_bios_param, 1225 .bios_param = ata_std_bios_param,
1315#ifdef CONFIG_PM
1316 .suspend = ata_scsi_device_suspend,
1317 .resume = ata_scsi_device_resume,
1318#endif
1319}; 1226};
1320 1227
1321static const struct ata_port_operations sata_fsl_ops = { 1228static const struct ata_port_operations sata_fsl_ops = {
1322 .port_disable = ata_port_disable,
1323
1324 .check_status = sata_fsl_check_status, 1229 .check_status = sata_fsl_check_status,
1325 .check_altstatus = sata_fsl_check_status, 1230 .check_altstatus = sata_fsl_check_status,
1326 .dev_select = ata_noop_dev_select, 1231 .dev_select = ata_noop_dev_select,
@@ -1330,8 +1235,6 @@ static const struct ata_port_operations sata_fsl_ops = {
1330 .qc_prep = sata_fsl_qc_prep, 1235 .qc_prep = sata_fsl_qc_prep,
1331 .qc_issue = sata_fsl_qc_issue, 1236 .qc_issue = sata_fsl_qc_issue,
1332 .irq_clear = sata_fsl_irq_clear, 1237 .irq_clear = sata_fsl_irq_clear,
1333 .irq_on = ata_dummy_irq_on,
1334 .irq_ack = ata_dummy_irq_ack,
1335 1238
1336 .scr_read = sata_fsl_scr_read, 1239 .scr_read = sata_fsl_scr_read,
1337 .scr_write = sata_fsl_scr_write, 1240 .scr_write = sata_fsl_scr_write,
@@ -1348,6 +1251,7 @@ static const struct ata_port_operations sata_fsl_ops = {
1348static const struct ata_port_info sata_fsl_port_info[] = { 1251static const struct ata_port_info sata_fsl_port_info[] = {
1349 { 1252 {
1350 .flags = SATA_FSL_HOST_FLAGS, 1253 .flags = SATA_FSL_HOST_FLAGS,
1254 .link_flags = SATA_FSL_HOST_LFLAGS,
1351 .pio_mask = 0x1f, /* pio 0-4 */ 1255 .pio_mask = 0x1f, /* pio 0-4 */
1352 .udma_mask = 0x7f, /* udma 0-6 */ 1256 .udma_mask = 0x7f, /* udma 0-6 */
1353 .port_ops = &sata_fsl_ops, 1257 .port_ops = &sata_fsl_ops,
@@ -1398,6 +1302,7 @@ static int sata_fsl_probe(struct of_device *ofdev,
1398 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); 1302 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n");
1399 goto error_exit_with_cleanup; 1303 goto error_exit_with_cleanup;
1400 } 1304 }
1305 host_priv->irq = irq;
1401 1306
1402 /* allocate host structure */ 1307 /* allocate host structure */
1403 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); 1308 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS);
@@ -1444,7 +1349,7 @@ static int sata_fsl_remove(struct of_device *ofdev)
1444 1349
1445 dev_set_drvdata(&ofdev->dev, NULL); 1350 dev_set_drvdata(&ofdev->dev, NULL);
1446 1351
1447 irq_dispose_mapping(host->irq); 1352 irq_dispose_mapping(host_priv->irq);
1448 iounmap(host_priv->hcr_base); 1353 iounmap(host_priv->hcr_base);
1449 kfree(host_priv); 1354 kfree(host_priv);
1450 1355
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 825e717bcef..7914def54fa 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -587,7 +587,7 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
587 VPRINTK("Splitting last PRD.\n"); 587 VPRINTK("Splitting last PRD.\n");
588 588
589 addr = le32_to_cpu(ap->prd[idx - 1].addr); 589 addr = le32_to_cpu(ap->prd[idx - 1].addr);
590 ap->prd[idx - 1].flags_len -= cpu_to_le32(SG_COUNT_ASIC_BUG); 590 ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
591 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG); 591 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
592 592
593 addr = addr + len - SG_COUNT_ASIC_BUG; 593 addr = addr + len - SG_COUNT_ASIC_BUG;
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index 5beddc322e6..b5034dc72a0 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -2,7 +2,6 @@
2#include <linux/device.h> 2#include <linux/device.h>
3#include <linux/mm.h> 3#include <linux/mm.h>
4#include <asm/io.h> /* Needed for i386 to build */ 4#include <asm/io.h> /* Needed for i386 to build */
5#include <asm/scatterlist.h> /* Needed for i386 to build */
6#include <linux/dma-mapping.h> 5#include <linux/dma-mapping.h>
7#include <linux/dmapool.h> 6#include <linux/dmapool.h>
8#include <linux/slab.h> 7#include <linux/slab.h>
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 9f4e67ee1eb..b91accf1265 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -664,7 +664,7 @@ static int pt_open(struct inode *inode, struct file *file)
664 goto out; 664 goto out;
665 665
666 err = -EROFS; 666 err = -EROFS;
667 if ((!tape->flags & PT_WRITE_OK) && (file->f_mode & 2)) 667 if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2))
668 goto out; 668 goto out;
669 669
670 if (!(iminor(inode) & 128)) 670 if (!(iminor(inode) & 128))
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 9dd0760dd87..dde02a15fa5 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -559,8 +559,6 @@ struct drm_mm {
559 * a family of cards. There will one drm_device for each card present 559 * a family of cards. There will one drm_device for each card present
560 * in this family 560 * in this family
561 */ 561 */
562struct drm_device;
563
564struct drm_driver { 562struct drm_driver {
565 int (*load) (struct drm_device *, unsigned long flags); 563 int (*load) (struct drm_device *, unsigned long flags);
566 int (*firstopen) (struct drm_device *); 564 int (*firstopen) (struct drm_device *);
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index d9be1462452..3cbebf868e6 100644
--- a/drivers/char/drm/drm_ioctl.c
+++ b/drivers/char/drm/drm_ioctl.c
@@ -272,7 +272,7 @@ int drm_getstats(struct drm_device *dev, void *data,
272 struct drm_stats *stats = data; 272 struct drm_stats *stats = data;
273 int i; 273 int i;
274 274
275 memset(stats, 0, sizeof(stats)); 275 memset(stats, 0, sizeof(*stats));
276 276
277 mutex_lock(&dev->struct_mutex); 277 mutex_lock(&dev->struct_mutex);
278 278
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h
index 76e44ac94fb..daa69c9d897 100644
--- a/drivers/char/drm/drm_os_linux.h
+++ b/drivers/char/drm/drm_os_linux.h
@@ -62,14 +62,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
62 62
63#endif 63#endif
64 64
65/** For data going into the kernel through the ioctl argument */
66#define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3) \
67 if ( copy_from_user(&arg1, arg2, arg3) ) \
68 return -EFAULT
69/** For data going from the kernel through the ioctl argument */
70#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3) \
71 if ( copy_to_user(arg1, &arg2, arg3) ) \
72 return -EFAULT
73/** Other copying of data to kernel space */ 65/** Other copying of data to kernel space */
74#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \ 66#define DRM_COPY_FROM_USER(arg1, arg2, arg3) \
75 copy_from_user(arg1, arg2, arg3) 67 copy_from_user(arg1, arg2, arg3)
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 335423c5c18..24fca8ec137 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1679,7 +1679,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1679 dev_priv->gart_info.bus_addr = 1679 dev_priv->gart_info.bus_addr =
1680 dev_priv->pcigart_offset + dev_priv->fb_location; 1680 dev_priv->pcigart_offset + dev_priv->fb_location;
1681 dev_priv->gart_info.mapping.offset = 1681 dev_priv->gart_info.mapping.offset =
1682 dev_priv->gart_info.bus_addr; 1682 dev_priv->pcigart_offset + dev_priv->fb_aper_offset;
1683 dev_priv->gart_info.mapping.size = 1683 dev_priv->gart_info.mapping.size =
1684 dev_priv->gart_info.table_size; 1684 dev_priv->gart_info.table_size;
1685 1685
@@ -2275,7 +2275,8 @@ int radeon_driver_firstopen(struct drm_device *dev)
2275 if (ret != 0) 2275 if (ret != 0)
2276 return ret; 2276 return ret;
2277 2277
2278 ret = drm_addmap(dev, drm_get_resource_start(dev, 0), 2278 dev_priv->fb_aper_offset = drm_get_resource_start(dev, 0);
2279 ret = drm_addmap(dev, dev_priv->fb_aper_offset,
2279 drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER, 2280 drm_get_resource_len(dev, 0), _DRM_FRAME_BUFFER,
2280 _DRM_WRITE_COMBINING, &map); 2281 _DRM_WRITE_COMBINING, &map);
2281 if (ret != 0) 2282 if (ret != 0)
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index e4077bc212b..bfbb60a9298 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -293,6 +293,7 @@ typedef struct drm_radeon_private {
293 293
294 /* starting from here on, data is preserved accross an open */ 294 /* starting from here on, data is preserved accross an open */
295 uint32_t flags; /* see radeon_chip_flags */ 295 uint32_t flags; /* see radeon_chip_flags */
296 unsigned long fb_aper_offset;
296} drm_radeon_private_t; 297} drm_radeon_private_t;
297 298
298typedef struct drm_radeon_buf_priv { 299typedef struct drm_radeon_buf_priv {
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c
index 59484d56b33..d465b2f9c1c 100644
--- a/drivers/char/drm/savage_bci.c
+++ b/drivers/char/drm/savage_bci.c
@@ -968,9 +968,6 @@ static int savage_bci_event_wait(struct drm_device *dev, void *data, struct drm_
968 968
969 DRM_DEBUG("\n"); 969 DRM_DEBUG("\n");
970 970
971 DRM_COPY_FROM_USER_IOCTL(event, (drm_savage_event_wait_t __user *) data,
972 sizeof(event));
973
974 UPDATE_EVENT_COUNTER(); 971 UPDATE_EVENT_COUNTER();
975 if (dev_priv->status_ptr) 972 if (dev_priv->status_ptr)
976 hw_e = dev_priv->status_ptr[1] & 0xffff; 973 hw_e = dev_priv->status_ptr[1] & 0xffff;
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
index 6be1c575758..a6b7ccdaf73 100644
--- a/drivers/char/drm/sis_mm.c
+++ b/drivers/char/drm/sis_mm.c
@@ -134,6 +134,7 @@ static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file_priv,
134 dev_priv->agp_initialized)) { 134 dev_priv->agp_initialized)) {
135 DRM_ERROR 135 DRM_ERROR
136 ("Attempt to allocate from uninitialized memory manager.\n"); 136 ("Attempt to allocate from uninitialized memory manager.\n");
137 mutex_unlock(&dev->struct_mutex);
137 return -EINVAL; 138 return -EINVAL;
138 } 139 }
139 140
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 7a003504c26..1bdd2bf4f37 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -730,13 +730,23 @@ static int send_prio_char(struct tty_struct *tty, char ch)
730 return 0; 730 return 0;
731} 731}
732 732
733int n_tty_ioctl(struct tty_struct * tty, struct file * file, 733/**
734 unsigned int cmd, unsigned long arg) 734 * tty_mode_ioctl - mode related ioctls
735 * @tty: tty for the ioctl
736 * @file: file pointer for the tty
737 * @cmd: command
738 * @arg: ioctl argument
739 *
740 * Perform non line discipline specific mode control ioctls. This
741 * is designed to be called by line disciplines to ensure they provide
742 * consistent mode setting.
743 */
744
745int tty_mode_ioctl(struct tty_struct * tty, struct file *file,
746 unsigned int cmd, unsigned long arg)
735{ 747{
736 struct tty_struct * real_tty; 748 struct tty_struct * real_tty;
737 void __user *p = (void __user *)arg; 749 void __user *p = (void __user *)arg;
738 int retval;
739 struct tty_ldisc *ld;
740 750
741 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 751 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
742 tty->driver->subtype == PTY_TYPE_MASTER) 752 tty->driver->subtype == PTY_TYPE_MASTER)
@@ -799,6 +809,93 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
799 return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO); 809 return set_termios(real_tty, p, TERMIOS_WAIT | TERMIOS_TERMIO);
800 case TCSETA: 810 case TCSETA:
801 return set_termios(real_tty, p, TERMIOS_TERMIO); 811 return set_termios(real_tty, p, TERMIOS_TERMIO);
812#ifndef TCGETS2
813 case TIOCGLCKTRMIOS:
814 if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked))
815 return -EFAULT;
816 return 0;
817
818 case TIOCSLCKTRMIOS:
819 if (!capable(CAP_SYS_ADMIN))
820 return -EPERM;
821 if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg))
822 return -EFAULT;
823 return 0;
824#else
825 case TIOCGLCKTRMIOS:
826 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked))
827 return -EFAULT;
828 return 0;
829
830 case TIOCSLCKTRMIOS:
831 if (!capable(CAP_SYS_ADMIN))
832 return -EPERM;
833 if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg))
834 return -EFAULT;
835 return 0;
836#endif
837 case TIOCGSOFTCAR:
838 return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg);
839 case TIOCSSOFTCAR:
840 if (get_user(arg, (unsigned int __user *) arg))
841 return -EFAULT;
842 mutex_lock(&tty->termios_mutex);
843 tty->termios->c_cflag =
844 ((tty->termios->c_cflag & ~CLOCAL) |
845 (arg ? CLOCAL : 0));
846 mutex_unlock(&tty->termios_mutex);
847 return 0;
848 default:
849 return -ENOIOCTLCMD;
850 }
851}
852
853EXPORT_SYMBOL_GPL(tty_mode_ioctl);
854
855int tty_perform_flush(struct tty_struct *tty, unsigned long arg)
856{
857 struct tty_ldisc *ld;
858 int retval = tty_check_change(tty);
859 if (retval)
860 return retval;
861
862 ld = tty_ldisc_ref(tty);
863 switch (arg) {
864 case TCIFLUSH:
865 if (ld && ld->flush_buffer)
866 ld->flush_buffer(tty);
867 break;
868 case TCIOFLUSH:
869 if (ld && ld->flush_buffer)
870 ld->flush_buffer(tty);
871 /* fall through */
872 case TCOFLUSH:
873 if (tty->driver->flush_buffer)
874 tty->driver->flush_buffer(tty);
875 break;
876 default:
877 tty_ldisc_deref(ld);
878 return -EINVAL;
879 }
880 tty_ldisc_deref(ld);
881 return 0;
882}
883
884EXPORT_SYMBOL_GPL(tty_perform_flush);
885
886int n_tty_ioctl(struct tty_struct * tty, struct file * file,
887 unsigned int cmd, unsigned long arg)
888{
889 struct tty_struct * real_tty;
890 int retval;
891
892 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
893 tty->driver->subtype == PTY_TYPE_MASTER)
894 real_tty = tty->link;
895 else
896 real_tty = tty;
897
898 switch (cmd) {
802 case TCXONC: 899 case TCXONC:
803 retval = tty_check_change(tty); 900 retval = tty_check_change(tty);
804 if (retval) 901 if (retval)
@@ -829,30 +926,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
829 } 926 }
830 return 0; 927 return 0;
831 case TCFLSH: 928 case TCFLSH:
832 retval = tty_check_change(tty); 929 return tty_perform_flush(tty, arg);
833 if (retval)
834 return retval;
835
836 ld = tty_ldisc_ref(tty);
837 switch (arg) {
838 case TCIFLUSH:
839 if (ld && ld->flush_buffer)
840 ld->flush_buffer(tty);
841 break;
842 case TCIOFLUSH:
843 if (ld && ld->flush_buffer)
844 ld->flush_buffer(tty);
845 /* fall through */
846 case TCOFLUSH:
847 if (tty->driver->flush_buffer)
848 tty->driver->flush_buffer(tty);
849 break;
850 default:
851 tty_ldisc_deref(ld);
852 return -EINVAL;
853 }
854 tty_ldisc_deref(ld);
855 return 0;
856 case TIOCOUTQ: 930 case TIOCOUTQ:
857 return put_user(tty->driver->chars_in_buffer ? 931 return put_user(tty->driver->chars_in_buffer ?
858 tty->driver->chars_in_buffer(tty) : 0, 932 tty->driver->chars_in_buffer(tty) : 0,
@@ -862,32 +936,6 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
862 if (L_ICANON(tty)) 936 if (L_ICANON(tty))
863 retval = inq_canon(tty); 937 retval = inq_canon(tty);
864 return put_user(retval, (unsigned int __user *) arg); 938 return put_user(retval, (unsigned int __user *) arg);
865#ifndef TCGETS2
866 case TIOCGLCKTRMIOS:
867 if (kernel_termios_to_user_termios((struct termios __user *)arg, real_tty->termios_locked))
868 return -EFAULT;
869 return 0;
870
871 case TIOCSLCKTRMIOS:
872 if (!capable(CAP_SYS_ADMIN))
873 return -EPERM;
874 if (user_termios_to_kernel_termios(real_tty->termios_locked, (struct termios __user *) arg))
875 return -EFAULT;
876 return 0;
877#else
878 case TIOCGLCKTRMIOS:
879 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, real_tty->termios_locked))
880 return -EFAULT;
881 return 0;
882
883 case TIOCSLCKTRMIOS:
884 if (!capable(CAP_SYS_ADMIN))
885 return -EPERM;
886 if (user_termios_to_kernel_termios_1(real_tty->termios_locked, (struct termios __user *) arg))
887 return -EFAULT;
888 return 0;
889#endif
890
891 case TIOCPKT: 939 case TIOCPKT:
892 { 940 {
893 int pktmode; 941 int pktmode;
@@ -906,19 +954,9 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
906 tty->packet = 0; 954 tty->packet = 0;
907 return 0; 955 return 0;
908 } 956 }
909 case TIOCGSOFTCAR:
910 return put_user(C_CLOCAL(tty) ? 1 : 0, (int __user *)arg);
911 case TIOCSSOFTCAR:
912 if (get_user(arg, (unsigned int __user *) arg))
913 return -EFAULT;
914 mutex_lock(&tty->termios_mutex);
915 tty->termios->c_cflag =
916 ((tty->termios->c_cflag & ~CLOCAL) |
917 (arg ? CLOCAL : 0));
918 mutex_unlock(&tty->termios_mutex);
919 return 0;
920 default: 957 default:
921 return -ENOIOCTLCMD; 958 /* Try the mode commands */
959 return tty_mode_ioctl(tty, file, cmd, arg);
922 } 960 }
923} 961}
924 962
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 100e8a201e3..e34da5c9719 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -141,7 +141,7 @@ int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int))
141 * never remove the console device we never need this pointer again. 141 * never remove the console device we never need this pointer again.
142 * 142 *
143 * Finally we put our input buffer in the input queue, ready to receive. */ 143 * Finally we put our input buffer in the input queue, ready to receive. */
144static int virtcons_probe(struct virtio_device *dev) 144static int __devinit virtcons_probe(struct virtio_device *dev)
145{ 145{
146 int err; 146 int err;
147 struct hvc_struct *hvc; 147 struct hvc_struct *hvc;
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 5596df65c8e..624ff3e082f 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -650,13 +650,14 @@ static void sbp2_login(struct work_struct *work)
650 if (sbp2_send_management_orb(lu, node_id, generation, 650 if (sbp2_send_management_orb(lu, node_id, generation,
651 SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) { 651 SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
652 if (lu->retries++ < 5) { 652 if (lu->retries++ < 5) {
653 queue_delayed_work(sbp2_wq, &lu->work, 653 if (queue_delayed_work(sbp2_wq, &lu->work,
654 DIV_ROUND_UP(HZ, 5)); 654 DIV_ROUND_UP(HZ, 5)))
655 kref_get(&lu->tgt->kref);
655 } else { 656 } else {
656 fw_error("failed to login to %s LUN %04x\n", 657 fw_error("failed to login to %s LUN %04x\n",
657 unit->device.bus_id, lu->lun); 658 unit->device.bus_id, lu->lun);
658 kref_put(&lu->tgt->kref, sbp2_release_target);
659 } 659 }
660 kref_put(&lu->tgt->kref, sbp2_release_target);
660 return; 661 return;
661 } 662 }
662 663
@@ -914,7 +915,9 @@ static void sbp2_reconnect(struct work_struct *work)
914 lu->retries = 0; 915 lu->retries = 0;
915 PREPARE_DELAYED_WORK(&lu->work, sbp2_login); 916 PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
916 } 917 }
917 queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)); 918 if (queue_delayed_work(sbp2_wq, &lu->work, DIV_ROUND_UP(HZ, 5)))
919 kref_get(&lu->tgt->kref);
920 kref_put(&lu->tgt->kref, sbp2_release_target);
918 return; 921 return;
919 } 922 }
920 923
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index dd332f28e08..0b27da7d749 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -297,7 +297,7 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid,
297static int hidinput_getkeycode(struct input_dev *dev, int scancode, 297static int hidinput_getkeycode(struct input_dev *dev, int scancode,
298 int *keycode) 298 int *keycode)
299{ 299{
300 struct hid_device *hid = dev->private; 300 struct hid_device *hid = input_get_drvdata(dev);
301 struct hid_usage *usage; 301 struct hid_usage *usage;
302 302
303 usage = hidinput_find_key(hid, scancode, 0); 303 usage = hidinput_find_key(hid, scancode, 0);
@@ -311,7 +311,7 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode,
311static int hidinput_setkeycode(struct input_dev *dev, int scancode, 311static int hidinput_setkeycode(struct input_dev *dev, int scancode,
312 int keycode) 312 int keycode)
313{ 313{
314 struct hid_device *hid = dev->private; 314 struct hid_device *hid = input_get_drvdata(dev);
315 struct hid_usage *usage; 315 struct hid_usage *usage;
316 int old_keycode; 316 int old_keycode;
317 317
@@ -1152,7 +1152,7 @@ int hidinput_connect(struct hid_device *hid)
1152 kfree(hidinput); 1152 kfree(hidinput);
1153 input_free_device(input_dev); 1153 input_free_device(input_dev);
1154 err_hid("Out of memory during hid input probe"); 1154 err_hid("Out of memory during hid input probe");
1155 return -1; 1155 goto out_unwind;
1156 } 1156 }
1157 1157
1158 input_set_drvdata(input_dev, hid); 1158 input_set_drvdata(input_dev, hid);
@@ -1186,15 +1186,25 @@ int hidinput_connect(struct hid_device *hid)
1186 * UGCI) cram a lot of unrelated inputs into the 1186 * UGCI) cram a lot of unrelated inputs into the
1187 * same interface. */ 1187 * same interface. */
1188 hidinput->report = report; 1188 hidinput->report = report;
1189 input_register_device(hidinput->input); 1189 if (input_register_device(hidinput->input))
1190 goto out_cleanup;
1190 hidinput = NULL; 1191 hidinput = NULL;
1191 } 1192 }
1192 } 1193 }
1193 1194
1194 if (hidinput) 1195 if (hidinput && input_register_device(hidinput->input))
1195 input_register_device(hidinput->input); 1196 goto out_cleanup;
1196 1197
1197 return 0; 1198 return 0;
1199
1200out_cleanup:
1201 input_free_device(hidinput->input);
1202 kfree(hidinput);
1203out_unwind:
1204 /* unwind the ones we already registered */
1205 hidinput_disconnect(hid);
1206
1207 return -1;
1198} 1208}
1199EXPORT_SYMBOL_GPL(hidinput_connect); 1209EXPORT_SYMBOL_GPL(hidinput_connect);
1200 1210
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 41a59a80e7e..a2552856476 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -129,6 +129,11 @@
129#define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053 129#define USB_DEVICE_ID_0_8_8_IF_KIT 0x0053
130#define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058 130#define USB_DEVICE_ID_PHIDGET_MOTORCONTROL 0x0058
131 131
132#define USB_VENDOR_ID_GOTOP 0x08f2
133#define USB_DEVICE_ID_SUPER_Q2 0x007f
134#define USB_DEVICE_ID_GOGOPEN 0x00ce
135#define USB_DEVICE_ID_PENPOWER 0x00f4
136
132#define USB_VENDOR_ID_GRIFFIN 0x077d 137#define USB_VENDOR_ID_GRIFFIN 0x077d
133#define USB_DEVICE_ID_POWERMATE 0x0410 138#define USB_DEVICE_ID_POWERMATE 0x0410
134#define USB_DEVICE_ID_SOUNDKNOB 0x04AA 139#define USB_DEVICE_ID_SOUNDKNOB 0x04AA
@@ -415,6 +420,9 @@ static const struct hid_blacklist {
415 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT, HID_QUIRK_IGNORE }, 420 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_7_IF_KIT, HID_QUIRK_IGNORE },
416 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE }, 421 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_0_8_8_IF_KIT, HID_QUIRK_IGNORE },
417 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL, HID_QUIRK_IGNORE }, 422 { USB_VENDOR_ID_GLAB, USB_DEVICE_ID_PHIDGET_MOTORCONTROL, HID_QUIRK_IGNORE },
423 { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_SUPER_Q2, HID_QUIRK_IGNORE },
424 { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_GOGOPEN, HID_QUIRK_IGNORE },
425 { USB_VENDOR_ID_GOTOP, USB_DEVICE_ID_PENPOWER, HID_QUIRK_IGNORE },
418 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, 426 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
419 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, 427 { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
420 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE }, 428 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_90, HID_QUIRK_IGNORE },
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 9837adcb17e..5fc4019956b 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -743,7 +743,7 @@ inval:
743static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 743static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
744{ 744{
745 struct inode *inode = file->f_path.dentry->d_inode; 745 struct inode *inode = file->f_path.dentry->d_inode;
746 return hiddev_ioctl(inode, file, cmd, compat_ptr(arg)); 746 return hiddev_ioctl(inode, file, cmd, (unsigned long)compat_ptr(arg));
747} 747}
748#endif 748#endif
749 749
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 6eaece96524..d1e8df18722 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -152,9 +152,22 @@ config BLK_DEV_IDEDISK
152 If unsure, say Y. 152 If unsure, say Y.
153 153
154config IDEDISK_MULTI_MODE 154config IDEDISK_MULTI_MODE
155 bool "Use multi-mode by default" 155 bool "Use multiple sector mode for Programmed Input/Output by default"
156 help 156 help
157 If you get this error, try to say Y here: 157 This setting is irrelevant for most IDE disks, with direct memory
158 access, to which multiple sector mode does not apply. Multiple sector
159 mode is a feature of most modern IDE hard drives, permitting the
160 transfer of multiple sectors per Programmed Input/Output interrupt,
161 rather than the usual one sector per interrupt. When this feature is
162 enabled, it can reduce operating system overhead for disk Programmed
163 Input/Output. On some systems, it also can increase the data
164 throughput of Programmed Input/Output. Some drives, however, seemed
165 to run slower with multiple sector mode enabled. Some drives claimed
166 to support multiple sector mode, but lost data at some settings.
167 Under rare circumstances, such failures could result in massive
168 filesystem corruption.
169
170 If you get the following error, try to say Y here:
158 171
159 hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } 172 hda: set_multmode: status=0x51 { DriveReady SeekComplete Error }
160 hda: set_multmode: error=0x04 { DriveStatusError } 173 hda: set_multmode: error=0x04 { DriveStatusError }
@@ -380,9 +393,10 @@ config IDEPCI_SHARE_IRQ
380config IDEPCI_PCIBUS_ORDER 393config IDEPCI_PCIBUS_ORDER
381 def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI 394 def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI
382 395
396# TODO: split it on per host driver config options (or module parameters)
383config BLK_DEV_OFFBOARD 397config BLK_DEV_OFFBOARD
384 bool "Boot off-board chipsets first support" 398 bool "Boot off-board chipsets first support"
385 depends on BLK_DEV_IDEPCI 399 depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001)
386 help 400 help
387 Normally, IDE controllers built into the motherboard (on-board 401 Normally, IDE controllers built into the motherboard (on-board
388 controllers) are assigned to ide0 and ide1 while those on add-in PCI 402 controllers) are assigned to ide0 and ide1 while those on add-in PCI
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 428f7a8a00b..e3add70b9cd 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -340,7 +340,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
340 340
341 if (drive->media != ide_disk) { 341 if (drive->media != ide_disk) {
342 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) 342 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
343 return -1; 343 return 0;
344 } 344 }
345 345
346 /* 346 /*
@@ -752,7 +752,8 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
752 mode = XFER_MW_DMA_1; 752 mode = XFER_MW_DMA_1;
753 } 753 }
754 754
755 printk(KERN_DEBUG "%s: selected mode 0x%x\n", drive->name, mode); 755 printk(KERN_DEBUG "%s: %s mode selected\n", drive->name,
756 mode ? ide_xfer_verbose(mode) : "no DMA");
756 757
757 return min(mode, req_mode); 758 return min(mode, req_mode);
758} 759}
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c89f0d3058e..755011827af 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -340,6 +340,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
340 if (args) { 340 if (args) {
341 args[0] = stat; 341 args[0] = stat;
342 args[1] = err; 342 args[1] = err;
343 /* be sure we're looking at the low order bits */
344 hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG);
343 args[2] = hwif->INB(IDE_NSECTOR_REG); 345 args[2] = hwif->INB(IDE_NSECTOR_REG);
344 args[3] = hwif->INB(IDE_SECTOR_REG); 346 args[3] = hwif->INB(IDE_SECTOR_REG);
345 args[4] = hwif->INB(IDE_LCYL_REG); 347 args[4] = hwif->INB(IDE_LCYL_REG);
@@ -654,7 +656,8 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
654 int retries = 10; 656 int retries = 10;
655 657
656 local_irq_enable_in_hardirq(); 658 local_irq_enable_in_hardirq();
657 if ((stat & DRQ_STAT) && args && args[3]) { 659 if (rq->cmd_type == REQ_TYPE_ATA_CMD &&
660 (stat & DRQ_STAT) && args && args[3]) {
658 u8 io_32bit = drive->io_32bit; 661 u8 io_32bit = drive->io_32bit;
659 drive->io_32bit = 0; 662 drive->io_32bit = 0;
660 hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS); 663 hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS);
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index dcda0f109df..e17a9ee120e 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -403,8 +403,12 @@ void ide_fix_driveid (struct hd_driveid *id)
403#endif 403#endif
404} 404}
405 405
406/* FIXME: exported for use by the USB storage (isd200.c) code only */ 406/*
407EXPORT_SYMBOL(ide_fix_driveid); 407 * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
408 * removing leading/trailing blanks and compressing internal blanks.
409 * It is primarily used to tidy up the model name/number fields as
410 * returned by the WIN_[P]IDENTIFY commands.
411 */
408 412
409void ide_fixstring (u8 *s, const int bytecount, const int byteswap) 413void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
410{ 414{
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 6a6f2e066b4..56fb0b84342 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -172,11 +172,12 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
172 ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); 172 ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap);
173 ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); 173 ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap);
174 174
175 /* we depend on this a lot! */
176 id->model[sizeof(id->model)-1] = '\0';
177
175 if (strstr(id->model, "E X A B Y T E N E S T")) 178 if (strstr(id->model, "E X A B Y T E N E S T"))
176 goto err_misc; 179 goto err_misc;
177 180
178 /* we depend on this a lot! */
179 id->model[sizeof(id->model)-1] = '\0';
180 printk("%s: %s, ", drive->name, id->model); 181 printk("%s: %s, ", drive->name, id->model);
181 drive->present = 1; 182 drive->present = 1;
182 drive->dead = 0; 183 drive->dead = 0;
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index d066546f283..2b60f1b0437 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -471,6 +471,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long
471 struct request rq; 471 struct request rq;
472 472
473 memset(&rq, 0, sizeof(rq)); 473 memset(&rq, 0, sizeof(rq));
474 rq.ref_count = 1;
474 rq.cmd_type = REQ_TYPE_ATA_TASKFILE; 475 rq.cmd_type = REQ_TYPE_ATA_TASKFILE;
475 rq.buffer = buf; 476 rq.buffer = buf;
476 477
@@ -511,6 +512,7 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf)
511 512
512EXPORT_SYMBOL(ide_raw_taskfile); 513EXPORT_SYMBOL(ide_raw_taskfile);
513 514
515#ifdef CONFIG_IDE_TASK_IOCTL
514int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 516int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
515{ 517{
516 ide_task_request_t *req_task; 518 ide_task_request_t *req_task;
@@ -660,6 +662,7 @@ abort:
660 662
661 return err; 663 return err;
662} 664}
665#endif
663 666
664int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) 667int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf)
665{ 668{
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 9329d4a810e..63625a0be71 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -302,6 +302,7 @@ struct ich_laptop {
302 302
303static const struct ich_laptop ich_laptop[] = { 303static const struct ich_laptop ich_laptop[] = {
304 /* devid, subvendor, subdev */ 304 /* devid, subvendor, subdev */
305 { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */
305 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ 306 { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */
306 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 307 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
307 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 308 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
diff --git a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
index f5f4983dfbf..7c4eb39b702 100644
--- a/drivers/ieee1394/dma.c
+++ b/drivers/ieee1394/dma.c
@@ -103,8 +103,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
103 goto err; 103 goto err;
104 } 104 }
105 105
106 /* just to be safe - this will become unnecessary once sglist->address goes away */ 106 sg_init_table(dma->sglist, dma->n_pages);
107 memset(dma->sglist, 0, dma->n_pages * sizeof(*dma->sglist));
108 107
109 /* fill scatter/gather list with pages */ 108 /* fill scatter/gather list with pages */
110 for (i = 0; i < dma->n_pages; i++) { 109 for (i = 0; i < dma->n_pages; i++) {
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index d5dfe11aa5c..b83d254bc86 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -71,11 +71,11 @@
71#include <linux/types.h> 71#include <linux/types.h>
72#include <linux/wait.h> 72#include <linux/wait.h>
73#include <linux/workqueue.h> 73#include <linux/workqueue.h>
74#include <linux/scatterlist.h>
74 75
75#include <asm/byteorder.h> 76#include <asm/byteorder.h>
76#include <asm/errno.h> 77#include <asm/errno.h>
77#include <asm/param.h> 78#include <asm/param.h>
78#include <asm/scatterlist.h>
79#include <asm/system.h> 79#include <asm/system.h>
80#include <asm/types.h> 80#include <asm/types.h>
81 81
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 6dd375825a1..6e9d75bd2b1 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -120,6 +120,7 @@ static const struct xpad_device {
120 { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 120 { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX },
121 { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 121 { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
122 { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 122 { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
123 { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
123 { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, 124 { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
124 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 125 { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
125 { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 126 { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
@@ -129,6 +130,7 @@ static const struct xpad_device {
129 { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 130 { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
130 { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 131 { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
131 { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 132 { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
133 { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 },
132 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 134 { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX },
133 { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 135 { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
134 { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, 136 { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX },
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index 4941a9e61e9..43aaa5cebd1 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -24,7 +24,7 @@ MODULE_DESCRIPTION("PC Speaker beeper driver");
24MODULE_LICENSE("GPL"); 24MODULE_LICENSE("GPL");
25MODULE_ALIAS("platform:pcspkr"); 25MODULE_ALIAS("platform:pcspkr");
26 26
27#ifdef CONFIG_X86 27#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
28/* Use the global PIT lock ! */ 28/* Use the global PIT lock ! */
29#include <asm/i8253.h> 29#include <asm/i8253.h>
30#else 30#else
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index f132702d137..b4423a471f0 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -129,12 +129,12 @@ MODULE_DEVICE_TABLE (usb, atp_table);
129 */ 129 */
130#define ATP_THRESHOLD 5 130#define ATP_THRESHOLD 5
131 131
132/* MacBook Pro (Geyser 3 & 4) initialization constants */ 132/* Geyser initialization constants */
133#define ATP_GEYSER3_MODE_READ_REQUEST_ID 1 133#define ATP_GEYSER_MODE_READ_REQUEST_ID 1
134#define ATP_GEYSER3_MODE_WRITE_REQUEST_ID 9 134#define ATP_GEYSER_MODE_WRITE_REQUEST_ID 9
135#define ATP_GEYSER3_MODE_REQUEST_VALUE 0x300 135#define ATP_GEYSER_MODE_REQUEST_VALUE 0x300
136#define ATP_GEYSER3_MODE_REQUEST_INDEX 0 136#define ATP_GEYSER_MODE_REQUEST_INDEX 0
137#define ATP_GEYSER3_MODE_VENDOR_VALUE 0x04 137#define ATP_GEYSER_MODE_VENDOR_VALUE 0x04
138 138
139/* Structure to hold all of our device specific stuff */ 139/* Structure to hold all of our device specific stuff */
140struct atp { 140struct atp {
@@ -142,9 +142,11 @@ struct atp {
142 struct usb_device * udev; /* usb device */ 142 struct usb_device * udev; /* usb device */
143 struct urb * urb; /* usb request block */ 143 struct urb * urb; /* usb request block */
144 signed char * data; /* transferred data */ 144 signed char * data; /* transferred data */
145 int open; /* non-zero if opened */ 145 struct input_dev * input; /* input dev */
146 struct input_dev *input; /* input dev */ 146 unsigned char open; /* non-zero if opened */
147 int valid; /* are the sensors valid ? */ 147 unsigned char valid; /* are the sensors valid ? */
148 unsigned char size_detect_done;
149 unsigned char overflowwarn; /* overflow warning printed? */
148 int x_old; /* last reported x/y, */ 150 int x_old; /* last reported x/y, */
149 int y_old; /* used for smoothing */ 151 int y_old; /* used for smoothing */
150 /* current value of the sensors */ 152 /* current value of the sensors */
@@ -153,7 +155,6 @@ struct atp {
153 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS]; 155 signed char xy_old[ATP_XSENSORS + ATP_YSENSORS];
154 /* accumulated sensors */ 156 /* accumulated sensors */
155 int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; 157 int xy_acc[ATP_XSENSORS + ATP_YSENSORS];
156 int overflowwarn; /* overflow warning printed? */
157 int datalen; /* size of an USB urb transfer */ 158 int datalen; /* size of an USB urb transfer */
158 int idlecount; /* number of empty packets */ 159 int idlecount; /* number of empty packets */
159 struct work_struct work; 160 struct work_struct work;
@@ -170,7 +171,7 @@ struct atp {
170 171
171#define dprintk(format, a...) \ 172#define dprintk(format, a...) \
172 do { \ 173 do { \
173 if (debug) printk(format, ##a); \ 174 if (debug) printk(KERN_DEBUG format, ##a); \
174 } while (0) 175 } while (0)
175 176
176MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann"); 177MODULE_AUTHOR("Johannes Berg, Stelian Pop, Frank Arnold, Michael Hanselmann");
@@ -188,6 +189,15 @@ static int debug = 1;
188module_param(debug, int, 0644); 189module_param(debug, int, 0644);
189MODULE_PARM_DESC(debug, "Activate debugging output"); 190MODULE_PARM_DESC(debug, "Activate debugging output");
190 191
192static inline int atp_is_fountain(struct atp *dev)
193{
194 u16 productId = le16_to_cpu(dev->udev->descriptor.idProduct);
195
196 return productId == FOUNTAIN_ANSI_PRODUCT_ID ||
197 productId == FOUNTAIN_ISO_PRODUCT_ID ||
198 productId == FOUNTAIN_TP_ONLY_PRODUCT_ID;
199}
200
191/* Checks if the device a Geyser 2 (ANSI, ISO, JIS) */ 201/* Checks if the device a Geyser 2 (ANSI, ISO, JIS) */
192static inline int atp_is_geyser_2(struct atp *dev) 202static inline int atp_is_geyser_2(struct atp *dev)
193{ 203{
@@ -211,52 +221,63 @@ static inline int atp_is_geyser_3(struct atp *dev)
211} 221}
212 222
213/* 223/*
214 * By default Geyser 3 device sends standard USB HID mouse 224 * By default newer Geyser devices send standard USB HID mouse
215 * packets (Report ID 2). This code changes device mode, so it 225 * packets (Report ID 2). This code changes device mode, so it
216 * sends raw sensor reports (Report ID 5). 226 * sends raw sensor reports (Report ID 5).
217 */ 227 */
218static int atp_geyser3_init(struct usb_device *udev) 228static int atp_geyser_init(struct usb_device *udev)
219{ 229{
220 char data[8]; 230 char data[8];
221 int size; 231 int size;
222 232
223 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 233 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
224 ATP_GEYSER3_MODE_READ_REQUEST_ID, 234 ATP_GEYSER_MODE_READ_REQUEST_ID,
225 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 235 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
226 ATP_GEYSER3_MODE_REQUEST_VALUE, 236 ATP_GEYSER_MODE_REQUEST_VALUE,
227 ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); 237 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
228 238
229 if (size != 8) { 239 if (size != 8) {
230 err("Could not do mode read request from device" 240 err("Could not do mode read request from device"
231 " (Geyser 3 mode)"); 241 " (Geyser Raw mode)");
232 return -EIO; 242 return -EIO;
233 } 243 }
234 244
235 /* Apply the mode switch */ 245 /* Apply the mode switch */
236 data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; 246 data[0] = ATP_GEYSER_MODE_VENDOR_VALUE;
237 247
238 size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 248 size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
239 ATP_GEYSER3_MODE_WRITE_REQUEST_ID, 249 ATP_GEYSER_MODE_WRITE_REQUEST_ID,
240 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 250 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
241 ATP_GEYSER3_MODE_REQUEST_VALUE, 251 ATP_GEYSER_MODE_REQUEST_VALUE,
242 ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); 252 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000);
243 253
244 if (size != 8) { 254 if (size != 8) {
245 err("Could not do mode write request to device" 255 err("Could not do mode write request to device"
246 " (Geyser 3 mode)"); 256 " (Geyser Raw mode)");
247 return -EIO; 257 return -EIO;
248 } 258 }
249 return 0; 259 return 0;
250} 260}
251 261
252/* Reinitialise the device if it's a geyser 3 */ 262/*
263 * Reinitialise the device. This usually stops stream of empty packets
264 * coming from it.
265 */
253static void atp_reinit(struct work_struct *work) 266static void atp_reinit(struct work_struct *work)
254{ 267{
255 struct atp *dev = container_of(work, struct atp, work); 268 struct atp *dev = container_of(work, struct atp, work);
256 struct usb_device *udev = dev->udev; 269 struct usb_device *udev = dev->udev;
270 int retval;
257 271
258 dev->idlecount = 0; 272 dev->idlecount = 0;
259 atp_geyser3_init(udev); 273
274 atp_geyser_init(udev);
275
276 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
277 if (retval) {
278 err("%s - usb_submit_urb failed with result %d",
279 __FUNCTION__, retval);
280 }
260} 281}
261 282
262static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, 283static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
@@ -337,7 +358,7 @@ static void atp_complete(struct urb* urb)
337 break; 358 break;
338 case -EOVERFLOW: 359 case -EOVERFLOW:
339 if(!dev->overflowwarn) { 360 if(!dev->overflowwarn) {
340 printk("appletouch: OVERFLOW with data " 361 printk(KERN_WARNING "appletouch: OVERFLOW with data "
341 "length %d, actual length is %d\n", 362 "length %d, actual length is %d\n",
342 dev->datalen, dev->urb->actual_length); 363 dev->datalen, dev->urb->actual_length);
343 dev->overflowwarn = 1; 364 dev->overflowwarn = 1;
@@ -426,15 +447,17 @@ static void atp_complete(struct urb* urb)
426 dev->x_old = dev->y_old = -1; 447 dev->x_old = dev->y_old = -1;
427 memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old)); 448 memcpy(dev->xy_old, dev->xy_cur, sizeof(dev->xy_old));
428 449
429 if (atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */ 450 if (dev->size_detect_done ||
451 atp_is_geyser_3(dev)) /* No 17" Macbooks (yet) */
430 goto exit; 452 goto exit;
431 453
432 /* 17" Powerbooks have extra X sensors */ 454 /* 17" Powerbooks have extra X sensors */
433 for (i = (atp_is_geyser_2(dev)?15:16); i < ATP_XSENSORS; i++) { 455 for (i = (atp_is_geyser_2(dev) ? 15 : 16); i < ATP_XSENSORS; i++) {
434 if (!dev->xy_cur[i]) continue; 456 if (!dev->xy_cur[i])
457 continue;
435 458
436 printk("appletouch: 17\" model detected.\n"); 459 printk(KERN_INFO "appletouch: 17\" model detected.\n");
437 if(atp_is_geyser_2(dev)) 460 if (atp_is_geyser_2(dev))
438 input_set_abs_params(dev->input, ABS_X, 0, 461 input_set_abs_params(dev->input, ABS_X, 0,
439 (20 - 1) * 462 (20 - 1) *
440 ATP_XFACT - 1, 463 ATP_XFACT - 1,
@@ -444,10 +467,10 @@ static void atp_complete(struct urb* urb)
444 (ATP_XSENSORS - 1) * 467 (ATP_XSENSORS - 1) *
445 ATP_XFACT - 1, 468 ATP_XFACT - 1,
446 ATP_FUZZ, 0); 469 ATP_FUZZ, 0);
447
448 break; 470 break;
449 } 471 }
450 472
473 dev->size_detect_done = 1;
451 goto exit; 474 goto exit;
452 } 475 }
453 476
@@ -479,7 +502,7 @@ static void atp_complete(struct urb* urb)
479 dev->y_old = y; 502 dev->y_old = y;
480 503
481 if (debug > 1) 504 if (debug > 1)
482 printk("appletouch: X: %3d Y: %3d " 505 printk(KERN_DEBUG "appletouch: X: %3d Y: %3d "
483 "Xz: %3d Yz: %3d\n", 506 "Xz: %3d Yz: %3d\n",
484 x, y, x_z, y_z); 507 x, y, x_z, y_z);
485 508
@@ -507,19 +530,25 @@ static void atp_complete(struct urb* urb)
507 input_report_key(dev->input, BTN_LEFT, key); 530 input_report_key(dev->input, BTN_LEFT, key);
508 input_sync(dev->input); 531 input_sync(dev->input);
509 532
510 /* Many Geysers will continue to send packets continually after 533 /*
511 the first touch unless reinitialised. Do so if it's been 534 * Many Geysers will continue to send packets continually after
512 idle for a while in order to avoid waking the kernel up 535 * the first touch unless reinitialised. Do so if it's been
513 several hundred times a second */ 536 * idle for a while in order to avoid waking the kernel up
514 537 * several hundred times a second. Re-initialization does not
515 if (!x && !y && !key) { 538 * work on Fountain touchpads.
516 dev->idlecount++; 539 */
517 if (dev->idlecount == 10) { 540 if (!atp_is_fountain(dev)) {
518 dev->valid = 0; 541 if (!x && !y && !key) {
519 schedule_work(&dev->work); 542 dev->idlecount++;
520 } 543 if (dev->idlecount == 10) {
521 } else 544 dev->valid = 0;
522 dev->idlecount = 0; 545 schedule_work(&dev->work);
546 /* Don't resubmit urb here, wait for reinit */
547 return;
548 }
549 } else
550 dev->idlecount = 0;
551 }
523 552
524exit: 553exit:
525 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 554 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
@@ -593,12 +622,12 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id
593 else 622 else
594 dev->datalen = 81; 623 dev->datalen = 81;
595 624
596 if (atp_is_geyser_3(dev)) { 625 if (!atp_is_fountain(dev)) {
597 /* switch to raw sensor mode */ 626 /* switch to raw sensor mode */
598 if (atp_geyser3_init(udev)) 627 if (atp_geyser_init(udev))
599 goto err_free_devs; 628 goto err_free_devs;
600 629
601 printk("appletouch Geyser 3 inited.\n"); 630 printk(KERN_INFO "appletouch: Geyser mode initialized.\n");
602 } 631 }
603 632
604 dev->urb = usb_alloc_urb(0, GFP_KERNEL); 633 dev->urb = usb_alloc_urb(0, GFP_KERNEL);
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c
index 655a3921743..26ec09529b5 100644
--- a/drivers/input/mouse/inport.c
+++ b/drivers/input/mouse/inport.c
@@ -144,7 +144,7 @@ static int __init inport_init(void)
144 b = inb(INPORT_SIGNATURE_PORT); 144 b = inb(INPORT_SIGNATURE_PORT);
145 c = inb(INPORT_SIGNATURE_PORT); 145 c = inb(INPORT_SIGNATURE_PORT);
146 if (a == b || a != c) { 146 if (a == b || a != c) {
147 printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE); 147 printk(KERN_INFO "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE);
148 err = -ENODEV; 148 err = -ENODEV;
149 goto err_release_region; 149 goto err_release_region;
150 } 150 }
diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c
index b23a4f3ea5c..37e7c75b43b 100644
--- a/drivers/input/mouse/logibm.c
+++ b/drivers/input/mouse/logibm.c
@@ -134,7 +134,7 @@ static int __init logibm_init(void)
134 udelay(100); 134 udelay(100);
135 135
136 if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) { 136 if (inb(LOGIBM_SIGNATURE_PORT) != LOGIBM_SIGNATURE_BYTE) {
137 printk(KERN_ERR "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE); 137 printk(KERN_INFO "logibm.c: Didn't find Logitech busmouse at %#x\n", LOGIBM_BASE);
138 err = -ENODEV; 138 err = -ENODEV;
139 goto err_release_region; 139 goto err_release_region;
140 } 140 }
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index 6af199805ff..02b3ad8c082 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -944,11 +944,7 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d)
944 944
945#endif /* __hppa__ */ 945#endif /* __hppa__ */
946 946
947#if !defined(__mc68000__) /* Link error on m68k! */
948static void __exit hp_sdc_exit(void)
949#else
950static void hp_sdc_exit(void) 947static void hp_sdc_exit(void)
951#endif
952{ 948{
953 write_lock_irq(&hp_sdc.lock); 949 write_lock_irq(&hp_sdc.lock);
954 950
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index a3b945ac325..7832d8ba8e4 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -109,7 +109,7 @@ config HISAX_16_3
109 109
110config HISAX_TELESPCI 110config HISAX_TELESPCI
111 bool "Teles PCI" 111 bool "Teles PCI"
112 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 112 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
113 help 113 help
114 This enables HiSax support for the Teles PCI. 114 This enables HiSax support for the Teles PCI.
115 See <file:Documentation/isdn/README.HiSax> on how to configure it. 115 See <file:Documentation/isdn/README.HiSax> on how to configure it.
@@ -237,7 +237,7 @@ config HISAX_MIC
237 237
238config HISAX_NETJET 238config HISAX_NETJET
239 bool "NETjet card" 239 bool "NETjet card"
240 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 240 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
241 help 241 help
242 This enables HiSax support for the NetJet from Traverse 242 This enables HiSax support for the NetJet from Traverse
243 Technologies. 243 Technologies.
@@ -248,7 +248,7 @@ config HISAX_NETJET
248 248
249config HISAX_NETJET_U 249config HISAX_NETJET_U
250 bool "NETspider U card" 250 bool "NETspider U card"
251 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 251 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
252 help 252 help
253 This enables HiSax support for the Netspider U interface ISDN card 253 This enables HiSax support for the Netspider U interface ISDN card
254 from Traverse Technologies. 254 from Traverse Technologies.
@@ -287,7 +287,7 @@ config HISAX_HSTSAPHIR
287 287
288config HISAX_BKM_A4T 288config HISAX_BKM_A4T
289 bool "Telekom A4T card" 289 bool "Telekom A4T card"
290 depends on PCI 290 depends on PCI && PCI_LEGACY
291 help 291 help
292 This enables HiSax support for the Telekom A4T card. 292 This enables HiSax support for the Telekom A4T card.
293 293
@@ -297,7 +297,7 @@ config HISAX_BKM_A4T
297 297
298config HISAX_SCT_QUADRO 298config HISAX_SCT_QUADRO
299 bool "Scitel Quadro card" 299 bool "Scitel Quadro card"
300 depends on PCI 300 depends on PCI && PCI_LEGACY
301 help 301 help
302 This enables HiSax support for the Scitel Quadro card. 302 This enables HiSax support for the Scitel Quadro card.
303 303
@@ -316,7 +316,7 @@ config HISAX_GAZEL
316 316
317config HISAX_HFC_PCI 317config HISAX_HFC_PCI
318 bool "HFC PCI-Bus cards" 318 bool "HFC PCI-Bus cards"
319 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 319 depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
320 help 320 help
321 This enables HiSax support for the HFC-S PCI 2BDS0 based cards. 321 This enables HiSax support for the HFC-S PCI 2BDS0 based cards.
322 322
@@ -325,7 +325,7 @@ config HISAX_HFC_PCI
325 325
326config HISAX_W6692 326config HISAX_W6692
327 bool "Winbond W6692 based cards" 327 bool "Winbond W6692 based cards"
328 depends on PCI 328 depends on PCI && PCI_LEGACY
329 help 329 help
330 This enables HiSax support for Winbond W6692 based PCI ISDN cards. 330 This enables HiSax support for Winbond W6692 based PCI ISDN cards.
331 331
@@ -341,7 +341,7 @@ config HISAX_HFC_SX
341 341
342config HISAX_ENTERNOW_PCI 342config HISAX_ENTERNOW_PCI
343 bool "Formula-n enter:now PCI card" 343 bool "Formula-n enter:now PCI card"
344 depends on HISAX_NETJET && PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV)) 344 depends on HISAX_NETJET && PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
345 help 345 help
346 This enables HiSax support for the Formula-n enter:now PCI 346 This enables HiSax support for the Formula-n enter:now PCI
347 ISDN card. 347 ISDN card.
@@ -411,7 +411,7 @@ config HISAX_HFC4S8S
411 411
412config HISAX_FRITZ_PCIPNP 412config HISAX_FRITZ_PCIPNP
413 tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)" 413 tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)"
414 depends on PCI && EXPERIMENTAL 414 depends on PCI && PCI_LEGACY && EXPERIMENTAL
415 help 415 help
416 This enables the driver for the AVM Fritz!Card PCI, 416 This enables the driver for the AVM Fritz!Card PCI,
417 Fritz!Card PCI v2 and Fritz!Card PnP. 417 Fritz!Card PCI v2 and Fritz!Card PnP.
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index f8b79783c8b..035d158779d 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -830,7 +830,7 @@ static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
830 830
831#endif /* __ISAPNP__ */ 831#endif /* __ISAPNP__ */
832 832
833#ifndef CONFIG_PCI 833#ifndef CONFIG_PCI_LEGACY
834 834
835static int __devinit avm_pci_setup(struct IsdnCardState *cs) 835static int __devinit avm_pci_setup(struct IsdnCardState *cs)
836{ 836{
@@ -872,7 +872,7 @@ static int __devinit avm_pci_setup(struct IsdnCardState *cs)
872 return (1); 872 return (1);
873} 873}
874 874
875#endif /* CONFIG_PCI */ 875#endif /* CONFIG_PCI_LEGACY */
876 876
877int __devinit 877int __devinit
878setup_avm_pcipnp(struct IsdnCard *card) 878setup_avm_pcipnp(struct IsdnCard *card)
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 82674507874..2d670856d14 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -1148,7 +1148,7 @@ static int __devinit setup_diva_isapnp(struct IsdnCard *card)
1148 1148
1149#endif /* ISAPNP */ 1149#endif /* ISAPNP */
1150 1150
1151#ifdef CONFIG_PCI 1151#ifdef CONFIG_PCI_LEGACY
1152static struct pci_dev *dev_diva __devinitdata = NULL; 1152static struct pci_dev *dev_diva __devinitdata = NULL;
1153static struct pci_dev *dev_diva_u __devinitdata = NULL; 1153static struct pci_dev *dev_diva_u __devinitdata = NULL;
1154static struct pci_dev *dev_diva201 __devinitdata = NULL; 1154static struct pci_dev *dev_diva201 __devinitdata = NULL;
@@ -1229,14 +1229,14 @@ static int __devinit setup_diva_pci(struct IsdnCard *card)
1229 return (1); /* card found */ 1229 return (1); /* card found */
1230} 1230}
1231 1231
1232#else /* if !CONFIG_PCI */ 1232#else /* if !CONFIG_PCI_LEGACY */
1233 1233
1234static int __devinit setup_diva_pci(struct IsdnCard *card) 1234static int __devinit setup_diva_pci(struct IsdnCard *card)
1235{ 1235{
1236 return (-1); /* card not found; continue search */ 1236 return (-1); /* card not found; continue search */
1237} 1237}
1238 1238
1239#endif /* CONFIG_PCI */ 1239#endif /* CONFIG_PCI_LEGACY */
1240 1240
1241int __devinit 1241int __devinit
1242setup_diva(struct IsdnCard *card) 1242setup_diva(struct IsdnCard *card)
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index 948a9b290fd..d272d8ce653 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -883,7 +883,7 @@ setup_elsa_isa(struct IsdnCard *card)
883 val += 'A' - 3; 883 val += 'A' - 3;
884 if (val == 'B' || val == 'C') 884 if (val == 'B' || val == 'C')
885 val ^= 1; 885 val ^= 1;
886 if ((cs->subtyp == ELSA_PCFPRO) && (val = 'G')) 886 if ((cs->subtyp == ELSA_PCFPRO) && (val == 'G'))
887 val = 'C'; 887 val = 'C';
888 printk(KERN_INFO 888 printk(KERN_INFO
889 "Elsa: %s found at %#lx Rev.:%c IRQ %d\n", 889 "Elsa: %s found at %#lx Rev.:%c IRQ %d\n",
@@ -1025,7 +1025,7 @@ setup_elsa_pcmcia(struct IsdnCard *card)
1025 cs->irq); 1025 cs->irq);
1026} 1026}
1027 1027
1028#ifdef CONFIG_PCI 1028#ifdef CONFIG_PCI_LEGACY
1029static struct pci_dev *dev_qs1000 __devinitdata = NULL; 1029static struct pci_dev *dev_qs1000 __devinitdata = NULL;
1030static struct pci_dev *dev_qs3000 __devinitdata = NULL; 1030static struct pci_dev *dev_qs3000 __devinitdata = NULL;
1031 1031
@@ -1093,7 +1093,7 @@ setup_elsa_pci(struct IsdnCard *card)
1093{ 1093{
1094 return (1); 1094 return (1);
1095} 1095}
1096#endif /* CONFIG_PCI */ 1096#endif /* CONFIG_PCI_LEGACY */
1097 1097
1098static int __devinit 1098static int __devinit
1099setup_elsa_common(struct IsdnCard *card) 1099setup_elsa_common(struct IsdnCard *card)
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index 3efa719b6d2..f66620ad8e7 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -532,6 +532,7 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
532 return (0); 532 return (0);
533} 533}
534 534
535#ifdef CONFIG_PCI_LEGACY
535static struct pci_dev *dev_tel __devinitdata = NULL; 536static struct pci_dev *dev_tel __devinitdata = NULL;
536 537
537static int __devinit 538static int __devinit
@@ -620,6 +621,7 @@ setup_gazelpci(struct IsdnCardState *cs)
620 621
621 return (0); 622 return (0);
622} 623}
624#endif /* CONFIG_PCI_LEGACY */
623 625
624int __devinit 626int __devinit
625setup_gazel(struct IsdnCard *card) 627setup_gazel(struct IsdnCard *card)
@@ -639,7 +641,7 @@ setup_gazel(struct IsdnCard *card)
639 return (0); 641 return (0);
640 } else { 642 } else {
641 643
642#ifdef CONFIG_PCI 644#ifdef CONFIG_PCI_LEGACY
643 if (setup_gazelpci(cs)) 645 if (setup_gazelpci(cs))
644 return (0); 646 return (0);
645#else 647#else
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index e5918c6fe73..bd9921128aa 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -223,7 +223,6 @@ static int niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
223 return 0; 223 return 0;
224} 224}
225 225
226static struct pci_dev *niccy_dev __devinitdata = NULL;
227#ifdef __ISAPNP__ 226#ifdef __ISAPNP__
228static struct pnp_card *pnp_c __devinitdata = NULL; 227static struct pnp_card *pnp_c __devinitdata = NULL;
229#endif 228#endif
@@ -299,7 +298,9 @@ int __devinit setup_niccy(struct IsdnCard *card)
299 return 0; 298 return 0;
300 } 299 }
301 } else { 300 } else {
302#ifdef CONFIG_PCI 301#ifdef CONFIG_PCI_LEGACY
302 static struct pci_dev *niccy_dev __devinitdata;
303
303 u_int pci_ioaddr; 304 u_int pci_ioaddr;
304 cs->subtyp = 0; 305 cs->subtyp = 0;
305 if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM, 306 if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM,
@@ -356,7 +357,7 @@ int __devinit setup_niccy(struct IsdnCard *card)
356 printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n"); 357 printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
357 printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n"); 358 printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
358 return 0; 359 return 0;
359#endif /* CONFIG_PCI */ 360#endif /* CONFIG_PCI_LEGACY */
360 } 361 }
361 printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n", 362 printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
362 CardType[cs->typ], (cs->subtyp == 1) ? "PnP" : "PCI", 363 CardType[cs->typ], (cs->subtyp == 1) ? "PnP" : "PCI",
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c
index 03dfc32166a..95425f3d222 100644
--- a/drivers/isdn/hisax/sedlbauer.c
+++ b/drivers/isdn/hisax/sedlbauer.c
@@ -600,7 +600,7 @@ setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
600} 600}
601#endif /* __ISAPNP__ */ 601#endif /* __ISAPNP__ */
602 602
603#ifdef CONFIG_PCI 603#ifdef CONFIG_PCI_LEGACY
604static struct pci_dev *dev_sedl __devinitdata = NULL; 604static struct pci_dev *dev_sedl __devinitdata = NULL;
605 605
606static int __devinit 606static int __devinit
@@ -675,7 +675,7 @@ setup_sedlbauer_pci(struct IsdnCard *card)
675 return (1); 675 return (1);
676} 676}
677 677
678#endif /* CONFIG_PCI */ 678#endif /* CONFIG_PCI_LEGACY */
679 679
680int __devinit 680int __devinit
681setup_sedlbauer(struct IsdnCard *card) 681setup_sedlbauer(struct IsdnCard *card)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 47d90db280c..99bc50059d3 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -60,7 +60,7 @@ static void gpio_led_set(struct led_classdev *led_cdev,
60 gpio_set_value(led_dat->gpio, level); 60 gpio_set_value(led_dat->gpio, level);
61} 61}
62 62
63static int __init gpio_led_probe(struct platform_device *pdev) 63static int gpio_led_probe(struct platform_device *pdev)
64{ 64{
65 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 65 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
66 struct gpio_led *cur_led; 66 struct gpio_led *cur_led;
@@ -93,13 +93,13 @@ static int __init gpio_led_probe(struct platform_device *pdev)
93 93
94 gpio_direction_output(led_dat->gpio, led_dat->active_low); 94 gpio_direction_output(led_dat->gpio, led_dat->active_low);
95 95
96 INIT_WORK(&led_dat->work, gpio_led_work);
97
96 ret = led_classdev_register(&pdev->dev, &led_dat->cdev); 98 ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
97 if (ret < 0) { 99 if (ret < 0) {
98 gpio_free(led_dat->gpio); 100 gpio_free(led_dat->gpio);
99 goto err; 101 goto err;
100 } 102 }
101
102 INIT_WORK(&led_dat->work, gpio_led_work);
103 } 103 }
104 104
105 platform_set_drvdata(pdev, leds_data); 105 platform_set_drvdata(pdev, leds_data);
@@ -110,17 +110,17 @@ err:
110 if (i > 0) { 110 if (i > 0) {
111 for (i = i - 1; i >= 0; i--) { 111 for (i = i - 1; i >= 0; i--) {
112 led_classdev_unregister(&leds_data[i].cdev); 112 led_classdev_unregister(&leds_data[i].cdev);
113 cancel_work_sync(&leds_data[i].work);
113 gpio_free(leds_data[i].gpio); 114 gpio_free(leds_data[i].gpio);
114 } 115 }
115 } 116 }
116 117
117 flush_scheduled_work();
118 kfree(leds_data); 118 kfree(leds_data);
119 119
120 return ret; 120 return ret;
121} 121}
122 122
123static int __exit gpio_led_remove(struct platform_device *pdev) 123static int __devexit gpio_led_remove(struct platform_device *pdev)
124{ 124{
125 int i; 125 int i;
126 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 126 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
@@ -130,9 +130,10 @@ static int __exit gpio_led_remove(struct platform_device *pdev)
130 130
131 for (i = 0; i < pdata->num_leds; i++) { 131 for (i = 0; i < pdata->num_leds; i++) {
132 led_classdev_unregister(&leds_data[i].cdev); 132 led_classdev_unregister(&leds_data[i].cdev);
133 cancel_work_sync(&leds_data[i].work);
133 gpio_free(leds_data[i].gpio); 134 gpio_free(leds_data[i].gpio);
134 } 135 }
135 136
136 kfree(leds_data); 137 kfree(leds_data);
137 138
138 return 0; 139 return 0;
@@ -144,7 +145,7 @@ static int gpio_led_suspend(struct platform_device *pdev, pm_message_t state)
144 struct gpio_led_platform_data *pdata = pdev->dev.platform_data; 145 struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
145 struct gpio_led_data *leds_data; 146 struct gpio_led_data *leds_data;
146 int i; 147 int i;
147 148
148 leds_data = platform_get_drvdata(pdev); 149 leds_data = platform_get_drvdata(pdev);
149 150
150 for (i = 0; i < pdata->num_leds; i++) 151 for (i = 0; i < pdata->num_leds; i++)
@@ -172,7 +173,8 @@ static int gpio_led_resume(struct platform_device *pdev)
172#endif 173#endif
173 174
174static struct platform_driver gpio_led_driver = { 175static struct platform_driver gpio_led_driver = {
175 .remove = __exit_p(gpio_led_remove), 176 .probe = gpio_led_probe,
177 .remove = __devexit_p(gpio_led_remove),
176 .suspend = gpio_led_suspend, 178 .suspend = gpio_led_suspend,
177 .resume = gpio_led_resume, 179 .resume = gpio_led_resume,
178 .driver = { 180 .driver = {
@@ -183,7 +185,7 @@ static struct platform_driver gpio_led_driver = {
183 185
184static int __init gpio_led_init(void) 186static int __init gpio_led_init(void)
185{ 187{
186 return platform_driver_probe(&gpio_led_driver, gpio_led_probe); 188 return platform_driver_register(&gpio_led_driver);
187} 189}
188 190
189static void __exit gpio_led_exit(void) 191static void __exit gpio_led_exit(void)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 8939e610508..5a7eb650181 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -102,6 +102,8 @@ static void combine_restrictions_low(struct io_restrictions *lhs,
102 lhs->seg_boundary_mask = 102 lhs->seg_boundary_mask =
103 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask); 103 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask);
104 104
105 lhs->bounce_pfn = min_not_zero(lhs->bounce_pfn, rhs->bounce_pfn);
106
105 lhs->no_cluster |= rhs->no_cluster; 107 lhs->no_cluster |= rhs->no_cluster;
106} 108}
107 109
@@ -566,6 +568,8 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
566 min_not_zero(rs->seg_boundary_mask, 568 min_not_zero(rs->seg_boundary_mask,
567 q->seg_boundary_mask); 569 q->seg_boundary_mask);
568 570
571 rs->bounce_pfn = min_not_zero(rs->bounce_pfn, q->bounce_pfn);
572
569 rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); 573 rs->no_cluster |= !test_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
570} 574}
571EXPORT_SYMBOL_GPL(dm_set_device_limits); 575EXPORT_SYMBOL_GPL(dm_set_device_limits);
@@ -707,6 +711,8 @@ static void check_for_valid_limits(struct io_restrictions *rs)
707 rs->max_segment_size = MAX_SEGMENT_SIZE; 711 rs->max_segment_size = MAX_SEGMENT_SIZE;
708 if (!rs->seg_boundary_mask) 712 if (!rs->seg_boundary_mask)
709 rs->seg_boundary_mask = -1; 713 rs->seg_boundary_mask = -1;
714 if (!rs->bounce_pfn)
715 rs->bounce_pfn = -1;
710} 716}
711 717
712int dm_table_add_target(struct dm_table *t, const char *type, 718int dm_table_add_target(struct dm_table *t, const char *type,
@@ -891,6 +897,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
891 q->hardsect_size = t->limits.hardsect_size; 897 q->hardsect_size = t->limits.hardsect_size;
892 q->max_segment_size = t->limits.max_segment_size; 898 q->max_segment_size = t->limits.max_segment_size;
893 q->seg_boundary_mask = t->limits.seg_boundary_mask; 899 q->seg_boundary_mask = t->limits.seg_boundary_mask;
900 q->bounce_pfn = t->limits.bounce_pfn;
894 if (t->limits.no_cluster) 901 if (t->limits.no_cluster)
895 q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER); 902 q->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER);
896 else 903 else
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 80a67d789b7..82af3465a90 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2624,6 +2624,13 @@ static void handle_stripe5(struct stripe_head *sh)
2624 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); 2624 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);
2625 /* Now to look around and see what can be done */ 2625 /* Now to look around and see what can be done */
2626 2626
2627 /* clean-up completed biofill operations */
2628 if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) {
2629 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
2630 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
2631 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
2632 }
2633
2627 rcu_read_lock(); 2634 rcu_read_lock();
2628 for (i=disks; i--; ) { 2635 for (i=disks; i--; ) {
2629 mdk_rdev_t *rdev; 2636 mdk_rdev_t *rdev;
@@ -2897,13 +2904,6 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
2897 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state); 2904 s.expanded = test_bit(STRIPE_EXPAND_READY, &sh->state);
2898 /* Now to look around and see what can be done */ 2905 /* Now to look around and see what can be done */
2899 2906
2900 /* clean-up completed biofill operations */
2901 if (test_bit(STRIPE_OP_BIOFILL, &sh->ops.complete)) {
2902 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.pending);
2903 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.ack);
2904 clear_bit(STRIPE_OP_BIOFILL, &sh->ops.complete);
2905 }
2906
2907 rcu_read_lock(); 2907 rcu_read_lock();
2908 for (i=disks; i--; ) { 2908 for (i=disks; i--; ) {
2909 mdk_rdev_t *rdev; 2909 mdk_rdev_t *rdev;
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index dd9bd4310c8..1604f049040 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -151,6 +151,7 @@ config VIDEO_IR_I2C
151 151
152config VIDEO_IR 152config VIDEO_IR
153 tristate 153 tristate
154 depends on INPUT
154 select VIDEO_IR_I2C if I2C 155 select VIDEO_IR_I2C if I2C
155 156
156config VIDEO_TVEEPROM 157config VIDEO_TVEEPROM
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index cb034ead95a..7d04a6fd1ac 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -59,43 +59,89 @@ void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data)
59} 59}
60 60
61/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */ 61/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */
62int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) 62static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev,
63 unsigned long us1, unsigned long us2)
63{ 64{
64 unsigned long start; 65 unsigned long timeout;
65 int err; 66 int err;
66 67
67 /* wait for registers to be programmed */ 68 /* wait for registers to be programmed */
68 start = jiffies; 69 timeout = jiffies + usecs_to_jiffies(us1);
69 while (1) { 70 while (1) {
70 err = time_after(jiffies, start + HZ/20); 71 err = time_after(jiffies, timeout);
71 if (saa7146_read(dev, MC2) & 2) 72 if (saa7146_read(dev, MC2) & 2)
72 break; 73 break;
73 if (err) { 74 if (err) {
74 DEB_S(("timed out while waiting for registers getting programmed\n")); 75 printk(KERN_ERR "%s: %s timed out while waiting for "
76 "registers getting programmed\n",
77 dev->name, __FUNCTION__);
75 return -ETIMEDOUT; 78 return -ETIMEDOUT;
76 } 79 }
77 if (nobusyloop) 80 msleep(1);
78 msleep(1);
79 } 81 }
80 82
81 /* wait for transfer to complete */ 83 /* wait for transfer to complete */
82 start = jiffies; 84 timeout = jiffies + usecs_to_jiffies(us2);
83 while (1) { 85 while (1) {
84 err = time_after(jiffies, start + HZ/4); 86 err = time_after(jiffies, timeout);
85 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) 87 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
86 break; 88 break;
87 saa7146_read(dev, MC2); 89 saa7146_read(dev, MC2);
88 if (err) { 90 if (err) {
89 DEB_S(("timed out while waiting for transfer completion\n")); 91 DEB_S(("%s: %s timed out while waiting for transfer "
92 "completion\n", dev->name, __FUNCTION__));
90 return -ETIMEDOUT; 93 return -ETIMEDOUT;
91 } 94 }
92 if (nobusyloop) 95 msleep(1);
93 msleep(1);
94 } 96 }
95 97
96 return 0; 98 return 0;
97} 99}
98 100
101static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev,
102 unsigned long us1, unsigned long us2)
103{
104 unsigned long loops;
105
106 /* wait for registers to be programmed */
107 loops = us1;
108 while (1) {
109 if (saa7146_read(dev, MC2) & 2)
110 break;
111 if (!loops--) {
112 printk(KERN_ERR "%s: %s timed out while waiting for "
113 "registers getting programmed\n",
114 dev->name, __FUNCTION__);
115 return -ETIMEDOUT;
116 }
117 udelay(1);
118 }
119
120 /* wait for transfer to complete */
121 loops = us2 / 5;
122 while (1) {
123 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
124 break;
125 saa7146_read(dev, MC2);
126 if (!loops--) {
127 DEB_S(("%s: %s timed out while waiting for transfer "
128 "completion\n", dev->name, __FUNCTION__));
129 return -ETIMEDOUT;
130 }
131 udelay(5);
132 }
133
134 return 0;
135}
136
137int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop)
138{
139 if (nobusyloop)
140 return saa7146_wait_for_debi_done_sleep(dev, 50000, 250000);
141 else
142 return saa7146_wait_for_debi_done_busyloop(dev, 50000, 250000);
143}
144
99/**************************************************************************** 145/****************************************************************************
100 * general helper functions 146 * general helper functions
101 ****************************************************************************/ 147 ****************************************************************************/
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c
index 4b93931de4e..13cf1666817 100644
--- a/drivers/media/dvb/frontends/mt2131.c
+++ b/drivers/media/dvb/frontends/mt2131.c
@@ -116,7 +116,7 @@ static int mt2131_set_params(struct dvb_frontend *fe,
116 f_lo1 = (f_lo1 / 250) * 250; 116 f_lo1 = (f_lo1 / 250) * 250;
117 f_lo2 = f_lo1 - freq - MT2131_IF2; 117 f_lo2 = f_lo1 - freq - MT2131_IF2;
118 118
119 priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000, 119 priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000;
120 120
121 /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */ 121 /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */
122 num1 = f_lo1 * 64 / (MT2131_FREF / 128); 122 num1 = f_lo1 * 64 / (MT2131_FREF / 128);
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c
index 30e8a705fad..8dee7ec9456 100644
--- a/drivers/media/dvb/frontends/s5h1409.c
+++ b/drivers/media/dvb/frontends/s5h1409.c
@@ -42,6 +42,9 @@ struct s5h1409_state {
42 fe_modulation_t current_modulation; 42 fe_modulation_t current_modulation;
43 43
44 u32 current_frequency; 44 u32 current_frequency;
45
46 u32 is_qam_locked;
47 u32 qam_state;
45}; 48};
46 49
47static int debug = 0; 50static int debug = 0;
@@ -94,6 +97,7 @@ static struct init_tab {
94 { 0xac, 0x1003, }, 97 { 0xac, 0x1003, },
95 { 0xad, 0x103f, }, 98 { 0xad, 0x103f, },
96 { 0xe2, 0x0100, }, 99 { 0xe2, 0x0100, },
100 { 0xe3, 0x0000, },
97 { 0x28, 0x1010, }, 101 { 0x28, 0x1010, },
98 { 0xb1, 0x000e, }, 102 { 0xb1, 0x000e, },
99}; 103};
@@ -335,6 +339,8 @@ static int s5h1409_softreset(struct dvb_frontend* fe)
335 339
336 s5h1409_writereg(state, 0xf5, 0); 340 s5h1409_writereg(state, 0xf5, 0);
337 s5h1409_writereg(state, 0xf5, 1); 341 s5h1409_writereg(state, 0xf5, 1);
342 state->is_qam_locked = 0;
343 state->qam_state = 0;
338 return 0; 344 return 0;
339} 345}
340 346
@@ -349,6 +355,11 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz)
349 s5h1409_writereg(state, 0x87, 0x01be); 355 s5h1409_writereg(state, 0x87, 0x01be);
350 s5h1409_writereg(state, 0x88, 0x0436); 356 s5h1409_writereg(state, 0x88, 0x0436);
351 s5h1409_writereg(state, 0x89, 0x054d); 357 s5h1409_writereg(state, 0x89, 0x054d);
358 } else
359 if (KHz == 4000) {
360 s5h1409_writereg(state, 0x87, 0x014b);
361 s5h1409_writereg(state, 0x88, 0x0cb5);
362 s5h1409_writereg(state, 0x89, 0x03e2);
352 } else { 363 } else {
353 printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz); 364 printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz);
354 ret = -1; 365 ret = -1;
@@ -361,7 +372,7 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted)
361{ 372{
362 struct s5h1409_state* state = fe->demodulator_priv; 373 struct s5h1409_state* state = fe->demodulator_priv;
363 374
364 dprintk("%s()\n", __FUNCTION__); 375 dprintk("%s(%d)\n", __FUNCTION__, inverted);
365 376
366 if(inverted == 1) 377 if(inverted == 1)
367 return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ 378 return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */
@@ -382,14 +393,10 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe,
382 s5h1409_writereg(state, 0xf4, 0); 393 s5h1409_writereg(state, 0xf4, 0);
383 break; 394 break;
384 case QAM_64: 395 case QAM_64:
385 dprintk("%s() QAM_64\n", __FUNCTION__);
386 s5h1409_writereg(state, 0xf4, 1);
387 s5h1409_writereg(state, 0x85, 0x100);
388 break;
389 case QAM_256: 396 case QAM_256:
390 dprintk("%s() QAM_256\n", __FUNCTION__); 397 dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__);
391 s5h1409_writereg(state, 0xf4, 1); 398 s5h1409_writereg(state, 0xf4, 1);
392 s5h1409_writereg(state, 0x85, 0x101); 399 s5h1409_writereg(state, 0x85, 0x110);
393 break; 400 break;
394 default: 401 default:
395 dprintk("%s() Invalid modulation\n", __FUNCTION__); 402 dprintk("%s() Invalid modulation\n", __FUNCTION__);
@@ -423,7 +430,7 @@ static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable)
423 if (enable) 430 if (enable)
424 return s5h1409_writereg(state, 0xe3, 0x1100); 431 return s5h1409_writereg(state, 0xe3, 0x1100);
425 else 432 else
426 return s5h1409_writereg(state, 0xe3, 0); 433 return s5h1409_writereg(state, 0xe3, 0x1000);
427} 434}
428 435
429static int s5h1409_sleep(struct dvb_frontend* fe, int enable) 436static int s5h1409_sleep(struct dvb_frontend* fe, int enable)
@@ -444,6 +451,66 @@ static int s5h1409_register_reset(struct dvb_frontend* fe)
444 return s5h1409_writereg(state, 0xfa, 0); 451 return s5h1409_writereg(state, 0xfa, 0);
445} 452}
446 453
454static void s5h1409_set_qam_amhum_mode(struct dvb_frontend *fe)
455{
456 struct s5h1409_state *state = fe->demodulator_priv;
457 u16 reg;
458
459 if (state->is_qam_locked)
460 return;
461
462 /* QAM EQ lock check */
463 reg = s5h1409_readreg(state, 0xf0);
464
465 if ((reg >> 13) & 0x1) {
466
467 state->is_qam_locked = 1;
468 reg &= 0xff;
469
470 s5h1409_writereg(state, 0x96, 0x00c);
471 if ((reg < 0x38) || (reg > 0x68) ) {
472 s5h1409_writereg(state, 0x93, 0x3332);
473 s5h1409_writereg(state, 0x9e, 0x2c37);
474 } else {
475 s5h1409_writereg(state, 0x93, 0x3130);
476 s5h1409_writereg(state, 0x9e, 0x2836);
477 }
478
479 } else {
480 s5h1409_writereg(state, 0x96, 0x0008);
481 s5h1409_writereg(state, 0x93, 0x3332);
482 s5h1409_writereg(state, 0x9e, 0x2c37);
483 }
484}
485
486static void s5h1409_set_qam_interleave_mode(struct dvb_frontend *fe)
487{
488 struct s5h1409_state *state = fe->demodulator_priv;
489 u16 reg, reg1, reg2;
490
491 reg = s5h1409_readreg(state, 0xf1);
492
493 /* Master lock */
494 if ((reg >> 15) & 0x1) {
495 if (state->qam_state != 2) {
496 state->qam_state = 2;
497 reg1 = s5h1409_readreg(state, 0xb2);
498 reg2 = s5h1409_readreg(state, 0xad);
499
500 s5h1409_writereg(state, 0x96, 0x20);
501 s5h1409_writereg(state, 0xad,
502 ( ((reg1 & 0xf000) >> 4) | (reg2 & 0xf0ff)) );
503 s5h1409_writereg(state, 0xab, 0x1100);
504 }
505 } else {
506 if (state->qam_state != 1) {
507 state->qam_state = 1;
508 s5h1409_writereg(state, 0x96, 0x08);
509 s5h1409_writereg(state, 0xab, 0x1101);
510 }
511 }
512}
513
447/* Talk to the demod, set the FEC, GUARD, QAM settings etc */ 514/* Talk to the demod, set the FEC, GUARD, QAM settings etc */
448static int s5h1409_set_frontend (struct dvb_frontend* fe, 515static int s5h1409_set_frontend (struct dvb_frontend* fe,
449 struct dvb_frontend_parameters *p) 516 struct dvb_frontend_parameters *p)
@@ -458,12 +525,21 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe,
458 525
459 s5h1409_enable_modulation(fe, p->u.vsb.modulation); 526 s5h1409_enable_modulation(fe, p->u.vsb.modulation);
460 527
528 /* Allow the demod to settle */
529 msleep(100);
530
461 if (fe->ops.tuner_ops.set_params) { 531 if (fe->ops.tuner_ops.set_params) {
462 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); 532 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1);
463 fe->ops.tuner_ops.set_params(fe, p); 533 fe->ops.tuner_ops.set_params(fe, p);
464 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); 534 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
465 } 535 }
466 536
537 /* Optimize the demod for QAM */
538 if (p->u.vsb.modulation != VSB_8) {
539 s5h1409_set_qam_amhum_mode(fe);
540 s5h1409_set_qam_interleave_mode(fe);
541 }
542
467 return 0; 543 return 0;
468} 544}
469 545
@@ -495,8 +571,8 @@ static int s5h1409_init (struct dvb_frontend* fe)
495 s5h1409_set_gpio(fe, state->config->gpio); 571 s5h1409_set_gpio(fe, state->config->gpio);
496 s5h1409_softreset(fe); 572 s5h1409_softreset(fe);
497 573
498 /* Note: Leaving the I2C gate open here. */ 574 /* Note: Leaving the I2C gate closed. */
499 s5h1409_i2c_gate_ctrl(fe, 1); 575 s5h1409_i2c_gate_ctrl(fe, 0);
500 576
501 return 0; 577 return 0;
502} 578}
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c
index 17e5cb561cd..7c23775f77d 100644
--- a/drivers/media/dvb/frontends/stv0297.c
+++ b/drivers/media/dvb/frontends/stv0297.c
@@ -358,11 +358,23 @@ static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber)
358static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) 358static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
359{ 359{
360 struct stv0297_state *state = fe->demodulator_priv; 360 struct stv0297_state *state = fe->demodulator_priv;
361 u8 STRENGTH[2]; 361 u8 STRENGTH[3];
362 362 u16 tmp;
363 stv0297_readregs(state, 0x41, STRENGTH, 2); 363
364 *strength = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0]; 364 stv0297_readregs(state, 0x41, STRENGTH, 3);
365 365 tmp = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0];
366 if (STRENGTH[2] & 0x20) {
367 if (tmp < 0x200)
368 tmp = 0;
369 else
370 tmp = tmp - 0x200;
371 } else {
372 if (tmp > 0x1ff)
373 tmp = 0;
374 else
375 tmp = 0x1ff - tmp;
376 }
377 *strength = (tmp << 7) | (tmp >> 2);
366 return 0; 378 return 0;
367} 379}
368 380
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index 4cd9e82c466..45137d2ebfb 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -301,6 +301,8 @@ static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber)
301 u32 _ber = tda10021_readreg(state, 0x14) | 301 u32 _ber = tda10021_readreg(state, 0x14) |
302 (tda10021_readreg(state, 0x15) << 8) | 302 (tda10021_readreg(state, 0x15) << 8) |
303 ((tda10021_readreg(state, 0x16) & 0x0f) << 16); 303 ((tda10021_readreg(state, 0x16) & 0x0f) << 16);
304 _tda10021_writereg(state, 0x10, (tda10021_readreg(state, 0x10) & ~0xc0)
305 | (tda10021_inittab[0x10] & 0xc0));
304 *ber = 10 * _ber; 306 *ber = 10 * _ber;
305 307
306 return 0; 308 return 0;
@@ -310,7 +312,11 @@ static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength)
310{ 312{
311 struct tda10021_state* state = fe->demodulator_priv; 313 struct tda10021_state* state = fe->demodulator_priv;
312 314
315 u8 config = tda10021_readreg(state, 0x02);
313 u8 gain = tda10021_readreg(state, 0x17); 316 u8 gain = tda10021_readreg(state, 0x17);
317 if (config & 0x02)
318 /* the agc value is inverted */
319 gain = ~gain;
314 *strength = (gain << 8) | gain; 320 *strength = (gain << 8) | gain;
315 321
316 return 0; 322 return 0;
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c
index 066b73b7569..60433b5011f 100644
--- a/drivers/media/dvb/frontends/ves1820.c
+++ b/drivers/media/dvb/frontends/ves1820.c
@@ -47,7 +47,7 @@ struct ves1820_state {
47static int verbose; 47static int verbose;
48 48
49static u8 ves1820_inittab[] = { 49static u8 ves1820_inittab[] = {
50 0x69, 0x6A, 0x93, 0x12, 0x12, 0x46, 0x26, 0x1A, 50 0x69, 0x6A, 0x93, 0x1A, 0x12, 0x46, 0x26, 0x1A,
51 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20, 51 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20,
52 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 52 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 53 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index 6d53289b327..54b91f26ca6 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -84,7 +84,7 @@ config DVB_BUDGET
84 84
85config DVB_BUDGET_CI 85config DVB_BUDGET_CI
86 tristate "Budget cards with onboard CI connector" 86 tristate "Budget cards with onboard CI connector"
87 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 87 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 && INPUT
88 select VIDEO_SAA7146 88 select VIDEO_SAA7146
89 select DVB_STV0297 if !DVB_FE_CUSTOMISE 89 select DVB_STV0297 if !DVB_FE_CUSTOMISE
90 select DVB_STV0299 if !DVB_FE_CUSTOMISE 90 select DVB_STV0299 if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 2e571eb9313..c9f14bfc854 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -363,7 +363,7 @@ endmenu # encoder / decoder chips
363 363
364config VIDEO_VIVI 364config VIDEO_VIVI
365 tristate "Virtual Video Driver" 365 tristate "Virtual Video Driver"
366 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI 366 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64
367 select VIDEOBUF_VMALLOC 367 select VIDEOBUF_VMALLOC
368 default n 368 default n
369 ---help--- 369 ---help---
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 9feeb636ff9..a88b56e6ca0 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2881,10 +2881,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2881 if (NULL == fmt) 2881 if (NULL == fmt)
2882 return -EINVAL; 2882 return -EINVAL;
2883 mutex_lock(&fh->cap.lock); 2883 mutex_lock(&fh->cap.lock);
2884 if (fmt->depth != pic->depth) {
2885 retval = -EINVAL;
2886 goto fh_unlock_and_return;
2887 }
2888 if (fmt->flags & FORMAT_FLAGS_RAW) { 2884 if (fmt->flags & FORMAT_FLAGS_RAW) {
2889 /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL * 2885 /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL *
2890 RAW_LINES * 2. F1 is stored at offset 0, F2 2886 RAW_LINES * 2. F1 is stored at offset 0, F2
@@ -3117,6 +3113,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
3117 vm->width,vm->height,field); 3113 vm->width,vm->height,field);
3118 if (0 != retval) 3114 if (0 != retval)
3119 goto fh_unlock_and_return; 3115 goto fh_unlock_and_return;
3116 btv->init.width = vm->width;
3117 btv->init.height = vm->height;
3120 spin_lock_irqsave(&btv->s_lock,flags); 3118 spin_lock_irqsave(&btv->s_lock,flags);
3121 buffer_queue(&fh->cap,&buf->vb); 3119 buffer_queue(&fh->cap,&buf->vb);
3122 spin_unlock_irqrestore(&btv->s_lock,flags); 3120 spin_unlock_irqrestore(&btv->s_lock,flags);
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index 0b92c35a843..d4ac4c4b49b 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -36,7 +36,7 @@
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/input.h> 37#include <linux/input.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <asm/scatterlist.h> 39#include <linux/scatterlist.h>
40#include <asm/io.h> 40#include <asm/io.h>
41#include <media/v4l2-common.h> 41#include <media/v4l2-common.h>
42 42
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index b63cab33692..7ae499c9c54 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -3,6 +3,9 @@
3 * multifunction chip. Currently works with the Omnivision OV7670 3 * multifunction chip. Currently works with the Omnivision OV7670
4 * sensor. 4 * sensor.
5 * 5 *
6 * The data sheet for this device can be found at:
7 * http://www.marvell.com/products/pcconn/88ALP01.jsp
8 *
6 * Copyright 2006 One Laptop Per Child Association, Inc. 9 * Copyright 2006 One Laptop Per Child Association, Inc.
7 * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net> 10 * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net>
8 * 11 *
@@ -2232,13 +2235,16 @@ static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2232{ 2235{
2233 struct cafe_camera *cam = cafe_find_by_pdev(pdev); 2236 struct cafe_camera *cam = cafe_find_by_pdev(pdev);
2234 int ret; 2237 int ret;
2238 enum cafe_state cstate;
2235 2239
2236 ret = pci_save_state(pdev); 2240 ret = pci_save_state(pdev);
2237 if (ret) 2241 if (ret)
2238 return ret; 2242 return ret;
2243 cstate = cam->state; /* HACK - stop_dma sets to idle */
2239 cafe_ctlr_stop_dma(cam); 2244 cafe_ctlr_stop_dma(cam);
2240 cafe_ctlr_power_down(cam); 2245 cafe_ctlr_power_down(cam);
2241 pci_disable_device(pdev); 2246 pci_disable_device(pdev);
2247 cam->state = cstate;
2242 return 0; 2248 return 0;
2243} 2249}
2244 2250
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig
index 72004a07b2d..d8b1ccb4491 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CX23885 1config VIDEO_CX23885
2 tristate "Conexant cx23885 (2388x successor) support" 2 tristate "Conexant cx23885 (2388x successor) support"
3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C 3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index eeb5224ca10..ceb31d4a251 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CX88 1config VIDEO_CX88
2 tristate "Conexant 2388x (bt878 successor) support" 2 tristate "Conexant 2388x (bt878 successor) support"
3 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index 5b6a4037160..c1127802ad9 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_EM28XX 1config VIDEO_EM28XX
2 tristate "Empia EM2800/2820/2840 USB video capture support" 2 tristate "Empia EM2800/2820/2840 USB video capture support"
3 depends on VIDEO_V4L1 && I2C 3 depends on VIDEO_V4L1 && I2C && INPUT
4 select VIDEO_TUNER 4 select VIDEO_TUNER
5 select VIDEO_TVEEPROM 5 select VIDEO_TVEEPROM
6 select VIDEO_IR 6 select VIDEO_IR
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 997d067e32e..e3a4aa7a9df 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -416,8 +416,10 @@ static int attach_inform(struct i2c_client *client)
416 struct em28xx *dev = client->adapter->algo_data; 416 struct em28xx *dev = client->adapter->algo_data;
417 417
418 switch (client->addr << 1) { 418 switch (client->addr << 1) {
419 case 0x43: 419 case 0x86:
420 case 0x4b: 420 case 0x84:
421 case 0x96:
422 case 0x94:
421 { 423 {
422 struct tuner_setup tun_setup; 424 struct tuner_setup tun_setup;
423 425
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index a4c2a907124..2529c298b86 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -32,6 +32,7 @@
32#include <linux/usb.h> 32#include <linux/usb.h>
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/version.h> 34#include <linux/version.h>
35#include <linux/mm.h>
35#include <linux/video_decoder.h> 36#include <linux/video_decoder.h>
36#include <linux/mutex.h> 37#include <linux/mutex.h>
37 38
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c
index ce4b2f9791e..36047d4e70f 100644
--- a/drivers/media/video/planb.c
+++ b/drivers/media/video/planb.c
@@ -91,7 +91,6 @@ static void planb_close(struct video_device *);
91static int planb_ioctl(struct video_device *, unsigned int, void *); 91static int planb_ioctl(struct video_device *, unsigned int, void *);
92static int planb_init_done(struct video_device *); 92static int planb_init_done(struct video_device *);
93static int planb_mmap(struct video_device *, const char *, unsigned long); 93static int planb_mmap(struct video_device *, const char *, unsigned long);
94static void planb_irq(int, void *);
95static void release_planb(void); 94static void release_planb(void);
96int init_planbs(struct video_init *); 95int init_planbs(struct video_init *);
97 96
@@ -1315,7 +1314,7 @@ cmd_tab_data_end:
1315 return c1; 1314 return c1;
1316} 1315}
1317 1316
1318static void planb_irq(int irq, void *dev_id) 1317static irqreturn_t planb_irq(int irq, void *dev_id)
1319{ 1318{
1320 unsigned int stat, astat; 1319 unsigned int stat, astat;
1321 struct planb *pb = (struct planb *)dev_id; 1320 struct planb *pb = (struct planb *)dev_id;
@@ -1358,13 +1357,14 @@ static void planb_irq(int irq, void *dev_id)
1358 pb->frame_stat[fr] = GBUFFER_DONE; 1357 pb->frame_stat[fr] = GBUFFER_DONE;
1359 pb->grabbing--; 1358 pb->grabbing--;
1360 wake_up_interruptible(&pb->capq); 1359 wake_up_interruptible(&pb->capq);
1361 return; 1360 return IRQ_HANDLED;
1362 } 1361 }
1363 /* incorrect interrupts? */ 1362 /* incorrect interrupts? */
1364 pb->intr_mask = PLANB_CLR_IRQ; 1363 pb->intr_mask = PLANB_CLR_IRQ;
1365 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ); 1364 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ);
1366 printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts" 1365 printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts"
1367 " unconditionally\n"); 1366 " unconditionally\n");
1367 return IRQ_HANDLED;
1368} 1368}
1369 1369
1370/******************************* 1370/*******************************
@@ -2090,7 +2090,7 @@ static int init_planb(struct planb *pb)
2090 /* clear interrupt mask */ 2090 /* clear interrupt mask */
2091 pb->intr_mask = PLANB_CLR_IRQ; 2091 pb->intr_mask = PLANB_CLR_IRQ;
2092 2092
2093 result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); 2093 result = request_irq(pb->irq, planb_irq, 0, "PlanB", pb);
2094 if (result < 0) { 2094 if (result < 0) {
2095 if (result==-EINVAL) 2095 if (result==-EINVAL)
2096 printk(KERN_ERR "PlanB: Bad irq number (%d) " 2096 printk(KERN_ERR "PlanB: Bad irq number (%d) "
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index f569b00201d..46f156fb108 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -410,7 +410,7 @@ static int parse_mtoken(const char *ptr,unsigned int len,
410 int msk; 410 int msk;
411 *valptr = 0; 411 *valptr = 0;
412 for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) { 412 for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) {
413 if (!msk & valid_bits) continue; 413 if (!(msk & valid_bits)) continue;
414 valid_bits &= ~msk; 414 valid_bits &= ~msk;
415 if (!names[idx]) continue; 415 if (!names[idx]) continue;
416 slen = strlen(names[idx]); 416 slen = strlen(names[idx]);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c
index ca9e2789c8c..11b3b2e84b9 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -136,14 +136,13 @@ static int __init pvr_init(void)
136 136
137static void __exit pvr_exit(void) 137static void __exit pvr_exit(void)
138{ 138{
139
140 pvr2_trace(PVR2_TRACE_INIT,"pvr_exit"); 139 pvr2_trace(PVR2_TRACE_INIT,"pvr_exit");
141 140
141 usb_deregister(&pvr_driver);
142
142#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS 143#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
143 pvr2_sysfs_class_destroy(class_ptr); 144 pvr2_sysfs_class_destroy(class_ptr);
144#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ 145#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
145
146 usb_deregister(&pvr_driver);
147} 146}
148 147
149module_init(pvr_init); 148module_init(pvr_init);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 2ee3c3049e8..3c57a7d8200 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -905,13 +905,6 @@ struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *mp,
905} 905}
906 906
907 907
908static int pvr2_sysfs_hotplug(struct device *d,
909 struct kobj_uevent_env *env)
910{
911 /* Even though we don't do anything here, we still need this function
912 because sysfs will still try to call it. */
913 return 0;
914}
915 908
916struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) 909struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
917{ 910{
@@ -922,7 +915,6 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
922 clp->class.name = "pvrusb2"; 915 clp->class.name = "pvrusb2";
923 clp->class.class_release = pvr2_sysfs_class_release; 916 clp->class.class_release = pvr2_sysfs_class_release;
924 clp->class.dev_release = pvr2_sysfs_release; 917 clp->class.dev_release = pvr2_sysfs_release;
925 clp->class.dev_uevent = pvr2_sysfs_hotplug;
926 if (class_register(&clp->class)) { 918 if (class_register(&clp->class)) {
927 pvr2_sysfs_trace( 919 pvr2_sysfs_trace(
928 "Registration failed for pvr2_sysfs_class id=%p",clp); 920 "Registration failed for pvr2_sysfs_class id=%p",clp);
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index d6d8d660196..3aa8cb2b860 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_SAA7134 1config VIDEO_SAA7134
2 tristate "Philips SAA7134 support" 2 tristate "Philips SAA7134 support"
3 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select VIDEOBUF_DMA_SG 4 select VIDEOBUF_DMA_SG
5 select VIDEO_IR 5 select VIDEO_IR
6 select VIDEO_TUNER 6 select VIDEO_TUNER
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index c6f7279669c..b9c5cf7dc84 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -543,8 +543,10 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
543 V4L functions, and force ALSA to use that as the DMA area */ 543 V4L functions, and force ALSA to use that as the DMA area */
544 544
545 substream->runtime->dma_area = dev->dmasound.dma.vmalloc; 545 substream->runtime->dma_area = dev->dmasound.dma.vmalloc;
546 substream->runtime->dma_bytes = dev->dmasound.bufsize;
547 substream->runtime->dma_addr = 0;
546 548
547 return 1; 549 return 0;
548 550
549} 551}
550 552
@@ -652,6 +654,17 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
652} 654}
653 655
654/* 656/*
657 * page callback (needed for mmap)
658 */
659
660static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream,
661 unsigned long offset)
662{
663 void *pageptr = substream->runtime->dma_area + offset;
664 return vmalloc_to_page(pageptr);
665}
666
667/*
655 * ALSA capture callbacks definition 668 * ALSA capture callbacks definition
656 */ 669 */
657 670
@@ -664,6 +677,7 @@ static struct snd_pcm_ops snd_card_saa7134_capture_ops = {
664 .prepare = snd_card_saa7134_capture_prepare, 677 .prepare = snd_card_saa7134_capture_prepare,
665 .trigger = snd_card_saa7134_capture_trigger, 678 .trigger = snd_card_saa7134_capture_trigger,
666 .pointer = snd_card_saa7134_capture_pointer, 679 .pointer = snd_card_saa7134_capture_pointer,
680 .page = snd_card_saa7134_page,
667}; 681};
668 682
669/* 683/*
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index a4c192fb4e4..4f3dad9ae6d 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2996,11 +2996,11 @@ struct saa7134_board saa7134_boards[] = {
2996 },{ 2996 },{
2997 .name = name_comp1, 2997 .name = name_comp1,
2998 .vmux = 0, 2998 .vmux = 0,
2999 .amux = LINE2, 2999 .amux = LINE1,
3000 },{ 3000 },{
3001 .name = name_svideo, 3001 .name = name_svideo,
3002 .vmux = 8, 3002 .vmux = 8,
3003 .amux = LINE2, 3003 .amux = LINE1,
3004 }}, 3004 }},
3005 }, 3005 },
3006 [SAA7134_BOARD_FLYDVBS_LR300] = { 3006 [SAA7134_BOARD_FLYDVBS_LR300] = {
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 6a777604f07..9e99f3636d3 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -30,7 +30,7 @@
30 30
31/* standard i2c insmod options */ 31/* standard i2c insmod options */
32static unsigned short normal_i2c[] = { 32static unsigned short normal_i2c[] = {
33#ifdef CONFIG_TUNER_TEA5761 33#if defined(CONFIG_TUNER_TEA5761) || (defined(CONFIG_TUNER_TEA5761_MODULE) && defined(MODULE))
34 0x10, 34 0x10,
35#endif 35#endif
36 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ 36 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */
@@ -292,7 +292,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
292 } 292 }
293 t->mode_mask = T_RADIO; 293 t->mode_mask = T_RADIO;
294 break; 294 break;
295#ifdef CONFIG_TUNER_TEA5761
296 case TUNER_TEA5761: 295 case TUNER_TEA5761:
297 if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) { 296 if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) {
298 t->type = TUNER_ABSENT; 297 t->type = TUNER_ABSENT;
@@ -301,7 +300,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
301 } 300 }
302 t->mode_mask = T_RADIO; 301 t->mode_mask = T_RADIO;
303 break; 302 break;
304#endif
305 case TUNER_PHILIPS_FMD1216ME_MK3: 303 case TUNER_PHILIPS_FMD1216ME_MK3:
306 buffer[0] = 0x0b; 304 buffer[0] = 0x0b;
307 buffer[1] = 0xdc; 305 buffer[1] = 0xdc;
@@ -594,7 +592,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
594 /* autodetection code based on the i2c addr */ 592 /* autodetection code based on the i2c addr */
595 if (!no_autodetect) { 593 if (!no_autodetect) {
596 switch (addr) { 594 switch (addr) {
597#ifdef CONFIG_TUNER_TEA5761
598 case 0x10: 595 case 0x10:
599 if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) { 596 if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) {
600 t->type = TUNER_TEA5761; 597 t->type = TUNER_TEA5761;
@@ -606,7 +603,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
606 goto register_client; 603 goto register_client;
607 } 604 }
608 break; 605 break;
609#endif
610 case 0x42: 606 case 0x42:
611 case 0x43: 607 case 0x43:
612 case 0x4a: 608 case 0x4a:
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index e2f1c972754..25d0aef88ef 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -799,10 +799,10 @@ static inline void tvp5150_reset(struct i2c_client *c)
799 tvp5150_write_inittab(c, tvp5150_init_enable); 799 tvp5150_write_inittab(c, tvp5150_init_enable);
800 800
801 /* Initialize image preferences */ 801 /* Initialize image preferences */
802 tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8); 802 tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright);
803 tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); 803 tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast);
804 tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8); 804 tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast);
805 tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); 805 tvp5150_write(c, TVP5150_HUE_CTL, decoder->hue);
806 806
807 tvp5150_set_std(c, decoder->norm); 807 tvp5150_set_std(c, decoder->norm);
808}; 808};
@@ -1077,10 +1077,10 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
1077 core->norm = V4L2_STD_ALL; /* Default is autodetect */ 1077 core->norm = V4L2_STD_ALL; /* Default is autodetect */
1078 core->route.input = TVP5150_COMPOSITE1; 1078 core->route.input = TVP5150_COMPOSITE1;
1079 core->enable = 1; 1079 core->enable = 1;
1080 core->bright = 32768; 1080 core->bright = 128;
1081 core->contrast = 32768; 1081 core->contrast = 128;
1082 core->hue = 32768; 1082 core->hue = 0;
1083 core->sat = 32768; 1083 core->sat = 128;
1084 1084
1085 if (rv) { 1085 if (rv) {
1086 kfree(c); 1086 kfree(c);
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 682406168de..e4ad7a1c4fb 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -1077,8 +1077,8 @@ static int i2o_block_probe(struct device *dev)
1077 blk_queue_max_sectors(queue, max_sectors); 1077 blk_queue_max_sectors(queue, max_sectors);
1078 blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size)); 1078 blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size));
1079 1079
1080 osm_debug("max sectors = %d\n", queue->max_phys_segments); 1080 osm_debug("max sectors = %d\n", queue->max_sectors);
1081 osm_debug("phys segments = %d\n", queue->max_sectors); 1081 osm_debug("phys segments = %d\n", queue->max_phys_segments);
1082 osm_debug("max hw segments = %d\n", queue->max_hw_segments); 1082 osm_debug("max hw segments = %d\n", queue->max_hw_segments);
1083 1083
1084 /* 1084 /*
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 09435e0ec68..b96667448eb 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -19,7 +19,6 @@
19#include <linux/pagemap.h> 19#include <linux/pagemap.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/leds.h> 21#include <linux/leds.h>
22#include <asm/scatterlist.h>
23#include <linux/scatterlist.h> 22#include <linux/scatterlist.h>
24 23
25#include <linux/mmc/card.h> 24#include <linux/mmc/card.h>
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 7471d49909b..64b05c6270f 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/scatterlist.h>
14#include <linux/scatterlist.h> 13#include <linux/scatterlist.h>
15 14
16#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index a6dafe62b99..0d96080d44b 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/scatterlist.h>
14#include <linux/scatterlist.h> 13#include <linux/scatterlist.h>
15 14
16#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
index 4d289b27503..e1fca588e38 100644
--- a/drivers/mmc/core/sdio_ops.c
+++ b/drivers/mmc/core/sdio_ops.c
@@ -9,7 +9,6 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#include <asm/scatterlist.h>
13#include <linux/scatterlist.h> 12#include <linux/scatterlist.h>
14 13
15#include <linux/mmc/host.h> 14#include <linux/mmc/host.h>
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index bb30d5be782..2797da7eeee 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1192,6 +1192,8 @@ struct net_device * __init i82596_probe(int unit)
1192 goto out; 1192 goto out;
1193 } 1193 }
1194 1194
1195 dev->base_addr = ioaddr;
1196
1195 for (i = 0; i < 8; i++) { 1197 for (i = 0; i < 8; i++) {
1196 eth_addr[i] = inb(ioaddr + 8 + i); 1198 eth_addr[i] = inb(ioaddr + 8 + i);
1197 checksum += eth_addr[i]; 1199 checksum += eth_addr[i];
@@ -1209,7 +1211,6 @@ struct net_device * __init i82596_probe(int unit)
1209 goto out1; 1211 goto out1;
1210 } 1212 }
1211 1213
1212 dev->base_addr = ioaddr;
1213 dev->irq = 10; 1214 dev->irq = 10;
1214 } 1215 }
1215#endif 1216#endif
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 867cb7345b5..cb581ebbe3c 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -136,10 +136,11 @@ config TUN
136 If you don't know what to use this for, you don't need it. 136 If you don't know what to use this for, you don't need it.
137 137
138config VETH 138config VETH
139 tristate "Virtual ethernet device" 139 tristate "Virtual ethernet pair device"
140 ---help--- 140 ---help---
141 The device is an ethernet tunnel. Devices are created in pairs. When 141 This device is a local ethernet tunnel. Devices are created in pairs.
142 one end receives the packet it appears on its pair and vice versa. 142 When one end receives the packet it appears on its pair and vice
143 versa.
143 144
144config NET_SB1000 145config NET_SB1000
145 tristate "General Instruments Surfboard 1000" 146 tristate "General Instruments Surfboard 1000"
@@ -1883,9 +1884,7 @@ config FEC2
1883 1884
1884config FEC_MPC52xx 1885config FEC_MPC52xx
1885 tristate "MPC52xx FEC driver" 1886 tristate "MPC52xx FEC driver"
1886 depends on PPC_MPC52xx 1887 depends on PPC_MERGE && PPC_MPC52xx && PPC_BESTCOMM_FEC
1887 select PPC_BESTCOMM
1888 select PPC_BESTCOMM_FEC
1889 select CRC32 1888 select CRC32
1890 select PHYLIB 1889 select PHYLIB
1891 ---help--- 1890 ---help---
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index fc1cf0b742b..a8a0ee220da 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -879,9 +879,9 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match)
879 "Error while parsing device node resource\n" ); 879 "Error while parsing device node resource\n" );
880 return rv; 880 return rv;
881 } 881 }
882 if ((mem.end - mem.start + 1) != sizeof(struct mpc52xx_fec)) { 882 if ((mem.end - mem.start + 1) < sizeof(struct mpc52xx_fec)) {
883 printk(KERN_ERR DRIVER_NAME 883 printk(KERN_ERR DRIVER_NAME
884 " - invalid resource size (%lx != %x), check mpc52xx_devices.c\n", 884 " - invalid resource size (%lx < %x), check mpc52xx_devices.c\n",
885 (unsigned long)(mem.end - mem.start + 1), sizeof(struct mpc52xx_fec)); 885 (unsigned long)(mem.end - mem.start + 1), sizeof(struct mpc52xx_fec));
886 return -EINVAL; 886 return -EINVAL;
887 } 887 }
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index e0119f6a331..580cb4ab2af 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -762,26 +762,20 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
762 762
763 if (copy_from_user(&addr, 763 if (copy_from_user(&addr,
764 (void __user *) arg, AX25_ADDR_LEN)) { 764 (void __user *) arg, AX25_ADDR_LEN)) {
765 err = -EFAULT; 765 err = -EFAULT;
766 break; 766 break;
767 } 767 }
768 768
769 netif_tx_lock_bh(dev); 769 netif_tx_lock_bh(dev);
770 memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN); 770 memcpy(dev->dev_addr, &addr, AX25_ADDR_LEN);
771 netif_tx_unlock_bh(dev); 771 netif_tx_unlock_bh(dev);
772 772
773 err = 0; 773 err = 0;
774 break; 774 break;
775 } 775 }
776
777 /* Allow stty to read, but not set, the serial port */
778 case TCGETS:
779 case TCGETA:
780 err = n_tty_ioctl(tty, (struct file *) file, cmd, arg);
781 break;
782 776
783 default: 777 default:
784 err = -ENOIOCTLCMD; 778 err = tty_mode_ioctl(tty, file, cmd, arg);
785 } 779 }
786 780
787 sp_put(sp); 781 sp_put(sp);
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 2c6f7be36e8..fc753d7f674 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -434,11 +434,6 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
434 IRDA_ASSERT(dev != NULL, return -1;); 434 IRDA_ASSERT(dev != NULL, return -1;);
435 435
436 switch (cmd) { 436 switch (cmd) {
437 case TCGETS:
438 case TCGETA:
439 err = n_tty_ioctl(tty, file, cmd, arg);
440 break;
441
442 case IRTTY_IOCTDONGLE: 437 case IRTTY_IOCTDONGLE:
443 /* this call blocks for completion */ 438 /* this call blocks for completion */
444 err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg); 439 err = sirdev_set_dongle(dev, (IRDA_DONGLE) arg);
@@ -454,7 +449,7 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
454 err = -EFAULT; 449 err = -EFAULT;
455 break; 450 break;
456 default: 451 default:
457 err = -ENOIOCTLCMD; 452 err = tty_mode_ioctl(tty, file, cmd, arg);
458 break; 453 break;
459 } 454 }
460 return err; 455 return err;
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index e25dbab6736..0c89b028a80 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -33,7 +33,6 @@
33#include <asm/ip32/ip32_ints.h> 33#include <asm/ip32/ip32_ints.h>
34 34
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/scatterlist.h>
37 36
38#include "meth.h" 37#include "meth.h"
39 38
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 366e62a2b1e..0f306ddb563 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1151,7 +1151,7 @@ static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget)
1151 u16 length; 1151 u16 length;
1152 __wsum checksum; 1152 __wsum checksum;
1153 1153
1154 while (rx_done->entry[idx].length != 0 && work_done++ < budget) { 1154 while (rx_done->entry[idx].length != 0 && work_done < budget) {
1155 length = ntohs(rx_done->entry[idx].length); 1155 length = ntohs(rx_done->entry[idx].length);
1156 rx_done->entry[idx].length = 0; 1156 rx_done->entry[idx].length = 0;
1157 checksum = csum_unfold(rx_done->entry[idx].checksum); 1157 checksum = csum_unfold(rx_done->entry[idx].checksum);
@@ -1167,6 +1167,7 @@ static inline int myri10ge_clean_rx_done(struct myri10ge_priv *mgp, int budget)
1167 rx_bytes += rx_ok * (unsigned long)length; 1167 rx_bytes += rx_ok * (unsigned long)length;
1168 cnt++; 1168 cnt++;
1169 idx = cnt & (myri10ge_max_intr_slots - 1); 1169 idx = cnt & (myri10ge_max_intr_slots - 1);
1170 work_done++;
1170 } 1171 }
1171 rx_done->idx = idx; 1172 rx_done->idx = idx;
1172 rx_done->cnt = cnt; 1173 rx_done->cnt = cnt;
@@ -1233,13 +1234,12 @@ static int myri10ge_poll(struct napi_struct *napi, int budget)
1233 struct myri10ge_priv *mgp = 1234 struct myri10ge_priv *mgp =
1234 container_of(napi, struct myri10ge_priv, napi); 1235 container_of(napi, struct myri10ge_priv, napi);
1235 struct net_device *netdev = mgp->dev; 1236 struct net_device *netdev = mgp->dev;
1236 struct myri10ge_rx_done *rx_done = &mgp->rx_done;
1237 int work_done; 1237 int work_done;
1238 1238
1239 /* process as many rx events as NAPI will allow */ 1239 /* process as many rx events as NAPI will allow */
1240 work_done = myri10ge_clean_rx_done(mgp, budget); 1240 work_done = myri10ge_clean_rx_done(mgp, budget);
1241 1241
1242 if (rx_done->entry[rx_done->idx].length == 0 || !netif_running(netdev)) { 1242 if (work_done < budget || !netif_running(netdev)) {
1243 netif_rx_complete(netdev, napi); 1243 netif_rx_complete(netdev, napi);
1244 put_be32(htonl(3), mgp->irq_claim); 1244 put_be32(htonl(3), mgp->irq_claim);
1245 } 1245 }
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index d2ede5ff9ff..035fd41fb61 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -265,7 +265,7 @@ static struct phy_driver marvell_drivers[] = {
265 .read_status = &genphy_read_status, 265 .read_status = &genphy_read_status,
266 .ack_interrupt = &marvell_ack_interrupt, 266 .ack_interrupt = &marvell_ack_interrupt,
267 .config_intr = &marvell_config_intr, 267 .config_intr = &marvell_config_intr,
268 .driver = {.owner = THIS_MODULE,}, 268 .driver = { .owner = THIS_MODULE },
269 }, 269 },
270 { 270 {
271 .phy_id = 0x01410c90, 271 .phy_id = 0x01410c90,
@@ -278,7 +278,7 @@ static struct phy_driver marvell_drivers[] = {
278 .read_status = &genphy_read_status, 278 .read_status = &genphy_read_status,
279 .ack_interrupt = &marvell_ack_interrupt, 279 .ack_interrupt = &marvell_ack_interrupt,
280 .config_intr = &marvell_config_intr, 280 .config_intr = &marvell_config_intr,
281 .driver = {.owner = THIS_MODULE,}, 281 .driver = { .owner = THIS_MODULE },
282 }, 282 },
283 { 283 {
284 .phy_id = 0x01410cc0, 284 .phy_id = 0x01410cc0,
@@ -291,7 +291,7 @@ static struct phy_driver marvell_drivers[] = {
291 .read_status = &genphy_read_status, 291 .read_status = &genphy_read_status,
292 .ack_interrupt = &marvell_ack_interrupt, 292 .ack_interrupt = &marvell_ack_interrupt,
293 .config_intr = &marvell_config_intr, 293 .config_intr = &marvell_config_intr,
294 .driver = {.owner = THIS_MODULE,}, 294 .driver = { .owner = THIS_MODULE },
295 }, 295 },
296 { 296 {
297 .phy_id = 0x01410cd0, 297 .phy_id = 0x01410cd0,
@@ -304,8 +304,21 @@ static struct phy_driver marvell_drivers[] = {
304 .read_status = &genphy_read_status, 304 .read_status = &genphy_read_status,
305 .ack_interrupt = &marvell_ack_interrupt, 305 .ack_interrupt = &marvell_ack_interrupt,
306 .config_intr = &marvell_config_intr, 306 .config_intr = &marvell_config_intr,
307 .driver = {.owner = THIS_MODULE,}, 307 .driver = { .owner = THIS_MODULE },
308 } 308 },
309 {
310 .phy_id = 0x01410e30,
311 .phy_id_mask = 0xfffffff0,
312 .name = "Marvell 88E1240",
313 .features = PHY_GBIT_FEATURES,
314 .flags = PHY_HAS_INTERRUPT,
315 .config_init = &m88e1111_config_init,
316 .config_aneg = &marvell_config_aneg,
317 .read_status = &genphy_read_status,
318 .ack_interrupt = &marvell_ack_interrupt,
319 .config_intr = &marvell_config_intr,
320 .driver = { .owner = THIS_MODULE },
321 },
309}; 322};
310 323
311static int __init marvell_init(void) 324static int __init marvell_init(void)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index c0461217b10..f6e484812a9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -706,7 +706,7 @@ int phy_driver_register(struct phy_driver *new_driver)
706 return retval; 706 return retval;
707 } 707 }
708 708
709 pr_info("%s: Registered new driver\n", new_driver->name); 709 pr_debug("%s: Registered new driver\n", new_driver->name);
710 710
711 return 0; 711 return 0;
712} 712}
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index 27f5b904f48..8d278c87ba4 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -309,16 +309,11 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
309 err = 0; 309 err = 0;
310 break; 310 break;
311 311
312 case TCGETS:
313 case TCGETA:
314 err = n_tty_ioctl(tty, file, cmd, arg);
315 break;
316
317 case TCFLSH: 312 case TCFLSH:
318 /* flush our buffers and the serial port's buffer */ 313 /* flush our buffers and the serial port's buffer */
319 if (arg == TCIOFLUSH || arg == TCOFLUSH) 314 if (arg == TCIOFLUSH || arg == TCOFLUSH)
320 ppp_async_flush_output(ap); 315 ppp_async_flush_output(ap);
321 err = n_tty_ioctl(tty, file, cmd, arg); 316 err = tty_perform_flush(tty, arg);
322 break; 317 break;
323 318
324 case FIONREAD: 319 case FIONREAD:
@@ -329,7 +324,8 @@ ppp_asynctty_ioctl(struct tty_struct *tty, struct file *file,
329 break; 324 break;
330 325
331 default: 326 default:
332 err = -ENOIOCTLCMD; 327 /* Try the various mode ioctls */
328 err = tty_mode_ioctl(tty, file, cmd, arg);
333 } 329 }
334 330
335 ap_put(ap); 331 ap_put(ap);
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index ce64032a465..00e2fb48b4a 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -349,16 +349,11 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
349 err = 0; 349 err = 0;
350 break; 350 break;
351 351
352 case TCGETS:
353 case TCGETA:
354 err = n_tty_ioctl(tty, file, cmd, arg);
355 break;
356
357 case TCFLSH: 352 case TCFLSH:
358 /* flush our buffers and the serial port's buffer */ 353 /* flush our buffers and the serial port's buffer */
359 if (arg == TCIOFLUSH || arg == TCOFLUSH) 354 if (arg == TCIOFLUSH || arg == TCOFLUSH)
360 ppp_sync_flush_output(ap); 355 ppp_sync_flush_output(ap);
361 err = n_tty_ioctl(tty, file, cmd, arg); 356 err = tty_perform_flush(tty, arg);
362 break; 357 break;
363 358
364 case FIONREAD: 359 case FIONREAD:
@@ -369,7 +364,8 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
369 break; 364 break;
370 365
371 default: 366 default:
372 err = -ENOIOCTLCMD; 367 err = tty_mode_ioctl(tty, file, cmd, arg);
368 break;
373 } 369 }
374 370
375 sp_put(ap); 371 sp_put(ap);
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index f8904fd9236..a7556cd2df7 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -488,7 +488,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
488{ 488{
489 struct pppol2tp_session *session = NULL; 489 struct pppol2tp_session *session = NULL;
490 struct pppol2tp_tunnel *tunnel; 490 struct pppol2tp_tunnel *tunnel;
491 unsigned char *ptr; 491 unsigned char *ptr, *optr;
492 u16 hdrflags; 492 u16 hdrflags;
493 u16 tunnel_id, session_id; 493 u16 tunnel_id, session_id;
494 int length; 494 int length;
@@ -496,7 +496,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
496 496
497 tunnel = pppol2tp_sock_to_tunnel(sock); 497 tunnel = pppol2tp_sock_to_tunnel(sock);
498 if (tunnel == NULL) 498 if (tunnel == NULL)
499 goto error; 499 goto no_tunnel;
500 500
501 /* UDP always verifies the packet length. */ 501 /* UDP always verifies the packet length. */
502 __skb_pull(skb, sizeof(struct udphdr)); 502 __skb_pull(skb, sizeof(struct udphdr));
@@ -509,7 +509,7 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
509 } 509 }
510 510
511 /* Point to L2TP header */ 511 /* Point to L2TP header */
512 ptr = skb->data; 512 optr = ptr = skb->data;
513 513
514 /* Get L2TP header flags */ 514 /* Get L2TP header flags */
515 hdrflags = ntohs(*(__be16*)ptr); 515 hdrflags = ntohs(*(__be16*)ptr);
@@ -637,12 +637,14 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
637 /* If offset bit set, skip it. */ 637 /* If offset bit set, skip it. */
638 if (hdrflags & L2TP_HDRFLAG_O) { 638 if (hdrflags & L2TP_HDRFLAG_O) {
639 offset = ntohs(*(__be16 *)ptr); 639 offset = ntohs(*(__be16 *)ptr);
640 skb->transport_header += 2 + offset; 640 ptr += 2 + offset;
641 if (!pskb_may_pull(skb, skb_transport_offset(skb) + 2))
642 goto discard;
643 } 641 }
644 642
645 __skb_pull(skb, skb_transport_offset(skb)); 643 offset = ptr - optr;
644 if (!pskb_may_pull(skb, offset))
645 goto discard;
646
647 __skb_pull(skb, offset);
646 648
647 /* Skip PPP header, if present. In testing, Microsoft L2TP clients 649 /* Skip PPP header, if present. In testing, Microsoft L2TP clients
648 * don't send the PPP header (PPP header compression enabled), but 650 * don't send the PPP header (PPP header compression enabled), but
@@ -652,6 +654,9 @@ static int pppol2tp_recv_core(struct sock *sock, struct sk_buff *skb)
652 * Note that skb->data[] isn't dereferenced from a u16 ptr here since 654 * Note that skb->data[] isn't dereferenced from a u16 ptr here since
653 * the field may be unaligned. 655 * the field may be unaligned.
654 */ 656 */
657 if (!pskb_may_pull(skb, 2))
658 goto discard;
659
655 if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03)) 660 if ((skb->data[0] == 0xff) && (skb->data[1] == 0x03))
656 skb_pull(skb, 2); 661 skb_pull(skb, 2);
657 662
@@ -709,6 +714,10 @@ discard:
709 return 0; 714 return 0;
710 715
711error: 716error:
717 /* Put UDP header back */
718 __skb_push(skb, sizeof(struct udphdr));
719
720no_tunnel:
712 return 1; 721 return 1;
713} 722}
714 723
@@ -1050,6 +1059,8 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
1050 /* Get routing info from the tunnel socket */ 1059 /* Get routing info from the tunnel socket */
1051 dst_release(skb->dst); 1060 dst_release(skb->dst);
1052 skb->dst = sk_dst_get(sk_tun); 1061 skb->dst = sk_dst_get(sk_tun);
1062 skb_orphan(skb);
1063 skb->sk = sk_tun;
1053 1064
1054 /* Queue the packet to IP for output */ 1065 /* Queue the packet to IP for output */
1055 len = skb->len; 1066 len = skb->len;
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index b822859c8de..73a7e6529ee 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -78,12 +78,6 @@ static char version[] __devinitdata = "rrunner.c: v0.50 11/11/2002 Jes Sorensen
78 * stack will need to know about I/O vectors or something similar. 78 * stack will need to know about I/O vectors or something similar.
79 */ 79 */
80 80
81/*
82 * sysctl_[wr]mem_max are checked at init time to see if they are at
83 * least 256KB and increased to 256KB if they are not. This is done to
84 * avoid ending up with socket buffers smaller than the MTU size,
85 */
86
87static int __devinit rr_init_one(struct pci_dev *pdev, 81static int __devinit rr_init_one(struct pci_dev *pdev,
88 const struct pci_device_id *ent) 82 const struct pci_device_id *ent)
89{ 83{
@@ -561,18 +555,6 @@ static int __devinit rr_init(struct net_device *dev)
561 sram_size = rr_read_eeprom_word(rrpriv, (void *)8); 555 sram_size = rr_read_eeprom_word(rrpriv, (void *)8);
562 printk(" SRAM size 0x%06x\n", sram_size); 556 printk(" SRAM size 0x%06x\n", sram_size);
563 557
564 if (sysctl_rmem_max < 262144){
565 printk(" Receive socket buffer limit too low (%i), "
566 "setting to 262144\n", sysctl_rmem_max);
567 sysctl_rmem_max = 262144;
568 }
569
570 if (sysctl_wmem_max < 262144){
571 printk(" Transmit socket buffer limit too low (%i), "
572 "setting to 262144\n", sysctl_wmem_max);
573 sysctl_wmem_max = 262144;
574 }
575
576 return 0; 558 return 0;
577} 559}
578 560
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 335b7cc80eb..251a3ce376a 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -1218,14 +1218,8 @@ static int slip_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
1218 return 0; 1218 return 0;
1219 /* VSV changes end */ 1219 /* VSV changes end */
1220#endif 1220#endif
1221
1222 /* Allow stty to read, but not set, the serial port */
1223 case TCGETS:
1224 case TCGETA:
1225 return n_tty_ioctl(tty, file, cmd, arg);
1226
1227 default: 1221 default:
1228 return -ENOIOCTLCMD; 1222 return tty_mode_ioctl(tty, file, cmd, arg);
1229 } 1223 }
1230} 1224}
1231 1225
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 120c8affe83..c20a3bd21bb 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3143,8 +3143,8 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
3143 dev->irq = pdev->irq; 3143 dev->irq = pdev->irq;
3144 dev->dma = 0; 3144 dev->dma = 0;
3145 3145
3146 /* Happy Meal can do it all... */ 3146 /* Happy Meal can do it all... except VLAN. */
3147 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; 3147 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_VLAN_CHALLENGED;
3148 3148
3149#if defined(CONFIG_SBUS) && defined(CONFIG_PCI) 3149#if defined(CONFIG_SBUS) && defined(CONFIG_PCI)
3150 /* Hook up PCI register/dma accessors. */ 3150 /* Hook up PCI register/dma accessors. */
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 09440d783e6..cad51991076 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7365,10 +7365,6 @@ static int tg3_open(struct net_device *dev)
7365 } else if (pci_enable_msi(tp->pdev) == 0) { 7365 } else if (pci_enable_msi(tp->pdev) == 0) {
7366 u32 msi_mode; 7366 u32 msi_mode;
7367 7367
7368 /* Hardware bug - MSI won't work if INTX disabled. */
7369 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)
7370 pci_intx(tp->pdev, 1);
7371
7372 msi_mode = tr32(MSGINT_MODE); 7368 msi_mode = tr32(MSGINT_MODE);
7373 tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE); 7369 tw32(MSGINT_MODE, msi_mode | MSGINT_MODE_ENABLE);
7374 tp->tg3_flags2 |= TG3_FLG2_USING_MSI; 7370 tp->tg3_flags2 |= TG3_FLG2_USING_MSI;
@@ -12681,11 +12677,6 @@ static int tg3_resume(struct pci_dev *pdev)
12681 if (err) 12677 if (err)
12682 return err; 12678 return err;
12683 12679
12684 /* Hardware bug - MSI won't work if INTX disabled. */
12685 if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) &&
12686 (tp->tg3_flags2 & TG3_FLG2_USING_MSI))
12687 pci_intx(tp->pdev, 1);
12688
12689 netif_device_attach(dev); 12680 netif_device_attach(dev);
12690 12681
12691 tg3_full_lock(tp, 0); 12682 tg3_full_lock(tp, 0);
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 5a96d74e4ce..a12c9c41b21 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -93,13 +93,9 @@ config USB_RTL8150
93 To compile this driver as a module, choose M here: the 93 To compile this driver as a module, choose M here: the
94 module will be called rtl8150. 94 module will be called rtl8150.
95 95
96config USB_USBNET_MII
97 tristate
98 default n
99
100config USB_USBNET 96config USB_USBNET
101 tristate "Multi-purpose USB Networking Framework" 97 tristate "Multi-purpose USB Networking Framework"
102 select MII if USB_USBNET_MII != n 98 select MII
103 ---help--- 99 ---help---
104 This driver supports several kinds of network links over USB, 100 This driver supports several kinds of network links over USB,
105 with "minidrivers" built around a common network driver core 101 with "minidrivers" built around a common network driver core
@@ -135,7 +131,6 @@ config USB_NET_AX8817X
135 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters" 131 tristate "ASIX AX88xxx Based USB 2.0 Ethernet Adapters"
136 depends on USB_USBNET && NET_ETHERNET 132 depends on USB_USBNET && NET_ETHERNET
137 select CRC32 133 select CRC32
138 select USB_USBNET_MII
139 default y 134 default y
140 help 135 help
141 This option adds support for ASIX AX88xxx based USB 2.0 136 This option adds support for ASIX AX88xxx based USB 2.0
@@ -190,7 +185,6 @@ config USB_NET_DM9601
190 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices" 185 tristate "Davicom DM9601 based USB 1.1 10/100 ethernet devices"
191 depends on USB_USBNET 186 depends on USB_USBNET
192 select CRC32 187 select CRC32
193 select USB_USBNET_MII
194 help 188 help
195 This option adds support for Davicom DM9601 based USB 1.1 189 This option adds support for Davicom DM9601 based USB 1.1
196 10/100 Ethernet adapters. 190 10/100 Ethernet adapters.
@@ -225,7 +219,6 @@ config USB_NET_PLUSB
225config USB_NET_MCS7830 219config USB_NET_MCS7830
226 tristate "MosChip MCS7830 based Ethernet adapters" 220 tristate "MosChip MCS7830 based Ethernet adapters"
227 depends on USB_USBNET 221 depends on USB_USBNET
228 select USB_USBNET_MII
229 help 222 help
230 Choose this option if you're using a 10/100 Ethernet USB2 223 Choose this option if you're using a 10/100 Ethernet USB2
231 adapter based on the MosChip 7830 controller. This includes 224 adapter based on the MosChip 7830 controller. This includes
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index acd5f1c0e63..8ed1fc5cbc7 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -683,9 +683,6 @@ done_nopm:
683 * they'll probably want to use this base set. 683 * they'll probably want to use this base set.
684 */ 684 */
685 685
686#if defined(CONFIG_MII) || defined(CONFIG_MII_MODULE)
687#define HAVE_MII
688
689int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd) 686int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd)
690{ 687{
691 struct usbnet *dev = netdev_priv(net); 688 struct usbnet *dev = netdev_priv(net);
@@ -744,8 +741,6 @@ int usbnet_nway_reset(struct net_device *net)
744} 741}
745EXPORT_SYMBOL_GPL(usbnet_nway_reset); 742EXPORT_SYMBOL_GPL(usbnet_nway_reset);
746 743
747#endif /* HAVE_MII */
748
749void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) 744void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info)
750{ 745{
751 struct usbnet *dev = netdev_priv(net); 746 struct usbnet *dev = netdev_priv(net);
@@ -776,12 +771,10 @@ EXPORT_SYMBOL_GPL(usbnet_set_msglevel);
776 771
777/* drivers may override default ethtool_ops in their bind() routine */ 772/* drivers may override default ethtool_ops in their bind() routine */
778static struct ethtool_ops usbnet_ethtool_ops = { 773static struct ethtool_ops usbnet_ethtool_ops = {
779#ifdef HAVE_MII
780 .get_settings = usbnet_get_settings, 774 .get_settings = usbnet_get_settings,
781 .set_settings = usbnet_set_settings, 775 .set_settings = usbnet_set_settings,
782 .get_link = usbnet_get_link, 776 .get_link = usbnet_get_link,
783 .nway_reset = usbnet_nway_reset, 777 .nway_reset = usbnet_nway_reset,
784#endif
785 .get_drvinfo = usbnet_get_drvinfo, 778 .get_drvinfo = usbnet_get_drvinfo,
786 .get_msglevel = usbnet_get_msglevel, 779 .get_msglevel = usbnet_get_msglevel,
787 .set_msglevel = usbnet_set_msglevel, 780 .set_msglevel = usbnet_set_msglevel,
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index c48b1cc63fd..1e89d4de1bb 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -719,12 +719,8 @@ static int x25_asy_ioctl(struct tty_struct *tty, struct file *file,
719 return 0; 719 return 0;
720 case SIOCSIFHWADDR: 720 case SIOCSIFHWADDR:
721 return -EINVAL; 721 return -EINVAL;
722 /* Allow stty to read, but not set, the serial port */
723 case TCGETS:
724 case TCGETA:
725 return n_tty_ioctl(tty, file, cmd, arg);
726 default: 722 default:
727 return -ENOIOCTLCMD; 723 return tty_mode_ioctl(tty, file, cmd, arg);
728 } 724 }
729} 725}
730 726
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 4bd14b33186..88efe1bae58 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2735,16 +2735,8 @@ static int strip_ioctl(struct tty_struct *tty, struct file *file,
2735 return -EFAULT; 2735 return -EFAULT;
2736 return set_mac_address(strip_info, &addr); 2736 return set_mac_address(strip_info, &addr);
2737 } 2737 }
2738 /*
2739 * Allow stty to read, but not set, the serial port
2740 */
2741
2742 case TCGETS:
2743 case TCGETA:
2744 return n_tty_ioctl(tty, file, cmd, arg);
2745 break;
2746 default: 2738 default:
2747 return -ENOIOCTLCMD; 2739 return tty_mode_ioctl(tty, file, cmd, arg);
2748 break; 2740 break;
2749 } 2741 }
2750 return 0; 2742 return 0;
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 7a1d6d51283..e1ca42591ac 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -21,6 +21,17 @@ config PCI_MSI
21 21
22 If you don't know what to do here, say N. 22 If you don't know what to do here, say N.
23 23
24config PCI_LEGACY
25 bool "Enable deprecated pci_find_* API"
26 depends on PCI
27 default y
28 help
29 Say Y here if you want to include support for the deprecated
30 pci_find_slot() and pci_find_device() APIs. Most drivers have
31 been converted over to using the proper hotplug APIs, so this
32 option serves to include/exclude only a few drivers that are
33 still using this API.
34
24config PCI_DEBUG 35config PCI_DEBUG
25 bool "PCI Debugging" 36 bool "PCI Debugging"
26 depends on PCI && DEBUG_KERNEL 37 depends on PCI && DEBUG_KERNEL
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index 63d62752fb9..a64449d489d 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -41,7 +41,7 @@ config HOTPLUG_PCI_FAKE
41 41
42config HOTPLUG_PCI_COMPAQ 42config HOTPLUG_PCI_COMPAQ
43 tristate "Compaq PCI Hotplug driver" 43 tristate "Compaq PCI Hotplug driver"
44 depends on X86 && PCI_BIOS 44 depends on X86 && PCI_BIOS && PCI_LEGACY
45 help 45 help
46 Say Y here if you have a motherboard with a Compaq PCI Hotplug 46 Say Y here if you have a motherboard with a Compaq PCI Hotplug
47 controller. 47 controller.
@@ -63,7 +63,7 @@ config HOTPLUG_PCI_COMPAQ_NVRAM
63 63
64config HOTPLUG_PCI_IBM 64config HOTPLUG_PCI_IBM
65 tristate "IBM PCI Hotplug driver" 65 tristate "IBM PCI Hotplug driver"
66 depends on X86_IO_APIC && X86 && PCI_BIOS 66 depends on X86_IO_APIC && X86 && PCI_BIOS && PCI_LEGACY
67 help 67 help
68 Say Y here if you have a motherboard with a IBM PCI Hotplug 68 Say Y here if you have a motherboard with a IBM PCI Hotplug
69 controller. 69 controller.
@@ -119,7 +119,7 @@ config HOTPLUG_PCI_CPCI_ZT5550
119 119
120config HOTPLUG_PCI_CPCI_GENERIC 120config HOTPLUG_PCI_CPCI_GENERIC
121 tristate "Generic port I/O CompactPCI Hotplug driver" 121 tristate "Generic port I/O CompactPCI Hotplug driver"
122 depends on HOTPLUG_PCI_CPCI && X86 122 depends on HOTPLUG_PCI_CPCI && X86 && PCI_LEGACY
123 help 123 help
124 Say Y here if you have a CompactPCI system card that exposes the #ENUM 124 Say Y here if you have a CompactPCI system card that exposes the #ENUM
125 hotswap signal as a bit in a system register that can be read through 125 hotswap signal as a bit in a system register that can be read through
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 3ef0a4875a6..856d57b4d60 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1931,16 +1931,14 @@ void cpqhp_pushbutton_thread(unsigned long slot)
1931 return ; 1931 return ;
1932 } 1932 }
1933 1933
1934 if (func != NULL && ctrl != NULL) { 1934 if (cpqhp_process_SS(ctrl, func) != 0) {
1935 if (cpqhp_process_SS(ctrl, func) != 0) { 1935 amber_LED_on(ctrl, hp_slot);
1936 amber_LED_on (ctrl, hp_slot); 1936 green_LED_on(ctrl, hp_slot);
1937 green_LED_on (ctrl, hp_slot);
1938
1939 set_SOGO(ctrl);
1940 1937
1941 /* Wait for SOBS to be unset */ 1938 set_SOGO(ctrl);
1942 wait_for_ctrl_irq (ctrl); 1939
1943 } 1940 /* Wait for SOBS to be unset */
1941 wait_for_ctrl_irq(ctrl);
1944 } 1942 }
1945 1943
1946 p_slot->state = STATIC_STATE; 1944 p_slot->state = STATIC_STATE;
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 87e01615053..07c9f09c856 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -224,6 +224,12 @@ static struct msi_desc* alloc_msi_entry(void)
224 return entry; 224 return entry;
225} 225}
226 226
227static void pci_intx_for_msi(struct pci_dev *dev, int enable)
228{
229 if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
230 pci_intx(dev, enable);
231}
232
227#ifdef CONFIG_PM 233#ifdef CONFIG_PM
228static void __pci_restore_msi_state(struct pci_dev *dev) 234static void __pci_restore_msi_state(struct pci_dev *dev)
229{ 235{
@@ -237,7 +243,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
237 entry = get_irq_msi(dev->irq); 243 entry = get_irq_msi(dev->irq);
238 pos = entry->msi_attrib.pos; 244 pos = entry->msi_attrib.pos;
239 245
240 pci_intx(dev, 0); /* disable intx */ 246 pci_intx_for_msi(dev, 0);
241 msi_set_enable(dev, 0); 247 msi_set_enable(dev, 0);
242 write_msi_msg(dev->irq, &entry->msg); 248 write_msi_msg(dev->irq, &entry->msg);
243 if (entry->msi_attrib.maskbit) 249 if (entry->msi_attrib.maskbit)
@@ -260,7 +266,7 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
260 return; 266 return;
261 267
262 /* route the table */ 268 /* route the table */
263 pci_intx(dev, 0); /* disable intx */ 269 pci_intx_for_msi(dev, 0);
264 msix_set_enable(dev, 0); 270 msix_set_enable(dev, 0);
265 271
266 list_for_each_entry(entry, &dev->msi_list, list) { 272 list_for_each_entry(entry, &dev->msi_list, list) {
@@ -343,7 +349,7 @@ static int msi_capability_init(struct pci_dev *dev)
343 } 349 }
344 350
345 /* Set MSI enabled bits */ 351 /* Set MSI enabled bits */
346 pci_intx(dev, 0); /* disable intx */ 352 pci_intx_for_msi(dev, 0);
347 msi_set_enable(dev, 1); 353 msi_set_enable(dev, 1);
348 dev->msi_enabled = 1; 354 dev->msi_enabled = 1;
349 355
@@ -433,7 +439,7 @@ static int msix_capability_init(struct pci_dev *dev,
433 i++; 439 i++;
434 } 440 }
435 /* Set MSI-X enabled bits */ 441 /* Set MSI-X enabled bits */
436 pci_intx(dev, 0); /* disable intx */ 442 pci_intx_for_msi(dev, 0);
437 msix_set_enable(dev, 1); 443 msix_set_enable(dev, 1);
438 dev->msix_enabled = 1; 444 dev->msix_enabled = 1;
439 445
@@ -528,7 +534,7 @@ void pci_disable_msi(struct pci_dev* dev)
528 return; 534 return;
529 535
530 msi_set_enable(dev, 0); 536 msi_set_enable(dev, 0);
531 pci_intx(dev, 1); /* enable intx */ 537 pci_intx_for_msi(dev, 1);
532 dev->msi_enabled = 0; 538 dev->msi_enabled = 0;
533 539
534 BUG_ON(list_empty(&dev->msi_list)); 540 BUG_ON(list_empty(&dev->msi_list));
@@ -640,7 +646,7 @@ void pci_disable_msix(struct pci_dev* dev)
640 return; 646 return;
641 647
642 msix_set_enable(dev, 0); 648 msix_set_enable(dev, 0);
643 pci_intx(dev, 1); /* enable intx */ 649 pci_intx_for_msi(dev, 1);
644 dev->msix_enabled = 0; 650 dev->msix_enabled = 0;
645 651
646 msix_free_all_irqs(dev); 652 msix_free_all_irqs(dev);
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 6e2760b6c20..6d1a2161181 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -143,8 +143,8 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
143 * system is in its list of supported devices. Returns the matching 143 * system is in its list of supported devices. Returns the matching
144 * pci_device_id structure or %NULL if there is no match. 144 * pci_device_id structure or %NULL if there is no match.
145 */ 145 */
146const struct pci_device_id *pci_match_device(struct pci_driver *drv, 146static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
147 struct pci_dev *dev) 147 struct pci_dev *dev)
148{ 148{
149 struct pci_dynid *dynid; 149 struct pci_dynid *dynid;
150 150
@@ -559,7 +559,6 @@ static int __init pci_driver_init(void)
559postcore_initcall(pci_driver_init); 559postcore_initcall(pci_driver_init);
560 560
561EXPORT_SYMBOL(pci_match_id); 561EXPORT_SYMBOL(pci_match_id);
562EXPORT_SYMBOL(pci_match_device);
563EXPORT_SYMBOL(__pci_register_driver); 562EXPORT_SYMBOL(__pci_register_driver);
564EXPORT_SYMBOL(pci_unregister_driver); 563EXPORT_SYMBOL(pci_unregister_driver);
565EXPORT_SYMBOL(pci_dev_driver); 564EXPORT_SYMBOL(pci_dev_driver);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index d0bb5b9d212..26cc4dcf4f0 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1621,12 +1621,8 @@ static void __init quirk_disable_all_msi(struct pci_dev *dev)
1621 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); 1621 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n");
1622} 1622}
1623DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi); 1623DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
1624DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi);
1625DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); 1624DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
1626DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); 1625DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
1627DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RD580, quirk_disable_all_msi);
1628DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RX790, quirk_disable_all_msi);
1629DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS690, quirk_disable_all_msi);
1630DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi); 1626DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
1631 1627
1632/* Disable MSI on chipsets that are known to not support it */ 1628/* Disable MSI on chipsets that are known to not support it */
@@ -1678,6 +1674,9 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev)
1678} 1674}
1679DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, 1675DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE,
1680 quirk_msi_ht_cap); 1676 quirk_msi_ht_cap);
1677DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS,
1678 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
1679 quirk_msi_ht_cap);
1681 1680
1682/* The nVidia CK804 chipset may have 2 HT MSI mappings. 1681/* The nVidia CK804 chipset may have 2 HT MSI mappings.
1683 * MSI are supported if the MSI capability set in any of these mappings. 1682 * MSI are supported if the MSI capability set in any of these mappings.
@@ -1705,4 +1704,48 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1705} 1704}
1706DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, 1705DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1707 quirk_nvidia_ck804_msi_ht_cap); 1706 quirk_nvidia_ck804_msi_ht_cap);
1707
1708static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
1709{
1710 dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
1711}
1712DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1713 PCI_DEVICE_ID_TIGON3_5780,
1714 quirk_msi_intx_disable_bug);
1715DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1716 PCI_DEVICE_ID_TIGON3_5780S,
1717 quirk_msi_intx_disable_bug);
1718DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1719 PCI_DEVICE_ID_TIGON3_5714,
1720 quirk_msi_intx_disable_bug);
1721DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1722 PCI_DEVICE_ID_TIGON3_5714S,
1723 quirk_msi_intx_disable_bug);
1724DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1725 PCI_DEVICE_ID_TIGON3_5715,
1726 quirk_msi_intx_disable_bug);
1727DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_BROADCOM,
1728 PCI_DEVICE_ID_TIGON3_5715S,
1729 quirk_msi_intx_disable_bug);
1730
1731DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4390,
1732 quirk_msi_intx_disable_bug);
1733DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4391,
1734 quirk_msi_intx_disable_bug);
1735DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4392,
1736 quirk_msi_intx_disable_bug);
1737DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4393,
1738 quirk_msi_intx_disable_bug);
1739DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4394,
1740 quirk_msi_intx_disable_bug);
1741DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4395,
1742 quirk_msi_intx_disable_bug);
1743
1744DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4373,
1745 quirk_msi_intx_disable_bug);
1746DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4374,
1747 quirk_msi_intx_disable_bug);
1748DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375,
1749 quirk_msi_intx_disable_bug);
1750
1708#endif /* CONFIG_PCI_MSI */ 1751#endif /* CONFIG_PCI_MSI */
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index b001b5922e3..8541034021f 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -113,6 +113,8 @@ pci_find_next_bus(const struct pci_bus *from)
113 return b; 113 return b;
114} 114}
115 115
116#ifdef CONFIG_PCI_LEGACY
117
116/** 118/**
117 * pci_find_slot - locate PCI device from a given PCI slot 119 * pci_find_slot - locate PCI device from a given PCI slot
118 * @bus: number of PCI bus on which desired PCI device resides 120 * @bus: number of PCI bus on which desired PCI device resides
@@ -137,6 +139,8 @@ pci_find_slot(unsigned int bus, unsigned int devfn)
137 return NULL; 139 return NULL;
138} 140}
139 141
142#endif /* CONFIG_PCI_LEGACY */
143
140/** 144/**
141 * pci_get_slot - locate PCI device for a given PCI slot 145 * pci_get_slot - locate PCI device for a given PCI slot
142 * @bus: PCI bus on which desired PCI device resides 146 * @bus: PCI bus on which desired PCI device resides
@@ -200,6 +204,7 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
200 return NULL; 204 return NULL;
201} 205}
202 206
207#ifdef CONFIG_PCI_LEGACY
203/** 208/**
204 * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id 209 * pci_find_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id
205 * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids 210 * @vendor: PCI vendor id to match, or %PCI_ANY_ID to match all vendor ids
@@ -278,6 +283,7 @@ pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *
278{ 283{
279 return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from); 284 return pci_find_subsys(vendor, device, PCI_ANY_ID, PCI_ANY_ID, from);
280} 285}
286#endif /* CONFIG_PCI_LEGACY */
281 287
282/** 288/**
283 * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id 289 * pci_get_subsys - begin or continue searching for a PCI device by vendor/subvendor/device/subdevice id
@@ -468,8 +474,11 @@ int pci_dev_present(const struct pci_device_id *ids)
468EXPORT_SYMBOL(pci_dev_present); 474EXPORT_SYMBOL(pci_dev_present);
469EXPORT_SYMBOL(pci_find_present); 475EXPORT_SYMBOL(pci_find_present);
470 476
477#ifdef CONFIG_PCI_LEGACY
471EXPORT_SYMBOL(pci_find_device); 478EXPORT_SYMBOL(pci_find_device);
472EXPORT_SYMBOL(pci_find_slot); 479EXPORT_SYMBOL(pci_find_slot);
480#endif /* CONFIG_PCI_LEGACY */
481
473/* For boot time work */ 482/* For boot time work */
474EXPORT_SYMBOL(pci_find_bus); 483EXPORT_SYMBOL(pci_find_bus);
475EXPORT_SYMBOL(pci_find_next_bus); 484EXPORT_SYMBOL(pci_find_next_bus);
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index e3fe83a23cf..29cf1457ca1 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -120,7 +120,8 @@ static int cmos_read_alarm(struct device *dev, struct rtc_wkalrm *t)
120 t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM); 120 t->time.tm_hour = CMOS_READ(RTC_HOURS_ALARM);
121 121
122 if (cmos->day_alrm) { 122 if (cmos->day_alrm) {
123 t->time.tm_mday = CMOS_READ(cmos->day_alrm); 123 /* ignore upper bits on readback per ACPI spec */
124 t->time.tm_mday = CMOS_READ(cmos->day_alrm) & 0x3f;
124 if (!t->time.tm_mday) 125 if (!t->time.tm_mday)
125 t->time.tm_mday = -1; 126 t->time.tm_mday = -1;
126 127
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index bf60d35f580..2bad1637330 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -464,7 +464,7 @@ static int __devexit m48t59_rtc_remove(struct platform_device *pdev)
464 return 0; 464 return 0;
465} 465}
466 466
467static struct platform_driver m48t59_rtc_platdrv = { 467static struct platform_driver m48t59_rtc_driver = {
468 .driver = { 468 .driver = {
469 .name = "rtc-m48t59", 469 .name = "rtc-m48t59",
470 .owner = THIS_MODULE, 470 .owner = THIS_MODULE,
@@ -475,12 +475,12 @@ static struct platform_driver m48t59_rtc_platdrv = {
475 475
476static int __init m48t59_rtc_init(void) 476static int __init m48t59_rtc_init(void)
477{ 477{
478 return platform_driver_register(&m48t59_rtc_platdrv); 478 return platform_driver_register(&m48t59_rtc_driver);
479} 479}
480 480
481static void __exit m48t59_rtc_exit(void) 481static void __exit m48t59_rtc_exit(void)
482{ 482{
483 platform_driver_unregister(&m48t59_rtc_platdrv); 483 platform_driver_unregister(&m48t59_rtc_driver);
484} 484}
485 485
486module_init(m48t59_rtc_init); 486module_init(m48t59_rtc_init);
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 859f870552e..5e083d1f57e 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -193,6 +193,12 @@ dcssblk_segment_warn(int rc, char* seg_name)
193 } 193 }
194} 194}
195 195
196static void dcssblk_unregister_callback(struct device *dev)
197{
198 device_unregister(dev);
199 put_device(dev);
200}
201
196/* 202/*
197 * device attribute for switching shared/nonshared (exclusive) 203 * device attribute for switching shared/nonshared (exclusive)
198 * operation (show + store) 204 * operation (show + store)
@@ -276,8 +282,7 @@ removeseg:
276 blk_cleanup_queue(dev_info->dcssblk_queue); 282 blk_cleanup_queue(dev_info->dcssblk_queue);
277 dev_info->gd->queue = NULL; 283 dev_info->gd->queue = NULL;
278 put_disk(dev_info->gd); 284 put_disk(dev_info->gd);
279 device_unregister(dev); 285 rc = device_schedule_callback(dev, dcssblk_unregister_callback);
280 put_device(dev);
281out: 286out:
282 up_write(&dcssblk_devices_sem); 287 up_write(&dcssblk_devices_sem);
283 return rc; 288 return rc;
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 725b0dd1426..f4c132ab39e 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -343,10 +343,10 @@ static int cmf_copy_block(struct ccw_device *cdev)
343 343
344 if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) { 344 if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) {
345 /* Don't copy if a start function is in progress. */ 345 /* Don't copy if a start function is in progress. */
346 if ((!sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) && 346 if ((!(sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED)) &&
347 (sch->schib.scsw.actl & 347 (sch->schib.scsw.actl &
348 (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) && 348 (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) &&
349 (!sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) 349 (!(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)))
350 return -EBUSY; 350 return -EBUSY;
351 } 351 }
352 cmb_data = cdev->private->cmb; 352 cmb_data = cdev->private->cmb;
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 7ee57f084a8..74f6b539974 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -738,7 +738,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch,
738 atomic_set(&cdev->private->onoff, 0); 738 atomic_set(&cdev->private->onoff, 0);
739 cdev->dev.parent = &sch->dev; 739 cdev->dev.parent = &sch->dev;
740 cdev->dev.release = ccw_device_release; 740 cdev->dev.release = ccw_device_release;
741 INIT_LIST_HEAD(&cdev->private->kick_work.entry); 741 INIT_WORK(&cdev->private->kick_work, NULL);
742 cdev->dev.groups = ccwdev_attr_groups; 742 cdev->dev.groups = ccwdev_attr_groups;
743 /* Do first half of device_register. */ 743 /* Do first half of device_register. */
744 device_initialize(&cdev->dev); 744 device_initialize(&cdev->dev);
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c
index 3ccca5871fd..47bb47b4858 100644
--- a/drivers/s390/net/smsgiucv.c
+++ b/drivers/s390/net/smsgiucv.c
@@ -148,6 +148,10 @@ static int __init smsg_init(void)
148{ 148{
149 int rc; 149 int rc;
150 150
151 if (!MACHINE_IS_VM) {
152 rc = -EPROTONOSUPPORT;
153 goto out;
154 }
151 rc = driver_register(&smsg_driver); 155 rc = driver_register(&smsg_driver);
152 if (rc != 0) 156 if (rc != 0)
153 goto out; 157 goto out;
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 86cf10efb0c..a6676be8784 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -725,7 +725,7 @@ config SCSI_FD_MCS
725 725
726config SCSI_GDTH 726config SCSI_GDTH
727 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" 727 tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support"
728 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API 728 depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API && PCI_LEGACY
729 ---help--- 729 ---help---
730 Formerly called GDT SCSI Disk Array Controller Support. 730 Formerly called GDT SCSI Disk Array Controller Support.
731 731
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 22d91ee173c..5f2396c0395 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -556,7 +556,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
556 unsigned long timeout) 556 unsigned long timeout)
557{ 557{
558 u64 *crq_as_u64 = (u64 *) &evt_struct->crq; 558 u64 *crq_as_u64 = (u64 *) &evt_struct->crq;
559 int request_status; 559 int request_status = 0;
560 int rc; 560 int rc;
561 561
562 /* If we have exhausted our request limit, just fail this request, 562 /* If we have exhausted our request limit, just fail this request,
@@ -574,6 +574,13 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
574 if (request_status < -1) 574 if (request_status < -1)
575 goto send_error; 575 goto send_error;
576 /* Otherwise, we may have run out of requests. */ 576 /* Otherwise, we may have run out of requests. */
577 /* If request limit was 0 when we started the adapter is in the
578 * process of performing a login with the server adapter, or
579 * we may have run out of requests.
580 */
581 else if (request_status == -1 &&
582 evt_struct->iu.srp.login_req.opcode != SRP_LOGIN_REQ)
583 goto send_busy;
577 /* Abort and reset calls should make it through. 584 /* Abort and reset calls should make it through.
578 * Nothing except abort and reset should use the last two 585 * Nothing except abort and reset should use the last two
579 * slots unless we had two or less to begin with. 586 * slots unless we had two or less to begin with.
@@ -633,7 +640,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
633 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); 640 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
634 641
635 free_event_struct(&hostdata->pool, evt_struct); 642 free_event_struct(&hostdata->pool, evt_struct);
636 atomic_inc(&hostdata->request_limit); 643 if (request_status != -1)
644 atomic_inc(&hostdata->request_limit);
637 return SCSI_MLQUEUE_HOST_BUSY; 645 return SCSI_MLQUEUE_HOST_BUSY;
638 646
639 send_error: 647 send_error:
@@ -927,10 +935,11 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata)
927 login->req_buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT; 935 login->req_buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT;
928 936
929 spin_lock_irqsave(hostdata->host->host_lock, flags); 937 spin_lock_irqsave(hostdata->host->host_lock, flags);
930 /* Start out with a request limit of 1, since this is negotiated in 938 /* Start out with a request limit of 0, since this is negotiated in
931 * the login request we are just sending 939 * the login request we are just sending and login requests always
940 * get sent by the driver regardless of request_limit.
932 */ 941 */
933 atomic_set(&hostdata->request_limit, 1); 942 atomic_set(&hostdata->request_limit, 0);
934 943
935 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2); 944 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, init_timeout * 2);
936 spin_unlock_irqrestore(hostdata->host->host_lock, flags); 945 spin_unlock_irqrestore(hostdata->host->host_lock, flags);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index c0755565fae..4e46045dea6 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -682,6 +682,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
682 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb; 682 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb;
683 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq); 683 struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq);
684 int datadir = scsi_cmnd->sc_data_direction; 684 int datadir = scsi_cmnd->sc_data_direction;
685 char tag[2];
685 686
686 lpfc_cmd->fcp_rsp->rspSnsLen = 0; 687 lpfc_cmd->fcp_rsp->rspSnsLen = 0;
687 /* clear task management bits */ 688 /* clear task management bits */
@@ -692,8 +693,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
692 693
693 memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16); 694 memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16);
694 695
695 if (scsi_cmnd->device->tagged_supported) { 696 if (scsi_populate_tag_msg(scsi_cmnd, tag)) {
696 switch (scsi_cmnd->tag) { 697 switch (tag[0]) {
697 case HEAD_OF_QUEUE_TAG: 698 case HEAD_OF_QUEUE_TAG:
698 fcp_cmnd->fcpCntl1 = HEAD_OF_Q; 699 fcp_cmnd->fcpCntl1 = HEAD_OF_Q;
699 break; 700 break;
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 4652ad22516..abef7048f25 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -593,10 +593,11 @@ static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int q
593 if (aux->frame_type != OS_FRAME_TYPE_DATA && 593 if (aux->frame_type != OS_FRAME_TYPE_DATA &&
594 aux->frame_type != OS_FRAME_TYPE_EOD && 594 aux->frame_type != OS_FRAME_TYPE_EOD &&
595 aux->frame_type != OS_FRAME_TYPE_MARKER) { 595 aux->frame_type != OS_FRAME_TYPE_MARKER) {
596 if (!quiet) 596 if (!quiet) {
597#if DEBUG 597#if DEBUG
598 printk(OSST_DEB_MSG "%s:D: Skipping frame, frame type %x\n", name, aux->frame_type); 598 printk(OSST_DEB_MSG "%s:D: Skipping frame, frame type %x\n", name, aux->frame_type);
599#endif 599#endif
600 }
600 goto err_out; 601 goto err_out;
601 } 602 }
602 if (aux->frame_type == OS_FRAME_TYPE_EOD && 603 if (aux->frame_type == OS_FRAME_TYPE_EOD &&
@@ -606,11 +607,12 @@ static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int q
606 goto err_out; 607 goto err_out;
607 } 608 }
608 if (frame_seq_number != -1 && ntohl(aux->frame_seq_num) != frame_seq_number) { 609 if (frame_seq_number != -1 && ntohl(aux->frame_seq_num) != frame_seq_number) {
609 if (!quiet) 610 if (!quiet) {
610#if DEBUG 611#if DEBUG
611 printk(OSST_DEB_MSG "%s:D: Skipping frame, sequence number %u (expected %d)\n", 612 printk(OSST_DEB_MSG "%s:D: Skipping frame, sequence number %u (expected %d)\n",
612 name, ntohl(aux->frame_seq_num), frame_seq_number); 613 name, ntohl(aux->frame_seq_num), frame_seq_number);
613#endif 614#endif
615 }
614 goto err_out; 616 goto err_out;
615 } 617 }
616 if (aux->frame_type == OS_FRAME_TYPE_MARKER) { 618 if (aux->frame_type == OS_FRAME_TYPE_MARKER) {
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 61fdaf02f25..0e81e4cf887 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -785,7 +785,7 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
785 * end-of-list 785 * end-of-list
786 */ 786 */
787 if (!left) 787 if (!left)
788 sg_mark_end(sgl, this); 788 sg_mark_end(&sgl[this - 1]);
789 789
790 /* 790 /*
791 * don't allow subsequent mempool allocs to sleep, it would 791 * don't allow subsequent mempool allocs to sleep, it would
@@ -2115,6 +2115,142 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2115EXPORT_SYMBOL(scsi_device_set_state); 2115EXPORT_SYMBOL(scsi_device_set_state);
2116 2116
2117/** 2117/**
2118 * sdev_evt_emit - emit a single SCSI device uevent
2119 * @sdev: associated SCSI device
2120 * @evt: event to emit
2121 *
2122 * Send a single uevent (scsi_event) to the associated scsi_device.
2123 */
2124static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
2125{
2126 int idx = 0;
2127 char *envp[3];
2128
2129 switch (evt->evt_type) {
2130 case SDEV_EVT_MEDIA_CHANGE:
2131 envp[idx++] = "SDEV_MEDIA_CHANGE=1";
2132 break;
2133
2134 default:
2135 /* do nothing */
2136 break;
2137 }
2138
2139 envp[idx++] = NULL;
2140
2141 kobject_uevent_env(&sdev->sdev_gendev.kobj, KOBJ_CHANGE, envp);
2142}
2143
2144/**
2145 * sdev_evt_thread - send a uevent for each scsi event
2146 * @work: work struct for scsi_device
2147 *
2148 * Dispatch queued events to their associated scsi_device kobjects
2149 * as uevents.
2150 */
2151void scsi_evt_thread(struct work_struct *work)
2152{
2153 struct scsi_device *sdev;
2154 LIST_HEAD(event_list);
2155
2156 sdev = container_of(work, struct scsi_device, event_work);
2157
2158 while (1) {
2159 struct scsi_event *evt;
2160 struct list_head *this, *tmp;
2161 unsigned long flags;
2162
2163 spin_lock_irqsave(&sdev->list_lock, flags);
2164 list_splice_init(&sdev->event_list, &event_list);
2165 spin_unlock_irqrestore(&sdev->list_lock, flags);
2166
2167 if (list_empty(&event_list))
2168 break;
2169
2170 list_for_each_safe(this, tmp, &event_list) {
2171 evt = list_entry(this, struct scsi_event, node);
2172 list_del(&evt->node);
2173 scsi_evt_emit(sdev, evt);
2174 kfree(evt);
2175 }
2176 }
2177}
2178
2179/**
2180 * sdev_evt_send - send asserted event to uevent thread
2181 * @sdev: scsi_device event occurred on
2182 * @evt: event to send
2183 *
2184 * Assert scsi device event asynchronously.
2185 */
2186void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt)
2187{
2188 unsigned long flags;
2189
2190 if (!test_bit(evt->evt_type, sdev->supported_events)) {
2191 kfree(evt);
2192 return;
2193 }
2194
2195 spin_lock_irqsave(&sdev->list_lock, flags);
2196 list_add_tail(&evt->node, &sdev->event_list);
2197 schedule_work(&sdev->event_work);
2198 spin_unlock_irqrestore(&sdev->list_lock, flags);
2199}
2200EXPORT_SYMBOL_GPL(sdev_evt_send);
2201
2202/**
2203 * sdev_evt_alloc - allocate a new scsi event
2204 * @evt_type: type of event to allocate
2205 * @gfpflags: GFP flags for allocation
2206 *
2207 * Allocates and returns a new scsi_event.
2208 */
2209struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
2210 gfp_t gfpflags)
2211{
2212 struct scsi_event *evt = kzalloc(sizeof(struct scsi_event), gfpflags);
2213 if (!evt)
2214 return NULL;
2215
2216 evt->evt_type = evt_type;
2217 INIT_LIST_HEAD(&evt->node);
2218
2219 /* evt_type-specific initialization, if any */
2220 switch (evt_type) {
2221 case SDEV_EVT_MEDIA_CHANGE:
2222 default:
2223 /* do nothing */
2224 break;
2225 }
2226
2227 return evt;
2228}
2229EXPORT_SYMBOL_GPL(sdev_evt_alloc);
2230
2231/**
2232 * sdev_evt_send_simple - send asserted event to uevent thread
2233 * @sdev: scsi_device event occurred on
2234 * @evt_type: type of event to send
2235 * @gfpflags: GFP flags for allocation
2236 *
2237 * Assert scsi device event asynchronously, given an event type.
2238 */
2239void sdev_evt_send_simple(struct scsi_device *sdev,
2240 enum scsi_device_event evt_type, gfp_t gfpflags)
2241{
2242 struct scsi_event *evt = sdev_evt_alloc(evt_type, gfpflags);
2243 if (!evt) {
2244 sdev_printk(KERN_ERR, sdev, "event %d eaten due to OOM\n",
2245 evt_type);
2246 return;
2247 }
2248
2249 sdev_evt_send(sdev, evt);
2250}
2251EXPORT_SYMBOL_GPL(sdev_evt_send_simple);
2252
2253/**
2118 * scsi_device_quiesce - Block user issued commands. 2254 * scsi_device_quiesce - Block user issued commands.
2119 * @sdev: scsi device to quiesce. 2255 * @sdev: scsi device to quiesce.
2120 * 2256 *
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index b53c5f67e37..40ea71cd2ca 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -236,6 +236,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
236 struct scsi_device *sdev; 236 struct scsi_device *sdev;
237 int display_failure_msg = 1, ret; 237 int display_failure_msg = 1, ret;
238 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 238 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
239 extern void scsi_evt_thread(struct work_struct *work);
239 240
240 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, 241 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size,
241 GFP_ATOMIC); 242 GFP_ATOMIC);
@@ -254,7 +255,9 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
254 INIT_LIST_HEAD(&sdev->same_target_siblings); 255 INIT_LIST_HEAD(&sdev->same_target_siblings);
255 INIT_LIST_HEAD(&sdev->cmd_list); 256 INIT_LIST_HEAD(&sdev->cmd_list);
256 INIT_LIST_HEAD(&sdev->starved_entry); 257 INIT_LIST_HEAD(&sdev->starved_entry);
258 INIT_LIST_HEAD(&sdev->event_list);
257 spin_lock_init(&sdev->list_lock); 259 spin_lock_init(&sdev->list_lock);
260 INIT_WORK(&sdev->event_work, scsi_evt_thread);
258 261
259 sdev->sdev_gendev.parent = get_device(&starget->dev); 262 sdev->sdev_gendev.parent = get_device(&starget->dev);
260 sdev->sdev_target = starget; 263 sdev->sdev_target = starget;
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index d531ceeb0d8..f374fdcb681 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -268,6 +268,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
268 struct scsi_device *sdev; 268 struct scsi_device *sdev;
269 struct device *parent; 269 struct device *parent;
270 struct scsi_target *starget; 270 struct scsi_target *starget;
271 struct list_head *this, *tmp;
271 unsigned long flags; 272 unsigned long flags;
272 273
273 sdev = container_of(work, struct scsi_device, ew.work); 274 sdev = container_of(work, struct scsi_device, ew.work);
@@ -282,6 +283,16 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
282 list_del(&sdev->starved_entry); 283 list_del(&sdev->starved_entry);
283 spin_unlock_irqrestore(sdev->host->host_lock, flags); 284 spin_unlock_irqrestore(sdev->host->host_lock, flags);
284 285
286 cancel_work_sync(&sdev->event_work);
287
288 list_for_each_safe(this, tmp, &sdev->event_list) {
289 struct scsi_event *evt;
290
291 evt = list_entry(this, struct scsi_event, node);
292 list_del(&evt->node);
293 kfree(evt);
294 }
295
285 if (sdev->request_queue) { 296 if (sdev->request_queue) {
286 sdev->request_queue->queuedata = NULL; 297 sdev->request_queue->queuedata = NULL;
287 /* user context needed to free queue */ 298 /* user context needed to free queue */
@@ -614,6 +625,41 @@ sdev_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
614} 625}
615static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); 626static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL);
616 627
628#define DECLARE_EVT_SHOW(name, Cap_name) \
629static ssize_t \
630sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \
631 char *buf) \
632{ \
633 struct scsi_device *sdev = to_scsi_device(dev); \
634 int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\
635 return snprintf(buf, 20, "%d\n", val); \
636}
637
638#define DECLARE_EVT_STORE(name, Cap_name) \
639static ssize_t \
640sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \
641 const char *buf, size_t count) \
642{ \
643 struct scsi_device *sdev = to_scsi_device(dev); \
644 int val = simple_strtoul(buf, NULL, 0); \
645 if (val == 0) \
646 clear_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \
647 else if (val == 1) \
648 set_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \
649 else \
650 return -EINVAL; \
651 return count; \
652}
653
654#define DECLARE_EVT(name, Cap_name) \
655 DECLARE_EVT_SHOW(name, Cap_name) \
656 DECLARE_EVT_STORE(name, Cap_name) \
657 static DEVICE_ATTR(evt_##name, S_IRUGO, sdev_show_evt_##name, \
658 sdev_store_evt_##name);
659#define REF_EVT(name) &dev_attr_evt_##name.attr
660
661DECLARE_EVT(media_change, MEDIA_CHANGE)
662
617/* Default template for device attributes. May NOT be modified */ 663/* Default template for device attributes. May NOT be modified */
618static struct attribute *scsi_sdev_attrs[] = { 664static struct attribute *scsi_sdev_attrs[] = {
619 &dev_attr_device_blocked.attr, 665 &dev_attr_device_blocked.attr,
@@ -631,6 +677,7 @@ static struct attribute *scsi_sdev_attrs[] = {
631 &dev_attr_iodone_cnt.attr, 677 &dev_attr_iodone_cnt.attr,
632 &dev_attr_ioerr_cnt.attr, 678 &dev_attr_ioerr_cnt.attr,
633 &dev_attr_modalias.attr, 679 &dev_attr_modalias.attr,
680 REF_EVT(media_change),
634 NULL 681 NULL
635}; 682};
636 683
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c
index 4d4c9f01be8..1f16de71996 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/serial/8250_early.c
@@ -76,7 +76,7 @@ static void __init wait_for_xmitr(struct uart_port *port)
76 } 76 }
77} 77}
78 78
79static void __init putc(struct uart_port *port, int c) 79static void __init serial_putc(struct uart_port *port, int c)
80{ 80{
81 wait_for_xmitr(port); 81 wait_for_xmitr(port);
82 serial_out(port, UART_TX, c); 82 serial_out(port, UART_TX, c);
@@ -91,7 +91,7 @@ static void __init early_serial8250_write(struct console *console, const char *s
91 ier = serial_in(port, UART_IER); 91 ier = serial_in(port, UART_IER);
92 serial_out(port, UART_IER, 0); 92 serial_out(port, UART_IER, 0);
93 93
94 uart_console_write(port, s, count, putc); 94 uart_console_write(port, s, count, serial_putc);
95 95
96 /* Wait for transmitter to become empty and restore the IER */ 96 /* Wait for transmitter to become empty and restore the IER */
97 wait_for_xmitr(port); 97 wait_for_xmitr(port);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 0e357562ce9..ceb03c9e749 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -1986,6 +1986,7 @@ static int pciserial_suspend_one(struct pci_dev *dev, pm_message_t state)
1986 1986
1987static int pciserial_resume_one(struct pci_dev *dev) 1987static int pciserial_resume_one(struct pci_dev *dev)
1988{ 1988{
1989 int err;
1989 struct serial_private *priv = pci_get_drvdata(dev); 1990 struct serial_private *priv = pci_get_drvdata(dev);
1990 1991
1991 pci_set_power_state(dev, PCI_D0); 1992 pci_set_power_state(dev, PCI_D0);
@@ -1995,7 +1996,9 @@ static int pciserial_resume_one(struct pci_dev *dev)
1995 /* 1996 /*
1996 * The device may have been disabled. Re-enable it. 1997 * The device may have been disabled. Re-enable it.
1997 */ 1998 */
1998 pci_enable_device(dev); 1999 err = pci_enable_device(dev);
2000 if (err)
2001 return err;
1999 2002
2000 pciserial_resume_ports(priv); 2003 pciserial_resume_ports(priv);
2001 } 2004 }
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 161d1021b7e..e52a6296ca4 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -601,8 +601,7 @@ static int match_maple_bus_driver(struct device *devptr,
601 return 0; 601 return 0;
602} 602}
603 603
604static int maple_bus_uevent(struct device *dev, char **envp, 604static int maple_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
605 int num_envp, char *buffer, int buffer_size)
606{ 605{
607 return 0; 606 return 0;
608} 607}
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
index 4d8c2a5b329..bcea8d9b718 100644
--- a/drivers/telephony/phonedev.c
+++ b/drivers/telephony/phonedev.c
@@ -120,9 +120,8 @@ int phone_register_device(struct phone_device *p, int unit)
120void phone_unregister_device(struct phone_device *pfd) 120void phone_unregister_device(struct phone_device *pfd)
121{ 121{
122 mutex_lock(&phone_lock); 122 mutex_lock(&phone_lock);
123 if (phone_device[pfd->minor] != pfd) 123 if (likely(phone_device[pfd->minor] == pfd))
124 panic("phone: bad unregister"); 124 phone_device[pfd->minor] = NULL;
125 phone_device[pfd->minor] = NULL;
126 mutex_unlock(&phone_lock); 125 mutex_unlock(&phone_lock);
127} 126}
128 127
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index ead2475406b..28d4972f7ad 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -11,7 +11,6 @@
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/scatterlist.h>
15#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
16#include <linux/dmapool.h> 15#include <linux/dmapool.h>
17#include <linux/usb.h> 16#include <linux/usb.h>
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 3dd997df850..fea8256a18d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -30,7 +30,6 @@
30#include <linux/utsname.h> 30#include <linux/utsname.h>
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/scatterlist.h>
34#include <linux/device.h> 33#include <linux/device.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
36#include <linux/mutex.h> 35#include <linux/mutex.h>
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 69aa68287d3..c4a6f1095b8 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -36,7 +36,7 @@
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37 37
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/scatterlist.h> 39#include <linux/scatterlist.h>
40#include <linux/mm.h> 40#include <linux/mm.h>
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42 42
diff --git a/drivers/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c
index c404fc69e7e..b481cc0e32e 100644
--- a/drivers/watchdog/alim1535_wdt.c
+++ b/drivers/watchdog/alim1535_wdt.c
@@ -31,7 +31,7 @@ static unsigned long ali_is_open;
31static char ali_expect_release; 31static char ali_expect_release;
32static struct pci_dev *ali_pci; 32static struct pci_dev *ali_pci;
33static u32 ali_timeout_bits; /* stores the computed timeout */ 33static u32 ali_timeout_bits; /* stores the computed timeout */
34static spinlock_t ali_lock; /* Guards the hardware */ 34static DEFINE_SPINLOCK(ali_lock); /* Guards the hardware */
35 35
36/* module parameters */ 36/* module parameters */
37static int timeout = WATCHDOG_TIMEOUT; 37static int timeout = WATCHDOG_TIMEOUT;
@@ -398,8 +398,6 @@ static int __init watchdog_init(void)
398{ 398{
399 int ret; 399 int ret;
400 400
401 spin_lock_init(&ali_lock);
402
403 /* Check whether or not the hardware watchdog is there */ 401 /* Check whether or not the hardware watchdog is there */
404 if (ali_find_watchdog() != 0) { 402 if (ali_find_watchdog() != 0) {
405 return -ENODEV; 403 return -ENODEV;
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 19db5302ba6..a61cbd48dc0 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -61,7 +61,7 @@
61 61
62static int heartbeat = DEFAULT_HEARTBEAT; 62static int heartbeat = DEFAULT_HEARTBEAT;
63 63
64static spinlock_t io_lock; 64static DEFINE_SPINLOCK(io_lock);
65static unsigned long wdt_status; 65static unsigned long wdt_status;
66#define WDT_IN_USE 0 66#define WDT_IN_USE 0
67#define WDT_OK_TO_CLOSE 1 67#define WDT_OK_TO_CLOSE 1
@@ -200,8 +200,6 @@ static int davinci_wdt_probe(struct platform_device *pdev)
200 int ret = 0, size; 200 int ret = 0, size;
201 struct resource *res; 201 struct resource *res;
202 202
203 spin_lock_init(&io_lock);
204
205 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) 203 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
206 heartbeat = DEFAULT_HEARTBEAT; 204 heartbeat = DEFAULT_HEARTBEAT;
207 205
@@ -262,7 +260,7 @@ static int __init davinci_wdt_init(void)
262 260
263static void __exit davinci_wdt_exit(void) 261static void __exit davinci_wdt_exit(void)
264{ 262{
265 return platform_driver_unregister(&platform_wdt_driver); 263 platform_driver_unregister(&platform_wdt_driver);
266} 264}
267 265
268module_init(davinci_wdt_init); 266module_init(davinci_wdt_init);
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
index f236954d253..ca44fd9b19b 100644
--- a/drivers/watchdog/i6300esb.c
+++ b/drivers/watchdog/i6300esb.c
@@ -77,7 +77,7 @@
77 77
78/* internal variables */ 78/* internal variables */
79static void __iomem *BASEADDR; 79static void __iomem *BASEADDR;
80static spinlock_t esb_lock; /* Guards the hardware */ 80static DEFINE_SPINLOCK(esb_lock); /* Guards the hardware */
81static unsigned long timer_alive; 81static unsigned long timer_alive;
82static struct pci_dev *esb_pci; 82static struct pci_dev *esb_pci;
83static unsigned short triggered; /* The status of the watchdog upon boot */ 83static unsigned short triggered; /* The status of the watchdog upon boot */
@@ -456,8 +456,6 @@ static int __init watchdog_init (void)
456{ 456{
457 int ret; 457 int ret;
458 458
459 spin_lock_init(&esb_lock);
460
461 /* Check whether or not the hardware watchdog is there */ 459 /* Check whether or not the hardware watchdog is there */
462 if (!esb_getdevice () || esb_pci == NULL) 460 if (!esb_getdevice () || esb_pci == NULL)
463 return -ENODEV; 461 return -ENODEV;
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index cd5a565bc3a..a0e6809e369 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -35,10 +35,12 @@
35 * 82801GDH (ICH7DH) : document number 307013-002, 307014-009, 35 * 82801GDH (ICH7DH) : document number 307013-002, 307014-009,
36 * 82801GBM (ICH7-M) : document number 307013-002, 307014-009, 36 * 82801GBM (ICH7-M) : document number 307013-002, 307014-009,
37 * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009, 37 * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009,
38 * 82801HB (ICH8) : document number 313056-002, 313057-004, 38 * 82801HB (ICH8) : document number 313056-003, 313057-009,
39 * 82801HR (ICH8R) : document number 313056-002, 313057-004, 39 * 82801HR (ICH8R) : document number 313056-003, 313057-009,
40 * 82801HH (ICH8DH) : document number 313056-002, 313057-004, 40 * 82801HBM (ICH8M) : document number 313056-003, 313057-009,
41 * 82801HO (ICH8DO) : document number 313056-002, 313057-004, 41 * 82801HH (ICH8DH) : document number 313056-003, 313057-009,
42 * 82801HO (ICH8DO) : document number 313056-003, 313057-009,
43 * 82801HEM (ICH8M-E) : document number 313056-003, 313057-009,
42 * 82801IB (ICH9) : document number 316972-001, 316973-001, 44 * 82801IB (ICH9) : document number 316972-001, 316973-001,
43 * 82801IR (ICH9R) : document number 316972-001, 316973-001, 45 * 82801IR (ICH9R) : document number 316972-001, 316973-001,
44 * 82801IH (ICH9DH) : document number 316972-001, 316973-001, 46 * 82801IH (ICH9DH) : document number 316972-001, 316973-001,
@@ -95,8 +97,10 @@ enum iTCO_chipsets {
95 TCO_ICH7M, /* ICH7-M */ 97 TCO_ICH7M, /* ICH7-M */
96 TCO_ICH7MDH, /* ICH7-M DH */ 98 TCO_ICH7MDH, /* ICH7-M DH */
97 TCO_ICH8, /* ICH8 & ICH8R */ 99 TCO_ICH8, /* ICH8 & ICH8R */
100 TCO_ICH8ME, /* ICH8M-E */
98 TCO_ICH8DH, /* ICH8DH */ 101 TCO_ICH8DH, /* ICH8DH */
99 TCO_ICH8DO, /* ICH8DO */ 102 TCO_ICH8DO, /* ICH8DO */
103 TCO_ICH8M, /* ICH8M */
100 TCO_ICH9, /* ICH9 */ 104 TCO_ICH9, /* ICH9 */
101 TCO_ICH9R, /* ICH9R */ 105 TCO_ICH9R, /* ICH9R */
102 TCO_ICH9DH, /* ICH9DH */ 106 TCO_ICH9DH, /* ICH9DH */
@@ -125,8 +129,10 @@ static struct {
125 {"ICH7-M", 2}, 129 {"ICH7-M", 2},
126 {"ICH7-M DH", 2}, 130 {"ICH7-M DH", 2},
127 {"ICH8 or ICH8R", 2}, 131 {"ICH8 or ICH8R", 2},
132 {"ICH8M-E", 2},
128 {"ICH8DH", 2}, 133 {"ICH8DH", 2},
129 {"ICH8DO", 2}, 134 {"ICH8DO", 2},
135 {"ICH8M", 2},
130 {"ICH9", 2}, 136 {"ICH9", 2},
131 {"ICH9R", 2}, 137 {"ICH9R", 2},
132 {"ICH9DH", 2}, 138 {"ICH9DH", 2},
@@ -134,6 +140,15 @@ static struct {
134 {NULL,0} 140 {NULL,0}
135}; 141};
136 142
143#define ITCO_PCI_DEVICE(dev, data) \
144 .vendor = PCI_VENDOR_ID_INTEL, \
145 .device = dev, \
146 .subvendor = PCI_ANY_ID, \
147 .subdevice = PCI_ANY_ID, \
148 .class = 0, \
149 .class_mask = 0, \
150 .driver_data = data
151
137/* 152/*
138 * This data only exists for exporting the supported PCI ids 153 * This data only exists for exporting the supported PCI ids
139 * via MODULE_DEVICE_TABLE. We do not actually register a 154 * via MODULE_DEVICE_TABLE. We do not actually register a
@@ -141,45 +156,47 @@ static struct {
141 * functions that probably will be registered by other drivers. 156 * functions that probably will be registered by other drivers.
142 */ 157 */
143static struct pci_device_id iTCO_wdt_pci_tbl[] = { 158static struct pci_device_id iTCO_wdt_pci_tbl[] = {
144 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH }, 159 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AA_0, TCO_ICH )},
145 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH0 }, 160 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AB_0, TCO_ICH0 )},
146 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2 }, 161 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_0, TCO_ICH2 )},
147 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2M }, 162 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_10, TCO_ICH2M )},
148 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3 }, 163 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_0, TCO_ICH3 )},
149 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3M }, 164 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_12, TCO_ICH3M )},
150 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4 }, 165 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_0, TCO_ICH4 )},
151 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4M }, 166 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_12, TCO_ICH4M )},
152 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_CICH }, 167 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801E_0, TCO_CICH )},
153 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH5 }, 168 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801EB_0, TCO_ICH5 )},
154 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_6300ESB }, 169 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB_1, TCO_6300ESB)},
155 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6 }, 170 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_0, TCO_ICH6 )},
156 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6M }, 171 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_1, TCO_ICH6M )},
157 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6W }, 172 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_2, TCO_ICH6W )},
158 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7 }, 173 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_0, TCO_ICH7 )},
159 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7M }, 174 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_1, TCO_ICH7M )},
160 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7MDH }, 175 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_31, TCO_ICH7MDH)},
161 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8 }, 176 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_0, TCO_ICH8 )},
162 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DH }, 177 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_1, TCO_ICH8ME )},
163 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DO }, 178 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_2, TCO_ICH8DH )},
164 { PCI_VENDOR_ID_INTEL, 0x2918, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9 }, 179 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_3, TCO_ICH8DO )},
165 { PCI_VENDOR_ID_INTEL, 0x2916, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9R }, 180 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_4, TCO_ICH8M )},
166 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9DH }, 181 { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )},
167 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 182 { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )},
168 { PCI_VENDOR_ID_INTEL, 0x2671, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 183 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )},
169 { PCI_VENDOR_ID_INTEL, 0x2672, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 184 { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)},
170 { PCI_VENDOR_ID_INTEL, 0x2673, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 185 { ITCO_PCI_DEVICE(0x2671, TCO_631XESB)},
171 { PCI_VENDOR_ID_INTEL, 0x2674, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 186 { ITCO_PCI_DEVICE(0x2672, TCO_631XESB)},
172 { PCI_VENDOR_ID_INTEL, 0x2675, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 187 { ITCO_PCI_DEVICE(0x2673, TCO_631XESB)},
173 { PCI_VENDOR_ID_INTEL, 0x2676, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 188 { ITCO_PCI_DEVICE(0x2674, TCO_631XESB)},
174 { PCI_VENDOR_ID_INTEL, 0x2677, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 189 { ITCO_PCI_DEVICE(0x2675, TCO_631XESB)},
175 { PCI_VENDOR_ID_INTEL, 0x2678, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 190 { ITCO_PCI_DEVICE(0x2676, TCO_631XESB)},
176 { PCI_VENDOR_ID_INTEL, 0x2679, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 191 { ITCO_PCI_DEVICE(0x2677, TCO_631XESB)},
177 { PCI_VENDOR_ID_INTEL, 0x267a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 192 { ITCO_PCI_DEVICE(0x2678, TCO_631XESB)},
178 { PCI_VENDOR_ID_INTEL, 0x267b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 193 { ITCO_PCI_DEVICE(0x2679, TCO_631XESB)},
179 { PCI_VENDOR_ID_INTEL, 0x267c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 194 { ITCO_PCI_DEVICE(0x267a, TCO_631XESB)},
180 { PCI_VENDOR_ID_INTEL, 0x267d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 195 { ITCO_PCI_DEVICE(0x267b, TCO_631XESB)},
181 { PCI_VENDOR_ID_INTEL, 0x267e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 196 { ITCO_PCI_DEVICE(0x267c, TCO_631XESB)},
182 { PCI_VENDOR_ID_INTEL, 0x267f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB }, 197 { ITCO_PCI_DEVICE(0x267d, TCO_631XESB)},
198 { ITCO_PCI_DEVICE(0x267e, TCO_631XESB)},
199 { ITCO_PCI_DEVICE(0x267f, TCO_631XESB)},
183 { 0, }, /* End of list */ 200 { 0, }, /* End of list */
184}; 201};
185MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl); 202MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
@@ -300,6 +317,7 @@ static int iTCO_wdt_start(void)
300 317
301 /* disable chipset's NO_REBOOT bit */ 318 /* disable chipset's NO_REBOOT bit */
302 if (iTCO_wdt_unset_NO_REBOOT_bit()) { 319 if (iTCO_wdt_unset_NO_REBOOT_bit()) {
320 spin_unlock(&iTCO_wdt_private.io_lock);
303 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); 321 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
304 return -EIO; 322 return -EIO;
305 } 323 }
@@ -590,7 +608,7 @@ static struct miscdevice iTCO_wdt_miscdev = {
590 * Init & exit routines 608 * Init & exit routines
591 */ 609 */
592 610
593static int iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev) 611static int __devinit iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev)
594{ 612{
595 int ret; 613 int ret;
596 u32 base_address; 614 u32 base_address;
@@ -694,7 +712,7 @@ out:
694 return ret; 712 return ret;
695} 713}
696 714
697static void iTCO_wdt_cleanup(void) 715static void __devexit iTCO_wdt_cleanup(void)
698{ 716{
699 /* Stop the timer before we leave */ 717 /* Stop the timer before we leave */
700 if (!nowayout) 718 if (!nowayout)
@@ -709,7 +727,7 @@ static void iTCO_wdt_cleanup(void)
709 iTCO_wdt_private.ACPIBASE = 0; 727 iTCO_wdt_private.ACPIBASE = 0;
710} 728}
711 729
712static int iTCO_wdt_probe(struct platform_device *dev) 730static int __devinit iTCO_wdt_probe(struct platform_device *dev)
713{ 731{
714 int found = 0; 732 int found = 0;
715 struct pci_dev *pdev = NULL; 733 struct pci_dev *pdev = NULL;
@@ -735,7 +753,7 @@ static int iTCO_wdt_probe(struct platform_device *dev)
735 return 0; 753 return 0;
736} 754}
737 755
738static int iTCO_wdt_remove(struct platform_device *dev) 756static int __devexit iTCO_wdt_remove(struct platform_device *dev)
739{ 757{
740 if (iTCO_wdt_private.ACPIBASE) 758 if (iTCO_wdt_private.ACPIBASE)
741 iTCO_wdt_cleanup(); 759 iTCO_wdt_cleanup();
@@ -753,7 +771,7 @@ static void iTCO_wdt_shutdown(struct platform_device *dev)
753 771
754static struct platform_driver iTCO_wdt_driver = { 772static struct platform_driver iTCO_wdt_driver = {
755 .probe = iTCO_wdt_probe, 773 .probe = iTCO_wdt_probe,
756 .remove = iTCO_wdt_remove, 774 .remove = __devexit_p(iTCO_wdt_remove),
757 .shutdown = iTCO_wdt_shutdown, 775 .shutdown = iTCO_wdt_shutdown,
758 .suspend = iTCO_wdt_suspend, 776 .suspend = iTCO_wdt_suspend,
759 .resume = iTCO_wdt_resume, 777 .resume = iTCO_wdt_resume,
diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index c3a60f52ccb..4b89f401691 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -48,7 +48,7 @@
48 48
49static struct platform_device *ibwdt_platform_device; 49static struct platform_device *ibwdt_platform_device;
50static unsigned long ibwdt_is_open; 50static unsigned long ibwdt_is_open;
51static spinlock_t ibwdt_lock; 51static DEFINE_SPINLOCK(ibwdt_lock);
52static char expect_close; 52static char expect_close;
53 53
54/* Module information */ 54/* Module information */
@@ -308,8 +308,6 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
308{ 308{
309 int res; 309 int res;
310 310
311 spin_lock_init(&ibwdt_lock);
312
313#if WDT_START != WDT_STOP 311#if WDT_START != WDT_STOP
314 if (!request_region(WDT_STOP, 1, "IB700 WDT")) { 312 if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
315 printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP); 313 printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP);
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
index 6d35bb112a5..e6e07b4575e 100644
--- a/drivers/watchdog/machzwd.c
+++ b/drivers/watchdog/machzwd.c
@@ -123,8 +123,8 @@ static void zf_ping(unsigned long data);
123static int zf_action = GEN_RESET; 123static int zf_action = GEN_RESET;
124static unsigned long zf_is_open; 124static unsigned long zf_is_open;
125static char zf_expect_close; 125static char zf_expect_close;
126static spinlock_t zf_lock; 126static DEFINE_SPINLOCK(zf_lock);
127static spinlock_t zf_port_lock; 127static DEFINE_SPINLOCK(zf_port_lock);
128static DEFINE_TIMER(zf_timer, zf_ping, 0, 0); 128static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
129static unsigned long next_heartbeat = 0; 129static unsigned long next_heartbeat = 0;
130 130
@@ -438,9 +438,6 @@ static int __init zf_init(void)
438 438
439 zf_show_action(action); 439 zf_show_action(action);
440 440
441 spin_lock_init(&zf_lock);
442 spin_lock_init(&zf_port_lock);
443
444 if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){ 441 if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){
445 printk(KERN_ERR "cannot reserve I/O ports at %d\n", 442 printk(KERN_ERR "cannot reserve I/O ports at %d\n",
446 ZF_IOBASE); 443 ZF_IOBASE);
diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
index a0bf95fb976..6369f569517 100644
--- a/drivers/watchdog/mpc83xx_wdt.c
+++ b/drivers/watchdog/mpc83xx_wdt.c
@@ -56,7 +56,7 @@ static int prescale = 1;
56static unsigned int timeout_sec; 56static unsigned int timeout_sec;
57 57
58static unsigned long wdt_is_open; 58static unsigned long wdt_is_open;
59static spinlock_t wdt_spinlock; 59static DEFINE_SPINLOCK(wdt_spinlock);
60 60
61static void mpc83xx_wdt_keepalive(void) 61static void mpc83xx_wdt_keepalive(void)
62{ 62{
@@ -185,9 +185,6 @@ static int __devinit mpc83xx_wdt_probe(struct platform_device *dev)
185 printk(KERN_INFO "WDT driver for MPC83xx initialized. " 185 printk(KERN_INFO "WDT driver for MPC83xx initialized. "
186 "mode:%s timeout=%d (%d seconds)\n", 186 "mode:%s timeout=%d (%d seconds)\n",
187 reset ? "reset":"interrupt", timeout, timeout_sec); 187 reset ? "reset":"interrupt", timeout, timeout_sec);
188
189 spin_lock_init(&wdt_spinlock);
190
191 return 0; 188 return 0;
192 189
193err_unmap: 190err_unmap:
diff --git a/drivers/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c
index 3d3deae0d64..15e4f8887a9 100644
--- a/drivers/watchdog/pc87413_wdt.c
+++ b/drivers/watchdog/pc87413_wdt.c
@@ -61,7 +61,7 @@ static unsigned long timer_enabled = 0; /* is the timer enabled? */
61 61
62static char expect_close; /* is the close expected? */ 62static char expect_close; /* is the close expected? */
63 63
64static spinlock_t io_lock; /* to guard the watchdog from io races */ 64static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */
65 65
66static int nowayout = WATCHDOG_NOWAYOUT; 66static int nowayout = WATCHDOG_NOWAYOUT;
67 67
@@ -561,8 +561,6 @@ static int __init pc87413_init(void)
561{ 561{
562 int ret; 562 int ret;
563 563
564 spin_lock_init(&io_lock);
565
566 printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT); 564 printk(KERN_INFO PFX "Version " VERSION " at io 0x%X\n", WDT_INDEX_IO_PORT);
567 565
568 /* request_region(io, 2, "pc87413"); */ 566 /* request_region(io, 2, "pc87413"); */
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 22f8873dd09..b04aa096a10 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -80,7 +80,7 @@
80static int nowayout = WATCHDOG_NOWAYOUT; 80static int nowayout = WATCHDOG_NOWAYOUT;
81static int heartbeat = DEFAULT_HEARTBEAT; 81static int heartbeat = DEFAULT_HEARTBEAT;
82 82
83static spinlock_t io_lock; 83static DEFINE_SPINLOCK(io_lock);
84static unsigned long wdt_status; 84static unsigned long wdt_status;
85#define WDT_IN_USE 0 85#define WDT_IN_USE 0
86#define WDT_OK_TO_CLOSE 1 86#define WDT_OK_TO_CLOSE 1
@@ -254,8 +254,6 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
254 int ret = 0, size; 254 int ret = 0, size;
255 struct resource *res; 255 struct resource *res;
256 256
257 spin_lock_init(&io_lock);
258
259 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT) 257 if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
260 heartbeat = DEFAULT_HEARTBEAT; 258 heartbeat = DEFAULT_HEARTBEAT;
261 259
@@ -335,7 +333,7 @@ static int __init pnx4008_wdt_init(void)
335 333
336static void __exit pnx4008_wdt_exit(void) 334static void __exit pnx4008_wdt_exit(void)
337{ 335{
338 return platform_driver_unregister(&platform_wdt_driver); 336 platform_driver_unregister(&platform_wdt_driver);
339} 337}
340 338
341module_init(pnx4008_wdt_init); 339module_init(pnx4008_wdt_init);
diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c
index 285d8528953..2ee2677f364 100644
--- a/drivers/watchdog/sbc8360.c
+++ b/drivers/watchdog/sbc8360.c
@@ -54,7 +54,7 @@
54#include <asm/system.h> 54#include <asm/system.h>
55 55
56static unsigned long sbc8360_is_open; 56static unsigned long sbc8360_is_open;
57static spinlock_t sbc8360_lock; 57static DEFINE_SPINLOCK(sbc8360_lock);
58static char expect_close; 58static char expect_close;
59 59
60#define PFX "sbc8360: " 60#define PFX "sbc8360: "
@@ -359,7 +359,6 @@ static int __init sbc8360_init(void)
359 goto out_noreboot; 359 goto out_noreboot;
360 } 360 }
361 361
362 spin_lock_init(&sbc8360_lock);
363 res = misc_register(&sbc8360_miscdev); 362 res = misc_register(&sbc8360_miscdev);
364 if (res) { 363 if (res) {
365 printk(KERN_ERR PFX "failed to register misc device\n"); 364 printk(KERN_ERR PFX "failed to register misc device\n");
diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c
index 9670d47190d..32ccd7c89c7 100644
--- a/drivers/watchdog/sc1200wdt.c
+++ b/drivers/watchdog/sc1200wdt.c
@@ -74,7 +74,7 @@ static int io = -1;
74static int io_len = 2; /* for non plug and play */ 74static int io_len = 2; /* for non plug and play */
75static struct semaphore open_sem; 75static struct semaphore open_sem;
76static char expect_close; 76static char expect_close;
77static spinlock_t sc1200wdt_lock; /* io port access serialisation */ 77static DEFINE_SPINLOCK(sc1200wdt_lock); /* io port access serialisation */
78 78
79#if defined CONFIG_PNP 79#if defined CONFIG_PNP
80static int isapnp = 1; 80static int isapnp = 1;
@@ -375,7 +375,6 @@ static int __init sc1200wdt_init(void)
375 375
376 printk("%s\n", banner); 376 printk("%s\n", banner);
377 377
378 spin_lock_init(&sc1200wdt_lock);
379 sema_init(&open_sem, 1); 378 sema_init(&open_sem, 1);
380 379
381#if defined CONFIG_PNP 380#if defined CONFIG_PNP
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index e8594c64d1e..2847324a2be 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -125,7 +125,7 @@ static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
125static unsigned long next_heartbeat; 125static unsigned long next_heartbeat;
126static unsigned long wdt_is_open; 126static unsigned long wdt_is_open;
127static char wdt_expect_close; 127static char wdt_expect_close;
128static spinlock_t wdt_spinlock; 128static DEFINE_SPINLOCK(wdt_spinlock);
129 129
130/* 130/*
131 * Whack the dog 131 * Whack the dog
@@ -383,8 +383,6 @@ static int __init sc520_wdt_init(void)
383{ 383{
384 int rc = -EBUSY; 384 int rc = -EBUSY;
385 385
386 spin_lock_init(&wdt_spinlock);
387
388 /* Check that the timeout value is within it's range ; if not reset to the default */ 386 /* Check that the timeout value is within it's range ; if not reset to the default */
389 if (wdt_set_heartbeat(timeout)) { 387 if (wdt_set_heartbeat(timeout)) {
390 wdt_set_heartbeat(WATCHDOG_TIMEOUT); 388 wdt_set_heartbeat(WATCHDOG_TIMEOUT);
diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index d3cb0a76602..5d2b5ba6141 100644
--- a/drivers/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
@@ -83,7 +83,7 @@ static unsigned long timer_enabled = 0; /* is the timer enabled? */
83 83
84static char expect_close; /* is the close expected? */ 84static char expect_close; /* is the close expected? */
85 85
86static spinlock_t io_lock; /* to guard the watchdog from io races */ 86static DEFINE_SPINLOCK(io_lock);/* to guard the watchdog from io races */
87 87
88static int nowayout = WATCHDOG_NOWAYOUT; 88static int nowayout = WATCHDOG_NOWAYOUT;
89 89
@@ -540,8 +540,6 @@ static int __init wb_smsc_wdt_init(void)
540{ 540{
541 int ret; 541 int ret;
542 542
543 spin_lock_init(&io_lock);
544
545 printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n"); 543 printk("SMsC 37B787 watchdog component driver " VERSION " initialising...\n");
546 544
547 if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) { 545 if (!request_region(IOPORT, IOPORT_SIZE, "SMsC 37B787 watchdog")) {
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index df33b3b5a53..386492821fc 100644
--- a/drivers/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
@@ -48,7 +48,7 @@
48 48
49static unsigned long wdt_is_open; 49static unsigned long wdt_is_open;
50static char expect_close; 50static char expect_close;
51static spinlock_t io_lock; 51static DEFINE_SPINLOCK(io_lock);
52 52
53/* You must set this - there is no sane way to probe for this board. */ 53/* You must set this - there is no sane way to probe for this board. */
54static int wdt_io = 0x2E; 54static int wdt_io = 0x2E;
@@ -328,8 +328,6 @@ wdt_init(void)
328{ 328{
329 int ret; 329 int ret;
330 330
331 spin_lock_init(&io_lock);
332
333 printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n"); 331 printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n");
334 332
335 if (wdt_set_heartbeat(timeout)) { 333 if (wdt_set_heartbeat(timeout)) {
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 51826c216d6..c622a0e6c9a 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -47,7 +47,7 @@
47 47
48static unsigned long wdt_is_open; 48static unsigned long wdt_is_open;
49static char expect_close; 49static char expect_close;
50static spinlock_t io_lock; 50static DEFINE_SPINLOCK(io_lock);
51 51
52/* You must set this - there is no sane way to probe for this board. */ 52/* You must set this - there is no sane way to probe for this board. */
53static int wdt_io = 0x2e; 53static int wdt_io = 0x2e;
@@ -376,8 +376,6 @@ wdt_init(void)
376{ 376{
377 int ret, i, found = 0; 377 int ret, i, found = 0;
378 378
379 spin_lock_init(&io_lock);
380
381 printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n"); 379 printk (KERN_INFO PFX "WDT driver for W83697HF/HG initializing\n");
382 380
383 if (wdt_io == 0) { 381 if (wdt_io == 0) {
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index 3c88fe18f4f..bcc9d48955d 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -94,7 +94,7 @@ static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
94static unsigned long next_heartbeat; 94static unsigned long next_heartbeat;
95static unsigned long wdt_is_open; 95static unsigned long wdt_is_open;
96static char wdt_expect_close; 96static char wdt_expect_close;
97static spinlock_t wdt_spinlock; 97static DEFINE_SPINLOCK(wdt_spinlock);
98 98
99/* 99/*
100 * Whack the dog 100 * Whack the dog
@@ -350,8 +350,6 @@ static int __init w83877f_wdt_init(void)
350{ 350{
351 int rc = -EBUSY; 351 int rc = -EBUSY;
352 352
353 spin_lock_init(&wdt_spinlock);
354
355 if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */ 353 if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
356 { 354 {
357 timeout = WATCHDOG_TIMEOUT; 355 timeout = WATCHDOG_TIMEOUT;
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c
index 15796844289..b475529d247 100644
--- a/drivers/watchdog/w83977f_wdt.c
+++ b/drivers/watchdog/w83977f_wdt.c
@@ -50,7 +50,7 @@ static int timeoutW; /* timeout in watchdog counter units */
50static unsigned long timer_alive; 50static unsigned long timer_alive;
51static int testmode; 51static int testmode;
52static char expect_close; 52static char expect_close;
53static spinlock_t spinlock; 53static DEFINE_SPINLOCK(spinlock);
54 54
55module_param(timeout, int, 0); 55module_param(timeout, int, 0);
56MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (15..7635), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); 56MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (15..7635), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")");
@@ -476,8 +476,6 @@ static int __init w83977f_wdt_init(void)
476 476
477 printk(KERN_INFO PFX DRIVER_VERSION); 477 printk(KERN_INFO PFX DRIVER_VERSION);
478 478
479 spin_lock_init(&spinlock);
480
481 /* 479 /*
482 * Check that the timeout value is within it's range ; 480 * Check that the timeout value is within it's range ;
483 * if not reset to the default 481 * if not reset to the default
diff --git a/drivers/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c
index 950905d3c39..9e368091f79 100644
--- a/drivers/watchdog/wafer5823wdt.c
+++ b/drivers/watchdog/wafer5823wdt.c
@@ -45,7 +45,7 @@
45 45
46static unsigned long wafwdt_is_open; 46static unsigned long wafwdt_is_open;
47static char expect_close; 47static char expect_close;
48static spinlock_t wafwdt_lock; 48static DEFINE_SPINLOCK(wafwdt_lock);
49 49
50/* 50/*
51 * You must set these - there is no sane way to probe for this board. 51 * You must set these - there is no sane way to probe for this board.
@@ -252,8 +252,6 @@ static int __init wafwdt_init(void)
252 252
253 printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n"); 253 printk(KERN_INFO "WDT driver for Wafer 5823 single board computer initialising.\n");
254 254
255 spin_lock_init(&wafwdt_lock);
256
257 if (timeout < 1 || timeout > 255) { 255 if (timeout < 1 || timeout > 255) {
258 timeout = WD_TIMO; 256 timeout = WD_TIMO;
259 printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n", 257 printk (KERN_INFO PFX "timeout value must be 1<=x<=255, using %d\n",
diff --git a/drivers/watchdog/wdt.c b/drivers/watchdog/wdt.c
index 0a3de6a0244..53d0bb410df 100644
--- a/drivers/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
@@ -253,7 +253,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id)
253 printk(KERN_CRIT "Possible fan fault.\n"); 253 printk(KERN_CRIT "Possible fan fault.\n");
254 } 254 }
255#endif /* CONFIG_WDT_501 */ 255#endif /* CONFIG_WDT_501 */
256 if (!(status & WDC_SR_WCCR)) 256 if (!(status & WDC_SR_WCCR)) {
257#ifdef SOFTWARE_REBOOT 257#ifdef SOFTWARE_REBOOT
258#ifdef ONLY_TESTING 258#ifdef ONLY_TESTING
259 printk(KERN_CRIT "Would Reboot.\n"); 259 printk(KERN_CRIT "Would Reboot.\n");
@@ -264,6 +264,7 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id)
264#else 264#else
265 printk(KERN_CRIT "Reset in 5ms.\n"); 265 printk(KERN_CRIT "Reset in 5ms.\n");
266#endif 266#endif
267 }
267 return IRQ_HANDLED; 268 return IRQ_HANDLED;
268} 269}
269 270
diff --git a/drivers/watchdog/wdt977.c b/drivers/watchdog/wdt977.c
index 7d300ff7ab0..9b7f6b6edef 100644
--- a/drivers/watchdog/wdt977.c
+++ b/drivers/watchdog/wdt977.c
@@ -59,7 +59,7 @@ static int timeoutM; /* timeout in minutes */
59static unsigned long timer_alive; 59static unsigned long timer_alive;
60static int testmode; 60static int testmode;
61static char expect_close; 61static char expect_close;
62static spinlock_t spinlock; 62static DEFINE_SPINLOCK(spinlock);
63 63
64module_param(timeout, int, 0); 64module_param(timeout, int, 0);
65MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")"); 65MODULE_PARM_DESC(timeout,"Watchdog timeout in seconds (60..15300), default=" __MODULE_STRING(DEFAULT_TIMEOUT) ")");
@@ -448,8 +448,6 @@ static int __init wd977_init(void)
448 448
449 printk(KERN_INFO PFX DRIVER_VERSION); 449 printk(KERN_INFO PFX DRIVER_VERSION);
450 450
451 spin_lock_init(&spinlock);
452
453 /* Check that the timeout value is within it's range ; if not reset to the default */ 451 /* Check that the timeout value is within it's range ; if not reset to the default */
454 if (wdt977_set_timeout(timeout)) 452 if (wdt977_set_timeout(timeout))
455 { 453 {
diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c
index 6baf4ae42c9..1355608683e 100644
--- a/drivers/watchdog/wdt_pci.c
+++ b/drivers/watchdog/wdt_pci.c
@@ -74,7 +74,7 @@
74static int dev_count; 74static int dev_count;
75 75
76static struct semaphore open_sem; 76static struct semaphore open_sem;
77static spinlock_t wdtpci_lock; 77static DEFINE_SPINLOCK(wdtpci_lock);
78static char expect_close; 78static char expect_close;
79 79
80static int io; 80static int io;
@@ -298,7 +298,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id)
298 printk(KERN_CRIT PFX "Possible fan fault.\n"); 298 printk(KERN_CRIT PFX "Possible fan fault.\n");
299 } 299 }
300#endif /* CONFIG_WDT_501_PCI */ 300#endif /* CONFIG_WDT_501_PCI */
301 if (!(status&WDC_SR_WCCR)) 301 if (!(status&WDC_SR_WCCR)) {
302#ifdef SOFTWARE_REBOOT 302#ifdef SOFTWARE_REBOOT
303#ifdef ONLY_TESTING 303#ifdef ONLY_TESTING
304 printk(KERN_CRIT PFX "Would Reboot.\n"); 304 printk(KERN_CRIT PFX "Would Reboot.\n");
@@ -309,6 +309,7 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id)
309#else 309#else
310 printk(KERN_CRIT PFX "Reset in 5ms.\n"); 310 printk(KERN_CRIT PFX "Reset in 5ms.\n");
311#endif 311#endif
312 }
312 return IRQ_HANDLED; 313 return IRQ_HANDLED;
313} 314}
314 315
@@ -606,7 +607,6 @@ static int __devinit wdtpci_init_one (struct pci_dev *dev,
606 } 607 }
607 608
608 sema_init(&open_sem, 1); 609 sema_init(&open_sem, 1);
609 spin_lock_init(&wdtpci_lock);
610 610
611 irq = dev->irq; 611 irq = dev->irq;
612 io = pci_resource_start (dev, 2); 612 io = pci_resource_start (dev, 2);