aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-07-30 01:55:32 -0400
committerLen Brown <len.brown@intel.com>2005-07-30 01:55:32 -0400
commitadbedd34244e2b054557002817f979a9b004a405 (patch)
tree78e4a524e84f8b3e23ae8b49ac689048584e4668 /drivers
parentd6ac1a7910d22626bc77e73db091e00b810715f4 (diff)
parentb0825488a642cadcf39709961dde61440cb0731c (diff)
merge 2.6.13-rc4 with ACPI's to-linus tree
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/cciss.c49
-rw-r--r--drivers/block/cciss.h4
-rw-r--r--drivers/char/agp/agp.h1
-rw-r--r--drivers/char/agp/intel-agp.c12
-rw-r--r--drivers/char/keyboard.c4
-rw-r--r--drivers/char/sonypi.c146
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/firmware/pcdp.c14
-rw-r--r--drivers/hwmon/adm1026.c2
-rw-r--r--drivers/hwmon/atxp1.c5
-rw-r--r--drivers/hwmon/fscpos.c4
-rw-r--r--drivers/hwmon/gl520sm.c4
-rw-r--r--drivers/hwmon/max1619.c2
-rw-r--r--drivers/hwmon/pc87360.c2
-rw-r--r--drivers/i2c/busses/i2c-i801.c6
-rw-r--r--drivers/i2c/busses/i2c-mpc.c94
-rw-r--r--drivers/i2c/chips/ds1337.c6
-rw-r--r--drivers/i2c/chips/eeprom.c8
-rw-r--r--drivers/i2c/chips/max6875.c8
-rw-r--r--drivers/i2c/i2c-core.c8
-rw-r--r--drivers/ide/legacy/ide-cs.c3
-rw-r--r--drivers/input/evdev.c1
-rw-r--r--drivers/input/input.c389
-rw-r--r--drivers/input/joydev.c6
-rw-r--r--drivers/input/misc/uinput.c181
-rw-r--r--drivers/input/mouse/alps.c29
-rw-r--r--drivers/input/mouse/logips2pp.c2
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mouse/synaptics.c14
-rw-r--r--drivers/input/serio/Kconfig2
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h14
-rw-r--r--drivers/input/serio/i8042.c60
-rw-r--r--drivers/input/serio/serio.c42
-rw-r--r--drivers/input/serio/serio_raw.c1
-rw-r--r--drivers/input/touchscreen/Kconfig2
-rw-r--r--drivers/md/dm-table.c6
-rw-r--r--drivers/md/dm.c196
-rw-r--r--drivers/net/cs89x0.c1
-rw-r--r--drivers/net/e1000/e1000_main.c29
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c7
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c8
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/wireless/orinoco_cs.c2
-rw-r--r--drivers/pci/probe.c2
-rw-r--r--drivers/pci/quirks.c5
-rw-r--r--drivers/pci/rom.c4
-rw-r--r--drivers/pci/setup-bus.c12
-rw-r--r--drivers/pcmcia/au1000_generic.c1
-rw-r--r--drivers/pcmcia/cistpl.c51
-rw-r--r--drivers/pcmcia/ds.c4
-rw-r--r--drivers/pcmcia/o2micro.h34
-rw-r--r--drivers/pcmcia/pcmcia_resource.c2
-rw-r--r--drivers/s390/cio/device_fsm.c3
-rw-r--r--drivers/scsi/ata_piix.c19
-rw-r--r--drivers/serial/8250_pnp.c22
-rw-r--r--drivers/serial/serial_cs.c10
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/core/devio.c18
-rw-r--r--drivers/usb/core/hcd.c4
-rw-r--r--drivers/usb/core/hcd.h8
-rw-r--r--drivers/usb/core/message.c6
-rw-r--r--drivers/usb/host/ehci-q.c4
-rw-r--r--drivers/usb/host/ohci-hcd.c5
-rw-r--r--drivers/usb/host/ohci-s3c2410.c496
-rw-r--r--drivers/usb/input/acecad.c14
-rw-r--r--drivers/usb/input/aiptek.c6
-rw-r--r--drivers/usb/input/ati_remote.c8
-rw-r--r--drivers/usb/input/hid-core.c24
-rw-r--r--drivers/usb/input/hid-input.c11
-rw-r--r--drivers/usb/input/itmtouch.c6
-rw-r--r--drivers/usb/input/kbtab.c6
-rw-r--r--drivers/usb/input/mtouchusb.c6
-rw-r--r--drivers/usb/input/powermate.c6
-rw-r--r--drivers/usb/input/touchkitusb.c7
-rw-r--r--drivers/usb/input/usbkbd.c6
-rw-r--r--drivers/usb/input/usbmouse.c6
-rw-r--r--drivers/usb/input/wacom.c6
-rw-r--r--drivers/usb/input/xpad.c6
-rw-r--r--drivers/usb/media/konicawc.c6
-rw-r--r--drivers/usb/misc/ldusb.c7
-rw-r--r--drivers/usb/net/pegasus.c1
-rw-r--r--drivers/usb/net/rtl8150.c2
-rw-r--r--drivers/usb/net/zd1201.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c146
-rw-r--r--drivers/usb/serial/ftdi_sio.h14
-rw-r--r--drivers/usb/usb-skeleton.c6
-rw-r--r--drivers/video/fbmem.c6
-rw-r--r--drivers/video/fbsysfs.c14
-rw-r--r--drivers/video/vesafb.c47
-rw-r--r--drivers/w1/Kconfig2
92 files changed, 1543 insertions, 925 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 3e9fb6e4a52..418b1469d75 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1135,7 +1135,7 @@ static int revalidate_allvol(ctlr_info_t *host)
1135 /* this is for the online array utilities */ 1135 /* this is for the online array utilities */
1136 if (!drv->heads && i) 1136 if (!drv->heads && i)
1137 continue; 1137 continue;
1138 blk_queue_hardsect_size(host->queue, drv->block_size); 1138 blk_queue_hardsect_size(drv->queue, drv->block_size);
1139 set_capacity(disk, drv->nr_blocks); 1139 set_capacity(disk, drv->nr_blocks);
1140 add_disk(disk); 1140 add_disk(disk);
1141 } 1141 }
@@ -1691,7 +1691,7 @@ static int cciss_revalidate(struct gendisk *disk)
1691 cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size); 1691 cciss_read_capacity(h->ctlr, logvol, size_buff, 1, &total_size, &block_size);
1692 cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv); 1692 cciss_geometry_inquiry(h->ctlr, logvol, 1, total_size, block_size, inq_buff, drv);
1693 1693
1694 blk_queue_hardsect_size(h->queue, drv->block_size); 1694 blk_queue_hardsect_size(drv->queue, drv->block_size);
1695 set_capacity(disk, drv->nr_blocks); 1695 set_capacity(disk, drv->nr_blocks);
1696 1696
1697 kfree(size_buff); 1697 kfree(size_buff);
@@ -2248,12 +2248,12 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2248 * them up. We will also keep track of the next queue to run so 2248 * them up. We will also keep track of the next queue to run so
2249 * that every queue gets a chance to be started first. 2249 * that every queue gets a chance to be started first.
2250 */ 2250 */
2251 for (j=0; j < NWD; j++){ 2251 for (j=0; j < h->highest_lun + 1; j++){
2252 int curr_queue = (start_queue + j) % NWD; 2252 int curr_queue = (start_queue + j) % (h->highest_lun + 1);
2253 /* make sure the disk has been added and the drive is real 2253 /* make sure the disk has been added and the drive is real
2254 * because this can be called from the middle of init_one. 2254 * because this can be called from the middle of init_one.
2255 */ 2255 */
2256 if(!(h->gendisk[curr_queue]->queue) || 2256 if(!(h->drv[curr_queue].queue) ||
2257 !(h->drv[curr_queue].heads)) 2257 !(h->drv[curr_queue].heads))
2258 continue; 2258 continue;
2259 blk_start_queue(h->gendisk[curr_queue]->queue); 2259 blk_start_queue(h->gendisk[curr_queue]->queue);
@@ -2264,14 +2264,14 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs)
2264 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) 2264 if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS)
2265 { 2265 {
2266 if (curr_queue == start_queue){ 2266 if (curr_queue == start_queue){
2267 h->next_to_run = (start_queue + 1) % NWD; 2267 h->next_to_run = (start_queue + 1) % (h->highest_lun + 1);
2268 goto cleanup; 2268 goto cleanup;
2269 } else { 2269 } else {
2270 h->next_to_run = curr_queue; 2270 h->next_to_run = curr_queue;
2271 goto cleanup; 2271 goto cleanup;
2272 } 2272 }
2273 } else { 2273 } else {
2274 curr_queue = (curr_queue + 1) % NWD; 2274 curr_queue = (curr_queue + 1) % (h->highest_lun + 1);
2275 } 2275 }
2276 } 2276 }
2277 2277
@@ -2279,7 +2279,6 @@ cleanup:
2279 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags); 2279 spin_unlock_irqrestore(CCISS_LOCK(h->ctlr), flags);
2280 return IRQ_HANDLED; 2280 return IRQ_HANDLED;
2281} 2281}
2282
2283/* 2282/*
2284 * We cannot read the structure directly, for portablity we must use 2283 * We cannot read the structure directly, for portablity we must use
2285 * the io functions. 2284 * the io functions.
@@ -2789,13 +2788,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2789 } 2788 }
2790 2789
2791 spin_lock_init(&hba[i]->lock); 2790 spin_lock_init(&hba[i]->lock);
2792 q = blk_init_queue(do_cciss_request, &hba[i]->lock);
2793 if (!q)
2794 goto clean4;
2795
2796 q->backing_dev_info.ra_pages = READ_AHEAD;
2797 hba[i]->queue = q;
2798 q->queuedata = hba[i];
2799 2791
2800 /* Initialize the pdev driver private data. 2792 /* Initialize the pdev driver private data.
2801 have it point to hba[i]. */ 2793 have it point to hba[i]. */
@@ -2817,6 +2809,20 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2817 2809
2818 cciss_procinit(i); 2810 cciss_procinit(i);
2819 2811
2812 for(j=0; j < NWD; j++) { /* mfm */
2813 drive_info_struct *drv = &(hba[i]->drv[j]);
2814 struct gendisk *disk = hba[i]->gendisk[j];
2815
2816 q = blk_init_queue(do_cciss_request, &hba[i]->lock);
2817 if (!q) {
2818 printk(KERN_ERR
2819 "cciss: unable to allocate queue for disk %d\n",
2820 j);
2821 break;
2822 }
2823 drv->queue = q;
2824
2825 q->backing_dev_info.ra_pages = READ_AHEAD;
2820 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask); 2826 blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
2821 2827
2822 /* This is a hardware imposed limit. */ 2828 /* This is a hardware imposed limit. */
@@ -2827,26 +2833,23 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
2827 2833
2828 blk_queue_max_sectors(q, 512); 2834 blk_queue_max_sectors(q, 512);
2829 2835
2830 2836 q->queuedata = hba[i];
2831 for(j=0; j<NWD; j++) {
2832 drive_info_struct *drv = &(hba[i]->drv[j]);
2833 struct gendisk *disk = hba[i]->gendisk[j];
2834
2835 sprintf(disk->disk_name, "cciss/c%dd%d", i, j); 2837 sprintf(disk->disk_name, "cciss/c%dd%d", i, j);
2836 sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j); 2838 sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j);
2837 disk->major = hba[i]->major; 2839 disk->major = hba[i]->major;
2838 disk->first_minor = j << NWD_SHIFT; 2840 disk->first_minor = j << NWD_SHIFT;
2839 disk->fops = &cciss_fops; 2841 disk->fops = &cciss_fops;
2840 disk->queue = hba[i]->queue; 2842 disk->queue = q;
2841 disk->private_data = drv; 2843 disk->private_data = drv;
2842 /* we must register the controller even if no disks exist */ 2844 /* we must register the controller even if no disks exist */
2843 /* this is for the online array utilities */ 2845 /* this is for the online array utilities */
2844 if(!drv->heads && j) 2846 if(!drv->heads && j)
2845 continue; 2847 continue;
2846 blk_queue_hardsect_size(hba[i]->queue, drv->block_size); 2848 blk_queue_hardsect_size(q, drv->block_size);
2847 set_capacity(disk, drv->nr_blocks); 2849 set_capacity(disk, drv->nr_blocks);
2848 add_disk(disk); 2850 add_disk(disk);
2849 } 2851 }
2852
2850 return(1); 2853 return(1);
2851 2854
2852clean4: 2855clean4:
@@ -2912,10 +2915,10 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev)
2912 for (j = 0; j < NWD; j++) { 2915 for (j = 0; j < NWD; j++) {
2913 struct gendisk *disk = hba[i]->gendisk[j]; 2916 struct gendisk *disk = hba[i]->gendisk[j];
2914 if (disk->flags & GENHD_FL_UP) 2917 if (disk->flags & GENHD_FL_UP)
2918 blk_cleanup_queue(disk->queue);
2915 del_gendisk(disk); 2919 del_gendisk(disk);
2916 } 2920 }
2917 2921
2918 blk_cleanup_queue(hba[i]->queue);
2919 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), 2922 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct),
2920 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); 2923 hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle);
2921 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct), 2924 pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof( ErrorInfo_struct),
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h
index 8fb19206edd..566587d0a50 100644
--- a/drivers/block/cciss.h
+++ b/drivers/block/cciss.h
@@ -29,6 +29,7 @@ typedef struct _drive_info_struct
29{ 29{
30 __u32 LunID; 30 __u32 LunID;
31 int usage_count; 31 int usage_count;
32 struct request_queue *queue;
32 sector_t nr_blocks; 33 sector_t nr_blocks;
33 int block_size; 34 int block_size;
34 int heads; 35 int heads;
@@ -72,7 +73,6 @@ struct ctlr_info
72 unsigned int maxQsinceinit; 73 unsigned int maxQsinceinit;
73 unsigned int maxSG; 74 unsigned int maxSG;
74 spinlock_t lock; 75 spinlock_t lock;
75 struct request_queue *queue;
76 76
77 //* pointers to command and error info pool */ 77 //* pointers to command and error info pool */
78 CommandList_struct *cmd_pool; 78 CommandList_struct *cmd_pool;
@@ -260,7 +260,7 @@ struct board_type {
260 struct access_method *access; 260 struct access_method *access;
261}; 261};
262 262
263#define CCISS_LOCK(i) (hba[i]->queue->queue_lock) 263#define CCISS_LOCK(i) (&hba[i]->lock)
264 264
265#endif /* CCISS_H */ 265#endif /* CCISS_H */
266 266
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index c1fe013c64f..b4af87c6f9c 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -143,6 +143,7 @@ struct agp_bridge_data {
143 char major_version; 143 char major_version;
144 char minor_version; 144 char minor_version;
145 struct list_head list; 145 struct list_head list;
146 u32 apbase_config;
146}; 147};
147 148
148#define KB(x) ((x) * 1024) 149#define KB(x) ((x) * 1024)
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 51266d6b4d7..1f7d415f432 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1047,9 +1047,15 @@ static int intel_845_configure(void)
1047 /* aperture size */ 1047 /* aperture size */
1048 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 1048 pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
1049 1049
1050 /* address to map to */ 1050 if (agp_bridge->apbase_config != 0) {
1051 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); 1051 pci_write_config_dword(agp_bridge->dev, AGP_APBASE,
1052 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 1052 agp_bridge->apbase_config);
1053 } else {
1054 /* address to map to */
1055 pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
1056 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
1057 agp_bridge->apbase_config = temp;
1058 }
1053 1059
1054 /* attbase - aperture base */ 1060 /* attbase - aperture base */
1055 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 1061 pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 7b19e02f112..523fd3c8bba 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -198,10 +198,10 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
198 198
199 if (scancode >= dev->keycodemax) 199 if (scancode >= dev->keycodemax)
200 return -EINVAL; 200 return -EINVAL;
201 if (keycode > KEY_MAX)
202 return -EINVAL;
203 if (keycode < 0 || keycode > KEY_MAX) 201 if (keycode < 0 || keycode > KEY_MAX)
204 return -EINVAL; 202 return -EINVAL;
203 if (keycode >> (dev->keycodesize * 8))
204 return -EINVAL;
205 205
206 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); 206 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);
207 207
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index fd042060809..cefbe985e55 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -439,6 +439,11 @@ static struct {
439 { 0, 0 }, 439 { 0, 0 },
440}; 440};
441 441
442struct sonypi_keypress {
443 struct input_dev *dev;
444 int key;
445};
446
442static struct sonypi_device { 447static struct sonypi_device {
443 struct pci_dev *dev; 448 struct pci_dev *dev;
444 struct platform_device *pdev; 449 struct platform_device *pdev;
@@ -710,22 +715,61 @@ static void sonypi_setbluetoothpower(u8 state)
710 715
711static void input_keyrelease(void *data) 716static void input_keyrelease(void *data)
712{ 717{
713 struct input_dev *input_dev; 718 struct sonypi_keypress kp;
714 int key;
715
716 while (1) {
717 if (kfifo_get(sonypi_device.input_fifo,
718 (unsigned char *)&input_dev,
719 sizeof(input_dev)) != sizeof(input_dev))
720 return;
721 if (kfifo_get(sonypi_device.input_fifo,
722 (unsigned char *)&key,
723 sizeof(key)) != sizeof(key))
724 return;
725 719
720 while (kfifo_get(sonypi_device.input_fifo, (unsigned char *)&kp,
721 sizeof(kp)) == sizeof(kp)) {
726 msleep(10); 722 msleep(10);
727 input_report_key(input_dev, key, 0); 723 input_report_key(kp.dev, kp.key, 0);
728 input_sync(input_dev); 724 input_sync(kp.dev);
725 }
726}
727
728static void sonypi_report_input_event(u8 event)
729{
730 struct input_dev *jog_dev = &sonypi_device.input_jog_dev;
731 struct input_dev *key_dev = &sonypi_device.input_key_dev;
732 struct sonypi_keypress kp = { NULL };
733 int i;
734
735 switch (event) {
736 case SONYPI_EVENT_JOGDIAL_UP:
737 case SONYPI_EVENT_JOGDIAL_UP_PRESSED:
738 input_report_rel(jog_dev, REL_WHEEL, 1);
739 input_sync(jog_dev);
740 break;
741
742 case SONYPI_EVENT_JOGDIAL_DOWN:
743 case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED:
744 input_report_rel(jog_dev, REL_WHEEL, -1);
745 input_sync(jog_dev);
746 break;
747
748 case SONYPI_EVENT_JOGDIAL_PRESSED:
749 kp.key = BTN_MIDDLE;
750 kp.dev = jog_dev;
751 break;
752
753 case SONYPI_EVENT_FNKEY_RELEASED:
754 /* Nothing, not all VAIOs generate this event */
755 break;
756
757 default:
758 for (i = 0; sonypi_inputkeys[i].sonypiev; i++)
759 if (event == sonypi_inputkeys[i].sonypiev) {
760 kp.dev = key_dev;
761 kp.key = sonypi_inputkeys[i].inputev;
762 break;
763 }
764 break;
765 }
766
767 if (kp.dev) {
768 input_report_key(kp.dev, kp.key, 1);
769 input_sync(kp.dev);
770 kfifo_put(sonypi_device.input_fifo,
771 (unsigned char *)&kp, sizeof(kp));
772 schedule_work(&sonypi_device.input_work);
729 } 773 }
730} 774}
731 775
@@ -768,51 +812,8 @@ found:
768 printk(KERN_INFO 812 printk(KERN_INFO
769 "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2); 813 "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2);
770 814
771 if (useinput) { 815 if (useinput)
772 struct input_dev *input_jog_dev = &sonypi_device.input_jog_dev; 816 sonypi_report_input_event(event);
773 struct input_dev *input_key_dev = &sonypi_device.input_key_dev;
774 switch (event) {
775 case SONYPI_EVENT_JOGDIAL_UP:
776 case SONYPI_EVENT_JOGDIAL_UP_PRESSED:
777 input_report_rel(input_jog_dev, REL_WHEEL, 1);
778 break;
779 case SONYPI_EVENT_JOGDIAL_DOWN:
780 case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED:
781 input_report_rel(input_jog_dev, REL_WHEEL, -1);
782 break;
783 case SONYPI_EVENT_JOGDIAL_PRESSED: {
784 int key = BTN_MIDDLE;
785 input_report_key(input_jog_dev, key, 1);
786 kfifo_put(sonypi_device.input_fifo,
787 (unsigned char *)&input_jog_dev,
788 sizeof(input_jog_dev));
789 kfifo_put(sonypi_device.input_fifo,
790 (unsigned char *)&key, sizeof(key));
791 break;
792 }
793 case SONYPI_EVENT_FNKEY_RELEASED:
794 /* Nothing, not all VAIOs generate this event */
795 break;
796 }
797 input_sync(input_jog_dev);
798
799 for (i = 0; sonypi_inputkeys[i].sonypiev; i++) {
800 int key;
801
802 if (event != sonypi_inputkeys[i].sonypiev)
803 continue;
804
805 key = sonypi_inputkeys[i].inputev;
806 input_report_key(input_key_dev, key, 1);
807 kfifo_put(sonypi_device.input_fifo,
808 (unsigned char *)&input_key_dev,
809 sizeof(input_key_dev));
810 kfifo_put(sonypi_device.input_fifo,
811 (unsigned char *)&key, sizeof(key));
812 }
813 input_sync(input_key_dev);
814 schedule_work(&sonypi_device.input_work);
815 }
816 817
817 kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); 818 kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event));
818 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); 819 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
@@ -1227,14 +1228,7 @@ static int __devinit sonypi_probe(void)
1227 sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] = 1228 sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] =
1228 BIT(BTN_MIDDLE); 1229 BIT(BTN_MIDDLE);
1229 sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL); 1230 sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL);
1230 sonypi_device.input_jog_dev.name = 1231 sonypi_device.input_jog_dev.name = SONYPI_JOG_INPUTNAME;
1231 kmalloc(sizeof(SONYPI_JOG_INPUTNAME), GFP_KERNEL);
1232 if (!sonypi_device.input_jog_dev.name) {
1233 printk(KERN_ERR "sonypi: kmalloc failed\n");
1234 ret = -ENOMEM;
1235 goto out_inkmallocinput1;
1236 }
1237 sprintf(sonypi_device.input_jog_dev.name, SONYPI_JOG_INPUTNAME);
1238 sonypi_device.input_jog_dev.id.bustype = BUS_ISA; 1232 sonypi_device.input_jog_dev.id.bustype = BUS_ISA;
1239 sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY; 1233 sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY;
1240 1234
@@ -1248,14 +1242,7 @@ static int __devinit sonypi_probe(void)
1248 if (sonypi_inputkeys[i].inputev) 1242 if (sonypi_inputkeys[i].inputev)
1249 set_bit(sonypi_inputkeys[i].inputev, 1243 set_bit(sonypi_inputkeys[i].inputev,
1250 sonypi_device.input_key_dev.keybit); 1244 sonypi_device.input_key_dev.keybit);
1251 sonypi_device.input_key_dev.name = 1245 sonypi_device.input_key_dev.name = SONYPI_KEY_INPUTNAME;
1252 kmalloc(sizeof(SONYPI_KEY_INPUTNAME), GFP_KERNEL);
1253 if (!sonypi_device.input_key_dev.name) {
1254 printk(KERN_ERR "sonypi: kmalloc failed\n");
1255 ret = -ENOMEM;
1256 goto out_inkmallocinput2;
1257 }
1258 sprintf(sonypi_device.input_key_dev.name, SONYPI_KEY_INPUTNAME);
1259 sonypi_device.input_key_dev.id.bustype = BUS_ISA; 1246 sonypi_device.input_key_dev.id.bustype = BUS_ISA;
1260 sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY; 1247 sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY;
1261 1248
@@ -1313,11 +1300,7 @@ out_platformdev:
1313 kfifo_free(sonypi_device.input_fifo); 1300 kfifo_free(sonypi_device.input_fifo);
1314out_infifo: 1301out_infifo:
1315 input_unregister_device(&sonypi_device.input_key_dev); 1302 input_unregister_device(&sonypi_device.input_key_dev);
1316 kfree(sonypi_device.input_key_dev.name);
1317out_inkmallocinput2:
1318 input_unregister_device(&sonypi_device.input_jog_dev); 1303 input_unregister_device(&sonypi_device.input_jog_dev);
1319 kfree(sonypi_device.input_jog_dev.name);
1320out_inkmallocinput1:
1321 free_irq(sonypi_device.irq, sonypi_irq); 1304 free_irq(sonypi_device.irq, sonypi_irq);
1322out_reqirq: 1305out_reqirq:
1323 release_region(sonypi_device.ioport1, sonypi_device.region_size); 1306 release_region(sonypi_device.ioport1, sonypi_device.region_size);
@@ -1337,13 +1320,14 @@ static void __devexit sonypi_remove(void)
1337{ 1320{
1338 sonypi_disable(); 1321 sonypi_disable();
1339 1322
1323 synchronize_sched(); /* Allow sonypi interrupt to complete. */
1324 flush_scheduled_work();
1325
1340 platform_device_unregister(sonypi_device.pdev); 1326 platform_device_unregister(sonypi_device.pdev);
1341 1327
1342 if (useinput) { 1328 if (useinput) {
1343 input_unregister_device(&sonypi_device.input_key_dev); 1329 input_unregister_device(&sonypi_device.input_key_dev);
1344 kfree(sonypi_device.input_key_dev.name);
1345 input_unregister_device(&sonypi_device.input_jog_dev); 1330 input_unregister_device(&sonypi_device.input_jog_dev);
1346 kfree(sonypi_device.input_jog_dev.name);
1347 kfifo_free(sonypi_device.input_fifo); 1331 kfifo_free(sonypi_device.input_fifo);
1348 } 1332 }
1349 1333
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 7a7859dd0d9..10b01498238 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1130,7 +1130,7 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
1130 unsigned int target_freq, 1130 unsigned int target_freq,
1131 unsigned int relation) 1131 unsigned int relation)
1132{ 1132{
1133 unsigned int ret; 1133 int ret;
1134 1134
1135 policy = cpufreq_cpu_get(policy->cpu); 1135 policy = cpufreq_cpu_get(policy->cpu);
1136 if (!policy) 1136 if (!policy)
@@ -1151,7 +1151,7 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_target);
1151 1151
1152static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) 1152static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event)
1153{ 1153{
1154 int ret = -EINVAL; 1154 int ret;
1155 1155
1156 if (!try_module_get(policy->governor->owner)) 1156 if (!try_module_get(policy->governor->owner))
1157 return -EINVAL; 1157 return -EINVAL;
diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c
index 53c95c0bbf4..ae1fb45dbb4 100644
--- a/drivers/firmware/pcdp.c
+++ b/drivers/firmware/pcdp.c
@@ -25,14 +25,22 @@ setup_serial_console(struct pcdp_uart *uart)
25#ifdef CONFIG_SERIAL_8250_CONSOLE 25#ifdef CONFIG_SERIAL_8250_CONSOLE
26 int mmio; 26 int mmio;
27 static char options[64], *p = options; 27 static char options[64], *p = options;
28 char parity;
28 29
29 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY); 30 mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
30 p += sprintf(p, "console=uart,%s,0x%lx", 31 p += sprintf(p, "console=uart,%s,0x%lx",
31 mmio ? "mmio" : "io", uart->addr.address); 32 mmio ? "mmio" : "io", uart->addr.address);
32 if (uart->baud) 33 if (uart->baud) {
33 p += sprintf(p, ",%lu", uart->baud); 34 p += sprintf(p, ",%lu", uart->baud);
34 if (uart->bits) 35 if (uart->bits) {
35 p += sprintf(p, "n%d", uart->bits); 36 switch (uart->parity) {
37 case 0x2: parity = 'e'; break;
38 case 0x3: parity = 'o'; break;
39 default: parity = 'n';
40 }
41 p += sprintf(p, "%c%d", parity, uart->bits);
42 }
43 }
36 44
37 return early_serial_console_init(options); 45 return early_serial_console_init(options);
38#else 46#else
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index 3c85fe150cd..4fa17c76eea 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -393,7 +393,7 @@ void adm1026_init_client(struct i2c_client *client)
393 393
394 value = data->config3; 394 value = data->config3;
395 if (data->config3 & CFG3_GPIO16_ENABLE) { 395 if (data->config3 & CFG3_GPIO16_ENABLE) {
396 dev_dbg(&client->dev, "GPIO16 enabled. THERM" 396 dev_dbg(&client->dev, "GPIO16 enabled. THERM "
397 "pin disabled.\n"); 397 "pin disabled.\n");
398 } else { 398 } else {
399 dev_dbg(&client->dev, "THERM pin enabled. " 399 dev_dbg(&client->dev, "THERM pin enabled. "
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c
index 0bcf82b4c07..fca3fc1cef7 100644
--- a/drivers/hwmon/atxp1.c
+++ b/drivers/hwmon/atxp1.c
@@ -21,6 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/jiffies.h>
24#include <linux/i2c.h> 25#include <linux/i2c.h>
25#include <linux/i2c-sensor.h> 26#include <linux/i2c-sensor.h>
26#include <linux/i2c-vid.h> 27#include <linux/i2c-vid.h>
@@ -80,9 +81,7 @@ static struct atxp1_data * atxp1_update_device(struct device *dev)
80 81
81 down(&data->update_lock); 82 down(&data->update_lock);
82 83
83 if ((jiffies - data->last_updated > HZ) || 84 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
84 (jiffies < data->last_updated) ||
85 !data->valid) {
86 85
87 /* Update local register data */ 86 /* Update local register data */
88 data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID); 87 data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID);
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c
index 3beaa6191ef..270015b626a 100644
--- a/drivers/hwmon/fscpos.c
+++ b/drivers/hwmon/fscpos.c
@@ -32,6 +32,7 @@
32 32
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/jiffies.h>
35#include <linux/i2c.h> 36#include <linux/i2c.h>
36#include <linux/i2c-sensor.h> 37#include <linux/i2c-sensor.h>
37#include <linux/init.h> 38#include <linux/init.h>
@@ -572,8 +573,7 @@ static struct fscpos_data *fscpos_update_device(struct device *dev)
572 573
573 down(&data->update_lock); 574 down(&data->update_lock);
574 575
575 if ((jiffies - data->last_updated > 2 * HZ) || 576 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
576 (jiffies < data->last_updated) || !data->valid) {
577 int i; 577 int i;
578 578
579 dev_dbg(&client->dev, "Starting fscpos update\n"); 579 dev_dbg(&client->dev, "Starting fscpos update\n");
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index a13a504f5bf..80ae8d30c2a 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/jiffies.h>
27#include <linux/i2c.h> 28#include <linux/i2c.h>
28#include <linux/i2c-sensor.h> 29#include <linux/i2c-sensor.h>
29#include <linux/i2c-vid.h> 30#include <linux/i2c-vid.h>
@@ -678,8 +679,7 @@ static struct gl520_data *gl520_update_device(struct device *dev)
678 679
679 down(&data->update_lock); 680 down(&data->update_lock);
680 681
681 if ((jiffies - data->last_updated > 2 * HZ) || 682 if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
682 (jiffies < data->last_updated) || !data->valid) {
683 683
684 dev_dbg(&client->dev, "Starting gl520sm update\n"); 684 dev_dbg(&client->dev, "Starting gl520sm update\n");
685 685
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
index bf553dcd97d..3c159f1d49e 100644
--- a/drivers/hwmon/max1619.c
+++ b/drivers/hwmon/max1619.c
@@ -363,7 +363,7 @@ static void __exit sensors_max1619_exit(void)
363 i2c_del_driver(&max1619_driver); 363 i2c_del_driver(&max1619_driver);
364} 364}
365 365
366MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and" 366MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and "
367 "Jean Delvare <khali@linux-fr.org>"); 367 "Jean Delvare <khali@linux-fr.org>");
368MODULE_DESCRIPTION("MAX1619 sensor driver"); 368MODULE_DESCRIPTION("MAX1619 sensor driver");
369MODULE_LICENSE("GPL"); 369MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 876c68f3af3..fa4032d53b7 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -1043,7 +1043,7 @@ static void pc87360_init_client(struct i2c_client *client, int use_thermistors)
1043 if (init >= 2 && data->innr) { 1043 if (init >= 2 && data->innr) {
1044 reg = pc87360_read_value(data, LD_IN, NO_BANK, 1044 reg = pc87360_read_value(data, LD_IN, NO_BANK,
1045 PC87365_REG_IN_CONVRATE); 1045 PC87365_REG_IN_CONVRATE);
1046 dev_info(&client->dev, "VLM conversion set to" 1046 dev_info(&client->dev, "VLM conversion set to "
1047 "1s period, 160us delay\n"); 1047 "1s period, 160us delay\n");
1048 pc87360_write_value(data, LD_IN, NO_BANK, 1048 pc87360_write_value(data, LD_IN, NO_BANK,
1049 PC87365_REG_IN_CONVRATE, 1049 PC87365_REG_IN_CONVRATE,
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 0ab7e37f5b0..1ab41313ce5 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -137,7 +137,7 @@ static int i801_setup(struct pci_dev *dev)
137 pci_read_config_word(I801_dev, SMBBA, &i801_smba); 137 pci_read_config_word(I801_dev, SMBBA, &i801_smba);
138 i801_smba &= 0xfff0; 138 i801_smba &= 0xfff0;
139 if(i801_smba == 0) { 139 if(i801_smba == 0) {
140 dev_err(&dev->dev, "SMB base address uninitialized" 140 dev_err(&dev->dev, "SMB base address uninitialized "
141 "- upgrade BIOS or use force_addr=0xaddr\n"); 141 "- upgrade BIOS or use force_addr=0xaddr\n");
142 return -ENODEV; 142 return -ENODEV;
143 } 143 }
@@ -186,7 +186,7 @@ static int i801_transaction(void)
186 int result = 0; 186 int result = 0;
187 int timeout = 0; 187 int timeout = 0;
188 188
189 dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x," 189 dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
190 "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), 190 "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
191 inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), 191 inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
192 inb_p(SMBHSTDAT1)); 192 inb_p(SMBHSTDAT1));
@@ -240,7 +240,7 @@ static int i801_transaction(void)
240 outb_p(inb(SMBHSTSTS), SMBHSTSTS); 240 outb_p(inb(SMBHSTSTS), SMBHSTSTS);
241 241
242 if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { 242 if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
243 dev_dbg(&I801_dev->dev, "Failed reset at end of transaction" 243 dev_dbg(&I801_dev->dev, "Failed reset at end of transaction "
244 "(%02x)\n", temp); 244 "(%02x)\n", temp);
245 } 245 }
246 dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, " 246 dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, "
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 9ad3e9262e8..04adde62a00 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -382,6 +382,100 @@ static void __exit fsl_i2c_exit(void)
382module_init(fsl_i2c_init); 382module_init(fsl_i2c_init);
383module_exit(fsl_i2c_exit); 383module_exit(fsl_i2c_exit);
384 384
385static int fsl_i2c_probe(struct device *device)
386{
387 int result = 0;
388 struct mpc_i2c *i2c;
389 struct platform_device *pdev = to_platform_device(device);
390 struct fsl_i2c_platform_data *pdata;
391 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
392
393 pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;
394
395 if (!(i2c = kmalloc(sizeof(*i2c), GFP_KERNEL))) {
396 return -ENOMEM;
397 }
398 memset(i2c, 0, sizeof(*i2c));
399
400 i2c->irq = platform_get_irq(pdev, 0);
401 i2c->flags = pdata->device_flags;
402 init_waitqueue_head(&i2c->queue);
403
404 i2c->base = ioremap((phys_addr_t)r->start, MPC_I2C_REGION);
405
406 if (!i2c->base) {
407 printk(KERN_ERR "i2c-mpc - failed to map controller\n");
408 result = -ENOMEM;
409 goto fail_map;
410 }
411
412 if (i2c->irq != 0)
413 if ((result = request_irq(i2c->irq, mpc_i2c_isr,
414 SA_SHIRQ, "i2c-mpc", i2c)) < 0) {
415 printk(KERN_ERR
416 "i2c-mpc - failed to attach interrupt\n");
417 goto fail_irq;
418 }
419
420 mpc_i2c_setclock(i2c);
421 dev_set_drvdata(device, i2c);
422
423 i2c->adap = mpc_ops;
424 i2c_set_adapdata(&i2c->adap, i2c);
425 i2c->adap.dev.parent = &pdev->dev;
426 if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
427 printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
428 goto fail_add;
429 }
430
431 return result;
432
433 fail_add:
434 if (i2c->irq != 0)
435 free_irq(i2c->irq, NULL);
436 fail_irq:
437 iounmap(i2c->base);
438 fail_map:
439 kfree(i2c);
440 return result;
441};
442
443static int fsl_i2c_remove(struct device *device)
444{
445 struct mpc_i2c *i2c = dev_get_drvdata(device);
446
447 i2c_del_adapter(&i2c->adap);
448 dev_set_drvdata(device, NULL);
449
450 if (i2c->irq != 0)
451 free_irq(i2c->irq, i2c);
452
453 iounmap(i2c->base);
454 kfree(i2c);
455 return 0;
456};
457
458/* Structure for a device driver */
459static struct device_driver fsl_i2c_driver = {
460 .name = "fsl-i2c",
461 .bus = &platform_bus_type,
462 .probe = fsl_i2c_probe,
463 .remove = fsl_i2c_remove,
464};
465
466static int __init fsl_i2c_init(void)
467{
468 return driver_register(&fsl_i2c_driver);
469}
470
471static void __exit fsl_i2c_exit(void)
472{
473 driver_unregister(&fsl_i2c_driver);
474}
475
476module_init(fsl_i2c_init);
477module_exit(fsl_i2c_exit);
478
385MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>"); 479MODULE_AUTHOR("Adrian Cox <adrian@humboldt.co.uk>");
386MODULE_DESCRIPTION 480MODULE_DESCRIPTION
387 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors"); 481 ("I2C-Bus adapter for MPC107 bridge and MPC824x/85xx/52xx processors");
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
index 74ece8ac1c2..82cf959989f 100644
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -165,7 +165,7 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
165 buf[0] = 0; /* reg offset */ 165 buf[0] = 0; /* reg offset */
166 buf[1] = BIN2BCD(dt->tm_sec); 166 buf[1] = BIN2BCD(dt->tm_sec);
167 buf[2] = BIN2BCD(dt->tm_min); 167 buf[2] = BIN2BCD(dt->tm_min);
168 buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6); 168 buf[3] = BIN2BCD(dt->tm_hour);
169 buf[4] = BIN2BCD(dt->tm_wday) + 1; 169 buf[4] = BIN2BCD(dt->tm_wday) + 1;
170 buf[5] = BIN2BCD(dt->tm_mday); 170 buf[5] = BIN2BCD(dt->tm_mday);
171 buf[6] = BIN2BCD(dt->tm_mon) + 1; 171 buf[6] = BIN2BCD(dt->tm_mon) + 1;
@@ -344,9 +344,9 @@ static void ds1337_init_client(struct i2c_client *client)
344 344
345 /* Ensure that device is set in 24-hour mode */ 345 /* Ensure that device is set in 24-hour mode */
346 val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); 346 val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR);
347 if ((val >= 0) && (val & (1 << 6)) == 0) 347 if ((val >= 0) && (val & (1 << 6)))
348 i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, 348 i2c_smbus_write_byte_data(client, DS1337_REG_HOUR,
349 val | (1 << 6)); 349 val & 0x3f);
350} 350}
351 351
352static int ds1337_detach_client(struct i2c_client *client) 352static int ds1337_detach_client(struct i2c_client *client)
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index 6ea413f6d5e..a2da31b0dd7 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -163,6 +163,11 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
163 struct eeprom_data *data; 163 struct eeprom_data *data;
164 int err = 0; 164 int err = 0;
165 165
166 /* prevent 24RF08 corruption */
167 if (kind < 0)
168 i2c_smbus_xfer(adapter, address, 0, 0, 0,
169 I2C_SMBUS_QUICK, NULL);
170
166 /* There are three ways we can read the EEPROM data: 171 /* There are three ways we can read the EEPROM data:
167 (1) I2C block reads (faster, but unsupported by most adapters) 172 (1) I2C block reads (faster, but unsupported by most adapters)
168 (2) Consecutive byte reads (100% overhead) 173 (2) Consecutive byte reads (100% overhead)
@@ -187,9 +192,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
187 new_client->driver = &eeprom_driver; 192 new_client->driver = &eeprom_driver;
188 new_client->flags = 0; 193 new_client->flags = 0;
189 194
190 /* prevent 24RF08 corruption */
191 i2c_smbus_write_quick(new_client, 0);
192
193 /* Fill in the remaining client fields */ 195 /* Fill in the remaining client fields */
194 strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); 196 strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE);
195 data->valid = 0; 197 data->valid = 0;
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index c4f14d9623c..0230375f72e 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -343,6 +343,11 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
343 struct max6875_data *data; 343 struct max6875_data *data;
344 int err = 0; 344 int err = 0;
345 345
346 /* Prevent 24RF08 corruption (in case of user error) */
347 if (kind < 0)
348 i2c_smbus_xfer(adapter, address, 0, 0, 0,
349 I2C_SMBUS_QUICK, NULL);
350
346 /* There are three ways we can read the EEPROM data: 351 /* There are three ways we can read the EEPROM data:
347 (1) I2C block reads (faster, but unsupported by most adapters) 352 (1) I2C block reads (faster, but unsupported by most adapters)
348 (2) Consecutive byte reads (100% overhead) 353 (2) Consecutive byte reads (100% overhead)
@@ -370,9 +375,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
370 new_client->driver = &max6875_driver; 375 new_client->driver = &max6875_driver;
371 new_client->flags = 0; 376 new_client->flags = 0;
372 377
373 /* Prevent 24RF08 corruption */
374 i2c_smbus_write_quick(new_client, 0);
375
376 /* Setup the user section */ 378 /* Setup the user section */
377 data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; 379 data->blocks[max6875_eeprom_user].type = max6875_eeprom_user;
378 data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; 380 data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES;
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4fd4f52c8e9..4a9ead27759 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -231,8 +231,8 @@ int i2c_del_adapter(struct i2c_adapter *adap)
231 if (driver->detach_adapter) 231 if (driver->detach_adapter)
232 if ((res = driver->detach_adapter(adap))) { 232 if ((res = driver->detach_adapter(adap))) {
233 dev_warn(&adap->dev, "can't detach adapter " 233 dev_warn(&adap->dev, "can't detach adapter "
234 "while detaching driver %s: driver not " 234 "while detaching driver %s: driver "
235 "detached!", driver->name); 235 "not detached!\n", driver->name);
236 goto out_unlock; 236 goto out_unlock;
237 } 237 }
238 } 238 }
@@ -456,8 +456,8 @@ int i2c_detach_client(struct i2c_client *client)
456 res = adapter->client_unregister(client); 456 res = adapter->client_unregister(client);
457 if (res) { 457 if (res) {
458 dev_err(&client->dev, 458 dev_err(&client->dev,
459 "client_unregister [%s] failed, " 459 "client_unregister [%s] failed, "
460 "client not detached", client->name); 460 "client not detached\n", client->name);
461 goto out; 461 goto out;
462 } 462 }
463 } 463 }
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index aac59751e1b..03747439ac9 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -465,7 +465,7 @@ static struct pcmcia_device_id ide_ids[] = {
465 PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591), 465 PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591),
466 PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4), 466 PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4),
467 PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde), 467 PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde),
468 PCMCIA_DEVICE_PROD_ID12("EXP", "CD", 0x6f58c983, 0xaae5994f), 468 PCMCIA_DEVICE_PROD_ID12("EXP", "CD+GAME", 0x6f58c983, 0x63c13aaf),
469 PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591), 469 PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591),
470 PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728), 470 PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728),
471 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), 471 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e),
@@ -481,6 +481,7 @@ static struct pcmcia_device_id ide_ids[] = {
481 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), 481 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
482 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 482 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
483 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 483 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
484 PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
484 PCMCIA_DEVICE_NULL, 485 PCMCIA_DEVICE_NULL,
485}; 486};
486MODULE_DEVICE_TABLE(pcmcia, ide_ids); 487MODULE_DEVICE_TABLE(pcmcia, ide_ids);
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 374f404e81d..20e3a165989 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -320,6 +320,7 @@ static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
320 if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; 320 if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL;
321 if (get_user(v, ip + 1)) return -EFAULT; 321 if (get_user(v, ip + 1)) return -EFAULT;
322 if (v < 0 || v > KEY_MAX) return -EINVAL; 322 if (v < 0 || v > KEY_MAX) return -EINVAL;
323 if (v >> (dev->keycodesize * 8)) return -EINVAL;
323 u = SET_INPUT_KEYCODE(dev, t, v); 324 u = SET_INPUT_KEYCODE(dev, t, v);
324 clear_bit(u, dev->keybit); 325 clear_bit(u, dev->keybit);
325 set_bit(v, dev->keybit); 326 set_bit(v, dev->keybit);
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 7c4b4d37b3e..a275211c8e1 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -48,12 +48,6 @@ static LIST_HEAD(input_handler_list);
48 48
49static struct input_handler *input_table[8]; 49static struct input_handler *input_table[8];
50 50
51#ifdef CONFIG_PROC_FS
52static struct proc_dir_entry *proc_bus_input_dir;
53static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
54static int input_devices_state;
55#endif
56
57void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 51void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
58{ 52{
59 struct input_handle *handle; 53 struct input_handle *handle;
@@ -312,6 +306,7 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st
312 return NULL; 306 return NULL;
313} 307}
314 308
309
315/* 310/*
316 * Input hotplugging interface - loading event handlers based on 311 * Input hotplugging interface - loading event handlers based on
317 * device bitfields. 312 * device bitfields.
@@ -428,6 +423,177 @@ static void input_call_hotplug(char *verb, struct input_dev *dev)
428 423
429#endif 424#endif
430 425
426#ifdef CONFIG_PROC_FS
427
428static struct proc_dir_entry *proc_bus_input_dir;
429static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait);
430static int input_devices_state;
431
432static inline void input_wakeup_procfs_readers(void)
433{
434 input_devices_state++;
435 wake_up(&input_devices_poll_wait);
436}
437
438static unsigned int input_devices_poll(struct file *file, poll_table *wait)
439{
440 int state = input_devices_state;
441 poll_wait(file, &input_devices_poll_wait, wait);
442 if (state != input_devices_state)
443 return POLLIN | POLLRDNORM;
444 return 0;
445}
446
447#define SPRINTF_BIT_B(bit, name, max) \
448 do { \
449 len += sprintf(buf + len, "B: %s", name); \
450 for (i = NBITS(max) - 1; i >= 0; i--) \
451 if (dev->bit[i]) break; \
452 for (; i >= 0; i--) \
453 len += sprintf(buf + len, "%lx ", dev->bit[i]); \
454 len += sprintf(buf + len, "\n"); \
455 } while (0)
456
457#define SPRINTF_BIT_B2(bit, name, max, ev) \
458 do { \
459 if (test_bit(ev, dev->evbit)) \
460 SPRINTF_BIT_B(bit, name, max); \
461 } while (0)
462
463static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
464{
465 struct input_dev *dev;
466 struct input_handle *handle;
467
468 off_t at = 0;
469 int i, len, cnt = 0;
470
471 list_for_each_entry(dev, &input_dev_list, node) {
472
473 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
474 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
475
476 len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : "");
477 len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : "");
478 len += sprintf(buf + len, "H: Handlers=");
479
480 list_for_each_entry(handle, &dev->h_list, d_node)
481 len += sprintf(buf + len, "%s ", handle->name);
482
483 len += sprintf(buf + len, "\n");
484
485 SPRINTF_BIT_B(evbit, "EV=", EV_MAX);
486 SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY);
487 SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL);
488 SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS);
489 SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC);
490 SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED);
491 SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND);
492 SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF);
493
494 len += sprintf(buf + len, "\n");
495
496 at += len;
497
498 if (at >= pos) {
499 if (!*start) {
500 *start = buf + (pos - (at - len));
501 cnt = at - pos;
502 } else cnt += len;
503 buf += len;
504 if (cnt >= count)
505 break;
506 }
507 }
508
509 if (&dev->node == &input_dev_list)
510 *eof = 1;
511
512 return (count > cnt) ? cnt : count;
513}
514
515static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
516{
517 struct input_handler *handler;
518
519 off_t at = 0;
520 int len = 0, cnt = 0;
521 int i = 0;
522
523 list_for_each_entry(handler, &input_handler_list, node) {
524
525 if (handler->fops)
526 len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n",
527 i++, handler->name, handler->minor);
528 else
529 len = sprintf(buf, "N: Number=%d Name=%s\n",
530 i++, handler->name);
531
532 at += len;
533
534 if (at >= pos) {
535 if (!*start) {
536 *start = buf + (pos - (at - len));
537 cnt = at - pos;
538 } else cnt += len;
539 buf += len;
540 if (cnt >= count)
541 break;
542 }
543 }
544 if (&handler->node == &input_handler_list)
545 *eof = 1;
546
547 return (count > cnt) ? cnt : count;
548}
549
550static struct file_operations input_fileops;
551
552static int __init input_proc_init(void)
553{
554 struct proc_dir_entry *entry;
555
556 proc_bus_input_dir = proc_mkdir("input", proc_bus);
557 if (!proc_bus_input_dir)
558 return -ENOMEM;
559
560 proc_bus_input_dir->owner = THIS_MODULE;
561
562 entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL);
563 if (!entry)
564 goto fail1;
565
566 entry->owner = THIS_MODULE;
567 input_fileops = *entry->proc_fops;
568 entry->proc_fops = &input_fileops;
569 entry->proc_fops->poll = input_devices_poll;
570
571 entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL);
572 if (!entry)
573 goto fail2;
574
575 entry->owner = THIS_MODULE;
576
577 return 0;
578
579 fail2: remove_proc_entry("devices", proc_bus_input_dir);
580 fail1: remove_proc_entry("input", proc_bus);
581 return -ENOMEM;
582}
583
584static void input_proc_exit(void)
585{
586 remove_proc_entry("devices", proc_bus_input_dir);
587 remove_proc_entry("handlers", proc_bus_input_dir);
588 remove_proc_entry("input", proc_bus);
589}
590
591#else /* !CONFIG_PROC_FS */
592static inline void input_wakeup_procfs_readers(void) { }
593static inline int input_proc_init(void) { return 0; }
594static inline void input_proc_exit(void) { }
595#endif
596
431void input_register_device(struct input_dev *dev) 597void input_register_device(struct input_dev *dev)
432{ 598{
433 struct input_handle *handle; 599 struct input_handle *handle;
@@ -464,10 +630,7 @@ void input_register_device(struct input_dev *dev)
464 input_call_hotplug("add", dev); 630 input_call_hotplug("add", dev);
465#endif 631#endif
466 632
467#ifdef CONFIG_PROC_FS 633 input_wakeup_procfs_readers();
468 input_devices_state++;
469 wake_up(&input_devices_poll_wait);
470#endif
471} 634}
472 635
473void input_unregister_device(struct input_dev *dev) 636void input_unregister_device(struct input_dev *dev)
@@ -491,10 +654,7 @@ void input_unregister_device(struct input_dev *dev)
491 654
492 list_del_init(&dev->node); 655 list_del_init(&dev->node);
493 656
494#ifdef CONFIG_PROC_FS 657 input_wakeup_procfs_readers();
495 input_devices_state++;
496 wake_up(&input_devices_poll_wait);
497#endif
498} 658}
499 659
500void input_register_handler(struct input_handler *handler) 660void input_register_handler(struct input_handler *handler)
@@ -518,10 +678,7 @@ void input_register_handler(struct input_handler *handler)
518 if ((handle = handler->connect(handler, dev, id))) 678 if ((handle = handler->connect(handler, dev, id)))
519 input_link_handle(handle); 679 input_link_handle(handle);
520 680
521#ifdef CONFIG_PROC_FS 681 input_wakeup_procfs_readers();
522 input_devices_state++;
523 wake_up(&input_devices_poll_wait);
524#endif
525} 682}
526 683
527void input_unregister_handler(struct input_handler *handler) 684void input_unregister_handler(struct input_handler *handler)
@@ -540,10 +697,7 @@ void input_unregister_handler(struct input_handler *handler)
540 if (handler->fops != NULL) 697 if (handler->fops != NULL)
541 input_table[handler->minor >> 5] = NULL; 698 input_table[handler->minor >> 5] = NULL;
542 699
543#ifdef CONFIG_PROC_FS 700 input_wakeup_procfs_readers();
544 input_devices_state++;
545 wake_up(&input_devices_poll_wait);
546#endif
547} 701}
548 702
549static int input_open_file(struct inode *inode, struct file *file) 703static int input_open_file(struct inode *inode, struct file *file)
@@ -582,190 +736,43 @@ static struct file_operations input_fops = {
582 .open = input_open_file, 736 .open = input_open_file,
583}; 737};
584 738
585#ifdef CONFIG_PROC_FS 739struct class *input_class;
586
587#define SPRINTF_BIT_B(bit, name, max) \
588 do { \
589 len += sprintf(buf + len, "B: %s", name); \
590 for (i = NBITS(max) - 1; i >= 0; i--) \
591 if (dev->bit[i]) break; \
592 for (; i >= 0; i--) \
593 len += sprintf(buf + len, "%lx ", dev->bit[i]); \
594 len += sprintf(buf + len, "\n"); \
595 } while (0)
596
597#define SPRINTF_BIT_B2(bit, name, max, ev) \
598 do { \
599 if (test_bit(ev, dev->evbit)) \
600 SPRINTF_BIT_B(bit, name, max); \
601 } while (0)
602
603
604static unsigned int input_devices_poll(struct file *file, poll_table *wait)
605{
606 int state = input_devices_state;
607 poll_wait(file, &input_devices_poll_wait, wait);
608 if (state != input_devices_state)
609 return POLLIN | POLLRDNORM;
610 return 0;
611}
612 740
613static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) 741static int __init input_init(void)
614{ 742{
615 struct input_dev *dev; 743 int err;
616 struct input_handle *handle;
617
618 off_t at = 0;
619 int i, len, cnt = 0;
620
621 list_for_each_entry(dev, &input_dev_list, node) {
622
623 len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
624 dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
625
626 len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : "");
627 len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : "");
628 len += sprintf(buf + len, "H: Handlers=");
629
630 list_for_each_entry(handle, &dev->h_list, d_node)
631 len += sprintf(buf + len, "%s ", handle->name);
632
633 len += sprintf(buf + len, "\n");
634
635 SPRINTF_BIT_B(evbit, "EV=", EV_MAX);
636 SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY);
637 SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL);
638 SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS);
639 SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC);
640 SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED);
641 SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND);
642 SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF);
643
644 len += sprintf(buf + len, "\n");
645
646 at += len;
647 744
648 if (at >= pos) { 745 input_class = class_create(THIS_MODULE, "input");
649 if (!*start) { 746 if (IS_ERR(input_class)) {
650 *start = buf + (pos - (at - len)); 747 printk(KERN_ERR "input: unable to register input class\n");
651 cnt = at - pos; 748 return PTR_ERR(input_class);
652 } else cnt += len;
653 buf += len;
654 if (cnt >= count)
655 break;
656 }
657 } 749 }
658 750
659 if (&dev->node == &input_dev_list) 751 err = input_proc_init();
660 *eof = 1; 752 if (err)
661 753 goto fail1;
662 return (count > cnt) ? cnt : count;
663}
664
665static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
666{
667 struct input_handler *handler;
668
669 off_t at = 0;
670 int len = 0, cnt = 0;
671 int i = 0;
672
673 list_for_each_entry(handler, &input_handler_list, node) {
674
675 if (handler->fops)
676 len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n",
677 i++, handler->name, handler->minor);
678 else
679 len = sprintf(buf, "N: Number=%d Name=%s\n",
680 i++, handler->name);
681
682 at += len;
683 754
684 if (at >= pos) { 755 err = register_chrdev(INPUT_MAJOR, "input", &input_fops);
685 if (!*start) { 756 if (err) {
686 *start = buf + (pos - (at - len)); 757 printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR);
687 cnt = at - pos; 758 goto fail2;
688 } else cnt += len;
689 buf += len;
690 if (cnt >= count)
691 break;
692 }
693 } 759 }
694 if (&handler->node == &input_handler_list)
695 *eof = 1;
696
697 return (count > cnt) ? cnt : count;
698}
699
700static struct file_operations input_fileops;
701 760
702static int __init input_proc_init(void) 761 err = devfs_mk_dir("input");
703{ 762 if (err)
704 struct proc_dir_entry *entry; 763 goto fail3;
705 764
706 proc_bus_input_dir = proc_mkdir("input", proc_bus);
707 if (proc_bus_input_dir == NULL)
708 return -ENOMEM;
709 proc_bus_input_dir->owner = THIS_MODULE;
710 entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL);
711 if (entry == NULL) {
712 remove_proc_entry("input", proc_bus);
713 return -ENOMEM;
714 }
715 entry->owner = THIS_MODULE;
716 input_fileops = *entry->proc_fops;
717 entry->proc_fops = &input_fileops;
718 entry->proc_fops->poll = input_devices_poll;
719 entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL);
720 if (entry == NULL) {
721 remove_proc_entry("devices", proc_bus_input_dir);
722 remove_proc_entry("input", proc_bus);
723 return -ENOMEM;
724 }
725 entry->owner = THIS_MODULE;
726 return 0; 765 return 0;
727}
728#else /* !CONFIG_PROC_FS */
729static inline int input_proc_init(void) { return 0; }
730#endif
731 766
732struct class *input_class; 767 fail3: unregister_chrdev(INPUT_MAJOR, "input");
733 768 fail2: input_proc_exit();
734static int __init input_init(void) 769 fail1: class_destroy(input_class);
735{ 770 return err;
736 int retval = -ENOMEM;
737
738 input_class = class_create(THIS_MODULE, "input");
739 if (IS_ERR(input_class))
740 return PTR_ERR(input_class);
741 input_proc_init();
742 retval = register_chrdev(INPUT_MAJOR, "input", &input_fops);
743 if (retval) {
744 printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR);
745 remove_proc_entry("devices", proc_bus_input_dir);
746 remove_proc_entry("handlers", proc_bus_input_dir);
747 remove_proc_entry("input", proc_bus);
748 class_destroy(input_class);
749 return retval;
750 }
751
752 retval = devfs_mk_dir("input");
753 if (retval) {
754 remove_proc_entry("devices", proc_bus_input_dir);
755 remove_proc_entry("handlers", proc_bus_input_dir);
756 remove_proc_entry("input", proc_bus);
757 unregister_chrdev(INPUT_MAJOR, "input");
758 class_destroy(input_class);
759 }
760 return retval;
761} 771}
762 772
763static void __exit input_exit(void) 773static void __exit input_exit(void)
764{ 774{
765 remove_proc_entry("devices", proc_bus_input_dir); 775 input_proc_exit();
766 remove_proc_entry("handlers", proc_bus_input_dir);
767 remove_proc_entry("input", proc_bus);
768
769 devfs_remove("input"); 776 devfs_remove("input");
770 unregister_chrdev(INPUT_MAJOR, "input"); 777 unregister_chrdev(INPUT_MAJOR, "input");
771 class_destroy(input_class); 778 class_destroy(input_class);
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index ff8e1bbd0e1..e0938d1d3ad 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -37,8 +37,6 @@ MODULE_LICENSE("GPL");
37#define JOYDEV_MINORS 16 37#define JOYDEV_MINORS 16
38#define JOYDEV_BUFFER_SIZE 64 38#define JOYDEV_BUFFER_SIZE 64
39 39
40#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ)
41
42struct joydev { 40struct joydev {
43 int exist; 41 int exist;
44 int open; 42 int open;
@@ -117,7 +115,7 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne
117 return; 115 return;
118 } 116 }
119 117
120 event.time = MSECS(jiffies); 118 event.time = jiffies_to_msecs(jiffies);
121 119
122 list_for_each_entry(list, &joydev->list, node) { 120 list_for_each_entry(list, &joydev->list, node) {
123 121
@@ -245,7 +243,7 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo
245 243
246 struct js_event event; 244 struct js_event event;
247 245
248 event.time = MSECS(jiffies); 246 event.time = jiffies_to_msecs(jiffies);
249 247
250 if (list->startup < joydev->nkey) { 248 if (list->startup < joydev->nkey) {
251 event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; 249 event.type = JS_EVENT_BUTTON | JS_EVENT_INIT;
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 98710997aaa..d5c5b32045a 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -36,16 +36,6 @@
36#include <linux/miscdevice.h> 36#include <linux/miscdevice.h>
37#include <linux/uinput.h> 37#include <linux/uinput.h>
38 38
39static int uinput_dev_open(struct input_dev *dev)
40{
41 return 0;
42}
43
44static void uinput_dev_close(struct input_dev *dev)
45{
46
47}
48
49static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 39static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
50{ 40{
51 struct uinput_device *udev; 41 struct uinput_device *udev;
@@ -63,22 +53,24 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i
63 return 0; 53 return 0;
64} 54}
65 55
66static int uinput_request_alloc_id(struct input_dev *dev, struct uinput_request *request) 56static int uinput_request_alloc_id(struct uinput_device *udev, struct uinput_request *request)
67{ 57{
68 /* Atomically allocate an ID for the given request. Returns 0 on success. */ 58 /* Atomically allocate an ID for the given request. Returns 0 on success. */
69 struct uinput_device *udev = dev->private;
70 int id; 59 int id;
60 int err = -1;
61
62 spin_lock(&udev->requests_lock);
71 63
72 down(&udev->requests_sem); 64 for (id = 0; id < UINPUT_NUM_REQUESTS; id++)
73 for (id=0; id<UINPUT_NUM_REQUESTS; id++)
74 if (!udev->requests[id]) { 65 if (!udev->requests[id]) {
75 udev->requests[id] = request;
76 request->id = id; 66 request->id = id;
77 up(&udev->requests_sem); 67 udev->requests[id] = request;
78 return 0; 68 err = 0;
69 break;
79 } 70 }
80 up(&udev->requests_sem); 71
81 return -1; 72 spin_unlock(&udev->requests_lock);
73 return err;
82} 74}
83 75
84static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id) 76static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id)
@@ -86,70 +78,78 @@ static struct uinput_request* uinput_request_find(struct uinput_device *udev, in
86 /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ 78 /* Find an input request, by ID. Returns NULL if the ID isn't valid. */
87 if (id >= UINPUT_NUM_REQUESTS || id < 0) 79 if (id >= UINPUT_NUM_REQUESTS || id < 0)
88 return NULL; 80 return NULL;
89 if (udev->requests[id]->completed)
90 return NULL;
91 return udev->requests[id]; 81 return udev->requests[id];
92} 82}
93 83
94static void uinput_request_init(struct input_dev *dev, struct uinput_request *request, int code) 84static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct uinput_request *request)
95{ 85{
96 struct uinput_device *udev = dev->private; 86 /* Allocate slot. If none are available right away, wait. */
87 return wait_event_interruptible(udev->requests_waitq,
88 !uinput_request_alloc_id(udev, request));
89}
97 90
98 memset(request, 0, sizeof(struct uinput_request)); 91static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request)
99 request->code = code; 92{
100 init_waitqueue_head(&request->waitq); 93 complete(&request->done);
101 94
102 /* Allocate an ID. If none are available right away, wait. */ 95 /* Mark slot as available */
103 request->retval = wait_event_interruptible(udev->requests_waitq, 96 udev->requests[request->id] = NULL;
104 !uinput_request_alloc_id(dev, request)); 97 wake_up_interruptible(&udev->requests_waitq);
105} 98}
106 99
107static void uinput_request_submit(struct input_dev *dev, struct uinput_request *request) 100static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request)
108{ 101{
109 struct uinput_device *udev = dev->private;
110 int retval; 102 int retval;
111 103
112 /* Tell our userspace app about this new request by queueing an input event */ 104 /* Tell our userspace app about this new request by queueing an input event */
113 uinput_dev_event(dev, EV_UINPUT, request->code, request->id); 105 uinput_dev_event(dev, EV_UINPUT, request->code, request->id);
114 106
115 /* Wait for the request to complete */ 107 /* Wait for the request to complete */
116 retval = wait_event_interruptible(request->waitq, request->completed); 108 retval = wait_for_completion_interruptible(&request->done);
117 if (retval) 109 if (!retval)
118 request->retval = retval; 110 retval = request->retval;
119 111
120 /* Release this request's ID, let others know it's available */ 112 return retval;
121 udev->requests[request->id] = NULL;
122 wake_up_interruptible(&udev->requests_waitq);
123} 113}
124 114
125static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) 115static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect)
126{ 116{
127 struct uinput_request request; 117 struct uinput_request request;
118 int retval;
128 119
129 if (!test_bit(EV_FF, dev->evbit)) 120 if (!test_bit(EV_FF, dev->evbit))
130 return -ENOSYS; 121 return -ENOSYS;
131 122
132 uinput_request_init(dev, &request, UI_FF_UPLOAD); 123 request.id = -1;
133 if (request.retval) 124 init_completion(&request.done);
134 return request.retval; 125 request.code = UI_FF_UPLOAD;
135 request.u.effect = effect; 126 request.u.effect = effect;
136 uinput_request_submit(dev, &request); 127
137 return request.retval; 128 retval = uinput_request_reserve_slot(dev->private, &request);
129 if (!retval)
130 retval = uinput_request_submit(dev, &request);
131
132 return retval;
138} 133}
139 134
140static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) 135static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
141{ 136{
142 struct uinput_request request; 137 struct uinput_request request;
138 int retval;
143 139
144 if (!test_bit(EV_FF, dev->evbit)) 140 if (!test_bit(EV_FF, dev->evbit))
145 return -ENOSYS; 141 return -ENOSYS;
146 142
147 uinput_request_init(dev, &request, UI_FF_ERASE); 143 request.id = -1;
148 if (request.retval) 144 init_completion(&request.done);
149 return request.retval; 145 request.code = UI_FF_ERASE;
150 request.u.effect_id = effect_id; 146 request.u.effect_id = effect_id;
151 uinput_request_submit(dev, &request); 147
152 return request.retval; 148 retval = uinput_request_reserve_slot(dev->private, &request);
149 if (!retval)
150 retval = uinput_request_submit(dev, &request);
151
152 return retval;
153} 153}
154 154
155static int uinput_create_device(struct uinput_device *udev) 155static int uinput_create_device(struct uinput_device *udev)
@@ -159,32 +159,30 @@ static int uinput_create_device(struct uinput_device *udev)
159 return -EINVAL; 159 return -EINVAL;
160 } 160 }
161 161
162 udev->dev->open = uinput_dev_open;
163 udev->dev->close = uinput_dev_close;
164 udev->dev->event = uinput_dev_event; 162 udev->dev->event = uinput_dev_event;
165 udev->dev->upload_effect = uinput_dev_upload_effect; 163 udev->dev->upload_effect = uinput_dev_upload_effect;
166 udev->dev->erase_effect = uinput_dev_erase_effect; 164 udev->dev->erase_effect = uinput_dev_erase_effect;
167 udev->dev->private = udev; 165 udev->dev->private = udev;
168 166
169 init_waitqueue_head(&(udev->waitq)); 167 init_waitqueue_head(&udev->waitq);
170 168
171 input_register_device(udev->dev); 169 input_register_device(udev->dev);
172 170
173 set_bit(UIST_CREATED, &(udev->state)); 171 set_bit(UIST_CREATED, &udev->state);
174 172
175 return 0; 173 return 0;
176} 174}
177 175
178static int uinput_destroy_device(struct uinput_device *udev) 176static int uinput_destroy_device(struct uinput_device *udev)
179{ 177{
180 if (!test_bit(UIST_CREATED, &(udev->state))) { 178 if (!test_bit(UIST_CREATED, &udev->state)) {
181 printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); 179 printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME);
182 return -EINVAL; 180 return -EINVAL;
183 } 181 }
184 182
185 input_unregister_device(udev->dev); 183 input_unregister_device(udev->dev);
186 184
187 clear_bit(UIST_CREATED, &(udev->state)); 185 clear_bit(UIST_CREATED, &udev->state);
188 186
189 return 0; 187 return 0;
190} 188}
@@ -198,7 +196,7 @@ static int uinput_open(struct inode *inode, struct file *file)
198 if (!newdev) 196 if (!newdev)
199 goto error; 197 goto error;
200 memset(newdev, 0, sizeof(struct uinput_device)); 198 memset(newdev, 0, sizeof(struct uinput_device));
201 init_MUTEX(&newdev->requests_sem); 199 spin_lock_init(&newdev->requests_lock);
202 init_waitqueue_head(&newdev->requests_waitq); 200 init_waitqueue_head(&newdev->requests_waitq);
203 201
204 newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); 202 newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL);
@@ -253,15 +251,16 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz
253 struct uinput_user_dev *user_dev; 251 struct uinput_user_dev *user_dev;
254 struct input_dev *dev; 252 struct input_dev *dev;
255 struct uinput_device *udev; 253 struct uinput_device *udev;
256 int size, 254 char *name;
257 retval; 255 int size;
256 int retval;
258 257
259 retval = count; 258 retval = count;
260 259
261 udev = file->private_data; 260 udev = file->private_data;
262 dev = udev->dev; 261 dev = udev->dev;
263 262
264 user_dev = kmalloc(sizeof(*user_dev), GFP_KERNEL); 263 user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL);
265 if (!user_dev) { 264 if (!user_dev) {
266 retval = -ENOMEM; 265 retval = -ENOMEM;
267 goto exit; 266 goto exit;
@@ -272,17 +271,17 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz
272 goto exit; 271 goto exit;
273 } 272 }
274 273
275 if (NULL != dev->name) 274 if (dev->name)
276 kfree(dev->name); 275 kfree(dev->name);
277 276
278 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; 277 size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1;
279 dev->name = kmalloc(size, GFP_KERNEL); 278 dev->name = name = kmalloc(size, GFP_KERNEL);
280 if (!dev->name) { 279 if (!name) {
281 retval = -ENOMEM; 280 retval = -ENOMEM;
282 goto exit; 281 goto exit;
283 } 282 }
283 strlcpy(name, user_dev->name, size);
284 284
285 strlcpy(dev->name, user_dev->name, size);
286 dev->id.bustype = user_dev->id.bustype; 285 dev->id.bustype = user_dev->id.bustype;
287 dev->id.vendor = user_dev->id.vendor; 286 dev->id.vendor = user_dev->id.vendor;
288 dev->id.product = user_dev->id.product; 287 dev->id.product = user_dev->id.product;
@@ -314,14 +313,13 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t
314{ 313{
315 struct uinput_device *udev = file->private_data; 314 struct uinput_device *udev = file->private_data;
316 315
317 if (test_bit(UIST_CREATED, &(udev->state))) { 316 if (test_bit(UIST_CREATED, &udev->state)) {
318 struct input_event ev; 317 struct input_event ev;
319 318
320 if (copy_from_user(&ev, buffer, sizeof(struct input_event))) 319 if (copy_from_user(&ev, buffer, sizeof(struct input_event)))
321 return -EFAULT; 320 return -EFAULT;
322 input_event(udev->dev, ev.type, ev.code, ev.value); 321 input_event(udev->dev, ev.type, ev.code, ev.value);
323 } 322 } else
324 else
325 count = uinput_alloc_device(file, buffer, count); 323 count = uinput_alloc_device(file, buffer, count);
326 324
327 return count; 325 return count;
@@ -332,26 +330,24 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count,
332 struct uinput_device *udev = file->private_data; 330 struct uinput_device *udev = file->private_data;
333 int retval = 0; 331 int retval = 0;
334 332
335 if (!test_bit(UIST_CREATED, &(udev->state))) 333 if (!test_bit(UIST_CREATED, &udev->state))
336 return -ENODEV; 334 return -ENODEV;
337 335
338 if ((udev->head == udev->tail) && (file->f_flags & O_NONBLOCK)) 336 if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK))
339 return -EAGAIN; 337 return -EAGAIN;
340 338
341 retval = wait_event_interruptible(udev->waitq, 339 retval = wait_event_interruptible(udev->waitq,
342 (udev->head != udev->tail) || 340 udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state));
343 !test_bit(UIST_CREATED, &(udev->state)));
344
345 if (retval) 341 if (retval)
346 return retval; 342 return retval;
347 343
348 if (!test_bit(UIST_CREATED, &(udev->state))) 344 if (!test_bit(UIST_CREATED, &udev->state))
349 return -ENODEV; 345 return -ENODEV;
350 346
351 while ((udev->head != udev->tail) && 347 while ((udev->head != udev->tail) &&
352 (retval + sizeof(struct input_event) <= count)) { 348 (retval + sizeof(struct input_event) <= count)) {
353 if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), 349 if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event)))
354 sizeof(struct input_event))) return -EFAULT; 350 return -EFAULT;
355 udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; 351 udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE;
356 retval += sizeof(struct input_event); 352 retval += sizeof(struct input_event);
357 } 353 }
@@ -373,12 +369,12 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait)
373 369
374static int uinput_burn_device(struct uinput_device *udev) 370static int uinput_burn_device(struct uinput_device *udev)
375{ 371{
376 if (test_bit(UIST_CREATED, &(udev->state))) 372 if (test_bit(UIST_CREATED, &udev->state))
377 uinput_destroy_device(udev); 373 uinput_destroy_device(udev);
378 374
379 if (NULL != udev->dev->name) 375 if (udev->dev->name)
380 kfree(udev->dev->name); 376 kfree(udev->dev->name);
381 if (NULL != udev->dev->phys) 377 if (udev->dev->phys)
382 kfree(udev->dev->phys); 378 kfree(udev->dev->phys);
383 379
384 kfree(udev->dev); 380 kfree(udev->dev);
@@ -389,7 +385,8 @@ static int uinput_burn_device(struct uinput_device *udev)
389 385
390static int uinput_close(struct inode *inode, struct file *file) 386static int uinput_close(struct inode *inode, struct file *file)
391{ 387{
392 return uinput_burn_device(file->private_data); 388 uinput_burn_device(file->private_data);
389 return 0;
393} 390}
394 391
395static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 392static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -401,6 +398,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
401 struct uinput_ff_erase ff_erase; 398 struct uinput_ff_erase ff_erase;
402 struct uinput_request *req; 399 struct uinput_request *req;
403 int length; 400 int length;
401 char *phys;
404 402
405 udev = file->private_data; 403 udev = file->private_data;
406 404
@@ -415,7 +413,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
415 case UI_SET_SNDBIT: 413 case UI_SET_SNDBIT:
416 case UI_SET_FFBIT: 414 case UI_SET_FFBIT:
417 case UI_SET_PHYS: 415 case UI_SET_PHYS:
418 if (test_bit(UIST_CREATED, &(udev->state))) 416 if (test_bit(UIST_CREATED, &udev->state))
419 return -EINVAL; 417 return -EINVAL;
420 } 418 }
421 419
@@ -498,20 +496,19 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
498 retval = -EFAULT; 496 retval = -EFAULT;
499 break; 497 break;
500 } 498 }
501 if (NULL != udev->dev->phys) 499 kfree(udev->dev->phys);
502 kfree(udev->dev->phys); 500 udev->dev->phys = phys = kmalloc(length, GFP_KERNEL);
503 udev->dev->phys = kmalloc(length, GFP_KERNEL); 501 if (!phys) {
504 if (!udev->dev->phys) {
505 retval = -ENOMEM; 502 retval = -ENOMEM;
506 break; 503 break;
507 } 504 }
508 if (copy_from_user(udev->dev->phys, p, length)) { 505 if (copy_from_user(phys, p, length)) {
509 retval = -EFAULT;
510 kfree(udev->dev->phys);
511 udev->dev->phys = NULL; 506 udev->dev->phys = NULL;
507 kfree(phys);
508 retval = -EFAULT;
512 break; 509 break;
513 } 510 }
514 udev->dev->phys[length-1] = '\0'; 511 phys[length - 1] = '\0';
515 break; 512 break;
516 513
517 case UI_BEGIN_FF_UPLOAD: 514 case UI_BEGIN_FF_UPLOAD:
@@ -520,7 +517,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
520 break; 517 break;
521 } 518 }
522 req = uinput_request_find(udev, ff_up.request_id); 519 req = uinput_request_find(udev, ff_up.request_id);
523 if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { 520 if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) {
524 retval = -EINVAL; 521 retval = -EINVAL;
525 break; 522 break;
526 } 523 }
@@ -538,7 +535,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
538 break; 535 break;
539 } 536 }
540 req = uinput_request_find(udev, ff_erase.request_id); 537 req = uinput_request_find(udev, ff_erase.request_id);
541 if (!(req && req->code==UI_FF_ERASE)) { 538 if (!(req && req->code == UI_FF_ERASE)) {
542 retval = -EINVAL; 539 retval = -EINVAL;
543 break; 540 break;
544 } 541 }
@@ -556,14 +553,13 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
556 break; 553 break;
557 } 554 }
558 req = uinput_request_find(udev, ff_up.request_id); 555 req = uinput_request_find(udev, ff_up.request_id);
559 if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { 556 if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) {
560 retval = -EINVAL; 557 retval = -EINVAL;
561 break; 558 break;
562 } 559 }
563 req->retval = ff_up.retval; 560 req->retval = ff_up.retval;
564 memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect)); 561 memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect));
565 req->completed = 1; 562 uinput_request_done(udev, req);
566 wake_up_interruptible(&req->waitq);
567 break; 563 break;
568 564
569 case UI_END_FF_ERASE: 565 case UI_END_FF_ERASE:
@@ -572,13 +568,12 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
572 break; 568 break;
573 } 569 }
574 req = uinput_request_find(udev, ff_erase.request_id); 570 req = uinput_request_find(udev, ff_erase.request_id);
575 if (!(req && req->code==UI_FF_ERASE)) { 571 if (!(req && req->code == UI_FF_ERASE)) {
576 retval = -EINVAL; 572 retval = -EINVAL;
577 break; 573 break;
578 } 574 }
579 req->retval = ff_erase.retval; 575 req->retval = ff_erase.retval;
580 req->completed = 1; 576 uinput_request_done(udev, req);
581 wake_up_interruptible(&req->waitq);
582 break; 577 break;
583 578
584 default: 579 default:
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index a12e98158a7..0d68e5e0182 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -2,7 +2,7 @@
2 * ALPS touchpad PS/2 mouse driver 2 * ALPS touchpad PS/2 mouse driver
3 * 3 *
4 * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au> 4 * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au>
5 * Copyright (c) 2003 Peter Osterlund <petero2@telia.com> 5 * Copyright (c) 2003-2005 Peter Osterlund <petero2@telia.com>
6 * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> 6 * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru>
7 * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> 7 * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz>
8 * 8 *
@@ -350,7 +350,6 @@ static int alps_tap_mode(struct psmouse *psmouse, int enable)
350static int alps_reconnect(struct psmouse *psmouse) 350static int alps_reconnect(struct psmouse *psmouse)
351{ 351{
352 struct alps_data *priv = psmouse->private; 352 struct alps_data *priv = psmouse->private;
353 unsigned char param[4];
354 int version; 353 int version;
355 354
356 psmouse_reset(psmouse); 355 psmouse_reset(psmouse);
@@ -358,21 +357,20 @@ static int alps_reconnect(struct psmouse *psmouse)
358 if (!(priv->i = alps_get_model(psmouse, &version))) 357 if (!(priv->i = alps_get_model(psmouse, &version)))
359 return -1; 358 return -1;
360 359
361 if (priv->i->flags & ALPS_PASS && alps_passthrough_mode(psmouse, 1)) 360 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
362 return -1; 361 return -1;
363 362
364 if (alps_get_status(psmouse, param)) 363 if (alps_tap_mode(psmouse, 1)) {
364 printk(KERN_WARNING "alps.c: Failed to reenable hardware tapping\n");
365 return -1; 365 return -1;
366 366 }
367 if (!(param[0] & 0x04))
368 alps_tap_mode(psmouse, 1);
369 367
370 if (alps_absolute_mode(psmouse)) { 368 if (alps_absolute_mode(psmouse)) {
371 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); 369 printk(KERN_ERR "alps.c: Failed to reenable absolute mode\n");
372 return -1; 370 return -1;
373 } 371 }
374 372
375 if (priv->i->flags == ALPS_PASS && alps_passthrough_mode(psmouse, 0)) 373 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0))
376 return -1; 374 return -1;
377 375
378 return 0; 376 return 0;
@@ -389,7 +387,6 @@ static void alps_disconnect(struct psmouse *psmouse)
389int alps_init(struct psmouse *psmouse) 387int alps_init(struct psmouse *psmouse)
390{ 388{
391 struct alps_data *priv; 389 struct alps_data *priv;
392 unsigned char param[4];
393 int version; 390 int version;
394 391
395 psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); 392 psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL);
@@ -403,16 +400,8 @@ int alps_init(struct psmouse *psmouse)
403 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) 400 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
404 goto init_fail; 401 goto init_fail;
405 402
406 if (alps_get_status(psmouse, param)) { 403 if (alps_tap_mode(psmouse, 1))
407 printk(KERN_ERR "alps.c: touchpad status report request failed\n"); 404 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
408 goto init_fail;
409 }
410
411 if (param[0] & 0x04) {
412 printk(KERN_INFO "alps.c: Enabling hardware tapping\n");
413 if (alps_tap_mode(psmouse, 1))
414 printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
415 }
416 405
417 if (alps_absolute_mode(psmouse)) { 406 if (alps_absolute_mode(psmouse)) {
418 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); 407 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c
index 5ab1bd7d529..48d2b20d264 100644
--- a/drivers/input/mouse/logips2pp.c
+++ b/drivers/input/mouse/logips2pp.c
@@ -385,8 +385,6 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
385 385
386 if (buttons < 3) 386 if (buttons < 3)
387 clear_bit(BTN_MIDDLE, psmouse->dev.keybit); 387 clear_bit(BTN_MIDDLE, psmouse->dev.keybit);
388 if (buttons < 2)
389 clear_bit(BTN_RIGHT, psmouse->dev.keybit);
390 388
391 if (model_info) 389 if (model_info)
392 ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); 390 ps2pp_set_model_properties(psmouse, model_info, use_ps2pp);
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 19785a6c5ab..2bb2fe78bdc 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -344,6 +344,7 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties)
344 return -1; 344 return -1;
345 345
346 if (set_properties) { 346 if (set_properties) {
347 set_bit(BTN_MIDDLE, psmouse->dev.keybit);
347 set_bit(REL_WHEEL, psmouse->dev.relbit); 348 set_bit(REL_WHEEL, psmouse->dev.relbit);
348 349
349 if (!psmouse->vendor) psmouse->vendor = "Generic"; 350 if (!psmouse->vendor) psmouse->vendor = "Generic";
@@ -376,6 +377,7 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties)
376 return -1; 377 return -1;
377 378
378 if (set_properties) { 379 if (set_properties) {
380 set_bit(BTN_MIDDLE, psmouse->dev.keybit);
379 set_bit(REL_WHEEL, psmouse->dev.relbit); 381 set_bit(REL_WHEEL, psmouse->dev.relbit);
380 set_bit(BTN_SIDE, psmouse->dev.keybit); 382 set_bit(BTN_SIDE, psmouse->dev.keybit);
381 set_bit(BTN_EXTRA, psmouse->dev.keybit); 383 set_bit(BTN_EXTRA, psmouse->dev.keybit);
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 36c721227b6..02930942240 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -219,7 +219,7 @@ static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet
219 serio_interrupt(ptport, packet[1], 0, NULL); 219 serio_interrupt(ptport, packet[1], 0, NULL);
220 serio_interrupt(ptport, packet[4], 0, NULL); 220 serio_interrupt(ptport, packet[4], 0, NULL);
221 serio_interrupt(ptport, packet[5], 0, NULL); 221 serio_interrupt(ptport, packet[5], 0, NULL);
222 if (child->type >= PSMOUSE_GENPS) 222 if (child->pktsize == 4)
223 serio_interrupt(ptport, packet[2], 0, NULL); 223 serio_interrupt(ptport, packet[2], 0, NULL);
224 } else 224 } else
225 serio_interrupt(ptport, packet[1], 0, NULL); 225 serio_interrupt(ptport, packet[1], 0, NULL);
@@ -233,7 +233,7 @@ static void synaptics_pt_activate(struct psmouse *psmouse)
233 233
234 /* adjust the touchpad to child's choice of protocol */ 234 /* adjust the touchpad to child's choice of protocol */
235 if (child) { 235 if (child) {
236 if (child->type >= PSMOUSE_GENPS) 236 if (child->pktsize == 4)
237 priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; 237 priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT;
238 else 238 else
239 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; 239 priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT;
@@ -608,6 +608,13 @@ static struct dmi_system_id toshiba_dmi_table[] = {
608 DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"), 608 DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"),
609 }, 609 },
610 }, 610 },
611 {
612 .ident = "Toshiba Dynabook",
613 .matches = {
614 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
615 DMI_MATCH(DMI_PRODUCT_NAME , "dynabook"),
616 },
617 },
611 { } 618 { }
612}; 619};
613#endif 620#endif
@@ -656,7 +663,8 @@ int synaptics_init(struct psmouse *psmouse)
656 * thye same as rate of standard PS/2 mouse. 663 * thye same as rate of standard PS/2 mouse.
657 */ 664 */
658 if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { 665 if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) {
659 printk(KERN_INFO "synaptics: Toshiba Satellite detected, limiting rate to 40pps.\n"); 666 printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n",
667 dmi_get_system_info(DMI_PRODUCT_NAME));
660 psmouse->rate = 40; 668 psmouse->rate = 40;
661 } 669 }
662#endif 670#endif
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index b3710733b36..98acf170252 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -175,7 +175,7 @@ config SERIO_RAW
175 allocating minor 1 (that historically corresponds to /dev/psaux) 175 allocating minor 1 (that historically corresponds to /dev/psaux)
176 first. To bind this driver to a serio port use sysfs interface: 176 first. To bind this driver to a serio port use sysfs interface:
177 177
178 echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver 178 echo -n "serio_raw" > /sys/bus/serio/devices/serioX/drvctl
179 179
180 To compile this driver as a module, choose M here: the 180 To compile this driver as a module, choose M here: the
181 module will be called serio_raw. 181 module will be called serio_raw.
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 0487ecbb8a4..03877c84e6f 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -131,12 +131,26 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
131 }, 131 },
132 }, 132 },
133 { 133 {
134 .ident = "Fujitsu-Siemens Lifebook T3010",
135 .matches = {
136 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
137 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
138 },
139 },
140 {
134 .ident = "Toshiba P10", 141 .ident = "Toshiba P10",
135 .matches = { 142 .matches = {
136 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 143 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
137 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), 144 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
138 }, 145 },
139 }, 146 },
147 {
148 .ident = "Alienware Sentia",
149 .matches = {
150 DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
151 DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
152 },
153 },
140 { } 154 { }
141}; 155};
142 156
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index a9bf549c8dc..708a1d3beab 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -100,7 +100,7 @@ struct i8042_port {
100static struct i8042_port i8042_ports[I8042_NUM_PORTS] = { 100static struct i8042_port i8042_ports[I8042_NUM_PORTS] = {
101 { 101 {
102 .disable = I8042_CTR_KBDDIS, 102 .disable = I8042_CTR_KBDDIS,
103 .irqen = I8042_CTR_KBDINT, 103 .irqen = I8042_CTR_KBDINT,
104 .mux = -1, 104 .mux = -1,
105 .name = "KBD", 105 .name = "KBD",
106 }, 106 },
@@ -191,41 +191,45 @@ static int i8042_flush(void)
191static int i8042_command(unsigned char *param, int command) 191static int i8042_command(unsigned char *param, int command)
192{ 192{
193 unsigned long flags; 193 unsigned long flags;
194 int retval = 0, i = 0; 194 int i, retval, auxerr = 0;
195 195
196 if (i8042_noloop && command == I8042_CMD_AUX_LOOP) 196 if (i8042_noloop && command == I8042_CMD_AUX_LOOP)
197 return -1; 197 return -1;
198 198
199 spin_lock_irqsave(&i8042_lock, flags); 199 spin_lock_irqsave(&i8042_lock, flags);
200 200
201 retval = i8042_wait_write(); 201 if ((retval = i8042_wait_write()))
202 if (!retval) { 202 goto out;
203 dbg("%02x -> i8042 (command)", command & 0xff); 203
204 i8042_write_command(command & 0xff); 204 dbg("%02x -> i8042 (command)", command & 0xff);
205 i8042_write_command(command & 0xff);
206
207 for (i = 0; i < ((command >> 12) & 0xf); i++) {
208 if ((retval = i8042_wait_write()))
209 goto out;
210 dbg("%02x -> i8042 (parameter)", param[i]);
211 i8042_write_data(param[i]);
205 } 212 }
206 213
207 if (!retval) 214 for (i = 0; i < ((command >> 8) & 0xf); i++) {
208 for (i = 0; i < ((command >> 12) & 0xf); i++) { 215 if ((retval = i8042_wait_read()))
209 if ((retval = i8042_wait_write())) break; 216 goto out;
210 dbg("%02x -> i8042 (parameter)", param[i]);
211 i8042_write_data(param[i]);
212 }
213 217
214 if (!retval) 218 if (command == I8042_CMD_AUX_LOOP &&
215 for (i = 0; i < ((command >> 8) & 0xf); i++) { 219 !(i8042_read_status() & I8042_STR_AUXDATA)) {
216 if ((retval = i8042_wait_read())) break; 220 retval = auxerr = -1;
217 if (i8042_read_status() & I8042_STR_AUXDATA) 221 goto out;
218 param[i] = ~i8042_read_data();
219 else
220 param[i] = i8042_read_data();
221 dbg("%02x <- i8042 (return)", param[i]);
222 } 222 }
223 223
224 spin_unlock_irqrestore(&i8042_lock, flags); 224 param[i] = i8042_read_data();
225 dbg("%02x <- i8042 (return)", param[i]);
226 }
225 227
226 if (retval) 228 if (retval)
227 dbg(" -- i8042 (timeout)"); 229 dbg(" -- i8042 (%s)", auxerr ? "auxerr" : "timeout");
228 230
231 out:
232 spin_unlock_irqrestore(&i8042_lock, flags);
229 return retval; 233 return retval;
230} 234}
231 235
@@ -507,17 +511,17 @@ static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version)
507 */ 511 */
508 512
509 param = 0xf0; 513 param = 0xf0;
510 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0x0f) 514 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0xf0)
511 return -1; 515 return -1;
512 param = mode ? 0x56 : 0xf6; 516 param = mode ? 0x56 : 0xf6;
513 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != (mode ? 0xa9 : 0x09)) 517 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != (mode ? 0x56 : 0xf6))
514 return -1; 518 return -1;
515 param = mode ? 0xa4 : 0xa5; 519 param = mode ? 0xa4 : 0xa5;
516 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == (mode ? 0x5b : 0x5a)) 520 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == (mode ? 0xa4 : 0xa5))
517 return -1; 521 return -1;
518 522
519 if (mux_version) 523 if (mux_version)
520 *mux_version = ~param; 524 *mux_version = param;
521 525
522 return 0; 526 return 0;
523} 527}
@@ -619,7 +623,7 @@ static int __init i8042_check_aux(void)
619 */ 623 */
620 624
621 param = 0x5a; 625 param = 0x5a;
622 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0xa5) { 626 if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0x5a) {
623 627
624/* 628/*
625 * External connection test - filters out AT-soldered PS/2 i8042's 629 * External connection test - filters out AT-soldered PS/2 i8042's
@@ -630,7 +634,7 @@ static int __init i8042_check_aux(void)
630 */ 634 */
631 635
632 if (i8042_command(&param, I8042_CMD_AUX_TEST) 636 if (i8042_command(&param, I8042_CMD_AUX_TEST)
633 || (param && param != 0xfa && param != 0xff)) 637 || (param && param != 0xfa && param != 0xff))
634 return -1; 638 return -1;
635 } 639 }
636 640
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index f367695e69b..edd15db1771 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -389,6 +389,14 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut
389 return sprintf(buf, "%s\n", serio->name); 389 return sprintf(buf, "%s\n", serio->name);
390} 390}
391 391
392static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
393{
394 struct serio *serio = to_serio_port(dev);
395
396 return sprintf(buf, "serio:ty%02Xpr%02Xid%02Xex%02X\n",
397 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
398}
399
392static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) 400static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf)
393{ 401{
394 struct serio *serio = to_serio_port(dev); 402 struct serio *serio = to_serio_port(dev);
@@ -487,6 +495,7 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
487 495
488static struct device_attribute serio_device_attrs[] = { 496static struct device_attribute serio_device_attrs[] = {
489 __ATTR(description, S_IRUGO, serio_show_description, NULL), 497 __ATTR(description, S_IRUGO, serio_show_description, NULL),
498 __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL),
490 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), 499 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver),
491 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), 500 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
492 __ATTR_NULL 501 __ATTR_NULL
@@ -785,36 +794,37 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv)
785 794
786#ifdef CONFIG_HOTPLUG 795#ifdef CONFIG_HOTPLUG
787 796
788#define PUT_ENVP(fmt, val) \ 797#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \
789do { \ 798 do { \
790 envp[i++] = buffer; \ 799 int err = add_hotplug_env_var(envp, num_envp, &i, \
791 length += snprintf(buffer, buffer_size - length, fmt, val); \ 800 buffer, buffer_size, &len, \
792 if (buffer_size - length <= 0 || i >= num_envp) \ 801 fmt, val); \
793 return -ENOMEM; \ 802 if (err) \
794 length++; \ 803 return err; \
795 buffer += length; \ 804 } while (0)
796} while (0) 805
797static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) 806static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
798{ 807{
799 struct serio *serio; 808 struct serio *serio;
800 int i = 0; 809 int i = 0;
801 int length = 0; 810 int len = 0;
802 811
803 if (!dev) 812 if (!dev)
804 return -ENODEV; 813 return -ENODEV;
805 814
806 serio = to_serio_port(dev); 815 serio = to_serio_port(dev);
807 816
808 PUT_ENVP("SERIO_TYPE=%02x", serio->id.type); 817 SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type);
809 PUT_ENVP("SERIO_PROTO=%02x", serio->id.proto); 818 SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto);
810 PUT_ENVP("SERIO_ID=%02x", serio->id.id); 819 SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id);
811 PUT_ENVP("SERIO_EXTRA=%02x", serio->id.extra); 820 SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra);
812 821 SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
822 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
813 envp[i] = NULL; 823 envp[i] = NULL;
814 824
815 return 0; 825 return 0;
816} 826}
817#undef PUT_ENVP 827#undef SERIO_ADD_HOTPLUG_VAR
818 828
819#else 829#else
820 830
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index d914e7e93db..47e08de18d0 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -299,6 +299,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv)
299 299
300 serio_raw->dev.minor = PSMOUSE_MINOR; 300 serio_raw->dev.minor = PSMOUSE_MINOR;
301 serio_raw->dev.name = serio_raw->name; 301 serio_raw->dev.name = serio_raw->name;
302 serio_raw->dev.dev = &serio->dev;
302 serio_raw->dev.fops = &serio_raw_fops; 303 serio_raw->dev.fops = &serio_raw_fops;
303 304
304 err = misc_register(&serio_raw->dev); 305 err = misc_register(&serio_raw->dev);
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 7e991274ea4..0489af5a80c 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -58,7 +58,7 @@ config TOUCHSCREEN_ELO
58 If unsure, say N. 58 If unsure, say N.
59 59
60 To compile this driver as a module, choose M here: the 60 To compile this driver as a module, choose M here: the
61 module will be called gunze. 61 module will be called elo.
62 62
63config TOUCHSCREEN_MTOUCH 63config TOUCHSCREEN_MTOUCH
64 tristate "MicroTouch serial touchscreens" 64 tristate "MicroTouch serial touchscreens"
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index a5a4c0ed8a1..a6d3baa46f6 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -869,11 +869,17 @@ static void suspend_targets(struct dm_table *t, unsigned postsuspend)
869 869
870void dm_table_presuspend_targets(struct dm_table *t) 870void dm_table_presuspend_targets(struct dm_table *t)
871{ 871{
872 if (!t)
873 return;
874
872 return suspend_targets(t, 0); 875 return suspend_targets(t, 0);
873} 876}
874 877
875void dm_table_postsuspend_targets(struct dm_table *t) 878void dm_table_postsuspend_targets(struct dm_table *t)
876{ 879{
880 if (!t)
881 return;
882
877 return suspend_targets(t, 1); 883 return suspend_targets(t, 1);
878} 884}
879 885
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 54fabbf0667..d487d9deb98 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -55,10 +55,10 @@ union map_info *dm_get_mapinfo(struct bio *bio)
55 */ 55 */
56#define DMF_BLOCK_IO 0 56#define DMF_BLOCK_IO 0
57#define DMF_SUSPENDED 1 57#define DMF_SUSPENDED 1
58#define DMF_FS_LOCKED 2
59 58
60struct mapped_device { 59struct mapped_device {
61 struct rw_semaphore lock; 60 struct rw_semaphore io_lock;
61 struct semaphore suspend_lock;
62 rwlock_t map_lock; 62 rwlock_t map_lock;
63 atomic_t holders; 63 atomic_t holders;
64 64
@@ -248,16 +248,16 @@ static inline void free_tio(struct mapped_device *md, struct target_io *tio)
248 */ 248 */
249static int queue_io(struct mapped_device *md, struct bio *bio) 249static int queue_io(struct mapped_device *md, struct bio *bio)
250{ 250{
251 down_write(&md->lock); 251 down_write(&md->io_lock);
252 252
253 if (!test_bit(DMF_BLOCK_IO, &md->flags)) { 253 if (!test_bit(DMF_BLOCK_IO, &md->flags)) {
254 up_write(&md->lock); 254 up_write(&md->io_lock);
255 return 1; 255 return 1;
256 } 256 }
257 257
258 bio_list_add(&md->deferred, bio); 258 bio_list_add(&md->deferred, bio);
259 259
260 up_write(&md->lock); 260 up_write(&md->io_lock);
261 return 0; /* deferred successfully */ 261 return 0; /* deferred successfully */
262} 262}
263 263
@@ -568,14 +568,14 @@ static int dm_request(request_queue_t *q, struct bio *bio)
568 int r; 568 int r;
569 struct mapped_device *md = q->queuedata; 569 struct mapped_device *md = q->queuedata;
570 570
571 down_read(&md->lock); 571 down_read(&md->io_lock);
572 572
573 /* 573 /*
574 * If we're suspended we have to queue 574 * If we're suspended we have to queue
575 * this io for later. 575 * this io for later.
576 */ 576 */
577 while (test_bit(DMF_BLOCK_IO, &md->flags)) { 577 while (test_bit(DMF_BLOCK_IO, &md->flags)) {
578 up_read(&md->lock); 578 up_read(&md->io_lock);
579 579
580 if (bio_rw(bio) == READA) { 580 if (bio_rw(bio) == READA) {
581 bio_io_error(bio, bio->bi_size); 581 bio_io_error(bio, bio->bi_size);
@@ -594,11 +594,11 @@ static int dm_request(request_queue_t *q, struct bio *bio)
594 * We're in a while loop, because someone could suspend 594 * We're in a while loop, because someone could suspend
595 * before we get to the following read lock. 595 * before we get to the following read lock.
596 */ 596 */
597 down_read(&md->lock); 597 down_read(&md->io_lock);
598 } 598 }
599 599
600 __split_bio(md, bio); 600 __split_bio(md, bio);
601 up_read(&md->lock); 601 up_read(&md->io_lock);
602 return 0; 602 return 0;
603} 603}
604 604
@@ -610,7 +610,7 @@ static int dm_flush_all(request_queue_t *q, struct gendisk *disk,
610 int ret = -ENXIO; 610 int ret = -ENXIO;
611 611
612 if (map) { 612 if (map) {
613 ret = dm_table_flush_all(md->map); 613 ret = dm_table_flush_all(map);
614 dm_table_put(map); 614 dm_table_put(map);
615 } 615 }
616 616
@@ -747,7 +747,8 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
747 goto bad1; 747 goto bad1;
748 748
749 memset(md, 0, sizeof(*md)); 749 memset(md, 0, sizeof(*md));
750 init_rwsem(&md->lock); 750 init_rwsem(&md->io_lock);
751 init_MUTEX(&md->suspend_lock);
751 rwlock_init(&md->map_lock); 752 rwlock_init(&md->map_lock);
752 atomic_set(&md->holders, 1); 753 atomic_set(&md->holders, 1);
753 atomic_set(&md->event_nr, 0); 754 atomic_set(&md->event_nr, 0);
@@ -825,18 +826,13 @@ static void event_callback(void *context)
825 wake_up(&md->eventq); 826 wake_up(&md->eventq);
826} 827}
827 828
828static void __set_size(struct gendisk *disk, sector_t size) 829static void __set_size(struct mapped_device *md, sector_t size)
829{ 830{
830 struct block_device *bdev; 831 set_capacity(md->disk, size);
831 832
832 set_capacity(disk, size); 833 down(&md->frozen_bdev->bd_inode->i_sem);
833 bdev = bdget_disk(disk, 0); 834 i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
834 if (bdev) { 835 up(&md->frozen_bdev->bd_inode->i_sem);
835 down(&bdev->bd_inode->i_sem);
836 i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
837 up(&bdev->bd_inode->i_sem);
838 bdput(bdev);
839 }
840} 836}
841 837
842static int __bind(struct mapped_device *md, struct dm_table *t) 838static int __bind(struct mapped_device *md, struct dm_table *t)
@@ -845,17 +841,18 @@ static int __bind(struct mapped_device *md, struct dm_table *t)
845 sector_t size; 841 sector_t size;
846 842
847 size = dm_table_get_size(t); 843 size = dm_table_get_size(t);
848 __set_size(md->disk, size); 844 __set_size(md, size);
849 if (size == 0) 845 if (size == 0)
850 return 0; 846 return 0;
851 847
848 dm_table_get(t);
849 dm_table_event_callback(t, event_callback, md);
850
852 write_lock(&md->map_lock); 851 write_lock(&md->map_lock);
853 md->map = t; 852 md->map = t;
853 dm_table_set_restrictions(t, q);
854 write_unlock(&md->map_lock); 854 write_unlock(&md->map_lock);
855 855
856 dm_table_get(t);
857 dm_table_event_callback(md->map, event_callback, md);
858 dm_table_set_restrictions(t, q);
859 return 0; 856 return 0;
860} 857}
861 858
@@ -935,7 +932,7 @@ void dm_put(struct mapped_device *md)
935 struct dm_table *map = dm_get_table(md); 932 struct dm_table *map = dm_get_table(md);
936 933
937 if (atomic_dec_and_test(&md->holders)) { 934 if (atomic_dec_and_test(&md->holders)) {
938 if (!test_bit(DMF_SUSPENDED, &md->flags) && map) { 935 if (!dm_suspended(md)) {
939 dm_table_presuspend_targets(map); 936 dm_table_presuspend_targets(map);
940 dm_table_postsuspend_targets(map); 937 dm_table_postsuspend_targets(map);
941 } 938 }
@@ -968,17 +965,17 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table)
968{ 965{
969 int r = -EINVAL; 966 int r = -EINVAL;
970 967
971 down_write(&md->lock); 968 down(&md->suspend_lock);
972 969
973 /* device must be suspended */ 970 /* device must be suspended */
974 if (!test_bit(DMF_SUSPENDED, &md->flags)) 971 if (!dm_suspended(md))
975 goto out; 972 goto out;
976 973
977 __unbind(md); 974 __unbind(md);
978 r = __bind(md, table); 975 r = __bind(md, table);
979 976
980out: 977out:
981 up_write(&md->lock); 978 up(&md->suspend_lock);
982 return r; 979 return r;
983} 980}
984 981
@@ -986,16 +983,13 @@ out:
986 * Functions to lock and unlock any filesystem running on the 983 * Functions to lock and unlock any filesystem running on the
987 * device. 984 * device.
988 */ 985 */
989static int __lock_fs(struct mapped_device *md) 986static int lock_fs(struct mapped_device *md)
990{ 987{
991 int error = -ENOMEM; 988 int r = -ENOMEM;
992
993 if (test_and_set_bit(DMF_FS_LOCKED, &md->flags))
994 return 0;
995 989
996 md->frozen_bdev = bdget_disk(md->disk, 0); 990 md->frozen_bdev = bdget_disk(md->disk, 0);
997 if (!md->frozen_bdev) { 991 if (!md->frozen_bdev) {
998 DMWARN("bdget failed in __lock_fs"); 992 DMWARN("bdget failed in lock_fs");
999 goto out; 993 goto out;
1000 } 994 }
1001 995
@@ -1003,13 +997,13 @@ static int __lock_fs(struct mapped_device *md)
1003 997
1004 md->frozen_sb = freeze_bdev(md->frozen_bdev); 998 md->frozen_sb = freeze_bdev(md->frozen_bdev);
1005 if (IS_ERR(md->frozen_sb)) { 999 if (IS_ERR(md->frozen_sb)) {
1006 error = PTR_ERR(md->frozen_sb); 1000 r = PTR_ERR(md->frozen_sb);
1007 goto out_bdput; 1001 goto out_bdput;
1008 } 1002 }
1009 1003
1010 /* don't bdput right now, we don't want the bdev 1004 /* don't bdput right now, we don't want the bdev
1011 * to go away while it is locked. We'll bdput 1005 * to go away while it is locked. We'll bdput
1012 * in __unlock_fs 1006 * in unlock_fs
1013 */ 1007 */
1014 return 0; 1008 return 0;
1015 1009
@@ -1018,15 +1012,11 @@ out_bdput:
1018 md->frozen_sb = NULL; 1012 md->frozen_sb = NULL;
1019 md->frozen_bdev = NULL; 1013 md->frozen_bdev = NULL;
1020out: 1014out:
1021 clear_bit(DMF_FS_LOCKED, &md->flags); 1015 return r;
1022 return error;
1023} 1016}
1024 1017
1025static void __unlock_fs(struct mapped_device *md) 1018static void unlock_fs(struct mapped_device *md)
1026{ 1019{
1027 if (!test_and_clear_bit(DMF_FS_LOCKED, &md->flags))
1028 return;
1029
1030 thaw_bdev(md->frozen_bdev, md->frozen_sb); 1020 thaw_bdev(md->frozen_bdev, md->frozen_sb);
1031 bdput(md->frozen_bdev); 1021 bdput(md->frozen_bdev);
1032 1022
@@ -1043,50 +1033,37 @@ static void __unlock_fs(struct mapped_device *md)
1043 */ 1033 */
1044int dm_suspend(struct mapped_device *md) 1034int dm_suspend(struct mapped_device *md)
1045{ 1035{
1046 struct dm_table *map; 1036 struct dm_table *map = NULL;
1047 DECLARE_WAITQUEUE(wait, current); 1037 DECLARE_WAITQUEUE(wait, current);
1048 int error = -EINVAL; 1038 int r = -EINVAL;
1049 1039
1050 /* Flush I/O to the device. */ 1040 down(&md->suspend_lock);
1051 down_read(&md->lock); 1041
1052 if (test_bit(DMF_BLOCK_IO, &md->flags)) 1042 if (dm_suspended(md))
1053 goto out_read_unlock; 1043 goto out;
1054 1044
1055 map = dm_get_table(md); 1045 map = dm_get_table(md);
1056 if (map)
1057 /* This does not get reverted if there's an error later. */
1058 dm_table_presuspend_targets(map);
1059 1046
1060 error = __lock_fs(md); 1047 /* This does not get reverted if there's an error later. */
1061 if (error) { 1048 dm_table_presuspend_targets(map);
1062 dm_table_put(map);
1063 goto out_read_unlock;
1064 }
1065 1049
1066 up_read(&md->lock); 1050 /* Flush I/O to the device. */
1051 r = lock_fs(md);
1052 if (r)
1053 goto out;
1067 1054
1068 /* 1055 /*
1069 * First we set the BLOCK_IO flag so no more ios will be mapped. 1056 * First we set the BLOCK_IO flag so no more ios will be mapped.
1070 *
1071 * If the flag is already set we know another thread is trying to
1072 * suspend as well, so we leave the fs locked for this thread.
1073 */ 1057 */
1074 error = -EINVAL; 1058 down_write(&md->io_lock);
1075 down_write(&md->lock); 1059 set_bit(DMF_BLOCK_IO, &md->flags);
1076 if (test_and_set_bit(DMF_BLOCK_IO, &md->flags)) {
1077 if (map)
1078 dm_table_put(map);
1079 goto out_write_unlock;
1080 }
1081 1060
1082 add_wait_queue(&md->wait, &wait); 1061 add_wait_queue(&md->wait, &wait);
1083 up_write(&md->lock); 1062 up_write(&md->io_lock);
1084 1063
1085 /* unplug */ 1064 /* unplug */
1086 if (map) { 1065 if (map)
1087 dm_table_unplug_all(map); 1066 dm_table_unplug_all(map);
1088 dm_table_put(map);
1089 }
1090 1067
1091 /* 1068 /*
1092 * Then we wait for the already mapped ios to 1069 * Then we wait for the already mapped ios to
@@ -1102,62 +1079,67 @@ int dm_suspend(struct mapped_device *md)
1102 } 1079 }
1103 set_current_state(TASK_RUNNING); 1080 set_current_state(TASK_RUNNING);
1104 1081
1105 down_write(&md->lock); 1082 down_write(&md->io_lock);
1106 remove_wait_queue(&md->wait, &wait); 1083 remove_wait_queue(&md->wait, &wait);
1107 1084
1108 /* were we interrupted ? */ 1085 /* were we interrupted ? */
1109 error = -EINTR; 1086 r = -EINTR;
1110 if (atomic_read(&md->pending)) 1087 if (atomic_read(&md->pending)) {
1111 goto out_unfreeze; 1088 up_write(&md->io_lock);
1112 1089 unlock_fs(md);
1113 set_bit(DMF_SUSPENDED, &md->flags); 1090 clear_bit(DMF_BLOCK_IO, &md->flags);
1091 goto out;
1092 }
1093 up_write(&md->io_lock);
1114 1094
1115 map = dm_get_table(md); 1095 dm_table_postsuspend_targets(map);
1116 if (map)
1117 dm_table_postsuspend_targets(map);
1118 dm_table_put(map);
1119 up_write(&md->lock);
1120 1096
1121 return 0; 1097 set_bit(DMF_SUSPENDED, &md->flags);
1122 1098
1123out_unfreeze: 1099 r = 0;
1124 __unlock_fs(md);
1125 clear_bit(DMF_BLOCK_IO, &md->flags);
1126out_write_unlock:
1127 up_write(&md->lock);
1128 return error;
1129 1100
1130out_read_unlock: 1101out:
1131 up_read(&md->lock); 1102 dm_table_put(map);
1132 return error; 1103 up(&md->suspend_lock);
1104 return r;
1133} 1105}
1134 1106
1135int dm_resume(struct mapped_device *md) 1107int dm_resume(struct mapped_device *md)
1136{ 1108{
1109 int r = -EINVAL;
1137 struct bio *def; 1110 struct bio *def;
1138 struct dm_table *map = dm_get_table(md); 1111 struct dm_table *map = NULL;
1139 1112
1140 down_write(&md->lock); 1113 down(&md->suspend_lock);
1141 if (!map || 1114 if (!dm_suspended(md))
1142 !test_bit(DMF_SUSPENDED, &md->flags) || 1115 goto out;
1143 !dm_table_get_size(map)) { 1116
1144 up_write(&md->lock); 1117 map = dm_get_table(md);
1145 dm_table_put(map); 1118 if (!map || !dm_table_get_size(map))
1146 return -EINVAL; 1119 goto out;
1147 }
1148 1120
1149 dm_table_resume_targets(map); 1121 dm_table_resume_targets(map);
1150 clear_bit(DMF_SUSPENDED, &md->flags); 1122
1123 down_write(&md->io_lock);
1151 clear_bit(DMF_BLOCK_IO, &md->flags); 1124 clear_bit(DMF_BLOCK_IO, &md->flags);
1152 1125
1153 def = bio_list_get(&md->deferred); 1126 def = bio_list_get(&md->deferred);
1154 __flush_deferred_io(md, def); 1127 __flush_deferred_io(md, def);
1155 up_write(&md->lock); 1128 up_write(&md->io_lock);
1156 __unlock_fs(md); 1129
1130 unlock_fs(md);
1131
1132 clear_bit(DMF_SUSPENDED, &md->flags);
1133
1157 dm_table_unplug_all(map); 1134 dm_table_unplug_all(map);
1135
1136 r = 0;
1137
1138out:
1158 dm_table_put(map); 1139 dm_table_put(map);
1140 up(&md->suspend_lock);
1159 1141
1160 return 0; 1142 return r;
1161} 1143}
1162 1144
1163/*----------------------------------------------------------------- 1145/*-----------------------------------------------------------------
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
index b96d6fb1929..2c6dc24c372 100644
--- a/drivers/net/cs89x0.c
+++ b/drivers/net/cs89x0.c
@@ -1450,6 +1450,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
1450 /* Write the contents of the packet */ 1450 /* Write the contents of the packet */
1451 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1); 1451 outsw(dev->base_addr + TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
1452 spin_unlock_irq(&lp->lock); 1452 spin_unlock_irq(&lp->lock);
1453 lp->stats.tx_bytes += skb->len;
1453 dev->trans_start = jiffies; 1454 dev->trans_start = jiffies;
1454 dev_kfree_skb (skb); 1455 dev_kfree_skb (skb);
1455 1456
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cb7f051a60a..5e5d2c3c7ce 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -162,7 +162,6 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
162static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); 162static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
163static void e1000_restore_vlan(struct e1000_adapter *adapter); 163static void e1000_restore_vlan(struct e1000_adapter *adapter);
164 164
165static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
166static int e1000_suspend(struct pci_dev *pdev, uint32_t state); 165static int e1000_suspend(struct pci_dev *pdev, uint32_t state);
167#ifdef CONFIG_PM 166#ifdef CONFIG_PM
168static int e1000_resume(struct pci_dev *pdev); 167static int e1000_resume(struct pci_dev *pdev);
@@ -173,12 +172,6 @@ static int e1000_resume(struct pci_dev *pdev);
173static void e1000_netpoll (struct net_device *netdev); 172static void e1000_netpoll (struct net_device *netdev);
174#endif 173#endif
175 174
176struct notifier_block e1000_notifier_reboot = {
177 .notifier_call = e1000_notify_reboot,
178 .next = NULL,
179 .priority = 0
180};
181
182/* Exported from other modules */ 175/* Exported from other modules */
183 176
184extern void e1000_check_options(struct e1000_adapter *adapter); 177extern void e1000_check_options(struct e1000_adapter *adapter);
@@ -221,9 +214,7 @@ e1000_init_module(void)
221 printk(KERN_INFO "%s\n", e1000_copyright); 214 printk(KERN_INFO "%s\n", e1000_copyright);
222 215
223 ret = pci_module_init(&e1000_driver); 216 ret = pci_module_init(&e1000_driver);
224 if(ret >= 0) { 217
225 register_reboot_notifier(&e1000_notifier_reboot);
226 }
227 return ret; 218 return ret;
228} 219}
229 220
@@ -239,7 +230,6 @@ module_init(e1000_init_module);
239static void __exit 230static void __exit
240e1000_exit_module(void) 231e1000_exit_module(void)
241{ 232{
242 unregister_reboot_notifier(&e1000_notifier_reboot);
243 pci_unregister_driver(&e1000_driver); 233 pci_unregister_driver(&e1000_driver);
244} 234}
245 235
@@ -3652,23 +3642,6 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
3652} 3642}
3653 3643
3654static int 3644static int
3655e1000_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
3656{
3657 struct pci_dev *pdev = NULL;
3658
3659 switch(event) {
3660 case SYS_DOWN:
3661 case SYS_HALT:
3662 case SYS_POWER_OFF:
3663 while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
3664 if(pci_dev_driver(pdev) == &e1000_driver)
3665 e1000_suspend(pdev, 3);
3666 }
3667 }
3668 return NOTIFY_DONE;
3669}
3670
3671static int
3672e1000_suspend(struct pci_dev *pdev, uint32_t state) 3645e1000_suspend(struct pci_dev *pdev, uint32_t state)
3673{ 3646{
3674 struct net_device *netdev = pci_get_drvdata(pdev); 3647 struct net_device *netdev = pci_get_drvdata(pdev);
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index dbb941004ae..980d7e5d66c 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -1671,7 +1671,7 @@ static void set_multicast_list(struct net_device *dev)
1671 1671
1672static struct pcmcia_device_id nmclan_ids[] = { 1672static struct pcmcia_device_id nmclan_ids[] = {
1673 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941), 1673 PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941),
1674 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet", 0x0ebf1d60, 0x00b2e941), 1674 PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet+", 0xebf1d60, 0xad673aaf),
1675 PCMCIA_DEVICE_NULL, 1675 PCMCIA_DEVICE_NULL,
1676}; 1676};
1677MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); 1677MODULE_DEVICE_TABLE(pcmcia, nmclan_ids);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index e1664aef3df..9f22d138e3a 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1639,7 +1639,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1639 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab), 1639 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab),
1640 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101), 1640 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101),
1641 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), 1641 PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab),
1642 PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 1642 PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
1643 PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 1643 PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
1644 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 1644 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
1645 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 1645 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
@@ -1683,7 +1683,6 @@ static struct pcmcia_device_id pcnet_ids[] = {
1683 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11), 1683 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11),
1684 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff), 1684 PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff),
1685 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), 1685 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68),
1686 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM", 0xbb7fbdd7, 0x5ba10d49),
1687 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), 1686 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997),
1688 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), 1687 PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8),
1689 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), 1688 PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96),
@@ -1719,6 +1718,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1719 PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e), 1718 PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e),
1720 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398), 1719 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398),
1721 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b), 1720 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b),
1721 PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660+", 0x1a424a1c, 0x50dcd0ec),
1722 PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), 1722 PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9),
1723 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), 1723 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84),
1724 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), 1724 PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9),
@@ -1737,6 +1737,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1737 PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), 1737 PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947),
1738 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), 1738 PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941),
1739 PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), 1739 PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6),
1740 PCMCIA_DEVICE_PROD_ID12("IC-CARD+", "IC-CARD+", 0x93693494, 0x93693494),
1740 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), 1741 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b),
1741 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), 1742 PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0),
1742 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), 1743 PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956),
@@ -1753,7 +1754,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1753 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), 1754 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d),
1754 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), 1755 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389),
1755 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), 1756 PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9),
1756 PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline ", 0x0733cc81, 0x5e07cfa0), 1757 PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline + 10/100 Network PC Card (PCM100H1)", 0x733cc81, 0x7a3e5c3a),
1757 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), 1758 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737),
1758 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), 1759 PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922),
1759 PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), 1760 PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0),
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 0d8bb4cccbb..d652e1eddb4 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -2332,8 +2332,8 @@ static struct pcmcia_device_id smc91c92_ids[] = {
2332 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef), 2332 PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef),
2333 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 2333 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
2334 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 2334 PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
2335 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2335 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
2336 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2336 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
2337 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020), 2337 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020),
2338 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023), 2338 PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023),
2339 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb), 2339 PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb),
@@ -2343,8 +2343,8 @@ static struct pcmcia_device_id smc91c92_ids[] = {
2343 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9), 2343 PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9),
2344 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953), 2344 PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953),
2345 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a), 2345 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a),
2346 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2346 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Four of Diamonds Ethernet", 0xc2f80cd, 0xb3466314),
2347 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2347 PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard:Seven of Diamonds Ethernet", 0xc2f80cd, 0x194b650a),
2348 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc), 2348 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc),
2349 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9), 2349 PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9),
2350 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d), 2350 PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d),
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 9f33bad174e..ce143f08638 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -1985,7 +1985,7 @@ static struct pcmcia_device_id xirc2ps_ids[] = {
1985 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 1985 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
1986 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 1986 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
1987 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 1987 PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
1988 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 1988 PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
1989 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a), 1989 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a),
1990 PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2), 1990 PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2),
1991 PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37), 1991 PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37),
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
index 368d2f962f6..1cc1492083c 100644
--- a/drivers/net/wireless/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco_cs.c
@@ -621,8 +621,6 @@ static struct pcmcia_device_id orinoco_cs_ids[] = {
621 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), 621 PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021),
622 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), 622 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 623 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
624 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
625 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
626 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 624 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
627 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), 625 PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
628 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), 626 PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index df3bdae2040..93e8a878ea9 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -507,7 +507,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
507 pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); 507 pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses);
508 508
509 if (!is_cardbus) { 509 if (!is_cardbus) {
510 child->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA; 510 child->bridge_ctl = bctl | PCI_BRIDGE_CTL_NO_ISA;
511 /* 511 /*
512 * Adjust subordinate busnr in parent buses. 512 * Adjust subordinate busnr in parent buses.
513 * We do this before scanning for children because 513 * We do this before scanning for children because
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 1521fd5d95c..8d0968bd527 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -820,6 +820,11 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
820 case 0x0001: /* Toshiba Satellite A40 */ 820 case 0x0001: /* Toshiba Satellite A40 */
821 asus_hides_smbus = 1; 821 asus_hides_smbus = 1;
822 } 822 }
823 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
824 switch(dev->subsystem_device) {
825 case 0x0001: /* Toshiba Tecra M2 */
826 asus_hides_smbus = 1;
827 }
823 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { 828 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
824 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 829 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
825 switch(dev->subsystem_device) { 830 switch(dev->subsystem_device) {
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index 838575e3fac..713c78f3a65 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
125 image += readw(pds + 16) * 512; 125 image += readw(pds + 16) * 512;
126 } while (!last_image); 126 } while (!last_image);
127 127
128 *size = image - rom; 128 /* never return a size larger than the PCI resource window */
129 /* there are known ROMs that get the size wrong */
130 *size = min((size_t)(image - rom), *size);
129 131
130 return rom; 132 return rom;
131} 133}
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 9fe48f712be..a2eebc6eaac 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -51,8 +51,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus)
51 struct resource_list head, *list, *tmp; 51 struct resource_list head, *list, *tmp;
52 int idx; 52 int idx;
53 53
54 bus->bridge_ctl &= ~PCI_BRIDGE_CTL_VGA;
55
56 head.next = NULL; 54 head.next = NULL;
57 list_for_each_entry(dev, &bus->devices, bus_list) { 55 list_for_each_entry(dev, &bus->devices, bus_list) {
58 u16 class = dev->class >> 8; 56 u16 class = dev->class >> 8;
@@ -62,10 +60,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus)
62 class == PCI_CLASS_BRIDGE_HOST) 60 class == PCI_CLASS_BRIDGE_HOST)
63 continue; 61 continue;
64 62
65 if (class == PCI_CLASS_DISPLAY_VGA ||
66 class == PCI_CLASS_NOT_DEFINED_VGA)
67 bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
68
69 pdev_sort_resources(dev, &head); 63 pdev_sort_resources(dev, &head);
70 } 64 }
71 65
@@ -509,12 +503,6 @@ pci_bus_assign_resources(struct pci_bus *bus)
509 503
510 pbus_assign_resources_sorted(bus); 504 pbus_assign_resources_sorted(bus);
511 505
512 if (bus->bridge_ctl & PCI_BRIDGE_CTL_VGA) {
513 /* Propagate presence of the VGA to upstream bridges */
514 for (b = bus; b->parent; b = b->parent) {
515 b->bridge_ctl |= PCI_BRIDGE_CTL_VGA;
516 }
517 }
518 list_for_each_entry(dev, &bus->devices, bus_list) { 506 list_for_each_entry(dev, &bus->devices, bus_list) {
519 b = dev->subordinate; 507 b = dev->subordinate;
520 if (!b) 508 if (!b)
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 0a5c95807cf..470ef756252 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -388,6 +388,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
388 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 388 struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
389 memset(skt, 0, sizeof(*skt)); 389 memset(skt, 0, sizeof(*skt));
390 390
391 skt->socket.resource_ops = &pccard_static_ops;
391 skt->socket.ops = &au1x00_pcmcia_operations; 392 skt->socket.ops = &au1x00_pcmcia_operations;
392 skt->socket.owner = ops->owner; 393 skt->socket.owner = ops->owner;
393 skt->socket.dev.dev = dev; 394 skt->socket.dev.dev = dev;
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index dd7651ff5b4..3afb682255a 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -88,31 +88,38 @@ EXPORT_SYMBOL(release_cis_mem);
88static void __iomem * 88static void __iomem *
89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) 89set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
90{ 90{
91 pccard_mem_map *mem = &s->cis_mem; 91 pccard_mem_map *mem = &s->cis_mem;
92 int ret; 92 int ret;
93
94 if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s);
96 if (mem->res == NULL) {
97 printk(KERN_NOTICE "cs: unable to map card memory!\n");
98 return NULL;
99 }
100 s->cis_virt = NULL;
101 }
93 102
94 if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { 103 if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt))
95 mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 104 s->cis_virt = ioremap(mem->res->start, s->map_size);
96 if (mem->res == NULL) { 105
97 printk(KERN_NOTICE "cs: unable to map card memory!\n"); 106 mem->card_start = card_offset;
98 return NULL; 107 mem->flags = flags;
108
109 ret = s->ops->set_mem_map(s, mem);
110 if (ret) {
111 iounmap(s->cis_virt);
112 s->cis_virt = NULL;
113 return NULL;
99 } 114 }
100 s->cis_virt = ioremap(mem->res->start, s->map_size);
101 }
102 mem->card_start = card_offset;
103 mem->flags = flags;
104 ret = s->ops->set_mem_map(s, mem);
105 if (ret) {
106 iounmap(s->cis_virt);
107 return NULL;
108 }
109 115
110 if (s->features & SS_CAP_STATIC_MAP) { 116 if (s->features & SS_CAP_STATIC_MAP) {
111 if (s->cis_virt) 117 if (s->cis_virt)
112 iounmap(s->cis_virt); 118 iounmap(s->cis_virt);
113 s->cis_virt = ioremap(mem->static_start, s->map_size); 119 s->cis_virt = ioremap(mem->static_start, s->map_size);
114 } 120 }
115 return s->cis_virt; 121
122 return s->cis_virt;
116} 123}
117 124
118/*====================================================================== 125/*======================================================================
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 3e3c6f12bbe..d63f22a5bf7 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -206,8 +206,8 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
206 u32 hash; 206 u32 hash;
207 207
208 if (!p_drv->attach || !p_drv->event || !p_drv->detach) 208 if (!p_drv->attach || !p_drv->event || !p_drv->detach)
209 printk(KERN_DEBUG "pcmcia: %s does misses a callback function", 209 printk(KERN_DEBUG "pcmcia: %s lacks a requisite callback "
210 p_drv->drv.name); 210 "function\n", p_drv->drv.name);
211 211
212 while (did && did->match_flags) { 212 while (did && did->match_flags) {
213 for (i=0; i<4; i++) { 213 for (i=0; i<4; i++) {
diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h
index b1f6e3d9ee0..a234ce1967a 100644
--- a/drivers/pcmcia/o2micro.h
+++ b/drivers/pcmcia/o2micro.h
@@ -120,11 +120,16 @@
120#define O2_MODE_E_LED_OUT 0x08 120#define O2_MODE_E_LED_OUT 0x08
121#define O2_MODE_E_SKTA_ACTV 0x10 121#define O2_MODE_E_SKTA_ACTV 0x10
122 122
123#define O2_RESERVED1 0x94
124#define O2_RESERVED2 0xD4
125#define O2_RES_READ_PREFETCH 0x02
126#define O2_RES_WRITE_BURST 0x08
127
123static int o2micro_override(struct yenta_socket *socket) 128static int o2micro_override(struct yenta_socket *socket)
124{ 129{
125 /* 130 /*
126 * 'reserved' register at 0x94/D4. chaning it to 0xCA (8 bit) enables 131 * 'reserved' register at 0x94/D4. allows setting read prefetch and write
127 * read prefetching which for example makes the RME Hammerfall DSP 132 * bursting. read prefetching for example makes the RME Hammerfall DSP
128 * working. for some bridges it is at 0x94, for others at 0xD4. it's 133 * working. for some bridges it is at 0x94, for others at 0xD4. it's
129 * ok to write to both registers on all O2 bridges. 134 * ok to write to both registers on all O2 bridges.
130 * from Eric Still, 02Micro. 135 * from Eric Still, 02Micro.
@@ -132,20 +137,35 @@ static int o2micro_override(struct yenta_socket *socket)
132 u8 a, b; 137 u8 a, b;
133 138
134 if (PCI_FUNC(socket->dev->devfn) == 0) { 139 if (PCI_FUNC(socket->dev->devfn) == 0) {
135 a = config_readb(socket, 0x94); 140 a = config_readb(socket, O2_RESERVED1);
136 b = config_readb(socket, 0xD4); 141 b = config_readb(socket, O2_RESERVED2);
137 142
138 printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b); 143 printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b);
139 144
140 switch (socket->dev->device) { 145 switch (socket->dev->device) {
146 /*
147 * older bridges have problems with both read prefetch and write
148 * bursting depending on the combination of the chipset, bridge
149 * and the cardbus card. so disable them to be on the safe side.
150 */
151 case PCI_DEVICE_ID_O2_6729:
152 case PCI_DEVICE_ID_O2_6730:
153 case PCI_DEVICE_ID_O2_6812:
141 case PCI_DEVICE_ID_O2_6832: 154 case PCI_DEVICE_ID_O2_6832:
142 printk(KERN_INFO "Yenta O2: old bridge, not enabling read prefetch / write burst\n"); 155 case PCI_DEVICE_ID_O2_6836:
156 printk(KERN_INFO "Yenta O2: old bridge, disabling read prefetch/write burst\n");
157 config_writeb(socket, O2_RESERVED1,
158 a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
159 config_writeb(socket, O2_RESERVED2,
160 b & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST));
143 break; 161 break;
144 162
145 default: 163 default:
146 printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n"); 164 printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n");
147 config_writeb(socket, 0x94, a | 0x0a); 165 config_writeb(socket, O2_RESERVED1,
148 config_writeb(socket, 0xD4, b | 0x0a); 166 a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
167 config_writeb(socket, O2_RESERVED2,
168 b | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST);
149 } 169 }
150 } 170 }
151 171
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 184f4f88b2a..6f9fdb27640 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -800,7 +800,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
800 } else { 800 } else {
801 int try; 801 int try;
802 u32 mask = s->irq_mask; 802 u32 mask = s->irq_mask;
803 void *data = NULL; 803 void *data = &p_dev->dev.driver; /* something unique to this device */
804 804
805 for (try = 0; try < 64; try++) { 805 for (try = 0; try < 64; try++) {
806 irq = try % 32; 806 irq = try % 32;
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 9b7f6f548b1..ee7a05e0c3b 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -235,6 +235,9 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
235 sch->schib.pmcw.pam & 235 sch->schib.pmcw.pam &
236 sch->schib.pmcw.pom & 236 sch->schib.pmcw.pom &
237 sch->opm; 237 sch->opm;
238 /* Check since device may again have become not operational. */
239 if (!sch->schib.pmcw.dnv)
240 state = DEV_STATE_NOT_OPER;
238 if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) 241 if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID)
239 /* Force reprobe on all chpids. */ 242 /* Force reprobe on all chpids. */
240 old_lpm = 0; 243 old_lpm = 0;
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 3be54643925..a2cfade2c1c 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -38,6 +38,7 @@ enum {
38 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 38 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
39 ICH5_PMR = 0x90, /* port mapping register */ 39 ICH5_PMR = 0x90, /* port mapping register */
40 ICH5_PCS = 0x92, /* port control and status */ 40 ICH5_PCS = 0x92, /* port control and status */
41 PIIX_SCC = 0x0A, /* sub-class code register */
41 42
42 PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */ 43 PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */
43 PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */ 44 PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */
@@ -62,6 +63,8 @@ enum {
62 ich6_sata_rm = 4, 63 ich6_sata_rm = 4,
63 ich7_sata = 5, 64 ich7_sata = 5,
64 esb2_sata = 6, 65 esb2_sata = 6,
66
67 PIIX_AHCI_DEVICE = 6,
65}; 68};
66 69
67static int piix_init_one (struct pci_dev *pdev, 70static int piix_init_one (struct pci_dev *pdev,
@@ -574,11 +577,11 @@ static int piix_disable_ahci(struct pci_dev *pdev)
574 addr = pci_resource_start(pdev, AHCI_PCI_BAR); 577 addr = pci_resource_start(pdev, AHCI_PCI_BAR);
575 if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) 578 if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR))
576 return 0; 579 return 0;
577 580
578 mmio = ioremap(addr, 64); 581 mmio = ioremap(addr, 64);
579 if (!mmio) 582 if (!mmio)
580 return -ENOMEM; 583 return -ENOMEM;
581 584
582 tmp = readl(mmio + AHCI_GLOBAL_CTL); 585 tmp = readl(mmio + AHCI_GLOBAL_CTL);
583 if (tmp & AHCI_ENABLE) { 586 if (tmp & AHCI_ENABLE) {
584 tmp &= ~AHCI_ENABLE; 587 tmp &= ~AHCI_ENABLE;
@@ -588,7 +591,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
588 if (tmp & AHCI_ENABLE) 591 if (tmp & AHCI_ENABLE)
589 rc = -EIO; 592 rc = -EIO;
590 } 593 }
591 594
592 iounmap(mmio); 595 iounmap(mmio);
593 return rc; 596 return rc;
594} 597}
@@ -626,9 +629,13 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
626 port_info[1] = NULL; 629 port_info[1] = NULL;
627 630
628 if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { 631 if (port_info[0]->host_flags & PIIX_FLAG_AHCI) {
629 int rc = piix_disable_ahci(pdev); 632 u8 tmp;
630 if (rc) 633 pci_read_config_byte(pdev, PIIX_SCC, &tmp);
631 return rc; 634 if (tmp == PIIX_AHCI_DEVICE) {
635 int rc = piix_disable_ahci(pdev);
636 if (rc)
637 return rc;
638 }
632 } 639 }
633 640
634 if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { 641 if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) {
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 18c58fb7389..6b321e82caf 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -394,7 +394,7 @@ static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
394} 394}
395 395
396static int __devinit 396static int __devinit
397serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) 397serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
398{ 398{
399 struct uart_port port; 399 struct uart_port port;
400 int ret, line, flags = dev_id->driver_data; 400 int ret, line, flags = dev_id->driver_data;
@@ -406,15 +406,23 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
406 } 406 }
407 407
408 memset(&port, 0, sizeof(struct uart_port)); 408 memset(&port, 0, sizeof(struct uart_port));
409 port.irq = pnp_irq(dev,0); 409 port.irq = pnp_irq(dev, 0);
410 port.iobase = pnp_port_start(dev, 0); 410 if (pnp_port_valid(dev, 0)) {
411 port.iobase = pnp_port_start(dev, 0);
412 port.iotype = UPIO_PORT;
413 } else if (pnp_mem_valid(dev, 0)) {
414 port.mapbase = pnp_mem_start(dev, 0);
415 port.iotype = UPIO_MEM;
416 port.flags = UPF_IOREMAP;
417 } else
418 return -ENODEV;
411 419
412#ifdef SERIAL_DEBUG_PNP 420#ifdef SERIAL_DEBUG_PNP
413 printk("Setup PNP port: port %x, irq %d, type %d\n", 421 printk("Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n",
414 port.iobase, port.irq, port.iotype); 422 port.iobase, port.mapbase, port.irq, port.iotype);
415#endif 423#endif
416 424
417 port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; 425 port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
418 port.uartclk = 1843200; 426 port.uartclk = 1843200;
419 port.dev = &dev->dev; 427 port.dev = &dev->dev;
420 428
@@ -426,7 +434,7 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
426 434
427} 435}
428 436
429static void __devexit serial_pnp_remove(struct pnp_dev * dev) 437static void __devexit serial_pnp_remove(struct pnp_dev *dev)
430{ 438{
431 long line = (long)pnp_get_drvdata(dev); 439 long line = (long)pnp_get_drvdata(dev);
432 if (line) 440 if (line)
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index de0136cc593..1ae0b381c16 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -790,19 +790,19 @@ static struct pcmcia_device_id serial_ids[] = {
790 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 790 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a),
791 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 791 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29),
792 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 792 PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719),
793 PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 793 PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet + 56K COMBO", 0x578ba6e7, 0xb0ac62c4),
794 PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 794 PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff),
795 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 795 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c),
796 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 796 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae),
797 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 797 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033),
798 PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), 798 PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58),
799 PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 799 PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e),
800 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 800 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Diamonds Modem+Ethernet", 0xc2f80cd, 0x656947b9),
801 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 801 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard:Jack of Hearts Modem+Ethernet", 0xc2f80cd, 0xdc9ba5ed),
802 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), 802 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc),
803 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), 803 PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f),
804 PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed), 804 PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed),
805 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 805 PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf),
806 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), 806 PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070),
807 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), 807 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562),
808 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070), 808 PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070),
@@ -840,7 +840,7 @@ static struct pcmcia_device_id serial_ids[] = {
840 PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed), 840 PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed),
841 PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65), 841 PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65),
842 PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6), 842 PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6),
843 PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400", 0x816cc815, 0x23539b80), 843 PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400+", 0x816cc815, 0x412729fb),
844 PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f), 844 PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f),
845 PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f), 845 PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f),
846 PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383), 846 PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383),
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index cd329dd7fb8..85dacc92545 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -20,6 +20,7 @@ config USB_ARCH_HAS_OHCI
20 default y if SA1111 20 default y if SA1111
21 default y if ARCH_OMAP 21 default y if ARCH_OMAP
22 default y if ARCH_LH7A404 22 default y if ARCH_LH7A404
23 default y if ARCH_S3C2410
23 default y if PXA27x 24 default y if PXA27x
24 # PPC: 25 # PPC:
25 default y if STB03xxx 26 default y if STB03xxx
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index adff5a77e31..16ecad30e29 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -980,6 +980,9 @@ static struct usb_device_id acm_ids[] = {
980 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ 980 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */
981 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 981 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
982 }, 982 },
983 { USB_DEVICE(0x0482, 0x0203), /* KYOCERA AH-K3001V */
984 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
985 },
983 /* control interfaces with various AT-command sets */ 986 /* control interfaces with various AT-command sets */
984 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, 987 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
985 USB_CDC_ACM_PROTO_AT_V25TER) }, 988 USB_CDC_ACM_PROTO_AT_V25TER) },
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 787c27a63c5..f86bf1454e2 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -569,8 +569,11 @@ static int proc_control(struct dev_state *ps, void __user *arg)
569 free_page((unsigned long)tbuf); 569 free_page((unsigned long)tbuf);
570 return -EINVAL; 570 return -EINVAL;
571 } 571 }
572 snoop(&dev->dev, "control read: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", 572 snoop(&dev->dev, "control read: bRequest=%02x "
573 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); 573 "bRrequestType=%02x wValue=%04x "
574 "wIndex=%04x wLength=%04x\n",
575 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue,
576 ctrl.wIndex, ctrl.wLength);
574 577
575 usb_unlock_device(dev); 578 usb_unlock_device(dev);
576 i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, 579 i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType,
@@ -579,11 +582,11 @@ static int proc_control(struct dev_state *ps, void __user *arg)
579 if ((i > 0) && ctrl.wLength) { 582 if ((i > 0) && ctrl.wLength) {
580 if (usbfs_snoop) { 583 if (usbfs_snoop) {
581 dev_info(&dev->dev, "control read: data "); 584 dev_info(&dev->dev, "control read: data ");
582 for (j = 0; j < ctrl.wLength; ++j) 585 for (j = 0; j < i; ++j)
583 printk ("%02x ", (unsigned char)(tbuf)[j]); 586 printk ("%02x ", (unsigned char)(tbuf)[j]);
584 printk("\n"); 587 printk("\n");
585 } 588 }
586 if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) { 589 if (copy_to_user(ctrl.data, tbuf, i)) {
587 free_page((unsigned long)tbuf); 590 free_page((unsigned long)tbuf);
588 return -EFAULT; 591 return -EFAULT;
589 } 592 }
@@ -595,8 +598,11 @@ static int proc_control(struct dev_state *ps, void __user *arg)
595 return -EFAULT; 598 return -EFAULT;
596 } 599 }
597 } 600 }
598 snoop(&dev->dev, "control write: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", 601 snoop(&dev->dev, "control write: bRequest=%02x "
599 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); 602 "bRrequestType=%02x wValue=%04x "
603 "wIndex=%04x wLength=%04x\n",
604 ctrl.bRequest, ctrl.bRequestType, ctrl.wValue,
605 ctrl.wIndex, ctrl.wLength);
600 if (usbfs_snoop) { 606 if (usbfs_snoop) {
601 dev_info(&dev->dev, "control write: data: "); 607 dev_info(&dev->dev, "control write: data: ");
602 for (j = 0; j < ctrl.wLength; ++j) 608 for (j = 0; j < ctrl.wLength; ++j)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8616356f55e..79422a3b07b 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -939,9 +939,9 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount)
939 case USB_SPEED_HIGH: /* ISOC or INTR */ 939 case USB_SPEED_HIGH: /* ISOC or INTR */
940 // FIXME adjust for input vs output 940 // FIXME adjust for input vs output
941 if (isoc) 941 if (isoc)
942 tmp = HS_USECS (bytecount); 942 tmp = HS_NSECS_ISO (bytecount);
943 else 943 else
944 tmp = HS_USECS_ISO (bytecount); 944 tmp = HS_NSECS (bytecount);
945 return tmp; 945 return tmp;
946 default: 946 default:
947 pr_debug ("%s: bogus device speed!\n", usbcore_name); 947 pr_debug ("%s: bogus device speed!\n", usbcore_name);
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 67db4a999b9..28055f95645 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -334,17 +334,19 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb,
334extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); 334extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb);
335 335
336/* 336/*
337 * Ceiling microseconds (typical) for that many bytes at high speed 337 * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
338 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed 338 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
339 * to preallocate bandwidth) 339 * to preallocate bandwidth)
340 */ 340 */
341#define USB2_HOST_DELAY 5 /* nsec, guess */ 341#define USB2_HOST_DELAY 5 /* nsec, guess */
342#define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \ 342#define HS_NSECS(bytes) ( ((55 * 8 * 2083)/1000) \
343 + ((2083UL * (3167 + BitTime (bytes)))/1000) \ 343 + ((2083UL * (3167 + BitTime (bytes)))/1000) \
344 + USB2_HOST_DELAY) 344 + USB2_HOST_DELAY)
345#define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \ 345#define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083)/1000) \
346 + ((2083UL * (3167 + BitTime (bytes)))/1000) \ 346 + ((2083UL * (3167 + BitTime (bytes)))/1000) \
347 + USB2_HOST_DELAY) 347 + USB2_HOST_DELAY)
348#define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes))
349#define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes))
348 350
349extern long usb_calc_bus_time (int speed, int is_input, 351extern long usb_calc_bus_time (int speed, int is_input,
350 int isoc, int bytecount); 352 int isoc, int bytecount);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index a428ef479bd..88d1b376f67 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -985,8 +985,10 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
985 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { 985 for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
986 struct usb_interface *interface; 986 struct usb_interface *interface;
987 987
988 /* remove this interface */ 988 /* remove this interface if it has been registered */
989 interface = dev->actconfig->interface[i]; 989 interface = dev->actconfig->interface[i];
990 if (!klist_node_attached(&interface->dev.knode_bus))
991 continue;
990 dev_dbg (&dev->dev, "unregistering interface %s\n", 992 dev_dbg (&dev->dev, "unregistering interface %s\n",
991 interface->dev.bus_id); 993 interface->dev.bus_id);
992 usb_remove_sysfs_intf_files(interface); 994 usb_remove_sysfs_intf_files(interface);
@@ -1439,7 +1441,7 @@ free_interfaces:
1439 } 1441 }
1440 } 1442 }
1441 1443
1442 return ret; 1444 return 0;
1443} 1445}
1444 1446
1445// synchronous request completion model 1447// synchronous request completion model
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index d74b2d68a50..4f97a4ad1ed 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -657,8 +657,8 @@ qh_make (
657 * For control/bulk requests, the HC or TT handles these. 657 * For control/bulk requests, the HC or TT handles these.
658 */ 658 */
659 if (type == PIPE_INTERRUPT) { 659 if (type == PIPE_INTERRUPT) {
660 qh->usecs = usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, 660 qh->usecs = NS_TO_US (usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0,
661 hb_mult (maxp) * max_packet (maxp)); 661 hb_mult (maxp) * max_packet (maxp)));
662 qh->start = NO_FRAME; 662 qh->start = NO_FRAME;
663 663
664 if (urb->dev->speed == USB_SPEED_HIGH) { 664 if (urb->dev->speed == USB_SPEED_HIGH) {
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 68decab280d..56b43f2a0e5 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -887,6 +887,10 @@ MODULE_LICENSE ("GPL");
887#include "ohci-sa1111.c" 887#include "ohci-sa1111.c"
888#endif 888#endif
889 889
890#ifdef CONFIG_ARCH_S3C2410
891#include "ohci-s3c2410.c"
892#endif
893
890#ifdef CONFIG_ARCH_OMAP 894#ifdef CONFIG_ARCH_OMAP
891#include "ohci-omap.c" 895#include "ohci-omap.c"
892#endif 896#endif
@@ -909,6 +913,7 @@ MODULE_LICENSE ("GPL");
909 913
910#if !(defined(CONFIG_PCI) \ 914#if !(defined(CONFIG_PCI) \
911 || defined(CONFIG_SA1111) \ 915 || defined(CONFIG_SA1111) \
916 || defined(CONFIG_ARCH_S3C2410) \
912 || defined(CONFIG_ARCH_OMAP) \ 917 || defined(CONFIG_ARCH_OMAP) \
913 || defined (CONFIG_ARCH_LH7A404) \ 918 || defined (CONFIG_ARCH_LH7A404) \
914 || defined (CONFIG_PXA27x) \ 919 || defined (CONFIG_PXA27x) \
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
new file mode 100644
index 00000000000..e9401662503
--- /dev/null
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -0,0 +1,496 @@
1/*
2 * OHCI HCD (Host Controller Driver) for USB.
3 *
4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
5 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
6 * (C) Copyright 2002 Hewlett-Packard Company
7 *
8 * USB Bus Glue for Samsung S3C2410
9 *
10 * Written by Christopher Hoover <ch@hpl.hp.com>
11 * Based on fragments of previous driver by Rusell King et al.
12 *
13 * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c
14 * by Ben Dooks, <ben@simtec.co.uk>
15 * Copyright (C) 2004 Simtec Electronics
16 *
17 * Thanks to basprog@mail.ru for updates to newer kernels
18 *
19 * This file is licenced under the GPL.
20*/
21
22#include <asm/hardware.h>
23#include <asm/mach-types.h>
24#include <asm/hardware/clock.h>
25#include <asm/arch/usb-control.h>
26
27#define valid_port(idx) ((idx) == 1 || (idx) == 2)
28
29/* clock device associated with the hcd */
30
31static struct clk *clk;
32
33/* forward definitions */
34
35static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc);
36
37/* conversion functions */
38
39struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd)
40{
41 return hcd->self.controller->platform_data;
42}
43
44static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
45{
46 struct s3c2410_hcd_info *info = dev->dev.platform_data;
47
48 dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
49 clk_enable(clk);
50
51 if (info != NULL) {
52 info->hcd = hcd;
53 info->report_oc = s3c2410_hcd_oc;
54
55 if (info->enable_oc != NULL) {
56 (info->enable_oc)(info, 1);
57 }
58 }
59}
60
61static void s3c2410_stop_hc(struct platform_device *dev)
62{
63 struct s3c2410_hcd_info *info = dev->dev.platform_data;
64
65 dev_dbg(&dev->dev, "s3c2410_stop_hc:\n");
66
67 if (info != NULL) {
68 info->report_oc = NULL;
69 info->hcd = NULL;
70
71 if (info->enable_oc != NULL) {
72 (info->enable_oc)(info, 0);
73 }
74 }
75
76 clk_disable(clk);
77}
78
79/* ohci_s3c2410_hub_status_data
80 *
81 * update the status data from the hub with anything that
82 * has been detected by our system
83*/
84
85static int
86ohci_s3c2410_hub_status_data (struct usb_hcd *hcd, char *buf)
87{
88 struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
89 struct s3c2410_hcd_port *port;
90 int orig;
91 int portno;
92
93 orig = ohci_hub_status_data (hcd, buf);
94
95 if (info == NULL)
96 return orig;
97
98 port = &info->port[0];
99
100 /* mark any changed port as changed */
101
102 for (portno = 0; portno < 2; port++, portno++) {
103 if (port->oc_changed == 1 &&
104 port->flags & S3C_HCDFLG_USED) {
105 dev_dbg(hcd->self.controller,
106 "oc change on port %d\n", portno);
107
108 if (orig < 1)
109 orig = 1;
110
111 buf[0] |= 1<<(portno+1);
112 }
113 }
114
115 return orig;
116}
117
118/* s3c2410_usb_set_power
119 *
120 * configure the power on a port, by calling the platform device
121 * routine registered with the platform device
122*/
123
124static void s3c2410_usb_set_power(struct s3c2410_hcd_info *info,
125 int port, int to)
126{
127 if (info == NULL)
128 return;
129
130 if (info->power_control != NULL) {
131 info->port[port-1].power = to;
132 (info->power_control)(port, to);
133 }
134}
135
136/* ohci_s3c2410_hub_control
137 *
138 * look at control requests to the hub, and see if we need
139 * to take any action or over-ride the results from the
140 * request.
141*/
142
143static int ohci_s3c2410_hub_control (
144 struct usb_hcd *hcd,
145 u16 typeReq,
146 u16 wValue,
147 u16 wIndex,
148 char *buf,
149 u16 wLength)
150{
151 struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
152 struct usb_hub_descriptor *desc;
153 int ret = -EINVAL;
154 u32 *data = (u32 *)buf;
155
156 dev_dbg(hcd->self.controller,
157 "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
158 hcd, typeReq, wValue, wIndex, buf, wLength);
159
160 /* if we are only an humble host without any special capabilites
161 * process the request straight away and exit */
162
163 if (info == NULL) {
164 ret = ohci_hub_control(hcd, typeReq, wValue,
165 wIndex, buf, wLength);
166 goto out;
167 }
168
169 /* check the request to see if it needs handling */
170
171 switch (typeReq) {
172 case SetPortFeature:
173 if (wValue == USB_PORT_FEAT_POWER) {
174 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
175 s3c2410_usb_set_power(info, wIndex, 1);
176 goto out;
177 }
178 break;
179
180 case ClearPortFeature:
181 switch (wValue) {
182 case USB_PORT_FEAT_C_OVER_CURRENT:
183 dev_dbg(hcd->self.controller,
184 "ClearPortFeature: C_OVER_CURRENT\n");
185
186 if (valid_port(wIndex)) {
187 info->port[wIndex-1].oc_changed = 0;
188 info->port[wIndex-1].oc_status = 0;
189 }
190
191 goto out;
192
193 case USB_PORT_FEAT_OVER_CURRENT:
194 dev_dbg(hcd->self.controller,
195 "ClearPortFeature: OVER_CURRENT\n");
196
197 if (valid_port(wIndex)) {
198 info->port[wIndex-1].oc_status = 0;
199 }
200
201 goto out;
202
203 case USB_PORT_FEAT_POWER:
204 dev_dbg(hcd->self.controller,
205 "ClearPortFeature: POWER\n");
206
207 if (valid_port(wIndex)) {
208 s3c2410_usb_set_power(info, wIndex, 0);
209 return 0;
210 }
211 }
212 break;
213 }
214
215 ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
216 if (ret)
217 goto out;
218
219 switch (typeReq) {
220 case GetHubDescriptor:
221
222 /* update the hub's descriptor */
223
224 desc = (struct usb_hub_descriptor *)buf;
225
226 if (info->power_control == NULL)
227 return ret;
228
229 dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n",
230 desc->wHubCharacteristics);
231
232 /* remove the old configurations for power-switching, and
233 * over-current protection, and insert our new configuration
234 */
235
236 desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM);
237 desc->wHubCharacteristics |= cpu_to_le16(0x0001);
238
239 if (info->enable_oc) {
240 desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM);
241 desc->wHubCharacteristics |= cpu_to_le16(0x0008|0x0001);
242 }
243
244 dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
245 desc->wHubCharacteristics);
246
247 return ret;
248
249 case GetPortStatus:
250 /* check port status */
251
252 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
253
254 if (valid_port(wIndex)) {
255 if (info->port[wIndex-1].oc_changed) {
256 *data |= cpu_to_le32(RH_PS_OCIC);
257 }
258
259 if (info->port[wIndex-1].oc_status) {
260 *data |= cpu_to_le32(RH_PS_POCI);
261 }
262 }
263 }
264
265 out:
266 return ret;
267}
268
269/* s3c2410_hcd_oc
270 *
271 * handle an over-current report
272*/
273
274static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc)
275{
276 struct s3c2410_hcd_port *port;
277 struct usb_hcd *hcd;
278 unsigned long flags;
279 int portno;
280
281 if (info == NULL)
282 return;
283
284 port = &info->port[0];
285 hcd = info->hcd;
286
287 local_irq_save(flags);
288
289 for (portno = 0; portno < 2; port++, portno++) {
290 if (port_oc & (1<<portno) &&
291 port->flags & S3C_HCDFLG_USED) {
292 port->oc_status = 1;
293 port->oc_changed = 1;
294
295 /* ok, once over-current is detected,
296 the port needs to be powered down */
297 s3c2410_usb_set_power(info, portno+1, 0);
298 }
299 }
300
301 local_irq_restore(flags);
302}
303
304/* may be called without controller electrically present */
305/* may be called with controller, bus, and devices active */
306
307/*
308 * usb_hcd_s3c2410_remove - shutdown processing for HCD
309 * @dev: USB Host Controller being removed
310 * Context: !in_interrupt()
311 *
312 * Reverses the effect of usb_hcd_3c2410_probe(), first invoking
313 * the HCD's stop() method. It is always called from a thread
314 * context, normally "rmmod", "apmd", or something similar.
315 *
316*/
317
318void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev)
319{
320 usb_remove_hcd(hcd);
321 s3c2410_stop_hc(dev);
322 iounmap(hcd->regs);
323 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
324 usb_put_hcd(hcd);
325}
326
327/**
328 * usb_hcd_s3c2410_probe - initialize S3C2410-based HCDs
329 * Context: !in_interrupt()
330 *
331 * Allocates basic resources for this USB host controller, and
332 * then invokes the start() method for the HCD associated with it
333 * through the hotplug entry's driver_data.
334 *
335 */
336int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
337 struct platform_device *dev)
338{
339 struct usb_hcd *hcd = NULL;
340 int retval;
341
342 s3c2410_usb_set_power(dev->dev.platform_data, 0, 1);
343 s3c2410_usb_set_power(dev->dev.platform_data, 1, 1);
344
345 hcd = usb_create_hcd(driver, &dev->dev, "s3c24xx");
346 if (hcd == NULL)
347 return -ENOMEM;
348
349 hcd->rsrc_start = dev->resource[0].start;
350 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
351
352 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
353 dev_err(&dev->dev, "request_mem_region failed");
354 retval = -EBUSY;
355 goto err0;
356 }
357
358 clk = clk_get(NULL, "usb-host");
359 if (IS_ERR(clk)) {
360 dev_err(&dev->dev, "cannot get usb-host clock\n");
361 retval = -ENOENT;
362 goto err1;
363 }
364
365 clk_use(clk);
366 s3c2410_start_hc(dev, hcd);
367
368 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
369 if (!hcd->regs) {
370 dev_err(&dev->dev, "ioremap failed\n");
371 retval = -ENOMEM;
372 goto err2;
373 }
374
375 ohci_hcd_init(hcd_to_ohci(hcd));
376
377 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
378 if (retval != 0)
379 goto err2;
380
381 return 0;
382
383 err2:
384 s3c2410_stop_hc(dev);
385 iounmap(hcd->regs);
386 clk_unuse(clk);
387 clk_put(clk);
388
389 err1:
390 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
391
392 err0:
393 usb_put_hcd(hcd);
394 return retval;
395}
396
397/*-------------------------------------------------------------------------*/
398
399static int
400ohci_s3c2410_start (struct usb_hcd *hcd)
401{
402 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
403 int ret;
404
405 if ((ret = ohci_init(ohci)) < 0)
406 return ret;
407
408 if ((ret = ohci_run (ohci)) < 0) {
409 err ("can't start %s", hcd->self.bus_name);
410 ohci_stop (hcd);
411 return ret;
412 }
413
414 return 0;
415}
416
417
418static const struct hc_driver ohci_s3c2410_hc_driver = {
419 .description = hcd_name,
420 .product_desc = "S3C24XX OHCI",
421 .hcd_priv_size = sizeof(struct ohci_hcd),
422
423 /*
424 * generic hardware linkage
425 */
426 .irq = ohci_irq,
427 .flags = HCD_USB11 | HCD_MEMORY,
428
429 /*
430 * basic lifecycle operations
431 */
432 .start = ohci_s3c2410_start,
433 .stop = ohci_stop,
434
435 /*
436 * managing i/o requests and associated device resources
437 */
438 .urb_enqueue = ohci_urb_enqueue,
439 .urb_dequeue = ohci_urb_dequeue,
440 .endpoint_disable = ohci_endpoint_disable,
441
442 /*
443 * scheduling support
444 */
445 .get_frame_number = ohci_get_frame,
446
447 /*
448 * root hub support
449 */
450 .hub_status_data = ohci_s3c2410_hub_status_data,
451 .hub_control = ohci_s3c2410_hub_control,
452
453#if defined(CONFIG_USB_SUSPEND) && 0
454 .hub_suspend = ohci_hub_suspend,
455 .hub_resume = ohci_hub_resume,
456#endif
457};
458
459/* device driver */
460
461static int ohci_hcd_s3c2410_drv_probe(struct device *dev)
462{
463 struct platform_device *pdev = to_platform_device(dev);
464 return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev);
465}
466
467static int ohci_hcd_s3c2410_drv_remove(struct device *dev)
468{
469 struct platform_device *pdev = to_platform_device(dev);
470 struct usb_hcd *hcd = dev_get_drvdata(dev);
471
472 usb_hcd_s3c2410_remove(hcd, pdev);
473 return 0;
474}
475
476static struct device_driver ohci_hcd_s3c2410_driver = {
477 .name = "s3c2410-ohci",
478 .bus = &platform_bus_type,
479 .probe = ohci_hcd_s3c2410_drv_probe,
480 .remove = ohci_hcd_s3c2410_drv_remove,
481 /*.suspend = ohci_hcd_s3c2410_drv_suspend, */
482 /*.resume = ohci_hcd_s3c2410_drv_resume, */
483};
484
485static int __init ohci_hcd_s3c2410_init (void)
486{
487 return driver_register(&ohci_hcd_s3c2410_driver);
488}
489
490static void __exit ohci_hcd_s3c2410_cleanup (void)
491{
492 driver_unregister(&ohci_hcd_s3c2410_driver);
493}
494
495module_init (ohci_hcd_s3c2410_init);
496module_exit (ohci_hcd_s3c2410_cleanup);
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c
index ebcf7c95580..13532f3e3ef 100644
--- a/drivers/usb/input/acecad.c
+++ b/drivers/usb/input/acecad.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/usb.h> 33#include <linux/usb.h>
34#include <linux/usb_input.h>
34 35
35/* 36/*
36 * Version Information 37 * Version Information
@@ -87,8 +88,8 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs)
87 if (prox) { 88 if (prox) {
88 int x = data[1] | (data[2] << 8); 89 int x = data[1] | (data[2] << 8);
89 int y = data[3] | (data[4] << 8); 90 int y = data[3] | (data[4] << 8);
90 /*Pressure should compute the same way for flair and 302*/ 91 /* Pressure should compute the same way for flair and 302 */
91 int pressure = data[5] | ((int)data[6] << 8); 92 int pressure = data[5] | (data[6] << 8);
92 int touch = data[0] & 0x01; 93 int touch = data[0] & 0x01;
93 int stylus = (data[0] & 0x10) >> 4; 94 int stylus = (data[0] & 0x10) >> 4;
94 int stylus2 = (data[0] & 0x20) >> 5; 95 int stylus2 = (data[0] & 0x20) >> 5;
@@ -104,9 +105,9 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs)
104 input_sync(dev); 105 input_sync(dev);
105 106
106resubmit: 107resubmit:
107 status = usb_submit_urb (urb, GFP_ATOMIC); 108 status = usb_submit_urb(urb, GFP_ATOMIC);
108 if (status) 109 if (status)
109 err ("can't resubmit intr, %s-%s/input0, status %d", 110 err("can't resubmit intr, %s-%s/input0, status %d",
110 acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); 111 acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status);
111} 112}
112 113
@@ -212,10 +213,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
212 213
213 acecad->dev.name = acecad->name; 214 acecad->dev.name = acecad->name;
214 acecad->dev.phys = acecad->phys; 215 acecad->dev.phys = acecad->phys;
215 acecad->dev.id.bustype = BUS_USB; 216 usb_to_input_id(dev, &acecad->dev.id);
216 acecad->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
217 acecad->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
218 acecad->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
219 acecad->dev.dev = &intf->dev; 217 acecad->dev.dev = &intf->dev;
220 218
221 usb_fill_int_urb(acecad->irq, dev, pipe, 219 usb_fill_int_urb(acecad->irq, dev, pipe,
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 6bb0f25e8e9..cd0cbfe2072 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -77,6 +77,7 @@
77#include <linux/module.h> 77#include <linux/module.h>
78#include <linux/init.h> 78#include <linux/init.h>
79#include <linux/usb.h> 79#include <linux/usb.h>
80#include <linux/usb_input.h>
80#include <linux/sched.h> 81#include <linux/sched.h>
81#include <asm/uaccess.h> 82#include <asm/uaccess.h>
82#include <asm/unaligned.h> 83#include <asm/unaligned.h>
@@ -2125,10 +2126,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
2125 aiptek->inputdev.absflat[ABS_WHEEL] = 0; 2126 aiptek->inputdev.absflat[ABS_WHEEL] = 0;
2126 aiptek->inputdev.name = "Aiptek"; 2127 aiptek->inputdev.name = "Aiptek";
2127 aiptek->inputdev.phys = aiptek->features.usbPath; 2128 aiptek->inputdev.phys = aiptek->features.usbPath;
2128 aiptek->inputdev.id.bustype = BUS_USB; 2129 usb_to_input_id(usbdev, &aiptek->inputdev.id);
2129 aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor);
2130 aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct);
2131 aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice);
2132 aiptek->inputdev.dev = &intf->dev; 2130 aiptek->inputdev.dev = &intf->dev;
2133 2131
2134 aiptek->usbdev = usbdev; 2132 aiptek->usbdev = usbdev;
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 654ac454744..fd99681ee48 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -94,6 +94,7 @@
94#include <linux/moduleparam.h> 94#include <linux/moduleparam.h>
95#include <linux/input.h> 95#include <linux/input.h>
96#include <linux/usb.h> 96#include <linux/usb.h>
97#include <linux/usb_input.h>
97#include <linux/wait.h> 98#include <linux/wait.h>
98 99
99/* 100/*
@@ -635,11 +636,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
635 idev->name = ati_remote->name; 636 idev->name = ati_remote->name;
636 idev->phys = ati_remote->phys; 637 idev->phys = ati_remote->phys;
637 638
638 idev->id.bustype = BUS_USB; 639 usb_to_input_id(ati_remote->udev, &idev->id);
639 idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor); 640 idev->dev = &ati_remote->udev->dev;
640 idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct);
641 idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice);
642 idev->dev = &(ati_remote->udev->dev);
643} 641}
644 642
645static int ati_remote_initialize(struct ati_remote *ati_remote) 643static int ati_remote_initialize(struct ati_remote *ati_remote)
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 2350e7a5ad7..b2cb2b35892 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -789,12 +789,12 @@ static __inline__ int search(__s32 *array, __s32 value, unsigned n)
789 return -1; 789 return -1;
790} 790}
791 791
792static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) 792static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs)
793{ 793{
794 hid_dump_input(usage, value); 794 hid_dump_input(usage, value);
795 if (hid->claimed & HID_CLAIMED_INPUT) 795 if (hid->claimed & HID_CLAIMED_INPUT)
796 hidinput_hid_event(hid, field, usage, value, regs); 796 hidinput_hid_event(hid, field, usage, value, regs);
797 if (hid->claimed & HID_CLAIMED_HIDDEV) 797 if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt)
798 hiddev_hid_event(hid, field, usage, value, regs); 798 hiddev_hid_event(hid, field, usage, value, regs);
799} 799}
800 800
@@ -804,7 +804,7 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s
804 * reporting to the layer). 804 * reporting to the layer).
805 */ 805 */
806 806
807static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, struct pt_regs *regs) 807static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt, struct pt_regs *regs)
808{ 808{
809 unsigned n; 809 unsigned n;
810 unsigned count = field->report_count; 810 unsigned count = field->report_count;
@@ -831,19 +831,19 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u
831 for (n = 0; n < count; n++) { 831 for (n = 0; n < count; n++) {
832 832
833 if (HID_MAIN_ITEM_VARIABLE & field->flags) { 833 if (HID_MAIN_ITEM_VARIABLE & field->flags) {
834 hid_process_event(hid, field, &field->usage[n], value[n], regs); 834 hid_process_event(hid, field, &field->usage[n], value[n], interrupt, regs);
835 continue; 835 continue;
836 } 836 }
837 837
838 if (field->value[n] >= min && field->value[n] <= max 838 if (field->value[n] >= min && field->value[n] <= max
839 && field->usage[field->value[n] - min].hid 839 && field->usage[field->value[n] - min].hid
840 && search(value, field->value[n], count)) 840 && search(value, field->value[n], count))
841 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, regs); 841 hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt, regs);
842 842
843 if (value[n] >= min && value[n] <= max 843 if (value[n] >= min && value[n] <= max
844 && field->usage[value[n] - min].hid 844 && field->usage[value[n] - min].hid
845 && search(field->value, value[n], count)) 845 && search(field->value, value[n], count))
846 hid_process_event(hid, field, &field->usage[value[n] - min], 1, regs); 846 hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt, regs);
847 } 847 }
848 848
849 memcpy(field->value, value, count * sizeof(__s32)); 849 memcpy(field->value, value, count * sizeof(__s32));
@@ -851,7 +851,7 @@ exit:
851 kfree(value); 851 kfree(value);
852} 852}
853 853
854static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs) 854static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_regs *regs)
855{ 855{
856 struct hid_device *hid = urb->context; 856 struct hid_device *hid = urb->context;
857 struct hid_report_enum *report_enum = hid->report_enum + type; 857 struct hid_report_enum *report_enum = hid->report_enum + type;
@@ -899,7 +899,7 @@ static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs)
899 hiddev_report_event(hid, report); 899 hiddev_report_event(hid, report);
900 900
901 for (n = 0; n < report->maxfield; n++) 901 for (n = 0; n < report->maxfield; n++)
902 hid_input_field(hid, report->field[n], data, regs); 902 hid_input_field(hid, report->field[n], data, interrupt, regs);
903 903
904 if (hid->claimed & HID_CLAIMED_INPUT) 904 if (hid->claimed & HID_CLAIMED_INPUT)
905 hidinput_report_event(hid, report); 905 hidinput_report_event(hid, report);
@@ -918,7 +918,7 @@ static void hid_irq_in(struct urb *urb, struct pt_regs *regs)
918 918
919 switch (urb->status) { 919 switch (urb->status) {
920 case 0: /* success */ 920 case 0: /* success */
921 hid_input_report(HID_INPUT_REPORT, urb, regs); 921 hid_input_report(HID_INPUT_REPORT, urb, 1, regs);
922 break; 922 break;
923 case -ECONNRESET: /* unlink */ 923 case -ECONNRESET: /* unlink */
924 case -ENOENT: 924 case -ENOENT:
@@ -1142,7 +1142,7 @@ static void hid_ctrl(struct urb *urb, struct pt_regs *regs)
1142 switch (urb->status) { 1142 switch (urb->status) {
1143 case 0: /* success */ 1143 case 0: /* success */
1144 if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) 1144 if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN)
1145 hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); 1145 hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, 0, regs);
1146 case -ESHUTDOWN: /* unplug */ 1146 case -ESHUTDOWN: /* unplug */
1147 case -EILSEQ: /* unplug timectrl on uhci */ 1147 case -EILSEQ: /* unplug timectrl on uhci */
1148 unplug = 1; 1148 unplug = 1;
@@ -1372,6 +1372,9 @@ void hid_init_reports(struct hid_device *hid)
1372#define USB_VENDOR_ID_A4TECH 0x09da 1372#define USB_VENDOR_ID_A4TECH 0x09da
1373#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 1373#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
1374 1374
1375#define USB_VENDOR_ID_AASHIMA 0x06D6
1376#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
1377
1375#define USB_VENDOR_ID_CYPRESS 0x04b4 1378#define USB_VENDOR_ID_CYPRESS 0x04b4
1376#define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 1379#define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001
1377#define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 1380#define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500
@@ -1548,6 +1551,7 @@ static struct hid_blacklist {
1548 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, 1551 { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 },
1549 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, 1552 { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 },
1550 1553
1554 { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD },
1551 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, 1555 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
1552 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, 1556 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
1553 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 1557 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c
index 9ac1e909533..63a4db721f7 100644
--- a/drivers/usb/input/hid-input.c
+++ b/drivers/usb/input/hid-input.c
@@ -31,6 +31,7 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/usb.h> 33#include <linux/usb.h>
34#include <linux/usb_input.h>
34 35
35#undef DEBUG 36#undef DEBUG
36 37
@@ -397,11 +398,12 @@ ignore:
397 398
398void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) 399void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs)
399{ 400{
400 struct input_dev *input = &field->hidinput->input; 401 struct input_dev *input;
401 int *quirks = &hid->quirks; 402 int *quirks = &hid->quirks;
402 403
403 if (!input) 404 if (!field->hidinput)
404 return; 405 return;
406 input = &field->hidinput->input;
405 407
406 input_regs(input, regs); 408 input_regs(input, regs);
407 409
@@ -581,10 +583,7 @@ int hidinput_connect(struct hid_device *hid)
581 hidinput->input.name = hid->name; 583 hidinput->input.name = hid->name;
582 hidinput->input.phys = hid->phys; 584 hidinput->input.phys = hid->phys;
583 hidinput->input.uniq = hid->uniq; 585 hidinput->input.uniq = hid->uniq;
584 hidinput->input.id.bustype = BUS_USB; 586 usb_to_input_id(dev, &hidinput->input.id);
585 hidinput->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
586 hidinput->input.id.product = le16_to_cpu(dev->descriptor.idProduct);
587 hidinput->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
588 hidinput->input.dev = &hid->intf->dev; 587 hidinput->input.dev = &hid->intf->dev;
589 } 588 }
590 589
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c
index 47dec6a1b34..0dc439f1082 100644
--- a/drivers/usb/input/itmtouch.c
+++ b/drivers/usb/input/itmtouch.c
@@ -53,6 +53,7 @@
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/init.h> 54#include <linux/init.h>
55#include <linux/usb.h> 55#include <linux/usb.h>
56#include <linux/usb_input.h>
56 57
57/* only an 8 byte buffer necessary for a single packet */ 58/* only an 8 byte buffer necessary for a single packet */
58#define ITM_BUFSIZE 8 59#define ITM_BUFSIZE 8
@@ -184,10 +185,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
184 185
185 itmtouch->inputdev.name = itmtouch->name; 186 itmtouch->inputdev.name = itmtouch->name;
186 itmtouch->inputdev.phys = itmtouch->phys; 187 itmtouch->inputdev.phys = itmtouch->phys;
187 itmtouch->inputdev.id.bustype = BUS_USB; 188 usb_to_input_id(udev, &itmtouch->inputdev.id);
188 itmtouch->inputdev.id.vendor = udev->descriptor.idVendor;
189 itmtouch->inputdev.id.product = udev->descriptor.idProduct;
190 itmtouch->inputdev.id.version = udev->descriptor.bcdDevice;
191 itmtouch->inputdev.dev = &intf->dev; 189 itmtouch->inputdev.dev = &intf->dev;
192 190
193 if (!strlen(itmtouch->name)) 191 if (!strlen(itmtouch->name))
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c
index d2f0f90a9bc..b6f6ac8d9c2 100644
--- a/drivers/usb/input/kbtab.c
+++ b/drivers/usb/input/kbtab.c
@@ -4,6 +4,7 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/usb.h> 6#include <linux/usb.h>
7#include <linux/usb_input.h>
7#include <asm/unaligned.h> 8#include <asm/unaligned.h>
8#include <asm/byteorder.h> 9#include <asm/byteorder.h>
9 10
@@ -167,10 +168,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
167 168
168 kbtab->dev.name = "KB Gear Tablet"; 169 kbtab->dev.name = "KB Gear Tablet";
169 kbtab->dev.phys = kbtab->phys; 170 kbtab->dev.phys = kbtab->phys;
170 kbtab->dev.id.bustype = BUS_USB; 171 usb_to_input_id(dev, &kbtab->dev.id);
171 kbtab->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
172 kbtab->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
173 kbtab->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
174 kbtab->dev.dev = &intf->dev; 172 kbtab->dev.dev = &intf->dev;
175 kbtab->usbdev = dev; 173 kbtab->usbdev = dev;
176 174
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c
index 09b5cc7c66d..ff9275057a1 100644
--- a/drivers/usb/input/mtouchusb.c
+++ b/drivers/usb/input/mtouchusb.c
@@ -53,6 +53,7 @@
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/init.h> 54#include <linux/init.h>
55#include <linux/usb.h> 55#include <linux/usb.h>
56#include <linux/usb_input.h>
56 57
57#define MTOUCHUSB_MIN_XC 0x0 58#define MTOUCHUSB_MIN_XC 0x0
58#define MTOUCHUSB_MAX_RAW_XC 0x4000 59#define MTOUCHUSB_MAX_RAW_XC 0x4000
@@ -232,10 +233,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
232 233
233 mtouch->input.name = mtouch->name; 234 mtouch->input.name = mtouch->name;
234 mtouch->input.phys = mtouch->phys; 235 mtouch->input.phys = mtouch->phys;
235 mtouch->input.id.bustype = BUS_USB; 236 usb_to_input_id(udev, &mtouch->input.id);
236 mtouch->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
237 mtouch->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
238 mtouch->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
239 mtouch->input.dev = &intf->dev; 237 mtouch->input.dev = &intf->dev;
240 238
241 mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 239 mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
index 3975b309d55..ad4afe7e589 100644
--- a/drivers/usb/input/powermate.c
+++ b/drivers/usb/input/powermate.c
@@ -35,6 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37#include <linux/usb.h> 37#include <linux/usb.h>
38#include <linux/usb_input.h>
38 39
39#define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */ 40#define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */
40#define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */ 41#define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */
@@ -389,10 +390,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
389 pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); 390 pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0);
390 pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); 391 pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL);
391 pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); 392 pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED);
392 pm->input.id.bustype = BUS_USB; 393 usb_to_input_id(udev, &pm->input.id);
393 pm->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
394 pm->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
395 pm->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
396 pm->input.event = powermate_input_event; 394 pm->input.event = powermate_input_event;
397 pm->input.dev = &intf->dev; 395 pm->input.dev = &intf->dev;
398 pm->input.phys = pm->phys; 396 pm->input.phys = pm->phys;
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c
index 386595ee21c..4276c24a508 100644
--- a/drivers/usb/input/touchkitusb.c
+++ b/drivers/usb/input/touchkitusb.c
@@ -35,7 +35,7 @@
35#define DEBUG 35#define DEBUG
36#endif 36#endif
37#include <linux/usb.h> 37#include <linux/usb.h>
38 38#include <linux/usb_input.h>
39 39
40#define TOUCHKIT_MIN_XC 0x0 40#define TOUCHKIT_MIN_XC 0x0
41#define TOUCHKIT_MAX_XC 0x07ff 41#define TOUCHKIT_MAX_XC 0x07ff
@@ -202,10 +202,7 @@ static int touchkit_probe(struct usb_interface *intf,
202 202
203 touchkit->input.name = touchkit->name; 203 touchkit->input.name = touchkit->name;
204 touchkit->input.phys = touchkit->phys; 204 touchkit->input.phys = touchkit->phys;
205 touchkit->input.id.bustype = BUS_USB; 205 usb_to_input_id(udev, &touchkit->input.id);
206 touchkit->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
207 touchkit->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
208 touchkit->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
209 touchkit->input.dev = &intf->dev; 206 touchkit->input.dev = &intf->dev;
210 207
211 touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 208 touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
index f35db1974c4..28987f15eee 100644
--- a/drivers/usb/input/usbkbd.c
+++ b/drivers/usb/input/usbkbd.c
@@ -32,6 +32,7 @@
32#include <linux/input.h> 32#include <linux/input.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/usb.h> 34#include <linux/usb.h>
35#include <linux/usb_input.h>
35 36
36/* 37/*
37 * Version Information 38 * Version Information
@@ -288,10 +289,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
288 289
289 kbd->dev.name = kbd->name; 290 kbd->dev.name = kbd->name;
290 kbd->dev.phys = kbd->phys; 291 kbd->dev.phys = kbd->phys;
291 kbd->dev.id.bustype = BUS_USB; 292 usb_to_input_id(dev, &kbd->dev.id);
292 kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
293 kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
294 kbd->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
295 kbd->dev.dev = &iface->dev; 293 kbd->dev.dev = &iface->dev;
296 294
297 if (dev->manufacturer) 295 if (dev->manufacturer)
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c
index 1ec41b5effe..4104dec847f 100644
--- a/drivers/usb/input/usbmouse.c
+++ b/drivers/usb/input/usbmouse.c
@@ -32,6 +32,7 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/usb.h> 34#include <linux/usb.h>
35#include <linux/usb_input.h>
35 36
36/* 37/*
37 * Version Information 38 * Version Information
@@ -171,10 +172,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
171 172
172 mouse->dev.name = mouse->name; 173 mouse->dev.name = mouse->name;
173 mouse->dev.phys = mouse->phys; 174 mouse->dev.phys = mouse->phys;
174 mouse->dev.id.bustype = BUS_USB; 175 usb_to_input_id(dev, &mouse->dev.id);
175 mouse->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
176 mouse->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
177 mouse->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
178 mouse->dev.dev = &intf->dev; 176 mouse->dev.dev = &intf->dev;
179 177
180 if (dev->manufacturer) 178 if (dev->manufacturer)
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
index f6b34af66b3..02412e31a46 100644
--- a/drivers/usb/input/wacom.c
+++ b/drivers/usb/input/wacom.c
@@ -69,6 +69,7 @@
69#include <linux/module.h> 69#include <linux/module.h>
70#include <linux/init.h> 70#include <linux/init.h>
71#include <linux/usb.h> 71#include <linux/usb.h>
72#include <linux/usb_input.h>
72#include <asm/unaligned.h> 73#include <asm/unaligned.h>
73#include <asm/byteorder.h> 74#include <asm/byteorder.h>
74 75
@@ -823,10 +824,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
823 824
824 wacom->dev.name = wacom->features->name; 825 wacom->dev.name = wacom->features->name;
825 wacom->dev.phys = wacom->phys; 826 wacom->dev.phys = wacom->phys;
826 wacom->dev.id.bustype = BUS_USB; 827 usb_to_input_id(dev, &wacom->dev.id);
827 wacom->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
828 wacom->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
829 wacom->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
830 wacom->dev.dev = &intf->dev; 828 wacom->dev.dev = &intf->dev;
831 wacom->usbdev = dev; 829 wacom->usbdev = dev;
832 830
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c
index a7fa1b17dcf..18125e0bffa 100644
--- a/drivers/usb/input/xpad.c
+++ b/drivers/usb/input/xpad.c
@@ -62,6 +62,7 @@
62#include <linux/module.h> 62#include <linux/module.h>
63#include <linux/smp_lock.h> 63#include <linux/smp_lock.h>
64#include <linux/usb.h> 64#include <linux/usb.h>
65#include <linux/usb_input.h>
65 66
66#define DRIVER_VERSION "v0.0.5" 67#define DRIVER_VERSION "v0.0.5"
67#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" 68#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>"
@@ -256,10 +257,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
256 257
257 xpad->udev = udev; 258 xpad->udev = udev;
258 259
259 xpad->dev.id.bustype = BUS_USB; 260 usb_to_input_id(udev, &xpad->dev.id);
260 xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
261 xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct);
262 xpad->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
263 xpad->dev.dev = &intf->dev; 261 xpad->dev.dev = &intf->dev;
264 xpad->dev.private = xpad; 262 xpad->dev.private = xpad;
265 xpad->dev.name = xpad_device[i].name; 263 xpad->dev.name = xpad_device[i].name;
diff --git a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c
index 08521a2b4f3..20ac9e1069d 100644
--- a/drivers/usb/media/konicawc.c
+++ b/drivers/usb/media/konicawc.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/usb_input.h>
19 20
20#include "usbvideo.h" 21#include "usbvideo.h"
21 22
@@ -845,10 +846,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
845 cam->input.private = cam; 846 cam->input.private = cam;
846 cam->input.evbit[0] = BIT(EV_KEY); 847 cam->input.evbit[0] = BIT(EV_KEY);
847 cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); 848 cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0);
848 cam->input.id.bustype = BUS_USB; 849 usb_to_input_id(dev, &cam->input.id);
849 cam->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
850 cam->input.id.product = le16_to_cpu(dev->descriptor.idProduct);
851 cam->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
852 input_register_device(&cam->input); 850 input_register_device(&cam->input);
853 851
854 usb_make_path(dev, cam->input_physname, 56); 852 usb_make_path(dev, cam->input_physname, 56);
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index 66ec88354b9..ad17892aac9 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -23,6 +23,7 @@
23 * 23 *
24 * V0.1 (mh) Initial version 24 * V0.1 (mh) Initial version
25 * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) 25 * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint)
26 * V0.12 (mh) Added kmalloc check for string buffer
26 */ 27 */
27 28
28#include <linux/config.h> 29#include <linux/config.h>
@@ -84,7 +85,7 @@ static struct usb_device_id ld_usb_table [] = {
84 { } /* Terminating entry */ 85 { } /* Terminating entry */
85}; 86};
86MODULE_DEVICE_TABLE(usb, ld_usb_table); 87MODULE_DEVICE_TABLE(usb, ld_usb_table);
87MODULE_VERSION("V0.11"); 88MODULE_VERSION("V0.12");
88MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); 89MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>");
89MODULE_DESCRIPTION("LD USB Driver"); 90MODULE_DESCRIPTION("LD USB Driver");
90MODULE_LICENSE("GPL"); 91MODULE_LICENSE("GPL");
@@ -635,6 +636,10 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
635 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && 636 (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) &&
636 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { 637 (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) {
637 buffer = kmalloc(256, GFP_KERNEL); 638 buffer = kmalloc(256, GFP_KERNEL);
639 if (buffer == NULL) {
640 dev_err(&intf->dev, "Couldn't allocate string buffer\n");
641 goto error;
642 }
638 /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ 643 /* usb_string makes SETUP+STALL to leave always ControlReadLoop */
639 usb_string(udev, 255, buffer, 256); 644 usb_string(udev, 255, buffer, 256);
640 kfree(buffer); 645 kfree(buffer);
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index 5f4496d8dba..fcd6d3ccef4 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -59,7 +59,6 @@ static const char driver_name[] = "pegasus";
59 59
60static int loopback = 0; 60static int loopback = 0;
61static int mii_mode = 0; 61static int mii_mode = 0;
62static int multicast_filter_limit = 32;
63 62
64static struct usb_eth_dev usb_dev_id[] = { 63static struct usb_eth_dev usb_dev_id[] = {
65#define PEGASUS_DEV(pn, vid, pid, flags) \ 64#define PEGASUS_DEV(pn, vid, pid, flags) \
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index 626b016addf..59ab40ebb39 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -167,8 +167,6 @@ struct rtl8150 {
167 167
168typedef struct rtl8150 rtl8150_t; 168typedef struct rtl8150 rtl8150_t;
169 169
170static unsigned long multicast_filter_limit = 32;
171
172static void fill_skb_pool(rtl8150_t *); 170static void fill_skb_pool(rtl8150_t *);
173static void free_skb_pool(rtl8150_t *); 171static void free_skb_pool(rtl8150_t *);
174static inline struct sk_buff *pull_skb(rtl8150_t *); 172static inline struct sk_buff *pull_skb(rtl8150_t *);
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c
index 3b387b00573..29cd801eb95 100644
--- a/drivers/usb/net/zd1201.c
+++ b/drivers/usb/net/zd1201.c
@@ -29,6 +29,7 @@ static struct usb_device_id zd1201_table[] = {
29 {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */ 29 {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */
30 {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */ 30 {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */
31 {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */ 31 {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */
32 {USB_DEVICE(0x1044, 0x8005)}, /* GIGABYTE GN-WLBZ201 usb adapter */
32 {} 33 {}
33}; 34};
34 35
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 0b03ddab53d..d1964a0c416 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -429,6 +429,9 @@ static struct usb_device_id id_table_combined [] = {
429 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, 429 { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
430 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, 430 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
431 { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, 431 { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) },
432 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) },
433 { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) },
434 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
432 { } /* Terminating entry */ 435 { } /* Terminating entry */
433}; 436};
434 437
@@ -545,6 +548,7 @@ static struct usb_serial_device_type ftdi_sio_device = {
545 548
546 549
547#define WDR_TIMEOUT 5000 /* default urb timeout */ 550#define WDR_TIMEOUT 5000 /* default urb timeout */
551#define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */
548 552
549/* High and low are for DTR, RTS etc etc */ 553/* High and low are for DTR, RTS etc etc */
550#define HIGH 1 554#define HIGH 1
@@ -593,62 +597,59 @@ static __u32 ftdi_232bm_baud_to_divisor(int baud)
593 return(ftdi_232bm_baud_base_to_divisor(baud, 48000000)); 597 return(ftdi_232bm_baud_base_to_divisor(baud, 48000000));
594} 598}
595 599
596static int set_rts(struct usb_serial_port *port, int high_or_low) 600#define set_mctrl(port, set) update_mctrl((port), (set), 0)
601#define clear_mctrl(port, clear) update_mctrl((port), 0, (clear))
602
603static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned int clear)
597{ 604{
598 struct ftdi_private *priv = usb_get_serial_port_data(port); 605 struct ftdi_private *priv = usb_get_serial_port_data(port);
599 char *buf; 606 char *buf;
600 unsigned ftdi_high_or_low; 607 unsigned urb_value;
601 int rv; 608 int rv;
602
603 buf = kmalloc(1, GFP_NOIO);
604 if (!buf)
605 return -ENOMEM;
606
607 if (high_or_low) {
608 ftdi_high_or_low = FTDI_SIO_SET_RTS_HIGH;
609 priv->last_dtr_rts |= TIOCM_RTS;
610 } else {
611 ftdi_high_or_low = FTDI_SIO_SET_RTS_LOW;
612 priv->last_dtr_rts &= ~TIOCM_RTS;
613 }
614 rv = usb_control_msg(port->serial->dev,
615 usb_sndctrlpipe(port->serial->dev, 0),
616 FTDI_SIO_SET_MODEM_CTRL_REQUEST,
617 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE,
618 ftdi_high_or_low, priv->interface,
619 buf, 0, WDR_TIMEOUT);
620
621 kfree(buf);
622 return rv;
623}
624 609
610 if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
611 dbg("%s - DTR|RTS not being set|cleared", __FUNCTION__);
612 return 0; /* no change */
613 }
625 614
626static int set_dtr(struct usb_serial_port *port, int high_or_low)
627{
628 struct ftdi_private *priv = usb_get_serial_port_data(port);
629 char *buf;
630 unsigned ftdi_high_or_low;
631 int rv;
632
633 buf = kmalloc(1, GFP_NOIO); 615 buf = kmalloc(1, GFP_NOIO);
634 if (!buf) 616 if (!buf) {
635 return -ENOMEM; 617 return -ENOMEM;
636
637 if (high_or_low) {
638 ftdi_high_or_low = FTDI_SIO_SET_DTR_HIGH;
639 priv->last_dtr_rts |= TIOCM_DTR;
640 } else {
641 ftdi_high_or_low = FTDI_SIO_SET_DTR_LOW;
642 priv->last_dtr_rts &= ~TIOCM_DTR;
643 } 618 }
619
620 clear &= ~set; /* 'set' takes precedence over 'clear' */
621 urb_value = 0;
622 if (clear & TIOCM_DTR)
623 urb_value |= FTDI_SIO_SET_DTR_LOW;
624 if (clear & TIOCM_RTS)
625 urb_value |= FTDI_SIO_SET_RTS_LOW;
626 if (set & TIOCM_DTR)
627 urb_value |= FTDI_SIO_SET_DTR_HIGH;
628 if (set & TIOCM_RTS)
629 urb_value |= FTDI_SIO_SET_RTS_HIGH;
644 rv = usb_control_msg(port->serial->dev, 630 rv = usb_control_msg(port->serial->dev,
645 usb_sndctrlpipe(port->serial->dev, 0), 631 usb_sndctrlpipe(port->serial->dev, 0),
646 FTDI_SIO_SET_MODEM_CTRL_REQUEST, 632 FTDI_SIO_SET_MODEM_CTRL_REQUEST,
647 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, 633 FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE,
648 ftdi_high_or_low, priv->interface, 634 urb_value, priv->interface,
649 buf, 0, WDR_TIMEOUT); 635 buf, 0, WDR_TIMEOUT);
650 636
651 kfree(buf); 637 kfree(buf);
638 if (rv < 0) {
639 err("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
640 __FUNCTION__,
641 (set & TIOCM_DTR) ? "HIGH" :
642 (clear & TIOCM_DTR) ? "LOW" : "unchanged",
643 (set & TIOCM_RTS) ? "HIGH" :
644 (clear & TIOCM_RTS) ? "LOW" : "unchanged");
645 } else {
646 dbg("%s - DTR %s, RTS %s", __FUNCTION__,
647 (set & TIOCM_DTR) ? "HIGH" :
648 (clear & TIOCM_DTR) ? "LOW" : "unchanged",
649 (set & TIOCM_RTS) ? "HIGH" :
650 (clear & TIOCM_RTS) ? "LOW" : "unchanged");
651 priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set;
652 }
652 return rv; 653 return rv;
653} 654}
654 655
@@ -681,7 +682,7 @@ static int change_speed(struct usb_serial_port *port)
681 FTDI_SIO_SET_BAUDRATE_REQUEST, 682 FTDI_SIO_SET_BAUDRATE_REQUEST,
682 FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, 683 FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE,
683 urb_value, urb_index, 684 urb_value, urb_index,
684 buf, 0, 100); 685 buf, 0, WDR_SHORT_TIMEOUT);
685 686
686 kfree(buf); 687 kfree(buf);
687 return rv; 688 return rv;
@@ -1219,12 +1220,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp)
1219 /* FIXME: Flow control might be enabled, so it should be checked - 1220 /* FIXME: Flow control might be enabled, so it should be checked -
1220 we have no control of defaults! */ 1221 we have no control of defaults! */
1221 /* Turn on RTS and DTR since we are not flow controlling by default */ 1222 /* Turn on RTS and DTR since we are not flow controlling by default */
1222 if (set_dtr(port, HIGH) < 0) { 1223 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1223 err("%s Error from DTR HIGH urb", __FUNCTION__);
1224 }
1225 if (set_rts(port, HIGH) < 0){
1226 err("%s Error from RTS HIGH urb", __FUNCTION__);
1227 }
1228 1224
1229 /* Not throttled */ 1225 /* Not throttled */
1230 spin_lock_irqsave(&priv->rx_lock, flags); 1226 spin_lock_irqsave(&priv->rx_lock, flags);
@@ -1274,14 +1270,8 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp)
1274 err("error from flowcontrol urb"); 1270 err("error from flowcontrol urb");
1275 } 1271 }
1276 1272
1277 /* drop DTR */ 1273 /* drop RTS and DTR */
1278 if (set_dtr(port, LOW) < 0){ 1274 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1279 err("Error from DTR LOW urb");
1280 }
1281 /* drop RTS */
1282 if (set_rts(port, LOW) < 0) {
1283 err("Error from RTS LOW urb");
1284 }
1285 } /* Note change no line if hupcl is off */ 1275 } /* Note change no line if hupcl is off */
1286 1276
1287 /* cancel any scheduled reading */ 1277 /* cancel any scheduled reading */
@@ -1797,7 +1787,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1797 FTDI_SIO_SET_DATA_REQUEST, 1787 FTDI_SIO_SET_DATA_REQUEST,
1798 FTDI_SIO_SET_DATA_REQUEST_TYPE, 1788 FTDI_SIO_SET_DATA_REQUEST_TYPE,
1799 urb_value , priv->interface, 1789 urb_value , priv->interface,
1800 buf, 0, 100) < 0) { 1790 buf, 0, WDR_SHORT_TIMEOUT) < 0) {
1801 err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); 1791 err("%s FAILED to set databits/stopbits/parity", __FUNCTION__);
1802 } 1792 }
1803 1793
@@ -1812,25 +1802,14 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_
1812 err("%s error from disable flowcontrol urb", __FUNCTION__); 1802 err("%s error from disable flowcontrol urb", __FUNCTION__);
1813 } 1803 }
1814 /* Drop RTS and DTR */ 1804 /* Drop RTS and DTR */
1815 if (set_dtr(port, LOW) < 0){ 1805 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1816 err("%s Error from DTR LOW urb", __FUNCTION__);
1817 }
1818 if (set_rts(port, LOW) < 0){
1819 err("%s Error from RTS LOW urb", __FUNCTION__);
1820 }
1821
1822 } else { 1806 } else {
1823 /* set the baudrate determined before */ 1807 /* set the baudrate determined before */
1824 if (change_speed(port)) { 1808 if (change_speed(port)) {
1825 err("%s urb failed to set baurdrate", __FUNCTION__); 1809 err("%s urb failed to set baurdrate", __FUNCTION__);
1826 } 1810 }
1827 /* Ensure RTS and DTR are raised */ 1811 /* Ensure RTS and DTR are raised */
1828 else if (set_dtr(port, HIGH) < 0){ 1812 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
1829 err("%s Error from DTR HIGH urb", __FUNCTION__);
1830 }
1831 else if (set_rts(port, HIGH) < 0){
1832 err("%s Error from RTS HIGH urb", __FUNCTION__);
1833 }
1834 } 1813 }
1835 1814
1836 /* Set flow control */ 1815 /* Set flow control */
@@ -1942,35 +1921,8 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file)
1942 1921
1943static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) 1922static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear)
1944{ 1923{
1945 int ret;
1946
1947 dbg("%s TIOCMSET", __FUNCTION__); 1924 dbg("%s TIOCMSET", __FUNCTION__);
1948 if (set & TIOCM_DTR){ 1925 return update_mctrl(port, set, clear);
1949 if ((ret = set_dtr(port, HIGH)) < 0) {
1950 err("Urb to set DTR failed");
1951 return(ret);
1952 }
1953 }
1954 if (set & TIOCM_RTS) {
1955 if ((ret = set_rts(port, HIGH)) < 0){
1956 err("Urb to set RTS failed");
1957 return(ret);
1958 }
1959 }
1960
1961 if (clear & TIOCM_DTR){
1962 if ((ret = set_dtr(port, LOW)) < 0){
1963 err("Urb to unset DTR failed");
1964 return(ret);
1965 }
1966 }
1967 if (clear & TIOCM_RTS) {
1968 if ((ret = set_rts(port, LOW)) < 0){
1969 err("Urb to unset RTS failed");
1970 return(ret);
1971 }
1972 }
1973 return(0);
1974} 1926}
1975 1927
1976 1928
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 8866376823a..9f4342093e8 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -265,10 +265,24 @@
265#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */ 265#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */
266 266
267/* 267/*
268 * microHAM product IDs (http://www.microham.com).
269 * Submitted by Justin Burket (KL1RL) <zorton@jtan.com>.
270 */
271#define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */
272#define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */
273
274/*
268 * Active Robots product ids. 275 * Active Robots product ids.
269 */ 276 */
270#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ 277#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */
271 278
279/*
280 * Evolution Robotics products (http://www.evolution.com/).
281 * Submitted by Shawn M. Lavelle.
282 */
283#define EVOLUTION_VID 0xDEEE /* Vendor ID */
284#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */
285
272/* Commands */ 286/* Commands */
273#define FTDI_SIO_RESET 0 /* Reset the port */ 287#define FTDI_SIO_RESET 0 /* Reset the port */
274#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 288#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index 6051a646fe6..353f24d45bc 100644
--- a/drivers/usb/usb-skeleton.c
+++ b/drivers/usb/usb-skeleton.c
@@ -257,7 +257,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
257 endpoint = &iface_desc->endpoint[i].desc; 257 endpoint = &iface_desc->endpoint[i].desc;
258 258
259 if (!dev->bulk_in_endpointAddr && 259 if (!dev->bulk_in_endpointAddr &&
260 (endpoint->bEndpointAddress & USB_DIR_IN) && 260 ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
261 == USB_DIR_IN) &&
261 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 262 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
262 == USB_ENDPOINT_XFER_BULK)) { 263 == USB_ENDPOINT_XFER_BULK)) {
263 /* we found a bulk in endpoint */ 264 /* we found a bulk in endpoint */
@@ -272,7 +273,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
272 } 273 }
273 274
274 if (!dev->bulk_out_endpointAddr && 275 if (!dev->bulk_out_endpointAddr &&
275 !(endpoint->bEndpointAddress & USB_DIR_OUT) && 276 ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK)
277 == USB_DIR_OUT) &&
276 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 278 ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
277 == USB_ENDPOINT_XFER_BULK)) { 279 == USB_ENDPOINT_XFER_BULK)) {
278 /* we found a bulk out endpoint */ 280 /* we found a bulk out endpoint */
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 40784a944d0..d2e19f6dd72 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -80,10 +80,12 @@ EXPORT_SYMBOL(fb_get_color_depth);
80 */ 80 */
81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) 81void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
82{ 82{
83 int i; 83 int i, j;
84 84
85 for (i = height; i--; ) { 85 for (i = height; i--; ) {
86 memcpy(dst, src, s_pitch); 86 /* s_pitch is a few bytes at the most, memcpy is suboptimal */
87 for (j = 0; j < s_pitch; j++)
88 dst[j] = src[j];
87 src += s_pitch; 89 src += s_pitch;
88 dst += d_pitch; 90 dst += d_pitch;
89 } 91 }
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 63b505cce4e..ed1d4d1ac4f 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -244,15 +244,15 @@ static ssize_t show_virtual(struct class_device *class_device, char *buf)
244 244
245/* Format for cmap is "%02x%c%4x%4x%4x\n" */ 245/* Format for cmap is "%02x%c%4x%4x%4x\n" */
246/* %02x entry %c transp %4x red %4x blue %4x green \n */ 246/* %02x entry %c transp %4x red %4x blue %4x green \n */
247/* 255 rows at 16 chars equals 4096 */ 247/* 256 rows at 16 chars equals 4096, the normal page size */
248/* PAGE_SIZE can be 4096 or larger */ 248/* the code will automatically adjust for different page sizes */
249static ssize_t store_cmap(struct class_device *class_device, const char *buf, 249static ssize_t store_cmap(struct class_device *class_device, const char *buf,
250 size_t count) 250 size_t count)
251{ 251{
252 struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); 252 struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device);
253 int rc, i, start, length, transp = 0; 253 int rc, i, start, length, transp = 0;
254 254
255 if ((count > 4096) || ((count % 16) != 0) || (PAGE_SIZE < 4096)) 255 if ((count > PAGE_SIZE) || ((count % 16) != 0))
256 return -EINVAL; 256 return -EINVAL;
257 257
258 if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) 258 if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap)
@@ -317,18 +317,18 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf)
317 !fb_info->cmap.green) 317 !fb_info->cmap.green)
318 return -EINVAL; 318 return -EINVAL;
319 319
320 if (PAGE_SIZE < 4096) 320 if (fb_info->cmap.len > PAGE_SIZE / 16)
321 return -EINVAL; 321 return -EINVAL;
322 322
323 /* don't mess with the format, the buffer is PAGE_SIZE */ 323 /* don't mess with the format, the buffer is PAGE_SIZE */
324 /* 255 entries at 16 chars per line equals 4096 = PAGE_SIZE */ 324 /* 256 entries at 16 chars per line equals 4096 = PAGE_SIZE */
325 for (i = 0; i < fb_info->cmap.len; i++) { 325 for (i = 0; i < fb_info->cmap.len; i++) {
326 sprintf(&buf[ i * 16], "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, 326 snprintf(&buf[ i * 16], PAGE_SIZE - i * 16, "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start,
327 ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), 327 ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '),
328 fb_info->cmap.red[i], fb_info->cmap.blue[i], 328 fb_info->cmap.red[i], fb_info->cmap.blue[i],
329 fb_info->cmap.green[i]); 329 fb_info->cmap.green[i]);
330 } 330 }
331 return 4096; 331 return 16 * fb_info->cmap.len;
332} 332}
333 333
334static ssize_t store_blank(struct class_device *class_device, const char * buf, 334static ssize_t store_blank(struct class_device *class_device, const char * buf,
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c
index 9ed1a931dd3..a272592b037 100644
--- a/drivers/video/vesafb.c
+++ b/drivers/video/vesafb.c
@@ -45,7 +45,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = {
45}; 45};
46 46
47static int inverse = 0; 47static int inverse = 0;
48static int mtrr = 1; 48static int mtrr = 3; /* default to write-combining */
49static int vram_remap __initdata = 0; /* Set amount of memory to be used */ 49static int vram_remap __initdata = 0; /* Set amount of memory to be used */
50static int vram_total __initdata = 0; /* Set total amount of memory */ 50static int vram_total __initdata = 0; /* Set total amount of memory */
51static int pmi_setpal = 0; /* pmi for palette changes ??? */ 51static int pmi_setpal = 0; /* pmi for palette changes ??? */
@@ -204,8 +204,8 @@ static int __init vesafb_setup(char *options)
204 pmi_setpal=0; 204 pmi_setpal=0;
205 else if (! strcmp(this_opt, "pmipal")) 205 else if (! strcmp(this_opt, "pmipal"))
206 pmi_setpal=1; 206 pmi_setpal=1;
207 else if (! strcmp(this_opt, "mtrr")) 207 else if (! strncmp(this_opt, "mtrr:", 5))
208 mtrr=1; 208 mtrr = simple_strtoul(this_opt+5, NULL, 0);
209 else if (! strcmp(this_opt, "nomtrr")) 209 else if (! strcmp(this_opt, "nomtrr"))
210 mtrr=0; 210 mtrr=0;
211 else if (! strncmp(this_opt, "vtotal:", 7)) 211 else if (! strncmp(this_opt, "vtotal:", 7))
@@ -387,14 +387,39 @@ static int __init vesafb_probe(struct device *device)
387 387
388 if (mtrr) { 388 if (mtrr) {
389 unsigned int temp_size = size_total; 389 unsigned int temp_size = size_total;
390 /* Find the largest power-of-two */ 390 unsigned int type = 0;
391 while (temp_size & (temp_size - 1)) 391
392 temp_size &= (temp_size - 1); 392 switch (mtrr) {
393 393 case 1:
394 /* Try and find a power of two to add */ 394 type = MTRR_TYPE_UNCACHABLE;
395 while (temp_size > PAGE_SIZE && 395 break;
396 mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { 396 case 2:
397 temp_size >>= 1; 397 type = MTRR_TYPE_WRBACK;
398 break;
399 case 3:
400 type = MTRR_TYPE_WRCOMB;
401 break;
402 case 4:
403 type = MTRR_TYPE_WRTHROUGH;
404 break;
405 default:
406 type = 0;
407 break;
408 }
409
410 if (type) {
411 int rc;
412
413 /* Find the largest power-of-two */
414 while (temp_size & (temp_size - 1))
415 temp_size &= (temp_size - 1);
416
417 /* Try and find a power of two to add */
418 do {
419 rc = mtrr_add(vesafb_fix.smem_start, temp_size,
420 type, 1);
421 temp_size >>= 1;
422 } while (temp_size >= PAGE_SIZE && rc == -EINVAL);
398 } 423 }
399 } 424 }
400 425
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig
index 4f120796273..711b90903e7 100644
--- a/drivers/w1/Kconfig
+++ b/drivers/w1/Kconfig
@@ -30,7 +30,7 @@ config W1_DS9490
30 This support is also available as a module. If so, the module 30 This support is also available as a module. If so, the module
31 will be called ds9490r.ko. 31 will be called ds9490r.ko.
32 32
33config W1_DS9490R_BRIDGE 33config W1_DS9490_BRIDGE
34 tristate "DS9490R USB <-> W1 transport layer for 1-wire" 34 tristate "DS9490R USB <-> W1 transport layer for 1-wire"
35 depends on W1_DS9490 35 depends on W1_DS9490
36 help 36 help