aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/pata_hpt37x.c2
-rw-r--r--drivers/base/node.c5
-rw-r--r--drivers/block/DAC960.c10
-rw-r--r--drivers/block/amiflop.c2
-rw-r--r--drivers/block/aoe/aoeblk.c2
-rw-r--r--drivers/block/ataflop.c2
-rw-r--r--drivers/block/brd.c2
-rw-r--r--drivers/block/cciss.c2
-rw-r--r--drivers/block/cpqarray.c2
-rw-r--r--drivers/block/floppy.c2
-rw-r--r--drivers/block/hd.c2
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/mg_disk.c2
-rw-r--r--drivers/block/nbd.c2
-rw-r--r--drivers/block/osdblk.c2
-rw-r--r--drivers/block/paride/pcd.c2
-rw-r--r--drivers/block/paride/pd.c2
-rw-r--r--drivers/block/paride/pf.c2
-rw-r--r--drivers/block/pktcdvd.c2
-rw-r--r--drivers/block/ps3disk.c2
-rw-r--r--drivers/block/ps3vram.c2
-rw-r--r--drivers/block/sunvdc.c2
-rw-r--r--drivers/block/swim.c2
-rw-r--r--drivers/block/swim3.c4
-rw-r--r--drivers/block/sx8.c2
-rw-r--r--drivers/block/ub.c2
-rw-r--r--drivers/block/umem.c3
-rw-r--r--drivers/block/viodasd.c2
-rw-r--r--drivers/block/virtio_blk.c2
-rw-r--r--drivers/block/xd.c2
-rw-r--r--drivers/block/xen-blkfront.c4
-rw-r--r--drivers/block/xsysace.c2
-rw-r--r--drivers/block/z2ram.c3
-rw-r--r--drivers/cdrom/gdrom.c2
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/char/agp/backend.c4
-rw-r--r--drivers/char/agp/uninorth-agp.c2
-rw-r--r--drivers/char/epca.c2
-rw-r--r--drivers/char/ipmi/ipmi_poweroff.c4
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c2
-rw-r--r--drivers/cpuidle/governors/menu.c271
-rw-r--r--drivers/edac/edac_core.h2
-rw-r--r--drivers/firmware/memmap.c2
-rw-r--r--drivers/gpio/bt8xxgpio.c4
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c2
-rw-r--r--drivers/gpu/drm/mga/mga_state.c4
-rw-r--r--drivers/hid/Kconfig7
-rw-r--r--drivers/hid/hid-core.c14
-rw-r--r--drivers/hid/usbhid/hid-core.c16
-rw-r--r--drivers/hwmon/adm1021.c79
-rw-r--r--drivers/hwmon/applesmc.c38
-rw-r--r--drivers/hwmon/coretemp.c4
-rw-r--r--drivers/hwmon/lis3lv02d.c9
-rw-r--r--drivers/hwmon/lis3lv02d.h24
-rw-r--r--drivers/hwmon/lis3lv02d_spi.c45
-rw-r--r--drivers/hwmon/sht15.c6
-rw-r--r--drivers/ide/ide-cd.c2
-rw-r--r--drivers/ide/ide-gd.c2
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/ide-tape.c2
-rw-r--r--drivers/ide/umc8672.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba6110.c2
-rw-r--r--drivers/input/keyboard/atkbd.c2
-rw-r--r--drivers/input/misc/Kconfig16
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/winbond-cir.c1614
-rw-r--r--drivers/isdn/capi/capifs.c2
-rw-r--r--drivers/isdn/capi/capiutil.c2
-rw-r--r--drivers/isdn/i4l/isdn_common.c4
-rw-r--r--drivers/lguest/page_tables.c2
-rw-r--r--drivers/macintosh/rack-meter.c2
-rw-r--r--drivers/md/dm.c4
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/md/md.h2
-rw-r--r--drivers/md/multipath.c3
-rw-r--r--drivers/media/dvb/pt1/pt1.c1
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c2
-rw-r--r--drivers/media/dvb/siano/smscoreapi.h4
-rw-r--r--drivers/media/radio/radio-mr800.c2
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c4
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c4
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c4
-rw-r--r--drivers/media/video/cx88/cx88-video.c4
-rw-r--r--drivers/media/video/gspca/m5602/m5602_core.c2
-rw-r--r--drivers/memstick/core/mspro_block.c2
-rw-r--r--drivers/message/fusion/mptbase.c4
-rw-r--r--drivers/message/i2o/i2o_block.c2
-rw-r--r--drivers/mfd/ab3100-core.c2
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c2
-rw-r--r--drivers/mmc/card/block.c2
-rw-r--r--drivers/mmc/host/mxcmmc.c2
-rw-r--r--drivers/mtd/devices/m25p80.c4
-rw-r--r--drivers/mtd/devices/slram.c2
-rw-r--r--drivers/mtd/ftl.c2
-rw-r--r--drivers/mtd/maps/ixp2000.c2
-rw-r--r--drivers/mtd/mtd_blkdevs.c2
-rw-r--r--drivers/mtd/nand/cafe_nand.c4
-rw-r--r--drivers/mtd/nand/cmx270_nand.c4
-rw-r--r--drivers/mtd/ubi/eba.c2
-rw-r--r--drivers/mtd/ubi/ubi.h2
-rw-r--r--drivers/net/arcnet/arc-rawmode.c1
-rw-r--r--drivers/net/arcnet/capmode.c1
-rw-r--r--drivers/net/bnx2x_reg.h2
-rw-r--r--drivers/net/bonding/bond_3ad.c2
-rw-r--r--drivers/net/e1000/e1000_hw.c2
-rw-r--r--drivers/net/gianfar_ethtool.c2
-rw-r--r--drivers/net/ibm_newemac/core.c8
-rw-r--r--drivers/net/igb/igb_main.c2
-rw-r--r--drivers/net/ll_temac_main.c2
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/ni52.c4
-rw-r--r--drivers/net/qlge/qlge_main.c4
-rw-r--r--drivers/net/rionet.c2
-rw-r--r--drivers/net/skfp/pcmplc.c2
-rw-r--r--drivers/net/skfp/pmf.c8
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/sky2.c2
-rw-r--r--drivers/net/vxge/vxge-config.h2
-rw-r--r--drivers/net/vxge/vxge-main.c2
-rw-r--r--drivers/net/wireless/ath/ath5k/reg.h2
-rw-r--r--drivers/net/wireless/atmel.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c2
-rw-r--r--drivers/oprofile/oprofilefs.c2
-rw-r--r--drivers/parisc/ccio-dma.c4
-rw-r--r--drivers/parisc/sba_iommu.c4
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c36
-rw-r--r--drivers/pcmcia/sa1100_jornada720.c156
-rw-r--r--drivers/pcmcia/yenta_socket.c2
-rw-r--r--drivers/pnp/driver.c10
-rw-r--r--drivers/rtc/rtc-omap.c2
-rw-r--r--drivers/s390/block/dasd.c2
-rw-r--r--drivers/s390/block/dasd_eckd.c2
-rw-r--r--drivers/s390/block/dasd_int.h2
-rw-r--r--drivers/s390/block/dcssblk.c2
-rw-r--r--drivers/s390/block/xpram.c2
-rw-r--r--drivers/s390/char/tape_block.c2
-rw-r--r--drivers/s390/net/netiucv.c2
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c2
-rw-r--r--drivers/sbus/char/jsflash.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c2
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c4
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--drivers/scsi/sr.c2
-rw-r--r--drivers/spi/omap_uwire.c2
-rw-r--r--drivers/spi/spi_s3c24xx.c2
-rw-r--r--drivers/staging/rt2860/rtmp.h2
-rw-r--r--drivers/usb/class/cdc-wdm.c2
-rw-r--r--drivers/usb/core/inode.c3
-rw-r--r--drivers/usb/gadget/inode.c2
-rw-r--r--drivers/usb/host/ehci-pci.c2
-rw-r--r--drivers/usb/host/ehci.h2
-rw-r--r--drivers/usb/host/ohci-q.c2
-rw-r--r--drivers/usb/host/xhci.h2
-rw-r--r--drivers/usb/serial/cypress_m8.h2
-rw-r--r--drivers/usb/serial/io_edgeport.c2
-rw-r--r--drivers/usb/serial/kl5kusb105.c2
-rw-r--r--drivers/usb/serial/spcp8x5.c2
-rw-r--r--drivers/usb/wusbcore/wa-hc.h2
-rw-r--r--drivers/uwb/i1480/i1480u-wlp/netdev.c2
-rw-r--r--drivers/video/cfbcopyarea.c2
-rw-r--r--drivers/video/imxfb.c2
-rw-r--r--drivers/video/omap/lcd_h3.c4
-rw-r--r--drivers/video/omap/lcd_h4.c4
-rw-r--r--drivers/video/omap/lcd_inn1510.c4
-rw-r--r--drivers/video/omap/lcd_inn1610.c4
-rw-r--r--drivers/video/omap/lcd_osk.c4
-rw-r--r--drivers/video/omap/lcd_palmte.c4
-rw-r--r--drivers/video/omap/lcd_palmtt.c4
-rw-r--r--drivers/video/omap/lcd_palmz71.c4
-rw-r--r--drivers/video/s3c2410fb.c2
-rw-r--r--drivers/xen/balloon.c6
174 files changed, 2345 insertions, 407 deletions
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 122c786449a9..d0a7df2e5ca7 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -624,7 +624,7 @@ static struct ata_port_operations hpt374_fn1_port_ops = {
624}; 624};
625 625
626/** 626/**
627 * htp37x_clock_slot - Turn timing to PC clock entry 627 * hpt37x_clock_slot - Turn timing to PC clock entry
628 * @freq: Reported frequency timing 628 * @freq: Reported frequency timing
629 * @base: Base timing 629 * @base: Base timing
630 * 630 *
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 91d4087b4039..1fe5536d404f 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -85,6 +85,8 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
85 "Node %d FilePages: %8lu kB\n" 85 "Node %d FilePages: %8lu kB\n"
86 "Node %d Mapped: %8lu kB\n" 86 "Node %d Mapped: %8lu kB\n"
87 "Node %d AnonPages: %8lu kB\n" 87 "Node %d AnonPages: %8lu kB\n"
88 "Node %d Shmem: %8lu kB\n"
89 "Node %d KernelStack: %8lu kB\n"
88 "Node %d PageTables: %8lu kB\n" 90 "Node %d PageTables: %8lu kB\n"
89 "Node %d NFS_Unstable: %8lu kB\n" 91 "Node %d NFS_Unstable: %8lu kB\n"
90 "Node %d Bounce: %8lu kB\n" 92 "Node %d Bounce: %8lu kB\n"
@@ -116,6 +118,9 @@ static ssize_t node_read_meminfo(struct sys_device * dev,
116 nid, K(node_page_state(nid, NR_FILE_PAGES)), 118 nid, K(node_page_state(nid, NR_FILE_PAGES)),
117 nid, K(node_page_state(nid, NR_FILE_MAPPED)), 119 nid, K(node_page_state(nid, NR_FILE_MAPPED)),
118 nid, K(node_page_state(nid, NR_ANON_PAGES)), 120 nid, K(node_page_state(nid, NR_ANON_PAGES)),
121 nid, K(node_page_state(nid, NR_SHMEM)),
122 nid, node_page_state(nid, NR_KERNEL_STACK) *
123 THREAD_SIZE / 1024,
119 nid, K(node_page_state(nid, NR_PAGETABLE)), 124 nid, K(node_page_state(nid, NR_PAGETABLE)),
120 nid, K(node_page_state(nid, NR_UNSTABLE_NFS)), 125 nid, K(node_page_state(nid, NR_UNSTABLE_NFS)),
121 nid, K(node_page_state(nid, NR_BOUNCE)), 126 nid, K(node_page_state(nid, NR_BOUNCE)),
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 1e6b7c14f697..c77b6f3c28ea 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -152,7 +152,7 @@ static int DAC960_revalidate_disk(struct gendisk *disk)
152 return 0; 152 return 0;
153} 153}
154 154
155static struct block_device_operations DAC960_BlockDeviceOperations = { 155static const struct block_device_operations DAC960_BlockDeviceOperations = {
156 .owner = THIS_MODULE, 156 .owner = THIS_MODULE,
157 .open = DAC960_open, 157 .open = DAC960_open,
158 .getgeo = DAC960_getgeo, 158 .getgeo = DAC960_getgeo,
@@ -6653,7 +6653,7 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
6653 else ErrorCode = get_user(ControllerNumber, 6653 else ErrorCode = get_user(ControllerNumber,
6654 &UserSpaceControllerInfo->ControllerNumber); 6654 &UserSpaceControllerInfo->ControllerNumber);
6655 if (ErrorCode != 0) 6655 if (ErrorCode != 0)
6656 break;; 6656 break;
6657 ErrorCode = -ENXIO; 6657 ErrorCode = -ENXIO;
6658 if (ControllerNumber < 0 || 6658 if (ControllerNumber < 0 ||
6659 ControllerNumber > DAC960_ControllerCount - 1) { 6659 ControllerNumber > DAC960_ControllerCount - 1) {
@@ -6661,7 +6661,7 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request,
6661 } 6661 }
6662 Controller = DAC960_Controllers[ControllerNumber]; 6662 Controller = DAC960_Controllers[ControllerNumber];
6663 if (Controller == NULL) 6663 if (Controller == NULL)
6664 break;; 6664 break;
6665 memset(&ControllerInfo, 0, sizeof(DAC960_ControllerInfo_T)); 6665 memset(&ControllerInfo, 0, sizeof(DAC960_ControllerInfo_T));
6666 ControllerInfo.ControllerNumber = ControllerNumber; 6666 ControllerInfo.ControllerNumber = ControllerNumber;
6667 ControllerInfo.FirmwareType = Controller->FirmwareType; 6667 ControllerInfo.FirmwareType = Controller->FirmwareType;
@@ -7210,7 +7210,7 @@ static struct pci_driver DAC960_pci_driver = {
7210 .remove = DAC960_Remove, 7210 .remove = DAC960_Remove,
7211}; 7211};
7212 7212
7213static int DAC960_init_module(void) 7213static int __init DAC960_init_module(void)
7214{ 7214{
7215 int ret; 7215 int ret;
7216 7216
@@ -7222,7 +7222,7 @@ static int DAC960_init_module(void)
7222 return ret; 7222 return ret;
7223} 7223}
7224 7224
7225static void DAC960_cleanup_module(void) 7225static void __exit DAC960_cleanup_module(void)
7226{ 7226{
7227 int i; 7227 int i;
7228 7228
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 2f07b7c99a95..055225839024 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1632,7 +1632,7 @@ static int amiga_floppy_change(struct gendisk *disk)
1632 return 0; 1632 return 0;
1633} 1633}
1634 1634
1635static struct block_device_operations floppy_fops = { 1635static const struct block_device_operations floppy_fops = {
1636 .owner = THIS_MODULE, 1636 .owner = THIS_MODULE,
1637 .open = floppy_open, 1637 .open = floppy_open,
1638 .release = floppy_release, 1638 .release = floppy_release,
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index b6cd571adbf2..3af97d4da2db 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -237,7 +237,7 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
237 return 0; 237 return 0;
238} 238}
239 239
240static struct block_device_operations aoe_bdops = { 240static const struct block_device_operations aoe_bdops = {
241 .open = aoeblk_open, 241 .open = aoeblk_open,
242 .release = aoeblk_release, 242 .release = aoeblk_release,
243 .getgeo = aoeblk_getgeo, 243 .getgeo = aoeblk_getgeo,
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 3ff02941b3dd..847a9e57570a 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1856,7 +1856,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode)
1856 return 0; 1856 return 0;
1857} 1857}
1858 1858
1859static struct block_device_operations floppy_fops = { 1859static const struct block_device_operations floppy_fops = {
1860 .owner = THIS_MODULE, 1860 .owner = THIS_MODULE,
1861 .open = floppy_open, 1861 .open = floppy_open,
1862 .release = floppy_release, 1862 .release = floppy_release,
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 4bf8705b3ace..4f688434daf1 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -375,7 +375,7 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode,
375 return error; 375 return error;
376} 376}
377 377
378static struct block_device_operations brd_fops = { 378static const struct block_device_operations brd_fops = {
379 .owner = THIS_MODULE, 379 .owner = THIS_MODULE,
380 .locked_ioctl = brd_ioctl, 380 .locked_ioctl = brd_ioctl,
381#ifdef CONFIG_BLK_DEV_XIP 381#ifdef CONFIG_BLK_DEV_XIP
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index d8372b432826..4f19105f755c 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -205,7 +205,7 @@ static int cciss_compat_ioctl(struct block_device *, fmode_t,
205 unsigned, unsigned long); 205 unsigned, unsigned long);
206#endif 206#endif
207 207
208static struct block_device_operations cciss_fops = { 208static const struct block_device_operations cciss_fops = {
209 .owner = THIS_MODULE, 209 .owner = THIS_MODULE,
210 .open = cciss_open, 210 .open = cciss_open,
211 .release = cciss_release, 211 .release = cciss_release,
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 44fa2018f6b0..b82d438e2607 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -193,7 +193,7 @@ static inline ctlr_info_t *get_host(struct gendisk *disk)
193} 193}
194 194
195 195
196static struct block_device_operations ida_fops = { 196static const struct block_device_operations ida_fops = {
197 .owner = THIS_MODULE, 197 .owner = THIS_MODULE,
198 .open = ida_open, 198 .open = ida_open,
199 .release = ida_release, 199 .release = ida_release,
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 2b387c2260d8..5c01f747571b 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3907,7 +3907,7 @@ static int floppy_revalidate(struct gendisk *disk)
3907 return res; 3907 return res;
3908} 3908}
3909 3909
3910static struct block_device_operations floppy_fops = { 3910static const struct block_device_operations floppy_fops = {
3911 .owner = THIS_MODULE, 3911 .owner = THIS_MODULE,
3912 .open = floppy_open, 3912 .open = floppy_open,
3913 .release = floppy_release, 3913 .release = floppy_release,
diff --git a/drivers/block/hd.c b/drivers/block/hd.c
index f9d01608cbe2..d5cdce08ffd2 100644
--- a/drivers/block/hd.c
+++ b/drivers/block/hd.c
@@ -692,7 +692,7 @@ static irqreturn_t hd_interrupt(int irq, void *dev_id)
692 return IRQ_HANDLED; 692 return IRQ_HANDLED;
693} 693}
694 694
695static struct block_device_operations hd_fops = { 695static const struct block_device_operations hd_fops = {
696 .getgeo = hd_getgeo, 696 .getgeo = hd_getgeo,
697}; 697};
698 698
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index bbb79441d895..edda9ea7c626 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1438,7 +1438,7 @@ out_unlocked:
1438 return 0; 1438 return 0;
1439} 1439}
1440 1440
1441static struct block_device_operations lo_fops = { 1441static const struct block_device_operations lo_fops = {
1442 .owner = THIS_MODULE, 1442 .owner = THIS_MODULE,
1443 .open = lo_open, 1443 .open = lo_open,
1444 .release = lo_release, 1444 .release = lo_release,
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 6d7fbaa92248..e0339aaa1815 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -775,7 +775,7 @@ static int mg_getgeo(struct block_device *bdev, struct hd_geometry *geo)
775 return 0; 775 return 0;
776} 776}
777 777
778static struct block_device_operations mg_disk_ops = { 778static const struct block_device_operations mg_disk_ops = {
779 .getgeo = mg_getgeo 779 .getgeo = mg_getgeo
780}; 780};
781 781
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5d23ffad7c77..cc923a5b430c 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -722,7 +722,7 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
722 return error; 722 return error;
723} 723}
724 724
725static struct block_device_operations nbd_fops = 725static const struct block_device_operations nbd_fops =
726{ 726{
727 .owner = THIS_MODULE, 727 .owner = THIS_MODULE,
728 .locked_ioctl = nbd_ioctl, 728 .locked_ioctl = nbd_ioctl,
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c
index 13c1aee6aa3f..a808b1530b3b 100644
--- a/drivers/block/osdblk.c
+++ b/drivers/block/osdblk.c
@@ -125,7 +125,7 @@ static struct class *class_osdblk; /* /sys/class/osdblk */
125static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ 125static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */
126static LIST_HEAD(osdblkdev_list); 126static LIST_HEAD(osdblkdev_list);
127 127
128static struct block_device_operations osdblk_bd_ops = { 128static const struct block_device_operations osdblk_bd_ops = {
129 .owner = THIS_MODULE, 129 .owner = THIS_MODULE,
130}; 130};
131 131
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 9f3518c515a1..8866ca369d5e 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -247,7 +247,7 @@ static int pcd_block_media_changed(struct gendisk *disk)
247 return cdrom_media_changed(&cd->info); 247 return cdrom_media_changed(&cd->info);
248} 248}
249 249
250static struct block_device_operations pcd_bdops = { 250static const struct block_device_operations pcd_bdops = {
251 .owner = THIS_MODULE, 251 .owner = THIS_MODULE,
252 .open = pcd_block_open, 252 .open = pcd_block_open,
253 .release = pcd_block_release, 253 .release = pcd_block_release,
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index bf5955b3d873..569e39e8f114 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -807,7 +807,7 @@ static int pd_revalidate(struct gendisk *p)
807 return 0; 807 return 0;
808} 808}
809 809
810static struct block_device_operations pd_fops = { 810static const struct block_device_operations pd_fops = {
811 .owner = THIS_MODULE, 811 .owner = THIS_MODULE,
812 .open = pd_open, 812 .open = pd_open,
813 .release = pd_release, 813 .release = pd_release,
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 68a90834e993..ea54ea393553 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -262,7 +262,7 @@ static char *pf_buf; /* buffer for request in progress */
262 262
263/* kernel glue structures */ 263/* kernel glue structures */
264 264
265static struct block_device_operations pf_fops = { 265static const struct block_device_operations pf_fops = {
266 .owner = THIS_MODULE, 266 .owner = THIS_MODULE,
267 .open = pf_open, 267 .open = pf_open,
268 .release = pf_release, 268 .release = pf_release,
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index fd5bb8ad59a9..2ddf03ae034e 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2849,7 +2849,7 @@ static int pkt_media_changed(struct gendisk *disk)
2849 return attached_disk->fops->media_changed(attached_disk); 2849 return attached_disk->fops->media_changed(attached_disk);
2850} 2850}
2851 2851
2852static struct block_device_operations pktcdvd_ops = { 2852static const struct block_device_operations pktcdvd_ops = {
2853 .owner = THIS_MODULE, 2853 .owner = THIS_MODULE,
2854 .open = pkt_open, 2854 .open = pkt_open,
2855 .release = pkt_close, 2855 .release = pkt_close,
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index 34cbb7f3efa8..03a130dca8ab 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -82,7 +82,7 @@ enum lv1_ata_in_out {
82static int ps3disk_major; 82static int ps3disk_major;
83 83
84 84
85static struct block_device_operations ps3disk_fops = { 85static const struct block_device_operations ps3disk_fops = {
86 .owner = THIS_MODULE, 86 .owner = THIS_MODULE,
87}; 87};
88 88
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index c8753a9ed290..3bb7c47c869f 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -88,7 +88,7 @@ struct ps3vram_priv {
88static int ps3vram_major; 88static int ps3vram_major;
89 89
90 90
91static struct block_device_operations ps3vram_fops = { 91static const struct block_device_operations ps3vram_fops = {
92 .owner = THIS_MODULE, 92 .owner = THIS_MODULE,
93}; 93};
94 94
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index cbfd9c0aef03..411f064760b4 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -103,7 +103,7 @@ static int vdc_getgeo(struct block_device *bdev, struct hd_geometry *geo)
103 return 0; 103 return 0;
104} 104}
105 105
106static struct block_device_operations vdc_fops = { 106static const struct block_device_operations vdc_fops = {
107 .owner = THIS_MODULE, 107 .owner = THIS_MODULE,
108 .getgeo = vdc_getgeo, 108 .getgeo = vdc_getgeo,
109}; 109};
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index cf7877fb8a7d..8f569e3df890 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -748,7 +748,7 @@ static int floppy_revalidate(struct gendisk *disk)
748 return !fs->disk_in; 748 return !fs->disk_in;
749} 749}
750 750
751static struct block_device_operations floppy_fops = { 751static const struct block_device_operations floppy_fops = {
752 .owner = THIS_MODULE, 752 .owner = THIS_MODULE,
753 .open = floppy_open, 753 .open = floppy_open,
754 .release = floppy_release, 754 .release = floppy_release,
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 80df93e3cdd0..6380ad8d91bd 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -998,7 +998,7 @@ static int floppy_revalidate(struct gendisk *disk)
998 return ret; 998 return ret;
999} 999}
1000 1000
1001static struct block_device_operations floppy_fops = { 1001static const struct block_device_operations floppy_fops = {
1002 .open = floppy_open, 1002 .open = floppy_open,
1003 .release = floppy_release, 1003 .release = floppy_release,
1004 .locked_ioctl = floppy_ioctl, 1004 .locked_ioctl = floppy_ioctl,
@@ -1062,7 +1062,7 @@ static int swim3_add_device(struct macio_dev *mdev, int index)
1062 goto out_release; 1062 goto out_release;
1063 } 1063 }
1064 fs->swim3_intr = macio_irq(mdev, 0); 1064 fs->swim3_intr = macio_irq(mdev, 0);
1065 fs->dma_intr = macio_irq(mdev, 1);; 1065 fs->dma_intr = macio_irq(mdev, 1);
1066 fs->cur_cyl = -1; 1066 fs->cur_cyl = -1;
1067 fs->cur_sector = -1; 1067 fs->cur_sector = -1;
1068 fs->secpercyl = 36; 1068 fs->secpercyl = 36;
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index f5cd2e83ebcc..a7c4184f4a63 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -423,7 +423,7 @@ static struct pci_driver carm_driver = {
423 .remove = carm_remove_one, 423 .remove = carm_remove_one,
424}; 424};
425 425
426static struct block_device_operations carm_bd_ops = { 426static const struct block_device_operations carm_bd_ops = {
427 .owner = THIS_MODULE, 427 .owner = THIS_MODULE,
428 .getgeo = carm_bdev_getgeo, 428 .getgeo = carm_bdev_getgeo,
429}; 429};
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index cc54473b8e77..c739b203fe91 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1789,7 +1789,7 @@ static int ub_bd_media_changed(struct gendisk *disk)
1789 return lun->changed; 1789 return lun->changed;
1790} 1790}
1791 1791
1792static struct block_device_operations ub_bd_fops = { 1792static const struct block_device_operations ub_bd_fops = {
1793 .owner = THIS_MODULE, 1793 .owner = THIS_MODULE,
1794 .open = ub_bd_open, 1794 .open = ub_bd_open,
1795 .release = ub_bd_release, 1795 .release = ub_bd_release,
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 858c34dd032d..ad1ba393801a 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -140,7 +140,6 @@ struct cardinfo {
140}; 140};
141 141
142static struct cardinfo cards[MM_MAXCARDS]; 142static struct cardinfo cards[MM_MAXCARDS];
143static struct block_device_operations mm_fops;
144static struct timer_list battery_timer; 143static struct timer_list battery_timer;
145 144
146static int num_cards; 145static int num_cards;
@@ -789,7 +788,7 @@ static int mm_check_change(struct gendisk *disk)
789 return 0; 788 return 0;
790} 789}
791 790
792static struct block_device_operations mm_fops = { 791static const struct block_device_operations mm_fops = {
793 .owner = THIS_MODULE, 792 .owner = THIS_MODULE,
794 .getgeo = mm_getgeo, 793 .getgeo = mm_getgeo,
795 .revalidate_disk = mm_revalidate, 794 .revalidate_disk = mm_revalidate,
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index b441ce3832e9..a8c8b56b275e 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -219,7 +219,7 @@ static int viodasd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
219/* 219/*
220 * Our file operations table 220 * Our file operations table
221 */ 221 */
222static struct block_device_operations viodasd_fops = { 222static const struct block_device_operations viodasd_fops = {
223 .owner = THIS_MODULE, 223 .owner = THIS_MODULE,
224 .open = viodasd_open, 224 .open = viodasd_open,
225 .release = viodasd_release, 225 .release = viodasd_release,
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index aa1a3d5a3e2b..aa89fe45237d 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -243,7 +243,7 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
243 return 0; 243 return 0;
244} 244}
245 245
246static struct block_device_operations virtblk_fops = { 246static const struct block_device_operations virtblk_fops = {
247 .locked_ioctl = virtblk_ioctl, 247 .locked_ioctl = virtblk_ioctl,
248 .owner = THIS_MODULE, 248 .owner = THIS_MODULE,
249 .getgeo = virtblk_getgeo, 249 .getgeo = virtblk_getgeo,
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index ce2429219925..0877d3628fda 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -130,7 +130,7 @@ static struct gendisk *xd_gendisk[2];
130 130
131static int xd_getgeo(struct block_device *bdev, struct hd_geometry *geo); 131static int xd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
132 132
133static struct block_device_operations xd_fops = { 133static const struct block_device_operations xd_fops = {
134 .owner = THIS_MODULE, 134 .owner = THIS_MODULE,
135 .locked_ioctl = xd_ioctl, 135 .locked_ioctl = xd_ioctl,
136 .getgeo = xd_getgeo, 136 .getgeo = xd_getgeo,
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index e53284767f7c..b8578bb3f4c9 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -65,7 +65,7 @@ struct blk_shadow {
65 unsigned long frame[BLKIF_MAX_SEGMENTS_PER_REQUEST]; 65 unsigned long frame[BLKIF_MAX_SEGMENTS_PER_REQUEST];
66}; 66};
67 67
68static struct block_device_operations xlvbd_block_fops; 68static const struct block_device_operations xlvbd_block_fops;
69 69
70#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE) 70#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE)
71 71
@@ -1039,7 +1039,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
1039 return 0; 1039 return 0;
1040} 1040}
1041 1041
1042static struct block_device_operations xlvbd_block_fops = 1042static const struct block_device_operations xlvbd_block_fops =
1043{ 1043{
1044 .owner = THIS_MODULE, 1044 .owner = THIS_MODULE,
1045 .open = blkif_open, 1045 .open = blkif_open,
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index b20abe102a2b..e5c5415eb45e 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -941,7 +941,7 @@ static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
941 return 0; 941 return 0;
942} 942}
943 943
944static struct block_device_operations ace_fops = { 944static const struct block_device_operations ace_fops = {
945 .owner = THIS_MODULE, 945 .owner = THIS_MODULE,
946 .open = ace_open, 946 .open = ace_open,
947 .release = ace_release, 947 .release = ace_release,
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index b2590409f25e..64f941e0f14b 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -64,7 +64,6 @@ static int current_device = -1;
64 64
65static DEFINE_SPINLOCK(z2ram_lock); 65static DEFINE_SPINLOCK(z2ram_lock);
66 66
67static struct block_device_operations z2_fops;
68static struct gendisk *z2ram_gendisk; 67static struct gendisk *z2ram_gendisk;
69 68
70static void do_z2_request(struct request_queue *q) 69static void do_z2_request(struct request_queue *q)
@@ -315,7 +314,7 @@ z2_release(struct gendisk *disk, fmode_t mode)
315 return 0; 314 return 0;
316} 315}
317 316
318static struct block_device_operations z2_fops = 317static const struct block_device_operations z2_fops =
319{ 318{
320 .owner = THIS_MODULE, 319 .owner = THIS_MODULE,
321 .open = z2_open, 320 .open = z2_open,
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index b5621f27c4be..a762283d2a21 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -512,7 +512,7 @@ static int gdrom_bdops_ioctl(struct block_device *bdev, fmode_t mode,
512 return cdrom_ioctl(gd.cd_info, bdev, mode, cmd, arg); 512 return cdrom_ioctl(gd.cd_info, bdev, mode, cmd, arg);
513} 513}
514 514
515static struct block_device_operations gdrom_bdops = { 515static const struct block_device_operations gdrom_bdops = {
516 .owner = THIS_MODULE, 516 .owner = THIS_MODULE,
517 .open = gdrom_bdops_open, 517 .open = gdrom_bdops_open,
518 .release = gdrom_bdops_release, 518 .release = gdrom_bdops_release,
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 0fff646cc2f0..57ca69e0ac55 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -177,7 +177,7 @@ static int viocd_blk_media_changed(struct gendisk *disk)
177 return cdrom_media_changed(&di->viocd_info); 177 return cdrom_media_changed(&di->viocd_info);
178} 178}
179 179
180struct block_device_operations viocd_fops = { 180static const struct block_device_operations viocd_fops = {
181 .owner = THIS_MODULE, 181 .owner = THIS_MODULE,
182 .open = viocd_blk_open, 182 .open = viocd_blk_open,
183 .release = viocd_blk_release, 183 .release = viocd_blk_release,
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index ad87753f6de4..a56ca080e108 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -114,9 +114,9 @@ static int agp_find_max(void)
114 long memory, index, result; 114 long memory, index, result;
115 115
116#if PAGE_SHIFT < 20 116#if PAGE_SHIFT < 20
117 memory = num_physpages >> (20 - PAGE_SHIFT); 117 memory = totalram_pages >> (20 - PAGE_SHIFT);
118#else 118#else
119 memory = num_physpages << (PAGE_SHIFT - 20); 119 memory = totalram_pages << (PAGE_SHIFT - 20);
120#endif 120#endif
121 index = 1; 121 index = 1;
122 122
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 20ef1bf5e726..703959eba45a 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -270,7 +270,7 @@ static void uninorth_agp_enable(struct agp_bridge_data *bridge, u32 mode)
270 270
271 if ((uninorth_rev >= 0x30) && (uninorth_rev <= 0x33)) { 271 if ((uninorth_rev >= 0x30) && (uninorth_rev <= 0x33)) {
272 /* 272 /*
273 * We need to to set REQ_DEPTH to 7 for U3 versions 1.0, 2.1, 273 * We need to set REQ_DEPTH to 7 for U3 versions 1.0, 2.1,
274 * 2.2 and 2.3, Darwin do so. 274 * 2.2 and 2.3, Darwin do so.
275 */ 275 */
276 if ((command >> AGPSTAT_RQ_DEPTH_SHIFT) > 7) 276 if ((command >> AGPSTAT_RQ_DEPTH_SHIFT) > 7)
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index ff647ca1c489..9d589e3144de 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -2239,7 +2239,7 @@ static void do_softint(struct work_struct *work)
2239 struct channel *ch = container_of(work, struct channel, tqueue); 2239 struct channel *ch = container_of(work, struct channel, tqueue);
2240 /* Called in response to a modem change event */ 2240 /* Called in response to a modem change event */
2241 if (ch && ch->magic == EPCA_MAGIC) { 2241 if (ch && ch->magic == EPCA_MAGIC) {
2242 struct tty_struct *tty = tty_port_tty_get(&ch->port);; 2242 struct tty_struct *tty = tty_port_tty_get(&ch->port);
2243 2243
2244 if (tty && tty->driver_data) { 2244 if (tty && tty->driver_data) {
2245 if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { 2245 if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) {
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c
index a261bd735dfb..2e66b5f773dd 100644
--- a/drivers/char/ipmi/ipmi_poweroff.c
+++ b/drivers/char/ipmi/ipmi_poweroff.c
@@ -691,7 +691,7 @@ static struct ctl_table_header *ipmi_table_header;
691/* 691/*
692 * Startup and shutdown functions. 692 * Startup and shutdown functions.
693 */ 693 */
694static int ipmi_poweroff_init(void) 694static int __init ipmi_poweroff_init(void)
695{ 695{
696 int rv; 696 int rv;
697 697
@@ -725,7 +725,7 @@ static int ipmi_poweroff_init(void)
725} 725}
726 726
727#ifdef MODULE 727#ifdef MODULE
728static __exit void ipmi_poweroff_cleanup(void) 728static void __exit ipmi_poweroff_cleanup(void)
729{ 729{
730 int rv; 730 int rv;
731 731
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 881934c068c8..c250a31efa53 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1017,7 +1017,7 @@ static ssize_t cmm_read(struct file *filp, __user char *buf, size_t count,
1017 } 1017 }
1018 } 1018 }
1019 1019
1020 if (dev->proto == 0 && count > dev->rlen - dev->rpos) { 1020 if (dev->proto == 0 && count > dev->rlen - dev->rpos && i) {
1021 DEBUGP(4, dev, "T=0 and count > buffer\n"); 1021 DEBUGP(4, dev, "T=0 and count > buffer\n");
1022 dev->rbuf[i] = dev->rbuf[i - 1]; 1022 dev->rbuf[i] = dev->rbuf[i - 1];
1023 dev->rbuf[i - 1] = dev->procbyte; 1023 dev->rbuf[i - 1] = dev->procbyte;
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index f1df59f59a37..68104434ebb5 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -2,8 +2,12 @@
2 * menu.c - the menu idle governor 2 * menu.c - the menu idle governor
3 * 3 *
4 * Copyright (C) 2006-2007 Adam Belay <abelay@novell.com> 4 * Copyright (C) 2006-2007 Adam Belay <abelay@novell.com>
5 * Copyright (C) 2009 Intel Corporation
6 * Author:
7 * Arjan van de Ven <arjan@linux.intel.com>
5 * 8 *
6 * This code is licenced under the GPL. 9 * This code is licenced under the GPL version 2 as described
10 * in the COPYING file that acompanies the Linux Kernel.
7 */ 11 */
8 12
9#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -13,22 +17,158 @@
13#include <linux/ktime.h> 17#include <linux/ktime.h>
14#include <linux/hrtimer.h> 18#include <linux/hrtimer.h>
15#include <linux/tick.h> 19#include <linux/tick.h>
20#include <linux/sched.h>
16 21
17#define BREAK_FUZZ 4 /* 4 us */ 22#define BUCKETS 12
18#define PRED_HISTORY_PCT 50 23#define RESOLUTION 1024
24#define DECAY 4
25#define MAX_INTERESTING 50000
26
27/*
28 * Concepts and ideas behind the menu governor
29 *
30 * For the menu governor, there are 3 decision factors for picking a C
31 * state:
32 * 1) Energy break even point
33 * 2) Performance impact
34 * 3) Latency tolerance (from pmqos infrastructure)
35 * These these three factors are treated independently.
36 *
37 * Energy break even point
38 * -----------------------
39 * C state entry and exit have an energy cost, and a certain amount of time in
40 * the C state is required to actually break even on this cost. CPUIDLE
41 * provides us this duration in the "target_residency" field. So all that we
42 * need is a good prediction of how long we'll be idle. Like the traditional
43 * menu governor, we start with the actual known "next timer event" time.
44 *
45 * Since there are other source of wakeups (interrupts for example) than
46 * the next timer event, this estimation is rather optimistic. To get a
47 * more realistic estimate, a correction factor is applied to the estimate,
48 * that is based on historic behavior. For example, if in the past the actual
49 * duration always was 50% of the next timer tick, the correction factor will
50 * be 0.5.
51 *
52 * menu uses a running average for this correction factor, however it uses a
53 * set of factors, not just a single factor. This stems from the realization
54 * that the ratio is dependent on the order of magnitude of the expected
55 * duration; if we expect 500 milliseconds of idle time the likelihood of
56 * getting an interrupt very early is much higher than if we expect 50 micro
57 * seconds of idle time. A second independent factor that has big impact on
58 * the actual factor is if there is (disk) IO outstanding or not.
59 * (as a special twist, we consider every sleep longer than 50 milliseconds
60 * as perfect; there are no power gains for sleeping longer than this)
61 *
62 * For these two reasons we keep an array of 12 independent factors, that gets
63 * indexed based on the magnitude of the expected duration as well as the
64 * "is IO outstanding" property.
65 *
66 * Limiting Performance Impact
67 * ---------------------------
68 * C states, especially those with large exit latencies, can have a real
69 * noticable impact on workloads, which is not acceptable for most sysadmins,
70 * and in addition, less performance has a power price of its own.
71 *
72 * As a general rule of thumb, menu assumes that the following heuristic
73 * holds:
74 * The busier the system, the less impact of C states is acceptable
75 *
76 * This rule-of-thumb is implemented using a performance-multiplier:
77 * If the exit latency times the performance multiplier is longer than
78 * the predicted duration, the C state is not considered a candidate
79 * for selection due to a too high performance impact. So the higher
80 * this multiplier is, the longer we need to be idle to pick a deep C
81 * state, and thus the less likely a busy CPU will hit such a deep
82 * C state.
83 *
84 * Two factors are used in determing this multiplier:
85 * a value of 10 is added for each point of "per cpu load average" we have.
86 * a value of 5 points is added for each process that is waiting for
87 * IO on this CPU.
88 * (these values are experimentally determined)
89 *
90 * The load average factor gives a longer term (few seconds) input to the
91 * decision, while the iowait value gives a cpu local instantanious input.
92 * The iowait factor may look low, but realize that this is also already
93 * represented in the system load average.
94 *
95 */
19 96
20struct menu_device { 97struct menu_device {
21 int last_state_idx; 98 int last_state_idx;
99 int needs_update;
22 100
23 unsigned int expected_us; 101 unsigned int expected_us;
24 unsigned int predicted_us; 102 u64 predicted_us;
25 unsigned int current_predicted_us; 103 unsigned int measured_us;
26 unsigned int last_measured_us; 104 unsigned int exit_us;
27 unsigned int elapsed_us; 105 unsigned int bucket;
106 u64 correction_factor[BUCKETS];
28}; 107};
29 108
109
110#define LOAD_INT(x) ((x) >> FSHIFT)
111#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
112
113static int get_loadavg(void)
114{
115 unsigned long this = this_cpu_load();
116
117
118 return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10;
119}
120
121static inline int which_bucket(unsigned int duration)
122{
123 int bucket = 0;
124
125 /*
126 * We keep two groups of stats; one with no
127 * IO pending, one without.
128 * This allows us to calculate
129 * E(duration)|iowait
130 */
131 if (nr_iowait_cpu())
132 bucket = BUCKETS/2;
133
134 if (duration < 10)
135 return bucket;
136 if (duration < 100)
137 return bucket + 1;
138 if (duration < 1000)
139 return bucket + 2;
140 if (duration < 10000)
141 return bucket + 3;
142 if (duration < 100000)
143 return bucket + 4;
144 return bucket + 5;
145}
146
147/*
148 * Return a multiplier for the exit latency that is intended
149 * to take performance requirements into account.
150 * The more performance critical we estimate the system
151 * to be, the higher this multiplier, and thus the higher
152 * the barrier to go to an expensive C state.
153 */
154static inline int performance_multiplier(void)
155{
156 int mult = 1;
157
158 /* for higher loadavg, we are more reluctant */
159
160 mult += 2 * get_loadavg();
161
162 /* for IO wait tasks (per cpu!) we add 5x each */
163 mult += 10 * nr_iowait_cpu();
164
165 return mult;
166}
167
30static DEFINE_PER_CPU(struct menu_device, menu_devices); 168static DEFINE_PER_CPU(struct menu_device, menu_devices);
31 169
170static void menu_update(struct cpuidle_device *dev);
171
32/** 172/**
33 * menu_select - selects the next idle state to enter 173 * menu_select - selects the next idle state to enter
34 * @dev: the CPU 174 * @dev: the CPU
@@ -38,41 +178,68 @@ static int menu_select(struct cpuidle_device *dev)
38 struct menu_device *data = &__get_cpu_var(menu_devices); 178 struct menu_device *data = &__get_cpu_var(menu_devices);
39 int latency_req = pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY); 179 int latency_req = pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY);
40 int i; 180 int i;
181 int multiplier;
182
183 data->last_state_idx = 0;
184 data->exit_us = 0;
185
186 if (data->needs_update) {
187 menu_update(dev);
188 data->needs_update = 0;
189 }
41 190
42 /* Special case when user has set very strict latency requirement */ 191 /* Special case when user has set very strict latency requirement */
43 if (unlikely(latency_req == 0)) { 192 if (unlikely(latency_req == 0))
44 data->last_state_idx = 0;
45 return 0; 193 return 0;
46 }
47 194
48 /* determine the expected residency time */ 195 /* determine the expected residency time, round up */
49 data->expected_us = 196 data->expected_us =
50 (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000; 197 DIV_ROUND_UP((u32)ktime_to_ns(tick_nohz_get_sleep_length()), 1000);
198
199
200 data->bucket = which_bucket(data->expected_us);
201
202 multiplier = performance_multiplier();
203
204 /*
205 * if the correction factor is 0 (eg first time init or cpu hotplug
206 * etc), we actually want to start out with a unity factor.
207 */
208 if (data->correction_factor[data->bucket] == 0)
209 data->correction_factor[data->bucket] = RESOLUTION * DECAY;
210
211 /* Make sure to round up for half microseconds */
212 data->predicted_us = DIV_ROUND_CLOSEST(
213 data->expected_us * data->correction_factor[data->bucket],
214 RESOLUTION * DECAY);
215
216 /*
217 * We want to default to C1 (hlt), not to busy polling
218 * unless the timer is happening really really soon.
219 */
220 if (data->expected_us > 5)
221 data->last_state_idx = CPUIDLE_DRIVER_STATE_START;
51 222
52 /* Recalculate predicted_us based on prediction_history_pct */
53 data->predicted_us *= PRED_HISTORY_PCT;
54 data->predicted_us += (100 - PRED_HISTORY_PCT) *
55 data->current_predicted_us;
56 data->predicted_us /= 100;
57 223
58 /* find the deepest idle state that satisfies our constraints */ 224 /* find the deepest idle state that satisfies our constraints */
59 for (i = CPUIDLE_DRIVER_STATE_START + 1; i < dev->state_count; i++) { 225 for (i = CPUIDLE_DRIVER_STATE_START; i < dev->state_count; i++) {
60 struct cpuidle_state *s = &dev->states[i]; 226 struct cpuidle_state *s = &dev->states[i];
61 227
62 if (s->target_residency > data->expected_us)
63 break;
64 if (s->target_residency > data->predicted_us) 228 if (s->target_residency > data->predicted_us)
65 break; 229 break;
66 if (s->exit_latency > latency_req) 230 if (s->exit_latency > latency_req)
67 break; 231 break;
232 if (s->exit_latency * multiplier > data->predicted_us)
233 break;
234 data->exit_us = s->exit_latency;
235 data->last_state_idx = i;
68 } 236 }
69 237
70 data->last_state_idx = i - 1; 238 return data->last_state_idx;
71 return i - 1;
72} 239}
73 240
74/** 241/**
75 * menu_reflect - attempts to guess what happened after entry 242 * menu_reflect - records that data structures need update
76 * @dev: the CPU 243 * @dev: the CPU
77 * 244 *
78 * NOTE: it's important to be fast here because this operation will add to 245 * NOTE: it's important to be fast here because this operation will add to
@@ -81,39 +248,63 @@ static int menu_select(struct cpuidle_device *dev)
81static void menu_reflect(struct cpuidle_device *dev) 248static void menu_reflect(struct cpuidle_device *dev)
82{ 249{
83 struct menu_device *data = &__get_cpu_var(menu_devices); 250 struct menu_device *data = &__get_cpu_var(menu_devices);
251 data->needs_update = 1;
252}
253
254/**
255 * menu_update - attempts to guess what happened after entry
256 * @dev: the CPU
257 */
258static void menu_update(struct cpuidle_device *dev)
259{
260 struct menu_device *data = &__get_cpu_var(menu_devices);
84 int last_idx = data->last_state_idx; 261 int last_idx = data->last_state_idx;
85 unsigned int last_idle_us = cpuidle_get_last_residency(dev); 262 unsigned int last_idle_us = cpuidle_get_last_residency(dev);
86 struct cpuidle_state *target = &dev->states[last_idx]; 263 struct cpuidle_state *target = &dev->states[last_idx];
87 unsigned int measured_us; 264 unsigned int measured_us;
265 u64 new_factor;
88 266
89 /* 267 /*
90 * Ugh, this idle state doesn't support residency measurements, so we 268 * Ugh, this idle state doesn't support residency measurements, so we
91 * are basically lost in the dark. As a compromise, assume we slept 269 * are basically lost in the dark. As a compromise, assume we slept
92 * for one full standard timer tick. However, be aware that this 270 * for the whole expected time.
93 * could potentially result in a suboptimal state transition.
94 */ 271 */
95 if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID))) 272 if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID)))
96 last_idle_us = USEC_PER_SEC / HZ; 273 last_idle_us = data->expected_us;
274
275
276 measured_us = last_idle_us;
97 277
98 /* 278 /*
99 * measured_us and elapsed_us are the cumulative idle time, since the 279 * We correct for the exit latency; we are assuming here that the
100 * last time we were woken out of idle by an interrupt. 280 * exit latency happens after the event that we're interested in.
101 */ 281 */
102 if (data->elapsed_us <= data->elapsed_us + last_idle_us) 282 if (measured_us > data->exit_us)
103 measured_us = data->elapsed_us + last_idle_us; 283 measured_us -= data->exit_us;
284
285
286 /* update our correction ratio */
287
288 new_factor = data->correction_factor[data->bucket]
289 * (DECAY - 1) / DECAY;
290
291 if (data->expected_us > 0 && data->measured_us < MAX_INTERESTING)
292 new_factor += RESOLUTION * measured_us / data->expected_us;
104 else 293 else
105 measured_us = -1; 294 /*
295 * we were idle so long that we count it as a perfect
296 * prediction
297 */
298 new_factor += RESOLUTION;
106 299
107 /* Predict time until next break event */ 300 /*
108 data->current_predicted_us = max(measured_us, data->last_measured_us); 301 * We don't want 0 as factor; we always want at least
302 * a tiny bit of estimated time.
303 */
304 if (new_factor == 0)
305 new_factor = 1;
109 306
110 if (last_idle_us + BREAK_FUZZ < 307 data->correction_factor[data->bucket] = new_factor;
111 data->expected_us - target->exit_latency) {
112 data->last_measured_us = measured_us;
113 data->elapsed_us = 0;
114 } else {
115 data->elapsed_us = measured_us;
116 }
117} 308}
118 309
119/** 310/**
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index 871c13b4c148..12f355cafdbe 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -286,7 +286,7 @@ enum scrub_type {
286 * is irrespective of the memory devices being mounted 286 * is irrespective of the memory devices being mounted
287 * on both sides of the memory stick. 287 * on both sides of the memory stick.
288 * 288 *
289 * Socket set: All of the memory sticks that are required for for 289 * Socket set: All of the memory sticks that are required for
290 * a single memory access or all of the memory sticks 290 * a single memory access or all of the memory sticks
291 * spanned by a chip-select row. A single socket set 291 * spanned by a chip-select row. A single socket set
292 * has two chip-select rows and if double-sided sticks 292 * has two chip-select rows and if double-sided sticks
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index d5ea8a68d338..56f9234781fa 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -164,7 +164,7 @@ int __init firmware_map_add_early(u64 start, u64 end, const char *type)
164{ 164{
165 struct firmware_map_entry *entry; 165 struct firmware_map_entry *entry;
166 166
167 entry = alloc_bootmem_low(sizeof(struct firmware_map_entry)); 167 entry = alloc_bootmem(sizeof(struct firmware_map_entry));
168 if (WARN_ON(!entry)) 168 if (WARN_ON(!entry))
169 return -ENOMEM; 169 return -ENOMEM;
170 170
diff --git a/drivers/gpio/bt8xxgpio.c b/drivers/gpio/bt8xxgpio.c
index 984b587f0f96..55904140213b 100644
--- a/drivers/gpio/bt8xxgpio.c
+++ b/drivers/gpio/bt8xxgpio.c
@@ -331,13 +331,13 @@ static struct pci_driver bt8xxgpio_pci_driver = {
331 .resume = bt8xxgpio_resume, 331 .resume = bt8xxgpio_resume,
332}; 332};
333 333
334static int bt8xxgpio_init(void) 334static int __init bt8xxgpio_init(void)
335{ 335{
336 return pci_register_driver(&bt8xxgpio_pci_driver); 336 return pci_register_driver(&bt8xxgpio_pci_driver);
337} 337}
338module_init(bt8xxgpio_init) 338module_init(bt8xxgpio_init)
339 339
340static void bt8xxgpio_exit(void) 340static void __exit bt8xxgpio_exit(void)
341{ 341{
342 pci_unregister_driver(&bt8xxgpio_pci_driver); 342 pci_unregister_driver(&bt8xxgpio_pci_driver);
343} 343}
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 2b914d732076..f4856a510476 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -232,7 +232,7 @@ intel_dp_aux_ch(struct intel_output *intel_output,
232 for (try = 0; try < 5; try++) { 232 for (try = 0; try < 5; try++) {
233 /* Load the send data into the aux channel data registers */ 233 /* Load the send data into the aux channel data registers */
234 for (i = 0; i < send_bytes; i += 4) { 234 for (i = 0; i < send_bytes; i += 4) {
235 uint32_t d = pack_aux(send + i, send_bytes - i);; 235 uint32_t d = pack_aux(send + i, send_bytes - i);
236 236
237 I915_WRITE(ch_data + i, d); 237 I915_WRITE(ch_data + i, d);
238 } 238 }
diff --git a/drivers/gpu/drm/mga/mga_state.c b/drivers/gpu/drm/mga/mga_state.c
index b710fab21cb3..a53b848e0f17 100644
--- a/drivers/gpu/drm/mga/mga_state.c
+++ b/drivers/gpu/drm/mga/mga_state.c
@@ -239,7 +239,7 @@ static __inline__ void mga_g200_emit_pipe(drm_mga_private_t * dev_priv)
239 MGA_WR34, 0x00000000, 239 MGA_WR34, 0x00000000,
240 MGA_WR42, 0x0000ffff, MGA_WR60, 0x0000ffff); 240 MGA_WR42, 0x0000ffff, MGA_WR60, 0x0000ffff);
241 241
242 /* Padding required to to hardware bug. 242 /* Padding required due to hardware bug.
243 */ 243 */
244 DMA_BLOCK(MGA_DMAPAD, 0xffffffff, 244 DMA_BLOCK(MGA_DMAPAD, 0xffffffff,
245 MGA_DMAPAD, 0xffffffff, 245 MGA_DMAPAD, 0xffffffff,
@@ -317,7 +317,7 @@ static __inline__ void mga_g400_emit_pipe(drm_mga_private_t * dev_priv)
317 MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */ 317 MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */
318 MGA_WR60, MGA_G400_WR_MAGIC); /* tex1 height */ 318 MGA_WR60, MGA_G400_WR_MAGIC); /* tex1 height */
319 319
320 /* Padding required to to hardware bug */ 320 /* Padding required due to hardware bug */
321 DMA_BLOCK(MGA_DMAPAD, 0xffffffff, 321 DMA_BLOCK(MGA_DMAPAD, 0xffffffff,
322 MGA_DMAPAD, 0xffffffff, 322 MGA_DMAPAD, 0xffffffff,
323 MGA_DMAPAD, 0xffffffff, 323 MGA_DMAPAD, 0xffffffff,
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 111afbe8de03..24d90ea246ce 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -205,13 +205,6 @@ config HID_NTRIG
205 Support for N-Trig touch screen. 205 Support for N-Trig touch screen.
206 206
207config HID_PANTHERLORD 207config HID_PANTHERLORD
208 tristate "Pantherlord devices support" if EMBEDDED
209 depends on USB_HID
210 default !EMBEDDED
211 ---help---
212 Support for PantherLord/GreenAsia based device support.
213
214config HID_PANTHERLORD
215 tristate "Pantherlord support" if EMBEDDED 208 tristate "Pantherlord support" if EMBEDDED
216 depends on USB_HID 209 depends on USB_HID
217 default !EMBEDDED 210 default !EMBEDDED
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 342b7d36d7bb..be34d32906bd 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1089,8 +1089,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
1089 return -1; 1089 return -1;
1090 } 1090 }
1091 1091
1092 buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, 1092 buf = kmalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);
1093 interrupt ? GFP_ATOMIC : GFP_KERNEL);
1094 1093
1095 if (!buf) { 1094 if (!buf) {
1096 report = hid_get_report(report_enum, data); 1095 report = hid_get_report(report_enum, data);
@@ -1238,6 +1237,17 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1238} 1237}
1239EXPORT_SYMBOL_GPL(hid_connect); 1238EXPORT_SYMBOL_GPL(hid_connect);
1240 1239
1240void hid_disconnect(struct hid_device *hdev)
1241{
1242 if (hdev->claimed & HID_CLAIMED_INPUT)
1243 hidinput_disconnect(hdev);
1244 if (hdev->claimed & HID_CLAIMED_HIDDEV)
1245 hdev->hiddev_disconnect(hdev);
1246 if (hdev->claimed & HID_CLAIMED_HIDRAW)
1247 hidraw_disconnect(hdev);
1248}
1249EXPORT_SYMBOL_GPL(hid_disconnect);
1250
1241/* a list of devices for which there is a specialized driver on HID bus */ 1251/* a list of devices for which there is a specialized driver on HID bus */
1242static const struct hid_device_id hid_blacklist[] = { 1252static const struct hid_device_id hid_blacklist[] = {
1243 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, 1253 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 1b0e07a67d6d..03bd703255a3 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1041,13 +1041,6 @@ static void usbhid_stop(struct hid_device *hid)
1041 1041
1042 hid_cancel_delayed_stuff(usbhid); 1042 hid_cancel_delayed_stuff(usbhid);
1043 1043
1044 if (hid->claimed & HID_CLAIMED_INPUT)
1045 hidinput_disconnect(hid);
1046 if (hid->claimed & HID_CLAIMED_HIDDEV)
1047 hiddev_disconnect(hid);
1048 if (hid->claimed & HID_CLAIMED_HIDRAW)
1049 hidraw_disconnect(hid);
1050
1051 hid->claimed = 0; 1044 hid->claimed = 0;
1052 1045
1053 usb_free_urb(usbhid->urbin); 1046 usb_free_urb(usbhid->urbin);
@@ -1085,7 +1078,7 @@ static struct hid_ll_driver usb_hid_driver = {
1085 .hidinput_input_event = usb_hidinput_input_event, 1078 .hidinput_input_event = usb_hidinput_input_event,
1086}; 1079};
1087 1080
1088static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) 1081static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1089{ 1082{
1090 struct usb_host_interface *interface = intf->cur_altsetting; 1083 struct usb_host_interface *interface = intf->cur_altsetting;
1091 struct usb_device *dev = interface_to_usbdev(intf); 1084 struct usb_device *dev = interface_to_usbdev(intf);
@@ -1117,6 +1110,7 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1117 hid->ff_init = hid_pidff_init; 1110 hid->ff_init = hid_pidff_init;
1118#ifdef CONFIG_USB_HIDDEV 1111#ifdef CONFIG_USB_HIDDEV
1119 hid->hiddev_connect = hiddev_connect; 1112 hid->hiddev_connect = hiddev_connect;
1113 hid->hiddev_disconnect = hiddev_disconnect;
1120 hid->hiddev_hid_event = hiddev_hid_event; 1114 hid->hiddev_hid_event = hiddev_hid_event;
1121 hid->hiddev_report_event = hiddev_report_event; 1115 hid->hiddev_report_event = hiddev_report_event;
1122#endif 1116#endif
@@ -1177,7 +1171,7 @@ err:
1177 return ret; 1171 return ret;
1178} 1172}
1179 1173
1180static void hid_disconnect(struct usb_interface *intf) 1174static void usbhid_disconnect(struct usb_interface *intf)
1181{ 1175{
1182 struct hid_device *hid = usb_get_intfdata(intf); 1176 struct hid_device *hid = usb_get_intfdata(intf);
1183 struct usbhid_device *usbhid; 1177 struct usbhid_device *usbhid;
@@ -1359,8 +1353,8 @@ MODULE_DEVICE_TABLE (usb, hid_usb_ids);
1359 1353
1360static struct usb_driver hid_driver = { 1354static struct usb_driver hid_driver = {
1361 .name = "usbhid", 1355 .name = "usbhid",
1362 .probe = hid_probe, 1356 .probe = usbhid_probe,
1363 .disconnect = hid_disconnect, 1357 .disconnect = usbhid_disconnect,
1364#ifdef CONFIG_PM 1358#ifdef CONFIG_PM
1365 .suspend = hid_suspend, 1359 .suspend = hid_suspend,
1366 .resume = hid_resume, 1360 .resume = hid_resume,
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c
index b11e06f644b1..afc594318125 100644
--- a/drivers/hwmon/adm1021.c
+++ b/drivers/hwmon/adm1021.c
@@ -83,16 +83,14 @@ struct adm1021_data {
83 83
84 struct mutex update_lock; 84 struct mutex update_lock;
85 char valid; /* !=0 if following fields are valid */ 85 char valid; /* !=0 if following fields are valid */
86 char low_power; /* !=0 if device in low power mode */
86 unsigned long last_updated; /* In jiffies */ 87 unsigned long last_updated; /* In jiffies */
87 88
88 s8 temp_max[2]; /* Register values */ 89 int temp_max[2]; /* Register values */
89 s8 temp_min[2]; 90 int temp_min[2];
90 s8 temp[2]; 91 int temp[2];
91 u8 alarms; 92 u8 alarms;
92 /* Special values for ADM1023 only */ 93 /* Special values for ADM1023 only */
93 u8 remote_temp_prec;
94 u8 remote_temp_os_prec;
95 u8 remote_temp_hyst_prec;
96 u8 remote_temp_offset; 94 u8 remote_temp_offset;
97 u8 remote_temp_offset_prec; 95 u8 remote_temp_offset_prec;
98}; 96};
@@ -141,7 +139,7 @@ static ssize_t show_temp(struct device *dev,
141 int index = to_sensor_dev_attr(devattr)->index; 139 int index = to_sensor_dev_attr(devattr)->index;
142 struct adm1021_data *data = adm1021_update_device(dev); 140 struct adm1021_data *data = adm1021_update_device(dev);
143 141
144 return sprintf(buf, "%d\n", 1000 * data->temp[index]); 142 return sprintf(buf, "%d\n", data->temp[index]);
145} 143}
146 144
147static ssize_t show_temp_max(struct device *dev, 145static ssize_t show_temp_max(struct device *dev,
@@ -150,7 +148,7 @@ static ssize_t show_temp_max(struct device *dev,
150 int index = to_sensor_dev_attr(devattr)->index; 148 int index = to_sensor_dev_attr(devattr)->index;
151 struct adm1021_data *data = adm1021_update_device(dev); 149 struct adm1021_data *data = adm1021_update_device(dev);
152 150
153 return sprintf(buf, "%d\n", 1000 * data->temp_max[index]); 151 return sprintf(buf, "%d\n", data->temp_max[index]);
154} 152}
155 153
156static ssize_t show_temp_min(struct device *dev, 154static ssize_t show_temp_min(struct device *dev,
@@ -159,7 +157,7 @@ static ssize_t show_temp_min(struct device *dev,
159 int index = to_sensor_dev_attr(devattr)->index; 157 int index = to_sensor_dev_attr(devattr)->index;
160 struct adm1021_data *data = adm1021_update_device(dev); 158 struct adm1021_data *data = adm1021_update_device(dev);
161 159
162 return sprintf(buf, "%d\n", 1000 * data->temp_min[index]); 160 return sprintf(buf, "%d\n", data->temp_min[index]);
163} 161}
164 162
165static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, 163static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
@@ -216,6 +214,35 @@ static ssize_t set_temp_min(struct device *dev,
216 return count; 214 return count;
217} 215}
218 216
217static ssize_t show_low_power(struct device *dev,
218 struct device_attribute *devattr, char *buf)
219{
220 struct adm1021_data *data = adm1021_update_device(dev);
221 return sprintf(buf, "%d\n", data->low_power);
222}
223
224static ssize_t set_low_power(struct device *dev,
225 struct device_attribute *devattr,
226 const char *buf, size_t count)
227{
228 struct i2c_client *client = to_i2c_client(dev);
229 struct adm1021_data *data = i2c_get_clientdata(client);
230 int low_power = simple_strtol(buf, NULL, 10) != 0;
231
232 mutex_lock(&data->update_lock);
233 if (low_power != data->low_power) {
234 int config = i2c_smbus_read_byte_data(
235 client, ADM1021_REG_CONFIG_R);
236 data->low_power = low_power;
237 i2c_smbus_write_byte_data(client, ADM1021_REG_CONFIG_W,
238 (config & 0xBF) | (low_power << 6));
239 }
240 mutex_unlock(&data->update_lock);
241
242 return count;
243}
244
245
219static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); 246static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
220static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, 247static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max,
221 set_temp_max, 0); 248 set_temp_max, 0);
@@ -233,6 +260,7 @@ static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
233static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); 260static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2);
234 261
235static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 262static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
263static DEVICE_ATTR(low_power, S_IWUSR | S_IRUGO, show_low_power, set_low_power);
236 264
237static struct attribute *adm1021_attributes[] = { 265static struct attribute *adm1021_attributes[] = {
238 &sensor_dev_attr_temp1_max.dev_attr.attr, 266 &sensor_dev_attr_temp1_max.dev_attr.attr,
@@ -247,6 +275,7 @@ static struct attribute *adm1021_attributes[] = {
247 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr, 275 &sensor_dev_attr_temp2_min_alarm.dev_attr.attr,
248 &sensor_dev_attr_temp2_fault.dev_attr.attr, 276 &sensor_dev_attr_temp2_fault.dev_attr.attr,
249 &dev_attr_alarms.attr, 277 &dev_attr_alarms.attr,
278 &dev_attr_low_power.attr,
250 NULL 279 NULL
251}; 280};
252 281
@@ -412,25 +441,27 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
412 dev_dbg(&client->dev, "Starting adm1021 update\n"); 441 dev_dbg(&client->dev, "Starting adm1021 update\n");
413 442
414 for (i = 0; i < 2; i++) { 443 for (i = 0; i < 2; i++) {
415 data->temp[i] = i2c_smbus_read_byte_data(client, 444 data->temp[i] = 1000 *
416 ADM1021_REG_TEMP(i)); 445 (s8) i2c_smbus_read_byte_data(
417 data->temp_max[i] = i2c_smbus_read_byte_data(client, 446 client, ADM1021_REG_TEMP(i));
418 ADM1021_REG_TOS_R(i)); 447 data->temp_max[i] = 1000 *
419 data->temp_min[i] = i2c_smbus_read_byte_data(client, 448 (s8) i2c_smbus_read_byte_data(
420 ADM1021_REG_THYST_R(i)); 449 client, ADM1021_REG_TOS_R(i));
450 data->temp_min[i] = 1000 *
451 (s8) i2c_smbus_read_byte_data(
452 client, ADM1021_REG_THYST_R(i));
421 } 453 }
422 data->alarms = i2c_smbus_read_byte_data(client, 454 data->alarms = i2c_smbus_read_byte_data(client,
423 ADM1021_REG_STATUS) & 0x7c; 455 ADM1021_REG_STATUS) & 0x7c;
424 if (data->type == adm1023) { 456 if (data->type == adm1023) {
425 data->remote_temp_prec = 457 /* The ADM1023 provides 3 extra bits of precision for
426 i2c_smbus_read_byte_data(client, 458 * the remote sensor in extra registers. */
427 ADM1023_REG_REM_TEMP_PREC); 459 data->temp[1] += 125 * (i2c_smbus_read_byte_data(
428 data->remote_temp_os_prec = 460 client, ADM1023_REG_REM_TEMP_PREC) >> 5);
429 i2c_smbus_read_byte_data(client, 461 data->temp_max[1] += 125 * (i2c_smbus_read_byte_data(
430 ADM1023_REG_REM_TOS_PREC); 462 client, ADM1023_REG_REM_TOS_PREC) >> 5);
431 data->remote_temp_hyst_prec = 463 data->temp_min[1] += 125 * (i2c_smbus_read_byte_data(
432 i2c_smbus_read_byte_data(client, 464 client, ADM1023_REG_REM_THYST_PREC) >> 5);
433 ADM1023_REG_REM_THYST_PREC);
434 data->remote_temp_offset = 465 data->remote_temp_offset =
435 i2c_smbus_read_byte_data(client, 466 i2c_smbus_read_byte_data(client,
436 ADM1023_REG_REM_OFFSET); 467 ADM1023_REG_REM_OFFSET);
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 753b34885f9d..7ea6a8f66056 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -178,6 +178,8 @@ static const int debug;
178static struct platform_device *pdev; 178static struct platform_device *pdev;
179static s16 rest_x; 179static s16 rest_x;
180static s16 rest_y; 180static s16 rest_y;
181static u8 backlight_state[2];
182
181static struct device *hwmon_dev; 183static struct device *hwmon_dev;
182static struct input_polled_dev *applesmc_idev; 184static struct input_polled_dev *applesmc_idev;
183 185
@@ -497,17 +499,36 @@ static int applesmc_probe(struct platform_device *dev)
497 return 0; 499 return 0;
498} 500}
499 501
500static int applesmc_resume(struct platform_device *dev) 502/* Synchronize device with memorized backlight state */
503static int applesmc_pm_resume(struct device *dev)
501{ 504{
502 return applesmc_device_init(); 505 mutex_lock(&applesmc_lock);
506 if (applesmc_light)
507 applesmc_write_key(BACKLIGHT_KEY, backlight_state, 2);
508 mutex_unlock(&applesmc_lock);
509 return 0;
503} 510}
504 511
512/* Reinitialize device on resume from hibernation */
513static int applesmc_pm_restore(struct device *dev)
514{
515 int ret = applesmc_device_init();
516 if (ret)
517 return ret;
518 return applesmc_pm_resume(dev);
519}
520
521static struct dev_pm_ops applesmc_pm_ops = {
522 .resume = applesmc_pm_resume,
523 .restore = applesmc_pm_restore,
524};
525
505static struct platform_driver applesmc_driver = { 526static struct platform_driver applesmc_driver = {
506 .probe = applesmc_probe, 527 .probe = applesmc_probe,
507 .resume = applesmc_resume,
508 .driver = { 528 .driver = {
509 .name = "applesmc", 529 .name = "applesmc",
510 .owner = THIS_MODULE, 530 .owner = THIS_MODULE,
531 .pm = &applesmc_pm_ops,
511 }, 532 },
512}; 533};
513 534
@@ -804,17 +825,10 @@ static ssize_t applesmc_calibrate_store(struct device *dev,
804 return count; 825 return count;
805} 826}
806 827
807/* Store the next backlight value to be written by the work */
808static unsigned int backlight_value;
809
810static void applesmc_backlight_set(struct work_struct *work) 828static void applesmc_backlight_set(struct work_struct *work)
811{ 829{
812 u8 buffer[2];
813
814 mutex_lock(&applesmc_lock); 830 mutex_lock(&applesmc_lock);
815 buffer[0] = backlight_value; 831 applesmc_write_key(BACKLIGHT_KEY, backlight_state, 2);
816 buffer[1] = 0x00;
817 applesmc_write_key(BACKLIGHT_KEY, buffer, 2);
818 mutex_unlock(&applesmc_lock); 832 mutex_unlock(&applesmc_lock);
819} 833}
820static DECLARE_WORK(backlight_work, &applesmc_backlight_set); 834static DECLARE_WORK(backlight_work, &applesmc_backlight_set);
@@ -824,7 +838,7 @@ static void applesmc_brightness_set(struct led_classdev *led_cdev,
824{ 838{
825 int ret; 839 int ret;
826 840
827 backlight_value = value; 841 backlight_state[0] = value;
828 ret = queue_work(applesmc_led_wq, &backlight_work); 842 ret = queue_work(applesmc_led_wq, &backlight_work);
829 843
830 if (debug && (!ret)) 844 if (debug && (!ret))
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 93c17223b527..972cf4ba963c 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -185,7 +185,7 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *
185 } 185 }
186 } 186 }
187 187
188 if (ismobile) { 188 if (ismobile || c->x86_model == 0x1c) {
189 189
190 err = rdmsr_safe_on_cpu(id, 0xee, &eax, &edx); 190 err = rdmsr_safe_on_cpu(id, 0xee, &eax, &edx);
191 if (err) { 191 if (err) {
@@ -417,7 +417,7 @@ static int __init coretemp_init(void)
417 if ((c->cpuid_level < 0) || (c->x86 != 0x6) || 417 if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
418 !((c->x86_model == 0xe) || (c->x86_model == 0xf) || 418 !((c->x86_model == 0xe) || (c->x86_model == 0xf) ||
419 (c->x86_model == 0x16) || (c->x86_model == 0x17) || 419 (c->x86_model == 0x16) || (c->x86_model == 0x17) ||
420 (c->x86_model == 0x1A))) { 420 (c->x86_model == 0x1A) || (c->x86_model == 0x1c))) {
421 421
422 /* supported CPU not found, but report the unknown 422 /* supported CPU not found, but report the unknown
423 family 6 CPU */ 423 family 6 CPU */
diff --git a/drivers/hwmon/lis3lv02d.c b/drivers/hwmon/lis3lv02d.c
index 271338bdb6be..cf5afb9a10ab 100644
--- a/drivers/hwmon/lis3lv02d.c
+++ b/drivers/hwmon/lis3lv02d.c
@@ -454,6 +454,15 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
454 (p->click_thresh_y << 4)); 454 (p->click_thresh_y << 4));
455 } 455 }
456 456
457 if (p->wakeup_flags && (dev->whoami == LIS_SINGLE_ID)) {
458 dev->write(dev, FF_WU_CFG_1, p->wakeup_flags);
459 dev->write(dev, FF_WU_THS_1, p->wakeup_thresh & 0x7f);
460 /* default to 2.5ms for now */
461 dev->write(dev, FF_WU_DURATION_1, 1);
462 /* enable high pass filter for both free-fall units */
463 dev->write(dev, CTRL_REG2, HP_FF_WU1 | HP_FF_WU2);
464 }
465
457 if (p->irq_cfg) 466 if (p->irq_cfg)
458 dev->write(dev, CTRL_REG3, p->irq_cfg); 467 dev->write(dev, CTRL_REG3, p->irq_cfg);
459 } 468 }
diff --git a/drivers/hwmon/lis3lv02d.h b/drivers/hwmon/lis3lv02d.h
index e320e2f511f1..3e1ff46f72d3 100644
--- a/drivers/hwmon/lis3lv02d.h
+++ b/drivers/hwmon/lis3lv02d.h
@@ -58,15 +58,17 @@ enum lis3_reg {
58 OUTZ_L = 0x2C, 58 OUTZ_L = 0x2C,
59 OUTZ_H = 0x2D, 59 OUTZ_H = 0x2D,
60 OUTZ = 0x2D, 60 OUTZ = 0x2D,
61 FF_WU_CFG = 0x30,
62 FF_WU_SRC = 0x31,
63 FF_WU_ACK = 0x32,
64 FF_WU_THS_L = 0x34,
65 FF_WU_THS_H = 0x35,
66 FF_WU_DURATION = 0x36,
67}; 61};
68 62
69enum lis302d_reg { 63enum lis302d_reg {
64 FF_WU_CFG_1 = 0x30,
65 FF_WU_SRC_1 = 0x31,
66 FF_WU_THS_1 = 0x32,
67 FF_WU_DURATION_1 = 0x33,
68 FF_WU_CFG_2 = 0x34,
69 FF_WU_SRC_2 = 0x35,
70 FF_WU_THS_2 = 0x36,
71 FF_WU_DURATION_2 = 0x37,
70 CLICK_CFG = 0x38, 72 CLICK_CFG = 0x38,
71 CLICK_SRC = 0x39, 73 CLICK_SRC = 0x39,
72 CLICK_THSY_X = 0x3B, 74 CLICK_THSY_X = 0x3B,
@@ -77,6 +79,12 @@ enum lis302d_reg {
77}; 79};
78 80
79enum lis3lv02d_reg { 81enum lis3lv02d_reg {
82 FF_WU_CFG = 0x30,
83 FF_WU_SRC = 0x31,
84 FF_WU_ACK = 0x32,
85 FF_WU_THS_L = 0x34,
86 FF_WU_THS_H = 0x35,
87 FF_WU_DURATION = 0x36,
80 DD_CFG = 0x38, 88 DD_CFG = 0x38,
81 DD_SRC = 0x39, 89 DD_SRC = 0x39,
82 DD_ACK = 0x3A, 90 DD_ACK = 0x3A,
@@ -107,6 +115,10 @@ enum lis3lv02d_ctrl2 {
107 CTRL2_FS = 0x80, /* Full Scale selection */ 115 CTRL2_FS = 0x80, /* Full Scale selection */
108}; 116};
109 117
118enum lis302d_ctrl2 {
119 HP_FF_WU2 = 0x08,
120 HP_FF_WU1 = 0x04,
121};
110 122
111enum lis3lv02d_ctrl3 { 123enum lis3lv02d_ctrl3 {
112 CTRL3_CFS0 = 0x01, 124 CTRL3_CFS0 = 0x01,
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 3827ff04485f..82ebca5a699c 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -66,17 +66,16 @@ static int __devinit lis302dl_spi_probe(struct spi_device *spi)
66 if (ret < 0) 66 if (ret < 0)
67 return ret; 67 return ret;
68 68
69 lis3_dev.bus_priv = spi; 69 lis3_dev.bus_priv = spi;
70 lis3_dev.init = lis3_spi_init; 70 lis3_dev.init = lis3_spi_init;
71 lis3_dev.read = lis3_spi_read; 71 lis3_dev.read = lis3_spi_read;
72 lis3_dev.write = lis3_spi_write; 72 lis3_dev.write = lis3_spi_write;
73 lis3_dev.irq = spi->irq; 73 lis3_dev.irq = spi->irq;
74 lis3_dev.ac = lis3lv02d_axis_normal; 74 lis3_dev.ac = lis3lv02d_axis_normal;
75 lis3_dev.pdata = spi->dev.platform_data; 75 lis3_dev.pdata = spi->dev.platform_data;
76 spi_set_drvdata(spi, &lis3_dev); 76 spi_set_drvdata(spi, &lis3_dev);
77 77
78 ret = lis3lv02d_init_device(&lis3_dev); 78 return lis3lv02d_init_device(&lis3_dev);
79 return ret;
80} 79}
81 80
82static int __devexit lis302dl_spi_remove(struct spi_device *spi) 81static int __devexit lis302dl_spi_remove(struct spi_device *spi)
@@ -87,6 +86,32 @@ static int __devexit lis302dl_spi_remove(struct spi_device *spi)
87 return 0; 86 return 0;
88} 87}
89 88
89#ifdef CONFIG_PM
90static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg)
91{
92 struct lis3lv02d *lis3 = spi_get_drvdata(spi);
93
94 if (!lis3->pdata->wakeup_flags)
95 lis3lv02d_poweroff(&lis3_dev);
96
97 return 0;
98}
99
100static int lis3lv02d_spi_resume(struct spi_device *spi)
101{
102 struct lis3lv02d *lis3 = spi_get_drvdata(spi);
103
104 if (!lis3->pdata->wakeup_flags)
105 lis3lv02d_poweron(lis3);
106
107 return 0;
108}
109
110#else
111#define lis3lv02d_spi_suspend NULL
112#define lis3lv02d_spi_resume NULL
113#endif
114
90static struct spi_driver lis302dl_spi_driver = { 115static struct spi_driver lis302dl_spi_driver = {
91 .driver = { 116 .driver = {
92 .name = DRV_NAME, 117 .name = DRV_NAME,
@@ -94,6 +119,8 @@ static struct spi_driver lis302dl_spi_driver = {
94 }, 119 },
95 .probe = lis302dl_spi_probe, 120 .probe = lis302dl_spi_probe,
96 .remove = __devexit_p(lis302dl_spi_remove), 121 .remove = __devexit_p(lis302dl_spi_remove),
122 .suspend = lis3lv02d_spi_suspend,
123 .resume = lis3lv02d_spi_resume,
97}; 124};
98 125
99static int __init lis302dl_init(void) 126static int __init lis302dl_init(void)
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index 6290a259456e..303c02694c3c 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -562,7 +562,7 @@ static int __devinit sht15_probe(struct platform_device *pdev)
562 ret = sysfs_create_group(&pdev->dev.kobj, &sht15_attr_group); 562 ret = sysfs_create_group(&pdev->dev.kobj, &sht15_attr_group);
563 if (ret) { 563 if (ret) {
564 dev_err(&pdev->dev, "sysfs create failed"); 564 dev_err(&pdev->dev, "sysfs create failed");
565 goto err_free_data; 565 goto err_release_gpio_data;
566 } 566 }
567 567
568 ret = request_irq(gpio_to_irq(data->pdata->gpio_data), 568 ret = request_irq(gpio_to_irq(data->pdata->gpio_data),
@@ -581,10 +581,12 @@ static int __devinit sht15_probe(struct platform_device *pdev)
581 data->hwmon_dev = hwmon_device_register(data->dev); 581 data->hwmon_dev = hwmon_device_register(data->dev);
582 if (IS_ERR(data->hwmon_dev)) { 582 if (IS_ERR(data->hwmon_dev)) {
583 ret = PTR_ERR(data->hwmon_dev); 583 ret = PTR_ERR(data->hwmon_dev);
584 goto err_release_gpio_data; 584 goto err_release_irq;
585 } 585 }
586 return 0; 586 return 0;
587 587
588err_release_irq:
589 free_irq(gpio_to_irq(data->pdata->gpio_data), data);
588err_release_gpio_data: 590err_release_gpio_data:
589 gpio_free(data->pdata->gpio_data); 591 gpio_free(data->pdata->gpio_data);
590err_release_gpio_sck: 592err_release_gpio_sck:
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index b79ca419d8d9..64207df8da82 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1686,7 +1686,7 @@ static int idecd_revalidate_disk(struct gendisk *disk)
1686 return 0; 1686 return 0;
1687} 1687}
1688 1688
1689static struct block_device_operations idecd_ops = { 1689static const struct block_device_operations idecd_ops = {
1690 .owner = THIS_MODULE, 1690 .owner = THIS_MODULE,
1691 .open = idecd_open, 1691 .open = idecd_open,
1692 .release = idecd_release, 1692 .release = idecd_release,
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index 214119026b3f..753241429c26 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -321,7 +321,7 @@ static int ide_gd_ioctl(struct block_device *bdev, fmode_t mode,
321 return drive->disk_ops->ioctl(drive, bdev, mode, cmd, arg); 321 return drive->disk_ops->ioctl(drive, bdev, mode, cmd, arg);
322} 322}
323 323
324static struct block_device_operations ide_gd_ops = { 324static const struct block_device_operations ide_gd_ops = {
325 .owner = THIS_MODULE, 325 .owner = THIS_MODULE,
326 .open = ide_gd_open, 326 .open = ide_gd_open,
327 .release = ide_gd_release, 327 .release = ide_gd_release,
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 8de442cbee94..63c53d65e875 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1212,7 +1212,7 @@ static int ide_find_port_slot(const struct ide_port_info *d)
1212{ 1212{
1213 int idx = -ENOENT; 1213 int idx = -ENOENT;
1214 u8 bootable = (d && (d->host_flags & IDE_HFLAG_NON_BOOTABLE)) ? 0 : 1; 1214 u8 bootable = (d && (d->host_flags & IDE_HFLAG_NON_BOOTABLE)) ? 0 : 1;
1215 u8 i = (d && (d->host_flags & IDE_HFLAG_QD_2ND_PORT)) ? 1 : 0;; 1215 u8 i = (d && (d->host_flags & IDE_HFLAG_QD_2ND_PORT)) ? 1 : 0;
1216 1216
1217 /* 1217 /*
1218 * Claim an unassigned slot. 1218 * Claim an unassigned slot.
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 9d6f62baac27..58fc920d5c32 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1913,7 +1913,7 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode,
1913 return err; 1913 return err;
1914} 1914}
1915 1915
1916static struct block_device_operations idetape_block_ops = { 1916static const struct block_device_operations idetape_block_ops = {
1917 .owner = THIS_MODULE, 1917 .owner = THIS_MODULE,
1918 .open = idetape_open, 1918 .open = idetape_open,
1919 .release = idetape_release, 1919 .release = idetape_release,
diff --git a/drivers/ide/umc8672.c b/drivers/ide/umc8672.c
index 0608d41fb6d0..60f936e2319c 100644
--- a/drivers/ide/umc8672.c
+++ b/drivers/ide/umc8672.c
@@ -170,9 +170,9 @@ static int __init umc8672_init(void)
170 goto out; 170 goto out;
171 171
172 if (umc8672_probe() == 0) 172 if (umc8672_probe() == 0)
173 return 0;; 173 return 0;
174out: 174out:
175 return -ENODEV;; 175 return -ENODEV;
176} 176}
177 177
178module_init(umc8672_init); 178module_init(umc8672_init);
diff --git a/drivers/infiniband/hw/ipath/ipath_iba6110.c b/drivers/infiniband/hw/ipath/ipath_iba6110.c
index 02831ad070b8..4bd39c8af80f 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba6110.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba6110.c
@@ -809,7 +809,7 @@ static int ipath_setup_ht_reset(struct ipath_devdata *dd)
809 * errors. We only bother to do this at load time, because it's OK if 809 * errors. We only bother to do this at load time, because it's OK if
810 * it happened before we were loaded (first time after boot/reset), 810 * it happened before we were loaded (first time after boot/reset),
811 * but any time after that, it's fatal anyway. Also need to not check 811 * but any time after that, it's fatal anyway. Also need to not check
812 * for for upper byte errors if we are in 8 bit mode, so figure out 812 * for upper byte errors if we are in 8 bit mode, so figure out
813 * our width. For now, at least, also complain if it's 8 bit. 813 * our width. For now, at least, also complain if it's 8 bit.
814 */ 814 */
815static void slave_or_pri_blk(struct ipath_devdata *dd, struct pci_dev *pdev, 815static void slave_or_pri_blk(struct ipath_devdata *dd, struct pci_dev *pdev,
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index c9523e48c6ad..adb09e2ba394 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -229,7 +229,7 @@ struct atkbd {
229}; 229};
230 230
231/* 231/*
232 * System-specific ketymap fixup routine 232 * System-specific keymap fixup routine
233 */ 233 */
234static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); 234static void (*atkbd_platform_fixup)(struct atkbd *, const void *data);
235static void *atkbd_platform_fixup_data; 235static void *atkbd_platform_fixup_data;
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 1a50be379cbc..76d6751f89a7 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -222,6 +222,22 @@ config INPUT_SGI_BTNS
222 To compile this driver as a module, choose M here: the 222 To compile this driver as a module, choose M here: the
223 module will be called sgi_btns. 223 module will be called sgi_btns.
224 224
225config INPUT_WINBOND_CIR
226 tristate "Winbond IR remote control"
227 depends on X86 && PNP
228 select LEDS_CLASS
229 select BITREVERSE
230 help
231 Say Y here if you want to use the IR remote functionality found
232 in some Winbond SuperI/O chips. Currently only the WPCD376I
233 chip is supported (included in some Intel Media series motherboards).
234
235 IR Receive and wake-on-IR from suspend and power-off is currently
236 supported.
237
238 To compile this driver as a module, choose M here: the module will be
239 called winbond_cir.
240
225config HP_SDC_RTC 241config HP_SDC_RTC
226 tristate "HP SDC Real Time Clock" 242 tristate "HP SDC Real Time Clock"
227 depends on (GSC || HP300) && SERIO 243 depends on (GSC || HP300) && SERIO
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index bf4db626c313..a8b84854fb7b 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
26obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o 26obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
27obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o 27obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o
28obj-$(CONFIG_INPUT_UINPUT) += uinput.o 28obj-$(CONFIG_INPUT_UINPUT) += uinput.o
29obj-$(CONFIG_INPUT_WINBOND_CIR) += winbond-cir.o
29obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o 30obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
30obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o 31obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o
31obj-$(CONFIG_INPUT_YEALINK) += yealink.o 32obj-$(CONFIG_INPUT_YEALINK) += yealink.o
diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c
new file mode 100644
index 000000000000..33309fe44e20
--- /dev/null
+++ b/drivers/input/misc/winbond-cir.c
@@ -0,0 +1,1614 @@
1/*
2 * winbond-cir.c - Driver for the Consumer IR functionality of Winbond
3 * SuperI/O chips.
4 *
5 * Currently supports the Winbond WPCD376i chip (PNP id WEC1022), but
6 * could probably support others (Winbond WEC102X, NatSemi, etc)
7 * with minor modifications.
8 *
9 * Original Author: David Härdeman <david@hardeman.nu>
10 * Copyright (C) 2009 David Härdeman <david@hardeman.nu>
11 *
12 * Dedicated to Matilda, my newborn daughter, without whose loving attention
13 * this driver would have been finished in half the time and with a fraction
14 * of the bugs.
15 *
16 * Written using:
17 * o Winbond WPCD376I datasheet helpfully provided by Jesse Barnes at Intel
18 * o NatSemi PC87338/PC97338 datasheet (for the serial port stuff)
19 * o DSDT dumps
20 *
21 * Supported features:
22 * o RC6
23 * o Wake-On-CIR functionality
24 *
25 * To do:
26 * o Test NEC and RC5
27 *
28 * Left as an exercise for the reader:
29 * o Learning (I have neither the hardware, nor the need)
30 * o IR Transmit (ibid)
31 *
32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version.
36 *
37 * This program is distributed in the hope that it will be useful,
38 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 * GNU General Public License for more details.
41 *
42 * You should have received a copy of the GNU General Public License
43 * along with this program; if not, write to the Free Software
44 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
45 */
46
47#include <linux/module.h>
48#include <linux/pnp.h>
49#include <linux/interrupt.h>
50#include <linux/timer.h>
51#include <linux/input.h>
52#include <linux/leds.h>
53#include <linux/list.h>
54#include <linux/spinlock.h>
55#include <linux/pci_ids.h>
56#include <linux/io.h>
57#include <linux/bitrev.h>
58#include <linux/bitops.h>
59
60#define DRVNAME "winbond-cir"
61
62/* CEIR Wake-Up Registers, relative to data->wbase */
63#define WBCIR_REG_WCEIR_CTL 0x03 /* CEIR Receiver Control */
64#define WBCIR_REG_WCEIR_STS 0x04 /* CEIR Receiver Status */
65#define WBCIR_REG_WCEIR_EV_EN 0x05 /* CEIR Receiver Event Enable */
66#define WBCIR_REG_WCEIR_CNTL 0x06 /* CEIR Receiver Counter Low */
67#define WBCIR_REG_WCEIR_CNTH 0x07 /* CEIR Receiver Counter High */
68#define WBCIR_REG_WCEIR_INDEX 0x08 /* CEIR Receiver Index */
69#define WBCIR_REG_WCEIR_DATA 0x09 /* CEIR Receiver Data */
70#define WBCIR_REG_WCEIR_CSL 0x0A /* CEIR Re. Compare Strlen */
71#define WBCIR_REG_WCEIR_CFG1 0x0B /* CEIR Re. Configuration 1 */
72#define WBCIR_REG_WCEIR_CFG2 0x0C /* CEIR Re. Configuration 2 */
73
74/* CEIR Enhanced Functionality Registers, relative to data->ebase */
75#define WBCIR_REG_ECEIR_CTS 0x00 /* Enhanced IR Control Status */
76#define WBCIR_REG_ECEIR_CCTL 0x01 /* Infrared Counter Control */
77#define WBCIR_REG_ECEIR_CNT_LO 0x02 /* Infrared Counter LSB */
78#define WBCIR_REG_ECEIR_CNT_HI 0x03 /* Infrared Counter MSB */
79#define WBCIR_REG_ECEIR_IREM 0x04 /* Infrared Emitter Status */
80
81/* SP3 Banked Registers, relative to data->sbase */
82#define WBCIR_REG_SP3_BSR 0x03 /* Bank Select, all banks */
83 /* Bank 0 */
84#define WBCIR_REG_SP3_RXDATA 0x00 /* FIFO RX data (r) */
85#define WBCIR_REG_SP3_TXDATA 0x00 /* FIFO TX data (w) */
86#define WBCIR_REG_SP3_IER 0x01 /* Interrupt Enable */
87#define WBCIR_REG_SP3_EIR 0x02 /* Event Identification (r) */
88#define WBCIR_REG_SP3_FCR 0x02 /* FIFO Control (w) */
89#define WBCIR_REG_SP3_MCR 0x04 /* Mode Control */
90#define WBCIR_REG_SP3_LSR 0x05 /* Link Status */
91#define WBCIR_REG_SP3_MSR 0x06 /* Modem Status */
92#define WBCIR_REG_SP3_ASCR 0x07 /* Aux Status and Control */
93 /* Bank 2 */
94#define WBCIR_REG_SP3_BGDL 0x00 /* Baud Divisor LSB */
95#define WBCIR_REG_SP3_BGDH 0x01 /* Baud Divisor MSB */
96#define WBCIR_REG_SP3_EXCR1 0x02 /* Extended Control 1 */
97#define WBCIR_REG_SP3_EXCR2 0x04 /* Extended Control 2 */
98#define WBCIR_REG_SP3_TXFLV 0x06 /* TX FIFO Level */
99#define WBCIR_REG_SP3_RXFLV 0x07 /* RX FIFO Level */
100 /* Bank 3 */
101#define WBCIR_REG_SP3_MRID 0x00 /* Module Identification */
102#define WBCIR_REG_SP3_SH_LCR 0x01 /* LCR Shadow */
103#define WBCIR_REG_SP3_SH_FCR 0x02 /* FCR Shadow */
104 /* Bank 4 */
105#define WBCIR_REG_SP3_IRCR1 0x02 /* Infrared Control 1 */
106 /* Bank 5 */
107#define WBCIR_REG_SP3_IRCR2 0x04 /* Infrared Control 2 */
108 /* Bank 6 */
109#define WBCIR_REG_SP3_IRCR3 0x00 /* Infrared Control 3 */
110#define WBCIR_REG_SP3_SIR_PW 0x02 /* SIR Pulse Width */
111 /* Bank 7 */
112#define WBCIR_REG_SP3_IRRXDC 0x00 /* IR RX Demod Control */
113#define WBCIR_REG_SP3_IRTXMC 0x01 /* IR TX Mod Control */
114#define WBCIR_REG_SP3_RCCFG 0x02 /* CEIR Config */
115#define WBCIR_REG_SP3_IRCFG1 0x04 /* Infrared Config 1 */
116#define WBCIR_REG_SP3_IRCFG4 0x07 /* Infrared Config 4 */
117
118/*
119 * Magic values follow
120 */
121
122/* No interrupts for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
123#define WBCIR_IRQ_NONE 0x00
124/* RX data bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
125#define WBCIR_IRQ_RX 0x01
126/* Over/Under-flow bit for WBCIR_REG_SP3_IER and WBCIR_REG_SP3_EIR */
127#define WBCIR_IRQ_ERR 0x04
128/* Led enable/disable bit for WBCIR_REG_ECEIR_CTS */
129#define WBCIR_LED_ENABLE 0x80
130/* RX data available bit for WBCIR_REG_SP3_LSR */
131#define WBCIR_RX_AVAIL 0x01
132/* RX disable bit for WBCIR_REG_SP3_ASCR */
133#define WBCIR_RX_DISABLE 0x20
134/* Extended mode enable bit for WBCIR_REG_SP3_EXCR1 */
135#define WBCIR_EXT_ENABLE 0x01
136/* Select compare register in WBCIR_REG_WCEIR_INDEX (bits 5 & 6) */
137#define WBCIR_REGSEL_COMPARE 0x10
138/* Select mask register in WBCIR_REG_WCEIR_INDEX (bits 5 & 6) */
139#define WBCIR_REGSEL_MASK 0x20
140/* Starting address of selected register in WBCIR_REG_WCEIR_INDEX */
141#define WBCIR_REG_ADDR0 0x00
142
143/* Valid banks for the SP3 UART */
144enum wbcir_bank {
145 WBCIR_BANK_0 = 0x00,
146 WBCIR_BANK_1 = 0x80,
147 WBCIR_BANK_2 = 0xE0,
148 WBCIR_BANK_3 = 0xE4,
149 WBCIR_BANK_4 = 0xE8,
150 WBCIR_BANK_5 = 0xEC,
151 WBCIR_BANK_6 = 0xF0,
152 WBCIR_BANK_7 = 0xF4,
153};
154
155/* Supported IR Protocols */
156enum wbcir_protocol {
157 IR_PROTOCOL_RC5 = 0x0,
158 IR_PROTOCOL_NEC = 0x1,
159 IR_PROTOCOL_RC6 = 0x2,
160};
161
162/* Misc */
163#define WBCIR_NAME "Winbond CIR"
164#define WBCIR_ID_FAMILY 0xF1 /* Family ID for the WPCD376I */
165#define WBCIR_ID_CHIP 0x04 /* Chip ID for the WPCD376I */
166#define IR_KEYPRESS_TIMEOUT 250 /* FIXME: should be per-protocol? */
167#define INVALID_SCANCODE 0x7FFFFFFF /* Invalid with all protos */
168#define WAKEUP_IOMEM_LEN 0x10 /* Wake-Up I/O Reg Len */
169#define EHFUNC_IOMEM_LEN 0x10 /* Enhanced Func I/O Reg Len */
170#define SP_IOMEM_LEN 0x08 /* Serial Port 3 (IR) Reg Len */
171#define WBCIR_MAX_IDLE_BYTES 10
172
173static DEFINE_SPINLOCK(wbcir_lock);
174static DEFINE_RWLOCK(keytable_lock);
175
176struct wbcir_key {
177 u32 scancode;
178 unsigned int keycode;
179};
180
181struct wbcir_keyentry {
182 struct wbcir_key key;
183 struct list_head list;
184};
185
186static struct wbcir_key rc6_def_keymap[] = {
187 { 0x800F0400, KEY_NUMERIC_0 },
188 { 0x800F0401, KEY_NUMERIC_1 },
189 { 0x800F0402, KEY_NUMERIC_2 },
190 { 0x800F0403, KEY_NUMERIC_3 },
191 { 0x800F0404, KEY_NUMERIC_4 },
192 { 0x800F0405, KEY_NUMERIC_5 },
193 { 0x800F0406, KEY_NUMERIC_6 },
194 { 0x800F0407, KEY_NUMERIC_7 },
195 { 0x800F0408, KEY_NUMERIC_8 },
196 { 0x800F0409, KEY_NUMERIC_9 },
197 { 0x800F041D, KEY_NUMERIC_STAR },
198 { 0x800F041C, KEY_NUMERIC_POUND },
199 { 0x800F0410, KEY_VOLUMEUP },
200 { 0x800F0411, KEY_VOLUMEDOWN },
201 { 0x800F0412, KEY_CHANNELUP },
202 { 0x800F0413, KEY_CHANNELDOWN },
203 { 0x800F040E, KEY_MUTE },
204 { 0x800F040D, KEY_VENDOR }, /* Vista Logo Key */
205 { 0x800F041E, KEY_UP },
206 { 0x800F041F, KEY_DOWN },
207 { 0x800F0420, KEY_LEFT },
208 { 0x800F0421, KEY_RIGHT },
209 { 0x800F0422, KEY_OK },
210 { 0x800F0423, KEY_ESC },
211 { 0x800F040F, KEY_INFO },
212 { 0x800F040A, KEY_CLEAR },
213 { 0x800F040B, KEY_ENTER },
214 { 0x800F045B, KEY_RED },
215 { 0x800F045C, KEY_GREEN },
216 { 0x800F045D, KEY_YELLOW },
217 { 0x800F045E, KEY_BLUE },
218 { 0x800F045A, KEY_TEXT },
219 { 0x800F0427, KEY_SWITCHVIDEOMODE },
220 { 0x800F040C, KEY_POWER },
221 { 0x800F0450, KEY_RADIO },
222 { 0x800F0448, KEY_PVR },
223 { 0x800F0447, KEY_AUDIO },
224 { 0x800F0426, KEY_EPG },
225 { 0x800F0449, KEY_CAMERA },
226 { 0x800F0425, KEY_TV },
227 { 0x800F044A, KEY_VIDEO },
228 { 0x800F0424, KEY_DVD },
229 { 0x800F0416, KEY_PLAY },
230 { 0x800F0418, KEY_PAUSE },
231 { 0x800F0419, KEY_STOP },
232 { 0x800F0414, KEY_FASTFORWARD },
233 { 0x800F041A, KEY_NEXT },
234 { 0x800F041B, KEY_PREVIOUS },
235 { 0x800F0415, KEY_REWIND },
236 { 0x800F0417, KEY_RECORD },
237};
238
239/* Registers and other state is protected by wbcir_lock */
240struct wbcir_data {
241 unsigned long wbase; /* Wake-Up Baseaddr */
242 unsigned long ebase; /* Enhanced Func. Baseaddr */
243 unsigned long sbase; /* Serial Port Baseaddr */
244 unsigned int irq; /* Serial Port IRQ */
245
246 struct input_dev *input_dev;
247 struct timer_list timer_keyup;
248 struct led_trigger *rxtrigger;
249 struct led_trigger *txtrigger;
250 struct led_classdev led;
251
252 u32 last_scancode;
253 unsigned int last_keycode;
254 u8 last_toggle;
255 u8 keypressed;
256 unsigned long keyup_jiffies;
257 unsigned int idle_count;
258
259 /* RX irdata and parsing state */
260 unsigned long irdata[30];
261 unsigned int irdata_count;
262 unsigned int irdata_idle;
263 unsigned int irdata_off;
264 unsigned int irdata_error;
265
266 /* Protected by keytable_lock */
267 struct list_head keytable;
268};
269
270static enum wbcir_protocol protocol = IR_PROTOCOL_RC6;
271module_param(protocol, uint, 0444);
272MODULE_PARM_DESC(protocol, "IR protocol to use "
273 "(0 = RC5, 1 = NEC, 2 = RC6A, default)");
274
275static int invert; /* default = 0 */
276module_param(invert, bool, 0444);
277MODULE_PARM_DESC(invert, "Invert the signal from the IR receiver");
278
279static unsigned int wake_sc = 0x800F040C;
280module_param(wake_sc, uint, 0644);
281MODULE_PARM_DESC(wake_sc, "Scancode of the power-on IR command");
282
283static unsigned int wake_rc6mode = 6;
284module_param(wake_rc6mode, uint, 0644);
285MODULE_PARM_DESC(wake_rc6mode, "RC6 mode for the power-on command "
286 "(0 = 0, 6 = 6A, default)");
287
288
289
290/*****************************************************************************
291 *
292 * UTILITY FUNCTIONS
293 *
294 *****************************************************************************/
295
296/* Caller needs to hold wbcir_lock */
297static void
298wbcir_set_bits(unsigned long addr, u8 bits, u8 mask)
299{
300 u8 val;
301
302 val = inb(addr);
303 val = ((val & ~mask) | (bits & mask));
304 outb(val, addr);
305}
306
307/* Selects the register bank for the serial port */
308static inline void
309wbcir_select_bank(struct wbcir_data *data, enum wbcir_bank bank)
310{
311 outb(bank, data->sbase + WBCIR_REG_SP3_BSR);
312}
313
314static enum led_brightness
315wbcir_led_brightness_get(struct led_classdev *led_cdev)
316{
317 struct wbcir_data *data = container_of(led_cdev,
318 struct wbcir_data,
319 led);
320
321 if (inb(data->ebase + WBCIR_REG_ECEIR_CTS) & WBCIR_LED_ENABLE)
322 return LED_FULL;
323 else
324 return LED_OFF;
325}
326
327static void
328wbcir_led_brightness_set(struct led_classdev *led_cdev,
329 enum led_brightness brightness)
330{
331 struct wbcir_data *data = container_of(led_cdev,
332 struct wbcir_data,
333 led);
334
335 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CTS,
336 brightness == LED_OFF ? 0x00 : WBCIR_LED_ENABLE,
337 WBCIR_LED_ENABLE);
338}
339
340/* Manchester encodes bits to RC6 message cells (see wbcir_parse_rc6) */
341static u8
342wbcir_to_rc6cells(u8 val)
343{
344 u8 coded = 0x00;
345 int i;
346
347 val &= 0x0F;
348 for (i = 0; i < 4; i++) {
349 if (val & 0x01)
350 coded |= 0x02 << (i * 2);
351 else
352 coded |= 0x01 << (i * 2);
353 val >>= 1;
354 }
355
356 return coded;
357}
358
359
360
361/*****************************************************************************
362 *
363 * INPUT FUNCTIONS
364 *
365 *****************************************************************************/
366
367static unsigned int
368wbcir_do_getkeycode(struct wbcir_data *data, u32 scancode)
369{
370 struct wbcir_keyentry *keyentry;
371 unsigned int keycode = KEY_RESERVED;
372 unsigned long flags;
373
374 read_lock_irqsave(&keytable_lock, flags);
375
376 list_for_each_entry(keyentry, &data->keytable, list) {
377 if (keyentry->key.scancode == scancode) {
378 keycode = keyentry->key.keycode;
379 break;
380 }
381 }
382
383 read_unlock_irqrestore(&keytable_lock, flags);
384 return keycode;
385}
386
387static int
388wbcir_getkeycode(struct input_dev *dev, int scancode, int *keycode)
389{
390 struct wbcir_data *data = input_get_drvdata(dev);
391
392 *keycode = (int)wbcir_do_getkeycode(data, (u32)scancode);
393 return 0;
394}
395
396static int
397wbcir_setkeycode(struct input_dev *dev, int sscancode, int keycode)
398{
399 struct wbcir_data *data = input_get_drvdata(dev);
400 struct wbcir_keyentry *keyentry;
401 struct wbcir_keyentry *new_keyentry;
402 unsigned long flags;
403 unsigned int old_keycode = KEY_RESERVED;
404 u32 scancode = (u32)sscancode;
405
406 if (keycode < 0 || keycode > KEY_MAX)
407 return -EINVAL;
408
409 new_keyentry = kmalloc(sizeof(*new_keyentry), GFP_KERNEL);
410 if (!new_keyentry)
411 return -ENOMEM;
412
413 write_lock_irqsave(&keytable_lock, flags);
414
415 list_for_each_entry(keyentry, &data->keytable, list) {
416 if (keyentry->key.scancode != scancode)
417 continue;
418
419 old_keycode = keyentry->key.keycode;
420 keyentry->key.keycode = keycode;
421
422 if (keyentry->key.keycode == KEY_RESERVED) {
423 list_del(&keyentry->list);
424 kfree(keyentry);
425 }
426
427 break;
428 }
429
430 set_bit(keycode, dev->keybit);
431
432 if (old_keycode == KEY_RESERVED) {
433 new_keyentry->key.scancode = scancode;
434 new_keyentry->key.keycode = keycode;
435 list_add(&new_keyentry->list, &data->keytable);
436 } else {
437 kfree(new_keyentry);
438 clear_bit(old_keycode, dev->keybit);
439 list_for_each_entry(keyentry, &data->keytable, list) {
440 if (keyentry->key.keycode == old_keycode) {
441 set_bit(old_keycode, dev->keybit);
442 break;
443 }
444 }
445 }
446
447 write_unlock_irqrestore(&keytable_lock, flags);
448 return 0;
449}
450
451/*
452 * Timer function to report keyup event some time after keydown is
453 * reported by the ISR.
454 */
455static void
456wbcir_keyup(unsigned long cookie)
457{
458 struct wbcir_data *data = (struct wbcir_data *)cookie;
459 unsigned long flags;
460
461 /*
462 * data->keyup_jiffies is used to prevent a race condition if a
463 * hardware interrupt occurs at this point and the keyup timer
464 * event is moved further into the future as a result.
465 *
466 * The timer will then be reactivated and this function called
467 * again in the future. We need to exit gracefully in that case
468 * to allow the input subsystem to do its auto-repeat magic or
469 * a keyup event might follow immediately after the keydown.
470 */
471
472 spin_lock_irqsave(&wbcir_lock, flags);
473
474 if (time_is_after_eq_jiffies(data->keyup_jiffies) && data->keypressed) {
475 data->keypressed = 0;
476 led_trigger_event(data->rxtrigger, LED_OFF);
477 input_report_key(data->input_dev, data->last_keycode, 0);
478 input_sync(data->input_dev);
479 }
480
481 spin_unlock_irqrestore(&wbcir_lock, flags);
482}
483
484static void
485wbcir_keydown(struct wbcir_data *data, u32 scancode, u8 toggle)
486{
487 unsigned int keycode;
488
489 /* Repeat? */
490 if (data->last_scancode == scancode &&
491 data->last_toggle == toggle &&
492 data->keypressed)
493 goto set_timer;
494 data->last_scancode = scancode;
495
496 /* Do we need to release an old keypress? */
497 if (data->keypressed) {
498 input_report_key(data->input_dev, data->last_keycode, 0);
499 input_sync(data->input_dev);
500 data->keypressed = 0;
501 }
502
503 /* Report scancode */
504 input_event(data->input_dev, EV_MSC, MSC_SCAN, (int)scancode);
505
506 /* Do we know this scancode? */
507 keycode = wbcir_do_getkeycode(data, scancode);
508 if (keycode == KEY_RESERVED)
509 goto set_timer;
510
511 /* Register a keypress */
512 input_report_key(data->input_dev, keycode, 1);
513 data->keypressed = 1;
514 data->last_keycode = keycode;
515 data->last_toggle = toggle;
516
517set_timer:
518 input_sync(data->input_dev);
519 led_trigger_event(data->rxtrigger,
520 data->keypressed ? LED_FULL : LED_OFF);
521 data->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT);
522 mod_timer(&data->timer_keyup, data->keyup_jiffies);
523}
524
525
526
527/*****************************************************************************
528 *
529 * IR PARSING FUNCTIONS
530 *
531 *****************************************************************************/
532
533/* Resets all irdata */
534static void
535wbcir_reset_irdata(struct wbcir_data *data)
536{
537 memset(data->irdata, 0, sizeof(data->irdata));
538 data->irdata_count = 0;
539 data->irdata_off = 0;
540 data->irdata_error = 0;
541}
542
543/* Adds one bit of irdata */
544static void
545add_irdata_bit(struct wbcir_data *data, int set)
546{
547 if (data->irdata_count >= sizeof(data->irdata) * 8) {
548 data->irdata_error = 1;
549 return;
550 }
551
552 if (set)
553 __set_bit(data->irdata_count, data->irdata);
554 data->irdata_count++;
555}
556
557/* Gets count bits of irdata */
558static u16
559get_bits(struct wbcir_data *data, int count)
560{
561 u16 val = 0x0;
562
563 if (data->irdata_count - data->irdata_off < count) {
564 data->irdata_error = 1;
565 return 0x0;
566 }
567
568 while (count > 0) {
569 val <<= 1;
570 if (test_bit(data->irdata_off, data->irdata))
571 val |= 0x1;
572 count--;
573 data->irdata_off++;
574 }
575
576 return val;
577}
578
579/* Reads 16 cells and converts them to a byte */
580static u8
581wbcir_rc6cells_to_byte(struct wbcir_data *data)
582{
583 u16 raw = get_bits(data, 16);
584 u8 val = 0x00;
585 int bit;
586
587 for (bit = 0; bit < 8; bit++) {
588 switch (raw & 0x03) {
589 case 0x01:
590 break;
591 case 0x02:
592 val |= (0x01 << bit);
593 break;
594 default:
595 data->irdata_error = 1;
596 break;
597 }
598 raw >>= 2;
599 }
600
601 return val;
602}
603
604/* Decodes a number of bits from raw RC5 data */
605static u8
606wbcir_get_rc5bits(struct wbcir_data *data, unsigned int count)
607{
608 u16 raw = get_bits(data, count * 2);
609 u8 val = 0x00;
610 int bit;
611
612 for (bit = 0; bit < count; bit++) {
613 switch (raw & 0x03) {
614 case 0x01:
615 val |= (0x01 << bit);
616 break;
617 case 0x02:
618 break;
619 default:
620 data->irdata_error = 1;
621 break;
622 }
623 raw >>= 2;
624 }
625
626 return val;
627}
628
629static void
630wbcir_parse_rc6(struct device *dev, struct wbcir_data *data)
631{
632 /*
633 * Normal bits are manchester coded as follows:
634 * cell0 + cell1 = logic "0"
635 * cell1 + cell0 = logic "1"
636 *
637 * The IR pulse has the following components:
638 *
639 * Leader - 6 * cell1 - discarded
640 * Gap - 2 * cell0 - discarded
641 * Start bit - Normal Coding - always "1"
642 * Mode Bit 2 - 0 - Normal Coding
643 * Toggle bit - Normal Coding with double bit time,
644 * e.g. cell0 + cell0 + cell1 + cell1
645 * means logic "0".
646 *
647 * The rest depends on the mode, the following modes are known:
648 *
649 * MODE 0:
650 * Address Bit 7 - 0 - Normal Coding
651 * Command Bit 7 - 0 - Normal Coding
652 *
653 * MODE 6:
654 * The above Toggle Bit is used as a submode bit, 0 = A, 1 = B.
655 * Submode B is for pointing devices, only remotes using submode A
656 * are supported.
657 *
658 * Customer range bit - 0 => Customer = 7 bits, 0...127
659 * 1 => Customer = 15 bits, 32768...65535
660 * Customer Bits - Normal Coding
661 *
662 * Customer codes are allocated by Philips. The rest of the bits
663 * are customer dependent. The following is commonly used (and the
664 * only supported config):
665 *
666 * Toggle Bit - Normal Coding
667 * Address Bit 6 - 0 - Normal Coding
668 * Command Bit 7 - 0 - Normal Coding
669 *
670 * All modes are followed by at least 6 * cell0.
671 *
672 * MODE 0 msglen:
673 * 1 * 2 (start bit) + 3 * 2 (mode) + 2 * 2 (toggle) +
674 * 8 * 2 (address) + 8 * 2 (command) =
675 * 44 cells
676 *
677 * MODE 6A msglen:
678 * 1 * 2 (start bit) + 3 * 2 (mode) + 2 * 2 (submode) +
679 * 1 * 2 (customer range bit) + 7/15 * 2 (customer bits) +
680 * 1 * 2 (toggle bit) + 7 * 2 (address) + 8 * 2 (command) =
681 * 60 - 76 cells
682 */
683 u8 mode;
684 u8 toggle;
685 u16 customer = 0x0;
686 u8 address;
687 u8 command;
688 u32 scancode;
689
690 /* Leader mark */
691 while (get_bits(data, 1) && !data->irdata_error)
692 /* Do nothing */;
693
694 /* Leader space */
695 if (get_bits(data, 1)) {
696 dev_dbg(dev, "RC6 - Invalid leader space\n");
697 return;
698 }
699
700 /* Start bit */
701 if (get_bits(data, 2) != 0x02) {
702 dev_dbg(dev, "RC6 - Invalid start bit\n");
703 return;
704 }
705
706 /* Mode */
707 mode = get_bits(data, 6);
708 switch (mode) {
709 case 0x15: /* 010101 = b000 */
710 mode = 0;
711 break;
712 case 0x29: /* 101001 = b110 */
713 mode = 6;
714 break;
715 default:
716 dev_dbg(dev, "RC6 - Invalid mode\n");
717 return;
718 }
719
720 /* Toggle bit / Submode bit */
721 toggle = get_bits(data, 4);
722 switch (toggle) {
723 case 0x03:
724 toggle = 0;
725 break;
726 case 0x0C:
727 toggle = 1;
728 break;
729 default:
730 dev_dbg(dev, "RC6 - Toggle bit error\n");
731 break;
732 }
733
734 /* Customer */
735 if (mode == 6) {
736 if (toggle != 0) {
737 dev_dbg(dev, "RC6B - Not Supported\n");
738 return;
739 }
740
741 customer = wbcir_rc6cells_to_byte(data);
742
743 if (customer & 0x80) {
744 /* 15 bit customer value */
745 customer <<= 8;
746 customer |= wbcir_rc6cells_to_byte(data);
747 }
748 }
749
750 /* Address */
751 address = wbcir_rc6cells_to_byte(data);
752 if (mode == 6) {
753 toggle = address >> 7;
754 address &= 0x7F;
755 }
756
757 /* Command */
758 command = wbcir_rc6cells_to_byte(data);
759
760 /* Create scancode */
761 scancode = command;
762 scancode |= address << 8;
763 scancode |= customer << 16;
764
765 /* Last sanity check */
766 if (data->irdata_error) {
767 dev_dbg(dev, "RC6 - Cell error(s)\n");
768 return;
769 }
770
771 dev_info(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X "
772 "toggle %u mode %u scan 0x%08X\n",
773 address,
774 command,
775 customer,
776 (unsigned int)toggle,
777 (unsigned int)mode,
778 scancode);
779
780 wbcir_keydown(data, scancode, toggle);
781}
782
783static void
784wbcir_parse_rc5(struct device *dev, struct wbcir_data *data)
785{
786 /*
787 * Bits are manchester coded as follows:
788 * cell1 + cell0 = logic "0"
789 * cell0 + cell1 = logic "1"
790 * (i.e. the reverse of RC6)
791 *
792 * Start bit 1 - "1" - discarded
793 * Start bit 2 - Must be inverted to get command bit 6
794 * Toggle bit
795 * Address Bit 4 - 0
796 * Command Bit 5 - 0
797 */
798 u8 toggle;
799 u8 address;
800 u8 command;
801 u32 scancode;
802
803 /* Start bit 1 */
804 if (!get_bits(data, 1)) {
805 dev_dbg(dev, "RC5 - Invalid start bit\n");
806 return;
807 }
808
809 /* Start bit 2 */
810 if (!wbcir_get_rc5bits(data, 1))
811 command = 0x40;
812 else
813 command = 0x00;
814
815 toggle = wbcir_get_rc5bits(data, 1);
816 address = wbcir_get_rc5bits(data, 5);
817 command |= wbcir_get_rc5bits(data, 6);
818 scancode = address << 7 | command;
819
820 /* Last sanity check */
821 if (data->irdata_error) {
822 dev_dbg(dev, "RC5 - Invalid message\n");
823 return;
824 }
825
826 dev_dbg(dev, "IR-RC5 ad %u cm %u t %u s %u\n",
827 (unsigned int)address,
828 (unsigned int)command,
829 (unsigned int)toggle,
830 (unsigned int)scancode);
831
832 wbcir_keydown(data, scancode, toggle);
833}
834
835static void
836wbcir_parse_nec(struct device *dev, struct wbcir_data *data)
837{
838 /*
839 * Each bit represents 560 us.
840 *
841 * Leader - 9 ms burst
842 * Gap - 4.5 ms silence
843 * Address1 bit 0 - 7 - Address 1
844 * Address2 bit 0 - 7 - Address 2
845 * Command1 bit 0 - 7 - Command 1
846 * Command2 bit 0 - 7 - Command 2
847 *
848 * Note the bit order!
849 *
850 * With the old NEC protocol, Address2 was the inverse of Address1
851 * and Command2 was the inverse of Command1 and were used as
852 * an error check.
853 *
854 * With NEC extended, Address1 is the LSB of the Address and
855 * Address2 is the MSB, Command parsing remains unchanged.
856 *
857 * A repeat message is coded as:
858 * Leader - 9 ms burst
859 * Gap - 2.25 ms silence
860 * Repeat - 560 us active
861 */
862 u8 address1;
863 u8 address2;
864 u8 command1;
865 u8 command2;
866 u16 address;
867 u32 scancode;
868
869 /* Leader mark */
870 while (get_bits(data, 1) && !data->irdata_error)
871 /* Do nothing */;
872
873 /* Leader space */
874 if (get_bits(data, 4)) {
875 dev_dbg(dev, "NEC - Invalid leader space\n");
876 return;
877 }
878
879 /* Repeat? */
880 if (get_bits(data, 1)) {
881 if (!data->keypressed) {
882 dev_dbg(dev, "NEC - Stray repeat message\n");
883 return;
884 }
885
886 dev_dbg(dev, "IR-NEC repeat s %u\n",
887 (unsigned int)data->last_scancode);
888
889 wbcir_keydown(data, data->last_scancode, data->last_toggle);
890 return;
891 }
892
893 /* Remaining leader space */
894 if (get_bits(data, 3)) {
895 dev_dbg(dev, "NEC - Invalid leader space\n");
896 return;
897 }
898
899 address1 = bitrev8(get_bits(data, 8));
900 address2 = bitrev8(get_bits(data, 8));
901 command1 = bitrev8(get_bits(data, 8));
902 command2 = bitrev8(get_bits(data, 8));
903
904 /* Sanity check */
905 if (data->irdata_error) {
906 dev_dbg(dev, "NEC - Invalid message\n");
907 return;
908 }
909
910 /* Check command validity */
911 if (command1 != ~command2) {
912 dev_dbg(dev, "NEC - Command bytes mismatch\n");
913 return;
914 }
915
916 /* Check for extended NEC protocol */
917 address = address1;
918 if (address1 != ~address2)
919 address |= address2 << 8;
920
921 scancode = address << 8 | command1;
922
923 dev_dbg(dev, "IR-NEC ad %u cm %u s %u\n",
924 (unsigned int)address,
925 (unsigned int)command1,
926 (unsigned int)scancode);
927
928 wbcir_keydown(data, scancode, !data->last_toggle);
929}
930
931
932
933/*****************************************************************************
934 *
935 * INTERRUPT FUNCTIONS
936 *
937 *****************************************************************************/
938
939static irqreturn_t
940wbcir_irq_handler(int irqno, void *cookie)
941{
942 struct pnp_dev *device = cookie;
943 struct wbcir_data *data = pnp_get_drvdata(device);
944 struct device *dev = &device->dev;
945 u8 status;
946 unsigned long flags;
947 u8 irdata[8];
948 int i;
949 unsigned int hw;
950
951 spin_lock_irqsave(&wbcir_lock, flags);
952
953 wbcir_select_bank(data, WBCIR_BANK_0);
954
955 status = inb(data->sbase + WBCIR_REG_SP3_EIR);
956
957 if (!(status & (WBCIR_IRQ_RX | WBCIR_IRQ_ERR))) {
958 spin_unlock_irqrestore(&wbcir_lock, flags);
959 return IRQ_NONE;
960 }
961
962 if (status & WBCIR_IRQ_ERR)
963 data->irdata_error = 1;
964
965 if (!(status & WBCIR_IRQ_RX))
966 goto out;
967
968 /* Since RXHDLEV is set, at least 8 bytes are in the FIFO */
969 insb(data->sbase + WBCIR_REG_SP3_RXDATA, &irdata[0], 8);
970
971 for (i = 0; i < sizeof(irdata); i++) {
972 hw = hweight8(irdata[i]);
973 if (hw > 4)
974 add_irdata_bit(data, 0);
975 else
976 add_irdata_bit(data, 1);
977
978 if (hw == 8)
979 data->idle_count++;
980 else
981 data->idle_count = 0;
982 }
983
984 if (data->idle_count > WBCIR_MAX_IDLE_BYTES) {
985 /* Set RXINACTIVE... */
986 outb(WBCIR_RX_DISABLE, data->sbase + WBCIR_REG_SP3_ASCR);
987
988 /* ...and drain the FIFO */
989 while (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_AVAIL)
990 inb(data->sbase + WBCIR_REG_SP3_RXDATA);
991
992 dev_dbg(dev, "IRDATA:\n");
993 for (i = 0; i < data->irdata_count; i += BITS_PER_LONG)
994 dev_dbg(dev, "0x%08lX\n", data->irdata[i/BITS_PER_LONG]);
995
996 switch (protocol) {
997 case IR_PROTOCOL_RC5:
998 wbcir_parse_rc5(dev, data);
999 break;
1000 case IR_PROTOCOL_RC6:
1001 wbcir_parse_rc6(dev, data);
1002 break;
1003 case IR_PROTOCOL_NEC:
1004 wbcir_parse_nec(dev, data);
1005 break;
1006 }
1007
1008 wbcir_reset_irdata(data);
1009 data->idle_count = 0;
1010 }
1011
1012out:
1013 spin_unlock_irqrestore(&wbcir_lock, flags);
1014 return IRQ_HANDLED;
1015}
1016
1017
1018
1019/*****************************************************************************
1020 *
1021 * SUSPEND/RESUME FUNCTIONS
1022 *
1023 *****************************************************************************/
1024
1025static void
1026wbcir_shutdown(struct pnp_dev *device)
1027{
1028 struct device *dev = &device->dev;
1029 struct wbcir_data *data = pnp_get_drvdata(device);
1030 int do_wake = 1;
1031 u8 match[11];
1032 u8 mask[11];
1033 u8 rc6_csl = 0;
1034 int i;
1035
1036 memset(match, 0, sizeof(match));
1037 memset(mask, 0, sizeof(mask));
1038
1039 if (wake_sc == INVALID_SCANCODE || !device_may_wakeup(dev)) {
1040 do_wake = 0;
1041 goto finish;
1042 }
1043
1044 switch (protocol) {
1045 case IR_PROTOCOL_RC5:
1046 if (wake_sc > 0xFFF) {
1047 do_wake = 0;
1048 dev_err(dev, "RC5 - Invalid wake scancode\n");
1049 break;
1050 }
1051
1052 /* Mask = 13 bits, ex toggle */
1053 mask[0] = 0xFF;
1054 mask[1] = 0x17;
1055
1056 match[0] = (wake_sc & 0x003F); /* 6 command bits */
1057 match[0] |= (wake_sc & 0x0180) >> 1; /* 2 address bits */
1058 match[1] = (wake_sc & 0x0E00) >> 9; /* 3 address bits */
1059 if (!(wake_sc & 0x0040)) /* 2nd start bit */
1060 match[1] |= 0x10;
1061
1062 break;
1063
1064 case IR_PROTOCOL_NEC:
1065 if (wake_sc > 0xFFFFFF) {
1066 do_wake = 0;
1067 dev_err(dev, "NEC - Invalid wake scancode\n");
1068 break;
1069 }
1070
1071 mask[0] = mask[1] = mask[2] = mask[3] = 0xFF;
1072
1073 match[1] = bitrev8((wake_sc & 0xFF));
1074 match[0] = ~match[1];
1075
1076 match[3] = bitrev8((wake_sc & 0xFF00) >> 8);
1077 if (wake_sc > 0xFFFF)
1078 match[2] = bitrev8((wake_sc & 0xFF0000) >> 16);
1079 else
1080 match[2] = ~match[3];
1081
1082 break;
1083
1084 case IR_PROTOCOL_RC6:
1085
1086 if (wake_rc6mode == 0) {
1087 if (wake_sc > 0xFFFF) {
1088 do_wake = 0;
1089 dev_err(dev, "RC6 - Invalid wake scancode\n");
1090 break;
1091 }
1092
1093 /* Command */
1094 match[0] = wbcir_to_rc6cells(wake_sc >> 0);
1095 mask[0] = 0xFF;
1096 match[1] = wbcir_to_rc6cells(wake_sc >> 4);
1097 mask[1] = 0xFF;
1098
1099 /* Address */
1100 match[2] = wbcir_to_rc6cells(wake_sc >> 8);
1101 mask[2] = 0xFF;
1102 match[3] = wbcir_to_rc6cells(wake_sc >> 12);
1103 mask[3] = 0xFF;
1104
1105 /* Header */
1106 match[4] = 0x50; /* mode1 = mode0 = 0, ignore toggle */
1107 mask[4] = 0xF0;
1108 match[5] = 0x09; /* start bit = 1, mode2 = 0 */
1109 mask[5] = 0x0F;
1110
1111 rc6_csl = 44;
1112
1113 } else if (wake_rc6mode == 6) {
1114 i = 0;
1115
1116 /* Command */
1117 match[i] = wbcir_to_rc6cells(wake_sc >> 0);
1118 mask[i++] = 0xFF;
1119 match[i] = wbcir_to_rc6cells(wake_sc >> 4);
1120 mask[i++] = 0xFF;
1121
1122 /* Address + Toggle */
1123 match[i] = wbcir_to_rc6cells(wake_sc >> 8);
1124 mask[i++] = 0xFF;
1125 match[i] = wbcir_to_rc6cells(wake_sc >> 12);
1126 mask[i++] = 0x3F;
1127
1128 /* Customer bits 7 - 0 */
1129 match[i] = wbcir_to_rc6cells(wake_sc >> 16);
1130 mask[i++] = 0xFF;
1131 match[i] = wbcir_to_rc6cells(wake_sc >> 20);
1132 mask[i++] = 0xFF;
1133
1134 if (wake_sc & 0x80000000) {
1135 /* Customer range bit and bits 15 - 8 */
1136 match[i] = wbcir_to_rc6cells(wake_sc >> 24);
1137 mask[i++] = 0xFF;
1138 match[i] = wbcir_to_rc6cells(wake_sc >> 28);
1139 mask[i++] = 0xFF;
1140 rc6_csl = 76;
1141 } else if (wake_sc <= 0x007FFFFF) {
1142 rc6_csl = 60;
1143 } else {
1144 do_wake = 0;
1145 dev_err(dev, "RC6 - Invalid wake scancode\n");
1146 break;
1147 }
1148
1149 /* Header */
1150 match[i] = 0x93; /* mode1 = mode0 = 1, submode = 0 */
1151 mask[i++] = 0xFF;
1152 match[i] = 0x0A; /* start bit = 1, mode2 = 1 */
1153 mask[i++] = 0x0F;
1154
1155 } else {
1156 do_wake = 0;
1157 dev_err(dev, "RC6 - Invalid wake mode\n");
1158 }
1159
1160 break;
1161
1162 default:
1163 do_wake = 0;
1164 break;
1165 }
1166
1167finish:
1168 if (do_wake) {
1169 /* Set compare and compare mask */
1170 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX,
1171 WBCIR_REGSEL_COMPARE | WBCIR_REG_ADDR0,
1172 0x3F);
1173 outsb(data->wbase + WBCIR_REG_WCEIR_DATA, match, 11);
1174 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_INDEX,
1175 WBCIR_REGSEL_MASK | WBCIR_REG_ADDR0,
1176 0x3F);
1177 outsb(data->wbase + WBCIR_REG_WCEIR_DATA, mask, 11);
1178
1179 /* RC6 Compare String Len */
1180 outb(rc6_csl, data->wbase + WBCIR_REG_WCEIR_CSL);
1181
1182 /* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
1183 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17);
1184
1185 /* Clear BUFF_EN, Clear END_EN, Set MATCH_EN */
1186 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x01, 0x07);
1187
1188 /* Set CEIR_EN */
1189 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x01, 0x01);
1190
1191 } else {
1192 /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
1193 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
1194
1195 /* Clear CEIR_EN */
1196 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01);
1197 }
1198
1199 /* Disable interrupts */
1200 outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
1201}
1202
1203static int
1204wbcir_suspend(struct pnp_dev *device, pm_message_t state)
1205{
1206 wbcir_shutdown(device);
1207 return 0;
1208}
1209
1210static int
1211wbcir_resume(struct pnp_dev *device)
1212{
1213 struct wbcir_data *data = pnp_get_drvdata(device);
1214
1215 /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
1216 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
1217
1218 /* Clear CEIR_EN */
1219 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01);
1220
1221 /* Enable interrupts */
1222 wbcir_reset_irdata(data);
1223 outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER);
1224
1225 return 0;
1226}
1227
1228
1229
1230/*****************************************************************************
1231 *
1232 * SETUP/INIT FUNCTIONS
1233 *
1234 *****************************************************************************/
1235
1236static void
1237wbcir_cfg_ceir(struct wbcir_data *data)
1238{
1239 u8 tmp;
1240
1241 /* Set PROT_SEL, RX_INV, Clear CEIR_EN (needed for the led) */
1242 tmp = protocol << 4;
1243 if (invert)
1244 tmp |= 0x08;
1245 outb(tmp, data->wbase + WBCIR_REG_WCEIR_CTL);
1246
1247 /* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
1248 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17);
1249
1250 /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */
1251 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
1252
1253 /* Set RC5 cell time to correspond to 36 kHz */
1254 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CFG1, 0x4A, 0x7F);
1255
1256 /* Set IRTX_INV */
1257 if (invert)
1258 outb(0x04, data->ebase + WBCIR_REG_ECEIR_CCTL);
1259 else
1260 outb(0x00, data->ebase + WBCIR_REG_ECEIR_CCTL);
1261
1262 /*
1263 * Clear IR LED, set SP3 clock to 24Mhz
1264 * set SP3_IRRX_SW to binary 01, helpfully not documented
1265 */
1266 outb(0x10, data->ebase + WBCIR_REG_ECEIR_CTS);
1267}
1268
1269static int __devinit
1270wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1271{
1272 struct device *dev = &device->dev;
1273 struct wbcir_data *data;
1274 int err;
1275
1276 if (!(pnp_port_len(device, 0) == EHFUNC_IOMEM_LEN &&
1277 pnp_port_len(device, 1) == WAKEUP_IOMEM_LEN &&
1278 pnp_port_len(device, 2) == SP_IOMEM_LEN)) {
1279 dev_err(dev, "Invalid resources\n");
1280 return -ENODEV;
1281 }
1282
1283 data = kzalloc(sizeof(*data), GFP_KERNEL);
1284 if (!data) {
1285 err = -ENOMEM;
1286 goto exit;
1287 }
1288
1289 pnp_set_drvdata(device, data);
1290
1291 data->ebase = pnp_port_start(device, 0);
1292 data->wbase = pnp_port_start(device, 1);
1293 data->sbase = pnp_port_start(device, 2);
1294 data->irq = pnp_irq(device, 0);
1295
1296 if (data->wbase == 0 || data->ebase == 0 ||
1297 data->sbase == 0 || data->irq == 0) {
1298 err = -ENODEV;
1299 dev_err(dev, "Invalid resources\n");
1300 goto exit_free_data;
1301 }
1302
1303 dev_dbg(&device->dev, "Found device "
1304 "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n",
1305 data->wbase, data->ebase, data->sbase, data->irq);
1306
1307 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
1308 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1309 data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
1310 err = -EBUSY;
1311 goto exit_free_data;
1312 }
1313
1314 if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
1315 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1316 data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
1317 err = -EBUSY;
1318 goto exit_release_wbase;
1319 }
1320
1321 if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
1322 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
1323 data->sbase, data->sbase + SP_IOMEM_LEN - 1);
1324 err = -EBUSY;
1325 goto exit_release_ebase;
1326 }
1327
1328 err = request_irq(data->irq, wbcir_irq_handler,
1329 IRQF_DISABLED, DRVNAME, device);
1330 if (err) {
1331 dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
1332 err = -EBUSY;
1333 goto exit_release_sbase;
1334 }
1335
1336 led_trigger_register_simple("cir-tx", &data->txtrigger);
1337 if (!data->txtrigger) {
1338 err = -ENOMEM;
1339 goto exit_free_irq;
1340 }
1341
1342 led_trigger_register_simple("cir-rx", &data->rxtrigger);
1343 if (!data->rxtrigger) {
1344 err = -ENOMEM;
1345 goto exit_unregister_txtrigger;
1346 }
1347
1348 data->led.name = "cir::activity";
1349 data->led.default_trigger = "cir-rx";
1350 data->led.brightness_set = wbcir_led_brightness_set;
1351 data->led.brightness_get = wbcir_led_brightness_get;
1352 err = led_classdev_register(&device->dev, &data->led);
1353 if (err)
1354 goto exit_unregister_rxtrigger;
1355
1356 data->input_dev = input_allocate_device();
1357 if (!data->input_dev) {
1358 err = -ENOMEM;
1359 goto exit_unregister_led;
1360 }
1361
1362 data->input_dev->evbit[0] = BIT(EV_KEY);
1363 data->input_dev->name = WBCIR_NAME;
1364 data->input_dev->phys = "wbcir/cir0";
1365 data->input_dev->id.bustype = BUS_HOST;
1366 data->input_dev->id.vendor = PCI_VENDOR_ID_WINBOND;
1367 data->input_dev->id.product = WBCIR_ID_FAMILY;
1368 data->input_dev->id.version = WBCIR_ID_CHIP;
1369 data->input_dev->getkeycode = wbcir_getkeycode;
1370 data->input_dev->setkeycode = wbcir_setkeycode;
1371 input_set_capability(data->input_dev, EV_MSC, MSC_SCAN);
1372 input_set_drvdata(data->input_dev, data);
1373
1374 err = input_register_device(data->input_dev);
1375 if (err)
1376 goto exit_free_input;
1377
1378 data->last_scancode = INVALID_SCANCODE;
1379 INIT_LIST_HEAD(&data->keytable);
1380 setup_timer(&data->timer_keyup, wbcir_keyup, (unsigned long)data);
1381
1382 /* Load default keymaps */
1383 if (protocol == IR_PROTOCOL_RC6) {
1384 int i;
1385 for (i = 0; i < ARRAY_SIZE(rc6_def_keymap); i++) {
1386 err = wbcir_setkeycode(data->input_dev,
1387 (int)rc6_def_keymap[i].scancode,
1388 (int)rc6_def_keymap[i].keycode);
1389 if (err)
1390 goto exit_unregister_keys;
1391 }
1392 }
1393
1394 device_init_wakeup(&device->dev, 1);
1395
1396 wbcir_cfg_ceir(data);
1397
1398 /* Disable interrupts */
1399 wbcir_select_bank(data, WBCIR_BANK_0);
1400 outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
1401
1402 /* Enable extended mode */
1403 wbcir_select_bank(data, WBCIR_BANK_2);
1404 outb(WBCIR_EXT_ENABLE, data->sbase + WBCIR_REG_SP3_EXCR1);
1405
1406 /*
1407 * Configure baud generator, IR data will be sampled at
1408 * a bitrate of: (24Mhz * prescaler) / (divisor * 16).
1409 *
1410 * The ECIR registers include a flag to change the
1411 * 24Mhz clock freq to 48Mhz.
1412 *
1413 * It's not documented in the specs, but fifo levels
1414 * other than 16 seems to be unsupported.
1415 */
1416
1417 /* prescaler 1.0, tx/rx fifo lvl 16 */
1418 outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2);
1419
1420 /* Set baud divisor to generate one byte per bit/cell */
1421 switch (protocol) {
1422 case IR_PROTOCOL_RC5:
1423 outb(0xA7, data->sbase + WBCIR_REG_SP3_BGDL);
1424 break;
1425 case IR_PROTOCOL_RC6:
1426 outb(0x53, data->sbase + WBCIR_REG_SP3_BGDL);
1427 break;
1428 case IR_PROTOCOL_NEC:
1429 outb(0x69, data->sbase + WBCIR_REG_SP3_BGDL);
1430 break;
1431 }
1432 outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);
1433
1434 /* Set CEIR mode */
1435 wbcir_select_bank(data, WBCIR_BANK_0);
1436 outb(0xC0, data->sbase + WBCIR_REG_SP3_MCR);
1437 inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */
1438 inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */
1439
1440 /* Disable RX demod, run-length encoding/decoding, set freq span */
1441 wbcir_select_bank(data, WBCIR_BANK_7);
1442 outb(0x10, data->sbase + WBCIR_REG_SP3_RCCFG);
1443
1444 /* Disable timer */
1445 wbcir_select_bank(data, WBCIR_BANK_4);
1446 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR1);
1447
1448 /* Enable MSR interrupt, Clear AUX_IRX */
1449 wbcir_select_bank(data, WBCIR_BANK_5);
1450 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR2);
1451
1452 /* Disable CRC */
1453 wbcir_select_bank(data, WBCIR_BANK_6);
1454 outb(0x20, data->sbase + WBCIR_REG_SP3_IRCR3);
1455
1456 /* Set RX/TX (de)modulation freq, not really used */
1457 wbcir_select_bank(data, WBCIR_BANK_7);
1458 outb(0xF2, data->sbase + WBCIR_REG_SP3_IRRXDC);
1459 outb(0x69, data->sbase + WBCIR_REG_SP3_IRTXMC);
1460
1461 /* Set invert and pin direction */
1462 if (invert)
1463 outb(0x10, data->sbase + WBCIR_REG_SP3_IRCFG4);
1464 else
1465 outb(0x00, data->sbase + WBCIR_REG_SP3_IRCFG4);
1466
1467 /* Set FIFO thresholds (RX = 8, TX = 3), reset RX/TX */
1468 wbcir_select_bank(data, WBCIR_BANK_0);
1469 outb(0x97, data->sbase + WBCIR_REG_SP3_FCR);
1470
1471 /* Clear AUX status bits */
1472 outb(0xE0, data->sbase + WBCIR_REG_SP3_ASCR);
1473
1474 /* Enable interrupts */
1475 outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER);
1476
1477 return 0;
1478
1479exit_unregister_keys:
1480 if (!list_empty(&data->keytable)) {
1481 struct wbcir_keyentry *key;
1482 struct wbcir_keyentry *keytmp;
1483
1484 list_for_each_entry_safe(key, keytmp, &data->keytable, list) {
1485 list_del(&key->list);
1486 kfree(key);
1487 }
1488 }
1489 input_unregister_device(data->input_dev);
1490 /* Can't call input_free_device on an unregistered device */
1491 data->input_dev = NULL;
1492exit_free_input:
1493 input_free_device(data->input_dev);
1494exit_unregister_led:
1495 led_classdev_unregister(&data->led);
1496exit_unregister_rxtrigger:
1497 led_trigger_unregister_simple(data->rxtrigger);
1498exit_unregister_txtrigger:
1499 led_trigger_unregister_simple(data->txtrigger);
1500exit_free_irq:
1501 free_irq(data->irq, device);
1502exit_release_sbase:
1503 release_region(data->sbase, SP_IOMEM_LEN);
1504exit_release_ebase:
1505 release_region(data->ebase, EHFUNC_IOMEM_LEN);
1506exit_release_wbase:
1507 release_region(data->wbase, WAKEUP_IOMEM_LEN);
1508exit_free_data:
1509 kfree(data);
1510 pnp_set_drvdata(device, NULL);
1511exit:
1512 return err;
1513}
1514
1515static void __devexit
1516wbcir_remove(struct pnp_dev *device)
1517{
1518 struct wbcir_data *data = pnp_get_drvdata(device);
1519 struct wbcir_keyentry *key;
1520 struct wbcir_keyentry *keytmp;
1521
1522 /* Disable interrupts */
1523 wbcir_select_bank(data, WBCIR_BANK_0);
1524 outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER);
1525
1526 del_timer_sync(&data->timer_keyup);
1527
1528 free_irq(data->irq, device);
1529
1530 /* Clear status bits NEC_REP, BUFF, MSG_END, MATCH */
1531 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_STS, 0x17, 0x17);
1532
1533 /* Clear CEIR_EN */
1534 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01);
1535
1536 /* Clear BUFF_EN, END_EN, MATCH_EN */
1537 wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07);
1538
1539 /* This will generate a keyup event if necessary */
1540 input_unregister_device(data->input_dev);
1541
1542 led_trigger_unregister_simple(data->rxtrigger);
1543 led_trigger_unregister_simple(data->txtrigger);
1544 led_classdev_unregister(&data->led);
1545
1546 /* This is ok since &data->led isn't actually used */
1547 wbcir_led_brightness_set(&data->led, LED_OFF);
1548
1549 release_region(data->wbase, WAKEUP_IOMEM_LEN);
1550 release_region(data->ebase, EHFUNC_IOMEM_LEN);
1551 release_region(data->sbase, SP_IOMEM_LEN);
1552
1553 list_for_each_entry_safe(key, keytmp, &data->keytable, list) {
1554 list_del(&key->list);
1555 kfree(key);
1556 }
1557
1558 kfree(data);
1559
1560 pnp_set_drvdata(device, NULL);
1561}
1562
1563static const struct pnp_device_id wbcir_ids[] = {
1564 { "WEC1022", 0 },
1565 { "", 0 }
1566};
1567MODULE_DEVICE_TABLE(pnp, wbcir_ids);
1568
1569static struct pnp_driver wbcir_driver = {
1570 .name = WBCIR_NAME,
1571 .id_table = wbcir_ids,
1572 .probe = wbcir_probe,
1573 .remove = __devexit_p(wbcir_remove),
1574 .suspend = wbcir_suspend,
1575 .resume = wbcir_resume,
1576 .shutdown = wbcir_shutdown
1577};
1578
1579static int __init
1580wbcir_init(void)
1581{
1582 int ret;
1583
1584 switch (protocol) {
1585 case IR_PROTOCOL_RC5:
1586 case IR_PROTOCOL_NEC:
1587 case IR_PROTOCOL_RC6:
1588 break;
1589 default:
1590 printk(KERN_ERR DRVNAME ": Invalid protocol argument\n");
1591 return -EINVAL;
1592 }
1593
1594 ret = pnp_register_driver(&wbcir_driver);
1595 if (ret)
1596 printk(KERN_ERR DRVNAME ": Unable to register driver\n");
1597
1598 return ret;
1599}
1600
1601static void __exit
1602wbcir_exit(void)
1603{
1604 pnp_unregister_driver(&wbcir_driver);
1605}
1606
1607MODULE_AUTHOR("David Härdeman <david@hardeman.nu>");
1608MODULE_DESCRIPTION("Winbond SuperI/O Consumer IR Driver");
1609MODULE_LICENSE("GPL");
1610
1611module_init(wbcir_init);
1612module_exit(wbcir_exit);
1613
1614
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index bff72d81f263..9f8f67b6c07f 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -89,7 +89,7 @@ static int capifs_remount(struct super_block *s, int *flags, char *data)
89 return 0; 89 return 0;
90} 90}
91 91
92static struct super_operations capifs_sops = 92static const struct super_operations capifs_sops =
93{ 93{
94 .statfs = simple_statfs, 94 .statfs = simple_statfs,
95 .remount_fs = capifs_remount, 95 .remount_fs = capifs_remount,
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index 16f2e465e5f9..26626eead828 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -1019,7 +1019,7 @@ int __init cdebug_init(void)
1019 if (!g_debbuf->buf) { 1019 if (!g_debbuf->buf) {
1020 kfree(g_cmsg); 1020 kfree(g_cmsg);
1021 kfree(g_debbuf); 1021 kfree(g_debbuf);
1022 return -ENOMEM;; 1022 return -ENOMEM;
1023 } 1023 }
1024 g_debbuf->size = CDEBUG_GSIZE; 1024 g_debbuf->size = CDEBUG_GSIZE;
1025 g_debbuf->buf[0] = 0; 1025 g_debbuf->buf[0] = 0;
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 7188c59a76ff..adb1e8c36b46 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -761,7 +761,7 @@ isdn_getnum(char **p)
761 * Be aware that this is not an atomic operation when sleep != 0, even though 761 * Be aware that this is not an atomic operation when sleep != 0, even though
762 * interrupts are turned off! Well, like that we are currently only called 762 * interrupts are turned off! Well, like that we are currently only called
763 * on behalf of a read system call on raw device files (which are documented 763 * on behalf of a read system call on raw device files (which are documented
764 * to be dangerous and for for debugging purpose only). The inode semaphore 764 * to be dangerous and for debugging purpose only). The inode semaphore
765 * takes care that this is not called for the same minor device number while 765 * takes care that this is not called for the same minor device number while
766 * we are sleeping, but access is not serialized against simultaneous read() 766 * we are sleeping, but access is not serialized against simultaneous read()
767 * from the corresponding ttyI device. Can other ugly events, like changes 767 * from the corresponding ttyI device. Can other ugly events, like changes
@@ -873,7 +873,7 @@ isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, wait_que
873 * Be aware that this is not an atomic operation when sleep != 0, even though 873 * Be aware that this is not an atomic operation when sleep != 0, even though
874 * interrupts are turned off! Well, like that we are currently only called 874 * interrupts are turned off! Well, like that we are currently only called
875 * on behalf of a read system call on raw device files (which are documented 875 * on behalf of a read system call on raw device files (which are documented
876 * to be dangerous and for for debugging purpose only). The inode semaphore 876 * to be dangerous and for debugging purpose only). The inode semaphore
877 * takes care that this is not called for the same minor device number while 877 * takes care that this is not called for the same minor device number while
878 * we are sleeping, but access is not serialized against simultaneous read() 878 * we are sleeping, but access is not serialized against simultaneous read()
879 * from the corresponding ttyI device. Can other ugly events, like changes 879 * from the corresponding ttyI device. Can other ugly events, like changes
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index a8d0aee3bc0e..8aaad65c3bb5 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -894,7 +894,7 @@ void guest_set_pte(struct lg_cpu *cpu,
894 * tells us they've changed. When the Guest tries to use the new entry it will 894 * tells us they've changed. When the Guest tries to use the new entry it will
895 * fault and demand_page() will fix it up. 895 * fault and demand_page() will fix it up.
896 * 896 *
897 * So with that in mind here's our code to to update a (top-level) PGD entry: 897 * So with that in mind here's our code to update a (top-level) PGD entry:
898 */ 898 */
899void guest_set_pgd(struct lguest *lg, unsigned long gpgdir, u32 idx) 899void guest_set_pgd(struct lguest *lg, unsigned long gpgdir, u32 idx)
900{ 900{
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index a98ab72adf95..93fb32038b14 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -274,7 +274,7 @@ static void __devinit rackmeter_init_cpu_sniffer(struct rackmeter *rm)
274 274
275 if (cpu > 1) 275 if (cpu > 1)
276 continue; 276 continue;
277 rcpu = &rm->cpu[cpu];; 277 rcpu = &rm->cpu[cpu];
278 rcpu->prev_idle = get_cpu_idle_time(cpu); 278 rcpu->prev_idle = get_cpu_idle_time(cpu);
279 rcpu->prev_wall = jiffies64_to_cputime64(get_jiffies_64()); 279 rcpu->prev_wall = jiffies64_to_cputime64(get_jiffies_64());
280 schedule_delayed_work_on(cpu, &rm->cpu[cpu].sniffer, 280 schedule_delayed_work_on(cpu, &rm->cpu[cpu].sniffer,
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index eee28fac210c..376f1ab48a24 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1716,7 +1716,7 @@ out:
1716 return r; 1716 return r;
1717} 1717}
1718 1718
1719static struct block_device_operations dm_blk_dops; 1719static const struct block_device_operations dm_blk_dops;
1720 1720
1721static void dm_wq_work(struct work_struct *work); 1721static void dm_wq_work(struct work_struct *work);
1722 1722
@@ -2663,7 +2663,7 @@ void dm_free_md_mempools(struct dm_md_mempools *pools)
2663 kfree(pools); 2663 kfree(pools);
2664} 2664}
2665 2665
2666static struct block_device_operations dm_blk_dops = { 2666static const struct block_device_operations dm_blk_dops = {
2667 .open = dm_blk_open, 2667 .open = dm_blk_open,
2668 .release = dm_blk_close, 2668 .release = dm_blk_close,
2669 .ioctl = dm_blk_ioctl, 2669 .ioctl = dm_blk_ioctl,
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9dd872000cec..6aa497e4baf8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -138,7 +138,7 @@ static ctl_table raid_root_table[] = {
138 { .ctl_name = 0 } 138 { .ctl_name = 0 }
139}; 139};
140 140
141static struct block_device_operations md_fops; 141static const struct block_device_operations md_fops;
142 142
143static int start_readonly; 143static int start_readonly;
144 144
@@ -5556,7 +5556,7 @@ static int md_revalidate(struct gendisk *disk)
5556 mddev->changed = 0; 5556 mddev->changed = 0;
5557 return 0; 5557 return 0;
5558} 5558}
5559static struct block_device_operations md_fops = 5559static const struct block_device_operations md_fops =
5560{ 5560{
5561 .owner = THIS_MODULE, 5561 .owner = THIS_MODULE,
5562 .open = md_open, 5562 .open = md_open,
diff --git a/drivers/md/md.h b/drivers/md/md.h
index f8fc188bc762..f55d2ff95133 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -201,7 +201,7 @@ struct mddev_s
201 * INTR: resync needs to be aborted for some reason 201 * INTR: resync needs to be aborted for some reason
202 * DONE: thread is done and is waiting to be reaped 202 * DONE: thread is done and is waiting to be reaped
203 * REQUEST: user-space has requested a sync (used with SYNC) 203 * REQUEST: user-space has requested a sync (used with SYNC)
204 * CHECK: user-space request for for check-only, no repair 204 * CHECK: user-space request for check-only, no repair
205 * RESHAPE: A reshape is happening 205 * RESHAPE: A reshape is happening
206 * 206 *
207 * If neither SYNC or RESHAPE are set, then it is a recovery. 207 * If neither SYNC or RESHAPE are set, then it is a recovery.
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 89e76819f61f..d2d3fd54cc68 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -150,6 +150,7 @@ static int multipath_make_request (struct request_queue *q, struct bio * bio)
150 } 150 }
151 151
152 mp_bh = mempool_alloc(conf->pool, GFP_NOIO); 152 mp_bh = mempool_alloc(conf->pool, GFP_NOIO);
153 memset(mp_bh, 0, sizeof(*mp_bh));
153 154
154 mp_bh->master_bio = bio; 155 mp_bh->master_bio = bio;
155 mp_bh->mddev = mddev; 156 mp_bh->mddev = mddev;
@@ -493,7 +494,7 @@ static int multipath_run (mddev_t *mddev)
493 } 494 }
494 mddev->degraded = conf->raid_disks - conf->working_disks; 495 mddev->degraded = conf->raid_disks - conf->working_disks;
495 496
496 conf->pool = mempool_create_kzalloc_pool(NR_RESERVED_BUFS, 497 conf->pool = mempool_create_kmalloc_pool(NR_RESERVED_BUFS,
497 sizeof(struct multipath_bh)); 498 sizeof(struct multipath_bh));
498 if (conf->pool == NULL) { 499 if (conf->pool == NULL) {
499 printk(KERN_ERR 500 printk(KERN_ERR
diff --git a/drivers/media/dvb/pt1/pt1.c b/drivers/media/dvb/pt1/pt1.c
index 8ffbcecad931..81e623a90f09 100644
--- a/drivers/media/dvb/pt1/pt1.c
+++ b/drivers/media/dvb/pt1/pt1.c
@@ -23,6 +23,7 @@
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/vmalloc.h>
26#include <linux/pci.h> 27#include <linux/pci.h>
27#include <linux/kthread.h> 28#include <linux/kthread.h>
28#include <linux/freezer.h> 29#include <linux/freezer.h>
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index bd9ab9d0d12a..fa6a62369a78 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -1367,7 +1367,7 @@ int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level)
1367 &msg, sizeof(msg)); 1367 &msg, sizeof(msg));
1368} 1368}
1369 1369
1370/* new GPIO managment implementation */ 1370/* new GPIO management implementation */
1371static int GetGpioPinParams(u32 PinNum, u32 *pTranslatedPinNum, 1371static int GetGpioPinParams(u32 PinNum, u32 *pTranslatedPinNum,
1372 u32 *pGroupNum, u32 *pGroupCfg) { 1372 u32 *pGroupNum, u32 *pGroupCfg) {
1373 1373
diff --git a/drivers/media/dvb/siano/smscoreapi.h b/drivers/media/dvb/siano/smscoreapi.h
index f1108c64e895..eec18aaf5512 100644
--- a/drivers/media/dvb/siano/smscoreapi.h
+++ b/drivers/media/dvb/siano/smscoreapi.h
@@ -657,12 +657,12 @@ struct smscore_buffer_t *smscore_getbuffer(struct smscore_device_t *coredev);
657extern void smscore_putbuffer(struct smscore_device_t *coredev, 657extern void smscore_putbuffer(struct smscore_device_t *coredev,
658 struct smscore_buffer_t *cb); 658 struct smscore_buffer_t *cb);
659 659
660/* old GPIO managment */ 660/* old GPIO management */
661int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin, 661int smscore_configure_gpio(struct smscore_device_t *coredev, u32 pin,
662 struct smscore_config_gpio *pinconfig); 662 struct smscore_config_gpio *pinconfig);
663int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level); 663int smscore_set_gpio(struct smscore_device_t *coredev, u32 pin, int level);
664 664
665/* new GPIO managment */ 665/* new GPIO management */
666extern int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum, 666extern int smscore_gpio_configure(struct smscore_device_t *coredev, u8 PinNum,
667 struct smscore_gpio_config *pGpioConfig); 667 struct smscore_gpio_config *pGpioConfig);
668extern int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum, 668extern int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 PinNum,
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 575bf9d89419..a1239083472d 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -46,7 +46,7 @@
46 * Version 0.11: Converted to v4l2_device. 46 * Version 0.11: Converted to v4l2_device.
47 * 47 *
48 * Many things to do: 48 * Many things to do:
49 * - Correct power managment of device (suspend & resume) 49 * - Correct power management of device (suspend & resume)
50 * - Add code for scanning and smooth tuning 50 * - Add code for scanning and smooth tuning
51 * - Add code for sensitivity value 51 * - Add code for sensitivity value
52 * - Correct mistakes 52 * - Correct mistakes
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 356d6896da3f..fbdc1cde56a6 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1371,7 +1371,7 @@ static struct cx8802_driver cx8802_blackbird_driver = {
1371 .advise_release = cx8802_blackbird_advise_release, 1371 .advise_release = cx8802_blackbird_advise_release,
1372}; 1372};
1373 1373
1374static int blackbird_init(void) 1374static int __init blackbird_init(void)
1375{ 1375{
1376 printk(KERN_INFO "cx2388x blackbird driver version %d.%d.%d loaded\n", 1376 printk(KERN_INFO "cx2388x blackbird driver version %d.%d.%d loaded\n",
1377 (CX88_VERSION_CODE >> 16) & 0xff, 1377 (CX88_VERSION_CODE >> 16) & 0xff,
@@ -1384,7 +1384,7 @@ static int blackbird_init(void)
1384 return cx8802_register_driver(&cx8802_blackbird_driver); 1384 return cx8802_register_driver(&cx8802_blackbird_driver);
1385} 1385}
1386 1386
1387static void blackbird_fini(void) 1387static void __exit blackbird_fini(void)
1388{ 1388{
1389 cx8802_unregister_driver(&cx8802_blackbird_driver); 1389 cx8802_unregister_driver(&cx8802_blackbird_driver);
1390} 1390}
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 6e5d142b5b00..518bcfe18bcb 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -1350,7 +1350,7 @@ static struct cx8802_driver cx8802_dvb_driver = {
1350 .advise_release = cx8802_dvb_advise_release, 1350 .advise_release = cx8802_dvb_advise_release,
1351}; 1351};
1352 1352
1353static int dvb_init(void) 1353static int __init dvb_init(void)
1354{ 1354{
1355 printk(KERN_INFO "cx88/2: cx2388x dvb driver version %d.%d.%d loaded\n", 1355 printk(KERN_INFO "cx88/2: cx2388x dvb driver version %d.%d.%d loaded\n",
1356 (CX88_VERSION_CODE >> 16) & 0xff, 1356 (CX88_VERSION_CODE >> 16) & 0xff,
@@ -1363,7 +1363,7 @@ static int dvb_init(void)
1363 return cx8802_register_driver(&cx8802_dvb_driver); 1363 return cx8802_register_driver(&cx8802_dvb_driver);
1364} 1364}
1365 1365
1366static void dvb_fini(void) 1366static void __exit dvb_fini(void)
1367{ 1367{
1368 cx8802_unregister_driver(&cx8802_dvb_driver); 1368 cx8802_unregister_driver(&cx8802_dvb_driver);
1369} 1369}
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 7172dcf2a4fa..de9ff0fc741f 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -870,7 +870,7 @@ static struct pci_driver cx8802_pci_driver = {
870 .remove = __devexit_p(cx8802_remove), 870 .remove = __devexit_p(cx8802_remove),
871}; 871};
872 872
873static int cx8802_init(void) 873static int __init cx8802_init(void)
874{ 874{
875 printk(KERN_INFO "cx88/2: cx2388x MPEG-TS Driver Manager version %d.%d.%d loaded\n", 875 printk(KERN_INFO "cx88/2: cx2388x MPEG-TS Driver Manager version %d.%d.%d loaded\n",
876 (CX88_VERSION_CODE >> 16) & 0xff, 876 (CX88_VERSION_CODE >> 16) & 0xff,
@@ -883,7 +883,7 @@ static int cx8802_init(void)
883 return pci_register_driver(&cx8802_pci_driver); 883 return pci_register_driver(&cx8802_pci_driver);
884} 884}
885 885
886static void cx8802_fini(void) 886static void __exit cx8802_fini(void)
887{ 887{
888 pci_unregister_driver(&cx8802_pci_driver); 888 pci_unregister_driver(&cx8802_pci_driver);
889} 889}
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 81d2b5dea18e..57e6b1241090 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -2113,7 +2113,7 @@ static struct pci_driver cx8800_pci_driver = {
2113#endif 2113#endif
2114}; 2114};
2115 2115
2116static int cx8800_init(void) 2116static int __init cx8800_init(void)
2117{ 2117{
2118 printk(KERN_INFO "cx88/0: cx2388x v4l2 driver version %d.%d.%d loaded\n", 2118 printk(KERN_INFO "cx88/0: cx2388x v4l2 driver version %d.%d.%d loaded\n",
2119 (CX88_VERSION_CODE >> 16) & 0xff, 2119 (CX88_VERSION_CODE >> 16) & 0xff,
@@ -2126,7 +2126,7 @@ static int cx8800_init(void)
2126 return pci_register_driver(&cx8800_pci_driver); 2126 return pci_register_driver(&cx8800_pci_driver);
2127} 2127}
2128 2128
2129static void cx8800_fini(void) 2129static void __exit cx8800_fini(void)
2130{ 2130{
2131 pci_unregister_driver(&cx8800_pci_driver); 2131 pci_unregister_driver(&cx8800_pci_driver);
2132} 2132}
diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c
index 8a5bba16ff32..7f1e5415850b 100644
--- a/drivers/media/video/gspca/m5602/m5602_core.c
+++ b/drivers/media/video/gspca/m5602/m5602_core.c
@@ -56,7 +56,7 @@ int m5602_read_bridge(struct sd *sd, const u8 address, u8 *i2c_data)
56 return (err < 0) ? err : 0; 56 return (err < 0) ? err : 0;
57} 57}
58 58
59/* Writes a byte to to the m5602 */ 59/* Writes a byte to the m5602 */
60int m5602_write_bridge(struct sd *sd, const u8 address, const u8 i2c_data) 60int m5602_write_bridge(struct sd *sd, const u8 address, const u8 i2c_data)
61{ 61{
62 int err; 62 int err;
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 7847bbc1440d..bd83fa0a4970 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -235,7 +235,7 @@ static int mspro_block_bd_getgeo(struct block_device *bdev,
235 return 0; 235 return 0;
236} 236}
237 237
238static struct block_device_operations ms_block_bdops = { 238static const struct block_device_operations ms_block_bdops = {
239 .open = mspro_block_bd_open, 239 .open = mspro_block_bd_open,
240 .release = mspro_block_bd_release, 240 .release = mspro_block_bd_release,
241 .getgeo = mspro_block_bd_getgeo, 241 .getgeo = mspro_block_bd_getgeo,
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 76fa2ee0b574..610e914abe6c 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -6821,7 +6821,7 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
6821 *size = y; 6821 *size = y;
6822} 6822}
6823/** 6823/**
6824 * mpt_set_taskmgmt_in_progress_flag - set flags associated with task managment 6824 * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management
6825 * @ioc: Pointer to MPT_ADAPTER structure 6825 * @ioc: Pointer to MPT_ADAPTER structure
6826 * 6826 *
6827 * Returns 0 for SUCCESS or -1 if FAILED. 6827 * Returns 0 for SUCCESS or -1 if FAILED.
@@ -6854,7 +6854,7 @@ mpt_set_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc)
6854EXPORT_SYMBOL(mpt_set_taskmgmt_in_progress_flag); 6854EXPORT_SYMBOL(mpt_set_taskmgmt_in_progress_flag);
6855 6855
6856/** 6856/**
6857 * mpt_clear_taskmgmt_in_progress_flag - clear flags associated with task managment 6857 * mpt_clear_taskmgmt_in_progress_flag - clear flags associated with task management
6858 * @ioc: Pointer to MPT_ADAPTER structure 6858 * @ioc: Pointer to MPT_ADAPTER structure
6859 * 6859 *
6860 **/ 6860 **/
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 335d4c78a775..d505b68cd372 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -925,7 +925,7 @@ static void i2o_block_request_fn(struct request_queue *q)
925}; 925};
926 926
927/* I2O Block device operations definition */ 927/* I2O Block device operations definition */
928static struct block_device_operations i2o_block_fops = { 928static const struct block_device_operations i2o_block_fops = {
929 .owner = THIS_MODULE, 929 .owner = THIS_MODULE,
930 .open = i2o_block_open, 930 .open = i2o_block_open,
931 .release = i2o_block_release, 931 .release = i2o_block_release,
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index c533f86ff5ea..5447da16a170 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -647,7 +647,7 @@ struct ab3100_init_setting {
647 u8 setting; 647 u8 setting;
648}; 648};
649 649
650static const struct ab3100_init_setting __initdata 650static const struct ab3100_init_setting __initconst
651ab3100_init_settings[] = { 651ab3100_init_settings[] = {
652 { 652 {
653 .abreg = AB3100_MCA, 653 .abreg = AB3100_MCA,
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index de966a6fb7e6..aecf40ecb3a4 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -97,7 +97,7 @@ static int ibmasmfs_get_super(struct file_system_type *fst,
97 return get_sb_single(fst, flags, data, ibmasmfs_fill_super, mnt); 97 return get_sb_single(fst, flags, data, ibmasmfs_fill_super, mnt);
98} 98}
99 99
100static struct super_operations ibmasmfs_s_ops = { 100static const struct super_operations ibmasmfs_s_ops = {
101 .statfs = simple_statfs, 101 .statfs = simple_statfs,
102 .drop_inode = generic_delete_inode, 102 .drop_inode = generic_delete_inode,
103}; 103};
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index adc205c49fbf..85f0e8cd875b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -130,7 +130,7 @@ mmc_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
130 return 0; 130 return 0;
131} 131}
132 132
133static struct block_device_operations mmc_bdops = { 133static const struct block_device_operations mmc_bdops = {
134 .open = mmc_blk_open, 134 .open = mmc_blk_open,
135 .release = mmc_blk_release, 135 .release = mmc_blk_release,
136 .getgeo = mmc_blk_getgeo, 136 .getgeo = mmc_blk_getgeo,
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index bc14bb1b0579..88671529c45d 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -512,7 +512,7 @@ static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat)
512 } 512 }
513 513
514 /* For the DMA case the DMA engine handles the data transfer 514 /* For the DMA case the DMA engine handles the data transfer
515 * automatically. For non DMA we have to to it ourselves. 515 * automatically. For non DMA we have to do it ourselves.
516 * Don't do it in interrupt context though. 516 * Don't do it in interrupt context though.
517 */ 517 */
518 if (!mxcmci_use_dma(host) && host->data) 518 if (!mxcmci_use_dma(host) && host->data)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 10ed195c0c1c..eb495d83064f 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -776,13 +776,13 @@ static struct spi_driver m25p80_driver = {
776}; 776};
777 777
778 778
779static int m25p80_init(void) 779static int __init m25p80_init(void)
780{ 780{
781 return spi_register_driver(&m25p80_driver); 781 return spi_register_driver(&m25p80_driver);
782} 782}
783 783
784 784
785static void m25p80_exit(void) 785static void __exit m25p80_exit(void)
786{ 786{
787 spi_unregister_driver(&m25p80_driver); 787 spi_unregister_driver(&m25p80_driver);
788} 788}
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index 00248e81ecd5..7d846e9173da 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -303,7 +303,7 @@ __setup("slram=", mtd_slram_setup);
303 303
304#endif 304#endif
305 305
306static int init_slram(void) 306static int __init init_slram(void)
307{ 307{
308 char *devname; 308 char *devname;
309 int i; 309 int i;
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index a790c062af1f..e56d6b42f020 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -1099,7 +1099,7 @@ static struct mtd_blktrans_ops ftl_tr = {
1099 .owner = THIS_MODULE, 1099 .owner = THIS_MODULE,
1100}; 1100};
1101 1101
1102static int init_ftl(void) 1102static int __init init_ftl(void)
1103{ 1103{
1104 return register_mtd_blktrans(&ftl_tr); 1104 return register_mtd_blktrans(&ftl_tr);
1105} 1105}
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index d4fb9a3ab4df..1bdf0ee6d0b6 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -184,7 +184,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
184 info->map.bankwidth = 1; 184 info->map.bankwidth = 1;
185 185
186 /* 186 /*
187 * map_priv_2 is used to store a ptr to to the bank_setup routine 187 * map_priv_2 is used to store a ptr to the bank_setup routine
188 */ 188 */
189 info->map.map_priv_2 = (unsigned long) ixp_data->bank_setup; 189 info->map.map_priv_2 = (unsigned long) ixp_data->bank_setup;
190 190
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 7baba40c1ed2..0acbf4f5be50 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -210,7 +210,7 @@ static int blktrans_ioctl(struct block_device *bdev, fmode_t mode,
210 } 210 }
211} 211}
212 212
213static struct block_device_operations mtd_blktrans_ops = { 213static const struct block_device_operations mtd_blktrans_ops = {
214 .owner = THIS_MODULE, 214 .owner = THIS_MODULE,
215 .open = blktrans_open, 215 .open = blktrans_open,
216 .release = blktrans_release, 216 .release = blktrans_release,
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index 29acd06b1c39..1b4690bdfdb3 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -903,12 +903,12 @@ static struct pci_driver cafe_nand_pci_driver = {
903 .resume = cafe_nand_resume, 903 .resume = cafe_nand_resume,
904}; 904};
905 905
906static int cafe_nand_init(void) 906static int __init cafe_nand_init(void)
907{ 907{
908 return pci_register_driver(&cafe_nand_pci_driver); 908 return pci_register_driver(&cafe_nand_pci_driver);
909} 909}
910 910
911static void cafe_nand_exit(void) 911static void __exit cafe_nand_exit(void)
912{ 912{
913 pci_unregister_driver(&cafe_nand_pci_driver); 913 pci_unregister_driver(&cafe_nand_pci_driver);
914} 914}
diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
index 10081e656a6f..826cacffcefc 100644
--- a/drivers/mtd/nand/cmx270_nand.c
+++ b/drivers/mtd/nand/cmx270_nand.c
@@ -147,7 +147,7 @@ static int cmx270_device_ready(struct mtd_info *mtd)
147/* 147/*
148 * Main initialization routine 148 * Main initialization routine
149 */ 149 */
150static int cmx270_init(void) 150static int __init cmx270_init(void)
151{ 151{
152 struct nand_chip *this; 152 struct nand_chip *this;
153 const char *part_type; 153 const char *part_type;
@@ -261,7 +261,7 @@ module_init(cmx270_init);
261/* 261/*
262 * Clean up routine 262 * Clean up routine
263 */ 263 */
264static void cmx270_cleanup(void) 264static void __exit cmx270_cleanup(void)
265{ 265{
266 /* Release resources, unregister device */ 266 /* Release resources, unregister device */
267 nand_release(cmx270_nand_mtd); 267 nand_release(cmx270_nand_mtd);
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index e4d9ef0c965a..9f87c99189a9 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -1065,7 +1065,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
1065 } 1065 }
1066 1066
1067 /* 1067 /*
1068 * Now we have got to calculate how much data we have to to copy. In 1068 * Now we have got to calculate how much data we have to copy. In
1069 * case of a static volume it is fairly easy - the VID header contains 1069 * case of a static volume it is fairly easy - the VID header contains
1070 * the data size. In case of a dynamic volume it is more difficult - we 1070 * the data size. In case of a dynamic volume it is more difficult - we
1071 * have to read the contents, cut 0xFF bytes from the end and copy only 1071 * have to read the contents, cut 0xFF bytes from the end and copy only
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index c290f51dd178..1af08178defd 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -570,7 +570,7 @@ void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol,
570 570
571/* 571/*
572 * ubi_rb_for_each_entry - walk an RB-tree. 572 * ubi_rb_for_each_entry - walk an RB-tree.
573 * @rb: a pointer to type 'struct rb_node' to to use as a loop counter 573 * @rb: a pointer to type 'struct rb_node' to use as a loop counter
574 * @pos: a pointer to RB-tree entry type to use as a loop counter 574 * @pos: a pointer to RB-tree entry type to use as a loop counter
575 * @root: RB-tree's root 575 * @root: RB-tree's root
576 * @member: the name of the 'struct rb_node' within the RB-tree entry 576 * @member: the name of the 'struct rb_node' within the RB-tree entry
diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c
index 646dfc5f50c9..8ea9c7545c12 100644
--- a/drivers/net/arcnet/arc-rawmode.c
+++ b/drivers/net/arcnet/arc-rawmode.c
@@ -123,7 +123,6 @@ static void rx(struct net_device *dev, int bufnum,
123 BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx"); 123 BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
124 124
125 skb->protocol = cpu_to_be16(ETH_P_ARCNET); 125 skb->protocol = cpu_to_be16(ETH_P_ARCNET);
126;
127 netif_rx(skb); 126 netif_rx(skb);
128} 127}
129 128
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c
index 083e21094b20..66bcbbb6babc 100644
--- a/drivers/net/arcnet/capmode.c
+++ b/drivers/net/arcnet/capmode.c
@@ -149,7 +149,6 @@ static void rx(struct net_device *dev, int bufnum,
149 BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx"); 149 BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
150 150
151 skb->protocol = cpu_to_be16(ETH_P_ARCNET); 151 skb->protocol = cpu_to_be16(ETH_P_ARCNET);
152;
153 netif_rx(skb); 152 netif_rx(skb);
154} 153}
155 154
diff --git a/drivers/net/bnx2x_reg.h b/drivers/net/bnx2x_reg.h
index 0695be14cf91..aa76cbada5e2 100644
--- a/drivers/net/bnx2x_reg.h
+++ b/drivers/net/bnx2x_reg.h
@@ -3122,7 +3122,7 @@
3122 The fields are:[4:0] - tail pointer; [10:5] - Link List size; 15:11] - 3122 The fields are:[4:0] - tail pointer; [10:5] - Link List size; 15:11] -
3123 header pointer. */ 3123 header pointer. */
3124#define TCM_REG_XX_TABLE 0x50240 3124#define TCM_REG_XX_TABLE 0x50240
3125/* [RW 4] Load value for for cfc ac credit cnt. */ 3125/* [RW 4] Load value for cfc ac credit cnt. */
3126#define TM_REG_CFC_AC_CRDCNT_VAL 0x164208 3126#define TM_REG_CFC_AC_CRDCNT_VAL 0x164208
3127/* [RW 4] Load value for cfc cld credit cnt. */ 3127/* [RW 4] Load value for cfc cld credit cnt. */
3128#define TM_REG_CFC_CLD_CRDCNT_VAL 0x164210 3128#define TM_REG_CFC_CLD_CRDCNT_VAL 0x164210
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index cea5cfe23b71..c3fa31c9f2a7 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1987,7 +1987,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
1987 // find new aggregator for the related port(s) 1987 // find new aggregator for the related port(s)
1988 new_aggregator = __get_first_agg(port); 1988 new_aggregator = __get_first_agg(port);
1989 for (; new_aggregator; new_aggregator = __get_next_agg(new_aggregator)) { 1989 for (; new_aggregator; new_aggregator = __get_next_agg(new_aggregator)) {
1990 // if the new aggregator is empty, or it connected to to our port only 1990 // if the new aggregator is empty, or it is connected to our port only
1991 if (!new_aggregator->lag_ports || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator)) { 1991 if (!new_aggregator->lag_ports || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator)) {
1992 break; 1992 break;
1993 } 1993 }
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index cda6b397550d..45ac225a7aaa 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -3035,7 +3035,7 @@ s32 e1000_check_for_link(struct e1000_hw *hw)
3035 /* If TBI compatibility is was previously off, turn it on. For 3035 /* If TBI compatibility is was previously off, turn it on. For
3036 * compatibility with a TBI link partner, we will store bad 3036 * compatibility with a TBI link partner, we will store bad
3037 * packets. Some frames have an additional byte on the end and 3037 * packets. Some frames have an additional byte on the end and
3038 * will look like CRC errors to to the hardware. 3038 * will look like CRC errors to the hardware.
3039 */ 3039 */
3040 if (!hw->tbi_compatibility_on) { 3040 if (!hw->tbi_compatibility_on) {
3041 hw->tbi_compatibility_on = true; 3041 hw->tbi_compatibility_on = true;
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 2234118eedbb..6c144b525b47 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -293,7 +293,7 @@ static int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals
293 rxtime = get_ictt_value(priv->rxic); 293 rxtime = get_ictt_value(priv->rxic);
294 rxcount = get_icft_value(priv->rxic); 294 rxcount = get_icft_value(priv->rxic);
295 txtime = get_ictt_value(priv->txic); 295 txtime = get_ictt_value(priv->txic);
296 txcount = get_icft_value(priv->txic);; 296 txcount = get_icft_value(priv->txic);
297 cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, rxtime); 297 cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, rxtime);
298 cvals->rx_max_coalesced_frames = rxcount; 298 cvals->rx_max_coalesced_frames = rxcount;
299 299
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 1d7d7fef414f..89c82c5e63e4 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2556,13 +2556,13 @@ static int __devinit emac_init_config(struct emac_instance *dev)
2556 if (emac_read_uint_prop(np, "mdio-device", &dev->mdio_ph, 0)) 2556 if (emac_read_uint_prop(np, "mdio-device", &dev->mdio_ph, 0))
2557 dev->mdio_ph = 0; 2557 dev->mdio_ph = 0;
2558 if (emac_read_uint_prop(np, "zmii-device", &dev->zmii_ph, 0)) 2558 if (emac_read_uint_prop(np, "zmii-device", &dev->zmii_ph, 0))
2559 dev->zmii_ph = 0;; 2559 dev->zmii_ph = 0;
2560 if (emac_read_uint_prop(np, "zmii-channel", &dev->zmii_port, 0)) 2560 if (emac_read_uint_prop(np, "zmii-channel", &dev->zmii_port, 0))
2561 dev->zmii_port = 0xffffffff;; 2561 dev->zmii_port = 0xffffffff;
2562 if (emac_read_uint_prop(np, "rgmii-device", &dev->rgmii_ph, 0)) 2562 if (emac_read_uint_prop(np, "rgmii-device", &dev->rgmii_ph, 0))
2563 dev->rgmii_ph = 0;; 2563 dev->rgmii_ph = 0;
2564 if (emac_read_uint_prop(np, "rgmii-channel", &dev->rgmii_port, 0)) 2564 if (emac_read_uint_prop(np, "rgmii-channel", &dev->rgmii_port, 0))
2565 dev->rgmii_port = 0xffffffff;; 2565 dev->rgmii_port = 0xffffffff;
2566 if (emac_read_uint_prop(np, "fifo-entry-size", &dev->fifo_entry_size, 0)) 2566 if (emac_read_uint_prop(np, "fifo-entry-size", &dev->fifo_entry_size, 0))
2567 dev->fifo_entry_size = 16; 2567 dev->fifo_entry_size = 16;
2568 if (emac_read_uint_prop(np, "mal-burst-size", &dev->mal_burst_size, 0)) 2568 if (emac_read_uint_prop(np, "mal-burst-size", &dev->mal_burst_size, 0))
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index d2639c4a086d..5d6c1530a8c0 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3966,7 +3966,7 @@ static int igb_set_vf_multicasts(struct igb_adapter *adapter,
3966 /* VFs are limited to using the MTA hash table for their multicast 3966 /* VFs are limited to using the MTA hash table for their multicast
3967 * addresses */ 3967 * addresses */
3968 for (i = 0; i < n; i++) 3968 for (i = 0; i < n; i++)
3969 vf_data->vf_mc_hashes[i] = hash_list[i];; 3969 vf_data->vf_mc_hashes[i] = hash_list[i];
3970 3970
3971 /* Flush and reset the mta with the new values */ 3971 /* Flush and reset the mta with the new values */
3972 igb_set_rx_mode(adapter->netdev); 3972 igb_set_rx_mode(adapter->netdev);
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index da8d0a0ca94f..f2a197fd47a5 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -865,7 +865,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
865 dcrs = dcr_resource_start(np, 0); 865 dcrs = dcr_resource_start(np, 0);
866 if (dcrs == 0) { 866 if (dcrs == 0) {
867 dev_err(&op->dev, "could not get DMA register address\n"); 867 dev_err(&op->dev, "could not get DMA register address\n");
868 goto nodev;; 868 goto nodev;
869 } 869 }
870 lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0)); 870 lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
871 dev_dbg(&op->dev, "DCR base: %x\n", dcrs); 871 dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index fb65b427c692..1d0d4d9ab623 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -241,7 +241,7 @@ static int macb_mii_init(struct macb *bp)
241 struct eth_platform_data *pdata; 241 struct eth_platform_data *pdata;
242 int err = -ENXIO, i; 242 int err = -ENXIO, i;
243 243
244 /* Enable managment port */ 244 /* Enable management port */
245 macb_writel(bp, NCR, MACB_BIT(MPE)); 245 macb_writel(bp, NCR, MACB_BIT(MPE));
246 246
247 bp->mii_bus = mdiobus_alloc(); 247 bp->mii_bus = mdiobus_alloc();
diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c
index bd0ac690d12c..aad3b370c562 100644
--- a/drivers/net/ni52.c
+++ b/drivers/net/ni52.c
@@ -615,10 +615,10 @@ static int init586(struct net_device *dev)
615 /* addr_len |!src_insert |pre-len |loopback */ 615 /* addr_len |!src_insert |pre-len |loopback */
616 writeb(0x2e, &cfg_cmd->adr_len); 616 writeb(0x2e, &cfg_cmd->adr_len);
617 writeb(0x00, &cfg_cmd->priority); 617 writeb(0x00, &cfg_cmd->priority);
618 writeb(0x60, &cfg_cmd->ifs);; 618 writeb(0x60, &cfg_cmd->ifs);
619 writeb(0x00, &cfg_cmd->time_low); 619 writeb(0x00, &cfg_cmd->time_low);
620 writeb(0xf2, &cfg_cmd->time_high); 620 writeb(0xf2, &cfg_cmd->time_high);
621 writeb(0x00, &cfg_cmd->promisc);; 621 writeb(0x00, &cfg_cmd->promisc);
622 if (dev->flags & IFF_ALLMULTI) { 622 if (dev->flags & IFF_ALLMULTI) {
623 int len = ((char __iomem *)p->iscp - (char __iomem *)ptr - 8) / 6; 623 int len = ((char __iomem *)p->iscp - (char __iomem *)ptr - 8) / 6;
624 if (num_addrs > len) { 624 if (num_addrs > len) {
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 220529257828..7783c5db81dc 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -2630,7 +2630,7 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2630 FLAGS_LI; /* Load irq delay values */ 2630 FLAGS_LI; /* Load irq delay values */
2631 if (rx_ring->lbq_len) { 2631 if (rx_ring->lbq_len) {
2632 cqicb->flags |= FLAGS_LL; /* Load lbq values */ 2632 cqicb->flags |= FLAGS_LL; /* Load lbq values */
2633 tmp = (u64)rx_ring->lbq_base_dma;; 2633 tmp = (u64)rx_ring->lbq_base_dma;
2634 base_indirect_ptr = (__le64 *) rx_ring->lbq_base_indirect; 2634 base_indirect_ptr = (__le64 *) rx_ring->lbq_base_indirect;
2635 page_entries = 0; 2635 page_entries = 0;
2636 do { 2636 do {
@@ -2654,7 +2654,7 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2654 } 2654 }
2655 if (rx_ring->sbq_len) { 2655 if (rx_ring->sbq_len) {
2656 cqicb->flags |= FLAGS_LS; /* Load sbq values */ 2656 cqicb->flags |= FLAGS_LS; /* Load sbq values */
2657 tmp = (u64)rx_ring->sbq_base_dma;; 2657 tmp = (u64)rx_ring->sbq_base_dma;
2658 base_indirect_ptr = (__le64 *) rx_ring->sbq_base_indirect; 2658 base_indirect_ptr = (__le64 *) rx_ring->sbq_base_indirect;
2659 page_entries = 0; 2659 page_entries = 0;
2660 do { 2660 do {
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index bc98e7f69ee9..ede937ee50c7 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -72,7 +72,7 @@ static int rionet_check = 0;
72static int rionet_capable = 1; 72static int rionet_capable = 1;
73 73
74/* 74/*
75 * This is a fast lookup table for for translating TX 75 * This is a fast lookup table for translating TX
76 * Ethernet packets into a destination RIO device. It 76 * Ethernet packets into a destination RIO device. It
77 * could be made into a hash table to save memory depending 77 * could be made into a hash table to save memory depending
78 * on system trade-offs. 78 * on system trade-offs.
diff --git a/drivers/net/skfp/pcmplc.c b/drivers/net/skfp/pcmplc.c
index f1df2ec8ad41..e6b33ee05ede 100644
--- a/drivers/net/skfp/pcmplc.c
+++ b/drivers/net/skfp/pcmplc.c
@@ -960,7 +960,7 @@ static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd)
960 /*PC88b*/ 960 /*PC88b*/
961 if (!phy->cf_join) { 961 if (!phy->cf_join) {
962 phy->cf_join = TRUE ; 962 phy->cf_join = TRUE ;
963 queue_event(smc,EVENT_CFM,CF_JOIN+np) ; ; 963 queue_event(smc,EVENT_CFM,CF_JOIN+np) ;
964 } 964 }
965 if (cmd == PC_JOIN) 965 if (cmd == PC_JOIN)
966 GO_STATE(PC8_ACTIVE) ; 966 GO_STATE(PC8_ACTIVE) ;
diff --git a/drivers/net/skfp/pmf.c b/drivers/net/skfp/pmf.c
index 79e665e0853d..a320fdb3727d 100644
--- a/drivers/net/skfp/pmf.c
+++ b/drivers/net/skfp/pmf.c
@@ -807,9 +807,9 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
807 mib_p->fddiPORTLerFlag ; 807 mib_p->fddiPORTLerFlag ;
808 sp->p4050_pad = 0 ; 808 sp->p4050_pad = 0 ;
809 sp->p4050_cutoff = 809 sp->p4050_cutoff =
810 mib_p->fddiPORTLer_Cutoff ; ; 810 mib_p->fddiPORTLer_Cutoff ;
811 sp->p4050_alarm = 811 sp->p4050_alarm =
812 mib_p->fddiPORTLer_Alarm ; ; 812 mib_p->fddiPORTLer_Alarm ;
813 sp->p4050_estimate = 813 sp->p4050_estimate =
814 mib_p->fddiPORTLer_Estimate ; 814 mib_p->fddiPORTLer_Estimate ;
815 sp->p4050_reject_ct = 815 sp->p4050_reject_ct =
@@ -829,7 +829,7 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
829 sp->p4051_porttype = 829 sp->p4051_porttype =
830 mib_p->fddiPORTMy_Type ; 830 mib_p->fddiPORTMy_Type ;
831 sp->p4051_connectstate = 831 sp->p4051_connectstate =
832 mib_p->fddiPORTConnectState ; ; 832 mib_p->fddiPORTConnectState ;
833 sp->p4051_pc_neighbor = 833 sp->p4051_pc_neighbor =
834 mib_p->fddiPORTNeighborType ; 834 mib_p->fddiPORTNeighborType ;
835 sp->p4051_pc_withhold = 835 sp->p4051_pc_withhold =
@@ -853,7 +853,7 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
853 struct smt_p_4053 *sp ; 853 struct smt_p_4053 *sp ;
854 sp = (struct smt_p_4053 *) to ; 854 sp = (struct smt_p_4053 *) to ;
855 sp->p4053_multiple = 855 sp->p4053_multiple =
856 mib_p->fddiPORTMultiple_P ; ; 856 mib_p->fddiPORTMultiple_P ;
857 sp->p4053_availablepaths = 857 sp->p4053_availablepaths =
858 mib_p->fddiPORTAvailablePaths ; 858 mib_p->fddiPORTAvailablePaths ;
859 sp->p4053_currentpath = 859 sp->p4053_currentpath =
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 62e852e21ab2..55bad4081966 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -215,7 +215,7 @@ static void skge_wol_init(struct skge_port *skge)
215 if (skge->wol & WAKE_MAGIC) 215 if (skge->wol & WAKE_MAGIC)
216 ctrl |= WOL_CTL_ENA_PME_ON_MAGIC_PKT|WOL_CTL_ENA_MAGIC_PKT_UNIT; 216 ctrl |= WOL_CTL_ENA_PME_ON_MAGIC_PKT|WOL_CTL_ENA_MAGIC_PKT_UNIT;
217 else 217 else
218 ctrl |= WOL_CTL_DIS_PME_ON_MAGIC_PKT|WOL_CTL_DIS_MAGIC_PKT_UNIT;; 218 ctrl |= WOL_CTL_DIS_PME_ON_MAGIC_PKT|WOL_CTL_DIS_MAGIC_PKT_UNIT;
219 219
220 ctrl |= WOL_CTL_DIS_PME_ON_PATTERN|WOL_CTL_DIS_PATTERN_UNIT; 220 ctrl |= WOL_CTL_DIS_PME_ON_PATTERN|WOL_CTL_DIS_PATTERN_UNIT;
221 skge_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); 221 skge_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 4bb52e9cd371..15140f9f2e92 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -765,7 +765,7 @@ static void sky2_wol_init(struct sky2_port *sky2)
765 if (sky2->wol & WAKE_MAGIC) 765 if (sky2->wol & WAKE_MAGIC)
766 ctrl |= WOL_CTL_ENA_PME_ON_MAGIC_PKT|WOL_CTL_ENA_MAGIC_PKT_UNIT; 766 ctrl |= WOL_CTL_ENA_PME_ON_MAGIC_PKT|WOL_CTL_ENA_MAGIC_PKT_UNIT;
767 else 767 else
768 ctrl |= WOL_CTL_DIS_PME_ON_MAGIC_PKT|WOL_CTL_DIS_MAGIC_PKT_UNIT;; 768 ctrl |= WOL_CTL_DIS_PME_ON_MAGIC_PKT|WOL_CTL_DIS_MAGIC_PKT_UNIT;
769 769
770 ctrl |= WOL_CTL_DIS_PME_ON_PATTERN|WOL_CTL_DIS_PATTERN_UNIT; 770 ctrl |= WOL_CTL_DIS_PME_ON_PATTERN|WOL_CTL_DIS_PATTERN_UNIT;
771 sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl); 771 sky2_write16(hw, WOL_REGS(port, WOL_CTRL_STAT), ctrl);
diff --git a/drivers/net/vxge/vxge-config.h b/drivers/net/vxge/vxge-config.h
index 62779a520ca1..3e94f0ce0900 100644
--- a/drivers/net/vxge/vxge-config.h
+++ b/drivers/net/vxge/vxge-config.h
@@ -1541,7 +1541,7 @@ void vxge_hw_ring_rxd_1b_info_get(
1541 rxd_info->l4_cksum_valid = 1541 rxd_info->l4_cksum_valid =
1542 (u32)VXGE_HW_RING_RXD_L4_CKSUM_CORRECT_GET(rxdp->control_0); 1542 (u32)VXGE_HW_RING_RXD_L4_CKSUM_CORRECT_GET(rxdp->control_0);
1543 rxd_info->l4_cksum = 1543 rxd_info->l4_cksum =
1544 (u32)VXGE_HW_RING_RXD_L4_CKSUM_GET(rxdp->control_0);; 1544 (u32)VXGE_HW_RING_RXD_L4_CKSUM_GET(rxdp->control_0);
1545 rxd_info->frame = 1545 rxd_info->frame =
1546 (u32)VXGE_HW_RING_RXD_ETHER_ENCAP_GET(rxdp->control_0); 1546 (u32)VXGE_HW_RING_RXD_ETHER_ENCAP_GET(rxdp->control_0);
1547 rxd_info->proto = 1547 rxd_info->proto =
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index b378037a29b5..068d7a9d3e36 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -2350,7 +2350,7 @@ static int vxge_enable_msix(struct vxgedev *vdev)
2350 enum vxge_hw_status status; 2350 enum vxge_hw_status status;
2351 /* 0 - Tx, 1 - Rx */ 2351 /* 0 - Tx, 1 - Rx */
2352 int tim_msix_id[4]; 2352 int tim_msix_id[4];
2353 int alarm_msix_id = 0, msix_intr_vect = 0;; 2353 int alarm_msix_id = 0, msix_intr_vect = 0;
2354 vdev->intr_cnt = 0; 2354 vdev->intr_cnt = 0;
2355 2355
2356 /* allocate msix vectors */ 2356 /* allocate msix vectors */
diff --git a/drivers/net/wireless/ath/ath5k/reg.h b/drivers/net/wireless/ath/ath5k/reg.h
index debad07d9900..c63ea6afd96f 100644
--- a/drivers/net/wireless/ath/ath5k/reg.h
+++ b/drivers/net/wireless/ath/ath5k/reg.h
@@ -982,7 +982,7 @@
982#define AR5K_5414_CBCFG_BUF_DIS 0x10 /* Disable buffer */ 982#define AR5K_5414_CBCFG_BUF_DIS 0x10 /* Disable buffer */
983 983
984/* 984/*
985 * PCI-E Power managment configuration 985 * PCI-E Power management configuration
986 * and status register [5424+] 986 * and status register [5424+]
987 */ 987 */
988#define AR5K_PCIE_PM_CTL 0x4068 /* Register address */ 988#define AR5K_PCIE_PM_CTL 0x4068 /* Register address */
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index a3b36b3a9d67..cce188837d10 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -3330,7 +3330,7 @@ static void atmel_smooth_qual(struct atmel_private *priv)
3330 priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID; 3330 priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
3331} 3331}
3332 3332
3333/* deals with incoming managment frames. */ 3333/* deals with incoming management frames. */
3334static void atmel_management_frame(struct atmel_private *priv, 3334static void atmel_management_frame(struct atmel_private *priv,
3335 struct ieee80211_hdr *header, 3335 struct ieee80211_hdr *header,
3336 u16 frame_len, u8 rssi) 3336 u16 frame_len, u8 rssi)
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 5e110a2328ae..4e79a9800134 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -368,7 +368,7 @@ error:
368 return r; 368 return r;
369} 369}
370 370
371/* MAC address: if custom mac addresses are to to be used CR_MAC_ADDR_P1 and 371/* MAC address: if custom mac addresses are to be used CR_MAC_ADDR_P1 and
372 * CR_MAC_ADDR_P2 must be overwritten 372 * CR_MAC_ADDR_P2 must be overwritten
373 */ 373 */
374int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr) 374int zd_write_mac_addr(struct zd_chip *chip, const u8 *mac_addr)
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index b7e4cee24269..2766a6d3c2e9 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -35,7 +35,7 @@ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
35} 35}
36 36
37 37
38static struct super_operations s_ops = { 38static const struct super_operations s_ops = {
39 .statfs = simple_statfs, 39 .statfs = simple_statfs,
40 .drop_inode = generic_delete_inode, 40 .drop_inode = generic_delete_inode,
41}; 41};
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index a45b0c0d574e..a6b4a5a53d40 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1266,7 +1266,7 @@ ccio_ioc_init(struct ioc *ioc)
1266 ** Hot-Plug/Removal of PCI cards. (aka PCI OLARD). 1266 ** Hot-Plug/Removal of PCI cards. (aka PCI OLARD).
1267 */ 1267 */
1268 1268
1269 iova_space_size = (u32) (num_physpages / count_parisc_driver(&ccio_driver)); 1269 iova_space_size = (u32) (totalram_pages / count_parisc_driver(&ccio_driver));
1270 1270
1271 /* limit IOVA space size to 1MB-1GB */ 1271 /* limit IOVA space size to 1MB-1GB */
1272 1272
@@ -1305,7 +1305,7 @@ ccio_ioc_init(struct ioc *ioc)
1305 1305
1306 DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n", 1306 DBG_INIT("%s() hpa 0x%p mem %luMB IOV %dMB (%d bits)\n",
1307 __func__, ioc->ioc_regs, 1307 __func__, ioc->ioc_regs,
1308 (unsigned long) num_physpages >> (20 - PAGE_SHIFT), 1308 (unsigned long) totalram_pages >> (20 - PAGE_SHIFT),
1309 iova_space_size>>20, 1309 iova_space_size>>20,
1310 iov_order + PAGE_SHIFT); 1310 iov_order + PAGE_SHIFT);
1311 1311
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 123d8fe3427d..57a6d19eba4c 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -1390,7 +1390,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1390 ** for DMA hints - ergo only 30 bits max. 1390 ** for DMA hints - ergo only 30 bits max.
1391 */ 1391 */
1392 1392
1393 iova_space_size = (u32) (num_physpages/global_ioc_cnt); 1393 iova_space_size = (u32) (totalram_pages/global_ioc_cnt);
1394 1394
1395 /* limit IOVA space size to 1MB-1GB */ 1395 /* limit IOVA space size to 1MB-1GB */
1396 if (iova_space_size < (1 << (20 - PAGE_SHIFT))) { 1396 if (iova_space_size < (1 << (20 - PAGE_SHIFT))) {
@@ -1415,7 +1415,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)
1415 DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n", 1415 DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n",
1416 __func__, 1416 __func__,
1417 ioc->ioc_hpa, 1417 ioc->ioc_hpa,
1418 (unsigned long) num_physpages >> (20 - PAGE_SHIFT), 1418 (unsigned long) totalram_pages >> (20 - PAGE_SHIFT),
1419 iova_space_size>>20, 1419 iova_space_size>>20,
1420 iov_order + PAGE_SHIFT); 1420 iov_order + PAGE_SHIFT);
1421 1421
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 7b424e0b0449..32c44040c1e8 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -27,6 +27,7 @@
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/poll.h> 28#include <linux/poll.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/seq_file.h>
30#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
31#include <linux/workqueue.h> 32#include <linux/workqueue.h>
32 33
@@ -105,37 +106,40 @@ static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info)
105#ifdef CONFIG_PROC_FS 106#ifdef CONFIG_PROC_FS
106static struct proc_dir_entry *proc_pccard = NULL; 107static struct proc_dir_entry *proc_pccard = NULL;
107 108
108static int proc_read_drivers_callback(struct device_driver *driver, void *d) 109static int proc_read_drivers_callback(struct device_driver *driver, void *_m)
109{ 110{
110 char **p = d; 111 struct seq_file *m = _m;
111 struct pcmcia_driver *p_drv = container_of(driver, 112 struct pcmcia_driver *p_drv = container_of(driver,
112 struct pcmcia_driver, drv); 113 struct pcmcia_driver, drv);
113 114
114 *p += sprintf(*p, "%-24.24s 1 %d\n", p_drv->drv.name, 115 seq_printf(m, "%-24.24s 1 %d\n", p_drv->drv.name,
115#ifdef CONFIG_MODULE_UNLOAD 116#ifdef CONFIG_MODULE_UNLOAD
116 (p_drv->owner) ? module_refcount(p_drv->owner) : 1 117 (p_drv->owner) ? module_refcount(p_drv->owner) : 1
117#else 118#else
118 1 119 1
119#endif 120#endif
120 ); 121 );
121 d = (void *) p;
122
123 return 0; 122 return 0;
124} 123}
125 124
126static int proc_read_drivers(char *buf, char **start, off_t pos, 125static int pccard_drivers_proc_show(struct seq_file *m, void *v)
127 int count, int *eof, void *data)
128{ 126{
129 char *p = buf; 127 return bus_for_each_drv(&pcmcia_bus_type, NULL,
130 int rc; 128 m, proc_read_drivers_callback);
131 129}
132 rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
133 (void *) &p, proc_read_drivers_callback);
134 if (rc < 0)
135 return rc;
136 130
137 return (p - buf); 131static int pccard_drivers_proc_open(struct inode *inode, struct file *file)
132{
133 return single_open(file, pccard_drivers_proc_show, NULL);
138} 134}
135
136static const struct file_operations pccard_drivers_proc_fops = {
137 .owner = THIS_MODULE,
138 .open = pccard_drivers_proc_open,
139 .read = seq_read,
140 .llseek = seq_lseek,
141 .release = single_release,
142};
139#endif 143#endif
140 144
141 145
@@ -1011,7 +1015,7 @@ void __init pcmcia_setup_ioctl(void) {
1011#ifdef CONFIG_PROC_FS 1015#ifdef CONFIG_PROC_FS
1012 proc_pccard = proc_mkdir("bus/pccard", NULL); 1016 proc_pccard = proc_mkdir("bus/pccard", NULL);
1013 if (proc_pccard) 1017 if (proc_pccard)
1014 create_proc_read_entry("drivers",0,proc_pccard,proc_read_drivers,NULL); 1018 proc_create("drivers", 0, proc_pccard, &pccard_drivers_proc_fops);
1015#endif 1019#endif
1016} 1020}
1017 1021
diff --git a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c
index 57ca085473d5..7eedb42f800c 100644
--- a/drivers/pcmcia/sa1100_jornada720.c
+++ b/drivers/pcmcia/sa1100_jornada720.c
@@ -16,89 +16,103 @@
16 16
17#include "sa1111_generic.h" 17#include "sa1111_generic.h"
18 18
19#define SOCKET0_POWER GPIO_GPIO0 19/* Does SOCKET1_3V actually do anything? */
20#define SOCKET0_3V GPIO_GPIO2 20#define SOCKET0_POWER GPIO_GPIO0
21#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3) 21#define SOCKET0_3V GPIO_GPIO2
22#warning *** Does SOCKET1_3V actually do anything? 22#define SOCKET1_POWER (GPIO_GPIO1 | GPIO_GPIO3)
23#define SOCKET1_3V GPIO_GPIO3 23#define SOCKET1_3V GPIO_GPIO3
24 24
25static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 25static int jornada720_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
26{ 26{
27 /* 27 unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3;
28 * What is all this crap for? 28
29 */ 29 /*
30 GRER |= 0x00000002; 30 * What is all this crap for?
31 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ 31 */
32 sa1111_set_io_dir(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); 32 GRER |= 0x00000002;
33 sa1111_set_io(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 33 /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */
34 sa1111_set_sleep_io(SA1111_DEV(skt->dev), GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); 34 sa1111_set_io_dir(SA1111_DEV(skt->dev), pin, 0, 0);
35 35 sa1111_set_io(SA1111_DEV(skt->dev), pin, 0);
36 return sa1111_pcmcia_hw_init(skt); 36 sa1111_set_sleep_io(SA1111_DEV(skt->dev), pin, 0);
37
38 return sa1111_pcmcia_hw_init(skt);
37} 39}
38 40
39static int 41static int
40jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) 42jornada720_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
41{ 43{
42 unsigned int pa_dwr_mask, pa_dwr_set; 44 unsigned int pa_dwr_mask, pa_dwr_set;
43 int ret; 45 int ret;
44 46
45printk("%s(): config socket %d vcc %d vpp %d\n", __func__, 47 printk(KERN_INFO "%s(): config socket %d vcc %d vpp %d\n", __func__,
46 skt->nr, state->Vcc, state->Vpp); 48 skt->nr, state->Vcc, state->Vpp);
47 49
48 switch (skt->nr) { 50 switch (skt->nr) {
49 case 0: 51 case 0:
50 pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V; 52 pa_dwr_mask = SOCKET0_POWER | SOCKET0_3V;
51 53
52 switch (state->Vcc) { 54 switch (state->Vcc) {
53 default: 55 default:
54 case 0: pa_dwr_set = 0; break; 56 case 0:
55 case 33: pa_dwr_set = SOCKET0_POWER | SOCKET0_3V; break; 57 pa_dwr_set = 0;
56 case 50: pa_dwr_set = SOCKET0_POWER; break; 58 break;
57 } 59 case 33:
58 break; 60 pa_dwr_set = SOCKET0_POWER | SOCKET0_3V;
59 61 break;
60 case 1: 62 case 50:
61 pa_dwr_mask = SOCKET1_POWER; 63 pa_dwr_set = SOCKET0_POWER;
62 64 break;
63 switch (state->Vcc) { 65 }
64 default: 66 break;
65 case 0: pa_dwr_set = 0; break; 67
66 case 33: pa_dwr_set = SOCKET1_POWER; break; 68 case 1:
67 case 50: pa_dwr_set = SOCKET1_POWER; break; 69 pa_dwr_mask = SOCKET1_POWER;
68 } 70
69 break; 71 switch (state->Vcc) {
70 72 default:
71 default: 73 case 0:
72 return -1; 74 pa_dwr_set = 0;
73 } 75 break;
74 76 case 33:
75 if (state->Vpp != state->Vcc && state->Vpp != 0) { 77 pa_dwr_set = SOCKET1_POWER;
76 printk(KERN_ERR "%s(): slot cannot support VPP %u\n", 78 break;
77 __func__, state->Vpp); 79 case 50:
78 return -1; 80 pa_dwr_set = SOCKET1_POWER;
79 } 81 break;
80 82 }
81 ret = sa1111_pcmcia_configure_socket(skt, state); 83 break;
82 if (ret == 0) { 84
83 unsigned long flags; 85 default:
84 86 return -1;
85 local_irq_save(flags); 87 }
86 sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set); 88
87 local_irq_restore(flags); 89 if (state->Vpp != state->Vcc && state->Vpp != 0) {
88 } 90 printk(KERN_ERR "%s(): slot cannot support VPP %u\n",
89 91 __func__, state->Vpp);
90 return ret; 92 return -EPERM;
93 }
94
95 ret = sa1111_pcmcia_configure_socket(skt, state);
96 if (ret == 0) {
97 unsigned long flags;
98
99 local_irq_save(flags);
100 sa1111_set_io(SA1111_DEV(skt->dev), pa_dwr_mask, pa_dwr_set);
101 local_irq_restore(flags);
102 }
103
104 return ret;
91} 105}
92 106
93static struct pcmcia_low_level jornada720_pcmcia_ops = { 107static struct pcmcia_low_level jornada720_pcmcia_ops = {
94 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
95 .hw_init = jornada720_pcmcia_hw_init, 109 .hw_init = jornada720_pcmcia_hw_init,
96 .hw_shutdown = sa1111_pcmcia_hw_shutdown, 110 .hw_shutdown = sa1111_pcmcia_hw_shutdown,
97 .socket_state = sa1111_pcmcia_socket_state, 111 .socket_state = sa1111_pcmcia_socket_state,
98 .configure_socket = jornada720_pcmcia_configure_socket, 112 .configure_socket = jornada720_pcmcia_configure_socket,
99 113
100 .socket_init = sa1111_pcmcia_socket_init, 114 .socket_init = sa1111_pcmcia_socket_init,
101 .socket_suspend = sa1111_pcmcia_socket_suspend, 115 .socket_suspend = sa1111_pcmcia_socket_suspend,
102}; 116};
103 117
104int __devinit pcmcia_jornada720_init(struct device *dev) 118int __devinit pcmcia_jornada720_init(struct device *dev)
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 737fe5d87c40..b459e87a30ac 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -717,7 +717,7 @@ static void yenta_free_resources(struct yenta_socket *socket)
717/* 717/*
718 * Close it down - release our resources and go home.. 718 * Close it down - release our resources and go home..
719 */ 719 */
720static void yenta_close(struct pci_dev *dev) 720static void __devexit yenta_close(struct pci_dev *dev)
721{ 721{
722 struct yenta_socket *sock = pci_get_drvdata(dev); 722 struct yenta_socket *sock = pci_get_drvdata(dev);
723 723
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 527ee764c93f..cd11b113494f 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -135,6 +135,15 @@ static int pnp_device_remove(struct device *dev)
135 return 0; 135 return 0;
136} 136}
137 137
138static void pnp_device_shutdown(struct device *dev)
139{
140 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
141 struct pnp_driver *drv = pnp_dev->driver;
142
143 if (drv && drv->shutdown)
144 drv->shutdown(pnp_dev);
145}
146
138static int pnp_bus_match(struct device *dev, struct device_driver *drv) 147static int pnp_bus_match(struct device *dev, struct device_driver *drv)
139{ 148{
140 struct pnp_dev *pnp_dev = to_pnp_dev(dev); 149 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
@@ -203,6 +212,7 @@ struct bus_type pnp_bus_type = {
203 .match = pnp_bus_match, 212 .match = pnp_bus_match,
204 .probe = pnp_device_probe, 213 .probe = pnp_device_probe,
205 .remove = pnp_device_remove, 214 .remove = pnp_device_remove,
215 .shutdown = pnp_device_shutdown,
206 .suspend = pnp_bus_suspend, 216 .suspend = pnp_bus_suspend,
207 .resume = pnp_bus_resume, 217 .resume = pnp_bus_resume,
208 .dev_attrs = pnp_interface_attrs, 218 .dev_attrs = pnp_interface_attrs,
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index bd1ce8e2bc18..0587d53987fe 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -430,7 +430,7 @@ fail:
430 430
431static int __exit omap_rtc_remove(struct platform_device *pdev) 431static int __exit omap_rtc_remove(struct platform_device *pdev)
432{ 432{
433 struct rtc_device *rtc = platform_get_drvdata(pdev);; 433 struct rtc_device *rtc = platform_get_drvdata(pdev);
434 434
435 device_init_wakeup(&pdev->dev, 0); 435 device_init_wakeup(&pdev->dev, 0);
436 436
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index e109da4583a8..dad0449475b6 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2146,7 +2146,7 @@ static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
2146 return 0; 2146 return 0;
2147} 2147}
2148 2148
2149struct block_device_operations 2149const struct block_device_operations
2150dasd_device_operations = { 2150dasd_device_operations = {
2151 .owner = THIS_MODULE, 2151 .owner = THIS_MODULE,
2152 .open = dasd_open, 2152 .open = dasd_open,
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index a1ce573648a2..bd9fe2e36dce 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -706,7 +706,7 @@ static int dasd_eckd_generate_uid(struct dasd_device *device,
706 sizeof(uid->serial) - 1); 706 sizeof(uid->serial) - 1);
707 EBCASC(uid->serial, sizeof(uid->serial) - 1); 707 EBCASC(uid->serial, sizeof(uid->serial) - 1);
708 uid->ssid = private->gneq->subsystemID; 708 uid->ssid = private->gneq->subsystemID;
709 uid->real_unit_addr = private->ned->unit_addr;; 709 uid->real_unit_addr = private->ned->unit_addr;
710 if (private->sneq) { 710 if (private->sneq) {
711 uid->type = private->sneq->sua_flags; 711 uid->type = private->sneq->sua_flags;
712 if (uid->type == UA_BASE_PAV_ALIAS) 712 if (uid->type == UA_BASE_PAV_ALIAS)
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index 5e47a1ee52b9..8afd9fa00875 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -540,7 +540,7 @@ dasd_check_blocksize(int bsize)
540extern debug_info_t *dasd_debug_area; 540extern debug_info_t *dasd_debug_area;
541extern struct dasd_profile_info_t dasd_global_profile; 541extern struct dasd_profile_info_t dasd_global_profile;
542extern unsigned int dasd_profile_level; 542extern unsigned int dasd_profile_level;
543extern struct block_device_operations dasd_device_operations; 543extern const struct block_device_operations dasd_device_operations;
544 544
545extern struct kmem_cache *dasd_page_cache; 545extern struct kmem_cache *dasd_page_cache;
546 546
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index d34617682a62..f76f4bd82b9f 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -34,7 +34,7 @@ static int dcssblk_direct_access(struct block_device *bdev, sector_t secnum,
34static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; 34static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0";
35 35
36static int dcssblk_major; 36static int dcssblk_major;
37static struct block_device_operations dcssblk_devops = { 37static const struct block_device_operations dcssblk_devops = {
38 .owner = THIS_MODULE, 38 .owner = THIS_MODULE,
39 .open = dcssblk_open, 39 .open = dcssblk_open,
40 .release = dcssblk_release, 40 .release = dcssblk_release,
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index ee604e92a5fa..116d1b3eeb15 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -244,7 +244,7 @@ static int xpram_getgeo(struct block_device *bdev, struct hd_geometry *geo)
244 return 0; 244 return 0;
245} 245}
246 246
247static struct block_device_operations xpram_devops = 247static const struct block_device_operations xpram_devops =
248{ 248{
249 .owner = THIS_MODULE, 249 .owner = THIS_MODULE,
250 .getgeo = xpram_getgeo, 250 .getgeo = xpram_getgeo,
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c
index 4cb9e70507ab..64f57ef2763c 100644
--- a/drivers/s390/char/tape_block.c
+++ b/drivers/s390/char/tape_block.c
@@ -50,7 +50,7 @@ static int tapeblock_ioctl(struct block_device *, fmode_t, unsigned int,
50static int tapeblock_medium_changed(struct gendisk *); 50static int tapeblock_medium_changed(struct gendisk *);
51static int tapeblock_revalidate_disk(struct gendisk *); 51static int tapeblock_revalidate_disk(struct gendisk *);
52 52
53static struct block_device_operations tapeblock_fops = { 53static const struct block_device_operations tapeblock_fops = {
54 .owner = THIS_MODULE, 54 .owner = THIS_MODULE,
55 .open = tapeblock_open, 55 .open = tapeblock_open,
56 .release = tapeblock_release, 56 .release = tapeblock_release,
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index a4b2c576144b..c84eadd3602a 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -2113,7 +2113,7 @@ static ssize_t remove_write (struct device_driver *drv,
2113 IUCV_DBF_TEXT(trace, 3, __func__); 2113 IUCV_DBF_TEXT(trace, 3, __func__);
2114 2114
2115 if (count >= IFNAMSIZ) 2115 if (count >= IFNAMSIZ)
2116 count = IFNAMSIZ - 1;; 2116 count = IFNAMSIZ - 1;
2117 2117
2118 for (i = 0, p = buf; i < count && *p; i++, p++) { 2118 for (i = 0, p = buf; i < count && *p; i++, p++) {
2119 if (*p == '\n' || *p == ' ') 2119 if (*p == '\n' || *p == ' ')
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 3ff726afafc6..0e1a34627a2e 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -102,7 +102,7 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
102 if (unlikely((status & ZFCP_STATUS_COMMON_ERP_FAILED) || 102 if (unlikely((status & ZFCP_STATUS_COMMON_ERP_FAILED) ||
103 !(status & ZFCP_STATUS_COMMON_RUNNING))) { 103 !(status & ZFCP_STATUS_COMMON_RUNNING))) {
104 zfcp_scsi_command_fail(scpnt, DID_ERROR); 104 zfcp_scsi_command_fail(scpnt, DID_ERROR);
105 return 0;; 105 return 0;
106 } 106 }
107 107
108 ret = zfcp_fsf_send_fcp_command_task(unit, scpnt); 108 ret = zfcp_fsf_send_fcp_command_task(unit, scpnt);
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index 6d4651684688..869a30b49edc 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -452,7 +452,7 @@ static const struct file_operations jsf_fops = {
452 452
453static struct miscdevice jsf_dev = { JSF_MINOR, "jsflash", &jsf_fops }; 453static struct miscdevice jsf_dev = { JSF_MINOR, "jsflash", &jsf_fops };
454 454
455static struct block_device_operations jsfd_fops = { 455static const struct block_device_operations jsfd_fops = {
456 .owner = THIS_MODULE, 456 .owner = THIS_MODULE,
457}; 457};
458 458
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index e6f2bb7365e6..8dfb59d58992 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -5223,7 +5223,7 @@ ahc_chip_init(struct ahc_softc *ahc)
5223 5223
5224 /* 5224 /*
5225 * Setup the allowed SCSI Sequences based on operational mode. 5225 * Setup the allowed SCSI Sequences based on operational mode.
5226 * If we are a target, we'll enalbe select in operations once 5226 * If we are a target, we'll enable select in operations once
5227 * we've had a lun enabled. 5227 * we've had a lun enabled.
5228 */ 5228 */
5229 scsiseq_template = ENSELO|ENAUTOATNO|ENAUTOATNP; 5229 scsiseq_template = ENSELO|ENAUTOATNO|ENAUTOATNP;
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 906cef5cda86..41e1b0e7e2ef 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1340,7 +1340,7 @@ static int bnx2i_process_login_resp(struct iscsi_session *session,
1340 resp_hdr->opcode = login->op_code; 1340 resp_hdr->opcode = login->op_code;
1341 resp_hdr->flags = login->response_flags; 1341 resp_hdr->flags = login->response_flags;
1342 resp_hdr->max_version = login->version_max; 1342 resp_hdr->max_version = login->version_max;
1343 resp_hdr->active_version = login->version_active;; 1343 resp_hdr->active_version = login->version_active;
1344 resp_hdr->hlength = 0; 1344 resp_hdr->hlength = 0;
1345 1345
1346 hton24(resp_hdr->dlength, login->data_length); 1346 hton24(resp_hdr->dlength, login->data_length);
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 9df7ed38e1be..9a1bd9534d74 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -1207,7 +1207,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
1207 vport->ct_flags &= ~FC_CT_RFF_ID; 1207 vport->ct_flags &= ~FC_CT_RFF_ID;
1208 CtReq->CommandResponse.bits.CmdRsp = 1208 CtReq->CommandResponse.bits.CmdRsp =
1209 be16_to_cpu(SLI_CTNS_RFF_ID); 1209 be16_to_cpu(SLI_CTNS_RFF_ID);
1210 CtReq->un.rff.PortId = cpu_to_be32(vport->fc_myDID);; 1210 CtReq->un.rff.PortId = cpu_to_be32(vport->fc_myDID);
1211 CtReq->un.rff.fbits = FC4_FEATURE_INIT; 1211 CtReq->un.rff.fbits = FC4_FEATURE_INIT;
1212 CtReq->un.rff.type_code = FC_FCP_DATA; 1212 CtReq->un.rff.type_code = FC_FCP_DATA;
1213 cmpl = lpfc_cmpl_ct_cmd_rff_id; 1213 cmpl = lpfc_cmpl_ct_cmd_rff_id;
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 7dc3d1894b1a..a39addc3a596 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -718,7 +718,7 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
718 * megasas_build_ldio - Prepares IOs to logical devices 718 * megasas_build_ldio - Prepares IOs to logical devices
719 * @instance: Adapter soft state 719 * @instance: Adapter soft state
720 * @scp: SCSI command 720 * @scp: SCSI command
721 * @cmd: Command to to be prepared 721 * @cmd: Command to be prepared
722 * 722 *
723 * Frames (and accompanying SGLs) for regular SCSI IOs use this function. 723 * Frames (and accompanying SGLs) for regular SCSI IOs use this function.
724 */ 724 */
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 40e3cafb3a9c..83c8b5e4fc8b 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1422,7 +1422,7 @@ static void qla4xxx_slave_destroy(struct scsi_device *sdev)
1422/** 1422/**
1423 * qla4xxx_del_from_active_array - returns an active srb 1423 * qla4xxx_del_from_active_array - returns an active srb
1424 * @ha: Pointer to host adapter structure. 1424 * @ha: Pointer to host adapter structure.
1425 * @index: index into to the active_array 1425 * @index: index into the active_array
1426 * 1426 *
1427 * This routine removes and returns the srb at the specified index 1427 * This routine removes and returns the srb at the specified index
1428 **/ 1428 **/
@@ -1500,7 +1500,7 @@ static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha)
1500 1500
1501/** 1501/**
1502 * qla4xxx_eh_wait_for_commands - wait for active cmds to finish. 1502 * qla4xxx_eh_wait_for_commands - wait for active cmds to finish.
1503 * @ha: pointer to to HBA 1503 * @ha: pointer to HBA
1504 * @t: target id 1504 * @t: target id
1505 * @l: lun id 1505 * @l: lun id
1506 * 1506 *
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a89c421dab51..8dd96dcd716c 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -956,7 +956,7 @@ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,
956} 956}
957#endif 957#endif
958 958
959static struct block_device_operations sd_fops = { 959static const struct block_device_operations sd_fops = {
960 .owner = THIS_MODULE, 960 .owner = THIS_MODULE,
961 .open = sd_open, 961 .open = sd_open,
962 .release = sd_release, 962 .release = sd_release,
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index cce0fe4c8a3b..eb61f7a70e1d 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -525,7 +525,7 @@ static int sr_block_media_changed(struct gendisk *disk)
525 return cdrom_media_changed(&cd->cdi); 525 return cdrom_media_changed(&cd->cdi);
526} 526}
527 527
528static struct block_device_operations sr_bdops = 528static const struct block_device_operations sr_bdops =
529{ 529{
530 .owner = THIS_MODULE, 530 .owner = THIS_MODULE,
531 .open = sr_block_open, 531 .open = sr_block_open,
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index 8980a5640bd9..e75ba9b28898 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -213,7 +213,7 @@ static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
213 unsigned bits = ust->bits_per_word; 213 unsigned bits = ust->bits_per_word;
214 unsigned bytes; 214 unsigned bytes;
215 u16 val, w; 215 u16 val, w;
216 int status = 0;; 216 int status = 0;
217 217
218 if (!t->tx_buf && !t->rx_buf) 218 if (!t->tx_buf && !t->rx_buf)
219 return 0; 219 return 0;
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 3f3119d760db..6ba8aece90b5 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -388,7 +388,7 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
388 388
389 err_no_iores: 389 err_no_iores:
390 err_no_pdata: 390 err_no_pdata:
391 spi_master_put(hw->master);; 391 spi_master_put(hw->master);
392 392
393 err_nomem: 393 err_nomem:
394 return err; 394 return err;
diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h
index 3f498f6f3ff6..90fd40f24734 100644
--- a/drivers/staging/rt2860/rtmp.h
+++ b/drivers/staging/rt2860/rtmp.h
@@ -2060,7 +2060,7 @@ typedef struct _STA_ADMIN_CONFIG {
2060 BOOLEAN AdhocBGJoined; // Indicate Adhoc B/G Join. 2060 BOOLEAN AdhocBGJoined; // Indicate Adhoc B/G Join.
2061 BOOLEAN Adhoc20NJoined; // Indicate Adhoc 20MHz N Join. 2061 BOOLEAN Adhoc20NJoined; // Indicate Adhoc 20MHz N Join.
2062#endif 2062#endif
2063 // New for WPA, windows want us to to keep association information and 2063 // New for WPA, windows want us to keep association information and
2064 // Fixed IEs from last association response 2064 // Fixed IEs from last association response
2065 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; 2065 NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
2066 USHORT ReqVarIELen; // Length of next VIE include EID & Length 2066 USHORT ReqVarIELen; // Length of next VIE include EID & Length
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index ba589d4ca8bc..8c64c018b676 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -506,8 +506,6 @@ static int wdm_open(struct inode *inode, struct file *file)
506 desc = usb_get_intfdata(intf); 506 desc = usb_get_intfdata(intf);
507 if (test_bit(WDM_DISCONNECTING, &desc->flags)) 507 if (test_bit(WDM_DISCONNECTING, &desc->flags))
508 goto out; 508 goto out;
509
510 ;
511 file->private_data = desc; 509 file->private_data = desc;
512 510
513 rv = usb_autopm_get_interface(desc->intf); 511 rv = usb_autopm_get_interface(desc->intf);
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index ffe75e83787c..97b40ce133f0 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -48,7 +48,6 @@
48#define USBFS_DEFAULT_BUSMODE (S_IXUGO | S_IRUGO) 48#define USBFS_DEFAULT_BUSMODE (S_IXUGO | S_IRUGO)
49#define USBFS_DEFAULT_LISTMODE S_IRUGO 49#define USBFS_DEFAULT_LISTMODE S_IRUGO
50 50
51static struct super_operations usbfs_ops;
52static const struct file_operations default_file_operations; 51static const struct file_operations default_file_operations;
53static struct vfsmount *usbfs_mount; 52static struct vfsmount *usbfs_mount;
54static int usbfs_mount_count; /* = 0 */ 53static int usbfs_mount_count; /* = 0 */
@@ -449,7 +448,7 @@ static const struct file_operations default_file_operations = {
449 .llseek = default_file_lseek, 448 .llseek = default_file_lseek,
450}; 449};
451 450
452static struct super_operations usbfs_ops = { 451static const struct super_operations usbfs_ops = {
453 .statfs = simple_statfs, 452 .statfs = simple_statfs,
454 .drop_inode = generic_delete_inode, 453 .drop_inode = generic_delete_inode,
455 .remount_fs = remount, 454 .remount_fs = remount,
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 7d33f50b5874..c44367fea185 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -2033,7 +2033,7 @@ gadgetfs_create_file (struct super_block *sb, char const *name,
2033 return inode; 2033 return inode;
2034} 2034}
2035 2035
2036static struct super_operations gadget_fs_operations = { 2036static const struct super_operations gadget_fs_operations = {
2037 .statfs = simple_statfs, 2037 .statfs = simple_statfs,
2038 .drop_inode = generic_delete_inode, 2038 .drop_inode = generic_delete_inode,
2039}; 2039};
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index c2f1b7df918c..b5b83c43898a 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -242,7 +242,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
242 * System suspend currently expects to be able to suspend the entire 242 * System suspend currently expects to be able to suspend the entire
243 * device tree, device-at-a-time. If we failed selective suspend 243 * device tree, device-at-a-time. If we failed selective suspend
244 * reports, system suspend would fail; so the root hub code must claim 244 * reports, system suspend would fail; so the root hub code must claim
245 * success. That's lying to usbcore, and it matters for for runtime 245 * success. That's lying to usbcore, and it matters for runtime
246 * PM scenarios with selective suspend and remote wakeup... 246 * PM scenarios with selective suspend and remote wakeup...
247 */ 247 */
248 if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev)) 248 if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev))
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 2bfff30f4704..48b9e889a18b 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -37,7 +37,7 @@ typedef __u16 __bitwise __hc16;
37#define __hc16 __le16 37#define __hc16 __le16
38#endif 38#endif
39 39
40/* statistics can be kept for for tuning/monitoring */ 40/* statistics can be kept for tuning/monitoring */
41struct ehci_stats { 41struct ehci_stats {
42 /* irq usage */ 42 /* irq usage */
43 unsigned long normal; 43 unsigned long normal;
diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
index c2d80f80448b..16fecb8ecc39 100644
--- a/drivers/usb/host/ohci-q.c
+++ b/drivers/usb/host/ohci-q.c
@@ -418,7 +418,7 @@ static struct ed *ed_get (
418 is_out = !(ep->desc.bEndpointAddress & USB_DIR_IN); 418 is_out = !(ep->desc.bEndpointAddress & USB_DIR_IN);
419 419
420 /* FIXME usbcore changes dev->devnum before SET_ADDRESS 420 /* FIXME usbcore changes dev->devnum before SET_ADDRESS
421 * suceeds ... otherwise we wouldn't need "pipe". 421 * succeeds ... otherwise we wouldn't need "pipe".
422 */ 422 */
423 info = usb_pipedevice (pipe); 423 info = usb_pipedevice (pipe);
424 ed->type = usb_pipetype(pipe); 424 ed->type = usb_pipetype(pipe);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index d31d32206ba3..ffe1625d4e1b 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1150,7 +1150,7 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci);
1150void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring); 1150void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring);
1151void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int last_ep); 1151void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int last_ep);
1152 1152
1153/* xHCI memory managment */ 1153/* xHCI memory management */
1154void xhci_mem_cleanup(struct xhci_hcd *xhci); 1154void xhci_mem_cleanup(struct xhci_hcd *xhci);
1155int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags); 1155int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags);
1156void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); 1156void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id);
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h
index e772b01ac3ac..1fd360e04065 100644
--- a/drivers/usb/serial/cypress_m8.h
+++ b/drivers/usb/serial/cypress_m8.h
@@ -57,7 +57,7 @@
57#define UART_RI 0x10 /* ring indicator - modem - device to host */ 57#define UART_RI 0x10 /* ring indicator - modem - device to host */
58#define UART_CD 0x40 /* carrier detect - modem - device to host */ 58#define UART_CD 0x40 /* carrier detect - modem - device to host */
59#define CYP_ERROR 0x08 /* received from input report - device to host */ 59#define CYP_ERROR 0x08 /* received from input report - device to host */
60/* Note - the below has nothing to to with the "feature report" reset */ 60/* Note - the below has nothing to do with the "feature report" reset */
61#define CONTROL_RESET 0x08 /* sent with output report - host to device */ 61#define CONTROL_RESET 0x08 /* sent with output report - host to device */
62 62
63/* End of RS-232 protocol definitions */ 63/* End of RS-232 protocol definitions */
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index dc0f832657e6..b97960ac92f2 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2540,7 +2540,7 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor)
2540 2540
2541/***************************************************************************** 2541/*****************************************************************************
2542 * send_cmd_write_uart_register 2542 * send_cmd_write_uart_register
2543 * this function builds up a uart register message and sends to to the device. 2543 * this function builds up a uart register message and sends to the device.
2544 *****************************************************************************/ 2544 *****************************************************************************/
2545static int send_cmd_write_uart_register(struct edgeport_port *edge_port, 2545static int send_cmd_write_uart_register(struct edgeport_port *edge_port,
2546 __u8 regNum, __u8 regValue) 2546 __u8 regNum, __u8 regValue)
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index a61673133d7d..f7373371b137 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -38,7 +38,7 @@
38 * 0.3a - implemented pools of write URBs 38 * 0.3a - implemented pools of write URBs
39 * 0.3 - alpha version for public testing 39 * 0.3 - alpha version for public testing
40 * 0.2 - TIOCMGET works, so autopilot(1) can be used! 40 * 0.2 - TIOCMGET works, so autopilot(1) can be used!
41 * 0.1 - can be used to to pilot-xfer -p /dev/ttyUSB0 -l 41 * 0.1 - can be used to do pilot-xfer -p /dev/ttyUSB0 -l
42 * 42 *
43 * The driver skeleton is mainly based on mct_u232.c and various other 43 * The driver skeleton is mainly based on mct_u232.c and various other
44 * pieces of code shamelessly copied from the drivers/usb/serial/ directory. 44 * pieces of code shamelessly copied from the drivers/usb/serial/ directory.
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 61e7c40b94fb..1e58220403d1 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -544,7 +544,7 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
544 } 544 }
545 545
546 /* Set Baud Rate */ 546 /* Set Baud Rate */
547 baud = tty_get_baud_rate(tty);; 547 baud = tty_get_baud_rate(tty);
548 switch (baud) { 548 switch (baud) {
549 case 300: buf[0] = 0x00; break; 549 case 300: buf[0] = 0x00; break;
550 case 600: buf[0] = 0x01; break; 550 case 600: buf[0] = 0x01; break;
diff --git a/drivers/usb/wusbcore/wa-hc.h b/drivers/usb/wusbcore/wa-hc.h
index 586d350cdb4d..d6bea3e0b54a 100644
--- a/drivers/usb/wusbcore/wa-hc.h
+++ b/drivers/usb/wusbcore/wa-hc.h
@@ -47,7 +47,7 @@
47 * to an endpoint on a WUSB device that is connected to a 47 * to an endpoint on a WUSB device that is connected to a
48 * HWA RC. 48 * HWA RC.
49 * 49 *
50 * xfer Transfer managment -- this is all the code that gets a 50 * xfer Transfer management -- this is all the code that gets a
51 * buffer and pushes it to a device (or viceversa). * 51 * buffer and pushes it to a device (or viceversa). *
52 * 52 *
53 * Some day a lot of this code will be shared between this driver and 53 * Some day a lot of this code will be shared between this driver and
diff --git a/drivers/uwb/i1480/i1480u-wlp/netdev.c b/drivers/uwb/i1480/i1480u-wlp/netdev.c
index 73055530e60f..b236e6969942 100644
--- a/drivers/uwb/i1480/i1480u-wlp/netdev.c
+++ b/drivers/uwb/i1480/i1480u-wlp/netdev.c
@@ -214,7 +214,7 @@ int i1480u_open(struct net_device *net_dev)
214 214
215 netif_wake_queue(net_dev); 215 netif_wake_queue(net_dev);
216#ifdef i1480u_FLOW_CONTROL 216#ifdef i1480u_FLOW_CONTROL
217 result = usb_submit_urb(i1480u->notif_urb, GFP_KERNEL);; 217 result = usb_submit_urb(i1480u->notif_urb, GFP_KERNEL);
218 if (result < 0) { 218 if (result < 0) {
219 dev_err(dev, "Can't submit notification URB: %d\n", result); 219 dev_err(dev, "Can't submit notification URB: %d\n", result);
220 goto error_notif_urb_submit; 220 goto error_notif_urb_submit;
diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c
index df03f3776dcc..79e5f40e6486 100644
--- a/drivers/video/cfbcopyarea.c
+++ b/drivers/video/cfbcopyarea.c
@@ -114,7 +114,7 @@ bitcpy(struct fb_info *p, unsigned long __iomem *dst, int dst_idx,
114 d0 >>= right; 114 d0 >>= right;
115 } else if (src_idx+n <= bits) { 115 } else if (src_idx+n <= bits) {
116 // Single source word 116 // Single source word
117 d0 <<= left;; 117 d0 <<= left;
118 } else { 118 } else {
119 // 2 source words 119 // 2 source words
120 d1 = FB_READL(src + 1); 120 d1 = FB_READL(src + 1);
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 30ae3022f633..66358fa825f3 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -710,7 +710,7 @@ static int __init imxfb_probe(struct platform_device *pdev)
710 710
711 fbi->clk = clk_get(&pdev->dev, NULL); 711 fbi->clk = clk_get(&pdev->dev, NULL);
712 if (IS_ERR(fbi->clk)) { 712 if (IS_ERR(fbi->clk)) {
713 ret = PTR_ERR(fbi->clk);; 713 ret = PTR_ERR(fbi->clk);
714 dev_err(&pdev->dev, "unable to get clock: %d\n", ret); 714 dev_err(&pdev->dev, "unable to get clock: %d\n", ret);
715 goto failed_getclock; 715 goto failed_getclock;
716 } 716 }
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
index 2486237ebba5..417ae5efa8bb 100644
--- a/drivers/video/omap/lcd_h3.c
+++ b/drivers/video/omap/lcd_h3.c
@@ -124,12 +124,12 @@ struct platform_driver h3_panel_driver = {
124 }, 124 },
125}; 125};
126 126
127static int h3_panel_drv_init(void) 127static int __init h3_panel_drv_init(void)
128{ 128{
129 return platform_driver_register(&h3_panel_driver); 129 return platform_driver_register(&h3_panel_driver);
130} 130}
131 131
132static void h3_panel_drv_cleanup(void) 132static void __exit h3_panel_drv_cleanup(void)
133{ 133{
134 platform_driver_unregister(&h3_panel_driver); 134 platform_driver_unregister(&h3_panel_driver);
135} 135}
diff --git a/drivers/video/omap/lcd_h4.c b/drivers/video/omap/lcd_h4.c
index 6ff56430341b..0c398bda7601 100644
--- a/drivers/video/omap/lcd_h4.c
+++ b/drivers/video/omap/lcd_h4.c
@@ -102,12 +102,12 @@ static struct platform_driver h4_panel_driver = {
102 }, 102 },
103}; 103};
104 104
105static int h4_panel_drv_init(void) 105static int __init h4_panel_drv_init(void)
106{ 106{
107 return platform_driver_register(&h4_panel_driver); 107 return platform_driver_register(&h4_panel_driver);
108} 108}
109 109
110static void h4_panel_drv_cleanup(void) 110static void __exit h4_panel_drv_cleanup(void)
111{ 111{
112 platform_driver_unregister(&h4_panel_driver); 112 platform_driver_unregister(&h4_panel_driver);
113} 113}
diff --git a/drivers/video/omap/lcd_inn1510.c b/drivers/video/omap/lcd_inn1510.c
index 6953ed4b5820..cdbd8bb607be 100644
--- a/drivers/video/omap/lcd_inn1510.c
+++ b/drivers/video/omap/lcd_inn1510.c
@@ -109,12 +109,12 @@ struct platform_driver innovator1510_panel_driver = {
109 }, 109 },
110}; 110};
111 111
112static int innovator1510_panel_drv_init(void) 112static int __init innovator1510_panel_drv_init(void)
113{ 113{
114 return platform_driver_register(&innovator1510_panel_driver); 114 return platform_driver_register(&innovator1510_panel_driver);
115} 115}
116 116
117static void innovator1510_panel_drv_cleanup(void) 117static void __exit innovator1510_panel_drv_cleanup(void)
118{ 118{
119 platform_driver_unregister(&innovator1510_panel_driver); 119 platform_driver_unregister(&innovator1510_panel_driver);
120} 120}
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
index 4c4f7ee6d733..268f7f808a4e 100644
--- a/drivers/video/omap/lcd_inn1610.c
+++ b/drivers/video/omap/lcd_inn1610.c
@@ -133,12 +133,12 @@ struct platform_driver innovator1610_panel_driver = {
133 }, 133 },
134}; 134};
135 135
136static int innovator1610_panel_drv_init(void) 136static int __init innovator1610_panel_drv_init(void)
137{ 137{
138 return platform_driver_register(&innovator1610_panel_driver); 138 return platform_driver_register(&innovator1610_panel_driver);
139} 139}
140 140
141static void innovator1610_panel_drv_cleanup(void) 141static void __exit innovator1610_panel_drv_cleanup(void)
142{ 142{
143 platform_driver_unregister(&innovator1610_panel_driver); 143 platform_driver_unregister(&innovator1610_panel_driver);
144} 144}
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
index 379c96d36da5..b3fa88bc6269 100644
--- a/drivers/video/omap/lcd_osk.c
+++ b/drivers/video/omap/lcd_osk.c
@@ -127,12 +127,12 @@ struct platform_driver osk_panel_driver = {
127 }, 127 },
128}; 128};
129 129
130static int osk_panel_drv_init(void) 130static int __init osk_panel_drv_init(void)
131{ 131{
132 return platform_driver_register(&osk_panel_driver); 132 return platform_driver_register(&osk_panel_driver);
133} 133}
134 134
135static void osk_panel_drv_cleanup(void) 135static void __exit osk_panel_drv_cleanup(void)
136{ 136{
137 platform_driver_unregister(&osk_panel_driver); 137 platform_driver_unregister(&osk_panel_driver);
138} 138}
diff --git a/drivers/video/omap/lcd_palmte.c b/drivers/video/omap/lcd_palmte.c
index 218317366e6e..4bf3c79f3cc7 100644
--- a/drivers/video/omap/lcd_palmte.c
+++ b/drivers/video/omap/lcd_palmte.c
@@ -108,12 +108,12 @@ struct platform_driver palmte_panel_driver = {
108 }, 108 },
109}; 109};
110 110
111static int palmte_panel_drv_init(void) 111static int __init palmte_panel_drv_init(void)
112{ 112{
113 return platform_driver_register(&palmte_panel_driver); 113 return platform_driver_register(&palmte_panel_driver);
114} 114}
115 115
116static void palmte_panel_drv_cleanup(void) 116static void __exit palmte_panel_drv_cleanup(void)
117{ 117{
118 platform_driver_unregister(&palmte_panel_driver); 118 platform_driver_unregister(&palmte_panel_driver);
119} 119}
diff --git a/drivers/video/omap/lcd_palmtt.c b/drivers/video/omap/lcd_palmtt.c
index 57b0f6cf6a5a..48ea1f9f2cbf 100644
--- a/drivers/video/omap/lcd_palmtt.c
+++ b/drivers/video/omap/lcd_palmtt.c
@@ -113,12 +113,12 @@ struct platform_driver palmtt_panel_driver = {
113 }, 113 },
114}; 114};
115 115
116static int palmtt_panel_drv_init(void) 116static int __init palmtt_panel_drv_init(void)
117{ 117{
118 return platform_driver_register(&palmtt_panel_driver); 118 return platform_driver_register(&palmtt_panel_driver);
119} 119}
120 120
121static void palmtt_panel_drv_cleanup(void) 121static void __exit palmtt_panel_drv_cleanup(void)
122{ 122{
123 platform_driver_unregister(&palmtt_panel_driver); 123 platform_driver_unregister(&palmtt_panel_driver);
124} 124}
diff --git a/drivers/video/omap/lcd_palmz71.c b/drivers/video/omap/lcd_palmz71.c
index d33d78b11723..0697d29b4d3b 100644
--- a/drivers/video/omap/lcd_palmz71.c
+++ b/drivers/video/omap/lcd_palmz71.c
@@ -109,12 +109,12 @@ struct platform_driver palmz71_panel_driver = {
109 }, 109 },
110}; 110};
111 111
112static int palmz71_panel_drv_init(void) 112static int __init palmz71_panel_drv_init(void)
113{ 113{
114 return platform_driver_register(&palmz71_panel_driver); 114 return platform_driver_register(&palmz71_panel_driver);
115} 115}
116 116
117static void palmz71_panel_drv_cleanup(void) 117static void __exit palmz71_panel_drv_cleanup(void)
118{ 118{
119 platform_driver_unregister(&palmz71_panel_driver); 119 platform_driver_unregister(&palmz71_panel_driver);
120} 120}
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 7da0027e2409..5ffca2adc6a8 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -1119,7 +1119,7 @@ int __init s3c2410fb_init(void)
1119 int ret = platform_driver_register(&s3c2410fb_driver); 1119 int ret = platform_driver_register(&s3c2410fb_driver);
1120 1120
1121 if (ret == 0) 1121 if (ret == 0)
1122 ret = platform_driver_register(&s3c2412fb_driver);; 1122 ret = platform_driver_register(&s3c2412fb_driver);
1123 1123
1124 return ret; 1124 return ret;
1125} 1125}
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index f5bbd9e83416..d31505b6f7a4 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -96,11 +96,7 @@ static struct balloon_stats balloon_stats;
96/* We increase/decrease in batches which fit in a page */ 96/* We increase/decrease in batches which fit in a page */
97static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)]; 97static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)];
98 98
99/* VM /proc information for memory */
100extern unsigned long totalram_pages;
101
102#ifdef CONFIG_HIGHMEM 99#ifdef CONFIG_HIGHMEM
103extern unsigned long totalhigh_pages;
104#define inc_totalhigh_pages() (totalhigh_pages++) 100#define inc_totalhigh_pages() (totalhigh_pages++)
105#define dec_totalhigh_pages() (totalhigh_pages--) 101#define dec_totalhigh_pages() (totalhigh_pages--)
106#else 102#else
@@ -214,7 +210,7 @@ static int increase_reservation(unsigned long nr_pages)
214 page = balloon_first_page(); 210 page = balloon_first_page();
215 for (i = 0; i < nr_pages; i++) { 211 for (i = 0; i < nr_pages; i++) {
216 BUG_ON(page == NULL); 212 BUG_ON(page == NULL);
217 frame_list[i] = page_to_pfn(page);; 213 frame_list[i] = page_to_pfn(page);
218 page = balloon_next_page(page); 214 page = balloon_next_page(page);
219 } 215 }
220 216