aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-04-07 14:15:50 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-04-07 14:15:50 -0400
commit454abcc57f1d48a976291bc4af73b5f087e21d70 (patch)
tree5bba999ea3f31527da02b60604531cc5fb52ea57 /drivers
parent88aab9341a315d81118be6b41c45e4fe32b94bc1 (diff)
parent6221f222c0ebf1acdf7abcf927178f40e1a65e2a (diff)
Merge commit 'v2.6.39-rc2' into spi/merge
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/pata_palmld.c43
-rw-r--r--drivers/atm/solos-pci.c39
-rw-r--r--drivers/bluetooth/btusb.c6
-rw-r--r--drivers/connector/cn_queue.c58
-rw-r--r--drivers/connector/connector.c47
-rw-r--r--drivers/edac/mpc85xx_edac.c27
-rw-r--r--drivers/gpu/drm/drm_edid.c3
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c20
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_i2c.c25
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c34
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c2
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c20
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c13
-rw-r--r--drivers/gpu/drm/radeon/rs600.c11
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c10
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c16
-rw-r--r--drivers/hwmon/twl4030-madc-hwmon.c2
-rw-r--r--drivers/ide/ide-io.c43
-rw-r--r--drivers/input/keyboard/spear-keyboard.c2
-rw-r--r--drivers/input/misc/uinput.c6
-rw-r--r--drivers/input/mouse/synaptics.c4
-rw-r--r--drivers/input/serio/i8042.c7
-rw-r--r--drivers/input/serio/rpckbd.c2
-rw-r--r--drivers/input/sparse-keymap.c14
-rw-r--r--drivers/input/tablet/wacom_wac.c291
-rw-r--r--drivers/input/tablet/wacom_wac.h2
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c2
-rw-r--r--drivers/macintosh/therm_pm72.c60
-rw-r--r--drivers/md/dm-table.c114
-rw-r--r--drivers/media/radio/wl128x/fmdrv_common.c16
-rw-r--r--drivers/media/rc/ite-cir.c1
-rw-r--r--drivers/net/atlx/atl2.c22
-rw-r--r--drivers/net/bonding/bond_alb.h2
-rw-r--r--drivers/net/irda/via-ircc.c94
-rw-r--r--drivers/net/mlx4/eq.c4
-rw-r--r--drivers/net/mlx4/mcg.c7
-rw-r--r--drivers/net/phy/phy_device.c8
-rw-r--r--drivers/net/starfire.c6
-rw-r--r--drivers/net/usb/Kconfig15
-rw-r--r--drivers/net/usb/Makefile1
-rw-r--r--drivers/net/usb/cdc_eem.c2
-rw-r--r--drivers/net/usb/cdc_ether.c23
-rw-r--r--drivers/net/usb/cdc_ncm.c2
-rw-r--r--drivers/net/usb/cdc_subset.c8
-rw-r--r--drivers/net/usb/gl620a.c2
-rw-r--r--drivers/net/usb/lg-vl600.c346
-rw-r--r--drivers/net/usb/net1080.c2
-rw-r--r--drivers/net/usb/plusb.c2
-rw-r--r--drivers/net/usb/rndis_host.c2
-rw-r--r--drivers/net/usb/usbnet.c13
-rw-r--r--drivers/net/usb/zaurus.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c4
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h1
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c1
-rw-r--r--drivers/net/wireless/ath/carl9170/tx.c7
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c10
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c10
-rw-r--r--drivers/pcmcia/pxa2xx_colibri.c133
-rw-r--r--drivers/pcmcia/pxa2xx_palmld.c42
-rw-r--r--drivers/pcmcia/pxa2xx_palmtc.c75
-rw-r--r--drivers/pcmcia/pxa2xx_palmtx.c57
-rw-r--r--drivers/pcmcia/pxa2xx_vpac270.c110
-rw-r--r--drivers/rtc/rtc-mrst.c10
-rw-r--r--drivers/scsi/ultrastor.c1
-rw-r--r--drivers/sh/intc/internals.h4
-rw-r--r--drivers/staging/altera-stapl/altera-jtag.c1
-rw-r--r--drivers/tty/n_tty.c6
-rw-r--r--drivers/tty/serial/Kconfig2
-rw-r--r--drivers/tty/serial/apbuart.c34
-rw-r--r--drivers/tty/tty_buffer.c4
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c76
-rw-r--r--drivers/usb/serial/mct_u232.c4
-rw-r--r--drivers/usb/serial/opticon.c2
-rw-r--r--drivers/video/fb-puv3.c28
-rw-r--r--drivers/video/pxafb.c136
-rw-r--r--drivers/video/pxafb.h3
80 files changed, 1281 insertions, 1022 deletions
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
index a2a73d953840..b86d7e22595e 100644
--- a/drivers/ata/pata_palmld.c
+++ b/drivers/ata/pata_palmld.c
@@ -33,6 +33,11 @@
33 33
34#define DRV_NAME "pata_palmld" 34#define DRV_NAME "pata_palmld"
35 35
36static struct gpio palmld_hdd_gpios[] = {
37 { GPIO_NR_PALMLD_IDE_PWEN, GPIOF_INIT_HIGH, "HDD Power" },
38 { GPIO_NR_PALMLD_IDE_RESET, GPIOF_INIT_LOW, "HDD Reset" },
39};
40
36static struct scsi_host_template palmld_sht = { 41static struct scsi_host_template palmld_sht = {
37 ATA_PIO_SHT(DRV_NAME), 42 ATA_PIO_SHT(DRV_NAME),
38}; 43};
@@ -52,28 +57,23 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev)
52 57
53 /* allocate host */ 58 /* allocate host */
54 host = ata_host_alloc(&pdev->dev, 1); 59 host = ata_host_alloc(&pdev->dev, 1);
55 if (!host) 60 if (!host) {
56 return -ENOMEM; 61 ret = -ENOMEM;
62 goto err1;
63 }
57 64
58 /* remap drive's physical memory address */ 65 /* remap drive's physical memory address */
59 mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000); 66 mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000);
60 if (!mem) 67 if (!mem) {
61 return -ENOMEM; 68 ret = -ENOMEM;
69 goto err1;
70 }
62 71
63 /* request and activate power GPIO, IRQ GPIO */ 72 /* request and activate power GPIO, IRQ GPIO */
64 ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR"); 73 ret = gpio_request_array(palmld_hdd_gpios,
74 ARRAY_SIZE(palmld_hdd_gpios));
65 if (ret) 75 if (ret)
66 goto err1; 76 goto err1;
67 ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_PWEN, 1);
68 if (ret)
69 goto err2;
70
71 ret = gpio_request(GPIO_NR_PALMLD_IDE_RESET, "HDD RST");
72 if (ret)
73 goto err2;
74 ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_RESET, 0);
75 if (ret)
76 goto err3;
77 77
78 /* reset the drive */ 78 /* reset the drive */
79 gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0); 79 gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0);
@@ -96,13 +96,15 @@ static __devinit int palmld_pata_probe(struct platform_device *pdev)
96 ata_sff_std_ports(&ap->ioaddr); 96 ata_sff_std_ports(&ap->ioaddr);
97 97
98 /* activate host */ 98 /* activate host */
99 return ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, 99 ret = ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING,
100 &palmld_sht); 100 &palmld_sht);
101 if (ret)
102 goto err2;
103
104 return ret;
101 105
102err3:
103 gpio_free(GPIO_NR_PALMLD_IDE_RESET);
104err2: 106err2:
105 gpio_free(GPIO_NR_PALMLD_IDE_PWEN); 107 gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios));
106err1: 108err1:
107 return ret; 109 return ret;
108} 110}
@@ -116,8 +118,7 @@ static __devexit int palmld_pata_remove(struct platform_device *dev)
116 /* power down the HDD */ 118 /* power down the HDD */
117 gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); 119 gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0);
118 120
119 gpio_free(GPIO_NR_PALMLD_IDE_RESET); 121 gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios));
120 gpio_free(GPIO_NR_PALMLD_IDE_PWEN);
121 122
122 return 0; 123 return 0;
123} 124}
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 25ef1a4556e6..cd0ff66469b2 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -165,7 +165,6 @@ static uint32_t fpga_tx(struct solos_card *);
165static irqreturn_t solos_irq(int irq, void *dev_id); 165static irqreturn_t solos_irq(int irq, void *dev_id);
166static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); 166static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci);
167static int list_vccs(int vci); 167static int list_vccs(int vci);
168static void release_vccs(struct atm_dev *dev);
169static int atm_init(struct solos_card *, struct device *); 168static int atm_init(struct solos_card *, struct device *);
170static void atm_remove(struct solos_card *); 169static void atm_remove(struct solos_card *);
171static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); 170static int send_command(struct solos_card *card, int dev, const char *buf, size_t size);
@@ -384,7 +383,6 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
384 /* Anything but 'Showtime' is down */ 383 /* Anything but 'Showtime' is down */
385 if (strcmp(state_str, "Showtime")) { 384 if (strcmp(state_str, "Showtime")) {
386 atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST); 385 atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST);
387 release_vccs(card->atmdev[port]);
388 dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str); 386 dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
389 return 0; 387 return 0;
390 } 388 }
@@ -697,7 +695,7 @@ void solos_bh(unsigned long card_arg)
697 size); 695 size);
698 } 696 }
699 if (atmdebug) { 697 if (atmdebug) {
700 dev_info(&card->dev->dev, "Received: device %d\n", port); 698 dev_info(&card->dev->dev, "Received: port %d\n", port);
701 dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", 699 dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n",
702 size, le16_to_cpu(header->vpi), 700 size, le16_to_cpu(header->vpi),
703 le16_to_cpu(header->vci)); 701 le16_to_cpu(header->vci));
@@ -710,8 +708,8 @@ void solos_bh(unsigned long card_arg)
710 le16_to_cpu(header->vci)); 708 le16_to_cpu(header->vci));
711 if (!vcc) { 709 if (!vcc) {
712 if (net_ratelimit()) 710 if (net_ratelimit())
713 dev_warn(&card->dev->dev, "Received packet for unknown VCI.VPI %d.%d on port %d\n", 711 dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n",
714 le16_to_cpu(header->vci), le16_to_cpu(header->vpi), 712 le16_to_cpu(header->vpi), le16_to_cpu(header->vci),
715 port); 713 port);
716 continue; 714 continue;
717 } 715 }
@@ -830,28 +828,6 @@ static int list_vccs(int vci)
830 return num_found; 828 return num_found;
831} 829}
832 830
833static void release_vccs(struct atm_dev *dev)
834{
835 int i;
836
837 write_lock_irq(&vcc_sklist_lock);
838 for (i = 0; i < VCC_HTABLE_SIZE; i++) {
839 struct hlist_head *head = &vcc_hash[i];
840 struct hlist_node *node, *tmp;
841 struct sock *s;
842 struct atm_vcc *vcc;
843
844 sk_for_each_safe(s, node, tmp, head) {
845 vcc = atm_sk(s);
846 if (vcc->dev == dev) {
847 vcc_release_async(vcc, -EPIPE);
848 sk_del_node_init(s);
849 }
850 }
851 }
852 write_unlock_irq(&vcc_sklist_lock);
853}
854
855 831
856static int popen(struct atm_vcc *vcc) 832static int popen(struct atm_vcc *vcc)
857{ 833{
@@ -1018,8 +994,15 @@ static uint32_t fpga_tx(struct solos_card *card)
1018 994
1019 /* Clean up and free oldskb now it's gone */ 995 /* Clean up and free oldskb now it's gone */
1020 if (atmdebug) { 996 if (atmdebug) {
997 struct pkt_hdr *header = (void *)oldskb->data;
998 int size = le16_to_cpu(header->size);
999
1000 skb_pull(oldskb, sizeof(*header));
1021 dev_info(&card->dev->dev, "Transmitted: port %d\n", 1001 dev_info(&card->dev->dev, "Transmitted: port %d\n",
1022 port); 1002 port);
1003 dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n",
1004 size, le16_to_cpu(header->vpi),
1005 le16_to_cpu(header->vci));
1023 print_buffer(oldskb); 1006 print_buffer(oldskb);
1024 } 1007 }
1025 1008
@@ -1262,7 +1245,7 @@ static int atm_init(struct solos_card *card, struct device *parent)
1262 card->atmdev[i]->ci_range.vci_bits = 16; 1245 card->atmdev[i]->ci_range.vci_bits = 16;
1263 card->atmdev[i]->dev_data = card; 1246 card->atmdev[i]->dev_data = card;
1264 card->atmdev[i]->phy_data = (void *)(unsigned long)i; 1247 card->atmdev[i]->phy_data = (void *)(unsigned long)i;
1265 atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN); 1248 atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND);
1266 1249
1267 skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 1250 skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
1268 if (!skb) { 1251 if (!skb) {
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 866811428e20..762a5109c68a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -71,6 +71,9 @@ static struct usb_device_id btusb_table[] = {
71 /* Apple MacBookAir3,1, MacBookAir3,2 */ 71 /* Apple MacBookAir3,1, MacBookAir3,2 */
72 { USB_DEVICE(0x05ac, 0x821b) }, 72 { USB_DEVICE(0x05ac, 0x821b) },
73 73
74 /* Apple MacBookPro8,2 */
75 { USB_DEVICE(0x05ac, 0x821a) },
76
74 /* AVM BlueFRITZ! USB v2.0 */ 77 /* AVM BlueFRITZ! USB v2.0 */
75 { USB_DEVICE(0x057c, 0x3800) }, 78 { USB_DEVICE(0x057c, 0x3800) },
76 79
@@ -690,7 +693,8 @@ static int btusb_send_frame(struct sk_buff *skb)
690 break; 693 break;
691 694
692 case HCI_ACLDATA_PKT: 695 case HCI_ACLDATA_PKT:
693 if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1) 696 if (!data->bulk_tx_ep || (hdev->conn_hash.acl_num < 1 &&
697 hdev->conn_hash.le_num < 1))
694 return -ENODEV; 698 return -ENODEV;
695 699
696 urb = usb_alloc_urb(0, GFP_ATOMIC); 700 urb = usb_alloc_urb(0, GFP_ATOMIC);
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 55653aba6735..c42c9d517790 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -31,24 +31,9 @@
31#include <linux/connector.h> 31#include <linux/connector.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33 33
34void cn_queue_wrapper(struct work_struct *work)
35{
36 struct cn_callback_entry *cbq =
37 container_of(work, struct cn_callback_entry, work);
38 struct cn_callback_data *d = &cbq->data;
39 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb));
40 struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb);
41
42 d->callback(msg, nsp);
43
44 kfree_skb(d->skb);
45 d->skb = NULL;
46
47 kfree(d->free);
48}
49
50static struct cn_callback_entry * 34static struct cn_callback_entry *
51cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, 35cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
36 struct cb_id *id,
52 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) 37 void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
53{ 38{
54 struct cn_callback_entry *cbq; 39 struct cn_callback_entry *cbq;
@@ -59,17 +44,23 @@ cn_queue_alloc_callback_entry(const char *name, struct cb_id *id,
59 return NULL; 44 return NULL;
60 } 45 }
61 46
47 atomic_set(&cbq->refcnt, 1);
48
49 atomic_inc(&dev->refcnt);
50 cbq->pdev = dev;
51
62 snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name); 52 snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name);
63 memcpy(&cbq->id.id, id, sizeof(struct cb_id)); 53 memcpy(&cbq->id.id, id, sizeof(struct cb_id));
64 cbq->data.callback = callback; 54 cbq->callback = callback;
65
66 INIT_WORK(&cbq->work, &cn_queue_wrapper);
67 return cbq; 55 return cbq;
68} 56}
69 57
70static void cn_queue_free_callback(struct cn_callback_entry *cbq) 58void cn_queue_release_callback(struct cn_callback_entry *cbq)
71{ 59{
72 flush_workqueue(cbq->pdev->cn_queue); 60 if (!atomic_dec_and_test(&cbq->refcnt))
61 return;
62
63 atomic_dec(&cbq->pdev->refcnt);
73 kfree(cbq); 64 kfree(cbq);
74} 65}
75 66
@@ -85,13 +76,10 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
85 struct cn_callback_entry *cbq, *__cbq; 76 struct cn_callback_entry *cbq, *__cbq;
86 int found = 0; 77 int found = 0;
87 78
88 cbq = cn_queue_alloc_callback_entry(name, id, callback); 79 cbq = cn_queue_alloc_callback_entry(dev, name, id, callback);
89 if (!cbq) 80 if (!cbq)
90 return -ENOMEM; 81 return -ENOMEM;
91 82
92 atomic_inc(&dev->refcnt);
93 cbq->pdev = dev;
94
95 spin_lock_bh(&dev->queue_lock); 83 spin_lock_bh(&dev->queue_lock);
96 list_for_each_entry(__cbq, &dev->queue_list, callback_entry) { 84 list_for_each_entry(__cbq, &dev->queue_list, callback_entry) {
97 if (cn_cb_equal(&__cbq->id.id, id)) { 85 if (cn_cb_equal(&__cbq->id.id, id)) {
@@ -104,8 +92,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
104 spin_unlock_bh(&dev->queue_lock); 92 spin_unlock_bh(&dev->queue_lock);
105 93
106 if (found) { 94 if (found) {
107 cn_queue_free_callback(cbq); 95 cn_queue_release_callback(cbq);
108 atomic_dec(&dev->refcnt);
109 return -EINVAL; 96 return -EINVAL;
110 } 97 }
111 98
@@ -130,10 +117,8 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id)
130 } 117 }
131 spin_unlock_bh(&dev->queue_lock); 118 spin_unlock_bh(&dev->queue_lock);
132 119
133 if (found) { 120 if (found)
134 cn_queue_free_callback(cbq); 121 cn_queue_release_callback(cbq);
135 atomic_dec(&dev->refcnt);
136 }
137} 122}
138 123
139struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) 124struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls)
@@ -151,12 +136,6 @@ struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls)
151 136
152 dev->nls = nls; 137 dev->nls = nls;
153 138
154 dev->cn_queue = alloc_ordered_workqueue(dev->name, 0);
155 if (!dev->cn_queue) {
156 kfree(dev);
157 return NULL;
158 }
159
160 return dev; 139 return dev;
161} 140}
162 141
@@ -164,9 +143,6 @@ void cn_queue_free_dev(struct cn_queue_dev *dev)
164{ 143{
165 struct cn_callback_entry *cbq, *n; 144 struct cn_callback_entry *cbq, *n;
166 145
167 flush_workqueue(dev->cn_queue);
168 destroy_workqueue(dev->cn_queue);
169
170 spin_lock_bh(&dev->queue_lock); 146 spin_lock_bh(&dev->queue_lock);
171 list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) 147 list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry)
172 list_del(&cbq->callback_entry); 148 list_del(&cbq->callback_entry);
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index f7554de3be5e..d77005849af8 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -122,51 +122,28 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
122 */ 122 */
123static int cn_call_callback(struct sk_buff *skb) 123static int cn_call_callback(struct sk_buff *skb)
124{ 124{
125 struct cn_callback_entry *__cbq, *__new_cbq; 125 struct cn_callback_entry *i, *cbq = NULL;
126 struct cn_dev *dev = &cdev; 126 struct cn_dev *dev = &cdev;
127 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb)); 127 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb));
128 struct netlink_skb_parms *nsp = &NETLINK_CB(skb);
128 int err = -ENODEV; 129 int err = -ENODEV;
129 130
130 spin_lock_bh(&dev->cbdev->queue_lock); 131 spin_lock_bh(&dev->cbdev->queue_lock);
131 list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { 132 list_for_each_entry(i, &dev->cbdev->queue_list, callback_entry) {
132 if (cn_cb_equal(&__cbq->id.id, &msg->id)) { 133 if (cn_cb_equal(&i->id.id, &msg->id)) {
133 if (likely(!work_pending(&__cbq->work) && 134 atomic_inc(&i->refcnt);
134 __cbq->data.skb == NULL)) { 135 cbq = i;
135 __cbq->data.skb = skb;
136
137 if (queue_work(dev->cbdev->cn_queue,
138 &__cbq->work))
139 err = 0;
140 else
141 err = -EINVAL;
142 } else {
143 struct cn_callback_data *d;
144
145 err = -ENOMEM;
146 __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
147 if (__new_cbq) {
148 d = &__new_cbq->data;
149 d->skb = skb;
150 d->callback = __cbq->data.callback;
151 d->free = __new_cbq;
152
153 INIT_WORK(&__new_cbq->work,
154 &cn_queue_wrapper);
155
156 if (queue_work(dev->cbdev->cn_queue,
157 &__new_cbq->work))
158 err = 0;
159 else {
160 kfree(__new_cbq);
161 err = -EINVAL;
162 }
163 }
164 }
165 break; 136 break;
166 } 137 }
167 } 138 }
168 spin_unlock_bh(&dev->cbdev->queue_lock); 139 spin_unlock_bh(&dev->cbdev->queue_lock);
169 140
141 if (cbq != NULL) {
142 cbq->callback(msg, nsp);
143 kfree_skb(skb);
144 cn_queue_release_callback(cbq);
145 }
146
170 return err; 147 return err;
171} 148}
172 149
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index ffb5ad080bee..38ab8e2cd7f4 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -1147,13 +1147,14 @@ static struct platform_driver mpc85xx_mc_err_driver = {
1147static void __init mpc85xx_mc_clear_rfxe(void *data) 1147static void __init mpc85xx_mc_clear_rfxe(void *data)
1148{ 1148{
1149 orig_hid1[smp_processor_id()] = mfspr(SPRN_HID1); 1149 orig_hid1[smp_processor_id()] = mfspr(SPRN_HID1);
1150 mtspr(SPRN_HID1, (orig_hid1[smp_processor_id()] & ~0x20000)); 1150 mtspr(SPRN_HID1, (orig_hid1[smp_processor_id()] & ~HID1_RFXE));
1151} 1151}
1152#endif 1152#endif
1153 1153
1154static int __init mpc85xx_mc_init(void) 1154static int __init mpc85xx_mc_init(void)
1155{ 1155{
1156 int res = 0; 1156 int res = 0;
1157 u32 pvr = 0;
1157 1158
1158 printk(KERN_INFO "Freescale(R) MPC85xx EDAC driver, " 1159 printk(KERN_INFO "Freescale(R) MPC85xx EDAC driver, "
1159 "(C) 2006 Montavista Software\n"); 1160 "(C) 2006 Montavista Software\n");
@@ -1183,12 +1184,17 @@ static int __init mpc85xx_mc_init(void)
1183#endif 1184#endif
1184 1185
1185#ifdef CONFIG_FSL_SOC_BOOKE 1186#ifdef CONFIG_FSL_SOC_BOOKE
1186 /* 1187 pvr = mfspr(SPRN_PVR);
1187 * need to clear HID1[RFXE] to disable machine check int 1188
1188 * so we can catch it 1189 if ((PVR_VER(pvr) == PVR_VER_E500V1) ||
1189 */ 1190 (PVR_VER(pvr) == PVR_VER_E500V2)) {
1190 if (edac_op_state == EDAC_OPSTATE_INT) 1191 /*
1191 on_each_cpu(mpc85xx_mc_clear_rfxe, NULL, 0); 1192 * need to clear HID1[RFXE] to disable machine check int
1193 * so we can catch it
1194 */
1195 if (edac_op_state == EDAC_OPSTATE_INT)
1196 on_each_cpu(mpc85xx_mc_clear_rfxe, NULL, 0);
1197 }
1192#endif 1198#endif
1193 1199
1194 return 0; 1200 return 0;
@@ -1206,7 +1212,12 @@ static void __exit mpc85xx_mc_restore_hid1(void *data)
1206static void __exit mpc85xx_mc_exit(void) 1212static void __exit mpc85xx_mc_exit(void)
1207{ 1213{
1208#ifdef CONFIG_FSL_SOC_BOOKE 1214#ifdef CONFIG_FSL_SOC_BOOKE
1209 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0); 1215 u32 pvr = mfspr(SPRN_PVR);
1216
1217 if ((PVR_VER(pvr) == PVR_VER_E500V1) ||
1218 (PVR_VER(pvr) == PVR_VER_E500V2)) {
1219 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
1220 }
1210#endif 1221#endif
1211#ifdef CONFIG_PCI 1222#ifdef CONFIG_PCI
1212 platform_driver_unregister(&mpc85xx_pci_err_driver); 1223 platform_driver_unregister(&mpc85xx_pci_err_driver);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 9c595e3b9c20..adc9358c9bec 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1297,7 +1297,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
1297/** 1297/**
1298 * Search EDID for CEA extension block. 1298 * Search EDID for CEA extension block.
1299 */ 1299 */
1300static u8 *drm_find_cea_extension(struct edid *edid) 1300u8 *drm_find_cea_extension(struct edid *edid)
1301{ 1301{
1302 u8 *edid_ext = NULL; 1302 u8 *edid_ext = NULL;
1303 int i; 1303 int i;
@@ -1318,6 +1318,7 @@ static u8 *drm_find_cea_extension(struct edid *edid)
1318 1318
1319 return edid_ext; 1319 return edid_ext;
1320} 1320}
1321EXPORT_SYMBOL(drm_find_cea_extension);
1321 1322
1322/** 1323/**
1323 * drm_detect_hdmi_monitor - detect whether monitor is hdmi. 1324 * drm_detect_hdmi_monitor - detect whether monitor is hdmi.
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 8342259f3160..d03fc05b39c0 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -269,21 +269,6 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
269 return ret; 269 return ret;
270} 270}
271 271
272static bool intel_crt_ddc_probe(struct drm_i915_private *dev_priv, int ddc_bus)
273{
274 u8 buf;
275 struct i2c_msg msgs[] = {
276 {
277 .addr = 0xA0,
278 .flags = 0,
279 .len = 1,
280 .buf = &buf,
281 },
282 };
283 /* DDC monitor detect: Does it ACK a write to 0xA0? */
284 return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1;
285}
286
287static bool intel_crt_detect_ddc(struct drm_connector *connector) 272static bool intel_crt_detect_ddc(struct drm_connector *connector)
288{ 273{
289 struct intel_crt *crt = intel_attached_crt(connector); 274 struct intel_crt *crt = intel_attached_crt(connector);
@@ -293,11 +278,6 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
293 if (crt->base.type != INTEL_OUTPUT_ANALOG) 278 if (crt->base.type != INTEL_OUTPUT_ANALOG)
294 return false; 279 return false;
295 280
296 if (intel_crt_ddc_probe(dev_priv, dev_priv->crt_ddc_pin)) {
297 DRM_DEBUG_KMS("CRT detected via DDC:0xa0\n");
298 return true;
299 }
300
301 if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) { 281 if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) {
302 struct edid *edid; 282 struct edid *edid;
303 bool is_digital = false; 283 bool is_digital = false;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5daa991cb287..f5b0d8306d83 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -39,7 +39,7 @@
39 ret__ = -ETIMEDOUT; \ 39 ret__ = -ETIMEDOUT; \
40 break; \ 40 break; \
41 } \ 41 } \
42 if (W && !in_dbg_master()) msleep(W); \ 42 if (W && !(in_atomic() || in_dbg_master())) msleep(W); \
43 } \ 43 } \
44 ret__; \ 44 ret__; \
45}) 45})
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 82d04c5899d2..d3b903bce7c5 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -259,7 +259,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
259 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50)) 259 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50))
260 goto timeout; 260 goto timeout;
261 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) 261 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
262 return 0; 262 goto clear_err;
263 263
264 val = I915_READ(GMBUS3 + reg_offset); 264 val = I915_READ(GMBUS3 + reg_offset);
265 do { 265 do {
@@ -287,7 +287,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
287 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50)) 287 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50))
288 goto timeout; 288 goto timeout;
289 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) 289 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
290 return 0; 290 goto clear_err;
291 291
292 val = loop = 0; 292 val = loop = 0;
293 do { 293 do {
@@ -302,14 +302,31 @@ gmbus_xfer(struct i2c_adapter *adapter,
302 if (i + 1 < num && wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_WAIT_PHASE), 50)) 302 if (i + 1 < num && wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_WAIT_PHASE), 50))
303 goto timeout; 303 goto timeout;
304 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) 304 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
305 return 0; 305 goto clear_err;
306 } 306 }
307 307
308 return num; 308 goto done;
309
310clear_err:
311 /* Toggle the Software Clear Interrupt bit. This has the effect
312 * of resetting the GMBUS controller and so clearing the
313 * BUS_ERROR raised by the slave's NAK.
314 */
315 I915_WRITE(GMBUS1 + reg_offset, GMBUS_SW_CLR_INT);
316 I915_WRITE(GMBUS1 + reg_offset, 0);
317
318done:
319 /* Mark the GMBUS interface as disabled. We will re-enable it at the
320 * start of the next xfer, till then let it sleep.
321 */
322 I915_WRITE(GMBUS0 + reg_offset, 0);
323 return i;
309 324
310timeout: 325timeout:
311 DRM_INFO("GMBUS timed out, falling back to bit banging on pin %d [%s]\n", 326 DRM_INFO("GMBUS timed out, falling back to bit banging on pin %d [%s]\n",
312 bus->reg0 & 0xff, bus->adapter.name); 327 bus->reg0 & 0xff, bus->adapter.name);
328 I915_WRITE(GMBUS0 + reg_offset, 0);
329
313 /* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */ 330 /* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */
314 bus->force_bit = intel_gpio_create(dev_priv, bus->reg0 & 0xff); 331 bus->force_bit = intel_gpio_create(dev_priv, bus->reg0 & 0xff);
315 if (!bus->force_bit) 332 if (!bus->force_bit)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 1a311ad01116..a562bd2648c7 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -473,19 +473,13 @@ static enum drm_connector_status
473intel_lvds_detect(struct drm_connector *connector, bool force) 473intel_lvds_detect(struct drm_connector *connector, bool force)
474{ 474{
475 struct drm_device *dev = connector->dev; 475 struct drm_device *dev = connector->dev;
476 enum drm_connector_status status = connector_status_connected; 476 enum drm_connector_status status;
477 477
478 status = intel_panel_detect(dev); 478 status = intel_panel_detect(dev);
479 if (status != connector_status_unknown) 479 if (status != connector_status_unknown)
480 return status; 480 return status;
481 481
482 /* ACPI lid methods were generally unreliable in this generation, so 482 return connector_status_connected;
483 * don't even bother.
484 */
485 if (IS_GEN2(dev) || IS_GEN3(dev))
486 return connector_status_connected;
487
488 return status;
489} 483}
490 484
491/** 485/**
@@ -835,25 +829,6 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
835 return false; 829 return false;
836} 830}
837 831
838static bool intel_lvds_ddc_probe(struct drm_device *dev, u8 pin)
839{
840 struct drm_i915_private *dev_priv = dev->dev_private;
841 u8 buf = 0;
842 struct i2c_msg msgs[] = {
843 {
844 .addr = 0xA0,
845 .flags = 0,
846 .len = 1,
847 .buf = &buf,
848 },
849 };
850 struct i2c_adapter *i2c = &dev_priv->gmbus[pin].adapter;
851 /* XXX this only appears to work when using GMBUS */
852 if (intel_gmbus_is_forced_bit(i2c))
853 return true;
854 return i2c_transfer(i2c, msgs, 1) == 1;
855}
856
857/** 832/**
858 * intel_lvds_init - setup LVDS connectors on this device 833 * intel_lvds_init - setup LVDS connectors on this device
859 * @dev: drm device 834 * @dev: drm device
@@ -894,11 +869,6 @@ bool intel_lvds_init(struct drm_device *dev)
894 } 869 }
895 } 870 }
896 871
897 if (!intel_lvds_ddc_probe(dev, pin)) {
898 DRM_DEBUG_KMS("LVDS did not respond to DDC probe\n");
899 return false;
900 }
901
902 intel_lvds = kzalloc(sizeof(struct intel_lvds), GFP_KERNEL); 872 intel_lvds = kzalloc(sizeof(struct intel_lvds), GFP_KERNEL);
903 if (!intel_lvds) { 873 if (!intel_lvds) {
904 return false; 874 return false;
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index e8b04f4aed7e..b52e46018245 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -97,7 +97,7 @@ nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan,
97 return -ENOMEM; 97 return -ENOMEM;
98 } 98 }
99 99
100 nvbo->bo.persistant_swap_storage = nvbo->gem->filp; 100 nvbo->bo.persistent_swap_storage = nvbo->gem->filp;
101 nvbo->gem->driver_private = nvbo; 101 nvbo->gem->driver_private = nvbo;
102 return 0; 102 return 0;
103} 103}
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 10e41af6b026..b41ec59c7100 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1009,6 +1009,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1009 uint64_t fb_location; 1009 uint64_t fb_location;
1010 uint32_t fb_format, fb_pitch_pixels, tiling_flags; 1010 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
1011 u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); 1011 u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
1012 u32 tmp;
1012 int r; 1013 int r;
1013 1014
1014 /* no fb bound */ 1015 /* no fb bound */
@@ -1137,6 +1138,15 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1137 WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, 1138 WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
1138 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); 1139 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
1139 1140
1141 /* pageflip setup */
1142 /* make sure flip is at vb rather than hb */
1143 tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
1144 tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN;
1145 WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
1146
1147 /* set pageflip to happen anywhere in vblank interval */
1148 WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
1149
1140 if (!atomic && fb && fb != crtc->fb) { 1150 if (!atomic && fb && fb != crtc->fb) {
1141 radeon_fb = to_radeon_framebuffer(fb); 1151 radeon_fb = to_radeon_framebuffer(fb);
1142 rbo = gem_to_radeon_bo(radeon_fb->obj); 1152 rbo = gem_to_radeon_bo(radeon_fb->obj);
@@ -1167,6 +1177,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1167 uint64_t fb_location; 1177 uint64_t fb_location;
1168 uint32_t fb_format, fb_pitch_pixels, tiling_flags; 1178 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
1169 u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; 1179 u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE;
1180 u32 tmp;
1170 int r; 1181 int r;
1171 1182
1172 /* no fb bound */ 1183 /* no fb bound */
@@ -1294,6 +1305,15 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1294 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, 1305 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
1295 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); 1306 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
1296 1307
1308 /* pageflip setup */
1309 /* make sure flip is at vb rather than hb */
1310 tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
1311 tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN;
1312 WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
1313
1314 /* set pageflip to happen anywhere in vblank interval */
1315 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
1316
1297 if (!atomic && fb && fb != crtc->fb) { 1317 if (!atomic && fb && fb != crtc->fb) {
1298 radeon_fb = to_radeon_framebuffer(fb); 1318 radeon_fb = to_radeon_framebuffer(fb);
1299 rbo = gem_to_radeon_bo(radeon_fb->obj); 1319 rbo = gem_to_radeon_bo(radeon_fb->obj);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 941080a77940..0b0cc74c08c0 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -43,17 +43,6 @@ static void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
43 43
44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) 44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc)
45{ 45{
46 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
47 u32 tmp;
48
49 /* make sure flip is at vb rather than hb */
50 tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
51 tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN;
52 WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
53
54 /* set pageflip to happen anywhere in vblank interval */
55 WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
56
57 /* enable the pflip int */ 46 /* enable the pflip int */
58 radeon_irq_kms_pflip_irq_get(rdev, crtc); 47 radeon_irq_kms_pflip_irq_get(rdev, crtc);
59} 48}
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 02d5c415f499..99768d9d91da 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -675,7 +675,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
675 ATOM_ENCODER_CAP_RECORD *cap_record; 675 ATOM_ENCODER_CAP_RECORD *cap_record;
676 u16 caps = 0; 676 u16 caps = 0;
677 677
678 while (record->ucRecordType > 0 && 678 while (record->ucRecordSize > 0 &&
679 record->ucRecordType > 0 &&
679 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { 680 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
680 switch (record->ucRecordType) { 681 switch (record->ucRecordType) {
681 case ATOM_ENCODER_CAP_RECORD_TYPE: 682 case ATOM_ENCODER_CAP_RECORD_TYPE:
@@ -720,7 +721,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
720 break; 721 break;
721 } 722 }
722 723
723 while (record->ucRecordType > 0 && 724 while (record->ucRecordSize > 0 &&
725 record->ucRecordType > 0 &&
724 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { 726 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
725 switch (record->ucRecordType) { 727 switch (record->ucRecordType) {
726 case ATOM_I2C_RECORD_TYPE: 728 case ATOM_I2C_RECORD_TYPE:
@@ -782,10 +784,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
782 ATOM_HPD_INT_RECORD *hpd_record; 784 ATOM_HPD_INT_RECORD *hpd_record;
783 ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; 785 ATOM_I2C_ID_CONFIG_ACCESS *i2c_config;
784 786
785 while (record->ucRecordType > 0 787 while (record->ucRecordSize > 0 &&
786 && record-> 788 record->ucRecordType > 0 &&
787 ucRecordType <= 789 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
788 ATOM_MAX_OBJECT_RECORD_NUMBER) {
789 switch (record->ucRecordType) { 790 switch (record->ucRecordType) {
790 case ATOM_I2C_RECORD_TYPE: 791 case ATOM_I2C_RECORD_TYPE:
791 i2c_record = 792 i2c_record =
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index cf602e2d0718..8caf546c8e92 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -2079,6 +2079,19 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
2079 DRM_MODE_CONNECTOR_DVII, &ddc_i2c, 2079 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
2080 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, 2080 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
2081 &hpd); 2081 &hpd);
2082 /* TV - TV DAC */
2083 ddc_i2c.valid = false;
2084 hpd.hpd = RADEON_HPD_NONE;
2085 radeon_add_legacy_encoder(dev,
2086 radeon_get_encoder_enum(dev,
2087 ATOM_DEVICE_TV1_SUPPORT,
2088 2),
2089 ATOM_DEVICE_TV1_SUPPORT);
2090 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
2091 DRM_MODE_CONNECTOR_SVIDEO,
2092 &ddc_i2c,
2093 CONNECTOR_OBJECT_ID_SVIDEO,
2094 &hpd);
2082 break; 2095 break;
2083 default: 2096 default:
2084 DRM_INFO("Connector table: %d (invalid)\n", 2097 DRM_INFO("Connector table: %d (invalid)\n",
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 19763f5df5e1..876cebc4b8ba 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -48,17 +48,6 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev);
48 48
49void rs600_pre_page_flip(struct radeon_device *rdev, int crtc) 49void rs600_pre_page_flip(struct radeon_device *rdev, int crtc)
50{ 50{
51 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
52 u32 tmp;
53
54 /* make sure flip is at vb rather than hb */
55 tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
56 tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN;
57 WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
58
59 /* set pageflip to happen anywhere in vblank interval */
60 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
61
62 /* enable the pflip int */ 51 /* enable the pflip int */
63 radeon_irq_kms_pflip_irq_get(rdev, crtc); 52 radeon_irq_kms_pflip_irq_get(rdev, crtc);
64} 53}
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 0b6a55ac2f87..2e618b5ac465 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1168,7 +1168,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1168 uint32_t page_alignment, 1168 uint32_t page_alignment,
1169 unsigned long buffer_start, 1169 unsigned long buffer_start,
1170 bool interruptible, 1170 bool interruptible,
1171 struct file *persistant_swap_storage, 1171 struct file *persistent_swap_storage,
1172 size_t acc_size, 1172 size_t acc_size,
1173 void (*destroy) (struct ttm_buffer_object *)) 1173 void (*destroy) (struct ttm_buffer_object *))
1174{ 1174{
@@ -1211,7 +1211,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1211 bo->priv_flags = 0; 1211 bo->priv_flags = 0;
1212 bo->mem.placement = (TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED); 1212 bo->mem.placement = (TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED);
1213 bo->seq_valid = false; 1213 bo->seq_valid = false;
1214 bo->persistant_swap_storage = persistant_swap_storage; 1214 bo->persistent_swap_storage = persistent_swap_storage;
1215 bo->acc_size = acc_size; 1215 bo->acc_size = acc_size;
1216 atomic_inc(&bo->glob->bo_count); 1216 atomic_inc(&bo->glob->bo_count);
1217 1217
@@ -1260,7 +1260,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
1260 uint32_t page_alignment, 1260 uint32_t page_alignment,
1261 unsigned long buffer_start, 1261 unsigned long buffer_start,
1262 bool interruptible, 1262 bool interruptible,
1263 struct file *persistant_swap_storage, 1263 struct file *persistent_swap_storage,
1264 struct ttm_buffer_object **p_bo) 1264 struct ttm_buffer_object **p_bo)
1265{ 1265{
1266 struct ttm_buffer_object *bo; 1266 struct ttm_buffer_object *bo;
@@ -1282,7 +1282,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
1282 1282
1283 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, 1283 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment,
1284 buffer_start, interruptible, 1284 buffer_start, interruptible,
1285 persistant_swap_storage, acc_size, NULL); 1285 persistent_swap_storage, acc_size, NULL);
1286 if (likely(ret == 0)) 1286 if (likely(ret == 0))
1287 *p_bo = bo; 1287 *p_bo = bo;
1288 1288
@@ -1863,7 +1863,7 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink)
1863 if (bo->bdev->driver->swap_notify) 1863 if (bo->bdev->driver->swap_notify)
1864 bo->bdev->driver->swap_notify(bo); 1864 bo->bdev->driver->swap_notify(bo);
1865 1865
1866 ret = ttm_tt_swapout(bo->ttm, bo->persistant_swap_storage); 1866 ret = ttm_tt_swapout(bo->ttm, bo->persistent_swap_storage);
1867out: 1867out:
1868 1868
1869 /** 1869 /**
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 86d5b1745a45..90e23e0bfadb 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -332,7 +332,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
332 ttm_tt_free_page_directory(ttm); 332 ttm_tt_free_page_directory(ttm);
333 } 333 }
334 334
335 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTANT_SWAP) && 335 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) &&
336 ttm->swap_storage) 336 ttm->swap_storage)
337 fput(ttm->swap_storage); 337 fput(ttm->swap_storage);
338 338
@@ -503,7 +503,7 @@ static int ttm_tt_swapin(struct ttm_tt *ttm)
503 page_cache_release(from_page); 503 page_cache_release(from_page);
504 } 504 }
505 505
506 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTANT_SWAP)) 506 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP))
507 fput(swap_storage); 507 fput(swap_storage);
508 ttm->swap_storage = NULL; 508 ttm->swap_storage = NULL;
509 ttm->page_flags &= ~TTM_PAGE_FLAG_SWAPPED; 509 ttm->page_flags &= ~TTM_PAGE_FLAG_SWAPPED;
@@ -514,7 +514,7 @@ out_err:
514 return ret; 514 return ret;
515} 515}
516 516
517int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage) 517int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
518{ 518{
519 struct address_space *swap_space; 519 struct address_space *swap_space;
520 struct file *swap_storage; 520 struct file *swap_storage;
@@ -540,7 +540,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
540 return 0; 540 return 0;
541 } 541 }
542 542
543 if (!persistant_swap_storage) { 543 if (!persistent_swap_storage) {
544 swap_storage = shmem_file_setup("ttm swap", 544 swap_storage = shmem_file_setup("ttm swap",
545 ttm->num_pages << PAGE_SHIFT, 545 ttm->num_pages << PAGE_SHIFT,
546 0); 546 0);
@@ -549,7 +549,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
549 return PTR_ERR(swap_storage); 549 return PTR_ERR(swap_storage);
550 } 550 }
551 } else 551 } else
552 swap_storage = persistant_swap_storage; 552 swap_storage = persistent_swap_storage;
553 553
554 swap_space = swap_storage->f_path.dentry->d_inode->i_mapping; 554 swap_space = swap_storage->f_path.dentry->d_inode->i_mapping;
555 555
@@ -577,12 +577,12 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
577 ttm_tt_free_alloced_pages(ttm); 577 ttm_tt_free_alloced_pages(ttm);
578 ttm->swap_storage = swap_storage; 578 ttm->swap_storage = swap_storage;
579 ttm->page_flags |= TTM_PAGE_FLAG_SWAPPED; 579 ttm->page_flags |= TTM_PAGE_FLAG_SWAPPED;
580 if (persistant_swap_storage) 580 if (persistent_swap_storage)
581 ttm->page_flags |= TTM_PAGE_FLAG_PERSISTANT_SWAP; 581 ttm->page_flags |= TTM_PAGE_FLAG_PERSISTENT_SWAP;
582 582
583 return 0; 583 return 0;
584out_err: 584out_err:
585 if (!persistant_swap_storage) 585 if (!persistent_swap_storage)
586 fput(swap_storage); 586 fput(swap_storage);
587 587
588 return ret; 588 return ret;
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c
index 97e22bef85ab..de5819199e2e 100644
--- a/drivers/hwmon/twl4030-madc-hwmon.c
+++ b/drivers/hwmon/twl4030-madc-hwmon.c
@@ -154,4 +154,4 @@ module_exit(twl4030_madc_hwmon_exit);
154MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver"); 154MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver");
155MODULE_LICENSE("GPL"); 155MODULE_LICENSE("GPL");
156MODULE_AUTHOR("J Keerthy"); 156MODULE_AUTHOR("J Keerthy");
157MODULE_ALIAS("twl4030_madc_hwmon"); 157MODULE_ALIAS("platform:twl4030_madc_hwmon");
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 0e406d73b2c8..177db6d5b2f5 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -430,6 +430,26 @@ static inline void ide_unlock_host(struct ide_host *host)
430 } 430 }
431} 431}
432 432
433static void __ide_requeue_and_plug(struct request_queue *q, struct request *rq)
434{
435 if (rq)
436 blk_requeue_request(q, rq);
437 if (rq || blk_peek_request(q)) {
438 /* Use 3ms as that was the old plug delay */
439 blk_delay_queue(q, 3);
440 }
441}
442
443void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq)
444{
445 struct request_queue *q = drive->queue;
446 unsigned long flags;
447
448 spin_lock_irqsave(q->queue_lock, flags);
449 __ide_requeue_and_plug(q, rq);
450 spin_unlock_irqrestore(q->queue_lock, flags);
451}
452
433/* 453/*
434 * Issue a new request to a device. 454 * Issue a new request to a device.
435 */ 455 */
@@ -550,28 +570,7 @@ plug_device:
550 ide_unlock_host(host); 570 ide_unlock_host(host);
551plug_device_2: 571plug_device_2:
552 spin_lock_irq(q->queue_lock); 572 spin_lock_irq(q->queue_lock);
553 573 __ide_requeue_and_plug(q, rq);
554 if (rq) {
555 blk_requeue_request(q, rq);
556 blk_delay_queue(q, queue_run_ms);
557 }
558}
559
560void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq)
561{
562 struct request_queue *q = drive->queue;
563 unsigned long flags;
564
565 spin_lock_irqsave(q->queue_lock, flags);
566
567 if (rq)
568 blk_requeue_request(q, rq);
569
570 spin_unlock_irqrestore(q->queue_lock, flags);
571
572 /* Use 3ms as that was the old plug delay */
573 if (rq)
574 blk_delay_queue(q, 3);
575} 574}
576 575
577static int drive_is_ready(ide_drive_t *drive) 576static int drive_is_ready(ide_drive_t *drive)
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index bee03d64c453..d712dffd2157 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -69,7 +69,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
69 u8 sts, val; 69 u8 sts, val;
70 70
71 sts = readb(kbd->io_base + STATUS_REG); 71 sts = readb(kbd->io_base + STATUS_REG);
72 if (sts & DATA_AVAIL) 72 if (!(sts & DATA_AVAIL))
73 return IRQ_NONE; 73 return IRQ_NONE;
74 74
75 if (kbd->last_key != KEY_RESERVED) { 75 if (kbd->last_key != KEY_RESERVED) {
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 364bdf43a381..736056897e50 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -302,10 +302,14 @@ static int uinput_validate_absbits(struct input_dev *dev)
302 int retval = 0; 302 int retval = 0;
303 303
304 for (cnt = 0; cnt < ABS_CNT; cnt++) { 304 for (cnt = 0; cnt < ABS_CNT; cnt++) {
305 int min, max;
305 if (!test_bit(cnt, dev->absbit)) 306 if (!test_bit(cnt, dev->absbit))
306 continue; 307 continue;
307 308
308 if (input_abs_get_max(dev, cnt) <= input_abs_get_min(dev, cnt)) { 309 min = input_abs_get_min(dev, cnt);
310 max = input_abs_get_max(dev, cnt);
311
312 if ((min != 0 || max != 0) && max <= min) {
309 printk(KERN_DEBUG 313 printk(KERN_DEBUG
310 "%s: invalid abs[%02x] min:%d max:%d\n", 314 "%s: invalid abs[%02x] min:%d max:%d\n",
311 UINPUT_NAME, cnt, 315 UINPUT_NAME, cnt,
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index aa186cf6c514..e06e045bf907 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -836,8 +836,8 @@ static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
836 }, 836 },
837 837
838 }, 838 },
839 { }
840#endif 839#endif
840 { }
841}; 841};
842 842
843static bool broken_olpc_ec; 843static bool broken_olpc_ec;
@@ -851,8 +851,8 @@ static const struct dmi_system_id __initconst olpc_dmi_table[] = {
851 DMI_MATCH(DMI_PRODUCT_NAME, "XO"), 851 DMI_MATCH(DMI_PRODUCT_NAME, "XO"),
852 }, 852 },
853 }, 853 },
854 { }
855#endif 854#endif
855 { }
856}; 856};
857 857
858void __init synaptics_module_init(void) 858void __init synaptics_module_init(void)
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index ac4c93689ab9..d37a48e099d0 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -869,15 +869,15 @@ static int i8042_controller_selftest(void)
869 do { 869 do {
870 870
871 if (i8042_command(&param, I8042_CMD_CTL_TEST)) { 871 if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
872 pr_err("i8042 controller self test timeout\n"); 872 pr_err("i8042 controller selftest timeout\n");
873 return -ENODEV; 873 return -ENODEV;
874 } 874 }
875 875
876 if (param == I8042_RET_CTL_TEST) 876 if (param == I8042_RET_CTL_TEST)
877 return 0; 877 return 0;
878 878
879 pr_err("i8042 controller selftest failed. (%#x != %#x)\n", 879 dbg("i8042 controller selftest: %#x != %#x\n",
880 param, I8042_RET_CTL_TEST); 880 param, I8042_RET_CTL_TEST);
881 msleep(50); 881 msleep(50);
882 } while (i++ < 5); 882 } while (i++ < 5);
883 883
@@ -891,6 +891,7 @@ static int i8042_controller_selftest(void)
891 pr_info("giving up on controller selftest, continuing anyway...\n"); 891 pr_info("giving up on controller selftest, continuing anyway...\n");
892 return 0; 892 return 0;
893#else 893#else
894 pr_err("i8042 controller selftest failed\n");
894 return -EIO; 895 return -EIO;
895#endif 896#endif
896} 897}
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c
index 9da6fbcaaa7e..7ec3c97dc1b9 100644
--- a/drivers/input/serio/rpckbd.c
+++ b/drivers/input/serio/rpckbd.c
@@ -90,7 +90,7 @@ static int rpckbd_open(struct serio *port)
90 90
91 if (request_irq(IRQ_KEYBOARDTX, rpckbd_tx, 0, "rpckbd", port) != 0) { 91 if (request_irq(IRQ_KEYBOARDTX, rpckbd_tx, 0, "rpckbd", port) != 0) {
92 printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ\n"); 92 printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ\n");
93 free_irq(IRQ_KEYBOARDRX, NULL); 93 free_irq(IRQ_KEYBOARDRX, port);
94 return -EBUSY; 94 return -EBUSY;
95 } 95 }
96 96
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index 337bf51bc984..fdb6a3976f94 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -208,6 +208,12 @@ int sparse_keymap_setup(struct input_dev *dev,
208 } 208 }
209 } 209 }
210 210
211 if (test_bit(EV_KEY, dev->evbit)) {
212 __set_bit(KEY_UNKNOWN, dev->keybit);
213 __set_bit(EV_MSC, dev->evbit);
214 __set_bit(MSC_SCAN, dev->mscbit);
215 }
216
211 dev->keycode = map; 217 dev->keycode = map;
212 dev->keycodemax = map_size; 218 dev->keycodemax = map_size;
213 dev->getkeycode = sparse_keymap_getkeycode; 219 dev->getkeycode = sparse_keymap_getkeycode;
@@ -268,6 +274,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k
268{ 274{
269 switch (ke->type) { 275 switch (ke->type) {
270 case KE_KEY: 276 case KE_KEY:
277 input_event(dev, EV_MSC, MSC_SCAN, ke->code);
271 input_report_key(dev, ke->keycode, value); 278 input_report_key(dev, ke->keycode, value);
272 input_sync(dev); 279 input_sync(dev);
273 if (value && autorelease) { 280 if (value && autorelease) {
@@ -305,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
305{ 312{
306 const struct key_entry *ke = 313 const struct key_entry *ke =
307 sparse_keymap_entry_from_scancode(dev, code); 314 sparse_keymap_entry_from_scancode(dev, code);
315 struct key_entry unknown_ke;
308 316
309 if (ke) { 317 if (ke) {
310 sparse_keymap_report_entry(dev, ke, value, autorelease); 318 sparse_keymap_report_entry(dev, ke, value, autorelease);
311 return true; 319 return true;
312 } 320 }
313 321
322 /* Report an unknown key event as a debugging aid */
323 unknown_ke.type = KE_KEY;
324 unknown_ke.code = code;
325 unknown_ke.keycode = KEY_UNKNOWN;
326 sparse_keymap_report_entry(dev, &unknown_ke, value, true);
327
314 return false; 328 return false;
315} 329}
316EXPORT_SYMBOL(sparse_keymap_report_event); 330EXPORT_SYMBOL(sparse_keymap_report_event);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 5597637cfd41..08ba5ad9c9be 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -16,6 +16,14 @@
16#include "wacom.h" 16#include "wacom.h"
17#include <linux/input/mt.h> 17#include <linux/input/mt.h>
18 18
19/* resolution for penabled devices */
20#define WACOM_PL_RES 20
21#define WACOM_PENPRTN_RES 40
22#define WACOM_VOLITO_RES 50
23#define WACOM_GRAPHIRE_RES 80
24#define WACOM_INTUOS_RES 100
25#define WACOM_INTUOS3_RES 200
26
19static int wacom_penpartner_irq(struct wacom_wac *wacom) 27static int wacom_penpartner_irq(struct wacom_wac *wacom)
20{ 28{
21 unsigned char *data = wacom->data; 29 unsigned char *data = wacom->data;
@@ -1055,6 +1063,19 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1055 input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 1063 input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max,
1056 features->pressure_fuzz, 0); 1064 features->pressure_fuzz, 0);
1057 1065
1066 if (features->device_type == BTN_TOOL_PEN) {
1067 /* penabled devices have fixed resolution for each model */
1068 input_abs_set_res(input_dev, ABS_X, features->x_resolution);
1069 input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
1070 } else {
1071 input_abs_set_res(input_dev, ABS_X,
1072 wacom_calculate_touch_res(features->x_max,
1073 features->x_phy));
1074 input_abs_set_res(input_dev, ABS_Y,
1075 wacom_calculate_touch_res(features->y_max,
1076 features->y_phy));
1077 }
1078
1058 __set_bit(ABS_MISC, input_dev->absbit); 1079 __set_bit(ABS_MISC, input_dev->absbit);
1059 1080
1060 switch (wacom_wac->features.type) { 1081 switch (wacom_wac->features.type) {
@@ -1171,15 +1192,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1171 case TABLETPC: 1192 case TABLETPC:
1172 __clear_bit(ABS_MISC, input_dev->absbit); 1193 __clear_bit(ABS_MISC, input_dev->absbit);
1173 1194
1174 if (features->device_type != BTN_TOOL_PEN) { 1195 if (features->device_type != BTN_TOOL_PEN)
1175 input_abs_set_res(input_dev, ABS_X,
1176 wacom_calculate_touch_res(features->x_max,
1177 features->x_phy));
1178 input_abs_set_res(input_dev, ABS_Y,
1179 wacom_calculate_touch_res(features->y_max,
1180 features->y_phy));
1181 break; /* no need to process stylus stuff */ 1196 break; /* no need to process stylus stuff */
1182 } 1197
1183 /* fall through */ 1198 /* fall through */
1184 1199
1185 case PL: 1200 case PL:
@@ -1216,12 +1231,6 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1216 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1231 input_set_abs_params(input_dev, ABS_MT_PRESSURE,
1217 0, features->pressure_max, 1232 0, features->pressure_max,
1218 features->pressure_fuzz, 0); 1233 features->pressure_fuzz, 0);
1219 input_abs_set_res(input_dev, ABS_X,
1220 wacom_calculate_touch_res(features->x_max,
1221 features->x_phy));
1222 input_abs_set_res(input_dev, ABS_Y,
1223 wacom_calculate_touch_res(features->y_max,
1224 features->y_phy));
1225 } else if (features->device_type == BTN_TOOL_PEN) { 1234 } else if (features->device_type == BTN_TOOL_PEN) {
1226 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 1235 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1227 __set_bit(BTN_TOOL_PEN, input_dev->keybit); 1236 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@@ -1233,161 +1242,242 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1233} 1242}
1234 1243
1235static const struct wacom_features wacom_features_0x00 = 1244static const struct wacom_features wacom_features_0x00 =
1236 { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }; 1245 { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
1246 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
1237static const struct wacom_features wacom_features_0x10 = 1247static const struct wacom_features wacom_features_0x10 =
1238 { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; 1248 { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
1249 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1239static const struct wacom_features wacom_features_0x11 = 1250static const struct wacom_features wacom_features_0x11 =
1240 { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; 1251 { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
1252 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1241static const struct wacom_features wacom_features_0x12 = 1253static const struct wacom_features wacom_features_0x12 =
1242 { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }; 1254 { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511,
1255 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1243static const struct wacom_features wacom_features_0x13 = 1256static const struct wacom_features wacom_features_0x13 =
1244 { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }; 1257 { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
1258 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1245static const struct wacom_features wacom_features_0x14 = 1259static const struct wacom_features wacom_features_0x14 =
1246 { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; 1260 { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1261 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1247static const struct wacom_features wacom_features_0x15 = 1262static const struct wacom_features wacom_features_0x15 =
1248 { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }; 1263 { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
1264 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1249static const struct wacom_features wacom_features_0x16 = 1265static const struct wacom_features wacom_features_0x16 =
1250 { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }; 1266 { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1267 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1251static const struct wacom_features wacom_features_0x17 = 1268static const struct wacom_features wacom_features_0x17 =
1252 { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; 1269 { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
1270 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1253static const struct wacom_features wacom_features_0x18 = 1271static const struct wacom_features wacom_features_0x18 =
1254 { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }; 1272 { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511,
1273 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1255static const struct wacom_features wacom_features_0x19 = 1274static const struct wacom_features wacom_features_0x19 =
1256 { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; 1275 { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1276 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1257static const struct wacom_features wacom_features_0x60 = 1277static const struct wacom_features wacom_features_0x60 =
1258 { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; 1278 { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1279 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1259static const struct wacom_features wacom_features_0x61 = 1280static const struct wacom_features wacom_features_0x61 =
1260 { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }; 1281 { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255,
1282 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1261static const struct wacom_features wacom_features_0x62 = 1283static const struct wacom_features wacom_features_0x62 =
1262 { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; 1284 { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1285 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1263static const struct wacom_features wacom_features_0x63 = 1286static const struct wacom_features wacom_features_0x63 =
1264 { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }; 1287 { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511,
1288 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1265static const struct wacom_features wacom_features_0x64 = 1289static const struct wacom_features wacom_features_0x64 =
1266 { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }; 1290 { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511,
1291 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1267static const struct wacom_features wacom_features_0x65 = 1292static const struct wacom_features wacom_features_0x65 =
1268 { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; 1293 { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
1294 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1269static const struct wacom_features wacom_features_0x69 = 1295static const struct wacom_features wacom_features_0x69 =
1270 { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; 1296 { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1297 63, GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
1271static const struct wacom_features wacom_features_0x20 = 1298static const struct wacom_features wacom_features_0x20 =
1272 { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; 1299 { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
1300 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1273static const struct wacom_features wacom_features_0x21 = 1301static const struct wacom_features wacom_features_0x21 =
1274 { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; 1302 { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1303 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1275static const struct wacom_features wacom_features_0x22 = 1304static const struct wacom_features wacom_features_0x22 =
1276 { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; 1305 { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
1306 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1277static const struct wacom_features wacom_features_0x23 = 1307static const struct wacom_features wacom_features_0x23 =
1278 { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; 1308 { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
1309 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1279static const struct wacom_features wacom_features_0x24 = 1310static const struct wacom_features wacom_features_0x24 =
1280 { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; 1311 { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
1312 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1281static const struct wacom_features wacom_features_0x30 = 1313static const struct wacom_features wacom_features_0x30 =
1282 { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }; 1314 { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255,
1315 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1283static const struct wacom_features wacom_features_0x31 = 1316static const struct wacom_features wacom_features_0x31 =
1284 { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }; 1317 { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255,
1318 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1285static const struct wacom_features wacom_features_0x32 = 1319static const struct wacom_features wacom_features_0x32 =
1286 { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }; 1320 { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255,
1321 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1287static const struct wacom_features wacom_features_0x33 = 1322static const struct wacom_features wacom_features_0x33 =
1288 { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }; 1323 { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255,
1324 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1289static const struct wacom_features wacom_features_0x34 = 1325static const struct wacom_features wacom_features_0x34 =
1290 { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }; 1326 { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511,
1327 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1291static const struct wacom_features wacom_features_0x35 = 1328static const struct wacom_features wacom_features_0x35 =
1292 { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }; 1329 { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511,
1330 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1293static const struct wacom_features wacom_features_0x37 = 1331static const struct wacom_features wacom_features_0x37 =
1294 { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }; 1332 { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511,
1333 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1295static const struct wacom_features wacom_features_0x38 = 1334static const struct wacom_features wacom_features_0x38 =
1296 { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; 1335 { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
1336 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1297static const struct wacom_features wacom_features_0x39 = 1337static const struct wacom_features wacom_features_0x39 =
1298 { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }; 1338 { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511,
1339 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1299static const struct wacom_features wacom_features_0xC4 = 1340static const struct wacom_features wacom_features_0xC4 =
1300 { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; 1341 { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
1342 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1301static const struct wacom_features wacom_features_0xC0 = 1343static const struct wacom_features wacom_features_0xC0 =
1302 { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; 1344 { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
1345 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1303static const struct wacom_features wacom_features_0xC2 = 1346static const struct wacom_features wacom_features_0xC2 =
1304 { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; 1347 { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
1348 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1305static const struct wacom_features wacom_features_0x03 = 1349static const struct wacom_features wacom_features_0x03 =
1306 { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }; 1350 { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511,
1351 0, PTU, WACOM_PL_RES, WACOM_PL_RES };
1307static const struct wacom_features wacom_features_0x41 = 1352static const struct wacom_features wacom_features_0x41 =
1308 { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; 1353 { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
1354 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1309static const struct wacom_features wacom_features_0x42 = 1355static const struct wacom_features wacom_features_0x42 =
1310 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; 1356 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1357 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1311static const struct wacom_features wacom_features_0x43 = 1358static const struct wacom_features wacom_features_0x43 =
1312 { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; 1359 { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
1360 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1313static const struct wacom_features wacom_features_0x44 = 1361static const struct wacom_features wacom_features_0x44 =
1314 { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; 1362 { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
1363 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1315static const struct wacom_features wacom_features_0x45 = 1364static const struct wacom_features wacom_features_0x45 =
1316 { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; 1365 { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
1366 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1317static const struct wacom_features wacom_features_0xB0 = 1367static const struct wacom_features wacom_features_0xB0 =
1318 { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }; 1368 { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023,
1369 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1319static const struct wacom_features wacom_features_0xB1 = 1370static const struct wacom_features wacom_features_0xB1 =
1320 { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }; 1371 { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023,
1372 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1321static const struct wacom_features wacom_features_0xB2 = 1373static const struct wacom_features wacom_features_0xB2 =
1322 { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }; 1374 { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023,
1375 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1323static const struct wacom_features wacom_features_0xB3 = 1376static const struct wacom_features wacom_features_0xB3 =
1324 { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }; 1377 { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023,
1378 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1325static const struct wacom_features wacom_features_0xB4 = 1379static const struct wacom_features wacom_features_0xB4 =
1326 { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }; 1380 { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023,
1381 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1327static const struct wacom_features wacom_features_0xB5 = 1382static const struct wacom_features wacom_features_0xB5 =
1328 { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }; 1383 { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023,
1384 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1329static const struct wacom_features wacom_features_0xB7 = 1385static const struct wacom_features wacom_features_0xB7 =
1330 { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }; 1386 { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023,
1387 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1331static const struct wacom_features wacom_features_0xB8 = 1388static const struct wacom_features wacom_features_0xB8 =
1332 { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }; 1389 { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
1390 63, INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1333static const struct wacom_features wacom_features_0xB9 = 1391static const struct wacom_features wacom_features_0xB9 =
1334 { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }; 1392 { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
1393 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1335static const struct wacom_features wacom_features_0xBA = 1394static const struct wacom_features wacom_features_0xBA =
1336 { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }; 1395 { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
1396 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1337static const struct wacom_features wacom_features_0xBB = 1397static const struct wacom_features wacom_features_0xBB =
1338 { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }; 1398 { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047,
1399 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1339static const struct wacom_features wacom_features_0xBC = 1400static const struct wacom_features wacom_features_0xBC =
1340 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, 63, INTUOS4 }; 1401 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047,
1402 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1341static const struct wacom_features wacom_features_0x3F = 1403static const struct wacom_features wacom_features_0x3F =
1342 { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }; 1404 { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023,
1405 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1343static const struct wacom_features wacom_features_0xC5 = 1406static const struct wacom_features wacom_features_0xC5 =
1344 { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE }; 1407 { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023,
1408 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1345static const struct wacom_features wacom_features_0xC6 = 1409static const struct wacom_features wacom_features_0xC6 =
1346 { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }; 1410 { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023,
1411 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1347static const struct wacom_features wacom_features_0xC7 = 1412static const struct wacom_features wacom_features_0xC7 =
1348 { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }; 1413 { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511,
1414 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1349static const struct wacom_features wacom_features_0xCE = 1415static const struct wacom_features wacom_features_0xCE =
1350 { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511, 0, DTU }; 1416 { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511,
1417 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1351static const struct wacom_features wacom_features_0xF0 = 1418static const struct wacom_features wacom_features_0xF0 =
1352 { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, 0, DTU }; 1419 { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511,
1420 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1353static const struct wacom_features wacom_features_0xCC = 1421static const struct wacom_features wacom_features_0xCC =
1354 { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047, 63, WACOM_21UX2 }; 1422 { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047,
1423 63, WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1355static const struct wacom_features wacom_features_0x90 = 1424static const struct wacom_features wacom_features_0x90 =
1356 { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1425 { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1426 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1357static const struct wacom_features wacom_features_0x93 = 1427static const struct wacom_features wacom_features_0x93 =
1358 { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1428 { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1429 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1359static const struct wacom_features wacom_features_0x9A = 1430static const struct wacom_features wacom_features_0x9A =
1360 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1431 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1432 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1361static const struct wacom_features wacom_features_0x9F = 1433static const struct wacom_features wacom_features_0x9F =
1362 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1434 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1435 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1363static const struct wacom_features wacom_features_0xE2 = 1436static const struct wacom_features wacom_features_0xE2 =
1364 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; 1437 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
1438 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1365static const struct wacom_features wacom_features_0xE3 = 1439static const struct wacom_features wacom_features_0xE3 =
1366 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; 1440 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
1441 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1442static const struct wacom_features wacom_features_0xE6 =
1443 { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255,
1444 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1367static const struct wacom_features wacom_features_0x47 = 1445static const struct wacom_features wacom_features_0x47 =
1368 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; 1446 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1369static struct wacom_features wacom_features_0xD0 = 1447 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1370 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1448static const struct wacom_features wacom_features_0xD0 =
1371static struct wacom_features wacom_features_0xD1 = 1449 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1372 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1450 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1373static struct wacom_features wacom_features_0xD2 = 1451static const struct wacom_features wacom_features_0xD1 =
1374 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1452 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1375static struct wacom_features wacom_features_0xD3 = 1453 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1376 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1454static const struct wacom_features wacom_features_0xD2 =
1455 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1456 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1457static const struct wacom_features wacom_features_0xD3 =
1458 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1459 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1377static const struct wacom_features wacom_features_0xD4 = 1460static const struct wacom_features wacom_features_0xD4 =
1378 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; 1461 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255,
1379static struct wacom_features wacom_features_0xD6 = 1462 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1380 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1463static const struct wacom_features wacom_features_0xD6 =
1381static struct wacom_features wacom_features_0xD7 = 1464 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1382 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1465 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1383static struct wacom_features wacom_features_0xD8 = 1466static const struct wacom_features wacom_features_0xD7 =
1384 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1467 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1385static struct wacom_features wacom_features_0xDA = 1468 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1386 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1469static const struct wacom_features wacom_features_0xD8 =
1470 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1471 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1472static const struct wacom_features wacom_features_0xDA =
1473 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1474 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1387static struct wacom_features wacom_features_0xDB = 1475static struct wacom_features wacom_features_0xDB =
1388 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1476 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1477 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1389static const struct wacom_features wacom_features_0x6004 = 1478static const struct wacom_features wacom_features_0x6004 =
1390 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 0, TABLETPC }; 1479 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
1480 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1391 1481
1392#define USB_DEVICE_WACOM(prod) \ 1482#define USB_DEVICE_WACOM(prod) \
1393 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ 1483 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1474,6 +1564,7 @@ const struct usb_device_id wacom_ids[] = {
1474 { USB_DEVICE_WACOM(0x9F) }, 1564 { USB_DEVICE_WACOM(0x9F) },
1475 { USB_DEVICE_WACOM(0xE2) }, 1565 { USB_DEVICE_WACOM(0xE2) },
1476 { USB_DEVICE_WACOM(0xE3) }, 1566 { USB_DEVICE_WACOM(0xE3) },
1567 { USB_DEVICE_WACOM(0xE6) },
1477 { USB_DEVICE_WACOM(0x47) }, 1568 { USB_DEVICE_WACOM(0x47) },
1478 { USB_DEVICE_LENOVO(0x6004) }, 1569 { USB_DEVICE_LENOVO(0x6004) },
1479 { } 1570 { }
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 835f756b150c..53eb71b68330 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -74,6 +74,8 @@ struct wacom_features {
74 int pressure_max; 74 int pressure_max;
75 int distance_max; 75 int distance_max;
76 int type; 76 int type;
77 int x_resolution;
78 int y_resolution;
77 int device_type; 79 int device_type;
78 int x_phy; 80 int x_phy;
79 int y_phy; 81 int y_phy;
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
index b4d7f63deff1..efa06882de00 100644
--- a/drivers/input/touchscreen/h3600_ts_input.c
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -62,7 +62,7 @@ MODULE_LICENSE("GPL");
62 Programmer has no control over these numbers. 62 Programmer has no control over these numbers.
63 TODO there are holes - specifically 1,7,0x0a 63 TODO there are holes - specifically 1,7,0x0a
64*/ 64*/
65#define VERSION_ID 0 /* Get Version (request/respose) */ 65#define VERSION_ID 0 /* Get Version (request/response) */
66#define KEYBD_ID 2 /* Keyboard (event) */ 66#define KEYBD_ID 2 /* Keyboard (event) */
67#define TOUCHS_ID 3 /* Touch Screen (event)*/ 67#define TOUCHS_ID 3 /* Touch Screen (event)*/
68#define EEPROM_READ_ID 4 /* (request/response) */ 68#define EEPROM_READ_ID 4 /* (request/response) */
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index bca2af2e3760..c987033714f6 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -153,7 +153,7 @@ static struct i2c_adapter * u3_0;
153static struct i2c_adapter * u3_1; 153static struct i2c_adapter * u3_1;
154static struct i2c_adapter * k2; 154static struct i2c_adapter * k2;
155static struct i2c_client * fcu; 155static struct i2c_client * fcu;
156static struct cpu_pid_state cpu_state[2]; 156static struct cpu_pid_state processor_state[2];
157static struct basckside_pid_params backside_params; 157static struct basckside_pid_params backside_params;
158static struct backside_pid_state backside_state; 158static struct backside_pid_state backside_state;
159static struct drives_pid_state drives_state; 159static struct drives_pid_state drives_state;
@@ -664,8 +664,8 @@ static int read_eeprom(int cpu, struct mpu_data *out)
664 664
665static void fetch_cpu_pumps_minmax(void) 665static void fetch_cpu_pumps_minmax(void)
666{ 666{
667 struct cpu_pid_state *state0 = &cpu_state[0]; 667 struct cpu_pid_state *state0 = &processor_state[0];
668 struct cpu_pid_state *state1 = &cpu_state[1]; 668 struct cpu_pid_state *state1 = &processor_state[1];
669 u16 pump_min = 0, pump_max = 0xffff; 669 u16 pump_min = 0, pump_max = 0xffff;
670 u16 tmp[4]; 670 u16 tmp[4];
671 671
@@ -717,17 +717,17 @@ static ssize_t show_##name(struct device *dev, struct device_attribute *attr, ch
717 return sprintf(buf, "%d", data); \ 717 return sprintf(buf, "%d", data); \
718} 718}
719 719
720BUILD_SHOW_FUNC_FIX(cpu0_temperature, cpu_state[0].last_temp) 720BUILD_SHOW_FUNC_FIX(cpu0_temperature, processor_state[0].last_temp)
721BUILD_SHOW_FUNC_FIX(cpu0_voltage, cpu_state[0].voltage) 721BUILD_SHOW_FUNC_FIX(cpu0_voltage, processor_state[0].voltage)
722BUILD_SHOW_FUNC_FIX(cpu0_current, cpu_state[0].current_a) 722BUILD_SHOW_FUNC_FIX(cpu0_current, processor_state[0].current_a)
723BUILD_SHOW_FUNC_INT(cpu0_exhaust_fan_rpm, cpu_state[0].rpm) 723BUILD_SHOW_FUNC_INT(cpu0_exhaust_fan_rpm, processor_state[0].rpm)
724BUILD_SHOW_FUNC_INT(cpu0_intake_fan_rpm, cpu_state[0].intake_rpm) 724BUILD_SHOW_FUNC_INT(cpu0_intake_fan_rpm, processor_state[0].intake_rpm)
725 725
726BUILD_SHOW_FUNC_FIX(cpu1_temperature, cpu_state[1].last_temp) 726BUILD_SHOW_FUNC_FIX(cpu1_temperature, processor_state[1].last_temp)
727BUILD_SHOW_FUNC_FIX(cpu1_voltage, cpu_state[1].voltage) 727BUILD_SHOW_FUNC_FIX(cpu1_voltage, processor_state[1].voltage)
728BUILD_SHOW_FUNC_FIX(cpu1_current, cpu_state[1].current_a) 728BUILD_SHOW_FUNC_FIX(cpu1_current, processor_state[1].current_a)
729BUILD_SHOW_FUNC_INT(cpu1_exhaust_fan_rpm, cpu_state[1].rpm) 729BUILD_SHOW_FUNC_INT(cpu1_exhaust_fan_rpm, processor_state[1].rpm)
730BUILD_SHOW_FUNC_INT(cpu1_intake_fan_rpm, cpu_state[1].intake_rpm) 730BUILD_SHOW_FUNC_INT(cpu1_intake_fan_rpm, processor_state[1].intake_rpm)
731 731
732BUILD_SHOW_FUNC_FIX(backside_temperature, backside_state.last_temp) 732BUILD_SHOW_FUNC_FIX(backside_temperature, backside_state.last_temp)
733BUILD_SHOW_FUNC_INT(backside_fan_pwm, backside_state.pwm) 733BUILD_SHOW_FUNC_INT(backside_fan_pwm, backside_state.pwm)
@@ -919,8 +919,8 @@ static void do_cpu_pid(struct cpu_pid_state *state, s32 temp, s32 power)
919 919
920static void do_monitor_cpu_combined(void) 920static void do_monitor_cpu_combined(void)
921{ 921{
922 struct cpu_pid_state *state0 = &cpu_state[0]; 922 struct cpu_pid_state *state0 = &processor_state[0];
923 struct cpu_pid_state *state1 = &cpu_state[1]; 923 struct cpu_pid_state *state1 = &processor_state[1];
924 s32 temp0, power0, temp1, power1; 924 s32 temp0, power0, temp1, power1;
925 s32 temp_combi, power_combi; 925 s32 temp_combi, power_combi;
926 int rc, intake, pump; 926 int rc, intake, pump;
@@ -1150,7 +1150,7 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state)
1150/* 1150/*
1151 * Initialize the state structure for one CPU control loop 1151 * Initialize the state structure for one CPU control loop
1152 */ 1152 */
1153static int init_cpu_state(struct cpu_pid_state *state, int index) 1153static int init_processor_state(struct cpu_pid_state *state, int index)
1154{ 1154{
1155 int err; 1155 int err;
1156 1156
@@ -1205,7 +1205,7 @@ static int init_cpu_state(struct cpu_pid_state *state, int index)
1205/* 1205/*
1206 * Dispose of the state data for one CPU control loop 1206 * Dispose of the state data for one CPU control loop
1207 */ 1207 */
1208static void dispose_cpu_state(struct cpu_pid_state *state) 1208static void dispose_processor_state(struct cpu_pid_state *state)
1209{ 1209{
1210 if (state->monitor == NULL) 1210 if (state->monitor == NULL)
1211 return; 1211 return;
@@ -1804,9 +1804,9 @@ static int main_control_loop(void *x)
1804 set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM); 1804 set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM);
1805 1805
1806 /* Initialize ADCs */ 1806 /* Initialize ADCs */
1807 initialize_adc(&cpu_state[0]); 1807 initialize_adc(&processor_state[0]);
1808 if (cpu_state[1].monitor != NULL) 1808 if (processor_state[1].monitor != NULL)
1809 initialize_adc(&cpu_state[1]); 1809 initialize_adc(&processor_state[1]);
1810 1810
1811 fcu_tickle_ticks = FCU_TICKLE_TICKS; 1811 fcu_tickle_ticks = FCU_TICKLE_TICKS;
1812 1812
@@ -1833,14 +1833,14 @@ static int main_control_loop(void *x)
1833 if (cpu_pid_type == CPU_PID_TYPE_COMBINED) 1833 if (cpu_pid_type == CPU_PID_TYPE_COMBINED)
1834 do_monitor_cpu_combined(); 1834 do_monitor_cpu_combined();
1835 else if (cpu_pid_type == CPU_PID_TYPE_RACKMAC) { 1835 else if (cpu_pid_type == CPU_PID_TYPE_RACKMAC) {
1836 do_monitor_cpu_rack(&cpu_state[0]); 1836 do_monitor_cpu_rack(&processor_state[0]);
1837 if (cpu_state[1].monitor != NULL) 1837 if (processor_state[1].monitor != NULL)
1838 do_monitor_cpu_rack(&cpu_state[1]); 1838 do_monitor_cpu_rack(&processor_state[1]);
1839 // better deal with UP 1839 // better deal with UP
1840 } else { 1840 } else {
1841 do_monitor_cpu_split(&cpu_state[0]); 1841 do_monitor_cpu_split(&processor_state[0]);
1842 if (cpu_state[1].monitor != NULL) 1842 if (processor_state[1].monitor != NULL)
1843 do_monitor_cpu_split(&cpu_state[1]); 1843 do_monitor_cpu_split(&processor_state[1]);
1844 // better deal with UP 1844 // better deal with UP
1845 } 1845 }
1846 /* Then, the rest */ 1846 /* Then, the rest */
@@ -1885,8 +1885,8 @@ static int main_control_loop(void *x)
1885 */ 1885 */
1886static void dispose_control_loops(void) 1886static void dispose_control_loops(void)
1887{ 1887{
1888 dispose_cpu_state(&cpu_state[0]); 1888 dispose_processor_state(&processor_state[0]);
1889 dispose_cpu_state(&cpu_state[1]); 1889 dispose_processor_state(&processor_state[1]);
1890 dispose_backside_state(&backside_state); 1890 dispose_backside_state(&backside_state);
1891 dispose_drives_state(&drives_state); 1891 dispose_drives_state(&drives_state);
1892 dispose_slots_state(&slots_state); 1892 dispose_slots_state(&slots_state);
@@ -1928,12 +1928,12 @@ static int create_control_loops(void)
1928 /* Create control loops for everything. If any fail, everything 1928 /* Create control loops for everything. If any fail, everything
1929 * fails 1929 * fails
1930 */ 1930 */
1931 if (init_cpu_state(&cpu_state[0], 0)) 1931 if (init_processor_state(&processor_state[0], 0))
1932 goto fail; 1932 goto fail;
1933 if (cpu_pid_type == CPU_PID_TYPE_COMBINED) 1933 if (cpu_pid_type == CPU_PID_TYPE_COMBINED)
1934 fetch_cpu_pumps_minmax(); 1934 fetch_cpu_pumps_minmax();
1935 1935
1936 if (cpu_count > 1 && init_cpu_state(&cpu_state[1], 1)) 1936 if (cpu_count > 1 && init_processor_state(&processor_state[1], 1))
1937 goto fail; 1937 goto fail;
1938 if (init_backside_state(&backside_state)) 1938 if (init_backside_state(&backside_state))
1939 goto fail; 1939 goto fail;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 416d4e258df6..cb8380c9767f 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -927,20 +927,80 @@ static int dm_table_build_index(struct dm_table *t)
927} 927}
928 928
929/* 929/*
930 * Get a disk whose integrity profile reflects the table's profile.
931 * If %match_all is true, all devices' profiles must match.
932 * If %match_all is false, all devices must at least have an
933 * allocated integrity profile; but uninitialized is ok.
934 * Returns NULL if integrity support was inconsistent or unavailable.
935 */
936static struct gendisk * dm_table_get_integrity_disk(struct dm_table *t,
937 bool match_all)
938{
939 struct list_head *devices = dm_table_get_devices(t);
940 struct dm_dev_internal *dd = NULL;
941 struct gendisk *prev_disk = NULL, *template_disk = NULL;
942
943 list_for_each_entry(dd, devices, list) {
944 template_disk = dd->dm_dev.bdev->bd_disk;
945 if (!blk_get_integrity(template_disk))
946 goto no_integrity;
947 if (!match_all && !blk_integrity_is_initialized(template_disk))
948 continue; /* skip uninitialized profiles */
949 else if (prev_disk &&
950 blk_integrity_compare(prev_disk, template_disk) < 0)
951 goto no_integrity;
952 prev_disk = template_disk;
953 }
954
955 return template_disk;
956
957no_integrity:
958 if (prev_disk)
959 DMWARN("%s: integrity not set: %s and %s profile mismatch",
960 dm_device_name(t->md),
961 prev_disk->disk_name,
962 template_disk->disk_name);
963 return NULL;
964}
965
966/*
930 * Register the mapped device for blk_integrity support if 967 * Register the mapped device for blk_integrity support if
931 * the underlying devices support it. 968 * the underlying devices have an integrity profile. But all devices
969 * may not have matching profiles (checking all devices isn't reliable
970 * during table load because this table may use other DM device(s) which
971 * must be resumed before they will have an initialized integity profile).
972 * Stacked DM devices force a 2 stage integrity profile validation:
973 * 1 - during load, validate all initialized integrity profiles match
974 * 2 - during resume, validate all integrity profiles match
932 */ 975 */
933static int dm_table_prealloc_integrity(struct dm_table *t, struct mapped_device *md) 976static int dm_table_prealloc_integrity(struct dm_table *t, struct mapped_device *md)
934{ 977{
935 struct list_head *devices = dm_table_get_devices(t); 978 struct gendisk *template_disk = NULL;
936 struct dm_dev_internal *dd;
937 979
938 list_for_each_entry(dd, devices, list) 980 template_disk = dm_table_get_integrity_disk(t, false);
939 if (bdev_get_integrity(dd->dm_dev.bdev)) { 981 if (!template_disk)
940 t->integrity_supported = 1; 982 return 0;
941 return blk_integrity_register(dm_disk(md), NULL);
942 }
943 983
984 if (!blk_integrity_is_initialized(dm_disk(md))) {
985 t->integrity_supported = 1;
986 return blk_integrity_register(dm_disk(md), NULL);
987 }
988
989 /*
990 * If DM device already has an initalized integrity
991 * profile the new profile should not conflict.
992 */
993 if (blk_integrity_is_initialized(template_disk) &&
994 blk_integrity_compare(dm_disk(md), template_disk) < 0) {
995 DMWARN("%s: conflict with existing integrity profile: "
996 "%s profile mismatch",
997 dm_device_name(t->md),
998 template_disk->disk_name);
999 return 1;
1000 }
1001
1002 /* Preserve existing initialized integrity profile */
1003 t->integrity_supported = 1;
944 return 0; 1004 return 0;
945} 1005}
946 1006
@@ -1094,41 +1154,27 @@ combine_limits:
1094 1154
1095/* 1155/*
1096 * Set the integrity profile for this device if all devices used have 1156 * Set the integrity profile for this device if all devices used have
1097 * matching profiles. 1157 * matching profiles. We're quite deep in the resume path but still
1158 * don't know if all devices (particularly DM devices this device
1159 * may be stacked on) have matching profiles. Even if the profiles
1160 * don't match we have no way to fail (to resume) at this point.
1098 */ 1161 */
1099static void dm_table_set_integrity(struct dm_table *t) 1162static void dm_table_set_integrity(struct dm_table *t)
1100{ 1163{
1101 struct list_head *devices = dm_table_get_devices(t); 1164 struct gendisk *template_disk = NULL;
1102 struct dm_dev_internal *prev = NULL, *dd = NULL;
1103 1165
1104 if (!blk_get_integrity(dm_disk(t->md))) 1166 if (!blk_get_integrity(dm_disk(t->md)))
1105 return; 1167 return;
1106 1168
1107 list_for_each_entry(dd, devices, list) { 1169 template_disk = dm_table_get_integrity_disk(t, true);
1108 if (prev && 1170 if (!template_disk &&
1109 blk_integrity_compare(prev->dm_dev.bdev->bd_disk, 1171 blk_integrity_is_initialized(dm_disk(t->md))) {
1110 dd->dm_dev.bdev->bd_disk) < 0) { 1172 DMWARN("%s: device no longer has a valid integrity profile",
1111 DMWARN("%s: integrity not set: %s and %s mismatch", 1173 dm_device_name(t->md));
1112 dm_device_name(t->md), 1174 return;
1113 prev->dm_dev.bdev->bd_disk->disk_name,
1114 dd->dm_dev.bdev->bd_disk->disk_name);
1115 goto no_integrity;
1116 }
1117 prev = dd;
1118 } 1175 }
1119
1120 if (!prev || !bdev_get_integrity(prev->dm_dev.bdev))
1121 goto no_integrity;
1122
1123 blk_integrity_register(dm_disk(t->md), 1176 blk_integrity_register(dm_disk(t->md),
1124 bdev_get_integrity(prev->dm_dev.bdev)); 1177 blk_get_integrity(template_disk));
1125
1126 return;
1127
1128no_integrity:
1129 blk_integrity_register(dm_disk(t->md), NULL);
1130
1131 return;
1132} 1178}
1133 1179
1134void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, 1180void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c
index 64454d39c0ca..ecfd9fb167d8 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -1494,12 +1494,17 @@ u32 fmc_prepare(struct fmdev *fmdev)
1494 } 1494 }
1495 1495
1496 memset(&fm_st_proto, 0, sizeof(fm_st_proto)); 1496 memset(&fm_st_proto, 0, sizeof(fm_st_proto));
1497 fm_st_proto.type = ST_FM;
1498 fm_st_proto.recv = fm_st_receive; 1497 fm_st_proto.recv = fm_st_receive;
1499 fm_st_proto.match_packet = NULL; 1498 fm_st_proto.match_packet = NULL;
1500 fm_st_proto.reg_complete_cb = fm_st_reg_comp_cb; 1499 fm_st_proto.reg_complete_cb = fm_st_reg_comp_cb;
1501 fm_st_proto.write = NULL; /* TI ST driver will fill write pointer */ 1500 fm_st_proto.write = NULL; /* TI ST driver will fill write pointer */
1502 fm_st_proto.priv_data = fmdev; 1501 fm_st_proto.priv_data = fmdev;
1502 fm_st_proto.chnl_id = 0x08;
1503 fm_st_proto.max_frame_size = 0xff;
1504 fm_st_proto.hdr_len = 1;
1505 fm_st_proto.offset_len_in_hdr = 0;
1506 fm_st_proto.len_size = 1;
1507 fm_st_proto.reserve = 1;
1503 1508
1504 ret = st_register(&fm_st_proto); 1509 ret = st_register(&fm_st_proto);
1505 if (ret == -EINPROGRESS) { 1510 if (ret == -EINPROGRESS) {
@@ -1532,7 +1537,7 @@ u32 fmc_prepare(struct fmdev *fmdev)
1532 g_st_write = fm_st_proto.write; 1537 g_st_write = fm_st_proto.write;
1533 } else { 1538 } else {
1534 fmerr("Failed to get ST write func pointer\n"); 1539 fmerr("Failed to get ST write func pointer\n");
1535 ret = st_unregister(ST_FM); 1540 ret = st_unregister(&fm_st_proto);
1536 if (ret < 0) 1541 if (ret < 0)
1537 fmerr("st_unregister failed %d\n", ret); 1542 fmerr("st_unregister failed %d\n", ret);
1538 return -EAGAIN; 1543 return -EAGAIN;
@@ -1586,6 +1591,7 @@ u32 fmc_prepare(struct fmdev *fmdev)
1586 */ 1591 */
1587u32 fmc_release(struct fmdev *fmdev) 1592u32 fmc_release(struct fmdev *fmdev)
1588{ 1593{
1594 static struct st_proto_s fm_st_proto;
1589 u32 ret; 1595 u32 ret;
1590 1596
1591 if (!test_bit(FM_CORE_READY, &fmdev->flag)) { 1597 if (!test_bit(FM_CORE_READY, &fmdev->flag)) {
@@ -1604,7 +1610,11 @@ u32 fmc_release(struct fmdev *fmdev)
1604 fmdev->resp_comp = NULL; 1610 fmdev->resp_comp = NULL;
1605 fmdev->rx.freq = 0; 1611 fmdev->rx.freq = 0;
1606 1612
1607 ret = st_unregister(ST_FM); 1613 memset(&fm_st_proto, 0, sizeof(fm_st_proto));
1614 fm_st_proto.chnl_id = 0x08;
1615
1616 ret = st_unregister(&fm_st_proto);
1617
1608 if (ret < 0) 1618 if (ret < 0)
1609 fmerr("Failed to de-register FM from ST %d\n", ret); 1619 fmerr("Failed to de-register FM from ST %d\n", ret);
1610 else 1620 else
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index ac0e42b47b2a..accaf6c9789a 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -41,6 +41,7 @@
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42#include <media/rc-core.h> 42#include <media/rc-core.h>
43#include <linux/pci_ids.h> 43#include <linux/pci_ids.h>
44#include <linux/delay.h>
44 45
45#include "ite-cir.h" 46#include "ite-cir.h"
46 47
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index e637e9f28fd4..937ef1afa5db 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -1996,13 +1996,15 @@ static int atl2_set_eeprom(struct net_device *netdev,
1996 if (!eeprom_buff) 1996 if (!eeprom_buff)
1997 return -ENOMEM; 1997 return -ENOMEM;
1998 1998
1999 ptr = (u32 *)eeprom_buff; 1999 ptr = eeprom_buff;
2000 2000
2001 if (eeprom->offset & 3) { 2001 if (eeprom->offset & 3) {
2002 /* need read/modify/write of first changed EEPROM word */ 2002 /* need read/modify/write of first changed EEPROM word */
2003 /* only the second byte of the word is being modified */ 2003 /* only the second byte of the word is being modified */
2004 if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) 2004 if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) {
2005 return -EIO; 2005 ret_val = -EIO;
2006 goto out;
2007 }
2006 ptr++; 2008 ptr++;
2007 } 2009 }
2008 if (((eeprom->offset + eeprom->len) & 3)) { 2010 if (((eeprom->offset + eeprom->len) & 3)) {
@@ -2011,18 +2013,22 @@ static int atl2_set_eeprom(struct net_device *netdev,
2011 * only the first byte of the word is being modified 2013 * only the first byte of the word is being modified
2012 */ 2014 */
2013 if (!atl2_read_eeprom(hw, last_dword * 4, 2015 if (!atl2_read_eeprom(hw, last_dword * 4,
2014 &(eeprom_buff[last_dword - first_dword]))) 2016 &(eeprom_buff[last_dword - first_dword]))) {
2015 return -EIO; 2017 ret_val = -EIO;
2018 goto out;
2019 }
2016 } 2020 }
2017 2021
2018 /* Device's eeprom is always little-endian, word addressable */ 2022 /* Device's eeprom is always little-endian, word addressable */
2019 memcpy(ptr, bytes, eeprom->len); 2023 memcpy(ptr, bytes, eeprom->len);
2020 2024
2021 for (i = 0; i < last_dword - first_dword + 1; i++) { 2025 for (i = 0; i < last_dword - first_dword + 1; i++) {
2022 if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) 2026 if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) {
2023 return -EIO; 2027 ret_val = -EIO;
2028 goto out;
2029 }
2024 } 2030 }
2025 2031 out:
2026 kfree(eeprom_buff); 2032 kfree(eeprom_buff);
2027 return ret_val; 2033 return ret_val;
2028} 2034}
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
index 118c28aa471e..4b3e35878406 100644
--- a/drivers/net/bonding/bond_alb.h
+++ b/drivers/net/bonding/bond_alb.h
@@ -74,7 +74,7 @@ struct tlb_client_info {
74 * packets to a Client that the Hash function 74 * packets to a Client that the Hash function
75 * gave this entry index. 75 * gave this entry index.
76 */ 76 */
77 u32 tx_bytes; /* Each Client acumulates the BytesTx that 77 u32 tx_bytes; /* Each Client accumulates the BytesTx that
78 * were tranmitted to it, and after each 78 * were tranmitted to it, and after each
79 * CallBack the LoadHistory is devided 79 * CallBack the LoadHistory is devided
80 * by the balance interval 80 * by the balance interval
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index 67c0ad42d818..186cd28a61cc 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -75,15 +75,9 @@ static int dongle_id = 0; /* default: probe */
75/* We can't guess the type of connected dongle, user *must* supply it. */ 75/* We can't guess the type of connected dongle, user *must* supply it. */
76module_param(dongle_id, int, 0); 76module_param(dongle_id, int, 0);
77 77
78/* FIXME : we should not need this, because instances should be automatically
79 * managed by the PCI layer. Especially that we seem to only be using the
80 * first entry. Jean II */
81/* Max 4 instances for now */
82static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL };
83
84/* Some prototypes */ 78/* Some prototypes */
85static int via_ircc_open(int i, chipio_t * info, unsigned int id); 79static int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
86static int via_ircc_close(struct via_ircc_cb *self); 80 unsigned int id);
87static int via_ircc_dma_receive(struct via_ircc_cb *self); 81static int via_ircc_dma_receive(struct via_ircc_cb *self);
88static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, 82static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
89 int iobase); 83 int iobase);
@@ -215,7 +209,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
215 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0)); 209 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
216 pci_write_config_byte(pcidev,0x5a,0xc0); 210 pci_write_config_byte(pcidev,0x5a,0xc0);
217 WriteLPCReg(0x28, 0x70 ); 211 WriteLPCReg(0x28, 0x70 );
218 if (via_ircc_open(0, &info,0x3076) == 0) 212 if (via_ircc_open(pcidev, &info, 0x3076) == 0)
219 rc=0; 213 rc=0;
220 } else 214 } else
221 rc = -ENODEV; //IR not turn on 215 rc = -ENODEV; //IR not turn on
@@ -254,7 +248,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
254 info.irq=FirIRQ; 248 info.irq=FirIRQ;
255 info.dma=FirDRQ1; 249 info.dma=FirDRQ1;
256 info.dma2=FirDRQ0; 250 info.dma2=FirDRQ0;
257 if (via_ircc_open(0, &info,0x3096) == 0) 251 if (via_ircc_open(pcidev, &info, 0x3096) == 0)
258 rc=0; 252 rc=0;
259 } else 253 } else
260 rc = -ENODEV; //IR not turn on !!!!! 254 rc = -ENODEV; //IR not turn on !!!!!
@@ -264,48 +258,10 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
264 return rc; 258 return rc;
265} 259}
266 260
267/*
268 * Function via_ircc_clean ()
269 *
270 * Close all configured chips
271 *
272 */
273static void via_ircc_clean(void)
274{
275 int i;
276
277 IRDA_DEBUG(3, "%s()\n", __func__);
278
279 for (i=0; i < ARRAY_SIZE(dev_self); i++) {
280 if (dev_self[i])
281 via_ircc_close(dev_self[i]);
282 }
283}
284
285static void __devexit via_remove_one (struct pci_dev *pdev)
286{
287 IRDA_DEBUG(3, "%s()\n", __func__);
288
289 /* FIXME : This is ugly. We should use pci_get_drvdata(pdev);
290 * to get our driver instance and call directly via_ircc_close().
291 * See vlsi_ir for details...
292 * Jean II */
293 via_ircc_clean();
294
295 /* FIXME : This should be in via_ircc_close(), because here we may
296 * theoritically disable still configured devices :-( - Jean II */
297 pci_disable_device(pdev);
298}
299
300static void __exit via_ircc_cleanup(void) 261static void __exit via_ircc_cleanup(void)
301{ 262{
302 IRDA_DEBUG(3, "%s()\n", __func__); 263 IRDA_DEBUG(3, "%s()\n", __func__);
303 264
304 /* FIXME : This should be redundant, as pci_unregister_driver()
305 * should call via_remove_one() on each device.
306 * Jean II */
307 via_ircc_clean();
308
309 /* Cleanup all instances of the driver */ 265 /* Cleanup all instances of the driver */
310 pci_unregister_driver (&via_driver); 266 pci_unregister_driver (&via_driver);
311} 267}
@@ -324,12 +280,13 @@ static const struct net_device_ops via_ircc_fir_ops = {
324}; 280};
325 281
326/* 282/*
327 * Function via_ircc_open (iobase, irq) 283 * Function via_ircc_open(pdev, iobase, irq)
328 * 284 *
329 * Open driver instance 285 * Open driver instance
330 * 286 *
331 */ 287 */
332static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) 288static __devinit int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
289 unsigned int id)
333{ 290{
334 struct net_device *dev; 291 struct net_device *dev;
335 struct via_ircc_cb *self; 292 struct via_ircc_cb *self;
@@ -337,9 +294,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
337 294
338 IRDA_DEBUG(3, "%s()\n", __func__); 295 IRDA_DEBUG(3, "%s()\n", __func__);
339 296
340 if (i >= ARRAY_SIZE(dev_self))
341 return -ENOMEM;
342
343 /* Allocate new instance of the driver */ 297 /* Allocate new instance of the driver */
344 dev = alloc_irdadev(sizeof(struct via_ircc_cb)); 298 dev = alloc_irdadev(sizeof(struct via_ircc_cb));
345 if (dev == NULL) 299 if (dev == NULL)
@@ -349,13 +303,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
349 self->netdev = dev; 303 self->netdev = dev;
350 spin_lock_init(&self->lock); 304 spin_lock_init(&self->lock);
351 305
352 /* FIXME : We should store our driver instance in the PCI layer, 306 pci_set_drvdata(pdev, self);
353 * using pci_set_drvdata(), not in this array. 307
354 * See vlsi_ir for details... - Jean II */
355 /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */
356 /* Need to store self somewhere */
357 dev_self[i] = self;
358 self->index = i;
359 /* Initialize Resource */ 308 /* Initialize Resource */
360 self->io.cfg_base = info->cfg_base; 309 self->io.cfg_base = info->cfg_base;
361 self->io.fir_base = info->fir_base; 310 self->io.fir_base = info->fir_base;
@@ -414,7 +363,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
414 363
415 /* Allocate memory if needed */ 364 /* Allocate memory if needed */
416 self->rx_buff.head = 365 self->rx_buff.head =
417 dma_alloc_coherent(NULL, self->rx_buff.truesize, 366 dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize,
418 &self->rx_buff_dma, GFP_KERNEL); 367 &self->rx_buff_dma, GFP_KERNEL);
419 if (self->rx_buff.head == NULL) { 368 if (self->rx_buff.head == NULL) {
420 err = -ENOMEM; 369 err = -ENOMEM;
@@ -423,7 +372,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
423 memset(self->rx_buff.head, 0, self->rx_buff.truesize); 372 memset(self->rx_buff.head, 0, self->rx_buff.truesize);
424 373
425 self->tx_buff.head = 374 self->tx_buff.head =
426 dma_alloc_coherent(NULL, self->tx_buff.truesize, 375 dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize,
427 &self->tx_buff_dma, GFP_KERNEL); 376 &self->tx_buff_dma, GFP_KERNEL);
428 if (self->tx_buff.head == NULL) { 377 if (self->tx_buff.head == NULL) {
429 err = -ENOMEM; 378 err = -ENOMEM;
@@ -455,33 +404,32 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
455 via_hw_init(self); 404 via_hw_init(self);
456 return 0; 405 return 0;
457 err_out4: 406 err_out4:
458 dma_free_coherent(NULL, self->tx_buff.truesize, 407 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
459 self->tx_buff.head, self->tx_buff_dma); 408 self->tx_buff.head, self->tx_buff_dma);
460 err_out3: 409 err_out3:
461 dma_free_coherent(NULL, self->rx_buff.truesize, 410 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
462 self->rx_buff.head, self->rx_buff_dma); 411 self->rx_buff.head, self->rx_buff_dma);
463 err_out2: 412 err_out2:
464 release_region(self->io.fir_base, self->io.fir_ext); 413 release_region(self->io.fir_base, self->io.fir_ext);
465 err_out1: 414 err_out1:
415 pci_set_drvdata(pdev, NULL);
466 free_netdev(dev); 416 free_netdev(dev);
467 dev_self[i] = NULL;
468 return err; 417 return err;
469} 418}
470 419
471/* 420/*
472 * Function via_ircc_close (self) 421 * Function via_remove_one(pdev)
473 * 422 *
474 * Close driver instance 423 * Close driver instance
475 * 424 *
476 */ 425 */
477static int via_ircc_close(struct via_ircc_cb *self) 426static void __devexit via_remove_one(struct pci_dev *pdev)
478{ 427{
428 struct via_ircc_cb *self = pci_get_drvdata(pdev);
479 int iobase; 429 int iobase;
480 430
481 IRDA_DEBUG(3, "%s()\n", __func__); 431 IRDA_DEBUG(3, "%s()\n", __func__);
482 432
483 IRDA_ASSERT(self != NULL, return -1;);
484
485 iobase = self->io.fir_base; 433 iobase = self->io.fir_base;
486 434
487 ResetChip(iobase, 5); //hardware reset. 435 ResetChip(iobase, 5); //hardware reset.
@@ -493,16 +441,16 @@ static int via_ircc_close(struct via_ircc_cb *self)
493 __func__, self->io.fir_base); 441 __func__, self->io.fir_base);
494 release_region(self->io.fir_base, self->io.fir_ext); 442 release_region(self->io.fir_base, self->io.fir_ext);
495 if (self->tx_buff.head) 443 if (self->tx_buff.head)
496 dma_free_coherent(NULL, self->tx_buff.truesize, 444 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
497 self->tx_buff.head, self->tx_buff_dma); 445 self->tx_buff.head, self->tx_buff_dma);
498 if (self->rx_buff.head) 446 if (self->rx_buff.head)
499 dma_free_coherent(NULL, self->rx_buff.truesize, 447 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
500 self->rx_buff.head, self->rx_buff_dma); 448 self->rx_buff.head, self->rx_buff_dma);
501 dev_self[self->index] = NULL; 449 pci_set_drvdata(pdev, NULL);
502 450
503 free_netdev(self->netdev); 451 free_netdev(self->netdev);
504 452
505 return 0; 453 pci_disable_device(pdev);
506} 454}
507 455
508/* 456/*
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index 506cfd0372ec..1ad1f6029af8 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -603,7 +603,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
603 } 603 }
604 604
605 for (i = 0; i < dev->caps.num_comp_vectors; ++i) { 605 for (i = 0; i < dev->caps.num_comp_vectors; ++i) {
606 err = mlx4_create_eq(dev, dev->caps.num_cqs + MLX4_NUM_SPARE_EQE, 606 err = mlx4_create_eq(dev, dev->caps.num_cqs -
607 dev->caps.reserved_cqs +
608 MLX4_NUM_SPARE_EQE,
607 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0, 609 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
608 &priv->eq_table.eq[i]); 610 &priv->eq_table.eq[i]);
609 if (err) { 611 if (err) {
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index e71372aa9cc4..c6d336aed2d9 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -111,7 +111,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 vep_num, u8 port,
111 u32 members_count; 111 u32 members_count;
112 struct mlx4_steer_index *new_entry; 112 struct mlx4_steer_index *new_entry;
113 struct mlx4_promisc_qp *pqp; 113 struct mlx4_promisc_qp *pqp;
114 struct mlx4_promisc_qp *dqp; 114 struct mlx4_promisc_qp *dqp = NULL;
115 u32 prot; 115 u32 prot;
116 int err; 116 int err;
117 u8 pf_num; 117 u8 pf_num;
@@ -184,7 +184,7 @@ out_mailbox:
184out_alloc: 184out_alloc:
185 if (dqp) { 185 if (dqp) {
186 list_del(&dqp->list); 186 list_del(&dqp->list);
187 kfree(&dqp); 187 kfree(dqp);
188 } 188 }
189 list_del(&new_entry->list); 189 list_del(&new_entry->list);
190 kfree(new_entry); 190 kfree(new_entry);
@@ -469,7 +469,6 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 vep_num, u8 port,
469 469
470 /*remove from list of promisc qps */ 470 /*remove from list of promisc qps */
471 list_del(&pqp->list); 471 list_del(&pqp->list);
472 kfree(pqp);
473 472
474 /* set the default entry not to include the removed one */ 473 /* set the default entry not to include the removed one */
475 mailbox = mlx4_alloc_cmd_mailbox(dev); 474 mailbox = mlx4_alloc_cmd_mailbox(dev);
@@ -528,6 +527,8 @@ out_mailbox:
528out_list: 527out_list:
529 if (back_to_list) 528 if (back_to_list)
530 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]); 529 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
530 else
531 kfree(pqp);
531out_mutex: 532out_mutex:
532 mutex_unlock(&priv->mcg_table.mutex); 533 mutex_unlock(&priv->mcg_table.mutex);
533 return err; 534 return err;
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 993c52c82aeb..e870c0698bbe 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -442,11 +442,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
442 u32 flags, phy_interface_t interface) 442 u32 flags, phy_interface_t interface)
443{ 443{
444 struct device *d = &phydev->dev; 444 struct device *d = &phydev->dev;
445 int err;
445 446
446 /* Assume that if there is no driver, that it doesn't 447 /* Assume that if there is no driver, that it doesn't
447 * exist, and we should use the genphy driver. */ 448 * exist, and we should use the genphy driver. */
448 if (NULL == d->driver) { 449 if (NULL == d->driver) {
449 int err;
450 d->driver = &genphy_driver.driver; 450 d->driver = &genphy_driver.driver;
451 451
452 err = d->driver->probe(d); 452 err = d->driver->probe(d);
@@ -474,7 +474,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
474 /* Do initial configuration here, now that 474 /* Do initial configuration here, now that
475 * we have certain key parameters 475 * we have certain key parameters
476 * (dev_flags and interface) */ 476 * (dev_flags and interface) */
477 return phy_init_hw(phydev); 477 err = phy_init_hw(phydev);
478 if (err)
479 phy_detach(phydev);
480
481 return err;
478} 482}
479 483
480/** 484/**
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index a4f2bd52e546..36045f3b0327 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -144,11 +144,7 @@ static int full_duplex[MAX_UNITS] = {0, };
144/* Time in jiffies before concluding the transmitter is hung. */ 144/* Time in jiffies before concluding the transmitter is hung. */
145#define TX_TIMEOUT (2 * HZ) 145#define TX_TIMEOUT (2 * HZ)
146 146
147/* 147#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
148 * This SUCKS.
149 * We need a much better method to determine if dma_addr_t is 64-bit.
150 */
151#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || (defined(CONFIG_MIPS) && ((defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || defined(CONFIG_64BIT))) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT))
152/* 64-bit dma_addr_t */ 148/* 64-bit dma_addr_t */
153#define ADDR_64BITS /* This chip uses 64 bit addresses. */ 149#define ADDR_64BITS /* This chip uses 64 bit addresses. */
154#define netdrv_addr_t __le64 150#define netdrv_addr_t __le64
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 6f600cced6e1..3ec22c307797 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -433,4 +433,19 @@ config USB_SIERRA_NET
433 To compile this driver as a module, choose M here: the 433 To compile this driver as a module, choose M here: the
434 module will be called sierra_net. 434 module will be called sierra_net.
435 435
436config USB_VL600
437 tristate "LG VL600 modem dongle"
438 depends on USB_NET_CDCETHER
439 select USB_ACM
440 help
441 Select this if you want to use an LG Electronics 4G/LTE usb modem
442 called VL600. This driver only handles the ethernet
443 interface exposed by the modem firmware. To establish a connection
444 you will first need a userspace program that sends the right
445 command to the modem through its CDC ACM port, and most
446 likely also a DHCP client. See this thread about using the
447 4G modem from Verizon:
448
449 http://ubuntuforums.org/showpost.php?p=10589647&postcount=17
450
436endmenu 451endmenu
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index cac170301187..c7ec8a5f0a90 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -27,4 +27,5 @@ obj-$(CONFIG_USB_IPHETH) += ipheth.o
27obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o 27obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o
28obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o 28obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
29obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o 29obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
30obj-$(CONFIG_USB_VL600) += lg-vl600.o
30 31
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 5f3b97668e63..8f128541656d 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -340,7 +340,7 @@ next:
340 340
341static const struct driver_info eem_info = { 341static const struct driver_info eem_info = {
342 .description = "CDC EEM Device", 342 .description = "CDC EEM Device",
343 .flags = FLAG_ETHER, 343 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
344 .bind = eem_bind, 344 .bind = eem_bind,
345 .rx_fixup = eem_rx_fixup, 345 .rx_fixup = eem_rx_fixup,
346 .tx_fixup = eem_tx_fixup, 346 .tx_fixup = eem_tx_fixup,
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 9a60e415d76b..341f7056a800 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -378,7 +378,7 @@ static void dumpspeed(struct usbnet *dev, __le32 *speeds)
378 __le32_to_cpu(speeds[1]) / 1000); 378 __le32_to_cpu(speeds[1]) / 1000);
379} 379}
380 380
381static void cdc_status(struct usbnet *dev, struct urb *urb) 381void usbnet_cdc_status(struct usbnet *dev, struct urb *urb)
382{ 382{
383 struct usb_cdc_notification *event; 383 struct usb_cdc_notification *event;
384 384
@@ -418,8 +418,9 @@ static void cdc_status(struct usbnet *dev, struct urb *urb)
418 break; 418 break;
419 } 419 }
420} 420}
421EXPORT_SYMBOL_GPL(usbnet_cdc_status);
421 422
422static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) 423int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
423{ 424{
424 int status; 425 int status;
425 struct cdc_state *info = (void *) &dev->data; 426 struct cdc_state *info = (void *) &dev->data;
@@ -441,6 +442,7 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
441 */ 442 */
442 return 0; 443 return 0;
443} 444}
445EXPORT_SYMBOL_GPL(usbnet_cdc_bind);
444 446
445static int cdc_manage_power(struct usbnet *dev, int on) 447static int cdc_manage_power(struct usbnet *dev, int on)
446{ 448{
@@ -450,20 +452,20 @@ static int cdc_manage_power(struct usbnet *dev, int on)
450 452
451static const struct driver_info cdc_info = { 453static const struct driver_info cdc_info = {
452 .description = "CDC Ethernet Device", 454 .description = "CDC Ethernet Device",
453 .flags = FLAG_ETHER, 455 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
454 // .check_connect = cdc_check_connect, 456 // .check_connect = cdc_check_connect,
455 .bind = cdc_bind, 457 .bind = usbnet_cdc_bind,
456 .unbind = usbnet_cdc_unbind, 458 .unbind = usbnet_cdc_unbind,
457 .status = cdc_status, 459 .status = usbnet_cdc_status,
458 .manage_power = cdc_manage_power, 460 .manage_power = cdc_manage_power,
459}; 461};
460 462
461static const struct driver_info mbm_info = { 463static const struct driver_info mbm_info = {
462 .description = "Mobile Broadband Network Device", 464 .description = "Mobile Broadband Network Device",
463 .flags = FLAG_WWAN, 465 .flags = FLAG_WWAN,
464 .bind = cdc_bind, 466 .bind = usbnet_cdc_bind,
465 .unbind = usbnet_cdc_unbind, 467 .unbind = usbnet_cdc_unbind,
466 .status = cdc_status, 468 .status = usbnet_cdc_status,
467 .manage_power = cdc_manage_power, 469 .manage_power = cdc_manage_power,
468}; 470};
469 471
@@ -560,6 +562,13 @@ static const struct usb_device_id products [] = {
560 .driver_info = 0, 562 .driver_info = 0,
561}, 563},
562 564
565/* LG Electronics VL600 wants additional headers on every frame */
566{
567 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
568 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
569 .driver_info = 0,
570},
571
563/* 572/*
564 * WHITELIST!!! 573 * WHITELIST!!!
565 * 574 *
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 7113168473cf..967371f04454 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1237,7 +1237,7 @@ static int cdc_ncm_manage_power(struct usbnet *dev, int status)
1237 1237
1238static const struct driver_info cdc_ncm_info = { 1238static const struct driver_info cdc_ncm_info = {
1239 .description = "CDC NCM", 1239 .description = "CDC NCM",
1240 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET, 1240 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET,
1241 .bind = cdc_ncm_bind, 1241 .bind = cdc_ncm_bind,
1242 .unbind = cdc_ncm_unbind, 1242 .unbind = cdc_ncm_unbind,
1243 .check_connect = cdc_ncm_check_connect, 1243 .check_connect = cdc_ncm_check_connect,
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index ca39ace0b0eb..fc5f13d47ad9 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -89,6 +89,7 @@ static int always_connected (struct usbnet *dev)
89 89
90static const struct driver_info ali_m5632_info = { 90static const struct driver_info ali_m5632_info = {
91 .description = "ALi M5632", 91 .description = "ALi M5632",
92 .flags = FLAG_POINTTOPOINT,
92}; 93};
93 94
94#endif 95#endif
@@ -110,6 +111,7 @@ static const struct driver_info ali_m5632_info = {
110 111
111static const struct driver_info an2720_info = { 112static const struct driver_info an2720_info = {
112 .description = "AnchorChips/Cypress 2720", 113 .description = "AnchorChips/Cypress 2720",
114 .flags = FLAG_POINTTOPOINT,
113 // no reset available! 115 // no reset available!
114 // no check_connect available! 116 // no check_connect available!
115 117
@@ -132,6 +134,7 @@ static const struct driver_info an2720_info = {
132 134
133static const struct driver_info belkin_info = { 135static const struct driver_info belkin_info = {
134 .description = "Belkin, eTEK, or compatible", 136 .description = "Belkin, eTEK, or compatible",
137 .flags = FLAG_POINTTOPOINT,
135}; 138};
136 139
137#endif /* CONFIG_USB_BELKIN */ 140#endif /* CONFIG_USB_BELKIN */
@@ -157,6 +160,7 @@ static const struct driver_info belkin_info = {
157static const struct driver_info epson2888_info = { 160static const struct driver_info epson2888_info = {
158 .description = "Epson USB Device", 161 .description = "Epson USB Device",
159 .check_connect = always_connected, 162 .check_connect = always_connected,
163 .flags = FLAG_POINTTOPOINT,
160 164
161 .in = 4, .out = 3, 165 .in = 4, .out = 3,
162}; 166};
@@ -173,6 +177,7 @@ static const struct driver_info epson2888_info = {
173#define HAVE_HARDWARE 177#define HAVE_HARDWARE
174static const struct driver_info kc2190_info = { 178static const struct driver_info kc2190_info = {
175 .description = "KC Technology KC-190", 179 .description = "KC Technology KC-190",
180 .flags = FLAG_POINTTOPOINT,
176}; 181};
177#endif /* CONFIG_USB_KC2190 */ 182#endif /* CONFIG_USB_KC2190 */
178 183
@@ -200,16 +205,19 @@ static const struct driver_info kc2190_info = {
200static const struct driver_info linuxdev_info = { 205static const struct driver_info linuxdev_info = {
201 .description = "Linux Device", 206 .description = "Linux Device",
202 .check_connect = always_connected, 207 .check_connect = always_connected,
208 .flags = FLAG_POINTTOPOINT,
203}; 209};
204 210
205static const struct driver_info yopy_info = { 211static const struct driver_info yopy_info = {
206 .description = "Yopy", 212 .description = "Yopy",
207 .check_connect = always_connected, 213 .check_connect = always_connected,
214 .flags = FLAG_POINTTOPOINT,
208}; 215};
209 216
210static const struct driver_info blob_info = { 217static const struct driver_info blob_info = {
211 .description = "Boot Loader OBject", 218 .description = "Boot Loader OBject",
212 .check_connect = always_connected, 219 .check_connect = always_connected,
220 .flags = FLAG_POINTTOPOINT,
213}; 221};
214 222
215#endif /* CONFIG_USB_ARMLINUX */ 223#endif /* CONFIG_USB_ARMLINUX */
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
index dcd57c37ef73..c4cfd1dea881 100644
--- a/drivers/net/usb/gl620a.c
+++ b/drivers/net/usb/gl620a.c
@@ -193,7 +193,7 @@ static int genelink_bind(struct usbnet *dev, struct usb_interface *intf)
193 193
194static const struct driver_info genelink_info = { 194static const struct driver_info genelink_info = {
195 .description = "Genesys GeneLink", 195 .description = "Genesys GeneLink",
196 .flags = FLAG_FRAMING_GL | FLAG_NO_SETINT, 196 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_GL | FLAG_NO_SETINT,
197 .bind = genelink_bind, 197 .bind = genelink_bind,
198 .rx_fixup = genelink_rx_fixup, 198 .rx_fixup = genelink_rx_fixup,
199 .tx_fixup = genelink_tx_fixup, 199 .tx_fixup = genelink_tx_fixup,
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
new file mode 100644
index 000000000000..1d83ccfd7277
--- /dev/null
+++ b/drivers/net/usb/lg-vl600.c
@@ -0,0 +1,346 @@
1/*
2 * Ethernet interface part of the LG VL600 LTE modem (4G dongle)
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Author: Andrzej Zaborowski <balrogg@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/etherdevice.h>
22#include <linux/ethtool.h>
23#include <linux/mii.h>
24#include <linux/usb.h>
25#include <linux/usb/cdc.h>
26#include <linux/usb/usbnet.h>
27#include <linux/if_ether.h>
28#include <linux/if_arp.h>
29#include <linux/inetdevice.h>
30
31/*
32 * The device has a CDC ACM port for modem control (it claims to be
33 * CDC ACM anyway) and a CDC Ethernet port for actual network data.
34 * It will however ignore data on both ports that is not encapsulated
35 * in a specific way, any data returned is also encapsulated the same
36 * way. The headers don't seem to follow any popular standard.
37 *
38 * This driver adds and strips these headers from the ethernet frames
39 * sent/received from the CDC Ethernet port. The proprietary header
40 * replaces the standard ethernet header in a packet so only actual
41 * ethernet frames are allowed. The headers allow some form of
42 * multiplexing by using non standard values of the .h_proto field.
43 * Windows/Mac drivers do send a couple of such frames to the device
44 * during initialisation, with protocol set to 0x0906 or 0x0b06 and (what
45 * seems to be) a flag in the .dummy_flags. This doesn't seem necessary
46 * for modem operation but can possibly be used for GPS or other funcitons.
47 */
48
49struct vl600_frame_hdr {
50 __le32 len;
51 __le32 serial;
52 __le32 pkt_cnt;
53 __le32 dummy_flags;
54 __le32 dummy;
55 __le32 magic;
56} __attribute__((packed));
57
58struct vl600_pkt_hdr {
59 __le32 dummy[2];
60 __le32 len;
61 __be16 h_proto;
62} __attribute__((packed));
63
64struct vl600_state {
65 struct sk_buff *current_rx_buf;
66};
67
68static int vl600_bind(struct usbnet *dev, struct usb_interface *intf)
69{
70 int ret;
71 struct vl600_state *s = kzalloc(sizeof(struct vl600_state), GFP_KERNEL);
72
73 if (!s)
74 return -ENOMEM;
75
76 ret = usbnet_cdc_bind(dev, intf);
77 if (ret) {
78 kfree(s);
79 return ret;
80 }
81
82 dev->driver_priv = s;
83
84 /* ARP packets don't go through, but they're also of no use. The
85 * subnet has only two hosts anyway: us and the gateway / DHCP
86 * server (probably simulated by modem firmware or network operator)
87 * whose address changes everytime we connect to the intarwebz and
88 * who doesn't bother answering ARP requests either. So hardware
89 * addresses have no meaning, the destination and the source of every
90 * packet depend only on whether it is on the IN or OUT endpoint. */
91 dev->net->flags |= IFF_NOARP;
92
93 return ret;
94}
95
96static void vl600_unbind(struct usbnet *dev, struct usb_interface *intf)
97{
98 struct vl600_state *s = dev->driver_priv;
99
100 if (s->current_rx_buf)
101 dev_kfree_skb(s->current_rx_buf);
102
103 kfree(s);
104
105 return usbnet_cdc_unbind(dev, intf);
106}
107
108static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
109{
110 struct vl600_frame_hdr *frame;
111 struct vl600_pkt_hdr *packet;
112 struct ethhdr *ethhdr;
113 int packet_len, count;
114 struct sk_buff *buf = skb;
115 struct sk_buff *clone;
116 struct vl600_state *s = dev->driver_priv;
117
118 /* Frame lengths are generally 4B multiplies but every couple of
119 * hours there's an odd number of bytes sized yet correct frame,
120 * so don't require this. */
121
122 /* Allow a packet (or multiple packets batched together) to be
123 * split across many frames. We don't allow a new batch to
124 * begin in the same frame another one is ending however, and no
125 * leading or trailing pad bytes. */
126 if (s->current_rx_buf) {
127 frame = (struct vl600_frame_hdr *) s->current_rx_buf->data;
128 if (skb->len + s->current_rx_buf->len >
129 le32_to_cpup(&frame->len)) {
130 netif_err(dev, ifup, dev->net, "Fragment too long\n");
131 dev->net->stats.rx_length_errors++;
132 goto error;
133 }
134
135 buf = s->current_rx_buf;
136 memcpy(skb_put(buf, skb->len), skb->data, skb->len);
137 } else if (skb->len < 4) {
138 netif_err(dev, ifup, dev->net, "Frame too short\n");
139 dev->net->stats.rx_length_errors++;
140 goto error;
141 }
142
143 frame = (struct vl600_frame_hdr *) buf->data;
144 /* NOTE: Should check that frame->magic == 0x53544448?
145 * Otherwise if we receive garbage at the beginning of the frame
146 * we may end up allocating a huge buffer and saving all the
147 * future incoming data into it. */
148
149 if (buf->len < sizeof(*frame) ||
150 buf->len != le32_to_cpup(&frame->len)) {
151 /* Save this fragment for later assembly */
152 if (s->current_rx_buf)
153 return 0;
154
155 s->current_rx_buf = skb_copy_expand(skb, 0,
156 le32_to_cpup(&frame->len), GFP_ATOMIC);
157 if (!s->current_rx_buf) {
158 netif_err(dev, ifup, dev->net, "Reserving %i bytes "
159 "for packet assembly failed.\n",
160 le32_to_cpup(&frame->len));
161 dev->net->stats.rx_errors++;
162 }
163
164 return 0;
165 }
166
167 count = le32_to_cpup(&frame->pkt_cnt);
168
169 skb_pull(buf, sizeof(*frame));
170
171 while (count--) {
172 if (buf->len < sizeof(*packet)) {
173 netif_err(dev, ifup, dev->net, "Packet too short\n");
174 goto error;
175 }
176
177 packet = (struct vl600_pkt_hdr *) buf->data;
178 packet_len = sizeof(*packet) + le32_to_cpup(&packet->len);
179 if (packet_len > buf->len) {
180 netif_err(dev, ifup, dev->net,
181 "Bad packet length stored in header\n");
182 goto error;
183 }
184
185 /* Packet header is same size as the ethernet header
186 * (sizeof(*packet) == sizeof(*ethhdr)), additionally
187 * the h_proto field is in the same place so we just leave it
188 * alone and fill in the remaining fields.
189 */
190 ethhdr = (struct ethhdr *) skb->data;
191 if (be16_to_cpup(&ethhdr->h_proto) == ETH_P_ARP &&
192 buf->len > 0x26) {
193 /* Copy the addresses from packet contents */
194 memcpy(ethhdr->h_source,
195 &buf->data[sizeof(*ethhdr) + 0x8],
196 ETH_ALEN);
197 memcpy(ethhdr->h_dest,
198 &buf->data[sizeof(*ethhdr) + 0x12],
199 ETH_ALEN);
200 } else {
201 memset(ethhdr->h_source, 0, ETH_ALEN);
202 memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN);
203 }
204
205 if (count) {
206 /* Not the last packet in this batch */
207 clone = skb_clone(buf, GFP_ATOMIC);
208 if (!clone)
209 goto error;
210
211 skb_trim(clone, packet_len);
212 usbnet_skb_return(dev, clone);
213
214 skb_pull(buf, (packet_len + 3) & ~3);
215 } else {
216 skb_trim(buf, packet_len);
217
218 if (s->current_rx_buf) {
219 usbnet_skb_return(dev, buf);
220 s->current_rx_buf = NULL;
221 return 0;
222 }
223
224 return 1;
225 }
226 }
227
228error:
229 if (s->current_rx_buf) {
230 dev_kfree_skb_any(s->current_rx_buf);
231 s->current_rx_buf = NULL;
232 }
233 dev->net->stats.rx_errors++;
234 return 0;
235}
236
237static struct sk_buff *vl600_tx_fixup(struct usbnet *dev,
238 struct sk_buff *skb, gfp_t flags)
239{
240 struct sk_buff *ret;
241 struct vl600_frame_hdr *frame;
242 struct vl600_pkt_hdr *packet;
243 static uint32_t serial = 1;
244 int orig_len = skb->len - sizeof(struct ethhdr);
245 int full_len = (skb->len + sizeof(struct vl600_frame_hdr) + 3) & ~3;
246
247 frame = (struct vl600_frame_hdr *) skb->data;
248 if (skb->len > sizeof(*frame) && skb->len == le32_to_cpup(&frame->len))
249 return skb; /* Already encapsulated? */
250
251 if (skb->len < sizeof(struct ethhdr))
252 /* Drop, device can only deal with ethernet packets */
253 return NULL;
254
255 if (!skb_cloned(skb)) {
256 int headroom = skb_headroom(skb);
257 int tailroom = skb_tailroom(skb);
258
259 if (tailroom >= full_len - skb->len - sizeof(*frame) &&
260 headroom >= sizeof(*frame))
261 /* There's enough head and tail room */
262 goto encapsulate;
263
264 if (headroom + tailroom + skb->len >= full_len) {
265 /* There's enough total room, just readjust */
266 skb->data = memmove(skb->head + sizeof(*frame),
267 skb->data, skb->len);
268 skb_set_tail_pointer(skb, skb->len);
269 goto encapsulate;
270 }
271 }
272
273 /* Alloc a new skb with the required size */
274 ret = skb_copy_expand(skb, sizeof(struct vl600_frame_hdr), full_len -
275 skb->len - sizeof(struct vl600_frame_hdr), flags);
276 dev_kfree_skb_any(skb);
277 if (!ret)
278 return ret;
279 skb = ret;
280
281encapsulate:
282 /* Packet header is same size as ethernet packet header
283 * (sizeof(*packet) == sizeof(struct ethhdr)), additionally the
284 * h_proto field is in the same place so we just leave it alone and
285 * overwrite the remaining fields.
286 */
287 packet = (struct vl600_pkt_hdr *) skb->data;
288 memset(&packet->dummy, 0, sizeof(packet->dummy));
289 packet->len = cpu_to_le32(orig_len);
290
291 frame = (struct vl600_frame_hdr *) skb_push(skb, sizeof(*frame));
292 memset(frame, 0, sizeof(*frame));
293 frame->len = cpu_to_le32(full_len);
294 frame->serial = cpu_to_le32(serial++);
295 frame->pkt_cnt = cpu_to_le32(1);
296
297 if (skb->len < full_len) /* Pad */
298 skb_put(skb, full_len - skb->len);
299
300 return skb;
301}
302
303static const struct driver_info vl600_info = {
304 .description = "LG VL600 modem",
305 .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE,
306 .bind = vl600_bind,
307 .unbind = vl600_unbind,
308 .status = usbnet_cdc_status,
309 .rx_fixup = vl600_rx_fixup,
310 .tx_fixup = vl600_tx_fixup,
311};
312
313static const struct usb_device_id products[] = {
314 {
315 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
316 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
317 .driver_info = (unsigned long) &vl600_info,
318 },
319 {}, /* End */
320};
321MODULE_DEVICE_TABLE(usb, products);
322
323static struct usb_driver lg_vl600_driver = {
324 .name = "lg-vl600",
325 .id_table = products,
326 .probe = usbnet_probe,
327 .disconnect = usbnet_disconnect,
328 .suspend = usbnet_suspend,
329 .resume = usbnet_resume,
330};
331
332static int __init vl600_init(void)
333{
334 return usb_register(&lg_vl600_driver);
335}
336module_init(vl600_init);
337
338static void __exit vl600_exit(void)
339{
340 usb_deregister(&lg_vl600_driver);
341}
342module_exit(vl600_exit);
343
344MODULE_AUTHOR("Anrzej Zaborowski");
345MODULE_DESCRIPTION("LG-VL600 modem's ethernet link");
346MODULE_LICENSE("GPL");
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
index ba72a7281cb0..01db4602a39e 100644
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -560,7 +560,7 @@ static int net1080_bind(struct usbnet *dev, struct usb_interface *intf)
560 560
561static const struct driver_info net1080_info = { 561static const struct driver_info net1080_info = {
562 .description = "NetChip TurboCONNECT", 562 .description = "NetChip TurboCONNECT",
563 .flags = FLAG_FRAMING_NC, 563 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_NC,
564 .bind = net1080_bind, 564 .bind = net1080_bind,
565 .reset = net1080_reset, 565 .reset = net1080_reset,
566 .check_connect = net1080_check_connect, 566 .check_connect = net1080_check_connect,
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 08ad269f6b4e..823c53751307 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -96,7 +96,7 @@ static int pl_reset(struct usbnet *dev)
96 96
97static const struct driver_info prolific_info = { 97static const struct driver_info prolific_info = {
98 .description = "Prolific PL-2301/PL-2302", 98 .description = "Prolific PL-2301/PL-2302",
99 .flags = FLAG_NO_SETINT, 99 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT,
100 /* some PL-2302 versions seem to fail usb_set_interface() */ 100 /* some PL-2302 versions seem to fail usb_set_interface() */
101 .reset = pl_reset, 101 .reset = pl_reset,
102}; 102};
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index dd8a4adf48ca..5994a25c56ac 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -573,7 +573,7 @@ EXPORT_SYMBOL_GPL(rndis_tx_fixup);
573 573
574static const struct driver_info rndis_info = { 574static const struct driver_info rndis_info = {
575 .description = "RNDIS device", 575 .description = "RNDIS device",
576 .flags = FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT, 576 .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
577 .bind = rndis_bind, 577 .bind = rndis_bind,
578 .unbind = rndis_unbind, 578 .unbind = rndis_unbind,
579 .status = rndis_status, 579 .status = rndis_status,
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 95c41d56631c..069c1cf0fdf7 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -387,8 +387,12 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
387static inline void rx_process (struct usbnet *dev, struct sk_buff *skb) 387static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
388{ 388{
389 if (dev->driver_info->rx_fixup && 389 if (dev->driver_info->rx_fixup &&
390 !dev->driver_info->rx_fixup (dev, skb)) 390 !dev->driver_info->rx_fixup (dev, skb)) {
391 goto error; 391 /* With RX_ASSEMBLE, rx_fixup() must update counters */
392 if (!(dev->driver_info->flags & FLAG_RX_ASSEMBLE))
393 dev->net->stats.rx_errors++;
394 goto done;
395 }
392 // else network stack removes extra byte if we forced a short packet 396 // else network stack removes extra byte if we forced a short packet
393 397
394 if (skb->len) { 398 if (skb->len) {
@@ -401,8 +405,8 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
401 } 405 }
402 406
403 netif_dbg(dev, rx_err, dev->net, "drop\n"); 407 netif_dbg(dev, rx_err, dev->net, "drop\n");
404error:
405 dev->net->stats.rx_errors++; 408 dev->net->stats.rx_errors++;
409done:
406 skb_queue_tail(&dev->done, skb); 410 skb_queue_tail(&dev->done, skb);
407} 411}
408 412
@@ -1376,7 +1380,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1376 // else "eth%d" when there's reasonable doubt. userspace 1380 // else "eth%d" when there's reasonable doubt. userspace
1377 // can rename the link if it knows better. 1381 // can rename the link if it knows better.
1378 if ((dev->driver_info->flags & FLAG_ETHER) != 0 && 1382 if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
1379 (net->dev_addr [0] & 0x02) == 0) 1383 ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
1384 (net->dev_addr [0] & 0x02) == 0))
1380 strcpy (net->name, "eth%d"); 1385 strcpy (net->name, "eth%d");
1381 /* WLAN devices should always be named "wlan%d" */ 1386 /* WLAN devices should always be named "wlan%d" */
1382 if ((dev->driver_info->flags & FLAG_WLAN) != 0) 1387 if ((dev->driver_info->flags & FLAG_WLAN) != 0)
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index 3eb0b167b5b4..241756e0e86f 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -102,7 +102,7 @@ static int always_connected (struct usbnet *dev)
102 102
103static const struct driver_info zaurus_sl5x00_info = { 103static const struct driver_info zaurus_sl5x00_info = {
104 .description = "Sharp Zaurus SL-5x00", 104 .description = "Sharp Zaurus SL-5x00",
105 .flags = FLAG_FRAMING_Z, 105 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
106 .check_connect = always_connected, 106 .check_connect = always_connected,
107 .bind = zaurus_bind, 107 .bind = zaurus_bind,
108 .unbind = usbnet_cdc_unbind, 108 .unbind = usbnet_cdc_unbind,
@@ -112,7 +112,7 @@ static const struct driver_info zaurus_sl5x00_info = {
112 112
113static const struct driver_info zaurus_pxa_info = { 113static const struct driver_info zaurus_pxa_info = {
114 .description = "Sharp Zaurus, PXA-2xx based", 114 .description = "Sharp Zaurus, PXA-2xx based",
115 .flags = FLAG_FRAMING_Z, 115 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
116 .check_connect = always_connected, 116 .check_connect = always_connected,
117 .bind = zaurus_bind, 117 .bind = zaurus_bind,
118 .unbind = usbnet_cdc_unbind, 118 .unbind = usbnet_cdc_unbind,
@@ -122,7 +122,7 @@ static const struct driver_info zaurus_pxa_info = {
122 122
123static const struct driver_info olympus_mxl_info = { 123static const struct driver_info olympus_mxl_info = {
124 .description = "Olympus R1000", 124 .description = "Olympus R1000",
125 .flags = FLAG_FRAMING_Z, 125 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
126 .check_connect = always_connected, 126 .check_connect = always_connected,
127 .bind = zaurus_bind, 127 .bind = zaurus_bind,
128 .unbind = usbnet_cdc_unbind, 128 .unbind = usbnet_cdc_unbind,
@@ -258,7 +258,7 @@ bad_desc:
258 258
259static const struct driver_info bogus_mdlm_info = { 259static const struct driver_info bogus_mdlm_info = {
260 .description = "pseudo-MDLM (BLAN) device", 260 .description = "pseudo-MDLM (BLAN) device",
261 .flags = FLAG_FRAMING_Z, 261 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
262 .check_connect = always_connected, 262 .check_connect = always_connected,
263 .tx_fixup = zaurus_tx_fixup, 263 .tx_fixup = zaurus_tx_fixup,
264 .bind = blan_mdlm_bind, 264 .bind = blan_mdlm_bind,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 524825720a09..dddb85de622d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1048,6 +1048,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1048 "Starting driver with initial channel: %d MHz\n", 1048 "Starting driver with initial channel: %d MHz\n",
1049 curchan->center_freq); 1049 curchan->center_freq);
1050 1050
1051 ath9k_ps_wakeup(sc);
1052
1051 mutex_lock(&sc->mutex); 1053 mutex_lock(&sc->mutex);
1052 1054
1053 /* setup initial channel */ 1055 /* setup initial channel */
@@ -1143,6 +1145,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1143mutex_unlock: 1145mutex_unlock:
1144 mutex_unlock(&sc->mutex); 1146 mutex_unlock(&sc->mutex);
1145 1147
1148 ath9k_ps_restore(sc);
1149
1146 return r; 1150 return r;
1147} 1151}
1148 1152
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index c6a5fae634a0..9cad061cc1d2 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -443,6 +443,7 @@ struct carl9170_ba_stats {
443 u8 ampdu_len; 443 u8 ampdu_len;
444 u8 ampdu_ack_len; 444 u8 ampdu_ack_len;
445 bool clear; 445 bool clear;
446 bool req;
446}; 447};
447 448
448struct carl9170_sta_info { 449struct carl9170_sta_info {
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index ede3d7e5a048..89fe60accf85 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1355,6 +1355,7 @@ static int carl9170_op_ampdu_action(struct ieee80211_hw *hw,
1355 tid_info = rcu_dereference(sta_info->agg[tid]); 1355 tid_info = rcu_dereference(sta_info->agg[tid]);
1356 1356
1357 sta_info->stats[tid].clear = true; 1357 sta_info->stats[tid].clear = true;
1358 sta_info->stats[tid].req = false;
1358 1359
1359 if (tid_info) { 1360 if (tid_info) {
1360 bitmap_zero(tid_info->bitmap, CARL9170_BAW_SIZE); 1361 bitmap_zero(tid_info->bitmap, CARL9170_BAW_SIZE);
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index 0ef70b6fc512..cb70ed7ec5cc 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -383,6 +383,7 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
383 383
384 if (sta_info->stats[tid].clear) { 384 if (sta_info->stats[tid].clear) {
385 sta_info->stats[tid].clear = false; 385 sta_info->stats[tid].clear = false;
386 sta_info->stats[tid].req = false;
386 sta_info->stats[tid].ampdu_len = 0; 387 sta_info->stats[tid].ampdu_len = 0;
387 sta_info->stats[tid].ampdu_ack_len = 0; 388 sta_info->stats[tid].ampdu_ack_len = 0;
388 } 389 }
@@ -391,10 +392,16 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
391 if (txinfo->status.rates[0].count == 1) 392 if (txinfo->status.rates[0].count == 1)
392 sta_info->stats[tid].ampdu_ack_len++; 393 sta_info->stats[tid].ampdu_ack_len++;
393 394
395 if (!(txinfo->flags & IEEE80211_TX_STAT_ACK))
396 sta_info->stats[tid].req = true;
397
394 if (super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_IMM_BA)) { 398 if (super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_IMM_BA)) {
395 super->s.rix = sta_info->stats[tid].ampdu_len; 399 super->s.rix = sta_info->stats[tid].ampdu_len;
396 super->s.cnt = sta_info->stats[tid].ampdu_ack_len; 400 super->s.cnt = sta_info->stats[tid].ampdu_ack_len;
397 txinfo->flags |= IEEE80211_TX_STAT_AMPDU; 401 txinfo->flags |= IEEE80211_TX_STAT_AMPDU;
402 if (sta_info->stats[tid].req)
403 txinfo->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
404
398 sta_info->stats[tid].clear = true; 405 sta_info->stats[tid].clear = true;
399 } 406 }
400 spin_unlock_bh(&tid_info->lock); 407 spin_unlock_bh(&tid_info->lock);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index d418b647be80..a209a0e76bf0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -1805,6 +1805,15 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1805 1805
1806 mutex_lock(&priv->mutex); 1806 mutex_lock(&priv->mutex);
1807 1807
1808 if (!ctx->vif || !iwl_legacy_is_ready_rf(priv)) {
1809 /*
1810 * Huh? But wait ... this can maybe happen when
1811 * we're in the middle of a firmware restart!
1812 */
1813 err = -EBUSY;
1814 goto out;
1815 }
1816
1808 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; 1817 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;
1809 1818
1810 if (!(interface_modes & BIT(newtype))) { 1819 if (!(interface_modes & BIT(newtype))) {
@@ -1832,6 +1841,7 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1832 /* success */ 1841 /* success */
1833 iwl_legacy_teardown_interface(priv, vif, true); 1842 iwl_legacy_teardown_interface(priv, vif, true);
1834 vif->type = newtype; 1843 vif->type = newtype;
1844 vif->p2p = newp2p;
1835 err = iwl_legacy_setup_interface(priv, ctx); 1845 err = iwl_legacy_setup_interface(priv, ctx);
1836 WARN_ON(err); 1846 WARN_ON(err);
1837 /* 1847 /*
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index ab87e1b73529..28eb3d885ba1 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -93,6 +93,7 @@ MODULE_LICENSE("GPL");
93struct iwl_mod_params iwl3945_mod_params = { 93struct iwl_mod_params iwl3945_mod_params = {
94 .sw_crypto = 1, 94 .sw_crypto = 1,
95 .restart_fw = 1, 95 .restart_fw = 1,
96 .disable_hw_scan = 1,
96 /* the rest are 0 by default */ 97 /* the rest are 0 by default */
97}; 98};
98 99
@@ -3960,8 +3961,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3960 * "the hard way", rather than using device's scan. 3961 * "the hard way", rather than using device's scan.
3961 */ 3962 */
3962 if (iwl3945_mod_params.disable_hw_scan) { 3963 if (iwl3945_mod_params.disable_hw_scan) {
3963 dev_printk(KERN_DEBUG, &(pdev->dev), 3964 IWL_DEBUG_INFO(priv, "Disabling hw_scan\n");
3964 "sw scan support is deprecated\n");
3965 iwl3945_hw_ops.hw_scan = NULL; 3965 iwl3945_hw_ops.hw_scan = NULL;
3966 } 3966 }
3967 3967
@@ -4280,8 +4280,7 @@ MODULE_PARM_DESC(swcrypto,
4280 "using software crypto (default 1 [software])"); 4280 "using software crypto (default 1 [software])");
4281module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, 4281module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan,
4282 int, S_IRUGO); 4282 int, S_IRUGO);
4283MODULE_PARM_DESC(disable_hw_scan, 4283MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)");
4284 "disable hardware scanning (default 0) (deprecated)");
4285#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 4284#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
4286module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); 4285module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR);
4287MODULE_PARM_DESC(debug, "debug output mask"); 4286MODULE_PARM_DESC(debug, "debug output mask");
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 4e368657a83c..37509d019910 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -730,8 +730,12 @@ static struct usb_device_id rt2800usb_device_table[] = {
730 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) }, 730 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) },
731 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) }, 731 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) },
732 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) }, 732 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) },
733 { USB_DEVICE(0x050d, 0x825b), USB_DEVICE_DATA(&rt2800usb_ops) },
734 { USB_DEVICE(0x050d, 0x935a), USB_DEVICE_DATA(&rt2800usb_ops) },
735 { USB_DEVICE(0x050d, 0x935b), USB_DEVICE_DATA(&rt2800usb_ops) },
733 /* Buffalo */ 736 /* Buffalo */
734 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) }, 737 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) },
738 { USB_DEVICE(0x0411, 0x016f), USB_DEVICE_DATA(&rt2800usb_ops) },
735 /* Conceptronic */ 739 /* Conceptronic */
736 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) }, 740 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
737 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) }, 741 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -818,6 +822,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
818 /* Pegatron */ 822 /* Pegatron */
819 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) }, 823 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) },
820 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) }, 824 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) },
825 { USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) },
821 /* Philips */ 826 /* Philips */
822 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) }, 827 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) },
823 /* Planex */ 828 /* Planex */
@@ -899,6 +904,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
899 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 904 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) },
900 /* Sitecom */ 905 /* Sitecom */
901 { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 906 { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) },
907 /* Toshiba */
908 { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) },
902 /* Zinwell */ 909 /* Zinwell */
903 { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) }, 910 { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) },
904#endif 911#endif
@@ -961,7 +968,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
961 { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) }, 968 { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) },
962 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) }, 969 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) },
963 { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 970 { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) },
964 { USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) },
965 /* Planex */ 971 /* Planex */
966 { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) }, 972 { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) },
967 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) }, 973 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -975,8 +981,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
975 /* Sweex */ 981 /* Sweex */
976 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) }, 982 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) },
977 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) }, 983 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) },
978 /* Toshiba */
979 { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) },
980 /* Zyxel */ 984 /* Zyxel */
981 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) }, 985 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) },
982#endif 986#endif
diff --git a/drivers/pcmcia/pxa2xx_colibri.c b/drivers/pcmcia/pxa2xx_colibri.c
index a52039564e74..443cb7fc872d 100644
--- a/drivers/pcmcia/pxa2xx_colibri.c
+++ b/drivers/pcmcia/pxa2xx_colibri.c
@@ -34,14 +34,24 @@
34#define COLIBRI320_DETECT_GPIO 81 34#define COLIBRI320_DETECT_GPIO 81
35#define COLIBRI320_READY_GPIO 29 35#define COLIBRI320_READY_GPIO 29
36 36
37static struct { 37enum {
38 int reset_gpio; 38 DETECT = 0,
39 int ppen_gpio; 39 READY = 1,
40 int bvd1_gpio; 40 BVD1 = 2,
41 int bvd2_gpio; 41 BVD2 = 3,
42 int detect_gpio; 42 PPEN = 4,
43 int ready_gpio; 43 RESET = 5,
44} colibri_pcmcia_gpio; 44};
45
46/* Contents of this array are configured on-the-fly in init function */
47static struct gpio colibri_pcmcia_gpios[] = {
48 { 0, GPIOF_IN, "PCMCIA Detect" },
49 { 0, GPIOF_IN, "PCMCIA Ready" },
50 { 0, GPIOF_IN, "PCMCIA BVD1" },
51 { 0, GPIOF_IN, "PCMCIA BVD2" },
52 { 0, GPIOF_INIT_LOW, "PCMCIA PPEN" },
53 { 0, GPIOF_INIT_HIGH,"PCMCIA Reset" },
54};
45 55
46static struct pcmcia_irqs colibri_irqs[] = { 56static struct pcmcia_irqs colibri_irqs[] = {
47 { 57 {
@@ -54,88 +64,42 @@ static int colibri_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
54{ 64{
55 int ret; 65 int ret;
56 66
57 ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT"); 67 ret = gpio_request_array(colibri_pcmcia_gpios,
68 ARRAY_SIZE(colibri_pcmcia_gpios));
58 if (ret) 69 if (ret)
59 goto err1; 70 goto err1;
60 ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio);
61 if (ret)
62 goto err2;
63
64 ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY");
65 if (ret)
66 goto err2;
67 ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio);
68 if (ret)
69 goto err3;
70 71
71 ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1"); 72 colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpios[DETECT].gpio);
72 if (ret) 73 skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpios[READY].gpio);
73 goto err3;
74 ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio);
75 if (ret)
76 goto err4;
77 74
78 ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2"); 75 ret = soc_pcmcia_request_irqs(skt, colibri_irqs,
79 if (ret) 76 ARRAY_SIZE(colibri_irqs));
80 goto err4;
81 ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio);
82 if (ret)
83 goto err5;
84
85 ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN");
86 if (ret)
87 goto err5;
88 ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0);
89 if (ret)
90 goto err6;
91
92 ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET");
93 if (ret)
94 goto err6;
95 ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1);
96 if (ret) 77 if (ret)
97 goto err7; 78 goto err2;
98
99 colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio);
100 skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio);
101 79
102 return soc_pcmcia_request_irqs(skt, colibri_irqs, 80 return ret;
103 ARRAY_SIZE(colibri_irqs));
104 81
105err7:
106 gpio_free(colibri_pcmcia_gpio.detect_gpio);
107err6:
108 gpio_free(colibri_pcmcia_gpio.ready_gpio);
109err5:
110 gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
111err4:
112 gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
113err3:
114 gpio_free(colibri_pcmcia_gpio.reset_gpio);
115err2: 82err2:
116 gpio_free(colibri_pcmcia_gpio.ppen_gpio); 83 gpio_free_array(colibri_pcmcia_gpios,
84 ARRAY_SIZE(colibri_pcmcia_gpios));
117err1: 85err1:
118 return ret; 86 return ret;
119} 87}
120 88
121static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 89static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
122{ 90{
123 gpio_free(colibri_pcmcia_gpio.detect_gpio); 91 gpio_free_array(colibri_pcmcia_gpios,
124 gpio_free(colibri_pcmcia_gpio.ready_gpio); 92 ARRAY_SIZE(colibri_pcmcia_gpios));
125 gpio_free(colibri_pcmcia_gpio.bvd1_gpio);
126 gpio_free(colibri_pcmcia_gpio.bvd2_gpio);
127 gpio_free(colibri_pcmcia_gpio.reset_gpio);
128 gpio_free(colibri_pcmcia_gpio.ppen_gpio);
129} 93}
130 94
131static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 95static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
132 struct pcmcia_state *state) 96 struct pcmcia_state *state)
133{ 97{
134 98
135 state->detect = !!gpio_get_value(colibri_pcmcia_gpio.detect_gpio); 99 state->detect = !!gpio_get_value(colibri_pcmcia_gpios[DETECT].gpio);
136 state->ready = !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio); 100 state->ready = !!gpio_get_value(colibri_pcmcia_gpios[READY].gpio);
137 state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio); 101 state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpios[BVD1].gpio);
138 state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio); 102 state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpios[BVD2].gpio);
139 state->wrprot = 0; 103 state->wrprot = 0;
140 state->vs_3v = 1; 104 state->vs_3v = 1;
141 state->vs_Xv = 0; 105 state->vs_Xv = 0;
@@ -145,9 +109,10 @@ static int
145colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, 109colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
146 const socket_state_t *state) 110 const socket_state_t *state)
147{ 111{
148 gpio_set_value(colibri_pcmcia_gpio.ppen_gpio, 112 gpio_set_value(colibri_pcmcia_gpios[PPEN].gpio,
149 !(state->Vcc == 33 && state->Vpp < 50)); 113 !(state->Vcc == 33 && state->Vpp < 50));
150 gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags & SS_RESET); 114 gpio_set_value(colibri_pcmcia_gpios[RESET].gpio,
115 state->flags & SS_RESET);
151 return 0; 116 return 0;
152} 117}
153 118
@@ -190,20 +155,20 @@ static int __init colibri_pcmcia_init(void)
190 155
191 /* Colibri PXA270 */ 156 /* Colibri PXA270 */
192 if (machine_is_colibri()) { 157 if (machine_is_colibri()) {
193 colibri_pcmcia_gpio.reset_gpio = COLIBRI270_RESET_GPIO; 158 colibri_pcmcia_gpios[RESET].gpio = COLIBRI270_RESET_GPIO;
194 colibri_pcmcia_gpio.ppen_gpio = COLIBRI270_PPEN_GPIO; 159 colibri_pcmcia_gpios[PPEN].gpio = COLIBRI270_PPEN_GPIO;
195 colibri_pcmcia_gpio.bvd1_gpio = COLIBRI270_BVD1_GPIO; 160 colibri_pcmcia_gpios[BVD1].gpio = COLIBRI270_BVD1_GPIO;
196 colibri_pcmcia_gpio.bvd2_gpio = COLIBRI270_BVD2_GPIO; 161 colibri_pcmcia_gpios[BVD2].gpio = COLIBRI270_BVD2_GPIO;
197 colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO; 162 colibri_pcmcia_gpios[DETECT].gpio = COLIBRI270_DETECT_GPIO;
198 colibri_pcmcia_gpio.ready_gpio = COLIBRI270_READY_GPIO; 163 colibri_pcmcia_gpios[READY].gpio = COLIBRI270_READY_GPIO;
199 /* Colibri PXA320 */ 164 /* Colibri PXA320 */
200 } else if (machine_is_colibri320()) { 165 } else if (machine_is_colibri320()) {
201 colibri_pcmcia_gpio.reset_gpio = COLIBRI320_RESET_GPIO; 166 colibri_pcmcia_gpios[RESET].gpio = COLIBRI320_RESET_GPIO;
202 colibri_pcmcia_gpio.ppen_gpio = COLIBRI320_PPEN_GPIO; 167 colibri_pcmcia_gpios[PPEN].gpio = COLIBRI320_PPEN_GPIO;
203 colibri_pcmcia_gpio.bvd1_gpio = COLIBRI320_BVD1_GPIO; 168 colibri_pcmcia_gpios[BVD1].gpio = COLIBRI320_BVD1_GPIO;
204 colibri_pcmcia_gpio.bvd2_gpio = COLIBRI320_BVD2_GPIO; 169 colibri_pcmcia_gpios[BVD2].gpio = COLIBRI320_BVD2_GPIO;
205 colibri_pcmcia_gpio.detect_gpio = COLIBRI320_DETECT_GPIO; 170 colibri_pcmcia_gpios[DETECT].gpio = COLIBRI320_DETECT_GPIO;
206 colibri_pcmcia_gpio.ready_gpio = COLIBRI320_READY_GPIO; 171 colibri_pcmcia_gpios[READY].gpio = COLIBRI320_READY_GPIO;
207 } 172 }
208 173
209 ret = platform_device_add_data(colibri_pcmcia_device, 174 ret = platform_device_add_data(colibri_pcmcia_device,
diff --git a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c
index 6fb6f7f0672e..69f73670949a 100644
--- a/drivers/pcmcia/pxa2xx_palmld.c
+++ b/drivers/pcmcia/pxa2xx_palmld.c
@@ -4,7 +4,7 @@
4 * Driver for Palm LifeDrive PCMCIA 4 * Driver for Palm LifeDrive PCMCIA
5 * 5 *
6 * Copyright (C) 2006 Alex Osborne <ato@meshy.org> 6 * Copyright (C) 2006 Alex Osborne <ato@meshy.org>
7 * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> 7 * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -20,49 +20,27 @@
20#include <mach/palmld.h> 20#include <mach/palmld.h>
21#include "soc_common.h" 21#include "soc_common.h"
22 22
23static struct gpio palmld_pcmcia_gpios[] = {
24 { GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" },
25 { GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
26 { GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
27};
28
23static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 29static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
24{ 30{
25 int ret; 31 int ret;
26 32
27 ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_POWER, "PCMCIA PWR"); 33 ret = gpio_request_array(palmld_pcmcia_gpios,
28 if (ret) 34 ARRAY_SIZE(palmld_pcmcia_gpios));
29 goto err1;
30 ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_POWER, 0);
31 if (ret)
32 goto err2;
33
34 ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_RESET, "PCMCIA RST");
35 if (ret)
36 goto err2;
37 ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_RESET, 1);
38 if (ret)
39 goto err3;
40
41 ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_READY, "PCMCIA RDY");
42 if (ret)
43 goto err3;
44 ret = gpio_direction_input(GPIO_NR_PALMLD_PCMCIA_READY);
45 if (ret)
46 goto err4;
47 35
48 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); 36 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY);
49 return 0;
50 37
51err4:
52 gpio_free(GPIO_NR_PALMLD_PCMCIA_READY);
53err3:
54 gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET);
55err2:
56 gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER);
57err1:
58 return ret; 38 return ret;
59} 39}
60 40
61static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 41static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
62{ 42{
63 gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); 43 gpio_free_array(palmld_pcmcia_gpios, ARRAY_SIZE(palmld_pcmcia_gpios));
64 gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET);
65 gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER);
66} 44}
67 45
68static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 46static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
diff --git a/drivers/pcmcia/pxa2xx_palmtc.c b/drivers/pcmcia/pxa2xx_palmtc.c
index 459a232d66be..d0ad6a76bbde 100644
--- a/drivers/pcmcia/pxa2xx_palmtc.c
+++ b/drivers/pcmcia/pxa2xx_palmtc.c
@@ -4,7 +4,7 @@
4 * Driver for Palm Tungsten|C PCMCIA 4 * Driver for Palm Tungsten|C PCMCIA
5 * 5 *
6 * Copyright (C) 2008 Alex Osborne <ato@meshy.org> 6 * Copyright (C) 2008 Alex Osborne <ato@meshy.org>
7 * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com> 7 * Copyright (C) 2009-2011 Marek Vasut <marek.vasut@gmail.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -21,79 +21,30 @@
21#include <mach/palmtc.h> 21#include <mach/palmtc.h>
22#include "soc_common.h" 22#include "soc_common.h"
23 23
24static struct gpio palmtc_pcmcia_gpios[] = {
25 { GPIO_NR_PALMTC_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" },
26 { GPIO_NR_PALMTC_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },
27 { GPIO_NR_PALMTC_PCMCIA_POWER3, GPIOF_INIT_LOW, "PCMCIA Power 3" },
28 { GPIO_NR_PALMTC_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
29 { GPIO_NR_PALMTC_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
30 { GPIO_NR_PALMTC_PCMCIA_PWRREADY, GPIOF_IN, "PCMCIA Power Ready" },
31};
32
24static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 33static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
25{ 34{
26 int ret; 35 int ret;
27 36
28 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1"); 37 ret = gpio_request_array(palmtc_pcmcia_gpios,
29 if (ret) 38 ARRAY_SIZE(palmtc_pcmcia_gpios));
30 goto err1;
31 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0);
32 if (ret)
33 goto err2;
34
35 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2");
36 if (ret)
37 goto err2;
38 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0);
39 if (ret)
40 goto err3;
41
42 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3");
43 if (ret)
44 goto err3;
45 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0);
46 if (ret)
47 goto err4;
48
49 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST");
50 if (ret)
51 goto err4;
52 ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1);
53 if (ret)
54 goto err5;
55
56 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY");
57 if (ret)
58 goto err5;
59 ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY);
60 if (ret)
61 goto err6;
62
63 ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY");
64 if (ret)
65 goto err6;
66 ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
67 if (ret)
68 goto err7;
69 39
70 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY); 40 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY);
71 return 0;
72 41
73err7:
74 gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
75err6:
76 gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);
77err5:
78 gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);
79err4:
80 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);
81err3:
82 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);
83err2:
84 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);
85err1:
86 return ret; 42 return ret;
87} 43}
88 44
89static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 45static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
90{ 46{
91 gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); 47 gpio_free_array(palmtc_pcmcia_gpios, ARRAY_SIZE(palmtc_pcmcia_gpios));
92 gpio_free(GPIO_NR_PALMTC_PCMCIA_READY);
93 gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET);
94 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3);
95 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2);
96 gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1);
97} 48}
98 49
99static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 50static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
diff --git a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c
index b07b247a399f..1a2580450402 100644
--- a/drivers/pcmcia/pxa2xx_palmtx.c
+++ b/drivers/pcmcia/pxa2xx_palmtx.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Driver for Palm T|X PCMCIA 4 * Driver for Palm T|X PCMCIA
5 * 5 *
6 * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> 6 * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -13,67 +13,34 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h>
16 17
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18
19#include <mach/gpio.h>
20#include <mach/palmtx.h> 19#include <mach/palmtx.h>
21
22#include "soc_common.h" 20#include "soc_common.h"
23 21
22static struct gpio palmtx_pcmcia_gpios[] = {
23 { GPIO_NR_PALMTX_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" },
24 { GPIO_NR_PALMTX_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" },
25 { GPIO_NR_PALMTX_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
26 { GPIO_NR_PALMTX_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
27};
28
24static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 29static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
25{ 30{
26 int ret; 31 int ret;
27 32
28 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER1, "PCMCIA PWR1"); 33 ret = gpio_request_array(palmtx_pcmcia_gpios,
29 if (ret) 34 ARRAY_SIZE(palmtx_pcmcia_gpios));
30 goto err1;
31 ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER1, 0);
32 if (ret)
33 goto err2;
34
35 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER2, "PCMCIA PWR2");
36 if (ret)
37 goto err2;
38 ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER2, 0);
39 if (ret)
40 goto err3;
41
42 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_RESET, "PCMCIA RST");
43 if (ret)
44 goto err3;
45 ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_RESET, 1);
46 if (ret)
47 goto err4;
48
49 ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_READY, "PCMCIA RDY");
50 if (ret)
51 goto err4;
52 ret = gpio_direction_input(GPIO_NR_PALMTX_PCMCIA_READY);
53 if (ret)
54 goto err5;
55 35
56 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); 36 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY);
57 return 0;
58 37
59err5:
60 gpio_free(GPIO_NR_PALMTX_PCMCIA_READY);
61err4:
62 gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET);
63err3:
64 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2);
65err2:
66 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1);
67err1:
68 return ret; 38 return ret;
69} 39}
70 40
71static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 41static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
72{ 42{
73 gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); 43 gpio_free_array(palmtx_pcmcia_gpios, ARRAY_SIZE(palmtx_pcmcia_gpios));
74 gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET);
75 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2);
76 gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1);
77} 44}
78 45
79static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 46static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c
index 55627eccee8e..435002dfc3ca 100644
--- a/drivers/pcmcia/pxa2xx_vpac270.c
+++ b/drivers/pcmcia/pxa2xx_vpac270.c
@@ -3,8 +3,7 @@
3 * 3 *
4 * Driver for Voipac PXA270 PCMCIA and CF sockets 4 * Driver for Voipac PXA270 PCMCIA and CF sockets
5 * 5 *
6 * Copyright (C) 2010 6 * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com>
7 * Marek Vasut <marek.vasut@gmail.com>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -22,6 +21,19 @@
22 21
23#include "soc_common.h" 22#include "soc_common.h"
24 23
24static struct gpio vpac270_pcmcia_gpios[] = {
25 { GPIO84_VPAC270_PCMCIA_CD, GPIOF_IN, "PCMCIA Card Detect" },
26 { GPIO35_VPAC270_PCMCIA_RDY, GPIOF_IN, "PCMCIA Ready" },
27 { GPIO107_VPAC270_PCMCIA_PPEN, GPIOF_INIT_LOW, "PCMCIA PPEN" },
28 { GPIO11_VPAC270_PCMCIA_RESET, GPIOF_INIT_LOW, "PCMCIA Reset" },
29};
30
31static struct gpio vpac270_cf_gpios[] = {
32 { GPIO17_VPAC270_CF_CD, GPIOF_IN, "CF Card Detect" },
33 { GPIO12_VPAC270_CF_RDY, GPIOF_IN, "CF Ready" },
34 { GPIO16_VPAC270_CF_RESET, GPIOF_INIT_LOW, "CF Reset" },
35};
36
25static struct pcmcia_irqs cd_irqs[] = { 37static struct pcmcia_irqs cd_irqs[] = {
26 { 38 {
27 .sock = 0, 39 .sock = 0,
@@ -40,96 +52,34 @@ static int vpac270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
40 int ret; 52 int ret;
41 53
42 if (skt->nr == 0) { 54 if (skt->nr == 0) {
43 ret = gpio_request(GPIO84_VPAC270_PCMCIA_CD, "PCMCIA CD"); 55 ret = gpio_request_array(vpac270_pcmcia_gpios,
44 if (ret) 56 ARRAY_SIZE(vpac270_pcmcia_gpios));
45 goto err1;
46 ret = gpio_direction_input(GPIO84_VPAC270_PCMCIA_CD);
47 if (ret)
48 goto err2;
49
50 ret = gpio_request(GPIO35_VPAC270_PCMCIA_RDY, "PCMCIA RDY");
51 if (ret)
52 goto err2;
53 ret = gpio_direction_input(GPIO35_VPAC270_PCMCIA_RDY);
54 if (ret)
55 goto err3;
56
57 ret = gpio_request(GPIO107_VPAC270_PCMCIA_PPEN, "PCMCIA PPEN");
58 if (ret)
59 goto err3;
60 ret = gpio_direction_output(GPIO107_VPAC270_PCMCIA_PPEN, 0);
61 if (ret)
62 goto err4;
63
64 ret = gpio_request(GPIO11_VPAC270_PCMCIA_RESET, "PCMCIA RESET");
65 if (ret)
66 goto err4;
67 ret = gpio_direction_output(GPIO11_VPAC270_PCMCIA_RESET, 0);
68 if (ret)
69 goto err5;
70 57
71 skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY); 58 skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY);
72 59
73 return soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1); 60 if (!ret)
74 61 ret = soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1);
75err5:
76 gpio_free(GPIO11_VPAC270_PCMCIA_RESET);
77err4:
78 gpio_free(GPIO107_VPAC270_PCMCIA_PPEN);
79err3:
80 gpio_free(GPIO35_VPAC270_PCMCIA_RDY);
81err2:
82 gpio_free(GPIO84_VPAC270_PCMCIA_CD);
83err1:
84 return ret;
85
86 } else { 62 } else {
87 ret = gpio_request(GPIO17_VPAC270_CF_CD, "CF CD"); 63 ret = gpio_request_array(vpac270_cf_gpios,
88 if (ret) 64 ARRAY_SIZE(vpac270_cf_gpios));
89 goto err6;
90 ret = gpio_direction_input(GPIO17_VPAC270_CF_CD);
91 if (ret)
92 goto err7;
93
94 ret = gpio_request(GPIO12_VPAC270_CF_RDY, "CF RDY");
95 if (ret)
96 goto err7;
97 ret = gpio_direction_input(GPIO12_VPAC270_CF_RDY);
98 if (ret)
99 goto err8;
100
101 ret = gpio_request(GPIO16_VPAC270_CF_RESET, "CF RESET");
102 if (ret)
103 goto err8;
104 ret = gpio_direction_output(GPIO16_VPAC270_CF_RESET, 0);
105 if (ret)
106 goto err9;
107 65
108 skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY); 66 skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY);
109 67
110 return soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1); 68 if (!ret)
111 69 ret = soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1);
112err9:
113 gpio_free(GPIO16_VPAC270_CF_RESET);
114err8:
115 gpio_free(GPIO12_VPAC270_CF_RDY);
116err7:
117 gpio_free(GPIO17_VPAC270_CF_CD);
118err6:
119 return ret;
120
121 } 70 }
71
72 return ret;
122} 73}
123 74
124static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 75static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
125{ 76{
126 gpio_free(GPIO11_VPAC270_PCMCIA_RESET); 77 if (skt->nr == 0)
127 gpio_free(GPIO107_VPAC270_PCMCIA_PPEN); 78 gpio_request_array(vpac270_pcmcia_gpios,
128 gpio_free(GPIO35_VPAC270_PCMCIA_RDY); 79 ARRAY_SIZE(vpac270_pcmcia_gpios));
129 gpio_free(GPIO84_VPAC270_PCMCIA_CD); 80 else
130 gpio_free(GPIO16_VPAC270_CF_RESET); 81 gpio_request_array(vpac270_cf_gpios,
131 gpio_free(GPIO12_VPAC270_CF_RDY); 82 ARRAY_SIZE(vpac270_cf_gpios));
132 gpio_free(GPIO17_VPAC270_CF_CD);
133} 83}
134 84
135static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 85static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index b86bc328463b..332a2c4a891c 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -319,7 +319,7 @@ static irqreturn_t mrst_rtc_irq(int irq, void *p)
319 return IRQ_NONE; 319 return IRQ_NONE;
320} 320}
321 321
322static int __init 322static int __devinit
323vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq) 323vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
324{ 324{
325 int retval = 0; 325 int retval = 0;
@@ -391,7 +391,7 @@ static void rtc_mrst_do_shutdown(void)
391 spin_unlock_irq(&rtc_lock); 391 spin_unlock_irq(&rtc_lock);
392} 392}
393 393
394static void __exit rtc_mrst_do_remove(struct device *dev) 394static void __devexit rtc_mrst_do_remove(struct device *dev)
395{ 395{
396 struct mrst_rtc *mrst = dev_get_drvdata(dev); 396 struct mrst_rtc *mrst = dev_get_drvdata(dev);
397 struct resource *iomem; 397 struct resource *iomem;
@@ -500,14 +500,14 @@ static inline int mrst_poweroff(struct device *dev)
500 500
501#endif 501#endif
502 502
503static int __init vrtc_mrst_platform_probe(struct platform_device *pdev) 503static int __devinit vrtc_mrst_platform_probe(struct platform_device *pdev)
504{ 504{
505 return vrtc_mrst_do_probe(&pdev->dev, 505 return vrtc_mrst_do_probe(&pdev->dev,
506 platform_get_resource(pdev, IORESOURCE_MEM, 0), 506 platform_get_resource(pdev, IORESOURCE_MEM, 0),
507 platform_get_irq(pdev, 0)); 507 platform_get_irq(pdev, 0));
508} 508}
509 509
510static int __exit vrtc_mrst_platform_remove(struct platform_device *pdev) 510static int __devexit vrtc_mrst_platform_remove(struct platform_device *pdev)
511{ 511{
512 rtc_mrst_do_remove(&pdev->dev); 512 rtc_mrst_do_remove(&pdev->dev);
513 return 0; 513 return 0;
@@ -525,7 +525,7 @@ MODULE_ALIAS("platform:vrtc_mrst");
525 525
526static struct platform_driver vrtc_mrst_platform_driver = { 526static struct platform_driver vrtc_mrst_platform_driver = {
527 .probe = vrtc_mrst_platform_probe, 527 .probe = vrtc_mrst_platform_probe,
528 .remove = __exit_p(vrtc_mrst_platform_remove), 528 .remove = __devexit_p(vrtc_mrst_platform_remove),
529 .shutdown = vrtc_mrst_platform_shutdown, 529 .shutdown = vrtc_mrst_platform_shutdown,
530 .driver = { 530 .driver = {
531 .name = (char *) driver_name, 531 .name = (char *) driver_name,
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 0571ef9639cb..9f4b58b7daad 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -138,6 +138,7 @@
138#include <linux/spinlock.h> 138#include <linux/spinlock.h>
139#include <linux/stat.h> 139#include <linux/stat.h>
140#include <linux/bitops.h> 140#include <linux/bitops.h>
141#include <linux/delay.h>
141 142
142#include <asm/io.h> 143#include <asm/io.h>
143#include <asm/system.h> 144#include <asm/system.h>
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
index df36a421e675..5b934851efa8 100644
--- a/drivers/sh/intc/internals.h
+++ b/drivers/sh/intc/internals.h
@@ -86,7 +86,7 @@ enum { MODE_ENABLE_REG = 0, /* Bit(s) set -> interrupt enabled */
86 86
87static inline struct intc_desc_int *get_intc_desc(unsigned int irq) 87static inline struct intc_desc_int *get_intc_desc(unsigned int irq)
88{ 88{
89 struct irq_chip *chip = get_irq_chip(irq); 89 struct irq_chip *chip = irq_get_chip(irq);
90 90
91 return container_of(chip, struct intc_desc_int, chip); 91 return container_of(chip, struct intc_desc_int, chip);
92} 92}
@@ -103,7 +103,7 @@ static inline void activate_irq(int irq)
103 set_irq_flags(irq, IRQF_VALID); 103 set_irq_flags(irq, IRQF_VALID);
104#else 104#else
105 /* same effect on other architectures */ 105 /* same effect on other architectures */
106 set_irq_noprobe(irq); 106 irq_set_noprobe(irq);
107#endif 107#endif
108} 108}
109 109
diff --git a/drivers/staging/altera-stapl/altera-jtag.c b/drivers/staging/altera-stapl/altera-jtag.c
index 6b633b179a7e..876308858b82 100644
--- a/drivers/staging/altera-stapl/altera-jtag.c
+++ b/drivers/staging/altera-stapl/altera-jtag.c
@@ -23,6 +23,7 @@
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */ 24 */
25 25
26#include <linux/delay.h>
26#include <linux/firmware.h> 27#include <linux/firmware.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <staging/altera.h> 29#include <staging/altera.h>
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 428f4fe0b5f7..0ad32888091c 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -95,6 +95,7 @@ static void n_tty_set_room(struct tty_struct *tty)
95{ 95{
96 /* tty->read_cnt is not read locked ? */ 96 /* tty->read_cnt is not read locked ? */
97 int left = N_TTY_BUF_SIZE - tty->read_cnt - 1; 97 int left = N_TTY_BUF_SIZE - tty->read_cnt - 1;
98 int old_left;
98 99
99 /* 100 /*
100 * If we are doing input canonicalization, and there are no 101 * If we are doing input canonicalization, and there are no
@@ -104,7 +105,12 @@ static void n_tty_set_room(struct tty_struct *tty)
104 */ 105 */
105 if (left <= 0) 106 if (left <= 0)
106 left = tty->icanon && !tty->canon_data; 107 left = tty->icanon && !tty->canon_data;
108 old_left = tty->receive_room;
107 tty->receive_room = left; 109 tty->receive_room = left;
110
111 /* Did this open up the receive buffer? We may need to flip */
112 if (left && !old_left)
113 schedule_work(&tty->buf.work);
108} 114}
109 115
110static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) 116static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index e1aee37270f5..80484af781e1 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1506,7 +1506,7 @@ config SERIAL_BCM63XX_CONSOLE
1506 1506
1507config SERIAL_GRLIB_GAISLER_APBUART 1507config SERIAL_GRLIB_GAISLER_APBUART
1508 tristate "GRLIB APBUART serial support" 1508 tristate "GRLIB APBUART serial support"
1509 depends on OF 1509 depends on OF && SPARC
1510 select SERIAL_CORE 1510 select SERIAL_CORE
1511 ---help--- 1511 ---help---
1512 Add support for the GRLIB APBUART serial port. 1512 Add support for the GRLIB APBUART serial port.
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 1ab999b04ef3..19a943693e4c 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -555,10 +555,9 @@ static struct uart_driver grlib_apbuart_driver = {
555 555
556static int __devinit apbuart_probe(struct platform_device *op) 556static int __devinit apbuart_probe(struct platform_device *op)
557{ 557{
558 int i = -1; 558 int i;
559 struct uart_port *port = NULL; 559 struct uart_port *port = NULL;
560 560
561 i = 0;
562 for (i = 0; i < grlib_apbuart_port_nr; i++) { 561 for (i = 0; i < grlib_apbuart_port_nr; i++) {
563 if (op->dev.of_node == grlib_apbuart_nodes[i]) 562 if (op->dev.of_node == grlib_apbuart_nodes[i])
564 break; 563 break;
@@ -566,6 +565,7 @@ static int __devinit apbuart_probe(struct platform_device *op)
566 565
567 port = &grlib_apbuart_ports[i]; 566 port = &grlib_apbuart_ports[i];
568 port->dev = &op->dev; 567 port->dev = &op->dev;
568 port->irq = op->archdata.irqs[0];
569 569
570 uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port); 570 uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port);
571 571
@@ -598,24 +598,12 @@ static struct platform_driver grlib_apbuart_of_driver = {
598 598
599static int grlib_apbuart_configure(void) 599static int grlib_apbuart_configure(void)
600{ 600{
601 struct device_node *np, *rp; 601 struct device_node *np;
602 const u32 *prop; 602 int line = 0;
603 int freq_khz, line = 0;
604
605 /* Get bus frequency */
606 rp = of_find_node_by_path("/");
607 if (!rp)
608 return -ENODEV;
609 rp = of_get_next_child(rp, NULL);
610 if (!rp)
611 return -ENODEV;
612 prop = of_get_property(rp, "clock-frequency", NULL);
613 if (!prop)
614 return -ENODEV;
615 freq_khz = *prop;
616 603
617 for_each_matching_node(np, apbuart_match) { 604 for_each_matching_node(np, apbuart_match) {
618 const int *irqs, *ampopts; 605 const int *ampopts;
606 const u32 *freq_hz;
619 const struct amba_prom_registers *regs; 607 const struct amba_prom_registers *regs;
620 struct uart_port *port; 608 struct uart_port *port;
621 unsigned long addr; 609 unsigned long addr;
@@ -623,11 +611,11 @@ static int grlib_apbuart_configure(void)
623 ampopts = of_get_property(np, "ampopts", NULL); 611 ampopts = of_get_property(np, "ampopts", NULL);
624 if (ampopts && (*ampopts == 0)) 612 if (ampopts && (*ampopts == 0))
625 continue; /* Ignore if used by another OS instance */ 613 continue; /* Ignore if used by another OS instance */
626
627 irqs = of_get_property(np, "interrupts", NULL);
628 regs = of_get_property(np, "reg", NULL); 614 regs = of_get_property(np, "reg", NULL);
615 /* Frequency of APB Bus is frequency of UART */
616 freq_hz = of_get_property(np, "freq", NULL);
629 617
630 if (!irqs || !regs) 618 if (!regs || !freq_hz || (*freq_hz == 0))
631 continue; 619 continue;
632 620
633 grlib_apbuart_nodes[line] = np; 621 grlib_apbuart_nodes[line] = np;
@@ -638,12 +626,12 @@ static int grlib_apbuart_configure(void)
638 626
639 port->mapbase = addr; 627 port->mapbase = addr;
640 port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map)); 628 port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
641 port->irq = *irqs; 629 port->irq = 0;
642 port->iotype = UPIO_MEM; 630 port->iotype = UPIO_MEM;
643 port->ops = &grlib_apbuart_ops; 631 port->ops = &grlib_apbuart_ops;
644 port->flags = UPF_BOOT_AUTOCONF; 632 port->flags = UPF_BOOT_AUTOCONF;
645 port->line = line; 633 port->line = line;
646 port->uartclk = freq_khz * 1000; 634 port->uartclk = *freq_hz;
647 port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); 635 port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line);
648 line++; 636 line++;
649 637
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index b9451219528b..f1a7918d71aa 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -442,10 +442,8 @@ static void flush_to_ldisc(struct work_struct *work)
442 line discipline as we want to empty the queue */ 442 line discipline as we want to empty the queue */
443 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) 443 if (test_bit(TTY_FLUSHPENDING, &tty->flags))
444 break; 444 break;
445 if (!tty->receive_room || seen_tail) { 445 if (!tty->receive_room || seen_tail)
446 schedule_work(&tty->buf.work);
447 break; 446 break;
448 }
449 if (count > tty->receive_room) 447 if (count > tty->receive_room)
450 count = tty->receive_room; 448 count = tty->receive_room;
451 char_buf = head->char_buf_ptr + head->read; 449 char_buf = head->char_buf_ptr + head->read;
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index b37f92cb71bc..444b60aa15e9 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -139,24 +139,6 @@ static const char ep0name [] = "ep0";
139static void pxa25x_ep_fifo_flush (struct usb_ep *ep); 139static void pxa25x_ep_fifo_flush (struct usb_ep *ep);
140static void nuke (struct pxa25x_ep *, int status); 140static void nuke (struct pxa25x_ep *, int status);
141 141
142/* one GPIO should be used to detect VBUS from the host */
143static int is_vbus_present(void)
144{
145 struct pxa2xx_udc_mach_info *mach = the_controller->mach;
146
147 if (gpio_is_valid(mach->gpio_vbus)) {
148 int value = gpio_get_value(mach->gpio_vbus);
149
150 if (mach->gpio_vbus_inverted)
151 return !value;
152 else
153 return !!value;
154 }
155 if (mach->udc_is_connected)
156 return mach->udc_is_connected();
157 return 1;
158}
159
160/* one GPIO should control a D+ pullup, so host sees this device (or not) */ 142/* one GPIO should control a D+ pullup, so host sees this device (or not) */
161static void pullup_off(void) 143static void pullup_off(void)
162{ 144{
@@ -1055,7 +1037,7 @@ udc_seq_show(struct seq_file *m, void *_d)
1055 "%s version: %s\nGadget driver: %s\nHost %s\n\n", 1037 "%s version: %s\nGadget driver: %s\nHost %s\n\n",
1056 driver_name, DRIVER_VERSION SIZE_STR "(pio)", 1038 driver_name, DRIVER_VERSION SIZE_STR "(pio)",
1057 dev->driver ? dev->driver->driver.name : "(none)", 1039 dev->driver ? dev->driver->driver.name : "(none)",
1058 is_vbus_present() ? "full speed" : "disconnected"); 1040 dev->gadget.speed == USB_SPEED_FULL ? "full speed" : "disconnected");
1059 1041
1060 /* registers for device and ep0 */ 1042 /* registers for device and ep0 */
1061 seq_printf(m, 1043 seq_printf(m,
@@ -1094,7 +1076,7 @@ udc_seq_show(struct seq_file *m, void *_d)
1094 (tmp & UDCCFR_ACM) ? " acm" : ""); 1076 (tmp & UDCCFR_ACM) ? " acm" : "");
1095 } 1077 }
1096 1078
1097 if (!is_vbus_present() || !dev->driver) 1079 if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver)
1098 goto done; 1080 goto done;
1099 1081
1100 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", 1082 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n",
@@ -1435,14 +1417,6 @@ lubbock_vbus_irq(int irq, void *_dev)
1435 1417
1436#endif 1418#endif
1437 1419
1438static irqreturn_t udc_vbus_irq(int irq, void *_dev)
1439{
1440 struct pxa25x_udc *dev = _dev;
1441
1442 pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present());
1443 return IRQ_HANDLED;
1444}
1445
1446 1420
1447/*-------------------------------------------------------------------------*/ 1421/*-------------------------------------------------------------------------*/
1448 1422
@@ -1766,12 +1740,9 @@ pxa25x_udc_irq(int irq, void *_dev)
1766 if (unlikely(udccr & UDCCR_SUSIR)) { 1740 if (unlikely(udccr & UDCCR_SUSIR)) {
1767 udc_ack_int_UDCCR(UDCCR_SUSIR); 1741 udc_ack_int_UDCCR(UDCCR_SUSIR);
1768 handled = 1; 1742 handled = 1;
1769 DBG(DBG_VERBOSE, "USB suspend%s\n", is_vbus_present() 1743 DBG(DBG_VERBOSE, "USB suspend\n");
1770 ? "" : "+disconnect");
1771 1744
1772 if (!is_vbus_present()) 1745 if (dev->gadget.speed != USB_SPEED_UNKNOWN
1773 stop_activity(dev, dev->driver);
1774 else if (dev->gadget.speed != USB_SPEED_UNKNOWN
1775 && dev->driver 1746 && dev->driver
1776 && dev->driver->suspend) 1747 && dev->driver->suspend)
1777 dev->driver->suspend(&dev->gadget); 1748 dev->driver->suspend(&dev->gadget);
@@ -1786,8 +1757,7 @@ pxa25x_udc_irq(int irq, void *_dev)
1786 1757
1787 if (dev->gadget.speed != USB_SPEED_UNKNOWN 1758 if (dev->gadget.speed != USB_SPEED_UNKNOWN
1788 && dev->driver 1759 && dev->driver
1789 && dev->driver->resume 1760 && dev->driver->resume)
1790 && is_vbus_present())
1791 dev->driver->resume(&dev->gadget); 1761 dev->driver->resume(&dev->gadget);
1792 } 1762 }
1793 1763
@@ -2137,7 +2107,7 @@ static struct pxa25x_udc memory = {
2137static int __init pxa25x_udc_probe(struct platform_device *pdev) 2107static int __init pxa25x_udc_probe(struct platform_device *pdev)
2138{ 2108{
2139 struct pxa25x_udc *dev = &memory; 2109 struct pxa25x_udc *dev = &memory;
2140 int retval, vbus_irq, irq; 2110 int retval, irq;
2141 u32 chiprev; 2111 u32 chiprev;
2142 2112
2143 /* insist on Intel/ARM/XScale */ 2113 /* insist on Intel/ARM/XScale */
@@ -2199,19 +2169,6 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2199 2169
2200 dev->transceiver = otg_get_transceiver(); 2170 dev->transceiver = otg_get_transceiver();
2201 2171
2202 if (gpio_is_valid(dev->mach->gpio_vbus)) {
2203 if ((retval = gpio_request(dev->mach->gpio_vbus,
2204 "pxa25x_udc GPIO VBUS"))) {
2205 dev_dbg(&pdev->dev,
2206 "can't get vbus gpio %d, err: %d\n",
2207 dev->mach->gpio_vbus, retval);
2208 goto err_gpio_vbus;
2209 }
2210 gpio_direction_input(dev->mach->gpio_vbus);
2211 vbus_irq = gpio_to_irq(dev->mach->gpio_vbus);
2212 } else
2213 vbus_irq = 0;
2214
2215 if (gpio_is_valid(dev->mach->gpio_pullup)) { 2172 if (gpio_is_valid(dev->mach->gpio_pullup)) {
2216 if ((retval = gpio_request(dev->mach->gpio_pullup, 2173 if ((retval = gpio_request(dev->mach->gpio_pullup,
2217 "pca25x_udc GPIO PULLUP"))) { 2174 "pca25x_udc GPIO PULLUP"))) {
@@ -2237,7 +2194,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2237 udc_disable(dev); 2194 udc_disable(dev);
2238 udc_reinit(dev); 2195 udc_reinit(dev);
2239 2196
2240 dev->vbus = !!is_vbus_present(); 2197 dev->vbus = 0;
2241 2198
2242 /* irq setup after old hardware state is cleaned up */ 2199 /* irq setup after old hardware state is cleaned up */
2243 retval = request_irq(irq, pxa25x_udc_irq, 2200 retval = request_irq(irq, pxa25x_udc_irq,
@@ -2273,22 +2230,10 @@ lubbock_fail0:
2273 } 2230 }
2274 } else 2231 } else
2275#endif 2232#endif
2276 if (vbus_irq) {
2277 retval = request_irq(vbus_irq, udc_vbus_irq,
2278 IRQF_DISABLED | IRQF_SAMPLE_RANDOM |
2279 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2280 driver_name, dev);
2281 if (retval != 0) {
2282 pr_err("%s: can't get irq %i, err %d\n",
2283 driver_name, vbus_irq, retval);
2284 goto err_vbus_irq;
2285 }
2286 }
2287 create_debug_files(dev); 2233 create_debug_files(dev);
2288 2234
2289 return 0; 2235 return 0;
2290 2236
2291 err_vbus_irq:
2292#ifdef CONFIG_ARCH_LUBBOCK 2237#ifdef CONFIG_ARCH_LUBBOCK
2293 free_irq(LUBBOCK_USB_DISC_IRQ, dev); 2238 free_irq(LUBBOCK_USB_DISC_IRQ, dev);
2294 err_irq_lub: 2239 err_irq_lub:
@@ -2298,9 +2243,6 @@ lubbock_fail0:
2298 if (gpio_is_valid(dev->mach->gpio_pullup)) 2243 if (gpio_is_valid(dev->mach->gpio_pullup))
2299 gpio_free(dev->mach->gpio_pullup); 2244 gpio_free(dev->mach->gpio_pullup);
2300 err_gpio_pullup: 2245 err_gpio_pullup:
2301 if (gpio_is_valid(dev->mach->gpio_vbus))
2302 gpio_free(dev->mach->gpio_vbus);
2303 err_gpio_vbus:
2304 if (dev->transceiver) { 2246 if (dev->transceiver) {
2305 otg_put_transceiver(dev->transceiver); 2247 otg_put_transceiver(dev->transceiver);
2306 dev->transceiver = NULL; 2248 dev->transceiver = NULL;
@@ -2337,10 +2279,6 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2337 free_irq(LUBBOCK_USB_IRQ, dev); 2279 free_irq(LUBBOCK_USB_IRQ, dev);
2338 } 2280 }
2339#endif 2281#endif
2340 if (gpio_is_valid(dev->mach->gpio_vbus)) {
2341 free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev);
2342 gpio_free(dev->mach->gpio_vbus);
2343 }
2344 if (gpio_is_valid(dev->mach->gpio_pullup)) 2282 if (gpio_is_valid(dev->mach->gpio_pullup))
2345 gpio_free(dev->mach->gpio_pullup); 2283 gpio_free(dev->mach->gpio_pullup);
2346 2284
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index d2c019637e45..ba0d28727ccb 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -106,7 +106,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state);
106static int mct_u232_tiocmget(struct tty_struct *tty); 106static int mct_u232_tiocmget(struct tty_struct *tty);
107static int mct_u232_tiocmset(struct tty_struct *tty, 107static int mct_u232_tiocmset(struct tty_struct *tty,
108 unsigned int set, unsigned int clear); 108 unsigned int set, unsigned int clear);
109static int mct_u232_ioctl(struct tty_struct *tty, struct file *file, 109static int mct_u232_ioctl(struct tty_struct *tty,
110 unsigned int cmd, unsigned long arg); 110 unsigned int cmd, unsigned long arg);
111static int mct_u232_get_icount(struct tty_struct *tty, 111static int mct_u232_get_icount(struct tty_struct *tty,
112 struct serial_icounter_struct *icount); 112 struct serial_icounter_struct *icount);
@@ -874,7 +874,7 @@ static void mct_u232_unthrottle(struct tty_struct *tty)
874 } 874 }
875} 875}
876 876
877static int mct_u232_ioctl(struct tty_struct *tty, struct file *file, 877static int mct_u232_ioctl(struct tty_struct *tty,
878 unsigned int cmd, unsigned long arg) 878 unsigned int cmd, unsigned long arg)
879{ 879{
880 DEFINE_WAIT(wait); 880 DEFINE_WAIT(wait);
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index 201f6096844b..a1dd4d4fa192 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -413,7 +413,7 @@ static int opticon_tiocmget(struct tty_struct *tty)
413 return result; 413 return result;
414} 414}
415 415
416static int opticon_tiocmset(struct tty_struct *tty, struct file *file, 416static int opticon_tiocmset(struct tty_struct *tty,
417 unsigned int set, unsigned int clear) 417 unsigned int set, unsigned int clear)
418{ 418{
419 struct usb_serial_port *port = tty->driver_data; 419 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
index dbd2dc4745d1..27f2c57e06e9 100644
--- a/drivers/video/fb-puv3.c
+++ b/drivers/video/fb-puv3.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/vmalloc.h>
17#include <linux/platform_device.h> 16#include <linux/platform_device.h>
18#include <linux/clk.h> 17#include <linux/clk.h>
19#include <linux/fb.h> 18#include <linux/fb.h>
@@ -531,7 +530,7 @@ static int unifb_set_par(struct fb_info *info)
531 return -EINVAL; 530 return -EINVAL;
532 } 531 }
533 532
534 writel(PKUNITY_UNIGFX_MMAP_BASE, UDE_FSA); 533 writel(info->fix.smem_start, UDE_FSA);
535 writel(info->var.yres, UDE_LS); 534 writel(info->var.yres, UDE_LS);
536 writel(get_line_length(info->var.xres, 535 writel(get_line_length(info->var.xres,
537 info->var.bits_per_pixel) >> 3, UDE_PS); 536 info->var.bits_per_pixel) >> 3, UDE_PS);
@@ -680,13 +679,27 @@ static int unifb_probe(struct platform_device *dev)
680 struct fb_info *info; 679 struct fb_info *info;
681 u32 unifb_regs[UNIFB_REGS_NUM]; 680 u32 unifb_regs[UNIFB_REGS_NUM];
682 int retval = -ENOMEM; 681 int retval = -ENOMEM;
683 struct resource *iomem, *mapmem; 682 struct resource *iomem;
683 void *videomemory;
684
685 videomemory = (void *)__get_free_pages(GFP_KERNEL | __GFP_COMP,
686 get_order(UNIFB_MEMSIZE));
687 if (!videomemory)
688 goto err;
689
690 memset(videomemory, 0, UNIFB_MEMSIZE);
691
692 unifb_fix.smem_start = virt_to_phys(videomemory);
693 unifb_fix.smem_len = UNIFB_MEMSIZE;
694
695 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
696 unifb_fix.mmio_start = iomem->start;
684 697
685 info = framebuffer_alloc(sizeof(u32)*256, &dev->dev); 698 info = framebuffer_alloc(sizeof(u32)*256, &dev->dev);
686 if (!info) 699 if (!info)
687 goto err; 700 goto err;
688 701
689 info->screen_base = (char __iomem *)KUSER_UNIGFX_BASE; 702 info->screen_base = (char __iomem *)videomemory;
690 info->fbops = &unifb_ops; 703 info->fbops = &unifb_ops;
691 704
692 retval = fb_find_mode(&info->var, info, NULL, 705 retval = fb_find_mode(&info->var, info, NULL,
@@ -695,13 +708,6 @@ static int unifb_probe(struct platform_device *dev)
695 if (!retval || (retval == 4)) 708 if (!retval || (retval == 4))
696 info->var = unifb_default; 709 info->var = unifb_default;
697 710
698 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
699 unifb_fix.mmio_start = iomem->start;
700
701 mapmem = platform_get_resource(dev, IORESOURCE_MEM, 1);
702 unifb_fix.smem_start = mapmem->start;
703 unifb_fix.smem_len = UNIFB_MEMSIZE;
704
705 info->fix = unifb_fix; 711 info->fix = unifb_fix;
706 info->pseudo_palette = info->par; 712 info->pseudo_palette = info->par;
707 info->par = NULL; 713 info->par = NULL;
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 825b665245bb..a2e5b5100ab4 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -627,7 +627,12 @@ static void overlay1fb_enable(struct pxafb_layer *ofb)
627 627
628static void overlay1fb_disable(struct pxafb_layer *ofb) 628static void overlay1fb_disable(struct pxafb_layer *ofb)
629{ 629{
630 uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); 630 uint32_t lccr5;
631
632 if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN))
633 return;
634
635 lccr5 = lcd_readl(ofb->fbi, LCCR5);
631 636
632 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN); 637 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN);
633 638
@@ -685,7 +690,12 @@ static void overlay2fb_enable(struct pxafb_layer *ofb)
685 690
686static void overlay2fb_disable(struct pxafb_layer *ofb) 691static void overlay2fb_disable(struct pxafb_layer *ofb)
687{ 692{
688 uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); 693 uint32_t lccr5;
694
695 if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN))
696 return;
697
698 lccr5 = lcd_readl(ofb->fbi, LCCR5);
689 699
690 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN); 700 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN);
691 701
@@ -720,12 +730,10 @@ static int overlayfb_open(struct fb_info *info, int user)
720 if (user == 0) 730 if (user == 0)
721 return -ENODEV; 731 return -ENODEV;
722 732
723 /* allow only one user at a time */ 733 if (ofb->usage++ == 0)
724 if (atomic_inc_and_test(&ofb->usage)) 734 /* unblank the base framebuffer */
725 return -EBUSY; 735 fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
726 736
727 /* unblank the base framebuffer */
728 fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
729 return 0; 737 return 0;
730} 738}
731 739
@@ -733,12 +741,15 @@ static int overlayfb_release(struct fb_info *info, int user)
733{ 741{
734 struct pxafb_layer *ofb = (struct pxafb_layer*) info; 742 struct pxafb_layer *ofb = (struct pxafb_layer*) info;
735 743
736 atomic_dec(&ofb->usage); 744 if (ofb->usage == 1) {
737 ofb->ops->disable(ofb); 745 ofb->ops->disable(ofb);
746 ofb->fb.var.height = -1;
747 ofb->fb.var.width = -1;
748 ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0;
749 ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0;
738 750
739 free_pages_exact(ofb->video_mem, ofb->video_mem_size); 751 ofb->usage--;
740 ofb->video_mem = NULL; 752 }
741 ofb->video_mem_size = 0;
742 return 0; 753 return 0;
743} 754}
744 755
@@ -750,7 +761,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var,
750 int xpos, ypos, pfor, bpp; 761 int xpos, ypos, pfor, bpp;
751 762
752 xpos = NONSTD_TO_XPOS(var->nonstd); 763 xpos = NONSTD_TO_XPOS(var->nonstd);
753 ypos = NONSTD_TO_XPOS(var->nonstd); 764 ypos = NONSTD_TO_YPOS(var->nonstd);
754 pfor = NONSTD_TO_PFOR(var->nonstd); 765 pfor = NONSTD_TO_PFOR(var->nonstd);
755 766
756 bpp = pxafb_var_to_bpp(var); 767 bpp = pxafb_var_to_bpp(var);
@@ -794,7 +805,7 @@ static int overlayfb_check_var(struct fb_var_screeninfo *var,
794 return 0; 805 return 0;
795} 806}
796 807
797static int overlayfb_map_video_memory(struct pxafb_layer *ofb) 808static int overlayfb_check_video_memory(struct pxafb_layer *ofb)
798{ 809{
799 struct fb_var_screeninfo *var = &ofb->fb.var; 810 struct fb_var_screeninfo *var = &ofb->fb.var;
800 int pfor = NONSTD_TO_PFOR(var->nonstd); 811 int pfor = NONSTD_TO_PFOR(var->nonstd);
@@ -812,27 +823,11 @@ static int overlayfb_map_video_memory(struct pxafb_layer *ofb)
812 823
813 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual); 824 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual);
814 825
815 /* don't re-allocate if the original video memory is enough */
816 if (ofb->video_mem) { 826 if (ofb->video_mem) {
817 if (ofb->video_mem_size >= size) 827 if (ofb->video_mem_size >= size)
818 return 0; 828 return 0;
819
820 free_pages_exact(ofb->video_mem, ofb->video_mem_size);
821 } 829 }
822 830 return -EINVAL;
823 ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
824 if (ofb->video_mem == NULL)
825 return -ENOMEM;
826
827 ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
828 ofb->video_mem_size = size;
829
830 mutex_lock(&ofb->fb.mm_lock);
831 ofb->fb.fix.smem_start = ofb->video_mem_phys;
832 ofb->fb.fix.smem_len = ofb->fb.fix.line_length * var->yres_virtual;
833 mutex_unlock(&ofb->fb.mm_lock);
834 ofb->fb.screen_base = ofb->video_mem;
835 return 0;
836} 831}
837 832
838static int overlayfb_set_par(struct fb_info *info) 833static int overlayfb_set_par(struct fb_info *info)
@@ -841,13 +836,13 @@ static int overlayfb_set_par(struct fb_info *info)
841 struct fb_var_screeninfo *var = &info->var; 836 struct fb_var_screeninfo *var = &info->var;
842 int xpos, ypos, pfor, bpp, ret; 837 int xpos, ypos, pfor, bpp, ret;
843 838
844 ret = overlayfb_map_video_memory(ofb); 839 ret = overlayfb_check_video_memory(ofb);
845 if (ret) 840 if (ret)
846 return ret; 841 return ret;
847 842
848 bpp = pxafb_var_to_bpp(var); 843 bpp = pxafb_var_to_bpp(var);
849 xpos = NONSTD_TO_XPOS(var->nonstd); 844 xpos = NONSTD_TO_XPOS(var->nonstd);
850 ypos = NONSTD_TO_XPOS(var->nonstd); 845 ypos = NONSTD_TO_YPOS(var->nonstd);
851 pfor = NONSTD_TO_PFOR(var->nonstd); 846 pfor = NONSTD_TO_PFOR(var->nonstd);
852 847
853 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) | 848 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) |
@@ -891,7 +886,7 @@ static void __devinit init_pxafb_overlay(struct pxafb_info *fbi,
891 886
892 ofb->id = id; 887 ofb->id = id;
893 ofb->ops = &ofb_ops[id]; 888 ofb->ops = &ofb_ops[id];
894 atomic_set(&ofb->usage, 0); 889 ofb->usage = 0;
895 ofb->fbi = fbi; 890 ofb->fbi = fbi;
896 init_completion(&ofb->branch_done); 891 init_completion(&ofb->branch_done);
897} 892}
@@ -904,29 +899,60 @@ static inline int pxafb_overlay_supported(void)
904 return 0; 899 return 0;
905} 900}
906 901
907static int __devinit pxafb_overlay_init(struct pxafb_info *fbi) 902static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb,
903 struct pxafb_layer *ofb)
904{
905 /* We assume that user will use at most video_mem_size for overlay fb,
906 * anyway, it's useless to use 16bpp main plane and 24bpp overlay
907 */
908 ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size),
909 GFP_KERNEL | __GFP_ZERO);
910 if (ofb->video_mem == NULL)
911 return -ENOMEM;
912
913 ofb->video_mem_phys = virt_to_phys(ofb->video_mem);
914 ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size);
915
916 mutex_lock(&ofb->fb.mm_lock);
917 ofb->fb.fix.smem_start = ofb->video_mem_phys;
918 ofb->fb.fix.smem_len = pxafb->video_mem_size;
919 mutex_unlock(&ofb->fb.mm_lock);
920
921 ofb->fb.screen_base = ofb->video_mem;
922
923 return 0;
924}
925
926static void __devinit pxafb_overlay_init(struct pxafb_info *fbi)
908{ 927{
909 int i, ret; 928 int i, ret;
910 929
911 if (!pxafb_overlay_supported()) 930 if (!pxafb_overlay_supported())
912 return 0; 931 return;
913 932
914 for (i = 0; i < 2; i++) { 933 for (i = 0; i < 2; i++) {
915 init_pxafb_overlay(fbi, &fbi->overlay[i], i); 934 struct pxafb_layer *ofb = &fbi->overlay[i];
916 ret = register_framebuffer(&fbi->overlay[i].fb); 935 init_pxafb_overlay(fbi, ofb, i);
936 ret = register_framebuffer(&ofb->fb);
917 if (ret) { 937 if (ret) {
918 dev_err(fbi->dev, "failed to register overlay %d\n", i); 938 dev_err(fbi->dev, "failed to register overlay %d\n", i);
919 return ret; 939 continue;
920 } 940 }
941 ret = pxafb_overlay_map_video_memory(fbi, ofb);
942 if (ret) {
943 dev_err(fbi->dev,
944 "failed to map video memory for overlay %d\n",
945 i);
946 unregister_framebuffer(&ofb->fb);
947 continue;
948 }
949 ofb->registered = 1;
921 } 950 }
922 951
923 /* mask all IU/BS/EOF/SOF interrupts */ 952 /* mask all IU/BS/EOF/SOF interrupts */
924 lcd_writel(fbi, LCCR5, ~0); 953 lcd_writel(fbi, LCCR5, ~0);
925 954
926 /* place overlay(s) on top of base */
927 fbi->lccr0 |= LCCR0_OUC;
928 pr_info("PXA Overlay driver loaded successfully!\n"); 955 pr_info("PXA Overlay driver loaded successfully!\n");
929 return 0;
930} 956}
931 957
932static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi) 958static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)
@@ -936,8 +962,15 @@ static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi)
936 if (!pxafb_overlay_supported()) 962 if (!pxafb_overlay_supported())
937 return; 963 return;
938 964
939 for (i = 0; i < 2; i++) 965 for (i = 0; i < 2; i++) {
940 unregister_framebuffer(&fbi->overlay[i].fb); 966 struct pxafb_layer *ofb = &fbi->overlay[i];
967 if (ofb->registered) {
968 if (ofb->video_mem)
969 free_pages_exact(ofb->video_mem,
970 ofb->video_mem_size);
971 unregister_framebuffer(&ofb->fb);
972 }
973 }
941} 974}
942#else 975#else
943static inline void pxafb_overlay_init(struct pxafb_info *fbi) {} 976static inline void pxafb_overlay_init(struct pxafb_info *fbi) {}
@@ -1368,7 +1401,8 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var,
1368 (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) || 1401 (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) ||
1369 (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) || 1402 (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) ||
1370 (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) || 1403 (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) ||
1371 (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])) 1404 ((fbi->lccr0 & LCCR0_SDS) &&
1405 (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])))
1372 pxafb_schedule_work(fbi, C_REENABLE); 1406 pxafb_schedule_work(fbi, C_REENABLE);
1373 1407
1374 return 0; 1408 return 0;
@@ -1420,7 +1454,8 @@ static void pxafb_enable_controller(struct pxafb_info *fbi)
1420 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB); 1454 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB);
1421 1455
1422 lcd_writel(fbi, FDADR0, fbi->fdadr[0]); 1456 lcd_writel(fbi, FDADR0, fbi->fdadr[0]);
1423 lcd_writel(fbi, FDADR1, fbi->fdadr[1]); 1457 if (fbi->lccr0 & LCCR0_SDS)
1458 lcd_writel(fbi, FDADR1, fbi->fdadr[1]);
1424 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB); 1459 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB);
1425} 1460}
1426 1461
@@ -1613,7 +1648,8 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
1613 1648
1614 switch (val) { 1649 switch (val) {
1615 case CPUFREQ_PRECHANGE: 1650 case CPUFREQ_PRECHANGE:
1616 set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); 1651 if (!fbi->overlay[0].usage && !fbi->overlay[1].usage)
1652 set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE);
1617 break; 1653 break;
1618 1654
1619 case CPUFREQ_POSTCHANGE: 1655 case CPUFREQ_POSTCHANGE:
@@ -1806,6 +1842,12 @@ static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
1806 1842
1807 pxafb_decode_mach_info(fbi, inf); 1843 pxafb_decode_mach_info(fbi, inf);
1808 1844
1845#ifdef CONFIG_FB_PXA_OVERLAY
1846 /* place overlay(s) on top of base */
1847 if (pxafb_overlay_supported())
1848 fbi->lccr0 |= LCCR0_OUC;
1849#endif
1850
1809 init_waitqueue_head(&fbi->ctrlr_wait); 1851 init_waitqueue_head(&fbi->ctrlr_wait);
1810 INIT_WORK(&fbi->task, pxafb_task); 1852 INIT_WORK(&fbi->task, pxafb_task);
1811 mutex_init(&fbi->ctrlr_lock); 1853 mutex_init(&fbi->ctrlr_lock);
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h
index 2353521c5c8c..26ba9fa3f737 100644
--- a/drivers/video/pxafb.h
+++ b/drivers/video/pxafb.h
@@ -92,7 +92,8 @@ struct pxafb_layer_ops {
92struct pxafb_layer { 92struct pxafb_layer {
93 struct fb_info fb; 93 struct fb_info fb;
94 int id; 94 int id;
95 atomic_t usage; 95 int registered;
96 uint32_t usage;
96 uint32_t control[2]; 97 uint32_t control[2];
97 98
98 struct pxafb_layer_ops *ops; 99 struct pxafb_layer_ops *ops;