aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/ac.c2
-rw-r--r--drivers/acpi/battery.c2
-rw-r--r--drivers/acpi/sbs.c2
-rw-r--r--drivers/base/devtmpfs.c3
-rw-r--r--drivers/bcma/driver_chipcommon.c2
-rw-r--r--drivers/bcma/driver_chipcommon_pmu.c2
-rw-r--r--drivers/bcma/driver_pci.c2
-rw-r--r--drivers/block/cciss.h2
-rw-r--r--drivers/block/xen-blkback/blkback.c37
-rw-r--r--drivers/char/bsr.c2
-rw-r--r--drivers/char/hw_random/core.c2
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c2
-rw-r--r--drivers/crypto/caam/ctrl.c26
-rw-r--r--drivers/dma/imx-dma.c3
-rw-r--r--drivers/dma/mv_xor.c5
-rw-r--r--drivers/edac/cell_edac.c2
-rw-r--r--drivers/edac/mpc85xx_edac.c12
-rw-r--r--drivers/gpio/gpio-ab8500.c1
-rw-r--r--drivers/gpio/gpio-bt8xx.c2
-rw-r--r--drivers/gpio/gpio-ep93xx.c2
-rw-r--r--drivers/gpio/gpio-u300.c8
-rw-r--r--drivers/gpu/drm/nouveau/nv50_graph.c1
-rw-r--r--drivers/gpu/drm/sis/sis_drv.h4
-rw-r--r--drivers/hwmon/Kconfig21
-rw-r--r--drivers/hwmon/Makefile2
-rw-r--r--drivers/hwmon/gl520sm.c2
-rw-r--r--drivers/hwmon/hwmon-vid.c42
-rw-r--r--drivers/hwmon/it87.c29
-rw-r--r--drivers/hwmon/lm78.c305
-rw-r--r--drivers/hwmon/max1111.c27
-rw-r--r--drivers/hwmon/sch5627.c334
-rw-r--r--drivers/hwmon/sch5636.c539
-rw-r--r--drivers/hwmon/sch56xx-common.c340
-rw-r--r--drivers/hwmon/sch56xx-common.h24
-rw-r--r--drivers/hwmon/sht15.c2
-rw-r--r--drivers/hwmon/via-cputemp.c44
-rw-r--r--drivers/i2c/Kconfig2
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c61
-rw-r--r--drivers/i2c/busses/i2c-cpm.c7
-rw-r--r--drivers/i2c/busses/i2c-highlander.c2
-rw-r--r--drivers/i2c/busses/i2c-omap.c4
-rw-r--r--drivers/i2c/busses/i2c-pxa.c7
-rw-r--r--drivers/i2c/busses/i2c-s6000.c5
-rw-r--r--drivers/i2c/i2c-core.c5
-rw-r--r--drivers/ide/palm_bk3710.c2
-rw-r--r--drivers/ide/tx4939ide.c4
-rw-r--r--drivers/input/serio/libps2.c2
-rw-r--r--drivers/input/serio/sa1111ps2.c6
-rw-r--r--drivers/isdn/i4l/isdn_bsdcomp.c2
-rw-r--r--drivers/media/rc/ite-cir.c1
-rw-r--r--drivers/media/video/davinci/vpif.c2
-rw-r--r--drivers/media/video/m5mols/m5mols_capture.c1
-rw-r--r--drivers/media/video/omap/omap_vout.c2
-rw-r--r--drivers/media/video/omap24xxcam.c5
-rw-r--r--drivers/media/video/videobuf2-memops.c1
-rw-r--r--drivers/message/i2o/iop.c8
-rw-r--r--drivers/mfd/tc6387xb.c2
-rw-r--r--drivers/misc/atmel-ssc.c2
-rw-r--r--drivers/misc/atmel_pwm.c2
-rw-r--r--drivers/mmc/host/dw_mmc.c2
-rw-r--r--drivers/mmc/host/mxcmmc.c8
-rw-r--r--drivers/mmc/host/vub300.c4
-rw-r--r--drivers/mtd/devices/sst25l.c4
-rw-r--r--drivers/mtd/maps/bfin-async-flash.c2
-rw-r--r--drivers/mtd/maps/ixp2000.c11
-rw-r--r--drivers/mtd/maps/pxa2xx-flash.c2
-rw-r--r--drivers/mtd/mtdchar.c2
-rw-r--r--drivers/mtd/nand/atmel_nand.c4
-rw-r--r--drivers/mtd/nand/bcm_umi_nand.c2
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c2
-rw-r--r--drivers/net/b44.c2
-rw-r--r--drivers/net/bcm63xx_enet.c8
-rw-r--r--drivers/net/bsd_comp.c2
-rw-r--r--drivers/net/can/softing/softing_main.c2
-rw-r--r--drivers/net/davinci_emac.c6
-rw-r--r--drivers/net/eexpress.c2
-rw-r--r--drivers/net/ethoc.c2
-rw-r--r--drivers/net/fec_mpc52xx.c7
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c4
-rw-r--r--drivers/net/fs_enet/mii-fec.c2
-rw-r--r--drivers/net/gianfar_ptp.c2
-rw-r--r--drivers/net/ibm_newemac/core.c2
-rw-r--r--drivers/net/irda/toim3232-sir.c2
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--drivers/net/natsemi.c4
-rw-r--r--drivers/net/pxa168_eth.c2
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/s2io.h4
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/net/sungem.c3
-rw-r--r--drivers/net/wan/lmc/lmc_var.h2
-rw-r--r--drivers/net/wireless/ath/ath5k/ahb.c1
-rw-r--r--drivers/net/wireless/b43/debugfs.c2
-rw-r--r--drivers/net/wireless/b43/dma.c2
-rw-r--r--drivers/net/wireless/b43/leds.c2
-rw-r--r--drivers/net/wireless/b43/lo.c2
-rw-r--r--drivers/net/wireless/b43/main.c2
-rw-r--r--drivers/net/wireless/b43/main.h2
-rw-r--r--drivers/net/wireless/b43/pcmcia.c2
-rw-r--r--drivers/net/wireless/b43/phy_a.c2
-rw-r--r--drivers/net/wireless/b43/phy_common.c2
-rw-r--r--drivers/net/wireless/b43/phy_g.c2
-rw-r--r--drivers/net/wireless/b43/phy_lp.c2
-rw-r--r--drivers/net/wireless/b43/phy_n.c2
-rw-r--r--drivers/net/wireless/b43/pio.c2
-rw-r--r--drivers/net/wireless/b43/radio_2055.c2
-rw-r--r--drivers/net/wireless/b43/rfkill.c2
-rw-r--r--drivers/net/wireless/b43/sdio.c2
-rw-r--r--drivers/net/wireless/b43/sysfs.c2
-rw-r--r--drivers/net/wireless/b43/tables.c2
-rw-r--r--drivers/net/wireless/b43/tables_lpphy.c2
-rw-r--r--drivers/net/wireless/b43/tables_nphy.c2
-rw-r--r--drivers/net/wireless/b43/wa.c2
-rw-r--r--drivers/net/wireless/b43/xmit.c2
-rw-r--r--drivers/net/wireless/b43legacy/debugfs.c2
-rw-r--r--drivers/net/wireless/b43legacy/dma.c2
-rw-r--r--drivers/net/wireless/b43legacy/ilt.c2
-rw-r--r--drivers/net/wireless/b43legacy/leds.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.h2
-rw-r--r--drivers/net/wireless/b43legacy/phy.c2
-rw-r--r--drivers/net/wireless/b43legacy/phy.h2
-rw-r--r--drivers/net/wireless/b43legacy/pio.c2
-rw-r--r--drivers/net/wireless/b43legacy/radio.c2
-rw-r--r--drivers/net/wireless/b43legacy/radio.h2
-rw-r--r--drivers/net/wireless/b43legacy/rfkill.c2
-rw-r--r--drivers/net/wireless/b43legacy/sysfs.c2
-rw-r--r--drivers/net/wireless/b43legacy/xmit.c2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-commands.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/reg.h4
-rw-r--r--drivers/parport/parport_ax88796.c2
-rw-r--r--drivers/pci/hotplug/shpchp_sysfs.c21
-rw-r--r--drivers/pci/pcie/aspm.c2
-rw-r--r--drivers/pcmcia/at91_cf.c7
-rw-r--r--drivers/pcmcia/electra_cf.c4
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c3
-rw-r--r--drivers/pcmcia/pxa2xx_trizeps4.c4
-rw-r--r--drivers/pcmcia/rsrc_iodyn.c6
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c6
-rw-r--r--drivers/platform/x86/asus-wmi.c2
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c10
-rw-r--r--drivers/pnp/pnpbios/rsparser.c12
-rw-r--r--drivers/power/ds2782_battery.c4
-rw-r--r--drivers/rtc/rtc-at32ap700x.c2
-rw-r--r--drivers/rtc/rtc-cmos.c6
-rw-r--r--drivers/rtc/rtc-ds1286.c2
-rw-r--r--drivers/rtc/rtc-ds1511.c2
-rw-r--r--drivers/rtc/rtc-ds1742.c2
-rw-r--r--drivers/rtc/rtc-m48t35.c2
-rw-r--r--drivers/rtc/rtc-m48t59.c2
-rw-r--r--drivers/rtc/rtc-mrst.c5
-rw-r--r--drivers/rtc/rtc-puv3.c5
-rw-r--r--drivers/rtc/rtc-s3c.c5
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h8
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c4
-rw-r--r--drivers/ssb/b43_pci_bridge.c2
-rw-r--r--drivers/ssb/driver_chipcommon.c2
-rw-r--r--drivers/ssb/driver_chipcommon_pmu.c2
-rw-r--r--drivers/ssb/driver_extif.c2
-rw-r--r--drivers/ssb/driver_gige.c2
-rw-r--r--drivers/ssb/driver_mipscore.c2
-rw-r--r--drivers/ssb/driver_pcicore.c2
-rw-r--r--drivers/ssb/embedded.c2
-rw-r--r--drivers/ssb/main.c2
-rw-r--r--drivers/ssb/pci.c2
-rw-r--r--drivers/ssb/pcihost_wrapper.c2
-rw-r--r--drivers/ssb/pcmcia.c2
-rw-r--r--drivers/ssb/scan.c2
-rw-r--r--drivers/ssb/sdio.c2
-rw-r--r--drivers/ssb/sprom.c2
-rw-r--r--drivers/staging/ath6kl/os/linux/include/ar6000_drv.h1
-rw-r--r--drivers/staging/bcm/headers.h7
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_sdio.c1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h1
-rw-r--r--drivers/staging/brcm80211/brcmfmac/wl_iw.c9
-rw-r--r--drivers/staging/hv/hv_mouse.c1
-rw-r--r--drivers/staging/hv/tools/hv_kvp_daemon.c1
-rw-r--r--drivers/staging/nvec/nvec.c1
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c2
-rw-r--r--drivers/staging/rtl8192e/ieee80211/ieee80211_module.c2
-rw-r--r--drivers/staging/rtl8192e/r8192E_core.c6
-rw-r--r--drivers/staging/rtl8192u/ieee80211/ieee80211_module.c2
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c6
-rw-r--r--drivers/staging/rtl8712/drv_types.h1
-rw-r--r--drivers/staging/rtl8712/osdep_service.h1
-rw-r--r--drivers/staging/sep/sep_driver.c1
-rw-r--r--drivers/staging/usbip/userspace/src/utils.h1
-rw-r--r--drivers/target/tcm_fc/tfc_cmd.c1
-rw-r--r--drivers/target/tcm_fc/tfc_conf.c1
-rw-r--r--drivers/target/tcm_fc/tfc_io.c1
-rw-r--r--drivers/target/tcm_fc/tfc_sess.c2
-rw-r--r--drivers/tty/serial/8250_pci.c2
-rw-r--r--drivers/tty/serial/Kconfig15
-rw-r--r--drivers/tty/serial/Makefile2
-rw-r--r--drivers/tty/serial/bfin_5xx.c5
-rw-r--r--drivers/tty/serial/imx.c5
-rw-r--r--drivers/tty/serial/m32r_sio.c2
-rw-r--r--drivers/tty/serial/omap-serial.c6
-rw-r--r--drivers/tty/serial/pxa.c2
-rw-r--r--drivers/tty/serial/s3c2400.c105
-rw-r--r--drivers/tty/serial/s3c2410.c2
-rw-r--r--drivers/tty/serial/s3c2412.c2
-rw-r--r--drivers/tty/serial/s3c2440.c2
-rw-r--r--drivers/tty/serial/s3c24a0.c117
-rw-r--r--drivers/tty/serial/s3c6400.c2
-rw-r--r--drivers/tty/serial/s5pv210.c7
-rw-r--r--drivers/tty/serial/samsung.c9
-rw-r--r--drivers/tty/serial/samsung.h19
-rw-r--r--drivers/tty/serial/sunsu.c2
-rw-r--r--drivers/tty/serial/vt8500_serial.c3
-rw-r--r--drivers/uio/uio_pdrv.c2
-rw-r--r--drivers/uio/uio_pdrv_genirq.c2
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c6
-rw-r--r--drivers/usb/gadget/pxa27x_udc.h4
-rw-r--r--drivers/usb/host/ehci-ath79.c2
-rw-r--r--drivers/usb/host/ehci-cns3xxx.c2
-rw-r--r--drivers/usb/host/ehci-fsl.c2
-rw-r--r--drivers/usb/host/ehci-grlib.c2
-rw-r--r--drivers/usb/host/ehci-ixp4xx.c2
-rw-r--r--drivers/usb/host/ehci-octeon.c2
-rw-r--r--drivers/usb/host/ehci-pmcmsp.c10
-rw-r--r--drivers/usb/host/ehci-ppc-of.c2
-rw-r--r--drivers/usb/host/ehci-w90x900.c2
-rw-r--r--drivers/usb/host/ehci-xilinx-of.c2
-rw-r--r--drivers/usb/host/fhci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-ath79.c4
-rw-r--r--drivers/usb/host/ohci-cns3xxx.c2
-rw-r--r--drivers/usb/host/ohci-da8xx.c2
-rw-r--r--drivers/usb/host/ohci-octeon.c2
-rw-r--r--drivers/usb/host/ohci-ppc-of.c2
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c2
-rw-r--r--drivers/usb/host/ohci-sa1111.c2
-rw-r--r--drivers/usb/host/ohci-sm501.c11
-rw-r--r--drivers/usb/host/ohci-ssb.c2
-rw-r--r--drivers/usb/host/ohci-tmio.c6
-rw-r--r--drivers/usb/host/oxu210hp-hcd.c2
-rw-r--r--drivers/usb/host/uhci-grlib.c2
-rw-r--r--drivers/usb/host/whci/init.c2
-rw-r--r--drivers/usb/misc/ftdi-elan.c28
-rw-r--r--drivers/usb/musb/musb_core.c2
-rw-r--r--drivers/usb/otg/isp1301_omap.c4
-rw-r--r--drivers/usb/otg/otg_fsm.c1
-rw-r--r--drivers/usb/otg/twl4030-usb.c2
-rw-r--r--drivers/uwb/uwbd.c2
-rw-r--r--drivers/uwb/whc-rc.c2
-rw-r--r--drivers/video/atmel_lcdfb.c4
-rw-r--r--drivers/video/aty/atyfb_base.c7
-rw-r--r--drivers/video/au1100fb.c2
-rw-r--r--drivers/video/cobalt_lcdfb.c2
-rw-r--r--drivers/video/controlfb.c4
-rw-r--r--drivers/video/ep93xx-fb.c4
-rw-r--r--drivers/video/i810/i810.h2
-rw-r--r--drivers/video/mb862xx/mb862xxfbdrv.c4
-rw-r--r--drivers/video/msm/mdp.c3
-rw-r--r--drivers/video/msm/msm_fb.c7
-rw-r--r--drivers/video/nuc900fb.c2
-rw-r--r--drivers/video/platinumfb.c5
-rw-r--r--drivers/video/pxa168fb.c2
-rw-r--r--drivers/video/udlfb.c1
-rw-r--r--drivers/video/via/viafbdev.c4
264 files changed, 1655 insertions, 1210 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 58c3f74bd84c..6512b20aeccd 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -89,7 +89,7 @@ struct acpi_ac {
89 unsigned long long state; 89 unsigned long long state;
90}; 90};
91 91
92#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); 92#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger)
93 93
94#ifdef CONFIG_ACPI_PROCFS_POWER 94#ifdef CONFIG_ACPI_PROCFS_POWER
95static const struct file_operations acpi_ac_fops = { 95static const struct file_operations acpi_ac_fops = {
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index fcc13ac0aa18..2c661353e8f2 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -132,7 +132,7 @@ struct acpi_battery {
132 unsigned long flags; 132 unsigned long flags;
133}; 133};
134 134
135#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 135#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat)
136 136
137inline int acpi_battery_present(struct acpi_battery *battery) 137inline int acpi_battery_present(struct acpi_battery *battery)
138{ 138{
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 51ae3794ec7f..50658ff887d9 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -112,7 +112,7 @@ struct acpi_battery {
112 u8 have_sysfs_alarm:1; 112 u8 have_sysfs_alarm:1;
113}; 113};
114 114
115#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 115#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat)
116 116
117struct acpi_sbs { 117struct acpi_sbs {
118 struct power_supply charger; 118 struct power_supply charger;
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 6d678c99512e..b89fffc1d777 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -406,9 +406,10 @@ static int devtmpfsd(void *p)
406 requests = NULL; 406 requests = NULL;
407 spin_unlock(&req_lock); 407 spin_unlock(&req_lock);
408 while (req) { 408 while (req) {
409 struct req *next = req->next;
409 req->err = handle(req->name, req->mode, req->dev); 410 req->err = handle(req->name, req->mode, req->dev);
410 complete(&req->done); 411 complete(&req->done);
411 req = req->next; 412 req = next;
412 } 413 }
413 spin_lock(&req_lock); 414 spin_lock(&req_lock);
414 } 415 }
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index fb543024df2f..851e05bc948a 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -3,7 +3,7 @@
3 * ChipCommon core driver 3 * ChipCommon core driver
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index dd5846bef029..fcc63db0ce75 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -2,7 +2,7 @@
2 * Broadcom specific AMBA 2 * Broadcom specific AMBA
3 * ChipCommon Power Management Unit driver 3 * ChipCommon Power Management Unit driver
4 * 4 *
5 * Copyright 2009, Michael Buesch <mb@bu3sch.de> 5 * Copyright 2009, Michael Buesch <m@bues.ch>
6 * Copyright 2007, Broadcom Corporation 6 * Copyright 2007, Broadcom Corporation
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index 745d26491291..25f3ddf33823 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -3,7 +3,7 @@
3 * PCI Core 3 * PCI Core
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h
index 16b4d58d84dd..c049548e68b7 100644
--- a/drivers/block/cciss.h
+++ b/drivers/block/cciss.h
@@ -223,7 +223,7 @@ static void SA5_submit_command( ctlr_info_t *h, CommandList_struct *c)
223 h->ctlr, c->busaddr); 223 h->ctlr, c->busaddr);
224#endif /* CCISS_DEBUG */ 224#endif /* CCISS_DEBUG */
225 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET); 225 writel(c->busaddr, h->vaddr + SA5_REQUEST_PORT_OFFSET);
226 readl(h->vaddr + SA5_REQUEST_PORT_OFFSET); 226 readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
227 h->commands_outstanding++; 227 h->commands_outstanding++;
228 if ( h->commands_outstanding > h->max_outstanding) 228 if ( h->commands_outstanding > h->max_outstanding)
229 h->max_outstanding = h->commands_outstanding; 229 h->max_outstanding = h->commands_outstanding;
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 5cf2993a8338..2330a9ad5e95 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -458,7 +458,8 @@ static void end_block_io_op(struct bio *bio, int error)
458 * (which has the sectors we want, number of them, grant references, etc), 458 * (which has the sectors we want, number of them, grant references, etc),
459 * and transmute it to the block API to hand it over to the proper block disk. 459 * and transmute it to the block API to hand it over to the proper block disk.
460 */ 460 */
461static int do_block_io_op(struct xen_blkif *blkif) 461static int
462__do_block_io_op(struct xen_blkif *blkif)
462{ 463{
463 union blkif_back_rings *blk_rings = &blkif->blk_rings; 464 union blkif_back_rings *blk_rings = &blkif->blk_rings;
464 struct blkif_request req; 465 struct blkif_request req;
@@ -515,6 +516,23 @@ static int do_block_io_op(struct xen_blkif *blkif)
515 return more_to_do; 516 return more_to_do;
516} 517}
517 518
519static int
520do_block_io_op(struct xen_blkif *blkif)
521{
522 union blkif_back_rings *blk_rings = &blkif->blk_rings;
523 int more_to_do;
524
525 do {
526 more_to_do = __do_block_io_op(blkif);
527 if (more_to_do)
528 break;
529
530 RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
531 } while (more_to_do);
532
533 return more_to_do;
534}
535
518/* 536/*
519 * Transmutation of the 'struct blkif_request' to a proper 'struct bio' 537 * Transmutation of the 'struct blkif_request' to a proper 'struct bio'
520 * and call the 'submit_bio' to pass it to the underlying storage. 538 * and call the 'submit_bio' to pass it to the underlying storage.
@@ -700,7 +718,6 @@ static void make_response(struct xen_blkif *blkif, u64 id,
700 struct blkif_response resp; 718 struct blkif_response resp;
701 unsigned long flags; 719 unsigned long flags;
702 union blkif_back_rings *blk_rings = &blkif->blk_rings; 720 union blkif_back_rings *blk_rings = &blkif->blk_rings;
703 int more_to_do = 0;
704 int notify; 721 int notify;
705 722
706 resp.id = id; 723 resp.id = id;
@@ -727,22 +744,7 @@ static void make_response(struct xen_blkif *blkif, u64 id,
727 } 744 }
728 blk_rings->common.rsp_prod_pvt++; 745 blk_rings->common.rsp_prod_pvt++;
729 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify); 746 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify);
730 if (blk_rings->common.rsp_prod_pvt == blk_rings->common.req_cons) {
731 /*
732 * Tail check for pending requests. Allows frontend to avoid
733 * notifications if requests are already in flight (lower
734 * overheads and promotes batching).
735 */
736 RING_FINAL_CHECK_FOR_REQUESTS(&blk_rings->common, more_to_do);
737
738 } else if (RING_HAS_UNCONSUMED_REQUESTS(&blk_rings->common)) {
739 more_to_do = 1;
740 }
741
742 spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); 747 spin_unlock_irqrestore(&blkif->blk_ring_lock, flags);
743
744 if (more_to_do)
745 blkif_notify_work(blkif);
746 if (notify) 748 if (notify)
747 notify_remote_via_irq(blkif->irq); 749 notify_remote_via_irq(blkif->irq);
748} 750}
@@ -824,3 +826,4 @@ static int __init xen_blkif_init(void)
824module_init(xen_blkif_init); 826module_init(xen_blkif_init);
825 827
826MODULE_LICENSE("Dual BSD/GPL"); 828MODULE_LICENSE("Dual BSD/GPL");
829MODULE_ALIAS("xen-backend:vbd");
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index cf39bc08ce08..0c688232aab3 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -212,7 +212,7 @@ static int bsr_add_node(struct device_node *bn)
212 212
213 cur->bsr_minor = i + total_bsr_devs; 213 cur->bsr_minor = i + total_bsr_devs;
214 cur->bsr_addr = res.start; 214 cur->bsr_addr = res.start;
215 cur->bsr_len = res.end - res.start + 1; 215 cur->bsr_len = resource_size(&res);
216 cur->bsr_bytes = bsr_bytes[i]; 216 cur->bsr_bytes = bsr_bytes[i];
217 cur->bsr_stride = bsr_stride[i]; 217 cur->bsr_stride = bsr_stride[i];
218 cur->bsr_dev = MKDEV(bsr_major, i + total_bsr_devs); 218 cur->bsr_dev = MKDEV(bsr_major, i + total_bsr_devs);
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 2016aad85203..1bafb40ec8a2 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -19,7 +19,7 @@
19 Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com> 19 Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>
20 20
21 Added generic RNG API 21 Added generic RNG API
22 Copyright 2006 Michael Buesch <mbuesch@freenet.de> 22 Copyright 2006 Michael Buesch <m@bues.ch>
23 Copyright 2005 (c) MontaVista Software, Inc. 23 Copyright 2005 (c) MontaVista Software, Inc.
24 24
25 Please read Documentation/hw_random.txt for details on use. 25 Please read Documentation/hw_random.txt for details on use.
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 39ccdeada791..e90e1c74fd4c 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -621,7 +621,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
621 621
622 drvdata->mem_start = regs_res->start; 622 drvdata->mem_start = regs_res->start;
623 drvdata->mem_end = regs_res->end; 623 drvdata->mem_end = regs_res->end;
624 drvdata->mem_size = regs_res->end - regs_res->start + 1; 624 drvdata->mem_size = resource_size(regs_res);
625 625
626 if (!request_mem_region(drvdata->mem_start, 626 if (!request_mem_region(drvdata->mem_start,
627 drvdata->mem_size, DRIVER_NAME)) { 627 drvdata->mem_size, DRIVER_NAME)) {
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index fc2d9ed22470..73988bb7322a 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -166,52 +166,52 @@ static int caam_probe(struct platform_device *pdev)
166 /* Controller-level - performance monitor counters */ 166 /* Controller-level - performance monitor counters */
167 ctrlpriv->ctl_rq_dequeued = 167 ctrlpriv->ctl_rq_dequeued =
168 debugfs_create_u64("rq_dequeued", 168 debugfs_create_u64("rq_dequeued",
169 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 169 S_IRUSR | S_IRGRP | S_IROTH,
170 ctrlpriv->ctl, &perfmon->req_dequeued); 170 ctrlpriv->ctl, &perfmon->req_dequeued);
171 ctrlpriv->ctl_ob_enc_req = 171 ctrlpriv->ctl_ob_enc_req =
172 debugfs_create_u64("ob_rq_encrypted", 172 debugfs_create_u64("ob_rq_encrypted",
173 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 173 S_IRUSR | S_IRGRP | S_IROTH,
174 ctrlpriv->ctl, &perfmon->ob_enc_req); 174 ctrlpriv->ctl, &perfmon->ob_enc_req);
175 ctrlpriv->ctl_ib_dec_req = 175 ctrlpriv->ctl_ib_dec_req =
176 debugfs_create_u64("ib_rq_decrypted", 176 debugfs_create_u64("ib_rq_decrypted",
177 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 177 S_IRUSR | S_IRGRP | S_IROTH,
178 ctrlpriv->ctl, &perfmon->ib_dec_req); 178 ctrlpriv->ctl, &perfmon->ib_dec_req);
179 ctrlpriv->ctl_ob_enc_bytes = 179 ctrlpriv->ctl_ob_enc_bytes =
180 debugfs_create_u64("ob_bytes_encrypted", 180 debugfs_create_u64("ob_bytes_encrypted",
181 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 181 S_IRUSR | S_IRGRP | S_IROTH,
182 ctrlpriv->ctl, &perfmon->ob_enc_bytes); 182 ctrlpriv->ctl, &perfmon->ob_enc_bytes);
183 ctrlpriv->ctl_ob_prot_bytes = 183 ctrlpriv->ctl_ob_prot_bytes =
184 debugfs_create_u64("ob_bytes_protected", 184 debugfs_create_u64("ob_bytes_protected",
185 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 185 S_IRUSR | S_IRGRP | S_IROTH,
186 ctrlpriv->ctl, &perfmon->ob_prot_bytes); 186 ctrlpriv->ctl, &perfmon->ob_prot_bytes);
187 ctrlpriv->ctl_ib_dec_bytes = 187 ctrlpriv->ctl_ib_dec_bytes =
188 debugfs_create_u64("ib_bytes_decrypted", 188 debugfs_create_u64("ib_bytes_decrypted",
189 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 189 S_IRUSR | S_IRGRP | S_IROTH,
190 ctrlpriv->ctl, &perfmon->ib_dec_bytes); 190 ctrlpriv->ctl, &perfmon->ib_dec_bytes);
191 ctrlpriv->ctl_ib_valid_bytes = 191 ctrlpriv->ctl_ib_valid_bytes =
192 debugfs_create_u64("ib_bytes_validated", 192 debugfs_create_u64("ib_bytes_validated",
193 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 193 S_IRUSR | S_IRGRP | S_IROTH,
194 ctrlpriv->ctl, &perfmon->ib_valid_bytes); 194 ctrlpriv->ctl, &perfmon->ib_valid_bytes);
195 195
196 /* Controller level - global status values */ 196 /* Controller level - global status values */
197 ctrlpriv->ctl_faultaddr = 197 ctrlpriv->ctl_faultaddr =
198 debugfs_create_u64("fault_addr", 198 debugfs_create_u64("fault_addr",
199 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 199 S_IRUSR | S_IRGRP | S_IROTH,
200 ctrlpriv->ctl, &perfmon->faultaddr); 200 ctrlpriv->ctl, &perfmon->faultaddr);
201 ctrlpriv->ctl_faultdetail = 201 ctrlpriv->ctl_faultdetail =
202 debugfs_create_u32("fault_detail", 202 debugfs_create_u32("fault_detail",
203 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 203 S_IRUSR | S_IRGRP | S_IROTH,
204 ctrlpriv->ctl, &perfmon->faultdetail); 204 ctrlpriv->ctl, &perfmon->faultdetail);
205 ctrlpriv->ctl_faultstatus = 205 ctrlpriv->ctl_faultstatus =
206 debugfs_create_u32("fault_status", 206 debugfs_create_u32("fault_status",
207 S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, 207 S_IRUSR | S_IRGRP | S_IROTH,
208 ctrlpriv->ctl, &perfmon->status); 208 ctrlpriv->ctl, &perfmon->status);
209 209
210 /* Internal covering keys (useful in non-secure mode only) */ 210 /* Internal covering keys (useful in non-secure mode only) */
211 ctrlpriv->ctl_kek_wrap.data = &ctrlpriv->ctrl->kek[0]; 211 ctrlpriv->ctl_kek_wrap.data = &ctrlpriv->ctrl->kek[0];
212 ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32); 212 ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
213 ctrlpriv->ctl_kek = debugfs_create_blob("kek", 213 ctrlpriv->ctl_kek = debugfs_create_blob("kek",
214 S_IFCHR | S_IRUSR | 214 S_IRUSR |
215 S_IRGRP | S_IROTH, 215 S_IRGRP | S_IROTH,
216 ctrlpriv->ctl, 216 ctrlpriv->ctl,
217 &ctrlpriv->ctl_kek_wrap); 217 &ctrlpriv->ctl_kek_wrap);
@@ -219,7 +219,7 @@ static int caam_probe(struct platform_device *pdev)
219 ctrlpriv->ctl_tkek_wrap.data = &ctrlpriv->ctrl->tkek[0]; 219 ctrlpriv->ctl_tkek_wrap.data = &ctrlpriv->ctrl->tkek[0];
220 ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32); 220 ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
221 ctrlpriv->ctl_tkek = debugfs_create_blob("tkek", 221 ctrlpriv->ctl_tkek = debugfs_create_blob("tkek",
222 S_IFCHR | S_IRUSR | 222 S_IRUSR |
223 S_IRGRP | S_IROTH, 223 S_IRGRP | S_IROTH,
224 ctrlpriv->ctl, 224 ctrlpriv->ctl,
225 &ctrlpriv->ctl_tkek_wrap); 225 &ctrlpriv->ctl_tkek_wrap);
@@ -227,7 +227,7 @@ static int caam_probe(struct platform_device *pdev)
227 ctrlpriv->ctl_tdsk_wrap.data = &ctrlpriv->ctrl->tdsk[0]; 227 ctrlpriv->ctl_tdsk_wrap.data = &ctrlpriv->ctrl->tdsk[0];
228 ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32); 228 ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32);
229 ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk", 229 ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk",
230 S_IFCHR | S_IRUSR | 230 S_IRUSR |
231 S_IRGRP | S_IROTH, 231 S_IRGRP | S_IROTH,
232 ctrlpriv->ctl, 232 ctrlpriv->ctl,
233 &ctrlpriv->ctl_tdsk_wrap); 233 &ctrlpriv->ctl_tdsk_wrap);
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index e18eaabe92b9..d99f71c356b5 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -135,7 +135,8 @@ static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
135 if (ret) 135 if (ret)
136 return ret; 136 return ret;
137 137
138 imx_dma_config_burstlen(imxdmac->imxdma_channel, imxdmac->watermark_level); 138 imx_dma_config_burstlen(imxdmac->imxdma_channel,
139 imxdmac->watermark_level * imxdmac->word_size);
139 140
140 return 0; 141 return 0;
141 default: 142 default:
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 954e334e01bb..06f9f27dbe7c 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1304,8 +1304,7 @@ static int mv_xor_shared_probe(struct platform_device *pdev)
1304 if (!res) 1304 if (!res)
1305 return -ENODEV; 1305 return -ENODEV;
1306 1306
1307 msp->xor_base = devm_ioremap(&pdev->dev, res->start, 1307 msp->xor_base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
1308 res->end - res->start + 1);
1309 if (!msp->xor_base) 1308 if (!msp->xor_base)
1310 return -EBUSY; 1309 return -EBUSY;
1311 1310
@@ -1314,7 +1313,7 @@ static int mv_xor_shared_probe(struct platform_device *pdev)
1314 return -ENODEV; 1313 return -ENODEV;
1315 1314
1316 msp->xor_high_base = devm_ioremap(&pdev->dev, res->start, 1315 msp->xor_high_base = devm_ioremap(&pdev->dev, res->start,
1317 res->end - res->start + 1); 1316 resource_size(res));
1318 if (!msp->xor_high_base) 1317 if (!msp->xor_high_base)
1319 return -EBUSY; 1318 return -EBUSY;
1320 1319
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
index db1df59ae2b6..9a6a274e6925 100644
--- a/drivers/edac/cell_edac.c
+++ b/drivers/edac/cell_edac.c
@@ -140,7 +140,7 @@ static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci)
140 if (of_node_to_nid(np) != priv->node) 140 if (of_node_to_nid(np) != priv->node)
141 continue; 141 continue;
142 csrow->first_page = r.start >> PAGE_SHIFT; 142 csrow->first_page = r.start >> PAGE_SHIFT;
143 csrow->nr_pages = (r.end - r.start + 1) >> PAGE_SHIFT; 143 csrow->nr_pages = resource_size(&r) >> PAGE_SHIFT;
144 csrow->last_page = csrow->first_page + csrow->nr_pages - 1; 144 csrow->last_page = csrow->first_page + csrow->nr_pages - 1;
145 csrow->mtype = MEM_XDR; 145 csrow->mtype = MEM_XDR;
146 csrow->edac_mode = EDAC_SECDED; 146 csrow->edac_mode = EDAC_SECDED;
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 38ab8e2cd7f4..11e1a5dad96f 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -538,15 +538,15 @@ static int __devinit mpc85xx_l2_err_probe(struct platform_device *op)
538 /* we only need the error registers */ 538 /* we only need the error registers */
539 r.start += 0xe00; 539 r.start += 0xe00;
540 540
541 if (!devm_request_mem_region(&op->dev, r.start, 541 if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r),
542 r.end - r.start + 1, pdata->name)) { 542 pdata->name)) {
543 printk(KERN_ERR "%s: Error while requesting mem region\n", 543 printk(KERN_ERR "%s: Error while requesting mem region\n",
544 __func__); 544 __func__);
545 res = -EBUSY; 545 res = -EBUSY;
546 goto err; 546 goto err;
547 } 547 }
548 548
549 pdata->l2_vbase = devm_ioremap(&op->dev, r.start, r.end - r.start + 1); 549 pdata->l2_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r));
550 if (!pdata->l2_vbase) { 550 if (!pdata->l2_vbase) {
551 printk(KERN_ERR "%s: Unable to setup L2 err regs\n", __func__); 551 printk(KERN_ERR "%s: Unable to setup L2 err regs\n", __func__);
552 res = -ENOMEM; 552 res = -ENOMEM;
@@ -987,15 +987,15 @@ static int __devinit mpc85xx_mc_err_probe(struct platform_device *op)
987 goto err; 987 goto err;
988 } 988 }
989 989
990 if (!devm_request_mem_region(&op->dev, r.start, 990 if (!devm_request_mem_region(&op->dev, r.start, resource_size(&r),
991 r.end - r.start + 1, pdata->name)) { 991 pdata->name)) {
992 printk(KERN_ERR "%s: Error while requesting mem region\n", 992 printk(KERN_ERR "%s: Error while requesting mem region\n",
993 __func__); 993 __func__);
994 res = -EBUSY; 994 res = -EBUSY;
995 goto err; 995 goto err;
996 } 996 }
997 997
998 pdata->mc_vbase = devm_ioremap(&op->dev, r.start, r.end - r.start + 1); 998 pdata->mc_vbase = devm_ioremap(&op->dev, r.start, resource_size(&r));
999 if (!pdata->mc_vbase) { 999 if (!pdata->mc_vbase) {
1000 printk(KERN_ERR "%s: Unable to setup MC err regs\n", __func__); 1000 printk(KERN_ERR "%s: Unable to setup MC err regs\n", __func__);
1001 res = -ENOMEM; 1001 res = -ENOMEM;
diff --git a/drivers/gpio/gpio-ab8500.c b/drivers/gpio/gpio-ab8500.c
index 970053c89ff7..ed795e64eea7 100644
--- a/drivers/gpio/gpio-ab8500.c
+++ b/drivers/gpio/gpio-ab8500.c
@@ -15,7 +15,6 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/slab.h>
19#include <linux/gpio.h> 18#include <linux/gpio.h>
20#include <linux/irq.h> 19#include <linux/irq.h>
21#include <linux/interrupt.h> 20#include <linux/interrupt.h>
diff --git a/drivers/gpio/gpio-bt8xx.c b/drivers/gpio/gpio-bt8xx.c
index aa4f09ad3ced..ec57936aef62 100644
--- a/drivers/gpio/gpio-bt8xx.c
+++ b/drivers/gpio/gpio-bt8xx.c
@@ -2,7 +2,7 @@
2 2
3 bt8xx GPIO abuser 3 bt8xx GPIO abuser
4 4
5 Copyright (C) 2008 Michael Buesch <mb@bu3sch.de> 5 Copyright (C) 2008 Michael Buesch <m@bues.ch>
6 6
7 Please do _only_ contact the people listed _above_ with issues related to this driver. 7 Please do _only_ contact the people listed _above_ with issues related to this driver.
8 All the other people listed below are not related to this driver. Their names 8 All the other people listed below are not related to this driver. Their names
diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c
index 3bfd3417ab11..72fb9c665320 100644
--- a/drivers/gpio/gpio-ep93xx.c
+++ b/drivers/gpio/gpio-ep93xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Generic EP93xx GPIO handling 2 * Generic EP93xx GPIO handling
3 * 3 *
4 * Copyright (c) 2008 Ryan Mallon <ryan@bluewatersys.com> 4 * Copyright (c) 2008 Ryan Mallon
5 * Copyright (c) 2011 H Hartley Sweeten <hsweeten@visionengravers.com> 5 * Copyright (c) 2011 H Hartley Sweeten <hsweeten@visionengravers.com>
6 * 6 *
7 * Based on code originally from: 7 * Based on code originally from:
diff --git a/drivers/gpio/gpio-u300.c b/drivers/gpio/gpio-u300.c
index fd2dfeeefdf3..53e8255cb0ba 100644
--- a/drivers/gpio/gpio-u300.c
+++ b/drivers/gpio/gpio-u300.c
@@ -578,8 +578,8 @@ static int __init gpio_probe(struct platform_device *pdev)
578 if (!memres) 578 if (!memres)
579 goto err_no_resource; 579 goto err_no_resource;
580 580
581 if (request_mem_region(memres->start, memres->end - memres->start, "GPIO Controller") 581 if (!request_mem_region(memres->start, resource_size(memres),
582 == NULL) { 582 "GPIO Controller")) {
583 err = -ENODEV; 583 err = -ENODEV;
584 goto err_no_ioregion; 584 goto err_no_ioregion;
585 } 585 }
@@ -637,7 +637,7 @@ static int __init gpio_probe(struct platform_device *pdev)
637 free_irq(gpio_ports[i].irq, &gpio_ports[i]); 637 free_irq(gpio_ports[i].irq, &gpio_ports[i]);
638 iounmap(virtbase); 638 iounmap(virtbase);
639 err_no_ioremap: 639 err_no_ioremap:
640 release_mem_region(memres->start, memres->end - memres->start); 640 release_mem_region(memres->start, resource_size(memres));
641 err_no_ioregion: 641 err_no_ioregion:
642 err_no_resource: 642 err_no_resource:
643 clk_disable(clk); 643 clk_disable(clk);
@@ -657,7 +657,7 @@ static int __exit gpio_remove(struct platform_device *pdev)
657 for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++) 657 for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++)
658 free_irq(gpio_ports[i].irq, &gpio_ports[i]); 658 free_irq(gpio_ports[i].irq, &gpio_ports[i]);
659 iounmap(virtbase); 659 iounmap(virtbase);
660 release_mem_region(memres->start, memres->end - memres->start); 660 release_mem_region(memres->start, resource_size(memres));
661 clk_disable(clk); 661 clk_disable(clk);
662 clk_put(clk); 662 clk_put(clk);
663 return 0; 663 return 0;
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c
index e25cbb46789a..40680f2b4231 100644
--- a/drivers/gpu/drm/nouveau/nv50_graph.c
+++ b/drivers/gpu/drm/nouveau/nv50_graph.c
@@ -31,7 +31,6 @@
31#include "nouveau_grctx.h" 31#include "nouveau_grctx.h"
32#include "nouveau_dma.h" 32#include "nouveau_dma.h"
33#include "nouveau_vm.h" 33#include "nouveau_vm.h"
34#include "nouveau_ramht.h"
35#include "nv50_evo.h" 34#include "nv50_evo.h"
36 35
37struct nv50_graph_engine { 36struct nv50_graph_engine {
diff --git a/drivers/gpu/drm/sis/sis_drv.h b/drivers/gpu/drm/sis/sis_drv.h
index ef940bad63f7..194303c177ad 100644
--- a/drivers/gpu/drm/sis/sis_drv.h
+++ b/drivers/gpu/drm/sis/sis_drv.h
@@ -48,8 +48,8 @@ enum sis_family {
48 48
49 49
50#define SIS_BASE (dev_priv->mmio) 50#define SIS_BASE (dev_priv->mmio)
51#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg); 51#define SIS_READ(reg) DRM_READ32(SIS_BASE, reg)
52#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val); 52#define SIS_WRITE(reg, val) DRM_WRITE32(SIS_BASE, reg, val)
53 53
54typedef struct drm_sis_private { 54typedef struct drm_sis_private {
55 drm_local_map_t *mmio; 55 drm_local_map_t *mmio;
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 5f888f7e7dcb..0598cd22edf2 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1041,8 +1041,13 @@ config SENSORS_SMSC47B397
1041 This driver can also be built as a module. If so, the module 1041 This driver can also be built as a module. If so, the module
1042 will be called smsc47b397. 1042 will be called smsc47b397.
1043 1043
1044config SENSORS_SCH56XX_COMMON
1045 tristate
1046 default n
1047
1044config SENSORS_SCH5627 1048config SENSORS_SCH5627
1045 tristate "SMSC SCH5627" 1049 tristate "SMSC SCH5627"
1050 select SENSORS_SCH56XX_COMMON
1046 help 1051 help
1047 If you say yes here you get support for the hardware monitoring 1052 If you say yes here you get support for the hardware monitoring
1048 features of the SMSC SCH5627 Super-I/O chip. 1053 features of the SMSC SCH5627 Super-I/O chip.
@@ -1050,6 +1055,21 @@ config SENSORS_SCH5627
1050 This driver can also be built as a module. If so, the module 1055 This driver can also be built as a module. If so, the module
1051 will be called sch5627. 1056 will be called sch5627.
1052 1057
1058config SENSORS_SCH5636
1059 tristate "SMSC SCH5636"
1060 select SENSORS_SCH56XX_COMMON
1061 help
1062 SMSC SCH5636 Super I/O chips include an embedded microcontroller for
1063 hardware monitoring solutions, allowing motherboard manufacturers to
1064 create their own custom hwmon solution based upon the SCH5636.
1065
1066 Currently this driver only supports the Fujitsu Theseus SCH5636 based
1067 hwmon solution. Say yes here if you want support for the Fujitsu
1068 Theseus' hardware monitoring features.
1069
1070 This driver can also be built as a module. If so, the module
1071 will be called sch5636.
1072
1053config SENSORS_ADS1015 1073config SENSORS_ADS1015
1054 tristate "Texas Instruments ADS1015" 1074 tristate "Texas Instruments ADS1015"
1055 depends on I2C 1075 depends on I2C
@@ -1142,6 +1162,7 @@ config SENSORS_TWL4030_MADC
1142config SENSORS_VIA_CPUTEMP 1162config SENSORS_VIA_CPUTEMP
1143 tristate "VIA CPU temperature sensor" 1163 tristate "VIA CPU temperature sensor"
1144 depends on X86 1164 depends on X86
1165 select HWMON_VID
1145 help 1166 help
1146 If you say yes here you get support for the temperature 1167 If you say yes here you get support for the temperature
1147 sensor inside your CPU. Supported are all known variants of 1168 sensor inside your CPU. Supported are all known variants of
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 28061cfa0cdb..d7995a1d0784 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -95,7 +95,9 @@ obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
95obj-$(CONFIG_SENSORS_PC87427) += pc87427.o 95obj-$(CONFIG_SENSORS_PC87427) += pc87427.o
96obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 96obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
97obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o 97obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o
98obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o
98obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o 99obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
100obj-$(CONFIG_SENSORS_SCH5636) += sch5636.o
99obj-$(CONFIG_SENSORS_SHT15) += sht15.o 101obj-$(CONFIG_SENSORS_SHT15) += sht15.o
100obj-$(CONFIG_SENSORS_SHT21) += sht21.o 102obj-$(CONFIG_SENSORS_SHT21) += sht21.o
101obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o 103obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index ec588026f0a9..131ea8625f08 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -273,7 +273,7 @@ static SENSOR_DEVICE_ATTR(in4_max, S_IRUGO | S_IWUSR,
273 273
274#define DIV_FROM_REG(val) (1 << (val)) 274#define DIV_FROM_REG(val) (1 << (val))
275#define FAN_FROM_REG(val,div) ((val)==0 ? 0 : (480000/((val) << (div)))) 275#define FAN_FROM_REG(val,div) ((val)==0 ? 0 : (480000/((val) << (div))))
276#define FAN_TO_REG(val,div) ((val)<=0?0:SENSORS_LIMIT((480000 + ((val) << ((div)-1))) / ((val) << (div)), 1, 255)); 276#define FAN_TO_REG(val,div) ((val)<=0?0:SENSORS_LIMIT((480000 + ((val) << ((div)-1))) / ((val) << (div)), 1, 255))
277 277
278static ssize_t get_fan_input(struct device *dev, struct device_attribute *attr, 278static ssize_t get_fan_input(struct device *dev, struct device_attribute *attr,
279 char *buf) 279 char *buf)
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c
index c8195a077da3..932da8a5aaf4 100644
--- a/drivers/hwmon/hwmon-vid.c
+++ b/drivers/hwmon/hwmon-vid.c
@@ -140,7 +140,11 @@ int vid_from_reg(int val, u8 vrm)
140 return(val & 0x10 ? 975 - (val & 0xF) * 25 : 140 return(val & 0x10 ? 975 - (val & 0xF) * 25 :
141 1750 - val * 50); 141 1750 - val * 50);
142 case 13: 142 case 13:
143 case 131:
143 val &= 0x3f; 144 val &= 0x3f;
145 /* Exception for Eden ULV 500 MHz */
146 if (vrm == 131 && val == 0x3f)
147 val++;
144 return(1708 - val * 16); 148 return(1708 - val * 16);
145 case 14: /* Intel Core */ 149 case 14: /* Intel Core */
146 /* compute in uV, round to mV */ 150 /* compute in uV, round to mV */
@@ -205,11 +209,45 @@ static struct vrm_model vrm_models[] = {
205 {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nehemiah */ 209 {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nehemiah */
206 {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */ 210 {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M, Eden-N */
207 {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */ 211 {X86_VENDOR_CENTAUR, 0x6, 0xA, 0x7, 0}, /* No information */
208 {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7, Esther */ 212 {X86_VENDOR_CENTAUR, 0x6, 0xA, ANY, 13}, /* C7-M, C7, Eden (Esther) */
213 {X86_VENDOR_CENTAUR, 0x6, 0xD, ANY, 134}, /* C7-D, C7-M, C7, Eden (Esther) */
209 214
210 {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */ 215 {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */
211}; 216};
212 217
218/*
219 * Special case for VIA model D: there are two different possible
220 * VID tables, so we have to figure out first, which one must be
221 * used. This resolves temporary drm value 134 to 14 (Intel Core
222 * 7-bit VID), 13 (Pentium M 6-bit VID) or 131 (Pentium M 6-bit VID
223 * + quirk for Eden ULV 500 MHz).
224 * Note: something similar might be needed for model A, I'm not sure.
225 */
226static u8 get_via_model_d_vrm(void)
227{
228 unsigned int vid, brand, dummy;
229 static const char *brands[4] = {
230 "C7-M", "C7", "Eden", "C7-D"
231 };
232
233 rdmsr(0x198, dummy, vid);
234 vid &= 0xff;
235
236 rdmsr(0x1154, brand, dummy);
237 brand = ((brand >> 4) ^ (brand >> 2)) & 0x03;
238
239 if (vid > 0x3f) {
240 pr_info("Using %d-bit VID table for VIA %s CPU\n",
241 7, brands[brand]);
242 return 14;
243 } else {
244 pr_info("Using %d-bit VID table for VIA %s CPU\n",
245 6, brands[brand]);
246 /* Enable quirk for Eden */
247 return brand == 2 ? 131 : 13;
248 }
249}
250
213static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) 251static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor)
214{ 252{
215 int i = 0; 253 int i = 0;
@@ -247,6 +285,8 @@ u8 vid_which_vrm(void)
247 eff_model += ((eax & 0x000F0000)>>16)<<4; 285 eff_model += ((eax & 0x000F0000)>>16)<<4;
248 } 286 }
249 vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor); 287 vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor);
288 if (vrm_ret == 134)
289 vrm_ret = get_via_model_d_vrm();
250 if (vrm_ret == 0) 290 if (vrm_ret == 0)
251 pr_info("Unknown VRM version of your x86 CPU\n"); 291 pr_info("Unknown VRM version of your x86 CPU\n");
252 return vrm_ret; 292 return vrm_ret;
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 5f5247750430..d912649fac50 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1172,6 +1172,32 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
1172 struct it87_data *data = it87_update_device(dev); 1172 struct it87_data *data = it87_update_device(dev);
1173 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1); 1173 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
1174} 1174}
1175
1176static ssize_t clear_intrusion(struct device *dev, struct device_attribute
1177 *attr, const char *buf, size_t count)
1178{
1179 struct it87_data *data = dev_get_drvdata(dev);
1180 long val;
1181 int config;
1182
1183 if (strict_strtol(buf, 10, &val) < 0 || val != 0)
1184 return -EINVAL;
1185
1186 mutex_lock(&data->update_lock);
1187 config = it87_read_value(data, IT87_REG_CONFIG);
1188 if (config < 0) {
1189 count = config;
1190 } else {
1191 config |= 1 << 5;
1192 it87_write_value(data, IT87_REG_CONFIG, config);
1193 /* Invalidate cache to force re-read */
1194 data->valid = 0;
1195 }
1196 mutex_unlock(&data->update_lock);
1197
1198 return count;
1199}
1200
1175static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8); 1201static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 8);
1176static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9); 1202static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, show_alarm, NULL, 9);
1177static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10); 1203static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, show_alarm, NULL, 10);
@@ -1188,6 +1214,8 @@ static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 6);
1188static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16); 1214static SENSOR_DEVICE_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 16);
1189static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17); 1215static SENSOR_DEVICE_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 17);
1190static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18); 1216static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 18);
1217static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
1218 show_alarm, clear_intrusion, 4);
1191 1219
1192static ssize_t show_beep(struct device *dev, struct device_attribute *attr, 1220static ssize_t show_beep(struct device *dev, struct device_attribute *attr,
1193 char *buf) 1221 char *buf)
@@ -1350,6 +1378,7 @@ static struct attribute *it87_attributes[] = {
1350 &sensor_dev_attr_temp3_alarm.dev_attr.attr, 1378 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
1351 1379
1352 &dev_attr_alarms.attr, 1380 &dev_attr_alarms.attr,
1381 &sensor_dev_attr_intrusion0_alarm.dev_attr.attr,
1353 &dev_attr_name.attr, 1382 &dev_attr_name.attr,
1354 NULL 1383 NULL
1355}; 1384};
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c
index 4cb24eafe318..6df0b4681710 100644
--- a/drivers/hwmon/lm78.c
+++ b/drivers/hwmon/lm78.c
@@ -2,7 +2,7 @@
2 lm78.c - Part of lm_sensors, Linux kernel modules for hardware 2 lm78.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring 3 monitoring
4 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> 4 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
5 Copyright (c) 2007 Jean Delvare <khali@linux-fr.org> 5 Copyright (c) 2007, 2011 Jean Delvare <khali@linux-fr.org>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
@@ -26,23 +26,21 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/jiffies.h> 27#include <linux/jiffies.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/platform_device.h>
30#include <linux/ioport.h>
31#include <linux/hwmon.h> 29#include <linux/hwmon.h>
32#include <linux/hwmon-vid.h> 30#include <linux/hwmon-vid.h>
33#include <linux/hwmon-sysfs.h> 31#include <linux/hwmon-sysfs.h>
34#include <linux/err.h> 32#include <linux/err.h>
35#include <linux/mutex.h> 33#include <linux/mutex.h>
36#include <linux/io.h>
37 34
38/* ISA device, if found */ 35#ifdef CONFIG_ISA
39static struct platform_device *pdev; 36#include <linux/platform_device.h>
37#include <linux/ioport.h>
38#include <linux/io.h>
39#endif
40 40
41/* Addresses to scan */ 41/* Addresses to scan */
42static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 42static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
43 0x2e, 0x2f, I2C_CLIENT_END }; 43 0x2e, 0x2f, I2C_CLIENT_END };
44static unsigned short isa_address = 0x290;
45
46enum chips { lm78, lm79 }; 44enum chips { lm78, lm79 };
47 45
48/* Many LM78 constants specified below */ 46/* Many LM78 constants specified below */
@@ -143,50 +141,12 @@ struct lm78_data {
143}; 141};
144 142
145 143
146static int lm78_i2c_detect(struct i2c_client *client,
147 struct i2c_board_info *info);
148static int lm78_i2c_probe(struct i2c_client *client,
149 const struct i2c_device_id *id);
150static int lm78_i2c_remove(struct i2c_client *client);
151
152static int __devinit lm78_isa_probe(struct platform_device *pdev);
153static int __devexit lm78_isa_remove(struct platform_device *pdev);
154
155static int lm78_read_value(struct lm78_data *data, u8 reg); 144static int lm78_read_value(struct lm78_data *data, u8 reg);
156static int lm78_write_value(struct lm78_data *data, u8 reg, u8 value); 145static int lm78_write_value(struct lm78_data *data, u8 reg, u8 value);
157static struct lm78_data *lm78_update_device(struct device *dev); 146static struct lm78_data *lm78_update_device(struct device *dev);
158static void lm78_init_device(struct lm78_data *data); 147static void lm78_init_device(struct lm78_data *data);
159 148
160 149
161static const struct i2c_device_id lm78_i2c_id[] = {
162 { "lm78", lm78 },
163 { "lm79", lm79 },
164 { }
165};
166MODULE_DEVICE_TABLE(i2c, lm78_i2c_id);
167
168static struct i2c_driver lm78_driver = {
169 .class = I2C_CLASS_HWMON,
170 .driver = {
171 .name = "lm78",
172 },
173 .probe = lm78_i2c_probe,
174 .remove = lm78_i2c_remove,
175 .id_table = lm78_i2c_id,
176 .detect = lm78_i2c_detect,
177 .address_list = normal_i2c,
178};
179
180static struct platform_driver lm78_isa_driver = {
181 .driver = {
182 .owner = THIS_MODULE,
183 .name = "lm78",
184 },
185 .probe = lm78_isa_probe,
186 .remove = __devexit_p(lm78_isa_remove),
187};
188
189
190/* 7 Voltages */ 150/* 7 Voltages */
191static ssize_t show_in(struct device *dev, struct device_attribute *da, 151static ssize_t show_in(struct device *dev, struct device_attribute *da,
192 char *buf) 152 char *buf)
@@ -514,6 +474,16 @@ static const struct attribute_group lm78_group = {
514 .attrs = lm78_attributes, 474 .attrs = lm78_attributes,
515}; 475};
516 476
477/*
478 * ISA related code
479 */
480#ifdef CONFIG_ISA
481
482/* ISA device, if found */
483static struct platform_device *pdev;
484
485static unsigned short isa_address = 0x290;
486
517/* I2C devices get this name attribute automatically, but for ISA devices 487/* I2C devices get this name attribute automatically, but for ISA devices
518 we must create it by ourselves. */ 488 we must create it by ourselves. */
519static ssize_t show_name(struct device *dev, struct device_attribute 489static ssize_t show_name(struct device *dev, struct device_attribute
@@ -525,6 +495,11 @@ static ssize_t show_name(struct device *dev, struct device_attribute
525} 495}
526static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 496static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
527 497
498static struct lm78_data *lm78_data_if_isa(void)
499{
500 return pdev ? platform_get_drvdata(pdev) : NULL;
501}
502
528/* Returns 1 if the I2C chip appears to be an alias of the ISA chip */ 503/* Returns 1 if the I2C chip appears to be an alias of the ISA chip */
529static int lm78_alias_detect(struct i2c_client *client, u8 chipid) 504static int lm78_alias_detect(struct i2c_client *client, u8 chipid)
530{ 505{
@@ -558,12 +533,24 @@ static int lm78_alias_detect(struct i2c_client *client, u8 chipid)
558 533
559 return 1; 534 return 1;
560} 535}
536#else /* !CONFIG_ISA */
537
538static int lm78_alias_detect(struct i2c_client *client, u8 chipid)
539{
540 return 0;
541}
542
543static struct lm78_data *lm78_data_if_isa(void)
544{
545 return NULL;
546}
547#endif /* CONFIG_ISA */
561 548
562static int lm78_i2c_detect(struct i2c_client *client, 549static int lm78_i2c_detect(struct i2c_client *client,
563 struct i2c_board_info *info) 550 struct i2c_board_info *info)
564{ 551{
565 int i; 552 int i;
566 struct lm78_data *isa = pdev ? platform_get_drvdata(pdev) : NULL; 553 struct lm78_data *isa = lm78_data_if_isa();
567 const char *client_name; 554 const char *client_name;
568 struct i2c_adapter *adapter = client->adapter; 555 struct i2c_adapter *adapter = client->adapter;
569 int address = client->addr; 556 int address = client->addr;
@@ -663,76 +650,24 @@ static int lm78_i2c_remove(struct i2c_client *client)
663 return 0; 650 return 0;
664} 651}
665 652
666static int __devinit lm78_isa_probe(struct platform_device *pdev) 653static const struct i2c_device_id lm78_i2c_id[] = {
667{ 654 { "lm78", lm78 },
668 int err; 655 { "lm79", lm79 },
669 struct lm78_data *data; 656 { }
670 struct resource *res; 657};
671 658MODULE_DEVICE_TABLE(i2c, lm78_i2c_id);
672 /* Reserve the ISA region */
673 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
674 if (!request_region(res->start + LM78_ADDR_REG_OFFSET, 2, "lm78")) {
675 err = -EBUSY;
676 goto exit;
677 }
678
679 if (!(data = kzalloc(sizeof(struct lm78_data), GFP_KERNEL))) {
680 err = -ENOMEM;
681 goto exit_release_region;
682 }
683 mutex_init(&data->lock);
684 data->isa_addr = res->start;
685 platform_set_drvdata(pdev, data);
686
687 if (lm78_read_value(data, LM78_REG_CHIPID) & 0x80) {
688 data->type = lm79;
689 data->name = "lm79";
690 } else {
691 data->type = lm78;
692 data->name = "lm78";
693 }
694
695 /* Initialize the LM78 chip */
696 lm78_init_device(data);
697
698 /* Register sysfs hooks */
699 if ((err = sysfs_create_group(&pdev->dev.kobj, &lm78_group))
700 || (err = device_create_file(&pdev->dev, &dev_attr_name)))
701 goto exit_remove_files;
702
703 data->hwmon_dev = hwmon_device_register(&pdev->dev);
704 if (IS_ERR(data->hwmon_dev)) {
705 err = PTR_ERR(data->hwmon_dev);
706 goto exit_remove_files;
707 }
708
709 return 0;
710
711 exit_remove_files:
712 sysfs_remove_group(&pdev->dev.kobj, &lm78_group);
713 device_remove_file(&pdev->dev, &dev_attr_name);
714 kfree(data);
715 exit_release_region:
716 release_region(res->start + LM78_ADDR_REG_OFFSET, 2);
717 exit:
718 return err;
719}
720
721static int __devexit lm78_isa_remove(struct platform_device *pdev)
722{
723 struct lm78_data *data = platform_get_drvdata(pdev);
724 struct resource *res;
725
726 hwmon_device_unregister(data->hwmon_dev);
727 sysfs_remove_group(&pdev->dev.kobj, &lm78_group);
728 device_remove_file(&pdev->dev, &dev_attr_name);
729 kfree(data);
730
731 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
732 release_region(res->start + LM78_ADDR_REG_OFFSET, 2);
733 659
734 return 0; 660static struct i2c_driver lm78_driver = {
735} 661 .class = I2C_CLASS_HWMON,
662 .driver = {
663 .name = "lm78",
664 },
665 .probe = lm78_i2c_probe,
666 .remove = lm78_i2c_remove,
667 .id_table = lm78_i2c_id,
668 .detect = lm78_i2c_detect,
669 .address_list = normal_i2c,
670};
736 671
737/* The SMBus locks itself, but ISA access must be locked explicitly! 672/* The SMBus locks itself, but ISA access must be locked explicitly!
738 We don't want to lock the whole ISA bus, so we lock each client 673 We don't want to lock the whole ISA bus, so we lock each client
@@ -743,6 +678,7 @@ static int lm78_read_value(struct lm78_data *data, u8 reg)
743{ 678{
744 struct i2c_client *client = data->client; 679 struct i2c_client *client = data->client;
745 680
681#ifdef CONFIG_ISA
746 if (!client) { /* ISA device */ 682 if (!client) { /* ISA device */
747 int res; 683 int res;
748 mutex_lock(&data->lock); 684 mutex_lock(&data->lock);
@@ -751,6 +687,7 @@ static int lm78_read_value(struct lm78_data *data, u8 reg)
751 mutex_unlock(&data->lock); 687 mutex_unlock(&data->lock);
752 return res; 688 return res;
753 } else 689 } else
690#endif
754 return i2c_smbus_read_byte_data(client, reg); 691 return i2c_smbus_read_byte_data(client, reg);
755} 692}
756 693
@@ -765,6 +702,7 @@ static int lm78_write_value(struct lm78_data *data, u8 reg, u8 value)
765{ 702{
766 struct i2c_client *client = data->client; 703 struct i2c_client *client = data->client;
767 704
705#ifdef CONFIG_ISA
768 if (!client) { /* ISA device */ 706 if (!client) { /* ISA device */
769 mutex_lock(&data->lock); 707 mutex_lock(&data->lock);
770 outb_p(reg, data->isa_addr + LM78_ADDR_REG_OFFSET); 708 outb_p(reg, data->isa_addr + LM78_ADDR_REG_OFFSET);
@@ -772,6 +710,7 @@ static int lm78_write_value(struct lm78_data *data, u8 reg, u8 value)
772 mutex_unlock(&data->lock); 710 mutex_unlock(&data->lock);
773 return 0; 711 return 0;
774 } else 712 } else
713#endif
775 return i2c_smbus_write_byte_data(client, reg, value); 714 return i2c_smbus_write_byte_data(client, reg, value);
776} 715}
777 716
@@ -849,6 +788,88 @@ static struct lm78_data *lm78_update_device(struct device *dev)
849 return data; 788 return data;
850} 789}
851 790
791#ifdef CONFIG_ISA
792static int __devinit lm78_isa_probe(struct platform_device *pdev)
793{
794 int err;
795 struct lm78_data *data;
796 struct resource *res;
797
798 /* Reserve the ISA region */
799 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
800 if (!request_region(res->start + LM78_ADDR_REG_OFFSET, 2, "lm78")) {
801 err = -EBUSY;
802 goto exit;
803 }
804
805 data = kzalloc(sizeof(struct lm78_data), GFP_KERNEL);
806 if (!data) {
807 err = -ENOMEM;
808 goto exit_release_region;
809 }
810 mutex_init(&data->lock);
811 data->isa_addr = res->start;
812 platform_set_drvdata(pdev, data);
813
814 if (lm78_read_value(data, LM78_REG_CHIPID) & 0x80) {
815 data->type = lm79;
816 data->name = "lm79";
817 } else {
818 data->type = lm78;
819 data->name = "lm78";
820 }
821
822 /* Initialize the LM78 chip */
823 lm78_init_device(data);
824
825 /* Register sysfs hooks */
826 if ((err = sysfs_create_group(&pdev->dev.kobj, &lm78_group))
827 || (err = device_create_file(&pdev->dev, &dev_attr_name)))
828 goto exit_remove_files;
829
830 data->hwmon_dev = hwmon_device_register(&pdev->dev);
831 if (IS_ERR(data->hwmon_dev)) {
832 err = PTR_ERR(data->hwmon_dev);
833 goto exit_remove_files;
834 }
835
836 return 0;
837
838 exit_remove_files:
839 sysfs_remove_group(&pdev->dev.kobj, &lm78_group);
840 device_remove_file(&pdev->dev, &dev_attr_name);
841 kfree(data);
842 exit_release_region:
843 release_region(res->start + LM78_ADDR_REG_OFFSET, 2);
844 exit:
845 return err;
846}
847
848static int __devexit lm78_isa_remove(struct platform_device *pdev)
849{
850 struct lm78_data *data = platform_get_drvdata(pdev);
851 struct resource *res;
852
853 hwmon_device_unregister(data->hwmon_dev);
854 sysfs_remove_group(&pdev->dev.kobj, &lm78_group);
855 device_remove_file(&pdev->dev, &dev_attr_name);
856 kfree(data);
857
858 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
859 release_region(res->start + LM78_ADDR_REG_OFFSET, 2);
860
861 return 0;
862}
863
864static struct platform_driver lm78_isa_driver = {
865 .driver = {
866 .owner = THIS_MODULE,
867 .name = "lm78",
868 },
869 .probe = lm78_isa_probe,
870 .remove = __devexit_p(lm78_isa_remove),
871};
872
852/* return 1 if a supported chip is found, 0 otherwise */ 873/* return 1 if a supported chip is found, 0 otherwise */
853static int __init lm78_isa_found(unsigned short address) 874static int __init lm78_isa_found(unsigned short address)
854{ 875{
@@ -969,12 +990,10 @@ static int __init lm78_isa_device_add(unsigned short address)
969 return err; 990 return err;
970} 991}
971 992
972static int __init sm_lm78_init(void) 993static int __init lm78_isa_register(void)
973{ 994{
974 int res; 995 int res;
975 996
976 /* We register the ISA device first, so that we can skip the
977 * registration of an I2C interface to the same device. */
978 if (lm78_isa_found(isa_address)) { 997 if (lm78_isa_found(isa_address)) {
979 res = platform_driver_register(&lm78_isa_driver); 998 res = platform_driver_register(&lm78_isa_driver);
980 if (res) 999 if (res)
@@ -986,32 +1005,62 @@ static int __init sm_lm78_init(void)
986 goto exit_unreg_isa_driver; 1005 goto exit_unreg_isa_driver;
987 } 1006 }
988 1007
989 res = i2c_add_driver(&lm78_driver);
990 if (res)
991 goto exit_unreg_isa_device;
992
993 return 0; 1008 return 0;
994 1009
995 exit_unreg_isa_device:
996 platform_device_unregister(pdev);
997 exit_unreg_isa_driver: 1010 exit_unreg_isa_driver:
998 platform_driver_unregister(&lm78_isa_driver); 1011 platform_driver_unregister(&lm78_isa_driver);
999 exit: 1012 exit:
1000 return res; 1013 return res;
1001} 1014}
1002 1015
1003static void __exit sm_lm78_exit(void) 1016static void lm78_isa_unregister(void)
1004{ 1017{
1005 if (pdev) { 1018 if (pdev) {
1006 platform_device_unregister(pdev); 1019 platform_device_unregister(pdev);
1007 platform_driver_unregister(&lm78_isa_driver); 1020 platform_driver_unregister(&lm78_isa_driver);
1008 } 1021 }
1009 i2c_del_driver(&lm78_driver);
1010} 1022}
1023#else /* !CONFIG_ISA */
1011 1024
1025static int __init lm78_isa_register(void)
1026{
1027 return 0;
1028}
1029
1030static void lm78_isa_unregister(void)
1031{
1032}
1033#endif /* CONFIG_ISA */
1012 1034
1035static int __init sm_lm78_init(void)
1036{
1037 int res;
1038
1039 /* We register the ISA device first, so that we can skip the
1040 * registration of an I2C interface to the same device. */
1041 res = lm78_isa_register();
1042 if (res)
1043 goto exit;
1044
1045 res = i2c_add_driver(&lm78_driver);
1046 if (res)
1047 goto exit_unreg_isa_device;
1048
1049 return 0;
1050
1051 exit_unreg_isa_device:
1052 lm78_isa_unregister();
1053 exit:
1054 return res;
1055}
1056
1057static void __exit sm_lm78_exit(void)
1058{
1059 lm78_isa_unregister();
1060 i2c_del_driver(&lm78_driver);
1061}
1013 1062
1014MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>"); 1063MODULE_AUTHOR("Frodo Looijaard, Jean Delvare <khali@linux-fr.org>");
1015MODULE_DESCRIPTION("LM78/LM79 driver"); 1064MODULE_DESCRIPTION("LM78/LM79 driver");
1016MODULE_LICENSE("GPL"); 1065MODULE_LICENSE("GPL");
1017 1066
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 14335bbc9bdc..c97b78ef9116 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -38,8 +38,8 @@ struct max1111_data {
38 struct device *hwmon_dev; 38 struct device *hwmon_dev;
39 struct spi_message msg; 39 struct spi_message msg;
40 struct spi_transfer xfer[2]; 40 struct spi_transfer xfer[2];
41 uint8_t *tx_buf; 41 uint8_t tx_buf[MAX1111_TX_BUF_SIZE];
42 uint8_t *rx_buf; 42 uint8_t rx_buf[MAX1111_RX_BUF_SIZE];
43 struct mutex drvdata_lock; 43 struct mutex drvdata_lock;
44 /* protect msg, xfer and buffers from multiple access */ 44 /* protect msg, xfer and buffers from multiple access */
45}; 45};
@@ -131,33 +131,23 @@ static const struct attribute_group max1111_attr_group = {
131 .attrs = max1111_attributes, 131 .attrs = max1111_attributes,
132}; 132};
133 133
134static int setup_transfer(struct max1111_data *data) 134static int __devinit setup_transfer(struct max1111_data *data)
135{ 135{
136 struct spi_message *m; 136 struct spi_message *m;
137 struct spi_transfer *x; 137 struct spi_transfer *x;
138 138
139 data->tx_buf = kmalloc(MAX1111_TX_BUF_SIZE, GFP_KERNEL);
140 if (!data->tx_buf)
141 return -ENOMEM;
142
143 data->rx_buf = kmalloc(MAX1111_RX_BUF_SIZE, GFP_KERNEL);
144 if (!data->rx_buf) {
145 kfree(data->tx_buf);
146 return -ENOMEM;
147 }
148
149 m = &data->msg; 139 m = &data->msg;
150 x = &data->xfer[0]; 140 x = &data->xfer[0];
151 141
152 spi_message_init(m); 142 spi_message_init(m);
153 143
154 x->tx_buf = &data->tx_buf[0]; 144 x->tx_buf = &data->tx_buf[0];
155 x->len = 1; 145 x->len = MAX1111_TX_BUF_SIZE;
156 spi_message_add_tail(x, m); 146 spi_message_add_tail(x, m);
157 147
158 x++; 148 x++;
159 x->rx_buf = &data->rx_buf[0]; 149 x->rx_buf = &data->rx_buf[0];
160 x->len = 2; 150 x->len = MAX1111_RX_BUF_SIZE;
161 spi_message_add_tail(x, m); 151 spi_message_add_tail(x, m);
162 152
163 return 0; 153 return 0;
@@ -192,7 +182,7 @@ static int __devinit max1111_probe(struct spi_device *spi)
192 err = sysfs_create_group(&spi->dev.kobj, &max1111_attr_group); 182 err = sysfs_create_group(&spi->dev.kobj, &max1111_attr_group);
193 if (err) { 183 if (err) {
194 dev_err(&spi->dev, "failed to create attribute group\n"); 184 dev_err(&spi->dev, "failed to create attribute group\n");
195 goto err_free_all; 185 goto err_free_data;
196 } 186 }
197 187
198 data->hwmon_dev = hwmon_device_register(&spi->dev); 188 data->hwmon_dev = hwmon_device_register(&spi->dev);
@@ -209,9 +199,6 @@ static int __devinit max1111_probe(struct spi_device *spi)
209 199
210err_remove: 200err_remove:
211 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); 201 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);
212err_free_all:
213 kfree(data->rx_buf);
214 kfree(data->tx_buf);
215err_free_data: 202err_free_data:
216 kfree(data); 203 kfree(data);
217 return err; 204 return err;
@@ -224,8 +211,6 @@ static int __devexit max1111_remove(struct spi_device *spi)
224 hwmon_device_unregister(data->hwmon_dev); 211 hwmon_device_unregister(data->hwmon_dev);
225 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); 212 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);
226 mutex_destroy(&data->drvdata_lock); 213 mutex_destroy(&data->drvdata_lock);
227 kfree(data->rx_buf);
228 kfree(data->tx_buf);
229 kfree(data); 214 kfree(data);
230 return 0; 215 return 0;
231} 216}
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c
index 3494a4cce414..e3b5c6039c25 100644
--- a/drivers/hwmon/sch5627.c
+++ b/drivers/hwmon/sch5627.c
@@ -28,33 +28,15 @@
28#include <linux/hwmon-sysfs.h> 28#include <linux/hwmon-sysfs.h>
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/io.h> 31#include "sch56xx-common.h"
32#include <linux/acpi.h>
33#include <linux/delay.h>
34 32
35#define DRVNAME "sch5627" 33#define DRVNAME "sch5627"
36#define DEVNAME DRVNAME /* We only support one model */ 34#define DEVNAME DRVNAME /* We only support one model */
37 35
38#define SIO_SCH5627_EM_LD 0x0C /* Embedded Microcontroller LD */
39#define SIO_UNLOCK_KEY 0x55 /* Key to enable Super-I/O */
40#define SIO_LOCK_KEY 0xAA /* Key to disable Super-I/O */
41
42#define SIO_REG_LDSEL 0x07 /* Logical device select */
43#define SIO_REG_DEVID 0x20 /* Device ID */
44#define SIO_REG_ENABLE 0x30 /* Logical device enable */
45#define SIO_REG_ADDR 0x66 /* Logical device address (2 bytes) */
46
47#define SIO_SCH5627_ID 0xC6 /* Chipset ID */
48
49#define REGION_LENGTH 9
50
51#define SCH5627_HWMON_ID 0xa5 36#define SCH5627_HWMON_ID 0xa5
52#define SCH5627_COMPANY_ID 0x5c 37#define SCH5627_COMPANY_ID 0x5c
53#define SCH5627_PRIMARY_ID 0xa0 38#define SCH5627_PRIMARY_ID 0xa0
54 39
55#define SCH5627_CMD_READ 0x02
56#define SCH5627_CMD_WRITE 0x03
57
58#define SCH5627_REG_BUILD_CODE 0x39 40#define SCH5627_REG_BUILD_CODE 0x39
59#define SCH5627_REG_BUILD_ID 0x3a 41#define SCH5627_REG_BUILD_ID 0x3a
60#define SCH5627_REG_HWMON_ID 0x3c 42#define SCH5627_REG_HWMON_ID 0x3c
@@ -111,182 +93,6 @@ struct sch5627_data {
111 u16 in[SCH5627_NO_IN]; 93 u16 in[SCH5627_NO_IN];
112}; 94};
113 95
114static struct platform_device *sch5627_pdev;
115
116/* Super I/O functions */
117static inline int superio_inb(int base, int reg)
118{
119 outb(reg, base);
120 return inb(base + 1);
121}
122
123static inline int superio_enter(int base)
124{
125 /* Don't step on other drivers' I/O space by accident */
126 if (!request_muxed_region(base, 2, DRVNAME)) {
127 pr_err("I/O address 0x%04x already in use\n", base);
128 return -EBUSY;
129 }
130
131 outb(SIO_UNLOCK_KEY, base);
132
133 return 0;
134}
135
136static inline void superio_select(int base, int ld)
137{
138 outb(SIO_REG_LDSEL, base);
139 outb(ld, base + 1);
140}
141
142static inline void superio_exit(int base)
143{
144 outb(SIO_LOCK_KEY, base);
145 release_region(base, 2);
146}
147
148static int sch5627_send_cmd(struct sch5627_data *data, u8 cmd, u16 reg, u8 v)
149{
150 u8 val;
151 int i;
152 /*
153 * According to SMSC for the commands we use the maximum time for
154 * the EM to respond is 15 ms, but testing shows in practice it
155 * responds within 15-32 reads, so we first busy poll, and if
156 * that fails sleep a bit and try again until we are way past
157 * the 15 ms maximum response time.
158 */
159 const int max_busy_polls = 64;
160 const int max_lazy_polls = 32;
161
162 /* (Optional) Write-Clear the EC to Host Mailbox Register */
163 val = inb(data->addr + 1);
164 outb(val, data->addr + 1);
165
166 /* Set Mailbox Address Pointer to first location in Region 1 */
167 outb(0x00, data->addr + 2);
168 outb(0x80, data->addr + 3);
169
170 /* Write Request Packet Header */
171 outb(cmd, data->addr + 4); /* VREG Access Type read:0x02 write:0x03 */
172 outb(0x01, data->addr + 5); /* # of Entries: 1 Byte (8-bit) */
173 outb(0x04, data->addr + 2); /* Mailbox AP to first data entry loc. */
174
175 /* Write Value field */
176 if (cmd == SCH5627_CMD_WRITE)
177 outb(v, data->addr + 4);
178
179 /* Write Address field */
180 outb(reg & 0xff, data->addr + 6);
181 outb(reg >> 8, data->addr + 7);
182
183 /* Execute the Random Access Command */
184 outb(0x01, data->addr); /* Write 01h to the Host-to-EC register */
185
186 /* EM Interface Polling "Algorithm" */
187 for (i = 0; i < max_busy_polls + max_lazy_polls; i++) {
188 if (i >= max_busy_polls)
189 msleep(1);
190 /* Read Interrupt source Register */
191 val = inb(data->addr + 8);
192 /* Write Clear the interrupt source bits */
193 if (val)
194 outb(val, data->addr + 8);
195 /* Command Completed ? */
196 if (val & 0x01)
197 break;
198 }
199 if (i == max_busy_polls + max_lazy_polls) {
200 pr_err("Max retries exceeded reading virtual "
201 "register 0x%04hx (%d)\n", reg, 1);
202 return -EIO;
203 }
204
205 /*
206 * According to SMSC we may need to retry this, but sofar I've always
207 * seen this succeed in 1 try.
208 */
209 for (i = 0; i < max_busy_polls; i++) {
210 /* Read EC-to-Host Register */
211 val = inb(data->addr + 1);
212 /* Command Completed ? */
213 if (val == 0x01)
214 break;
215
216 if (i == 0)
217 pr_warn("EC reports: 0x%02x reading virtual register "
218 "0x%04hx\n", (unsigned int)val, reg);
219 }
220 if (i == max_busy_polls) {
221 pr_err("Max retries exceeded reading virtual "
222 "register 0x%04hx (%d)\n", reg, 2);
223 return -EIO;
224 }
225
226 /*
227 * According to the SMSC app note we should now do:
228 *
229 * Set Mailbox Address Pointer to first location in Region 1 *
230 * outb(0x00, data->addr + 2);
231 * outb(0x80, data->addr + 3);
232 *
233 * But if we do that things don't work, so let's not.
234 */
235
236 /* Read Value field */
237 if (cmd == SCH5627_CMD_READ)
238 return inb(data->addr + 4);
239
240 return 0;
241}
242
243static int sch5627_read_virtual_reg(struct sch5627_data *data, u16 reg)
244{
245 return sch5627_send_cmd(data, SCH5627_CMD_READ, reg, 0);
246}
247
248static int sch5627_write_virtual_reg(struct sch5627_data *data,
249 u16 reg, u8 val)
250{
251 return sch5627_send_cmd(data, SCH5627_CMD_WRITE, reg, val);
252}
253
254static int sch5627_read_virtual_reg16(struct sch5627_data *data, u16 reg)
255{
256 int lsb, msb;
257
258 /* Read LSB first, this will cause the matching MSB to be latched */
259 lsb = sch5627_read_virtual_reg(data, reg);
260 if (lsb < 0)
261 return lsb;
262
263 msb = sch5627_read_virtual_reg(data, reg + 1);
264 if (msb < 0)
265 return msb;
266
267 return lsb | (msb << 8);
268}
269
270static int sch5627_read_virtual_reg12(struct sch5627_data *data, u16 msb_reg,
271 u16 lsn_reg, int high_nibble)
272{
273 int msb, lsn;
274
275 /* Read MSB first, this will cause the matching LSN to be latched */
276 msb = sch5627_read_virtual_reg(data, msb_reg);
277 if (msb < 0)
278 return msb;
279
280 lsn = sch5627_read_virtual_reg(data, lsn_reg);
281 if (lsn < 0)
282 return lsn;
283
284 if (high_nibble)
285 return (msb << 4) | (lsn >> 4);
286 else
287 return (msb << 4) | (lsn & 0x0f);
288}
289
290static struct sch5627_data *sch5627_update_device(struct device *dev) 96static struct sch5627_data *sch5627_update_device(struct device *dev)
291{ 97{
292 struct sch5627_data *data = dev_get_drvdata(dev); 98 struct sch5627_data *data = dev_get_drvdata(dev);
@@ -297,7 +103,7 @@ static struct sch5627_data *sch5627_update_device(struct device *dev)
297 103
298 /* Trigger a Vbat voltage measurement every 5 minutes */ 104 /* Trigger a Vbat voltage measurement every 5 minutes */
299 if (time_after(jiffies, data->last_battery + 300 * HZ)) { 105 if (time_after(jiffies, data->last_battery + 300 * HZ)) {
300 sch5627_write_virtual_reg(data, SCH5627_REG_CTRL, 106 sch56xx_write_virtual_reg(data->addr, SCH5627_REG_CTRL,
301 data->control | 0x10); 107 data->control | 0x10);
302 data->last_battery = jiffies; 108 data->last_battery = jiffies;
303 } 109 }
@@ -305,7 +111,7 @@ static struct sch5627_data *sch5627_update_device(struct device *dev)
305 /* Cache the values for 1 second */ 111 /* Cache the values for 1 second */
306 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { 112 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
307 for (i = 0; i < SCH5627_NO_TEMPS; i++) { 113 for (i = 0; i < SCH5627_NO_TEMPS; i++) {
308 val = sch5627_read_virtual_reg12(data, 114 val = sch56xx_read_virtual_reg12(data->addr,
309 SCH5627_REG_TEMP_MSB[i], 115 SCH5627_REG_TEMP_MSB[i],
310 SCH5627_REG_TEMP_LSN[i], 116 SCH5627_REG_TEMP_LSN[i],
311 SCH5627_REG_TEMP_HIGH_NIBBLE[i]); 117 SCH5627_REG_TEMP_HIGH_NIBBLE[i]);
@@ -317,7 +123,7 @@ static struct sch5627_data *sch5627_update_device(struct device *dev)
317 } 123 }
318 124
319 for (i = 0; i < SCH5627_NO_FANS; i++) { 125 for (i = 0; i < SCH5627_NO_FANS; i++) {
320 val = sch5627_read_virtual_reg16(data, 126 val = sch56xx_read_virtual_reg16(data->addr,
321 SCH5627_REG_FAN[i]); 127 SCH5627_REG_FAN[i]);
322 if (unlikely(val < 0)) { 128 if (unlikely(val < 0)) {
323 ret = ERR_PTR(val); 129 ret = ERR_PTR(val);
@@ -327,7 +133,7 @@ static struct sch5627_data *sch5627_update_device(struct device *dev)
327 } 133 }
328 134
329 for (i = 0; i < SCH5627_NO_IN; i++) { 135 for (i = 0; i < SCH5627_NO_IN; i++) {
330 val = sch5627_read_virtual_reg12(data, 136 val = sch56xx_read_virtual_reg12(data->addr,
331 SCH5627_REG_IN_MSB[i], 137 SCH5627_REG_IN_MSB[i],
332 SCH5627_REG_IN_LSN[i], 138 SCH5627_REG_IN_LSN[i],
333 SCH5627_REG_IN_HIGH_NIBBLE[i]); 139 SCH5627_REG_IN_HIGH_NIBBLE[i]);
@@ -355,18 +161,21 @@ static int __devinit sch5627_read_limits(struct sch5627_data *data)
355 * Note what SMSC calls ABS, is what lm_sensors calls max 161 * Note what SMSC calls ABS, is what lm_sensors calls max
356 * (aka high), and HIGH is what lm_sensors calls crit. 162 * (aka high), and HIGH is what lm_sensors calls crit.
357 */ 163 */
358 val = sch5627_read_virtual_reg(data, SCH5627_REG_TEMP_ABS[i]); 164 val = sch56xx_read_virtual_reg(data->addr,
165 SCH5627_REG_TEMP_ABS[i]);
359 if (val < 0) 166 if (val < 0)
360 return val; 167 return val;
361 data->temp_max[i] = val; 168 data->temp_max[i] = val;
362 169
363 val = sch5627_read_virtual_reg(data, SCH5627_REG_TEMP_HIGH[i]); 170 val = sch56xx_read_virtual_reg(data->addr,
171 SCH5627_REG_TEMP_HIGH[i]);
364 if (val < 0) 172 if (val < 0)
365 return val; 173 return val;
366 data->temp_crit[i] = val; 174 data->temp_crit[i] = val;
367 } 175 }
368 for (i = 0; i < SCH5627_NO_FANS; i++) { 176 for (i = 0; i < SCH5627_NO_FANS; i++) {
369 val = sch5627_read_virtual_reg16(data, SCH5627_REG_FAN_MIN[i]); 177 val = sch56xx_read_virtual_reg16(data->addr,
178 SCH5627_REG_FAN_MIN[i]);
370 if (val < 0) 179 if (val < 0)
371 return val; 180 return val;
372 data->fan_min[i] = val; 181 data->fan_min[i] = val;
@@ -667,7 +476,7 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
667 mutex_init(&data->update_lock); 476 mutex_init(&data->update_lock);
668 platform_set_drvdata(pdev, data); 477 platform_set_drvdata(pdev, data);
669 478
670 val = sch5627_read_virtual_reg(data, SCH5627_REG_HWMON_ID); 479 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_HWMON_ID);
671 if (val < 0) { 480 if (val < 0) {
672 err = val; 481 err = val;
673 goto error; 482 goto error;
@@ -679,7 +488,7 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
679 goto error; 488 goto error;
680 } 489 }
681 490
682 val = sch5627_read_virtual_reg(data, SCH5627_REG_COMPANY_ID); 491 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_COMPANY_ID);
683 if (val < 0) { 492 if (val < 0) {
684 err = val; 493 err = val;
685 goto error; 494 goto error;
@@ -691,7 +500,7 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
691 goto error; 500 goto error;
692 } 501 }
693 502
694 val = sch5627_read_virtual_reg(data, SCH5627_REG_PRIMARY_ID); 503 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_PRIMARY_ID);
695 if (val < 0) { 504 if (val < 0) {
696 err = val; 505 err = val;
697 goto error; 506 goto error;
@@ -703,25 +512,28 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
703 goto error; 512 goto error;
704 } 513 }
705 514
706 build_code = sch5627_read_virtual_reg(data, SCH5627_REG_BUILD_CODE); 515 build_code = sch56xx_read_virtual_reg(data->addr,
516 SCH5627_REG_BUILD_CODE);
707 if (build_code < 0) { 517 if (build_code < 0) {
708 err = build_code; 518 err = build_code;
709 goto error; 519 goto error;
710 } 520 }
711 521
712 build_id = sch5627_read_virtual_reg16(data, SCH5627_REG_BUILD_ID); 522 build_id = sch56xx_read_virtual_reg16(data->addr,
523 SCH5627_REG_BUILD_ID);
713 if (build_id < 0) { 524 if (build_id < 0) {
714 err = build_id; 525 err = build_id;
715 goto error; 526 goto error;
716 } 527 }
717 528
718 hwmon_rev = sch5627_read_virtual_reg(data, SCH5627_REG_HWMON_REV); 529 hwmon_rev = sch56xx_read_virtual_reg(data->addr,
530 SCH5627_REG_HWMON_REV);
719 if (hwmon_rev < 0) { 531 if (hwmon_rev < 0) {
720 err = hwmon_rev; 532 err = hwmon_rev;
721 goto error; 533 goto error;
722 } 534 }
723 535
724 val = sch5627_read_virtual_reg(data, SCH5627_REG_CTRL); 536 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_CTRL);
725 if (val < 0) { 537 if (val < 0) {
726 err = val; 538 err = val;
727 goto error; 539 goto error;
@@ -734,7 +546,7 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
734 } 546 }
735 /* Trigger a Vbat voltage measurement, so that we get a valid reading 547 /* Trigger a Vbat voltage measurement, so that we get a valid reading
736 the first time we read Vbat */ 548 the first time we read Vbat */
737 sch5627_write_virtual_reg(data, SCH5627_REG_CTRL, 549 sch56xx_write_virtual_reg(data->addr, SCH5627_REG_CTRL,
738 data->control | 0x10); 550 data->control | 0x10);
739 data->last_battery = jiffies; 551 data->last_battery = jiffies;
740 552
@@ -746,6 +558,7 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
746 if (err) 558 if (err)
747 goto error; 559 goto error;
748 560
561 pr_info("found %s chip at %#hx\n", DEVNAME, data->addr);
749 pr_info("firmware build: code 0x%02X, id 0x%04X, hwmon: rev 0x%02X\n", 562 pr_info("firmware build: code 0x%02X, id 0x%04X, hwmon: rev 0x%02X\n",
750 build_code, build_id, hwmon_rev); 563 build_code, build_id, hwmon_rev);
751 564
@@ -768,85 +581,6 @@ error:
768 return err; 581 return err;
769} 582}
770 583
771static int __init sch5627_find(int sioaddr, unsigned short *address)
772{
773 u8 devid;
774 int err = superio_enter(sioaddr);
775 if (err)
776 return err;
777
778 devid = superio_inb(sioaddr, SIO_REG_DEVID);
779 if (devid != SIO_SCH5627_ID) {
780 pr_debug("Unsupported device id: 0x%02x\n",
781 (unsigned int)devid);
782 err = -ENODEV;
783 goto exit;
784 }
785
786 superio_select(sioaddr, SIO_SCH5627_EM_LD);
787
788 if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) {
789 pr_warn("Device not activated\n");
790 err = -ENODEV;
791 goto exit;
792 }
793
794 /*
795 * Warning the order of the low / high byte is the other way around
796 * as on most other superio devices!!
797 */
798 *address = superio_inb(sioaddr, SIO_REG_ADDR) |
799 superio_inb(sioaddr, SIO_REG_ADDR + 1) << 8;
800 if (*address == 0) {
801 pr_warn("Base address not set\n");
802 err = -ENODEV;
803 goto exit;
804 }
805
806 pr_info("Found %s chip at %#hx\n", DEVNAME, *address);
807exit:
808 superio_exit(sioaddr);
809 return err;
810}
811
812static int __init sch5627_device_add(unsigned short address)
813{
814 struct resource res = {
815 .start = address,
816 .end = address + REGION_LENGTH - 1,
817 .flags = IORESOURCE_IO,
818 };
819 int err;
820
821 sch5627_pdev = platform_device_alloc(DRVNAME, address);
822 if (!sch5627_pdev)
823 return -ENOMEM;
824
825 res.name = sch5627_pdev->name;
826 err = acpi_check_resource_conflict(&res);
827 if (err)
828 goto exit_device_put;
829
830 err = platform_device_add_resources(sch5627_pdev, &res, 1);
831 if (err) {
832 pr_err("Device resource addition failed\n");
833 goto exit_device_put;
834 }
835
836 err = platform_device_add(sch5627_pdev);
837 if (err) {
838 pr_err("Device addition failed\n");
839 goto exit_device_put;
840 }
841
842 return 0;
843
844exit_device_put:
845 platform_device_put(sch5627_pdev);
846
847 return err;
848}
849
850static struct platform_driver sch5627_driver = { 584static struct platform_driver sch5627_driver = {
851 .driver = { 585 .driver = {
852 .owner = THIS_MODULE, 586 .owner = THIS_MODULE,
@@ -858,31 +592,11 @@ static struct platform_driver sch5627_driver = {
858 592
859static int __init sch5627_init(void) 593static int __init sch5627_init(void)
860{ 594{
861 int err = -ENODEV; 595 return platform_driver_register(&sch5627_driver);
862 unsigned short address;
863
864 if (sch5627_find(0x4e, &address) && sch5627_find(0x2e, &address))
865 goto exit;
866
867 err = platform_driver_register(&sch5627_driver);
868 if (err)
869 goto exit;
870
871 err = sch5627_device_add(address);
872 if (err)
873 goto exit_driver;
874
875 return 0;
876
877exit_driver:
878 platform_driver_unregister(&sch5627_driver);
879exit:
880 return err;
881} 596}
882 597
883static void __exit sch5627_exit(void) 598static void __exit sch5627_exit(void)
884{ 599{
885 platform_device_unregister(sch5627_pdev);
886 platform_driver_unregister(&sch5627_driver); 600 platform_driver_unregister(&sch5627_driver);
887} 601}
888 602
diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c
new file mode 100644
index 000000000000..244407aa79fc
--- /dev/null
+++ b/drivers/hwmon/sch5636.c
@@ -0,0 +1,539 @@
1/***************************************************************************
2 * Copyright (C) 2011 Hans de Goede <hdegoede@redhat.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19
20#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21
22#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/slab.h>
25#include <linux/jiffies.h>
26#include <linux/platform_device.h>
27#include <linux/hwmon.h>
28#include <linux/hwmon-sysfs.h>
29#include <linux/err.h>
30#include <linux/mutex.h>
31#include "sch56xx-common.h"
32
33#define DRVNAME "sch5636"
34#define DEVNAME "theseus" /* We only support one model for now */
35
36#define SCH5636_REG_FUJITSU_ID 0x780
37#define SCH5636_REG_FUJITSU_REV 0x783
38
39#define SCH5636_NO_INS 5
40#define SCH5636_NO_TEMPS 16
41#define SCH5636_NO_FANS 8
42
43static const u16 SCH5636_REG_IN_VAL[SCH5636_NO_INS] = {
44 0x22, 0x23, 0x24, 0x25, 0x189 };
45static const u16 SCH5636_REG_IN_FACTORS[SCH5636_NO_INS] = {
46 4400, 1500, 4000, 4400, 16000 };
47static const char * const SCH5636_IN_LABELS[SCH5636_NO_INS] = {
48 "3.3V", "VREF", "VBAT", "3.3AUX", "12V" };
49
50static const u16 SCH5636_REG_TEMP_VAL[SCH5636_NO_TEMPS] = {
51 0x2B, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x180, 0x181,
52 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C };
53#define SCH5636_REG_TEMP_CTRL(i) (0x790 + (i))
54#define SCH5636_TEMP_WORKING 0x01
55#define SCH5636_TEMP_ALARM 0x02
56#define SCH5636_TEMP_DEACTIVATED 0x80
57
58static const u16 SCH5636_REG_FAN_VAL[SCH5636_NO_FANS] = {
59 0x2C, 0x2E, 0x30, 0x32, 0x62, 0x64, 0x66, 0x68 };
60#define SCH5636_REG_FAN_CTRL(i) (0x880 + (i))
61/* FAULT in datasheet, but acts as an alarm */
62#define SCH5636_FAN_ALARM 0x04
63#define SCH5636_FAN_NOT_PRESENT 0x08
64#define SCH5636_FAN_DEACTIVATED 0x80
65
66
67struct sch5636_data {
68 unsigned short addr;
69 struct device *hwmon_dev;
70
71 struct mutex update_lock;
72 char valid; /* !=0 if following fields are valid */
73 unsigned long last_updated; /* In jiffies */
74 u8 in[SCH5636_NO_INS];
75 u8 temp_val[SCH5636_NO_TEMPS];
76 u8 temp_ctrl[SCH5636_NO_TEMPS];
77 u16 fan_val[SCH5636_NO_FANS];
78 u8 fan_ctrl[SCH5636_NO_FANS];
79};
80
81static struct sch5636_data *sch5636_update_device(struct device *dev)
82{
83 struct sch5636_data *data = dev_get_drvdata(dev);
84 struct sch5636_data *ret = data;
85 int i, val;
86
87 mutex_lock(&data->update_lock);
88
89 /* Cache the values for 1 second */
90 if (data->valid && !time_after(jiffies, data->last_updated + HZ))
91 goto abort;
92
93 for (i = 0; i < SCH5636_NO_INS; i++) {
94 val = sch56xx_read_virtual_reg(data->addr,
95 SCH5636_REG_IN_VAL[i]);
96 if (unlikely(val < 0)) {
97 ret = ERR_PTR(val);
98 goto abort;
99 }
100 data->in[i] = val;
101 }
102
103 for (i = 0; i < SCH5636_NO_TEMPS; i++) {
104 if (data->temp_ctrl[i] & SCH5636_TEMP_DEACTIVATED)
105 continue;
106
107 val = sch56xx_read_virtual_reg(data->addr,
108 SCH5636_REG_TEMP_VAL[i]);
109 if (unlikely(val < 0)) {
110 ret = ERR_PTR(val);
111 goto abort;
112 }
113 data->temp_val[i] = val;
114
115 val = sch56xx_read_virtual_reg(data->addr,
116 SCH5636_REG_TEMP_CTRL(i));
117 if (unlikely(val < 0)) {
118 ret = ERR_PTR(val);
119 goto abort;
120 }
121 data->temp_ctrl[i] = val;
122 /* Alarms need to be explicitly write-cleared */
123 if (val & SCH5636_TEMP_ALARM) {
124 sch56xx_write_virtual_reg(data->addr,
125 SCH5636_REG_TEMP_CTRL(i), val);
126 }
127 }
128
129 for (i = 0; i < SCH5636_NO_FANS; i++) {
130 if (data->fan_ctrl[i] & SCH5636_FAN_DEACTIVATED)
131 continue;
132
133 val = sch56xx_read_virtual_reg16(data->addr,
134 SCH5636_REG_FAN_VAL[i]);
135 if (unlikely(val < 0)) {
136 ret = ERR_PTR(val);
137 goto abort;
138 }
139 data->fan_val[i] = val;
140
141 val = sch56xx_read_virtual_reg(data->addr,
142 SCH5636_REG_FAN_CTRL(i));
143 if (unlikely(val < 0)) {
144 ret = ERR_PTR(val);
145 goto abort;
146 }
147 data->fan_ctrl[i] = val;
148 /* Alarms need to be explicitly write-cleared */
149 if (val & SCH5636_FAN_ALARM) {
150 sch56xx_write_virtual_reg(data->addr,
151 SCH5636_REG_FAN_CTRL(i), val);
152 }
153 }
154
155 data->last_updated = jiffies;
156 data->valid = 1;
157abort:
158 mutex_unlock(&data->update_lock);
159 return ret;
160}
161
162static int reg_to_rpm(u16 reg)
163{
164 if (reg == 0)
165 return -EIO;
166 if (reg == 0xffff)
167 return 0;
168
169 return 5400540 / reg;
170}
171
172static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
173 char *buf)
174{
175 return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME);
176}
177
178static ssize_t show_in_value(struct device *dev, struct device_attribute
179 *devattr, char *buf)
180{
181 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
182 struct sch5636_data *data = sch5636_update_device(dev);
183 int val;
184
185 if (IS_ERR(data))
186 return PTR_ERR(data);
187
188 val = DIV_ROUND_CLOSEST(
189 data->in[attr->index] * SCH5636_REG_IN_FACTORS[attr->index],
190 255);
191 return snprintf(buf, PAGE_SIZE, "%d\n", val);
192}
193
194static ssize_t show_in_label(struct device *dev, struct device_attribute
195 *devattr, char *buf)
196{
197 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
198
199 return snprintf(buf, PAGE_SIZE, "%s\n",
200 SCH5636_IN_LABELS[attr->index]);
201}
202
203static ssize_t show_temp_value(struct device *dev, struct device_attribute
204 *devattr, char *buf)
205{
206 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
207 struct sch5636_data *data = sch5636_update_device(dev);
208 int val;
209
210 if (IS_ERR(data))
211 return PTR_ERR(data);
212
213 val = (data->temp_val[attr->index] - 64) * 1000;
214 return snprintf(buf, PAGE_SIZE, "%d\n", val);
215}
216
217static ssize_t show_temp_fault(struct device *dev, struct device_attribute
218 *devattr, char *buf)
219{
220 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
221 struct sch5636_data *data = sch5636_update_device(dev);
222 int val;
223
224 if (IS_ERR(data))
225 return PTR_ERR(data);
226
227 val = (data->temp_ctrl[attr->index] & SCH5636_TEMP_WORKING) ? 0 : 1;
228 return snprintf(buf, PAGE_SIZE, "%d\n", val);
229}
230
231static ssize_t show_temp_alarm(struct device *dev, struct device_attribute
232 *devattr, char *buf)
233{
234 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
235 struct sch5636_data *data = sch5636_update_device(dev);
236 int val;
237
238 if (IS_ERR(data))
239 return PTR_ERR(data);
240
241 val = (data->temp_ctrl[attr->index] & SCH5636_TEMP_ALARM) ? 1 : 0;
242 return snprintf(buf, PAGE_SIZE, "%d\n", val);
243}
244
245static ssize_t show_fan_value(struct device *dev, struct device_attribute
246 *devattr, char *buf)
247{
248 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
249 struct sch5636_data *data = sch5636_update_device(dev);
250 int val;
251
252 if (IS_ERR(data))
253 return PTR_ERR(data);
254
255 val = reg_to_rpm(data->fan_val[attr->index]);
256 if (val < 0)
257 return val;
258
259 return snprintf(buf, PAGE_SIZE, "%d\n", val);
260}
261
262static ssize_t show_fan_fault(struct device *dev, struct device_attribute
263 *devattr, char *buf)
264{
265 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
266 struct sch5636_data *data = sch5636_update_device(dev);
267 int val;
268
269 if (IS_ERR(data))
270 return PTR_ERR(data);
271
272 val = (data->fan_ctrl[attr->index] & SCH5636_FAN_NOT_PRESENT) ? 1 : 0;
273 return snprintf(buf, PAGE_SIZE, "%d\n", val);
274}
275
276static ssize_t show_fan_alarm(struct device *dev, struct device_attribute
277 *devattr, char *buf)
278{
279 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
280 struct sch5636_data *data = sch5636_update_device(dev);
281 int val;
282
283 if (IS_ERR(data))
284 return PTR_ERR(data);
285
286 val = (data->fan_ctrl[attr->index] & SCH5636_FAN_ALARM) ? 1 : 0;
287 return snprintf(buf, PAGE_SIZE, "%d\n", val);
288}
289
290static struct sensor_device_attribute sch5636_attr[] = {
291 SENSOR_ATTR(name, 0444, show_name, NULL, 0),
292 SENSOR_ATTR(in0_input, 0444, show_in_value, NULL, 0),
293 SENSOR_ATTR(in0_label, 0444, show_in_label, NULL, 0),
294 SENSOR_ATTR(in1_input, 0444, show_in_value, NULL, 1),
295 SENSOR_ATTR(in1_label, 0444, show_in_label, NULL, 1),
296 SENSOR_ATTR(in2_input, 0444, show_in_value, NULL, 2),
297 SENSOR_ATTR(in2_label, 0444, show_in_label, NULL, 2),
298 SENSOR_ATTR(in3_input, 0444, show_in_value, NULL, 3),
299 SENSOR_ATTR(in3_label, 0444, show_in_label, NULL, 3),
300 SENSOR_ATTR(in4_input, 0444, show_in_value, NULL, 4),
301 SENSOR_ATTR(in4_label, 0444, show_in_label, NULL, 4),
302};
303
304static struct sensor_device_attribute sch5636_temp_attr[] = {
305 SENSOR_ATTR(temp1_input, 0444, show_temp_value, NULL, 0),
306 SENSOR_ATTR(temp1_fault, 0444, show_temp_fault, NULL, 0),
307 SENSOR_ATTR(temp1_alarm, 0444, show_temp_alarm, NULL, 0),
308 SENSOR_ATTR(temp2_input, 0444, show_temp_value, NULL, 1),
309 SENSOR_ATTR(temp2_fault, 0444, show_temp_fault, NULL, 1),
310 SENSOR_ATTR(temp2_alarm, 0444, show_temp_alarm, NULL, 1),
311 SENSOR_ATTR(temp3_input, 0444, show_temp_value, NULL, 2),
312 SENSOR_ATTR(temp3_fault, 0444, show_temp_fault, NULL, 2),
313 SENSOR_ATTR(temp3_alarm, 0444, show_temp_alarm, NULL, 2),
314 SENSOR_ATTR(temp4_input, 0444, show_temp_value, NULL, 3),
315 SENSOR_ATTR(temp4_fault, 0444, show_temp_fault, NULL, 3),
316 SENSOR_ATTR(temp4_alarm, 0444, show_temp_alarm, NULL, 3),
317 SENSOR_ATTR(temp5_input, 0444, show_temp_value, NULL, 4),
318 SENSOR_ATTR(temp5_fault, 0444, show_temp_fault, NULL, 4),
319 SENSOR_ATTR(temp5_alarm, 0444, show_temp_alarm, NULL, 4),
320 SENSOR_ATTR(temp6_input, 0444, show_temp_value, NULL, 5),
321 SENSOR_ATTR(temp6_fault, 0444, show_temp_fault, NULL, 5),
322 SENSOR_ATTR(temp6_alarm, 0444, show_temp_alarm, NULL, 5),
323 SENSOR_ATTR(temp7_input, 0444, show_temp_value, NULL, 6),
324 SENSOR_ATTR(temp7_fault, 0444, show_temp_fault, NULL, 6),
325 SENSOR_ATTR(temp7_alarm, 0444, show_temp_alarm, NULL, 6),
326 SENSOR_ATTR(temp8_input, 0444, show_temp_value, NULL, 7),
327 SENSOR_ATTR(temp8_fault, 0444, show_temp_fault, NULL, 7),
328 SENSOR_ATTR(temp8_alarm, 0444, show_temp_alarm, NULL, 7),
329 SENSOR_ATTR(temp9_input, 0444, show_temp_value, NULL, 8),
330 SENSOR_ATTR(temp9_fault, 0444, show_temp_fault, NULL, 8),
331 SENSOR_ATTR(temp9_alarm, 0444, show_temp_alarm, NULL, 8),
332 SENSOR_ATTR(temp10_input, 0444, show_temp_value, NULL, 9),
333 SENSOR_ATTR(temp10_fault, 0444, show_temp_fault, NULL, 9),
334 SENSOR_ATTR(temp10_alarm, 0444, show_temp_alarm, NULL, 9),
335 SENSOR_ATTR(temp11_input, 0444, show_temp_value, NULL, 10),
336 SENSOR_ATTR(temp11_fault, 0444, show_temp_fault, NULL, 10),
337 SENSOR_ATTR(temp11_alarm, 0444, show_temp_alarm, NULL, 10),
338 SENSOR_ATTR(temp12_input, 0444, show_temp_value, NULL, 11),
339 SENSOR_ATTR(temp12_fault, 0444, show_temp_fault, NULL, 11),
340 SENSOR_ATTR(temp12_alarm, 0444, show_temp_alarm, NULL, 11),
341 SENSOR_ATTR(temp13_input, 0444, show_temp_value, NULL, 12),
342 SENSOR_ATTR(temp13_fault, 0444, show_temp_fault, NULL, 12),
343 SENSOR_ATTR(temp13_alarm, 0444, show_temp_alarm, NULL, 12),
344 SENSOR_ATTR(temp14_input, 0444, show_temp_value, NULL, 13),
345 SENSOR_ATTR(temp14_fault, 0444, show_temp_fault, NULL, 13),
346 SENSOR_ATTR(temp14_alarm, 0444, show_temp_alarm, NULL, 13),
347 SENSOR_ATTR(temp15_input, 0444, show_temp_value, NULL, 14),
348 SENSOR_ATTR(temp15_fault, 0444, show_temp_fault, NULL, 14),
349 SENSOR_ATTR(temp15_alarm, 0444, show_temp_alarm, NULL, 14),
350 SENSOR_ATTR(temp16_input, 0444, show_temp_value, NULL, 15),
351 SENSOR_ATTR(temp16_fault, 0444, show_temp_fault, NULL, 15),
352 SENSOR_ATTR(temp16_alarm, 0444, show_temp_alarm, NULL, 15),
353};
354
355static struct sensor_device_attribute sch5636_fan_attr[] = {
356 SENSOR_ATTR(fan1_input, 0444, show_fan_value, NULL, 0),
357 SENSOR_ATTR(fan1_fault, 0444, show_fan_fault, NULL, 0),
358 SENSOR_ATTR(fan1_alarm, 0444, show_fan_alarm, NULL, 0),
359 SENSOR_ATTR(fan2_input, 0444, show_fan_value, NULL, 1),
360 SENSOR_ATTR(fan2_fault, 0444, show_fan_fault, NULL, 1),
361 SENSOR_ATTR(fan2_alarm, 0444, show_fan_alarm, NULL, 1),
362 SENSOR_ATTR(fan3_input, 0444, show_fan_value, NULL, 2),
363 SENSOR_ATTR(fan3_fault, 0444, show_fan_fault, NULL, 2),
364 SENSOR_ATTR(fan3_alarm, 0444, show_fan_alarm, NULL, 2),
365 SENSOR_ATTR(fan4_input, 0444, show_fan_value, NULL, 3),
366 SENSOR_ATTR(fan4_fault, 0444, show_fan_fault, NULL, 3),
367 SENSOR_ATTR(fan4_alarm, 0444, show_fan_alarm, NULL, 3),
368 SENSOR_ATTR(fan5_input, 0444, show_fan_value, NULL, 4),
369 SENSOR_ATTR(fan5_fault, 0444, show_fan_fault, NULL, 4),
370 SENSOR_ATTR(fan5_alarm, 0444, show_fan_alarm, NULL, 4),
371 SENSOR_ATTR(fan6_input, 0444, show_fan_value, NULL, 5),
372 SENSOR_ATTR(fan6_fault, 0444, show_fan_fault, NULL, 5),
373 SENSOR_ATTR(fan6_alarm, 0444, show_fan_alarm, NULL, 5),
374 SENSOR_ATTR(fan7_input, 0444, show_fan_value, NULL, 6),
375 SENSOR_ATTR(fan7_fault, 0444, show_fan_fault, NULL, 6),
376 SENSOR_ATTR(fan7_alarm, 0444, show_fan_alarm, NULL, 6),
377 SENSOR_ATTR(fan8_input, 0444, show_fan_value, NULL, 7),
378 SENSOR_ATTR(fan8_fault, 0444, show_fan_fault, NULL, 7),
379 SENSOR_ATTR(fan8_alarm, 0444, show_fan_alarm, NULL, 7),
380};
381
382static int sch5636_remove(struct platform_device *pdev)
383{
384 struct sch5636_data *data = platform_get_drvdata(pdev);
385 int i;
386
387 if (data->hwmon_dev)
388 hwmon_device_unregister(data->hwmon_dev);
389
390 for (i = 0; i < ARRAY_SIZE(sch5636_attr); i++)
391 device_remove_file(&pdev->dev, &sch5636_attr[i].dev_attr);
392
393 for (i = 0; i < SCH5636_NO_TEMPS * 3; i++)
394 device_remove_file(&pdev->dev,
395 &sch5636_temp_attr[i].dev_attr);
396
397 for (i = 0; i < SCH5636_NO_FANS * 3; i++)
398 device_remove_file(&pdev->dev,
399 &sch5636_fan_attr[i].dev_attr);
400
401 platform_set_drvdata(pdev, NULL);
402 kfree(data);
403
404 return 0;
405}
406
407static int __devinit sch5636_probe(struct platform_device *pdev)
408{
409 struct sch5636_data *data;
410 int i, err, val, revision[2];
411 char id[4];
412
413 data = kzalloc(sizeof(struct sch5636_data), GFP_KERNEL);
414 if (!data)
415 return -ENOMEM;
416
417 data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start;
418 mutex_init(&data->update_lock);
419 platform_set_drvdata(pdev, data);
420
421 for (i = 0; i < 3; i++) {
422 val = sch56xx_read_virtual_reg(data->addr,
423 SCH5636_REG_FUJITSU_ID + i);
424 if (val < 0) {
425 pr_err("Could not read Fujitsu id byte at %#x\n",
426 SCH5636_REG_FUJITSU_ID + i);
427 err = val;
428 goto error;
429 }
430 id[i] = val;
431 }
432 id[i] = '\0';
433
434 if (strcmp(id, "THS")) {
435 pr_err("Unknown Fujitsu id: %02x%02x%02x\n",
436 id[0], id[1], id[2]);
437 err = -ENODEV;
438 goto error;
439 }
440
441 for (i = 0; i < 2; i++) {
442 val = sch56xx_read_virtual_reg(data->addr,
443 SCH5636_REG_FUJITSU_REV + i);
444 if (val < 0) {
445 err = val;
446 goto error;
447 }
448 revision[i] = val;
449 }
450 pr_info("Found %s chip at %#hx, revison: %d.%02d\n", DEVNAME,
451 data->addr, revision[0], revision[1]);
452
453 /* Read all temp + fan ctrl registers to determine which are active */
454 for (i = 0; i < SCH5636_NO_TEMPS; i++) {
455 val = sch56xx_read_virtual_reg(data->addr,
456 SCH5636_REG_TEMP_CTRL(i));
457 if (unlikely(val < 0)) {
458 err = val;
459 goto error;
460 }
461 data->temp_ctrl[i] = val;
462 }
463
464 for (i = 0; i < SCH5636_NO_FANS; i++) {
465 val = sch56xx_read_virtual_reg(data->addr,
466 SCH5636_REG_FAN_CTRL(i));
467 if (unlikely(val < 0)) {
468 err = val;
469 goto error;
470 }
471 data->fan_ctrl[i] = val;
472 }
473
474 for (i = 0; i < ARRAY_SIZE(sch5636_attr); i++) {
475 err = device_create_file(&pdev->dev,
476 &sch5636_attr[i].dev_attr);
477 if (err)
478 goto error;
479 }
480
481 for (i = 0; i < (SCH5636_NO_TEMPS * 3); i++) {
482 if (data->temp_ctrl[i/3] & SCH5636_TEMP_DEACTIVATED)
483 continue;
484
485 err = device_create_file(&pdev->dev,
486 &sch5636_temp_attr[i].dev_attr);
487 if (err)
488 goto error;
489 }
490
491 for (i = 0; i < (SCH5636_NO_FANS * 3); i++) {
492 if (data->fan_ctrl[i/3] & SCH5636_FAN_DEACTIVATED)
493 continue;
494
495 err = device_create_file(&pdev->dev,
496 &sch5636_fan_attr[i].dev_attr);
497 if (err)
498 goto error;
499 }
500
501 data->hwmon_dev = hwmon_device_register(&pdev->dev);
502 if (IS_ERR(data->hwmon_dev)) {
503 err = PTR_ERR(data->hwmon_dev);
504 data->hwmon_dev = NULL;
505 goto error;
506 }
507
508 return 0;
509
510error:
511 sch5636_remove(pdev);
512 return err;
513}
514
515static struct platform_driver sch5636_driver = {
516 .driver = {
517 .owner = THIS_MODULE,
518 .name = DRVNAME,
519 },
520 .probe = sch5636_probe,
521 .remove = sch5636_remove,
522};
523
524static int __init sch5636_init(void)
525{
526 return platform_driver_register(&sch5636_driver);
527}
528
529static void __exit sch5636_exit(void)
530{
531 platform_driver_unregister(&sch5636_driver);
532}
533
534MODULE_DESCRIPTION("SMSC SCH5636 Hardware Monitoring Driver");
535MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
536MODULE_LICENSE("GPL");
537
538module_init(sch5636_init);
539module_exit(sch5636_exit);
diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c
new file mode 100644
index 000000000000..fac32ee0b10e
--- /dev/null
+++ b/drivers/hwmon/sch56xx-common.c
@@ -0,0 +1,340 @@
1/***************************************************************************
2 * Copyright (C) 2010-2011 Hans de Goede <hdegoede@redhat.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19
20#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21
22#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/platform_device.h>
25#include <linux/err.h>
26#include <linux/io.h>
27#include <linux/acpi.h>
28#include <linux/delay.h>
29#include "sch56xx-common.h"
30
31#define SIO_SCH56XX_LD_EM 0x0C /* Embedded uController Logical Dev */
32#define SIO_UNLOCK_KEY 0x55 /* Key to enable Super-I/O */
33#define SIO_LOCK_KEY 0xAA /* Key to disable Super-I/O */
34
35#define SIO_REG_LDSEL 0x07 /* Logical device select */
36#define SIO_REG_DEVID 0x20 /* Device ID */
37#define SIO_REG_ENABLE 0x30 /* Logical device enable */
38#define SIO_REG_ADDR 0x66 /* Logical device address (2 bytes) */
39
40#define SIO_SCH5627_ID 0xC6 /* Chipset ID */
41#define SIO_SCH5636_ID 0xC7 /* Chipset ID */
42
43#define REGION_LENGTH 9
44
45#define SCH56XX_CMD_READ 0x02
46#define SCH56XX_CMD_WRITE 0x03
47
48static struct platform_device *sch56xx_pdev;
49
50/* Super I/O functions */
51static inline int superio_inb(int base, int reg)
52{
53 outb(reg, base);
54 return inb(base + 1);
55}
56
57static inline int superio_enter(int base)
58{
59 /* Don't step on other drivers' I/O space by accident */
60 if (!request_muxed_region(base, 2, "sch56xx")) {
61 pr_err("I/O address 0x%04x already in use\n", base);
62 return -EBUSY;
63 }
64
65 outb(SIO_UNLOCK_KEY, base);
66
67 return 0;
68}
69
70static inline void superio_select(int base, int ld)
71{
72 outb(SIO_REG_LDSEL, base);
73 outb(ld, base + 1);
74}
75
76static inline void superio_exit(int base)
77{
78 outb(SIO_LOCK_KEY, base);
79 release_region(base, 2);
80}
81
82static int sch56xx_send_cmd(u16 addr, u8 cmd, u16 reg, u8 v)
83{
84 u8 val;
85 int i;
86 /*
87 * According to SMSC for the commands we use the maximum time for
88 * the EM to respond is 15 ms, but testing shows in practice it
89 * responds within 15-32 reads, so we first busy poll, and if
90 * that fails sleep a bit and try again until we are way past
91 * the 15 ms maximum response time.
92 */
93 const int max_busy_polls = 64;
94 const int max_lazy_polls = 32;
95
96 /* (Optional) Write-Clear the EC to Host Mailbox Register */
97 val = inb(addr + 1);
98 outb(val, addr + 1);
99
100 /* Set Mailbox Address Pointer to first location in Region 1 */
101 outb(0x00, addr + 2);
102 outb(0x80, addr + 3);
103
104 /* Write Request Packet Header */
105 outb(cmd, addr + 4); /* VREG Access Type read:0x02 write:0x03 */
106 outb(0x01, addr + 5); /* # of Entries: 1 Byte (8-bit) */
107 outb(0x04, addr + 2); /* Mailbox AP to first data entry loc. */
108
109 /* Write Value field */
110 if (cmd == SCH56XX_CMD_WRITE)
111 outb(v, addr + 4);
112
113 /* Write Address field */
114 outb(reg & 0xff, addr + 6);
115 outb(reg >> 8, addr + 7);
116
117 /* Execute the Random Access Command */
118 outb(0x01, addr); /* Write 01h to the Host-to-EC register */
119
120 /* EM Interface Polling "Algorithm" */
121 for (i = 0; i < max_busy_polls + max_lazy_polls; i++) {
122 if (i >= max_busy_polls)
123 msleep(1);
124 /* Read Interrupt source Register */
125 val = inb(addr + 8);
126 /* Write Clear the interrupt source bits */
127 if (val)
128 outb(val, addr + 8);
129 /* Command Completed ? */
130 if (val & 0x01)
131 break;
132 }
133 if (i == max_busy_polls + max_lazy_polls) {
134 pr_err("Max retries exceeded reading virtual "
135 "register 0x%04hx (%d)\n", reg, 1);
136 return -EIO;
137 }
138
139 /*
140 * According to SMSC we may need to retry this, but sofar I've always
141 * seen this succeed in 1 try.
142 */
143 for (i = 0; i < max_busy_polls; i++) {
144 /* Read EC-to-Host Register */
145 val = inb(addr + 1);
146 /* Command Completed ? */
147 if (val == 0x01)
148 break;
149
150 if (i == 0)
151 pr_warn("EC reports: 0x%02x reading virtual register "
152 "0x%04hx\n", (unsigned int)val, reg);
153 }
154 if (i == max_busy_polls) {
155 pr_err("Max retries exceeded reading virtual "
156 "register 0x%04hx (%d)\n", reg, 2);
157 return -EIO;
158 }
159
160 /*
161 * According to the SMSC app note we should now do:
162 *
163 * Set Mailbox Address Pointer to first location in Region 1 *
164 * outb(0x00, addr + 2);
165 * outb(0x80, addr + 3);
166 *
167 * But if we do that things don't work, so let's not.
168 */
169
170 /* Read Value field */
171 if (cmd == SCH56XX_CMD_READ)
172 return inb(addr + 4);
173
174 return 0;
175}
176
177int sch56xx_read_virtual_reg(u16 addr, u16 reg)
178{
179 return sch56xx_send_cmd(addr, SCH56XX_CMD_READ, reg, 0);
180}
181EXPORT_SYMBOL(sch56xx_read_virtual_reg);
182
183int sch56xx_write_virtual_reg(u16 addr, u16 reg, u8 val)
184{
185 return sch56xx_send_cmd(addr, SCH56XX_CMD_WRITE, reg, val);
186}
187EXPORT_SYMBOL(sch56xx_write_virtual_reg);
188
189int sch56xx_read_virtual_reg16(u16 addr, u16 reg)
190{
191 int lsb, msb;
192
193 /* Read LSB first, this will cause the matching MSB to be latched */
194 lsb = sch56xx_read_virtual_reg(addr, reg);
195 if (lsb < 0)
196 return lsb;
197
198 msb = sch56xx_read_virtual_reg(addr, reg + 1);
199 if (msb < 0)
200 return msb;
201
202 return lsb | (msb << 8);
203}
204EXPORT_SYMBOL(sch56xx_read_virtual_reg16);
205
206int sch56xx_read_virtual_reg12(u16 addr, u16 msb_reg, u16 lsn_reg,
207 int high_nibble)
208{
209 int msb, lsn;
210
211 /* Read MSB first, this will cause the matching LSN to be latched */
212 msb = sch56xx_read_virtual_reg(addr, msb_reg);
213 if (msb < 0)
214 return msb;
215
216 lsn = sch56xx_read_virtual_reg(addr, lsn_reg);
217 if (lsn < 0)
218 return lsn;
219
220 if (high_nibble)
221 return (msb << 4) | (lsn >> 4);
222 else
223 return (msb << 4) | (lsn & 0x0f);
224}
225EXPORT_SYMBOL(sch56xx_read_virtual_reg12);
226
227static int __init sch56xx_find(int sioaddr, unsigned short *address,
228 const char **name)
229{
230 u8 devid;
231 int err;
232
233 err = superio_enter(sioaddr);
234 if (err)
235 return err;
236
237 devid = superio_inb(sioaddr, SIO_REG_DEVID);
238 switch (devid) {
239 case SIO_SCH5627_ID:
240 *name = "sch5627";
241 break;
242 case SIO_SCH5636_ID:
243 *name = "sch5636";
244 break;
245 default:
246 pr_debug("Unsupported device id: 0x%02x\n",
247 (unsigned int)devid);
248 err = -ENODEV;
249 goto exit;
250 }
251
252 superio_select(sioaddr, SIO_SCH56XX_LD_EM);
253
254 if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) {
255 pr_warn("Device not activated\n");
256 err = -ENODEV;
257 goto exit;
258 }
259
260 /*
261 * Warning the order of the low / high byte is the other way around
262 * as on most other superio devices!!
263 */
264 *address = superio_inb(sioaddr, SIO_REG_ADDR) |
265 superio_inb(sioaddr, SIO_REG_ADDR + 1) << 8;
266 if (*address == 0) {
267 pr_warn("Base address not set\n");
268 err = -ENODEV;
269 goto exit;
270 }
271
272exit:
273 superio_exit(sioaddr);
274 return err;
275}
276
277static int __init sch56xx_device_add(unsigned short address, const char *name)
278{
279 struct resource res = {
280 .start = address,
281 .end = address + REGION_LENGTH - 1,
282 .flags = IORESOURCE_IO,
283 };
284 int err;
285
286 sch56xx_pdev = platform_device_alloc(name, address);
287 if (!sch56xx_pdev)
288 return -ENOMEM;
289
290 res.name = sch56xx_pdev->name;
291 err = acpi_check_resource_conflict(&res);
292 if (err)
293 goto exit_device_put;
294
295 err = platform_device_add_resources(sch56xx_pdev, &res, 1);
296 if (err) {
297 pr_err("Device resource addition failed\n");
298 goto exit_device_put;
299 }
300
301 err = platform_device_add(sch56xx_pdev);
302 if (err) {
303 pr_err("Device addition failed\n");
304 goto exit_device_put;
305 }
306
307 return 0;
308
309exit_device_put:
310 platform_device_put(sch56xx_pdev);
311
312 return err;
313}
314
315static int __init sch56xx_init(void)
316{
317 int err;
318 unsigned short address;
319 const char *name;
320
321 err = sch56xx_find(0x4e, &address, &name);
322 if (err)
323 err = sch56xx_find(0x2e, &address, &name);
324 if (err)
325 return err;
326
327 return sch56xx_device_add(address, name);
328}
329
330static void __exit sch56xx_exit(void)
331{
332 platform_device_unregister(sch56xx_pdev);
333}
334
335MODULE_DESCRIPTION("SMSC SCH56xx Hardware Monitoring Common Code");
336MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
337MODULE_LICENSE("GPL");
338
339module_init(sch56xx_init);
340module_exit(sch56xx_exit);
diff --git a/drivers/hwmon/sch56xx-common.h b/drivers/hwmon/sch56xx-common.h
new file mode 100644
index 000000000000..d5eaf3b9ebf5
--- /dev/null
+++ b/drivers/hwmon/sch56xx-common.h
@@ -0,0 +1,24 @@
1/***************************************************************************
2 * Copyright (C) 2010-2011 Hans de Goede <hdegoede@redhat.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19
20int sch56xx_read_virtual_reg(u16 addr, u16 reg);
21int sch56xx_write_virtual_reg(u16 addr, u16 reg, u8 val);
22int sch56xx_read_virtual_reg16(u16 addr, u16 reg);
23int sch56xx_read_virtual_reg12(u16 addr, u16 msb_reg, u16 lsn_reg,
24 int high_nibble);
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index cf4330b352ef..7d231cf5d2ce 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -671,7 +671,7 @@ static ssize_t sht15_show_status(struct device *dev,
671 * @buf: sysfs buffer to read the new heater state from. 671 * @buf: sysfs buffer to read the new heater state from.
672 * @count: length of the data. 672 * @count: length of the data.
673 * 673 *
674 * Will be called on read access to heater_enable sysfs attribute. 674 * Will be called on write access to heater_enable sysfs attribute.
675 * Returns number of bytes actually decoded, negative errno on error. 675 * Returns number of bytes actually decoded, negative errno on error.
676 */ 676 */
677static ssize_t sht15_store_heater(struct device *dev, 677static ssize_t sht15_store_heater(struct device *dev,
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c
index 0d18de424c66..8eac67d769fa 100644
--- a/drivers/hwmon/via-cputemp.c
+++ b/drivers/hwmon/via-cputemp.c
@@ -27,6 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/hwmon.h> 29#include <linux/hwmon.h>
30#include <linux/hwmon-vid.h>
30#include <linux/sysfs.h> 31#include <linux/sysfs.h>
31#include <linux/hwmon-sysfs.h> 32#include <linux/hwmon-sysfs.h>
32#include <linux/err.h> 33#include <linux/err.h>
@@ -48,8 +49,10 @@ enum { SHOW_TEMP, SHOW_LABEL, SHOW_NAME };
48struct via_cputemp_data { 49struct via_cputemp_data {
49 struct device *hwmon_dev; 50 struct device *hwmon_dev;
50 const char *name; 51 const char *name;
52 u8 vrm;
51 u32 id; 53 u32 id;
52 u32 msr; 54 u32 msr_temp;
55 u32 msr_vid;
53}; 56};
54 57
55/* 58/*
@@ -77,13 +80,27 @@ static ssize_t show_temp(struct device *dev,
77 u32 eax, edx; 80 u32 eax, edx;
78 int err; 81 int err;
79 82
80 err = rdmsr_safe_on_cpu(data->id, data->msr, &eax, &edx); 83 err = rdmsr_safe_on_cpu(data->id, data->msr_temp, &eax, &edx);
81 if (err) 84 if (err)
82 return -EAGAIN; 85 return -EAGAIN;
83 86
84 return sprintf(buf, "%lu\n", ((unsigned long)eax & 0xffffff) * 1000); 87 return sprintf(buf, "%lu\n", ((unsigned long)eax & 0xffffff) * 1000);
85} 88}
86 89
90static ssize_t show_cpu_vid(struct device *dev,
91 struct device_attribute *devattr, char *buf)
92{
93 struct via_cputemp_data *data = dev_get_drvdata(dev);
94 u32 eax, edx;
95 int err;
96
97 err = rdmsr_safe_on_cpu(data->id, data->msr_vid, &eax, &edx);
98 if (err)
99 return -EAGAIN;
100
101 return sprintf(buf, "%d\n", vid_from_reg(~edx & 0x7f, data->vrm));
102}
103
87static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 104static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL,
88 SHOW_TEMP); 105 SHOW_TEMP);
89static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL); 106static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_name, NULL, SHOW_LABEL);
@@ -100,6 +117,9 @@ static const struct attribute_group via_cputemp_group = {
100 .attrs = via_cputemp_attributes, 117 .attrs = via_cputemp_attributes,
101}; 118};
102 119
120/* Optional attributes */
121static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_cpu_vid, NULL);
122
103static int __devinit via_cputemp_probe(struct platform_device *pdev) 123static int __devinit via_cputemp_probe(struct platform_device *pdev)
104{ 124{
105 struct via_cputemp_data *data; 125 struct via_cputemp_data *data;
@@ -122,11 +142,12 @@ static int __devinit via_cputemp_probe(struct platform_device *pdev)
122 /* C7 A */ 142 /* C7 A */
123 case 0xD: 143 case 0xD:
124 /* C7 D */ 144 /* C7 D */
125 data->msr = 0x1169; 145 data->msr_temp = 0x1169;
146 data->msr_vid = 0x198;
126 break; 147 break;
127 case 0xF: 148 case 0xF:
128 /* Nano */ 149 /* Nano */
129 data->msr = 0x1423; 150 data->msr_temp = 0x1423;
130 break; 151 break;
131 default: 152 default:
132 err = -ENODEV; 153 err = -ENODEV;
@@ -134,7 +155,7 @@ static int __devinit via_cputemp_probe(struct platform_device *pdev)
134 } 155 }
135 156
136 /* test if we can access the TEMPERATURE MSR */ 157 /* test if we can access the TEMPERATURE MSR */
137 err = rdmsr_safe_on_cpu(data->id, data->msr, &eax, &edx); 158 err = rdmsr_safe_on_cpu(data->id, data->msr_temp, &eax, &edx);
138 if (err) { 159 if (err) {
139 dev_err(&pdev->dev, 160 dev_err(&pdev->dev,
140 "Unable to access TEMPERATURE MSR, giving up\n"); 161 "Unable to access TEMPERATURE MSR, giving up\n");
@@ -147,6 +168,15 @@ static int __devinit via_cputemp_probe(struct platform_device *pdev)
147 if (err) 168 if (err)
148 goto exit_free; 169 goto exit_free;
149 170
171 if (data->msr_vid)
172 data->vrm = vid_which_vrm();
173
174 if (data->vrm) {
175 err = device_create_file(&pdev->dev, &dev_attr_cpu0_vid);
176 if (err)
177 goto exit_remove;
178 }
179
150 data->hwmon_dev = hwmon_device_register(&pdev->dev); 180 data->hwmon_dev = hwmon_device_register(&pdev->dev);
151 if (IS_ERR(data->hwmon_dev)) { 181 if (IS_ERR(data->hwmon_dev)) {
152 err = PTR_ERR(data->hwmon_dev); 182 err = PTR_ERR(data->hwmon_dev);
@@ -158,6 +188,8 @@ static int __devinit via_cputemp_probe(struct platform_device *pdev)
158 return 0; 188 return 0;
159 189
160exit_remove: 190exit_remove:
191 if (data->vrm)
192 device_remove_file(&pdev->dev, &dev_attr_cpu0_vid);
161 sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group); 193 sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group);
162exit_free: 194exit_free:
163 platform_set_drvdata(pdev, NULL); 195 platform_set_drvdata(pdev, NULL);
@@ -171,6 +203,8 @@ static int __devexit via_cputemp_remove(struct platform_device *pdev)
171 struct via_cputemp_data *data = platform_get_drvdata(pdev); 203 struct via_cputemp_data *data = platform_get_drvdata(pdev);
172 204
173 hwmon_device_unregister(data->hwmon_dev); 205 hwmon_device_unregister(data->hwmon_dev);
206 if (data->vrm)
207 device_remove_file(&pdev->dev, &dev_attr_cpu0_vid);
174 sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group); 208 sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group);
175 platform_set_drvdata(pdev, NULL); 209 platform_set_drvdata(pdev, NULL);
176 kfree(data); 210 kfree(data);
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 30f06e956bfb..5f13c62e64b4 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -7,7 +7,7 @@ menuconfig I2C
7 depends on HAS_IOMEM 7 depends on HAS_IOMEM
8 select RT_MUTEXES 8 select RT_MUTEXES
9 ---help--- 9 ---help---
10 I2C (pronounce: I-square-C) is a slow serial bus protocol used in 10 I2C (pronounce: I-squared-C) is a slow serial bus protocol used in
11 many micro controller applications and developed by Philips. SMBus, 11 many micro controller applications and developed by Philips. SMBus,
12 or System Management Bus is a subset of the I2C protocol. More 12 or System Management Bus is a subset of the I2C protocol. More
13 information is contained in the directory <file:Documentation/i2c/>, 13 information is contained in the directory <file:Documentation/i2c/>,
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index dd364171f9c5..b6807db7b36f 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -1,23 +1,23 @@
1/* 1/*
2 Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl>, 2 * Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl>,
3 Philip Edelbrock <phil@netroedge.com>, 3 * Philip Edelbrock <phil@netroedge.com>,
4 Mark D. Studebaker <mdsxyz123@yahoo.com>, 4 * Mark D. Studebaker <mdsxyz123@yahoo.com>,
5 Dan Eaton <dan.eaton@rocketlogix.com> and 5 * Dan Eaton <dan.eaton@rocketlogix.com> and
6 Stephen Rousset<stephen.rousset@rocketlogix.com> 6 * Stephen Rousset <stephen.rousset@rocketlogix.com>
7 7 *
8 This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version. 11 * (at your option) any later version.
12 12 *
13 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 * GNU General Public License for more details.
17 17 *
18 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/ 21*/
22 22
23/* 23/*
@@ -254,8 +254,8 @@ static int ali1535_transaction(struct i2c_adapter *adap)
254 if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) { 254 if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
255 /* do a clear-on-write */ 255 /* do a clear-on-write */
256 outb_p(0xFF, SMBHSTSTS); 256 outb_p(0xFF, SMBHSTSTS);
257 if ((temp = inb_p(SMBHSTSTS)) & 257 temp = inb_p(SMBHSTSTS);
258 (ALI1535_STS_ERR | ALI1535_STS_BUSY)) { 258 if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
259 /* This is probably going to be correctable only by a 259 /* This is probably going to be correctable only by a
260 * power reset as one of the bits now appears to be 260 * power reset as one of the bits now appears to be
261 * stuck */ 261 * stuck */
@@ -267,9 +267,8 @@ static int ali1535_transaction(struct i2c_adapter *adap)
267 } 267 }
268 } else { 268 } else {
269 /* check and clear done bit */ 269 /* check and clear done bit */
270 if (temp & ALI1535_STS_DONE) { 270 if (temp & ALI1535_STS_DONE)
271 outb_p(temp, SMBHSTSTS); 271 outb_p(temp, SMBHSTSTS);
272 }
273 } 272 }
274 273
275 /* start the transaction by writing anything to the start register */ 274 /* start the transaction by writing anything to the start register */
@@ -278,7 +277,7 @@ static int ali1535_transaction(struct i2c_adapter *adap)
278 /* We will always wait for a fraction of a second! */ 277 /* We will always wait for a fraction of a second! */
279 timeout = 0; 278 timeout = 0;
280 do { 279 do {
281 msleep(1); 280 usleep_range(1000, 2000);
282 temp = inb_p(SMBHSTSTS); 281 temp = inb_p(SMBHSTSTS);
283 } while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE)) 282 } while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
284 && (timeout++ < MAX_TIMEOUT)); 283 && (timeout++ < MAX_TIMEOUT));
@@ -325,12 +324,12 @@ static int ali1535_transaction(struct i2c_adapter *adap)
325 /* take consequent actions for error conditions */ 324 /* take consequent actions for error conditions */
326 if (!(temp & ALI1535_STS_DONE)) { 325 if (!(temp & ALI1535_STS_DONE)) {
327 /* issue "kill" to reset host controller */ 326 /* issue "kill" to reset host controller */
328 outb_p(ALI1535_KILL,SMBHSTTYP); 327 outb_p(ALI1535_KILL, SMBHSTTYP);
329 outb_p(0xFF,SMBHSTSTS); 328 outb_p(0xFF, SMBHSTSTS);
330 } else if (temp & ALI1535_STS_ERR) { 329 } else if (temp & ALI1535_STS_ERR) {
331 /* issue "timeout" to reset all devices on bus */ 330 /* issue "timeout" to reset all devices on bus */
332 outb_p(ALI1535_T_OUT,SMBHSTTYP); 331 outb_p(ALI1535_T_OUT, SMBHSTTYP);
333 outb_p(0xFF,SMBHSTSTS); 332 outb_p(0xFF, SMBHSTSTS);
334 } 333 }
335 334
336 return result; 335 return result;
@@ -351,7 +350,7 @@ static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
351 for (timeout = 0; 350 for (timeout = 0;
352 (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE); 351 (timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
353 timeout++) { 352 timeout++) {
354 msleep(1); 353 usleep_range(1000, 2000);
355 temp = inb_p(SMBHSTSTS); 354 temp = inb_p(SMBHSTSTS);
356 } 355 }
357 if (timeout >= MAX_TIMEOUT) 356 if (timeout >= MAX_TIMEOUT)
@@ -480,12 +479,12 @@ static struct i2c_adapter ali1535_adapter = {
480 .algo = &smbus_algorithm, 479 .algo = &smbus_algorithm,
481}; 480};
482 481
483static const struct pci_device_id ali1535_ids[] = { 482static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {
484 { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) }, 483 { PCI_DEVICE(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101) },
485 { }, 484 { },
486}; 485};
487 486
488MODULE_DEVICE_TABLE (pci, ali1535_ids); 487MODULE_DEVICE_TABLE(pci, ali1535_ids);
489 488
490static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) 489static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
491{ 490{
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 3a20961bef1e..b1d9cd28d8da 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -662,11 +662,8 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
662 /* register new adapter to i2c module... */ 662 /* register new adapter to i2c module... */
663 663
664 data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len); 664 data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len);
665 if (data && len == 4) { 665 cpm->adap.nr = (data && len == 4) ? be32_to_cpup(data) : -1;
666 cpm->adap.nr = *data; 666 result = i2c_add_numbered_adapter(&cpm->adap);
667 result = i2c_add_numbered_adapter(&cpm->adap);
668 } else
669 result = i2c_add_adapter(&cpm->adap);
670 667
671 if (result < 0) { 668 if (result < 0) {
672 dev_err(&ofdev->dev, "Unable to register with I2C\n"); 669 dev_err(&ofdev->dev, "Unable to register with I2C\n");
diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
index 3df1bc80f37a..3876a2478bd7 100644
--- a/drivers/i2c/busses/i2c-highlander.c
+++ b/drivers/i2c/busses/i2c-highlander.c
@@ -227,7 +227,7 @@ static int highlander_i2c_read(struct highlander_i2c_dev *dev)
227 227
228 /* 228 /*
229 * The R0P7780LC0011RL FPGA needs a significant delay between 229 * The R0P7780LC0011RL FPGA needs a significant delay between
230 * data read cycles, otherwise the transciever gets confused and 230 * data read cycles, otherwise the transceiver gets confused and
231 * garbage is returned when the read is subsequently aborted. 231 * garbage is returned when the read is subsequently aborted.
232 * 232 *
233 * It is not sufficient to wait for BBSY. 233 * It is not sufficient to wait for BBSY.
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 58a58c7eaa17..1a766cf74f6b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -204,7 +204,7 @@ struct omap_i2c_dev {
204 u16 errata; 204 u16 errata;
205}; 205};
206 206
207const static u8 reg_map[] = { 207static const u8 reg_map[] = {
208 [OMAP_I2C_REV_REG] = 0x00, 208 [OMAP_I2C_REV_REG] = 0x00,
209 [OMAP_I2C_IE_REG] = 0x01, 209 [OMAP_I2C_IE_REG] = 0x01,
210 [OMAP_I2C_STAT_REG] = 0x02, 210 [OMAP_I2C_STAT_REG] = 0x02,
@@ -225,7 +225,7 @@ const static u8 reg_map[] = {
225 [OMAP_I2C_BUFSTAT_REG] = 0x10, 225 [OMAP_I2C_BUFSTAT_REG] = 0x10,
226}; 226};
227 227
228const static u8 omap4_reg_map[] = { 228static const u8 omap4_reg_map[] = {
229 [OMAP_I2C_REV_REG] = 0x04, 229 [OMAP_I2C_REV_REG] = 0x04,
230 [OMAP_I2C_IE_REG] = 0x2c, 230 [OMAP_I2C_IE_REG] = 0x2c,
231 [OMAP_I2C_STAT_REG] = 0x28, 231 [OMAP_I2C_STAT_REG] = 0x28,
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index f59224a5c761..d60364650990 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1079,7 +1079,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
1079 * The reason to do so is to avoid sysfs names that only make 1079 * The reason to do so is to avoid sysfs names that only make
1080 * sense when there are multiple adapters. 1080 * sense when there are multiple adapters.
1081 */ 1081 */
1082 i2c->adap.nr = dev->id != -1 ? dev->id : 0; 1082 i2c->adap.nr = dev->id;
1083 snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u", 1083 snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
1084 i2c->adap.nr); 1084 i2c->adap.nr);
1085 1085
@@ -1142,10 +1142,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
1142 i2c->adap.dev.of_node = dev->dev.of_node; 1142 i2c->adap.dev.of_node = dev->dev.of_node;
1143#endif 1143#endif
1144 1144
1145 if (i2c_type == REGS_CE4100) 1145 ret = i2c_add_numbered_adapter(&i2c->adap);
1146 ret = i2c_add_adapter(&i2c->adap);
1147 else
1148 ret = i2c_add_numbered_adapter(&i2c->adap);
1149 if (ret < 0) { 1146 if (ret < 0) {
1150 printk(KERN_INFO "I2C: Failed to add bus\n"); 1147 printk(KERN_INFO "I2C: Failed to add bus\n");
1151 goto eadapt; 1148 goto eadapt;
diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c
index cb5d01e279c6..c64ba736f480 100644
--- a/drivers/i2c/busses/i2c-s6000.c
+++ b/drivers/i2c/busses/i2c-s6000.c
@@ -341,10 +341,7 @@ static int __devinit s6i2c_probe(struct platform_device *dev)
341 i2c_wr16(iface, S6_I2C_TXTL, 0); 341 i2c_wr16(iface, S6_I2C_TXTL, 0);
342 342
343 platform_set_drvdata(dev, iface); 343 platform_set_drvdata(dev, iface);
344 if (bus_num < 0) 344 rc = i2c_add_numbered_adapter(p_adap);
345 rc = i2c_add_adapter(p_adap);
346 else
347 rc = i2c_add_numbered_adapter(p_adap);
348 if (rc) 345 if (rc)
349 goto err_irq_free; 346 goto err_irq_free;
350 return 0; 347 return 0;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 9a58994ff7ea..131079a3e292 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -925,6 +925,9 @@ EXPORT_SYMBOL(i2c_add_adapter);
925 * or otherwise built in to the system's mainboard, and where i2c_board_info 925 * or otherwise built in to the system's mainboard, and where i2c_board_info
926 * is used to properly configure I2C devices. 926 * is used to properly configure I2C devices.
927 * 927 *
928 * If the requested bus number is set to -1, then this function will behave
929 * identically to i2c_add_adapter, and will dynamically assign a bus number.
930 *
928 * If no devices have pre-been declared for this bus, then be sure to 931 * If no devices have pre-been declared for this bus, then be sure to
929 * register the adapter before any dynamically allocated ones. Otherwise 932 * register the adapter before any dynamically allocated ones. Otherwise
930 * the required bus ID may not be available. 933 * the required bus ID may not be available.
@@ -940,6 +943,8 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adap)
940 int id; 943 int id;
941 int status; 944 int status;
942 945
946 if (adap->nr == -1) /* -1 means dynamically assign bus id */
947 return i2c_add_adapter(adap);
943 if (adap->nr & ~MAX_ID_MASK) 948 if (adap->nr & ~MAX_ID_MASK)
944 return -EINVAL; 949 return -EINVAL;
945 950
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c
index 9e8f4e1b0cc9..712c7904d03e 100644
--- a/drivers/ide/palm_bk3710.c
+++ b/drivers/ide/palm_bk3710.c
@@ -342,7 +342,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
342 return -ENODEV; 342 return -ENODEV;
343 } 343 }
344 344
345 mem_size = mem->end - mem->start + 1; 345 mem_size = resource_size(mem);
346 if (request_mem_region(mem->start, mem_size, "palm_bk3710") == NULL) { 346 if (request_mem_region(mem->start, mem_size, "palm_bk3710") == NULL) {
347 printk(KERN_ERR "failed to request memory region\n"); 347 printk(KERN_ERR "failed to request memory region\n");
348 return -EBUSY; 348 return -EBUSY;
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index bed3e39aac96..71c231954972 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -551,10 +551,10 @@ static int __init tx4939ide_probe(struct platform_device *pdev)
551 return -ENODEV; 551 return -ENODEV;
552 552
553 if (!devm_request_mem_region(&pdev->dev, res->start, 553 if (!devm_request_mem_region(&pdev->dev, res->start,
554 res->end - res->start + 1, "tx4938ide")) 554 resource_size(res), "tx4938ide"))
555 return -EBUSY; 555 return -EBUSY;
556 mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, 556 mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start,
557 res->end - res->start + 1); 557 resource_size(res));
558 if (!mapbase) 558 if (!mapbase)
559 return -EBUSY; 559 return -EBUSY;
560 memset(&hw, 0, sizeof(hw)); 560 memset(&hw, 0, sizeof(hw));
diff --git a/drivers/input/serio/libps2.c b/drivers/input/serio/libps2.c
index 980af94ba9c8..07a8363f3c5c 100644
--- a/drivers/input/serio/libps2.c
+++ b/drivers/input/serio/libps2.c
@@ -210,7 +210,7 @@ int __ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command)
210 /* 210 /*
211 * Some devices (Synaptics) peform the reset before 211 * Some devices (Synaptics) peform the reset before
212 * ACKing the reset command, and so it can take a long 212 * ACKing the reset command, and so it can take a long
213 * time before the ACK arrrives. 213 * time before the ACK arrives.
214 */ 214 */
215 if (ps2_sendbyte(ps2dev, command & 0xff, 215 if (ps2_sendbyte(ps2dev, command & 0xff,
216 command == PS2_CMD_RESET_BAT ? 1000 : 200)) 216 command == PS2_CMD_RESET_BAT ? 1000 : 200))
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
index d55874e5d1c2..44fc8b4bcd81 100644
--- a/drivers/input/serio/sa1111ps2.c
+++ b/drivers/input/serio/sa1111ps2.c
@@ -300,8 +300,7 @@ static int __devinit ps2_probe(struct sa1111_dev *dev)
300 300
301 out: 301 out:
302 sa1111_disable_device(ps2if->dev); 302 sa1111_disable_device(ps2if->dev);
303 release_mem_region(dev->res.start, 303 release_mem_region(dev->res.start, resource_size(&dev->res));
304 dev->res.end - dev->res.start + 1);
305 free: 304 free:
306 sa1111_set_drvdata(dev, NULL); 305 sa1111_set_drvdata(dev, NULL);
307 kfree(ps2if); 306 kfree(ps2if);
@@ -317,8 +316,7 @@ static int __devexit ps2_remove(struct sa1111_dev *dev)
317 struct ps2if *ps2if = sa1111_get_drvdata(dev); 316 struct ps2if *ps2if = sa1111_get_drvdata(dev);
318 317
319 serio_unregister_port(ps2if->io); 318 serio_unregister_port(ps2if->io);
320 release_mem_region(dev->res.start, 319 release_mem_region(dev->res.start, resource_size(&dev->res));
321 dev->res.end - dev->res.start + 1);
322 sa1111_set_drvdata(dev, NULL); 320 sa1111_set_drvdata(dev, NULL);
323 321
324 kfree(ps2if); 322 kfree(ps2if);
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c
index 02d9918705dd..aa0b6a6f5ef4 100644
--- a/drivers/isdn/i4l/isdn_bsdcomp.c
+++ b/drivers/isdn/i4l/isdn_bsdcomp.c
@@ -155,7 +155,7 @@ struct bsd_db {
155#define LAST 255 155#define LAST 255
156 156
157#define MAXCODE(b) ((1 << (b)) - 1) 157#define MAXCODE(b) ((1 << (b)) - 1)
158#define BADCODEM1 MAXCODE(MAX_BSD_BITS); 158#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
159 159
160#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \ 160#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \
161 ^ (unsigned long)(prefix)) 161 ^ (unsigned long)(prefix))
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index ecd3d0280768..d20168fe4c40 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -42,7 +42,6 @@
42#include <linux/bitops.h> 42#include <linux/bitops.h>
43#include <media/rc-core.h> 43#include <media/rc-core.h>
44#include <linux/pci_ids.h> 44#include <linux/pci_ids.h>
45#include <linux/delay.h>
46 45
47#include "ite-cir.h" 46#include "ite-cir.h"
48 47
diff --git a/drivers/media/video/davinci/vpif.c b/drivers/media/video/davinci/vpif.c
index 9f3bfc1eb240..af9680273ff9 100644
--- a/drivers/media/video/davinci/vpif.c
+++ b/drivers/media/video/davinci/vpif.c
@@ -422,7 +422,7 @@ static int __init vpif_probe(struct platform_device *pdev)
422 if (!res) 422 if (!res)
423 return -ENOENT; 423 return -ENOENT;
424 424
425 res_len = res->end - res->start + 1; 425 res_len = resource_size(res);
426 426
427 res = request_mem_region(res->start, res_len, res->name); 427 res = request_mem_region(res->start, res_len, res->name);
428 if (!res) 428 if (!res)
diff --git a/drivers/media/video/m5mols/m5mols_capture.c b/drivers/media/video/m5mols/m5mols_capture.c
index d9471928369d..a45d8f098e02 100644
--- a/drivers/media/video/m5mols/m5mols_capture.c
+++ b/drivers/media/video/m5mols/m5mols_capture.c
@@ -22,7 +22,6 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/regulator/consumer.h> 23#include <linux/regulator/consumer.h>
24#include <linux/videodev2.h> 24#include <linux/videodev2.h>
25#include <linux/version.h>
26#include <media/v4l2-ctrls.h> 25#include <media/v4l2-ctrls.h>
27#include <media/v4l2-device.h> 26#include <media/v4l2-device.h>
28#include <media/v4l2-subdev.h> 27#include <media/v4l2-subdev.h>
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index 4d07c5844402..a647894d3a71 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -129,7 +129,7 @@ module_param(debug, bool, S_IRUGO);
129MODULE_PARM_DESC(debug, "Debug level (0-1)"); 129MODULE_PARM_DESC(debug, "Debug level (0-1)");
130 130
131/* list of image formats supported by OMAP2 video pipelines */ 131/* list of image formats supported by OMAP2 video pipelines */
132const static struct v4l2_fmtdesc omap_formats[] = { 132static const struct v4l2_fmtdesc omap_formats[] = {
133 { 133 {
134 /* Note: V4L2 defines RGB565 as: 134 /* Note: V4L2 defines RGB565 as:
135 * 135 *
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index f6626e87dbc5..69b60ba5dd7a 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -1768,14 +1768,13 @@ static int __devinit omap24xxcam_probe(struct platform_device *pdev)
1768 dev_err(cam->dev, "no mem resource?\n"); 1768 dev_err(cam->dev, "no mem resource?\n");
1769 goto err; 1769 goto err;
1770 } 1770 }
1771 if (!request_mem_region(mem->start, (mem->end - mem->start) + 1, 1771 if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) {
1772 pdev->name)) {
1773 dev_err(cam->dev, 1772 dev_err(cam->dev,
1774 "cannot reserve camera register I/O region\n"); 1773 "cannot reserve camera register I/O region\n");
1775 goto err; 1774 goto err;
1776 } 1775 }
1777 cam->mmio_base_phys = mem->start; 1776 cam->mmio_base_phys = mem->start;
1778 cam->mmio_size = (mem->end - mem->start) + 1; 1777 cam->mmio_size = resource_size(mem);
1779 1778
1780 /* map the region */ 1779 /* map the region */
1781 cam->mmio_base = (unsigned long) 1780 cam->mmio_base = (unsigned long)
diff --git a/drivers/media/video/videobuf2-memops.c b/drivers/media/video/videobuf2-memops.c
index 5370a3a7ee25..b03c3aea5bea 100644
--- a/drivers/media/video/videobuf2-memops.c
+++ b/drivers/media/video/videobuf2-memops.c
@@ -18,7 +18,6 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/file.h> 20#include <linux/file.h>
21#include <linux/slab.h>
22 21
23#include <media/videobuf2-core.h> 22#include <media/videobuf2-core.h>
24#include <media/videobuf2-memops.h> 23#include <media/videobuf2-memops.h>
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 090d2a3a6548..a8c08f332da0 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -681,11 +681,11 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
681 if (root && allocate_resource(root, res, sb->desired_mem_size, sb->desired_mem_size, sb->desired_mem_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */ 681 if (root && allocate_resource(root, res, sb->desired_mem_size, sb->desired_mem_size, sb->desired_mem_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
682 NULL, NULL) >= 0) { 682 NULL, NULL) >= 0) {
683 c->mem_alloc = 1; 683 c->mem_alloc = 1;
684 sb->current_mem_size = 1 + res->end - res->start; 684 sb->current_mem_size = resource_size(res);
685 sb->current_mem_base = res->start; 685 sb->current_mem_base = res->start;
686 osm_info("%s: allocated %llu bytes of PCI memory at " 686 osm_info("%s: allocated %llu bytes of PCI memory at "
687 "0x%016llX.\n", c->name, 687 "0x%016llX.\n", c->name,
688 (unsigned long long)(1 + res->end - res->start), 688 (unsigned long long)resource_size(res),
689 (unsigned long long)res->start); 689 (unsigned long long)res->start);
690 } 690 }
691 } 691 }
@@ -703,11 +703,11 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
703 if (root && allocate_resource(root, res, sb->desired_io_size, sb->desired_io_size, sb->desired_io_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */ 703 if (root && allocate_resource(root, res, sb->desired_io_size, sb->desired_io_size, sb->desired_io_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
704 NULL, NULL) >= 0) { 704 NULL, NULL) >= 0) {
705 c->io_alloc = 1; 705 c->io_alloc = 1;
706 sb->current_io_size = 1 + res->end - res->start; 706 sb->current_io_size = resource_size(res);
707 sb->current_mem_base = res->start; 707 sb->current_mem_base = res->start;
708 osm_info("%s: allocated %llu bytes of PCI I/O at " 708 osm_info("%s: allocated %llu bytes of PCI I/O at "
709 "0x%016llX.\n", c->name, 709 "0x%016llX.\n", c->name,
710 (unsigned long long)(1 + res->end - res->start), 710 (unsigned long long)resource_size(res),
711 (unsigned long long)res->start); 711 (unsigned long long)res->start);
712 } 712 }
713 } 713 }
diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c
index ad715bf49cac..71bc835324d8 100644
--- a/drivers/mfd/tc6387xb.c
+++ b/drivers/mfd/tc6387xb.c
@@ -177,7 +177,7 @@ static int __devinit tc6387xb_probe(struct platform_device *dev)
177 if (ret) 177 if (ret)
178 goto err_resource; 178 goto err_resource;
179 179
180 tc6387xb->scr = ioremap(rscr->start, rscr->end - rscr->start + 1); 180 tc6387xb->scr = ioremap(rscr->start, resource_size(rscr));
181 if (!tc6387xb->scr) { 181 if (!tc6387xb->scr) {
182 ret = -ENOMEM; 182 ret = -ENOMEM;
183 goto err_ioremap; 183 goto err_ioremap;
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 4afffe610f99..769a4e8e10dc 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -95,7 +95,7 @@ static int __init ssc_probe(struct platform_device *pdev)
95 } 95 }
96 96
97 ssc->pdev = pdev; 97 ssc->pdev = pdev;
98 ssc->regs = ioremap(regs->start, regs->end - regs->start + 1); 98 ssc->regs = ioremap(regs->start, resource_size(regs));
99 if (!ssc->regs) { 99 if (!ssc->regs) {
100 dev_dbg(&pdev->dev, "ioremap failed\n"); 100 dev_dbg(&pdev->dev, "ioremap failed\n");
101 retval = -EINVAL; 101 retval = -EINVAL;
diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c
index 0f3fb4f03bdf..28f5aaa19d4a 100644
--- a/drivers/misc/atmel_pwm.c
+++ b/drivers/misc/atmel_pwm.c
@@ -329,7 +329,7 @@ static int __init pwm_probe(struct platform_device *pdev)
329 p->pdev = pdev; 329 p->pdev = pdev;
330 p->mask = *mp; 330 p->mask = *mp;
331 p->irq = irq; 331 p->irq = irq;
332 p->base = ioremap(r->start, r->end - r->start + 1); 332 p->base = ioremap(r->start, resource_size(r));
333 if (!p->base) 333 if (!p->base)
334 goto fail; 334 goto fail;
335 p->clk = clk_get(&pdev->dev, "pwm_clk"); 335 p->clk = clk_get(&pdev->dev, "pwm_clk");
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 0c839d3338db..77f0b6b1681d 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1825,7 +1825,7 @@ static int dw_mci_probe(struct platform_device *pdev)
1825 INIT_LIST_HEAD(&host->queue); 1825 INIT_LIST_HEAD(&host->queue);
1826 1826
1827 ret = -ENOMEM; 1827 ret = -ENOMEM;
1828 host->regs = ioremap(regs->start, regs->end - regs->start + 1); 1828 host->regs = ioremap(regs->start, resource_size(regs));
1829 if (!host->regs) 1829 if (!host->regs)
1830 goto err_freehost; 1830 goto err_freehost;
1831 1831
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index cc20e0259325..14aa213b00da 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -715,13 +715,13 @@ static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
715 int burstlen, ret; 715 int burstlen, ret;
716 716
717 /* 717 /*
718 * use burstlen of 64 in 4 bit mode (--> reg value 0) 718 * use burstlen of 64 (16 words) in 4 bit mode (--> reg value 0)
719 * use burstlen of 16 in 1 bit mode (--> reg value 16) 719 * use burstlen of 16 (4 words) in 1 bit mode (--> reg value 16)
720 */ 720 */
721 if (ios->bus_width == MMC_BUS_WIDTH_4) 721 if (ios->bus_width == MMC_BUS_WIDTH_4)
722 burstlen = 64;
723 else
724 burstlen = 16; 722 burstlen = 16;
723 else
724 burstlen = 4;
725 725
726 if (mxcmci_use_dma(host) && burstlen != host->burstlen) { 726 if (mxcmci_use_dma(host) && burstlen != host->burstlen) {
727 host->burstlen = burstlen; 727 host->burstlen = burstlen;
diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index d4455ffbefd8..e8f6e65183d7 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -1625,8 +1625,8 @@ static void __vub300_command_response(struct vub300_mmc_host *vub300,
1625 cmd->error = respretval; 1625 cmd->error = respretval;
1626 } else if (cmd->error) { 1626 } else if (cmd->error) {
1627 /* 1627 /*
1628 * the error occured sending the command 1628 * the error occurred sending the command
1629 * or recieving the response 1629 * or receiving the response
1630 */ 1630 */
1631 } else if (vub300->command_out_urb->status) { 1631 } else if (vub300->command_out_urb->status) {
1632 vub300->usb_transport_fail = vub300->command_out_urb->status; 1632 vub300->usb_transport_fail = vub300->command_out_urb->status;
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index 1e2c430aaad2..83e80c65d6e7 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright © 2009 Bluewater Systems Ltd 6 * Copyright © 2009 Bluewater Systems Ltd
7 * Author: Andre Renaud <andre@bluewatersys.com> 7 * Author: Andre Renaud <andre@bluewatersys.com>
8 * Author: Ryan Mallon <ryan@bluewatersys.com> 8 * Author: Ryan Mallon
9 * 9 *
10 * Based on m25p80.c 10 * Based on m25p80.c
11 * 11 *
@@ -498,5 +498,5 @@ module_exit(sst25l_exit);
498 498
499MODULE_DESCRIPTION("MTD SPI driver for SST25L Flash chips"); 499MODULE_DESCRIPTION("MTD SPI driver for SST25L Flash chips");
500MODULE_AUTHOR("Andre Renaud <andre@bluewatersys.com>, " 500MODULE_AUTHOR("Andre Renaud <andre@bluewatersys.com>, "
501 "Ryan Mallon <ryan@bluewatersys.com>"); 501 "Ryan Mallon");
502MODULE_LICENSE("GPL"); 502MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
index d4297a97e100..67815eed2f00 100644
--- a/drivers/mtd/maps/bfin-async-flash.c
+++ b/drivers/mtd/maps/bfin-async-flash.c
@@ -142,7 +142,7 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev)
142 state->map.write = bfin_flash_write; 142 state->map.write = bfin_flash_write;
143 state->map.copy_to = bfin_flash_copy_to; 143 state->map.copy_to = bfin_flash_copy_to;
144 state->map.bankwidth = pdata->width; 144 state->map.bankwidth = pdata->width;
145 state->map.size = memory->end - memory->start + 1; 145 state->map.size = resource_size(memory);
146 state->map.virt = (void __iomem *)memory->start; 146 state->map.virt = (void __iomem *)memory->start;
147 state->map.phys = memory->start; 147 state->map.phys = memory->start;
148 state->map.map_priv_1 = (unsigned long)state; 148 state->map.map_priv_1 = (unsigned long)state;
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index c00b9175ba9e..1594a802631d 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -155,7 +155,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
155 if (!plat) 155 if (!plat)
156 return -ENODEV; 156 return -ENODEV;
157 157
158 window_size = dev->resource->end - dev->resource->start + 1; 158 window_size = resource_size(dev->resource);
159 dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", 159 dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n",
160 ixp_data->nr_banks, ((u32)window_size >> 20)); 160 ixp_data->nr_banks, ((u32)window_size >> 20));
161 161
@@ -194,16 +194,17 @@ static int ixp2000_flash_probe(struct platform_device *dev)
194 info->map.copy_to = ixp2000_flash_copy_to; 194 info->map.copy_to = ixp2000_flash_copy_to;
195 195
196 info->res = request_mem_region(dev->resource->start, 196 info->res = request_mem_region(dev->resource->start,
197 dev->resource->end - dev->resource->start + 1, 197 resource_size(dev->resource),
198 dev_name(&dev->dev)); 198 dev_name(&dev->dev));
199 if (!info->res) { 199 if (!info->res) {
200 dev_err(&dev->dev, "Could not reserve memory region\n"); 200 dev_err(&dev->dev, "Could not reserve memory region\n");
201 err = -ENOMEM; 201 err = -ENOMEM;
202 goto Error; 202 goto Error;
203 } 203 }
204 204
205 info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, 205 info->map.map_priv_1 =
206 dev->resource->end - dev->resource->start + 1); 206 (unsigned long)ioremap(dev->resource->start,
207 resource_size(dev->resource));
207 if (!info->map.map_priv_1) { 208 if (!info->map.map_priv_1) {
208 dev_err(&dev->dev, "Failed to ioremap flash region\n"); 209 dev_err(&dev->dev, "Failed to ioremap flash region\n");
209 err = -EIO; 210 err = -EIO;
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index f59d62f74d44..7ae137d4b998 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -70,7 +70,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev)
70 info->map.name = (char *) flash->name; 70 info->map.name = (char *) flash->name;
71 info->map.bankwidth = flash->width; 71 info->map.bankwidth = flash->width;
72 info->map.phys = res->start; 72 info->map.phys = res->start;
73 info->map.size = res->end - res->start + 1; 73 info->map.size = resource_size(res);
74 info->parts = flash->parts; 74 info->parts = flash->parts;
75 info->nr_parts = flash->nr_parts; 75 info->nr_parts = flash->nr_parts;
76 76
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 3f92731a5b9e..f1af2228a1b1 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -1192,7 +1192,7 @@ err_unregister_chdev:
1192static void __exit cleanup_mtdchar(void) 1192static void __exit cleanup_mtdchar(void)
1193{ 1193{
1194 unregister_mtd_user(&mtdchar_notifier); 1194 unregister_mtd_user(&mtdchar_notifier);
1195 mntput(mtd_inode_mnt); 1195 kern_unmount(mtd_inode_mnt);
1196 unregister_filesystem(&mtd_inodefs_type); 1196 unregister_filesystem(&mtd_inodefs_type);
1197 __unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd"); 1197 __unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd");
1198} 1198}
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 1b90fd56bef1..55da20ccc7a8 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -514,7 +514,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
514 514
515 host->io_phys = (dma_addr_t)mem->start; 515 host->io_phys = (dma_addr_t)mem->start;
516 516
517 host->io_base = ioremap(mem->start, mem->end - mem->start + 1); 517 host->io_base = ioremap(mem->start, resource_size(mem));
518 if (host->io_base == NULL) { 518 if (host->io_base == NULL) {
519 printk(KERN_ERR "atmel_nand: ioremap failed\n"); 519 printk(KERN_ERR "atmel_nand: ioremap failed\n");
520 res = -EIO; 520 res = -EIO;
@@ -548,7 +548,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
548 if (no_ecc) 548 if (no_ecc)
549 nand_chip->ecc.mode = NAND_ECC_NONE; 549 nand_chip->ecc.mode = NAND_ECC_NONE;
550 if (hard_ecc && regs) { 550 if (hard_ecc && regs) {
551 host->ecc = ioremap(regs->start, regs->end - regs->start + 1); 551 host->ecc = ioremap(regs->start, resource_size(regs));
552 if (host->ecc == NULL) { 552 if (host->ecc == NULL) {
553 printk(KERN_ERR "atmel_nand: ioremap failed\n"); 553 printk(KERN_ERR "atmel_nand: ioremap failed\n");
554 res = -EIO; 554 res = -EIO;
diff --git a/drivers/mtd/nand/bcm_umi_nand.c b/drivers/mtd/nand/bcm_umi_nand.c
index 9ec280738a9a..8c569e454dc5 100644
--- a/drivers/mtd/nand/bcm_umi_nand.c
+++ b/drivers/mtd/nand/bcm_umi_nand.c
@@ -380,7 +380,7 @@ static int __devinit bcm_umi_nand_probe(struct platform_device *pdev)
380 return -ENXIO; 380 return -ENXIO;
381 381
382 /* map physical address */ 382 /* map physical address */
383 bcm_umi_io_base = ioremap(r->start, r->end - r->start + 1); 383 bcm_umi_io_base = ioremap(r->start, resource_size(r));
384 384
385 if (!bcm_umi_io_base) { 385 if (!bcm_umi_io_base) {
386 printk(KERN_ERR "ioremap to access BCM UMI NAND chip failed\n"); 386 printk(KERN_ERR "ioremap to access BCM UMI NAND chip failed\n");
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 2f7c930872f9..eb1fbac63eb6 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -713,7 +713,7 @@ static int __devinit mpc5121_nfc_probe(struct platform_device *op)
713 } 713 }
714 714
715 regs_paddr = res.start; 715 regs_paddr = res.start;
716 regs_size = res.end - res.start + 1; 716 regs_size = resource_size(&res);
717 717
718 if (!devm_request_mem_region(dev, regs_paddr, regs_size, DRV_NAME)) { 718 if (!devm_request_mem_region(dev, regs_paddr, regs_size, DRV_NAME)) {
719 dev_err(dev, "Error requesting memory region!\n"); 719 dev_err(dev, "Error requesting memory region!\n");
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 6c4ef966ca58..41ea84e3f69c 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) 5 * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
6 * Copyright (C) 2006 Felix Fietkau (nbd@openwrt.org) 6 * Copyright (C) 2006 Felix Fietkau (nbd@openwrt.org)
7 * Copyright (C) 2006 Broadcom Corporation. 7 * Copyright (C) 2006 Broadcom Corporation.
8 * Copyright (C) 2007 Michael Buesch <mb@bu3sch.de> 8 * Copyright (C) 2007 Michael Buesch <m@bues.ch>
9 * 9 *
10 * Distribute under GPL. 10 * Distribute under GPL.
11 */ 11 */
diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
index 4753bb9731f5..1d9b9858067c 100644
--- a/drivers/net/bcm63xx_enet.c
+++ b/drivers/net/bcm63xx_enet.c
@@ -1647,7 +1647,7 @@ static int __devinit bcm_enet_probe(struct platform_device *pdev)
1647 if (ret) 1647 if (ret)
1648 goto out; 1648 goto out;
1649 1649
1650 iomem_size = res_mem->end - res_mem->start + 1; 1650 iomem_size = resource_size(res_mem);
1651 if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) { 1651 if (!request_mem_region(res_mem->start, iomem_size, "bcm63xx_enet")) {
1652 ret = -EBUSY; 1652 ret = -EBUSY;
1653 goto out; 1653 goto out;
@@ -1862,7 +1862,7 @@ static int __devexit bcm_enet_remove(struct platform_device *pdev)
1862 /* release device resources */ 1862 /* release device resources */
1863 iounmap(priv->base); 1863 iounmap(priv->base);
1864 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1864 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1865 release_mem_region(res->start, res->end - res->start + 1); 1865 release_mem_region(res->start, resource_size(res));
1866 1866
1867 /* disable hw block clocks */ 1867 /* disable hw block clocks */
1868 if (priv->phy_clk) { 1868 if (priv->phy_clk) {
@@ -1898,7 +1898,7 @@ static int __devinit bcm_enet_shared_probe(struct platform_device *pdev)
1898 if (!res) 1898 if (!res)
1899 return -ENODEV; 1899 return -ENODEV;
1900 1900
1901 iomem_size = res->end - res->start + 1; 1901 iomem_size = resource_size(res);
1902 if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma")) 1902 if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma"))
1903 return -EBUSY; 1903 return -EBUSY;
1904 1904
@@ -1916,7 +1916,7 @@ static int __devexit bcm_enet_shared_remove(struct platform_device *pdev)
1916 1916
1917 iounmap(bcm_enet_shared_base); 1917 iounmap(bcm_enet_shared_base);
1918 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1918 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1919 release_mem_region(res->start, res->end - res->start + 1); 1919 release_mem_region(res->start, resource_size(res));
1920 return 0; 1920 return 0;
1921} 1921}
1922 1922
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c
index 6e99d80ec409..a9b759add187 100644
--- a/drivers/net/bsd_comp.c
+++ b/drivers/net/bsd_comp.c
@@ -201,7 +201,7 @@ extern void ppp_unregister_compressor (struct compressor *cp);
201#define LAST 255 201#define LAST 255
202 202
203#define MAXCODE(b) ((1 << (b)) - 1) 203#define MAXCODE(b) ((1 << (b)) - 1)
204#define BADCODEM1 MAXCODE(MAX_BSD_BITS); 204#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
205 205
206#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \ 206#define BSD_HASH(prefix,suffix,hshift) ((((unsigned long)(suffix))<<(hshift)) \
207 ^ (unsigned long)(prefix)) 207 ^ (unsigned long)(prefix))
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index a79925e72d66..09a8b86cf1ac 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -799,7 +799,7 @@ static __devinit int softing_pdev_probe(struct platform_device *pdev)
799 if (!pres) 799 if (!pres)
800 goto platform_resource_failed; 800 goto platform_resource_failed;
801 card->dpram_phys = pres->start; 801 card->dpram_phys = pres->start;
802 card->dpram_size = pres->end - pres->start + 1; 802 card->dpram_size = resource_size(pres);
803 card->dpram = ioremap_nocache(card->dpram_phys, card->dpram_size); 803 card->dpram = ioremap_nocache(card->dpram_phys, card->dpram_size);
804 if (!card->dpram) { 804 if (!card->dpram) {
805 dev_alert(&card->pdev->dev, "dpram ioremap failed\n"); 805 dev_alert(&card->pdev->dev, "dpram ioremap failed\n");
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index acef7e96c9fd..3f451e4d8361 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -1822,7 +1822,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
1822 } 1822 }
1823 1823
1824 priv->emac_base_phys = res->start + pdata->ctrl_reg_offset; 1824 priv->emac_base_phys = res->start + pdata->ctrl_reg_offset;
1825 size = res->end - res->start + 1; 1825 size = resource_size(res);
1826 if (!request_mem_region(res->start, size, ndev->name)) { 1826 if (!request_mem_region(res->start, size, ndev->name)) {
1827 dev_err(&pdev->dev, "failed request_mem_region() for regs\n"); 1827 dev_err(&pdev->dev, "failed request_mem_region() for regs\n");
1828 rc = -ENXIO; 1828 rc = -ENXIO;
@@ -1927,7 +1927,7 @@ no_irq_res:
1927 cpdma_ctlr_destroy(priv->dma); 1927 cpdma_ctlr_destroy(priv->dma);
1928no_dma: 1928no_dma:
1929 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1929 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1930 release_mem_region(res->start, res->end - res->start + 1); 1930 release_mem_region(res->start, resource_size(res));
1931 iounmap(priv->remap_addr); 1931 iounmap(priv->remap_addr);
1932 1932
1933probe_quit: 1933probe_quit:
@@ -1961,7 +1961,7 @@ static int __devexit davinci_emac_remove(struct platform_device *pdev)
1961 cpdma_chan_destroy(priv->rxchan); 1961 cpdma_chan_destroy(priv->rxchan);
1962 cpdma_ctlr_destroy(priv->dma); 1962 cpdma_ctlr_destroy(priv->dma);
1963 1963
1964 release_mem_region(res->start, res->end - res->start + 1); 1964 release_mem_region(res->start, resource_size(res));
1965 1965
1966 unregister_netdev(ndev); 1966 unregister_netdev(ndev);
1967 iounmap(priv->remap_addr); 1967 iounmap(priv->remap_addr);
diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c
index 48ee51bb9e50..a19228563efd 100644
--- a/drivers/net/eexpress.c
+++ b/drivers/net/eexpress.c
@@ -365,7 +365,7 @@ static int __init do_express_probe(struct net_device *dev)
365 dev->irq = mca_irqmap[(pos1>>4)&0x7]; 365 dev->irq = mca_irqmap[(pos1>>4)&0x7];
366 366
367 /* 367 /*
368 * XXX: Transciever selection is done 368 * XXX: Transceiver selection is done
369 * differently on the MCA version. 369 * differently on the MCA version.
370 * How to get it to select something 370 * How to get it to select something
371 * other than external/AUI is currently 371 * other than external/AUI is currently
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 0da6295d9da6..8abbe1d82826 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -968,7 +968,7 @@ static int __devinit ethoc_probe(struct platform_device *pdev)
968 priv = netdev_priv(netdev); 968 priv = netdev_priv(netdev);
969 priv->netdev = netdev; 969 priv->netdev = netdev;
970 priv->dma_alloc = 0; 970 priv->dma_alloc = 0;
971 priv->io_region_size = mmio->end - mmio->start + 1; 971 priv->io_region_size = resource_size(mmio);
972 972
973 priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr, 973 priv->iobase = devm_ioremap_nocache(&pdev->dev, netdev->base_addr,
974 resource_size(mmio)); 974 resource_size(mmio));
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 381bdea97d5f..cb4416e591f1 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -871,10 +871,11 @@ static int __devinit mpc52xx_fec_probe(struct platform_device *op)
871 "Error while parsing device node resource\n" ); 871 "Error while parsing device node resource\n" );
872 goto err_netdev; 872 goto err_netdev;
873 } 873 }
874 if ((mem.end - mem.start + 1) < sizeof(struct mpc52xx_fec)) { 874 if (resource_size(&mem) < sizeof(struct mpc52xx_fec)) {
875 printk(KERN_ERR DRIVER_NAME 875 printk(KERN_ERR DRIVER_NAME
876 " - invalid resource size (%lx < %x), check mpc52xx_devices.c\n", 876 " - invalid resource size (%lx < %x), check mpc52xx_devices.c\n",
877 (unsigned long)(mem.end - mem.start + 1), sizeof(struct mpc52xx_fec)); 877 (unsigned long)resource_size(&mem),
878 sizeof(struct mpc52xx_fec));
878 rv = -EINVAL; 879 rv = -EINVAL;
879 goto err_netdev; 880 goto err_netdev;
880 } 881 }
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index ad2975440719..b09270b5d0a5 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -120,7 +120,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus,
120 if (ret) 120 if (ret)
121 return ret; 121 return ret;
122 122
123 if (res.end - res.start < 13) 123 if (resource_size(&res) <= 13)
124 return -ENODEV; 124 return -ENODEV;
125 125
126 /* This should really encode the pin number as well, but all 126 /* This should really encode the pin number as well, but all
@@ -139,7 +139,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus,
139 return -ENODEV; 139 return -ENODEV;
140 mdc_pin = *data; 140 mdc_pin = *data;
141 141
142 bitbang->dir = ioremap(res.start, res.end - res.start + 1); 142 bitbang->dir = ioremap(res.start, resource_size(&res));
143 if (!bitbang->dir) 143 if (!bitbang->dir)
144 return -ENOMEM; 144 return -ENOMEM;
145 145
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index 6a2e150e75bb..e0e9d6c35d83 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -136,7 +136,7 @@ static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev)
136 136
137 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); 137 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
138 138
139 fec->fecp = ioremap(res.start, res.end - res.start + 1); 139 fec->fecp = ioremap(res.start, resource_size(&res));
140 if (!fec->fecp) 140 if (!fec->fecp)
141 goto out_fec; 141 goto out_fec;
142 142
diff --git a/drivers/net/gianfar_ptp.c b/drivers/net/gianfar_ptp.c
index d8e175382d1d..1c97861596f0 100644
--- a/drivers/net/gianfar_ptp.c
+++ b/drivers/net/gianfar_ptp.c
@@ -491,7 +491,7 @@ static int gianfar_ptp_probe(struct platform_device *dev)
491 spin_lock_init(&etsects->lock); 491 spin_lock_init(&etsects->lock);
492 492
493 etsects->regs = ioremap(etsects->rsrc->start, 493 etsects->regs = ioremap(etsects->rsrc->start,
494 1 + etsects->rsrc->end - etsects->rsrc->start); 494 resource_size(etsects->rsrc));
495 if (!etsects->regs) { 495 if (!etsects->regs) {
496 pr_err("ioremap ptp registers failed\n"); 496 pr_err("ioremap ptp registers failed\n");
497 goto no_ioremap; 497 goto no_ioremap;
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 079450fe5e96..725399ea0690 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2770,7 +2770,7 @@ static int __devinit emac_probe(struct platform_device *ofdev)
2770 } 2770 }
2771 // TODO : request_mem_region 2771 // TODO : request_mem_region
2772 dev->emacp = ioremap(dev->rsrc_regs.start, 2772 dev->emacp = ioremap(dev->rsrc_regs.start,
2773 dev->rsrc_regs.end - dev->rsrc_regs.start + 1); 2773 resource_size(&dev->rsrc_regs));
2774 if (dev->emacp == NULL) { 2774 if (dev->emacp == NULL) {
2775 printk(KERN_ERR "%s: Can't map device registers!\n", 2775 printk(KERN_ERR "%s: Can't map device registers!\n",
2776 np->full_name); 2776 np->full_name);
diff --git a/drivers/net/irda/toim3232-sir.c b/drivers/net/irda/toim3232-sir.c
index 99e1ec02a011..19ad4606b799 100644
--- a/drivers/net/irda/toim3232-sir.c
+++ b/drivers/net/irda/toim3232-sir.c
@@ -78,7 +78,7 @@
78 * Target hardware: IRWave IR320ST-2 78 * Target hardware: IRWave IR320ST-2
79 * 79 *
80 * The IRWave IR320ST-2 is a simple dongle based on the Vishay/Temic 80 * The IRWave IR320ST-2 is a simple dongle based on the Vishay/Temic
81 * TOIM3232 SIR Endec and the Vishay/Temic TFDS4500 SIR IRDA transciever. 81 * TOIM3232 SIR Endec and the Vishay/Temic TFDS4500 SIR IRDA transceiver.
82 * It uses a hex inverter and some discrete components to buffer and 82 * It uses a hex inverter and some discrete components to buffer and
83 * line convert the RS232 down to 5V. 83 * line convert the RS232 down to 5V.
84 * 84 *
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index dcf6011b136c..0fcdc25699d8 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1172,7 +1172,7 @@ static int __init macb_probe(struct platform_device *pdev)
1172 clk_enable(bp->hclk); 1172 clk_enable(bp->hclk);
1173#endif 1173#endif
1174 1174
1175 bp->regs = ioremap(regs->start, regs->end - regs->start + 1); 1175 bp->regs = ioremap(regs->start, resource_size(regs));
1176 if (!bp->regs) { 1176 if (!bp->regs) {
1177 dev_err(&pdev->dev, "failed to map registers, aborting.\n"); 1177 dev_err(&pdev->dev, "failed to map registers, aborting.\n");
1178 err = -ENOMEM; 1178 err = -ENOMEM;
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 77dc6abe1867..259699983ca5 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2597,7 +2597,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2597 if (msp == NULL) 2597 if (msp == NULL)
2598 goto out; 2598 goto out;
2599 2599
2600 msp->base = ioremap(res->start, res->end - res->start + 1); 2600 msp->base = ioremap(res->start, resource_size(res));
2601 if (msp->base == NULL) 2601 if (msp->base == NULL)
2602 goto out_free; 2602 goto out_free;
2603 2603
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 60f46bc2bf64..2962cc695ce3 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1382,7 +1382,7 @@ static int find_mii(struct net_device *dev)
1382/* WCSR bits [0:4] [9:10] */ 1382/* WCSR bits [0:4] [9:10] */
1383#define WCSR_RESET_SAVE 0x61f 1383#define WCSR_RESET_SAVE 0x61f
1384/* RFCR bits [20] [22] [27:31] */ 1384/* RFCR bits [20] [22] [27:31] */
1385#define RFCR_RESET_SAVE 0xf8500000; 1385#define RFCR_RESET_SAVE 0xf8500000
1386 1386
1387static void natsemi_reset(struct net_device *dev) 1387static void natsemi_reset(struct net_device *dev)
1388{ 1388{
@@ -2920,7 +2920,7 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
2920 2920
2921 /* 2921 /*
2922 * If we're ignoring the PHY then autoneg and the internal 2922 * If we're ignoring the PHY then autoneg and the internal
2923 * transciever are really not going to work so don't let the 2923 * transceiver are really not going to work so don't let the
2924 * user select them. 2924 * user select them.
2925 */ 2925 */
2926 if (np->ignore_phy && (ecmd->autoneg == AUTONEG_ENABLE || 2926 if (np->ignore_phy && (ecmd->autoneg == AUTONEG_ENABLE ||
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c
index c1bb05be7a7c..1a3033d8e7ed 100644
--- a/drivers/net/pxa168_eth.c
+++ b/drivers/net/pxa168_eth.c
@@ -1505,7 +1505,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
1505 err = -ENODEV; 1505 err = -ENODEV;
1506 goto err_netdev; 1506 goto err_netdev;
1507 } 1507 }
1508 pep->base = ioremap(res->start, res->end - res->start + 1); 1508 pep->base = ioremap(res->start, resource_size(res));
1509 if (pep->base == NULL) { 1509 if (pep->base == NULL) {
1510 err = -ENOMEM; 1510 err = -ENOMEM;
1511 goto err_netdev; 1511 goto err_netdev;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 4e2d1448093c..7d9c650f395e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -694,7 +694,7 @@ struct rtl8169_private {
694 size_t size; 694 size_t size;
695 } phy_action; 695 } phy_action;
696 } *rtl_fw; 696 } *rtl_fw;
697#define RTL_FIRMWARE_UNKNOWN ERR_PTR(-EAGAIN); 697#define RTL_FIRMWARE_UNKNOWN ERR_PTR(-EAGAIN)
698}; 698};
699 699
700MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>"); 700MODULE_AUTHOR("Realtek and the Linux r8169 crew <netdev@vger.kernel.org>");
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index ae3c8e79b32f..d5596926a1ef 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -967,8 +967,8 @@ struct s2io_nic {
967 u8 serial_num[VPD_STRING_LEN]; 967 u8 serial_num[VPD_STRING_LEN];
968}; 968};
969 969
970#define RESET_ERROR 1; 970#define RESET_ERROR 1
971#define CMD_ERROR 2; 971#define CMD_ERROR 2
972 972
973/* OS related system calls */ 973/* OS related system calls */
974#ifndef readq 974#ifndef readq
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 68d50429ddf3..ea65f7ec360a 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -2597,7 +2597,7 @@ static int __devinit sbmac_probe(struct platform_device *pldev)
2597 2597
2598 res = platform_get_resource(pldev, IORESOURCE_MEM, 0); 2598 res = platform_get_resource(pldev, IORESOURCE_MEM, 0);
2599 BUG_ON(!res); 2599 BUG_ON(!res);
2600 sbm_base = ioremap_nocache(res->start, res->end - res->start + 1); 2600 sbm_base = ioremap_nocache(res->start, resource_size(res));
2601 if (!sbm_base) { 2601 if (!sbm_base) {
2602 printk(KERN_ERR "%s: unable to map device registers\n", 2602 printk(KERN_ERR "%s: unable to map device registers\n",
2603 dev_name(&pldev->dev)); 2603 dev_name(&pldev->dev));
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index ade35dde5b51..be745ae8f4e3 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -46,15 +46,14 @@
46#include <asm/byteorder.h> 46#include <asm/byteorder.h>
47#include <asm/uaccess.h> 47#include <asm/uaccess.h>
48#include <asm/irq.h> 48#include <asm/irq.h>
49#include <asm/prom.h>
49 50
50#ifdef CONFIG_SPARC 51#ifdef CONFIG_SPARC
51#include <asm/idprom.h> 52#include <asm/idprom.h>
52#include <asm/prom.h>
53#endif 53#endif
54 54
55#ifdef CONFIG_PPC_PMAC 55#ifdef CONFIG_PPC_PMAC
56#include <asm/pci-bridge.h> 56#include <asm/pci-bridge.h>
57#include <asm/prom.h>
58#include <asm/machdep.h> 57#include <asm/machdep.h>
59#include <asm/pmac_feature.h> 58#include <asm/pmac_feature.h>
60#endif 59#endif
diff --git a/drivers/net/wan/lmc/lmc_var.h b/drivers/net/wan/lmc/lmc_var.h
index 01ad45218d19..a1d202d8ad67 100644
--- a/drivers/net/wan/lmc/lmc_var.h
+++ b/drivers/net/wan/lmc/lmc_var.h
@@ -380,7 +380,7 @@ struct lmc___softc {
380/* CSR6 settings */ 380/* CSR6 settings */
381#define OPERATION_MODE 0x00000200 /* Full Duplex */ 381#define OPERATION_MODE 0x00000200 /* Full Duplex */
382#define PROMISC_MODE 0x00000040 /* Promiscuous Mode */ 382#define PROMISC_MODE 0x00000040 /* Promiscuous Mode */
383#define RECIEVE_ALL 0x40000000 /* Receive All */ 383#define RECEIVE_ALL 0x40000000 /* Receive All */
384#define PASS_BAD_FRAMES 0x00000008 /* Pass Bad Frames */ 384#define PASS_BAD_FRAMES 0x00000008 /* Pass Bad Frames */
385 385
386/* Dec control registers CSR6 as well */ 386/* Dec control registers CSR6 as well */
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
index 9f69a4c9a3f3..a2a167363dbf 100644
--- a/drivers/net/wireless/ath/ath5k/ahb.c
+++ b/drivers/net/wireless/ath/ath5k/ahb.c
@@ -24,7 +24,6 @@
24#include "debug.h" 24#include "debug.h"
25#include "base.h" 25#include "base.h"
26#include "reg.h" 26#include "reg.h"
27#include "debug.h"
28 27
29/* return bus cachesize in 4B word units */ 28/* return bus cachesize in 4B word units */
30static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz) 29static void ath5k_ahb_read_cachesize(struct ath_common *common, int *csz)
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c
index 59f59fa40334..e751fdee89b2 100644
--- a/drivers/net/wireless/b43/debugfs.c
+++ b/drivers/net/wireless/b43/debugfs.c
@@ -4,7 +4,7 @@
4 4
5 debugfs driver debugging code 5 debugfs driver debugging code
6 6
7 Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 0953ce1ac1b0..83cba22ac6e8 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -4,7 +4,7 @@
4 4
5 DMA ringbuffer and descriptor allocation/management 5 DMA ringbuffer and descriptor allocation/management
6 6
7 Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005, 2006 Michael Buesch <m@bues.ch>
8 8
9 Some code in this file is derived from the b44.c driver 9 Some code in this file is derived from the b44.c driver
10 Copyright (C) 2002 David S. Miller 10 Copyright (C) 2002 David S. Miller
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index b56ed41fc1bd..a38c1c6446ad 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -5,7 +5,7 @@
5 5
6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
7 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it> 7 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
8 Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de> 8 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
9 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 9 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
10 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 10 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
11 11
diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c
index a3dc8bb8ca95..4c82d582a524 100644
--- a/drivers/net/wireless/b43/lo.c
+++ b/drivers/net/wireless/b43/lo.c
@@ -6,7 +6,7 @@
6 6
7 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 7 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
8 Copyright (c) 2005, 2006 Stefano Brivio <stefano.brivio@polimi.it> 8 Copyright (c) 2005, 2006 Stefano Brivio <stefano.brivio@polimi.it>
9 Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de> 9 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
10 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org> 10 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org>
11 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch> 11 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch>
12 12
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 73fbf0358f96..032d46674f6b 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
6 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it> 6 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
7 Copyright (c) 2005-2009 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005-2009 Michael Buesch <m@bues.ch>
8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 10
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index e4ebce9be592..8c684cd33529 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Stefano Brivio <stefano.brivio@polimi.it> 6 Stefano Brivio <stefano.brivio@polimi.it>
7 Michael Buesch <mb@bu3sch.de> 7 Michael Buesch <m@bues.ch>
8 Danny van Dyk <kugelfang@gentoo.org> 8 Danny van Dyk <kugelfang@gentoo.org>
9 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 10
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
index 2c8461dcf1b0..12b6b4067a39 100644
--- a/drivers/net/wireless/b43/pcmcia.c
+++ b/drivers/net/wireless/b43/pcmcia.c
@@ -2,7 +2,7 @@
2 2
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 4
5 Copyright (c) 2007 Michael Buesch <mb@bu3sch.de> 5 Copyright (c) 2007 Michael Buesch <m@bues.ch>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/phy_a.c b/drivers/net/wireless/b43/phy_a.c
index 73ace5552bad..a6c38104693d 100644
--- a/drivers/net/wireless/b43/phy_a.c
+++ b/drivers/net/wireless/b43/phy_a.c
@@ -5,7 +5,7 @@
5 5
6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
8 Copyright (c) 2005-2008 Michael Buesch <mb@bu3sch.de> 8 Copyright (c) 2005-2008 Michael Buesch <m@bues.ch>
9 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org> 9 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org>
10 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch> 10 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch>
11 11
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 101957512bcc..07f009ff5ee2 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -5,7 +5,7 @@
5 5
6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
8 Copyright (c) 2005-2008 Michael Buesch <mb@bu3sch.de> 8 Copyright (c) 2005-2008 Michael Buesch <m@bues.ch>
9 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org> 9 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org>
10 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch> 10 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch>
11 11
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c
index 83532d19347f..8e157bc213f3 100644
--- a/drivers/net/wireless/b43/phy_g.c
+++ b/drivers/net/wireless/b43/phy_g.c
@@ -5,7 +5,7 @@
5 5
6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
8 Copyright (c) 2005-2008 Michael Buesch <mb@bu3sch.de> 8 Copyright (c) 2005-2008 Michael Buesch <m@bues.ch>
9 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org> 9 Copyright (c) 2005, 2006 Danny van Dyk <kugelfang@gentoo.org>
10 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch> 10 Copyright (c) 2005, 2006 Andreas Jaggi <andreas.jaggi@waterwave.ch>
11 11
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index daec1d9e4a18..f93d66b1817b 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 IEEE 802.11a/g LP-PHY driver 4 IEEE 802.11a/g LP-PHY driver
5 5
6 Copyright (c) 2008-2009 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2008-2009 Michael Buesch <m@bues.ch>
7 Copyright (c) 2009 Gábor Stefanik <netrolller.3d@gmail.com> 7 Copyright (c) 2009 Gábor Stefanik <netrolller.3d@gmail.com>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 1ae1e84cb4d1..3b46360da99b 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 IEEE 802.11n PHY support 4 IEEE 802.11n PHY support
5 5
6 Copyright (c) 2008 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2008 Michael Buesch <m@bues.ch>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c
index 44da620d9cc2..6e4228c3ed1b 100644
--- a/drivers/net/wireless/b43/pio.c
+++ b/drivers/net/wireless/b43/pio.c
@@ -4,7 +4,7 @@
4 4
5 PIO data transfer 5 PIO data transfer
6 6
7 Copyright (c) 2005-2008 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005-2008 Michael Buesch <m@bues.ch>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/radio_2055.c b/drivers/net/wireless/b43/radio_2055.c
index 44c6dea66882..93643f18c2b3 100644
--- a/drivers/net/wireless/b43/radio_2055.c
+++ b/drivers/net/wireless/b43/radio_2055.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 IEEE 802.11n PHY and radio device data tables 4 IEEE 802.11n PHY and radio device data tables
5 5
6 Copyright (c) 2008 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2008 Michael Buesch <m@bues.ch>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 59c3afe047af..70c2fcedd1bb 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 RFKILL support 4 RFKILL support
5 5
6 Copyright (c) 2007 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2007 Michael Buesch <m@bues.ch>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c
index 4fd6775b8c33..80b0755ed3af 100644
--- a/drivers/net/wireless/b43/sdio.c
+++ b/drivers/net/wireless/b43/sdio.c
@@ -4,7 +4,7 @@
4 * SDIO over Sonics Silicon Backplane bus glue for b43. 4 * SDIO over Sonics Silicon Backplane bus glue for b43.
5 * 5 *
6 * Copyright (C) 2009 Albert Herranz 6 * Copyright (C) 2009 Albert Herranz
7 * Copyright (C) 2009 Michael Buesch <mb@bu3sch.de> 7 * Copyright (C) 2009 Michael Buesch <m@bues.ch>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/sysfs.c b/drivers/net/wireless/b43/sysfs.c
index f1ae4e05a32c..8e8431d4eb0c 100644
--- a/drivers/net/wireless/b43/sysfs.c
+++ b/drivers/net/wireless/b43/sysfs.c
@@ -4,7 +4,7 @@
4 4
5 SYSFS support routines 5 SYSFS support routines
6 6
7 Copyright (c) 2006 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2006 Michael Buesch <m@bues.ch>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/tables.c b/drivers/net/wireless/b43/tables.c
index 1ef9a6463ec6..ea288df8aee9 100644
--- a/drivers/net/wireless/b43/tables.c
+++ b/drivers/net/wireless/b43/tables.c
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 6 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
7 Copyright (c) 2006, 2006 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2006, 2006 Michael Buesch <m@bues.ch>
8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 10
diff --git a/drivers/net/wireless/b43/tables_lpphy.c b/drivers/net/wireless/b43/tables_lpphy.c
index 6748c5a196e9..cff187c5616d 100644
--- a/drivers/net/wireless/b43/tables_lpphy.c
+++ b/drivers/net/wireless/b43/tables_lpphy.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 IEEE 802.11a/g LP-PHY and radio device data tables 4 IEEE 802.11a/g LP-PHY and radio device data tables
5 5
6 Copyright (c) 2009 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2009 Michael Buesch <m@bues.ch>
7 Copyright (c) 2009 Gábor Stefanik <netrolller.3d@gmail.com> 7 Copyright (c) 2009 Gábor Stefanik <netrolller.3d@gmail.com>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index 2de483b3d3ba..916f238a71df 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 IEEE 802.11n PHY data tables 4 IEEE 802.11n PHY data tables
5 5
6 Copyright (c) 2008 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2008 Michael Buesch <m@bues.ch>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/wa.c b/drivers/net/wireless/b43/wa.c
index 5d00d0eaf2e7..9b1a038be08b 100644
--- a/drivers/net/wireless/b43/wa.c
+++ b/drivers/net/wireless/b43/wa.c
@@ -5,7 +5,7 @@
5 PHY workarounds. 5 PHY workarounds.
6 6
7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it> 7 Copyright (c) 2005-2007 Stefano Brivio <stefano.brivio@polimi.it>
8 Copyright (c) 2005-2007 Michael Buesch <mbuesch@freenet.de> 8 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
9 9
10 This program is free software; you can redistribute it and/or modify 10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by 11 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 82bcf7595139..b74f25ec1ab4 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -6,7 +6,7 @@
6 6
7 Copyright (C) 2005 Martin Langer <martin-langer@gmx.de> 7 Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
8 Copyright (C) 2005 Stefano Brivio <stefano.brivio@polimi.it> 8 Copyright (C) 2005 Stefano Brivio <stefano.brivio@polimi.it>
9 Copyright (C) 2005, 2006 Michael Buesch <mb@bu3sch.de> 9 Copyright (C) 2005, 2006 Michael Buesch <m@bues.ch>
10 Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org> 10 Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org>
11 Copyright (C) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 11 Copyright (C) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
12 12
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c
index f232618f2cd1..5e28ad0d6d17 100644
--- a/drivers/net/wireless/b43legacy/debugfs.c
+++ b/drivers/net/wireless/b43legacy/debugfs.c
@@ -4,7 +4,7 @@
4 4
5 debugfs driver debugging code 5 debugfs driver debugging code
6 6
7 Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index 704ee62101bd..5010c477abdf 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -4,7 +4,7 @@
4 4
5 DMA ringbuffer and descriptor allocation/management 5 DMA ringbuffer and descriptor allocation/management
6 6
7 Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005, 2006 Michael Buesch <m@bues.ch>
8 8
9 Some code in this file is derived from the b44.c driver 9 Some code in this file is derived from the b44.c driver
10 Copyright (C) 2002 David S. Miller 10 Copyright (C) 2002 David S. Miller
diff --git a/drivers/net/wireless/b43legacy/ilt.c b/drivers/net/wireless/b43legacy/ilt.c
index a849078aea69..ee5682e54204 100644
--- a/drivers/net/wireless/b43legacy/ilt.c
+++ b/drivers/net/wireless/b43legacy/ilt.c
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Stefano Brivio <stefano.brivio@polimi.it> 6 Stefano Brivio <stefano.brivio@polimi.it>
7 Michael Buesch <mbuesch@freenet.de> 7 Michael Buesch <m@bues.ch>
8 Danny van Dyk <kugelfang@gentoo.org> 8 Danny van Dyk <kugelfang@gentoo.org>
9 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 10
diff --git a/drivers/net/wireless/b43legacy/leds.c b/drivers/net/wireless/b43legacy/leds.c
index 37e9be893560..2f1bfdc44f94 100644
--- a/drivers/net/wireless/b43legacy/leds.c
+++ b/drivers/net/wireless/b43legacy/leds.c
@@ -5,7 +5,7 @@
5 5
6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 6 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
7 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it> 7 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
8 Copyright (c) 2005-2007 Michael Buesch <mb@bu3sch.de> 8 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
9 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 9 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
10 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 10 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
11 11
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index d6db6c17da4f..04c03b212a5e 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de> 5 * Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
6 * Copyright (c) 2005-2008 Stefano Brivio <stefano.brivio@polimi.it> 6 * Copyright (c) 2005-2008 Stefano Brivio <stefano.brivio@polimi.it>
7 * Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 * Copyright (c) 2005, 2006 Michael Buesch <m@bues.ch>
8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 * Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net> 10 * Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
diff --git a/drivers/net/wireless/b43legacy/main.h b/drivers/net/wireless/b43legacy/main.h
index 1f0e2e379b02..b74a058d7bac 100644
--- a/drivers/net/wireless/b43legacy/main.h
+++ b/drivers/net/wireless/b43legacy/main.h
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it> 6 Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
7 Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005, 2006 Michael Buesch <m@bues.ch>
8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net> 10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c
index 28e477d01587..96faaef3661b 100644
--- a/drivers/net/wireless/b43legacy/phy.c
+++ b/drivers/net/wireless/b43legacy/phy.c
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Stefano Brivio <stefano.brivio@polimi.it> 6 Stefano Brivio <stefano.brivio@polimi.it>
7 Michael Buesch <mbuesch@freenet.de> 7 Michael Buesch <m@bues.ch>
8 Danny van Dyk <kugelfang@gentoo.org> 8 Danny van Dyk <kugelfang@gentoo.org>
9 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net> 10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
diff --git a/drivers/net/wireless/b43legacy/phy.h b/drivers/net/wireless/b43legacy/phy.h
index ecbe409f9a94..831a7a4760e5 100644
--- a/drivers/net/wireless/b43legacy/phy.h
+++ b/drivers/net/wireless/b43legacy/phy.h
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Stefano Brivio <stefano.brivio@polimi.it> 6 Stefano Brivio <stefano.brivio@polimi.it>
7 Michael Buesch <mbuesch@freenet.de> 7 Michael Buesch <m@bues.ch>
8 Danny van Dyk <kugelfang@gentoo.org> 8 Danny van Dyk <kugelfang@gentoo.org>
9 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net> 10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
diff --git a/drivers/net/wireless/b43legacy/pio.c b/drivers/net/wireless/b43legacy/pio.c
index b033b0ed4ca0..192251adf986 100644
--- a/drivers/net/wireless/b43legacy/pio.c
+++ b/drivers/net/wireless/b43legacy/pio.c
@@ -4,7 +4,7 @@
4 4
5 PIO Transmission 5 PIO Transmission
6 6
7 Copyright (c) 2005 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2005 Michael Buesch <m@bues.ch>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43legacy/radio.c b/drivers/net/wireless/b43legacy/radio.c
index 2df545cfad14..475eb14e665b 100644
--- a/drivers/net/wireless/b43legacy/radio.c
+++ b/drivers/net/wireless/b43legacy/radio.c
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Stefano Brivio <stefano.brivio@polimi.it> 6 Stefano Brivio <stefano.brivio@polimi.it>
7 Michael Buesch <mbuesch@freenet.de> 7 Michael Buesch <m@bues.ch>
8 Danny van Dyk <kugelfang@gentoo.org> 8 Danny van Dyk <kugelfang@gentoo.org>
9 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net> 10 Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
diff --git a/drivers/net/wireless/b43legacy/radio.h b/drivers/net/wireless/b43legacy/radio.h
index ec4de2811c52..bccb3d7da682 100644
--- a/drivers/net/wireless/b43legacy/radio.h
+++ b/drivers/net/wireless/b43legacy/radio.h
@@ -4,7 +4,7 @@
4 4
5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>, 5 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
6 Stefano Brivio <stefano.brivio@polimi.it> 6 Stefano Brivio <stefano.brivio@polimi.it>
7 Michael Buesch <mbuesch@freenet.de> 7 Michael Buesch <m@bues.ch>
8 Danny van Dyk <kugelfang@gentoo.org> 8 Danny van Dyk <kugelfang@gentoo.org>
9 Andreas Jaggi <andreas.jaggi@waterwave.ch> 9 Andreas Jaggi <andreas.jaggi@waterwave.ch>
10 10
diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
index b90f223fb31c..c4559bcbc707 100644
--- a/drivers/net/wireless/b43legacy/rfkill.c
+++ b/drivers/net/wireless/b43legacy/rfkill.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 RFKILL support 4 RFKILL support
5 5
6 Copyright (c) 2007 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2007 Michael Buesch <m@bues.ch>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43legacy/sysfs.c b/drivers/net/wireless/b43legacy/sysfs.c
index 56c384fa9b1f..57f8b089767c 100644
--- a/drivers/net/wireless/b43legacy/sysfs.c
+++ b/drivers/net/wireless/b43legacy/sysfs.c
@@ -4,7 +4,7 @@
4 4
5 SYSFS support routines 5 SYSFS support routines
6 6
7 Copyright (c) 2006 Michael Buesch <mb@bu3sch.de> 7 Copyright (c) 2006 Michael Buesch <m@bues.ch>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index 6c174f38ca3c..5188fab0b377 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -6,7 +6,7 @@
6 6
7 Copyright (C) 2005 Martin Langer <martin-langer@gmx.de> 7 Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
8 Copyright (C) 2005 Stefano Brivio <stefano.brivio@polimi.it> 8 Copyright (C) 2005 Stefano Brivio <stefano.brivio@polimi.it>
9 Copyright (C) 2005, 2006 Michael Buesch <mb@bu3sch.de> 9 Copyright (C) 2005, 2006 Michael Buesch <m@bues.ch>
10 Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org> 10 Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org>
11 Copyright (C) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 11 Copyright (C) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
12 Copyright (C) 2007 Larry Finger <Larry.Finger@lwfinger.net> 12 Copyright (C) 2007 Larry Finger <Larry.Finger@lwfinger.net>
diff --git a/drivers/net/wireless/iwlegacy/iwl-commands.h b/drivers/net/wireless/iwlegacy/iwl-commands.h
index ee21210bea9c..89904054473f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-commands.h
+++ b/drivers/net/wireless/iwlegacy/iwl-commands.h
@@ -2617,8 +2617,8 @@ struct iwl_scanstart_notification {
2617 __le32 status; 2617 __le32 status;
2618} __packed; 2618} __packed;
2619 2619
2620#define SCAN_OWNER_STATUS 0x1; 2620#define SCAN_OWNER_STATUS 0x1
2621#define MEASURE_OWNER_STATUS 0x2; 2621#define MEASURE_OWNER_STATUS 0x2
2622 2622
2623#define IWL_PROBE_STATUS_OK 0 2623#define IWL_PROBE_STATUS_OK 0
2624#define IWL_PROBE_STATUS_TX_FAILED BIT(0) 2624#define IWL_PROBE_STATUS_TX_FAILED BIT(0)
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 5769ca5cebca..e9e9d1d1778d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -2468,8 +2468,8 @@ struct iwl_scanstart_notification {
2468 __le32 status; 2468 __le32 status;
2469} __packed; 2469} __packed;
2470 2470
2471#define SCAN_OWNER_STATUS 0x1; 2471#define SCAN_OWNER_STATUS 0x1
2472#define MEASURE_OWNER_STATUS 0x2; 2472#define MEASURE_OWNER_STATUS 0x2
2473 2473
2474#define IWL_PROBE_STATUS_OK 0 2474#define IWL_PROBE_STATUS_OK 0
2475#define IWL_PROBE_STATUS_TX_FAILED BIT(0) 2475#define IWL_PROBE_STATUS_TX_FAILED BIT(0)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
index 72a3d5497547..ba5ff0411f0a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
@@ -1074,10 +1074,10 @@
1074#define _SRL(x) (((x) & 0x3F) << 8) 1074#define _SRL(x) (((x) & 0x3F) << 8)
1075 1075
1076#define _SIFS_CCK_CTX(x) ((x) & 0xFF) 1076#define _SIFS_CCK_CTX(x) ((x) & 0xFF)
1077#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8); 1077#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8)
1078 1078
1079#define _SIFS_OFDM_CTX(x) ((x) & 0xFF) 1079#define _SIFS_OFDM_CTX(x) ((x) & 0xFF)
1080#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8); 1080#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8)
1081 1081
1082#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8) 1082#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8)
1083 1083
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 2c5ac2bf5c56..844f6137970a 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -293,7 +293,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
293 goto exit_mem; 293 goto exit_mem;
294 } 294 }
295 295
296 size = (res->end - res->start) + 1; 296 size = resource_size(res);
297 spacing = size / 3; 297 spacing = size / 3;
298 298
299 dd->io = request_mem_region(res->start, size, pdev->name); 299 dd->io = request_mem_region(res->start, size, pdev->name);
diff --git a/drivers/pci/hotplug/shpchp_sysfs.c b/drivers/pci/hotplug/shpchp_sysfs.c
index 071b7dc0094b..efa30da1ae8f 100644
--- a/drivers/pci/hotplug/shpchp_sysfs.c
+++ b/drivers/pci/hotplug/shpchp_sysfs.c
@@ -50,29 +50,26 @@ static ssize_t show_ctrl (struct device *dev, struct device_attribute *attr, cha
50 pci_bus_for_each_resource(bus, res, index) { 50 pci_bus_for_each_resource(bus, res, index) {
51 if (res && (res->flags & IORESOURCE_MEM) && 51 if (res && (res->flags & IORESOURCE_MEM) &&
52 !(res->flags & IORESOURCE_PREFETCH)) { 52 !(res->flags & IORESOURCE_PREFETCH)) {
53 out += sprintf(out, "start = %8.8llx, " 53 out += sprintf(out, "start = %8.8llx, length = %8.8llx\n",
54 "length = %8.8llx\n", 54 (unsigned long long)res->start,
55 (unsigned long long)res->start, 55 (unsigned long long)resource_size(res));
56 (unsigned long long)(res->end - res->start));
57 } 56 }
58 } 57 }
59 out += sprintf(out, "Free resources: prefetchable memory\n"); 58 out += sprintf(out, "Free resources: prefetchable memory\n");
60 pci_bus_for_each_resource(bus, res, index) { 59 pci_bus_for_each_resource(bus, res, index) {
61 if (res && (res->flags & IORESOURCE_MEM) && 60 if (res && (res->flags & IORESOURCE_MEM) &&
62 (res->flags & IORESOURCE_PREFETCH)) { 61 (res->flags & IORESOURCE_PREFETCH)) {
63 out += sprintf(out, "start = %8.8llx, " 62 out += sprintf(out, "start = %8.8llx, length = %8.8llx\n",
64 "length = %8.8llx\n", 63 (unsigned long long)res->start,
65 (unsigned long long)res->start, 64 (unsigned long long)resource_size(res));
66 (unsigned long long)(res->end - res->start));
67 } 65 }
68 } 66 }
69 out += sprintf(out, "Free resources: IO\n"); 67 out += sprintf(out, "Free resources: IO\n");
70 pci_bus_for_each_resource(bus, res, index) { 68 pci_bus_for_each_resource(bus, res, index) {
71 if (res && (res->flags & IORESOURCE_IO)) { 69 if (res && (res->flags & IORESOURCE_IO)) {
72 out += sprintf(out, "start = %8.8llx, " 70 out += sprintf(out, "start = %8.8llx, length = %8.8llx\n",
73 "length = %8.8llx\n", 71 (unsigned long long)res->start,
74 (unsigned long long)res->start, 72 (unsigned long long)resource_size(res));
75 (unsigned long long)(res->end - res->start));
76 } 73 }
77 } 74 }
78 out += sprintf(out, "Free resources: bus numbers\n"); 75 out += sprintf(out, "Free resources: bus numbers\n");
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 6892601fc76f..cbfbab18be91 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -940,7 +940,7 @@ static int __init pcie_aspm_disable(char *str)
940 printk(KERN_INFO "PCIe ASPM is disabled\n"); 940 printk(KERN_INFO "PCIe ASPM is disabled\n");
941 } else if (!strcmp(str, "force")) { 941 } else if (!strcmp(str, "force")) {
942 aspm_force = 1; 942 aspm_force = 1;
943 printk(KERN_INFO "PCIe ASPM is forcedly enabled\n"); 943 printk(KERN_INFO "PCIe ASPM is forcibly enabled\n");
944 } 944 }
945 return 1; 945 return 1;
946} 946}
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index fb33fa42d249..4902206f53d9 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -283,8 +283,7 @@ static int __init at91_cf_probe(struct platform_device *pdev)
283 } 283 }
284 284
285 /* reserve chip-select regions */ 285 /* reserve chip-select regions */
286 if (!request_mem_region(io->start, io->end + 1 - io->start, 286 if (!request_mem_region(io->start, resource_size(io), driver_name)) {
287 driver_name)) {
288 status = -ENXIO; 287 status = -ENXIO;
289 goto fail1; 288 goto fail1;
290 } 289 }
@@ -308,7 +307,7 @@ static int __init at91_cf_probe(struct platform_device *pdev)
308 return 0; 307 return 0;
309 308
310fail2: 309fail2:
311 release_mem_region(io->start, io->end + 1 - io->start); 310 release_mem_region(io->start, resource_size(io));
312fail1: 311fail1:
313 if (cf->socket.io_offset) 312 if (cf->socket.io_offset)
314 iounmap((void __iomem *) cf->socket.io_offset); 313 iounmap((void __iomem *) cf->socket.io_offset);
@@ -339,7 +338,7 @@ static int __exit at91_cf_remove(struct platform_device *pdev)
339 struct resource *io = cf->socket.io[0].res; 338 struct resource *io = cf->socket.io[0].res;
340 339
341 pcmcia_unregister_socket(&cf->socket); 340 pcmcia_unregister_socket(&cf->socket);
342 release_mem_region(io->start, io->end + 1 - io->start); 341 release_mem_region(io->start, resource_size(io));
343 iounmap((void __iomem *) cf->socket.io_offset); 342 iounmap((void __iomem *) cf->socket.io_offset);
344 if (board->irq_pin) { 343 if (board->irq_pin) {
345 free_irq(board->irq_pin, cf); 344 free_irq(board->irq_pin, cf);
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index 6defd4a8168e..06ad3e5e7d3d 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -209,9 +209,9 @@ static int __devinit electra_cf_probe(struct platform_device *ofdev)
209 209
210 cf->ofdev = ofdev; 210 cf->ofdev = ofdev;
211 cf->mem_phys = mem.start; 211 cf->mem_phys = mem.start;
212 cf->mem_size = PAGE_ALIGN(mem.end - mem.start); 212 cf->mem_size = PAGE_ALIGN(resource_size(&mem));
213 cf->mem_base = ioremap(cf->mem_phys, cf->mem_size); 213 cf->mem_base = ioremap(cf->mem_phys, cf->mem_size);
214 cf->io_size = PAGE_ALIGN(io.end - io.start); 214 cf->io_size = PAGE_ALIGN(resource_size(&io));
215 215
216 area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END); 216 area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END);
217 if (area == NULL) 217 if (area == NULL)
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index 81af2b3bcc00..69ae2fd22400 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -48,9 +48,6 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
48{ 48{
49 int ret; 49 int ret;
50 50
51 if (platform_scoop_config->pcmcia_init)
52 platform_scoop_config->pcmcia_init();
53
54 /* Register interrupts */ 51 /* Register interrupts */
55 if (SCOOP_DEV[skt->nr].cd_irq >= 0) { 52 if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
56 struct pcmcia_irqs cd_irq; 53 struct pcmcia_irqs cd_irq;
diff --git a/drivers/pcmcia/pxa2xx_trizeps4.c b/drivers/pcmcia/pxa2xx_trizeps4.c
index b829e655457b..57ddb969d888 100644
--- a/drivers/pcmcia/pxa2xx_trizeps4.c
+++ b/drivers/pcmcia/pxa2xx_trizeps4.c
@@ -55,10 +55,6 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
55 } 55 }
56 skt->socket.pci_irq = IRQ_GPIO(GPIO_PRDY); 56 skt->socket.pci_irq = IRQ_GPIO(GPIO_PRDY);
57 break; 57 break;
58
59#ifndef CONFIG_MACH_TRIZEPS_CONXS
60 case 1:
61#endif
62 default: 58 default:
63 break; 59 break;
64 } 60 }
diff --git a/drivers/pcmcia/rsrc_iodyn.c b/drivers/pcmcia/rsrc_iodyn.c
index 523eb691c30b..f53c237bda2f 100644
--- a/drivers/pcmcia/rsrc_iodyn.c
+++ b/drivers/pcmcia/rsrc_iodyn.c
@@ -135,7 +135,7 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr,
135 try = res->end + 1; 135 try = res->end + 1;
136 if ((*base == 0) || (*base == try)) { 136 if ((*base == 0) || (*base == try)) {
137 if (adjust_resource(s->io[i].res, res->start, 137 if (adjust_resource(s->io[i].res, res->start,
138 res->end - res->start + num + 1)) 138 resource_size(res) + num))
139 continue; 139 continue;
140 *base = try; 140 *base = try;
141 s->io[i].InUse += num; 141 s->io[i].InUse += num;
@@ -147,8 +147,8 @@ static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr,
147 try = res->start - num; 147 try = res->start - num;
148 if ((*base == 0) || (*base == try)) { 148 if ((*base == 0) || (*base == try)) {
149 if (adjust_resource(s->io[i].res, 149 if (adjust_resource(s->io[i].res,
150 res->start - num, 150 res->start - num,
151 res->end - res->start + num + 1)) 151 resource_size(res) + num))
152 continue; 152 continue;
153 *base = try; 153 *base = try;
154 s->io[i].InUse += num; 154 s->io[i].InUse += num;
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index b187555d4388..9da9656242af 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -770,7 +770,7 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr,
770 res->end + num); 770 res->end + num);
771 if (!ret) { 771 if (!ret) {
772 ret = adjust_resource(s->io[i].res, res->start, 772 ret = adjust_resource(s->io[i].res, res->start,
773 res->end - res->start + num + 1); 773 resource_size(res) + num);
774 if (ret) 774 if (ret)
775 continue; 775 continue;
776 *base = try; 776 *base = try;
@@ -788,8 +788,8 @@ static int nonstatic_find_io(struct pcmcia_socket *s, unsigned int attr,
788 res->end); 788 res->end);
789 if (!ret) { 789 if (!ret) {
790 ret = adjust_resource(s->io[i].res, 790 ret = adjust_resource(s->io[i].res,
791 res->start - num, 791 res->start - num,
792 res->end - res->start + num + 1); 792 resource_size(res) + num);
793 if (ret) 793 if (ret)
794 continue; 794 continue;
795 *base = try; 795 *base = try;
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 3c7857c71a23..65b66aa44c78 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -857,7 +857,7 @@ static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
857 int err = asus_wmi_get_devstate(asus, dev_id, &value); 857 int err = asus_wmi_get_devstate(asus, dev_id, &value);
858 858
859 if (err < 0) 859 if (err < 0)
860 return err; 860 return 0; /* can't return negative here */
861 } 861 }
862 862
863 if (dev_id == ASUS_WMI_DEVID_FAN_CTRL) { 863 if (dev_id == ASUS_WMI_DEVID_FAN_CTRL) {
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 4a07cd96f787..bbf3edd85beb 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -1020,7 +1020,7 @@ static void pnpacpi_encode_io(struct pnp_dev *dev,
1020 io->minimum = p->start; 1020 io->minimum = p->start;
1021 io->maximum = p->end; 1021 io->maximum = p->end;
1022 io->alignment = 0; /* Correct? */ 1022 io->alignment = 0; /* Correct? */
1023 io->address_length = p->end - p->start + 1; 1023 io->address_length = resource_size(p);
1024 } else { 1024 } else {
1025 io->minimum = 0; 1025 io->minimum = 0;
1026 io->address_length = 0; 1026 io->address_length = 0;
@@ -1038,7 +1038,7 @@ static void pnpacpi_encode_fixed_io(struct pnp_dev *dev,
1038 1038
1039 if (pnp_resource_enabled(p)) { 1039 if (pnp_resource_enabled(p)) {
1040 fixed_io->address = p->start; 1040 fixed_io->address = p->start;
1041 fixed_io->address_length = p->end - p->start + 1; 1041 fixed_io->address_length = resource_size(p);
1042 } else { 1042 } else {
1043 fixed_io->address = 0; 1043 fixed_io->address = 0;
1044 fixed_io->address_length = 0; 1044 fixed_io->address_length = 0;
@@ -1061,7 +1061,7 @@ static void pnpacpi_encode_mem24(struct pnp_dev *dev,
1061 memory24->minimum = p->start; 1061 memory24->minimum = p->start;
1062 memory24->maximum = p->end; 1062 memory24->maximum = p->end;
1063 memory24->alignment = 0; 1063 memory24->alignment = 0;
1064 memory24->address_length = p->end - p->start + 1; 1064 memory24->address_length = resource_size(p);
1065 } else { 1065 } else {
1066 memory24->minimum = 0; 1066 memory24->minimum = 0;
1067 memory24->address_length = 0; 1067 memory24->address_length = 0;
@@ -1085,7 +1085,7 @@ static void pnpacpi_encode_mem32(struct pnp_dev *dev,
1085 memory32->minimum = p->start; 1085 memory32->minimum = p->start;
1086 memory32->maximum = p->end; 1086 memory32->maximum = p->end;
1087 memory32->alignment = 0; 1087 memory32->alignment = 0;
1088 memory32->address_length = p->end - p->start + 1; 1088 memory32->address_length = resource_size(p);
1089 } else { 1089 } else {
1090 memory32->minimum = 0; 1090 memory32->minimum = 0;
1091 memory32->alignment = 0; 1091 memory32->alignment = 0;
@@ -1108,7 +1108,7 @@ static void pnpacpi_encode_fixed_mem32(struct pnp_dev *dev,
1108 p->flags & IORESOURCE_MEM_WRITEABLE ? 1108 p->flags & IORESOURCE_MEM_WRITEABLE ?
1109 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 1109 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
1110 fixed_memory32->address = p->start; 1110 fixed_memory32->address = p->start;
1111 fixed_memory32->address_length = p->end - p->start + 1; 1111 fixed_memory32->address_length = resource_size(p);
1112 } else { 1112 } else {
1113 fixed_memory32->address = 0; 1113 fixed_memory32->address = 0;
1114 fixed_memory32->address_length = 0; 1114 fixed_memory32->address_length = 0;
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index cb1f47bfee96..cca2f9f9f3e3 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -505,7 +505,7 @@ static void pnpbios_encode_mem(struct pnp_dev *dev, unsigned char *p,
505 505
506 if (pnp_resource_enabled(res)) { 506 if (pnp_resource_enabled(res)) {
507 base = res->start; 507 base = res->start;
508 len = res->end - res->start + 1; 508 len = resource_size(res);
509 } else { 509 } else {
510 base = 0; 510 base = 0;
511 len = 0; 511 len = 0;
@@ -529,7 +529,7 @@ static void pnpbios_encode_mem32(struct pnp_dev *dev, unsigned char *p,
529 529
530 if (pnp_resource_enabled(res)) { 530 if (pnp_resource_enabled(res)) {
531 base = res->start; 531 base = res->start;
532 len = res->end - res->start + 1; 532 len = resource_size(res);
533 } else { 533 } else {
534 base = 0; 534 base = 0;
535 len = 0; 535 len = 0;
@@ -559,7 +559,7 @@ static void pnpbios_encode_fixed_mem32(struct pnp_dev *dev, unsigned char *p,
559 559
560 if (pnp_resource_enabled(res)) { 560 if (pnp_resource_enabled(res)) {
561 base = res->start; 561 base = res->start;
562 len = res->end - res->start + 1; 562 len = resource_size(res);
563 } else { 563 } else {
564 base = 0; 564 base = 0;
565 len = 0; 565 len = 0;
@@ -617,7 +617,7 @@ static void pnpbios_encode_port(struct pnp_dev *dev, unsigned char *p,
617 617
618 if (pnp_resource_enabled(res)) { 618 if (pnp_resource_enabled(res)) {
619 base = res->start; 619 base = res->start;
620 len = res->end - res->start + 1; 620 len = resource_size(res);
621 } else { 621 } else {
622 base = 0; 622 base = 0;
623 len = 0; 623 len = 0;
@@ -636,11 +636,11 @@ static void pnpbios_encode_fixed_port(struct pnp_dev *dev, unsigned char *p,
636 struct resource *res) 636 struct resource *res)
637{ 637{
638 unsigned long base = res->start; 638 unsigned long base = res->start;
639 unsigned long len = res->end - res->start + 1; 639 unsigned long len = resource_size(res);
640 640
641 if (pnp_resource_enabled(res)) { 641 if (pnp_resource_enabled(res)) {
642 base = res->start; 642 base = res->start;
643 len = res->end - res->start + 1; 643 len = resource_size(res);
644 } else { 644 } else {
645 base = 0; 645 base = 0;
646 len = 0; 646 len = 0;
diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
index 4d2dc4fa2888..bfbce5de49da 100644
--- a/drivers/power/ds2782_battery.c
+++ b/drivers/power/ds2782_battery.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2009 Bluewater Systems Ltd 4 * Copyright (C) 2009 Bluewater Systems Ltd
5 * 5 *
6 * Author: Ryan Mallon <ryan@bluewatersys.com> 6 * Author: Ryan Mallon
7 * 7 *
8 * DS2786 added by Yulia Vilensky <vilensky@compulab.co.il> 8 * DS2786 added by Yulia Vilensky <vilensky@compulab.co.il>
9 * 9 *
@@ -416,6 +416,6 @@ static void __exit ds278x_exit(void)
416} 416}
417module_exit(ds278x_exit); 417module_exit(ds278x_exit);
418 418
419MODULE_AUTHOR("Ryan Mallon <ryan@bluewatersys.com>"); 419MODULE_AUTHOR("Ryan Mallon");
420MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver"); 420MODULE_DESCRIPTION("Maxim/Dallas DS2782 Stand-Alone Fuel Gauage IC driver");
421MODULE_LICENSE("GPL"); 421MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index e725d51e773d..8dd08305aae1 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -223,7 +223,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
223 } 223 }
224 224
225 rtc->irq = irq; 225 rtc->irq = irq;
226 rtc->regs = ioremap(regs->start, regs->end - regs->start + 1); 226 rtc->regs = ioremap(regs->start, resource_size(regs));
227 if (!rtc->regs) { 227 if (!rtc->regs) {
228 ret = -ENOMEM; 228 ret = -ENOMEM;
229 dev_dbg(&pdev->dev, "could not map I/O memory\n"); 229 dev_dbg(&pdev->dev, "could not map I/O memory\n");
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 911e75cdc125..05beb6c1ca79 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -606,7 +606,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
606 * (needing ioremap etc), not i/o space resources like this ... 606 * (needing ioremap etc), not i/o space resources like this ...
607 */ 607 */
608 ports = request_region(ports->start, 608 ports = request_region(ports->start,
609 ports->end + 1 - ports->start, 609 resource_size(ports),
610 driver_name); 610 driver_name);
611 if (!ports) { 611 if (!ports) {
612 dev_dbg(dev, "i/o registers already in use\n"); 612 dev_dbg(dev, "i/o registers already in use\n");
@@ -750,7 +750,7 @@ cleanup1:
750 cmos_rtc.dev = NULL; 750 cmos_rtc.dev = NULL;
751 rtc_device_unregister(cmos_rtc.rtc); 751 rtc_device_unregister(cmos_rtc.rtc);
752cleanup0: 752cleanup0:
753 release_region(ports->start, ports->end + 1 - ports->start); 753 release_region(ports->start, resource_size(ports));
754 return retval; 754 return retval;
755} 755}
756 756
@@ -779,7 +779,7 @@ static void __exit cmos_do_remove(struct device *dev)
779 cmos->rtc = NULL; 779 cmos->rtc = NULL;
780 780
781 ports = cmos->iomem; 781 ports = cmos->iomem;
782 release_region(ports->start, ports->end + 1 - ports->start); 782 release_region(ports->start, resource_size(ports));
783 cmos->iomem = NULL; 783 cmos->iomem = NULL;
784 784
785 cmos->dev = NULL; 785 cmos->dev = NULL;
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index 47e681df31e2..68e6caf25496 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -343,7 +343,7 @@ static int __devinit ds1286_probe(struct platform_device *pdev)
343 if (!priv) 343 if (!priv)
344 return -ENOMEM; 344 return -ENOMEM;
345 345
346 priv->size = res->end - res->start + 1; 346 priv->size = resource_size(res);
347 if (!request_mem_region(res->start, priv->size, pdev->name)) { 347 if (!request_mem_region(res->start, priv->size, pdev->name)) {
348 ret = -EBUSY; 348 ret = -EBUSY;
349 goto out; 349 goto out;
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index fbabc773dded..568ad30617e7 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -490,7 +490,7 @@ ds1511_rtc_probe(struct platform_device *pdev)
490 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 490 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
491 if (!pdata) 491 if (!pdata)
492 return -ENOMEM; 492 return -ENOMEM;
493 pdata->size = res->end - res->start + 1; 493 pdata->size = resource_size(res);
494 if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size, 494 if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size,
495 pdev->name)) 495 pdev->name))
496 return -EBUSY; 496 return -EBUSY;
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 042630c90dd3..d84a448dd754 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -173,7 +173,7 @@ static int __devinit ds1742_rtc_probe(struct platform_device *pdev)
173 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 173 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
174 if (!pdata) 174 if (!pdata)
175 return -ENOMEM; 175 return -ENOMEM;
176 pdata->size = res->end - res->start + 1; 176 pdata->size = resource_size(res);
177 if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size, 177 if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size,
178 pdev->name)) 178 pdev->name))
179 return -EBUSY; 179 return -EBUSY;
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c
index 7410875e5838..8e2a24e33ed6 100644
--- a/drivers/rtc/rtc-m48t35.c
+++ b/drivers/rtc/rtc-m48t35.c
@@ -154,7 +154,7 @@ static int __devinit m48t35_probe(struct platform_device *pdev)
154 if (!priv) 154 if (!priv)
155 return -ENOMEM; 155 return -ENOMEM;
156 156
157 priv->size = res->end - res->start + 1; 157 priv->size = resource_size(res);
158 /* 158 /*
159 * kludge: remove the #ifndef after ioc3 resource 159 * kludge: remove the #ifndef after ioc3 resource
160 * conflicts are resolved 160 * conflicts are resolved
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 3978f4caf724..28365388fb6c 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -433,7 +433,7 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
433 433
434 if (!m48t59->ioaddr) { 434 if (!m48t59->ioaddr) {
435 /* ioaddr not mapped externally */ 435 /* ioaddr not mapped externally */
436 m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1); 436 m48t59->ioaddr = ioremap(res->start, resource_size(res));
437 if (!m48t59->ioaddr) 437 if (!m48t59->ioaddr)
438 goto out; 438 goto out;
439 } 439 }
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index 0cec5650d56a..d33544802a2e 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -332,9 +332,8 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
332 if (!iomem) 332 if (!iomem)
333 return -ENODEV; 333 return -ENODEV;
334 334
335 iomem = request_mem_region(iomem->start, 335 iomem = request_mem_region(iomem->start, resource_size(iomem),
336 iomem->end + 1 - iomem->start, 336 driver_name);
337 driver_name);
338 if (!iomem) { 337 if (!iomem) {
339 dev_dbg(dev, "i/o mem already in use.\n"); 338 dev_dbg(dev, "i/o mem already in use.\n");
340 return -EBUSY; 339 return -EBUSY;
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c
index 46f14b82f3ab..b3eba3cddd42 100644
--- a/drivers/rtc/rtc-puv3.c
+++ b/drivers/rtc/rtc-puv3.c
@@ -267,9 +267,8 @@ static int puv3_rtc_probe(struct platform_device *pdev)
267 return -ENOENT; 267 return -ENOENT;
268 } 268 }
269 269
270 puv3_rtc_mem = request_mem_region(res->start, 270 puv3_rtc_mem = request_mem_region(res->start, resource_size(res),
271 res->end-res->start+1, 271 pdev->name);
272 pdev->name);
273 272
274 if (puv3_rtc_mem == NULL) { 273 if (puv3_rtc_mem == NULL) {
275 dev_err(&pdev->dev, "failed to reserve memory region\n"); 274 dev_err(&pdev->dev, "failed to reserve memory region\n");
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 53c99b1a3c92..9329dbb9ebab 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -474,8 +474,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
474 return -ENOENT; 474 return -ENOENT;
475 } 475 }
476 476
477 s3c_rtc_mem = request_mem_region(res->start, 477 s3c_rtc_mem = request_mem_region(res->start, resource_size(res),
478 res->end-res->start+1,
479 pdev->name); 478 pdev->name);
480 479
481 if (s3c_rtc_mem == NULL) { 480 if (s3c_rtc_mem == NULL) {
@@ -484,7 +483,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
484 goto err_nores; 483 goto err_nores;
485 } 484 }
486 485
487 s3c_rtc_base = ioremap(res->start, res->end - res->start + 1); 486 s3c_rtc_base = ioremap(res->start, resource_size(res));
488 if (s3c_rtc_base == NULL) { 487 if (s3c_rtc_base == NULL) {
489 dev_err(&pdev->dev, "failed ioremap()\n"); 488 dev_err(&pdev->dev, "failed ioremap()\n");
490 ret = -EINVAL; 489 ret = -EINVAL;
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index e7fc70d6b478..2e7c136bb805 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -35,7 +35,7 @@
35 * mode page were taken from the LSI RDAC 2.4 GPL'd 35 * mode page were taken from the LSI RDAC 2.4 GPL'd
36 * driver, and then converted to Linux conventions. 36 * driver, and then converted to Linux conventions.
37 */ 37 */
38#define RDAC_QUIESCENCE_TIME 20; 38#define RDAC_QUIESCENCE_TIME 20
39/* 39/*
40 * Page Codes 40 * Page Codes
41 */ 41 */
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 9059524cf225..ab4c4d651d0c 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -2955,18 +2955,18 @@ typedef struct _SLI2_RDSC {
2955typedef struct _PCB { 2955typedef struct _PCB {
2956#ifdef __BIG_ENDIAN_BITFIELD 2956#ifdef __BIG_ENDIAN_BITFIELD
2957 uint32_t type:8; 2957 uint32_t type:8;
2958#define TYPE_NATIVE_SLI2 0x01; 2958#define TYPE_NATIVE_SLI2 0x01
2959 uint32_t feature:8; 2959 uint32_t feature:8;
2960#define FEATURE_INITIAL_SLI2 0x01; 2960#define FEATURE_INITIAL_SLI2 0x01
2961 uint32_t rsvd:12; 2961 uint32_t rsvd:12;
2962 uint32_t maxRing:4; 2962 uint32_t maxRing:4;
2963#else /* __LITTLE_ENDIAN_BITFIELD */ 2963#else /* __LITTLE_ENDIAN_BITFIELD */
2964 uint32_t maxRing:4; 2964 uint32_t maxRing:4;
2965 uint32_t rsvd:12; 2965 uint32_t rsvd:12;
2966 uint32_t feature:8; 2966 uint32_t feature:8;
2967#define FEATURE_INITIAL_SLI2 0x01; 2967#define FEATURE_INITIAL_SLI2 0x01
2968 uint32_t type:8; 2968 uint32_t type:8;
2969#define TYPE_NATIVE_SLI2 0x01; 2969#define TYPE_NATIVE_SLI2 0x01
2970#endif 2970#endif
2971 2971
2972 uint32_t mailBoxSize; 2972 uint32_t mailBoxSize;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 1b60a95adb50..ae8e298746ba 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -63,7 +63,7 @@ qla2100_intr_handler(int irq, void *dev_id)
63 63
64 /* 64 /*
65 * Issue a "HARD" reset in order for the RISC interrupt 65 * Issue a "HARD" reset in order for the RISC interrupt
66 * bit to be cleared. Schedule a big hammmer to get 66 * bit to be cleared. Schedule a big hammer to get
67 * out of the RISC PAUSED state. 67 * out of the RISC PAUSED state.
68 */ 68 */
69 WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC); 69 WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC);
@@ -169,7 +169,7 @@ qla2300_intr_handler(int irq, void *dev_id)
169 /* 169 /*
170 * Issue a "HARD" reset in order for the RISC 170 * Issue a "HARD" reset in order for the RISC
171 * interrupt bit to be cleared. Schedule a big 171 * interrupt bit to be cleared. Schedule a big
172 * hammmer to get out of the RISC PAUSED state. 172 * hammer to get out of the RISC PAUSED state.
173 */ 173 */
174 WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC); 174 WRT_REG_WORD(&reg->hccr, HCCR_RESET_RISC);
175 RD_REG_WORD(&reg->hccr); 175 RD_REG_WORD(&reg->hccr);
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c
index 744d3f6e4709..bf53e44c82a1 100644
--- a/drivers/ssb/b43_pci_bridge.c
+++ b/drivers/ssb/b43_pci_bridge.c
@@ -5,7 +5,7 @@
5 * because of its small size we include it in the SSB core 5 * because of its small size we include it in the SSB core
6 * instead of creating a standalone module. 6 * instead of creating a standalone module.
7 * 7 *
8 * Copyright 2007 Michael Buesch <mb@bu3sch.de> 8 * Copyright 2007 Michael Buesch <m@bues.ch>
9 * 9 *
10 * Licensed under the GNU/GPL. See COPYING for details. 10 * Licensed under the GNU/GPL. See COPYING for details.
11 */ 11 */
diff --git a/drivers/ssb/driver_chipcommon.c b/drivers/ssb/driver_chipcommon.c
index 06d15b6f2215..5d9c97c24797 100644
--- a/drivers/ssb/driver_chipcommon.c
+++ b/drivers/ssb/driver_chipcommon.c
@@ -3,7 +3,7 @@
3 * Broadcom ChipCommon core driver 3 * Broadcom ChipCommon core driver
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
index a7aef47bf739..52901c14c68b 100644
--- a/drivers/ssb/driver_chipcommon_pmu.c
+++ b/drivers/ssb/driver_chipcommon_pmu.c
@@ -2,7 +2,7 @@
2 * Sonics Silicon Backplane 2 * Sonics Silicon Backplane
3 * Broadcom ChipCommon Power Management Unit driver 3 * Broadcom ChipCommon Power Management Unit driver
4 * 4 *
5 * Copyright 2009, Michael Buesch <mb@bu3sch.de> 5 * Copyright 2009, Michael Buesch <m@bues.ch>
6 * Copyright 2007, Broadcom Corporation 6 * Copyright 2007, Broadcom Corporation
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
diff --git a/drivers/ssb/driver_extif.c b/drivers/ssb/driver_extif.c
index c3e1d3e6d610..dc47f30e9cf7 100644
--- a/drivers/ssb/driver_extif.c
+++ b/drivers/ssb/driver_extif.c
@@ -3,7 +3,7 @@
3 * Broadcom EXTIF core driver 3 * Broadcom EXTIF core driver
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * Copyright 2006, 2007, Felix Fietkau <nbd@openwrt.org> 7 * Copyright 2006, 2007, Felix Fietkau <nbd@openwrt.org>
8 * Copyright 2007, Aurelien Jarno <aurelien@aurel32.net> 8 * Copyright 2007, Aurelien Jarno <aurelien@aurel32.net>
9 * 9 *
diff --git a/drivers/ssb/driver_gige.c b/drivers/ssb/driver_gige.c
index d75890909222..3adb98dad70c 100644
--- a/drivers/ssb/driver_gige.c
+++ b/drivers/ssb/driver_gige.c
@@ -3,7 +3,7 @@
3 * Broadcom Gigabit Ethernet core driver 3 * Broadcom Gigabit Ethernet core driver
4 * 4 *
5 * Copyright 2008, Broadcom Corporation 5 * Copyright 2008, Broadcom Corporation
6 * Copyright 2008, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2008, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index 97efce184a8f..ced501568594 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -3,7 +3,7 @@
3 * Broadcom MIPS core driver 3 * Broadcom MIPS core driver
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 11d85bfd774e..e6ac3177fbbe 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -3,7 +3,7 @@
3 * Broadcom PCI-core driver 3 * Broadcom PCI-core driver
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/ssb/embedded.c b/drivers/ssb/embedded.c
index a0e0d246b592..eec3e267be4d 100644
--- a/drivers/ssb/embedded.c
+++ b/drivers/ssb/embedded.c
@@ -3,7 +3,7 @@
3 * Embedded systems support code 3 * Embedded systems support code
4 * 4 *
5 * Copyright 2005-2008, Broadcom Corporation 5 * Copyright 2005-2008, Broadcom Corporation
6 * Copyright 2006-2008, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006-2008, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 6ec6e099fe04..29c7d4f9d1ae 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -3,7 +3,7 @@
3 * Subsystem core 3 * Subsystem core
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index a00b35f03084..34c3bab90b9a 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Sonics Silicon Backplane PCI-Hostbus related functions. 2 * Sonics Silicon Backplane PCI-Hostbus related functions.
3 * 3 *
4 * Copyright (C) 2005-2006 Michael Buesch <mb@bu3sch.de> 4 * Copyright (C) 2005-2006 Michael Buesch <m@bues.ch>
5 * Copyright (C) 2005 Martin Langer <martin-langer@gmx.de> 5 * Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
6 * Copyright (C) 2005 Stefano Brivio <st3@riseup.net> 6 * Copyright (C) 2005 Stefano Brivio <st3@riseup.net>
7 * Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org> 7 * Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org>
diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
index d7a98131ebf3..116a8116984b 100644
--- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c
@@ -6,7 +6,7 @@
6 * Copyright (c) 2005 Stefano Brivio <st3@riseup.net> 6 * Copyright (c) 2005 Stefano Brivio <st3@riseup.net>
7 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org> 7 * Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
8 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch> 8 * Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
9 * Copyright (c) 2005-2007 Michael Buesch <mbuesch@freenet.de> 9 * Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
10 * 10 *
11 * Licensed under the GNU/GPL. See COPYING for details. 11 * Licensed under the GNU/GPL. See COPYING for details.
12 */ 12 */
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c
index f8533795ee7f..c821c6b2a6a0 100644
--- a/drivers/ssb/pcmcia.c
+++ b/drivers/ssb/pcmcia.c
@@ -3,7 +3,7 @@
3 * PCMCIA-Hostbus related functions 3 * PCMCIA-Hostbus related functions
4 * 4 *
5 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> 5 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2007-2008 Michael Buesch <mb@bu3sch.de> 6 * Copyright 2007-2008 Michael Buesch <m@bues.ch>
7 * 7 *
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c
index 8047f9aaa4b2..3e844874631f 100644
--- a/drivers/ssb/scan.c
+++ b/drivers/ssb/scan.c
@@ -2,7 +2,7 @@
2 * Sonics Silicon Backplane 2 * Sonics Silicon Backplane
3 * Bus scanning 3 * Bus scanning
4 * 4 *
5 * Copyright (C) 2005-2007 Michael Buesch <mb@bu3sch.de> 5 * Copyright (C) 2005-2007 Michael Buesch <m@bues.ch>
6 * Copyright (C) 2005 Martin Langer <martin-langer@gmx.de> 6 * Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
7 * Copyright (C) 2005 Stefano Brivio <st3@riseup.net> 7 * Copyright (C) 2005 Stefano Brivio <st3@riseup.net>
8 * Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 * Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org>
diff --git a/drivers/ssb/sdio.c b/drivers/ssb/sdio.c
index 65a6080cb02a..63fd709038ca 100644
--- a/drivers/ssb/sdio.c
+++ b/drivers/ssb/sdio.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Based on drivers/ssb/pcmcia.c 7 * Based on drivers/ssb/pcmcia.c
8 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> 8 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
9 * Copyright 2007-2008 Michael Buesch <mb@bu3sch.de> 9 * Copyright 2007-2008 Michael Buesch <m@bues.ch>
10 * 10 *
11 * Licensed under the GNU/GPL. See COPYING for details. 11 * Licensed under the GNU/GPL. See COPYING for details.
12 * 12 *
diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
index 45ff0e3a3828..80d366fcf8d3 100644
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -2,7 +2,7 @@
2 * Sonics Silicon Backplane 2 * Sonics Silicon Backplane
3 * Common SPROM support routines 3 * Common SPROM support routines
4 * 4 *
5 * Copyright (C) 2005-2008 Michael Buesch <mb@bu3sch.de> 5 * Copyright (C) 2005-2008 Michael Buesch <m@bues.ch>
6 * Copyright (C) 2005 Martin Langer <martin-langer@gmx.de> 6 * Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
7 * Copyright (C) 2005 Stefano Brivio <st3@riseup.net> 7 * Copyright (C) 2005 Stefano Brivio <st3@riseup.net>
8 * Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org> 8 * Copyright (C) 2005 Danny van Dyk <kugelfang@gentoo.org>
diff --git a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
index 22453b0873e4..11dc39c6987a 100644
--- a/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
+++ b/drivers/staging/ath6kl/os/linux/include/ar6000_drv.h
@@ -52,7 +52,6 @@
52#include "aggr_recv_api.h" 52#include "aggr_recv_api.h"
53#include <host_version.h> 53#include <host_version.h>
54#include <linux/rtnetlink.h> 54#include <linux/rtnetlink.h>
55#include <linux/init.h>
56#include <linux/moduleparam.h> 55#include <linux/moduleparam.h>
57#include "ar6000_api.h" 56#include "ar6000_api.h"
58#ifdef CONFIG_HOST_TCMD_SUPPORT 57#ifdef CONFIG_HOST_TCMD_SUPPORT
diff --git a/drivers/staging/bcm/headers.h b/drivers/staging/bcm/headers.h
index 1148e5e22eb9..8fe8d2b1f627 100644
--- a/drivers/staging/bcm/headers.h
+++ b/drivers/staging/bcm/headers.h
@@ -20,25 +20,23 @@
20#include <linux/file.h> 20#include <linux/file.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/etherdevice.h> 22#include <linux/etherdevice.h>
23#include <net/ip.h>
24#include <linux/wait.h> 23#include <linux/wait.h>
25#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27
28#include <linux/version.h> 26#include <linux/version.h>
29#include <linux/stddef.h> 27#include <linux/stddef.h>
30#include <linux/kernel.h>
31#include <linux/stat.h> 28#include <linux/stat.h>
32#include <linux/fcntl.h> 29#include <linux/fcntl.h>
33#include <linux/unistd.h> 30#include <linux/unistd.h>
34#include <linux/sched.h> 31#include <linux/sched.h>
35#include <linux/mm.h> 32#include <linux/mm.h>
36#include <linux/pagemap.h> 33#include <linux/pagemap.h>
37#include <asm/uaccess.h>
38#include <linux/kthread.h> 34#include <linux/kthread.h>
39#include <linux/tcp.h> 35#include <linux/tcp.h>
40#include <linux/udp.h> 36#include <linux/udp.h>
41#include <linux/usb.h> 37#include <linux/usb.h>
38#include <asm/uaccess.h>
39#include <net/ip.h>
42 40
43#include "Typedefs.h" 41#include "Typedefs.h"
44#include "Version.h" 42#include "Version.h"
@@ -61,7 +59,6 @@
61#include "Queue.h" 59#include "Queue.h"
62#include "vendorspecificextn.h" 60#include "vendorspecificextn.h"
63 61
64
65#include "InterfaceMacros.h" 62#include "InterfaceMacros.h"
66#include "InterfaceAdapter.h" 63#include "InterfaceAdapter.h"
67#include "InterfaceIsr.h" 64#include "InterfaceIsr.h"
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index a71c6f8ee8a3..8cbfeae464b1 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -26,7 +26,6 @@
26#include BCMEMBEDIMAGE 26#include BCMEMBEDIMAGE
27#endif /* BCMEMBEDIMAGE */ 27#endif /* BCMEMBEDIMAGE */
28 28
29#include <bcmdefs.h>
30#include <bcmutils.h> 29#include <bcmutils.h>
31#include <bcmdevs.h> 30#include <bcmdevs.h>
32 31
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index 996033cf9b09..d4bcc1edddb2 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -18,7 +18,6 @@
18#define _wl_cfg80211_h_ 18#define _wl_cfg80211_h_
19 19
20#include <linux/wireless.h> 20#include <linux/wireless.h>
21#include <linux/wireless.h>
22#include <net/cfg80211.h> 21#include <net/cfg80211.h>
23#include <wlioctl.h> 22#include <wlioctl.h>
24 23
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_iw.c b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
index 35eec917f232..53e6a10655e1 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_iw.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_iw.c
@@ -20,21 +20,16 @@
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21#include <linux/hardirq.h> 21#include <linux/hardirq.h>
22#include <wlioctl.h> 22#include <wlioctl.h>
23
24#include <bcmutils.h> 23#include <bcmutils.h>
25
26#include <linux/if_arp.h> 24#include <linux/if_arp.h>
27#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <linux/ieee80211.h>
28 27
29#include <dngl_stats.h> 28#include <dngl_stats.h>
30#include <dhd.h> 29#include <dhd.h>
31#include <dhdioctl.h> 30#include <dhdioctl.h>
32#include <linux/ieee80211.h>
33typedef const struct si_pub si_t;
34#include <wlioctl.h>
35 31
36#include <dngl_stats.h> 32typedef const struct si_pub si_t;
37#include <dhd.h>
38 33
39#define WL_ERROR(fmt, args...) printk(fmt, ##args) 34#define WL_ERROR(fmt, args...) printk(fmt, ##args)
40#define WL_TRACE(fmt, args...) no_printk(fmt, ##args) 35#define WL_TRACE(fmt, args...) no_printk(fmt, ##args)
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 359e73741c48..b3324d609c8b 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -24,7 +24,6 @@
24#include <linux/hiddev.h> 24#include <linux/hiddev.h>
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/dmi.h> 26#include <linux/dmi.h>
27#include <linux/delay.h>
28 27
29#include "hyperv.h" 28#include "hyperv.h"
30 29
diff --git a/drivers/staging/hv/tools/hv_kvp_daemon.c b/drivers/staging/hv/tools/hv_kvp_daemon.c
index 33f0f1c8ad73..a4a407f7052a 100644
--- a/drivers/staging/hv/tools/hv_kvp_daemon.c
+++ b/drivers/staging/hv/tools/hv_kvp_daemon.c
@@ -35,7 +35,6 @@
35#include <arpa/inet.h> 35#include <arpa/inet.h>
36#include <linux/connector.h> 36#include <linux/connector.h>
37#include <linux/netlink.h> 37#include <linux/netlink.h>
38#include <sys/socket.h>
39#include <ifaddrs.h> 38#include <ifaddrs.h>
40#include <netdb.h> 39#include <netdb.h>
41#include <syslog.h> 40#include <syslog.h>
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 1a94364c48b5..72258e8c64ca 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -21,7 +21,6 @@
21#include <linux/semaphore.h> 21#include <linux/semaphore.h>
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/notifier.h> 23#include <linux/notifier.h>
24#include <linux/workqueue.h>
25#include <linux/platform_device.h> 24#include <linux/platform_device.h>
26#include "nvec.h" 25#include "nvec.h"
27 26
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index bae7d85fe831..4c6651aac307 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -307,7 +307,7 @@ static int proc_get_stats_tx(char *page, char **start,
307void rtl8180_proc_module_init(void) 307void rtl8180_proc_module_init(void)
308{ 308{
309 DMESG("Initializing proc filesystem"); 309 DMESG("Initializing proc filesystem");
310 rtl8180_proc = create_proc_entry(RTL8180_MODULE_NAME, S_IFDIR, init_net.proc_net); 310 rtl8180_proc = proc_mkdir(RTL8180_MODULE_NAME, init_net.proc_net);
311} 311}
312 312
313void rtl8180_proc_module_remove(void) 313void rtl8180_proc_module_remove(void)
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
index 663b0b8e1095..c2901b50dbfe 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
@@ -311,7 +311,7 @@ int __init ieee80211_rtl_init(void)
311 } 311 }
312 312
313 ieee80211_debug_level = debug; 313 ieee80211_debug_level = debug;
314 ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); 314 ieee80211_proc = proc_mkdir(DRV_NAME, init_net.proc_net);
315 if (ieee80211_proc == NULL) { 315 if (ieee80211_proc == NULL) {
316 IEEE80211_ERROR("Unable to create " DRV_NAME 316 IEEE80211_ERROR("Unable to create " DRV_NAME
317 " proc directory\n"); 317 " proc directory\n");
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index 19a9a07224a2..8550794c6b91 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -508,7 +508,7 @@ static int proc_get_stats_rx(char *page, char **start,
508static void rtl8192_proc_module_init(void) 508static void rtl8192_proc_module_init(void)
509{ 509{
510 RT_TRACE(COMP_INIT, "Initializing proc filesystem\n"); 510 RT_TRACE(COMP_INIT, "Initializing proc filesystem\n");
511 rtl8192_proc=create_proc_entry(RTL819xE_MODULE_NAME, S_IFDIR, init_net.proc_net); 511 rtl8192_proc = proc_mkdir(RTL819xE_MODULE_NAME, init_net.proc_net);
512} 512}
513 513
514 514
@@ -540,9 +540,7 @@ static void rtl8192_proc_init_one(struct r8192_priv *priv)
540 struct net_device *dev = priv->ieee80211->dev; 540 struct net_device *dev = priv->ieee80211->dev;
541 struct proc_dir_entry *e; 541 struct proc_dir_entry *e;
542 542
543 priv->dir_dev = create_proc_entry(dev->name, 543 priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
544 S_IFDIR | S_IRUGO | S_IXUGO,
545 rtl8192_proc);
546 if (!priv->dir_dev) { 544 if (!priv->dir_dev) {
547 RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n", 545 RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
548 dev->name); 546 dev->name);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index fe978f359f91..d315b256b7a7 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -283,7 +283,7 @@ int __init ieee80211_debug_init(void)
283 283
284 ieee80211_debug_level = debug; 284 ieee80211_debug_level = debug;
285 285
286 ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); 286 ieee80211_proc = proc_mkdir(DRV_NAME, init_net.proc_net);
287 if (ieee80211_proc == NULL) { 287 if (ieee80211_proc == NULL) {
288 IEEE80211_ERROR("Unable to create " DRV_NAME 288 IEEE80211_ERROR("Unable to create " DRV_NAME
289 " proc directory\n"); 289 " proc directory\n");
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index e81b8ab6aa9d..6a1b5c179027 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -671,7 +671,7 @@ static int proc_get_stats_rx(char *page, char **start,
671void rtl8192_proc_module_init(void) 671void rtl8192_proc_module_init(void)
672{ 672{
673 RT_TRACE(COMP_INIT, "Initializing proc filesystem"); 673 RT_TRACE(COMP_INIT, "Initializing proc filesystem");
674 rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, init_net.proc_net); 674 rtl8192_proc = proc_mkdir(RTL819xU_MODULE_NAME, init_net.proc_net);
675} 675}
676 676
677 677
@@ -706,9 +706,7 @@ void rtl8192_proc_init_one(struct net_device *dev)
706{ 706{
707 struct proc_dir_entry *e; 707 struct proc_dir_entry *e;
708 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); 708 struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
709 priv->dir_dev = create_proc_entry(dev->name, 709 priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
710 S_IFDIR | S_IRUGO | S_IXUGO,
711 rtl8192_proc);
712 if (!priv->dir_dev) { 710 if (!priv->dir_dev) {
713 RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n", 711 RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
714 dev->name); 712 dev->name);
diff --git a/drivers/staging/rtl8712/drv_types.h b/drivers/staging/rtl8712/drv_types.h
index 3bb66dc2eb2c..4f380a64aa85 100644
--- a/drivers/staging/rtl8712/drv_types.h
+++ b/drivers/staging/rtl8712/drv_types.h
@@ -29,7 +29,6 @@ struct qos_priv {
29 29
30#include "rtl871x_ht.h" 30#include "rtl871x_ht.h"
31#include "rtl871x_cmd.h" 31#include "rtl871x_cmd.h"
32#include "wlan_bssdef.h"
33#include "rtl871x_xmit.h" 32#include "rtl871x_xmit.h"
34#include "rtl871x_recv.h" 33#include "rtl871x_recv.h"
35#include "rtl871x_security.h" 34#include "rtl871x_security.h"
diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 3d3f73c5cd5b..505395cff282 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -22,7 +22,6 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/kref.h> 24#include <linux/kref.h>
25#include <linux/netdevice.h>
26#include <linux/skbuff.h> 25#include <linux/skbuff.h>
27#include <linux/usb.h> 26#include <linux/usb.h>
28#include <linux/usb/ch9.h> 27#include <linux/usb/ch9.h>
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 52342c17eadd..848b4c57531d 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -50,7 +50,6 @@
50#include <linux/interrupt.h> 50#include <linux/interrupt.h>
51#include <linux/pagemap.h> 51#include <linux/pagemap.h>
52#include <asm/cacheflush.h> 52#include <asm/cacheflush.h>
53#include <linux/sched.h>
54#include <linux/delay.h> 53#include <linux/delay.h>
55#include <linux/jiffies.h> 54#include <linux/jiffies.h>
56#include <linux/rar_register.h> 55#include <linux/rar_register.h>
diff --git a/drivers/staging/usbip/userspace/src/utils.h b/drivers/staging/usbip/userspace/src/utils.h
index 6c29ae945212..991f662720bb 100644
--- a/drivers/staging/usbip/userspace/src/utils.h
+++ b/drivers/staging/usbip/userspace/src/utils.h
@@ -13,7 +13,6 @@
13#include <glib.h> 13#include <glib.h>
14#include <unistd.h> 14#include <unistd.h>
15#include <stdio.h> 15#include <stdio.h>
16#include <sys/types.h>
17#include <sys/stat.h> 16#include <sys/stat.h>
18#include <fcntl.h> 17#include <fcntl.h>
19#include <stdlib.h> 18#include <stdlib.h>
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c
index a6bfb6deba94..09df38b4610c 100644
--- a/drivers/target/tcm_fc/tfc_cmd.c
+++ b/drivers/target/tcm_fc/tfc_cmd.c
@@ -45,7 +45,6 @@
45#include <target/target_core_device.h> 45#include <target/target_core_device.h>
46#include <target/target_core_tpg.h> 46#include <target/target_core_tpg.h>
47#include <target/target_core_configfs.h> 47#include <target/target_core_configfs.h>
48#include <target/target_core_base.h>
49#include <target/target_core_tmr.h> 48#include <target/target_core_tmr.h>
50#include <target/configfs_macros.h> 49#include <target/configfs_macros.h>
51 50
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c
index d63e3dd3b180..8781d1e423df 100644
--- a/drivers/target/tcm_fc/tfc_conf.c
+++ b/drivers/target/tcm_fc/tfc_conf.c
@@ -48,7 +48,6 @@
48#include <target/target_core_device.h> 48#include <target/target_core_device.h>
49#include <target/target_core_tpg.h> 49#include <target/target_core_tpg.h>
50#include <target/target_core_configfs.h> 50#include <target/target_core_configfs.h>
51#include <target/target_core_base.h>
52#include <target/configfs_macros.h> 51#include <target/configfs_macros.h>
53 52
54#include "tcm_fc.h" 53#include "tcm_fc.h"
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c
index 11e6483fc127..8e2a46ddcccb 100644
--- a/drivers/target/tcm_fc/tfc_io.c
+++ b/drivers/target/tcm_fc/tfc_io.c
@@ -54,7 +54,6 @@
54#include <target/target_core_device.h> 54#include <target/target_core_device.h>
55#include <target/target_core_tpg.h> 55#include <target/target_core_tpg.h>
56#include <target/target_core_configfs.h> 56#include <target/target_core_configfs.h>
57#include <target/target_core_base.h>
58#include <target/configfs_macros.h> 57#include <target/configfs_macros.h>
59 58
60#include "tcm_fc.h" 59#include "tcm_fc.h"
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index fbcbb3d1d06b..dbb5eaeee399 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -46,10 +46,8 @@
46#include <target/target_core_device.h> 46#include <target/target_core_device.h>
47#include <target/target_core_tpg.h> 47#include <target/target_core_tpg.h>
48#include <target/target_core_configfs.h> 48#include <target/target_core_configfs.h>
49#include <target/target_core_base.h>
50#include <target/configfs_macros.h> 49#include <target/configfs_macros.h>
51 50
52#include <scsi/libfc.h>
53#include "tcm_fc.h" 51#include "tcm_fc.h"
54 52
55static void ft_sess_delete_all(struct ft_tport *); 53static void ft_sess_delete_all(struct ft_tport *);
diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index f41b4259ecdd..cf35e0dc5085 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -743,7 +743,7 @@ pci_ni8430_setup(struct serial_private *priv,
743 len = pci_resource_len(priv->dev, bar); 743 len = pci_resource_len(priv->dev, bar);
744 p = ioremap_nocache(base, len); 744 p = ioremap_nocache(base, len);
745 745
746 /* enable the transciever */ 746 /* enable the transceiver */
747 writeb(readb(p + offset + NI8430_PORTCON) | NI8430_PORTCON_TXVR_ENABLE, 747 writeb(readb(p + offset + NI8430_PORTCON) | NI8430_PORTCON_TXVR_ENABLE,
748 p + offset + NI8430_PORTCON); 748 p + offset + NI8430_PORTCON);
749 749
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 636144cea932..8f41e1123461 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -457,7 +457,6 @@ config SERIAL_SAMSUNG_UARTS_4
457config SERIAL_SAMSUNG_UARTS 457config SERIAL_SAMSUNG_UARTS
458 int 458 int
459 depends on ARM && PLAT_SAMSUNG 459 depends on ARM && PLAT_SAMSUNG
460 default 2 if ARCH_S3C2400
461 default 6 if ARCH_S5P6450 460 default 6 if ARCH_S5P6450
462 default 4 if SERIAL_SAMSUNG_UARTS_4 461 default 4 if SERIAL_SAMSUNG_UARTS_4
463 default 3 462 default 3
@@ -489,13 +488,6 @@ config SERIAL_SAMSUNG_CONSOLE
489 your boot loader about how to pass options to the kernel at 488 your boot loader about how to pass options to the kernel at
490 boot time.) 489 boot time.)
491 490
492config SERIAL_S3C2400
493 tristate "Samsung S3C2410 Serial port support"
494 depends on ARM && SERIAL_SAMSUNG && CPU_S3C2400
495 default y if CPU_S3C2400
496 help
497 Serial port support for the Samsung S3C2400 SoC
498
499config SERIAL_S3C2410 491config SERIAL_S3C2410
500 tristate "Samsung S3C2410 Serial port support" 492 tristate "Samsung S3C2410 Serial port support"
501 depends on SERIAL_SAMSUNG && CPU_S3C2410 493 depends on SERIAL_SAMSUNG && CPU_S3C2410
@@ -519,13 +511,6 @@ config SERIAL_S3C2440
519 help 511 help
520 Serial port support for the Samsung S3C2440, S3C2416 and S3C2442 SoC 512 Serial port support for the Samsung S3C2440, S3C2416 and S3C2442 SoC
521 513
522config SERIAL_S3C24A0
523 tristate "Samsung S3C24A0 Serial port support"
524 depends on SERIAL_SAMSUNG && CPU_S3C24A0
525 default y if CPU_S3C24A0
526 help
527 Serial port support for the Samsung S3C24A0 SoC
528
529config SERIAL_S3C6400 514config SERIAL_S3C6400
530 tristate "Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support" 515 tristate "Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support"
531 depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5P6450 || CPU_S5PC100) 516 depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5P6450 || CPU_S5PC100)
diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
index cb2628fee4c7..83b4da6a1062 100644
--- a/drivers/tty/serial/Makefile
+++ b/drivers/tty/serial/Makefile
@@ -38,11 +38,9 @@ obj-$(CONFIG_SERIAL_BCM63XX) += bcm63xx_uart.o
38obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o 38obj-$(CONFIG_SERIAL_BFIN) += bfin_5xx.o
39obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o 39obj-$(CONFIG_SERIAL_BFIN_SPORT) += bfin_sport_uart.o
40obj-$(CONFIG_SERIAL_SAMSUNG) += samsung.o 40obj-$(CONFIG_SERIAL_SAMSUNG) += samsung.o
41obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o
42obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o 41obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o
43obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o 42obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o
44obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o 43obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o
45obj-$(CONFIG_SERIAL_S3C24A0) += s3c24a0.o
46obj-$(CONFIG_SERIAL_S3C6400) += s3c6400.o 44obj-$(CONFIG_SERIAL_S3C6400) += s3c6400.o
47obj-$(CONFIG_SERIAL_S5PV210) += s5pv210.o 45obj-$(CONFIG_SERIAL_S5PV210) += s5pv210.o
48obj-$(CONFIG_SERIAL_MAX3100) += max3100.o 46obj-$(CONFIG_SERIAL_MAX3100) += max3100.o
diff --git a/drivers/tty/serial/bfin_5xx.c b/drivers/tty/serial/bfin_5xx.c
index 9b1ff2b6bb37..ff6979181ac5 100644
--- a/drivers/tty/serial/bfin_5xx.c
+++ b/drivers/tty/serial/bfin_5xx.c
@@ -1304,8 +1304,7 @@ static int bfin_serial_probe(struct platform_device *pdev)
1304 goto out_error_free_peripherals; 1304 goto out_error_free_peripherals;
1305 } 1305 }
1306 1306
1307 uart->port.membase = ioremap(res->start, 1307 uart->port.membase = ioremap(res->start, resource_size(res));
1308 res->end - res->start);
1309 if (!uart->port.membase) { 1308 if (!uart->port.membase) {
1310 dev_err(&pdev->dev, "Cannot map uart IO\n"); 1309 dev_err(&pdev->dev, "Cannot map uart IO\n");
1311 ret = -ENXIO; 1310 ret = -ENXIO;
@@ -1483,7 +1482,7 @@ static int bfin_earlyprintk_probe(struct platform_device *pdev)
1483 } 1482 }
1484 1483
1485 bfin_earlyprintk_port.port.membase = ioremap(res->start, 1484 bfin_earlyprintk_port.port.membase = ioremap(res->start,
1486 res->end - res->start); 1485 resource_size(res));
1487 if (!bfin_earlyprintk_port.port.membase) { 1486 if (!bfin_earlyprintk_port.port.membase) {
1488 dev_err(&pdev->dev, "Cannot map uart IO\n"); 1487 dev_err(&pdev->dev, "Cannot map uart IO\n");
1489 ret = -ENXIO; 1488 ret = -ENXIO;
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index a54473123e0a..22fe801cce31 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -954,7 +954,7 @@ static void imx_release_port(struct uart_port *port)
954 struct resource *mmres; 954 struct resource *mmres;
955 955
956 mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); 956 mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
957 release_mem_region(mmres->start, mmres->end - mmres->start + 1); 957 release_mem_region(mmres->start, resource_size(mmres));
958} 958}
959 959
960/* 960/*
@@ -970,8 +970,7 @@ static int imx_request_port(struct uart_port *port)
970 if (!mmres) 970 if (!mmres)
971 return -ENODEV; 971 return -ENODEV;
972 972
973 ret = request_mem_region(mmres->start, mmres->end - mmres->start + 1, 973 ret = request_mem_region(mmres->start, resource_size(mmres), "imx-uart");
974 "imx-uart");
975 974
976 return ret ? 0 : -EBUSY; 975 return ret ? 0 : -EBUSY;
977} 976}
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c
index 84db7321cce8..8e07517f8acd 100644
--- a/drivers/tty/serial/m32r_sio.c
+++ b/drivers/tty/serial/m32r_sio.c
@@ -892,7 +892,7 @@ static int m32r_sio_request_port(struct uart_port *port)
892 * If we have a mapbase, then request that as well. 892 * If we have a mapbase, then request that as well.
893 */ 893 */
894 if (ret == 0 && up->port.flags & UPF_IOREMAP) { 894 if (ret == 0 && up->port.flags & UPF_IOREMAP) {
895 int size = res->end - res->start + 1; 895 int size = resource_size(res);
896 896
897 up->port.membase = ioremap(up->port.mapbase, size); 897 up->port.membase = ioremap(up->port.mapbase, size);
898 if (!up->port.membase) 898 if (!up->port.membase)
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 47cadf474149..c37df8d0fa28 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1241,8 +1241,8 @@ static int serial_omap_probe(struct platform_device *pdev)
1241 return -ENODEV; 1241 return -ENODEV;
1242 } 1242 }
1243 1243
1244 if (!request_mem_region(mem->start, (mem->end - mem->start) + 1, 1244 if (!request_mem_region(mem->start, resource_size(mem),
1245 pdev->dev.driver->name)) { 1245 pdev->dev.driver->name)) {
1246 dev_err(&pdev->dev, "memory region already claimed\n"); 1246 dev_err(&pdev->dev, "memory region already claimed\n");
1247 return -EBUSY; 1247 return -EBUSY;
1248 } 1248 }
@@ -1308,7 +1308,7 @@ err:
1308 dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", 1308 dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n",
1309 pdev->id, __func__, ret); 1309 pdev->id, __func__, ret);
1310do_release_region: 1310do_release_region:
1311 release_mem_region(mem->start, (mem->end - mem->start) + 1); 1311 release_mem_region(mem->start, resource_size(mem));
1312 return ret; 1312 return ret;
1313} 1313}
1314 1314
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 4302e6e3768e..531931c1b250 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -803,7 +803,7 @@ static int serial_pxa_probe(struct platform_device *dev)
803 break; 803 break;
804 } 804 }
805 805
806 sport->port.membase = ioremap(mmres->start, mmres->end - mmres->start + 1); 806 sport->port.membase = ioremap(mmres->start, resource_size(mmres));
807 if (!sport->port.membase) { 807 if (!sport->port.membase) {
808 ret = -ENOMEM; 808 ret = -ENOMEM;
809 goto err_clk; 809 goto err_clk;
diff --git a/drivers/tty/serial/s3c2400.c b/drivers/tty/serial/s3c2400.c
deleted file mode 100644
index d13051b3df87..000000000000
--- a/drivers/tty/serial/s3c2400.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * Driver for Samsung SoC onboard UARTs.
3 *
4 * Ben Dooks, Copyright (c) 2003-2005 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/module.h>
13#include <linux/ioport.h>
14#include <linux/io.h>
15#include <linux/platform_device.h>
16
17#include <asm/irq.h>
18
19#include <mach/hardware.h>
20
21#include <plat/regs-serial.h>
22#include <mach/regs-gpio.h>
23
24#include "samsung.h"
25
26static int s3c2400_serial_getsource(struct uart_port *port,
27 struct s3c24xx_uart_clksrc *clk)
28{
29 clk->divisor = 1;
30 clk->name = "pclk";
31
32 return 0;
33}
34
35static int s3c2400_serial_setsource(struct uart_port *port,
36 struct s3c24xx_uart_clksrc *clk)
37{
38 return 0;
39}
40
41static int s3c2400_serial_resetport(struct uart_port *port,
42 struct s3c2410_uartcfg *cfg)
43{
44 dbg("s3c2400_serial_resetport: port=%p (%08lx), cfg=%p\n",
45 port, port->mapbase, cfg);
46
47 wr_regl(port, S3C2410_UCON, cfg->ucon);
48 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
49
50 /* reset both fifos */
51
52 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
53 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
54
55 return 0;
56}
57
58static struct s3c24xx_uart_info s3c2400_uart_inf = {
59 .name = "Samsung S3C2400 UART",
60 .type = PORT_S3C2400,
61 .fifosize = 16,
62 .rx_fifomask = S3C2410_UFSTAT_RXMASK,
63 .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT,
64 .rx_fifofull = S3C2410_UFSTAT_RXFULL,
65 .tx_fifofull = S3C2410_UFSTAT_TXFULL,
66 .tx_fifomask = S3C2410_UFSTAT_TXMASK,
67 .tx_fifoshift = S3C2410_UFSTAT_TXSHIFT,
68 .get_clksrc = s3c2400_serial_getsource,
69 .set_clksrc = s3c2400_serial_setsource,
70 .reset_port = s3c2400_serial_resetport,
71};
72
73static int s3c2400_serial_probe(struct platform_device *dev)
74{
75 return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);
76}
77
78static struct platform_driver s3c2400_serial_driver = {
79 .probe = s3c2400_serial_probe,
80 .remove = __devexit_p(s3c24xx_serial_remove),
81 .driver = {
82 .name = "s3c2400-uart",
83 .owner = THIS_MODULE,
84 },
85};
86
87s3c24xx_console_init(&s3c2400_serial_driver, &s3c2400_uart_inf);
88
89static inline int s3c2400_serial_init(void)
90{
91 return s3c24xx_serial_init(&s3c2400_serial_driver, &s3c2400_uart_inf);
92}
93
94static inline void s3c2400_serial_exit(void)
95{
96 platform_driver_unregister(&s3c2400_serial_driver);
97}
98
99module_init(s3c2400_serial_init);
100module_exit(s3c2400_serial_exit);
101
102MODULE_LICENSE("GPL v2");
103MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
104MODULE_DESCRIPTION("Samsung S3C2400 SoC Serial port driver");
105MODULE_ALIAS("platform:s3c2400-uart");
diff --git a/drivers/tty/serial/s3c2410.c b/drivers/tty/serial/s3c2410.c
index bffe6ff9b158..b1d7e7c1849d 100644
--- a/drivers/tty/serial/s3c2410.c
+++ b/drivers/tty/serial/s3c2410.c
@@ -96,8 +96,6 @@ static struct platform_driver s3c2410_serial_driver = {
96 }, 96 },
97}; 97};
98 98
99s3c24xx_console_init(&s3c2410_serial_driver, &s3c2410_uart_inf);
100
101static int __init s3c2410_serial_init(void) 99static int __init s3c2410_serial_init(void)
102{ 100{
103 return s3c24xx_serial_init(&s3c2410_serial_driver, &s3c2410_uart_inf); 101 return s3c24xx_serial_init(&s3c2410_serial_driver, &s3c2410_uart_inf);
diff --git a/drivers/tty/serial/s3c2412.c b/drivers/tty/serial/s3c2412.c
index 7e2b9504a687..2234bf9ced45 100644
--- a/drivers/tty/serial/s3c2412.c
+++ b/drivers/tty/serial/s3c2412.c
@@ -130,8 +130,6 @@ static struct platform_driver s3c2412_serial_driver = {
130 }, 130 },
131}; 131};
132 132
133s3c24xx_console_init(&s3c2412_serial_driver, &s3c2412_uart_inf);
134
135static inline int s3c2412_serial_init(void) 133static inline int s3c2412_serial_init(void)
136{ 134{
137 return s3c24xx_serial_init(&s3c2412_serial_driver, &s3c2412_uart_inf); 135 return s3c24xx_serial_init(&s3c2412_serial_driver, &s3c2412_uart_inf);
diff --git a/drivers/tty/serial/s3c2440.c b/drivers/tty/serial/s3c2440.c
index 9e10d415d5fd..1d0c324b813f 100644
--- a/drivers/tty/serial/s3c2440.c
+++ b/drivers/tty/serial/s3c2440.c
@@ -159,8 +159,6 @@ static struct platform_driver s3c2440_serial_driver = {
159 }, 159 },
160}; 160};
161 161
162s3c24xx_console_init(&s3c2440_serial_driver, &s3c2440_uart_inf);
163
164static int __init s3c2440_serial_init(void) 162static int __init s3c2440_serial_init(void)
165{ 163{
166 return s3c24xx_serial_init(&s3c2440_serial_driver, &s3c2440_uart_inf); 164 return s3c24xx_serial_init(&s3c2440_serial_driver, &s3c2440_uart_inf);
diff --git a/drivers/tty/serial/s3c24a0.c b/drivers/tty/serial/s3c24a0.c
deleted file mode 100644
index 914eff22e499..000000000000
--- a/drivers/tty/serial/s3c24a0.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * Driver for Samsung S3C24A0 SoC onboard UARTs.
3 *
4 * Based on drivers/serial/s3c2410.c
5 *
6 * Author: Sandeep Patil <sandeep.patil@azingo.com>
7 *
8 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
9 * http://armlinux.simtec.co.uk/
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#include <linux/module.h>
17#include <linux/ioport.h>
18#include <linux/platform_device.h>
19#include <linux/init.h>
20#include <linux/serial_core.h>
21#include <linux/serial.h>
22#include <linux/io.h>
23#include <linux/irq.h>
24
25#include <mach/hardware.h>
26
27#include <plat/regs-serial.h>
28#include <mach/regs-gpio.h>
29
30#include "samsung.h"
31
32static int s3c24a0_serial_setsource(struct uart_port *port,
33 struct s3c24xx_uart_clksrc *clk)
34{
35 unsigned long ucon = rd_regl(port, S3C2410_UCON);
36
37 if (strcmp(clk->name, "uclk") == 0)
38 ucon |= S3C2410_UCON_UCLK;
39 else
40 ucon &= ~S3C2410_UCON_UCLK;
41
42 wr_regl(port, S3C2410_UCON, ucon);
43 return 0;
44}
45
46static int s3c24a0_serial_getsource(struct uart_port *port,
47 struct s3c24xx_uart_clksrc *clk)
48{
49 unsigned long ucon = rd_regl(port, S3C2410_UCON);
50
51 clk->divisor = 1;
52 clk->name = (ucon & S3C2410_UCON_UCLK) ? "uclk" : "pclk";
53
54 return 0;
55}
56
57static int s3c24a0_serial_resetport(struct uart_port *port,
58 struct s3c2410_uartcfg *cfg)
59{
60 dbg("s3c24a0_serial_resetport: port=%p (%08lx), cfg=%p\n",
61 port, port->mapbase, cfg);
62
63 wr_regl(port, S3C2410_UCON, cfg->ucon);
64 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
65
66 /* reset both fifos */
67
68 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
69 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
70
71 return 0;
72}
73
74static struct s3c24xx_uart_info s3c24a0_uart_inf = {
75 .name = "Samsung S3C24A0 UART",
76 .type = PORT_S3C2410,
77 .fifosize = 16,
78 .rx_fifomask = S3C24A0_UFSTAT_RXMASK,
79 .rx_fifoshift = S3C24A0_UFSTAT_RXSHIFT,
80 .rx_fifofull = S3C24A0_UFSTAT_RXFULL,
81 .tx_fifofull = S3C24A0_UFSTAT_TXFULL,
82 .tx_fifomask = S3C24A0_UFSTAT_TXMASK,
83 .tx_fifoshift = S3C24A0_UFSTAT_TXSHIFT,
84 .get_clksrc = s3c24a0_serial_getsource,
85 .set_clksrc = s3c24a0_serial_setsource,
86 .reset_port = s3c24a0_serial_resetport,
87};
88
89static int s3c24a0_serial_probe(struct platform_device *dev)
90{
91 return s3c24xx_serial_probe(dev, &s3c24a0_uart_inf);
92}
93
94static struct platform_driver s3c24a0_serial_driver = {
95 .probe = s3c24a0_serial_probe,
96 .remove = __devexit_p(s3c24xx_serial_remove),
97 .driver = {
98 .name = "s3c24a0-uart",
99 .owner = THIS_MODULE,
100 },
101};
102
103s3c24xx_console_init(&s3c24a0_serial_driver, &s3c24a0_uart_inf);
104
105static int __init s3c24a0_serial_init(void)
106{
107 return s3c24xx_serial_init(&s3c24a0_serial_driver, &s3c24a0_uart_inf);
108}
109
110static void __exit s3c24a0_serial_exit(void)
111{
112 platform_driver_unregister(&s3c24a0_serial_driver);
113}
114
115module_init(s3c24a0_serial_init);
116module_exit(s3c24a0_serial_exit);
117
diff --git a/drivers/tty/serial/s3c6400.c b/drivers/tty/serial/s3c6400.c
index ded26c42ff37..e2f6913d84d5 100644
--- a/drivers/tty/serial/s3c6400.c
+++ b/drivers/tty/serial/s3c6400.c
@@ -130,8 +130,6 @@ static struct platform_driver s3c6400_serial_driver = {
130 }, 130 },
131}; 131};
132 132
133s3c24xx_console_init(&s3c6400_serial_driver, &s3c6400_uart_inf);
134
135static int __init s3c6400_serial_init(void) 133static int __init s3c6400_serial_init(void)
136{ 134{
137 return s3c24xx_serial_init(&s3c6400_serial_driver, &s3c6400_uart_inf); 135 return s3c24xx_serial_init(&s3c6400_serial_driver, &s3c6400_uart_inf);
diff --git a/drivers/tty/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c
index dd194dc80ee9..8dd160c96e87 100644
--- a/drivers/tty/serial/s5pv210.c
+++ b/drivers/tty/serial/s5pv210.c
@@ -135,13 +135,6 @@ static struct platform_driver s5p_serial_driver = {
135 }, 135 },
136}; 136};
137 137
138static int __init s5pv210_serial_console_init(void)
139{
140 return s3c24xx_serial_initconsole(&s5p_serial_driver, s5p_uart_inf);
141}
142
143console_initcall(s5pv210_serial_console_init);
144
145static int __init s5p_serial_init(void) 138static int __init s5p_serial_init(void)
146{ 139{
147 return s3c24xx_serial_init(&s5p_serial_driver, *s5p_uart_inf); 140 return s3c24xx_serial_init(&s5p_serial_driver, *s5p_uart_inf);
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index f66f64829303..7ead42104c67 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1416,10 +1416,8 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
1416 1416
1417 /* is the port configured? */ 1417 /* is the port configured? */
1418 1418
1419 if (port->mapbase == 0x0) { 1419 if (port->mapbase == 0x0)
1420 co->index = 0; 1420 return -ENODEV;
1421 port = &s3c24xx_serial_ports[co->index].port;
1422 }
1423 1421
1424 cons_uart = port; 1422 cons_uart = port;
1425 1423
@@ -1451,7 +1449,8 @@ static struct console s3c24xx_serial_console = {
1451 .flags = CON_PRINTBUFFER, 1449 .flags = CON_PRINTBUFFER,
1452 .index = -1, 1450 .index = -1,
1453 .write = s3c24xx_serial_console_write, 1451 .write = s3c24xx_serial_console_write,
1454 .setup = s3c24xx_serial_console_setup 1452 .setup = s3c24xx_serial_console_setup,
1453 .data = &s3c24xx_uart_drv,
1455}; 1454};
1456 1455
1457int s3c24xx_serial_initconsole(struct platform_driver *drv, 1456int s3c24xx_serial_initconsole(struct platform_driver *drv,
diff --git a/drivers/tty/serial/samsung.h b/drivers/tty/serial/samsung.h
index 5b098cd76040..a69d9a54be94 100644
--- a/drivers/tty/serial/samsung.h
+++ b/drivers/tty/serial/samsung.h
@@ -79,25 +79,6 @@ extern int s3c24xx_serial_initconsole(struct platform_driver *drv,
79extern int s3c24xx_serial_init(struct platform_driver *drv, 79extern int s3c24xx_serial_init(struct platform_driver *drv,
80 struct s3c24xx_uart_info *info); 80 struct s3c24xx_uart_info *info);
81 81
82#ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
83
84#define s3c24xx_console_init(__drv, __inf) \
85static int __init s3c_serial_console_init(void) \
86{ \
87 struct s3c24xx_uart_info *uinfo[CONFIG_SERIAL_SAMSUNG_UARTS]; \
88 int i; \
89 \
90 for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++) \
91 uinfo[i] = __inf; \
92 return s3c24xx_serial_initconsole(__drv, uinfo); \
93} \
94 \
95console_initcall(s3c_serial_console_init)
96
97#else
98#define s3c24xx_console_init(drv, inf) extern void no_console(void)
99#endif
100
101#ifdef CONFIG_SERIAL_SAMSUNG_DEBUG 82#ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
102 83
103extern void printascii(const char *); 84extern void printascii(const char *);
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 92aa54550e84..ad0f8f5f6ea1 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -1435,7 +1435,7 @@ static int __devinit su_probe(struct platform_device *op)
1435 1435
1436 rp = &op->resource[0]; 1436 rp = &op->resource[0];
1437 up->port.mapbase = rp->start; 1437 up->port.mapbase = rp->start;
1438 up->reg_size = (rp->end - rp->start) + 1; 1438 up->reg_size = resource_size(rp);
1439 up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); 1439 up->port.membase = of_ioremap(rp, 0, up->reg_size, "su");
1440 if (!up->port.membase) { 1440 if (!up->port.membase) {
1441 if (type != SU_PORT_PORT) 1441 if (type != SU_PORT_PORT)
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index 37fc4e3d487c..026cb9ea5cd1 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -573,8 +573,7 @@ static int __init vt8500_serial_probe(struct platform_device *pdev)
573 snprintf(vt8500_port->name, sizeof(vt8500_port->name), 573 snprintf(vt8500_port->name, sizeof(vt8500_port->name),
574 "VT8500 UART%d", pdev->id); 574 "VT8500 UART%d", pdev->id);
575 575
576 vt8500_port->uart.membase = ioremap(mmres->start, 576 vt8500_port->uart.membase = ioremap(mmres->start, resource_size(mmres));
577 mmres->end - mmres->start + 1);
578 if (!vt8500_port->uart.membase) { 577 if (!vt8500_port->uart.membase) {
579 ret = -ENOMEM; 578 ret = -ENOMEM;
580 goto err; 579 goto err;
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c
index 7d3e469b9904..bdc3db946122 100644
--- a/drivers/uio/uio_pdrv.c
+++ b/drivers/uio/uio_pdrv.c
@@ -58,7 +58,7 @@ static int uio_pdrv_probe(struct platform_device *pdev)
58 58
59 uiomem->memtype = UIO_MEM_PHYS; 59 uiomem->memtype = UIO_MEM_PHYS;
60 uiomem->addr = r->start; 60 uiomem->addr = r->start;
61 uiomem->size = r->end - r->start + 1; 61 uiomem->size = resource_size(r);
62 ++uiomem; 62 ++uiomem;
63 } 63 }
64 64
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
index 0f424af7f109..31e799d9efe5 100644
--- a/drivers/uio/uio_pdrv_genirq.c
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -137,7 +137,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev)
137 137
138 uiomem->memtype = UIO_MEM_PHYS; 138 uiomem->memtype = UIO_MEM_PHYS;
139 uiomem->addr = r->start; 139 uiomem->addr = r->start;
140 uiomem->size = r->end - r->start + 1; 140 uiomem->size = resource_size(r);
141 ++uiomem; 141 ++uiomem;
142 } 142 }
143 143
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index db1a659702ba..f045c8968a6e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -272,7 +272,7 @@ static void usba_init_debugfs(struct usba_udc *udc)
272 272
273 regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM, 273 regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM,
274 CTRL_IOMEM_ID); 274 CTRL_IOMEM_ID);
275 regs->d_inode->i_size = regs_resource->end - regs_resource->start + 1; 275 regs->d_inode->i_size = resource_size(regs_resource);
276 udc->debugfs_regs = regs; 276 udc->debugfs_regs = regs;
277 277
278 usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0)); 278 usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0));
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 4e4833168087..3e59035e6de8 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2463,7 +2463,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2463 } 2463 }
2464 2464
2465 if (pdata->operating_mode == FSL_USB2_DR_DEVICE) { 2465 if (pdata->operating_mode == FSL_USB2_DR_DEVICE) {
2466 if (!request_mem_region(res->start, res->end - res->start + 1, 2466 if (!request_mem_region(res->start, resource_size(res),
2467 driver_name)) { 2467 driver_name)) {
2468 ERR("request mem region for %s failed\n", pdev->name); 2468 ERR("request mem region for %s failed\n", pdev->name);
2469 ret = -EBUSY; 2469 ret = -EBUSY;
@@ -2605,7 +2605,7 @@ err_iounmap_noclk:
2605 iounmap(dr_regs); 2605 iounmap(dr_regs);
2606err_release_mem_region: 2606err_release_mem_region:
2607 if (pdata->operating_mode == FSL_USB2_DR_DEVICE) 2607 if (pdata->operating_mode == FSL_USB2_DR_DEVICE)
2608 release_mem_region(res->start, res->end - res->start + 1); 2608 release_mem_region(res->start, resource_size(res));
2609err_kfree: 2609err_kfree:
2610 kfree(udc_controller); 2610 kfree(udc_controller);
2611 udc_controller = NULL; 2611 udc_controller = NULL;
@@ -2640,7 +2640,7 @@ static int __exit fsl_udc_remove(struct platform_device *pdev)
2640 free_irq(udc_controller->irq, udc_controller); 2640 free_irq(udc_controller->irq, udc_controller);
2641 iounmap(dr_regs); 2641 iounmap(dr_regs);
2642 if (pdata->operating_mode == FSL_USB2_DR_DEVICE) 2642 if (pdata->operating_mode == FSL_USB2_DR_DEVICE)
2643 release_mem_region(res->start, res->end - res->start + 1); 2643 release_mem_region(res->start, resource_size(res));
2644 2644
2645 device_unregister(&udc_controller->gadget.dev); 2645 device_unregister(&udc_controller->gadget.dev);
2646 /* free udc --wait for the release() finished */ 2646 /* free udc --wait for the release() finished */
diff --git a/drivers/usb/gadget/pxa27x_udc.h b/drivers/usb/gadget/pxa27x_udc.h
index cd16231d8c73..b01696eab068 100644
--- a/drivers/usb/gadget/pxa27x_udc.h
+++ b/drivers/usb/gadget/pxa27x_udc.h
@@ -88,9 +88,9 @@
88#define UDCISR_INT_MASK (UDCICR_FIFOERR | UDCICR_PKTCOMPL) 88#define UDCISR_INT_MASK (UDCICR_FIFOERR | UDCICR_PKTCOMPL)
89 89
90#define UDCOTGICR_IESF (1 << 24) /* OTG SET_FEATURE command recvd */ 90#define UDCOTGICR_IESF (1 << 24) /* OTG SET_FEATURE command recvd */
91#define UDCOTGICR_IEXR (1 << 17) /* Extra Transciever Interrupt 91#define UDCOTGICR_IEXR (1 << 17) /* Extra Transceiver Interrupt
92 Rising Edge Interrupt Enable */ 92 Rising Edge Interrupt Enable */
93#define UDCOTGICR_IEXF (1 << 16) /* Extra Transciever Interrupt 93#define UDCOTGICR_IEXF (1 << 16) /* Extra Transceiver Interrupt
94 Falling Edge Interrupt Enable */ 94 Falling Edge Interrupt Enable */
95#define UDCOTGICR_IEVV40R (1 << 9) /* OTG Vbus Valid 4.0V Rising Edge 95#define UDCOTGICR_IEVV40R (1 << 9) /* OTG Vbus Valid 4.0V Rising Edge
96 Interrupt Enable */ 96 Interrupt Enable */
diff --git a/drivers/usb/host/ehci-ath79.c b/drivers/usb/host/ehci-ath79.c
index aa248c2f2c60..4d2e88d04dab 100644
--- a/drivers/usb/host/ehci-ath79.c
+++ b/drivers/usb/host/ehci-ath79.c
@@ -148,7 +148,7 @@ static int ehci_ath79_probe(struct platform_device *pdev)
148 return -ENOMEM; 148 return -ENOMEM;
149 149
150 hcd->rsrc_start = res->start; 150 hcd->rsrc_start = res->start;
151 hcd->rsrc_len = res->end - res->start + 1; 151 hcd->rsrc_len = resource_size(res);
152 152
153 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 153 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
154 dev_dbg(&pdev->dev, "controller already in use\n"); 154 dev_dbg(&pdev->dev, "controller already in use\n");
diff --git a/drivers/usb/host/ehci-cns3xxx.c b/drivers/usb/host/ehci-cns3xxx.c
index d41745c6f0c4..6536abdea6e6 100644
--- a/drivers/usb/host/ehci-cns3xxx.c
+++ b/drivers/usb/host/ehci-cns3xxx.c
@@ -107,7 +107,7 @@ static int cns3xxx_ehci_probe(struct platform_device *pdev)
107 } 107 }
108 108
109 hcd->rsrc_start = res->start; 109 hcd->rsrc_start = res->start;
110 hcd->rsrc_len = res->end - res->start + 1; 110 hcd->rsrc_len = resource_size(res);
111 111
112 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, 112 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
113 driver->description)) { 113 driver->description)) {
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index f380bf97e5af..34a3140d1e5f 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -100,7 +100,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
100 goto err2; 100 goto err2;
101 } 101 }
102 hcd->rsrc_start = res->start; 102 hcd->rsrc_start = res->start;
103 hcd->rsrc_len = res->end - res->start + 1; 103 hcd->rsrc_len = resource_size(res);
104 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, 104 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
105 driver->description)) { 105 driver->description)) {
106 dev_dbg(&pdev->dev, "controller already in use\n"); 106 dev_dbg(&pdev->dev, "controller already in use\n");
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c
index 93b230dc51a2..fdfd8c5b639b 100644
--- a/drivers/usb/host/ehci-grlib.c
+++ b/drivers/usb/host/ehci-grlib.c
@@ -130,7 +130,7 @@ static int __devinit ehci_hcd_grlib_probe(struct platform_device *op)
130 return -ENOMEM; 130 return -ENOMEM;
131 131
132 hcd->rsrc_start = res.start; 132 hcd->rsrc_start = res.start;
133 hcd->rsrc_len = res.end - res.start + 1; 133 hcd->rsrc_len = resource_size(&res);
134 134
135 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 135 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
136 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); 136 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__);
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c
index 50e600d26e28..c4460f3d009f 100644
--- a/drivers/usb/host/ehci-ixp4xx.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -100,7 +100,7 @@ static int ixp4xx_ehci_probe(struct platform_device *pdev)
100 goto fail_request_resource; 100 goto fail_request_resource;
101 } 101 }
102 hcd->rsrc_start = res->start; 102 hcd->rsrc_start = res->start;
103 hcd->rsrc_len = res->end - res->start + 1; 103 hcd->rsrc_len = resource_size(res);
104 104
105 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, 105 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
106 driver->description)) { 106 driver->description)) {
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c
index ff55757ba7d8..c3ba3ed5f3a6 100644
--- a/drivers/usb/host/ehci-octeon.c
+++ b/drivers/usb/host/ehci-octeon.c
@@ -124,7 +124,7 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
124 return -ENOMEM; 124 return -ENOMEM;
125 125
126 hcd->rsrc_start = res_mem->start; 126 hcd->rsrc_start = res_mem->start;
127 hcd->rsrc_len = res_mem->end - res_mem->start + 1; 127 hcd->rsrc_len = resource_size(res_mem);
128 128
129 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, 129 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
130 OCTEON_EHCI_HCD_NAME)) { 130 OCTEON_EHCI_HCD_NAME)) {
diff --git a/drivers/usb/host/ehci-pmcmsp.c b/drivers/usb/host/ehci-pmcmsp.c
index cd69099cda19..e8d54de44acc 100644
--- a/drivers/usb/host/ehci-pmcmsp.c
+++ b/drivers/usb/host/ehci-pmcmsp.c
@@ -124,7 +124,7 @@ static int usb_hcd_msp_map_regs(struct mspusb_device *dev)
124 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 124 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
125 if (res == NULL) 125 if (res == NULL)
126 return -ENOMEM; 126 return -ENOMEM;
127 res_len = res->end - res->start + 1; 127 res_len = resource_size(res);
128 if (!request_mem_region(res->start, res_len, "mab regs")) 128 if (!request_mem_region(res->start, res_len, "mab regs"))
129 return -EBUSY; 129 return -EBUSY;
130 130
@@ -140,7 +140,7 @@ static int usb_hcd_msp_map_regs(struct mspusb_device *dev)
140 retval = -ENOMEM; 140 retval = -ENOMEM;
141 goto err2; 141 goto err2;
142 } 142 }
143 res_len = res->end - res->start + 1; 143 res_len = resource_size(res);
144 if (!request_mem_region(res->start, res_len, "usbid regs")) { 144 if (!request_mem_region(res->start, res_len, "usbid regs")) {
145 retval = -EBUSY; 145 retval = -EBUSY;
146 goto err2; 146 goto err2;
@@ -154,13 +154,13 @@ static int usb_hcd_msp_map_regs(struct mspusb_device *dev)
154 return 0; 154 return 0;
155err3: 155err3:
156 res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 156 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
157 res_len = res->end - res->start + 1; 157 res_len = resource_size(res);
158 release_mem_region(res->start, res_len); 158 release_mem_region(res->start, res_len);
159err2: 159err2:
160 iounmap(dev->mab_regs); 160 iounmap(dev->mab_regs);
161err1: 161err1:
162 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 162 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
163 res_len = res->end - res->start + 1; 163 res_len = resource_size(res);
164 release_mem_region(res->start, res_len); 164 release_mem_region(res->start, res_len);
165 dev_err(&pdev->dev, "Failed to map non-EHCI regs.\n"); 165 dev_err(&pdev->dev, "Failed to map non-EHCI regs.\n");
166 return retval; 166 return retval;
@@ -194,7 +194,7 @@ int usb_hcd_msp_probe(const struct hc_driver *driver,
194 goto err1; 194 goto err1;
195 } 195 }
196 hcd->rsrc_start = res->start; 196 hcd->rsrc_start = res->start;
197 hcd->rsrc_len = res->end - res->start + 1; 197 hcd->rsrc_len = resource_size(res);
198 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, dev->name)) { 198 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, dev->name)) {
199 retval = -EBUSY; 199 retval = -EBUSY;
200 goto err1; 200 goto err1;
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 8552db6c29c9..41d11fe14252 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -130,7 +130,7 @@ static int __devinit ehci_hcd_ppc_of_probe(struct platform_device *op)
130 return -ENOMEM; 130 return -ENOMEM;
131 131
132 hcd->rsrc_start = res.start; 132 hcd->rsrc_start = res.start;
133 hcd->rsrc_len = res.end - res.start + 1; 133 hcd->rsrc_len = resource_size(&res);
134 134
135 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 135 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
136 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); 136 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__);
diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c
index 52a027aaa370..d661cf7de140 100644
--- a/drivers/usb/host/ehci-w90x900.c
+++ b/drivers/usb/host/ehci-w90x900.c
@@ -41,7 +41,7 @@ static int __devinit usb_w90x900_probe(const struct hc_driver *driver,
41 } 41 }
42 42
43 hcd->rsrc_start = res->start; 43 hcd->rsrc_start = res->start;
44 hcd->rsrc_len = res->end - res->start + 1; 44 hcd->rsrc_len = resource_size(res);
45 45
46 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 46 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
47 retval = -EBUSY; 47 retval = -EBUSY;
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c
index a64d6d66d760..32793ce3d9e9 100644
--- a/drivers/usb/host/ehci-xilinx-of.c
+++ b/drivers/usb/host/ehci-xilinx-of.c
@@ -174,7 +174,7 @@ static int __devinit ehci_hcd_xilinx_of_probe(struct platform_device *op)
174 return -ENOMEM; 174 return -ENOMEM;
175 175
176 hcd->rsrc_start = res.start; 176 hcd->rsrc_start = res.start;
177 hcd->rsrc_len = res.end - res.start + 1; 177 hcd->rsrc_len = resource_size(&res);
178 178
179 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 179 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
180 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); 180 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__);
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 19223c7449e1..572ea53b0226 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -605,7 +605,7 @@ static int __devinit of_fhci_probe(struct platform_device *ofdev)
605 goto err_regs; 605 goto err_regs;
606 } 606 }
607 607
608 hcd->regs = ioremap(usb_regs.start, usb_regs.end - usb_regs.start + 1); 608 hcd->regs = ioremap(usb_regs.start, resource_size(&usb_regs));
609 if (!hcd->regs) { 609 if (!hcd->regs) {
610 dev_err(dev, "could not ioremap regs\n"); 610 dev_err(dev, "could not ioremap regs\n");
611 ret = -ENOMEM; 611 ret = -ENOMEM;
diff --git a/drivers/usb/host/ohci-ath79.c b/drivers/usb/host/ohci-ath79.c
index ffea3e7cb0a8..c620c50f6770 100644
--- a/drivers/usb/host/ohci-ath79.c
+++ b/drivers/usb/host/ohci-ath79.c
@@ -93,8 +93,8 @@ static int ohci_ath79_probe(struct platform_device *pdev)
93 ret = -ENODEV; 93 ret = -ENODEV;
94 goto err_put_hcd; 94 goto err_put_hcd;
95 } 95 }
96 hcd->rsrc_start = res->start; 96 hcd->rsrc_start = res->start;
97 hcd->rsrc_len = res->end - res->start + 1; 97 hcd->rsrc_len = resource_size(res);
98 98
99 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 99 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
100 dev_dbg(&pdev->dev, "controller already in use\n"); 100 dev_dbg(&pdev->dev, "controller already in use\n");
diff --git a/drivers/usb/host/ohci-cns3xxx.c b/drivers/usb/host/ohci-cns3xxx.c
index f05ef87e934c..5a00a1e1c6ca 100644
--- a/drivers/usb/host/ohci-cns3xxx.c
+++ b/drivers/usb/host/ohci-cns3xxx.c
@@ -100,7 +100,7 @@ static int cns3xxx_ohci_probe(struct platform_device *pdev)
100 goto err1; 100 goto err1;
101 } 101 }
102 hcd->rsrc_start = res->start; 102 hcd->rsrc_start = res->start;
103 hcd->rsrc_len = res->end - res->start + 1; 103 hcd->rsrc_len = resource_size(res);
104 104
105 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, 105 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
106 driver->description)) { 106 driver->description)) {
diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c
index d22fb4d577b7..6aca2c4453f7 100644
--- a/drivers/usb/host/ohci-da8xx.c
+++ b/drivers/usb/host/ohci-da8xx.c
@@ -322,7 +322,7 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver,
322 goto err2; 322 goto err2;
323 } 323 }
324 hcd->rsrc_start = mem->start; 324 hcd->rsrc_start = mem->start;
325 hcd->rsrc_len = mem->end - mem->start + 1; 325 hcd->rsrc_len = resource_size(mem);
326 326
327 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 327 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
328 dev_dbg(&pdev->dev, "request_mem_region failed\n"); 328 dev_dbg(&pdev->dev, "request_mem_region failed\n");
diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c
index e4ddfaf8870f..d8b45647d1dc 100644
--- a/drivers/usb/host/ohci-octeon.c
+++ b/drivers/usb/host/ohci-octeon.c
@@ -135,7 +135,7 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev)
135 return -ENOMEM; 135 return -ENOMEM;
136 136
137 hcd->rsrc_start = res_mem->start; 137 hcd->rsrc_start = res_mem->start;
138 hcd->rsrc_len = res_mem->end - res_mem->start + 1; 138 hcd->rsrc_len = resource_size(res_mem);
139 139
140 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, 140 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
141 OCTEON_OHCI_HCD_NAME)) { 141 OCTEON_OHCI_HCD_NAME)) {
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 1ca1821320f4..0c12f4e14dcd 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -110,7 +110,7 @@ static int __devinit ohci_hcd_ppc_of_probe(struct platform_device *op)
110 return -ENOMEM; 110 return -ENOMEM;
111 111
112 hcd->rsrc_start = res.start; 112 hcd->rsrc_start = res.start;
113 hcd->rsrc_len = res.end - res.start + 1; 113 hcd->rsrc_len = resource_size(&res);
114 114
115 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 115 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
116 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); 116 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__);
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index 89e670e38c10..c0f595c44487 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -56,7 +56,7 @@ static int usb_hcd_ppc_soc_probe(const struct hc_driver *driver,
56 if (!hcd) 56 if (!hcd)
57 return -ENOMEM; 57 return -ENOMEM;
58 hcd->rsrc_start = res->start; 58 hcd->rsrc_start = res->start;
59 hcd->rsrc_len = res->end - res->start + 1; 59 hcd->rsrc_len = resource_size(res);
60 60
61 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 61 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
62 pr_debug("%s: request_mem_region failed\n", __FILE__); 62 pr_debug("%s: request_mem_region failed\n", __FILE__);
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index d8eb3bdafabb..4204d9720d23 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -131,7 +131,7 @@ int usb_hcd_sa1111_probe (const struct hc_driver *driver,
131 if (!hcd) 131 if (!hcd)
132 return -ENOMEM; 132 return -ENOMEM;
133 hcd->rsrc_start = dev->res.start; 133 hcd->rsrc_start = dev->res.start;
134 hcd->rsrc_len = dev->res.end - dev->res.start + 1; 134 hcd->rsrc_len = resource_size(&dev->res);
135 135
136 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 136 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
137 dbg("request_mem_region failed"); 137 dbg("request_mem_region failed");
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index 041d30f30c10..78918ca0da23 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -103,8 +103,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
103 goto err0; 103 goto err0;
104 } 104 }
105 105
106 if (!request_mem_region(mem->start, mem->end - mem->start + 1, 106 if (!request_mem_region(mem->start, resource_size(mem), pdev->name)) {
107 pdev->name)) {
108 dev_err(dev, "request_mem_region failed\n"); 107 dev_err(dev, "request_mem_region failed\n");
109 retval = -EBUSY; 108 retval = -EBUSY;
110 goto err0; 109 goto err0;
@@ -126,7 +125,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
126 125
127 if (!dma_declare_coherent_memory(dev, mem->start, 126 if (!dma_declare_coherent_memory(dev, mem->start,
128 mem->start - mem->parent->start, 127 mem->start - mem->parent->start,
129 (mem->end - mem->start) + 1, 128 resource_size(mem),
130 DMA_MEMORY_MAP | 129 DMA_MEMORY_MAP |
131 DMA_MEMORY_EXCLUSIVE)) { 130 DMA_MEMORY_EXCLUSIVE)) {
132 dev_err(dev, "cannot declare coherent memory\n"); 131 dev_err(dev, "cannot declare coherent memory\n");
@@ -149,7 +148,7 @@ static int ohci_hcd_sm501_drv_probe(struct platform_device *pdev)
149 } 148 }
150 149
151 hcd->rsrc_start = res->start; 150 hcd->rsrc_start = res->start;
152 hcd->rsrc_len = res->end - res->start + 1; 151 hcd->rsrc_len = resource_size(res);
153 152
154 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, pdev->name)) { 153 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, pdev->name)) {
155 dev_err(dev, "request_mem_region failed\n"); 154 dev_err(dev, "request_mem_region failed\n");
@@ -185,7 +184,7 @@ err3:
185err2: 184err2:
186 dma_release_declared_memory(dev); 185 dma_release_declared_memory(dev);
187err1: 186err1:
188 release_mem_region(mem->start, mem->end - mem->start + 1); 187 release_mem_region(mem->start, resource_size(mem));
189err0: 188err0:
190 return retval; 189 return retval;
191} 190}
@@ -201,7 +200,7 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev)
201 dma_release_declared_memory(&pdev->dev); 200 dma_release_declared_memory(&pdev->dev);
202 mem = platform_get_resource(pdev, IORESOURCE_MEM, 1); 201 mem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
203 if (mem) 202 if (mem)
204 release_mem_region(mem->start, mem->end - mem->start + 1); 203 release_mem_region(mem->start, resource_size(mem));
205 204
206 /* mask interrupts and disable power */ 205 /* mask interrupts and disable power */
207 206
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
index 48ee6943bf35..c4aea3b8315e 100644
--- a/drivers/usb/host/ohci-ssb.c
+++ b/drivers/usb/host/ohci-ssb.c
@@ -2,7 +2,7 @@
2 * Sonics Silicon Backplane 2 * Sonics Silicon Backplane
3 * Broadcom USB-core OHCI driver 3 * Broadcom USB-core OHCI driver
4 * 4 *
5 * Copyright 2007 Michael Buesch <mb@bu3sch.de> 5 * Copyright 2007 Michael Buesch <m@bues.ch>
6 * 6 *
7 * Derived from the OHCI-PCI driver 7 * Derived from the OHCI-PCI driver
8 * Copyright 1999 Roman Weissgaerber 8 * Copyright 1999 Roman Weissgaerber
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index 3558491dd87d..57ad1271fc9b 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -208,13 +208,13 @@ static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev)
208 } 208 }
209 209
210 hcd->rsrc_start = regs->start; 210 hcd->rsrc_start = regs->start;
211 hcd->rsrc_len = regs->end - regs->start + 1; 211 hcd->rsrc_len = resource_size(regs);
212 212
213 tmio = hcd_to_tmio(hcd); 213 tmio = hcd_to_tmio(hcd);
214 214
215 spin_lock_init(&tmio->lock); 215 spin_lock_init(&tmio->lock);
216 216
217 tmio->ccr = ioremap(config->start, config->end - config->start + 1); 217 tmio->ccr = ioremap(config->start, resource_size(config));
218 if (!tmio->ccr) { 218 if (!tmio->ccr) {
219 ret = -ENOMEM; 219 ret = -ENOMEM;
220 goto err_ioremap_ccr; 220 goto err_ioremap_ccr;
@@ -228,7 +228,7 @@ static int __devinit ohci_hcd_tmio_drv_probe(struct platform_device *dev)
228 228
229 if (!dma_declare_coherent_memory(&dev->dev, sram->start, 229 if (!dma_declare_coherent_memory(&dev->dev, sram->start,
230 sram->start, 230 sram->start,
231 sram->end - sram->start + 1, 231 resource_size(sram),
232 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE)) { 232 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE)) {
233 ret = -EBUSY; 233 ret = -EBUSY;
234 goto err_dma_declare; 234 goto err_dma_declare;
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c
index 5fbe997dc6df..dcd889803f0f 100644
--- a/drivers/usb/host/oxu210hp-hcd.c
+++ b/drivers/usb/host/oxu210hp-hcd.c
@@ -3828,7 +3828,7 @@ static int oxu_drv_probe(struct platform_device *pdev)
3828 return -ENODEV; 3828 return -ENODEV;
3829 } 3829 }
3830 memstart = res->start; 3830 memstart = res->start;
3831 memlen = res->end - res->start + 1; 3831 memlen = resource_size(res);
3832 dev_dbg(&pdev->dev, "MEM resource %lx-%lx\n", memstart, memlen); 3832 dev_dbg(&pdev->dev, "MEM resource %lx-%lx\n", memstart, memlen);
3833 if (!request_mem_region(memstart, memlen, 3833 if (!request_mem_region(memstart, memlen,
3834 oxu_hc_driver.description)) { 3834 oxu_hc_driver.description)) {
diff --git a/drivers/usb/host/uhci-grlib.c b/drivers/usb/host/uhci-grlib.c
index d01c1e227681..f7a62138e3e0 100644
--- a/drivers/usb/host/uhci-grlib.c
+++ b/drivers/usb/host/uhci-grlib.c
@@ -111,7 +111,7 @@ static int __devinit uhci_hcd_grlib_probe(struct platform_device *op)
111 return -ENOMEM; 111 return -ENOMEM;
112 112
113 hcd->rsrc_start = res.start; 113 hcd->rsrc_start = res.start;
114 hcd->rsrc_len = res.end - res.start + 1; 114 hcd->rsrc_len = resource_size(&res);
115 115
116 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 116 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
117 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__); 117 printk(KERN_ERR "%s: request_mem_region failed\n", __FILE__);
diff --git a/drivers/usb/host/whci/init.c b/drivers/usb/host/whci/init.c
index f7582e8e2169..d3e13b640d4b 100644
--- a/drivers/usb/host/whci/init.c
+++ b/drivers/usb/host/whci/init.c
@@ -178,7 +178,7 @@ void whc_clean_up(struct whc *whc)
178 if (whc->qset_pool) 178 if (whc->qset_pool)
179 dma_pool_destroy(whc->qset_pool); 179 dma_pool_destroy(whc->qset_pool);
180 180
181 len = whc->umc->resource.end - whc->umc->resource.start + 1; 181 len = resource_size(&whc->umc->resource);
182 if (whc->base) 182 if (whc->base)
183 iounmap(whc->base); 183 iounmap(whc->base);
184 if (whc->base_phys) 184 if (whc->base_phys)
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index b16bd3ce3915..2f41089cd854 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -187,7 +187,7 @@ struct usb_ftdi {
187 u32 controlreg; 187 u32 controlreg;
188 u8 response[4 + 1024]; 188 u8 response[4 + 1024];
189 int expected; 189 int expected;
190 int recieved; 190 int received;
191 int ed_found; 191 int ed_found;
192}; 192};
193#define kref_to_usb_ftdi(d) container_of(d, struct usb_ftdi, kref) 193#define kref_to_usb_ftdi(d) container_of(d, struct usb_ftdi, kref)
@@ -353,7 +353,7 @@ static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi)
353 mutex_lock(&ftdi->u132_lock); 353 mutex_lock(&ftdi->u132_lock);
354 } 354 }
355 } 355 }
356 ftdi->recieved = 0; 356 ftdi->received = 0;
357 ftdi->expected = 4; 357 ftdi->expected = 4;
358 ftdi->ed_found = 0; 358 ftdi->ed_found = 0;
359 mutex_unlock(&ftdi->u132_lock); 359 mutex_unlock(&ftdi->u132_lock);
@@ -411,7 +411,7 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi)
411 } 411 }
412 } 412 }
413 } 413 }
414 ftdi->recieved = 0; 414 ftdi->received = 0;
415 ftdi->expected = 4; 415 ftdi->expected = 4;
416 ftdi->ed_found = 0; 416 ftdi->ed_found = 0;
417 mutex_unlock(&ftdi->u132_lock); 417 mutex_unlock(&ftdi->u132_lock);
@@ -447,7 +447,7 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi)
447 } 447 }
448 } 448 }
449 } 449 }
450 ftdi->recieved = 0; 450 ftdi->received = 0;
451 ftdi->expected = 4; 451 ftdi->expected = 4;
452 ftdi->ed_found = 0; 452 ftdi->ed_found = 0;
453 mutex_unlock(&ftdi->u132_lock); 453 mutex_unlock(&ftdi->u132_lock);
@@ -874,7 +874,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
874 mutex_unlock(&ftdi->u132_lock); 874 mutex_unlock(&ftdi->u132_lock);
875 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 875 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
876 payload); 876 payload);
877 ftdi->recieved = 0; 877 ftdi->received = 0;
878 ftdi->expected = 4; 878 ftdi->expected = 4;
879 ftdi->ed_found = 0; 879 ftdi->ed_found = 0;
880 return ftdi->response; 880 return ftdi->response;
@@ -890,7 +890,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
890 mutex_unlock(&ftdi->u132_lock); 890 mutex_unlock(&ftdi->u132_lock);
891 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 891 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
892 payload); 892 payload);
893 ftdi->recieved = 0; 893 ftdi->received = 0;
894 ftdi->expected = 4; 894 ftdi->expected = 4;
895 ftdi->ed_found = 0; 895 ftdi->ed_found = 0;
896 return ftdi->response; 896 return ftdi->response;
@@ -905,7 +905,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
905 mutex_unlock(&ftdi->u132_lock); 905 mutex_unlock(&ftdi->u132_lock);
906 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 906 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
907 payload); 907 payload);
908 ftdi->recieved = 0; 908 ftdi->received = 0;
909 ftdi->expected = 4; 909 ftdi->expected = 4;
910 ftdi->ed_found = 0; 910 ftdi->ed_found = 0;
911 return ftdi->response; 911 return ftdi->response;
@@ -914,7 +914,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi,
914 mutex_unlock(&ftdi->u132_lock); 914 mutex_unlock(&ftdi->u132_lock);
915 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 915 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
916 payload); 916 payload);
917 ftdi->recieved = 0; 917 ftdi->received = 0;
918 ftdi->expected = 4; 918 ftdi->expected = 4;
919 ftdi->ed_found = 0; 919 ftdi->ed_found = 0;
920 return ftdi->response; 920 return ftdi->response;
@@ -934,7 +934,7 @@ static char *have_ed_get_response(struct usb_ftdi *ftdi,
934 if (target->active) 934 if (target->active)
935 ftdi_elan_do_callback(ftdi, target, NULL, 0); 935 ftdi_elan_do_callback(ftdi, target, NULL, 0);
936 target->abandoning = 0; 936 target->abandoning = 0;
937 ftdi->recieved = 0; 937 ftdi->received = 0;
938 ftdi->expected = 4; 938 ftdi->expected = 4;
939 ftdi->ed_found = 0; 939 ftdi->ed_found = 0;
940 return ftdi->response; 940 return ftdi->response;
@@ -951,7 +951,7 @@ static char *have_ed_get_response(struct usb_ftdi *ftdi,
951*/ 951*/
952static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi) 952static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
953{ 953{
954 u8 *b = ftdi->response + ftdi->recieved; 954 u8 *b = ftdi->response + ftdi->received;
955 int bytes_read = 0; 955 int bytes_read = 0;
956 int retry_on_empty = 1; 956 int retry_on_empty = 1;
957 int retry_on_timeout = 3; 957 int retry_on_timeout = 3;
@@ -1043,11 +1043,11 @@ static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
1043 u8 c = ftdi->bulk_in_buffer[++ftdi->bulk_in_last]; 1043 u8 c = ftdi->bulk_in_buffer[++ftdi->bulk_in_last];
1044 bytes_read += 1; 1044 bytes_read += 1;
1045 ftdi->bulk_in_left -= 1; 1045 ftdi->bulk_in_left -= 1;
1046 if (ftdi->recieved == 0 && c == 0xFF) { 1046 if (ftdi->received == 0 && c == 0xFF) {
1047 goto have; 1047 goto have;
1048 } else 1048 } else
1049 *b++ = c; 1049 *b++ = c;
1050 if (++ftdi->recieved < ftdi->expected) { 1050 if (++ftdi->received < ftdi->expected) {
1051 goto have; 1051 goto have;
1052 } else if (ftdi->ed_found) { 1052 } else if (ftdi->ed_found) {
1053 int ed_number = (ftdi->response[0] >> 5) & 0x03; 1053 int ed_number = (ftdi->response[0] >> 5) & 0x03;
@@ -1069,7 +1069,7 @@ static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
1069 } 1069 }
1070 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, 1070 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response,
1071 payload); 1071 payload);
1072 ftdi->recieved = 0; 1072 ftdi->received = 0;
1073 ftdi->expected = 4; 1073 ftdi->expected = 4;
1074 ftdi->ed_found = 0; 1074 ftdi->ed_found = 0;
1075 b = ftdi->response; 1075 b = ftdi->response;
@@ -1089,7 +1089,7 @@ static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
1089 *respond->value = data; 1089 *respond->value = data;
1090 *respond->result = 0; 1090 *respond->result = 0;
1091 complete(&respond->wait_completion); 1091 complete(&respond->wait_completion);
1092 ftdi->recieved = 0; 1092 ftdi->received = 0;
1093 ftdi->expected = 4; 1093 ftdi->expected = 4;
1094 ftdi->ed_found = 0; 1094 ftdi->ed_found = 0;
1095 b = ftdi->response; 1095 b = ftdi->response;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c71b0372786e..bcbd1aba961a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1955,7 +1955,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1955 * - initializes musb->xceiv, usually by otg_get_transceiver() 1955 * - initializes musb->xceiv, usually by otg_get_transceiver()
1956 * - stops powering VBUS 1956 * - stops powering VBUS
1957 * 1957 *
1958 * There are various transciever configurations. Blackfin, 1958 * There are various transceiver configurations. Blackfin,
1959 * DaVinci, TUSB60x0, and others integrate them. OMAP3 uses 1959 * DaVinci, TUSB60x0, and others integrate them. OMAP3 uses
1960 * external/discrete ones in various flavors (twl4030 family, 1960 * external/discrete ones in various flavors (twl4030 family,
1961 * isp1504, non-OTG, etc) mostly hooking up through ULPI. 1961 * isp1504, non-OTG, etc) mostly hooking up through ULPI.
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index 8c282258e1bd..ca9b690a7e40 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -660,7 +660,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
660 int ret = IRQ_NONE; 660 int ret = IRQ_NONE;
661 struct isp1301 *isp = _isp; 661 struct isp1301 *isp = _isp;
662 662
663 /* update ISP1301 transciever from OTG controller */ 663 /* update ISP1301 transceiver from OTG controller */
664 if (otg_irq & OPRT_CHG) { 664 if (otg_irq & OPRT_CHG) {
665 omap_writew(OPRT_CHG, OTG_IRQ_SRC); 665 omap_writew(OPRT_CHG, OTG_IRQ_SRC);
666 isp1301_defer_work(isp, WORK_UPDATE_ISP); 666 isp1301_defer_work(isp, WORK_UPDATE_ISP);
@@ -755,7 +755,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
755 omap_writew(A_VBUS_ERR, OTG_IRQ_SRC); 755 omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
756 ret = IRQ_HANDLED; 756 ret = IRQ_HANDLED;
757 757
758 /* switch driver; the transciever code activates it, 758 /* switch driver; the transceiver code activates it,
759 * ungating the udc clock or resuming OHCI. 759 * ungating the udc clock or resuming OHCI.
760 */ 760 */
761 } else if (otg_irq & DRIVER_SWITCH) { 761 } else if (otg_irq & DRIVER_SWITCH) {
diff --git a/drivers/usb/otg/otg_fsm.c b/drivers/usb/otg/otg_fsm.c
index b0cc422f2ff9..09117387d2a4 100644
--- a/drivers/usb/otg/otg_fsm.c
+++ b/drivers/usb/otg/otg_fsm.c
@@ -28,7 +28,6 @@
28#include <linux/usb.h> 28#include <linux/usb.h>
29#include <linux/usb/gadget.h> 29#include <linux/usb/gadget.h>
30#include <linux/usb/otg.h> 30#include <linux/usb/otg.h>
31#include <linux/types.h>
32 31
33#include "otg_fsm.h" 32#include "otg_fsm.h"
34 33
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index efeb4d1517ff..14f66c358629 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -166,7 +166,7 @@ struct twl4030_usb {
166}; 166};
167 167
168/* internal define on top of container_of */ 168/* internal define on top of container_of */
169#define xceiv_to_twl(x) container_of((x), struct twl4030_usb, otg); 169#define xceiv_to_twl(x) container_of((x), struct twl4030_usb, otg)
170 170
171/*-------------------------------------------------------------------------*/ 171/*-------------------------------------------------------------------------*/
172 172
diff --git a/drivers/uwb/uwbd.c b/drivers/uwb/uwbd.c
index 001c8b4020a8..bdcb13cc1d54 100644
--- a/drivers/uwb/uwbd.c
+++ b/drivers/uwb/uwbd.c
@@ -256,7 +256,7 @@ static void uwbd_event_handle(struct uwb_event *evt)
256 * UWB Daemon 256 * UWB Daemon
257 * 257 *
258 * Listens to all UWB notifications and takes care to track the state 258 * Listens to all UWB notifications and takes care to track the state
259 * of the UWB neighboorhood for the kernel. When we do a run, we 259 * of the UWB neighbourhood for the kernel. When we do a run, we
260 * spinlock, move the list to a private copy and release the 260 * spinlock, move the list to a private copy and release the
261 * lock. Hold it as little as possible. Not a conflict: it is 261 * lock. Hold it as little as possible. Not a conflict: it is
262 * guaranteed we own the events in the private list. 262 * guaranteed we own the events in the private list.
diff --git a/drivers/uwb/whc-rc.c b/drivers/uwb/whc-rc.c
index 70a004aa19db..3ae3c702500d 100644
--- a/drivers/uwb/whc-rc.c
+++ b/drivers/uwb/whc-rc.c
@@ -222,7 +222,7 @@ int whcrc_setup_rc_umc(struct whcrc *whcrc)
222 struct umc_dev *umc_dev = whcrc->umc_dev; 222 struct umc_dev *umc_dev = whcrc->umc_dev;
223 223
224 whcrc->area = umc_dev->resource.start; 224 whcrc->area = umc_dev->resource.start;
225 whcrc->rc_len = umc_dev->resource.end - umc_dev->resource.start + 1; 225 whcrc->rc_len = resource_size(&umc_dev->resource);
226 result = -EBUSY; 226 result = -EBUSY;
227 if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) { 227 if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) {
228 dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n", 228 dev_err(dev, "can't request URC region (%zu bytes @ 0x%lx): %d\n",
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 4484c721f0f9..817ab60f7537 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -906,7 +906,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
906 if (map) { 906 if (map) {
907 /* use a pre-allocated memory buffer */ 907 /* use a pre-allocated memory buffer */
908 info->fix.smem_start = map->start; 908 info->fix.smem_start = map->start;
909 info->fix.smem_len = map->end - map->start + 1; 909 info->fix.smem_len = resource_size(map);
910 if (!request_mem_region(info->fix.smem_start, 910 if (!request_mem_region(info->fix.smem_start,
911 info->fix.smem_len, pdev->name)) { 911 info->fix.smem_len, pdev->name)) {
912 ret = -EBUSY; 912 ret = -EBUSY;
@@ -932,7 +932,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
932 932
933 /* LCDC registers */ 933 /* LCDC registers */
934 info->fix.mmio_start = regs->start; 934 info->fix.mmio_start = regs->start;
935 info->fix.mmio_len = regs->end - regs->start + 1; 935 info->fix.mmio_len = resource_size(regs);
936 936
937 if (!request_mem_region(info->fix.mmio_start, 937 if (!request_mem_region(info->fix.mmio_start,
938 info->fix.mmio_len, pdev->name)) { 938 info->fix.mmio_len, pdev->name)) {
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index d7aaec5667bf..44bdce4242ad 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -3458,9 +3458,10 @@ static int __devinit atyfb_setup_generic(struct pci_dev *pdev,
3458 3458
3459 raddr = addr + 0x7ff000UL; 3459 raddr = addr + 0x7ff000UL;
3460 rrp = &pdev->resource[2]; 3460 rrp = &pdev->resource[2];
3461 if ((rrp->flags & IORESOURCE_MEM) && request_mem_region(rrp->start, rrp->end - rrp->start + 1, "atyfb")) { 3461 if ((rrp->flags & IORESOURCE_MEM) &&
3462 request_mem_region(rrp->start, resource_size(rrp), "atyfb")) {
3462 par->aux_start = rrp->start; 3463 par->aux_start = rrp->start;
3463 par->aux_size = rrp->end - rrp->start + 1; 3464 par->aux_size = resource_size(rrp);
3464 raddr = rrp->start; 3465 raddr = rrp->start;
3465 PRINTKI("using auxiliary register aperture\n"); 3466 PRINTKI("using auxiliary register aperture\n");
3466 } 3467 }
@@ -3550,7 +3551,7 @@ static int __devinit atyfb_pci_probe(struct pci_dev *pdev,
3550 3551
3551 /* Reserve space */ 3552 /* Reserve space */
3552 res_start = rp->start; 3553 res_start = rp->start;
3553 res_size = rp->end - rp->start + 1; 3554 res_size = resource_size(rp);
3554 if (!request_mem_region(res_start, res_size, "atyfb")) 3555 if (!request_mem_region(res_start, res_size, "atyfb"))
3555 return -EBUSY; 3556 return -EBUSY;
3556 3557
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 34b2fc472fe8..01a8fde67f20 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -486,7 +486,7 @@ static int __devinit au1100fb_drv_probe(struct platform_device *dev)
486 } 486 }
487 487
488 au1100fb_fix.mmio_start = regs_res->start; 488 au1100fb_fix.mmio_start = regs_res->start;
489 au1100fb_fix.mmio_len = regs_res->end - regs_res->start + 1; 489 au1100fb_fix.mmio_len = resource_size(regs_res);
490 490
491 if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len, 491 if (!request_mem_region(au1100fb_fix.mmio_start, au1100fb_fix.mmio_len,
492 DRIVER_NAME)) { 492 DRIVER_NAME)) {
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/cobalt_lcdfb.c
index 42fe155aba0e..e02764319ff7 100644
--- a/drivers/video/cobalt_lcdfb.c
+++ b/drivers/video/cobalt_lcdfb.c
@@ -303,7 +303,7 @@ static int __devinit cobalt_lcdfb_probe(struct platform_device *dev)
303 return -EBUSY; 303 return -EBUSY;
304 } 304 }
305 305
306 info->screen_size = res->end - res->start + 1; 306 info->screen_size = resource_size(res);
307 info->screen_base = ioremap(res->start, info->screen_size); 307 info->screen_base = ioremap(res->start, info->screen_size);
308 info->fbops = &cobalt_lcd_fbops; 308 info->fbops = &cobalt_lcd_fbops;
309 info->fix = cobalt_lcdfb_fix; 309 info->fix = cobalt_lcdfb_fix;
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c
index c225dcce89e7..9075bea55879 100644
--- a/drivers/video/controlfb.c
+++ b/drivers/video/controlfb.c
@@ -709,11 +709,11 @@ static int __init control_of_init(struct device_node *dp)
709 709
710 /* Map in frame buffer and registers */ 710 /* Map in frame buffer and registers */
711 p->fb_orig_base = fb_res.start; 711 p->fb_orig_base = fb_res.start;
712 p->fb_orig_size = fb_res.end - fb_res.start + 1; 712 p->fb_orig_size = resource_size(&fb_res);
713 /* use the big-endian aperture (??) */ 713 /* use the big-endian aperture (??) */
714 p->frame_buffer_phys = fb_res.start + 0x800000; 714 p->frame_buffer_phys = fb_res.start + 0x800000;
715 p->control_regs_phys = reg_res.start; 715 p->control_regs_phys = reg_res.start;
716 p->control_regs_size = reg_res.end - reg_res.start + 1; 716 p->control_regs_size = resource_size(&reg_res);
717 717
718 if (!p->fb_orig_base || 718 if (!p->fb_orig_base ||
719 !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { 719 !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) {
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c
index cbdb1bd77c21..40e5f17d1e4b 100644
--- a/drivers/video/ep93xx-fb.c
+++ b/drivers/video/ep93xx-fb.c
@@ -4,7 +4,7 @@
4 * Framebuffer support for the EP93xx series. 4 * Framebuffer support for the EP93xx series.
5 * 5 *
6 * Copyright (C) 2007 Bluewater Systems Ltd 6 * Copyright (C) 2007 Bluewater Systems Ltd
7 * Author: Ryan Mallon <ryan@bluewatersys.com> 7 * Author: Ryan Mallon
8 * 8 *
9 * Copyright (c) 2009 H Hartley Sweeten <hsweeten@visionengravers.com> 9 * Copyright (c) 2009 H Hartley Sweeten <hsweeten@visionengravers.com>
10 * 10 *
@@ -644,6 +644,6 @@ module_exit(ep93xxfb_exit);
644 644
645MODULE_DESCRIPTION("EP93XX Framebuffer Driver"); 645MODULE_DESCRIPTION("EP93XX Framebuffer Driver");
646MODULE_ALIAS("platform:ep93xx-fb"); 646MODULE_ALIAS("platform:ep93xx-fb");
647MODULE_AUTHOR("Ryan Mallon <ryan&bluewatersys.com>, " 647MODULE_AUTHOR("Ryan Mallon, "
648 "H Hartley Sweeten <hsweeten@visionengravers.com"); 648 "H Hartley Sweeten <hsweeten@visionengravers.com");
649MODULE_LICENSE("GPL"); 649MODULE_LICENSE("GPL");
diff --git a/drivers/video/i810/i810.h b/drivers/video/i810/i810.h
index f37de60ecc59..1414b73ac55b 100644
--- a/drivers/video/i810/i810.h
+++ b/drivers/video/i810/i810.h
@@ -137,7 +137,7 @@
137#define DRAM_ON 0x08 137#define DRAM_ON 0x08
138#define DRAM_OFF 0xE7 138#define DRAM_OFF 0xE7
139#define PG_ENABLE_MASK 0x01 139#define PG_ENABLE_MASK 0x01
140#define RING_SIZE_MASK (RINGBUFFER_SIZE - 1); 140#define RING_SIZE_MASK (RINGBUFFER_SIZE - 1)
141 141
142/* defines for restoring registers partially */ 142/* defines for restoring registers partially */
143#define ADDR_MAP_MASK (0x07 << 5) 143#define ADDR_MAP_MASK (0x07 << 5)
diff --git a/drivers/video/mb862xx/mb862xxfbdrv.c b/drivers/video/mb862xx/mb862xxfbdrv.c
index f70bd63b0187..ee1de3e26dec 100644
--- a/drivers/video/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/mb862xx/mb862xxfbdrv.c
@@ -697,7 +697,7 @@ static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev)
697 goto fbrel; 697 goto fbrel;
698 } 698 }
699 699
700 res_size = 1 + res.end - res.start; 700 res_size = resource_size(&res);
701 par->res = request_mem_region(res.start, res_size, DRV_NAME); 701 par->res = request_mem_region(res.start, res_size, DRV_NAME);
702 if (par->res == NULL) { 702 if (par->res == NULL) {
703 dev_err(dev, "Cannot claim framebuffer/mmio\n"); 703 dev_err(dev, "Cannot claim framebuffer/mmio\n");
@@ -787,7 +787,7 @@ static int __devexit of_platform_mb862xx_remove(struct platform_device *ofdev)
787{ 787{
788 struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); 788 struct fb_info *fbi = dev_get_drvdata(&ofdev->dev);
789 struct mb862xxfb_par *par = fbi->par; 789 struct mb862xxfb_par *par = fbi->par;
790 resource_size_t res_size = 1 + par->res->end - par->res->start; 790 resource_size_t res_size = resource_size(par->res);
791 unsigned long reg; 791 unsigned long reg;
792 792
793 dev_dbg(fbi->dev, "%s release\n", fbi->fix.id); 793 dev_dbg(fbi->dev, "%s release\n", fbi->fix.id);
diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c
index c3636d55a3c5..243d16f09b8a 100644
--- a/drivers/video/msm/mdp.c
+++ b/drivers/video/msm/mdp.c
@@ -406,8 +406,7 @@ int mdp_probe(struct platform_device *pdev)
406 goto error_get_irq; 406 goto error_get_irq;
407 } 407 }
408 408
409 mdp->base = ioremap(resource->start, 409 mdp->base = ioremap(resource->start, resource_size(resource));
410 resource->end - resource->start);
411 if (mdp->base == 0) { 410 if (mdp->base == 0) {
412 printk(KERN_ERR "msmfb: cannot allocate mdp regs!\n"); 411 printk(KERN_ERR "msmfb: cannot allocate mdp regs!\n");
413 ret = -ENOMEM; 412 ret = -ENOMEM;
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
index ec351309e607..c6e3b4fcdd68 100644
--- a/drivers/video/msm/msm_fb.c
+++ b/drivers/video/msm/msm_fb.c
@@ -525,10 +525,9 @@ static int setup_fbmem(struct msmfb_info *msmfb, struct platform_device *pdev)
525 return -ENOMEM; 525 return -ENOMEM;
526 } 526 }
527 fb->fix.smem_start = resource->start; 527 fb->fix.smem_start = resource->start;
528 fb->fix.smem_len = resource->end - resource->start; 528 fb->fix.smem_len = resource_size(resource);
529 fbram = ioremap(resource->start, 529 fbram = ioremap(resource->start, resource_size(resource));
530 resource->end - resource->start); 530 if (fbram == NULL) {
531 if (fbram == 0) {
532 printk(KERN_ERR "msmfb: cannot allocate fbram!\n"); 531 printk(KERN_ERR "msmfb: cannot allocate fbram!\n");
533 return -ENOMEM; 532 return -ENOMEM;
534 } 533 }
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c
index f838d9e277f0..0fff59782e45 100644
--- a/drivers/video/nuc900fb.c
+++ b/drivers/video/nuc900fb.c
@@ -551,7 +551,7 @@ static int __devinit nuc900fb_probe(struct platform_device *pdev)
551 551
552 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 552 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
553 553
554 size = (res->end - res->start) + 1; 554 size = resource_size(res);
555 fbi->mem = request_mem_region(res->start, size, pdev->name); 555 fbi->mem = request_mem_region(res->start, size, pdev->name);
556 if (fbi->mem == NULL) { 556 if (fbi->mem == NULL) {
557 dev_err(&pdev->dev, "failed to alloc memory region\n"); 557 dev_err(&pdev->dev, "failed to alloc memory region\n");
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index ef532d9d3c99..f27ae16ead2e 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -567,7 +567,7 @@ static int __devinit platinumfb_probe(struct platform_device* odev)
567 * northbridge and that can fail. Only request framebuffer 567 * northbridge and that can fail. Only request framebuffer
568 */ 568 */
569 if (!request_mem_region(pinfo->rsrc_fb.start, 569 if (!request_mem_region(pinfo->rsrc_fb.start,
570 pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1, 570 resource_size(&pinfo->rsrc_fb),
571 "platinumfb framebuffer")) { 571 "platinumfb framebuffer")) {
572 printk(KERN_ERR "platinumfb: Can't request framebuffer !\n"); 572 printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
573 framebuffer_release(info); 573 framebuffer_release(info);
@@ -658,8 +658,7 @@ static int __devexit platinumfb_remove(struct platform_device* odev)
658 iounmap(pinfo->cmap_regs); 658 iounmap(pinfo->cmap_regs);
659 659
660 release_mem_region(pinfo->rsrc_fb.start, 660 release_mem_region(pinfo->rsrc_fb.start,
661 pinfo->rsrc_fb.end - 661 resource_size(&pinfo->rsrc_fb));
662 pinfo->rsrc_fb.start + 1);
663 662
664 release_mem_region(pinfo->cmap_regs_phys, 0x1000); 663 release_mem_region(pinfo->cmap_regs_phys, 0x1000);
665 664
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c
index bb95ec56d25d..18ead6f0184d 100644
--- a/drivers/video/pxa168fb.c
+++ b/drivers/video/pxa168fb.c
@@ -662,7 +662,7 @@ static int __devinit pxa168fb_probe(struct platform_device *pdev)
662 info->fix.ypanstep = 0; 662 info->fix.ypanstep = 0;
663 info->fix.ywrapstep = 0; 663 info->fix.ywrapstep = 0;
664 info->fix.mmio_start = res->start; 664 info->fix.mmio_start = res->start;
665 info->fix.mmio_len = res->end - res->start + 1; 665 info->fix.mmio_len = resource_size(res);
666 info->fix.accel = FB_ACCEL_NONE; 666 info->fix.accel = FB_ACCEL_NONE;
667 info->fbops = &pxa168fb_ops; 667 info->fbops = &pxa168fb_ops;
668 info->pseudo_palette = fbi->pseudo_palette; 668 info->pseudo_palette = fbi->pseudo_palette;
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
index 816a4fda04f5..087fc9960bb9 100644
--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -29,7 +29,6 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/prefetch.h> 30#include <linux/prefetch.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/prefetch.h>
33#include <video/udlfb.h> 32#include <video/udlfb.h>
34#include "edid.h" 33#include "edid.h"
35 34
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index cf43c80d27f6..53aa4430d86e 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2016,7 +2016,7 @@ static int __init viafb_setup(void)
2016int __init viafb_init(void) 2016int __init viafb_init(void)
2017{ 2017{
2018 u32 dummy_x, dummy_y; 2018 u32 dummy_x, dummy_y;
2019 int r; 2019 int r = 0;
2020 2020
2021 if (machine_is_olpc()) 2021 if (machine_is_olpc())
2022 /* Apply XO-1.5-specific configuration. */ 2022 /* Apply XO-1.5-specific configuration. */
@@ -2039,7 +2039,7 @@ int __init viafb_init(void)
2039 printk(KERN_INFO 2039 printk(KERN_INFO
2040 "VIA Graphics Integration Chipset framebuffer %d.%d initializing\n", 2040 "VIA Graphics Integration Chipset framebuffer %d.%d initializing\n",
2041 VERSION_MAJOR, VERSION_MINOR); 2041 VERSION_MAJOR, VERSION_MINOR);
2042 return 0; 2042 return r;
2043} 2043}
2044 2044
2045void __exit viafb_exit(void) 2045void __exit viafb_exit(void)