diff options
Diffstat (limited to 'drivers')
146 files changed, 1070 insertions, 714 deletions
diff --git a/drivers/base/soc.c b/drivers/base/soc.c index 05f150382da8..ba29b2e73d48 100644 --- a/drivers/base/soc.c +++ b/drivers/base/soc.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/sys_soc.h> | 15 | #include <linux/sys_soc.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | 17 | ||
18 | static DEFINE_IDR(soc_ida); | 18 | static DEFINE_IDA(soc_ida); |
19 | static DEFINE_SPINLOCK(soc_lock); | 19 | static DEFINE_SPINLOCK(soc_lock); |
20 | 20 | ||
21 | static ssize_t soc_info_get(struct device *dev, | 21 | static ssize_t soc_info_get(struct device *dev, |
@@ -168,8 +168,6 @@ void soc_device_unregister(struct soc_device *soc_dev) | |||
168 | 168 | ||
169 | static int __init soc_bus_register(void) | 169 | static int __init soc_bus_register(void) |
170 | { | 170 | { |
171 | spin_lock_init(&soc_lock); | ||
172 | |||
173 | return bus_register(&soc_bus_type); | 171 | return bus_register(&soc_bus_type); |
174 | } | 172 | } |
175 | core_initcall(soc_bus_register); | 173 | core_initcall(soc_bus_register); |
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index c1172dafdffa..fb7c80fb721e 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig | |||
@@ -29,7 +29,7 @@ config BCMA_HOST_PCI | |||
29 | 29 | ||
30 | config BCMA_DRIVER_PCI_HOSTMODE | 30 | config BCMA_DRIVER_PCI_HOSTMODE |
31 | bool "Driver for PCI core working in hostmode" | 31 | bool "Driver for PCI core working in hostmode" |
32 | depends on BCMA && MIPS | 32 | depends on BCMA && MIPS && BCMA_HOST_PCI |
33 | help | 33 | help |
34 | PCI core hostmode operation (external PCI bus). | 34 | PCI core hostmode operation (external PCI bus). |
35 | 35 | ||
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c index 4e20bcfa7ec5..d2097a11c3c7 100644 --- a/drivers/bcma/driver_pci_host.c +++ b/drivers/bcma/driver_pci_host.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "bcma_private.h" | 12 | #include "bcma_private.h" |
13 | #include <linux/pci.h> | ||
13 | #include <linux/export.h> | 14 | #include <linux/export.h> |
14 | #include <linux/bcma/bcma.h> | 15 | #include <linux/bcma/bcma.h> |
15 | #include <asm/paccess.h> | 16 | #include <asm/paccess.h> |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 48442476ec00..ae9edca7b56d 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -72,7 +72,9 @@ static struct usb_device_id ath3k_table[] = { | |||
72 | 72 | ||
73 | /* Atheros AR3012 with sflash firmware*/ | 73 | /* Atheros AR3012 with sflash firmware*/ |
74 | { USB_DEVICE(0x0CF3, 0x3004) }, | 74 | { USB_DEVICE(0x0CF3, 0x3004) }, |
75 | { USB_DEVICE(0x0CF3, 0x311D) }, | ||
75 | { USB_DEVICE(0x13d3, 0x3375) }, | 76 | { USB_DEVICE(0x13d3, 0x3375) }, |
77 | { USB_DEVICE(0x04CA, 0x3005) }, | ||
76 | 78 | ||
77 | /* Atheros AR5BBU12 with sflash firmware */ | 79 | /* Atheros AR5BBU12 with sflash firmware */ |
78 | { USB_DEVICE(0x0489, 0xE02C) }, | 80 | { USB_DEVICE(0x0489, 0xE02C) }, |
@@ -89,7 +91,9 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
89 | 91 | ||
90 | /* Atheros AR3012 with sflash firmware*/ | 92 | /* Atheros AR3012 with sflash firmware*/ |
91 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 93 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
94 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | ||
92 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 95 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
96 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
93 | 97 | ||
94 | { } /* Terminating entry */ | 98 | { } /* Terminating entry */ |
95 | }; | 99 | }; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 480cad920048..3311b812a0c6 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -61,7 +61,7 @@ static struct usb_device_id btusb_table[] = { | |||
61 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, | 61 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, |
62 | 62 | ||
63 | /* Broadcom SoftSailing reporting vendor specific */ | 63 | /* Broadcom SoftSailing reporting vendor specific */ |
64 | { USB_DEVICE(0x05ac, 0x21e1) }, | 64 | { USB_DEVICE(0x0a5c, 0x21e1) }, |
65 | 65 | ||
66 | /* Apple MacBookPro 7,1 */ | 66 | /* Apple MacBookPro 7,1 */ |
67 | { USB_DEVICE(0x05ac, 0x8213) }, | 67 | { USB_DEVICE(0x05ac, 0x8213) }, |
@@ -103,6 +103,7 @@ static struct usb_device_id btusb_table[] = { | |||
103 | /* Broadcom BCM20702A0 */ | 103 | /* Broadcom BCM20702A0 */ |
104 | { USB_DEVICE(0x0a5c, 0x21e3) }, | 104 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
105 | { USB_DEVICE(0x0a5c, 0x21e6) }, | 105 | { USB_DEVICE(0x0a5c, 0x21e6) }, |
106 | { USB_DEVICE(0x0a5c, 0x21e8) }, | ||
106 | { USB_DEVICE(0x0a5c, 0x21f3) }, | 107 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
107 | { USB_DEVICE(0x413c, 0x8197) }, | 108 | { USB_DEVICE(0x413c, 0x8197) }, |
108 | 109 | ||
@@ -129,7 +130,9 @@ static struct usb_device_id blacklist_table[] = { | |||
129 | 130 | ||
130 | /* Atheros 3012 with sflash firmware */ | 131 | /* Atheros 3012 with sflash firmware */ |
131 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 132 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
133 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | ||
132 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 134 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
133 | 136 | ||
134 | /* Atheros AR5BBU12 with sflash firmware */ | 137 | /* Atheros AR5BBU12 with sflash firmware */ |
135 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 138 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index fd5adb408f44..98a8c05d4f23 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -299,11 +299,11 @@ static void hci_uart_tty_close(struct tty_struct *tty) | |||
299 | hci_uart_close(hdev); | 299 | hci_uart_close(hdev); |
300 | 300 | ||
301 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { | 301 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { |
302 | hu->proto->close(hu); | ||
303 | if (hdev) { | 302 | if (hdev) { |
304 | hci_unregister_dev(hdev); | 303 | hci_unregister_dev(hdev); |
305 | hci_free_dev(hdev); | 304 | hci_free_dev(hdev); |
306 | } | 305 | } |
306 | hu->proto->close(hu); | ||
307 | } | 307 | } |
308 | 308 | ||
309 | kfree(hu); | 309 | kfree(hu); |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 3845ab44c330..dfd7876f127c 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -906,8 +906,8 @@ int hpet_alloc(struct hpet_data *hdp) | |||
906 | hpetp->hp_which, hdp->hd_phys_address, | 906 | hpetp->hp_which, hdp->hd_phys_address, |
907 | hpetp->hp_ntimer > 1 ? "s" : ""); | 907 | hpetp->hp_ntimer > 1 ? "s" : ""); |
908 | for (i = 0; i < hpetp->hp_ntimer; i++) | 908 | for (i = 0; i < hpetp->hp_ntimer; i++) |
909 | printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); | 909 | printk(KERN_CONT "%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); |
910 | printk("\n"); | 910 | printk(KERN_CONT "\n"); |
911 | 911 | ||
912 | temp = hpetp->hp_tick_freq; | 912 | temp = hpetp->hp_tick_freq; |
913 | remainder = do_div(temp, 1000000); | 913 | remainder = do_div(temp, 1000000); |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 54ca8b23cde3..4ec04a754733 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1260,10 +1260,15 @@ static int proc_do_uuid(ctl_table *table, int write, | |||
1260 | uuid = table->data; | 1260 | uuid = table->data; |
1261 | if (!uuid) { | 1261 | if (!uuid) { |
1262 | uuid = tmp_uuid; | 1262 | uuid = tmp_uuid; |
1263 | uuid[8] = 0; | ||
1264 | } | ||
1265 | if (uuid[8] == 0) | ||
1266 | generate_random_uuid(uuid); | 1263 | generate_random_uuid(uuid); |
1264 | } else { | ||
1265 | static DEFINE_SPINLOCK(bootid_spinlock); | ||
1266 | |||
1267 | spin_lock(&bootid_spinlock); | ||
1268 | if (!uuid[8]) | ||
1269 | generate_random_uuid(uuid); | ||
1270 | spin_unlock(&bootid_spinlock); | ||
1271 | } | ||
1267 | 1272 | ||
1268 | sprintf(buf, "%pU", uuid); | 1273 | sprintf(buf, "%pU", uuid); |
1269 | 1274 | ||
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 82e882028fcf..6b5cf02c35c8 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/async.h> | ||
27 | #include <asm/io.h> | 26 | #include <asm/io.h> |
28 | 27 | ||
29 | /* | 28 | /* |
@@ -180,15 +179,17 @@ static int verify_pmtmr_rate(void) | |||
180 | /* Number of reads we try to get two different values */ | 179 | /* Number of reads we try to get two different values */ |
181 | #define ACPI_PM_READ_CHECKS 10000 | 180 | #define ACPI_PM_READ_CHECKS 10000 |
182 | 181 | ||
183 | static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie) | 182 | static int __init init_acpi_pm_clocksource(void) |
184 | { | 183 | { |
185 | cycle_t value1, value2; | 184 | cycle_t value1, value2; |
186 | unsigned int i, j = 0; | 185 | unsigned int i, j = 0; |
187 | 186 | ||
187 | if (!pmtmr_ioport) | ||
188 | return -ENODEV; | ||
188 | 189 | ||
189 | /* "verify" this timing source: */ | 190 | /* "verify" this timing source: */ |
190 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { | 191 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { |
191 | usleep_range(100 * j, 100 * j + 100); | 192 | udelay(100 * j); |
192 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 193 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
193 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { | 194 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { |
194 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 195 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
@@ -202,34 +203,25 @@ static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie | |||
202 | " 0x%#llx, 0x%#llx - aborting.\n", | 203 | " 0x%#llx, 0x%#llx - aborting.\n", |
203 | value1, value2); | 204 | value1, value2); |
204 | pmtmr_ioport = 0; | 205 | pmtmr_ioport = 0; |
205 | return; | 206 | return -EINVAL; |
206 | } | 207 | } |
207 | if (i == ACPI_PM_READ_CHECKS) { | 208 | if (i == ACPI_PM_READ_CHECKS) { |
208 | printk(KERN_INFO "PM-Timer failed consistency check " | 209 | printk(KERN_INFO "PM-Timer failed consistency check " |
209 | " (0x%#llx) - aborting.\n", value1); | 210 | " (0x%#llx) - aborting.\n", value1); |
210 | pmtmr_ioport = 0; | 211 | pmtmr_ioport = 0; |
211 | return; | 212 | return -ENODEV; |
212 | } | 213 | } |
213 | } | 214 | } |
214 | 215 | ||
215 | if (verify_pmtmr_rate() != 0){ | 216 | if (verify_pmtmr_rate() != 0){ |
216 | pmtmr_ioport = 0; | 217 | pmtmr_ioport = 0; |
217 | return; | 218 | return -ENODEV; |
218 | } | 219 | } |
219 | 220 | ||
220 | clocksource_register_hz(&clocksource_acpi_pm, | 221 | return clocksource_register_hz(&clocksource_acpi_pm, |
221 | PMTMR_TICKS_PER_SEC); | 222 | PMTMR_TICKS_PER_SEC); |
222 | } | 223 | } |
223 | 224 | ||
224 | static int __init init_acpi_pm_clocksource(void) | ||
225 | { | ||
226 | if (!pmtmr_ioport) | ||
227 | return -ENODEV; | ||
228 | |||
229 | async_schedule(acpi_pm_clocksource_async, NULL); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | /* We use fs_initcall because we want the PCI fixups to have run | 225 | /* We use fs_initcall because we want the PCI fixups to have run |
234 | * but we still need to load before device_initcall | 226 | * but we still need to load before device_initcall |
235 | */ | 227 | */ |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 767bcc31b365..2397f6f451b1 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -332,6 +332,20 @@ struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) | |||
332 | } | 332 | } |
333 | EXPORT_SYMBOL(dma_find_channel); | 333 | EXPORT_SYMBOL(dma_find_channel); |
334 | 334 | ||
335 | /* | ||
336 | * net_dma_find_channel - find a channel for net_dma | ||
337 | * net_dma has alignment requirements | ||
338 | */ | ||
339 | struct dma_chan *net_dma_find_channel(void) | ||
340 | { | ||
341 | struct dma_chan *chan = dma_find_channel(DMA_MEMCPY); | ||
342 | if (chan && !is_dma_copy_aligned(chan->device, 1, 1, 1)) | ||
343 | return NULL; | ||
344 | |||
345 | return chan; | ||
346 | } | ||
347 | EXPORT_SYMBOL(net_dma_find_channel); | ||
348 | |||
335 | /** | 349 | /** |
336 | * dma_issue_pending_all - flush all pending operations across all channels | 350 | * dma_issue_pending_all - flush all pending operations across all channels |
337 | */ | 351 | */ |
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 31493d80e0e9..73b2b65cb1de 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -546,9 +546,9 @@ void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | |||
546 | PCI_DMA_TODEVICE, flags, 0); | 546 | PCI_DMA_TODEVICE, flags, 0); |
547 | } | 547 | } |
548 | 548 | ||
549 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan) | 549 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan) |
550 | { | 550 | { |
551 | unsigned long phys_complete; | 551 | dma_addr_t phys_complete; |
552 | u64 completion; | 552 | u64 completion; |
553 | 553 | ||
554 | completion = *chan->completion; | 554 | completion = *chan->completion; |
@@ -569,7 +569,7 @@ unsigned long ioat_get_current_completion(struct ioat_chan_common *chan) | |||
569 | } | 569 | } |
570 | 570 | ||
571 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | 571 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, |
572 | unsigned long *phys_complete) | 572 | dma_addr_t *phys_complete) |
573 | { | 573 | { |
574 | *phys_complete = ioat_get_current_completion(chan); | 574 | *phys_complete = ioat_get_current_completion(chan); |
575 | if (*phys_complete == chan->last_completion) | 575 | if (*phys_complete == chan->last_completion) |
@@ -580,14 +580,14 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | |||
580 | return true; | 580 | return true; |
581 | } | 581 | } |
582 | 582 | ||
583 | static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete) | 583 | static void __cleanup(struct ioat_dma_chan *ioat, dma_addr_t phys_complete) |
584 | { | 584 | { |
585 | struct ioat_chan_common *chan = &ioat->base; | 585 | struct ioat_chan_common *chan = &ioat->base; |
586 | struct list_head *_desc, *n; | 586 | struct list_head *_desc, *n; |
587 | struct dma_async_tx_descriptor *tx; | 587 | struct dma_async_tx_descriptor *tx; |
588 | 588 | ||
589 | dev_dbg(to_dev(chan), "%s: phys_complete: %lx\n", | 589 | dev_dbg(to_dev(chan), "%s: phys_complete: %llx\n", |
590 | __func__, phys_complete); | 590 | __func__, (unsigned long long) phys_complete); |
591 | list_for_each_safe(_desc, n, &ioat->used_desc) { | 591 | list_for_each_safe(_desc, n, &ioat->used_desc) { |
592 | struct ioat_desc_sw *desc; | 592 | struct ioat_desc_sw *desc; |
593 | 593 | ||
@@ -652,7 +652,7 @@ static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete) | |||
652 | static void ioat1_cleanup(struct ioat_dma_chan *ioat) | 652 | static void ioat1_cleanup(struct ioat_dma_chan *ioat) |
653 | { | 653 | { |
654 | struct ioat_chan_common *chan = &ioat->base; | 654 | struct ioat_chan_common *chan = &ioat->base; |
655 | unsigned long phys_complete; | 655 | dma_addr_t phys_complete; |
656 | 656 | ||
657 | prefetch(chan->completion); | 657 | prefetch(chan->completion); |
658 | 658 | ||
@@ -698,7 +698,7 @@ static void ioat1_timer_event(unsigned long data) | |||
698 | mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); | 698 | mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); |
699 | spin_unlock_bh(&ioat->desc_lock); | 699 | spin_unlock_bh(&ioat->desc_lock); |
700 | } else if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 700 | } else if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
701 | unsigned long phys_complete; | 701 | dma_addr_t phys_complete; |
702 | 702 | ||
703 | spin_lock_bh(&ioat->desc_lock); | 703 | spin_lock_bh(&ioat->desc_lock); |
704 | /* if we haven't made progress and we have already | 704 | /* if we haven't made progress and we have already |
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index c7888bccd974..5e8fe01ba69d 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -88,7 +88,7 @@ struct ioatdma_device { | |||
88 | struct ioat_chan_common { | 88 | struct ioat_chan_common { |
89 | struct dma_chan common; | 89 | struct dma_chan common; |
90 | void __iomem *reg_base; | 90 | void __iomem *reg_base; |
91 | unsigned long last_completion; | 91 | dma_addr_t last_completion; |
92 | spinlock_t cleanup_lock; | 92 | spinlock_t cleanup_lock; |
93 | unsigned long state; | 93 | unsigned long state; |
94 | #define IOAT_COMPLETION_PENDING 0 | 94 | #define IOAT_COMPLETION_PENDING 0 |
@@ -310,7 +310,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device); | |||
310 | void __devexit ioat_dma_remove(struct ioatdma_device *device); | 310 | void __devexit ioat_dma_remove(struct ioatdma_device *device); |
311 | struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, | 311 | struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, |
312 | void __iomem *iobase); | 312 | void __iomem *iobase); |
313 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan); | 313 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan); |
314 | void ioat_init_channel(struct ioatdma_device *device, | 314 | void ioat_init_channel(struct ioatdma_device *device, |
315 | struct ioat_chan_common *chan, int idx); | 315 | struct ioat_chan_common *chan, int idx); |
316 | enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, | 316 | enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, |
@@ -318,7 +318,7 @@ enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, | |||
318 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | 318 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, |
319 | size_t len, struct ioat_dma_descriptor *hw); | 319 | size_t len, struct ioat_dma_descriptor *hw); |
320 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | 320 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, |
321 | unsigned long *phys_complete); | 321 | dma_addr_t *phys_complete); |
322 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 322 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
323 | void ioat_kobject_del(struct ioatdma_device *device); | 323 | void ioat_kobject_del(struct ioatdma_device *device); |
324 | extern const struct sysfs_ops ioat_sysfs_ops; | 324 | extern const struct sysfs_ops ioat_sysfs_ops; |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index e8e110ff3d96..86895760b598 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -128,7 +128,7 @@ static void ioat2_start_null_desc(struct ioat2_dma_chan *ioat) | |||
128 | spin_unlock_bh(&ioat->prep_lock); | 128 | spin_unlock_bh(&ioat->prep_lock); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | 131 | static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete) |
132 | { | 132 | { |
133 | struct ioat_chan_common *chan = &ioat->base; | 133 | struct ioat_chan_common *chan = &ioat->base; |
134 | struct dma_async_tx_descriptor *tx; | 134 | struct dma_async_tx_descriptor *tx; |
@@ -179,7 +179,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | |||
179 | static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | 179 | static void ioat2_cleanup(struct ioat2_dma_chan *ioat) |
180 | { | 180 | { |
181 | struct ioat_chan_common *chan = &ioat->base; | 181 | struct ioat_chan_common *chan = &ioat->base; |
182 | unsigned long phys_complete; | 182 | dma_addr_t phys_complete; |
183 | 183 | ||
184 | spin_lock_bh(&chan->cleanup_lock); | 184 | spin_lock_bh(&chan->cleanup_lock); |
185 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 185 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -260,7 +260,7 @@ int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo) | |||
260 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) | 260 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) |
261 | { | 261 | { |
262 | struct ioat_chan_common *chan = &ioat->base; | 262 | struct ioat_chan_common *chan = &ioat->base; |
263 | unsigned long phys_complete; | 263 | dma_addr_t phys_complete; |
264 | 264 | ||
265 | ioat2_quiesce(chan, 0); | 265 | ioat2_quiesce(chan, 0); |
266 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 266 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -275,7 +275,7 @@ void ioat2_timer_event(unsigned long data) | |||
275 | struct ioat_chan_common *chan = &ioat->base; | 275 | struct ioat_chan_common *chan = &ioat->base; |
276 | 276 | ||
277 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 277 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
278 | unsigned long phys_complete; | 278 | dma_addr_t phys_complete; |
279 | u64 status; | 279 | u64 status; |
280 | 280 | ||
281 | status = ioat_chansts(chan); | 281 | status = ioat_chansts(chan); |
@@ -572,9 +572,9 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order) | |||
572 | */ | 572 | */ |
573 | struct ioat_chan_common *chan = &ioat->base; | 573 | struct ioat_chan_common *chan = &ioat->base; |
574 | struct dma_chan *c = &chan->common; | 574 | struct dma_chan *c = &chan->common; |
575 | const u16 curr_size = ioat2_ring_size(ioat); | 575 | const u32 curr_size = ioat2_ring_size(ioat); |
576 | const u16 active = ioat2_ring_active(ioat); | 576 | const u16 active = ioat2_ring_active(ioat); |
577 | const u16 new_size = 1 << order; | 577 | const u32 new_size = 1 << order; |
578 | struct ioat_ring_ent **ring; | 578 | struct ioat_ring_ent **ring; |
579 | u16 i; | 579 | u16 i; |
580 | 580 | ||
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h index a2c413b2b8d8..be2a55b95c23 100644 --- a/drivers/dma/ioat/dma_v2.h +++ b/drivers/dma/ioat/dma_v2.h | |||
@@ -74,7 +74,7 @@ static inline struct ioat2_dma_chan *to_ioat2_chan(struct dma_chan *c) | |||
74 | return container_of(chan, struct ioat2_dma_chan, base); | 74 | return container_of(chan, struct ioat2_dma_chan, base); |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline u16 ioat2_ring_size(struct ioat2_dma_chan *ioat) | 77 | static inline u32 ioat2_ring_size(struct ioat2_dma_chan *ioat) |
78 | { | 78 | { |
79 | return 1 << ioat->alloc_order; | 79 | return 1 << ioat->alloc_order; |
80 | } | 80 | } |
@@ -91,7 +91,7 @@ static inline u16 ioat2_ring_pending(struct ioat2_dma_chan *ioat) | |||
91 | return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat)); | 91 | return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat)); |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline u16 ioat2_ring_space(struct ioat2_dma_chan *ioat) | 94 | static inline u32 ioat2_ring_space(struct ioat2_dma_chan *ioat) |
95 | { | 95 | { |
96 | return ioat2_ring_size(ioat) - ioat2_ring_active(ioat); | 96 | return ioat2_ring_size(ioat) - ioat2_ring_active(ioat); |
97 | } | 97 | } |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 2c4476c0e405..f7f1dc62c15c 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -257,7 +257,7 @@ static bool desc_has_ext(struct ioat_ring_ent *desc) | |||
257 | * The difference from the dma_v2.c __cleanup() is that this routine | 257 | * The difference from the dma_v2.c __cleanup() is that this routine |
258 | * handles extended descriptors and dma-unmapping raid operations. | 258 | * handles extended descriptors and dma-unmapping raid operations. |
259 | */ | 259 | */ |
260 | static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | 260 | static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete) |
261 | { | 261 | { |
262 | struct ioat_chan_common *chan = &ioat->base; | 262 | struct ioat_chan_common *chan = &ioat->base; |
263 | struct ioat_ring_ent *desc; | 263 | struct ioat_ring_ent *desc; |
@@ -314,7 +314,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | |||
314 | static void ioat3_cleanup(struct ioat2_dma_chan *ioat) | 314 | static void ioat3_cleanup(struct ioat2_dma_chan *ioat) |
315 | { | 315 | { |
316 | struct ioat_chan_common *chan = &ioat->base; | 316 | struct ioat_chan_common *chan = &ioat->base; |
317 | unsigned long phys_complete; | 317 | dma_addr_t phys_complete; |
318 | 318 | ||
319 | spin_lock_bh(&chan->cleanup_lock); | 319 | spin_lock_bh(&chan->cleanup_lock); |
320 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 320 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -333,7 +333,7 @@ static void ioat3_cleanup_event(unsigned long data) | |||
333 | static void ioat3_restart_channel(struct ioat2_dma_chan *ioat) | 333 | static void ioat3_restart_channel(struct ioat2_dma_chan *ioat) |
334 | { | 334 | { |
335 | struct ioat_chan_common *chan = &ioat->base; | 335 | struct ioat_chan_common *chan = &ioat->base; |
336 | unsigned long phys_complete; | 336 | dma_addr_t phys_complete; |
337 | 337 | ||
338 | ioat2_quiesce(chan, 0); | 338 | ioat2_quiesce(chan, 0); |
339 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 339 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -348,7 +348,7 @@ static void ioat3_timer_event(unsigned long data) | |||
348 | struct ioat_chan_common *chan = &ioat->base; | 348 | struct ioat_chan_common *chan = &ioat->base; |
349 | 349 | ||
350 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 350 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
351 | unsigned long phys_complete; | 351 | dma_addr_t phys_complete; |
352 | u64 status; | 352 | u64 status; |
353 | 353 | ||
354 | status = ioat_chansts(chan); | 354 | status = ioat_chansts(chan); |
@@ -1149,6 +1149,44 @@ static int ioat3_reset_hw(struct ioat_chan_common *chan) | |||
1149 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); | 1149 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | static bool is_jf_ioat(struct pci_dev *pdev) | ||
1153 | { | ||
1154 | switch (pdev->device) { | ||
1155 | case PCI_DEVICE_ID_INTEL_IOAT_JSF0: | ||
1156 | case PCI_DEVICE_ID_INTEL_IOAT_JSF1: | ||
1157 | case PCI_DEVICE_ID_INTEL_IOAT_JSF2: | ||
1158 | case PCI_DEVICE_ID_INTEL_IOAT_JSF3: | ||
1159 | case PCI_DEVICE_ID_INTEL_IOAT_JSF4: | ||
1160 | case PCI_DEVICE_ID_INTEL_IOAT_JSF5: | ||
1161 | case PCI_DEVICE_ID_INTEL_IOAT_JSF6: | ||
1162 | case PCI_DEVICE_ID_INTEL_IOAT_JSF7: | ||
1163 | case PCI_DEVICE_ID_INTEL_IOAT_JSF8: | ||
1164 | case PCI_DEVICE_ID_INTEL_IOAT_JSF9: | ||
1165 | return true; | ||
1166 | default: | ||
1167 | return false; | ||
1168 | } | ||
1169 | } | ||
1170 | |||
1171 | static bool is_snb_ioat(struct pci_dev *pdev) | ||
1172 | { | ||
1173 | switch (pdev->device) { | ||
1174 | case PCI_DEVICE_ID_INTEL_IOAT_SNB0: | ||
1175 | case PCI_DEVICE_ID_INTEL_IOAT_SNB1: | ||
1176 | case PCI_DEVICE_ID_INTEL_IOAT_SNB2: | ||
1177 | case PCI_DEVICE_ID_INTEL_IOAT_SNB3: | ||
1178 | case PCI_DEVICE_ID_INTEL_IOAT_SNB4: | ||
1179 | case PCI_DEVICE_ID_INTEL_IOAT_SNB5: | ||
1180 | case PCI_DEVICE_ID_INTEL_IOAT_SNB6: | ||
1181 | case PCI_DEVICE_ID_INTEL_IOAT_SNB7: | ||
1182 | case PCI_DEVICE_ID_INTEL_IOAT_SNB8: | ||
1183 | case PCI_DEVICE_ID_INTEL_IOAT_SNB9: | ||
1184 | return true; | ||
1185 | default: | ||
1186 | return false; | ||
1187 | } | ||
1188 | } | ||
1189 | |||
1152 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | 1190 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) |
1153 | { | 1191 | { |
1154 | struct pci_dev *pdev = device->pdev; | 1192 | struct pci_dev *pdev = device->pdev; |
@@ -1169,6 +1207,9 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1169 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; | 1207 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; |
1170 | dma->device_free_chan_resources = ioat2_free_chan_resources; | 1208 | dma->device_free_chan_resources = ioat2_free_chan_resources; |
1171 | 1209 | ||
1210 | if (is_jf_ioat(pdev) || is_snb_ioat(pdev)) | ||
1211 | dma->copy_align = 6; | ||
1212 | |||
1172 | dma_cap_set(DMA_INTERRUPT, dma->cap_mask); | 1213 | dma_cap_set(DMA_INTERRUPT, dma->cap_mask); |
1173 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; | 1214 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; |
1174 | 1215 | ||
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index da6c4c2c066a..79e3eba29702 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -1252,8 +1252,8 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device) | |||
1252 | struct page **pq_hw = &pq[IOP_ADMA_NUM_SRC_TEST+2]; | 1252 | struct page **pq_hw = &pq[IOP_ADMA_NUM_SRC_TEST+2]; |
1253 | /* address conversion buffers (dma_map / page_address) */ | 1253 | /* address conversion buffers (dma_map / page_address) */ |
1254 | void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2]; | 1254 | void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2]; |
1255 | dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST]; | 1255 | dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST+2]; |
1256 | dma_addr_t pq_dest[2]; | 1256 | dma_addr_t *pq_dest = &pq_src[IOP_ADMA_NUM_SRC_TEST]; |
1257 | 1257 | ||
1258 | int i; | 1258 | int i; |
1259 | struct dma_async_tx_descriptor *tx; | 1259 | struct dma_async_tx_descriptor *tx; |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index edadbdad31d0..e03653d69357 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -430,7 +430,7 @@ config GPIO_ML_IOH | |||
430 | 430 | ||
431 | config GPIO_SODAVILLE | 431 | config GPIO_SODAVILLE |
432 | bool "Intel Sodaville GPIO support" | 432 | bool "Intel Sodaville GPIO support" |
433 | depends on X86 && PCI && OF && BROKEN | 433 | depends on X86 && PCI && OF |
434 | select GPIO_GENERIC | 434 | select GPIO_GENERIC |
435 | select GENERIC_IRQ_CHIP | 435 | select GENERIC_IRQ_CHIP |
436 | help | 436 | help |
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 9ad1703d1408..ae5d7f12ce66 100644 --- a/drivers/gpio/gpio-adp5588.c +++ b/drivers/gpio/gpio-adp5588.c | |||
@@ -252,7 +252,7 @@ static irqreturn_t adp5588_irq_handler(int irq, void *devid) | |||
252 | if (ret < 0) | 252 | if (ret < 0) |
253 | memset(dev->irq_stat, 0, ARRAY_SIZE(dev->irq_stat)); | 253 | memset(dev->irq_stat, 0, ARRAY_SIZE(dev->irq_stat)); |
254 | 254 | ||
255 | for (bank = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO); | 255 | for (bank = 0, bit = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO); |
256 | bank++, bit = 0) { | 256 | bank++, bit = 0) { |
257 | pending = dev->irq_stat[bank] & dev->irq_mask[bank]; | 257 | pending = dev->irq_stat[bank] & dev->irq_mask[bank]; |
258 | 258 | ||
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 46277877b7ec..19d6fc0229c3 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2382,8 +2382,8 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
2382 | #endif | 2382 | #endif |
2383 | }; | 2383 | }; |
2384 | 2384 | ||
2385 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | ||
2386 | #ifdef CONFIG_ARCH_EXYNOS5 | 2385 | #ifdef CONFIG_ARCH_EXYNOS5 |
2386 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | ||
2387 | { | 2387 | { |
2388 | .chip = { | 2388 | .chip = { |
2389 | .base = EXYNOS5_GPA0(0), | 2389 | .base = EXYNOS5_GPA0(0), |
@@ -2541,11 +2541,11 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = { | |||
2541 | .to_irq = samsung_gpiolib_to_irq, | 2541 | .to_irq = samsung_gpiolib_to_irq, |
2542 | }, | 2542 | }, |
2543 | }, | 2543 | }, |
2544 | #endif | ||
2545 | }; | 2544 | }; |
2545 | #endif | ||
2546 | 2546 | ||
2547 | static struct samsung_gpio_chip exynos5_gpios_2[] = { | ||
2548 | #ifdef CONFIG_ARCH_EXYNOS5 | 2547 | #ifdef CONFIG_ARCH_EXYNOS5 |
2548 | static struct samsung_gpio_chip exynos5_gpios_2[] = { | ||
2549 | { | 2549 | { |
2550 | .chip = { | 2550 | .chip = { |
2551 | .base = EXYNOS5_GPE0(0), | 2551 | .base = EXYNOS5_GPE0(0), |
@@ -2602,11 +2602,11 @@ static struct samsung_gpio_chip exynos5_gpios_2[] = { | |||
2602 | 2602 | ||
2603 | }, | 2603 | }, |
2604 | }, | 2604 | }, |
2605 | #endif | ||
2606 | }; | 2605 | }; |
2606 | #endif | ||
2607 | 2607 | ||
2608 | static struct samsung_gpio_chip exynos5_gpios_3[] = { | ||
2609 | #ifdef CONFIG_ARCH_EXYNOS5 | 2608 | #ifdef CONFIG_ARCH_EXYNOS5 |
2609 | static struct samsung_gpio_chip exynos5_gpios_3[] = { | ||
2610 | { | 2610 | { |
2611 | .chip = { | 2611 | .chip = { |
2612 | .base = EXYNOS5_GPV0(0), | 2612 | .base = EXYNOS5_GPV0(0), |
@@ -2638,11 +2638,11 @@ static struct samsung_gpio_chip exynos5_gpios_3[] = { | |||
2638 | .label = "GPV4", | 2638 | .label = "GPV4", |
2639 | }, | 2639 | }, |
2640 | }, | 2640 | }, |
2641 | #endif | ||
2642 | }; | 2641 | }; |
2642 | #endif | ||
2643 | 2643 | ||
2644 | static struct samsung_gpio_chip exynos5_gpios_4[] = { | ||
2645 | #ifdef CONFIG_ARCH_EXYNOS5 | 2644 | #ifdef CONFIG_ARCH_EXYNOS5 |
2645 | static struct samsung_gpio_chip exynos5_gpios_4[] = { | ||
2646 | { | 2646 | { |
2647 | .chip = { | 2647 | .chip = { |
2648 | .base = EXYNOS5_GPZ(0), | 2648 | .base = EXYNOS5_GPZ(0), |
@@ -2650,8 +2650,8 @@ static struct samsung_gpio_chip exynos5_gpios_4[] = { | |||
2650 | .label = "GPZ", | 2650 | .label = "GPZ", |
2651 | }, | 2651 | }, |
2652 | }, | 2652 | }, |
2653 | #endif | ||
2654 | }; | 2653 | }; |
2654 | #endif | ||
2655 | 2655 | ||
2656 | 2656 | ||
2657 | #if defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) | 2657 | #if defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) |
diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c index 9ba15d31d242..031e5d24837d 100644 --- a/drivers/gpio/gpio-sodaville.c +++ b/drivers/gpio/gpio-sodaville.c | |||
@@ -41,7 +41,7 @@ | |||
41 | struct sdv_gpio_chip_data { | 41 | struct sdv_gpio_chip_data { |
42 | int irq_base; | 42 | int irq_base; |
43 | void __iomem *gpio_pub_base; | 43 | void __iomem *gpio_pub_base; |
44 | struct irq_domain id; | 44 | struct irq_domain *id; |
45 | struct irq_chip_generic *gc; | 45 | struct irq_chip_generic *gc; |
46 | struct bgpio_chip bgpio; | 46 | struct bgpio_chip bgpio; |
47 | }; | 47 | }; |
@@ -51,10 +51,9 @@ static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) | |||
51 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 51 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
52 | struct sdv_gpio_chip_data *sd = gc->private; | 52 | struct sdv_gpio_chip_data *sd = gc->private; |
53 | void __iomem *type_reg; | 53 | void __iomem *type_reg; |
54 | u32 irq_offs = d->irq - sd->irq_base; | ||
55 | u32 reg; | 54 | u32 reg; |
56 | 55 | ||
57 | if (irq_offs < 8) | 56 | if (d->hwirq < 8) |
58 | type_reg = sd->gpio_pub_base + GPIT1R0; | 57 | type_reg = sd->gpio_pub_base + GPIT1R0; |
59 | else | 58 | else |
60 | type_reg = sd->gpio_pub_base + GPIT1R1; | 59 | type_reg = sd->gpio_pub_base + GPIT1R1; |
@@ -63,11 +62,11 @@ static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) | |||
63 | 62 | ||
64 | switch (type) { | 63 | switch (type) { |
65 | case IRQ_TYPE_LEVEL_HIGH: | 64 | case IRQ_TYPE_LEVEL_HIGH: |
66 | reg &= ~BIT(4 * (irq_offs % 8)); | 65 | reg &= ~BIT(4 * (d->hwirq % 8)); |
67 | break; | 66 | break; |
68 | 67 | ||
69 | case IRQ_TYPE_LEVEL_LOW: | 68 | case IRQ_TYPE_LEVEL_LOW: |
70 | reg |= BIT(4 * (irq_offs % 8)); | 69 | reg |= BIT(4 * (d->hwirq % 8)); |
71 | break; | 70 | break; |
72 | 71 | ||
73 | default: | 72 | default: |
@@ -91,7 +90,7 @@ static irqreturn_t sdv_gpio_pub_irq_handler(int irq, void *data) | |||
91 | u32 irq_bit = __fls(irq_stat); | 90 | u32 irq_bit = __fls(irq_stat); |
92 | 91 | ||
93 | irq_stat &= ~BIT(irq_bit); | 92 | irq_stat &= ~BIT(irq_bit); |
94 | generic_handle_irq(sd->irq_base + irq_bit); | 93 | generic_handle_irq(irq_find_mapping(sd->id, irq_bit)); |
95 | } | 94 | } |
96 | 95 | ||
97 | return IRQ_HANDLED; | 96 | return IRQ_HANDLED; |
@@ -127,7 +126,7 @@ static int sdv_xlate(struct irq_domain *h, struct device_node *node, | |||
127 | } | 126 | } |
128 | 127 | ||
129 | static struct irq_domain_ops irq_domain_sdv_ops = { | 128 | static struct irq_domain_ops irq_domain_sdv_ops = { |
130 | .dt_translate = sdv_xlate, | 129 | .xlate = sdv_xlate, |
131 | }; | 130 | }; |
132 | 131 | ||
133 | static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | 132 | static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, |
@@ -149,10 +148,6 @@ static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | |||
149 | if (ret) | 148 | if (ret) |
150 | goto out_free_desc; | 149 | goto out_free_desc; |
151 | 150 | ||
152 | sd->id.irq_base = sd->irq_base; | ||
153 | sd->id.of_node = of_node_get(pdev->dev.of_node); | ||
154 | sd->id.ops = &irq_domain_sdv_ops; | ||
155 | |||
156 | /* | 151 | /* |
157 | * This gpio irq controller latches level irqs. Testing shows that if | 152 | * This gpio irq controller latches level irqs. Testing shows that if |
158 | * we unmask & ACK the IRQ before the source of the interrupt is gone | 153 | * we unmask & ACK the IRQ before the source of the interrupt is gone |
@@ -179,7 +174,10 @@ static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | |||
179 | IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, | 174 | IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, |
180 | IRQ_LEVEL | IRQ_NOPROBE); | 175 | IRQ_LEVEL | IRQ_NOPROBE); |
181 | 176 | ||
182 | irq_domain_add(&sd->id); | 177 | sd->id = irq_domain_add_legacy(pdev->dev.of_node, SDV_NUM_PUB_GPIOS, |
178 | sd->irq_base, 0, &irq_domain_sdv_ops, sd); | ||
179 | if (!sd->id) | ||
180 | goto out_free_irq; | ||
183 | return 0; | 181 | return 0; |
184 | out_free_irq: | 182 | out_free_irq: |
185 | free_irq(pdev->irq, sd); | 183 | free_irq(pdev->irq, sd); |
@@ -260,7 +258,6 @@ static void sdv_gpio_remove(struct pci_dev *pdev) | |||
260 | { | 258 | { |
261 | struct sdv_gpio_chip_data *sd = pci_get_drvdata(pdev); | 259 | struct sdv_gpio_chip_data *sd = pci_get_drvdata(pdev); |
262 | 260 | ||
263 | irq_domain_del(&sd->id); | ||
264 | free_irq(pdev->irq, sd); | 261 | free_irq(pdev->irq, sd); |
265 | irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); | 262 | irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); |
266 | 263 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 4a3a5f72ed4a..de8d2090bce3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c | |||
@@ -34,14 +34,14 @@ | |||
34 | static int lowlevel_buffer_allocate(struct drm_device *dev, | 34 | static int lowlevel_buffer_allocate(struct drm_device *dev, |
35 | unsigned int flags, struct exynos_drm_gem_buf *buf) | 35 | unsigned int flags, struct exynos_drm_gem_buf *buf) |
36 | { | 36 | { |
37 | dma_addr_t start_addr, end_addr; | 37 | dma_addr_t start_addr; |
38 | unsigned int npages, page_size, i = 0; | 38 | unsigned int npages, page_size, i = 0; |
39 | struct scatterlist *sgl; | 39 | struct scatterlist *sgl; |
40 | int ret = 0; | 40 | int ret = 0; |
41 | 41 | ||
42 | DRM_DEBUG_KMS("%s\n", __FILE__); | 42 | DRM_DEBUG_KMS("%s\n", __FILE__); |
43 | 43 | ||
44 | if (flags & EXYNOS_BO_NONCONTIG) { | 44 | if (IS_NONCONTIG_BUFFER(flags)) { |
45 | DRM_DEBUG_KMS("not support allocation type.\n"); | 45 | DRM_DEBUG_KMS("not support allocation type.\n"); |
46 | return -EINVAL; | 46 | return -EINVAL; |
47 | } | 47 | } |
@@ -52,13 +52,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
52 | } | 52 | } |
53 | 53 | ||
54 | if (buf->size >= SZ_1M) { | 54 | if (buf->size >= SZ_1M) { |
55 | npages = (buf->size >> SECTION_SHIFT) + 1; | 55 | npages = buf->size >> SECTION_SHIFT; |
56 | page_size = SECTION_SIZE; | 56 | page_size = SECTION_SIZE; |
57 | } else if (buf->size >= SZ_64K) { | 57 | } else if (buf->size >= SZ_64K) { |
58 | npages = (buf->size >> 16) + 1; | 58 | npages = buf->size >> 16; |
59 | page_size = SZ_64K; | 59 | page_size = SZ_64K; |
60 | } else { | 60 | } else { |
61 | npages = (buf->size >> PAGE_SHIFT) + 1; | 61 | npages = buf->size >> PAGE_SHIFT; |
62 | page_size = PAGE_SIZE; | 62 | page_size = PAGE_SIZE; |
63 | } | 63 | } |
64 | 64 | ||
@@ -76,26 +76,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
76 | return -ENOMEM; | 76 | return -ENOMEM; |
77 | } | 77 | } |
78 | 78 | ||
79 | buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, | 79 | buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, |
80 | &buf->dma_addr, GFP_KERNEL); | 80 | &buf->dma_addr, GFP_KERNEL); |
81 | if (!buf->kvaddr) { | 81 | if (!buf->kvaddr) { |
82 | DRM_ERROR("failed to allocate buffer.\n"); | 82 | DRM_ERROR("failed to allocate buffer.\n"); |
83 | ret = -ENOMEM; | 83 | ret = -ENOMEM; |
84 | goto err1; | 84 | goto err1; |
85 | } | 85 | } |
86 | |||
87 | start_addr = buf->dma_addr; | ||
88 | end_addr = buf->dma_addr + buf->size; | ||
89 | |||
90 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); | ||
91 | if (!buf->pages) { | ||
92 | DRM_ERROR("failed to allocate pages.\n"); | ||
93 | ret = -ENOMEM; | ||
94 | goto err2; | ||
95 | } | ||
96 | |||
97 | start_addr = buf->dma_addr; | ||
98 | end_addr = buf->dma_addr + buf->size; | ||
99 | 86 | ||
100 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); | 87 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); |
101 | if (!buf->pages) { | 88 | if (!buf->pages) { |
@@ -105,23 +92,17 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
105 | } | 92 | } |
106 | 93 | ||
107 | sgl = buf->sgt->sgl; | 94 | sgl = buf->sgt->sgl; |
95 | start_addr = buf->dma_addr; | ||
108 | 96 | ||
109 | while (i < npages) { | 97 | while (i < npages) { |
110 | buf->pages[i] = phys_to_page(start_addr); | 98 | buf->pages[i] = phys_to_page(start_addr); |
111 | sg_set_page(sgl, buf->pages[i], page_size, 0); | 99 | sg_set_page(sgl, buf->pages[i], page_size, 0); |
112 | sg_dma_address(sgl) = start_addr; | 100 | sg_dma_address(sgl) = start_addr; |
113 | start_addr += page_size; | 101 | start_addr += page_size; |
114 | if (end_addr - start_addr < page_size) | ||
115 | break; | ||
116 | sgl = sg_next(sgl); | 102 | sgl = sg_next(sgl); |
117 | i++; | 103 | i++; |
118 | } | 104 | } |
119 | 105 | ||
120 | buf->pages[i] = phys_to_page(start_addr); | ||
121 | |||
122 | sgl = sg_next(sgl); | ||
123 | sg_set_page(sgl, buf->pages[i+1], end_addr - start_addr, 0); | ||
124 | |||
125 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", | 106 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", |
126 | (unsigned long)buf->kvaddr, | 107 | (unsigned long)buf->kvaddr, |
127 | (unsigned long)buf->dma_addr, | 108 | (unsigned long)buf->dma_addr, |
@@ -150,7 +131,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, | |||
150 | * non-continuous memory would be released by exynos | 131 | * non-continuous memory would be released by exynos |
151 | * gem framework. | 132 | * gem framework. |
152 | */ | 133 | */ |
153 | if (flags & EXYNOS_BO_NONCONTIG) { | 134 | if (IS_NONCONTIG_BUFFER(flags)) { |
154 | DRM_DEBUG_KMS("not support allocation type.\n"); | 135 | DRM_DEBUG_KMS("not support allocation type.\n"); |
155 | return; | 136 | return; |
156 | } | 137 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 411832e8e17a..eaf630dc5dba 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c | |||
@@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, | |||
54 | * | 54 | * |
55 | * P.S. note that this driver is considered for modularization. | 55 | * P.S. note that this driver is considered for modularization. |
56 | */ | 56 | */ |
57 | ret = subdrv->probe(dev, subdrv->manager.dev); | 57 | ret = subdrv->probe(dev, subdrv->dev); |
58 | if (ret) | 58 | if (ret) |
59 | return ret; | 59 | return ret; |
60 | } | 60 | } |
61 | 61 | ||
62 | if (subdrv->is_local) | 62 | if (!subdrv->manager) |
63 | return 0; | 63 | return 0; |
64 | 64 | ||
65 | subdrv->manager->dev = subdrv->dev; | ||
66 | |||
65 | /* create and initialize a encoder for this sub driver. */ | 67 | /* create and initialize a encoder for this sub driver. */ |
66 | encoder = exynos_drm_encoder_create(dev, &subdrv->manager, | 68 | encoder = exynos_drm_encoder_create(dev, subdrv->manager, |
67 | (1 << MAX_CRTC) - 1); | 69 | (1 << MAX_CRTC) - 1); |
68 | if (!encoder) { | 70 | if (!encoder) { |
69 | DRM_ERROR("failed to create encoder\n"); | 71 | DRM_ERROR("failed to create encoder\n"); |
@@ -186,7 +188,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
186 | 188 | ||
187 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 189 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
188 | if (subdrv->open) { | 190 | if (subdrv->open) { |
189 | ret = subdrv->open(dev, subdrv->manager.dev, file); | 191 | ret = subdrv->open(dev, subdrv->dev, file); |
190 | if (ret) | 192 | if (ret) |
191 | goto err; | 193 | goto err; |
192 | } | 194 | } |
@@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
197 | err: | 199 | err: |
198 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { | 200 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { |
199 | if (subdrv->close) | 201 | if (subdrv->close) |
200 | subdrv->close(dev, subdrv->manager.dev, file); | 202 | subdrv->close(dev, subdrv->dev, file); |
201 | } | 203 | } |
202 | return ret; | 204 | return ret; |
203 | } | 205 | } |
@@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) | |||
209 | 211 | ||
210 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 212 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
211 | if (subdrv->close) | 213 | if (subdrv->close) |
212 | subdrv->close(dev, subdrv->manager.dev, file); | 214 | subdrv->close(dev, subdrv->dev, file); |
213 | } | 215 | } |
214 | } | 216 | } |
215 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); | 217 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index fbd0a232c93d..1d814175cd49 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -225,24 +225,25 @@ struct exynos_drm_private { | |||
225 | * Exynos drm sub driver structure. | 225 | * Exynos drm sub driver structure. |
226 | * | 226 | * |
227 | * @list: sub driver has its own list object to register to exynos drm driver. | 227 | * @list: sub driver has its own list object to register to exynos drm driver. |
228 | * @dev: pointer to device object for subdrv device driver. | ||
228 | * @drm_dev: pointer to drm_device and this pointer would be set | 229 | * @drm_dev: pointer to drm_device and this pointer would be set |
229 | * when sub driver calls exynos_drm_subdrv_register(). | 230 | * when sub driver calls exynos_drm_subdrv_register(). |
230 | * @is_local: appear encoder and connector disrelated device. | 231 | * @manager: subdrv has its own manager to control a hardware appropriately |
232 | * and we can access a hardware drawing on this manager. | ||
231 | * @probe: this callback would be called by exynos drm driver after | 233 | * @probe: this callback would be called by exynos drm driver after |
232 | * subdrv is registered to it. | 234 | * subdrv is registered to it. |
233 | * @remove: this callback is used to release resources created | 235 | * @remove: this callback is used to release resources created |
234 | * by probe callback. | 236 | * by probe callback. |
235 | * @open: this would be called with drm device file open. | 237 | * @open: this would be called with drm device file open. |
236 | * @close: this would be called with drm device file close. | 238 | * @close: this would be called with drm device file close. |
237 | * @manager: subdrv has its own manager to control a hardware appropriately | ||
238 | * and we can access a hardware drawing on this manager. | ||
239 | * @encoder: encoder object owned by this sub driver. | 239 | * @encoder: encoder object owned by this sub driver. |
240 | * @connector: connector object owned by this sub driver. | 240 | * @connector: connector object owned by this sub driver. |
241 | */ | 241 | */ |
242 | struct exynos_drm_subdrv { | 242 | struct exynos_drm_subdrv { |
243 | struct list_head list; | 243 | struct list_head list; |
244 | struct device *dev; | ||
244 | struct drm_device *drm_dev; | 245 | struct drm_device *drm_dev; |
245 | bool is_local; | 246 | struct exynos_drm_manager *manager; |
246 | 247 | ||
247 | int (*probe)(struct drm_device *drm_dev, struct device *dev); | 248 | int (*probe)(struct drm_device *drm_dev, struct device *dev); |
248 | void (*remove)(struct drm_device *dev); | 249 | void (*remove)(struct drm_device *dev); |
@@ -251,7 +252,6 @@ struct exynos_drm_subdrv { | |||
251 | void (*close)(struct drm_device *drm_dev, struct device *dev, | 252 | void (*close)(struct drm_device *drm_dev, struct device *dev, |
252 | struct drm_file *file); | 253 | struct drm_file *file); |
253 | 254 | ||
254 | struct exynos_drm_manager manager; | ||
255 | struct drm_encoder *encoder; | 255 | struct drm_encoder *encoder; |
256 | struct drm_connector *connector; | 256 | struct drm_connector *connector; |
257 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index ecb6db229700..29fdbfeb43cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) | |||
172 | static void fimd_apply(struct device *subdrv_dev) | 172 | static void fimd_apply(struct device *subdrv_dev) |
173 | { | 173 | { |
174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); | 174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); |
175 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 175 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
178 | struct fimd_win_data *win_data; | 178 | struct fimd_win_data *win_data; |
@@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = { | |||
577 | .disable = fimd_win_disable, | 577 | .disable = fimd_win_disable, |
578 | }; | 578 | }; |
579 | 579 | ||
580 | static struct exynos_drm_manager fimd_manager = { | ||
581 | .pipe = -1, | ||
582 | .ops = &fimd_manager_ops, | ||
583 | .overlay_ops = &fimd_overlay_ops, | ||
584 | .display_ops = &fimd_display_ops, | ||
585 | }; | ||
586 | |||
580 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) | 587 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) |
581 | { | 588 | { |
582 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 589 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -628,7 +635,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | |||
628 | struct fimd_context *ctx = (struct fimd_context *)dev_id; | 635 | struct fimd_context *ctx = (struct fimd_context *)dev_id; |
629 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 636 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
630 | struct drm_device *drm_dev = subdrv->drm_dev; | 637 | struct drm_device *drm_dev = subdrv->drm_dev; |
631 | struct exynos_drm_manager *manager = &subdrv->manager; | 638 | struct exynos_drm_manager *manager = subdrv->manager; |
632 | u32 val; | 639 | u32 val; |
633 | 640 | ||
634 | val = readl(ctx->regs + VIDINTCON1); | 641 | val = readl(ctx->regs + VIDINTCON1); |
@@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) | |||
744 | static int fimd_power_on(struct fimd_context *ctx, bool enable) | 751 | static int fimd_power_on(struct fimd_context *ctx, bool enable) |
745 | { | 752 | { |
746 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 753 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
747 | struct device *dev = subdrv->manager.dev; | 754 | struct device *dev = subdrv->dev; |
748 | 755 | ||
749 | DRM_DEBUG_KMS("%s\n", __FILE__); | 756 | DRM_DEBUG_KMS("%s\n", __FILE__); |
750 | 757 | ||
@@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
867 | 874 | ||
868 | subdrv = &ctx->subdrv; | 875 | subdrv = &ctx->subdrv; |
869 | 876 | ||
877 | subdrv->dev = dev; | ||
878 | subdrv->manager = &fimd_manager; | ||
870 | subdrv->probe = fimd_subdrv_probe; | 879 | subdrv->probe = fimd_subdrv_probe; |
871 | subdrv->remove = fimd_subdrv_remove; | 880 | subdrv->remove = fimd_subdrv_remove; |
872 | subdrv->manager.pipe = -1; | ||
873 | subdrv->manager.ops = &fimd_manager_ops; | ||
874 | subdrv->manager.overlay_ops = &fimd_overlay_ops; | ||
875 | subdrv->manager.display_ops = &fimd_display_ops; | ||
876 | subdrv->manager.dev = dev; | ||
877 | 881 | ||
878 | mutex_init(&ctx->lock); | 882 | mutex_init(&ctx->lock); |
879 | 883 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index fa1aa94a3d8e..26d51979116b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -56,9 +56,28 @@ static unsigned int convert_to_vm_err_msg(int msg) | |||
56 | return out_msg; | 56 | return out_msg; |
57 | } | 57 | } |
58 | 58 | ||
59 | static unsigned int mask_gem_flags(unsigned int flags) | 59 | static int check_gem_flags(unsigned int flags) |
60 | { | 60 | { |
61 | return flags &= EXYNOS_BO_NONCONTIG; | 61 | if (flags & ~(EXYNOS_BO_MASK)) { |
62 | DRM_ERROR("invalid flags.\n"); | ||
63 | return -EINVAL; | ||
64 | } | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static unsigned long roundup_gem_size(unsigned long size, unsigned int flags) | ||
70 | { | ||
71 | if (!IS_NONCONTIG_BUFFER(flags)) { | ||
72 | if (size >= SZ_1M) | ||
73 | return roundup(size, SECTION_SIZE); | ||
74 | else if (size >= SZ_64K) | ||
75 | return roundup(size, SZ_64K); | ||
76 | else | ||
77 | goto out; | ||
78 | } | ||
79 | out: | ||
80 | return roundup(size, PAGE_SIZE); | ||
62 | } | 81 | } |
63 | 82 | ||
64 | static struct page **exynos_gem_get_pages(struct drm_gem_object *obj, | 83 | static struct page **exynos_gem_get_pages(struct drm_gem_object *obj, |
@@ -319,10 +338,17 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
319 | struct exynos_drm_gem_buf *buf; | 338 | struct exynos_drm_gem_buf *buf; |
320 | int ret; | 339 | int ret; |
321 | 340 | ||
322 | size = roundup(size, PAGE_SIZE); | 341 | if (!size) { |
323 | DRM_DEBUG_KMS("%s: size = 0x%lx\n", __FILE__, size); | 342 | DRM_ERROR("invalid size.\n"); |
343 | return ERR_PTR(-EINVAL); | ||
344 | } | ||
324 | 345 | ||
325 | flags = mask_gem_flags(flags); | 346 | size = roundup_gem_size(size, flags); |
347 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
348 | |||
349 | ret = check_gem_flags(flags); | ||
350 | if (ret) | ||
351 | return ERR_PTR(ret); | ||
326 | 352 | ||
327 | buf = exynos_drm_init_buf(dev, size); | 353 | buf = exynos_drm_init_buf(dev, size); |
328 | if (!buf) | 354 | if (!buf) |
@@ -331,7 +357,7 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
331 | exynos_gem_obj = exynos_drm_gem_init(dev, size); | 357 | exynos_gem_obj = exynos_drm_gem_init(dev, size); |
332 | if (!exynos_gem_obj) { | 358 | if (!exynos_gem_obj) { |
333 | ret = -ENOMEM; | 359 | ret = -ENOMEM; |
334 | goto err; | 360 | goto err_fini_buf; |
335 | } | 361 | } |
336 | 362 | ||
337 | exynos_gem_obj->buffer = buf; | 363 | exynos_gem_obj->buffer = buf; |
@@ -347,18 +373,19 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
347 | ret = exynos_drm_gem_get_pages(&exynos_gem_obj->base); | 373 | ret = exynos_drm_gem_get_pages(&exynos_gem_obj->base); |
348 | if (ret < 0) { | 374 | if (ret < 0) { |
349 | drm_gem_object_release(&exynos_gem_obj->base); | 375 | drm_gem_object_release(&exynos_gem_obj->base); |
350 | goto err; | 376 | goto err_fini_buf; |
351 | } | 377 | } |
352 | } else { | 378 | } else { |
353 | ret = exynos_drm_alloc_buf(dev, buf, flags); | 379 | ret = exynos_drm_alloc_buf(dev, buf, flags); |
354 | if (ret < 0) { | 380 | if (ret < 0) { |
355 | drm_gem_object_release(&exynos_gem_obj->base); | 381 | drm_gem_object_release(&exynos_gem_obj->base); |
356 | goto err; | 382 | goto err_fini_buf; |
357 | } | 383 | } |
358 | } | 384 | } |
359 | 385 | ||
360 | return exynos_gem_obj; | 386 | return exynos_gem_obj; |
361 | err: | 387 | |
388 | err_fini_buf: | ||
362 | exynos_drm_fini_buf(dev, buf); | 389 | exynos_drm_fini_buf(dev, buf); |
363 | return ERR_PTR(ret); | 390 | return ERR_PTR(ret); |
364 | } | 391 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index e40fbad8b705..4ed842039505 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #define to_exynos_gem_obj(x) container_of(x,\ | 29 | #define to_exynos_gem_obj(x) container_of(x,\ |
30 | struct exynos_drm_gem_obj, base) | 30 | struct exynos_drm_gem_obj, base) |
31 | 31 | ||
32 | #define IS_NONCONTIG_BUFFER(f) (f & EXYNOS_BO_NONCONTIG) | ||
33 | |||
32 | /* | 34 | /* |
33 | * exynos drm gem buffer structure. | 35 | * exynos drm gem buffer structure. |
34 | * | 36 | * |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 14eb26b0ba1c..3424463676e0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -30,9 +30,8 @@ | |||
30 | struct drm_hdmi_context, subdrv); | 30 | struct drm_hdmi_context, subdrv); |
31 | 31 | ||
32 | /* these callback points shoud be set by specific drivers. */ | 32 | /* these callback points shoud be set by specific drivers. */ |
33 | static struct exynos_hdmi_display_ops *hdmi_display_ops; | 33 | static struct exynos_hdmi_ops *hdmi_ops; |
34 | static struct exynos_hdmi_manager_ops *hdmi_manager_ops; | 34 | static struct exynos_mixer_ops *mixer_ops; |
35 | static struct exynos_hdmi_overlay_ops *hdmi_overlay_ops; | ||
36 | 35 | ||
37 | struct drm_hdmi_context { | 36 | struct drm_hdmi_context { |
38 | struct exynos_drm_subdrv subdrv; | 37 | struct exynos_drm_subdrv subdrv; |
@@ -40,31 +39,20 @@ struct drm_hdmi_context { | |||
40 | struct exynos_drm_hdmi_context *mixer_ctx; | 39 | struct exynos_drm_hdmi_context *mixer_ctx; |
41 | }; | 40 | }; |
42 | 41 | ||
43 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | 42 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops) |
44 | *display_ops) | ||
45 | { | 43 | { |
46 | DRM_DEBUG_KMS("%s\n", __FILE__); | 44 | DRM_DEBUG_KMS("%s\n", __FILE__); |
47 | 45 | ||
48 | if (display_ops) | 46 | if (ops) |
49 | hdmi_display_ops = display_ops; | 47 | hdmi_ops = ops; |
50 | } | 48 | } |
51 | 49 | ||
52 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | 50 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops) |
53 | *manager_ops) | ||
54 | { | 51 | { |
55 | DRM_DEBUG_KMS("%s\n", __FILE__); | 52 | DRM_DEBUG_KMS("%s\n", __FILE__); |
56 | 53 | ||
57 | if (manager_ops) | 54 | if (ops) |
58 | hdmi_manager_ops = manager_ops; | 55 | mixer_ops = ops; |
59 | } | ||
60 | |||
61 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | ||
62 | *overlay_ops) | ||
63 | { | ||
64 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
65 | |||
66 | if (overlay_ops) | ||
67 | hdmi_overlay_ops = overlay_ops; | ||
68 | } | 56 | } |
69 | 57 | ||
70 | static bool drm_hdmi_is_connected(struct device *dev) | 58 | static bool drm_hdmi_is_connected(struct device *dev) |
@@ -73,8 +61,8 @@ static bool drm_hdmi_is_connected(struct device *dev) | |||
73 | 61 | ||
74 | DRM_DEBUG_KMS("%s\n", __FILE__); | 62 | DRM_DEBUG_KMS("%s\n", __FILE__); |
75 | 63 | ||
76 | if (hdmi_display_ops && hdmi_display_ops->is_connected) | 64 | if (hdmi_ops && hdmi_ops->is_connected) |
77 | return hdmi_display_ops->is_connected(ctx->hdmi_ctx->ctx); | 65 | return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx); |
78 | 66 | ||
79 | return false; | 67 | return false; |
80 | } | 68 | } |
@@ -86,9 +74,9 @@ static int drm_hdmi_get_edid(struct device *dev, | |||
86 | 74 | ||
87 | DRM_DEBUG_KMS("%s\n", __FILE__); | 75 | DRM_DEBUG_KMS("%s\n", __FILE__); |
88 | 76 | ||
89 | if (hdmi_display_ops && hdmi_display_ops->get_edid) | 77 | if (hdmi_ops && hdmi_ops->get_edid) |
90 | return hdmi_display_ops->get_edid(ctx->hdmi_ctx->ctx, | 78 | return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid, |
91 | connector, edid, len); | 79 | len); |
92 | 80 | ||
93 | return 0; | 81 | return 0; |
94 | } | 82 | } |
@@ -99,9 +87,8 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) | |||
99 | 87 | ||
100 | DRM_DEBUG_KMS("%s\n", __FILE__); | 88 | DRM_DEBUG_KMS("%s\n", __FILE__); |
101 | 89 | ||
102 | if (hdmi_display_ops && hdmi_display_ops->check_timing) | 90 | if (hdmi_ops && hdmi_ops->check_timing) |
103 | return hdmi_display_ops->check_timing(ctx->hdmi_ctx->ctx, | 91 | return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing); |
104 | timing); | ||
105 | 92 | ||
106 | return 0; | 93 | return 0; |
107 | } | 94 | } |
@@ -112,8 +99,8 @@ static int drm_hdmi_power_on(struct device *dev, int mode) | |||
112 | 99 | ||
113 | DRM_DEBUG_KMS("%s\n", __FILE__); | 100 | DRM_DEBUG_KMS("%s\n", __FILE__); |
114 | 101 | ||
115 | if (hdmi_display_ops && hdmi_display_ops->power_on) | 102 | if (hdmi_ops && hdmi_ops->power_on) |
116 | return hdmi_display_ops->power_on(ctx->hdmi_ctx->ctx, mode); | 103 | return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode); |
117 | 104 | ||
118 | return 0; | 105 | return 0; |
119 | } | 106 | } |
@@ -130,13 +117,13 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) | |||
130 | { | 117 | { |
131 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); | 118 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); |
132 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 119 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
133 | struct exynos_drm_manager *manager = &subdrv->manager; | 120 | struct exynos_drm_manager *manager = subdrv->manager; |
134 | 121 | ||
135 | DRM_DEBUG_KMS("%s\n", __FILE__); | 122 | DRM_DEBUG_KMS("%s\n", __FILE__); |
136 | 123 | ||
137 | if (hdmi_overlay_ops && hdmi_overlay_ops->enable_vblank) | 124 | if (mixer_ops && mixer_ops->enable_vblank) |
138 | return hdmi_overlay_ops->enable_vblank(ctx->mixer_ctx->ctx, | 125 | return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx, |
139 | manager->pipe); | 126 | manager->pipe); |
140 | 127 | ||
141 | return 0; | 128 | return 0; |
142 | } | 129 | } |
@@ -147,8 +134,8 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) | |||
147 | 134 | ||
148 | DRM_DEBUG_KMS("%s\n", __FILE__); | 135 | DRM_DEBUG_KMS("%s\n", __FILE__); |
149 | 136 | ||
150 | if (hdmi_overlay_ops && hdmi_overlay_ops->disable_vblank) | 137 | if (mixer_ops && mixer_ops->disable_vblank) |
151 | return hdmi_overlay_ops->disable_vblank(ctx->mixer_ctx->ctx); | 138 | return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); |
152 | } | 139 | } |
153 | 140 | ||
154 | static void drm_hdmi_mode_fixup(struct device *subdrv_dev, | 141 | static void drm_hdmi_mode_fixup(struct device *subdrv_dev, |
@@ -160,9 +147,9 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, | |||
160 | 147 | ||
161 | DRM_DEBUG_KMS("%s\n", __FILE__); | 148 | DRM_DEBUG_KMS("%s\n", __FILE__); |
162 | 149 | ||
163 | if (hdmi_manager_ops && hdmi_manager_ops->mode_fixup) | 150 | if (hdmi_ops && hdmi_ops->mode_fixup) |
164 | hdmi_manager_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, | 151 | hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode, |
165 | mode, adjusted_mode); | 152 | adjusted_mode); |
166 | } | 153 | } |
167 | 154 | ||
168 | static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) | 155 | static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) |
@@ -171,8 +158,8 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) | |||
171 | 158 | ||
172 | DRM_DEBUG_KMS("%s\n", __FILE__); | 159 | DRM_DEBUG_KMS("%s\n", __FILE__); |
173 | 160 | ||
174 | if (hdmi_manager_ops && hdmi_manager_ops->mode_set) | 161 | if (hdmi_ops && hdmi_ops->mode_set) |
175 | hdmi_manager_ops->mode_set(ctx->hdmi_ctx->ctx, mode); | 162 | hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode); |
176 | } | 163 | } |
177 | 164 | ||
178 | static void drm_hdmi_get_max_resol(struct device *subdrv_dev, | 165 | static void drm_hdmi_get_max_resol(struct device *subdrv_dev, |
@@ -182,9 +169,8 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, | |||
182 | 169 | ||
183 | DRM_DEBUG_KMS("%s\n", __FILE__); | 170 | DRM_DEBUG_KMS("%s\n", __FILE__); |
184 | 171 | ||
185 | if (hdmi_manager_ops && hdmi_manager_ops->get_max_resol) | 172 | if (hdmi_ops && hdmi_ops->get_max_resol) |
186 | hdmi_manager_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, | 173 | hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height); |
187 | height); | ||
188 | } | 174 | } |
189 | 175 | ||
190 | static void drm_hdmi_commit(struct device *subdrv_dev) | 176 | static void drm_hdmi_commit(struct device *subdrv_dev) |
@@ -193,8 +179,8 @@ static void drm_hdmi_commit(struct device *subdrv_dev) | |||
193 | 179 | ||
194 | DRM_DEBUG_KMS("%s\n", __FILE__); | 180 | DRM_DEBUG_KMS("%s\n", __FILE__); |
195 | 181 | ||
196 | if (hdmi_manager_ops && hdmi_manager_ops->commit) | 182 | if (hdmi_ops && hdmi_ops->commit) |
197 | hdmi_manager_ops->commit(ctx->hdmi_ctx->ctx); | 183 | hdmi_ops->commit(ctx->hdmi_ctx->ctx); |
198 | } | 184 | } |
199 | 185 | ||
200 | static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) | 186 | static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) |
@@ -209,8 +195,8 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) | |||
209 | case DRM_MODE_DPMS_STANDBY: | 195 | case DRM_MODE_DPMS_STANDBY: |
210 | case DRM_MODE_DPMS_SUSPEND: | 196 | case DRM_MODE_DPMS_SUSPEND: |
211 | case DRM_MODE_DPMS_OFF: | 197 | case DRM_MODE_DPMS_OFF: |
212 | if (hdmi_manager_ops && hdmi_manager_ops->disable) | 198 | if (hdmi_ops && hdmi_ops->disable) |
213 | hdmi_manager_ops->disable(ctx->hdmi_ctx->ctx); | 199 | hdmi_ops->disable(ctx->hdmi_ctx->ctx); |
214 | break; | 200 | break; |
215 | default: | 201 | default: |
216 | DRM_DEBUG_KMS("unkown dps mode: %d\n", mode); | 202 | DRM_DEBUG_KMS("unkown dps mode: %d\n", mode); |
@@ -235,8 +221,8 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, | |||
235 | 221 | ||
236 | DRM_DEBUG_KMS("%s\n", __FILE__); | 222 | DRM_DEBUG_KMS("%s\n", __FILE__); |
237 | 223 | ||
238 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_mode_set) | 224 | if (mixer_ops && mixer_ops->win_mode_set) |
239 | hdmi_overlay_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); | 225 | mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); |
240 | } | 226 | } |
241 | 227 | ||
242 | static void drm_mixer_commit(struct device *subdrv_dev, int zpos) | 228 | static void drm_mixer_commit(struct device *subdrv_dev, int zpos) |
@@ -245,8 +231,8 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) | |||
245 | 231 | ||
246 | DRM_DEBUG_KMS("%s\n", __FILE__); | 232 | DRM_DEBUG_KMS("%s\n", __FILE__); |
247 | 233 | ||
248 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_commit) | 234 | if (mixer_ops && mixer_ops->win_commit) |
249 | hdmi_overlay_ops->win_commit(ctx->mixer_ctx->ctx, zpos); | 235 | mixer_ops->win_commit(ctx->mixer_ctx->ctx, zpos); |
250 | } | 236 | } |
251 | 237 | ||
252 | static void drm_mixer_disable(struct device *subdrv_dev, int zpos) | 238 | static void drm_mixer_disable(struct device *subdrv_dev, int zpos) |
@@ -255,8 +241,8 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) | |||
255 | 241 | ||
256 | DRM_DEBUG_KMS("%s\n", __FILE__); | 242 | DRM_DEBUG_KMS("%s\n", __FILE__); |
257 | 243 | ||
258 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_disable) | 244 | if (mixer_ops && mixer_ops->win_disable) |
259 | hdmi_overlay_ops->win_disable(ctx->mixer_ctx->ctx, zpos); | 245 | mixer_ops->win_disable(ctx->mixer_ctx->ctx, zpos); |
260 | } | 246 | } |
261 | 247 | ||
262 | static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { | 248 | static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { |
@@ -265,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { | |||
265 | .disable = drm_mixer_disable, | 251 | .disable = drm_mixer_disable, |
266 | }; | 252 | }; |
267 | 253 | ||
254 | static struct exynos_drm_manager hdmi_manager = { | ||
255 | .pipe = -1, | ||
256 | .ops = &drm_hdmi_manager_ops, | ||
257 | .overlay_ops = &drm_hdmi_overlay_ops, | ||
258 | .display_ops = &drm_hdmi_display_ops, | ||
259 | }; | ||
268 | 260 | ||
269 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, | 261 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, |
270 | struct device *dev) | 262 | struct device *dev) |
@@ -332,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
332 | 324 | ||
333 | subdrv = &ctx->subdrv; | 325 | subdrv = &ctx->subdrv; |
334 | 326 | ||
327 | subdrv->dev = dev; | ||
328 | subdrv->manager = &hdmi_manager; | ||
335 | subdrv->probe = hdmi_subdrv_probe; | 329 | subdrv->probe = hdmi_subdrv_probe; |
336 | subdrv->manager.pipe = -1; | ||
337 | subdrv->manager.ops = &drm_hdmi_manager_ops; | ||
338 | subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops; | ||
339 | subdrv->manager.display_ops = &drm_hdmi_display_ops; | ||
340 | subdrv->manager.dev = dev; | ||
341 | 330 | ||
342 | platform_set_drvdata(pdev, subdrv); | 331 | platform_set_drvdata(pdev, subdrv); |
343 | 332 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 44497cfb6c74..f3ae192c8dcf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h | |||
@@ -38,15 +38,15 @@ struct exynos_drm_hdmi_context { | |||
38 | void *ctx; | 38 | void *ctx; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct exynos_hdmi_display_ops { | 41 | struct exynos_hdmi_ops { |
42 | /* display */ | ||
42 | bool (*is_connected)(void *ctx); | 43 | bool (*is_connected)(void *ctx); |
43 | int (*get_edid)(void *ctx, struct drm_connector *connector, | 44 | int (*get_edid)(void *ctx, struct drm_connector *connector, |
44 | u8 *edid, int len); | 45 | u8 *edid, int len); |
45 | int (*check_timing)(void *ctx, void *timing); | 46 | int (*check_timing)(void *ctx, void *timing); |
46 | int (*power_on)(void *ctx, int mode); | 47 | int (*power_on)(void *ctx, int mode); |
47 | }; | ||
48 | 48 | ||
49 | struct exynos_hdmi_manager_ops { | 49 | /* manager */ |
50 | void (*mode_fixup)(void *ctx, struct drm_connector *connector, | 50 | void (*mode_fixup)(void *ctx, struct drm_connector *connector, |
51 | struct drm_display_mode *mode, | 51 | struct drm_display_mode *mode, |
52 | struct drm_display_mode *adjusted_mode); | 52 | struct drm_display_mode *adjusted_mode); |
@@ -57,22 +57,17 @@ struct exynos_hdmi_manager_ops { | |||
57 | void (*disable)(void *ctx); | 57 | void (*disable)(void *ctx); |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct exynos_hdmi_overlay_ops { | 60 | struct exynos_mixer_ops { |
61 | /* manager */ | ||
61 | int (*enable_vblank)(void *ctx, int pipe); | 62 | int (*enable_vblank)(void *ctx, int pipe); |
62 | void (*disable_vblank)(void *ctx); | 63 | void (*disable_vblank)(void *ctx); |
64 | |||
65 | /* overlay */ | ||
63 | void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); | 66 | void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); |
64 | void (*win_commit)(void *ctx, int zpos); | 67 | void (*win_commit)(void *ctx, int zpos); |
65 | void (*win_disable)(void *ctx, int zpos); | 68 | void (*win_disable)(void *ctx, int zpos); |
66 | }; | 69 | }; |
67 | 70 | ||
68 | extern struct platform_driver hdmi_driver; | 71 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops); |
69 | extern struct platform_driver mixer_driver; | 72 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops); |
70 | |||
71 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | ||
72 | *display_ops); | ||
73 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | ||
74 | *manager_ops); | ||
75 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | ||
76 | *overlay_ops); | ||
77 | |||
78 | #endif | 73 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index c277a3a445f5..f92fe4c6174a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -24,6 +24,10 @@ struct exynos_plane { | |||
24 | 24 | ||
25 | static const uint32_t formats[] = { | 25 | static const uint32_t formats[] = { |
26 | DRM_FORMAT_XRGB8888, | 26 | DRM_FORMAT_XRGB8888, |
27 | DRM_FORMAT_ARGB8888, | ||
28 | DRM_FORMAT_NV12, | ||
29 | DRM_FORMAT_NV12M, | ||
30 | DRM_FORMAT_NV12MT, | ||
27 | }; | 31 | }; |
28 | 32 | ||
29 | static int | 33 | static int |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 8e1339f9fe1f..7b9c153dceb6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) | |||
199 | static void vidi_apply(struct device *subdrv_dev) | 199 | static void vidi_apply(struct device *subdrv_dev) |
200 | { | 200 | { |
201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); | 201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); |
202 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 202 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
205 | struct vidi_win_data *win_data; | 205 | struct vidi_win_data *win_data; |
@@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = { | |||
374 | .disable = vidi_win_disable, | 374 | .disable = vidi_win_disable, |
375 | }; | 375 | }; |
376 | 376 | ||
377 | static struct exynos_drm_manager vidi_manager = { | ||
378 | .pipe = -1, | ||
379 | .ops = &vidi_manager_ops, | ||
380 | .overlay_ops = &vidi_overlay_ops, | ||
381 | .display_ops = &vidi_display_ops, | ||
382 | }; | ||
383 | |||
377 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) | 384 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) |
378 | { | 385 | { |
379 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 386 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -425,7 +432,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) | |||
425 | struct vidi_context *ctx = container_of(work, struct vidi_context, | 432 | struct vidi_context *ctx = container_of(work, struct vidi_context, |
426 | work); | 433 | work); |
427 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 434 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
428 | struct exynos_drm_manager *manager = &subdrv->manager; | 435 | struct exynos_drm_manager *manager = subdrv->manager; |
429 | 436 | ||
430 | if (manager->pipe < 0) | 437 | if (manager->pipe < 0) |
431 | return; | 438 | return; |
@@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev) | |||
471 | static int vidi_power_on(struct vidi_context *ctx, bool enable) | 478 | static int vidi_power_on(struct vidi_context *ctx, bool enable) |
472 | { | 479 | { |
473 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 480 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
474 | struct device *dev = subdrv->manager.dev; | 481 | struct device *dev = subdrv->dev; |
475 | 482 | ||
476 | DRM_DEBUG_KMS("%s\n", __FILE__); | 483 | DRM_DEBUG_KMS("%s\n", __FILE__); |
477 | 484 | ||
@@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev) | |||
611 | ctx->raw_edid = (struct edid *)fake_edid_info; | 618 | ctx->raw_edid = (struct edid *)fake_edid_info; |
612 | 619 | ||
613 | subdrv = &ctx->subdrv; | 620 | subdrv = &ctx->subdrv; |
621 | subdrv->dev = dev; | ||
622 | subdrv->manager = &vidi_manager; | ||
614 | subdrv->probe = vidi_subdrv_probe; | 623 | subdrv->probe = vidi_subdrv_probe; |
615 | subdrv->remove = vidi_subdrv_remove; | 624 | subdrv->remove = vidi_subdrv_remove; |
616 | subdrv->manager.pipe = -1; | ||
617 | subdrv->manager.ops = &vidi_manager_ops; | ||
618 | subdrv->manager.overlay_ops = &vidi_overlay_ops; | ||
619 | subdrv->manager.display_ops = &vidi_display_ops; | ||
620 | subdrv->manager.dev = dev; | ||
621 | 625 | ||
622 | mutex_init(&ctx->lock); | 626 | mutex_init(&ctx->lock); |
623 | 627 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 575a8cbd3533..b00353876458 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include "exynos_hdmi.h" | 41 | #include "exynos_hdmi.h" |
42 | 42 | ||
43 | #define HDMI_OVERLAY_NUMBER 3 | ||
44 | #define MAX_WIDTH 1920 | 43 | #define MAX_WIDTH 1920 |
45 | #define MAX_HEIGHT 1080 | 44 | #define MAX_HEIGHT 1080 |
46 | #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) | 45 | #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) |
@@ -1194,7 +1193,7 @@ static int hdmi_conf_index(struct hdmi_context *hdata, | |||
1194 | 1193 | ||
1195 | static bool hdmi_is_connected(void *ctx) | 1194 | static bool hdmi_is_connected(void *ctx) |
1196 | { | 1195 | { |
1197 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1196 | struct hdmi_context *hdata = ctx; |
1198 | u32 val = hdmi_reg_read(hdata, HDMI_HPD_STATUS); | 1197 | u32 val = hdmi_reg_read(hdata, HDMI_HPD_STATUS); |
1199 | 1198 | ||
1200 | if (val) | 1199 | if (val) |
@@ -1207,7 +1206,7 @@ static int hdmi_get_edid(void *ctx, struct drm_connector *connector, | |||
1207 | u8 *edid, int len) | 1206 | u8 *edid, int len) |
1208 | { | 1207 | { |
1209 | struct edid *raw_edid; | 1208 | struct edid *raw_edid; |
1210 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1209 | struct hdmi_context *hdata = ctx; |
1211 | 1210 | ||
1212 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1211 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1213 | 1212 | ||
@@ -1275,7 +1274,7 @@ static int hdmi_v14_check_timing(struct fb_videomode *check_timing) | |||
1275 | 1274 | ||
1276 | static int hdmi_check_timing(void *ctx, void *timing) | 1275 | static int hdmi_check_timing(void *ctx, void *timing) |
1277 | { | 1276 | { |
1278 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1277 | struct hdmi_context *hdata = ctx; |
1279 | struct fb_videomode *check_timing = timing; | 1278 | struct fb_videomode *check_timing = timing; |
1280 | 1279 | ||
1281 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1280 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1312,13 +1311,6 @@ static int hdmi_display_power_on(void *ctx, int mode) | |||
1312 | return 0; | 1311 | return 0; |
1313 | } | 1312 | } |
1314 | 1313 | ||
1315 | static struct exynos_hdmi_display_ops display_ops = { | ||
1316 | .is_connected = hdmi_is_connected, | ||
1317 | .get_edid = hdmi_get_edid, | ||
1318 | .check_timing = hdmi_check_timing, | ||
1319 | .power_on = hdmi_display_power_on, | ||
1320 | }; | ||
1321 | |||
1322 | static void hdmi_set_acr(u32 freq, u8 *acr) | 1314 | static void hdmi_set_acr(u32 freq, u8 *acr) |
1323 | { | 1315 | { |
1324 | u32 n, cts; | 1316 | u32 n, cts; |
@@ -1914,7 +1906,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, | |||
1914 | struct drm_display_mode *adjusted_mode) | 1906 | struct drm_display_mode *adjusted_mode) |
1915 | { | 1907 | { |
1916 | struct drm_display_mode *m; | 1908 | struct drm_display_mode *m; |
1917 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1909 | struct hdmi_context *hdata = ctx; |
1918 | int index; | 1910 | int index; |
1919 | 1911 | ||
1920 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1912 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1951,7 +1943,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, | |||
1951 | 1943 | ||
1952 | static void hdmi_mode_set(void *ctx, void *mode) | 1944 | static void hdmi_mode_set(void *ctx, void *mode) |
1953 | { | 1945 | { |
1954 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1946 | struct hdmi_context *hdata = ctx; |
1955 | int conf_idx; | 1947 | int conf_idx; |
1956 | 1948 | ||
1957 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1949 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1974,7 +1966,7 @@ static void hdmi_get_max_resol(void *ctx, unsigned int *width, | |||
1974 | 1966 | ||
1975 | static void hdmi_commit(void *ctx) | 1967 | static void hdmi_commit(void *ctx) |
1976 | { | 1968 | { |
1977 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1969 | struct hdmi_context *hdata = ctx; |
1978 | 1970 | ||
1979 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1971 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1980 | 1972 | ||
@@ -1985,7 +1977,7 @@ static void hdmi_commit(void *ctx) | |||
1985 | 1977 | ||
1986 | static void hdmi_disable(void *ctx) | 1978 | static void hdmi_disable(void *ctx) |
1987 | { | 1979 | { |
1988 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1980 | struct hdmi_context *hdata = ctx; |
1989 | 1981 | ||
1990 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1982 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1991 | 1983 | ||
@@ -1996,7 +1988,14 @@ static void hdmi_disable(void *ctx) | |||
1996 | } | 1988 | } |
1997 | } | 1989 | } |
1998 | 1990 | ||
1999 | static struct exynos_hdmi_manager_ops manager_ops = { | 1991 | static struct exynos_hdmi_ops hdmi_ops = { |
1992 | /* display */ | ||
1993 | .is_connected = hdmi_is_connected, | ||
1994 | .get_edid = hdmi_get_edid, | ||
1995 | .check_timing = hdmi_check_timing, | ||
1996 | .power_on = hdmi_display_power_on, | ||
1997 | |||
1998 | /* manager */ | ||
2000 | .mode_fixup = hdmi_mode_fixup, | 1999 | .mode_fixup = hdmi_mode_fixup, |
2001 | .mode_set = hdmi_mode_set, | 2000 | .mode_set = hdmi_mode_set, |
2002 | .get_max_resol = hdmi_get_max_resol, | 2001 | .get_max_resol = hdmi_get_max_resol, |
@@ -2020,7 +2019,7 @@ static void hdmi_hotplug_func(struct work_struct *work) | |||
2020 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) | 2019 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) |
2021 | { | 2020 | { |
2022 | struct exynos_drm_hdmi_context *ctx = arg; | 2021 | struct exynos_drm_hdmi_context *ctx = arg; |
2023 | struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | 2022 | struct hdmi_context *hdata = ctx->ctx; |
2024 | u32 intc_flag; | 2023 | u32 intc_flag; |
2025 | 2024 | ||
2026 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); | 2025 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); |
@@ -2173,7 +2172,7 @@ static int hdmi_runtime_suspend(struct device *dev) | |||
2173 | 2172 | ||
2174 | DRM_DEBUG_KMS("%s\n", __func__); | 2173 | DRM_DEBUG_KMS("%s\n", __func__); |
2175 | 2174 | ||
2176 | hdmi_resource_poweroff((struct hdmi_context *)ctx->ctx); | 2175 | hdmi_resource_poweroff(ctx->ctx); |
2177 | 2176 | ||
2178 | return 0; | 2177 | return 0; |
2179 | } | 2178 | } |
@@ -2184,7 +2183,7 @@ static int hdmi_runtime_resume(struct device *dev) | |||
2184 | 2183 | ||
2185 | DRM_DEBUG_KMS("%s\n", __func__); | 2184 | DRM_DEBUG_KMS("%s\n", __func__); |
2186 | 2185 | ||
2187 | hdmi_resource_poweron((struct hdmi_context *)ctx->ctx); | 2186 | hdmi_resource_poweron(ctx->ctx); |
2188 | 2187 | ||
2189 | return 0; | 2188 | return 0; |
2190 | } | 2189 | } |
@@ -2322,8 +2321,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) | |||
2322 | hdata->irq = res->start; | 2321 | hdata->irq = res->start; |
2323 | 2322 | ||
2324 | /* register specific callbacks to common hdmi. */ | 2323 | /* register specific callbacks to common hdmi. */ |
2325 | exynos_drm_display_ops_register(&display_ops); | 2324 | exynos_hdmi_ops_register(&hdmi_ops); |
2326 | exynos_drm_manager_ops_register(&manager_ops); | ||
2327 | 2325 | ||
2328 | hdmi_resource_poweron(hdata); | 2326 | hdmi_resource_poweron(hdata); |
2329 | 2327 | ||
@@ -2351,7 +2349,7 @@ err_data: | |||
2351 | static int __devexit hdmi_remove(struct platform_device *pdev) | 2349 | static int __devexit hdmi_remove(struct platform_device *pdev) |
2352 | { | 2350 | { |
2353 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); | 2351 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); |
2354 | struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | 2352 | struct hdmi_context *hdata = ctx->ctx; |
2355 | 2353 | ||
2356 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 2354 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
2357 | 2355 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4d5f41e19527..e15438c01129 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -37,7 +37,8 @@ | |||
37 | #include "exynos_drm_drv.h" | 37 | #include "exynos_drm_drv.h" |
38 | #include "exynos_drm_hdmi.h" | 38 | #include "exynos_drm_hdmi.h" |
39 | 39 | ||
40 | #define HDMI_OVERLAY_NUMBER 3 | 40 | #define MIXER_WIN_NR 3 |
41 | #define MIXER_DEFAULT_WIN 0 | ||
41 | 42 | ||
42 | #define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) | 43 | #define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) |
43 | 44 | ||
@@ -75,16 +76,12 @@ struct mixer_resources { | |||
75 | }; | 76 | }; |
76 | 77 | ||
77 | struct mixer_context { | 78 | struct mixer_context { |
78 | struct fb_videomode *default_timing; | ||
79 | unsigned int default_win; | ||
80 | unsigned int default_bpp; | ||
81 | unsigned int irq; | 79 | unsigned int irq; |
82 | int pipe; | 80 | int pipe; |
83 | bool interlace; | 81 | bool interlace; |
84 | bool vp_enabled; | ||
85 | 82 | ||
86 | struct mixer_resources mixer_res; | 83 | struct mixer_resources mixer_res; |
87 | struct hdmi_win_data win_data[HDMI_OVERLAY_NUMBER]; | 84 | struct hdmi_win_data win_data[MIXER_WIN_NR]; |
88 | }; | 85 | }; |
89 | 86 | ||
90 | static const u8 filter_y_horiz_tap8[] = { | 87 | static const u8 filter_y_horiz_tap8[] = { |
@@ -643,9 +640,9 @@ static void mixer_win_mode_set(void *ctx, | |||
643 | 640 | ||
644 | win = overlay->zpos; | 641 | win = overlay->zpos; |
645 | if (win == DEFAULT_ZPOS) | 642 | if (win == DEFAULT_ZPOS) |
646 | win = mixer_ctx->default_win; | 643 | win = MIXER_DEFAULT_WIN; |
647 | 644 | ||
648 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 645 | if (win < 0 || win > MIXER_WIN_NR) { |
649 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 646 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
650 | return; | 647 | return; |
651 | } | 648 | } |
@@ -683,9 +680,9 @@ static void mixer_win_commit(void *ctx, int zpos) | |||
683 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); | 680 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
684 | 681 | ||
685 | if (win == DEFAULT_ZPOS) | 682 | if (win == DEFAULT_ZPOS) |
686 | win = mixer_ctx->default_win; | 683 | win = MIXER_DEFAULT_WIN; |
687 | 684 | ||
688 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 685 | if (win < 0 || win > MIXER_WIN_NR) { |
689 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 686 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
690 | return; | 687 | return; |
691 | } | 688 | } |
@@ -706,9 +703,9 @@ static void mixer_win_disable(void *ctx, int zpos) | |||
706 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); | 703 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
707 | 704 | ||
708 | if (win == DEFAULT_ZPOS) | 705 | if (win == DEFAULT_ZPOS) |
709 | win = mixer_ctx->default_win; | 706 | win = MIXER_DEFAULT_WIN; |
710 | 707 | ||
711 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 708 | if (win < 0 || win > MIXER_WIN_NR) { |
712 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 709 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
713 | return; | 710 | return; |
714 | } | 711 | } |
@@ -722,9 +719,12 @@ static void mixer_win_disable(void *ctx, int zpos) | |||
722 | spin_unlock_irqrestore(&res->reg_slock, flags); | 719 | spin_unlock_irqrestore(&res->reg_slock, flags); |
723 | } | 720 | } |
724 | 721 | ||
725 | static struct exynos_hdmi_overlay_ops overlay_ops = { | 722 | static struct exynos_mixer_ops mixer_ops = { |
723 | /* manager */ | ||
726 | .enable_vblank = mixer_enable_vblank, | 724 | .enable_vblank = mixer_enable_vblank, |
727 | .disable_vblank = mixer_disable_vblank, | 725 | .disable_vblank = mixer_disable_vblank, |
726 | |||
727 | /* overlay */ | ||
728 | .win_mode_set = mixer_win_mode_set, | 728 | .win_mode_set = mixer_win_mode_set, |
729 | .win_commit = mixer_win_commit, | 729 | .win_commit = mixer_win_commit, |
730 | .win_disable = mixer_win_disable, | 730 | .win_disable = mixer_win_disable, |
@@ -771,8 +771,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) | |||
771 | static irqreturn_t mixer_irq_handler(int irq, void *arg) | 771 | static irqreturn_t mixer_irq_handler(int irq, void *arg) |
772 | { | 772 | { |
773 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; | 773 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; |
774 | struct mixer_context *ctx = | 774 | struct mixer_context *ctx = drm_hdmi_ctx->ctx; |
775 | (struct mixer_context *)drm_hdmi_ctx->ctx; | ||
776 | struct mixer_resources *res = &ctx->mixer_res; | 775 | struct mixer_resources *res = &ctx->mixer_res; |
777 | u32 val, val_base; | 776 | u32 val, val_base; |
778 | 777 | ||
@@ -902,7 +901,7 @@ static int mixer_runtime_resume(struct device *dev) | |||
902 | 901 | ||
903 | DRM_DEBUG_KMS("resume - start\n"); | 902 | DRM_DEBUG_KMS("resume - start\n"); |
904 | 903 | ||
905 | mixer_resource_poweron((struct mixer_context *)ctx->ctx); | 904 | mixer_resource_poweron(ctx->ctx); |
906 | 905 | ||
907 | return 0; | 906 | return 0; |
908 | } | 907 | } |
@@ -913,7 +912,7 @@ static int mixer_runtime_suspend(struct device *dev) | |||
913 | 912 | ||
914 | DRM_DEBUG_KMS("suspend - start\n"); | 913 | DRM_DEBUG_KMS("suspend - start\n"); |
915 | 914 | ||
916 | mixer_resource_poweroff((struct mixer_context *)ctx->ctx); | 915 | mixer_resource_poweroff(ctx->ctx); |
917 | 916 | ||
918 | return 0; | 917 | return 0; |
919 | } | 918 | } |
@@ -926,8 +925,7 @@ static const struct dev_pm_ops mixer_pm_ops = { | |||
926 | static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, | 925 | static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, |
927 | struct platform_device *pdev) | 926 | struct platform_device *pdev) |
928 | { | 927 | { |
929 | struct mixer_context *mixer_ctx = | 928 | struct mixer_context *mixer_ctx = ctx->ctx; |
930 | (struct mixer_context *)ctx->ctx; | ||
931 | struct device *dev = &pdev->dev; | 929 | struct device *dev = &pdev->dev; |
932 | struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; | 930 | struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; |
933 | struct resource *res; | 931 | struct resource *res; |
@@ -1076,7 +1074,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) | |||
1076 | goto fail; | 1074 | goto fail; |
1077 | 1075 | ||
1078 | /* register specific callback point to common hdmi. */ | 1076 | /* register specific callback point to common hdmi. */ |
1079 | exynos_drm_overlay_ops_register(&overlay_ops); | 1077 | exynos_mixer_ops_register(&mixer_ops); |
1080 | 1078 | ||
1081 | mixer_resource_poweron(ctx); | 1079 | mixer_resource_poweron(ctx); |
1082 | 1080 | ||
@@ -1093,7 +1091,7 @@ static int mixer_remove(struct platform_device *pdev) | |||
1093 | struct device *dev = &pdev->dev; | 1091 | struct device *dev = &pdev->dev; |
1094 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = | 1092 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = |
1095 | platform_get_drvdata(pdev); | 1093 | platform_get_drvdata(pdev); |
1096 | struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; | 1094 | struct mixer_context *ctx = drm_hdmi_ctx->ctx; |
1097 | 1095 | ||
1098 | dev_info(dev, "remove successful\n"); | 1096 | dev_info(dev, "remove successful\n"); |
1099 | 1097 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index dfa55e7478fb..ae8a64f9f845 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(semaphores, | |||
64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); | 64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); |
65 | 65 | ||
66 | int i915_enable_rc6 __read_mostly = -1; | 66 | int i915_enable_rc6 __read_mostly = -1; |
67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0400); |
68 | MODULE_PARM_DESC(i915_enable_rc6, | 68 | MODULE_PARM_DESC(i915_enable_rc6, |
69 | "Enable power-saving render C-state 6. " | 69 | "Enable power-saving render C-state 6. " |
70 | "Different stages can be selected via bitmask values " | 70 | "Different stages can be selected via bitmask values " |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 4c65c639f772..0e3c6acde955 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1493,6 +1493,7 @@ i915_gem_object_move_off_active(struct drm_i915_gem_object *obj) | |||
1493 | { | 1493 | { |
1494 | list_del_init(&obj->ring_list); | 1494 | list_del_init(&obj->ring_list); |
1495 | obj->last_rendering_seqno = 0; | 1495 | obj->last_rendering_seqno = 0; |
1496 | obj->last_fenced_seqno = 0; | ||
1496 | } | 1497 | } |
1497 | 1498 | ||
1498 | static void | 1499 | static void |
@@ -1521,6 +1522,7 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj) | |||
1521 | BUG_ON(!list_empty(&obj->gpu_write_list)); | 1522 | BUG_ON(!list_empty(&obj->gpu_write_list)); |
1522 | BUG_ON(!obj->active); | 1523 | BUG_ON(!obj->active); |
1523 | obj->ring = NULL; | 1524 | obj->ring = NULL; |
1525 | obj->last_fenced_ring = NULL; | ||
1524 | 1526 | ||
1525 | i915_gem_object_move_off_active(obj); | 1527 | i915_gem_object_move_off_active(obj); |
1526 | obj->fenced_gpu_access = false; | 1528 | obj->fenced_gpu_access = false; |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 2abf4eb94039..b4bb1ef77ddc 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3728,6 +3728,9 @@ | |||
3728 | #define GT_FIFO_FREE_ENTRIES 0x120008 | 3728 | #define GT_FIFO_FREE_ENTRIES 0x120008 |
3729 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 | 3729 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
3730 | 3730 | ||
3731 | #define GEN6_UCGCTL1 0x9400 | ||
3732 | # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE (1 << 5) | ||
3733 | |||
3731 | #define GEN6_UCGCTL2 0x9404 | 3734 | #define GEN6_UCGCTL2 0x9404 |
3732 | # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) | 3735 | # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) |
3733 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) | 3736 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 91b35fd1db8c..bae38acf44dc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2245,6 +2245,33 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
2245 | } | 2245 | } |
2246 | 2246 | ||
2247 | static int | 2247 | static int |
2248 | intel_finish_fb(struct drm_framebuffer *old_fb) | ||
2249 | { | ||
2250 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | ||
2251 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; | ||
2252 | bool was_interruptible = dev_priv->mm.interruptible; | ||
2253 | int ret; | ||
2254 | |||
2255 | wait_event(dev_priv->pending_flip_queue, | ||
2256 | atomic_read(&dev_priv->mm.wedged) || | ||
2257 | atomic_read(&obj->pending_flip) == 0); | ||
2258 | |||
2259 | /* Big Hammer, we also need to ensure that any pending | ||
2260 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
2261 | * current scanout is retired before unpinning the old | ||
2262 | * framebuffer. | ||
2263 | * | ||
2264 | * This should only fail upon a hung GPU, in which case we | ||
2265 | * can safely continue. | ||
2266 | */ | ||
2267 | dev_priv->mm.interruptible = false; | ||
2268 | ret = i915_gem_object_finish_gpu(obj); | ||
2269 | dev_priv->mm.interruptible = was_interruptible; | ||
2270 | |||
2271 | return ret; | ||
2272 | } | ||
2273 | |||
2274 | static int | ||
2248 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | 2275 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, |
2249 | struct drm_framebuffer *old_fb) | 2276 | struct drm_framebuffer *old_fb) |
2250 | { | 2277 | { |
@@ -2282,25 +2309,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
2282 | return ret; | 2309 | return ret; |
2283 | } | 2310 | } |
2284 | 2311 | ||
2285 | if (old_fb) { | 2312 | if (old_fb) |
2286 | struct drm_i915_private *dev_priv = dev->dev_private; | 2313 | intel_finish_fb(old_fb); |
2287 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | ||
2288 | |||
2289 | wait_event(dev_priv->pending_flip_queue, | ||
2290 | atomic_read(&dev_priv->mm.wedged) || | ||
2291 | atomic_read(&obj->pending_flip) == 0); | ||
2292 | |||
2293 | /* Big Hammer, we also need to ensure that any pending | ||
2294 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
2295 | * current scanout is retired before unpinning the old | ||
2296 | * framebuffer. | ||
2297 | * | ||
2298 | * This should only fail upon a hung GPU, in which case we | ||
2299 | * can safely continue. | ||
2300 | */ | ||
2301 | ret = i915_gem_object_finish_gpu(obj); | ||
2302 | (void) ret; | ||
2303 | } | ||
2304 | 2314 | ||
2305 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 2315 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
2306 | LEAVE_ATOMIC_MODE_SET); | 2316 | LEAVE_ATOMIC_MODE_SET); |
@@ -3371,6 +3381,23 @@ static void intel_crtc_disable(struct drm_crtc *crtc) | |||
3371 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | 3381 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; |
3372 | struct drm_device *dev = crtc->dev; | 3382 | struct drm_device *dev = crtc->dev; |
3373 | 3383 | ||
3384 | /* Flush any pending WAITs before we disable the pipe. Note that | ||
3385 | * we need to drop the struct_mutex in order to acquire it again | ||
3386 | * during the lowlevel dpms routines around a couple of the | ||
3387 | * operations. It does not look trivial nor desirable to move | ||
3388 | * that locking higher. So instead we leave a window for the | ||
3389 | * submission of further commands on the fb before we can actually | ||
3390 | * disable it. This race with userspace exists anyway, and we can | ||
3391 | * only rely on the pipe being disabled by userspace after it | ||
3392 | * receives the hotplug notification and has flushed any pending | ||
3393 | * batches. | ||
3394 | */ | ||
3395 | if (crtc->fb) { | ||
3396 | mutex_lock(&dev->struct_mutex); | ||
3397 | intel_finish_fb(crtc->fb); | ||
3398 | mutex_unlock(&dev->struct_mutex); | ||
3399 | } | ||
3400 | |||
3374 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | 3401 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); |
3375 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); | 3402 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); |
3376 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); | 3403 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); |
@@ -8529,6 +8556,10 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
8529 | I915_WRITE(WM2_LP_ILK, 0); | 8556 | I915_WRITE(WM2_LP_ILK, 0); |
8530 | I915_WRITE(WM1_LP_ILK, 0); | 8557 | I915_WRITE(WM1_LP_ILK, 0); |
8531 | 8558 | ||
8559 | I915_WRITE(GEN6_UCGCTL1, | ||
8560 | I915_READ(GEN6_UCGCTL1) | | ||
8561 | GEN6_BLBUNIT_CLOCK_GATE_DISABLE); | ||
8562 | |||
8532 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock | 8563 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock |
8533 | * gating disable must be set. Failure to set it results in | 8564 | * gating disable must be set. Failure to set it results in |
8534 | * flickering pixels due to Z write ordering failures after | 8565 | * flickering pixels due to Z write ordering failures after |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 110552ff302c..4b637919f74f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -219,14 +219,38 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes) | |||
219 | return (max_link_clock * max_lanes * 8) / 10; | 219 | return (max_link_clock * max_lanes * 8) / 10; |
220 | } | 220 | } |
221 | 221 | ||
222 | static bool | ||
223 | intel_dp_adjust_dithering(struct intel_dp *intel_dp, | ||
224 | struct drm_display_mode *mode, | ||
225 | struct drm_display_mode *adjusted_mode) | ||
226 | { | ||
227 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | ||
228 | int max_lanes = intel_dp_max_lane_count(intel_dp); | ||
229 | int max_rate, mode_rate; | ||
230 | |||
231 | mode_rate = intel_dp_link_required(mode->clock, 24); | ||
232 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); | ||
233 | |||
234 | if (mode_rate > max_rate) { | ||
235 | mode_rate = intel_dp_link_required(mode->clock, 18); | ||
236 | if (mode_rate > max_rate) | ||
237 | return false; | ||
238 | |||
239 | if (adjusted_mode) | ||
240 | adjusted_mode->private_flags | ||
241 | |= INTEL_MODE_DP_FORCE_6BPC; | ||
242 | |||
243 | return true; | ||
244 | } | ||
245 | |||
246 | return true; | ||
247 | } | ||
248 | |||
222 | static int | 249 | static int |
223 | intel_dp_mode_valid(struct drm_connector *connector, | 250 | intel_dp_mode_valid(struct drm_connector *connector, |
224 | struct drm_display_mode *mode) | 251 | struct drm_display_mode *mode) |
225 | { | 252 | { |
226 | struct intel_dp *intel_dp = intel_attached_dp(connector); | 253 | struct intel_dp *intel_dp = intel_attached_dp(connector); |
227 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | ||
228 | int max_lanes = intel_dp_max_lane_count(intel_dp); | ||
229 | int max_rate, mode_rate; | ||
230 | 254 | ||
231 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 255 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
232 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) | 256 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) |
@@ -236,16 +260,8 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
236 | return MODE_PANEL; | 260 | return MODE_PANEL; |
237 | } | 261 | } |
238 | 262 | ||
239 | mode_rate = intel_dp_link_required(mode->clock, 24); | 263 | if (!intel_dp_adjust_dithering(intel_dp, mode, NULL)) |
240 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); | 264 | return MODE_CLOCK_HIGH; |
241 | |||
242 | if (mode_rate > max_rate) { | ||
243 | mode_rate = intel_dp_link_required(mode->clock, 18); | ||
244 | if (mode_rate > max_rate) | ||
245 | return MODE_CLOCK_HIGH; | ||
246 | else | ||
247 | mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC; | ||
248 | } | ||
249 | 265 | ||
250 | if (mode->clock < 10000) | 266 | if (mode->clock < 10000) |
251 | return MODE_CLOCK_LOW; | 267 | return MODE_CLOCK_LOW; |
@@ -672,7 +688,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
672 | int lane_count, clock; | 688 | int lane_count, clock; |
673 | int max_lane_count = intel_dp_max_lane_count(intel_dp); | 689 | int max_lane_count = intel_dp_max_lane_count(intel_dp); |
674 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; | 690 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
675 | int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; | 691 | int bpp; |
676 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 692 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
677 | 693 | ||
678 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 694 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
@@ -686,6 +702,11 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
686 | mode->clock = intel_dp->panel_fixed_mode->clock; | 702 | mode->clock = intel_dp->panel_fixed_mode->clock; |
687 | } | 703 | } |
688 | 704 | ||
705 | if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode)) | ||
706 | return false; | ||
707 | |||
708 | bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; | ||
709 | |||
689 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { | 710 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { |
690 | for (clock = 0; clock <= max_clock; clock++) { | 711 | for (clock = 0; clock <= max_clock; clock++) { |
691 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); | 712 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 601c86e664af..8fdc95700218 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -390,7 +390,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
390 | bus->has_gpio = intel_gpio_setup(bus, i); | 390 | bus->has_gpio = intel_gpio_setup(bus, i); |
391 | 391 | ||
392 | /* XXX force bit banging until GMBUS is fully debugged */ | 392 | /* XXX force bit banging until GMBUS is fully debugged */ |
393 | if (bus->has_gpio && IS_GEN2(dev)) | 393 | if (bus->has_gpio) |
394 | bus->force_bit = true; | 394 | bus->force_bit = true; |
395 | } | 395 | } |
396 | 396 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index e25581a9f60f..f75806e5bff5 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1038,7 +1038,7 @@ int intel_init_ring_buffer(struct drm_device *dev, | |||
1038 | * of the buffer. | 1038 | * of the buffer. |
1039 | */ | 1039 | */ |
1040 | ring->effective_size = ring->size; | 1040 | ring->effective_size = ring->size; |
1041 | if (IS_I830(ring->dev)) | 1041 | if (IS_I830(ring->dev) || IS_845G(ring->dev)) |
1042 | ring->effective_size -= 128; | 1042 | ring->effective_size -= 128; |
1043 | 1043 | ||
1044 | return 0; | 1044 | return 0; |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index a464771a7240..e90dfb625c42 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -95,7 +95,6 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, | |||
95 | /* must disable */ | 95 | /* must disable */ |
96 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; | 96 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; |
97 | sprctl |= SPRITE_ENABLE; | 97 | sprctl |= SPRITE_ENABLE; |
98 | sprctl |= SPRITE_DEST_KEY; | ||
99 | 98 | ||
100 | /* Sizes are 0 based */ | 99 | /* Sizes are 0 based */ |
101 | src_w--; | 100 | src_w--; |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index e607c4d7dd98..2d39f9977e00 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -230,6 +230,10 @@ atombios_dvo_setup(struct drm_encoder *encoder, int action) | |||
230 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | 230 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | /* some R4xx chips have the wrong frev */ | ||
234 | if (rdev->family <= CHIP_RV410) | ||
235 | frev = 1; | ||
236 | |||
233 | switch (frev) { | 237 | switch (frev) { |
234 | case 1: | 238 | case 1: |
235 | switch (crev) { | 239 | switch (crev) { |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 81801c176aa5..fe33d35dae8c 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -2553,7 +2553,7 @@ static void r100_pll_errata_after_data(struct radeon_device *rdev) | |||
2553 | * or the chip could hang on a subsequent access | 2553 | * or the chip could hang on a subsequent access |
2554 | */ | 2554 | */ |
2555 | if (rdev->pll_errata & CHIP_ERRATA_PLL_DELAY) { | 2555 | if (rdev->pll_errata & CHIP_ERRATA_PLL_DELAY) { |
2556 | udelay(5000); | 2556 | mdelay(5); |
2557 | } | 2557 | } |
2558 | 2558 | ||
2559 | /* This function is required to workaround a hardware bug in some (all?) | 2559 | /* This function is required to workaround a hardware bug in some (all?) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 391bd2636a80..de71243b591f 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2839,7 +2839,7 @@ void r600_rlc_stop(struct radeon_device *rdev) | |||
2839 | /* r7xx asics need to soft reset RLC before halting */ | 2839 | /* r7xx asics need to soft reset RLC before halting */ |
2840 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_RLC); | 2840 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_RLC); |
2841 | RREG32(SRBM_SOFT_RESET); | 2841 | RREG32(SRBM_SOFT_RESET); |
2842 | udelay(15000); | 2842 | mdelay(15); |
2843 | WREG32(SRBM_SOFT_RESET, 0); | 2843 | WREG32(SRBM_SOFT_RESET, 0); |
2844 | RREG32(SRBM_SOFT_RESET); | 2844 | RREG32(SRBM_SOFT_RESET); |
2845 | } | 2845 | } |
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 84c546250955..75ed17c96115 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
@@ -407,7 +407,7 @@ static void r600_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
407 | 407 | ||
408 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 408 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
409 | RADEON_READ(R600_GRBM_SOFT_RESET); | 409 | RADEON_READ(R600_GRBM_SOFT_RESET); |
410 | DRM_UDELAY(15000); | 410 | mdelay(15); |
411 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 411 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
412 | 412 | ||
413 | fw_data = (const __be32 *)dev_priv->me_fw->data; | 413 | fw_data = (const __be32 *)dev_priv->me_fw->data; |
@@ -500,7 +500,7 @@ static void r700_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
500 | 500 | ||
501 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 501 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
502 | RADEON_READ(R600_GRBM_SOFT_RESET); | 502 | RADEON_READ(R600_GRBM_SOFT_RESET); |
503 | DRM_UDELAY(15000); | 503 | mdelay(15); |
504 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 504 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
505 | 505 | ||
506 | fw_data = (const __be32 *)dev_priv->pfp_fw->data; | 506 | fw_data = (const __be32 *)dev_priv->pfp_fw->data; |
@@ -1797,7 +1797,7 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev, | |||
1797 | 1797 | ||
1798 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 1798 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
1799 | RADEON_READ(R600_GRBM_SOFT_RESET); | 1799 | RADEON_READ(R600_GRBM_SOFT_RESET); |
1800 | DRM_UDELAY(15000); | 1800 | mdelay(15); |
1801 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 1801 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
1802 | 1802 | ||
1803 | 1803 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index 6ae0c75f016a..9c6b29a41927 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
@@ -633,7 +633,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
633 | tmp &= ~(R300_SCLK_FORCE_VAP); | 633 | tmp &= ~(R300_SCLK_FORCE_VAP); |
634 | tmp |= RADEON_SCLK_FORCE_CP; | 634 | tmp |= RADEON_SCLK_FORCE_CP; |
635 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); | 635 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); |
636 | udelay(15000); | 636 | mdelay(15); |
637 | 637 | ||
638 | tmp = RREG32_PLL(R300_SCLK_CNTL2); | 638 | tmp = RREG32_PLL(R300_SCLK_CNTL2); |
639 | tmp &= ~(R300_SCLK_FORCE_TCL | | 639 | tmp &= ~(R300_SCLK_FORCE_TCL | |
@@ -651,12 +651,12 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
651 | tmp |= (RADEON_ENGIN_DYNCLK_MODE | | 651 | tmp |= (RADEON_ENGIN_DYNCLK_MODE | |
652 | (0x01 << RADEON_ACTIVE_HILO_LAT_SHIFT)); | 652 | (0x01 << RADEON_ACTIVE_HILO_LAT_SHIFT)); |
653 | WREG32_PLL(RADEON_CLK_PWRMGT_CNTL, tmp); | 653 | WREG32_PLL(RADEON_CLK_PWRMGT_CNTL, tmp); |
654 | udelay(15000); | 654 | mdelay(15); |
655 | 655 | ||
656 | tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL); | 656 | tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL); |
657 | tmp |= RADEON_SCLK_DYN_START_CNTL; | 657 | tmp |= RADEON_SCLK_DYN_START_CNTL; |
658 | WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp); | 658 | WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp); |
659 | udelay(15000); | 659 | mdelay(15); |
660 | 660 | ||
661 | /* When DRI is enabled, setting DYN_STOP_LAT to zero can cause some R200 | 661 | /* When DRI is enabled, setting DYN_STOP_LAT to zero can cause some R200 |
662 | to lockup randomly, leave them as set by BIOS. | 662 | to lockup randomly, leave them as set by BIOS. |
@@ -696,7 +696,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
696 | tmp |= RADEON_SCLK_MORE_FORCEON; | 696 | tmp |= RADEON_SCLK_MORE_FORCEON; |
697 | } | 697 | } |
698 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); | 698 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); |
699 | udelay(15000); | 699 | mdelay(15); |
700 | } | 700 | } |
701 | 701 | ||
702 | /* RV200::A11 A12, RV250::A11 A12 */ | 702 | /* RV200::A11 A12, RV250::A11 A12 */ |
@@ -709,7 +709,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
709 | tmp |= RADEON_TCL_BYPASS_DISABLE; | 709 | tmp |= RADEON_TCL_BYPASS_DISABLE; |
710 | WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp); | 710 | WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp); |
711 | } | 711 | } |
712 | udelay(15000); | 712 | mdelay(15); |
713 | 713 | ||
714 | /*enable dynamic mode for display clocks (PIXCLK and PIX2CLK) */ | 714 | /*enable dynamic mode for display clocks (PIXCLK and PIX2CLK) */ |
715 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 715 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
@@ -722,14 +722,14 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
722 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); | 722 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); |
723 | 723 | ||
724 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 724 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
725 | udelay(15000); | 725 | mdelay(15); |
726 | 726 | ||
727 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); | 727 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); |
728 | tmp |= (RADEON_PIXCLK_ALWAYS_ONb | | 728 | tmp |= (RADEON_PIXCLK_ALWAYS_ONb | |
729 | RADEON_PIXCLK_DAC_ALWAYS_ONb); | 729 | RADEON_PIXCLK_DAC_ALWAYS_ONb); |
730 | 730 | ||
731 | WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp); | 731 | WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp); |
732 | udelay(15000); | 732 | mdelay(15); |
733 | } | 733 | } |
734 | } else { | 734 | } else { |
735 | /* Turn everything OFF (ForceON to everything) */ | 735 | /* Turn everything OFF (ForceON to everything) */ |
@@ -861,7 +861,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
861 | } | 861 | } |
862 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); | 862 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); |
863 | 863 | ||
864 | udelay(16000); | 864 | mdelay(16); |
865 | 865 | ||
866 | if ((rdev->family == CHIP_R300) || | 866 | if ((rdev->family == CHIP_R300) || |
867 | (rdev->family == CHIP_R350)) { | 867 | (rdev->family == CHIP_R350)) { |
@@ -870,7 +870,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
870 | R300_SCLK_FORCE_GA | | 870 | R300_SCLK_FORCE_GA | |
871 | R300_SCLK_FORCE_CBA); | 871 | R300_SCLK_FORCE_CBA); |
872 | WREG32_PLL(R300_SCLK_CNTL2, tmp); | 872 | WREG32_PLL(R300_SCLK_CNTL2, tmp); |
873 | udelay(16000); | 873 | mdelay(16); |
874 | } | 874 | } |
875 | 875 | ||
876 | if (rdev->flags & RADEON_IS_IGP) { | 876 | if (rdev->flags & RADEON_IS_IGP) { |
@@ -878,7 +878,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
878 | tmp &= ~(RADEON_FORCEON_MCLKA | | 878 | tmp &= ~(RADEON_FORCEON_MCLKA | |
879 | RADEON_FORCEON_YCLKA); | 879 | RADEON_FORCEON_YCLKA); |
880 | WREG32_PLL(RADEON_MCLK_CNTL, tmp); | 880 | WREG32_PLL(RADEON_MCLK_CNTL, tmp); |
881 | udelay(16000); | 881 | mdelay(16); |
882 | } | 882 | } |
883 | 883 | ||
884 | if ((rdev->family == CHIP_RV200) || | 884 | if ((rdev->family == CHIP_RV200) || |
@@ -887,7 +887,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
887 | tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL); | 887 | tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL); |
888 | tmp |= RADEON_SCLK_MORE_FORCEON; | 888 | tmp |= RADEON_SCLK_MORE_FORCEON; |
889 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); | 889 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); |
890 | udelay(16000); | 890 | mdelay(16); |
891 | } | 891 | } |
892 | 892 | ||
893 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 893 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
@@ -900,7 +900,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
900 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); | 900 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); |
901 | 901 | ||
902 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 902 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
903 | udelay(16000); | 903 | mdelay(16); |
904 | 904 | ||
905 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); | 905 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); |
906 | tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb | | 906 | tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb | |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 81fc100be7e1..2cad9fde92fc 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -2845,7 +2845,7 @@ bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder) | |||
2845 | case 4: | 2845 | case 4: |
2846 | val = RBIOS16(index); | 2846 | val = RBIOS16(index); |
2847 | index += 2; | 2847 | index += 2; |
2848 | udelay(val * 1000); | 2848 | mdelay(val); |
2849 | break; | 2849 | break; |
2850 | case 6: | 2850 | case 6: |
2851 | slave_addr = id & 0xff; | 2851 | slave_addr = id & 0xff; |
@@ -3044,7 +3044,7 @@ static void combios_parse_pll_table(struct drm_device *dev, uint16_t offset) | |||
3044 | udelay(150); | 3044 | udelay(150); |
3045 | break; | 3045 | break; |
3046 | case 2: | 3046 | case 2: |
3047 | udelay(1000); | 3047 | mdelay(1); |
3048 | break; | 3048 | break; |
3049 | case 3: | 3049 | case 3: |
3050 | while (tmp--) { | 3050 | while (tmp--) { |
@@ -3075,13 +3075,13 @@ static void combios_parse_pll_table(struct drm_device *dev, uint16_t offset) | |||
3075 | /*mclk_cntl |= 0x00001111;*//* ??? */ | 3075 | /*mclk_cntl |= 0x00001111;*//* ??? */ |
3076 | WREG32_PLL(RADEON_MCLK_CNTL, | 3076 | WREG32_PLL(RADEON_MCLK_CNTL, |
3077 | mclk_cntl); | 3077 | mclk_cntl); |
3078 | udelay(10000); | 3078 | mdelay(10); |
3079 | #endif | 3079 | #endif |
3080 | WREG32_PLL | 3080 | WREG32_PLL |
3081 | (RADEON_CLK_PWRMGT_CNTL, | 3081 | (RADEON_CLK_PWRMGT_CNTL, |
3082 | tmp & | 3082 | tmp & |
3083 | ~RADEON_CG_NO1_DEBUG_0); | 3083 | ~RADEON_CG_NO1_DEBUG_0); |
3084 | udelay(10000); | 3084 | mdelay(10); |
3085 | } | 3085 | } |
3086 | break; | 3086 | break; |
3087 | default: | 3087 | default: |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 85bcfc8923a7..3edec1c198e3 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -900,6 +900,10 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
900 | struct radeon_i2c_chan *i2c; | 900 | struct radeon_i2c_chan *i2c; |
901 | int ret; | 901 | int ret; |
902 | 902 | ||
903 | /* don't add the mm_i2c bus unless hw_i2c is enabled */ | ||
904 | if (rec->mm_i2c && (radeon_hw_i2c == 0)) | ||
905 | return NULL; | ||
906 | |||
903 | i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); | 907 | i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); |
904 | if (i2c == NULL) | 908 | if (i2c == NULL) |
905 | return NULL; | 909 | return NULL; |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 2f46e0c8df53..42db254f6bb0 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -88,7 +88,7 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
88 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); | 88 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); |
89 | lvds_pll_cntl |= RADEON_LVDS_PLL_EN; | 89 | lvds_pll_cntl |= RADEON_LVDS_PLL_EN; |
90 | WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); | 90 | WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); |
91 | udelay(1000); | 91 | mdelay(1); |
92 | 92 | ||
93 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); | 93 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); |
94 | lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET; | 94 | lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET; |
@@ -101,7 +101,7 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
101 | (backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT)); | 101 | (backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT)); |
102 | if (is_mac) | 102 | if (is_mac) |
103 | lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; | 103 | lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; |
104 | udelay(panel_pwr_delay * 1000); | 104 | mdelay(panel_pwr_delay); |
105 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 105 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
106 | break; | 106 | break; |
107 | case DRM_MODE_DPMS_STANDBY: | 107 | case DRM_MODE_DPMS_STANDBY: |
@@ -118,10 +118,10 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
118 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 118 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
119 | lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON); | 119 | lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON); |
120 | } | 120 | } |
121 | udelay(panel_pwr_delay * 1000); | 121 | mdelay(panel_pwr_delay); |
122 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 122 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
123 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); | 123 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); |
124 | udelay(panel_pwr_delay * 1000); | 124 | mdelay(panel_pwr_delay); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | 127 | ||
@@ -656,7 +656,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
656 | 656 | ||
657 | WREG32(RADEON_DAC_MACRO_CNTL, tmp); | 657 | WREG32(RADEON_DAC_MACRO_CNTL, tmp); |
658 | 658 | ||
659 | udelay(2000); | 659 | mdelay(2); |
660 | 660 | ||
661 | if (RREG32(RADEON_DAC_CNTL) & RADEON_DAC_CMP_OUTPUT) | 661 | if (RREG32(RADEON_DAC_CNTL) & RADEON_DAC_CMP_OUTPUT) |
662 | found = connector_status_connected; | 662 | found = connector_status_connected; |
@@ -1499,7 +1499,7 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1499 | tmp = dac_cntl2 | RADEON_DAC2_DAC2_CLK_SEL | RADEON_DAC2_CMP_EN; | 1499 | tmp = dac_cntl2 | RADEON_DAC2_DAC2_CLK_SEL | RADEON_DAC2_CMP_EN; |
1500 | WREG32(RADEON_DAC_CNTL2, tmp); | 1500 | WREG32(RADEON_DAC_CNTL2, tmp); |
1501 | 1501 | ||
1502 | udelay(10000); | 1502 | mdelay(10); |
1503 | 1503 | ||
1504 | if (ASIC_IS_R300(rdev)) { | 1504 | if (ASIC_IS_R300(rdev)) { |
1505 | if (RREG32(RADEON_DAC_CNTL2) & RADEON_DAC2_CMP_OUT_B) | 1505 | if (RREG32(RADEON_DAC_CNTL2) & RADEON_DAC2_CMP_OUT_B) |
diff --git a/drivers/gpu/drm/savage/savage_state.c b/drivers/gpu/drm/savage/savage_state.c index 031aaaf79ac2..b6d8608375cd 100644 --- a/drivers/gpu/drm/savage/savage_state.c +++ b/drivers/gpu/drm/savage/savage_state.c | |||
@@ -988,7 +988,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ | |||
988 | * for locking on FreeBSD. | 988 | * for locking on FreeBSD. |
989 | */ | 989 | */ |
990 | if (cmdbuf->size) { | 990 | if (cmdbuf->size) { |
991 | kcmd_addr = kmalloc(cmdbuf->size * 8, GFP_KERNEL); | 991 | kcmd_addr = kmalloc_array(cmdbuf->size, 8, GFP_KERNEL); |
992 | if (kcmd_addr == NULL) | 992 | if (kcmd_addr == NULL) |
993 | return -ENOMEM; | 993 | return -ENOMEM; |
994 | 994 | ||
@@ -1015,8 +1015,8 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ | |||
1015 | cmdbuf->vb_addr = kvb_addr; | 1015 | cmdbuf->vb_addr = kvb_addr; |
1016 | } | 1016 | } |
1017 | if (cmdbuf->nbox) { | 1017 | if (cmdbuf->nbox) { |
1018 | kbox_addr = kmalloc(cmdbuf->nbox * sizeof(struct drm_clip_rect), | 1018 | kbox_addr = kmalloc_array(cmdbuf->nbox, sizeof(struct drm_clip_rect), |
1019 | GFP_KERNEL); | 1019 | GFP_KERNEL); |
1020 | if (kbox_addr == NULL) { | 1020 | if (kbox_addr == NULL) { |
1021 | ret = -ENOMEM; | 1021 | ret = -ENOMEM; |
1022 | goto done; | 1022 | goto done; |
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 37f42113af31..00e8f213f56e 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c | |||
@@ -182,7 +182,6 @@ static int i2c_dw_pci_resume(struct device *dev) | |||
182 | pci_restore_state(pdev); | 182 | pci_restore_state(pdev); |
183 | 183 | ||
184 | i2c_dw_init(i2c); | 184 | i2c_dw_init(i2c); |
185 | i2c_dw_enable(i2c); | ||
186 | return 0; | 185 | return 0; |
187 | } | 186 | } |
188 | 187 | ||
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 83b720ef6c34..246fdc151652 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -179,7 +179,7 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
179 | { | 179 | { |
180 | struct ib_port_attr attr; | 180 | struct ib_port_attr attr; |
181 | char *speed = ""; | 181 | char *speed = ""; |
182 | int rate = -1; /* in deci-Gb/sec */ | 182 | int rate; /* in deci-Gb/sec */ |
183 | ssize_t ret; | 183 | ssize_t ret; |
184 | 184 | ||
185 | ret = ib_query_port(p->ibdev, p->port_num, &attr); | 185 | ret = ib_query_port(p->ibdev, p->port_num, &attr); |
@@ -187,9 +187,6 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
187 | return ret; | 187 | return ret; |
188 | 188 | ||
189 | switch (attr.active_speed) { | 189 | switch (attr.active_speed) { |
190 | case IB_SPEED_SDR: | ||
191 | rate = 25; | ||
192 | break; | ||
193 | case IB_SPEED_DDR: | 190 | case IB_SPEED_DDR: |
194 | speed = " DDR"; | 191 | speed = " DDR"; |
195 | rate = 50; | 192 | rate = 50; |
@@ -210,6 +207,10 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
210 | speed = " EDR"; | 207 | speed = " EDR"; |
211 | rate = 250; | 208 | rate = 250; |
212 | break; | 209 | break; |
210 | case IB_SPEED_SDR: | ||
211 | default: /* default to SDR for invalid rates */ | ||
212 | rate = 25; | ||
213 | break; | ||
213 | } | 214 | } |
214 | 215 | ||
215 | rate *= ib_width_enum_to_int(attr.active_width); | 216 | rate *= ib_width_enum_to_int(attr.active_width); |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 75d305629300..669673e81439 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -253,6 +253,11 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, | |||
253 | if (out_mad->data[15] & 0x1) | 253 | if (out_mad->data[15] & 0x1) |
254 | props->active_speed = IB_SPEED_FDR10; | 254 | props->active_speed = IB_SPEED_FDR10; |
255 | } | 255 | } |
256 | |||
257 | /* Avoid wrong speed value returned by FW if the IB link is down. */ | ||
258 | if (props->state == IB_PORT_DOWN) | ||
259 | props->active_speed = IB_SPEED_SDR; | ||
260 | |||
256 | out: | 261 | out: |
257 | kfree(in_mad); | 262 | kfree(in_mad); |
258 | kfree(out_mad); | 263 | kfree(out_mad); |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 69e2ad06e515..daf21b899999 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -3232,6 +3232,7 @@ static void srpt_add_one(struct ib_device *device) | |||
3232 | srq_attr.attr.max_wr = sdev->srq_size; | 3232 | srq_attr.attr.max_wr = sdev->srq_size; |
3233 | srq_attr.attr.max_sge = 1; | 3233 | srq_attr.attr.max_sge = 1; |
3234 | srq_attr.attr.srq_limit = 0; | 3234 | srq_attr.attr.srq_limit = 0; |
3235 | srq_attr.srq_type = IB_SRQT_BASIC; | ||
3235 | 3236 | ||
3236 | sdev->srq = ib_create_srq(sdev->pd, &srq_attr); | 3237 | sdev->srq = ib_create_srq(sdev->pd, &srq_attr); |
3237 | if (IS_ERR(sdev->srq)) | 3238 | if (IS_ERR(sdev->srq)) |
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c index 34aebb8cd080..3c843cd725fa 100644 --- a/drivers/input/misc/da9052_onkey.c +++ b/drivers/input/misc/da9052_onkey.c | |||
@@ -95,7 +95,8 @@ static int __devinit da9052_onkey_probe(struct platform_device *pdev) | |||
95 | input_dev = input_allocate_device(); | 95 | input_dev = input_allocate_device(); |
96 | if (!onkey || !input_dev) { | 96 | if (!onkey || !input_dev) { |
97 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | 97 | dev_err(&pdev->dev, "Failed to allocate memory\n"); |
98 | return -ENOMEM; | 98 | error = -ENOMEM; |
99 | goto err_free_mem; | ||
99 | } | 100 | } |
100 | 101 | ||
101 | onkey->input = input_dev; | 102 | onkey->input = input_dev; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index d2c0db159b18..479011004a11 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -486,7 +486,6 @@ static void elantech_input_sync_v4(struct psmouse *psmouse) | |||
486 | unsigned char *packet = psmouse->packet; | 486 | unsigned char *packet = psmouse->packet; |
487 | 487 | ||
488 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | 488 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); |
489 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | ||
490 | input_mt_report_pointer_emulation(dev, true); | 489 | input_mt_report_pointer_emulation(dev, true); |
491 | input_sync(dev); | 490 | input_sync(dev); |
492 | } | 491 | } |
@@ -967,6 +966,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
967 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) | 966 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) |
968 | return -1; | 967 | return -1; |
969 | 968 | ||
969 | __set_bit(INPUT_PROP_POINTER, dev->propbit); | ||
970 | __set_bit(EV_KEY, dev->evbit); | 970 | __set_bit(EV_KEY, dev->evbit); |
971 | __set_bit(EV_ABS, dev->evbit); | 971 | __set_bit(EV_ABS, dev->evbit); |
972 | __clear_bit(EV_REL, dev->evbit); | 972 | __clear_bit(EV_REL, dev->evbit); |
@@ -1017,7 +1017,9 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1017 | */ | 1017 | */ |
1018 | psmouse_warn(psmouse, "couldn't query resolution data.\n"); | 1018 | psmouse_warn(psmouse, "couldn't query resolution data.\n"); |
1019 | } | 1019 | } |
1020 | 1020 | /* v4 is clickpad, with only one button. */ | |
1021 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | ||
1022 | __clear_bit(BTN_RIGHT, dev->keybit); | ||
1021 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); | 1023 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); |
1022 | /* For X to recognize me as touchpad. */ | 1024 | /* For X to recognize me as touchpad. */ |
1023 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); | 1025 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); |
@@ -1245,6 +1247,8 @@ static void elantech_disconnect(struct psmouse *psmouse) | |||
1245 | */ | 1247 | */ |
1246 | static int elantech_reconnect(struct psmouse *psmouse) | 1248 | static int elantech_reconnect(struct psmouse *psmouse) |
1247 | { | 1249 | { |
1250 | psmouse_reset(psmouse); | ||
1251 | |||
1248 | if (elantech_detect(psmouse, 0)) | 1252 | if (elantech_detect(psmouse, 0)) |
1249 | return -1; | 1253 | return -1; |
1250 | 1254 | ||
@@ -1324,6 +1328,8 @@ int elantech_init(struct psmouse *psmouse) | |||
1324 | if (!etd) | 1328 | if (!etd) |
1325 | return -ENOMEM; | 1329 | return -ENOMEM; |
1326 | 1330 | ||
1331 | psmouse_reset(psmouse); | ||
1332 | |||
1327 | etd->parity[0] = 1; | 1333 | etd->parity[0] = 1; |
1328 | for (i = 1; i < 256; i++) | 1334 | for (i = 1; i < 256; i++) |
1329 | etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; | 1335 | etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; |
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index a9ad8e1402be..39fe9b737cae 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -12,9 +12,9 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/input-polldev.h> | 14 | #include <linux/input-polldev.h> |
15 | #include <linux/gpio.h> | ||
15 | #include <linux/gpio_mouse.h> | 16 | #include <linux/gpio_mouse.h> |
16 | 17 | ||
17 | #include <asm/gpio.h> | ||
18 | 18 | ||
19 | /* | 19 | /* |
20 | * Timer function which is run every scan_ms ms when the device is opened. | 20 | * Timer function which is run every scan_ms ms when the device is opened. |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index a977bfaa6821..661a0ca3b3d6 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -741,6 +741,14 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | |||
741 | } | 741 | } |
742 | } else { | 742 | } else { |
743 | /* SFAC packet */ | 743 | /* SFAC packet */ |
744 | if ((packet[0] & (FSP_PB0_LBTN|FSP_PB0_PHY_BTN)) == | ||
745 | FSP_PB0_LBTN) { | ||
746 | /* On-pad click in SFAC mode should be handled | ||
747 | * by userspace. On-pad clicks in MFMC mode | ||
748 | * are real clickpad clicks, and not ignored. | ||
749 | */ | ||
750 | packet[0] &= ~FSP_PB0_LBTN; | ||
751 | } | ||
744 | 752 | ||
745 | /* no multi-finger information */ | 753 | /* no multi-finger information */ |
746 | ad->last_mt_fgr = 0; | 754 | ad->last_mt_fgr = 0; |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 22b218018137..f3102494237d 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -304,7 +304,7 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
304 | return 0; | 304 | return 0; |
305 | 305 | ||
306 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { | 306 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { |
307 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); | 307 | psmouse_warn(psmouse, "failed to get extended button data\n"); |
308 | button_info = 0; | 308 | button_info = 0; |
309 | } | 309 | } |
310 | 310 | ||
@@ -326,16 +326,18 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
326 | 326 | ||
327 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); | 327 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
328 | if (error) { | 328 | if (error) { |
329 | printk(KERN_ERR | 329 | psmouse_err(psmouse, |
330 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", | 330 | "failed to create sysfs attributes, error: %d\n", |
331 | error); | 331 | error); |
332 | kfree(psmouse->private); | 332 | kfree(psmouse->private); |
333 | psmouse->private = NULL; | 333 | psmouse->private = NULL; |
334 | return -1; | 334 | return -1; |
335 | } | 335 | } |
336 | 336 | ||
337 | printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", | 337 | psmouse_info(psmouse, |
338 | firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); | 338 | "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", |
339 | firmware_id, | ||
340 | (button_info & 0xf0) >> 4, button_info & 0x0f); | ||
339 | 341 | ||
340 | return 0; | 342 | return 0; |
341 | } | 343 | } |
diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 6c6f6d8ea9b4..f7eda3d00fad 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/input/touchscreen/tps6507x_ts.c | ||
3 | * | ||
4 | * Touchscreen driver for the tps6507x chip. | 2 | * Touchscreen driver for the tps6507x chip. |
5 | * | 3 | * |
6 | * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com) | 4 | * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com) |
@@ -376,4 +374,4 @@ module_platform_driver(tps6507x_ts_driver); | |||
376 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); | 374 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); |
377 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); | 375 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); |
378 | MODULE_LICENSE("GPL v2"); | 376 | MODULE_LICENSE("GPL v2"); |
379 | MODULE_ALIAS("platform:tps6507x-tsc"); | 377 | MODULE_ALIAS("platform:tps6507x-ts"); |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index b3d6ac17272d..a6d9fd2858f7 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -176,7 +176,7 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
176 | struct cardstate *cs = tty->driver_data; | 176 | struct cardstate *cs = tty->driver_data; |
177 | 177 | ||
178 | if (!cs) { /* happens if we didn't find cs in open */ | 178 | if (!cs) { /* happens if we didn't find cs in open */ |
179 | printk(KERN_DEBUG "%s: no cardstate\n", __func__); | 179 | gig_dbg(DEBUG_IF, "%s: no cardstate", __func__); |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 3d0dfa7a89a2..97e73e555d11 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -539,9 +539,6 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) | |||
539 | bitmap->events_cleared = bitmap->mddev->events; | 539 | bitmap->events_cleared = bitmap->mddev->events; |
540 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); | 540 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); |
541 | 541 | ||
542 | bitmap->flags |= BITMAP_HOSTENDIAN; | ||
543 | sb->version = cpu_to_le32(BITMAP_MAJOR_HOSTENDIAN); | ||
544 | |||
545 | kunmap_atomic(sb); | 542 | kunmap_atomic(sb); |
546 | 543 | ||
547 | return 0; | 544 | return 0; |
@@ -1788,7 +1785,9 @@ int bitmap_load(struct mddev *mddev) | |||
1788 | * re-add of a missing device */ | 1785 | * re-add of a missing device */ |
1789 | start = mddev->recovery_cp; | 1786 | start = mddev->recovery_cp; |
1790 | 1787 | ||
1788 | mutex_lock(&mddev->bitmap_info.mutex); | ||
1791 | err = bitmap_init_from_disk(bitmap, start); | 1789 | err = bitmap_init_from_disk(bitmap, start); |
1790 | mutex_unlock(&mddev->bitmap_info.mutex); | ||
1792 | 1791 | ||
1793 | if (err) | 1792 | if (err) |
1794 | goto out; | 1793 | goto out; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d35e4c991e38..15dd59b84e94 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1712,6 +1712,7 @@ static int process_checks(struct r1bio *r1_bio) | |||
1712 | struct r1conf *conf = mddev->private; | 1712 | struct r1conf *conf = mddev->private; |
1713 | int primary; | 1713 | int primary; |
1714 | int i; | 1714 | int i; |
1715 | int vcnt; | ||
1715 | 1716 | ||
1716 | for (primary = 0; primary < conf->raid_disks * 2; primary++) | 1717 | for (primary = 0; primary < conf->raid_disks * 2; primary++) |
1717 | if (r1_bio->bios[primary]->bi_end_io == end_sync_read && | 1718 | if (r1_bio->bios[primary]->bi_end_io == end_sync_read && |
@@ -1721,9 +1722,9 @@ static int process_checks(struct r1bio *r1_bio) | |||
1721 | break; | 1722 | break; |
1722 | } | 1723 | } |
1723 | r1_bio->read_disk = primary; | 1724 | r1_bio->read_disk = primary; |
1725 | vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9); | ||
1724 | for (i = 0; i < conf->raid_disks * 2; i++) { | 1726 | for (i = 0; i < conf->raid_disks * 2; i++) { |
1725 | int j; | 1727 | int j; |
1726 | int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9); | ||
1727 | struct bio *pbio = r1_bio->bios[primary]; | 1728 | struct bio *pbio = r1_bio->bios[primary]; |
1728 | struct bio *sbio = r1_bio->bios[i]; | 1729 | struct bio *sbio = r1_bio->bios[i]; |
1729 | int size; | 1730 | int size; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index fff782189e48..c8dbb84d5357 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1788,6 +1788,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1788 | struct r10conf *conf = mddev->private; | 1788 | struct r10conf *conf = mddev->private; |
1789 | int i, first; | 1789 | int i, first; |
1790 | struct bio *tbio, *fbio; | 1790 | struct bio *tbio, *fbio; |
1791 | int vcnt; | ||
1791 | 1792 | ||
1792 | atomic_set(&r10_bio->remaining, 1); | 1793 | atomic_set(&r10_bio->remaining, 1); |
1793 | 1794 | ||
@@ -1802,10 +1803,10 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1802 | first = i; | 1803 | first = i; |
1803 | fbio = r10_bio->devs[i].bio; | 1804 | fbio = r10_bio->devs[i].bio; |
1804 | 1805 | ||
1806 | vcnt = (r10_bio->sectors + (PAGE_SIZE >> 9) - 1) >> (PAGE_SHIFT - 9); | ||
1805 | /* now find blocks with errors */ | 1807 | /* now find blocks with errors */ |
1806 | for (i=0 ; i < conf->copies ; i++) { | 1808 | for (i=0 ; i < conf->copies ; i++) { |
1807 | int j, d; | 1809 | int j, d; |
1808 | int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9); | ||
1809 | 1810 | ||
1810 | tbio = r10_bio->devs[i].bio; | 1811 | tbio = r10_bio->devs[i].bio; |
1811 | 1812 | ||
@@ -1871,7 +1872,6 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1871 | */ | 1872 | */ |
1872 | for (i = 0; i < conf->copies; i++) { | 1873 | for (i = 0; i < conf->copies; i++) { |
1873 | int j, d; | 1874 | int j, d; |
1874 | int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9); | ||
1875 | 1875 | ||
1876 | tbio = r10_bio->devs[i].repl_bio; | 1876 | tbio = r10_bio->devs[i].repl_bio; |
1877 | if (!tbio || !tbio->bi_end_io) | 1877 | if (!tbio || !tbio->bi_end_io) |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4555baa383b2..39696c6a4ed7 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -143,10 +143,12 @@ struct dvb_frontend_private { | |||
143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); | 143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); |
144 | static int dtv_get_frontend(struct dvb_frontend *fe, | 144 | static int dtv_get_frontend(struct dvb_frontend *fe, |
145 | struct dvb_frontend_parameters *p_out); | 145 | struct dvb_frontend_parameters *p_out); |
146 | static int dtv_property_legacy_params_sync(struct dvb_frontend *fe, | ||
147 | struct dvb_frontend_parameters *p); | ||
146 | 148 | ||
147 | static bool has_get_frontend(struct dvb_frontend *fe) | 149 | static bool has_get_frontend(struct dvb_frontend *fe) |
148 | { | 150 | { |
149 | return fe->ops.get_frontend; | 151 | return fe->ops.get_frontend != NULL; |
150 | } | 152 | } |
151 | 153 | ||
152 | /* | 154 | /* |
@@ -697,6 +699,7 @@ restart: | |||
697 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; | 699 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; |
698 | fepriv->delay = HZ / 2; | 700 | fepriv->delay = HZ / 2; |
699 | } | 701 | } |
702 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
700 | fe->ops.read_status(fe, &s); | 703 | fe->ops.read_status(fe, &s); |
701 | if (s != fepriv->status) { | 704 | if (s != fepriv->status) { |
702 | dvb_frontend_add_event(fe, s); /* update event list */ | 705 | dvb_frontend_add_event(fe, s); /* update event list */ |
@@ -1833,6 +1836,13 @@ static int dtv_set_frontend(struct dvb_frontend *fe) | |||
1833 | return -EINVAL; | 1836 | return -EINVAL; |
1834 | 1837 | ||
1835 | /* | 1838 | /* |
1839 | * Initialize output parameters to match the values given by | ||
1840 | * the user. FE_SET_FRONTEND triggers an initial frontend event | ||
1841 | * with status = 0, which copies output parameters to userspace. | ||
1842 | */ | ||
1843 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
1844 | |||
1845 | /* | ||
1836 | * Be sure that the bandwidth will be filled for all | 1846 | * Be sure that the bandwidth will be filled for all |
1837 | * non-satellite systems, as tuners need to know what | 1847 | * non-satellite systems, as tuners need to know what |
1838 | * low pass/Nyquist half filter should be applied, in | 1848 | * low pass/Nyquist half filter should be applied, in |
diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c index 3b7b102f20ae..482d249ca7f3 100644 --- a/drivers/media/dvb/dvb-usb/it913x.c +++ b/drivers/media/dvb/dvb-usb/it913x.c | |||
@@ -238,12 +238,27 @@ static int it913x_read_reg(struct usb_device *udev, u32 reg) | |||
238 | 238 | ||
239 | static u32 it913x_query(struct usb_device *udev, u8 pro) | 239 | static u32 it913x_query(struct usb_device *udev, u8 pro) |
240 | { | 240 | { |
241 | int ret; | 241 | int ret, i; |
242 | u8 data[4]; | 242 | u8 data[4]; |
243 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | 243 | u8 ver; |
244 | 0x1222, 0, &data[0], 3); | 244 | |
245 | for (i = 0; i < 5; i++) { | ||
246 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | ||
247 | 0x1222, 0, &data[0], 3); | ||
248 | ver = data[0]; | ||
249 | if (ver > 0 && ver < 3) | ||
250 | break; | ||
251 | msleep(100); | ||
252 | } | ||
245 | 253 | ||
246 | it913x_config.chip_ver = data[0]; | 254 | if (ver < 1 || ver > 2) { |
255 | info("Failed to identify chip version applying 1"); | ||
256 | it913x_config.chip_ver = 0x1; | ||
257 | it913x_config.chip_type = 0x9135; | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | it913x_config.chip_ver = ver; | ||
247 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; | 262 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; |
248 | 263 | ||
249 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, | 264 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, |
@@ -660,30 +675,41 @@ static int it913x_download_firmware(struct usb_device *udev, | |||
660 | if ((packet_size > min_pkt) || (i == fw->size)) { | 675 | if ((packet_size > min_pkt) || (i == fw->size)) { |
661 | fw_data = (u8 *)(fw->data + pos); | 676 | fw_data = (u8 *)(fw->data + pos); |
662 | pos += packet_size; | 677 | pos += packet_size; |
663 | if (packet_size > 0) | 678 | if (packet_size > 0) { |
664 | ret |= it913x_io(udev, WRITE_DATA, | 679 | ret = it913x_io(udev, WRITE_DATA, |
665 | DEV_0, CMD_SCATTER_WRITE, 0, | 680 | DEV_0, CMD_SCATTER_WRITE, 0, |
666 | 0, fw_data, packet_size); | 681 | 0, fw_data, packet_size); |
682 | if (ret < 0) | ||
683 | break; | ||
684 | } | ||
667 | udelay(1000); | 685 | udelay(1000); |
668 | } | 686 | } |
669 | } | 687 | } |
670 | i++; | 688 | i++; |
671 | } | 689 | } |
672 | 690 | ||
673 | ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
674 | |||
675 | msleep(100); | ||
676 | |||
677 | if (ret < 0) | 691 | if (ret < 0) |
678 | info("FRM Firmware Download Failed (%04x)" , ret); | 692 | info("FRM Firmware Download Failed (%d)" , ret); |
679 | else | 693 | else |
680 | info("FRM Firmware Download Completed - Resetting Device"); | 694 | info("FRM Firmware Download Completed - Resetting Device"); |
681 | 695 | ||
682 | ret |= it913x_return_status(udev); | 696 | msleep(30); |
697 | |||
698 | ret = it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
699 | if (ret < 0) | ||
700 | info("FRM Device not responding to reboot"); | ||
701 | |||
702 | ret = it913x_return_status(udev); | ||
703 | if (ret == 0) { | ||
704 | info("FRM Failed to reboot device"); | ||
705 | return -ENODEV; | ||
706 | } | ||
683 | 707 | ||
684 | msleep(30); | 708 | msleep(30); |
685 | 709 | ||
686 | ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); | 710 | ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); |
711 | |||
712 | msleep(30); | ||
687 | 713 | ||
688 | /* Tuner function */ | 714 | /* Tuner function */ |
689 | if (it913x_config.dual_mode) | 715 | if (it913x_config.dual_mode) |
@@ -901,5 +927,5 @@ module_usb_driver(it913x_driver); | |||
901 | 927 | ||
902 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); | 928 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); |
903 | MODULE_DESCRIPTION("it913x USB 2 Driver"); | 929 | MODULE_DESCRIPTION("it913x USB 2 Driver"); |
904 | MODULE_VERSION("1.27"); | 930 | MODULE_VERSION("1.28"); |
905 | MODULE_LICENSE("GPL"); | 931 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 5452beef8e11..989e556913ed 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1763,13 +1763,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); | 1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); |
1764 | if (iarg > AUDIO_STEREO_SWAPPED) | 1764 | if (iarg > AUDIO_STEREO_SWAPPED) |
1765 | return -EINVAL; | 1765 | return -EINVAL; |
1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg); | 1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg + 1); |
1767 | 1767 | ||
1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: | 1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: |
1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); | 1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); |
1770 | if (iarg > AUDIO_STEREO_SWAPPED) | 1770 | if (iarg > AUDIO_STEREO_SWAPPED) |
1771 | return -EINVAL; | 1771 | return -EINVAL; |
1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg); | 1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg + 1); |
1773 | 1773 | ||
1774 | default: | 1774 | default: |
1775 | return -EINVAL; | 1775 | return -EINVAL; |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 4a44f9a1bae0..b76b0ac0958f 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -468,22 +468,30 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, | |||
468 | spin_unlock_irqrestore(&stream->clock.lock, flags); | 468 | spin_unlock_irqrestore(&stream->clock.lock, flags); |
469 | } | 469 | } |
470 | 470 | ||
471 | static int uvc_video_clock_init(struct uvc_streaming *stream) | 471 | static void uvc_video_clock_reset(struct uvc_streaming *stream) |
472 | { | 472 | { |
473 | struct uvc_clock *clock = &stream->clock; | 473 | struct uvc_clock *clock = &stream->clock; |
474 | 474 | ||
475 | spin_lock_init(&clock->lock); | ||
476 | clock->head = 0; | 475 | clock->head = 0; |
477 | clock->count = 0; | 476 | clock->count = 0; |
478 | clock->size = 32; | ||
479 | clock->last_sof = -1; | 477 | clock->last_sof = -1; |
480 | clock->sof_offset = -1; | 478 | clock->sof_offset = -1; |
479 | } | ||
480 | |||
481 | static int uvc_video_clock_init(struct uvc_streaming *stream) | ||
482 | { | ||
483 | struct uvc_clock *clock = &stream->clock; | ||
484 | |||
485 | spin_lock_init(&clock->lock); | ||
486 | clock->size = 32; | ||
481 | 487 | ||
482 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), | 488 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), |
483 | GFP_KERNEL); | 489 | GFP_KERNEL); |
484 | if (clock->samples == NULL) | 490 | if (clock->samples == NULL) |
485 | return -ENOMEM; | 491 | return -ENOMEM; |
486 | 492 | ||
493 | uvc_video_clock_reset(stream); | ||
494 | |||
487 | return 0; | 495 | return 0; |
488 | } | 496 | } |
489 | 497 | ||
@@ -1424,8 +1432,6 @@ static void uvc_uninit_video(struct uvc_streaming *stream, int free_buffers) | |||
1424 | 1432 | ||
1425 | if (free_buffers) | 1433 | if (free_buffers) |
1426 | uvc_free_urb_buffers(stream); | 1434 | uvc_free_urb_buffers(stream); |
1427 | |||
1428 | uvc_video_clock_cleanup(stream); | ||
1429 | } | 1435 | } |
1430 | 1436 | ||
1431 | /* | 1437 | /* |
@@ -1555,10 +1561,6 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags) | |||
1555 | 1561 | ||
1556 | uvc_video_stats_start(stream); | 1562 | uvc_video_stats_start(stream); |
1557 | 1563 | ||
1558 | ret = uvc_video_clock_init(stream); | ||
1559 | if (ret < 0) | ||
1560 | return ret; | ||
1561 | |||
1562 | if (intf->num_altsetting > 1) { | 1564 | if (intf->num_altsetting > 1) { |
1563 | struct usb_host_endpoint *best_ep = NULL; | 1565 | struct usb_host_endpoint *best_ep = NULL; |
1564 | unsigned int best_psize = 3 * 1024; | 1566 | unsigned int best_psize = 3 * 1024; |
@@ -1683,6 +1685,8 @@ int uvc_video_resume(struct uvc_streaming *stream, int reset) | |||
1683 | 1685 | ||
1684 | stream->frozen = 0; | 1686 | stream->frozen = 0; |
1685 | 1687 | ||
1688 | uvc_video_clock_reset(stream); | ||
1689 | |||
1686 | ret = uvc_commit_video(stream, &stream->ctrl); | 1690 | ret = uvc_commit_video(stream, &stream->ctrl); |
1687 | if (ret < 0) { | 1691 | if (ret < 0) { |
1688 | uvc_queue_enable(&stream->queue, 0); | 1692 | uvc_queue_enable(&stream->queue, 0); |
@@ -1819,25 +1823,35 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable) | |||
1819 | uvc_uninit_video(stream, 1); | 1823 | uvc_uninit_video(stream, 1); |
1820 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1824 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); |
1821 | uvc_queue_enable(&stream->queue, 0); | 1825 | uvc_queue_enable(&stream->queue, 0); |
1826 | uvc_video_clock_cleanup(stream); | ||
1822 | return 0; | 1827 | return 0; |
1823 | } | 1828 | } |
1824 | 1829 | ||
1825 | ret = uvc_queue_enable(&stream->queue, 1); | 1830 | ret = uvc_video_clock_init(stream); |
1826 | if (ret < 0) | 1831 | if (ret < 0) |
1827 | return ret; | 1832 | return ret; |
1828 | 1833 | ||
1834 | ret = uvc_queue_enable(&stream->queue, 1); | ||
1835 | if (ret < 0) | ||
1836 | goto error_queue; | ||
1837 | |||
1829 | /* Commit the streaming parameters. */ | 1838 | /* Commit the streaming parameters. */ |
1830 | ret = uvc_commit_video(stream, &stream->ctrl); | 1839 | ret = uvc_commit_video(stream, &stream->ctrl); |
1831 | if (ret < 0) { | 1840 | if (ret < 0) |
1832 | uvc_queue_enable(&stream->queue, 0); | 1841 | goto error_commit; |
1833 | return ret; | ||
1834 | } | ||
1835 | 1842 | ||
1836 | ret = uvc_init_video(stream, GFP_KERNEL); | 1843 | ret = uvc_init_video(stream, GFP_KERNEL); |
1837 | if (ret < 0) { | 1844 | if (ret < 0) |
1838 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1845 | goto error_video; |
1839 | uvc_queue_enable(&stream->queue, 0); | 1846 | |
1840 | } | 1847 | return 0; |
1848 | |||
1849 | error_video: | ||
1850 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | ||
1851 | error_commit: | ||
1852 | uvc_queue_enable(&stream->queue, 0); | ||
1853 | error_queue: | ||
1854 | uvc_video_clock_cleanup(stream); | ||
1841 | 1855 | ||
1842 | return ret; | 1856 | return ret; |
1843 | } | 1857 | } |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 94eb05b1afdf..58fc65f5c817 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -106,16 +106,14 @@ static int mtdchar_open(struct inode *inode, struct file *file) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | if (mtd->type == MTD_ABSENT) { | 108 | if (mtd->type == MTD_ABSENT) { |
109 | put_mtd_device(mtd); | ||
110 | ret = -ENODEV; | 109 | ret = -ENODEV; |
111 | goto out; | 110 | goto out1; |
112 | } | 111 | } |
113 | 112 | ||
114 | mtd_ino = iget_locked(mnt->mnt_sb, devnum); | 113 | mtd_ino = iget_locked(mnt->mnt_sb, devnum); |
115 | if (!mtd_ino) { | 114 | if (!mtd_ino) { |
116 | put_mtd_device(mtd); | ||
117 | ret = -ENOMEM; | 115 | ret = -ENOMEM; |
118 | goto out; | 116 | goto out1; |
119 | } | 117 | } |
120 | if (mtd_ino->i_state & I_NEW) { | 118 | if (mtd_ino->i_state & I_NEW) { |
121 | mtd_ino->i_private = mtd; | 119 | mtd_ino->i_private = mtd; |
@@ -127,23 +125,25 @@ static int mtdchar_open(struct inode *inode, struct file *file) | |||
127 | 125 | ||
128 | /* You can't open it RW if it's not a writeable device */ | 126 | /* You can't open it RW if it's not a writeable device */ |
129 | if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { | 127 | if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { |
130 | iput(mtd_ino); | ||
131 | put_mtd_device(mtd); | ||
132 | ret = -EACCES; | 128 | ret = -EACCES; |
133 | goto out; | 129 | goto out2; |
134 | } | 130 | } |
135 | 131 | ||
136 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); | 132 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); |
137 | if (!mfi) { | 133 | if (!mfi) { |
138 | iput(mtd_ino); | ||
139 | put_mtd_device(mtd); | ||
140 | ret = -ENOMEM; | 134 | ret = -ENOMEM; |
141 | goto out; | 135 | goto out2; |
142 | } | 136 | } |
143 | mfi->ino = mtd_ino; | 137 | mfi->ino = mtd_ino; |
144 | mfi->mtd = mtd; | 138 | mfi->mtd = mtd; |
145 | file->private_data = mfi; | 139 | file->private_data = mfi; |
140 | mutex_unlock(&mtd_mutex); | ||
141 | return 0; | ||
146 | 142 | ||
143 | out2: | ||
144 | iput(mtd_ino); | ||
145 | out1: | ||
146 | put_mtd_device(mtd); | ||
147 | out: | 147 | out: |
148 | mutex_unlock(&mtd_mutex); | 148 | mutex_unlock(&mtd_mutex); |
149 | simple_release_fs(&mnt, &count); | 149 | simple_release_fs(&mnt, &count); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 215eb2536b1e..2504ab005589 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -118,15 +118,13 @@ void ath9k_ps_restore(struct ath_softc *sc) | |||
118 | if (--sc->ps_usecount != 0) | 118 | if (--sc->ps_usecount != 0) |
119 | goto unlock; | 119 | goto unlock; |
120 | 120 | ||
121 | if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) | 121 | if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK)) |
122 | goto unlock; | ||
123 | |||
124 | if (sc->ps_idle) | ||
125 | mode = ATH9K_PM_FULL_SLEEP; | 122 | mode = ATH9K_PM_FULL_SLEEP; |
126 | else if (sc->ps_enabled && | 123 | else if (sc->ps_enabled && |
127 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | | 124 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | |
128 | PS_WAIT_FOR_CAB | | 125 | PS_WAIT_FOR_CAB | |
129 | PS_WAIT_FOR_PSPOLL_DATA))) | 126 | PS_WAIT_FOR_PSPOLL_DATA | |
127 | PS_WAIT_FOR_TX_ACK))) | ||
130 | mode = ATH9K_PM_NETWORK_SLEEP; | 128 | mode = ATH9K_PM_NETWORK_SLEEP; |
131 | else | 129 | else |
132 | goto unlock; | 130 | goto unlock; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index fc9901e027c1..90cc5e772650 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1062,11 +1062,6 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1062 | 1062 | ||
1063 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); | 1063 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
1064 | 1064 | ||
1065 | /* | ||
1066 | * Register the extra components. | ||
1067 | */ | ||
1068 | rt2x00rfkill_register(rt2x00dev); | ||
1069 | |||
1070 | return 0; | 1065 | return 0; |
1071 | } | 1066 | } |
1072 | 1067 | ||
@@ -1210,6 +1205,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1210 | rt2x00link_register(rt2x00dev); | 1205 | rt2x00link_register(rt2x00dev); |
1211 | rt2x00leds_register(rt2x00dev); | 1206 | rt2x00leds_register(rt2x00dev); |
1212 | rt2x00debug_register(rt2x00dev); | 1207 | rt2x00debug_register(rt2x00dev); |
1208 | rt2x00rfkill_register(rt2x00dev); | ||
1213 | 1209 | ||
1214 | return 0; | 1210 | return 0; |
1215 | 1211 | ||
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 510023554e5f..e54488db0e10 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -838,7 +838,10 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw, | |||
838 | __le16 fc = hdr->frame_control; | 838 | __le16 fc = hdr->frame_control; |
839 | 839 | ||
840 | txrate = ieee80211_get_tx_rate(hw, info); | 840 | txrate = ieee80211_get_tx_rate(hw, info); |
841 | tcb_desc->hw_rate = txrate->hw_value; | 841 | if (txrate) |
842 | tcb_desc->hw_rate = txrate->hw_value; | ||
843 | else | ||
844 | tcb_desc->hw_rate = 0; | ||
842 | 845 | ||
843 | if (ieee80211_is_data(fc)) { | 846 | if (ieee80211_is_data(fc)) { |
844 | /* | 847 | /* |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 07dd38efe62a..288b035a3579 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -912,8 +912,13 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
912 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); | 912 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); |
913 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; | 913 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; |
914 | pskb = __skb_dequeue(&ring->queue); | 914 | pskb = __skb_dequeue(&ring->queue); |
915 | if (pskb) | 915 | if (pskb) { |
916 | struct rtl_tx_desc *entry = &ring->desc[ring->idx]; | ||
917 | pci_unmap_single(rtlpci->pdev, rtlpriv->cfg->ops->get_desc( | ||
918 | (u8 *) entry, true, HW_DESC_TXBUFF_ADDR), | ||
919 | pskb->len, PCI_DMA_TODEVICE); | ||
916 | kfree_skb(pskb); | 920 | kfree_skb(pskb); |
921 | } | ||
917 | 922 | ||
918 | /*NB: the beacon data buffer must be 32-bit aligned. */ | 923 | /*NB: the beacon data buffer must be 32-bit aligned. */ |
919 | pskb = ieee80211_beacon_get(hw, mac->vif); | 924 | pskb = ieee80211_beacon_get(hw, mac->vif); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c index 4898c502974d..480862c07f92 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c | |||
@@ -91,7 +91,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
91 | u8 tid; | 91 | u8 tid; |
92 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 92 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
94 | static int header_print; | ||
95 | 94 | ||
96 | rtlpriv->dm.dm_initialgain_enable = true; | 95 | rtlpriv->dm.dm_initialgain_enable = true; |
97 | rtlpriv->dm.dm_flag = 0; | 96 | rtlpriv->dm.dm_flag = 0; |
@@ -171,10 +170,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
171 | for (tid = 0; tid < 8; tid++) | 170 | for (tid = 0; tid < 8; tid++) |
172 | skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); | 171 | skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); |
173 | 172 | ||
174 | /* Only load firmware for first MAC */ | ||
175 | if (header_print) | ||
176 | return 0; | ||
177 | |||
178 | /* for firmware buf */ | 173 | /* for firmware buf */ |
179 | rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); | 174 | rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); |
180 | if (!rtlpriv->rtlhal.pfirmware) { | 175 | if (!rtlpriv->rtlhal.pfirmware) { |
@@ -186,7 +181,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
186 | rtlpriv->max_fw_size = 0x8000; | 181 | rtlpriv->max_fw_size = 0x8000; |
187 | pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); | 182 | pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); |
188 | pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); | 183 | pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); |
189 | header_print++; | ||
190 | 184 | ||
191 | /* request fw */ | 185 | /* request fw */ |
192 | err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, | 186 | err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 2e1e352864bb..d04dbda13f5a 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -124,46 +124,38 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, | |||
124 | return status; | 124 | return status; |
125 | } | 125 | } |
126 | 126 | ||
127 | static u32 _usb_read_sync(struct usb_device *udev, u32 addr, u16 len) | 127 | static u32 _usb_read_sync(struct rtl_priv *rtlpriv, u32 addr, u16 len) |
128 | { | 128 | { |
129 | struct device *dev = rtlpriv->io.dev; | ||
130 | struct usb_device *udev = to_usb_device(dev); | ||
129 | u8 request; | 131 | u8 request; |
130 | u16 wvalue; | 132 | u16 wvalue; |
131 | u16 index; | 133 | u16 index; |
132 | u32 *data; | 134 | __le32 *data = &rtlpriv->usb_data[rtlpriv->usb_data_index]; |
133 | u32 ret; | ||
134 | 135 | ||
135 | data = kmalloc(sizeof(u32), GFP_KERNEL); | ||
136 | if (!data) | ||
137 | return -ENOMEM; | ||
138 | request = REALTEK_USB_VENQT_CMD_REQ; | 136 | request = REALTEK_USB_VENQT_CMD_REQ; |
139 | index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ | 137 | index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ |
140 | 138 | ||
141 | wvalue = (u16)addr; | 139 | wvalue = (u16)addr; |
142 | _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); | 140 | _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); |
143 | ret = le32_to_cpu(*data); | 141 | if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT) |
144 | kfree(data); | 142 | rtlpriv->usb_data_index = 0; |
145 | return ret; | 143 | return le32_to_cpu(*data); |
146 | } | 144 | } |
147 | 145 | ||
148 | static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) | 146 | static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) |
149 | { | 147 | { |
150 | struct device *dev = rtlpriv->io.dev; | 148 | return (u8)_usb_read_sync(rtlpriv, addr, 1); |
151 | |||
152 | return (u8)_usb_read_sync(to_usb_device(dev), addr, 1); | ||
153 | } | 149 | } |
154 | 150 | ||
155 | static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) | 151 | static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) |
156 | { | 152 | { |
157 | struct device *dev = rtlpriv->io.dev; | 153 | return (u16)_usb_read_sync(rtlpriv, addr, 2); |
158 | |||
159 | return (u16)_usb_read_sync(to_usb_device(dev), addr, 2); | ||
160 | } | 154 | } |
161 | 155 | ||
162 | static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) | 156 | static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) |
163 | { | 157 | { |
164 | struct device *dev = rtlpriv->io.dev; | 158 | return _usb_read_sync(rtlpriv, addr, 4); |
165 | |||
166 | return _usb_read_sync(to_usb_device(dev), addr, 4); | ||
167 | } | 159 | } |
168 | 160 | ||
169 | static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, | 161 | static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, |
@@ -955,6 +947,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf, | |||
955 | return -ENOMEM; | 947 | return -ENOMEM; |
956 | } | 948 | } |
957 | rtlpriv = hw->priv; | 949 | rtlpriv = hw->priv; |
950 | rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), | ||
951 | GFP_KERNEL); | ||
952 | if (!rtlpriv->usb_data) | ||
953 | return -ENOMEM; | ||
954 | rtlpriv->usb_data_index = 0; | ||
958 | init_completion(&rtlpriv->firmware_loading_complete); | 955 | init_completion(&rtlpriv->firmware_loading_complete); |
959 | SET_IEEE80211_DEV(hw, &intf->dev); | 956 | SET_IEEE80211_DEV(hw, &intf->dev); |
960 | udev = interface_to_usbdev(intf); | 957 | udev = interface_to_usbdev(intf); |
@@ -1025,6 +1022,7 @@ void rtl_usb_disconnect(struct usb_interface *intf) | |||
1025 | /* rtl_deinit_rfkill(hw); */ | 1022 | /* rtl_deinit_rfkill(hw); */ |
1026 | rtl_usb_deinit(hw); | 1023 | rtl_usb_deinit(hw); |
1027 | rtl_deinit_core(hw); | 1024 | rtl_deinit_core(hw); |
1025 | kfree(rtlpriv->usb_data); | ||
1028 | rtlpriv->cfg->ops->deinit_sw_leds(hw); | 1026 | rtlpriv->cfg->ops->deinit_sw_leds(hw); |
1029 | rtlpriv->cfg->ops->deinit_sw_vars(hw); | 1027 | rtlpriv->cfg->ops->deinit_sw_vars(hw); |
1030 | _rtl_usb_io_handler_release(hw); | 1028 | _rtl_usb_io_handler_release(hw); |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index b591614c3b9b..28ebc69218a3 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -67,7 +67,7 @@ | |||
67 | #define QOS_QUEUE_NUM 4 | 67 | #define QOS_QUEUE_NUM 4 |
68 | #define RTL_MAC80211_NUM_QUEUE 5 | 68 | #define RTL_MAC80211_NUM_QUEUE 5 |
69 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 | 69 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 |
70 | 70 | #define RTL_USB_MAX_RX_COUNT 100 | |
71 | #define QBSS_LOAD_SIZE 5 | 71 | #define QBSS_LOAD_SIZE 5 |
72 | #define MAX_WMMELE_LENGTH 64 | 72 | #define MAX_WMMELE_LENGTH 64 |
73 | 73 | ||
@@ -1629,6 +1629,10 @@ struct rtl_priv { | |||
1629 | interface or hardware */ | 1629 | interface or hardware */ |
1630 | unsigned long status; | 1630 | unsigned long status; |
1631 | 1631 | ||
1632 | /* data buffer pointer for USB reads */ | ||
1633 | __le32 *usb_data; | ||
1634 | int usb_data_index; | ||
1635 | |||
1632 | /*This must be the last item so | 1636 | /*This must be the last item so |
1633 | that it points to the data allocated | 1637 | that it points to the data allocated |
1634 | beyond this structure like: | 1638 | beyond this structure like: |
diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c index bba81216b4db..bf984b6dc477 100644 --- a/drivers/of/gpio.c +++ b/drivers/of/gpio.c | |||
@@ -140,7 +140,7 @@ int of_gpio_simple_xlate(struct gpio_chip *gc, | |||
140 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) | 140 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) |
141 | return -EINVAL; | 141 | return -EINVAL; |
142 | 142 | ||
143 | if (gpiospec->args[0] > gc->ngpio) | 143 | if (gpiospec->args[0] >= gc->ngpio) |
144 | return -EINVAL; | 144 | return -EINVAL; |
145 | 145 | ||
146 | if (flags) | 146 | if (flags) |
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 53969af17558..81fd606e47bc 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -214,7 +214,7 @@ static struct of_device_id __devinitdata of_anatop_regulator_match_tbl[] = { | |||
214 | { /* end */ } | 214 | { /* end */ } |
215 | }; | 215 | }; |
216 | 216 | ||
217 | static struct platform_driver anatop_regulator = { | 217 | static struct platform_driver anatop_regulator_driver = { |
218 | .driver = { | 218 | .driver = { |
219 | .name = "anatop_regulator", | 219 | .name = "anatop_regulator", |
220 | .owner = THIS_MODULE, | 220 | .owner = THIS_MODULE, |
@@ -226,13 +226,13 @@ static struct platform_driver anatop_regulator = { | |||
226 | 226 | ||
227 | static int __init anatop_regulator_init(void) | 227 | static int __init anatop_regulator_init(void) |
228 | { | 228 | { |
229 | return platform_driver_register(&anatop_regulator); | 229 | return platform_driver_register(&anatop_regulator_driver); |
230 | } | 230 | } |
231 | postcore_initcall(anatop_regulator_init); | 231 | postcore_initcall(anatop_regulator_init); |
232 | 232 | ||
233 | static void __exit anatop_regulator_exit(void) | 233 | static void __exit anatop_regulator_exit(void) |
234 | { | 234 | { |
235 | platform_driver_unregister(&anatop_regulator); | 235 | platform_driver_unregister(&anatop_regulator_driver); |
236 | } | 236 | } |
237 | module_exit(anatop_regulator_exit); | 237 | module_exit(anatop_regulator_exit); |
238 | 238 | ||
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 550292304b0f..c9f890b088da 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c | |||
@@ -213,7 +213,6 @@ static struct platform_driver efi_rtc_driver = { | |||
213 | .name = "rtc-efi", | 213 | .name = "rtc-efi", |
214 | .owner = THIS_MODULE, | 214 | .owner = THIS_MODULE, |
215 | }, | 215 | }, |
216 | .probe = efi_rtc_probe, | ||
217 | .remove = __exit_p(efi_rtc_remove), | 216 | .remove = __exit_p(efi_rtc_remove), |
218 | }; | 217 | }; |
219 | 218 | ||
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 692de7360e94..684ef4bbfce4 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -339,8 +339,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
339 | dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision); | 339 | dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision); |
340 | 340 | ||
341 | /* Enable the clockwatch on ST Variants */ | 341 | /* Enable the clockwatch on ST Variants */ |
342 | if ((ldata->hw_designer == AMBA_VENDOR_ST) && | 342 | if (ldata->hw_designer == AMBA_VENDOR_ST) |
343 | (ldata->hw_revision > 1)) | ||
344 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | 343 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, |
345 | ldata->base + RTC_CR); | 344 | ldata->base + RTC_CR); |
346 | 345 | ||
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index 7f8e6c247935..33b6ba0afa0d 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
@@ -122,6 +122,7 @@ static const struct rtc_class_ops r9701_rtc_ops = { | |||
122 | static int __devinit r9701_probe(struct spi_device *spi) | 122 | static int __devinit r9701_probe(struct spi_device *spi) |
123 | { | 123 | { |
124 | struct rtc_device *rtc; | 124 | struct rtc_device *rtc; |
125 | struct rtc_time dt; | ||
125 | unsigned char tmp; | 126 | unsigned char tmp; |
126 | int res; | 127 | int res; |
127 | 128 | ||
@@ -132,6 +133,27 @@ static int __devinit r9701_probe(struct spi_device *spi) | |||
132 | return -ENODEV; | 133 | return -ENODEV; |
133 | } | 134 | } |
134 | 135 | ||
136 | /* | ||
137 | * The device seems to be present. Now check if the registers | ||
138 | * contain invalid values. If so, try to write a default date: | ||
139 | * 2000/1/1 00:00:00 | ||
140 | */ | ||
141 | r9701_get_datetime(&spi->dev, &dt); | ||
142 | if (rtc_valid_tm(&dt)) { | ||
143 | dev_info(&spi->dev, "trying to repair invalid date/time\n"); | ||
144 | dt.tm_sec = 0; | ||
145 | dt.tm_min = 0; | ||
146 | dt.tm_hour = 0; | ||
147 | dt.tm_mday = 1; | ||
148 | dt.tm_mon = 0; | ||
149 | dt.tm_year = 100; | ||
150 | |||
151 | if (r9701_set_datetime(&spi->dev, &dt)) { | ||
152 | dev_err(&spi->dev, "cannot repair RTC register\n"); | ||
153 | return -ENODEV; | ||
154 | } | ||
155 | } | ||
156 | |||
135 | rtc = rtc_device_register("r9701", | 157 | rtc = rtc_device_register("r9701", |
136 | &spi->dev, &r9701_rtc_ops, THIS_MODULE); | 158 | &spi->dev, &r9701_rtc_ops, THIS_MODULE); |
137 | if (IS_ERR(rtc)) | 159 | if (IS_ERR(rtc)) |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 9ccea134a996..3f3a29752369 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -40,6 +40,10 @@ enum s3c_cpu_type { | |||
40 | TYPE_S3C64XX, | 40 | TYPE_S3C64XX, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct s3c_rtc_drv_data { | ||
44 | int cpu_type; | ||
45 | }; | ||
46 | |||
43 | /* I have yet to find an S3C implementation with more than one | 47 | /* I have yet to find an S3C implementation with more than one |
44 | * of these rtc blocks in */ | 48 | * of these rtc blocks in */ |
45 | 49 | ||
@@ -446,10 +450,12 @@ static const struct of_device_id s3c_rtc_dt_match[]; | |||
446 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) | 450 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) |
447 | { | 451 | { |
448 | #ifdef CONFIG_OF | 452 | #ifdef CONFIG_OF |
453 | struct s3c_rtc_drv_data *data; | ||
449 | if (pdev->dev.of_node) { | 454 | if (pdev->dev.of_node) { |
450 | const struct of_device_id *match; | 455 | const struct of_device_id *match; |
451 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); | 456 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); |
452 | return match->data; | 457 | data = (struct s3c_rtc_drv_data *) match->data; |
458 | return data->cpu_type; | ||
453 | } | 459 | } |
454 | #endif | 460 | #endif |
455 | return platform_get_device_id(pdev)->driver_data; | 461 | return platform_get_device_id(pdev)->driver_data; |
@@ -664,20 +670,27 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
664 | #define s3c_rtc_resume NULL | 670 | #define s3c_rtc_resume NULL |
665 | #endif | 671 | #endif |
666 | 672 | ||
673 | static struct s3c_rtc_drv_data s3c_rtc_drv_data_array[] = { | ||
674 | [TYPE_S3C2410] = { TYPE_S3C2410 }, | ||
675 | [TYPE_S3C2416] = { TYPE_S3C2416 }, | ||
676 | [TYPE_S3C2443] = { TYPE_S3C2443 }, | ||
677 | [TYPE_S3C64XX] = { TYPE_S3C64XX }, | ||
678 | }; | ||
679 | |||
667 | #ifdef CONFIG_OF | 680 | #ifdef CONFIG_OF |
668 | static const struct of_device_id s3c_rtc_dt_match[] = { | 681 | static const struct of_device_id s3c_rtc_dt_match[] = { |
669 | { | 682 | { |
670 | .compatible = "samsung,s3c2410-rtc" | 683 | .compatible = "samsung,s3c2410-rtc", |
671 | .data = TYPE_S3C2410, | 684 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2410], |
672 | }, { | 685 | }, { |
673 | .compatible = "samsung,s3c2416-rtc" | 686 | .compatible = "samsung,s3c2416-rtc", |
674 | .data = TYPE_S3C2416, | 687 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2416], |
675 | }, { | 688 | }, { |
676 | .compatible = "samsung,s3c2443-rtc" | 689 | .compatible = "samsung,s3c2443-rtc", |
677 | .data = TYPE_S3C2443, | 690 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2443], |
678 | }, { | 691 | }, { |
679 | .compatible = "samsung,s3c6410-rtc" | 692 | .compatible = "samsung,s3c6410-rtc", |
680 | .data = TYPE_S3C64XX, | 693 | .data = &s3c_rtc_drv_data_array[TYPE_S3C64XX], |
681 | }, | 694 | }, |
682 | {}, | 695 | {}, |
683 | }; | 696 | }; |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 4c2c6df2a9ef..258abeabf624 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -112,6 +112,7 @@ static const u8 twl6030_rtc_reg_map[] = { | |||
112 | #define BIT_RTC_CTRL_REG_TEST_MODE_M 0x10 | 112 | #define BIT_RTC_CTRL_REG_TEST_MODE_M 0x10 |
113 | #define BIT_RTC_CTRL_REG_SET_32_COUNTER_M 0x20 | 113 | #define BIT_RTC_CTRL_REG_SET_32_COUNTER_M 0x20 |
114 | #define BIT_RTC_CTRL_REG_GET_TIME_M 0x40 | 114 | #define BIT_RTC_CTRL_REG_GET_TIME_M 0x40 |
115 | #define BIT_RTC_CTRL_REG_RTC_V_OPT 0x80 | ||
115 | 116 | ||
116 | /* RTC_STATUS_REG bitfields */ | 117 | /* RTC_STATUS_REG bitfields */ |
117 | #define BIT_RTC_STATUS_REG_RUN_M 0x02 | 118 | #define BIT_RTC_STATUS_REG_RUN_M 0x02 |
@@ -235,25 +236,57 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
235 | unsigned char rtc_data[ALL_TIME_REGS + 1]; | 236 | unsigned char rtc_data[ALL_TIME_REGS + 1]; |
236 | int ret; | 237 | int ret; |
237 | u8 save_control; | 238 | u8 save_control; |
239 | u8 rtc_control; | ||
238 | 240 | ||
239 | ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG); | 241 | ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG); |
240 | if (ret < 0) | 242 | if (ret < 0) { |
243 | dev_err(dev, "%s: reading CTRL_REG, error %d\n", __func__, ret); | ||
241 | return ret; | 244 | return ret; |
245 | } | ||
246 | /* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */ | ||
247 | if (twl_class_is_6030()) { | ||
248 | if (save_control & BIT_RTC_CTRL_REG_GET_TIME_M) { | ||
249 | save_control &= ~BIT_RTC_CTRL_REG_GET_TIME_M; | ||
250 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | ||
251 | if (ret < 0) { | ||
252 | dev_err(dev, "%s clr GET_TIME, error %d\n", | ||
253 | __func__, ret); | ||
254 | return ret; | ||
255 | } | ||
256 | } | ||
257 | } | ||
242 | 258 | ||
243 | save_control |= BIT_RTC_CTRL_REG_GET_TIME_M; | 259 | /* Copy RTC counting registers to static registers or latches */ |
260 | rtc_control = save_control | BIT_RTC_CTRL_REG_GET_TIME_M; | ||
244 | 261 | ||
245 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | 262 | /* for twl6030/32 enable read access to static shadowed registers */ |
246 | if (ret < 0) | 263 | if (twl_class_is_6030()) |
264 | rtc_control |= BIT_RTC_CTRL_REG_RTC_V_OPT; | ||
265 | |||
266 | ret = twl_rtc_write_u8(rtc_control, REG_RTC_CTRL_REG); | ||
267 | if (ret < 0) { | ||
268 | dev_err(dev, "%s: writing CTRL_REG, error %d\n", __func__, ret); | ||
247 | return ret; | 269 | return ret; |
270 | } | ||
248 | 271 | ||
249 | ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data, | 272 | ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data, |
250 | (rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS); | 273 | (rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS); |
251 | 274 | ||
252 | if (ret < 0) { | 275 | if (ret < 0) { |
253 | dev_err(dev, "rtc_read_time error %d\n", ret); | 276 | dev_err(dev, "%s: reading data, error %d\n", __func__, ret); |
254 | return ret; | 277 | return ret; |
255 | } | 278 | } |
256 | 279 | ||
280 | /* for twl6030 restore original state of rtc control register */ | ||
281 | if (twl_class_is_6030()) { | ||
282 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | ||
283 | if (ret < 0) { | ||
284 | dev_err(dev, "%s: restore CTRL_REG, error %d\n", | ||
285 | __func__, ret); | ||
286 | return ret; | ||
287 | } | ||
288 | } | ||
289 | |||
257 | tm->tm_sec = bcd2bin(rtc_data[0]); | 290 | tm->tm_sec = bcd2bin(rtc_data[0]); |
258 | tm->tm_min = bcd2bin(rtc_data[1]); | 291 | tm->tm_min = bcd2bin(rtc_data[1]); |
259 | tm->tm_hour = bcd2bin(rtc_data[2]); | 292 | tm->tm_hour = bcd2bin(rtc_data[2]); |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 31bfba805cf4..9b2901feaf78 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -653,7 +653,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
653 | dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n", | 653 | dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n", |
654 | rx_buf_count); | 654 | rx_buf_count); |
655 | if (t->tx_buf) | 655 | if (t->tx_buf) |
656 | dma_unmap_single(NULL, t->tx_dma, t->len, | 656 | dma_unmap_single(&spi->dev, t->tx_dma, t->len, |
657 | DMA_TO_DEVICE); | 657 | DMA_TO_DEVICE); |
658 | return -ENOMEM; | 658 | return -ENOMEM; |
659 | } | 659 | } |
@@ -692,10 +692,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
692 | if (spicfg->io_type == SPI_IO_TYPE_DMA) { | 692 | if (spicfg->io_type == SPI_IO_TYPE_DMA) { |
693 | 693 | ||
694 | if (t->tx_buf) | 694 | if (t->tx_buf) |
695 | dma_unmap_single(NULL, t->tx_dma, t->len, | 695 | dma_unmap_single(&spi->dev, t->tx_dma, t->len, |
696 | DMA_TO_DEVICE); | 696 | DMA_TO_DEVICE); |
697 | 697 | ||
698 | dma_unmap_single(NULL, t->rx_dma, rx_buf_count, | 698 | dma_unmap_single(&spi->dev, t->rx_dma, rx_buf_count, |
699 | DMA_FROM_DEVICE); | 699 | DMA_FROM_DEVICE); |
700 | 700 | ||
701 | clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); | 701 | clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 24cacff57786..5f748c0d96bd 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi) | |||
139 | static void fsl_spi_chipselect(struct spi_device *spi, int value) | 139 | static void fsl_spi_chipselect(struct spi_device *spi, int value) |
140 | { | 140 | { |
141 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 141 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
142 | struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data; | 142 | struct fsl_spi_platform_data *pdata; |
143 | bool pol = spi->mode & SPI_CS_HIGH; | 143 | bool pol = spi->mode & SPI_CS_HIGH; |
144 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 144 | struct spi_mpc8xxx_cs *cs = spi->controller_state; |
145 | 145 | ||
146 | pdata = spi->dev.parent->parent->platform_data; | ||
147 | |||
146 | if (value == BITBANG_CS_INACTIVE) { | 148 | if (value == BITBANG_CS_INACTIVE) { |
147 | if (pdata->cs_control) | 149 | if (pdata->cs_control) |
148 | pdata->cs_control(spi, !pol); | 150 | pdata->cs_control(spi, !pol); |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 31054e3de4c1..570f22053be8 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -83,7 +83,7 @@ struct spi_imx_data { | |||
83 | struct spi_bitbang bitbang; | 83 | struct spi_bitbang bitbang; |
84 | 84 | ||
85 | struct completion xfer_done; | 85 | struct completion xfer_done; |
86 | void *base; | 86 | void __iomem *base; |
87 | int irq; | 87 | int irq; |
88 | struct clk *clk; | 88 | struct clk *clk; |
89 | unsigned long spi_clk; | 89 | unsigned long spi_clk; |
@@ -766,8 +766,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
766 | } | 766 | } |
767 | 767 | ||
768 | ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); | 768 | ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); |
769 | if (ret < 0) | 769 | if (ret < 0) { |
770 | num_cs = mxc_platform_info->num_chipselect; | 770 | if (mxc_platform_info) |
771 | num_cs = mxc_platform_info->num_chipselect; | ||
772 | else | ||
773 | return ret; | ||
774 | } | ||
771 | 775 | ||
772 | master = spi_alloc_master(&pdev->dev, | 776 | master = spi_alloc_master(&pdev->dev, |
773 | sizeof(struct spi_imx_data) + sizeof(int) * num_cs); | 777 | sizeof(struct spi_imx_data) + sizeof(int) * num_cs); |
@@ -784,7 +788,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
784 | 788 | ||
785 | for (i = 0; i < master->num_chipselect; i++) { | 789 | for (i = 0; i < master->num_chipselect; i++) { |
786 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); | 790 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); |
787 | if (cs_gpio < 0) | 791 | if (cs_gpio < 0 && mxc_platform_info) |
788 | cs_gpio = mxc_platform_info->chipselect[i]; | 792 | cs_gpio = mxc_platform_info->chipselect[i]; |
789 | 793 | ||
790 | spi_imx->chipselect[i] = cs_gpio; | 794 | spi_imx->chipselect[i] = cs_gpio; |
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 08a3b1133d29..eb1dee26bda3 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig | |||
@@ -27,13 +27,14 @@ config ANDROID_LOGGER | |||
27 | 27 | ||
28 | config ANDROID_PERSISTENT_RAM | 28 | config ANDROID_PERSISTENT_RAM |
29 | bool | 29 | bool |
30 | depends on HAVE_MEMBLOCK | ||
30 | select REED_SOLOMON | 31 | select REED_SOLOMON |
31 | select REED_SOLOMON_ENC8 | 32 | select REED_SOLOMON_ENC8 |
32 | select REED_SOLOMON_DEC8 | 33 | select REED_SOLOMON_DEC8 |
33 | 34 | ||
34 | config ANDROID_RAM_CONSOLE | 35 | config ANDROID_RAM_CONSOLE |
35 | bool "Android RAM buffer console" | 36 | bool "Android RAM buffer console" |
36 | depends on !S390 && !UML | 37 | depends on !S390 && !UML && HAVE_MEMBLOCK |
37 | select ANDROID_PERSISTENT_RAM | 38 | select ANDROID_PERSISTENT_RAM |
38 | default n | 39 | default n |
39 | 40 | ||
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 052b43e4e505..b91e4bc332a7 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c | |||
@@ -55,7 +55,6 @@ static int lowmem_minfree[6] = { | |||
55 | }; | 55 | }; |
56 | static int lowmem_minfree_size = 4; | 56 | static int lowmem_minfree_size = 4; |
57 | 57 | ||
58 | static struct task_struct *lowmem_deathpending; | ||
59 | static unsigned long lowmem_deathpending_timeout; | 58 | static unsigned long lowmem_deathpending_timeout; |
60 | 59 | ||
61 | #define lowmem_print(level, x...) \ | 60 | #define lowmem_print(level, x...) \ |
@@ -64,24 +63,6 @@ static unsigned long lowmem_deathpending_timeout; | |||
64 | printk(x); \ | 63 | printk(x); \ |
65 | } while (0) | 64 | } while (0) |
66 | 65 | ||
67 | static int | ||
68 | task_notify_func(struct notifier_block *self, unsigned long val, void *data); | ||
69 | |||
70 | static struct notifier_block task_nb = { | ||
71 | .notifier_call = task_notify_func, | ||
72 | }; | ||
73 | |||
74 | static int | ||
75 | task_notify_func(struct notifier_block *self, unsigned long val, void *data) | ||
76 | { | ||
77 | struct task_struct *task = data; | ||
78 | |||
79 | if (task == lowmem_deathpending) | ||
80 | lowmem_deathpending = NULL; | ||
81 | |||
82 | return NOTIFY_OK; | ||
83 | } | ||
84 | |||
85 | static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | 66 | static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) |
86 | { | 67 | { |
87 | struct task_struct *tsk; | 68 | struct task_struct *tsk; |
@@ -97,19 +78,6 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
97 | int other_file = global_page_state(NR_FILE_PAGES) - | 78 | int other_file = global_page_state(NR_FILE_PAGES) - |
98 | global_page_state(NR_SHMEM); | 79 | global_page_state(NR_SHMEM); |
99 | 80 | ||
100 | /* | ||
101 | * If we already have a death outstanding, then | ||
102 | * bail out right away; indicating to vmscan | ||
103 | * that we have nothing further to offer on | ||
104 | * this pass. | ||
105 | * | ||
106 | * Note: Currently you need CONFIG_PROFILING | ||
107 | * for this to work correctly. | ||
108 | */ | ||
109 | if (lowmem_deathpending && | ||
110 | time_before_eq(jiffies, lowmem_deathpending_timeout)) | ||
111 | return 0; | ||
112 | |||
113 | if (lowmem_adj_size < array_size) | 81 | if (lowmem_adj_size < array_size) |
114 | array_size = lowmem_adj_size; | 82 | array_size = lowmem_adj_size; |
115 | if (lowmem_minfree_size < array_size) | 83 | if (lowmem_minfree_size < array_size) |
@@ -148,6 +116,12 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
148 | if (!p) | 116 | if (!p) |
149 | continue; | 117 | continue; |
150 | 118 | ||
119 | if (test_tsk_thread_flag(p, TIF_MEMDIE) && | ||
120 | time_before_eq(jiffies, lowmem_deathpending_timeout)) { | ||
121 | task_unlock(p); | ||
122 | rcu_read_unlock(); | ||
123 | return 0; | ||
124 | } | ||
151 | oom_score_adj = p->signal->oom_score_adj; | 125 | oom_score_adj = p->signal->oom_score_adj; |
152 | if (oom_score_adj < min_score_adj) { | 126 | if (oom_score_adj < min_score_adj) { |
153 | task_unlock(p); | 127 | task_unlock(p); |
@@ -174,15 +148,9 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
174 | lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", | 148 | lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", |
175 | selected->pid, selected->comm, | 149 | selected->pid, selected->comm, |
176 | selected_oom_score_adj, selected_tasksize); | 150 | selected_oom_score_adj, selected_tasksize); |
177 | /* | ||
178 | * If CONFIG_PROFILING is off, then we don't want to stall | ||
179 | * the killer by setting lowmem_deathpending. | ||
180 | */ | ||
181 | #ifdef CONFIG_PROFILING | ||
182 | lowmem_deathpending = selected; | ||
183 | lowmem_deathpending_timeout = jiffies + HZ; | 151 | lowmem_deathpending_timeout = jiffies + HZ; |
184 | #endif | ||
185 | send_sig(SIGKILL, selected, 0); | 152 | send_sig(SIGKILL, selected, 0); |
153 | set_tsk_thread_flag(selected, TIF_MEMDIE); | ||
186 | rem -= selected_tasksize; | 154 | rem -= selected_tasksize; |
187 | } | 155 | } |
188 | lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n", | 156 | lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n", |
@@ -198,7 +166,6 @@ static struct shrinker lowmem_shrinker = { | |||
198 | 166 | ||
199 | static int __init lowmem_init(void) | 167 | static int __init lowmem_init(void) |
200 | { | 168 | { |
201 | task_handoff_register(&task_nb); | ||
202 | register_shrinker(&lowmem_shrinker); | 169 | register_shrinker(&lowmem_shrinker); |
203 | return 0; | 170 | return 0; |
204 | } | 171 | } |
@@ -206,7 +173,6 @@ static int __init lowmem_init(void) | |||
206 | static void __exit lowmem_exit(void) | 173 | static void __exit lowmem_exit(void) |
207 | { | 174 | { |
208 | unregister_shrinker(&lowmem_shrinker); | 175 | unregister_shrinker(&lowmem_shrinker); |
209 | task_handoff_unregister(&task_nb); | ||
210 | } | 176 | } |
211 | 177 | ||
212 | module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); | 178 | module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); |
diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c index e08f2574e30a..8d8c1e33e0ff 100644 --- a/drivers/staging/android/persistent_ram.c +++ b/drivers/staging/android/persistent_ram.c | |||
@@ -399,12 +399,12 @@ static __init | |||
399 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | 399 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) |
400 | { | 400 | { |
401 | struct persistent_ram_zone *prz; | 401 | struct persistent_ram_zone *prz; |
402 | int ret; | 402 | int ret = -ENOMEM; |
403 | 403 | ||
404 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); | 404 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); |
405 | if (!prz) { | 405 | if (!prz) { |
406 | pr_err("persistent_ram: failed to allocate persistent ram zone\n"); | 406 | pr_err("persistent_ram: failed to allocate persistent ram zone\n"); |
407 | return ERR_PTR(-ENOMEM); | 407 | goto err; |
408 | } | 408 | } |
409 | 409 | ||
410 | INIT_LIST_HEAD(&prz->node); | 410 | INIT_LIST_HEAD(&prz->node); |
@@ -412,13 +412,13 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | |||
412 | ret = persistent_ram_buffer_init(dev_name(dev), prz); | 412 | ret = persistent_ram_buffer_init(dev_name(dev), prz); |
413 | if (ret) { | 413 | if (ret) { |
414 | pr_err("persistent_ram: failed to initialize buffer\n"); | 414 | pr_err("persistent_ram: failed to initialize buffer\n"); |
415 | return ERR_PTR(ret); | 415 | goto err; |
416 | } | 416 | } |
417 | 417 | ||
418 | prz->ecc = ecc; | 418 | prz->ecc = ecc; |
419 | ret = persistent_ram_init_ecc(prz, prz->buffer_size); | 419 | ret = persistent_ram_init_ecc(prz, prz->buffer_size); |
420 | if (ret) | 420 | if (ret) |
421 | return ERR_PTR(ret); | 421 | goto err; |
422 | 422 | ||
423 | if (prz->buffer->sig == PERSISTENT_RAM_SIG) { | 423 | if (prz->buffer->sig == PERSISTENT_RAM_SIG) { |
424 | if (buffer_size(prz) > prz->buffer_size || | 424 | if (buffer_size(prz) > prz->buffer_size || |
@@ -442,6 +442,9 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | |||
442 | atomic_set(&prz->buffer->size, 0); | 442 | atomic_set(&prz->buffer->size, 0); |
443 | 443 | ||
444 | return prz; | 444 | return prz; |
445 | err: | ||
446 | kfree(prz); | ||
447 | return ERR_PTR(ret); | ||
445 | } | 448 | } |
446 | 449 | ||
447 | struct persistent_ram_zone * __init | 450 | struct persistent_ram_zone * __init |
diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index bc723eff11af..45c522cbe784 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c | |||
@@ -85,7 +85,7 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
85 | struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; | 85 | struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; |
86 | struct timed_gpio *cur_gpio; | 86 | struct timed_gpio *cur_gpio; |
87 | struct timed_gpio_data *gpio_data, *gpio_dat; | 87 | struct timed_gpio_data *gpio_data, *gpio_dat; |
88 | int i, j, ret = 0; | 88 | int i, ret; |
89 | 89 | ||
90 | if (!pdata) | 90 | if (!pdata) |
91 | return -EBUSY; | 91 | return -EBUSY; |
@@ -108,18 +108,12 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
108 | gpio_dat->dev.get_time = gpio_get_time; | 108 | gpio_dat->dev.get_time = gpio_get_time; |
109 | gpio_dat->dev.enable = gpio_enable; | 109 | gpio_dat->dev.enable = gpio_enable; |
110 | ret = gpio_request(cur_gpio->gpio, cur_gpio->name); | 110 | ret = gpio_request(cur_gpio->gpio, cur_gpio->name); |
111 | if (ret >= 0) { | 111 | if (ret < 0) |
112 | ret = timed_output_dev_register(&gpio_dat->dev); | 112 | goto err_out; |
113 | if (ret < 0) | 113 | ret = timed_output_dev_register(&gpio_dat->dev); |
114 | gpio_free(cur_gpio->gpio); | ||
115 | } | ||
116 | if (ret < 0) { | 114 | if (ret < 0) { |
117 | for (j = 0; j < i; j++) { | 115 | gpio_free(cur_gpio->gpio); |
118 | timed_output_dev_unregister(&gpio_data[i].dev); | 116 | goto err_out; |
119 | gpio_free(gpio_data[i].gpio); | ||
120 | } | ||
121 | kfree(gpio_data); | ||
122 | return ret; | ||
123 | } | 117 | } |
124 | 118 | ||
125 | gpio_dat->gpio = cur_gpio->gpio; | 119 | gpio_dat->gpio = cur_gpio->gpio; |
@@ -131,6 +125,15 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
131 | platform_set_drvdata(pdev, gpio_data); | 125 | platform_set_drvdata(pdev, gpio_data); |
132 | 126 | ||
133 | return 0; | 127 | return 0; |
128 | |||
129 | err_out: | ||
130 | while (--i >= 0) { | ||
131 | timed_output_dev_unregister(&gpio_data[i].dev); | ||
132 | gpio_free(gpio_data[i].gpio); | ||
133 | } | ||
134 | kfree(gpio_data); | ||
135 | |||
136 | return ret; | ||
134 | } | 137 | } |
135 | 138 | ||
136 | static int timed_gpio_remove(struct platform_device *pdev) | 139 | static int timed_gpio_remove(struct platform_device *pdev) |
diff --git a/drivers/staging/iio/inkern.c b/drivers/staging/iio/inkern.c index de2c8ea64965..ef07a02bf542 100644 --- a/drivers/staging/iio/inkern.c +++ b/drivers/staging/iio/inkern.c | |||
@@ -82,6 +82,7 @@ int iio_map_array_unregister(struct iio_dev *indio_dev, | |||
82 | ret = -ENODEV; | 82 | ret = -ENODEV; |
83 | goto error_ret; | 83 | goto error_ret; |
84 | } | 84 | } |
85 | i++; | ||
85 | } | 86 | } |
86 | error_ret: | 87 | error_ret: |
87 | mutex_unlock(&iio_map_list_lock); | 88 | mutex_unlock(&iio_map_list_lock); |
diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index d5ddac3d8831..ebc2d0840caf 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c | |||
@@ -108,7 +108,8 @@ static const int ak8975_index_to_reg[] = { | |||
108 | static int ak8975_write_data(struct i2c_client *client, | 108 | static int ak8975_write_data(struct i2c_client *client, |
109 | u8 reg, u8 val, u8 mask, u8 shift) | 109 | u8 reg, u8 val, u8 mask, u8 shift) |
110 | { | 110 | { |
111 | struct ak8975_data *data = i2c_get_clientdata(client); | 111 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
112 | struct ak8975_data *data = iio_priv(indio_dev); | ||
112 | u8 regval; | 113 | u8 regval; |
113 | int ret; | 114 | int ret; |
114 | 115 | ||
@@ -159,7 +160,8 @@ static int ak8975_read_data(struct i2c_client *client, | |||
159 | */ | 160 | */ |
160 | static int ak8975_setup(struct i2c_client *client) | 161 | static int ak8975_setup(struct i2c_client *client) |
161 | { | 162 | { |
162 | struct ak8975_data *data = i2c_get_clientdata(client); | 163 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
164 | struct ak8975_data *data = iio_priv(indio_dev); | ||
163 | u8 device_id; | 165 | u8 device_id; |
164 | int ret; | 166 | int ret; |
165 | 167 | ||
@@ -509,6 +511,7 @@ static int ak8975_probe(struct i2c_client *client, | |||
509 | goto exit_gpio; | 511 | goto exit_gpio; |
510 | } | 512 | } |
511 | data = iio_priv(indio_dev); | 513 | data = iio_priv(indio_dev); |
514 | i2c_set_clientdata(client, indio_dev); | ||
512 | /* Perform some basic start-of-day setup of the device. */ | 515 | /* Perform some basic start-of-day setup of the device. */ |
513 | err = ak8975_setup(client); | 516 | err = ak8975_setup(client); |
514 | if (err < 0) { | 517 | if (err < 0) { |
@@ -516,7 +519,6 @@ static int ak8975_probe(struct i2c_client *client, | |||
516 | goto exit_free_iio; | 519 | goto exit_free_iio; |
517 | } | 520 | } |
518 | 521 | ||
519 | i2c_set_clientdata(client, indio_dev); | ||
520 | data->client = client; | 522 | data->client = client; |
521 | mutex_init(&data->lock); | 523 | mutex_init(&data->lock); |
522 | data->eoc_irq = client->irq; | 524 | data->eoc_irq = client->irq; |
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c index 91dd3da70cb4..e00b416c4d33 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.c +++ b/drivers/staging/iio/magnetometer/hmc5843.c | |||
@@ -521,7 +521,9 @@ static int hmc5843_detect(struct i2c_client *client, | |||
521 | /* Called when we have found a new HMC5843. */ | 521 | /* Called when we have found a new HMC5843. */ |
522 | static void hmc5843_init_client(struct i2c_client *client) | 522 | static void hmc5843_init_client(struct i2c_client *client) |
523 | { | 523 | { |
524 | struct hmc5843_data *data = i2c_get_clientdata(client); | 524 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
525 | struct hmc5843_data *data = iio_priv(indio_dev); | ||
526 | |||
525 | hmc5843_set_meas_conf(client, data->meas_conf); | 527 | hmc5843_set_meas_conf(client, data->meas_conf); |
526 | hmc5843_set_rate(client, data->rate); | 528 | hmc5843_set_rate(client, data->rate); |
527 | hmc5843_configure(client, data->operating_mode); | 529 | hmc5843_configure(client, data->operating_mode); |
diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c index 43ebc43e6b9a..1075fb1df0d9 100644 --- a/drivers/staging/media/as102/as102_fw.c +++ b/drivers/staging/media/as102/as102_fw.c | |||
@@ -165,7 +165,7 @@ error: | |||
165 | int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) | 165 | int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) |
166 | { | 166 | { |
167 | int errno = -EFAULT; | 167 | int errno = -EFAULT; |
168 | const struct firmware *firmware; | 168 | const struct firmware *firmware = NULL; |
169 | unsigned char *cmd_buf = NULL; | 169 | unsigned char *cmd_buf = NULL; |
170 | char *fw1, *fw2; | 170 | char *fw1, *fw2; |
171 | struct usb_device *dev = bus_adap->usb_dev; | 171 | struct usb_device *dev = bus_adap->usb_dev; |
diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c index 3df5b4c58ecd..620b8d54223d 100644 --- a/drivers/staging/omapdrm/omap_drv.c +++ b/drivers/staging/omapdrm/omap_drv.c | |||
@@ -803,9 +803,6 @@ static void pdev_shutdown(struct platform_device *device) | |||
803 | static int pdev_probe(struct platform_device *device) | 803 | static int pdev_probe(struct platform_device *device) |
804 | { | 804 | { |
805 | DBG("%s", device->name); | 805 | DBG("%s", device->name); |
806 | if (platform_driver_register(&omap_dmm_driver)) | ||
807 | dev_err(&device->dev, "DMM registration failed\n"); | ||
808 | |||
809 | return drm_platform_init(&omap_drm_driver, device); | 806 | return drm_platform_init(&omap_drm_driver, device); |
810 | } | 807 | } |
811 | 808 | ||
@@ -833,6 +830,10 @@ struct platform_driver pdev = { | |||
833 | static int __init omap_drm_init(void) | 830 | static int __init omap_drm_init(void) |
834 | { | 831 | { |
835 | DBG("init"); | 832 | DBG("init"); |
833 | if (platform_driver_register(&omap_dmm_driver)) { | ||
834 | /* we can continue on without DMM.. so not fatal */ | ||
835 | dev_err(NULL, "DMM registration failed\n"); | ||
836 | } | ||
836 | return platform_driver_register(&pdev); | 837 | return platform_driver_register(&pdev); |
837 | } | 838 | } |
838 | 839 | ||
diff --git a/drivers/staging/ozwpan/TODO b/drivers/staging/ozwpan/TODO index f7a9c122f596..c2d30a7112f3 100644 --- a/drivers/staging/ozwpan/TODO +++ b/drivers/staging/ozwpan/TODO | |||
@@ -8,5 +8,7 @@ TODO: | |||
8 | - code review by USB developer community. | 8 | - code review by USB developer community. |
9 | - testing with as many devices as possible. | 9 | - testing with as many devices as possible. |
10 | 10 | ||
11 | Please send any patches for this driver to Chris Kelly <ckelly@ozmodevices.com> | 11 | Please send any patches for this driver to |
12 | Rupesh Gujare <rgujare@ozmodevices.com> | ||
13 | Chris Kelly <ckelly@ozmodevices.com> | ||
12 | and Greg Kroah-Hartman <gregkh@linuxfoundation.org>. | 14 | and Greg Kroah-Hartman <gregkh@linuxfoundation.org>. |
diff --git a/drivers/staging/ramster/Kconfig b/drivers/staging/ramster/Kconfig index 8b57b87edda4..4af1f8d4b953 100644 --- a/drivers/staging/ramster/Kconfig +++ b/drivers/staging/ramster/Kconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # Dependency on CONFIG_BROKEN is because there is a commit dependency | ||
2 | # on a cleancache naming change to be submitted by Konrad Wilk | ||
3 | # a39c00ded70339603ffe1b0ffdf3ade85bcf009a "Merge branch 'stable/cleancache.v13' | ||
4 | # into linux-next. Once this commit is present, BROKEN can be removed | ||
5 | config RAMSTER | 1 | config RAMSTER |
6 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" | 2 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" |
7 | depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM && BROKEN | 3 | depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM |
8 | select LZO_COMPRESS | 4 | select LZO_COMPRESS |
9 | select LZO_DECOMPRESS | 5 | select LZO_DECOMPRESS |
10 | default n | 6 | default n |
diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c index 66341dff8c99..f9a4498984cc 100644 --- a/drivers/staging/rts_pstor/ms.c +++ b/drivers/staging/rts_pstor/ms.c | |||
@@ -3498,7 +3498,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 | |||
3498 | 3498 | ||
3499 | log_blk++; | 3499 | log_blk++; |
3500 | 3500 | ||
3501 | for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) { | 3501 | for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1; |
3502 | seg_no++) { | ||
3502 | if (log_blk < ms_start_idx[seg_no+1]) | 3503 | if (log_blk < ms_start_idx[seg_no+1]) |
3503 | break; | 3504 | break; |
3504 | } | 3505 | } |
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c index a7feb3e328a0..1dccd933a7e4 100644 --- a/drivers/staging/rts_pstor/rtsx.c +++ b/drivers/staging/rts_pstor/rtsx.c | |||
@@ -1000,6 +1000,11 @@ static int __devinit rtsx_probe(struct pci_dev *pci, | |||
1000 | 1000 | ||
1001 | rtsx_init_chip(dev->chip); | 1001 | rtsx_init_chip(dev->chip); |
1002 | 1002 | ||
1003 | /* set the supported max_lun and max_id for the scsi host | ||
1004 | * NOTE: the minimal value of max_id is 1 */ | ||
1005 | host->max_id = 1; | ||
1006 | host->max_lun = dev->chip->max_lun; | ||
1007 | |||
1003 | /* Start up our control thread */ | 1008 | /* Start up our control thread */ |
1004 | th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME); | 1009 | th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME); |
1005 | if (IS_ERR(th)) { | 1010 | if (IS_ERR(th)) { |
diff --git a/drivers/staging/rts_pstor/rtsx_transport.c b/drivers/staging/rts_pstor/rtsx_transport.c index 4e3d2c106af0..9b2e5c99870f 100644 --- a/drivers/staging/rts_pstor/rtsx_transport.c +++ b/drivers/staging/rts_pstor/rtsx_transport.c | |||
@@ -335,6 +335,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
335 | int sg_cnt, i, resid; | 335 | int sg_cnt, i, resid; |
336 | int err = 0; | 336 | int err = 0; |
337 | long timeleft; | 337 | long timeleft; |
338 | struct scatterlist *sg_ptr; | ||
338 | u32 val = TRIG_DMA; | 339 | u32 val = TRIG_DMA; |
339 | 340 | ||
340 | if ((sg == NULL) || (num_sg <= 0) || !offset || !index) | 341 | if ((sg == NULL) || (num_sg <= 0) || !offset || !index) |
@@ -371,7 +372,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
371 | sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); | 372 | sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); |
372 | 373 | ||
373 | resid = size; | 374 | resid = size; |
374 | 375 | sg_ptr = sg; | |
375 | chip->sgi = 0; | 376 | chip->sgi = 0; |
376 | /* Usually the next entry will be @sg@ + 1, but if this sg element | 377 | /* Usually the next entry will be @sg@ + 1, but if this sg element |
377 | * is part of a chained scatterlist, it could jump to the start of | 378 | * is part of a chained scatterlist, it could jump to the start of |
@@ -379,14 +380,14 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
379 | * the proper sg | 380 | * the proper sg |
380 | */ | 381 | */ |
381 | for (i = 0; i < *index; i++) | 382 | for (i = 0; i < *index; i++) |
382 | sg = sg_next(sg); | 383 | sg_ptr = sg_next(sg_ptr); |
383 | for (i = *index; i < sg_cnt; i++) { | 384 | for (i = *index; i < sg_cnt; i++) { |
384 | dma_addr_t addr; | 385 | dma_addr_t addr; |
385 | unsigned int len; | 386 | unsigned int len; |
386 | u8 option; | 387 | u8 option; |
387 | 388 | ||
388 | addr = sg_dma_address(sg); | 389 | addr = sg_dma_address(sg_ptr); |
389 | len = sg_dma_len(sg); | 390 | len = sg_dma_len(sg_ptr); |
390 | 391 | ||
391 | RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n", | 392 | RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n", |
392 | (unsigned int)addr, len); | 393 | (unsigned int)addr, len); |
@@ -415,7 +416,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
415 | if (!resid) | 416 | if (!resid) |
416 | break; | 417 | break; |
417 | 418 | ||
418 | sg = sg_next(sg); | 419 | sg_ptr = sg_next(sg_ptr); |
419 | } | 420 | } |
420 | 421 | ||
421 | RTSX_DEBUGP("SG table count = %d\n", chip->sgi); | 422 | RTSX_DEBUGP("SG table count = %d\n", chip->sgi); |
diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index ad54c2e5c932..f1701bc6e312 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c | |||
@@ -3114,7 +3114,7 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
3114 | current->pid); | 3114 | current->pid); |
3115 | if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET, | 3115 | if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET, |
3116 | &call_status->status)) { | 3116 | &call_status->status)) { |
3117 | dev_warn(&sep->pdev->dev, | 3117 | dev_dbg(&sep->pdev->dev, |
3118 | "[PID%d] dcb prep needed before send msg\n", | 3118 | "[PID%d] dcb prep needed before send msg\n", |
3119 | current->pid); | 3119 | current->pid); |
3120 | error = -EPROTO; | 3120 | error = -EPROTO; |
@@ -3122,9 +3122,9 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
3122 | } | 3122 | } |
3123 | 3123 | ||
3124 | if (!arg) { | 3124 | if (!arg) { |
3125 | dev_warn(&sep->pdev->dev, | 3125 | dev_dbg(&sep->pdev->dev, |
3126 | "[PID%d] dcb null arg\n", current->pid); | 3126 | "[PID%d] dcb null arg\n", current->pid); |
3127 | error = EINVAL; | 3127 | error = -EINVAL; |
3128 | goto end_function; | 3128 | goto end_function; |
3129 | } | 3129 | } |
3130 | 3130 | ||
diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 9fedc442a779..573c80003f0c 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c | |||
@@ -35,10 +35,10 @@ static int vector[PIO2_CARDS_MAX]; | |||
35 | static int vector_num; | 35 | static int vector_num; |
36 | static int level[PIO2_CARDS_MAX]; | 36 | static int level[PIO2_CARDS_MAX]; |
37 | static int level_num; | 37 | static int level_num; |
38 | static const char *variant[PIO2_CARDS_MAX]; | 38 | static char *variant[PIO2_CARDS_MAX]; |
39 | static int variant_num; | 39 | static int variant_num; |
40 | 40 | ||
41 | static int loopback; | 41 | static bool loopback; |
42 | 42 | ||
43 | static int pio2_match(struct vme_dev *); | 43 | static int pio2_match(struct vme_dev *); |
44 | static int __devinit pio2_probe(struct vme_dev *); | 44 | static int __devinit pio2_probe(struct vme_dev *); |
diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 0ff8d7bbf2a7..774b0d4a7e06 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c | |||
@@ -655,6 +655,9 @@ bool KeybSetDefaultKey ( | |||
655 | return (false); | 655 | return (false); |
656 | } | 656 | } |
657 | 657 | ||
658 | if (uKeyLength > MAX_KEY_LEN) | ||
659 | return false; | ||
660 | |||
658 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; | 661 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; |
659 | for(ii=0;ii<ETH_ALEN;ii++) | 662 | for(ii=0;ii<ETH_ALEN;ii++) |
660 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; | 663 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; |
diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c index 1463d76895f0..d59456c29df1 100644 --- a/drivers/staging/vt6656/ioctl.c +++ b/drivers/staging/vt6656/ioctl.c | |||
@@ -565,7 +565,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) | |||
565 | result = -ENOMEM; | 565 | result = -ENOMEM; |
566 | break; | 566 | break; |
567 | } | 567 | } |
568 | pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); | 568 | pNodeList = kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); |
569 | if (pNodeList == NULL) { | 569 | if (pNodeList == NULL) { |
570 | result = -ENOMEM; | 570 | result = -ENOMEM; |
571 | break; | 571 | break; |
@@ -601,6 +601,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) | |||
601 | } | 601 | } |
602 | } | 602 | } |
603 | if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { | 603 | if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { |
604 | kfree(pNodeList); | ||
604 | result = -EFAULT; | 605 | result = -EFAULT; |
605 | break; | 606 | break; |
606 | } | 607 | } |
diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 27bb523c8a97..ee62a06a75f4 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c | |||
@@ -684,6 +684,9 @@ BOOL KeybSetDefaultKey( | |||
684 | return (FALSE); | 684 | return (FALSE); |
685 | } | 685 | } |
686 | 686 | ||
687 | if (uKeyLength > MAX_KEY_LEN) | ||
688 | return false; | ||
689 | |||
687 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; | 690 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; |
688 | for (ii = 0; ii < ETH_ALEN; ii++) | 691 | for (ii = 0; ii < ETH_ALEN; ii++) |
689 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; | 692 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; |
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 94d5c35e22fb..3650bbff7686 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c | |||
@@ -61,7 +61,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension, | |||
61 | } | 61 | } |
62 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); | 62 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); |
63 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ | 63 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ |
64 | if ((temp & 0x88) == 0x80) | 64 | if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) |
65 | data = 0; /* DDR */ | 65 | data = 0; /* DDR */ |
66 | else | 66 | else |
67 | data = 1; /* DDRII */ | 67 | data = 1; /* DDRII */ |
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 2919924213c4..60d4adf99923 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c | |||
@@ -152,6 +152,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) | |||
152 | pVBInfo->pXGINew_CR97 = &XG20_CR97; | 152 | pVBInfo->pXGINew_CR97 = &XG20_CR97; |
153 | 153 | ||
154 | if (ChipType == XG27) { | 154 | if (ChipType == XG27) { |
155 | unsigned char temp; | ||
155 | pVBInfo->MCLKData | 156 | pVBInfo->MCLKData |
156 | = (struct SiS_MCLKData *) XGI27New_MCLKData; | 157 | = (struct SiS_MCLKData *) XGI27New_MCLKData; |
157 | pVBInfo->CR40 = XGI27_cr41; | 158 | pVBInfo->CR40 = XGI27_cr41; |
@@ -162,7 +163,13 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) | |||
162 | pVBInfo->pCRDE = XG27_CRDE; | 163 | pVBInfo->pCRDE = XG27_CRDE; |
163 | pVBInfo->pSR40 = &XG27_SR40; | 164 | pVBInfo->pSR40 = &XG27_SR40; |
164 | pVBInfo->pSR41 = &XG27_SR41; | 165 | pVBInfo->pSR41 = &XG27_SR41; |
166 | pVBInfo->SR15 = XG27_SR13; | ||
165 | 167 | ||
168 | /*Z11m DDR*/ | ||
169 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); | ||
170 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ | ||
171 | if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) | ||
172 | pVBInfo->pXGINew_CR97 = &Z11m_CR97; | ||
166 | } | 173 | } |
167 | 174 | ||
168 | if (ChipType >= XG20) { | 175 | if (ChipType >= XG20) { |
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index dddf261ed53d..e8d6f674b274 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h | |||
@@ -33,6 +33,13 @@ static struct XGI_ECLKDataStruct XGI340_ECLKData[] = { | |||
33 | {0x5c, 0x23, 0x01, 166} | 33 | {0x5c, 0x23, 0x01, 166} |
34 | }; | 34 | }; |
35 | 35 | ||
36 | static unsigned char XG27_SR13[4][8] = { | ||
37 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ | ||
38 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ | ||
39 | {0x32, 0x32, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR18 */ | ||
40 | {0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00} /* SR1B */ | ||
41 | }; | ||
42 | |||
36 | static unsigned char XGI340_SR13[4][8] = { | 43 | static unsigned char XGI340_SR13[4][8] = { |
37 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ | 44 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ |
38 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ | 45 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ |
@@ -71,7 +78,7 @@ static unsigned char XGI27_cr41[24][8] = { | |||
71 | {0x20, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0 CR41 */ | 78 | {0x20, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0 CR41 */ |
72 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 1 CR8A */ | 79 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 1 CR8A */ |
73 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 2 CR8B */ | 80 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 2 CR8B */ |
74 | {0xB5, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7], | 81 | {0xB3, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7], |
75 | CR99[2:0], | 82 | CR99[2:0], |
76 | CR45[3:0]*/ | 83 | CR45[3:0]*/ |
77 | {0xf0, 0xf5, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 4 CR59 */ | 84 | {0xf0, 0xf5, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 4 CR59 */ |
@@ -2803,6 +2810,8 @@ static unsigned char XG27_CRDE[2]; | |||
2803 | static unsigned char XG27_SR40 = 0x04 ; | 2810 | static unsigned char XG27_SR40 = 0x04 ; |
2804 | static unsigned char XG27_SR41 = 0x00 ; | 2811 | static unsigned char XG27_SR41 = 0x00 ; |
2805 | 2812 | ||
2813 | static unsigned char Z11m_CR97 = 0x80 ; | ||
2814 | |||
2806 | static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { | 2815 | static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { |
2807 | /* SR2B,SR2C,SR2D */ | 2816 | /* SR2B,SR2C,SR2D */ |
2808 | {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ | 2817 | {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ |
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 09caa4f2687e..917461c66014 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c | |||
@@ -267,33 +267,39 @@ static unsigned long obj_idx_to_offset(struct page *page, | |||
267 | return off + obj_idx * class_size; | 267 | return off + obj_idx * class_size; |
268 | } | 268 | } |
269 | 269 | ||
270 | static void reset_page(struct page *page) | ||
271 | { | ||
272 | clear_bit(PG_private, &page->flags); | ||
273 | clear_bit(PG_private_2, &page->flags); | ||
274 | set_page_private(page, 0); | ||
275 | page->mapping = NULL; | ||
276 | page->freelist = NULL; | ||
277 | reset_page_mapcount(page); | ||
278 | } | ||
279 | |||
270 | static void free_zspage(struct page *first_page) | 280 | static void free_zspage(struct page *first_page) |
271 | { | 281 | { |
272 | struct page *nextp, *tmp; | 282 | struct page *nextp, *tmp, *head_extra; |
273 | 283 | ||
274 | BUG_ON(!is_first_page(first_page)); | 284 | BUG_ON(!is_first_page(first_page)); |
275 | BUG_ON(first_page->inuse); | 285 | BUG_ON(first_page->inuse); |
276 | 286 | ||
277 | nextp = (struct page *)page_private(first_page); | 287 | head_extra = (struct page *)page_private(first_page); |
278 | 288 | ||
279 | clear_bit(PG_private, &first_page->flags); | 289 | reset_page(first_page); |
280 | clear_bit(PG_private_2, &first_page->flags); | ||
281 | set_page_private(first_page, 0); | ||
282 | first_page->mapping = NULL; | ||
283 | first_page->freelist = NULL; | ||
284 | reset_page_mapcount(first_page); | ||
285 | __free_page(first_page); | 290 | __free_page(first_page); |
286 | 291 | ||
287 | /* zspage with only 1 system page */ | 292 | /* zspage with only 1 system page */ |
288 | if (!nextp) | 293 | if (!head_extra) |
289 | return; | 294 | return; |
290 | 295 | ||
291 | list_for_each_entry_safe(nextp, tmp, &nextp->lru, lru) { | 296 | list_for_each_entry_safe(nextp, tmp, &head_extra->lru, lru) { |
292 | list_del(&nextp->lru); | 297 | list_del(&nextp->lru); |
293 | clear_bit(PG_private_2, &nextp->flags); | 298 | reset_page(nextp); |
294 | nextp->index = 0; | ||
295 | __free_page(nextp); | 299 | __free_page(nextp); |
296 | } | 300 | } |
301 | reset_page(head_extra); | ||
302 | __free_page(head_extra); | ||
297 | } | 303 | } |
298 | 304 | ||
299 | /* Initialize a newly allocated zspage */ | 305 | /* Initialize a newly allocated zspage */ |
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 5b149b466ec8..5c27f7e6c9f1 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
@@ -1572,13 +1572,11 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id) | |||
1572 | do { | 1572 | do { |
1573 | struct uart_8250_port *up; | 1573 | struct uart_8250_port *up; |
1574 | struct uart_port *port; | 1574 | struct uart_port *port; |
1575 | bool skip; | ||
1576 | 1575 | ||
1577 | up = list_entry(l, struct uart_8250_port, list); | 1576 | up = list_entry(l, struct uart_8250_port, list); |
1578 | port = &up->port; | 1577 | port = &up->port; |
1579 | skip = pass_counter && up->port.flags & UPF_IIR_ONCE; | ||
1580 | 1578 | ||
1581 | if (!skip && port->handle_irq(port)) { | 1579 | if (port->handle_irq(port)) { |
1582 | handled = 1; | 1580 | handled = 1; |
1583 | end = NULL; | 1581 | end = NULL; |
1584 | } else if (end == NULL) | 1582 | } else if (end == NULL) |
@@ -2037,10 +2035,12 @@ static int serial8250_startup(struct uart_port *port) | |||
2037 | spin_unlock_irqrestore(&port->lock, flags); | 2035 | spin_unlock_irqrestore(&port->lock, flags); |
2038 | 2036 | ||
2039 | /* | 2037 | /* |
2040 | * If the interrupt is not reasserted, setup a timer to | 2038 | * If the interrupt is not reasserted, or we otherwise |
2041 | * kick the UART on a regular basis. | 2039 | * don't trust the iir, setup a timer to kick the UART |
2040 | * on a regular basis. | ||
2042 | */ | 2041 | */ |
2043 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { | 2042 | if ((!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) || |
2043 | up->port.flags & UPF_BUG_THRE) { | ||
2044 | up->bugs |= UART_BUG_THRE; | 2044 | up->bugs |= UART_BUG_THRE; |
2045 | pr_debug("ttyS%d - using backup timer\n", | 2045 | pr_debug("ttyS%d - using backup timer\n", |
2046 | serial_index(port)); | 2046 | serial_index(port)); |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index da2b0b0a183f..858dca865d6a 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -1096,7 +1096,7 @@ static int kt_serial_setup(struct serial_private *priv, | |||
1096 | const struct pciserial_board *board, | 1096 | const struct pciserial_board *board, |
1097 | struct uart_port *port, int idx) | 1097 | struct uart_port *port, int idx) |
1098 | { | 1098 | { |
1099 | port->flags |= UPF_IIR_ONCE; | 1099 | port->flags |= UPF_BUG_THRE; |
1100 | return skip_tx_en_setup(priv, board, port, idx); | 1100 | return skip_tx_en_setup(priv, board, port, idx); |
1101 | } | 1101 | } |
1102 | 1102 | ||
@@ -1118,18 +1118,6 @@ pci_xr17c154_setup(struct serial_private *priv, | |||
1118 | return pci_default_setup(priv, board, port, idx); | 1118 | return pci_default_setup(priv, board, port, idx); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | static int try_enable_msi(struct pci_dev *dev) | ||
1122 | { | ||
1123 | /* use msi if available, but fallback to legacy otherwise */ | ||
1124 | pci_enable_msi(dev); | ||
1125 | return 0; | ||
1126 | } | ||
1127 | |||
1128 | static void disable_msi(struct pci_dev *dev) | ||
1129 | { | ||
1130 | pci_disable_msi(dev); | ||
1131 | } | ||
1132 | |||
1133 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B | 1121 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B |
1134 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B | 1122 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B |
1135 | #define PCI_DEVICE_ID_OCTPRO 0x0001 | 1123 | #define PCI_DEVICE_ID_OCTPRO 0x0001 |
@@ -1249,9 +1237,7 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
1249 | .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT, | 1237 | .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT, |
1250 | .subvendor = PCI_ANY_ID, | 1238 | .subvendor = PCI_ANY_ID, |
1251 | .subdevice = PCI_ANY_ID, | 1239 | .subdevice = PCI_ANY_ID, |
1252 | .init = try_enable_msi, | ||
1253 | .setup = kt_serial_setup, | 1240 | .setup = kt_serial_setup, |
1254 | .exit = disable_msi, | ||
1255 | }, | 1241 | }, |
1256 | /* | 1242 | /* |
1257 | * ITE | 1243 | * ITE |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 665beb68f670..070b442c1f81 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1041,7 +1041,7 @@ config SERIAL_OMAP | |||
1041 | 1041 | ||
1042 | config SERIAL_OMAP_CONSOLE | 1042 | config SERIAL_OMAP_CONSOLE |
1043 | bool "Console on OMAP serial port" | 1043 | bool "Console on OMAP serial port" |
1044 | depends on SERIAL_OMAP | 1044 | depends on SERIAL_OMAP=y |
1045 | select SERIAL_CORE_CONSOLE | 1045 | select SERIAL_CORE_CONSOLE |
1046 | help | 1046 | help |
1047 | Select this option if you would like to use omap serial port as | 1047 | Select this option if you would like to use omap serial port as |
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index e7903751e058..1f0330915d5a 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -556,7 +556,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
557 | if (res_mem) | 557 | if (res_mem) |
558 | port->mapbase = res_mem->start; | 558 | port->mapbase = res_mem->start; |
559 | else if (platp->mapbase) | 559 | else if (platp) |
560 | port->mapbase = platp->mapbase; | 560 | port->mapbase = platp->mapbase; |
561 | else | 561 | else |
562 | return -EINVAL; | 562 | return -EINVAL; |
@@ -564,7 +564,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
565 | if (res_irq) | 565 | if (res_irq) |
566 | port->irq = res_irq->start; | 566 | port->irq = res_irq->start; |
567 | else if (platp->irq) | 567 | else if (platp) |
568 | port->irq = platp->irq; | 568 | port->irq = platp->irq; |
569 | 569 | ||
570 | /* Check platform data first so we can override device node data */ | 570 | /* Check platform data first so we can override device node data */ |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 0c65c9e66986..3d569cd68f58 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -1946,10 +1946,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1946 | goto unmap; | 1946 | goto unmap; |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | /* Ensure interrupts from this UART are masked and cleared */ | ||
1950 | writew(0, uap->port.membase + UART011_IMSC); | ||
1951 | writew(0xffff, uap->port.membase + UART011_ICR); | ||
1952 | |||
1953 | uap->vendor = vendor; | 1949 | uap->vendor = vendor; |
1954 | uap->lcrh_rx = vendor->lcrh_rx; | 1950 | uap->lcrh_rx = vendor->lcrh_rx; |
1955 | uap->lcrh_tx = vendor->lcrh_tx; | 1951 | uap->lcrh_tx = vendor->lcrh_tx; |
@@ -1967,6 +1963,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1967 | uap->port.line = i; | 1963 | uap->port.line = i; |
1968 | pl011_dma_probe(uap); | 1964 | pl011_dma_probe(uap); |
1969 | 1965 | ||
1966 | /* Ensure interrupts from this UART are masked and cleared */ | ||
1967 | writew(0, uap->port.membase + UART011_IMSC); | ||
1968 | writew(0xffff, uap->port.membase + UART011_ICR); | ||
1969 | |||
1970 | snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); | 1970 | snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); |
1971 | 1971 | ||
1972 | amba_ports[i] = uap; | 1972 | amba_ports[i] = uap; |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index f9a6be7a9bed..3d7e1ee2fa57 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -389,6 +389,8 @@ static void atmel_start_rx(struct uart_port *port) | |||
389 | { | 389 | { |
390 | UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ | 390 | UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ |
391 | 391 | ||
392 | UART_PUT_CR(port, ATMEL_US_RXEN); | ||
393 | |||
392 | if (atmel_use_dma_rx(port)) { | 394 | if (atmel_use_dma_rx(port)) { |
393 | /* enable PDC controller */ | 395 | /* enable PDC controller */ |
394 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | | 396 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | |
@@ -404,6 +406,8 @@ static void atmel_start_rx(struct uart_port *port) | |||
404 | */ | 406 | */ |
405 | static void atmel_stop_rx(struct uart_port *port) | 407 | static void atmel_stop_rx(struct uart_port *port) |
406 | { | 408 | { |
409 | UART_PUT_CR(port, ATMEL_US_RXDIS); | ||
410 | |||
407 | if (atmel_use_dma_rx(port)) { | 411 | if (atmel_use_dma_rx(port)) { |
408 | /* disable PDC receive */ | 412 | /* disable PDC receive */ |
409 | UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); | 413 | UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 0121486ac4fa..d00b38eb268e 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -1381,29 +1381,24 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1381 | return -ENODEV; | 1381 | return -ENODEV; |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | if (!request_mem_region(mem->start, resource_size(mem), | 1384 | if (!devm_request_mem_region(&pdev->dev, mem->start, resource_size(mem), |
1385 | pdev->dev.driver->name)) { | 1385 | pdev->dev.driver->name)) { |
1386 | dev_err(&pdev->dev, "memory region already claimed\n"); | 1386 | dev_err(&pdev->dev, "memory region already claimed\n"); |
1387 | return -EBUSY; | 1387 | return -EBUSY; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); | 1390 | dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); |
1391 | if (!dma_rx) { | 1391 | if (!dma_rx) |
1392 | ret = -EINVAL; | 1392 | return -ENXIO; |
1393 | goto err; | ||
1394 | } | ||
1395 | 1393 | ||
1396 | dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); | 1394 | dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); |
1397 | if (!dma_tx) { | 1395 | if (!dma_tx) |
1398 | ret = -EINVAL; | 1396 | return -ENXIO; |
1399 | goto err; | 1397 | |
1400 | } | 1398 | up = devm_kzalloc(&pdev->dev, sizeof(*up), GFP_KERNEL); |
1399 | if (!up) | ||
1400 | return -ENOMEM; | ||
1401 | 1401 | ||
1402 | up = kzalloc(sizeof(*up), GFP_KERNEL); | ||
1403 | if (up == NULL) { | ||
1404 | ret = -ENOMEM; | ||
1405 | goto do_release_region; | ||
1406 | } | ||
1407 | up->pdev = pdev; | 1402 | up->pdev = pdev; |
1408 | up->port.dev = &pdev->dev; | 1403 | up->port.dev = &pdev->dev; |
1409 | up->port.type = PORT_OMAP; | 1404 | up->port.type = PORT_OMAP; |
@@ -1423,16 +1418,17 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1423 | dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", | 1418 | dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", |
1424 | up->port.line); | 1419 | up->port.line); |
1425 | ret = -ENODEV; | 1420 | ret = -ENODEV; |
1426 | goto err; | 1421 | goto err_port_line; |
1427 | } | 1422 | } |
1428 | 1423 | ||
1429 | sprintf(up->name, "OMAP UART%d", up->port.line); | 1424 | sprintf(up->name, "OMAP UART%d", up->port.line); |
1430 | up->port.mapbase = mem->start; | 1425 | up->port.mapbase = mem->start; |
1431 | up->port.membase = ioremap(mem->start, resource_size(mem)); | 1426 | up->port.membase = devm_ioremap(&pdev->dev, mem->start, |
1427 | resource_size(mem)); | ||
1432 | if (!up->port.membase) { | 1428 | if (!up->port.membase) { |
1433 | dev_err(&pdev->dev, "can't ioremap UART\n"); | 1429 | dev_err(&pdev->dev, "can't ioremap UART\n"); |
1434 | ret = -ENOMEM; | 1430 | ret = -ENOMEM; |
1435 | goto err; | 1431 | goto err_ioremap; |
1436 | } | 1432 | } |
1437 | 1433 | ||
1438 | up->port.flags = omap_up_info->flags; | 1434 | up->port.flags = omap_up_info->flags; |
@@ -1478,16 +1474,19 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1478 | 1474 | ||
1479 | ret = uart_add_one_port(&serial_omap_reg, &up->port); | 1475 | ret = uart_add_one_port(&serial_omap_reg, &up->port); |
1480 | if (ret != 0) | 1476 | if (ret != 0) |
1481 | goto do_release_region; | 1477 | goto err_add_port; |
1482 | 1478 | ||
1483 | pm_runtime_put(&pdev->dev); | 1479 | pm_runtime_put(&pdev->dev); |
1484 | platform_set_drvdata(pdev, up); | 1480 | platform_set_drvdata(pdev, up); |
1485 | return 0; | 1481 | return 0; |
1486 | err: | 1482 | |
1483 | err_add_port: | ||
1484 | pm_runtime_put(&pdev->dev); | ||
1485 | pm_runtime_disable(&pdev->dev); | ||
1486 | err_ioremap: | ||
1487 | err_port_line: | ||
1487 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", | 1488 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", |
1488 | pdev->id, __func__, ret); | 1489 | pdev->id, __func__, ret); |
1489 | do_release_region: | ||
1490 | release_mem_region(mem->start, resource_size(mem)); | ||
1491 | return ret; | 1490 | return ret; |
1492 | } | 1491 | } |
1493 | 1492 | ||
@@ -1499,8 +1498,6 @@ static int serial_omap_remove(struct platform_device *dev) | |||
1499 | pm_runtime_disable(&up->pdev->dev); | 1498 | pm_runtime_disable(&up->pdev->dev); |
1500 | uart_remove_one_port(&serial_omap_reg, &up->port); | 1499 | uart_remove_one_port(&serial_omap_reg, &up->port); |
1501 | pm_qos_remove_request(&up->pm_qos_request); | 1500 | pm_qos_remove_request(&up->pm_qos_request); |
1502 | |||
1503 | kfree(up); | ||
1504 | } | 1501 | } |
1505 | 1502 | ||
1506 | platform_set_drvdata(dev, NULL); | 1503 | platform_set_drvdata(dev, NULL); |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 08b9962b8fda..bbbec4a74cfb 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -210,6 +210,7 @@ enum { | |||
210 | #define CMITC_UARTCLK 192000000 /* 192.0000 MHz */ | 210 | #define CMITC_UARTCLK 192000000 /* 192.0000 MHz */ |
211 | #define FRI2_64_UARTCLK 64000000 /* 64.0000 MHz */ | 211 | #define FRI2_64_UARTCLK 64000000 /* 64.0000 MHz */ |
212 | #define FRI2_48_UARTCLK 48000000 /* 48.0000 MHz */ | 212 | #define FRI2_48_UARTCLK 48000000 /* 48.0000 MHz */ |
213 | #define NTC1_UARTCLK 64000000 /* 64.0000 MHz */ | ||
213 | 214 | ||
214 | struct pch_uart_buffer { | 215 | struct pch_uart_buffer { |
215 | unsigned char *buf; | 216 | unsigned char *buf; |
@@ -384,6 +385,12 @@ static int pch_uart_get_uartclk(void) | |||
384 | if (cmp && strstr(cmp, "Fish River Island II")) | 385 | if (cmp && strstr(cmp, "Fish River Island II")) |
385 | return FRI2_48_UARTCLK; | 386 | return FRI2_48_UARTCLK; |
386 | 387 | ||
388 | /* Kontron COMe-mTT10 (nanoETXexpress-TT) */ | ||
389 | cmp = dmi_get_system_info(DMI_BOARD_NAME); | ||
390 | if (cmp && (strstr(cmp, "COMe-mTT") || | ||
391 | strstr(cmp, "nanoETXexpress-TT"))) | ||
392 | return NTC1_UARTCLK; | ||
393 | |||
387 | return DEFAULT_UARTCLK; | 394 | return DEFAULT_UARTCLK; |
388 | } | 395 | } |
389 | 396 | ||
@@ -1651,6 +1658,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, | |||
1651 | } | 1658 | } |
1652 | 1659 | ||
1653 | pci_enable_msi(pdev); | 1660 | pci_enable_msi(pdev); |
1661 | pci_set_master(pdev); | ||
1654 | 1662 | ||
1655 | iobase = pci_resource_start(pdev, 0); | 1663 | iobase = pci_resource_start(pdev, 0); |
1656 | mapbase = pci_resource_start(pdev, 1); | 1664 | mapbase = pci_resource_start(pdev, 1); |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index de249d265bec..d8b0aee35632 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -982,6 +982,7 @@ static void s3c24xx_serial_resetport(struct uart_port *port, | |||
982 | 982 | ||
983 | ucon &= ucon_mask; | 983 | ucon &= ucon_mask; |
984 | wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); | 984 | wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); |
985 | wr_regl(port, S3C2410_ULCON, cfg->ulcon); | ||
985 | 986 | ||
986 | /* reset both fifos */ | 987 | /* reset both fifos */ |
987 | wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); | 988 | wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 3bdd4b19dd06..2156188db4a6 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -2932,11 +2932,10 @@ static int __init con_init(void) | |||
2932 | gotoxy(vc, vc->vc_x, vc->vc_y); | 2932 | gotoxy(vc, vc->vc_x, vc->vc_y); |
2933 | csi_J(vc, 0); | 2933 | csi_J(vc, 0); |
2934 | update_screen(vc); | 2934 | update_screen(vc); |
2935 | pr_info("Console: %s %s %dx%d", | 2935 | pr_info("Console: %s %s %dx%d\n", |
2936 | vc->vc_can_do_color ? "colour" : "mono", | 2936 | vc->vc_can_do_color ? "colour" : "mono", |
2937 | display_desc, vc->vc_cols, vc->vc_rows); | 2937 | display_desc, vc->vc_cols, vc->vc_rows); |
2938 | printable = 1; | 2938 | printable = 1; |
2939 | printk("\n"); | ||
2940 | 2939 | ||
2941 | console_unlock(); | 2940 | console_unlock(); |
2942 | 2941 | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index cbd8f5f80596..76316a33061b 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -2,14 +2,6 @@ | |||
2 | # USB device configuration | 2 | # USB device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig USB_SUPPORT | ||
6 | bool "USB support" | ||
7 | depends on HAS_IOMEM | ||
8 | default y | ||
9 | ---help--- | ||
10 | This option adds core support for Universal Serial Bus (USB). | ||
11 | You will also need drivers from the following menu to make use of it. | ||
12 | |||
13 | # many non-PCI SOC chips embed OHCI | 5 | # many non-PCI SOC chips embed OHCI |
14 | config USB_ARCH_HAS_OHCI | 6 | config USB_ARCH_HAS_OHCI |
15 | boolean | 7 | boolean |
@@ -63,6 +55,14 @@ config USB_ARCH_HAS_XHCI | |||
63 | boolean | 55 | boolean |
64 | default PCI | 56 | default PCI |
65 | 57 | ||
58 | menuconfig USB_SUPPORT | ||
59 | bool "USB support" | ||
60 | depends on HAS_IOMEM | ||
61 | default y | ||
62 | ---help--- | ||
63 | This option adds core support for Universal Serial Bus (USB). | ||
64 | You will also need drivers from the following menu to make use of it. | ||
65 | |||
66 | if USB_SUPPORT | 66 | if USB_SUPPORT |
67 | 67 | ||
68 | config USB_COMMON | 68 | config USB_COMMON |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index f8e2d6d52e5c..9a56635dc19c 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1189,8 +1189,13 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
1189 | if (status == 0) { | 1189 | if (status == 0) { |
1190 | status = usb_suspend_device(udev, msg); | 1190 | status = usb_suspend_device(udev, msg); |
1191 | 1191 | ||
1192 | /* Again, ignore errors during system sleep transitions */ | 1192 | /* |
1193 | if (!PMSG_IS_AUTO(msg)) | 1193 | * Ignore errors from non-root-hub devices during |
1194 | * system sleep transitions. For the most part, | ||
1195 | * these devices should go to low power anyway when | ||
1196 | * the entire bus is suspended. | ||
1197 | */ | ||
1198 | if (udev->parent && !PMSG_IS_AUTO(msg)) | ||
1194 | status = 0; | 1199 | status = 0; |
1195 | } | 1200 | } |
1196 | 1201 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 9d7fc9a39933..140d3e11f212 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1978,6 +1978,18 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg) | |||
1978 | if (status == 0) { | 1978 | if (status == 0) { |
1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); | 1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); |
1980 | hcd->state = HC_STATE_SUSPENDED; | 1980 | hcd->state = HC_STATE_SUSPENDED; |
1981 | |||
1982 | /* Did we race with a root-hub wakeup event? */ | ||
1983 | if (rhdev->do_remote_wakeup) { | ||
1984 | char buffer[6]; | ||
1985 | |||
1986 | status = hcd->driver->hub_status_data(hcd, buffer); | ||
1987 | if (status != 0) { | ||
1988 | dev_dbg(&rhdev->dev, "suspend raced with wakeup event\n"); | ||
1989 | hcd_bus_resume(rhdev, PMSG_AUTO_RESUME); | ||
1990 | status = -EBUSY; | ||
1991 | } | ||
1992 | } | ||
1981 | } else { | 1993 | } else { |
1982 | spin_lock_irq(&hcd_root_hub_lock); | 1994 | spin_lock_irq(&hcd_root_hub_lock); |
1983 | if (!HCD_DEAD(hcd)) { | 1995 | if (!HCD_DEAD(hcd)) { |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 28664eb7f555..a2aa9d652c67 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -3163,6 +3163,22 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
3163 | if (retval) | 3163 | if (retval) |
3164 | goto fail; | 3164 | goto fail; |
3165 | 3165 | ||
3166 | /* | ||
3167 | * Some superspeed devices have finished the link training process | ||
3168 | * and attached to a superspeed hub port, but the device descriptor | ||
3169 | * got from those devices show they aren't superspeed devices. Warm | ||
3170 | * reset the port attached by the devices can fix them. | ||
3171 | */ | ||
3172 | if ((udev->speed == USB_SPEED_SUPER) && | ||
3173 | (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) { | ||
3174 | dev_err(&udev->dev, "got a wrong device descriptor, " | ||
3175 | "warm reset device\n"); | ||
3176 | hub_port_reset(hub, port1, udev, | ||
3177 | HUB_BH_RESET_TIME, true); | ||
3178 | retval = -EINVAL; | ||
3179 | goto fail; | ||
3180 | } | ||
3181 | |||
3166 | if (udev->descriptor.bMaxPacketSize0 == 0xff || | 3182 | if (udev->descriptor.bMaxPacketSize0 == 0xff || |
3167 | udev->speed == USB_SPEED_SUPER) | 3183 | udev->speed == USB_SPEED_SUPER) |
3168 | i = 512; | 3184 | i = 512; |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index b3bdfede45e6..aed3e07942d4 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -308,7 +308,8 @@ static void sg_complete(struct urb *urb) | |||
308 | retval = usb_unlink_urb(io->urbs [i]); | 308 | retval = usb_unlink_urb(io->urbs [i]); |
309 | if (retval != -EINPROGRESS && | 309 | if (retval != -EINPROGRESS && |
310 | retval != -ENODEV && | 310 | retval != -ENODEV && |
311 | retval != -EBUSY) | 311 | retval != -EBUSY && |
312 | retval != -EIDRM) | ||
312 | dev_err(&io->dev->dev, | 313 | dev_err(&io->dev->dev, |
313 | "%s, unlink --> %d\n", | 314 | "%s, unlink --> %d\n", |
314 | __func__, retval); | 315 | __func__, retval); |
@@ -317,7 +318,6 @@ static void sg_complete(struct urb *urb) | |||
317 | } | 318 | } |
318 | spin_lock(&io->lock); | 319 | spin_lock(&io->lock); |
319 | } | 320 | } |
320 | urb->dev = NULL; | ||
321 | 321 | ||
322 | /* on the last completion, signal usb_sg_wait() */ | 322 | /* on the last completion, signal usb_sg_wait() */ |
323 | io->bytes += urb->actual_length; | 323 | io->bytes += urb->actual_length; |
@@ -524,7 +524,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
524 | case -ENXIO: /* hc didn't queue this one */ | 524 | case -ENXIO: /* hc didn't queue this one */ |
525 | case -EAGAIN: | 525 | case -EAGAIN: |
526 | case -ENOMEM: | 526 | case -ENOMEM: |
527 | io->urbs[i]->dev = NULL; | ||
528 | retval = 0; | 527 | retval = 0; |
529 | yield(); | 528 | yield(); |
530 | break; | 529 | break; |
@@ -542,7 +541,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
542 | 541 | ||
543 | /* fail any uncompleted urbs */ | 542 | /* fail any uncompleted urbs */ |
544 | default: | 543 | default: |
545 | io->urbs[i]->dev = NULL; | ||
546 | io->urbs[i]->status = retval; | 544 | io->urbs[i]->status = retval; |
547 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", | 545 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", |
548 | __func__, retval); | 546 | __func__, retval); |
@@ -593,7 +591,10 @@ void usb_sg_cancel(struct usb_sg_request *io) | |||
593 | if (!io->urbs [i]->dev) | 591 | if (!io->urbs [i]->dev) |
594 | continue; | 592 | continue; |
595 | retval = usb_unlink_urb(io->urbs [i]); | 593 | retval = usb_unlink_urb(io->urbs [i]); |
596 | if (retval != -EINPROGRESS && retval != -EBUSY) | 594 | if (retval != -EINPROGRESS |
595 | && retval != -ENODEV | ||
596 | && retval != -EBUSY | ||
597 | && retval != -EIDRM) | ||
597 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", | 598 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
598 | __func__, retval); | 599 | __func__, retval); |
599 | } | 600 | } |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 7239a73c1b8c..cd9b3a2cd8a7 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -539,6 +539,10 @@ EXPORT_SYMBOL_GPL(usb_submit_urb); | |||
539 | * never submitted, or it was unlinked before, or the hardware is already | 539 | * never submitted, or it was unlinked before, or the hardware is already |
540 | * finished with it), even if the completion handler has not yet run. | 540 | * finished with it), even if the completion handler has not yet run. |
541 | * | 541 | * |
542 | * The URB must not be deallocated while this routine is running. In | ||
543 | * particular, when a driver calls this routine, it must insure that the | ||
544 | * completion handler cannot deallocate the URB. | ||
545 | * | ||
542 | * Unlinking and Endpoint Queues: | 546 | * Unlinking and Endpoint Queues: |
543 | * | 547 | * |
544 | * [The behaviors and guarantees described below do not apply to virtual | 548 | * [The behaviors and guarantees described below do not apply to virtual |
@@ -603,6 +607,10 @@ EXPORT_SYMBOL_GPL(usb_unlink_urb); | |||
603 | * with error -EPERM. Thus even if the URB's completion handler always | 607 | * with error -EPERM. Thus even if the URB's completion handler always |
604 | * tries to resubmit, it will not succeed and the URB will become idle. | 608 | * tries to resubmit, it will not succeed and the URB will become idle. |
605 | * | 609 | * |
610 | * The URB must not be deallocated while this routine is running. In | ||
611 | * particular, when a driver calls this routine, it must insure that the | ||
612 | * completion handler cannot deallocate the URB. | ||
613 | * | ||
606 | * This routine may not be used in an interrupt context (such as a bottom | 614 | * This routine may not be used in an interrupt context (such as a bottom |
607 | * half or a completion handler), or when holding a spinlock, or in other | 615 | * half or a completion handler), or when holding a spinlock, or in other |
608 | * situations where the caller can't schedule(). | 616 | * situations where the caller can't schedule(). |
@@ -640,6 +648,10 @@ EXPORT_SYMBOL_GPL(usb_kill_urb); | |||
640 | * with error -EPERM. Thus even if the URB's completion handler always | 648 | * with error -EPERM. Thus even if the URB's completion handler always |
641 | * tries to resubmit, it will not succeed and the URB will become idle. | 649 | * tries to resubmit, it will not succeed and the URB will become idle. |
642 | * | 650 | * |
651 | * The URB must not be deallocated while this routine is running. In | ||
652 | * particular, when a driver calls this routine, it must insure that the | ||
653 | * completion handler cannot deallocate the URB. | ||
654 | * | ||
643 | * This routine may not be used in an interrupt context (such as a bottom | 655 | * This routine may not be used in an interrupt context (such as a bottom |
644 | * half or a completion handler), or when holding a spinlock, or in other | 656 | * half or a completion handler), or when holding a spinlock, or in other |
645 | * situations where the caller can't schedule(). | 657 | * situations where the caller can't schedule(). |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 8793f32bab11..e58b16442971 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1574,7 +1574,6 @@ static void destroy_ep_files (struct dev_data *dev) | |||
1574 | DBG (dev, "%s %d\n", __func__, dev->state); | 1574 | DBG (dev, "%s %d\n", __func__, dev->state); |
1575 | 1575 | ||
1576 | /* dev->state must prevent interference */ | 1576 | /* dev->state must prevent interference */ |
1577 | restart: | ||
1578 | spin_lock_irq (&dev->lock); | 1577 | spin_lock_irq (&dev->lock); |
1579 | while (!list_empty(&dev->epfiles)) { | 1578 | while (!list_empty(&dev->epfiles)) { |
1580 | struct ep_data *ep; | 1579 | struct ep_data *ep; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 057cdda7a489..806cc95317aa 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -347,6 +347,8 @@ static int ehci_reset (struct ehci_hcd *ehci) | |||
347 | if (ehci->debug) | 347 | if (ehci->debug) |
348 | dbgp_external_startup(); | 348 | dbgp_external_startup(); |
349 | 349 | ||
350 | ehci->port_c_suspend = ehci->suspended_ports = | ||
351 | ehci->resuming_ports = 0; | ||
350 | return retval; | 352 | return retval; |
351 | } | 353 | } |
352 | 354 | ||
@@ -939,6 +941,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
939 | * like usb_port_resume() does. | 941 | * like usb_port_resume() does. |
940 | */ | 942 | */ |
941 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); | 943 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
944 | set_bit(i, &ehci->resuming_ports); | ||
942 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 945 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
943 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 946 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
944 | } | 947 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 256fbd42e48c..38fe07623152 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -223,15 +223,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
223 | * remote wakeup, we must fail the suspend. | 223 | * remote wakeup, we must fail the suspend. |
224 | */ | 224 | */ |
225 | if (hcd->self.root_hub->do_remote_wakeup) { | 225 | if (hcd->self.root_hub->do_remote_wakeup) { |
226 | port = HCS_N_PORTS(ehci->hcs_params); | 226 | if (ehci->resuming_ports) { |
227 | while (port--) { | 227 | spin_unlock_irq(&ehci->lock); |
228 | if (ehci->reset_done[port] != 0) { | 228 | ehci_dbg(ehci, "suspend failed because a port is resuming\n"); |
229 | spin_unlock_irq(&ehci->lock); | 229 | return -EBUSY; |
230 | ehci_dbg(ehci, "suspend failed because " | ||
231 | "port %d is resuming\n", | ||
232 | port + 1); | ||
233 | return -EBUSY; | ||
234 | } | ||
235 | } | 230 | } |
236 | } | 231 | } |
237 | 232 | ||
@@ -554,16 +549,12 @@ static int | |||
554 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | 549 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) |
555 | { | 550 | { |
556 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 551 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
557 | u32 temp, status = 0; | 552 | u32 temp, status; |
558 | u32 mask; | 553 | u32 mask; |
559 | int ports, i, retval = 1; | 554 | int ports, i, retval = 1; |
560 | unsigned long flags; | 555 | unsigned long flags; |
561 | u32 ppcd = 0; | 556 | u32 ppcd = 0; |
562 | 557 | ||
563 | /* if !USB_SUSPEND, root hub timers won't get shut down ... */ | ||
564 | if (ehci->rh_state != EHCI_RH_RUNNING) | ||
565 | return 0; | ||
566 | |||
567 | /* init status to no-changes */ | 558 | /* init status to no-changes */ |
568 | buf [0] = 0; | 559 | buf [0] = 0; |
569 | ports = HCS_N_PORTS (ehci->hcs_params); | 560 | ports = HCS_N_PORTS (ehci->hcs_params); |
@@ -572,6 +563,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
572 | retval++; | 563 | retval++; |
573 | } | 564 | } |
574 | 565 | ||
566 | /* Inform the core about resumes-in-progress by returning | ||
567 | * a non-zero value even if there are no status changes. | ||
568 | */ | ||
569 | status = ehci->resuming_ports; | ||
570 | |||
575 | /* Some boards (mostly VIA?) report bogus overcurrent indications, | 571 | /* Some boards (mostly VIA?) report bogus overcurrent indications, |
576 | * causing massive log spam unless we completely ignore them. It | 572 | * causing massive log spam unless we completely ignore them. It |
577 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is | 573 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is |
@@ -846,6 +842,7 @@ static int ehci_hub_control ( | |||
846 | ehci_writel(ehci, | 842 | ehci_writel(ehci, |
847 | temp & ~(PORT_RWC_BITS | PORT_RESUME), | 843 | temp & ~(PORT_RWC_BITS | PORT_RESUME), |
848 | status_reg); | 844 | status_reg); |
845 | clear_bit(wIndex, &ehci->resuming_ports); | ||
849 | retval = handshake(ehci, status_reg, | 846 | retval = handshake(ehci, status_reg, |
850 | PORT_RESUME, 0, 2000 /* 2msec */); | 847 | PORT_RESUME, 0, 2000 /* 2msec */); |
851 | if (retval != 0) { | 848 | if (retval != 0) { |
@@ -864,6 +861,7 @@ static int ehci_hub_control ( | |||
864 | ehci->reset_done[wIndex])) { | 861 | ehci->reset_done[wIndex])) { |
865 | status |= USB_PORT_STAT_C_RESET << 16; | 862 | status |= USB_PORT_STAT_C_RESET << 16; |
866 | ehci->reset_done [wIndex] = 0; | 863 | ehci->reset_done [wIndex] = 0; |
864 | clear_bit(wIndex, &ehci->resuming_ports); | ||
867 | 865 | ||
868 | /* force reset to complete */ | 866 | /* force reset to complete */ |
869 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), | 867 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), |
@@ -884,8 +882,10 @@ static int ehci_hub_control ( | |||
884 | ehci_readl(ehci, status_reg)); | 882 | ehci_readl(ehci, status_reg)); |
885 | } | 883 | } |
886 | 884 | ||
887 | if (!(temp & (PORT_RESUME|PORT_RESET))) | 885 | if (!(temp & (PORT_RESUME|PORT_RESET))) { |
888 | ehci->reset_done[wIndex] = 0; | 886 | ehci->reset_done[wIndex] = 0; |
887 | clear_bit(wIndex, &ehci->resuming_ports); | ||
888 | } | ||
889 | 889 | ||
890 | /* transfer dedicated ports to the companion hc */ | 890 | /* transfer dedicated ports to the companion hc */ |
891 | if ((temp & PORT_CONNECT) && | 891 | if ((temp & PORT_CONNECT) && |
@@ -920,6 +920,7 @@ static int ehci_hub_control ( | |||
920 | status |= USB_PORT_STAT_SUSPEND; | 920 | status |= USB_PORT_STAT_SUSPEND; |
921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { | 921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { |
922 | clear_bit(wIndex, &ehci->suspended_ports); | 922 | clear_bit(wIndex, &ehci->suspended_ports); |
923 | clear_bit(wIndex, &ehci->resuming_ports); | ||
923 | ehci->reset_done[wIndex] = 0; | 924 | ehci->reset_done[wIndex] = 0; |
924 | if (temp & PORT_PE) | 925 | if (temp & PORT_PE) |
925 | set_bit(wIndex, &ehci->port_c_suspend); | 926 | set_bit(wIndex, &ehci->port_c_suspend); |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 3de48a2d7955..73544bd440bd 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -224,6 +224,7 @@ static int tegra_ehci_hub_control( | |||
224 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); | 224 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); |
225 | /* start resume signalling */ | 225 | /* start resume signalling */ |
226 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); | 226 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); |
227 | set_bit(wIndex-1, &ehci->resuming_ports); | ||
227 | 228 | ||
228 | spin_unlock_irqrestore(&ehci->lock, flags); | 229 | spin_unlock_irqrestore(&ehci->lock, flags); |
229 | msleep(20); | 230 | msleep(20); |
@@ -236,6 +237,7 @@ static int tegra_ehci_hub_control( | |||
236 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); | 237 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); |
237 | 238 | ||
238 | ehci->reset_done[wIndex-1] = 0; | 239 | ehci->reset_done[wIndex-1] = 0; |
240 | clear_bit(wIndex-1, &ehci->resuming_ports); | ||
239 | 241 | ||
240 | tegra->port_resuming = 1; | 242 | tegra->port_resuming = 1; |
241 | goto done; | 243 | goto done; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 8f9acbc96fde..2694ed6558d2 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -117,6 +117,8 @@ struct ehci_hcd { /* one per controller */ | |||
117 | the change-suspend feature turned on */ | 117 | the change-suspend feature turned on */ |
118 | unsigned long suspended_ports; /* which ports are | 118 | unsigned long suspended_ports; /* which ports are |
119 | suspended */ | 119 | suspended */ |
120 | unsigned long resuming_ports; /* which ports have | ||
121 | started to resume */ | ||
120 | 122 | ||
121 | /* per-HC memory pools (could be per-bus, but ...) */ | 123 | /* per-HC memory pools (could be per-bus, but ...) */ |
122 | struct dma_pool *qh_pool; /* qh per active urb */ | 124 | struct dma_pool *qh_pool; /* qh per active urb */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 11de5f1be981..32dada8c8b4f 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -825,9 +825,13 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev) | |||
825 | } | 825 | } |
826 | } | 826 | } |
827 | 827 | ||
828 | /* Disable any BIOS SMIs */ | 828 | val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); |
829 | writel(XHCI_LEGACY_DISABLE_SMI, | 829 | /* Mask off (turn off) any enabled SMIs */ |
830 | base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | 830 | val &= XHCI_LEGACY_DISABLE_SMI; |
831 | /* Mask all SMI events bits, RW1C */ | ||
832 | val |= XHCI_LEGACY_SMI_EVENTS; | ||
833 | /* Disable any BIOS SMIs and clear all SMI events*/ | ||
834 | writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | ||
831 | 835 | ||
832 | if (usb_is_intel_switchable_xhci(pdev)) | 836 | if (usb_is_intel_switchable_xhci(pdev)) |
833 | usb_enable_xhci_ports(pdev); | 837 | usb_enable_xhci_ports(pdev); |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 045cde4cbc3d..768d54295a20 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -196,11 +196,12 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
196 | status = get_hub_status_data(uhci, buf); | 196 | status = get_hub_status_data(uhci, buf); |
197 | 197 | ||
198 | switch (uhci->rh_state) { | 198 | switch (uhci->rh_state) { |
199 | case UHCI_RH_SUSPENDING: | ||
200 | case UHCI_RH_SUSPENDED: | 199 | case UHCI_RH_SUSPENDED: |
201 | /* if port change, ask to be resumed */ | 200 | /* if port change, ask to be resumed */ |
202 | if (status || uhci->resuming_ports) | 201 | if (status || uhci->resuming_ports) { |
202 | status = 1; | ||
203 | usb_hcd_resume_root_hub(hcd); | 203 | usb_hcd_resume_root_hub(hcd); |
204 | } | ||
204 | break; | 205 | break; |
205 | 206 | ||
206 | case UHCI_RH_AUTO_STOPPED: | 207 | case UHCI_RH_AUTO_STOPPED: |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index e9b0f043455d..4b436f5a4171 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -119,7 +119,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci) | |||
119 | xhci_dbg(xhci, " Event Interrupts %s\n", | 119 | xhci_dbg(xhci, " Event Interrupts %s\n", |
120 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 120 | (temp & CMD_EIE) ? "enabled " : "disabled"); |
121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", | 121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", |
122 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 122 | (temp & CMD_HSEIE) ? "enabled " : "disabled"); |
123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", | 123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", |
124 | (temp & CMD_LRESET) ? "not " : ""); | 124 | (temp & CMD_LRESET) ? "not " : ""); |
125 | } | 125 | } |
diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h index c7f33123d4c0..377f4242dabb 100644 --- a/drivers/usb/host/xhci-ext-caps.h +++ b/drivers/usb/host/xhci-ext-caps.h | |||
@@ -62,8 +62,9 @@ | |||
62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ | 62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ |
63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ | 63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ |
64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) | 64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) |
65 | /* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ | 65 | /* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ |
66 | #define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) | 66 | #define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17)) |
67 | #define XHCI_LEGACY_SMI_EVENTS (0x7 << 29) | ||
67 | 68 | ||
68 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ | 69 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ |
69 | #define XHCI_L1C (1 << 16) | 70 | #define XHCI_L1C (1 << 16) |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index cae4c6f2845a..68eaa908ac8e 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1796,11 +1796,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1796 | int i; | 1796 | int i; |
1797 | 1797 | ||
1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
1799 | if (xhci->ir_set) { | ||
1800 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); | ||
1801 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); | ||
1802 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | ||
1803 | } | ||
1804 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 1799 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
1805 | if (xhci->erst.entries) | 1800 | if (xhci->erst.entries) |
1806 | dma_free_coherent(&pdev->dev, size, | 1801 | dma_free_coherent(&pdev->dev, size, |
@@ -1812,7 +1807,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1812 | xhci->event_ring = NULL; | 1807 | xhci->event_ring = NULL; |
1813 | xhci_dbg(xhci, "Freed event ring\n"); | 1808 | xhci_dbg(xhci, "Freed event ring\n"); |
1814 | 1809 | ||
1815 | xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring); | ||
1816 | if (xhci->cmd_ring) | 1810 | if (xhci->cmd_ring) |
1817 | xhci_ring_free(xhci, xhci->cmd_ring); | 1811 | xhci_ring_free(xhci, xhci->cmd_ring); |
1818 | xhci->cmd_ring = NULL; | 1812 | xhci->cmd_ring = NULL; |
@@ -1841,7 +1835,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1841 | xhci->medium_streams_pool = NULL; | 1835 | xhci->medium_streams_pool = NULL; |
1842 | xhci_dbg(xhci, "Freed medium stream array pool\n"); | 1836 | xhci_dbg(xhci, "Freed medium stream array pool\n"); |
1843 | 1837 | ||
1844 | xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr); | ||
1845 | if (xhci->dcbaa) | 1838 | if (xhci->dcbaa) |
1846 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), | 1839 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), |
1847 | xhci->dcbaa, xhci->dcbaa->dma); | 1840 | xhci->dcbaa, xhci->dcbaa->dma); |
@@ -2459,6 +2452,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2459 | 2452 | ||
2460 | fail: | 2453 | fail: |
2461 | xhci_warn(xhci, "Couldn't initialize memory\n"); | 2454 | xhci_warn(xhci, "Couldn't initialize memory\n"); |
2455 | xhci_halt(xhci); | ||
2456 | xhci_reset(xhci); | ||
2462 | xhci_mem_cleanup(xhci); | 2457 | xhci_mem_cleanup(xhci); |
2463 | return -ENOMEM; | 2458 | return -ENOMEM; |
2464 | } | 2459 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ef98b38626fb..7a856a767e77 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -95,6 +95,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
95 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 95 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); | 96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); |
97 | } | 97 | } |
98 | if (pdev->vendor == PCI_VENDOR_ID_VIA) | ||
99 | xhci->quirks |= XHCI_RESET_ON_RESUME; | ||
98 | } | 100 | } |
99 | 101 | ||
100 | /* called during probe() after chip reset completes */ | 102 | /* called during probe() after chip reset completes */ |
@@ -326,7 +328,7 @@ int __init xhci_register_pci(void) | |||
326 | return pci_register_driver(&xhci_pci_driver); | 328 | return pci_register_driver(&xhci_pci_driver); |
327 | } | 329 | } |
328 | 330 | ||
329 | void __exit xhci_unregister_pci(void) | 331 | void xhci_unregister_pci(void) |
330 | { | 332 | { |
331 | pci_unregister_driver(&xhci_pci_driver); | 333 | pci_unregister_driver(&xhci_pci_driver); |
332 | } | 334 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 6bd9d53062eb..3d9422f16a20 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2417,7 +2417,7 @@ hw_died: | |||
2417 | u32 irq_pending; | 2417 | u32 irq_pending; |
2418 | /* Acknowledge the PCI interrupt */ | 2418 | /* Acknowledge the PCI interrupt */ |
2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
2420 | irq_pending |= 0x3; | 2420 | irq_pending |= IMAN_IP; |
2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); | 2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); |
2422 | } | 2422 | } |
2423 | 2423 | ||
@@ -2734,7 +2734,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2734 | urb->dev->speed == USB_SPEED_FULL) | 2734 | urb->dev->speed == USB_SPEED_FULL) |
2735 | urb->interval /= 8; | 2735 | urb->interval /= 8; |
2736 | } | 2736 | } |
2737 | return xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 2737 | return xhci_queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index); |
2738 | } | 2738 | } |
2739 | 2739 | ||
2740 | /* | 2740 | /* |
@@ -3514,7 +3514,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3514 | } | 3514 | } |
3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; | 3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; |
3516 | 3516 | ||
3517 | return xhci_queue_isoc_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 3517 | return xhci_queue_isoc_tx(xhci, mem_flags, urb, slot_id, ep_index); |
3518 | } | 3518 | } |
3519 | 3519 | ||
3520 | /**** Command Ring Operations ****/ | 3520 | /**** Command Ring Operations ****/ |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e1963d4a430f..36641a7f2371 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -106,6 +106,9 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); | 106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); |
107 | if (!ret) | 107 | if (!ret) |
108 | xhci->xhc_state |= XHCI_STATE_HALTED; | 108 | xhci->xhc_state |= XHCI_STATE_HALTED; |
109 | else | ||
110 | xhci_warn(xhci, "Host not halted after %u microseconds.\n", | ||
111 | XHCI_MAX_HALT_USEC); | ||
109 | return ret; | 112 | return ret; |
110 | } | 113 | } |
111 | 114 | ||
@@ -664,11 +667,11 @@ static void xhci_save_registers(struct xhci_hcd *xhci) | |||
664 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); | 667 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); |
665 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); | 668 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); |
666 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); | 669 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); |
667 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
668 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
669 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); | 670 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); |
670 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); | 671 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); |
671 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); | 672 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); |
673 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
674 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
672 | } | 675 | } |
673 | 676 | ||
674 | static void xhci_restore_registers(struct xhci_hcd *xhci) | 677 | static void xhci_restore_registers(struct xhci_hcd *xhci) |
@@ -677,10 +680,11 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) | |||
677 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); | 680 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); |
678 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); | 681 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); |
679 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); | 682 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); |
680 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
681 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
682 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); | 683 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); |
683 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); | 684 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); |
685 | xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue); | ||
686 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
687 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
684 | } | 688 | } |
685 | 689 | ||
686 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) | 690 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 91074fdab3eb..3d69c4b2b542 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -205,6 +205,10 @@ struct xhci_op_regs { | |||
205 | #define CMD_PM_INDEX (1 << 11) | 205 | #define CMD_PM_INDEX (1 << 11) |
206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
207 | 207 | ||
208 | /* IMAN - Interrupt Management Register */ | ||
209 | #define IMAN_IP (1 << 1) | ||
210 | #define IMAN_IE (1 << 0) | ||
211 | |||
208 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
209 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
210 | #define STS_HALT XHCI_STS_HALT | 214 | #define STS_HALT XHCI_STS_HALT |
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 7f547dc3a590..ed8adb052ca7 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -60,8 +60,6 @@ static int usb_serial_device_probe(struct device *dev) | |||
60 | retval = -ENODEV; | 60 | retval = -ENODEV; |
61 | goto exit; | 61 | goto exit; |
62 | } | 62 | } |
63 | if (port->dev_state != PORT_REGISTERING) | ||
64 | goto exit; | ||
65 | 63 | ||
66 | driver = port->serial->type; | 64 | driver = port->serial->type; |
67 | if (driver->port_probe) { | 65 | if (driver->port_probe) { |
@@ -98,9 +96,6 @@ static int usb_serial_device_remove(struct device *dev) | |||
98 | if (!port) | 96 | if (!port) |
99 | return -ENODEV; | 97 | return -ENODEV; |
100 | 98 | ||
101 | if (port->dev_state != PORT_UNREGISTERING) | ||
102 | return retval; | ||
103 | |||
104 | device_remove_file(&port->dev, &dev_attr_port_number); | 99 | device_remove_file(&port->dev, &dev_attr_port_number); |
105 | 100 | ||
106 | driver = port->serial->type; | 101 | driver = port->serial->type; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ff8605b4b4be..02e7f2d32d52 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -75,7 +75,8 @@ struct ftdi_private { | |||
75 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 75 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
76 | struct async_icount icount; | 76 | struct async_icount icount; |
77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | 77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ |
78 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ | 78 | char prev_status; /* Used for TIOCMIWAIT */ |
79 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
79 | char transmit_empty; /* If transmitter is empty or not */ | 80 | char transmit_empty; /* If transmitter is empty or not */ |
80 | struct usb_serial_port *port; | 81 | struct usb_serial_port *port; |
81 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 82 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
@@ -1681,6 +1682,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1681 | init_waitqueue_head(&priv->delta_msr_wait); | 1682 | init_waitqueue_head(&priv->delta_msr_wait); |
1682 | 1683 | ||
1683 | priv->flags = ASYNC_LOW_LATENCY; | 1684 | priv->flags = ASYNC_LOW_LATENCY; |
1685 | priv->dev_gone = false; | ||
1684 | 1686 | ||
1685 | if (quirk && quirk->port_probe) | 1687 | if (quirk && quirk->port_probe) |
1686 | quirk->port_probe(priv); | 1688 | quirk->port_probe(priv); |
@@ -1839,6 +1841,9 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
1839 | 1841 | ||
1840 | dbg("%s", __func__); | 1842 | dbg("%s", __func__); |
1841 | 1843 | ||
1844 | priv->dev_gone = true; | ||
1845 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1846 | |||
1842 | remove_sysfs_attrs(port); | 1847 | remove_sysfs_attrs(port); |
1843 | 1848 | ||
1844 | kref_put(&priv->kref, ftdi_sio_priv_release); | 1849 | kref_put(&priv->kref, ftdi_sio_priv_release); |
@@ -1982,17 +1987,19 @@ static int ftdi_process_packet(struct tty_struct *tty, | |||
1982 | N.B. packet may be processed more than once, but differences | 1987 | N.B. packet may be processed more than once, but differences |
1983 | are only processed once. */ | 1988 | are only processed once. */ |
1984 | status = packet[0] & FTDI_STATUS_B0_MASK; | 1989 | status = packet[0] & FTDI_STATUS_B0_MASK; |
1985 | if (status & FTDI_RS0_CTS) | ||
1986 | priv->icount.cts++; | ||
1987 | if (status & FTDI_RS0_DSR) | ||
1988 | priv->icount.dsr++; | ||
1989 | if (status & FTDI_RS0_RI) | ||
1990 | priv->icount.rng++; | ||
1991 | if (status & FTDI_RS0_RLSD) | ||
1992 | priv->icount.dcd++; | ||
1993 | if (status != priv->prev_status) { | 1990 | if (status != priv->prev_status) { |
1994 | priv->diff_status |= status ^ priv->prev_status; | 1991 | char diff_status = status ^ priv->prev_status; |
1995 | wake_up_interruptible(&priv->delta_msr_wait); | 1992 | |
1993 | if (diff_status & FTDI_RS0_CTS) | ||
1994 | priv->icount.cts++; | ||
1995 | if (diff_status & FTDI_RS0_DSR) | ||
1996 | priv->icount.dsr++; | ||
1997 | if (diff_status & FTDI_RS0_RI) | ||
1998 | priv->icount.rng++; | ||
1999 | if (diff_status & FTDI_RS0_RLSD) | ||
2000 | priv->icount.dcd++; | ||
2001 | |||
2002 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1996 | priv->prev_status = status; | 2003 | priv->prev_status = status; |
1997 | } | 2004 | } |
1998 | 2005 | ||
@@ -2395,15 +2402,12 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2395 | */ | 2402 | */ |
2396 | case TIOCMIWAIT: | 2403 | case TIOCMIWAIT: |
2397 | cprev = priv->icount; | 2404 | cprev = priv->icount; |
2398 | while (1) { | 2405 | while (!priv->dev_gone) { |
2399 | interruptible_sleep_on(&priv->delta_msr_wait); | 2406 | interruptible_sleep_on(&priv->delta_msr_wait); |
2400 | /* see if a signal did it */ | 2407 | /* see if a signal did it */ |
2401 | if (signal_pending(current)) | 2408 | if (signal_pending(current)) |
2402 | return -ERESTARTSYS; | 2409 | return -ERESTARTSYS; |
2403 | cnow = priv->icount; | 2410 | cnow = priv->icount; |
2404 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | ||
2405 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | ||
2406 | return -EIO; /* no change => error */ | ||
2407 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2411 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
2408 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2412 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
2409 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || | 2413 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
@@ -2412,7 +2416,7 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2412 | } | 2416 | } |
2413 | cprev = cnow; | 2417 | cprev = cnow; |
2414 | } | 2418 | } |
2415 | /* not reached */ | 2419 | return -EIO; |
2416 | break; | 2420 | break; |
2417 | case TIOCSERGETLSR: | 2421 | case TIOCSERGETLSR: |
2418 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2422 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 6e1622f2a297..08d16e8c002d 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | /* Product information. */ | 28 | /* Product information. */ |
29 | #define FOCUS_VENDOR_ID 0x0C2E | 29 | #define FOCUS_VENDOR_ID 0x0C2E |
30 | #define FOCUS_PRODUCT_ID 0x0720 | 30 | #define FOCUS_PRODUCT_ID_BI 0x0720 |
31 | #define FOCUS_PRODUCT_ID_UNI 0x0710 | 31 | #define FOCUS_PRODUCT_ID_UNI 0x0700 |
32 | 32 | ||
33 | #define METROUSB_SET_REQUEST_TYPE 0x40 | 33 | #define METROUSB_SET_REQUEST_TYPE 0x40 |
34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 | 34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 |
@@ -47,7 +47,7 @@ struct metrousb_private { | |||
47 | 47 | ||
48 | /* Device table list. */ | 48 | /* Device table list. */ |
49 | static struct usb_device_id id_table[] = { | 49 | static struct usb_device_id id_table[] = { |
50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID) }, | 50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, |
51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, | 51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, |
52 | { }, /* Terminating entry. */ | 52 | { }, /* Terminating entry. */ |
53 | }; | 53 | }; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 836cfa9a515f..f4465ccddc35 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -708,6 +708,7 @@ static const struct usb_device_id option_ids[] = { | |||
708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, | 708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, |
709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, | 709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, |
710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, | 710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, |
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, | ||
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, | 712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, |
712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, | 713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, |
713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, | 714 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ff4a174fa5de..a1a9062954c4 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -420,7 +420,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
420 | control = priv->line_control; | 420 | control = priv->line_control; |
421 | if ((cflag & CBAUD) == B0) | 421 | if ((cflag & CBAUD) == B0) |
422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); | 422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); |
423 | else | 423 | else if ((old_termios->c_cflag & CBAUD) == B0) |
424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); | 424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); |
425 | if (control != priv->line_control) { | 425 | if (control != priv->line_control) { |
426 | control = priv->line_control; | 426 | control = priv->line_control; |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index f14465a83dd1..fdd5aa2c8d82 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -289,6 +289,7 @@ static const struct usb_device_id id_table[] = { | |||
289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ | 289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ |
290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ | 290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ |
291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ | 291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ |
292 | { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */ | ||
292 | /* Sierra Wireless C885 */ | 293 | /* Sierra Wireless C885 */ |
293 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, | 294 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, |
294 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ | 295 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 69230f01056a..97355a15bbea 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1059,6 +1059,12 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1059 | serial->attached = 1; | 1059 | serial->attached = 1; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | /* Avoid race with tty_open and serial_install by setting the | ||
1063 | * disconnected flag and not clearing it until all ports have been | ||
1064 | * registered. | ||
1065 | */ | ||
1066 | serial->disconnected = 1; | ||
1067 | |||
1062 | if (get_free_serial(serial, num_ports, &minor) == NULL) { | 1068 | if (get_free_serial(serial, num_ports, &minor) == NULL) { |
1063 | dev_err(&interface->dev, "No more free serial devices\n"); | 1069 | dev_err(&interface->dev, "No more free serial devices\n"); |
1064 | goto probe_error; | 1070 | goto probe_error; |
@@ -1070,19 +1076,16 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1070 | port = serial->port[i]; | 1076 | port = serial->port[i]; |
1071 | dev_set_name(&port->dev, "ttyUSB%d", port->number); | 1077 | dev_set_name(&port->dev, "ttyUSB%d", port->number); |
1072 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); | 1078 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); |
1073 | port->dev_state = PORT_REGISTERING; | ||
1074 | device_enable_async_suspend(&port->dev); | 1079 | device_enable_async_suspend(&port->dev); |
1075 | 1080 | ||
1076 | retval = device_add(&port->dev); | 1081 | retval = device_add(&port->dev); |
1077 | if (retval) { | 1082 | if (retval) |
1078 | dev_err(&port->dev, "Error registering port device, " | 1083 | dev_err(&port->dev, "Error registering port device, " |
1079 | "continuing\n"); | 1084 | "continuing\n"); |
1080 | port->dev_state = PORT_UNREGISTERED; | ||
1081 | } else { | ||
1082 | port->dev_state = PORT_REGISTERED; | ||
1083 | } | ||
1084 | } | 1085 | } |
1085 | 1086 | ||
1087 | serial->disconnected = 0; | ||
1088 | |||
1086 | usb_serial_console_init(debug, minor); | 1089 | usb_serial_console_init(debug, minor); |
1087 | 1090 | ||
1088 | exit: | 1091 | exit: |
@@ -1124,22 +1127,8 @@ void usb_serial_disconnect(struct usb_interface *interface) | |||
1124 | } | 1127 | } |
1125 | kill_traffic(port); | 1128 | kill_traffic(port); |
1126 | cancel_work_sync(&port->work); | 1129 | cancel_work_sync(&port->work); |
1127 | if (port->dev_state == PORT_REGISTERED) { | 1130 | if (device_is_registered(&port->dev)) |
1128 | |||
1129 | /* Make sure the port is bound so that the | ||
1130 | * driver's port_remove method is called. | ||
1131 | */ | ||
1132 | if (!port->dev.driver) { | ||
1133 | int rc; | ||
1134 | |||
1135 | port->dev.driver = | ||
1136 | &serial->type->driver; | ||
1137 | rc = device_bind_driver(&port->dev); | ||
1138 | } | ||
1139 | port->dev_state = PORT_UNREGISTERING; | ||
1140 | device_del(&port->dev); | 1131 | device_del(&port->dev); |
1141 | port->dev_state = PORT_UNREGISTERED; | ||
1142 | } | ||
1143 | } | 1132 | } |
1144 | } | 1133 | } |
1145 | serial->type->disconnect(serial); | 1134 | serial->type->disconnect(serial); |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index c18538e4a6db..2653e73db623 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -132,6 +132,35 @@ static struct us_unusual_dev for_dynamic_ids = | |||
132 | #undef COMPLIANT_DEV | 132 | #undef COMPLIANT_DEV |
133 | #undef USUAL_DEV | 133 | #undef USUAL_DEV |
134 | 134 | ||
135 | #ifdef CONFIG_LOCKDEP | ||
136 | |||
137 | static struct lock_class_key us_interface_key[USB_MAXINTERFACES]; | ||
138 | |||
139 | static void us_set_lock_class(struct mutex *mutex, | ||
140 | struct usb_interface *intf) | ||
141 | { | ||
142 | struct usb_device *udev = interface_to_usbdev(intf); | ||
143 | struct usb_host_config *config = udev->actconfig; | ||
144 | int i; | ||
145 | |||
146 | for (i = 0; i < config->desc.bNumInterfaces; i++) { | ||
147 | if (config->interface[i] == intf) | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | BUG_ON(i == config->desc.bNumInterfaces); | ||
152 | |||
153 | lockdep_set_class(mutex, &us_interface_key[i]); | ||
154 | } | ||
155 | |||
156 | #else | ||
157 | |||
158 | static void us_set_lock_class(struct mutex *mutex, | ||
159 | struct usb_interface *intf) | ||
160 | { | ||
161 | } | ||
162 | |||
163 | #endif | ||
135 | 164 | ||
136 | #ifdef CONFIG_PM /* Minimal support for suspend and resume */ | 165 | #ifdef CONFIG_PM /* Minimal support for suspend and resume */ |
137 | 166 | ||
@@ -895,6 +924,7 @@ int usb_stor_probe1(struct us_data **pus, | |||
895 | *pus = us = host_to_us(host); | 924 | *pus = us = host_to_us(host); |
896 | memset(us, 0, sizeof(struct us_data)); | 925 | memset(us, 0, sizeof(struct us_data)); |
897 | mutex_init(&(us->dev_mutex)); | 926 | mutex_init(&(us->dev_mutex)); |
927 | us_set_lock_class(&us->dev_mutex, intf); | ||
898 | init_completion(&us->cmnd_ready); | 928 | init_completion(&us->cmnd_ready); |
899 | init_completion(&(us->notify)); | 929 | init_completion(&(us->notify)); |
900 | init_waitqueue_head(&us->delay_wait); | 930 | init_waitqueue_head(&us->delay_wait); |