diff options
author | Rob Herring <rob.herring@calxeda.com> | 2013-11-07 11:34:46 -0500 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2013-11-07 11:34:46 -0500 |
commit | b5480950c6cbb7b07ab1c1a5af0dc661a1cb6f24 (patch) | |
tree | b5fcb00387a838beb2bcf2f8ed2fd3d6d460c8ae /drivers | |
parent | e363bbac316ffb5daaf45d855f82680148cafe20 (diff) | |
parent | 355e62f5ad12b005c862838156262eb2df2f8dff (diff) |
Merge remote-tracking branch 'grant/devicetree/next' into for-next
Diffstat (limited to 'drivers')
181 files changed, 1668 insertions, 1017 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 611ce9061dc5..407ad13cac2f 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -968,7 +968,7 @@ int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device) | |||
968 | } | 968 | } |
969 | return 0; | 969 | return 0; |
970 | } | 970 | } |
971 | EXPORT_SYMBOL_GPL(acpi_bus_get_device); | 971 | EXPORT_SYMBOL(acpi_bus_get_device); |
972 | 972 | ||
973 | int acpi_device_add(struct acpi_device *device, | 973 | int acpi_device_add(struct acpi_device *device, |
974 | void (*release)(struct device *)) | 974 | void (*release)(struct device *)) |
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c index c9fd6943ce45..50329d1057ed 100644 --- a/drivers/bcma/driver_pci.c +++ b/drivers/bcma/driver_pci.c | |||
@@ -210,25 +210,6 @@ static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc) | |||
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | static void bcma_core_pci_power_save(struct bcma_drv_pci *pc, bool up) | ||
214 | { | ||
215 | u16 data; | ||
216 | |||
217 | if (pc->core->id.rev >= 15 && pc->core->id.rev <= 20) { | ||
218 | data = up ? 0x74 : 0x7C; | ||
219 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
220 | BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7F64); | ||
221 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
222 | BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data); | ||
223 | } else if (pc->core->id.rev >= 21 && pc->core->id.rev <= 22) { | ||
224 | data = up ? 0x75 : 0x7D; | ||
225 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
226 | BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7E65); | ||
227 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
228 | BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data); | ||
229 | } | ||
230 | } | ||
231 | |||
232 | /************************************************** | 213 | /************************************************** |
233 | * Init. | 214 | * Init. |
234 | **************************************************/ | 215 | **************************************************/ |
@@ -255,6 +236,32 @@ void bcma_core_pci_init(struct bcma_drv_pci *pc) | |||
255 | bcma_core_pci_clientmode_init(pc); | 236 | bcma_core_pci_clientmode_init(pc); |
256 | } | 237 | } |
257 | 238 | ||
239 | void bcma_core_pci_power_save(struct bcma_bus *bus, bool up) | ||
240 | { | ||
241 | struct bcma_drv_pci *pc; | ||
242 | u16 data; | ||
243 | |||
244 | if (bus->hosttype != BCMA_HOSTTYPE_PCI) | ||
245 | return; | ||
246 | |||
247 | pc = &bus->drv_pci[0]; | ||
248 | |||
249 | if (pc->core->id.rev >= 15 && pc->core->id.rev <= 20) { | ||
250 | data = up ? 0x74 : 0x7C; | ||
251 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
252 | BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7F64); | ||
253 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
254 | BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data); | ||
255 | } else if (pc->core->id.rev >= 21 && pc->core->id.rev <= 22) { | ||
256 | data = up ? 0x75 : 0x7D; | ||
257 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
258 | BCMA_CORE_PCI_MDIO_BLK1_MGMT1, 0x7E65); | ||
259 | bcma_pcie_mdio_writeread(pc, BCMA_CORE_PCI_MDIO_BLK1, | ||
260 | BCMA_CORE_PCI_MDIO_BLK1_MGMT3, data); | ||
261 | } | ||
262 | } | ||
263 | EXPORT_SYMBOL_GPL(bcma_core_pci_power_save); | ||
264 | |||
258 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, | 265 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, |
259 | bool enable) | 266 | bool enable) |
260 | { | 267 | { |
@@ -310,8 +317,6 @@ void bcma_core_pci_up(struct bcma_bus *bus) | |||
310 | 317 | ||
311 | pc = &bus->drv_pci[0]; | 318 | pc = &bus->drv_pci[0]; |
312 | 319 | ||
313 | bcma_core_pci_power_save(pc, true); | ||
314 | |||
315 | bcma_core_pci_extend_L1timer(pc, true); | 320 | bcma_core_pci_extend_L1timer(pc, true); |
316 | } | 321 | } |
317 | EXPORT_SYMBOL_GPL(bcma_core_pci_up); | 322 | EXPORT_SYMBOL_GPL(bcma_core_pci_up); |
@@ -326,7 +331,5 @@ void bcma_core_pci_down(struct bcma_bus *bus) | |||
326 | pc = &bus->drv_pci[0]; | 331 | pc = &bus->drv_pci[0]; |
327 | 332 | ||
328 | bcma_core_pci_extend_L1timer(pc, false); | 333 | bcma_core_pci_extend_L1timer(pc, false); |
329 | |||
330 | bcma_core_pci_power_save(pc, false); | ||
331 | } | 334 | } |
332 | EXPORT_SYMBOL_GPL(bcma_core_pci_down); | 335 | EXPORT_SYMBOL_GPL(bcma_core_pci_down); |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index a12b923bbaca..0a327f4154a2 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -85,6 +85,7 @@ static struct usb_device_id ath3k_table[] = { | |||
85 | { USB_DEVICE(0x04CA, 0x3008) }, | 85 | { USB_DEVICE(0x04CA, 0x3008) }, |
86 | { USB_DEVICE(0x13d3, 0x3362) }, | 86 | { USB_DEVICE(0x13d3, 0x3362) }, |
87 | { USB_DEVICE(0x0CF3, 0xE004) }, | 87 | { USB_DEVICE(0x0CF3, 0xE004) }, |
88 | { USB_DEVICE(0x0CF3, 0xE005) }, | ||
88 | { USB_DEVICE(0x0930, 0x0219) }, | 89 | { USB_DEVICE(0x0930, 0x0219) }, |
89 | { USB_DEVICE(0x0489, 0xe057) }, | 90 | { USB_DEVICE(0x0489, 0xe057) }, |
90 | { USB_DEVICE(0x13d3, 0x3393) }, | 91 | { USB_DEVICE(0x13d3, 0x3393) }, |
@@ -126,6 +127,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
126 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 127 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
127 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 128 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
128 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 129 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
130 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, | ||
129 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 131 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
130 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, | 132 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, |
131 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | 133 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8e16f0af6358..f3dfc0a88fdc 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -102,6 +102,7 @@ static struct usb_device_id btusb_table[] = { | |||
102 | 102 | ||
103 | /* Broadcom BCM20702A0 */ | 103 | /* Broadcom BCM20702A0 */ |
104 | { USB_DEVICE(0x0b05, 0x17b5) }, | 104 | { USB_DEVICE(0x0b05, 0x17b5) }, |
105 | { USB_DEVICE(0x0b05, 0x17cb) }, | ||
105 | { USB_DEVICE(0x04ca, 0x2003) }, | 106 | { USB_DEVICE(0x04ca, 0x2003) }, |
106 | { USB_DEVICE(0x0489, 0xe042) }, | 107 | { USB_DEVICE(0x0489, 0xe042) }, |
107 | { USB_DEVICE(0x413c, 0x8197) }, | 108 | { USB_DEVICE(0x413c, 0x8197) }, |
@@ -112,6 +113,9 @@ static struct usb_device_id btusb_table[] = { | |||
112 | /*Broadcom devices with vendor specific id */ | 113 | /*Broadcom devices with vendor specific id */ |
113 | { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }, | 114 | { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }, |
114 | 115 | ||
116 | /* Belkin F8065bf - Broadcom based */ | ||
117 | { USB_VENDOR_AND_INTERFACE_INFO(0x050d, 0xff, 0x01, 0x01) }, | ||
118 | |||
115 | { } /* Terminating entry */ | 119 | { } /* Terminating entry */ |
116 | }; | 120 | }; |
117 | 121 | ||
@@ -148,6 +152,7 @@ static struct usb_device_id blacklist_table[] = { | |||
148 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 152 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
149 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 153 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
150 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 154 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
155 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, | ||
151 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 156 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
152 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, | 157 | { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, |
153 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | 158 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c index 19ab6ff53d59..2394e9753ef5 100644 --- a/drivers/bus/mvebu-mbus.c +++ b/drivers/bus/mvebu-mbus.c | |||
@@ -700,6 +700,7 @@ static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus, | |||
700 | phys_addr_t sdramwins_phys_base, | 700 | phys_addr_t sdramwins_phys_base, |
701 | size_t sdramwins_size) | 701 | size_t sdramwins_size) |
702 | { | 702 | { |
703 | struct device_node *np; | ||
703 | int win; | 704 | int win; |
704 | 705 | ||
705 | mbus->mbuswins_base = ioremap(mbuswins_phys_base, mbuswins_size); | 706 | mbus->mbuswins_base = ioremap(mbuswins_phys_base, mbuswins_size); |
@@ -712,8 +713,11 @@ static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus, | |||
712 | return -ENOMEM; | 713 | return -ENOMEM; |
713 | } | 714 | } |
714 | 715 | ||
715 | if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric")) | 716 | np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); |
717 | if (np) { | ||
716 | mbus->hw_io_coherency = 1; | 718 | mbus->hw_io_coherency = 1; |
719 | of_node_put(np); | ||
720 | } | ||
717 | 721 | ||
718 | for (win = 0; win < mbus->soc->num_wins; win++) | 722 | for (win = 0; win < mbus->soc->num_wins; win++) |
719 | mvebu_mbus_disable_window(mbus, win); | 723 | mvebu_mbus_disable_window(mbus, win); |
@@ -861,11 +865,13 @@ static void __init mvebu_mbus_get_pcie_resources(struct device_node *np, | |||
861 | int ret; | 865 | int ret; |
862 | 866 | ||
863 | /* | 867 | /* |
864 | * These are optional, so we clear them and they'll | 868 | * These are optional, so we make sure that resource_size(x) will |
865 | * be zero if they are missing from the DT. | 869 | * return 0. |
866 | */ | 870 | */ |
867 | memset(mem, 0, sizeof(struct resource)); | 871 | memset(mem, 0, sizeof(struct resource)); |
872 | mem->end = -1; | ||
868 | memset(io, 0, sizeof(struct resource)); | 873 | memset(io, 0, sizeof(struct resource)); |
874 | io->end = -1; | ||
869 | 875 | ||
870 | ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg)); | 876 | ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg)); |
871 | if (!ret) { | 877 | if (!ret) { |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 7737b5bd26af..7a744d391756 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -640,7 +640,7 @@ struct timer_rand_state { | |||
640 | */ | 640 | */ |
641 | void add_device_randomness(const void *buf, unsigned int size) | 641 | void add_device_randomness(const void *buf, unsigned int size) |
642 | { | 642 | { |
643 | unsigned long time = get_cycles() ^ jiffies; | 643 | unsigned long time = random_get_entropy() ^ jiffies; |
644 | 644 | ||
645 | mix_pool_bytes(&input_pool, buf, size, NULL); | 645 | mix_pool_bytes(&input_pool, buf, size, NULL); |
646 | mix_pool_bytes(&input_pool, &time, sizeof(time), NULL); | 646 | mix_pool_bytes(&input_pool, &time, sizeof(time), NULL); |
@@ -677,7 +677,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num) | |||
677 | goto out; | 677 | goto out; |
678 | 678 | ||
679 | sample.jiffies = jiffies; | 679 | sample.jiffies = jiffies; |
680 | sample.cycles = get_cycles(); | 680 | sample.cycles = random_get_entropy(); |
681 | sample.num = num; | 681 | sample.num = num; |
682 | mix_pool_bytes(&input_pool, &sample, sizeof(sample), NULL); | 682 | mix_pool_bytes(&input_pool, &sample, sizeof(sample), NULL); |
683 | 683 | ||
@@ -744,7 +744,7 @@ void add_interrupt_randomness(int irq, int irq_flags) | |||
744 | struct fast_pool *fast_pool = &__get_cpu_var(irq_randomness); | 744 | struct fast_pool *fast_pool = &__get_cpu_var(irq_randomness); |
745 | struct pt_regs *regs = get_irq_regs(); | 745 | struct pt_regs *regs = get_irq_regs(); |
746 | unsigned long now = jiffies; | 746 | unsigned long now = jiffies; |
747 | __u32 input[4], cycles = get_cycles(); | 747 | __u32 input[4], cycles = random_get_entropy(); |
748 | 748 | ||
749 | input[0] = cycles ^ jiffies; | 749 | input[0] = cycles ^ jiffies; |
750 | input[1] = irq; | 750 | input[1] = irq; |
@@ -1459,12 +1459,11 @@ struct ctl_table random_table[] = { | |||
1459 | 1459 | ||
1460 | static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned; | 1460 | static u32 random_int_secret[MD5_MESSAGE_BYTES / 4] ____cacheline_aligned; |
1461 | 1461 | ||
1462 | static int __init random_int_secret_init(void) | 1462 | int random_int_secret_init(void) |
1463 | { | 1463 | { |
1464 | get_random_bytes(random_int_secret, sizeof(random_int_secret)); | 1464 | get_random_bytes(random_int_secret, sizeof(random_int_secret)); |
1465 | return 0; | 1465 | return 0; |
1466 | } | 1466 | } |
1467 | late_initcall(random_int_secret_init); | ||
1468 | 1467 | ||
1469 | /* | 1468 | /* |
1470 | * Get a random word for internal kernel use only. Similar to urandom but | 1469 | * Get a random word for internal kernel use only. Similar to urandom but |
@@ -1483,7 +1482,7 @@ unsigned int get_random_int(void) | |||
1483 | 1482 | ||
1484 | hash = get_cpu_var(get_random_int_hash); | 1483 | hash = get_cpu_var(get_random_int_hash); |
1485 | 1484 | ||
1486 | hash[0] += current->pid + jiffies + get_cycles(); | 1485 | hash[0] += current->pid + jiffies + random_get_entropy(); |
1487 | md5_transform(hash, random_int_secret); | 1486 | md5_transform(hash, random_int_secret); |
1488 | ret = hash[0]; | 1487 | ret = hash[0]; |
1489 | put_cpu_var(get_random_int_hash); | 1488 | put_cpu_var(get_random_int_hash); |
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 78c49d8e0f4a..c522a95c0e16 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
@@ -229,7 +229,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
229 | if (of_property_read_u32(np, "clock-latency", &transition_latency)) | 229 | if (of_property_read_u32(np, "clock-latency", &transition_latency)) |
230 | transition_latency = CPUFREQ_ETERNAL; | 230 | transition_latency = CPUFREQ_ETERNAL; |
231 | 231 | ||
232 | if (cpu_reg) { | 232 | if (!IS_ERR(cpu_reg)) { |
233 | struct opp *opp; | 233 | struct opp *opp; |
234 | unsigned long min_uV, max_uV; | 234 | unsigned long min_uV, max_uV; |
235 | int i; | 235 | int i; |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 9733f29ed148..32b3479a2405 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -394,7 +394,10 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) | |||
394 | trace_cpu_frequency(pstate * 100000, cpu->cpu); | 394 | trace_cpu_frequency(pstate * 100000, cpu->cpu); |
395 | 395 | ||
396 | cpu->pstate.current_pstate = pstate; | 396 | cpu->pstate.current_pstate = pstate; |
397 | wrmsrl(MSR_IA32_PERF_CTL, pstate << 8); | 397 | if (limits.no_turbo) |
398 | wrmsrl(MSR_IA32_PERF_CTL, BIT(32) | (pstate << 8)); | ||
399 | else | ||
400 | wrmsrl(MSR_IA32_PERF_CTL, pstate << 8); | ||
398 | 401 | ||
399 | } | 402 | } |
400 | 403 | ||
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c index 19e364fa5955..3f418166ce02 100644 --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c | |||
@@ -113,7 +113,7 @@ static int spear_cpufreq_target(struct cpufreq_policy *policy, | |||
113 | unsigned int target_freq, unsigned int relation) | 113 | unsigned int target_freq, unsigned int relation) |
114 | { | 114 | { |
115 | struct cpufreq_freqs freqs; | 115 | struct cpufreq_freqs freqs; |
116 | unsigned long newfreq; | 116 | long newfreq; |
117 | struct clk *srcclk; | 117 | struct clk *srcclk; |
118 | int index, ret, mult = 1; | 118 | int index, ret, mult = 1; |
119 | 119 | ||
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 30548701665c..bc6d820812b6 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c | |||
@@ -227,7 +227,7 @@ static int caam_probe(struct platform_device *pdev) | |||
227 | topregs = (struct caam_full __iomem *)ctrl; | 227 | topregs = (struct caam_full __iomem *)ctrl; |
228 | 228 | ||
229 | /* Get the IRQ of the controller (for security violations only) */ | 229 | /* Get the IRQ of the controller (for security violations only) */ |
230 | ctrlpriv->secvio_irq = of_irq_to_resource(nprop, 0, NULL); | 230 | ctrlpriv->secvio_irq = irq_of_parse_and_map(nprop, 0); |
231 | 231 | ||
232 | /* | 232 | /* |
233 | * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel, | 233 | * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel, |
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 94b80a937647..bdb786d5a5e5 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c | |||
@@ -405,7 +405,7 @@ int caam_jr_probe(struct platform_device *pdev, struct device_node *np, | |||
405 | dma_set_mask(jrdev, DMA_BIT_MASK(32)); | 405 | dma_set_mask(jrdev, DMA_BIT_MASK(32)); |
406 | 406 | ||
407 | /* Identify the interrupt */ | 407 | /* Identify the interrupt */ |
408 | jrpriv->irq = of_irq_to_resource(np, 0, NULL); | 408 | jrpriv->irq = irq_of_parse_and_map(np, 0); |
409 | 409 | ||
410 | /* Now do the platform independent part */ | 410 | /* Now do the platform independent part */ |
411 | error = caam_jr_init(jrdev); /* now turn on hardware */ | 411 | error = caam_jr_init(jrdev); /* now turn on hardware */ |
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 8bdde57f6bb1..e28104b4aab0 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c | |||
@@ -1818,7 +1818,7 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd, | |||
1818 | goto err; | 1818 | goto err; |
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | dd->irq = of_irq_to_resource(node, 0, NULL); | 1821 | dd->irq = irq_of_parse_and_map(node, 0); |
1822 | if (!dd->irq) { | 1822 | if (!dd->irq) { |
1823 | dev_err(dev, "can't translate OF irq value\n"); | 1823 | dev_err(dev, "can't translate OF irq value\n"); |
1824 | err = -EINVAL; | 1824 | err = -EINVAL; |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 526ec77c7ba0..f238cfd33847 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -198,6 +198,7 @@ config TI_EDMA | |||
198 | depends on ARCH_DAVINCI || ARCH_OMAP | 198 | depends on ARCH_DAVINCI || ARCH_OMAP |
199 | select DMA_ENGINE | 199 | select DMA_ENGINE |
200 | select DMA_VIRTUAL_CHANNELS | 200 | select DMA_VIRTUAL_CHANNELS |
201 | select TI_PRIV_EDMA | ||
201 | default n | 202 | default n |
202 | help | 203 | help |
203 | Enable support for the TI EDMA controller. This DMA | 204 | Enable support for the TI EDMA controller. This DMA |
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index ff50ff4c6a57..3519111c566b 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -306,6 +306,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg( | |||
306 | EDMA_SLOT_ANY); | 306 | EDMA_SLOT_ANY); |
307 | if (echan->slot[i] < 0) { | 307 | if (echan->slot[i] < 0) { |
308 | dev_err(dev, "Failed to allocate slot\n"); | 308 | dev_err(dev, "Failed to allocate slot\n"); |
309 | kfree(edesc); | ||
309 | return NULL; | 310 | return NULL; |
310 | } | 311 | } |
311 | } | 312 | } |
@@ -749,6 +750,6 @@ static void __exit edma_exit(void) | |||
749 | } | 750 | } |
750 | module_exit(edma_exit); | 751 | module_exit(edma_exit); |
751 | 752 | ||
752 | MODULE_AUTHOR("Matt Porter <mporter@ti.com>"); | 753 | MODULE_AUTHOR("Matt Porter <matt.porter@linaro.org>"); |
753 | MODULE_DESCRIPTION("TI EDMA DMA engine driver"); | 754 | MODULE_DESCRIPTION("TI EDMA DMA engine driver"); |
754 | MODULE_LICENSE("GPL v2"); | 755 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 78f8ca5fccee..55852c026791 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -437,17 +437,18 @@ static void dma_irq_handle_channel(struct imxdma_channel *imxdmac) | |||
437 | struct imxdma_engine *imxdma = imxdmac->imxdma; | 437 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
438 | int chno = imxdmac->channel; | 438 | int chno = imxdmac->channel; |
439 | struct imxdma_desc *desc; | 439 | struct imxdma_desc *desc; |
440 | unsigned long flags; | ||
440 | 441 | ||
441 | spin_lock(&imxdma->lock); | 442 | spin_lock_irqsave(&imxdma->lock, flags); |
442 | if (list_empty(&imxdmac->ld_active)) { | 443 | if (list_empty(&imxdmac->ld_active)) { |
443 | spin_unlock(&imxdma->lock); | 444 | spin_unlock_irqrestore(&imxdma->lock, flags); |
444 | goto out; | 445 | goto out; |
445 | } | 446 | } |
446 | 447 | ||
447 | desc = list_first_entry(&imxdmac->ld_active, | 448 | desc = list_first_entry(&imxdmac->ld_active, |
448 | struct imxdma_desc, | 449 | struct imxdma_desc, |
449 | node); | 450 | node); |
450 | spin_unlock(&imxdma->lock); | 451 | spin_unlock_irqrestore(&imxdma->lock, flags); |
451 | 452 | ||
452 | if (desc->sg) { | 453 | if (desc->sg) { |
453 | u32 tmp; | 454 | u32 tmp; |
@@ -519,7 +520,6 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) | |||
519 | { | 520 | { |
520 | struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan); | 521 | struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan); |
521 | struct imxdma_engine *imxdma = imxdmac->imxdma; | 522 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
522 | unsigned long flags; | ||
523 | int slot = -1; | 523 | int slot = -1; |
524 | int i; | 524 | int i; |
525 | 525 | ||
@@ -527,7 +527,6 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) | |||
527 | switch (d->type) { | 527 | switch (d->type) { |
528 | case IMXDMA_DESC_INTERLEAVED: | 528 | case IMXDMA_DESC_INTERLEAVED: |
529 | /* Try to get a free 2D slot */ | 529 | /* Try to get a free 2D slot */ |
530 | spin_lock_irqsave(&imxdma->lock, flags); | ||
531 | for (i = 0; i < IMX_DMA_2D_SLOTS; i++) { | 530 | for (i = 0; i < IMX_DMA_2D_SLOTS; i++) { |
532 | if ((imxdma->slots_2d[i].count > 0) && | 531 | if ((imxdma->slots_2d[i].count > 0) && |
533 | ((imxdma->slots_2d[i].xsr != d->x) || | 532 | ((imxdma->slots_2d[i].xsr != d->x) || |
@@ -537,10 +536,8 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) | |||
537 | slot = i; | 536 | slot = i; |
538 | break; | 537 | break; |
539 | } | 538 | } |
540 | if (slot < 0) { | 539 | if (slot < 0) |
541 | spin_unlock_irqrestore(&imxdma->lock, flags); | ||
542 | return -EBUSY; | 540 | return -EBUSY; |
543 | } | ||
544 | 541 | ||
545 | imxdma->slots_2d[slot].xsr = d->x; | 542 | imxdma->slots_2d[slot].xsr = d->x; |
546 | imxdma->slots_2d[slot].ysr = d->y; | 543 | imxdma->slots_2d[slot].ysr = d->y; |
@@ -549,7 +546,6 @@ static int imxdma_xfer_desc(struct imxdma_desc *d) | |||
549 | 546 | ||
550 | imxdmac->slot_2d = slot; | 547 | imxdmac->slot_2d = slot; |
551 | imxdmac->enabled_2d = true; | 548 | imxdmac->enabled_2d = true; |
552 | spin_unlock_irqrestore(&imxdma->lock, flags); | ||
553 | 549 | ||
554 | if (slot == IMX_DMA_2D_SLOT_A) { | 550 | if (slot == IMX_DMA_2D_SLOT_A) { |
555 | d->config_mem &= ~CCR_MSEL_B; | 551 | d->config_mem &= ~CCR_MSEL_B; |
@@ -625,18 +621,17 @@ static void imxdma_tasklet(unsigned long data) | |||
625 | struct imxdma_channel *imxdmac = (void *)data; | 621 | struct imxdma_channel *imxdmac = (void *)data; |
626 | struct imxdma_engine *imxdma = imxdmac->imxdma; | 622 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
627 | struct imxdma_desc *desc; | 623 | struct imxdma_desc *desc; |
624 | unsigned long flags; | ||
628 | 625 | ||
629 | spin_lock(&imxdma->lock); | 626 | spin_lock_irqsave(&imxdma->lock, flags); |
630 | 627 | ||
631 | if (list_empty(&imxdmac->ld_active)) { | 628 | if (list_empty(&imxdmac->ld_active)) { |
632 | /* Someone might have called terminate all */ | 629 | /* Someone might have called terminate all */ |
633 | goto out; | 630 | spin_unlock_irqrestore(&imxdma->lock, flags); |
631 | return; | ||
634 | } | 632 | } |
635 | desc = list_first_entry(&imxdmac->ld_active, struct imxdma_desc, node); | 633 | desc = list_first_entry(&imxdmac->ld_active, struct imxdma_desc, node); |
636 | 634 | ||
637 | if (desc->desc.callback) | ||
638 | desc->desc.callback(desc->desc.callback_param); | ||
639 | |||
640 | /* If we are dealing with a cyclic descriptor, keep it on ld_active | 635 | /* If we are dealing with a cyclic descriptor, keep it on ld_active |
641 | * and dont mark the descriptor as complete. | 636 | * and dont mark the descriptor as complete. |
642 | * Only in non-cyclic cases it would be marked as complete | 637 | * Only in non-cyclic cases it would be marked as complete |
@@ -663,7 +658,11 @@ static void imxdma_tasklet(unsigned long data) | |||
663 | __func__, imxdmac->channel); | 658 | __func__, imxdmac->channel); |
664 | } | 659 | } |
665 | out: | 660 | out: |
666 | spin_unlock(&imxdma->lock); | 661 | spin_unlock_irqrestore(&imxdma->lock, flags); |
662 | |||
663 | if (desc->desc.callback) | ||
664 | desc->desc.callback(desc->desc.callback_param); | ||
665 | |||
667 | } | 666 | } |
668 | 667 | ||
669 | static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | 668 | static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, |
@@ -883,7 +882,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic( | |||
883 | kfree(imxdmac->sg_list); | 882 | kfree(imxdmac->sg_list); |
884 | 883 | ||
885 | imxdmac->sg_list = kcalloc(periods + 1, | 884 | imxdmac->sg_list = kcalloc(periods + 1, |
886 | sizeof(struct scatterlist), GFP_KERNEL); | 885 | sizeof(struct scatterlist), GFP_ATOMIC); |
887 | if (!imxdmac->sg_list) | 886 | if (!imxdmac->sg_list) |
888 | return NULL; | 887 | return NULL; |
889 | 888 | ||
diff --git a/drivers/dma/sh/rcar-hpbdma.c b/drivers/dma/sh/rcar-hpbdma.c index 45a520281ce1..ebad84591a6e 100644 --- a/drivers/dma/sh/rcar-hpbdma.c +++ b/drivers/dma/sh/rcar-hpbdma.c | |||
@@ -93,6 +93,7 @@ struct hpb_dmae_chan { | |||
93 | void __iomem *base; | 93 | void __iomem *base; |
94 | const struct hpb_dmae_slave_config *cfg; | 94 | const struct hpb_dmae_slave_config *cfg; |
95 | char dev_id[16]; /* unique name per DMAC of channel */ | 95 | char dev_id[16]; /* unique name per DMAC of channel */ |
96 | dma_addr_t slave_addr; | ||
96 | }; | 97 | }; |
97 | 98 | ||
98 | struct hpb_dmae_device { | 99 | struct hpb_dmae_device { |
@@ -432,7 +433,6 @@ hpb_dmae_alloc_chan_resources(struct hpb_dmae_chan *hpb_chan, | |||
432 | hpb_chan->xfer_mode = XFER_DOUBLE; | 433 | hpb_chan->xfer_mode = XFER_DOUBLE; |
433 | } else { | 434 | } else { |
434 | dev_err(hpb_chan->shdma_chan.dev, "DCR setting error"); | 435 | dev_err(hpb_chan->shdma_chan.dev, "DCR setting error"); |
435 | shdma_free_irq(&hpb_chan->shdma_chan); | ||
436 | return -EINVAL; | 436 | return -EINVAL; |
437 | } | 437 | } |
438 | 438 | ||
@@ -446,7 +446,8 @@ hpb_dmae_alloc_chan_resources(struct hpb_dmae_chan *hpb_chan, | |||
446 | return 0; | 446 | return 0; |
447 | } | 447 | } |
448 | 448 | ||
449 | static int hpb_dmae_set_slave(struct shdma_chan *schan, int slave_id, bool try) | 449 | static int hpb_dmae_set_slave(struct shdma_chan *schan, int slave_id, |
450 | dma_addr_t slave_addr, bool try) | ||
450 | { | 451 | { |
451 | struct hpb_dmae_chan *chan = to_chan(schan); | 452 | struct hpb_dmae_chan *chan = to_chan(schan); |
452 | const struct hpb_dmae_slave_config *sc = | 453 | const struct hpb_dmae_slave_config *sc = |
@@ -457,6 +458,7 @@ static int hpb_dmae_set_slave(struct shdma_chan *schan, int slave_id, bool try) | |||
457 | if (try) | 458 | if (try) |
458 | return 0; | 459 | return 0; |
459 | chan->cfg = sc; | 460 | chan->cfg = sc; |
461 | chan->slave_addr = slave_addr ? : sc->addr; | ||
460 | return hpb_dmae_alloc_chan_resources(chan, sc); | 462 | return hpb_dmae_alloc_chan_resources(chan, sc); |
461 | } | 463 | } |
462 | 464 | ||
@@ -468,7 +470,7 @@ static dma_addr_t hpb_dmae_slave_addr(struct shdma_chan *schan) | |||
468 | { | 470 | { |
469 | struct hpb_dmae_chan *chan = to_chan(schan); | 471 | struct hpb_dmae_chan *chan = to_chan(schan); |
470 | 472 | ||
471 | return chan->cfg->addr; | 473 | return chan->slave_addr; |
472 | } | 474 | } |
473 | 475 | ||
474 | static struct shdma_desc *hpb_dmae_embedded_desc(void *buf, int i) | 476 | static struct shdma_desc *hpb_dmae_embedded_desc(void *buf, int i) |
@@ -614,7 +616,6 @@ static void hpb_dmae_chan_remove(struct hpb_dmae_device *hpbdev) | |||
614 | shdma_for_each_chan(schan, &hpbdev->shdma_dev, i) { | 616 | shdma_for_each_chan(schan, &hpbdev->shdma_dev, i) { |
615 | BUG_ON(!schan); | 617 | BUG_ON(!schan); |
616 | 618 | ||
617 | shdma_free_irq(schan); | ||
618 | shdma_chan_remove(schan); | 619 | shdma_chan_remove(schan); |
619 | } | 620 | } |
620 | dma_dev->chancnt = 0; | 621 | dma_dev->chancnt = 0; |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 0ff43552d472..89675f862308 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -63,6 +63,7 @@ struct gpio_bank { | |||
63 | struct gpio_chip chip; | 63 | struct gpio_chip chip; |
64 | struct clk *dbck; | 64 | struct clk *dbck; |
65 | u32 mod_usage; | 65 | u32 mod_usage; |
66 | u32 irq_usage; | ||
66 | u32 dbck_enable_mask; | 67 | u32 dbck_enable_mask; |
67 | bool dbck_enabled; | 68 | bool dbck_enabled; |
68 | struct device *dev; | 69 | struct device *dev; |
@@ -86,6 +87,9 @@ struct gpio_bank { | |||
86 | #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio)) | 87 | #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio)) |
87 | #define GPIO_MOD_CTRL_BIT BIT(0) | 88 | #define GPIO_MOD_CTRL_BIT BIT(0) |
88 | 89 | ||
90 | #define BANK_USED(bank) (bank->mod_usage || bank->irq_usage) | ||
91 | #define LINE_USED(line, offset) (line & (1 << offset)) | ||
92 | |||
89 | static int irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq) | 93 | static int irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq) |
90 | { | 94 | { |
91 | return bank->chip.base + gpio_irq; | 95 | return bank->chip.base + gpio_irq; |
@@ -420,15 +424,69 @@ static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, | |||
420 | return 0; | 424 | return 0; |
421 | } | 425 | } |
422 | 426 | ||
427 | static void _enable_gpio_module(struct gpio_bank *bank, unsigned offset) | ||
428 | { | ||
429 | if (bank->regs->pinctrl) { | ||
430 | void __iomem *reg = bank->base + bank->regs->pinctrl; | ||
431 | |||
432 | /* Claim the pin for MPU */ | ||
433 | __raw_writel(__raw_readl(reg) | (1 << offset), reg); | ||
434 | } | ||
435 | |||
436 | if (bank->regs->ctrl && !BANK_USED(bank)) { | ||
437 | void __iomem *reg = bank->base + bank->regs->ctrl; | ||
438 | u32 ctrl; | ||
439 | |||
440 | ctrl = __raw_readl(reg); | ||
441 | /* Module is enabled, clocks are not gated */ | ||
442 | ctrl &= ~GPIO_MOD_CTRL_BIT; | ||
443 | __raw_writel(ctrl, reg); | ||
444 | bank->context.ctrl = ctrl; | ||
445 | } | ||
446 | } | ||
447 | |||
448 | static void _disable_gpio_module(struct gpio_bank *bank, unsigned offset) | ||
449 | { | ||
450 | void __iomem *base = bank->base; | ||
451 | |||
452 | if (bank->regs->wkup_en && | ||
453 | !LINE_USED(bank->mod_usage, offset) && | ||
454 | !LINE_USED(bank->irq_usage, offset)) { | ||
455 | /* Disable wake-up during idle for dynamic tick */ | ||
456 | _gpio_rmw(base, bank->regs->wkup_en, 1 << offset, 0); | ||
457 | bank->context.wake_en = | ||
458 | __raw_readl(bank->base + bank->regs->wkup_en); | ||
459 | } | ||
460 | |||
461 | if (bank->regs->ctrl && !BANK_USED(bank)) { | ||
462 | void __iomem *reg = bank->base + bank->regs->ctrl; | ||
463 | u32 ctrl; | ||
464 | |||
465 | ctrl = __raw_readl(reg); | ||
466 | /* Module is disabled, clocks are gated */ | ||
467 | ctrl |= GPIO_MOD_CTRL_BIT; | ||
468 | __raw_writel(ctrl, reg); | ||
469 | bank->context.ctrl = ctrl; | ||
470 | } | ||
471 | } | ||
472 | |||
473 | static int gpio_is_input(struct gpio_bank *bank, int mask) | ||
474 | { | ||
475 | void __iomem *reg = bank->base + bank->regs->direction; | ||
476 | |||
477 | return __raw_readl(reg) & mask; | ||
478 | } | ||
479 | |||
423 | static int gpio_irq_type(struct irq_data *d, unsigned type) | 480 | static int gpio_irq_type(struct irq_data *d, unsigned type) |
424 | { | 481 | { |
425 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 482 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
426 | unsigned gpio = 0; | 483 | unsigned gpio = 0; |
427 | int retval; | 484 | int retval; |
428 | unsigned long flags; | 485 | unsigned long flags; |
486 | unsigned offset; | ||
429 | 487 | ||
430 | if (WARN_ON(!bank->mod_usage)) | 488 | if (!BANK_USED(bank)) |
431 | return -EINVAL; | 489 | pm_runtime_get_sync(bank->dev); |
432 | 490 | ||
433 | #ifdef CONFIG_ARCH_OMAP1 | 491 | #ifdef CONFIG_ARCH_OMAP1 |
434 | if (d->irq > IH_MPUIO_BASE) | 492 | if (d->irq > IH_MPUIO_BASE) |
@@ -446,7 +504,17 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) | |||
446 | return -EINVAL; | 504 | return -EINVAL; |
447 | 505 | ||
448 | spin_lock_irqsave(&bank->lock, flags); | 506 | spin_lock_irqsave(&bank->lock, flags); |
449 | retval = _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), type); | 507 | offset = GPIO_INDEX(bank, gpio); |
508 | retval = _set_gpio_triggering(bank, offset, type); | ||
509 | if (!LINE_USED(bank->mod_usage, offset)) { | ||
510 | _enable_gpio_module(bank, offset); | ||
511 | _set_gpio_direction(bank, offset, 1); | ||
512 | } else if (!gpio_is_input(bank, 1 << offset)) { | ||
513 | spin_unlock_irqrestore(&bank->lock, flags); | ||
514 | return -EINVAL; | ||
515 | } | ||
516 | |||
517 | bank->irq_usage |= 1 << GPIO_INDEX(bank, gpio); | ||
450 | spin_unlock_irqrestore(&bank->lock, flags); | 518 | spin_unlock_irqrestore(&bank->lock, flags); |
451 | 519 | ||
452 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) | 520 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) |
@@ -603,35 +671,19 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
603 | * If this is the first gpio_request for the bank, | 671 | * If this is the first gpio_request for the bank, |
604 | * enable the bank module. | 672 | * enable the bank module. |
605 | */ | 673 | */ |
606 | if (!bank->mod_usage) | 674 | if (!BANK_USED(bank)) |
607 | pm_runtime_get_sync(bank->dev); | 675 | pm_runtime_get_sync(bank->dev); |
608 | 676 | ||
609 | spin_lock_irqsave(&bank->lock, flags); | 677 | spin_lock_irqsave(&bank->lock, flags); |
610 | /* Set trigger to none. You need to enable the desired trigger with | 678 | /* Set trigger to none. You need to enable the desired trigger with |
611 | * request_irq() or set_irq_type(). | 679 | * request_irq() or set_irq_type(). Only do this if the IRQ line has |
680 | * not already been requested. | ||
612 | */ | 681 | */ |
613 | _set_gpio_triggering(bank, offset, IRQ_TYPE_NONE); | 682 | if (!LINE_USED(bank->irq_usage, offset)) { |
614 | 683 | _set_gpio_triggering(bank, offset, IRQ_TYPE_NONE); | |
615 | if (bank->regs->pinctrl) { | 684 | _enable_gpio_module(bank, offset); |
616 | void __iomem *reg = bank->base + bank->regs->pinctrl; | ||
617 | |||
618 | /* Claim the pin for MPU */ | ||
619 | __raw_writel(__raw_readl(reg) | (1 << offset), reg); | ||
620 | } | ||
621 | |||
622 | if (bank->regs->ctrl && !bank->mod_usage) { | ||
623 | void __iomem *reg = bank->base + bank->regs->ctrl; | ||
624 | u32 ctrl; | ||
625 | |||
626 | ctrl = __raw_readl(reg); | ||
627 | /* Module is enabled, clocks are not gated */ | ||
628 | ctrl &= ~GPIO_MOD_CTRL_BIT; | ||
629 | __raw_writel(ctrl, reg); | ||
630 | bank->context.ctrl = ctrl; | ||
631 | } | 685 | } |
632 | |||
633 | bank->mod_usage |= 1 << offset; | 686 | bank->mod_usage |= 1 << offset; |
634 | |||
635 | spin_unlock_irqrestore(&bank->lock, flags); | 687 | spin_unlock_irqrestore(&bank->lock, flags); |
636 | 688 | ||
637 | return 0; | 689 | return 0; |
@@ -640,31 +692,11 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
640 | static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) | 692 | static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) |
641 | { | 693 | { |
642 | struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); | 694 | struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); |
643 | void __iomem *base = bank->base; | ||
644 | unsigned long flags; | 695 | unsigned long flags; |
645 | 696 | ||
646 | spin_lock_irqsave(&bank->lock, flags); | 697 | spin_lock_irqsave(&bank->lock, flags); |
647 | |||
648 | if (bank->regs->wkup_en) { | ||
649 | /* Disable wake-up during idle for dynamic tick */ | ||
650 | _gpio_rmw(base, bank->regs->wkup_en, 1 << offset, 0); | ||
651 | bank->context.wake_en = | ||
652 | __raw_readl(bank->base + bank->regs->wkup_en); | ||
653 | } | ||
654 | |||
655 | bank->mod_usage &= ~(1 << offset); | 698 | bank->mod_usage &= ~(1 << offset); |
656 | 699 | _disable_gpio_module(bank, offset); | |
657 | if (bank->regs->ctrl && !bank->mod_usage) { | ||
658 | void __iomem *reg = bank->base + bank->regs->ctrl; | ||
659 | u32 ctrl; | ||
660 | |||
661 | ctrl = __raw_readl(reg); | ||
662 | /* Module is disabled, clocks are gated */ | ||
663 | ctrl |= GPIO_MOD_CTRL_BIT; | ||
664 | __raw_writel(ctrl, reg); | ||
665 | bank->context.ctrl = ctrl; | ||
666 | } | ||
667 | |||
668 | _reset_gpio(bank, bank->chip.base + offset); | 700 | _reset_gpio(bank, bank->chip.base + offset); |
669 | spin_unlock_irqrestore(&bank->lock, flags); | 701 | spin_unlock_irqrestore(&bank->lock, flags); |
670 | 702 | ||
@@ -672,7 +704,7 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) | |||
672 | * If this is the last gpio to be freed in the bank, | 704 | * If this is the last gpio to be freed in the bank, |
673 | * disable the bank module. | 705 | * disable the bank module. |
674 | */ | 706 | */ |
675 | if (!bank->mod_usage) | 707 | if (!BANK_USED(bank)) |
676 | pm_runtime_put(bank->dev); | 708 | pm_runtime_put(bank->dev); |
677 | } | 709 | } |
678 | 710 | ||
@@ -762,10 +794,20 @@ static void gpio_irq_shutdown(struct irq_data *d) | |||
762 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); | 794 | struct gpio_bank *bank = irq_data_get_irq_chip_data(d); |
763 | unsigned int gpio = irq_to_gpio(bank, d->hwirq); | 795 | unsigned int gpio = irq_to_gpio(bank, d->hwirq); |
764 | unsigned long flags; | 796 | unsigned long flags; |
797 | unsigned offset = GPIO_INDEX(bank, gpio); | ||
765 | 798 | ||
766 | spin_lock_irqsave(&bank->lock, flags); | 799 | spin_lock_irqsave(&bank->lock, flags); |
800 | bank->irq_usage &= ~(1 << offset); | ||
801 | _disable_gpio_module(bank, offset); | ||
767 | _reset_gpio(bank, gpio); | 802 | _reset_gpio(bank, gpio); |
768 | spin_unlock_irqrestore(&bank->lock, flags); | 803 | spin_unlock_irqrestore(&bank->lock, flags); |
804 | |||
805 | /* | ||
806 | * If this is the last IRQ to be freed in the bank, | ||
807 | * disable the bank module. | ||
808 | */ | ||
809 | if (!BANK_USED(bank)) | ||
810 | pm_runtime_put(bank->dev); | ||
769 | } | 811 | } |
770 | 812 | ||
771 | static void gpio_ack_irq(struct irq_data *d) | 813 | static void gpio_ack_irq(struct irq_data *d) |
@@ -897,13 +939,6 @@ static int gpio_input(struct gpio_chip *chip, unsigned offset) | |||
897 | return 0; | 939 | return 0; |
898 | } | 940 | } |
899 | 941 | ||
900 | static int gpio_is_input(struct gpio_bank *bank, int mask) | ||
901 | { | ||
902 | void __iomem *reg = bank->base + bank->regs->direction; | ||
903 | |||
904 | return __raw_readl(reg) & mask; | ||
905 | } | ||
906 | |||
907 | static int gpio_get(struct gpio_chip *chip, unsigned offset) | 942 | static int gpio_get(struct gpio_chip *chip, unsigned offset) |
908 | { | 943 | { |
909 | struct gpio_bank *bank; | 944 | struct gpio_bank *bank; |
@@ -922,13 +957,22 @@ static int gpio_output(struct gpio_chip *chip, unsigned offset, int value) | |||
922 | { | 957 | { |
923 | struct gpio_bank *bank; | 958 | struct gpio_bank *bank; |
924 | unsigned long flags; | 959 | unsigned long flags; |
960 | int retval = 0; | ||
925 | 961 | ||
926 | bank = container_of(chip, struct gpio_bank, chip); | 962 | bank = container_of(chip, struct gpio_bank, chip); |
927 | spin_lock_irqsave(&bank->lock, flags); | 963 | spin_lock_irqsave(&bank->lock, flags); |
964 | |||
965 | if (LINE_USED(bank->irq_usage, offset)) { | ||
966 | retval = -EINVAL; | ||
967 | goto exit; | ||
968 | } | ||
969 | |||
928 | bank->set_dataout(bank, offset, value); | 970 | bank->set_dataout(bank, offset, value); |
929 | _set_gpio_direction(bank, offset, 0); | 971 | _set_gpio_direction(bank, offset, 0); |
972 | |||
973 | exit: | ||
930 | spin_unlock_irqrestore(&bank->lock, flags); | 974 | spin_unlock_irqrestore(&bank->lock, flags); |
931 | return 0; | 975 | return retval; |
932 | } | 976 | } |
933 | 977 | ||
934 | static int gpio_debounce(struct gpio_chip *chip, unsigned offset, | 978 | static int gpio_debounce(struct gpio_chip *chip, unsigned offset, |
@@ -1400,7 +1444,7 @@ void omap2_gpio_prepare_for_idle(int pwr_mode) | |||
1400 | struct gpio_bank *bank; | 1444 | struct gpio_bank *bank; |
1401 | 1445 | ||
1402 | list_for_each_entry(bank, &omap_gpio_list, node) { | 1446 | list_for_each_entry(bank, &omap_gpio_list, node) { |
1403 | if (!bank->mod_usage || !bank->loses_context) | 1447 | if (!BANK_USED(bank) || !bank->loses_context) |
1404 | continue; | 1448 | continue; |
1405 | 1449 | ||
1406 | bank->power_mode = pwr_mode; | 1450 | bank->power_mode = pwr_mode; |
@@ -1414,7 +1458,7 @@ void omap2_gpio_resume_after_idle(void) | |||
1414 | struct gpio_bank *bank; | 1458 | struct gpio_bank *bank; |
1415 | 1459 | ||
1416 | list_for_each_entry(bank, &omap_gpio_list, node) { | 1460 | list_for_each_entry(bank, &omap_gpio_list, node) { |
1417 | if (!bank->mod_usage || !bank->loses_context) | 1461 | if (!BANK_USED(bank) || !bank->loses_context) |
1418 | continue; | 1462 | continue; |
1419 | 1463 | ||
1420 | pm_runtime_get_sync(bank->dev); | 1464 | pm_runtime_get_sync(bank->dev); |
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index e3745eb07570..6038966ab045 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c | |||
@@ -293,10 +293,9 @@ static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p) | |||
293 | if (pdata) { | 293 | if (pdata) { |
294 | p->config = *pdata; | 294 | p->config = *pdata; |
295 | } else if (IS_ENABLED(CONFIG_OF) && np) { | 295 | } else if (IS_ENABLED(CONFIG_OF) && np) { |
296 | ret = of_parse_phandle_with_args(np, "gpio-ranges", | 296 | ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, |
297 | "#gpio-range-cells", 0, &args); | 297 | &args); |
298 | p->config.number_of_pins = ret == 0 && args.args_count == 3 | 298 | p->config.number_of_pins = ret == 0 ? args.args[2] |
299 | ? args.args[2] | ||
300 | : RCAR_MAX_GPIO_PER_BANK; | 299 | : RCAR_MAX_GPIO_PER_BANK; |
301 | p->config.gpio_base = -1; | 300 | p->config.gpio_base = -1; |
302 | } | 301 | } |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1688ff500513..830f7501cb4d 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -2925,6 +2925,8 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) | |||
2925 | /* Speaker Allocation Data Block */ | 2925 | /* Speaker Allocation Data Block */ |
2926 | if (dbl == 3) { | 2926 | if (dbl == 3) { |
2927 | *sadb = kmalloc(dbl, GFP_KERNEL); | 2927 | *sadb = kmalloc(dbl, GFP_KERNEL); |
2928 | if (!*sadb) | ||
2929 | return -ENOMEM; | ||
2928 | memcpy(*sadb, &db[1], dbl); | 2930 | memcpy(*sadb, &db[1], dbl); |
2929 | count = dbl; | 2931 | count = dbl; |
2930 | break; | 2932 | break; |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index f6f6cc7fc133..3d13ca6e257f 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -416,14 +416,6 @@ static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode) | |||
416 | return; | 416 | return; |
417 | 417 | ||
418 | /* | 418 | /* |
419 | * fbdev->blank can be called from irq context in case of a panic. | ||
420 | * Since we already have our own special panic handler which will | ||
421 | * restore the fbdev console mode completely, just bail out early. | ||
422 | */ | ||
423 | if (oops_in_progress) | ||
424 | return; | ||
425 | |||
426 | /* | ||
427 | * For each CRTC in this fb, turn the connectors on/off. | 419 | * For each CRTC in this fb, turn the connectors on/off. |
428 | */ | 420 | */ |
429 | drm_modeset_lock_all(dev); | 421 | drm_modeset_lock_all(dev); |
diff --git a/drivers/gpu/drm/gma500/gtt.c b/drivers/gpu/drm/gma500/gtt.c index 92babac362ec..2db731f00930 100644 --- a/drivers/gpu/drm/gma500/gtt.c +++ b/drivers/gpu/drm/gma500/gtt.c | |||
@@ -204,6 +204,7 @@ static int psb_gtt_attach_pages(struct gtt_range *gt) | |||
204 | if (IS_ERR(pages)) | 204 | if (IS_ERR(pages)) |
205 | return PTR_ERR(pages); | 205 | return PTR_ERR(pages); |
206 | 206 | ||
207 | gt->npage = gt->gem.size / PAGE_SIZE; | ||
207 | gt->pages = pages; | 208 | gt->pages = pages; |
208 | 209 | ||
209 | return 0; | 210 | return 0; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index c27a21034a5e..d5c784d48671 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1290,12 +1290,9 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1290 | * then we do not take part in VGA arbitration and the | 1290 | * then we do not take part in VGA arbitration and the |
1291 | * vga_client_register() fails with -ENODEV. | 1291 | * vga_client_register() fails with -ENODEV. |
1292 | */ | 1292 | */ |
1293 | if (!HAS_PCH_SPLIT(dev)) { | 1293 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); |
1294 | ret = vga_client_register(dev->pdev, dev, NULL, | 1294 | if (ret && ret != -ENODEV) |
1295 | i915_vga_set_decode); | 1295 | goto out; |
1296 | if (ret && ret != -ENODEV) | ||
1297 | goto out; | ||
1298 | } | ||
1299 | 1296 | ||
1300 | intel_register_dsm_handler(); | 1297 | intel_register_dsm_handler(); |
1301 | 1298 | ||
@@ -1351,12 +1348,6 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1351 | */ | 1348 | */ |
1352 | intel_fbdev_initial_config(dev); | 1349 | intel_fbdev_initial_config(dev); |
1353 | 1350 | ||
1354 | /* | ||
1355 | * Must do this after fbcon init so that | ||
1356 | * vgacon_save_screen() works during the handover. | ||
1357 | */ | ||
1358 | i915_disable_vga_mem(dev); | ||
1359 | |||
1360 | /* Only enable hotplug handling once the fbdev is fully set up. */ | 1351 | /* Only enable hotplug handling once the fbdev is fully set up. */ |
1361 | dev_priv->enable_hotplug_processing = true; | 1352 | dev_priv->enable_hotplug_processing = true; |
1362 | 1353 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index c159e1a6810f..38f96f65d87a 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3881,6 +3881,9 @@ | |||
3881 | #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG 0x9030 | 3881 | #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG 0x9030 |
3882 | #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11) | 3882 | #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11) |
3883 | 3883 | ||
3884 | #define HSW_SCRATCH1 0xb038 | ||
3885 | #define HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE (1<<27) | ||
3886 | |||
3884 | #define HSW_FUSE_STRAP 0x42014 | 3887 | #define HSW_FUSE_STRAP 0x42014 |
3885 | #define HSW_CDCLK_LIMIT (1 << 24) | 3888 | #define HSW_CDCLK_LIMIT (1 << 24) |
3886 | 3889 | ||
@@ -4728,6 +4731,9 @@ | |||
4728 | #define GEN7_ROW_CHICKEN2_GT2 0xf4f4 | 4731 | #define GEN7_ROW_CHICKEN2_GT2 0xf4f4 |
4729 | #define DOP_CLOCK_GATING_DISABLE (1<<0) | 4732 | #define DOP_CLOCK_GATING_DISABLE (1<<0) |
4730 | 4733 | ||
4734 | #define HSW_ROW_CHICKEN3 0xe49c | ||
4735 | #define HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE (1 << 6) | ||
4736 | |||
4731 | #define G4X_AUD_VID_DID (dev_priv->info->display_mmio_offset + 0x62020) | 4737 | #define G4X_AUD_VID_DID (dev_priv->info->display_mmio_offset + 0x62020) |
4732 | #define INTEL_AUDIO_DEVCL 0x808629FB | 4738 | #define INTEL_AUDIO_DEVCL 0x808629FB |
4733 | #define INTEL_AUDIO_DEVBLC 0x80862801 | 4739 | #define INTEL_AUDIO_DEVBLC 0x80862801 |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e5822e79f912..581fb4b2f766 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3941,8 +3941,6 @@ static void intel_connector_check_state(struct intel_connector *connector) | |||
3941 | * consider. */ | 3941 | * consider. */ |
3942 | void intel_connector_dpms(struct drm_connector *connector, int mode) | 3942 | void intel_connector_dpms(struct drm_connector *connector, int mode) |
3943 | { | 3943 | { |
3944 | struct intel_encoder *encoder = intel_attached_encoder(connector); | ||
3945 | |||
3946 | /* All the simple cases only support two dpms states. */ | 3944 | /* All the simple cases only support two dpms states. */ |
3947 | if (mode != DRM_MODE_DPMS_ON) | 3945 | if (mode != DRM_MODE_DPMS_ON) |
3948 | mode = DRM_MODE_DPMS_OFF; | 3946 | mode = DRM_MODE_DPMS_OFF; |
@@ -3953,10 +3951,8 @@ void intel_connector_dpms(struct drm_connector *connector, int mode) | |||
3953 | connector->dpms = mode; | 3951 | connector->dpms = mode; |
3954 | 3952 | ||
3955 | /* Only need to change hw state when actually enabled */ | 3953 | /* Only need to change hw state when actually enabled */ |
3956 | if (encoder->base.crtc) | 3954 | if (connector->encoder) |
3957 | intel_encoder_dpms(encoder, mode); | 3955 | intel_encoder_dpms(to_intel_encoder(connector->encoder), mode); |
3958 | else | ||
3959 | WARN_ON(encoder->connectors_active != false); | ||
3960 | 3956 | ||
3961 | intel_modeset_check_state(connector->dev); | 3957 | intel_modeset_check_state(connector->dev); |
3962 | } | 3958 | } |
@@ -10049,33 +10045,6 @@ static void i915_disable_vga(struct drm_device *dev) | |||
10049 | POSTING_READ(vga_reg); | 10045 | POSTING_READ(vga_reg); |
10050 | } | 10046 | } |
10051 | 10047 | ||
10052 | static void i915_enable_vga_mem(struct drm_device *dev) | ||
10053 | { | ||
10054 | /* Enable VGA memory on Intel HD */ | ||
10055 | if (HAS_PCH_SPLIT(dev)) { | ||
10056 | vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO); | ||
10057 | outb(inb(VGA_MSR_READ) | VGA_MSR_MEM_EN, VGA_MSR_WRITE); | ||
10058 | vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO | | ||
10059 | VGA_RSRC_LEGACY_MEM | | ||
10060 | VGA_RSRC_NORMAL_IO | | ||
10061 | VGA_RSRC_NORMAL_MEM); | ||
10062 | vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); | ||
10063 | } | ||
10064 | } | ||
10065 | |||
10066 | void i915_disable_vga_mem(struct drm_device *dev) | ||
10067 | { | ||
10068 | /* Disable VGA memory on Intel HD */ | ||
10069 | if (HAS_PCH_SPLIT(dev)) { | ||
10070 | vga_get_uninterruptible(dev->pdev, VGA_RSRC_LEGACY_IO); | ||
10071 | outb(inb(VGA_MSR_READ) & ~VGA_MSR_MEM_EN, VGA_MSR_WRITE); | ||
10072 | vga_set_legacy_decoding(dev->pdev, VGA_RSRC_LEGACY_IO | | ||
10073 | VGA_RSRC_NORMAL_IO | | ||
10074 | VGA_RSRC_NORMAL_MEM); | ||
10075 | vga_put(dev->pdev, VGA_RSRC_LEGACY_IO); | ||
10076 | } | ||
10077 | } | ||
10078 | |||
10079 | void intel_modeset_init_hw(struct drm_device *dev) | 10048 | void intel_modeset_init_hw(struct drm_device *dev) |
10080 | { | 10049 | { |
10081 | intel_init_power_well(dev); | 10050 | intel_init_power_well(dev); |
@@ -10354,7 +10323,6 @@ void i915_redisable_vga(struct drm_device *dev) | |||
10354 | if (I915_READ(vga_reg) != VGA_DISP_DISABLE) { | 10323 | if (I915_READ(vga_reg) != VGA_DISP_DISABLE) { |
10355 | DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n"); | 10324 | DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n"); |
10356 | i915_disable_vga(dev); | 10325 | i915_disable_vga(dev); |
10357 | i915_disable_vga_mem(dev); | ||
10358 | } | 10326 | } |
10359 | } | 10327 | } |
10360 | 10328 | ||
@@ -10568,8 +10536,6 @@ void intel_modeset_cleanup(struct drm_device *dev) | |||
10568 | 10536 | ||
10569 | intel_disable_fbc(dev); | 10537 | intel_disable_fbc(dev); |
10570 | 10538 | ||
10571 | i915_enable_vga_mem(dev); | ||
10572 | |||
10573 | intel_disable_gt_powersave(dev); | 10539 | intel_disable_gt_powersave(dev); |
10574 | 10540 | ||
10575 | ironlake_teardown_rc6(dev); | 10541 | ironlake_teardown_rc6(dev); |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 79c14e298ba6..2c555f91bfae 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1467,7 +1467,7 @@ static void intel_edp_psr_setup(struct intel_dp *intel_dp) | |||
1467 | 1467 | ||
1468 | /* Avoid continuous PSR exit by masking memup and hpd */ | 1468 | /* Avoid continuous PSR exit by masking memup and hpd */ |
1469 | I915_WRITE(EDP_PSR_DEBUG_CTL, EDP_PSR_DEBUG_MASK_MEMUP | | 1469 | I915_WRITE(EDP_PSR_DEBUG_CTL, EDP_PSR_DEBUG_MASK_MEMUP | |
1470 | EDP_PSR_DEBUG_MASK_HPD); | 1470 | EDP_PSR_DEBUG_MASK_HPD | EDP_PSR_DEBUG_MASK_LPSP); |
1471 | 1471 | ||
1472 | intel_dp->psr_setup_done = true; | 1472 | intel_dp->psr_setup_done = true; |
1473 | } | 1473 | } |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 28cae80495e2..9b7b68fd5d47 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -793,6 +793,5 @@ extern void hsw_pc8_disable_interrupts(struct drm_device *dev); | |||
793 | extern void hsw_pc8_restore_interrupts(struct drm_device *dev); | 793 | extern void hsw_pc8_restore_interrupts(struct drm_device *dev); |
794 | extern void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv); | 794 | extern void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv); |
795 | extern void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv); | 795 | extern void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv); |
796 | extern void i915_disable_vga_mem(struct drm_device *dev); | ||
797 | 796 | ||
798 | #endif /* __INTEL_DRV_H__ */ | 797 | #endif /* __INTEL_DRV_H__ */ |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index dd176b7296c1..f4c5e95b2d6f 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -3864,8 +3864,6 @@ static void valleyview_enable_rps(struct drm_device *dev) | |||
3864 | dev_priv->rps.rpe_delay), | 3864 | dev_priv->rps.rpe_delay), |
3865 | dev_priv->rps.rpe_delay); | 3865 | dev_priv->rps.rpe_delay); |
3866 | 3866 | ||
3867 | INIT_DELAYED_WORK(&dev_priv->rps.vlv_work, vlv_rps_timer_work); | ||
3868 | |||
3869 | valleyview_set_rps(dev_priv->dev, dev_priv->rps.rpe_delay); | 3867 | valleyview_set_rps(dev_priv->dev, dev_priv->rps.rpe_delay); |
3870 | 3868 | ||
3871 | gen6_enable_rps_interrupts(dev); | 3869 | gen6_enable_rps_interrupts(dev); |
@@ -4955,6 +4953,11 @@ static void haswell_init_clock_gating(struct drm_device *dev) | |||
4955 | I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER, | 4953 | I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER, |
4956 | GEN7_WA_L3_CHICKEN_MODE); | 4954 | GEN7_WA_L3_CHICKEN_MODE); |
4957 | 4955 | ||
4956 | /* L3 caching of data atomics doesn't work -- disable it. */ | ||
4957 | I915_WRITE(HSW_SCRATCH1, HSW_SCRATCH1_L3_DATA_ATOMICS_DISABLE); | ||
4958 | I915_WRITE(HSW_ROW_CHICKEN3, | ||
4959 | _MASKED_BIT_ENABLE(HSW_ROW_CHICKEN3_L3_GLOBAL_ATOMICS_DISABLE)); | ||
4960 | |||
4958 | /* This is required by WaCatErrorRejectionIssue:hsw */ | 4961 | /* This is required by WaCatErrorRejectionIssue:hsw */ |
4959 | I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, | 4962 | I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, |
4960 | I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | | 4963 | I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | |
@@ -5681,5 +5684,7 @@ void intel_pm_init(struct drm_device *dev) | |||
5681 | 5684 | ||
5682 | INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, | 5685 | INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, |
5683 | intel_gen6_powersave_work); | 5686 | intel_gen6_powersave_work); |
5687 | |||
5688 | INIT_DELAYED_WORK(&dev_priv->rps.vlv_work, vlv_rps_timer_work); | ||
5684 | } | 5689 | } |
5685 | 5690 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c index 37712a6df923..e290cfa4acee 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c | |||
@@ -113,7 +113,7 @@ nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine, | |||
113 | pmc->use_msi = false; | 113 | pmc->use_msi = false; |
114 | break; | 114 | break; |
115 | default: | 115 | default: |
116 | pmc->use_msi = nouveau_boolopt(device->cfgopt, "NvMSI", true); | 116 | pmc->use_msi = nouveau_boolopt(device->cfgopt, "NvMSI", false); |
117 | if (pmc->use_msi) { | 117 | if (pmc->use_msi) { |
118 | pmc->use_msi = pci_enable_msi(device->pdev) == 0; | 118 | pmc->use_msi = pci_enable_msi(device->pdev) == 0; |
119 | if (pmc->use_msi) { | 119 | if (pmc->use_msi) { |
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index b162e98a2953..9b6950d9b3c0 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c | |||
@@ -1930,7 +1930,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev, | |||
1930 | } | 1930 | } |
1931 | j++; | 1931 | j++; |
1932 | 1932 | ||
1933 | if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) | 1933 | if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) |
1934 | return -EINVAL; | 1934 | return -EINVAL; |
1935 | 1935 | ||
1936 | tmp = RREG32(MC_PMG_CMD_MRS); | 1936 | tmp = RREG32(MC_PMG_CMD_MRS); |
@@ -1945,7 +1945,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev, | |||
1945 | } | 1945 | } |
1946 | j++; | 1946 | j++; |
1947 | 1947 | ||
1948 | if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) | 1948 | if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) |
1949 | return -EINVAL; | 1949 | return -EINVAL; |
1950 | break; | 1950 | break; |
1951 | case MC_SEQ_RESERVE_M >> 2: | 1951 | case MC_SEQ_RESERVE_M >> 2: |
@@ -1959,7 +1959,7 @@ static int btc_set_mc_special_registers(struct radeon_device *rdev, | |||
1959 | } | 1959 | } |
1960 | j++; | 1960 | j++; |
1961 | 1961 | ||
1962 | if (j > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) | 1962 | if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) |
1963 | return -EINVAL; | 1963 | return -EINVAL; |
1964 | break; | 1964 | break; |
1965 | default: | 1965 | default: |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index d02fd1c045d5..b874ccdf52f7 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -77,6 +77,8 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev); | |||
77 | static void cik_program_aspm(struct radeon_device *rdev); | 77 | static void cik_program_aspm(struct radeon_device *rdev); |
78 | static void cik_init_pg(struct radeon_device *rdev); | 78 | static void cik_init_pg(struct radeon_device *rdev); |
79 | static void cik_init_cg(struct radeon_device *rdev); | 79 | static void cik_init_cg(struct radeon_device *rdev); |
80 | static void cik_fini_pg(struct radeon_device *rdev); | ||
81 | static void cik_fini_cg(struct radeon_device *rdev); | ||
80 | static void cik_enable_gui_idle_interrupt(struct radeon_device *rdev, | 82 | static void cik_enable_gui_idle_interrupt(struct radeon_device *rdev, |
81 | bool enable); | 83 | bool enable); |
82 | 84 | ||
@@ -4185,6 +4187,10 @@ static void cik_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask) | |||
4185 | dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 4187 | dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
4186 | RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); | 4188 | RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); |
4187 | 4189 | ||
4190 | /* disable CG/PG */ | ||
4191 | cik_fini_pg(rdev); | ||
4192 | cik_fini_cg(rdev); | ||
4193 | |||
4188 | /* stop the rlc */ | 4194 | /* stop the rlc */ |
4189 | cik_rlc_stop(rdev); | 4195 | cik_rlc_stop(rdev); |
4190 | 4196 | ||
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 555164e270a7..b5c67a99dda9 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -3131,7 +3131,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
3131 | rdev->config.evergreen.sx_max_export_size = 256; | 3131 | rdev->config.evergreen.sx_max_export_size = 256; |
3132 | rdev->config.evergreen.sx_max_export_pos_size = 64; | 3132 | rdev->config.evergreen.sx_max_export_pos_size = 64; |
3133 | rdev->config.evergreen.sx_max_export_smx_size = 192; | 3133 | rdev->config.evergreen.sx_max_export_smx_size = 192; |
3134 | rdev->config.evergreen.max_hw_contexts = 8; | 3134 | rdev->config.evergreen.max_hw_contexts = 4; |
3135 | rdev->config.evergreen.sq_num_cf_insts = 2; | 3135 | rdev->config.evergreen.sq_num_cf_insts = 2; |
3136 | 3136 | ||
3137 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; | 3137 | rdev->config.evergreen.sc_prim_fifo_size = 0x40; |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index f71ce390aebe..f815c20640bd 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -288,8 +288,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
288 | /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ | 288 | /* fglrx clears sth in AFMT_AUDIO_PACKET_CONTROL2 here */ |
289 | 289 | ||
290 | WREG32(HDMI_ACR_PACKET_CONTROL + offset, | 290 | WREG32(HDMI_ACR_PACKET_CONTROL + offset, |
291 | HDMI_ACR_AUTO_SEND | /* allow hw to sent ACR packets when required */ | 291 | HDMI_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ |
292 | HDMI_ACR_SOURCE); /* select SW CTS value */ | ||
293 | 292 | ||
294 | evergreen_hdmi_update_ACR(encoder, mode->clock); | 293 | evergreen_hdmi_update_ACR(encoder, mode->clock); |
295 | 294 | ||
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index 8768fd6a1e27..4f6d2962767d 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -1501,7 +1501,7 @@ | |||
1501 | * 6. COMMAND [29:22] | BYTE_COUNT [20:0] | 1501 | * 6. COMMAND [29:22] | BYTE_COUNT [20:0] |
1502 | */ | 1502 | */ |
1503 | # define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20) | 1503 | # define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20) |
1504 | /* 0 - SRC_ADDR | 1504 | /* 0 - DST_ADDR |
1505 | * 1 - GDS | 1505 | * 1 - GDS |
1506 | */ | 1506 | */ |
1507 | # define PACKET3_CP_DMA_ENGINE(x) ((x) << 27) | 1507 | # define PACKET3_CP_DMA_ENGINE(x) ((x) << 27) |
@@ -1516,7 +1516,7 @@ | |||
1516 | # define PACKET3_CP_DMA_CP_SYNC (1 << 31) | 1516 | # define PACKET3_CP_DMA_CP_SYNC (1 << 31) |
1517 | /* COMMAND */ | 1517 | /* COMMAND */ |
1518 | # define PACKET3_CP_DMA_DIS_WC (1 << 21) | 1518 | # define PACKET3_CP_DMA_DIS_WC (1 << 21) |
1519 | # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 23) | 1519 | # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22) |
1520 | /* 0 - none | 1520 | /* 0 - none |
1521 | * 1 - 8 in 16 | 1521 | * 1 - 8 in 16 |
1522 | * 2 - 8 in 32 | 1522 | * 2 - 8 in 32 |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index b0fa6002af3e..5b729319f27b 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -57,15 +57,15 @@ enum r600_hdmi_iec_status_bits { | |||
57 | static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = { | 57 | static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = { |
58 | /* 32kHz 44.1kHz 48kHz */ | 58 | /* 32kHz 44.1kHz 48kHz */ |
59 | /* Clock N CTS N CTS N CTS */ | 59 | /* Clock N CTS N CTS N CTS */ |
60 | { 25174, 4576, 28125, 7007, 31250, 6864, 28125 }, /* 25,20/1.001 MHz */ | 60 | { 25175, 4576, 28125, 7007, 31250, 6864, 28125 }, /* 25,20/1.001 MHz */ |
61 | { 25200, 4096, 25200, 6272, 28000, 6144, 25200 }, /* 25.20 MHz */ | 61 | { 25200, 4096, 25200, 6272, 28000, 6144, 25200 }, /* 25.20 MHz */ |
62 | { 27000, 4096, 27000, 6272, 30000, 6144, 27000 }, /* 27.00 MHz */ | 62 | { 27000, 4096, 27000, 6272, 30000, 6144, 27000 }, /* 27.00 MHz */ |
63 | { 27027, 4096, 27027, 6272, 30030, 6144, 27027 }, /* 27.00*1.001 MHz */ | 63 | { 27027, 4096, 27027, 6272, 30030, 6144, 27027 }, /* 27.00*1.001 MHz */ |
64 | { 54000, 4096, 54000, 6272, 60000, 6144, 54000 }, /* 54.00 MHz */ | 64 | { 54000, 4096, 54000, 6272, 60000, 6144, 54000 }, /* 54.00 MHz */ |
65 | { 54054, 4096, 54054, 6272, 60060, 6144, 54054 }, /* 54.00*1.001 MHz */ | 65 | { 54054, 4096, 54054, 6272, 60060, 6144, 54054 }, /* 54.00*1.001 MHz */ |
66 | { 74175, 11648, 210937, 17836, 234375, 11648, 140625 }, /* 74.25/1.001 MHz */ | 66 | { 74176, 11648, 210937, 17836, 234375, 11648, 140625 }, /* 74.25/1.001 MHz */ |
67 | { 74250, 4096, 74250, 6272, 82500, 6144, 74250 }, /* 74.25 MHz */ | 67 | { 74250, 4096, 74250, 6272, 82500, 6144, 74250 }, /* 74.25 MHz */ |
68 | { 148351, 11648, 421875, 8918, 234375, 5824, 140625 }, /* 148.50/1.001 MHz */ | 68 | { 148352, 11648, 421875, 8918, 234375, 5824, 140625 }, /* 148.50/1.001 MHz */ |
69 | { 148500, 4096, 148500, 6272, 165000, 6144, 148500 }, /* 148.50 MHz */ | 69 | { 148500, 4096, 148500, 6272, 165000, 6144, 148500 }, /* 148.50 MHz */ |
70 | { 0, 4096, 0, 6272, 0, 6144, 0 } /* Other */ | 70 | { 0, 4096, 0, 6272, 0, 6144, 0 } /* Other */ |
71 | }; | 71 | }; |
@@ -75,8 +75,15 @@ static const struct radeon_hdmi_acr r600_hdmi_predefined_acr[] = { | |||
75 | */ | 75 | */ |
76 | static void r600_hdmi_calc_cts(uint32_t clock, int *CTS, int N, int freq) | 76 | static void r600_hdmi_calc_cts(uint32_t clock, int *CTS, int N, int freq) |
77 | { | 77 | { |
78 | if (*CTS == 0) | 78 | u64 n; |
79 | *CTS = clock * N / (128 * freq) * 1000; | 79 | u32 d; |
80 | |||
81 | if (*CTS == 0) { | ||
82 | n = (u64)clock * (u64)N * 1000ULL; | ||
83 | d = 128 * freq; | ||
84 | do_div(n, d); | ||
85 | *CTS = n; | ||
86 | } | ||
80 | DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n", | 87 | DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n", |
81 | N, *CTS, freq); | 88 | N, *CTS, freq); |
82 | } | 89 | } |
@@ -444,8 +451,8 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
444 | } | 451 | } |
445 | 452 | ||
446 | WREG32(HDMI0_ACR_PACKET_CONTROL + offset, | 453 | WREG32(HDMI0_ACR_PACKET_CONTROL + offset, |
447 | HDMI0_ACR_AUTO_SEND | /* allow hw to sent ACR packets when required */ | 454 | HDMI0_ACR_SOURCE | /* select SW CTS value - XXX verify that hw CTS works on all families */ |
448 | HDMI0_ACR_SOURCE); /* select SW CTS value */ | 455 | HDMI0_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ |
449 | 456 | ||
450 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, | 457 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, |
451 | HDMI0_NULL_SEND | /* send null packets when required */ | 458 | HDMI0_NULL_SEND | /* send null packets when required */ |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index e673fe26ea84..7b3c7b5932c5 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -1523,7 +1523,7 @@ | |||
1523 | */ | 1523 | */ |
1524 | # define PACKET3_CP_DMA_CP_SYNC (1 << 31) | 1524 | # define PACKET3_CP_DMA_CP_SYNC (1 << 31) |
1525 | /* COMMAND */ | 1525 | /* COMMAND */ |
1526 | # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 23) | 1526 | # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22) |
1527 | /* 0 - none | 1527 | /* 0 - none |
1528 | * 1 - 8 in 16 | 1528 | * 1 - 8 in 16 |
1529 | * 2 - 8 in 32 | 1529 | * 2 - 8 in 32 |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index ac07ad1d4f8c..4f6b7fc7ad3c 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -945,6 +945,8 @@ void radeon_dpm_enable_uvd(struct radeon_device *rdev, bool enable) | |||
945 | if (enable) { | 945 | if (enable) { |
946 | mutex_lock(&rdev->pm.mutex); | 946 | mutex_lock(&rdev->pm.mutex); |
947 | rdev->pm.dpm.uvd_active = true; | 947 | rdev->pm.dpm.uvd_active = true; |
948 | /* disable this for now */ | ||
949 | #if 0 | ||
948 | if ((rdev->pm.dpm.sd == 1) && (rdev->pm.dpm.hd == 0)) | 950 | if ((rdev->pm.dpm.sd == 1) && (rdev->pm.dpm.hd == 0)) |
949 | dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_SD; | 951 | dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_SD; |
950 | else if ((rdev->pm.dpm.sd == 2) && (rdev->pm.dpm.hd == 0)) | 952 | else if ((rdev->pm.dpm.sd == 2) && (rdev->pm.dpm.hd == 0)) |
@@ -954,6 +956,7 @@ void radeon_dpm_enable_uvd(struct radeon_device *rdev, bool enable) | |||
954 | else if ((rdev->pm.dpm.sd == 0) && (rdev->pm.dpm.hd == 2)) | 956 | else if ((rdev->pm.dpm.sd == 0) && (rdev->pm.dpm.hd == 2)) |
955 | dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_HD2; | 957 | dpm_state = POWER_STATE_TYPE_INTERNAL_UVD_HD2; |
956 | else | 958 | else |
959 | #endif | ||
957 | dpm_state = POWER_STATE_TYPE_INTERNAL_UVD; | 960 | dpm_state = POWER_STATE_TYPE_INTERNAL_UVD; |
958 | rdev->pm.dpm.state = dpm_state; | 961 | rdev->pm.dpm.state = dpm_state; |
959 | mutex_unlock(&rdev->pm.mutex); | 962 | mutex_unlock(&rdev->pm.mutex); |
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c index f4d6bcee9006..12e8099a0823 100644 --- a/drivers/gpu/drm/radeon/radeon_test.c +++ b/drivers/gpu/drm/radeon/radeon_test.c | |||
@@ -36,8 +36,8 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag) | |||
36 | struct radeon_bo *vram_obj = NULL; | 36 | struct radeon_bo *vram_obj = NULL; |
37 | struct radeon_bo **gtt_obj = NULL; | 37 | struct radeon_bo **gtt_obj = NULL; |
38 | uint64_t gtt_addr, vram_addr; | 38 | uint64_t gtt_addr, vram_addr; |
39 | unsigned i, n, size; | 39 | unsigned n, size; |
40 | int r, ring; | 40 | int i, r, ring; |
41 | 41 | ||
42 | switch (flag) { | 42 | switch (flag) { |
43 | case RADEON_TEST_COPY_DMA: | 43 | case RADEON_TEST_COPY_DMA: |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index a0f11856ddde..4f2e73f79638 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -798,7 +798,8 @@ void radeon_uvd_note_usage(struct radeon_device *rdev) | |||
798 | (rdev->pm.dpm.hd != hd)) { | 798 | (rdev->pm.dpm.hd != hd)) { |
799 | rdev->pm.dpm.sd = sd; | 799 | rdev->pm.dpm.sd = sd; |
800 | rdev->pm.dpm.hd = hd; | 800 | rdev->pm.dpm.hd = hd; |
801 | streams_changed = true; | 801 | /* disable this for now */ |
802 | /*streams_changed = true;*/ | ||
802 | } | 803 | } |
803 | } | 804 | } |
804 | 805 | ||
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index c354c1094967..d4652af425b8 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -85,6 +85,9 @@ extern void si_dma_vm_set_page(struct radeon_device *rdev, | |||
85 | uint32_t incr, uint32_t flags); | 85 | uint32_t incr, uint32_t flags); |
86 | static void si_enable_gui_idle_interrupt(struct radeon_device *rdev, | 86 | static void si_enable_gui_idle_interrupt(struct radeon_device *rdev, |
87 | bool enable); | 87 | bool enable); |
88 | static void si_fini_pg(struct radeon_device *rdev); | ||
89 | static void si_fini_cg(struct radeon_device *rdev); | ||
90 | static void si_rlc_stop(struct radeon_device *rdev); | ||
88 | 91 | ||
89 | static const u32 verde_rlc_save_restore_register_list[] = | 92 | static const u32 verde_rlc_save_restore_register_list[] = |
90 | { | 93 | { |
@@ -3608,6 +3611,13 @@ static void si_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask) | |||
3608 | dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 3611 | dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
3609 | RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); | 3612 | RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS)); |
3610 | 3613 | ||
3614 | /* disable PG/CG */ | ||
3615 | si_fini_pg(rdev); | ||
3616 | si_fini_cg(rdev); | ||
3617 | |||
3618 | /* stop the rlc */ | ||
3619 | si_rlc_stop(rdev); | ||
3620 | |||
3611 | /* Disable CP parsing/prefetching */ | 3621 | /* Disable CP parsing/prefetching */ |
3612 | WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT | CP_CE_HALT); | 3622 | WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT | CP_CE_HALT); |
3613 | 3623 | ||
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 9ace28702c76..2332aa1bf93c 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -5208,7 +5208,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev, | |||
5208 | table->mc_reg_table_entry[k].mc_data[j] |= 0x100; | 5208 | table->mc_reg_table_entry[k].mc_data[j] |= 0x100; |
5209 | } | 5209 | } |
5210 | j++; | 5210 | j++; |
5211 | if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) | 5211 | if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) |
5212 | return -EINVAL; | 5212 | return -EINVAL; |
5213 | 5213 | ||
5214 | if (!pi->mem_gddr5) { | 5214 | if (!pi->mem_gddr5) { |
@@ -5218,7 +5218,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev, | |||
5218 | table->mc_reg_table_entry[k].mc_data[j] = | 5218 | table->mc_reg_table_entry[k].mc_data[j] = |
5219 | (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16; | 5219 | (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16; |
5220 | j++; | 5220 | j++; |
5221 | if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) | 5221 | if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) |
5222 | return -EINVAL; | 5222 | return -EINVAL; |
5223 | } | 5223 | } |
5224 | break; | 5224 | break; |
@@ -5231,7 +5231,7 @@ static int si_set_mc_special_registers(struct radeon_device *rdev, | |||
5231 | (temp_reg & 0xffff0000) | | 5231 | (temp_reg & 0xffff0000) | |
5232 | (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); | 5232 | (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); |
5233 | j++; | 5233 | j++; |
5234 | if (j > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) | 5234 | if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) |
5235 | return -EINVAL; | 5235 | return -EINVAL; |
5236 | break; | 5236 | break; |
5237 | default: | 5237 | default: |
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h index 52d2ab6b67a0..7e2e0ea66a00 100644 --- a/drivers/gpu/drm/radeon/sid.h +++ b/drivers/gpu/drm/radeon/sid.h | |||
@@ -1553,7 +1553,7 @@ | |||
1553 | * 6. COMMAND [30:21] | BYTE_COUNT [20:0] | 1553 | * 6. COMMAND [30:21] | BYTE_COUNT [20:0] |
1554 | */ | 1554 | */ |
1555 | # define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20) | 1555 | # define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20) |
1556 | /* 0 - SRC_ADDR | 1556 | /* 0 - DST_ADDR |
1557 | * 1 - GDS | 1557 | * 1 - GDS |
1558 | */ | 1558 | */ |
1559 | # define PACKET3_CP_DMA_ENGINE(x) ((x) << 27) | 1559 | # define PACKET3_CP_DMA_ENGINE(x) ((x) << 27) |
@@ -1568,7 +1568,7 @@ | |||
1568 | # define PACKET3_CP_DMA_CP_SYNC (1 << 31) | 1568 | # define PACKET3_CP_DMA_CP_SYNC (1 << 31) |
1569 | /* COMMAND */ | 1569 | /* COMMAND */ |
1570 | # define PACKET3_CP_DMA_DIS_WC (1 << 21) | 1570 | # define PACKET3_CP_DMA_DIS_WC (1 << 21) |
1571 | # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 23) | 1571 | # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22) |
1572 | /* 0 - none | 1572 | /* 0 - none |
1573 | * 1 - 8 in 16 | 1573 | * 1 - 8 in 16 |
1574 | * 2 - 8 in 32 | 1574 | * 2 - 8 in 32 |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index 7f998bf1cc9d..9364129ba292 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
@@ -1868,7 +1868,7 @@ int trinity_dpm_init(struct radeon_device *rdev) | |||
1868 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 1868 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
1869 | pi->at[i] = TRINITY_AT_DFLT; | 1869 | pi->at[i] = TRINITY_AT_DFLT; |
1870 | 1870 | ||
1871 | pi->enable_bapm = true; | 1871 | pi->enable_bapm = false; |
1872 | pi->enable_nbps_policy = true; | 1872 | pi->enable_nbps_policy = true; |
1873 | pi->enable_sclk_ds = true; | 1873 | pi->enable_sclk_ds = true; |
1874 | pi->enable_gfx_power_gating = true; | 1874 | pi->enable_gfx_power_gating = true; |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 71b70e3a7a71..c91d547191dd 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -241,6 +241,7 @@ config HID_HOLTEK | |||
241 | - Sharkoon Drakonia / Perixx MX-2000 gaming mice | 241 | - Sharkoon Drakonia / Perixx MX-2000 gaming mice |
242 | - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 / | 242 | - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 / |
243 | Zalman ZM-GM1 | 243 | Zalman ZM-GM1 |
244 | - SHARKOON DarkGlider Gaming mouse | ||
244 | 245 | ||
245 | config HOLTEK_FF | 246 | config HOLTEK_FF |
246 | bool "Holtek On Line Grip force feedback support" | 247 | bool "Holtek On Line Grip force feedback support" |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index b8470b1a10fe..5a8c01112a23 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1715,6 +1715,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1715 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, | 1715 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, |
1716 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, | 1716 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, |
1717 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, | 1717 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, |
1718 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, | ||
1718 | { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) }, | 1719 | { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) }, |
1719 | { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, | 1720 | { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, |
1720 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, | 1721 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, |
diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c index 7e6db3cf46f9..e696566cde46 100644 --- a/drivers/hid/hid-holtek-mouse.c +++ b/drivers/hid/hid-holtek-mouse.c | |||
@@ -27,6 +27,7 @@ | |||
27 | * - USB ID 04d9:a067, sold as Sharkoon Drakonia and Perixx MX-2000 | 27 | * - USB ID 04d9:a067, sold as Sharkoon Drakonia and Perixx MX-2000 |
28 | * - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200 | 28 | * - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200 |
29 | * and Zalman ZM-GM1 | 29 | * and Zalman ZM-GM1 |
30 | * - USB ID 04d9:a081, sold as SHARKOON DarkGlider Gaming mouse | ||
30 | */ | 31 | */ |
31 | 32 | ||
32 | static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 33 | static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
@@ -46,6 +47,7 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
46 | } | 47 | } |
47 | break; | 48 | break; |
48 | case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A: | 49 | case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A: |
50 | case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081: | ||
49 | if (*rsize >= 113 && rdesc[106] == 0xff && rdesc[107] == 0x7f | 51 | if (*rsize >= 113 && rdesc[106] == 0xff && rdesc[107] == 0x7f |
50 | && rdesc[111] == 0xff && rdesc[112] == 0x7f) { | 52 | && rdesc[111] == 0xff && rdesc[112] == 0x7f) { |
51 | hid_info(hdev, "Fixing up report descriptor\n"); | 53 | hid_info(hdev, "Fixing up report descriptor\n"); |
@@ -63,6 +65,8 @@ static const struct hid_device_id holtek_mouse_devices[] = { | |||
63 | USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, | 65 | USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, |
64 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, |
65 | USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, | 67 | USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, |
68 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, | ||
69 | USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, | ||
66 | { } | 70 | { } |
67 | }; | 71 | }; |
68 | MODULE_DEVICE_TABLE(hid, holtek_mouse_devices); | 72 | MODULE_DEVICE_TABLE(hid, holtek_mouse_devices); |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index e60e8d530697..9cbc7ab07dfa 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -450,6 +450,7 @@ | |||
450 | #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 | 450 | #define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 |
451 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 | 451 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067 |
452 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a | 452 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a |
453 | #define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081 | ||
453 | 454 | ||
454 | #define USB_VENDOR_ID_IMATION 0x0718 | 455 | #define USB_VENDOR_ID_IMATION 0x0718 |
455 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 | 456 | #define USB_DEVICE_ID_DISC_STAKKA 0xd000 |
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index 602c188e9d86..6101816a7ddd 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c | |||
@@ -382,7 +382,7 @@ static ssize_t kone_sysfs_write_profilex(struct file *fp, | |||
382 | } | 382 | } |
383 | #define PROFILE_ATTR(number) \ | 383 | #define PROFILE_ATTR(number) \ |
384 | static struct bin_attribute bin_attr_profile##number = { \ | 384 | static struct bin_attribute bin_attr_profile##number = { \ |
385 | .attr = { .name = "profile##number", .mode = 0660 }, \ | 385 | .attr = { .name = "profile" #number, .mode = 0660 }, \ |
386 | .size = sizeof(struct kone_profile), \ | 386 | .size = sizeof(struct kone_profile), \ |
387 | .read = kone_sysfs_read_profilex, \ | 387 | .read = kone_sysfs_read_profilex, \ |
388 | .write = kone_sysfs_write_profilex, \ | 388 | .write = kone_sysfs_write_profilex, \ |
diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index 5ddf605b6b89..5e99fcdc71b9 100644 --- a/drivers/hid/hid-roccat-koneplus.c +++ b/drivers/hid/hid-roccat-koneplus.c | |||
@@ -229,13 +229,13 @@ static ssize_t koneplus_sysfs_read_profilex_buttons(struct file *fp, | |||
229 | 229 | ||
230 | #define PROFILE_ATTR(number) \ | 230 | #define PROFILE_ATTR(number) \ |
231 | static struct bin_attribute bin_attr_profile##number##_settings = { \ | 231 | static struct bin_attribute bin_attr_profile##number##_settings = { \ |
232 | .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ | 232 | .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ |
233 | .size = KONEPLUS_SIZE_PROFILE_SETTINGS, \ | 233 | .size = KONEPLUS_SIZE_PROFILE_SETTINGS, \ |
234 | .read = koneplus_sysfs_read_profilex_settings, \ | 234 | .read = koneplus_sysfs_read_profilex_settings, \ |
235 | .private = &profile_numbers[number-1], \ | 235 | .private = &profile_numbers[number-1], \ |
236 | }; \ | 236 | }; \ |
237 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ | 237 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ |
238 | .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ | 238 | .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ |
239 | .size = KONEPLUS_SIZE_PROFILE_BUTTONS, \ | 239 | .size = KONEPLUS_SIZE_PROFILE_BUTTONS, \ |
240 | .read = koneplus_sysfs_read_profilex_buttons, \ | 240 | .read = koneplus_sysfs_read_profilex_buttons, \ |
241 | .private = &profile_numbers[number-1], \ | 241 | .private = &profile_numbers[number-1], \ |
diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c index 515bc03136c0..0c8e1ef0b67d 100644 --- a/drivers/hid/hid-roccat-kovaplus.c +++ b/drivers/hid/hid-roccat-kovaplus.c | |||
@@ -257,13 +257,13 @@ static ssize_t kovaplus_sysfs_read_profilex_buttons(struct file *fp, | |||
257 | 257 | ||
258 | #define PROFILE_ATTR(number) \ | 258 | #define PROFILE_ATTR(number) \ |
259 | static struct bin_attribute bin_attr_profile##number##_settings = { \ | 259 | static struct bin_attribute bin_attr_profile##number##_settings = { \ |
260 | .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ | 260 | .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ |
261 | .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, \ | 261 | .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, \ |
262 | .read = kovaplus_sysfs_read_profilex_settings, \ | 262 | .read = kovaplus_sysfs_read_profilex_settings, \ |
263 | .private = &profile_numbers[number-1], \ | 263 | .private = &profile_numbers[number-1], \ |
264 | }; \ | 264 | }; \ |
265 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ | 265 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ |
266 | .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ | 266 | .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ |
267 | .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, \ | 267 | .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, \ |
268 | .read = kovaplus_sysfs_read_profilex_buttons, \ | 268 | .read = kovaplus_sysfs_read_profilex_buttons, \ |
269 | .private = &profile_numbers[number-1], \ | 269 | .private = &profile_numbers[number-1], \ |
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 5a6dbbeee790..1a07e07d99a0 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c | |||
@@ -225,13 +225,13 @@ static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, | |||
225 | 225 | ||
226 | #define PROFILE_ATTR(number) \ | 226 | #define PROFILE_ATTR(number) \ |
227 | static struct bin_attribute bin_attr_profile##number##_settings = { \ | 227 | static struct bin_attribute bin_attr_profile##number##_settings = { \ |
228 | .attr = { .name = "profile##number##_settings", .mode = 0440 }, \ | 228 | .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \ |
229 | .size = PYRA_SIZE_PROFILE_SETTINGS, \ | 229 | .size = PYRA_SIZE_PROFILE_SETTINGS, \ |
230 | .read = pyra_sysfs_read_profilex_settings, \ | 230 | .read = pyra_sysfs_read_profilex_settings, \ |
231 | .private = &profile_numbers[number-1], \ | 231 | .private = &profile_numbers[number-1], \ |
232 | }; \ | 232 | }; \ |
233 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ | 233 | static struct bin_attribute bin_attr_profile##number##_buttons = { \ |
234 | .attr = { .name = "profile##number##_buttons", .mode = 0440 }, \ | 234 | .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \ |
235 | .size = PYRA_SIZE_PROFILE_BUTTONS, \ | 235 | .size = PYRA_SIZE_PROFILE_BUTTONS, \ |
236 | .read = pyra_sysfs_read_profilex_buttons, \ | 236 | .read = pyra_sysfs_read_profilex_buttons, \ |
237 | .private = &profile_numbers[number-1], \ | 237 | .private = &profile_numbers[number-1], \ |
diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c index 2e7d644dba18..71adf9e60b13 100644 --- a/drivers/hid/hid-wiimote-modules.c +++ b/drivers/hid/hid-wiimote-modules.c | |||
@@ -119,12 +119,22 @@ static const struct wiimod_ops wiimod_keys = { | |||
119 | * the rumble motor, this flag shouldn't be set. | 119 | * the rumble motor, this flag shouldn't be set. |
120 | */ | 120 | */ |
121 | 121 | ||
122 | /* used by wiimod_rumble and wiipro_rumble */ | ||
123 | static void wiimod_rumble_worker(struct work_struct *work) | ||
124 | { | ||
125 | struct wiimote_data *wdata = container_of(work, struct wiimote_data, | ||
126 | rumble_worker); | ||
127 | |||
128 | spin_lock_irq(&wdata->state.lock); | ||
129 | wiiproto_req_rumble(wdata, wdata->state.cache_rumble); | ||
130 | spin_unlock_irq(&wdata->state.lock); | ||
131 | } | ||
132 | |||
122 | static int wiimod_rumble_play(struct input_dev *dev, void *data, | 133 | static int wiimod_rumble_play(struct input_dev *dev, void *data, |
123 | struct ff_effect *eff) | 134 | struct ff_effect *eff) |
124 | { | 135 | { |
125 | struct wiimote_data *wdata = input_get_drvdata(dev); | 136 | struct wiimote_data *wdata = input_get_drvdata(dev); |
126 | __u8 value; | 137 | __u8 value; |
127 | unsigned long flags; | ||
128 | 138 | ||
129 | /* | 139 | /* |
130 | * The wiimote supports only a single rumble motor so if any magnitude | 140 | * The wiimote supports only a single rumble motor so if any magnitude |
@@ -137,9 +147,10 @@ static int wiimod_rumble_play(struct input_dev *dev, void *data, | |||
137 | else | 147 | else |
138 | value = 0; | 148 | value = 0; |
139 | 149 | ||
140 | spin_lock_irqsave(&wdata->state.lock, flags); | 150 | /* Locking state.lock here might deadlock with input_event() calls. |
141 | wiiproto_req_rumble(wdata, value); | 151 | * schedule_work acts as barrier. Merging multiple changes is fine. */ |
142 | spin_unlock_irqrestore(&wdata->state.lock, flags); | 152 | wdata->state.cache_rumble = value; |
153 | schedule_work(&wdata->rumble_worker); | ||
143 | 154 | ||
144 | return 0; | 155 | return 0; |
145 | } | 156 | } |
@@ -147,6 +158,8 @@ static int wiimod_rumble_play(struct input_dev *dev, void *data, | |||
147 | static int wiimod_rumble_probe(const struct wiimod_ops *ops, | 158 | static int wiimod_rumble_probe(const struct wiimod_ops *ops, |
148 | struct wiimote_data *wdata) | 159 | struct wiimote_data *wdata) |
149 | { | 160 | { |
161 | INIT_WORK(&wdata->rumble_worker, wiimod_rumble_worker); | ||
162 | |||
150 | set_bit(FF_RUMBLE, wdata->input->ffbit); | 163 | set_bit(FF_RUMBLE, wdata->input->ffbit); |
151 | if (input_ff_create_memless(wdata->input, NULL, wiimod_rumble_play)) | 164 | if (input_ff_create_memless(wdata->input, NULL, wiimod_rumble_play)) |
152 | return -ENOMEM; | 165 | return -ENOMEM; |
@@ -159,6 +172,8 @@ static void wiimod_rumble_remove(const struct wiimod_ops *ops, | |||
159 | { | 172 | { |
160 | unsigned long flags; | 173 | unsigned long flags; |
161 | 174 | ||
175 | cancel_work_sync(&wdata->rumble_worker); | ||
176 | |||
162 | spin_lock_irqsave(&wdata->state.lock, flags); | 177 | spin_lock_irqsave(&wdata->state.lock, flags); |
163 | wiiproto_req_rumble(wdata, 0); | 178 | wiiproto_req_rumble(wdata, 0); |
164 | spin_unlock_irqrestore(&wdata->state.lock, flags); | 179 | spin_unlock_irqrestore(&wdata->state.lock, flags); |
@@ -1731,7 +1746,6 @@ static int wiimod_pro_play(struct input_dev *dev, void *data, | |||
1731 | { | 1746 | { |
1732 | struct wiimote_data *wdata = input_get_drvdata(dev); | 1747 | struct wiimote_data *wdata = input_get_drvdata(dev); |
1733 | __u8 value; | 1748 | __u8 value; |
1734 | unsigned long flags; | ||
1735 | 1749 | ||
1736 | /* | 1750 | /* |
1737 | * The wiimote supports only a single rumble motor so if any magnitude | 1751 | * The wiimote supports only a single rumble motor so if any magnitude |
@@ -1744,9 +1758,10 @@ static int wiimod_pro_play(struct input_dev *dev, void *data, | |||
1744 | else | 1758 | else |
1745 | value = 0; | 1759 | value = 0; |
1746 | 1760 | ||
1747 | spin_lock_irqsave(&wdata->state.lock, flags); | 1761 | /* Locking state.lock here might deadlock with input_event() calls. |
1748 | wiiproto_req_rumble(wdata, value); | 1762 | * schedule_work acts as barrier. Merging multiple changes is fine. */ |
1749 | spin_unlock_irqrestore(&wdata->state.lock, flags); | 1763 | wdata->state.cache_rumble = value; |
1764 | schedule_work(&wdata->rumble_worker); | ||
1750 | 1765 | ||
1751 | return 0; | 1766 | return 0; |
1752 | } | 1767 | } |
@@ -1756,6 +1771,8 @@ static int wiimod_pro_probe(const struct wiimod_ops *ops, | |||
1756 | { | 1771 | { |
1757 | int ret, i; | 1772 | int ret, i; |
1758 | 1773 | ||
1774 | INIT_WORK(&wdata->rumble_worker, wiimod_rumble_worker); | ||
1775 | |||
1759 | wdata->extension.input = input_allocate_device(); | 1776 | wdata->extension.input = input_allocate_device(); |
1760 | if (!wdata->extension.input) | 1777 | if (!wdata->extension.input) |
1761 | return -ENOMEM; | 1778 | return -ENOMEM; |
@@ -1817,12 +1834,13 @@ static void wiimod_pro_remove(const struct wiimod_ops *ops, | |||
1817 | if (!wdata->extension.input) | 1834 | if (!wdata->extension.input) |
1818 | return; | 1835 | return; |
1819 | 1836 | ||
1837 | input_unregister_device(wdata->extension.input); | ||
1838 | wdata->extension.input = NULL; | ||
1839 | cancel_work_sync(&wdata->rumble_worker); | ||
1840 | |||
1820 | spin_lock_irqsave(&wdata->state.lock, flags); | 1841 | spin_lock_irqsave(&wdata->state.lock, flags); |
1821 | wiiproto_req_rumble(wdata, 0); | 1842 | wiiproto_req_rumble(wdata, 0); |
1822 | spin_unlock_irqrestore(&wdata->state.lock, flags); | 1843 | spin_unlock_irqrestore(&wdata->state.lock, flags); |
1823 | |||
1824 | input_unregister_device(wdata->extension.input); | ||
1825 | wdata->extension.input = NULL; | ||
1826 | } | 1844 | } |
1827 | 1845 | ||
1828 | static const struct wiimod_ops wiimod_pro = { | 1846 | static const struct wiimod_ops wiimod_pro = { |
diff --git a/drivers/hid/hid-wiimote.h b/drivers/hid/hid-wiimote.h index f1474f372c0b..75db0c400037 100644 --- a/drivers/hid/hid-wiimote.h +++ b/drivers/hid/hid-wiimote.h | |||
@@ -133,13 +133,15 @@ struct wiimote_state { | |||
133 | __u8 *cmd_read_buf; | 133 | __u8 *cmd_read_buf; |
134 | __u8 cmd_read_size; | 134 | __u8 cmd_read_size; |
135 | 135 | ||
136 | /* calibration data */ | 136 | /* calibration/cache data */ |
137 | __u16 calib_bboard[4][3]; | 137 | __u16 calib_bboard[4][3]; |
138 | __u8 cache_rumble; | ||
138 | }; | 139 | }; |
139 | 140 | ||
140 | struct wiimote_data { | 141 | struct wiimote_data { |
141 | struct hid_device *hdev; | 142 | struct hid_device *hdev; |
142 | struct input_dev *input; | 143 | struct input_dev *input; |
144 | struct work_struct rumble_worker; | ||
143 | struct led_classdev *leds[4]; | 145 | struct led_classdev *leds[4]; |
144 | struct input_dev *accel; | 146 | struct input_dev *accel; |
145 | struct input_dev *ir; | 147 | struct input_dev *ir; |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 8918dd12bb69..6a6dd5cd7833 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -308,18 +308,25 @@ static int hidraw_fasync(int fd, struct file *file, int on) | |||
308 | static void drop_ref(struct hidraw *hidraw, int exists_bit) | 308 | static void drop_ref(struct hidraw *hidraw, int exists_bit) |
309 | { | 309 | { |
310 | if (exists_bit) { | 310 | if (exists_bit) { |
311 | hid_hw_close(hidraw->hid); | ||
312 | hidraw->exist = 0; | 311 | hidraw->exist = 0; |
313 | if (hidraw->open) | 312 | if (hidraw->open) { |
313 | hid_hw_close(hidraw->hid); | ||
314 | wake_up_interruptible(&hidraw->wait); | 314 | wake_up_interruptible(&hidraw->wait); |
315 | } | ||
315 | } else { | 316 | } else { |
316 | --hidraw->open; | 317 | --hidraw->open; |
317 | } | 318 | } |
318 | 319 | if (!hidraw->open) { | |
319 | if (!hidraw->open && !hidraw->exist) { | 320 | if (!hidraw->exist) { |
320 | device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); | 321 | device_destroy(hidraw_class, |
321 | hidraw_table[hidraw->minor] = NULL; | 322 | MKDEV(hidraw_major, hidraw->minor)); |
322 | kfree(hidraw); | 323 | hidraw_table[hidraw->minor] = NULL; |
324 | kfree(hidraw); | ||
325 | } else { | ||
326 | /* close device for last reader */ | ||
327 | hid_hw_power(hidraw->hid, PM_HINT_NORMAL); | ||
328 | hid_hw_close(hidraw->hid); | ||
329 | } | ||
323 | } | 330 | } |
324 | } | 331 | } |
325 | 332 | ||
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 5bf2fb785844..93b00d76374c 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
@@ -615,7 +615,7 @@ static const struct file_operations uhid_fops = { | |||
615 | 615 | ||
616 | static struct miscdevice uhid_misc = { | 616 | static struct miscdevice uhid_misc = { |
617 | .fops = &uhid_fops, | 617 | .fops = &uhid_fops, |
618 | .minor = MISC_DYNAMIC_MINOR, | 618 | .minor = UHID_MINOR, |
619 | .name = UHID_NAME, | 619 | .name = UHID_NAME, |
620 | }; | 620 | }; |
621 | 621 | ||
@@ -634,4 +634,5 @@ module_exit(uhid_exit); | |||
634 | MODULE_LICENSE("GPL"); | 634 | MODULE_LICENSE("GPL"); |
635 | MODULE_AUTHOR("David Herrmann <dh.herrmann@gmail.com>"); | 635 | MODULE_AUTHOR("David Herrmann <dh.herrmann@gmail.com>"); |
636 | MODULE_DESCRIPTION("User-space I/O driver support for HID subsystem"); | 636 | MODULE_DESCRIPTION("User-space I/O driver support for HID subsystem"); |
637 | MODULE_ALIAS_MISCDEV(UHID_MINOR); | ||
637 | MODULE_ALIAS("devname:" UHID_NAME); | 638 | MODULE_ALIAS("devname:" UHID_NAME); |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 98814d12a604..3288f13d2d87 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -230,6 +230,7 @@ static int send_argument(const char *key) | |||
230 | 230 | ||
231 | static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) | 231 | static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) |
232 | { | 232 | { |
233 | u8 status, data = 0; | ||
233 | int i; | 234 | int i; |
234 | 235 | ||
235 | if (send_command(cmd) || send_argument(key)) { | 236 | if (send_command(cmd) || send_argument(key)) { |
@@ -237,6 +238,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) | |||
237 | return -EIO; | 238 | return -EIO; |
238 | } | 239 | } |
239 | 240 | ||
241 | /* This has no effect on newer (2012) SMCs */ | ||
240 | if (send_byte(len, APPLESMC_DATA_PORT)) { | 242 | if (send_byte(len, APPLESMC_DATA_PORT)) { |
241 | pr_warn("%.4s: read len fail\n", key); | 243 | pr_warn("%.4s: read len fail\n", key); |
242 | return -EIO; | 244 | return -EIO; |
@@ -250,6 +252,17 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) | |||
250 | buffer[i] = inb(APPLESMC_DATA_PORT); | 252 | buffer[i] = inb(APPLESMC_DATA_PORT); |
251 | } | 253 | } |
252 | 254 | ||
255 | /* Read the data port until bit0 is cleared */ | ||
256 | for (i = 0; i < 16; i++) { | ||
257 | udelay(APPLESMC_MIN_WAIT); | ||
258 | status = inb(APPLESMC_CMD_PORT); | ||
259 | if (!(status & 0x01)) | ||
260 | break; | ||
261 | data = inb(APPLESMC_DATA_PORT); | ||
262 | } | ||
263 | if (i) | ||
264 | pr_warn("flushed %d bytes, last value is: %d\n", i, data); | ||
265 | |||
253 | return 0; | 266 | return 0; |
254 | } | 267 | } |
255 | 268 | ||
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index b2b8aa9adc0e..3e5ea2c87a6e 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -447,7 +447,7 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm) | |||
447 | 447 | ||
448 | init_waitqueue_head(&cpm->i2c_wait); | 448 | init_waitqueue_head(&cpm->i2c_wait); |
449 | 449 | ||
450 | cpm->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); | 450 | cpm->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); |
451 | if (!cpm->irq) | 451 | if (!cpm->irq) |
452 | return -EINVAL; | 452 | return -EINVAL; |
453 | 453 | ||
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 4c1b60539a25..0aa01136f8d9 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -270,7 +270,8 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume); | |||
270 | MODULE_ALIAS("platform:i2c_designware"); | 270 | MODULE_ALIAS("platform:i2c_designware"); |
271 | 271 | ||
272 | static struct platform_driver dw_i2c_driver = { | 272 | static struct platform_driver dw_i2c_driver = { |
273 | .remove = dw_i2c_remove, | 273 | .probe = dw_i2c_probe, |
274 | .remove = dw_i2c_remove, | ||
274 | .driver = { | 275 | .driver = { |
275 | .name = "i2c_designware", | 276 | .name = "i2c_designware", |
276 | .owner = THIS_MODULE, | 277 | .owner = THIS_MODULE, |
@@ -282,7 +283,7 @@ static struct platform_driver dw_i2c_driver = { | |||
282 | 283 | ||
283 | static int __init dw_i2c_init_driver(void) | 284 | static int __init dw_i2c_init_driver(void) |
284 | { | 285 | { |
285 | return platform_driver_probe(&dw_i2c_driver, dw_i2c_probe); | 286 | return platform_driver_register(&dw_i2c_driver); |
286 | } | 287 | } |
287 | subsys_initcall(dw_i2c_init_driver); | 288 | subsys_initcall(dw_i2c_init_driver); |
288 | 289 | ||
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index ccf46656bdad..1d7efa3169cd 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -365,7 +365,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) | |||
365 | clk_disable_unprepare(i2c_imx->clk); | 365 | clk_disable_unprepare(i2c_imx->clk); |
366 | } | 366 | } |
367 | 367 | ||
368 | static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, | 368 | static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, |
369 | unsigned int rate) | 369 | unsigned int rate) |
370 | { | 370 | { |
371 | struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div; | 371 | struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div; |
@@ -589,7 +589,7 @@ static struct i2c_algorithm i2c_imx_algo = { | |||
589 | .functionality = i2c_imx_func, | 589 | .functionality = i2c_imx_func, |
590 | }; | 590 | }; |
591 | 591 | ||
592 | static int __init i2c_imx_probe(struct platform_device *pdev) | 592 | static int i2c_imx_probe(struct platform_device *pdev) |
593 | { | 593 | { |
594 | const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids, | 594 | const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids, |
595 | &pdev->dev); | 595 | &pdev->dev); |
@@ -697,7 +697,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev) | |||
697 | return 0; /* Return OK */ | 697 | return 0; /* Return OK */ |
698 | } | 698 | } |
699 | 699 | ||
700 | static int __exit i2c_imx_remove(struct platform_device *pdev) | 700 | static int i2c_imx_remove(struct platform_device *pdev) |
701 | { | 701 | { |
702 | struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev); | 702 | struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev); |
703 | 703 | ||
@@ -715,7 +715,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev) | |||
715 | } | 715 | } |
716 | 716 | ||
717 | static struct platform_driver i2c_imx_driver = { | 717 | static struct platform_driver i2c_imx_driver = { |
718 | .remove = __exit_p(i2c_imx_remove), | 718 | .probe = i2c_imx_probe, |
719 | .remove = i2c_imx_remove, | ||
719 | .driver = { | 720 | .driver = { |
720 | .name = DRIVER_NAME, | 721 | .name = DRIVER_NAME, |
721 | .owner = THIS_MODULE, | 722 | .owner = THIS_MODULE, |
@@ -726,7 +727,7 @@ static struct platform_driver i2c_imx_driver = { | |||
726 | 727 | ||
727 | static int __init i2c_adap_imx_init(void) | 728 | static int __init i2c_adap_imx_init(void) |
728 | { | 729 | { |
729 | return platform_driver_probe(&i2c_imx_driver, i2c_imx_probe); | 730 | return platform_driver_register(&i2c_imx_driver); |
730 | } | 731 | } |
731 | subsys_initcall(i2c_adap_imx_init); | 732 | subsys_initcall(i2c_adap_imx_init); |
732 | 733 | ||
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index f4a01675fa71..b7c857774708 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -780,12 +780,13 @@ static struct platform_driver mxs_i2c_driver = { | |||
780 | .owner = THIS_MODULE, | 780 | .owner = THIS_MODULE, |
781 | .of_match_table = mxs_i2c_dt_ids, | 781 | .of_match_table = mxs_i2c_dt_ids, |
782 | }, | 782 | }, |
783 | .probe = mxs_i2c_probe, | ||
783 | .remove = mxs_i2c_remove, | 784 | .remove = mxs_i2c_remove, |
784 | }; | 785 | }; |
785 | 786 | ||
786 | static int __init mxs_i2c_init(void) | 787 | static int __init mxs_i2c_init(void) |
787 | { | 788 | { |
788 | return platform_driver_probe(&mxs_i2c_driver, mxs_i2c_probe); | 789 | return platform_driver_register(&mxs_i2c_driver); |
789 | } | 790 | } |
790 | subsys_initcall(mxs_i2c_init); | 791 | subsys_initcall(mxs_i2c_init); |
791 | 792 | ||
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 6d8308d5dc4e..9967a6f9c2ff 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -939,6 +939,9 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) | |||
939 | /* | 939 | /* |
940 | * ProDB0017052: Clear ARDY bit twice | 940 | * ProDB0017052: Clear ARDY bit twice |
941 | */ | 941 | */ |
942 | if (stat & OMAP_I2C_STAT_ARDY) | ||
943 | omap_i2c_ack_stat(dev, OMAP_I2C_STAT_ARDY); | ||
944 | |||
942 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | | 945 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | |
943 | OMAP_I2C_STAT_AL)) { | 946 | OMAP_I2C_STAT_AL)) { |
944 | omap_i2c_ack_stat(dev, (OMAP_I2C_STAT_RRDY | | 947 | omap_i2c_ack_stat(dev, (OMAP_I2C_STAT_RRDY | |
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index f8f6f2e552db..04a17b9b38bb 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c | |||
@@ -859,8 +859,7 @@ static const struct i2c_algorithm stu300_algo = { | |||
859 | .functionality = stu300_func, | 859 | .functionality = stu300_func, |
860 | }; | 860 | }; |
861 | 861 | ||
862 | static int __init | 862 | static int stu300_probe(struct platform_device *pdev) |
863 | stu300_probe(struct platform_device *pdev) | ||
864 | { | 863 | { |
865 | struct stu300_dev *dev; | 864 | struct stu300_dev *dev; |
866 | struct i2c_adapter *adap; | 865 | struct i2c_adapter *adap; |
@@ -966,8 +965,7 @@ static SIMPLE_DEV_PM_OPS(stu300_pm, stu300_suspend, stu300_resume); | |||
966 | #define STU300_I2C_PM NULL | 965 | #define STU300_I2C_PM NULL |
967 | #endif | 966 | #endif |
968 | 967 | ||
969 | static int __exit | 968 | static int stu300_remove(struct platform_device *pdev) |
970 | stu300_remove(struct platform_device *pdev) | ||
971 | { | 969 | { |
972 | struct stu300_dev *dev = platform_get_drvdata(pdev); | 970 | struct stu300_dev *dev = platform_get_drvdata(pdev); |
973 | 971 | ||
@@ -989,13 +987,14 @@ static struct platform_driver stu300_i2c_driver = { | |||
989 | .pm = STU300_I2C_PM, | 987 | .pm = STU300_I2C_PM, |
990 | .of_match_table = stu300_dt_match, | 988 | .of_match_table = stu300_dt_match, |
991 | }, | 989 | }, |
992 | .remove = __exit_p(stu300_remove), | 990 | .probe = stu300_probe, |
991 | .remove = stu300_remove, | ||
993 | 992 | ||
994 | }; | 993 | }; |
995 | 994 | ||
996 | static int __init stu300_init(void) | 995 | static int __init stu300_init(void) |
997 | { | 996 | { |
998 | return platform_driver_probe(&stu300_i2c_driver, stu300_probe); | 997 | return platform_driver_register(&stu300_i2c_driver); |
999 | } | 998 | } |
1000 | 999 | ||
1001 | static void __exit stu300_exit(void) | 1000 | static void __exit stu300_exit(void) |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 29d3f045a2bf..3be58f89ac77 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap) | |||
1134 | acpi_handle handle; | 1134 | acpi_handle handle; |
1135 | acpi_status status; | 1135 | acpi_status status; |
1136 | 1136 | ||
1137 | if (!adap->dev.parent) | ||
1138 | return; | ||
1139 | |||
1137 | handle = ACPI_HANDLE(adap->dev.parent); | 1140 | handle = ACPI_HANDLE(adap->dev.parent); |
1138 | if (!handle) | 1141 | if (!handle) |
1139 | return; | 1142 | return; |
diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c index 74b41ae690f3..928656e241dd 100644 --- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c +++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c | |||
@@ -200,7 +200,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev) | |||
200 | arb->parent = of_find_i2c_adapter_by_node(parent_np); | 200 | arb->parent = of_find_i2c_adapter_by_node(parent_np); |
201 | if (!arb->parent) { | 201 | if (!arb->parent) { |
202 | dev_err(dev, "Cannot find parent bus\n"); | 202 | dev_err(dev, "Cannot find parent bus\n"); |
203 | return -EINVAL; | 203 | return -EPROBE_DEFER; |
204 | } | 204 | } |
205 | 205 | ||
206 | /* Actually add the mux adapter */ | 206 | /* Actually add the mux adapter */ |
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index 5d4a99ba743e..a764da777f08 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c | |||
@@ -66,7 +66,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux, | |||
66 | struct device_node *adapter_np, *child; | 66 | struct device_node *adapter_np, *child; |
67 | struct i2c_adapter *adapter; | 67 | struct i2c_adapter *adapter; |
68 | unsigned *values, *gpios; | 68 | unsigned *values, *gpios; |
69 | int i = 0; | 69 | int i = 0, ret; |
70 | 70 | ||
71 | if (!np) | 71 | if (!np) |
72 | return -ENODEV; | 72 | return -ENODEV; |
@@ -79,7 +79,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux, | |||
79 | adapter = of_find_i2c_adapter_by_node(adapter_np); | 79 | adapter = of_find_i2c_adapter_by_node(adapter_np); |
80 | if (!adapter) { | 80 | if (!adapter) { |
81 | dev_err(&pdev->dev, "Cannot find parent bus\n"); | 81 | dev_err(&pdev->dev, "Cannot find parent bus\n"); |
82 | return -ENODEV; | 82 | return -EPROBE_DEFER; |
83 | } | 83 | } |
84 | mux->data.parent = i2c_adapter_id(adapter); | 84 | mux->data.parent = i2c_adapter_id(adapter); |
85 | put_device(&adapter->dev); | 85 | put_device(&adapter->dev); |
@@ -116,8 +116,12 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux, | |||
116 | return -ENOMEM; | 116 | return -ENOMEM; |
117 | } | 117 | } |
118 | 118 | ||
119 | for (i = 0; i < mux->data.n_gpios; i++) | 119 | for (i = 0; i < mux->data.n_gpios; i++) { |
120 | gpios[i] = of_get_named_gpio(np, "mux-gpios", i); | 120 | ret = of_get_named_gpio(np, "mux-gpios", i); |
121 | if (ret < 0) | ||
122 | return ret; | ||
123 | gpios[i] = ret; | ||
124 | } | ||
121 | 125 | ||
122 | mux->data.gpios = gpios; | 126 | mux->data.gpios = gpios; |
123 | 127 | ||
@@ -177,7 +181,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) | |||
177 | if (!parent) { | 181 | if (!parent) { |
178 | dev_err(&pdev->dev, "Parent adapter (%d) not found\n", | 182 | dev_err(&pdev->dev, "Parent adapter (%d) not found\n", |
179 | mux->data.parent); | 183 | mux->data.parent); |
180 | return -ENODEV; | 184 | return -EPROBE_DEFER; |
181 | } | 185 | } |
182 | 186 | ||
183 | mux->parent = parent; | 187 | mux->parent = parent; |
diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c index 69a91732ae65..68a37157377d 100644 --- a/drivers/i2c/muxes/i2c-mux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c | |||
@@ -113,7 +113,7 @@ static int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux, | |||
113 | adapter = of_find_i2c_adapter_by_node(adapter_np); | 113 | adapter = of_find_i2c_adapter_by_node(adapter_np); |
114 | if (!adapter) { | 114 | if (!adapter) { |
115 | dev_err(mux->dev, "Cannot find parent bus\n"); | 115 | dev_err(mux->dev, "Cannot find parent bus\n"); |
116 | return -ENODEV; | 116 | return -EPROBE_DEFER; |
117 | } | 117 | } |
118 | mux->pdata->parent_bus_num = i2c_adapter_id(adapter); | 118 | mux->pdata->parent_bus_num = i2c_adapter_id(adapter); |
119 | put_device(&adapter->dev); | 119 | put_device(&adapter->dev); |
@@ -211,7 +211,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev) | |||
211 | if (!mux->parent) { | 211 | if (!mux->parent) { |
212 | dev_err(&pdev->dev, "Parent adapter (%d) not found\n", | 212 | dev_err(&pdev->dev, "Parent adapter (%d) not found\n", |
213 | mux->pdata->parent_bus_num); | 213 | mux->pdata->parent_bus_num); |
214 | ret = -ENODEV; | 214 | ret = -EPROBE_DEFER; |
215 | goto err; | 215 | goto err; |
216 | } | 216 | } |
217 | 217 | ||
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c index d0a79a4bce1c..ba6f6a91dfff 100644 --- a/drivers/iio/amplifiers/ad8366.c +++ b/drivers/iio/amplifiers/ad8366.c | |||
@@ -185,10 +185,8 @@ static int ad8366_remove(struct spi_device *spi) | |||
185 | 185 | ||
186 | iio_device_unregister(indio_dev); | 186 | iio_device_unregister(indio_dev); |
187 | 187 | ||
188 | if (!IS_ERR(reg)) { | 188 | if (!IS_ERR(reg)) |
189 | regulator_disable(reg); | 189 | regulator_disable(reg); |
190 | regulator_put(reg); | ||
191 | } | ||
192 | 190 | ||
193 | return 0; | 191 | return 0; |
194 | } | 192 | } |
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 8e84cd522e49..f95c6979efd8 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
@@ -852,7 +852,6 @@ static void iio_dev_release(struct device *device) | |||
852 | iio_device_unregister_trigger_consumer(indio_dev); | 852 | iio_device_unregister_trigger_consumer(indio_dev); |
853 | iio_device_unregister_eventset(indio_dev); | 853 | iio_device_unregister_eventset(indio_dev); |
854 | iio_device_unregister_sysfs(indio_dev); | 854 | iio_device_unregister_sysfs(indio_dev); |
855 | iio_device_unregister_debugfs(indio_dev); | ||
856 | 855 | ||
857 | ida_simple_remove(&iio_ida, indio_dev->id); | 856 | ida_simple_remove(&iio_ida, indio_dev->id); |
858 | kfree(indio_dev); | 857 | kfree(indio_dev); |
@@ -1087,6 +1086,7 @@ void iio_device_unregister(struct iio_dev *indio_dev) | |||
1087 | 1086 | ||
1088 | if (indio_dev->chrdev.dev) | 1087 | if (indio_dev->chrdev.dev) |
1089 | cdev_del(&indio_dev->chrdev); | 1088 | cdev_del(&indio_dev->chrdev); |
1089 | iio_device_unregister_debugfs(indio_dev); | ||
1090 | 1090 | ||
1091 | iio_disable_all_buffers(indio_dev); | 1091 | iio_disable_all_buffers(indio_dev); |
1092 | 1092 | ||
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index e8d2849cc81d..cab3bc7494a2 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c | |||
@@ -29,9 +29,9 @@ | |||
29 | #define ST_MAGN_NUMBER_DATA_CHANNELS 3 | 29 | #define ST_MAGN_NUMBER_DATA_CHANNELS 3 |
30 | 30 | ||
31 | /* DEFAULT VALUE FOR SENSORS */ | 31 | /* DEFAULT VALUE FOR SENSORS */ |
32 | #define ST_MAGN_DEFAULT_OUT_X_L_ADDR 0X04 | 32 | #define ST_MAGN_DEFAULT_OUT_X_H_ADDR 0X03 |
33 | #define ST_MAGN_DEFAULT_OUT_Y_L_ADDR 0X08 | 33 | #define ST_MAGN_DEFAULT_OUT_Y_H_ADDR 0X07 |
34 | #define ST_MAGN_DEFAULT_OUT_Z_L_ADDR 0X06 | 34 | #define ST_MAGN_DEFAULT_OUT_Z_H_ADDR 0X05 |
35 | 35 | ||
36 | /* FULLSCALE */ | 36 | /* FULLSCALE */ |
37 | #define ST_MAGN_FS_AVL_1300MG 1300 | 37 | #define ST_MAGN_FS_AVL_1300MG 1300 |
@@ -117,16 +117,16 @@ | |||
117 | static const struct iio_chan_spec st_magn_16bit_channels[] = { | 117 | static const struct iio_chan_spec st_magn_16bit_channels[] = { |
118 | ST_SENSORS_LSM_CHANNELS(IIO_MAGN, | 118 | ST_SENSORS_LSM_CHANNELS(IIO_MAGN, |
119 | BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), | 119 | BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), |
120 | ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16, | 120 | ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_BE, 16, 16, |
121 | ST_MAGN_DEFAULT_OUT_X_L_ADDR), | 121 | ST_MAGN_DEFAULT_OUT_X_H_ADDR), |
122 | ST_SENSORS_LSM_CHANNELS(IIO_MAGN, | 122 | ST_SENSORS_LSM_CHANNELS(IIO_MAGN, |
123 | BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), | 123 | BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), |
124 | ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16, | 124 | ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_BE, 16, 16, |
125 | ST_MAGN_DEFAULT_OUT_Y_L_ADDR), | 125 | ST_MAGN_DEFAULT_OUT_Y_H_ADDR), |
126 | ST_SENSORS_LSM_CHANNELS(IIO_MAGN, | 126 | ST_SENSORS_LSM_CHANNELS(IIO_MAGN, |
127 | BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), | 127 | BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), |
128 | ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16, | 128 | ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_BE, 16, 16, |
129 | ST_MAGN_DEFAULT_OUT_Z_L_ADDR), | 129 | ST_MAGN_DEFAULT_OUT_Z_H_ADDR), |
130 | IIO_CHAN_SOFT_TIMESTAMP(3) | 130 | IIO_CHAN_SOFT_TIMESTAMP(3) |
131 | }; | 131 | }; |
132 | 132 | ||
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 653ac6bfc57a..6c923c7039a1 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -1588,7 +1588,7 @@ static int srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch, | |||
1588 | int resp_data_len; | 1588 | int resp_data_len; |
1589 | int resp_len; | 1589 | int resp_len; |
1590 | 1590 | ||
1591 | resp_data_len = (rsp_code == SRP_TSK_MGMT_SUCCESS) ? 0 : 4; | 1591 | resp_data_len = 4; |
1592 | resp_len = sizeof(*srp_rsp) + resp_data_len; | 1592 | resp_len = sizeof(*srp_rsp) + resp_data_len; |
1593 | 1593 | ||
1594 | srp_rsp = ioctx->ioctx.buf; | 1594 | srp_rsp = ioctx->ioctx.buf; |
@@ -1600,11 +1600,9 @@ static int srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch, | |||
1600 | + atomic_xchg(&ch->req_lim_delta, 0)); | 1600 | + atomic_xchg(&ch->req_lim_delta, 0)); |
1601 | srp_rsp->tag = tag; | 1601 | srp_rsp->tag = tag; |
1602 | 1602 | ||
1603 | if (rsp_code != SRP_TSK_MGMT_SUCCESS) { | 1603 | srp_rsp->flags |= SRP_RSP_FLAG_RSPVALID; |
1604 | srp_rsp->flags |= SRP_RSP_FLAG_RSPVALID; | 1604 | srp_rsp->resp_data_len = cpu_to_be32(resp_data_len); |
1605 | srp_rsp->resp_data_len = cpu_to_be32(resp_data_len); | 1605 | srp_rsp->data[3] = rsp_code; |
1606 | srp_rsp->data[3] = rsp_code; | ||
1607 | } | ||
1608 | 1606 | ||
1609 | return resp_len; | 1607 | return resp_len; |
1610 | } | 1608 | } |
@@ -2358,6 +2356,8 @@ static void srpt_release_channel_work(struct work_struct *w) | |||
2358 | transport_deregister_session(se_sess); | 2356 | transport_deregister_session(se_sess); |
2359 | ch->sess = NULL; | 2357 | ch->sess = NULL; |
2360 | 2358 | ||
2359 | ib_destroy_cm_id(ch->cm_id); | ||
2360 | |||
2361 | srpt_destroy_ch_ib(ch); | 2361 | srpt_destroy_ch_ib(ch); |
2362 | 2362 | ||
2363 | srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_ring, | 2363 | srpt_free_ioctx_ring((struct srpt_ioctx **)ch->ioctx_ring, |
@@ -2368,8 +2368,6 @@ static void srpt_release_channel_work(struct work_struct *w) | |||
2368 | list_del(&ch->list); | 2368 | list_del(&ch->list); |
2369 | spin_unlock_irq(&sdev->spinlock); | 2369 | spin_unlock_irq(&sdev->spinlock); |
2370 | 2370 | ||
2371 | ib_destroy_cm_id(ch->cm_id); | ||
2372 | |||
2373 | if (ch->release_done) | 2371 | if (ch->release_done) |
2374 | complete(ch->release_done); | 2372 | complete(ch->release_done); |
2375 | 2373 | ||
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index b90eb4fb2b5b..dfbcd872f95e 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
@@ -236,12 +236,12 @@ static void sxps2_close(struct serio *pserio) | |||
236 | */ | 236 | */ |
237 | static int xps2_of_probe(struct platform_device *ofdev) | 237 | static int xps2_of_probe(struct platform_device *ofdev) |
238 | { | 238 | { |
239 | struct resource r_irq; /* Interrupt resources */ | ||
240 | struct resource r_mem; /* IO mem resources */ | 239 | struct resource r_mem; /* IO mem resources */ |
241 | struct xps2data *drvdata; | 240 | struct xps2data *drvdata; |
242 | struct serio *serio; | 241 | struct serio *serio; |
243 | struct device *dev = &ofdev->dev; | 242 | struct device *dev = &ofdev->dev; |
244 | resource_size_t remap_size, phys_addr; | 243 | resource_size_t remap_size, phys_addr; |
244 | unsigned int irq; | ||
245 | int error; | 245 | int error; |
246 | 246 | ||
247 | dev_info(dev, "Device Tree Probing \'%s\'\n", | 247 | dev_info(dev, "Device Tree Probing \'%s\'\n", |
@@ -255,7 +255,8 @@ static int xps2_of_probe(struct platform_device *ofdev) | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /* Get IRQ for the device */ | 257 | /* Get IRQ for the device */ |
258 | if (!of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq)) { | 258 | irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); |
259 | if (!irq) { | ||
259 | dev_err(dev, "no IRQ found\n"); | 260 | dev_err(dev, "no IRQ found\n"); |
260 | return -ENODEV; | 261 | return -ENODEV; |
261 | } | 262 | } |
@@ -268,7 +269,7 @@ static int xps2_of_probe(struct platform_device *ofdev) | |||
268 | } | 269 | } |
269 | 270 | ||
270 | spin_lock_init(&drvdata->lock); | 271 | spin_lock_init(&drvdata->lock); |
271 | drvdata->irq = r_irq.start; | 272 | drvdata->irq = irq; |
272 | drvdata->serio = serio; | 273 | drvdata->serio = serio; |
273 | drvdata->dev = dev; | 274 | drvdata->dev = dev; |
274 | 275 | ||
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index fe302e33f72e..c880ebaf1553 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig | |||
@@ -52,7 +52,7 @@ config AMD_IOMMU | |||
52 | select PCI_PRI | 52 | select PCI_PRI |
53 | select PCI_PASID | 53 | select PCI_PASID |
54 | select IOMMU_API | 54 | select IOMMU_API |
55 | depends on X86_64 && PCI && ACPI && X86_IO_APIC | 55 | depends on X86_64 && PCI && ACPI |
56 | ---help--- | 56 | ---help--- |
57 | With this option you can enable support for AMD IOMMU hardware in | 57 | With this option you can enable support for AMD IOMMU hardware in |
58 | your system. An IOMMU is a hardware component which provides | 58 | your system. An IOMMU is a hardware component which provides |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index f417e89e1e7e..181c9ba929cd 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -377,6 +377,7 @@ struct arm_smmu_cfg { | |||
377 | u32 cbar; | 377 | u32 cbar; |
378 | pgd_t *pgd; | 378 | pgd_t *pgd; |
379 | }; | 379 | }; |
380 | #define INVALID_IRPTNDX 0xff | ||
380 | 381 | ||
381 | #define ARM_SMMU_CB_ASID(cfg) ((cfg)->cbndx) | 382 | #define ARM_SMMU_CB_ASID(cfg) ((cfg)->cbndx) |
382 | #define ARM_SMMU_CB_VMID(cfg) ((cfg)->cbndx + 1) | 383 | #define ARM_SMMU_CB_VMID(cfg) ((cfg)->cbndx + 1) |
@@ -840,7 +841,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
840 | if (IS_ERR_VALUE(ret)) { | 841 | if (IS_ERR_VALUE(ret)) { |
841 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", | 842 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", |
842 | root_cfg->irptndx, irq); | 843 | root_cfg->irptndx, irq); |
843 | root_cfg->irptndx = -1; | 844 | root_cfg->irptndx = INVALID_IRPTNDX; |
844 | goto out_free_context; | 845 | goto out_free_context; |
845 | } | 846 | } |
846 | 847 | ||
@@ -869,7 +870,7 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) | |||
869 | writel_relaxed(0, cb_base + ARM_SMMU_CB_SCTLR); | 870 | writel_relaxed(0, cb_base + ARM_SMMU_CB_SCTLR); |
870 | arm_smmu_tlb_inv_context(root_cfg); | 871 | arm_smmu_tlb_inv_context(root_cfg); |
871 | 872 | ||
872 | if (root_cfg->irptndx != -1) { | 873 | if (root_cfg->irptndx != INVALID_IRPTNDX) { |
873 | irq = smmu->irqs[smmu->num_global_irqs + root_cfg->irptndx]; | 874 | irq = smmu->irqs[smmu->num_global_irqs + root_cfg->irptndx]; |
874 | free_irq(irq, domain); | 875 | free_irq(irq, domain); |
875 | } | 876 | } |
@@ -1857,8 +1858,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1857 | goto out_put_parent; | 1858 | goto out_put_parent; |
1858 | } | 1859 | } |
1859 | 1860 | ||
1860 | arm_smmu_device_reset(smmu); | ||
1861 | |||
1862 | for (i = 0; i < smmu->num_global_irqs; ++i) { | 1861 | for (i = 0; i < smmu->num_global_irqs; ++i) { |
1863 | err = request_irq(smmu->irqs[i], | 1862 | err = request_irq(smmu->irqs[i], |
1864 | arm_smmu_global_fault, | 1863 | arm_smmu_global_fault, |
@@ -1876,6 +1875,8 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1876 | spin_lock(&arm_smmu_devices_lock); | 1875 | spin_lock(&arm_smmu_devices_lock); |
1877 | list_add(&smmu->list, &arm_smmu_devices); | 1876 | list_add(&smmu->list, &arm_smmu_devices); |
1878 | spin_unlock(&arm_smmu_devices_lock); | 1877 | spin_unlock(&arm_smmu_devices_lock); |
1878 | |||
1879 | arm_smmu_device_reset(smmu); | ||
1879 | return 0; | 1880 | return 0; |
1880 | 1881 | ||
1881 | out_free_irqs: | 1882 | out_free_irqs: |
@@ -1966,10 +1967,10 @@ static int __init arm_smmu_init(void) | |||
1966 | return ret; | 1967 | return ret; |
1967 | 1968 | ||
1968 | /* Oh, for a proper bus abstraction */ | 1969 | /* Oh, for a proper bus abstraction */ |
1969 | if (!iommu_present(&platform_bus_type)); | 1970 | if (!iommu_present(&platform_bus_type)) |
1970 | bus_set_iommu(&platform_bus_type, &arm_smmu_ops); | 1971 | bus_set_iommu(&platform_bus_type, &arm_smmu_ops); |
1971 | 1972 | ||
1972 | if (!iommu_present(&amba_bustype)); | 1973 | if (!iommu_present(&amba_bustype)) |
1973 | bus_set_iommu(&amba_bustype, &arm_smmu_ops); | 1974 | bus_set_iommu(&amba_bustype, &arm_smmu_ops); |
1974 | 1975 | ||
1975 | return 0; | 1976 | return 0; |
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 71eb233b9ace..b6a74bcbb08f 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c | |||
@@ -996,6 +996,7 @@ static void request_write(struct cached_dev *dc, struct search *s) | |||
996 | closure_bio_submit(bio, cl, s->d); | 996 | closure_bio_submit(bio, cl, s->d); |
997 | } else { | 997 | } else { |
998 | bch_writeback_add(dc); | 998 | bch_writeback_add(dc); |
999 | s->op.cache_bio = bio; | ||
999 | 1000 | ||
1000 | if (bio->bi_rw & REQ_FLUSH) { | 1001 | if (bio->bi_rw & REQ_FLUSH) { |
1001 | /* Also need to send a flush to the backing device */ | 1002 | /* Also need to send a flush to the backing device */ |
@@ -1008,8 +1009,6 @@ static void request_write(struct cached_dev *dc, struct search *s) | |||
1008 | flush->bi_private = cl; | 1009 | flush->bi_private = cl; |
1009 | 1010 | ||
1010 | closure_bio_submit(flush, cl, s->d); | 1011 | closure_bio_submit(flush, cl, s->d); |
1011 | } else { | ||
1012 | s->op.cache_bio = bio; | ||
1013 | } | 1012 | } |
1014 | } | 1013 | } |
1015 | out: | 1014 | out: |
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index 87ed3fb5149a..f344659dceac 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c | |||
@@ -113,14 +113,14 @@ static const struct sh_mobile_sdhi_ops sdhi_ops = { | |||
113 | }; | 113 | }; |
114 | 114 | ||
115 | static const struct of_device_id sh_mobile_sdhi_of_match[] = { | 115 | static const struct of_device_id sh_mobile_sdhi_of_match[] = { |
116 | { .compatible = "renesas,shmobile-sdhi" }, | 116 | { .compatible = "renesas,sdhi-shmobile" }, |
117 | { .compatible = "renesas,sh7372-sdhi" }, | 117 | { .compatible = "renesas,sdhi-sh7372" }, |
118 | { .compatible = "renesas,sh73a0-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | 118 | { .compatible = "renesas,sdhi-sh73a0", .data = &sh_mobile_sdhi_of_cfg[0], }, |
119 | { .compatible = "renesas,r8a73a4-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | 119 | { .compatible = "renesas,sdhi-r8a73a4", .data = &sh_mobile_sdhi_of_cfg[0], }, |
120 | { .compatible = "renesas,r8a7740-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | 120 | { .compatible = "renesas,sdhi-r8a7740", .data = &sh_mobile_sdhi_of_cfg[0], }, |
121 | { .compatible = "renesas,r8a7778-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | 121 | { .compatible = "renesas,sdhi-r8a7778", .data = &sh_mobile_sdhi_of_cfg[0], }, |
122 | { .compatible = "renesas,r8a7779-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | 122 | { .compatible = "renesas,sdhi-r8a7779", .data = &sh_mobile_sdhi_of_cfg[0], }, |
123 | { .compatible = "renesas,r8a7790-sdhi", .data = &sh_mobile_sdhi_of_cfg[0], }, | 123 | { .compatible = "renesas,sdhi-r8a7790", .data = &sh_mobile_sdhi_of_cfg[0], }, |
124 | {}, | 124 | {}, |
125 | }; | 125 | }; |
126 | MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match); | 126 | MODULE_DEVICE_TABLE(of, sh_mobile_sdhi_of_match); |
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 26b14f9fcac6..6bc9618af094 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -168,12 +168,25 @@ static inline int write_disable(struct m25p *flash) | |||
168 | */ | 168 | */ |
169 | static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable) | 169 | static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable) |
170 | { | 170 | { |
171 | int status; | ||
172 | bool need_wren = false; | ||
173 | |||
171 | switch (JEDEC_MFR(jedec_id)) { | 174 | switch (JEDEC_MFR(jedec_id)) { |
172 | case CFI_MFR_MACRONIX: | ||
173 | case CFI_MFR_ST: /* Micron, actually */ | 175 | case CFI_MFR_ST: /* Micron, actually */ |
176 | /* Some Micron need WREN command; all will accept it */ | ||
177 | need_wren = true; | ||
178 | case CFI_MFR_MACRONIX: | ||
174 | case 0xEF /* winbond */: | 179 | case 0xEF /* winbond */: |
180 | if (need_wren) | ||
181 | write_enable(flash); | ||
182 | |||
175 | flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B; | 183 | flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B; |
176 | return spi_write(flash->spi, flash->command, 1); | 184 | status = spi_write(flash->spi, flash->command, 1); |
185 | |||
186 | if (need_wren) | ||
187 | write_disable(flash); | ||
188 | |||
189 | return status; | ||
177 | default: | 190 | default: |
178 | /* Spansion style */ | 191 | /* Spansion style */ |
179 | flash->command[0] = OPCODE_BRWR; | 192 | flash->command[0] = OPCODE_BRWR; |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 7ed4841327f2..d340b2f198c6 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2869,10 +2869,8 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd, | |||
2869 | 2869 | ||
2870 | len = le16_to_cpu(p->ext_param_page_length) * 16; | 2870 | len = le16_to_cpu(p->ext_param_page_length) * 16; |
2871 | ep = kmalloc(len, GFP_KERNEL); | 2871 | ep = kmalloc(len, GFP_KERNEL); |
2872 | if (!ep) { | 2872 | if (!ep) |
2873 | ret = -ENOMEM; | 2873 | return -ENOMEM; |
2874 | goto ext_out; | ||
2875 | } | ||
2876 | 2874 | ||
2877 | /* Send our own NAND_CMD_PARAM. */ | 2875 | /* Send our own NAND_CMD_PARAM. */ |
2878 | chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); | 2876 | chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); |
@@ -2920,7 +2918,7 @@ static int nand_flash_detect_ext_param_page(struct mtd_info *mtd, | |||
2920 | } | 2918 | } |
2921 | 2919 | ||
2922 | pr_info("ONFI extended param page detected.\n"); | 2920 | pr_info("ONFI extended param page detected.\n"); |
2923 | return 0; | 2921 | ret = 0; |
2924 | 2922 | ||
2925 | ext_out: | 2923 | ext_out: |
2926 | kfree(ep); | 2924 | kfree(ep); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 55bbb8b8200c..e883bfe2e727 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1724,6 +1724,7 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1724 | struct bonding *bond = netdev_priv(bond_dev); | 1724 | struct bonding *bond = netdev_priv(bond_dev); |
1725 | struct slave *slave, *oldcurrent; | 1725 | struct slave *slave, *oldcurrent; |
1726 | struct sockaddr addr; | 1726 | struct sockaddr addr; |
1727 | int old_flags = bond_dev->flags; | ||
1727 | netdev_features_t old_features = bond_dev->features; | 1728 | netdev_features_t old_features = bond_dev->features; |
1728 | 1729 | ||
1729 | /* slave is not a slave or master is not master of this slave */ | 1730 | /* slave is not a slave or master is not master of this slave */ |
@@ -1855,12 +1856,18 @@ static int __bond_release_one(struct net_device *bond_dev, | |||
1855 | * bond_change_active_slave(..., NULL) | 1856 | * bond_change_active_slave(..., NULL) |
1856 | */ | 1857 | */ |
1857 | if (!USES_PRIMARY(bond->params.mode)) { | 1858 | if (!USES_PRIMARY(bond->params.mode)) { |
1858 | /* unset promiscuity level from slave */ | 1859 | /* unset promiscuity level from slave |
1859 | if (bond_dev->flags & IFF_PROMISC) | 1860 | * NOTE: The NETDEV_CHANGEADDR call above may change the value |
1861 | * of the IFF_PROMISC flag in the bond_dev, but we need the | ||
1862 | * value of that flag before that change, as that was the value | ||
1863 | * when this slave was attached, so we cache at the start of the | ||
1864 | * function and use it here. Same goes for ALLMULTI below | ||
1865 | */ | ||
1866 | if (old_flags & IFF_PROMISC) | ||
1860 | dev_set_promiscuity(slave_dev, -1); | 1867 | dev_set_promiscuity(slave_dev, -1); |
1861 | 1868 | ||
1862 | /* unset allmulti level from slave */ | 1869 | /* unset allmulti level from slave */ |
1863 | if (bond_dev->flags & IFF_ALLMULTI) | 1870 | if (old_flags & IFF_ALLMULTI) |
1864 | dev_set_allmulti(slave_dev, -1); | 1871 | dev_set_allmulti(slave_dev, -1); |
1865 | 1872 | ||
1866 | bond_hw_addr_flush(bond_dev, slave_dev); | 1873 | bond_hw_addr_flush(bond_dev, slave_dev); |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 71c677e651d7..3f21142138b7 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -702,7 +702,6 @@ static int flexcan_chip_start(struct net_device *dev) | |||
702 | { | 702 | { |
703 | struct flexcan_priv *priv = netdev_priv(dev); | 703 | struct flexcan_priv *priv = netdev_priv(dev); |
704 | struct flexcan_regs __iomem *regs = priv->base; | 704 | struct flexcan_regs __iomem *regs = priv->base; |
705 | unsigned int i; | ||
706 | int err; | 705 | int err; |
707 | u32 reg_mcr, reg_ctrl; | 706 | u32 reg_mcr, reg_ctrl; |
708 | 707 | ||
@@ -772,17 +771,6 @@ static int flexcan_chip_start(struct net_device *dev) | |||
772 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); | 771 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); |
773 | flexcan_write(reg_ctrl, ®s->ctrl); | 772 | flexcan_write(reg_ctrl, ®s->ctrl); |
774 | 773 | ||
775 | for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) { | ||
776 | flexcan_write(0, ®s->cantxfg[i].can_ctrl); | ||
777 | flexcan_write(0, ®s->cantxfg[i].can_id); | ||
778 | flexcan_write(0, ®s->cantxfg[i].data[0]); | ||
779 | flexcan_write(0, ®s->cantxfg[i].data[1]); | ||
780 | |||
781 | /* put MB into rx queue */ | ||
782 | flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), | ||
783 | ®s->cantxfg[i].can_ctrl); | ||
784 | } | ||
785 | |||
786 | /* acceptance mask/acceptance code (accept everything) */ | 774 | /* acceptance mask/acceptance code (accept everything) */ |
787 | flexcan_write(0x0, ®s->rxgmask); | 775 | flexcan_write(0x0, ®s->rxgmask); |
788 | flexcan_write(0x0, ®s->rx14mask); | 776 | flexcan_write(0x0, ®s->rx14mask); |
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index 874188ba06f7..25377e547f9b 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -76,6 +76,10 @@ MODULE_PARM_DESC(maxdev, "Maximum number of slcan interfaces"); | |||
76 | /* maximum rx buffer len: extended CAN frame with timestamp */ | 76 | /* maximum rx buffer len: extended CAN frame with timestamp */ |
77 | #define SLC_MTU (sizeof("T1111222281122334455667788EA5F\r")+1) | 77 | #define SLC_MTU (sizeof("T1111222281122334455667788EA5F\r")+1) |
78 | 78 | ||
79 | #define SLC_CMD_LEN 1 | ||
80 | #define SLC_SFF_ID_LEN 3 | ||
81 | #define SLC_EFF_ID_LEN 8 | ||
82 | |||
79 | struct slcan { | 83 | struct slcan { |
80 | int magic; | 84 | int magic; |
81 | 85 | ||
@@ -142,47 +146,63 @@ static void slc_bump(struct slcan *sl) | |||
142 | { | 146 | { |
143 | struct sk_buff *skb; | 147 | struct sk_buff *skb; |
144 | struct can_frame cf; | 148 | struct can_frame cf; |
145 | int i, dlc_pos, tmp; | 149 | int i, tmp; |
146 | unsigned long ultmp; | 150 | u32 tmpid; |
147 | char cmd = sl->rbuff[0]; | 151 | char *cmd = sl->rbuff; |
148 | 152 | ||
149 | if ((cmd != 't') && (cmd != 'T') && (cmd != 'r') && (cmd != 'R')) | 153 | cf.can_id = 0; |
154 | |||
155 | switch (*cmd) { | ||
156 | case 'r': | ||
157 | cf.can_id = CAN_RTR_FLAG; | ||
158 | /* fallthrough */ | ||
159 | case 't': | ||
160 | /* store dlc ASCII value and terminate SFF CAN ID string */ | ||
161 | cf.can_dlc = sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN]; | ||
162 | sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN] = 0; | ||
163 | /* point to payload data behind the dlc */ | ||
164 | cmd += SLC_CMD_LEN + SLC_SFF_ID_LEN + 1; | ||
165 | break; | ||
166 | case 'R': | ||
167 | cf.can_id = CAN_RTR_FLAG; | ||
168 | /* fallthrough */ | ||
169 | case 'T': | ||
170 | cf.can_id |= CAN_EFF_FLAG; | ||
171 | /* store dlc ASCII value and terminate EFF CAN ID string */ | ||
172 | cf.can_dlc = sl->rbuff[SLC_CMD_LEN + SLC_EFF_ID_LEN]; | ||
173 | sl->rbuff[SLC_CMD_LEN + SLC_EFF_ID_LEN] = 0; | ||
174 | /* point to payload data behind the dlc */ | ||
175 | cmd += SLC_CMD_LEN + SLC_EFF_ID_LEN + 1; | ||
176 | break; | ||
177 | default: | ||
150 | return; | 178 | return; |
179 | } | ||
151 | 180 | ||
152 | if (cmd & 0x20) /* tiny chars 'r' 't' => standard frame format */ | 181 | if (kstrtou32(sl->rbuff + SLC_CMD_LEN, 16, &tmpid)) |
153 | dlc_pos = 4; /* dlc position tiiid */ | ||
154 | else | ||
155 | dlc_pos = 9; /* dlc position Tiiiiiiiid */ | ||
156 | |||
157 | if (!((sl->rbuff[dlc_pos] >= '0') && (sl->rbuff[dlc_pos] < '9'))) | ||
158 | return; | 182 | return; |
159 | 183 | ||
160 | cf.can_dlc = sl->rbuff[dlc_pos] - '0'; /* get can_dlc from ASCII val */ | 184 | cf.can_id |= tmpid; |
161 | 185 | ||
162 | sl->rbuff[dlc_pos] = 0; /* terminate can_id string */ | 186 | /* get can_dlc from sanitized ASCII value */ |
163 | 187 | if (cf.can_dlc >= '0' && cf.can_dlc < '9') | |
164 | if (kstrtoul(sl->rbuff+1, 16, &ultmp)) | 188 | cf.can_dlc -= '0'; |
189 | else | ||
165 | return; | 190 | return; |
166 | 191 | ||
167 | cf.can_id = ultmp; | ||
168 | |||
169 | if (!(cmd & 0x20)) /* NO tiny chars => extended frame format */ | ||
170 | cf.can_id |= CAN_EFF_FLAG; | ||
171 | |||
172 | if ((cmd | 0x20) == 'r') /* RTR frame */ | ||
173 | cf.can_id |= CAN_RTR_FLAG; | ||
174 | |||
175 | *(u64 *) (&cf.data) = 0; /* clear payload */ | 192 | *(u64 *) (&cf.data) = 0; /* clear payload */ |
176 | 193 | ||
177 | for (i = 0, dlc_pos++; i < cf.can_dlc; i++) { | 194 | /* RTR frames may have a dlc > 0 but they never have any data bytes */ |
178 | tmp = hex_to_bin(sl->rbuff[dlc_pos++]); | 195 | if (!(cf.can_id & CAN_RTR_FLAG)) { |
179 | if (tmp < 0) | 196 | for (i = 0; i < cf.can_dlc; i++) { |
180 | return; | 197 | tmp = hex_to_bin(*cmd++); |
181 | cf.data[i] = (tmp << 4); | 198 | if (tmp < 0) |
182 | tmp = hex_to_bin(sl->rbuff[dlc_pos++]); | 199 | return; |
183 | if (tmp < 0) | 200 | cf.data[i] = (tmp << 4); |
184 | return; | 201 | tmp = hex_to_bin(*cmd++); |
185 | cf.data[i] |= tmp; | 202 | if (tmp < 0) |
203 | return; | ||
204 | cf.data[i] |= tmp; | ||
205 | } | ||
186 | } | 206 | } |
187 | 207 | ||
188 | skb = dev_alloc_skb(sizeof(struct can_frame) + | 208 | skb = dev_alloc_skb(sizeof(struct can_frame) + |
@@ -209,7 +229,6 @@ static void slc_bump(struct slcan *sl) | |||
209 | /* parse tty input stream */ | 229 | /* parse tty input stream */ |
210 | static void slcan_unesc(struct slcan *sl, unsigned char s) | 230 | static void slcan_unesc(struct slcan *sl, unsigned char s) |
211 | { | 231 | { |
212 | |||
213 | if ((s == '\r') || (s == '\a')) { /* CR or BEL ends the pdu */ | 232 | if ((s == '\r') || (s == '\a')) { /* CR or BEL ends the pdu */ |
214 | if (!test_and_clear_bit(SLF_ERROR, &sl->flags) && | 233 | if (!test_and_clear_bit(SLF_ERROR, &sl->flags) && |
215 | (sl->rcount > 4)) { | 234 | (sl->rcount > 4)) { |
@@ -236,27 +255,46 @@ static void slcan_unesc(struct slcan *sl, unsigned char s) | |||
236 | /* Encapsulate one can_frame and stuff into a TTY queue. */ | 255 | /* Encapsulate one can_frame and stuff into a TTY queue. */ |
237 | static void slc_encaps(struct slcan *sl, struct can_frame *cf) | 256 | static void slc_encaps(struct slcan *sl, struct can_frame *cf) |
238 | { | 257 | { |
239 | int actual, idx, i; | 258 | int actual, i; |
240 | char cmd; | 259 | unsigned char *pos; |
260 | unsigned char *endpos; | ||
261 | canid_t id = cf->can_id; | ||
262 | |||
263 | pos = sl->xbuff; | ||
241 | 264 | ||
242 | if (cf->can_id & CAN_RTR_FLAG) | 265 | if (cf->can_id & CAN_RTR_FLAG) |
243 | cmd = 'R'; /* becomes 'r' in standard frame format */ | 266 | *pos = 'R'; /* becomes 'r' in standard frame format (SFF) */ |
244 | else | 267 | else |
245 | cmd = 'T'; /* becomes 't' in standard frame format */ | 268 | *pos = 'T'; /* becomes 't' in standard frame format (SSF) */ |
246 | 269 | ||
247 | if (cf->can_id & CAN_EFF_FLAG) | 270 | /* determine number of chars for the CAN-identifier */ |
248 | sprintf(sl->xbuff, "%c%08X%d", cmd, | 271 | if (cf->can_id & CAN_EFF_FLAG) { |
249 | cf->can_id & CAN_EFF_MASK, cf->can_dlc); | 272 | id &= CAN_EFF_MASK; |
250 | else | 273 | endpos = pos + SLC_EFF_ID_LEN; |
251 | sprintf(sl->xbuff, "%c%03X%d", cmd | 0x20, | 274 | } else { |
252 | cf->can_id & CAN_SFF_MASK, cf->can_dlc); | 275 | *pos |= 0x20; /* convert R/T to lower case for SFF */ |
276 | id &= CAN_SFF_MASK; | ||
277 | endpos = pos + SLC_SFF_ID_LEN; | ||
278 | } | ||
253 | 279 | ||
254 | idx = strlen(sl->xbuff); | 280 | /* build 3 (SFF) or 8 (EFF) digit CAN identifier */ |
281 | pos++; | ||
282 | while (endpos >= pos) { | ||
283 | *endpos-- = hex_asc_upper[id & 0xf]; | ||
284 | id >>= 4; | ||
285 | } | ||
286 | |||
287 | pos += (cf->can_id & CAN_EFF_FLAG) ? SLC_EFF_ID_LEN : SLC_SFF_ID_LEN; | ||
255 | 288 | ||
256 | for (i = 0; i < cf->can_dlc; i++) | 289 | *pos++ = cf->can_dlc + '0'; |
257 | sprintf(&sl->xbuff[idx + 2*i], "%02X", cf->data[i]); | 290 | |
291 | /* RTR frames may have a dlc > 0 but they never have any data bytes */ | ||
292 | if (!(cf->can_id & CAN_RTR_FLAG)) { | ||
293 | for (i = 0; i < cf->can_dlc; i++) | ||
294 | pos = hex_byte_pack_upper(pos, cf->data[i]); | ||
295 | } | ||
258 | 296 | ||
259 | strcat(sl->xbuff, "\r"); /* add terminating character */ | 297 | *pos++ = '\r'; |
260 | 298 | ||
261 | /* Order of next two lines is *very* important. | 299 | /* Order of next two lines is *very* important. |
262 | * When we are sending a little amount of data, | 300 | * When we are sending a little amount of data, |
@@ -267,8 +305,8 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf) | |||
267 | * 14 Oct 1994 Dmitry Gorodchanin. | 305 | * 14 Oct 1994 Dmitry Gorodchanin. |
268 | */ | 306 | */ |
269 | set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); | 307 | set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
270 | actual = sl->tty->ops->write(sl->tty, sl->xbuff, strlen(sl->xbuff)); | 308 | actual = sl->tty->ops->write(sl->tty, sl->xbuff, pos - sl->xbuff); |
271 | sl->xleft = strlen(sl->xbuff) - actual; | 309 | sl->xleft = (pos - sl->xbuff) - actual; |
272 | sl->xhead = sl->xbuff + actual; | 310 | sl->xhead = sl->xbuff + actual; |
273 | sl->dev->stats.tx_bytes += cf->can_dlc; | 311 | sl->dev->stats.tx_bytes += cf->can_dlc; |
274 | } | 312 | } |
@@ -286,11 +324,13 @@ static void slcan_write_wakeup(struct tty_struct *tty) | |||
286 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) | 324 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) |
287 | return; | 325 | return; |
288 | 326 | ||
327 | spin_lock(&sl->lock); | ||
289 | if (sl->xleft <= 0) { | 328 | if (sl->xleft <= 0) { |
290 | /* Now serial buffer is almost free & we can start | 329 | /* Now serial buffer is almost free & we can start |
291 | * transmission of another packet */ | 330 | * transmission of another packet */ |
292 | sl->dev->stats.tx_packets++; | 331 | sl->dev->stats.tx_packets++; |
293 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 332 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
333 | spin_unlock(&sl->lock); | ||
294 | netif_wake_queue(sl->dev); | 334 | netif_wake_queue(sl->dev); |
295 | return; | 335 | return; |
296 | } | 336 | } |
@@ -298,6 +338,7 @@ static void slcan_write_wakeup(struct tty_struct *tty) | |||
298 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 338 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); |
299 | sl->xleft -= actual; | 339 | sl->xleft -= actual; |
300 | sl->xhead += actual; | 340 | sl->xhead += actual; |
341 | spin_unlock(&sl->lock); | ||
301 | } | 342 | } |
302 | 343 | ||
303 | /* Send a can_frame to a TTY queue. */ | 344 | /* Send a can_frame to a TTY queue. */ |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c index a0f647f92bf5..0b7a4c3b01a2 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c | |||
@@ -463,7 +463,7 @@ static int peak_usb_start(struct peak_usb_device *dev) | |||
463 | if (i < PCAN_USB_MAX_TX_URBS) { | 463 | if (i < PCAN_USB_MAX_TX_URBS) { |
464 | if (i == 0) { | 464 | if (i == 0) { |
465 | netdev_err(netdev, "couldn't setup any tx URB\n"); | 465 | netdev_err(netdev, "couldn't setup any tx URB\n"); |
466 | return err; | 466 | goto err_tx; |
467 | } | 467 | } |
468 | 468 | ||
469 | netdev_warn(netdev, "tx performance may be slow\n"); | 469 | netdev_warn(netdev, "tx performance may be slow\n"); |
@@ -472,7 +472,7 @@ static int peak_usb_start(struct peak_usb_device *dev) | |||
472 | if (dev->adapter->dev_start) { | 472 | if (dev->adapter->dev_start) { |
473 | err = dev->adapter->dev_start(dev); | 473 | err = dev->adapter->dev_start(dev); |
474 | if (err) | 474 | if (err) |
475 | goto failed; | 475 | goto err_adapter; |
476 | } | 476 | } |
477 | 477 | ||
478 | dev->state |= PCAN_USB_STATE_STARTED; | 478 | dev->state |= PCAN_USB_STATE_STARTED; |
@@ -481,19 +481,26 @@ static int peak_usb_start(struct peak_usb_device *dev) | |||
481 | if (dev->adapter->dev_set_bus) { | 481 | if (dev->adapter->dev_set_bus) { |
482 | err = dev->adapter->dev_set_bus(dev, 1); | 482 | err = dev->adapter->dev_set_bus(dev, 1); |
483 | if (err) | 483 | if (err) |
484 | goto failed; | 484 | goto err_adapter; |
485 | } | 485 | } |
486 | 486 | ||
487 | dev->can.state = CAN_STATE_ERROR_ACTIVE; | 487 | dev->can.state = CAN_STATE_ERROR_ACTIVE; |
488 | 488 | ||
489 | return 0; | 489 | return 0; |
490 | 490 | ||
491 | failed: | 491 | err_adapter: |
492 | if (err == -ENODEV) | 492 | if (err == -ENODEV) |
493 | netif_device_detach(dev->netdev); | 493 | netif_device_detach(dev->netdev); |
494 | 494 | ||
495 | netdev_warn(netdev, "couldn't submit control: %d\n", err); | 495 | netdev_warn(netdev, "couldn't submit control: %d\n", err); |
496 | 496 | ||
497 | for (i = 0; i < PCAN_USB_MAX_TX_URBS; i++) { | ||
498 | usb_free_urb(dev->tx_contexts[i].urb); | ||
499 | dev->tx_contexts[i].urb = NULL; | ||
500 | } | ||
501 | err_tx: | ||
502 | usb_kill_anchored_urbs(&dev->rx_submitted); | ||
503 | |||
497 | return err; | 504 | return err; |
498 | } | 505 | } |
499 | 506 | ||
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index 9e1601487263..d0878526c0c8 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c | |||
@@ -628,12 +628,12 @@ static const struct net_device_ops arc_emac_netdev_ops = { | |||
628 | 628 | ||
629 | static int arc_emac_probe(struct platform_device *pdev) | 629 | static int arc_emac_probe(struct platform_device *pdev) |
630 | { | 630 | { |
631 | struct resource res_regs, res_irq; | 631 | struct resource res_regs; |
632 | struct device_node *phy_node; | 632 | struct device_node *phy_node; |
633 | struct arc_emac_priv *priv; | 633 | struct arc_emac_priv *priv; |
634 | struct net_device *ndev; | 634 | struct net_device *ndev; |
635 | const char *mac_addr; | 635 | const char *mac_addr; |
636 | unsigned int id, clock_frequency; | 636 | unsigned int id, clock_frequency, irq; |
637 | int err; | 637 | int err; |
638 | 638 | ||
639 | if (!pdev->dev.of_node) | 639 | if (!pdev->dev.of_node) |
@@ -661,8 +661,8 @@ static int arc_emac_probe(struct platform_device *pdev) | |||
661 | } | 661 | } |
662 | 662 | ||
663 | /* Get IRQ from device tree */ | 663 | /* Get IRQ from device tree */ |
664 | err = of_irq_to_resource(pdev->dev.of_node, 0, &res_irq); | 664 | irq = irq_of_parse_and_map(pdev->dev.of_node, 0); |
665 | if (!err) { | 665 | if (!irq) { |
666 | dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n"); | 666 | dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n"); |
667 | return -ENODEV; | 667 | return -ENODEV; |
668 | } | 668 | } |
@@ -711,7 +711,7 @@ static int arc_emac_probe(struct platform_device *pdev) | |||
711 | goto out; | 711 | goto out; |
712 | } | 712 | } |
713 | 713 | ||
714 | ndev->irq = res_irq.start; | 714 | ndev->irq = irq; |
715 | dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq); | 715 | dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq); |
716 | 716 | ||
717 | /* Register interrupt handler for device */ | 717 | /* Register interrupt handler for device */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 61726af1de6e..e66beff2704d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -2481,8 +2481,7 @@ load_error_cnic2: | |||
2481 | load_error_cnic1: | 2481 | load_error_cnic1: |
2482 | bnx2x_napi_disable_cnic(bp); | 2482 | bnx2x_napi_disable_cnic(bp); |
2483 | /* Update the number of queues without the cnic queues */ | 2483 | /* Update the number of queues without the cnic queues */ |
2484 | rc = bnx2x_set_real_num_queues(bp, 0); | 2484 | if (bnx2x_set_real_num_queues(bp, 0)) |
2485 | if (rc) | ||
2486 | BNX2X_ERR("Unable to set real_num_queues not including cnic\n"); | 2485 | BNX2X_ERR("Unable to set real_num_queues not including cnic\n"); |
2487 | load_error_cnic0: | 2486 | load_error_cnic0: |
2488 | BNX2X_ERR("CNIC-related load failed\n"); | 2487 | BNX2X_ERR("CNIC-related load failed\n"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index d60a2ea3da19..51468227bf3b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -175,6 +175,7 @@ typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy, | |||
175 | #define EDC_MODE_LINEAR 0x0022 | 175 | #define EDC_MODE_LINEAR 0x0022 |
176 | #define EDC_MODE_LIMITING 0x0044 | 176 | #define EDC_MODE_LIMITING 0x0044 |
177 | #define EDC_MODE_PASSIVE_DAC 0x0055 | 177 | #define EDC_MODE_PASSIVE_DAC 0x0055 |
178 | #define EDC_MODE_ACTIVE_DAC 0x0066 | ||
178 | 179 | ||
179 | /* ETS defines*/ | 180 | /* ETS defines*/ |
180 | #define DCBX_INVALID_COS (0xFF) | 181 | #define DCBX_INVALID_COS (0xFF) |
@@ -3684,6 +3685,41 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy, | |||
3684 | bnx2x_update_link_attr(params, vars->link_attr_sync); | 3685 | bnx2x_update_link_attr(params, vars->link_attr_sync); |
3685 | } | 3686 | } |
3686 | 3687 | ||
3688 | static void bnx2x_disable_kr2(struct link_params *params, | ||
3689 | struct link_vars *vars, | ||
3690 | struct bnx2x_phy *phy) | ||
3691 | { | ||
3692 | struct bnx2x *bp = params->bp; | ||
3693 | int i; | ||
3694 | static struct bnx2x_reg_set reg_set[] = { | ||
3695 | /* Step 1 - Program the TX/RX alignment markers */ | ||
3696 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0x7690}, | ||
3697 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xe647}, | ||
3698 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0xc4f0}, | ||
3699 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0x7690}, | ||
3700 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xe647}, | ||
3701 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0xc4f0}, | ||
3702 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000c}, | ||
3703 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6000}, | ||
3704 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0000}, | ||
3705 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0002}, | ||
3706 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x0000}, | ||
3707 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x0af7}, | ||
3708 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x0af7}, | ||
3709 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0002}, | ||
3710 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0000} | ||
3711 | }; | ||
3712 | DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n"); | ||
3713 | |||
3714 | for (i = 0; i < ARRAY_SIZE(reg_set); i++) | ||
3715 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | ||
3716 | reg_set[i].val); | ||
3717 | vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | ||
3718 | bnx2x_update_link_attr(params, vars->link_attr_sync); | ||
3719 | |||
3720 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; | ||
3721 | } | ||
3722 | |||
3687 | static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, | 3723 | static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, |
3688 | struct link_params *params) | 3724 | struct link_params *params) |
3689 | { | 3725 | { |
@@ -3715,7 +3751,6 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3715 | struct link_params *params, | 3751 | struct link_params *params, |
3716 | struct link_vars *vars) { | 3752 | struct link_vars *vars) { |
3717 | u16 lane, i, cl72_ctrl, an_adv = 0; | 3753 | u16 lane, i, cl72_ctrl, an_adv = 0; |
3718 | u16 ucode_ver; | ||
3719 | struct bnx2x *bp = params->bp; | 3754 | struct bnx2x *bp = params->bp; |
3720 | static struct bnx2x_reg_set reg_set[] = { | 3755 | static struct bnx2x_reg_set reg_set[] = { |
3721 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, | 3756 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, |
@@ -3806,15 +3841,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3806 | 3841 | ||
3807 | /* Advertise pause */ | 3842 | /* Advertise pause */ |
3808 | bnx2x_ext_phy_set_pause(params, phy, vars); | 3843 | bnx2x_ext_phy_set_pause(params, phy, vars); |
3809 | /* Set KR Autoneg Work-Around flag for Warpcore version older than D108 | 3844 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; |
3810 | */ | ||
3811 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3812 | MDIO_WC_REG_UC_INFO_B1_VERSION, &ucode_ver); | ||
3813 | if (ucode_ver < 0xd108) { | ||
3814 | DP(NETIF_MSG_LINK, "Enable AN KR work-around. WC ver:0x%x\n", | ||
3815 | ucode_ver); | ||
3816 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; | ||
3817 | } | ||
3818 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | 3845 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, |
3819 | MDIO_WC_REG_DIGITAL5_MISC7, 0x100); | 3846 | MDIO_WC_REG_DIGITAL5_MISC7, 0x100); |
3820 | 3847 | ||
@@ -3838,6 +3865,8 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3838 | bnx2x_set_aer_mmd(params, phy); | 3865 | bnx2x_set_aer_mmd(params, phy); |
3839 | 3866 | ||
3840 | bnx2x_warpcore_enable_AN_KR2(phy, params, vars); | 3867 | bnx2x_warpcore_enable_AN_KR2(phy, params, vars); |
3868 | } else { | ||
3869 | bnx2x_disable_kr2(params, vars, phy); | ||
3841 | } | 3870 | } |
3842 | 3871 | ||
3843 | /* Enable Autoneg: only on the main lane */ | 3872 | /* Enable Autoneg: only on the main lane */ |
@@ -4347,20 +4376,14 @@ static void bnx2x_warpcore_config_runtime(struct bnx2x_phy *phy, | |||
4347 | struct bnx2x *bp = params->bp; | 4376 | struct bnx2x *bp = params->bp; |
4348 | u32 serdes_net_if; | 4377 | u32 serdes_net_if; |
4349 | u16 gp_status1 = 0, lnkup = 0, lnkup_kr = 0; | 4378 | u16 gp_status1 = 0, lnkup = 0, lnkup_kr = 0; |
4350 | u16 lane = bnx2x_get_warpcore_lane(phy, params); | ||
4351 | 4379 | ||
4352 | vars->turn_to_run_wc_rt = vars->turn_to_run_wc_rt ? 0 : 1; | 4380 | vars->turn_to_run_wc_rt = vars->turn_to_run_wc_rt ? 0 : 1; |
4353 | 4381 | ||
4354 | if (!vars->turn_to_run_wc_rt) | 4382 | if (!vars->turn_to_run_wc_rt) |
4355 | return; | 4383 | return; |
4356 | 4384 | ||
4357 | /* Return if there is no link partner */ | ||
4358 | if (!(bnx2x_warpcore_get_sigdet(phy, params))) { | ||
4359 | DP(NETIF_MSG_LINK, "bnx2x_warpcore_get_sigdet false\n"); | ||
4360 | return; | ||
4361 | } | ||
4362 | |||
4363 | if (vars->rx_tx_asic_rst) { | 4385 | if (vars->rx_tx_asic_rst) { |
4386 | u16 lane = bnx2x_get_warpcore_lane(phy, params); | ||
4364 | serdes_net_if = (REG_RD(bp, params->shmem_base + | 4387 | serdes_net_if = (REG_RD(bp, params->shmem_base + |
4365 | offsetof(struct shmem_region, dev_info. | 4388 | offsetof(struct shmem_region, dev_info. |
4366 | port_hw_config[params->port].default_cfg)) & | 4389 | port_hw_config[params->port].default_cfg)) & |
@@ -4375,14 +4398,8 @@ static void bnx2x_warpcore_config_runtime(struct bnx2x_phy *phy, | |||
4375 | /*10G KR*/ | 4398 | /*10G KR*/ |
4376 | lnkup_kr = (gp_status1 >> (12+lane)) & 0x1; | 4399 | lnkup_kr = (gp_status1 >> (12+lane)) & 0x1; |
4377 | 4400 | ||
4378 | DP(NETIF_MSG_LINK, | ||
4379 | "gp_status1 0x%x\n", gp_status1); | ||
4380 | |||
4381 | if (lnkup_kr || lnkup) { | 4401 | if (lnkup_kr || lnkup) { |
4382 | vars->rx_tx_asic_rst = 0; | 4402 | vars->rx_tx_asic_rst = 0; |
4383 | DP(NETIF_MSG_LINK, | ||
4384 | "link up, rx_tx_asic_rst 0x%x\n", | ||
4385 | vars->rx_tx_asic_rst); | ||
4386 | } else { | 4403 | } else { |
4387 | /* Reset the lane to see if link comes up.*/ | 4404 | /* Reset the lane to see if link comes up.*/ |
4388 | bnx2x_warpcore_reset_lane(bp, phy, 1); | 4405 | bnx2x_warpcore_reset_lane(bp, phy, 1); |
@@ -4507,10 +4524,14 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, | |||
4507 | * enabled transmitter to avoid current leakage in case | 4524 | * enabled transmitter to avoid current leakage in case |
4508 | * no module is connected | 4525 | * no module is connected |
4509 | */ | 4526 | */ |
4510 | if (bnx2x_is_sfp_module_plugged(phy, params)) | 4527 | if ((params->loopback_mode == LOOPBACK_NONE) || |
4511 | bnx2x_sfp_module_detection(phy, params); | 4528 | (params->loopback_mode == LOOPBACK_EXT)) { |
4512 | else | 4529 | if (bnx2x_is_sfp_module_plugged(phy, params)) |
4513 | bnx2x_sfp_e3_set_transmitter(params, phy, 1); | 4530 | bnx2x_sfp_module_detection(phy, params); |
4531 | else | ||
4532 | bnx2x_sfp_e3_set_transmitter(params, | ||
4533 | phy, 1); | ||
4534 | } | ||
4514 | 4535 | ||
4515 | bnx2x_warpcore_config_sfi(phy, params); | 4536 | bnx2x_warpcore_config_sfi(phy, params); |
4516 | break; | 4537 | break; |
@@ -5757,6 +5778,11 @@ static int bnx2x_warpcore_read_status(struct bnx2x_phy *phy, | |||
5757 | rc = bnx2x_get_link_speed_duplex(phy, params, vars, link_up, gp_speed, | 5778 | rc = bnx2x_get_link_speed_duplex(phy, params, vars, link_up, gp_speed, |
5758 | duplex); | 5779 | duplex); |
5759 | 5780 | ||
5781 | /* In case of KR link down, start up the recovering procedure */ | ||
5782 | if ((!link_up) && (phy->media_type == ETH_PHY_KR) && | ||
5783 | (!(phy->flags & FLAGS_WC_DUAL_MODE))) | ||
5784 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; | ||
5785 | |||
5760 | DP(NETIF_MSG_LINK, "duplex %x flow_ctrl 0x%x link_status 0x%x\n", | 5786 | DP(NETIF_MSG_LINK, "duplex %x flow_ctrl 0x%x link_status 0x%x\n", |
5761 | vars->duplex, vars->flow_ctrl, vars->link_status); | 5787 | vars->duplex, vars->flow_ctrl, vars->link_status); |
5762 | return rc; | 5788 | return rc; |
@@ -6507,6 +6533,11 @@ static int bnx2x_link_initialize(struct link_params *params, | |||
6507 | params->phy[INT_PHY].config_init(phy, params, vars); | 6533 | params->phy[INT_PHY].config_init(phy, params, vars); |
6508 | } | 6534 | } |
6509 | 6535 | ||
6536 | /* Re-read this value in case it was changed inside config_init due to | ||
6537 | * limitations of optic module | ||
6538 | */ | ||
6539 | vars->line_speed = params->phy[INT_PHY].req_line_speed; | ||
6540 | |||
6510 | /* Init external phy*/ | 6541 | /* Init external phy*/ |
6511 | if (non_ext_phy) { | 6542 | if (non_ext_phy) { |
6512 | if (params->phy[INT_PHY].supported & | 6543 | if (params->phy[INT_PHY].supported & |
@@ -8080,7 +8111,10 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8080 | if (copper_module_type & | 8111 | if (copper_module_type & |
8081 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) { | 8112 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) { |
8082 | DP(NETIF_MSG_LINK, "Active Copper cable detected\n"); | 8113 | DP(NETIF_MSG_LINK, "Active Copper cable detected\n"); |
8083 | check_limiting_mode = 1; | 8114 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) |
8115 | *edc_mode = EDC_MODE_ACTIVE_DAC; | ||
8116 | else | ||
8117 | check_limiting_mode = 1; | ||
8084 | } else if (copper_module_type & | 8118 | } else if (copper_module_type & |
8085 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE) { | 8119 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE) { |
8086 | DP(NETIF_MSG_LINK, | 8120 | DP(NETIF_MSG_LINK, |
@@ -8555,6 +8589,7 @@ static void bnx2x_warpcore_set_limiting_mode(struct link_params *params, | |||
8555 | mode = MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE_DEFAULT; | 8589 | mode = MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE_DEFAULT; |
8556 | break; | 8590 | break; |
8557 | case EDC_MODE_PASSIVE_DAC: | 8591 | case EDC_MODE_PASSIVE_DAC: |
8592 | case EDC_MODE_ACTIVE_DAC: | ||
8558 | mode = MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE_SFP_DAC; | 8593 | mode = MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE_SFP_DAC; |
8559 | break; | 8594 | break; |
8560 | default: | 8595 | default: |
@@ -9730,32 +9765,41 @@ static int bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, | |||
9730 | MDIO_AN_DEVAD, MDIO_AN_REG_8481_1000T_CTRL, | 9765 | MDIO_AN_DEVAD, MDIO_AN_REG_8481_1000T_CTRL, |
9731 | an_1000_val); | 9766 | an_1000_val); |
9732 | 9767 | ||
9733 | /* set 100 speed advertisement */ | 9768 | /* Set 10/100 speed advertisement */ |
9734 | if ((phy->req_line_speed == SPEED_AUTO_NEG) && | 9769 | if (phy->req_line_speed == SPEED_AUTO_NEG) { |
9735 | (phy->speed_cap_mask & | 9770 | if (phy->speed_cap_mask & |
9736 | (PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL | | 9771 | PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL) { |
9737 | PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF))) { | 9772 | /* Enable autoneg and restart autoneg for legacy speeds |
9738 | an_10_100_val |= (1<<7); | 9773 | */ |
9739 | /* Enable autoneg and restart autoneg for legacy speeds */ | 9774 | autoneg_val |= (1<<9 | 1<<12); |
9740 | autoneg_val |= (1<<9 | 1<<12); | ||
9741 | |||
9742 | if (phy->req_duplex == DUPLEX_FULL) | ||
9743 | an_10_100_val |= (1<<8); | 9775 | an_10_100_val |= (1<<8); |
9744 | DP(NETIF_MSG_LINK, "Advertising 100M\n"); | 9776 | DP(NETIF_MSG_LINK, "Advertising 100M-FD\n"); |
9745 | } | 9777 | } |
9746 | /* set 10 speed advertisement */ | 9778 | |
9747 | if (((phy->req_line_speed == SPEED_AUTO_NEG) && | 9779 | if (phy->speed_cap_mask & |
9748 | (phy->speed_cap_mask & | 9780 | PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF) { |
9749 | (PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL | | 9781 | /* Enable autoneg and restart autoneg for legacy speeds |
9750 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF)) && | 9782 | */ |
9751 | (phy->supported & | 9783 | autoneg_val |= (1<<9 | 1<<12); |
9752 | (SUPPORTED_10baseT_Half | | 9784 | an_10_100_val |= (1<<7); |
9753 | SUPPORTED_10baseT_Full)))) { | 9785 | DP(NETIF_MSG_LINK, "Advertising 100M-HD\n"); |
9754 | an_10_100_val |= (1<<5); | 9786 | } |
9755 | autoneg_val |= (1<<9 | 1<<12); | 9787 | |
9756 | if (phy->req_duplex == DUPLEX_FULL) | 9788 | if ((phy->speed_cap_mask & |
9789 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL) && | ||
9790 | (phy->supported & SUPPORTED_10baseT_Full)) { | ||
9757 | an_10_100_val |= (1<<6); | 9791 | an_10_100_val |= (1<<6); |
9758 | DP(NETIF_MSG_LINK, "Advertising 10M\n"); | 9792 | autoneg_val |= (1<<9 | 1<<12); |
9793 | DP(NETIF_MSG_LINK, "Advertising 10M-FD\n"); | ||
9794 | } | ||
9795 | |||
9796 | if ((phy->speed_cap_mask & | ||
9797 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF) && | ||
9798 | (phy->supported & SUPPORTED_10baseT_Half)) { | ||
9799 | an_10_100_val |= (1<<5); | ||
9800 | autoneg_val |= (1<<9 | 1<<12); | ||
9801 | DP(NETIF_MSG_LINK, "Advertising 10M-HD\n"); | ||
9802 | } | ||
9759 | } | 9803 | } |
9760 | 9804 | ||
9761 | /* Only 10/100 are allowed to work in FORCE mode */ | 9805 | /* Only 10/100 are allowed to work in FORCE mode */ |
@@ -13432,43 +13476,6 @@ static void bnx2x_sfp_tx_fault_detection(struct bnx2x_phy *phy, | |||
13432 | } | 13476 | } |
13433 | } | 13477 | } |
13434 | } | 13478 | } |
13435 | static void bnx2x_disable_kr2(struct link_params *params, | ||
13436 | struct link_vars *vars, | ||
13437 | struct bnx2x_phy *phy) | ||
13438 | { | ||
13439 | struct bnx2x *bp = params->bp; | ||
13440 | int i; | ||
13441 | static struct bnx2x_reg_set reg_set[] = { | ||
13442 | /* Step 1 - Program the TX/RX alignment markers */ | ||
13443 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL5, 0x7690}, | ||
13444 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL7, 0xe647}, | ||
13445 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL6, 0xc4f0}, | ||
13446 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_TX_CTRL9, 0x7690}, | ||
13447 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL11, 0xe647}, | ||
13448 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL82_USERB1_RX_CTRL10, 0xc4f0}, | ||
13449 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_USERB0_CTRL, 0x000c}, | ||
13450 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL1, 0x6000}, | ||
13451 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CTRL3, 0x0000}, | ||
13452 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL73_BAM_CODE_FIELD, 0x0002}, | ||
13453 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI1, 0x0000}, | ||
13454 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI2, 0x0af7}, | ||
13455 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_OUI3, 0x0af7}, | ||
13456 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_BAM_CODE, 0x0002}, | ||
13457 | {MDIO_WC_DEVAD, MDIO_WC_REG_ETA_CL73_LD_UD_CODE, 0x0000} | ||
13458 | }; | ||
13459 | DP(NETIF_MSG_LINK, "Disabling 20G-KR2\n"); | ||
13460 | |||
13461 | for (i = 0; i < ARRAY_SIZE(reg_set); i++) | ||
13462 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | ||
13463 | reg_set[i].val); | ||
13464 | vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | ||
13465 | bnx2x_update_link_attr(params, vars->link_attr_sync); | ||
13466 | |||
13467 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; | ||
13468 | /* Restart AN on leading lane */ | ||
13469 | bnx2x_warpcore_restart_AN_KR(phy, params); | ||
13470 | } | ||
13471 | |||
13472 | static void bnx2x_kr2_recovery(struct link_params *params, | 13479 | static void bnx2x_kr2_recovery(struct link_params *params, |
13473 | struct link_vars *vars, | 13480 | struct link_vars *vars, |
13474 | struct bnx2x_phy *phy) | 13481 | struct bnx2x_phy *phy) |
@@ -13546,6 +13553,8 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13546 | /* Disable KR2 on both lanes */ | 13553 | /* Disable KR2 on both lanes */ |
13547 | DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, next_page); | 13554 | DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, next_page); |
13548 | bnx2x_disable_kr2(params, vars, phy); | 13555 | bnx2x_disable_kr2(params, vars, phy); |
13556 | /* Restart AN on leading lane */ | ||
13557 | bnx2x_warpcore_restart_AN_KR(phy, params); | ||
13549 | return; | 13558 | return; |
13550 | } | 13559 | } |
13551 | } | 13560 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index a6704b555042..82b658d8c04c 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -4703,6 +4703,14 @@ bool bnx2x_chk_parity_attn(struct bnx2x *bp, bool *global, bool print) | |||
4703 | attn.sig[3] = REG_RD(bp, | 4703 | attn.sig[3] = REG_RD(bp, |
4704 | MISC_REG_AEU_AFTER_INVERT_4_FUNC_0 + | 4704 | MISC_REG_AEU_AFTER_INVERT_4_FUNC_0 + |
4705 | port*4); | 4705 | port*4); |
4706 | /* Since MCP attentions can't be disabled inside the block, we need to | ||
4707 | * read AEU registers to see whether they're currently disabled | ||
4708 | */ | ||
4709 | attn.sig[3] &= ((REG_RD(bp, | ||
4710 | !port ? MISC_REG_AEU_ENABLE4_FUNC_0_OUT_0 | ||
4711 | : MISC_REG_AEU_ENABLE4_FUNC_1_OUT_0) & | ||
4712 | MISC_AEU_ENABLE_MCP_PRTY_BITS) | | ||
4713 | ~MISC_AEU_ENABLE_MCP_PRTY_BITS); | ||
4706 | 4714 | ||
4707 | if (!CHIP_IS_E1x(bp)) | 4715 | if (!CHIP_IS_E1x(bp)) |
4708 | attn.sig[4] = REG_RD(bp, | 4716 | attn.sig[4] = REG_RD(bp, |
@@ -5447,26 +5455,24 @@ static void bnx2x_timer(unsigned long data) | |||
5447 | if (IS_PF(bp) && | 5455 | if (IS_PF(bp) && |
5448 | !BP_NOMCP(bp)) { | 5456 | !BP_NOMCP(bp)) { |
5449 | int mb_idx = BP_FW_MB_IDX(bp); | 5457 | int mb_idx = BP_FW_MB_IDX(bp); |
5450 | u32 drv_pulse; | 5458 | u16 drv_pulse; |
5451 | u32 mcp_pulse; | 5459 | u16 mcp_pulse; |
5452 | 5460 | ||
5453 | ++bp->fw_drv_pulse_wr_seq; | 5461 | ++bp->fw_drv_pulse_wr_seq; |
5454 | bp->fw_drv_pulse_wr_seq &= DRV_PULSE_SEQ_MASK; | 5462 | bp->fw_drv_pulse_wr_seq &= DRV_PULSE_SEQ_MASK; |
5455 | /* TBD - add SYSTEM_TIME */ | ||
5456 | drv_pulse = bp->fw_drv_pulse_wr_seq; | 5463 | drv_pulse = bp->fw_drv_pulse_wr_seq; |
5457 | bnx2x_drv_pulse(bp); | 5464 | bnx2x_drv_pulse(bp); |
5458 | 5465 | ||
5459 | mcp_pulse = (SHMEM_RD(bp, func_mb[mb_idx].mcp_pulse_mb) & | 5466 | mcp_pulse = (SHMEM_RD(bp, func_mb[mb_idx].mcp_pulse_mb) & |
5460 | MCP_PULSE_SEQ_MASK); | 5467 | MCP_PULSE_SEQ_MASK); |
5461 | /* The delta between driver pulse and mcp response | 5468 | /* The delta between driver pulse and mcp response |
5462 | * should be 1 (before mcp response) or 0 (after mcp response) | 5469 | * should not get too big. If the MFW is more than 5 pulses |
5470 | * behind, we should worry about it enough to generate an error | ||
5471 | * log. | ||
5463 | */ | 5472 | */ |
5464 | if ((drv_pulse != mcp_pulse) && | 5473 | if (((drv_pulse - mcp_pulse) & MCP_PULSE_SEQ_MASK) > 5) |
5465 | (drv_pulse != ((mcp_pulse + 1) & MCP_PULSE_SEQ_MASK))) { | 5474 | BNX2X_ERR("MFW seems hanged: drv_pulse (0x%x) != mcp_pulse (0x%x)\n", |
5466 | /* someone lost a heartbeat... */ | ||
5467 | BNX2X_ERR("drv_pulse (0x%x) != mcp_pulse (0x%x)\n", | ||
5468 | drv_pulse, mcp_pulse); | 5475 | drv_pulse, mcp_pulse); |
5469 | } | ||
5470 | } | 5476 | } |
5471 | 5477 | ||
5472 | if (bp->state == BNX2X_STATE_OPEN) | 5478 | if (bp->state == BNX2X_STATE_OPEN) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index 2604b6204abe..9ad012bdd915 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -1819,7 +1819,7 @@ bnx2x_get_vf_igu_cam_info(struct bnx2x *bp) | |||
1819 | fid = GET_FIELD((val), IGU_REG_MAPPING_MEMORY_FID); | 1819 | fid = GET_FIELD((val), IGU_REG_MAPPING_MEMORY_FID); |
1820 | if (fid & IGU_FID_ENCODE_IS_PF) | 1820 | if (fid & IGU_FID_ENCODE_IS_PF) |
1821 | current_pf = fid & IGU_FID_PF_NUM_MASK; | 1821 | current_pf = fid & IGU_FID_PF_NUM_MASK; |
1822 | else if (current_pf == BP_ABS_FUNC(bp)) | 1822 | else if (current_pf == BP_FUNC(bp)) |
1823 | bnx2x_vf_set_igu_info(bp, sb_id, | 1823 | bnx2x_vf_set_igu_info(bp, sb_id, |
1824 | (fid & IGU_FID_VF_NUM_MASK)); | 1824 | (fid & IGU_FID_VF_NUM_MASK)); |
1825 | DP(BNX2X_MSG_IOV, "%s[%d], igu_sb_id=%d, msix=%d\n", | 1825 | DP(BNX2X_MSG_IOV, "%s[%d], igu_sb_id=%d, msix=%d\n", |
@@ -3180,6 +3180,7 @@ int bnx2x_enable_sriov(struct bnx2x *bp) | |||
3180 | /* set local queue arrays */ | 3180 | /* set local queue arrays */ |
3181 | vf->vfqs = &bp->vfdb->vfqs[qcount]; | 3181 | vf->vfqs = &bp->vfdb->vfqs[qcount]; |
3182 | qcount += vf_sb_count(vf); | 3182 | qcount += vf_sb_count(vf); |
3183 | bnx2x_iov_static_resc(bp, vf); | ||
3183 | } | 3184 | } |
3184 | 3185 | ||
3185 | /* prepare msix vectors in VF configuration space */ | 3186 | /* prepare msix vectors in VF configuration space */ |
@@ -3187,6 +3188,8 @@ int bnx2x_enable_sriov(struct bnx2x *bp) | |||
3187 | bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf_idx)); | 3188 | bnx2x_pretend_func(bp, HW_VF_HANDLE(bp, vf_idx)); |
3188 | REG_WR(bp, PCICFG_OFFSET + GRC_CONFIG_REG_VF_MSIX_CONTROL, | 3189 | REG_WR(bp, PCICFG_OFFSET + GRC_CONFIG_REG_VF_MSIX_CONTROL, |
3189 | num_vf_queues); | 3190 | num_vf_queues); |
3191 | DP(BNX2X_MSG_IOV, "set msix vec num in VF %d cfg space to %d\n", | ||
3192 | vf_idx, num_vf_queues); | ||
3190 | } | 3193 | } |
3191 | bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); | 3194 | bnx2x_pretend_func(bp, BP_ABS_FUNC(bp)); |
3192 | 3195 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c index 6cfb88732452..da16953eb2ec 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c | |||
@@ -1765,28 +1765,28 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf, | |||
1765 | switch (mbx->first_tlv.tl.type) { | 1765 | switch (mbx->first_tlv.tl.type) { |
1766 | case CHANNEL_TLV_ACQUIRE: | 1766 | case CHANNEL_TLV_ACQUIRE: |
1767 | bnx2x_vf_mbx_acquire(bp, vf, mbx); | 1767 | bnx2x_vf_mbx_acquire(bp, vf, mbx); |
1768 | break; | 1768 | return; |
1769 | case CHANNEL_TLV_INIT: | 1769 | case CHANNEL_TLV_INIT: |
1770 | bnx2x_vf_mbx_init_vf(bp, vf, mbx); | 1770 | bnx2x_vf_mbx_init_vf(bp, vf, mbx); |
1771 | break; | 1771 | return; |
1772 | case CHANNEL_TLV_SETUP_Q: | 1772 | case CHANNEL_TLV_SETUP_Q: |
1773 | bnx2x_vf_mbx_setup_q(bp, vf, mbx); | 1773 | bnx2x_vf_mbx_setup_q(bp, vf, mbx); |
1774 | break; | 1774 | return; |
1775 | case CHANNEL_TLV_SET_Q_FILTERS: | 1775 | case CHANNEL_TLV_SET_Q_FILTERS: |
1776 | bnx2x_vf_mbx_set_q_filters(bp, vf, mbx); | 1776 | bnx2x_vf_mbx_set_q_filters(bp, vf, mbx); |
1777 | break; | 1777 | return; |
1778 | case CHANNEL_TLV_TEARDOWN_Q: | 1778 | case CHANNEL_TLV_TEARDOWN_Q: |
1779 | bnx2x_vf_mbx_teardown_q(bp, vf, mbx); | 1779 | bnx2x_vf_mbx_teardown_q(bp, vf, mbx); |
1780 | break; | 1780 | return; |
1781 | case CHANNEL_TLV_CLOSE: | 1781 | case CHANNEL_TLV_CLOSE: |
1782 | bnx2x_vf_mbx_close_vf(bp, vf, mbx); | 1782 | bnx2x_vf_mbx_close_vf(bp, vf, mbx); |
1783 | break; | 1783 | return; |
1784 | case CHANNEL_TLV_RELEASE: | 1784 | case CHANNEL_TLV_RELEASE: |
1785 | bnx2x_vf_mbx_release_vf(bp, vf, mbx); | 1785 | bnx2x_vf_mbx_release_vf(bp, vf, mbx); |
1786 | break; | 1786 | return; |
1787 | case CHANNEL_TLV_UPDATE_RSS: | 1787 | case CHANNEL_TLV_UPDATE_RSS: |
1788 | bnx2x_vf_mbx_update_rss(bp, vf, mbx); | 1788 | bnx2x_vf_mbx_update_rss(bp, vf, mbx); |
1789 | break; | 1789 | return; |
1790 | } | 1790 | } |
1791 | 1791 | ||
1792 | } else { | 1792 | } else { |
@@ -1802,26 +1802,24 @@ static void bnx2x_vf_mbx_request(struct bnx2x *bp, struct bnx2x_virtf *vf, | |||
1802 | for (i = 0; i < 20; i++) | 1802 | for (i = 0; i < 20; i++) |
1803 | DP_CONT(BNX2X_MSG_IOV, "%x ", | 1803 | DP_CONT(BNX2X_MSG_IOV, "%x ", |
1804 | mbx->msg->req.tlv_buf_size.tlv_buffer[i]); | 1804 | mbx->msg->req.tlv_buf_size.tlv_buffer[i]); |
1805 | } | ||
1805 | 1806 | ||
1806 | /* test whether we can respond to the VF (do we have an address | 1807 | /* can we respond to VF (do we have an address for it?) */ |
1807 | * for it?) | 1808 | if (vf->state == VF_ACQUIRED || vf->state == VF_ENABLED) { |
1808 | */ | 1809 | /* mbx_resp uses the op_rc of the VF */ |
1809 | if (vf->state == VF_ACQUIRED || vf->state == VF_ENABLED) { | 1810 | vf->op_rc = PFVF_STATUS_NOT_SUPPORTED; |
1810 | /* mbx_resp uses the op_rc of the VF */ | ||
1811 | vf->op_rc = PFVF_STATUS_NOT_SUPPORTED; | ||
1812 | 1811 | ||
1813 | /* notify the VF that we do not support this request */ | 1812 | /* notify the VF that we do not support this request */ |
1814 | bnx2x_vf_mbx_resp(bp, vf); | 1813 | bnx2x_vf_mbx_resp(bp, vf); |
1815 | } else { | 1814 | } else { |
1816 | /* can't send a response since this VF is unknown to us | 1815 | /* can't send a response since this VF is unknown to us |
1817 | * just ack the FW to release the mailbox and unlock | 1816 | * just ack the FW to release the mailbox and unlock |
1818 | * the channel. | 1817 | * the channel. |
1819 | */ | 1818 | */ |
1820 | storm_memset_vf_mbx_ack(bp, vf->abs_vfid); | 1819 | storm_memset_vf_mbx_ack(bp, vf->abs_vfid); |
1821 | mmiowb(); | 1820 | /* Firmware ack should be written before unlocking channel */ |
1822 | bnx2x_unlock_vf_pf_channel(bp, vf, | 1821 | mmiowb(); |
1823 | mbx->first_tlv.tl.type); | 1822 | bnx2x_unlock_vf_pf_channel(bp, vf, mbx->first_tlv.tl.type); |
1824 | } | ||
1825 | } | 1823 | } |
1826 | } | 1824 | } |
1827 | 1825 | ||
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index ace5050dba38..db020230bd0b 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -88,6 +88,7 @@ static inline char *nic_name(struct pci_dev *pdev) | |||
88 | #define BE_MIN_MTU 256 | 88 | #define BE_MIN_MTU 256 |
89 | 89 | ||
90 | #define BE_NUM_VLANS_SUPPORTED 64 | 90 | #define BE_NUM_VLANS_SUPPORTED 64 |
91 | #define BE_UMC_NUM_VLANS_SUPPORTED 15 | ||
91 | #define BE_MAX_EQD 96u | 92 | #define BE_MAX_EQD 96u |
92 | #define BE_MAX_TX_FRAG_COUNT 30 | 93 | #define BE_MAX_TX_FRAG_COUNT 30 |
93 | 94 | ||
@@ -333,6 +334,7 @@ enum vf_state { | |||
333 | 334 | ||
334 | #define BE_FLAGS_LINK_STATUS_INIT 1 | 335 | #define BE_FLAGS_LINK_STATUS_INIT 1 |
335 | #define BE_FLAGS_WORKER_SCHEDULED (1 << 3) | 336 | #define BE_FLAGS_WORKER_SCHEDULED (1 << 3) |
337 | #define BE_FLAGS_VLAN_PROMISC (1 << 4) | ||
336 | #define BE_FLAGS_NAPI_ENABLED (1 << 9) | 338 | #define BE_FLAGS_NAPI_ENABLED (1 << 9) |
337 | #define BE_UC_PMAC_COUNT 30 | 339 | #define BE_UC_PMAC_COUNT 30 |
338 | #define BE_VF_UC_PMAC_COUNT 2 | 340 | #define BE_VF_UC_PMAC_COUNT 2 |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 1ab5dab11eff..bd0e0c0bbcd8 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -180,6 +180,9 @@ static int be_mcc_compl_process(struct be_adapter *adapter, | |||
180 | dev_err(&adapter->pdev->dev, | 180 | dev_err(&adapter->pdev->dev, |
181 | "opcode %d-%d failed:status %d-%d\n", | 181 | "opcode %d-%d failed:status %d-%d\n", |
182 | opcode, subsystem, compl_status, extd_status); | 182 | opcode, subsystem, compl_status, extd_status); |
183 | |||
184 | if (extd_status == MCC_ADDL_STS_INSUFFICIENT_RESOURCES) | ||
185 | return extd_status; | ||
183 | } | 186 | } |
184 | } | 187 | } |
185 | done: | 188 | done: |
@@ -1812,6 +1815,12 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) | |||
1812 | } else if (flags & IFF_ALLMULTI) { | 1815 | } else if (flags & IFF_ALLMULTI) { |
1813 | req->if_flags_mask = req->if_flags = | 1816 | req->if_flags_mask = req->if_flags = |
1814 | cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS); | 1817 | cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS); |
1818 | } else if (flags & BE_FLAGS_VLAN_PROMISC) { | ||
1819 | req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_VLAN_PROMISCUOUS); | ||
1820 | |||
1821 | if (value == ON) | ||
1822 | req->if_flags = | ||
1823 | cpu_to_le32(BE_IF_FLAGS_VLAN_PROMISCUOUS); | ||
1815 | } else { | 1824 | } else { |
1816 | struct netdev_hw_addr *ha; | 1825 | struct netdev_hw_addr *ha; |
1817 | int i = 0; | 1826 | int i = 0; |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index d026226db88c..108ca8abf0af 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -60,6 +60,8 @@ enum { | |||
60 | MCC_STATUS_NOT_SUPPORTED = 66 | 60 | MCC_STATUS_NOT_SUPPORTED = 66 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | #define MCC_ADDL_STS_INSUFFICIENT_RESOURCES 0x16 | ||
64 | |||
63 | #define CQE_STATUS_COMPL_MASK 0xFFFF | 65 | #define CQE_STATUS_COMPL_MASK 0xFFFF |
64 | #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ | 66 | #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */ |
65 | #define CQE_STATUS_EXTD_MASK 0xFFFF | 67 | #define CQE_STATUS_EXTD_MASK 0xFFFF |
@@ -1791,7 +1793,7 @@ struct be_nic_res_desc { | |||
1791 | u8 acpi_params; | 1793 | u8 acpi_params; |
1792 | u8 wol_param; | 1794 | u8 wol_param; |
1793 | u16 rsvd7; | 1795 | u16 rsvd7; |
1794 | u32 rsvd8[3]; | 1796 | u32 rsvd8[7]; |
1795 | } __packed; | 1797 | } __packed; |
1796 | 1798 | ||
1797 | struct be_cmd_req_get_func_config { | 1799 | struct be_cmd_req_get_func_config { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 100b528b9bd0..2c38cc402119 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -855,11 +855,11 @@ static struct sk_buff *be_xmit_workarounds(struct be_adapter *adapter, | |||
855 | unsigned int eth_hdr_len; | 855 | unsigned int eth_hdr_len; |
856 | struct iphdr *ip; | 856 | struct iphdr *ip; |
857 | 857 | ||
858 | /* Lancer ASIC has a bug wherein packets that are 32 bytes or less | 858 | /* Lancer, SH-R ASICs have a bug wherein Packets that are 32 bytes or less |
859 | * may cause a transmit stall on that port. So the work-around is to | 859 | * may cause a transmit stall on that port. So the work-around is to |
860 | * pad such packets to a 36-byte length. | 860 | * pad short packets (<= 32 bytes) to a 36-byte length. |
861 | */ | 861 | */ |
862 | if (unlikely(lancer_chip(adapter) && skb->len <= 32)) { | 862 | if (unlikely(!BEx_chip(adapter) && skb->len <= 32)) { |
863 | if (skb_padto(skb, 36)) | 863 | if (skb_padto(skb, 36)) |
864 | goto tx_drop; | 864 | goto tx_drop; |
865 | skb->len = 36; | 865 | skb->len = 36; |
@@ -1013,18 +1013,40 @@ static int be_vid_config(struct be_adapter *adapter) | |||
1013 | status = be_cmd_vlan_config(adapter, adapter->if_handle, | 1013 | status = be_cmd_vlan_config(adapter, adapter->if_handle, |
1014 | vids, num, 1, 0); | 1014 | vids, num, 1, 0); |
1015 | 1015 | ||
1016 | /* Set to VLAN promisc mode as setting VLAN filter failed */ | ||
1017 | if (status) { | 1016 | if (status) { |
1018 | dev_info(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n"); | 1017 | /* Set to VLAN promisc mode as setting VLAN filter failed */ |
1019 | dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering.\n"); | 1018 | if (status == MCC_ADDL_STS_INSUFFICIENT_RESOURCES) |
1020 | goto set_vlan_promisc; | 1019 | goto set_vlan_promisc; |
1020 | dev_err(&adapter->pdev->dev, | ||
1021 | "Setting HW VLAN filtering failed.\n"); | ||
1022 | } else { | ||
1023 | if (adapter->flags & BE_FLAGS_VLAN_PROMISC) { | ||
1024 | /* hw VLAN filtering re-enabled. */ | ||
1025 | status = be_cmd_rx_filter(adapter, | ||
1026 | BE_FLAGS_VLAN_PROMISC, OFF); | ||
1027 | if (!status) { | ||
1028 | dev_info(&adapter->pdev->dev, | ||
1029 | "Disabling VLAN Promiscuous mode.\n"); | ||
1030 | adapter->flags &= ~BE_FLAGS_VLAN_PROMISC; | ||
1031 | dev_info(&adapter->pdev->dev, | ||
1032 | "Re-Enabling HW VLAN filtering\n"); | ||
1033 | } | ||
1034 | } | ||
1021 | } | 1035 | } |
1022 | 1036 | ||
1023 | return status; | 1037 | return status; |
1024 | 1038 | ||
1025 | set_vlan_promisc: | 1039 | set_vlan_promisc: |
1026 | status = be_cmd_vlan_config(adapter, adapter->if_handle, | 1040 | dev_warn(&adapter->pdev->dev, "Exhausted VLAN HW filters.\n"); |
1027 | NULL, 0, 1, 1); | 1041 | |
1042 | status = be_cmd_rx_filter(adapter, BE_FLAGS_VLAN_PROMISC, ON); | ||
1043 | if (!status) { | ||
1044 | dev_info(&adapter->pdev->dev, "Enable VLAN Promiscuous mode\n"); | ||
1045 | dev_info(&adapter->pdev->dev, "Disabling HW VLAN filtering\n"); | ||
1046 | adapter->flags |= BE_FLAGS_VLAN_PROMISC; | ||
1047 | } else | ||
1048 | dev_err(&adapter->pdev->dev, | ||
1049 | "Failed to enable VLAN Promiscuous mode.\n"); | ||
1028 | return status; | 1050 | return status; |
1029 | } | 1051 | } |
1030 | 1052 | ||
@@ -1033,10 +1055,6 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid) | |||
1033 | struct be_adapter *adapter = netdev_priv(netdev); | 1055 | struct be_adapter *adapter = netdev_priv(netdev); |
1034 | int status = 0; | 1056 | int status = 0; |
1035 | 1057 | ||
1036 | if (!lancer_chip(adapter) && !be_physfn(adapter)) { | ||
1037 | status = -EINVAL; | ||
1038 | goto ret; | ||
1039 | } | ||
1040 | 1058 | ||
1041 | /* Packets with VID 0 are always received by Lancer by default */ | 1059 | /* Packets with VID 0 are always received by Lancer by default */ |
1042 | if (lancer_chip(adapter) && vid == 0) | 1060 | if (lancer_chip(adapter) && vid == 0) |
@@ -1059,11 +1077,6 @@ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid) | |||
1059 | struct be_adapter *adapter = netdev_priv(netdev); | 1077 | struct be_adapter *adapter = netdev_priv(netdev); |
1060 | int status = 0; | 1078 | int status = 0; |
1061 | 1079 | ||
1062 | if (!lancer_chip(adapter) && !be_physfn(adapter)) { | ||
1063 | status = -EINVAL; | ||
1064 | goto ret; | ||
1065 | } | ||
1066 | |||
1067 | /* Packets with VID 0 are always received by Lancer by default */ | 1080 | /* Packets with VID 0 are always received by Lancer by default */ |
1068 | if (lancer_chip(adapter) && vid == 0) | 1081 | if (lancer_chip(adapter) && vid == 0) |
1069 | goto ret; | 1082 | goto ret; |
@@ -1188,8 +1201,8 @@ static int be_get_vf_config(struct net_device *netdev, int vf, | |||
1188 | 1201 | ||
1189 | vi->vf = vf; | 1202 | vi->vf = vf; |
1190 | vi->tx_rate = vf_cfg->tx_rate; | 1203 | vi->tx_rate = vf_cfg->tx_rate; |
1191 | vi->vlan = vf_cfg->vlan_tag; | 1204 | vi->vlan = vf_cfg->vlan_tag & VLAN_VID_MASK; |
1192 | vi->qos = 0; | 1205 | vi->qos = vf_cfg->vlan_tag >> VLAN_PRIO_SHIFT; |
1193 | memcpy(&vi->mac, vf_cfg->mac_addr, ETH_ALEN); | 1206 | memcpy(&vi->mac, vf_cfg->mac_addr, ETH_ALEN); |
1194 | 1207 | ||
1195 | return 0; | 1208 | return 0; |
@@ -1199,28 +1212,29 @@ static int be_set_vf_vlan(struct net_device *netdev, | |||
1199 | int vf, u16 vlan, u8 qos) | 1212 | int vf, u16 vlan, u8 qos) |
1200 | { | 1213 | { |
1201 | struct be_adapter *adapter = netdev_priv(netdev); | 1214 | struct be_adapter *adapter = netdev_priv(netdev); |
1215 | struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; | ||
1202 | int status = 0; | 1216 | int status = 0; |
1203 | 1217 | ||
1204 | if (!sriov_enabled(adapter)) | 1218 | if (!sriov_enabled(adapter)) |
1205 | return -EPERM; | 1219 | return -EPERM; |
1206 | 1220 | ||
1207 | if (vf >= adapter->num_vfs || vlan > 4095) | 1221 | if (vf >= adapter->num_vfs || vlan > 4095 || qos > 7) |
1208 | return -EINVAL; | 1222 | return -EINVAL; |
1209 | 1223 | ||
1210 | if (vlan) { | 1224 | if (vlan || qos) { |
1211 | if (adapter->vf_cfg[vf].vlan_tag != vlan) { | 1225 | vlan |= qos << VLAN_PRIO_SHIFT; |
1226 | if (vf_cfg->vlan_tag != vlan) { | ||
1212 | /* If this is new value, program it. Else skip. */ | 1227 | /* If this is new value, program it. Else skip. */ |
1213 | adapter->vf_cfg[vf].vlan_tag = vlan; | 1228 | vf_cfg->vlan_tag = vlan; |
1214 | 1229 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | |
1215 | status = be_cmd_set_hsw_config(adapter, vlan, | 1230 | vf_cfg->if_handle, 0); |
1216 | vf + 1, adapter->vf_cfg[vf].if_handle, 0); | ||
1217 | } | 1231 | } |
1218 | } else { | 1232 | } else { |
1219 | /* Reset Transparent Vlan Tagging. */ | 1233 | /* Reset Transparent Vlan Tagging. */ |
1220 | adapter->vf_cfg[vf].vlan_tag = 0; | 1234 | vf_cfg->vlan_tag = 0; |
1221 | vlan = adapter->vf_cfg[vf].def_vid; | 1235 | vlan = vf_cfg->def_vid; |
1222 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | 1236 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, |
1223 | adapter->vf_cfg[vf].if_handle, 0); | 1237 | vf_cfg->if_handle, 0); |
1224 | } | 1238 | } |
1225 | 1239 | ||
1226 | 1240 | ||
@@ -2963,6 +2977,8 @@ static void BEx_get_resources(struct be_adapter *adapter, | |||
2963 | 2977 | ||
2964 | if (adapter->function_mode & FLEX10_MODE) | 2978 | if (adapter->function_mode & FLEX10_MODE) |
2965 | res->max_vlans = BE_NUM_VLANS_SUPPORTED/8; | 2979 | res->max_vlans = BE_NUM_VLANS_SUPPORTED/8; |
2980 | else if (adapter->function_mode & UMC_ENABLED) | ||
2981 | res->max_vlans = BE_UMC_NUM_VLANS_SUPPORTED; | ||
2966 | else | 2982 | else |
2967 | res->max_vlans = BE_NUM_VLANS_SUPPORTED; | 2983 | res->max_vlans = BE_NUM_VLANS_SUPPORTED; |
2968 | res->max_mcast_mac = BE_MAX_MC; | 2984 | res->max_mcast_mac = BE_MAX_MC; |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c index 005c2e06b8c0..f8b92864fc52 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c | |||
@@ -90,7 +90,7 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
90 | struct fs_platform_info *fpi = fep->fpi; | 90 | struct fs_platform_info *fpi = fep->fpi; |
91 | int ret = -EINVAL; | 91 | int ret = -EINVAL; |
92 | 92 | ||
93 | fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); | 93 | fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0); |
94 | if (fep->interrupt == NO_IRQ) | 94 | if (fep->interrupt == NO_IRQ) |
95 | goto out; | 95 | goto out; |
96 | 96 | ||
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c index 8aac2316d0f3..a9a00f39521a 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c | |||
@@ -100,7 +100,7 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
100 | { | 100 | { |
101 | struct platform_device *ofdev = to_platform_device(fep->dev); | 101 | struct platform_device *ofdev = to_platform_device(fep->dev); |
102 | 102 | ||
103 | fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); | 103 | fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0); |
104 | if (fep->interrupt == NO_IRQ) | 104 | if (fep->interrupt == NO_IRQ) |
105 | return -EINVAL; | 105 | return -EINVAL; |
106 | 106 | ||
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c index e151784c5ebd..d37cd4ebac65 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c | |||
@@ -100,7 +100,7 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
100 | { | 100 | { |
101 | struct platform_device *ofdev = to_platform_device(fep->dev); | 101 | struct platform_device *ofdev = to_platform_device(fep->dev); |
102 | 102 | ||
103 | fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); | 103 | fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0); |
104 | if (fep->interrupt == NO_IRQ) | 104 | if (fep->interrupt == NO_IRQ) |
105 | return -EINVAL; | 105 | return -EINVAL; |
106 | 106 | ||
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index 098f133908ae..e006a09ba899 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -452,7 +452,9 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
452 | err = -ENODEV; | 452 | err = -ENODEV; |
453 | 453 | ||
454 | etsects->caps = ptp_gianfar_caps; | 454 | etsects->caps = ptp_gianfar_caps; |
455 | etsects->cksel = DEFAULT_CKSEL; | 455 | |
456 | if (get_of_u32(node, "fsl,cksel", &etsects->cksel)) | ||
457 | etsects->cksel = DEFAULT_CKSEL; | ||
456 | 458 | ||
457 | if (get_of_u32(node, "fsl,tclk-period", &etsects->tclk_period) || | 459 | if (get_of_u32(node, "fsl,tclk-period", &etsects->tclk_period) || |
458 | get_of_u32(node, "fsl,tmr-prsc", &etsects->tmr_prsc) || | 460 | get_of_u32(node, "fsl,tmr-prsc", &etsects->tmr_prsc) || |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c index 0c524fa9f811..cfef7fc32cdd 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.c +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.c | |||
@@ -701,8 +701,7 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw, | |||
701 | 701 | ||
702 | details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use); | 702 | details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use); |
703 | if (cmd_details) { | 703 | if (cmd_details) { |
704 | memcpy(details, cmd_details, | 704 | *details = *cmd_details; |
705 | sizeof(struct i40e_asq_cmd_details)); | ||
706 | 705 | ||
707 | /* If the cmd_details are defined copy the cookie. The | 706 | /* If the cmd_details are defined copy the cookie. The |
708 | * cpu_to_le32 is not needed here because the data is ignored | 707 | * cpu_to_le32 is not needed here because the data is ignored |
@@ -760,7 +759,7 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw, | |||
760 | desc_on_ring = I40E_ADMINQ_DESC(hw->aq.asq, hw->aq.asq.next_to_use); | 759 | desc_on_ring = I40E_ADMINQ_DESC(hw->aq.asq, hw->aq.asq.next_to_use); |
761 | 760 | ||
762 | /* if the desc is available copy the temp desc to the right place */ | 761 | /* if the desc is available copy the temp desc to the right place */ |
763 | memcpy(desc_on_ring, desc, sizeof(struct i40e_aq_desc)); | 762 | *desc_on_ring = *desc; |
764 | 763 | ||
765 | /* if buff is not NULL assume indirect command */ | 764 | /* if buff is not NULL assume indirect command */ |
766 | if (buff != NULL) { | 765 | if (buff != NULL) { |
@@ -807,7 +806,7 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw, | |||
807 | 806 | ||
808 | /* if ready, copy the desc back to temp */ | 807 | /* if ready, copy the desc back to temp */ |
809 | if (i40e_asq_done(hw)) { | 808 | if (i40e_asq_done(hw)) { |
810 | memcpy(desc, desc_on_ring, sizeof(struct i40e_aq_desc)); | 809 | *desc = *desc_on_ring; |
811 | if (buff != NULL) | 810 | if (buff != NULL) |
812 | memcpy(buff, dma_buff->va, buff_size); | 811 | memcpy(buff, dma_buff->va, buff_size); |
813 | retval = le16_to_cpu(desc->retval); | 812 | retval = le16_to_cpu(desc->retval); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c index c21df7bc3b1d..1e4ea134975a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_common.c +++ b/drivers/net/ethernet/intel/i40e/i40e_common.c | |||
@@ -507,7 +507,7 @@ i40e_status i40e_aq_get_link_info(struct i40e_hw *hw, | |||
507 | 507 | ||
508 | /* save link status information */ | 508 | /* save link status information */ |
509 | if (link) | 509 | if (link) |
510 | memcpy(link, hw_link_info, sizeof(struct i40e_link_status)); | 510 | *link = *hw_link_info; |
511 | 511 | ||
512 | /* flag cleared so helper functions don't call AQ again */ | 512 | /* flag cleared so helper functions don't call AQ again */ |
513 | hw->phy.get_link_info = false; | 513 | hw->phy.get_link_info = false; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 601d482694ea..221aa4795017 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -101,10 +101,10 @@ int i40e_allocate_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem, | |||
101 | mem->size = ALIGN(size, alignment); | 101 | mem->size = ALIGN(size, alignment); |
102 | mem->va = dma_zalloc_coherent(&pf->pdev->dev, mem->size, | 102 | mem->va = dma_zalloc_coherent(&pf->pdev->dev, mem->size, |
103 | &mem->pa, GFP_KERNEL); | 103 | &mem->pa, GFP_KERNEL); |
104 | if (mem->va) | 104 | if (!mem->va) |
105 | return 0; | 105 | return -ENOMEM; |
106 | 106 | ||
107 | return -ENOMEM; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | /** | 110 | /** |
@@ -136,10 +136,10 @@ int i40e_allocate_virt_mem_d(struct i40e_hw *hw, struct i40e_virt_mem *mem, | |||
136 | mem->size = size; | 136 | mem->size = size; |
137 | mem->va = kzalloc(size, GFP_KERNEL); | 137 | mem->va = kzalloc(size, GFP_KERNEL); |
138 | 138 | ||
139 | if (mem->va) | 139 | if (!mem->va) |
140 | return 0; | 140 | return -ENOMEM; |
141 | 141 | ||
142 | return -ENOMEM; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
145 | /** | 145 | /** |
@@ -174,8 +174,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, | |||
174 | u16 needed, u16 id) | 174 | u16 needed, u16 id) |
175 | { | 175 | { |
176 | int ret = -ENOMEM; | 176 | int ret = -ENOMEM; |
177 | int i = 0; | 177 | int i, j; |
178 | int j = 0; | ||
179 | 178 | ||
180 | if (!pile || needed == 0 || id >= I40E_PILE_VALID_BIT) { | 179 | if (!pile || needed == 0 || id >= I40E_PILE_VALID_BIT) { |
181 | dev_info(&pf->pdev->dev, | 180 | dev_info(&pf->pdev->dev, |
@@ -186,7 +185,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, | |||
186 | 185 | ||
187 | /* start the linear search with an imperfect hint */ | 186 | /* start the linear search with an imperfect hint */ |
188 | i = pile->search_hint; | 187 | i = pile->search_hint; |
189 | while (i < pile->num_entries && ret < 0) { | 188 | while (i < pile->num_entries) { |
190 | /* skip already allocated entries */ | 189 | /* skip already allocated entries */ |
191 | if (pile->list[i] & I40E_PILE_VALID_BIT) { | 190 | if (pile->list[i] & I40E_PILE_VALID_BIT) { |
192 | i++; | 191 | i++; |
@@ -205,6 +204,7 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile, | |||
205 | pile->list[i+j] = id | I40E_PILE_VALID_BIT; | 204 | pile->list[i+j] = id | I40E_PILE_VALID_BIT; |
206 | ret = i; | 205 | ret = i; |
207 | pile->search_hint = i + j; | 206 | pile->search_hint = i + j; |
207 | break; | ||
208 | } else { | 208 | } else { |
209 | /* not enough, so skip over it and continue looking */ | 209 | /* not enough, so skip over it and continue looking */ |
210 | i += j; | 210 | i += j; |
@@ -1388,7 +1388,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1388 | bool add_happened = false; | 1388 | bool add_happened = false; |
1389 | int filter_list_len = 0; | 1389 | int filter_list_len = 0; |
1390 | u32 changed_flags = 0; | 1390 | u32 changed_flags = 0; |
1391 | i40e_status ret = 0; | 1391 | i40e_status aq_ret = 0; |
1392 | struct i40e_pf *pf; | 1392 | struct i40e_pf *pf; |
1393 | int num_add = 0; | 1393 | int num_add = 0; |
1394 | int num_del = 0; | 1394 | int num_del = 0; |
@@ -1449,28 +1449,28 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1449 | 1449 | ||
1450 | /* flush a full buffer */ | 1450 | /* flush a full buffer */ |
1451 | if (num_del == filter_list_len) { | 1451 | if (num_del == filter_list_len) { |
1452 | ret = i40e_aq_remove_macvlan(&pf->hw, | 1452 | aq_ret = i40e_aq_remove_macvlan(&pf->hw, |
1453 | vsi->seid, del_list, num_del, | 1453 | vsi->seid, del_list, num_del, |
1454 | NULL); | 1454 | NULL); |
1455 | num_del = 0; | 1455 | num_del = 0; |
1456 | memset(del_list, 0, sizeof(*del_list)); | 1456 | memset(del_list, 0, sizeof(*del_list)); |
1457 | 1457 | ||
1458 | if (ret) | 1458 | if (aq_ret) |
1459 | dev_info(&pf->pdev->dev, | 1459 | dev_info(&pf->pdev->dev, |
1460 | "ignoring delete macvlan error, err %d, aq_err %d while flushing a full buffer\n", | 1460 | "ignoring delete macvlan error, err %d, aq_err %d while flushing a full buffer\n", |
1461 | ret, | 1461 | aq_ret, |
1462 | pf->hw.aq.asq_last_status); | 1462 | pf->hw.aq.asq_last_status); |
1463 | } | 1463 | } |
1464 | } | 1464 | } |
1465 | if (num_del) { | 1465 | if (num_del) { |
1466 | ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, | 1466 | aq_ret = i40e_aq_remove_macvlan(&pf->hw, vsi->seid, |
1467 | del_list, num_del, NULL); | 1467 | del_list, num_del, NULL); |
1468 | num_del = 0; | 1468 | num_del = 0; |
1469 | 1469 | ||
1470 | if (ret) | 1470 | if (aq_ret) |
1471 | dev_info(&pf->pdev->dev, | 1471 | dev_info(&pf->pdev->dev, |
1472 | "ignoring delete macvlan error, err %d, aq_err %d\n", | 1472 | "ignoring delete macvlan error, err %d, aq_err %d\n", |
1473 | ret, pf->hw.aq.asq_last_status); | 1473 | aq_ret, pf->hw.aq.asq_last_status); |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | kfree(del_list); | 1476 | kfree(del_list); |
@@ -1515,32 +1515,30 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1515 | 1515 | ||
1516 | /* flush a full buffer */ | 1516 | /* flush a full buffer */ |
1517 | if (num_add == filter_list_len) { | 1517 | if (num_add == filter_list_len) { |
1518 | ret = i40e_aq_add_macvlan(&pf->hw, | 1518 | aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, |
1519 | vsi->seid, | 1519 | add_list, num_add, |
1520 | add_list, | 1520 | NULL); |
1521 | num_add, | ||
1522 | NULL); | ||
1523 | num_add = 0; | 1521 | num_add = 0; |
1524 | 1522 | ||
1525 | if (ret) | 1523 | if (aq_ret) |
1526 | break; | 1524 | break; |
1527 | memset(add_list, 0, sizeof(*add_list)); | 1525 | memset(add_list, 0, sizeof(*add_list)); |
1528 | } | 1526 | } |
1529 | } | 1527 | } |
1530 | if (num_add) { | 1528 | if (num_add) { |
1531 | ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, | 1529 | aq_ret = i40e_aq_add_macvlan(&pf->hw, vsi->seid, |
1532 | add_list, num_add, NULL); | 1530 | add_list, num_add, NULL); |
1533 | num_add = 0; | 1531 | num_add = 0; |
1534 | } | 1532 | } |
1535 | kfree(add_list); | 1533 | kfree(add_list); |
1536 | add_list = NULL; | 1534 | add_list = NULL; |
1537 | 1535 | ||
1538 | if (add_happened && (!ret)) { | 1536 | if (add_happened && (!aq_ret)) { |
1539 | /* do nothing */; | 1537 | /* do nothing */; |
1540 | } else if (add_happened && (ret)) { | 1538 | } else if (add_happened && (aq_ret)) { |
1541 | dev_info(&pf->pdev->dev, | 1539 | dev_info(&pf->pdev->dev, |
1542 | "add filter failed, err %d, aq_err %d\n", | 1540 | "add filter failed, err %d, aq_err %d\n", |
1543 | ret, pf->hw.aq.asq_last_status); | 1541 | aq_ret, pf->hw.aq.asq_last_status); |
1544 | if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOSPC) && | 1542 | if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOSPC) && |
1545 | !test_bit(__I40E_FILTER_OVERFLOW_PROMISC, | 1543 | !test_bit(__I40E_FILTER_OVERFLOW_PROMISC, |
1546 | &vsi->state)) { | 1544 | &vsi->state)) { |
@@ -1556,28 +1554,27 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) | |||
1556 | if (changed_flags & IFF_ALLMULTI) { | 1554 | if (changed_flags & IFF_ALLMULTI) { |
1557 | bool cur_multipromisc; | 1555 | bool cur_multipromisc; |
1558 | cur_multipromisc = !!(vsi->current_netdev_flags & IFF_ALLMULTI); | 1556 | cur_multipromisc = !!(vsi->current_netdev_flags & IFF_ALLMULTI); |
1559 | ret = i40e_aq_set_vsi_multicast_promiscuous(&vsi->back->hw, | 1557 | aq_ret = i40e_aq_set_vsi_multicast_promiscuous(&vsi->back->hw, |
1560 | vsi->seid, | 1558 | vsi->seid, |
1561 | cur_multipromisc, | 1559 | cur_multipromisc, |
1562 | NULL); | 1560 | NULL); |
1563 | if (ret) | 1561 | if (aq_ret) |
1564 | dev_info(&pf->pdev->dev, | 1562 | dev_info(&pf->pdev->dev, |
1565 | "set multi promisc failed, err %d, aq_err %d\n", | 1563 | "set multi promisc failed, err %d, aq_err %d\n", |
1566 | ret, pf->hw.aq.asq_last_status); | 1564 | aq_ret, pf->hw.aq.asq_last_status); |
1567 | } | 1565 | } |
1568 | if ((changed_flags & IFF_PROMISC) || promisc_forced_on) { | 1566 | if ((changed_flags & IFF_PROMISC) || promisc_forced_on) { |
1569 | bool cur_promisc; | 1567 | bool cur_promisc; |
1570 | cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) || | 1568 | cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) || |
1571 | test_bit(__I40E_FILTER_OVERFLOW_PROMISC, | 1569 | test_bit(__I40E_FILTER_OVERFLOW_PROMISC, |
1572 | &vsi->state)); | 1570 | &vsi->state)); |
1573 | ret = i40e_aq_set_vsi_unicast_promiscuous(&vsi->back->hw, | 1571 | aq_ret = i40e_aq_set_vsi_unicast_promiscuous(&vsi->back->hw, |
1574 | vsi->seid, | 1572 | vsi->seid, |
1575 | cur_promisc, | 1573 | cur_promisc, NULL); |
1576 | NULL); | 1574 | if (aq_ret) |
1577 | if (ret) | ||
1578 | dev_info(&pf->pdev->dev, | 1575 | dev_info(&pf->pdev->dev, |
1579 | "set uni promisc failed, err %d, aq_err %d\n", | 1576 | "set uni promisc failed, err %d, aq_err %d\n", |
1580 | ret, pf->hw.aq.asq_last_status); | 1577 | aq_ret, pf->hw.aq.asq_last_status); |
1581 | } | 1578 | } |
1582 | 1579 | ||
1583 | clear_bit(__I40E_CONFIG_BUSY, &vsi->state); | 1580 | clear_bit(__I40E_CONFIG_BUSY, &vsi->state); |
@@ -1790,6 +1787,8 @@ int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid) | |||
1790 | * i40e_vsi_kill_vlan - Remove vsi membership for given vlan | 1787 | * i40e_vsi_kill_vlan - Remove vsi membership for given vlan |
1791 | * @vsi: the vsi being configured | 1788 | * @vsi: the vsi being configured |
1792 | * @vid: vlan id to be removed (0 = untagged only , -1 = any) | 1789 | * @vid: vlan id to be removed (0 = untagged only , -1 = any) |
1790 | * | ||
1791 | * Return: 0 on success or negative otherwise | ||
1793 | **/ | 1792 | **/ |
1794 | int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) | 1793 | int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) |
1795 | { | 1794 | { |
@@ -1863,37 +1862,39 @@ int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid) | |||
1863 | * i40e_vlan_rx_add_vid - Add a vlan id filter to HW offload | 1862 | * i40e_vlan_rx_add_vid - Add a vlan id filter to HW offload |
1864 | * @netdev: network interface to be adjusted | 1863 | * @netdev: network interface to be adjusted |
1865 | * @vid: vlan id to be added | 1864 | * @vid: vlan id to be added |
1865 | * | ||
1866 | * net_device_ops implementation for adding vlan ids | ||
1866 | **/ | 1867 | **/ |
1867 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, | 1868 | static int i40e_vlan_rx_add_vid(struct net_device *netdev, |
1868 | __always_unused __be16 proto, u16 vid) | 1869 | __always_unused __be16 proto, u16 vid) |
1869 | { | 1870 | { |
1870 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1871 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1871 | struct i40e_vsi *vsi = np->vsi; | 1872 | struct i40e_vsi *vsi = np->vsi; |
1872 | int ret; | 1873 | int ret = 0; |
1873 | 1874 | ||
1874 | if (vid > 4095) | 1875 | if (vid > 4095) |
1875 | return 0; | 1876 | return -EINVAL; |
1877 | |||
1878 | netdev_info(netdev, "adding %pM vid=%d\n", netdev->dev_addr, vid); | ||
1876 | 1879 | ||
1877 | netdev_info(vsi->netdev, "adding %pM vid=%d\n", | ||
1878 | netdev->dev_addr, vid); | ||
1879 | /* If the network stack called us with vid = 0, we should | 1880 | /* If the network stack called us with vid = 0, we should |
1880 | * indicate to i40e_vsi_add_vlan() that we want to receive | 1881 | * indicate to i40e_vsi_add_vlan() that we want to receive |
1881 | * any traffic (i.e. with any vlan tag, or untagged) | 1882 | * any traffic (i.e. with any vlan tag, or untagged) |
1882 | */ | 1883 | */ |
1883 | ret = i40e_vsi_add_vlan(vsi, vid ? vid : I40E_VLAN_ANY); | 1884 | ret = i40e_vsi_add_vlan(vsi, vid ? vid : I40E_VLAN_ANY); |
1884 | 1885 | ||
1885 | if (!ret) { | 1886 | if (!ret && (vid < VLAN_N_VID)) |
1886 | if (vid < VLAN_N_VID) | 1887 | set_bit(vid, vsi->active_vlans); |
1887 | set_bit(vid, vsi->active_vlans); | ||
1888 | } | ||
1889 | 1888 | ||
1890 | return 0; | 1889 | return ret; |
1891 | } | 1890 | } |
1892 | 1891 | ||
1893 | /** | 1892 | /** |
1894 | * i40e_vlan_rx_kill_vid - Remove a vlan id filter from HW offload | 1893 | * i40e_vlan_rx_kill_vid - Remove a vlan id filter from HW offload |
1895 | * @netdev: network interface to be adjusted | 1894 | * @netdev: network interface to be adjusted |
1896 | * @vid: vlan id to be removed | 1895 | * @vid: vlan id to be removed |
1896 | * | ||
1897 | * net_device_ops implementation for adding vlan ids | ||
1897 | **/ | 1898 | **/ |
1898 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, | 1899 | static int i40e_vlan_rx_kill_vid(struct net_device *netdev, |
1899 | __always_unused __be16 proto, u16 vid) | 1900 | __always_unused __be16 proto, u16 vid) |
@@ -1901,15 +1902,16 @@ static int i40e_vlan_rx_kill_vid(struct net_device *netdev, | |||
1901 | struct i40e_netdev_priv *np = netdev_priv(netdev); | 1902 | struct i40e_netdev_priv *np = netdev_priv(netdev); |
1902 | struct i40e_vsi *vsi = np->vsi; | 1903 | struct i40e_vsi *vsi = np->vsi; |
1903 | 1904 | ||
1904 | netdev_info(vsi->netdev, "removing %pM vid=%d\n", | 1905 | netdev_info(netdev, "removing %pM vid=%d\n", netdev->dev_addr, vid); |
1905 | netdev->dev_addr, vid); | 1906 | |
1906 | /* return code is ignored as there is nothing a user | 1907 | /* return code is ignored as there is nothing a user |
1907 | * can do about failure to remove and a log message was | 1908 | * can do about failure to remove and a log message was |
1908 | * already printed from another function | 1909 | * already printed from the other function |
1909 | */ | 1910 | */ |
1910 | i40e_vsi_kill_vlan(vsi, vid); | 1911 | i40e_vsi_kill_vlan(vsi, vid); |
1911 | 1912 | ||
1912 | clear_bit(vid, vsi->active_vlans); | 1913 | clear_bit(vid, vsi->active_vlans); |
1914 | |||
1913 | return 0; | 1915 | return 0; |
1914 | } | 1916 | } |
1915 | 1917 | ||
@@ -1936,10 +1938,10 @@ static void i40e_restore_vlan(struct i40e_vsi *vsi) | |||
1936 | * @vsi: the vsi being adjusted | 1938 | * @vsi: the vsi being adjusted |
1937 | * @vid: the vlan id to set as a PVID | 1939 | * @vid: the vlan id to set as a PVID |
1938 | **/ | 1940 | **/ |
1939 | i40e_status i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid) | 1941 | int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid) |
1940 | { | 1942 | { |
1941 | struct i40e_vsi_context ctxt; | 1943 | struct i40e_vsi_context ctxt; |
1942 | i40e_status ret; | 1944 | i40e_status aq_ret; |
1943 | 1945 | ||
1944 | vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID); | 1946 | vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID); |
1945 | vsi->info.pvid = cpu_to_le16(vid); | 1947 | vsi->info.pvid = cpu_to_le16(vid); |
@@ -1948,14 +1950,15 @@ i40e_status i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid) | |||
1948 | 1950 | ||
1949 | ctxt.seid = vsi->seid; | 1951 | ctxt.seid = vsi->seid; |
1950 | memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); | 1952 | memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); |
1951 | ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); | 1953 | aq_ret = i40e_aq_update_vsi_params(&vsi->back->hw, &ctxt, NULL); |
1952 | if (ret) { | 1954 | if (aq_ret) { |
1953 | dev_info(&vsi->back->pdev->dev, | 1955 | dev_info(&vsi->back->pdev->dev, |
1954 | "%s: update vsi failed, aq_err=%d\n", | 1956 | "%s: update vsi failed, aq_err=%d\n", |
1955 | __func__, vsi->back->hw.aq.asq_last_status); | 1957 | __func__, vsi->back->hw.aq.asq_last_status); |
1958 | return -ENOENT; | ||
1956 | } | 1959 | } |
1957 | 1960 | ||
1958 | return ret; | 1961 | return 0; |
1959 | } | 1962 | } |
1960 | 1963 | ||
1961 | /** | 1964 | /** |
@@ -3326,7 +3329,8 @@ static void i40e_pf_unquiesce_all_vsi(struct i40e_pf *pf) | |||
3326 | **/ | 3329 | **/ |
3327 | static u8 i40e_dcb_get_num_tc(struct i40e_dcbx_config *dcbcfg) | 3330 | static u8 i40e_dcb_get_num_tc(struct i40e_dcbx_config *dcbcfg) |
3328 | { | 3331 | { |
3329 | int num_tc = 0, i; | 3332 | u8 num_tc = 0; |
3333 | int i; | ||
3330 | 3334 | ||
3331 | /* Scan the ETS Config Priority Table to find | 3335 | /* Scan the ETS Config Priority Table to find |
3332 | * traffic class enabled for a given priority | 3336 | * traffic class enabled for a given priority |
@@ -3341,9 +3345,7 @@ static u8 i40e_dcb_get_num_tc(struct i40e_dcbx_config *dcbcfg) | |||
3341 | /* Traffic class index starts from zero so | 3345 | /* Traffic class index starts from zero so |
3342 | * increment to return the actual count | 3346 | * increment to return the actual count |
3343 | */ | 3347 | */ |
3344 | num_tc++; | 3348 | return num_tc + 1; |
3345 | |||
3346 | return num_tc; | ||
3347 | } | 3349 | } |
3348 | 3350 | ||
3349 | /** | 3351 | /** |
@@ -3451,28 +3453,27 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi) | |||
3451 | struct i40e_aqc_query_vsi_bw_config_resp bw_config = {0}; | 3453 | struct i40e_aqc_query_vsi_bw_config_resp bw_config = {0}; |
3452 | struct i40e_pf *pf = vsi->back; | 3454 | struct i40e_pf *pf = vsi->back; |
3453 | struct i40e_hw *hw = &pf->hw; | 3455 | struct i40e_hw *hw = &pf->hw; |
3456 | i40e_status aq_ret; | ||
3454 | u32 tc_bw_max; | 3457 | u32 tc_bw_max; |
3455 | int ret; | ||
3456 | int i; | 3458 | int i; |
3457 | 3459 | ||
3458 | /* Get the VSI level BW configuration */ | 3460 | /* Get the VSI level BW configuration */ |
3459 | ret = i40e_aq_query_vsi_bw_config(hw, vsi->seid, &bw_config, NULL); | 3461 | aq_ret = i40e_aq_query_vsi_bw_config(hw, vsi->seid, &bw_config, NULL); |
3460 | if (ret) { | 3462 | if (aq_ret) { |
3461 | dev_info(&pf->pdev->dev, | 3463 | dev_info(&pf->pdev->dev, |
3462 | "couldn't get pf vsi bw config, err %d, aq_err %d\n", | 3464 | "couldn't get pf vsi bw config, err %d, aq_err %d\n", |
3463 | ret, pf->hw.aq.asq_last_status); | 3465 | aq_ret, pf->hw.aq.asq_last_status); |
3464 | return ret; | 3466 | return -EINVAL; |
3465 | } | 3467 | } |
3466 | 3468 | ||
3467 | /* Get the VSI level BW configuration per TC */ | 3469 | /* Get the VSI level BW configuration per TC */ |
3468 | ret = i40e_aq_query_vsi_ets_sla_config(hw, vsi->seid, | 3470 | aq_ret = i40e_aq_query_vsi_ets_sla_config(hw, vsi->seid, &bw_ets_config, |
3469 | &bw_ets_config, | 3471 | NULL); |
3470 | NULL); | 3472 | if (aq_ret) { |
3471 | if (ret) { | ||
3472 | dev_info(&pf->pdev->dev, | 3473 | dev_info(&pf->pdev->dev, |
3473 | "couldn't get pf vsi ets bw config, err %d, aq_err %d\n", | 3474 | "couldn't get pf vsi ets bw config, err %d, aq_err %d\n", |
3474 | ret, pf->hw.aq.asq_last_status); | 3475 | aq_ret, pf->hw.aq.asq_last_status); |
3475 | return ret; | 3476 | return -EINVAL; |
3476 | } | 3477 | } |
3477 | 3478 | ||
3478 | if (bw_config.tc_valid_bits != bw_ets_config.tc_valid_bits) { | 3479 | if (bw_config.tc_valid_bits != bw_ets_config.tc_valid_bits) { |
@@ -3494,7 +3495,8 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi) | |||
3494 | /* 3 bits out of 4 for each TC */ | 3495 | /* 3 bits out of 4 for each TC */ |
3495 | vsi->bw_ets_max_quanta[i] = (u8)((tc_bw_max >> (i*4)) & 0x7); | 3496 | vsi->bw_ets_max_quanta[i] = (u8)((tc_bw_max >> (i*4)) & 0x7); |
3496 | } | 3497 | } |
3497 | return ret; | 3498 | |
3499 | return 0; | ||
3498 | } | 3500 | } |
3499 | 3501 | ||
3500 | /** | 3502 | /** |
@@ -3505,30 +3507,30 @@ static int i40e_vsi_get_bw_info(struct i40e_vsi *vsi) | |||
3505 | * | 3507 | * |
3506 | * Returns 0 on success, negative value on failure | 3508 | * Returns 0 on success, negative value on failure |
3507 | **/ | 3509 | **/ |
3508 | static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, | 3510 | static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, |
3509 | u8 enabled_tc, | ||
3510 | u8 *bw_share) | 3511 | u8 *bw_share) |
3511 | { | 3512 | { |
3512 | struct i40e_aqc_configure_vsi_tc_bw_data bw_data; | 3513 | struct i40e_aqc_configure_vsi_tc_bw_data bw_data; |
3513 | int i, ret = 0; | 3514 | i40e_status aq_ret; |
3515 | int i; | ||
3514 | 3516 | ||
3515 | bw_data.tc_valid_bits = enabled_tc; | 3517 | bw_data.tc_valid_bits = enabled_tc; |
3516 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) | 3518 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) |
3517 | bw_data.tc_bw_credits[i] = bw_share[i]; | 3519 | bw_data.tc_bw_credits[i] = bw_share[i]; |
3518 | 3520 | ||
3519 | ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, | 3521 | aq_ret = i40e_aq_config_vsi_tc_bw(&vsi->back->hw, vsi->seid, &bw_data, |
3520 | &bw_data, NULL); | 3522 | NULL); |
3521 | if (ret) { | 3523 | if (aq_ret) { |
3522 | dev_info(&vsi->back->pdev->dev, | 3524 | dev_info(&vsi->back->pdev->dev, |
3523 | "%s: AQ command Config VSI BW allocation per TC failed = %d\n", | 3525 | "%s: AQ command Config VSI BW allocation per TC failed = %d\n", |
3524 | __func__, vsi->back->hw.aq.asq_last_status); | 3526 | __func__, vsi->back->hw.aq.asq_last_status); |
3525 | return ret; | 3527 | return -EINVAL; |
3526 | } | 3528 | } |
3527 | 3529 | ||
3528 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) | 3530 | for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) |
3529 | vsi->info.qs_handle[i] = bw_data.qs_handles[i]; | 3531 | vsi->info.qs_handle[i] = bw_data.qs_handles[i]; |
3530 | 3532 | ||
3531 | return ret; | 3533 | return 0; |
3532 | } | 3534 | } |
3533 | 3535 | ||
3534 | /** | 3536 | /** |
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index 48cbc833b051..86d51429a189 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -1607,6 +1607,9 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) | |||
1607 | igb_write_phy_reg(hw, I347AT4_PAGE_SELECT, 0); | 1607 | igb_write_phy_reg(hw, I347AT4_PAGE_SELECT, 0); |
1608 | igb_write_phy_reg(hw, PHY_CONTROL, 0x4140); | 1608 | igb_write_phy_reg(hw, PHY_CONTROL, 0x4140); |
1609 | } | 1609 | } |
1610 | } else if (hw->phy.type == e1000_phy_82580) { | ||
1611 | /* enable MII loopback */ | ||
1612 | igb_write_phy_reg(hw, I82580_PHY_LBK_CTRL, 0x8041); | ||
1610 | } | 1613 | } |
1611 | 1614 | ||
1612 | /* add small delay to avoid loopback test failure */ | 1615 | /* add small delay to avoid loopback test failure */ |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 1a9c4f6269ea..ecc7f7b696b8 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
@@ -3086,13 +3086,16 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
3086 | PCI_DMA_FROMDEVICE); | 3086 | PCI_DMA_FROMDEVICE); |
3087 | skge_rx_reuse(e, skge->rx_buf_size); | 3087 | skge_rx_reuse(e, skge->rx_buf_size); |
3088 | } else { | 3088 | } else { |
3089 | struct skge_element ee; | ||
3089 | struct sk_buff *nskb; | 3090 | struct sk_buff *nskb; |
3090 | 3091 | ||
3091 | nskb = netdev_alloc_skb_ip_align(dev, skge->rx_buf_size); | 3092 | nskb = netdev_alloc_skb_ip_align(dev, skge->rx_buf_size); |
3092 | if (!nskb) | 3093 | if (!nskb) |
3093 | goto resubmit; | 3094 | goto resubmit; |
3094 | 3095 | ||
3095 | skb = e->skb; | 3096 | ee = *e; |
3097 | |||
3098 | skb = ee.skb; | ||
3096 | prefetch(skb->data); | 3099 | prefetch(skb->data); |
3097 | 3100 | ||
3098 | if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { | 3101 | if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { |
@@ -3101,8 +3104,8 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
3101 | } | 3104 | } |
3102 | 3105 | ||
3103 | pci_unmap_single(skge->hw->pdev, | 3106 | pci_unmap_single(skge->hw->pdev, |
3104 | dma_unmap_addr(e, mapaddr), | 3107 | dma_unmap_addr(&ee, mapaddr), |
3105 | dma_unmap_len(e, maplen), | 3108 | dma_unmap_len(&ee, maplen), |
3106 | PCI_DMA_FROMDEVICE); | 3109 | PCI_DMA_FROMDEVICE); |
3107 | } | 3110 | } |
3108 | 3111 | ||
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index 83c2091c9c23..bd1a2d2bc2ae 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c | |||
@@ -543,7 +543,7 @@ static const struct of_device_id moxart_mac_match[] = { | |||
543 | { } | 543 | { } |
544 | }; | 544 | }; |
545 | 545 | ||
546 | struct __initdata platform_driver moxart_mac_driver = { | 546 | static struct platform_driver moxart_mac_driver = { |
547 | .probe = moxart_mac_probe, | 547 | .probe = moxart_mac_probe, |
548 | .remove = moxart_remove, | 548 | .remove = moxart_remove, |
549 | .driver = { | 549 | .driver = { |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 4d7ad0074d1c..ebe4c86e5230 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -1794,3 +1794,11 @@ const struct ethtool_ops qlcnic_sriov_vf_ethtool_ops = { | |||
1794 | .set_msglevel = qlcnic_set_msglevel, | 1794 | .set_msglevel = qlcnic_set_msglevel, |
1795 | .get_msglevel = qlcnic_get_msglevel, | 1795 | .get_msglevel = qlcnic_get_msglevel, |
1796 | }; | 1796 | }; |
1797 | |||
1798 | const struct ethtool_ops qlcnic_ethtool_failed_ops = { | ||
1799 | .get_settings = qlcnic_get_settings, | ||
1800 | .get_drvinfo = qlcnic_get_drvinfo, | ||
1801 | .set_msglevel = qlcnic_set_msglevel, | ||
1802 | .get_msglevel = qlcnic_get_msglevel, | ||
1803 | .set_dump = qlcnic_set_dump, | ||
1804 | }; | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index c4c5023e1fdf..21d00a0449a1 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -431,6 +431,9 @@ static void qlcnic_82xx_cancel_idc_work(struct qlcnic_adapter *adapter) | |||
431 | while (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) | 431 | while (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) |
432 | usleep_range(10000, 11000); | 432 | usleep_range(10000, 11000); |
433 | 433 | ||
434 | if (!adapter->fw_work.work.func) | ||
435 | return; | ||
436 | |||
434 | cancel_delayed_work_sync(&adapter->fw_work); | 437 | cancel_delayed_work_sync(&adapter->fw_work); |
435 | } | 438 | } |
436 | 439 | ||
@@ -2275,8 +2278,9 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2275 | adapter->portnum = adapter->ahw->pci_func; | 2278 | adapter->portnum = adapter->ahw->pci_func; |
2276 | err = qlcnic_start_firmware(adapter); | 2279 | err = qlcnic_start_firmware(adapter); |
2277 | if (err) { | 2280 | if (err) { |
2278 | dev_err(&pdev->dev, "Loading fw failed.Please Reboot\n"); | 2281 | dev_err(&pdev->dev, "Loading fw failed.Please Reboot\n" |
2279 | goto err_out_free_hw; | 2282 | "\t\tIf reboot doesn't help, try flashing the card\n"); |
2283 | goto err_out_maintenance_mode; | ||
2280 | } | 2284 | } |
2281 | 2285 | ||
2282 | qlcnic_get_multiq_capability(adapter); | 2286 | qlcnic_get_multiq_capability(adapter); |
@@ -2408,6 +2412,22 @@ err_out_disable_pdev: | |||
2408 | pci_set_drvdata(pdev, NULL); | 2412 | pci_set_drvdata(pdev, NULL); |
2409 | pci_disable_device(pdev); | 2413 | pci_disable_device(pdev); |
2410 | return err; | 2414 | return err; |
2415 | |||
2416 | err_out_maintenance_mode: | ||
2417 | netdev->netdev_ops = &qlcnic_netdev_failed_ops; | ||
2418 | SET_ETHTOOL_OPS(netdev, &qlcnic_ethtool_failed_ops); | ||
2419 | err = register_netdev(netdev); | ||
2420 | |||
2421 | if (err) { | ||
2422 | dev_err(&pdev->dev, "Failed to register net device\n"); | ||
2423 | qlcnic_clr_all_drv_state(adapter, 0); | ||
2424 | goto err_out_free_hw; | ||
2425 | } | ||
2426 | |||
2427 | pci_set_drvdata(pdev, adapter); | ||
2428 | qlcnic_add_sysfs(adapter); | ||
2429 | |||
2430 | return 0; | ||
2411 | } | 2431 | } |
2412 | 2432 | ||
2413 | static void qlcnic_remove(struct pci_dev *pdev) | 2433 | static void qlcnic_remove(struct pci_dev *pdev) |
@@ -2518,8 +2538,16 @@ static int qlcnic_resume(struct pci_dev *pdev) | |||
2518 | static int qlcnic_open(struct net_device *netdev) | 2538 | static int qlcnic_open(struct net_device *netdev) |
2519 | { | 2539 | { |
2520 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 2540 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
2541 | u32 state; | ||
2521 | int err; | 2542 | int err; |
2522 | 2543 | ||
2544 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); | ||
2545 | if (state == QLCNIC_DEV_FAILED || state == QLCNIC_DEV_BADBAD) { | ||
2546 | netdev_err(netdev, "%s: Device is in FAILED state\n", __func__); | ||
2547 | |||
2548 | return -EIO; | ||
2549 | } | ||
2550 | |||
2523 | netif_carrier_off(netdev); | 2551 | netif_carrier_off(netdev); |
2524 | 2552 | ||
2525 | err = qlcnic_attach(adapter); | 2553 | err = qlcnic_attach(adapter); |
@@ -3228,6 +3256,13 @@ void qlcnic_82xx_dev_request_reset(struct qlcnic_adapter *adapter, u32 key) | |||
3228 | return; | 3256 | return; |
3229 | 3257 | ||
3230 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); | 3258 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); |
3259 | if (state == QLCNIC_DEV_FAILED || state == QLCNIC_DEV_BADBAD) { | ||
3260 | netdev_err(adapter->netdev, "%s: Device is in FAILED state\n", | ||
3261 | __func__); | ||
3262 | qlcnic_api_unlock(adapter); | ||
3263 | |||
3264 | return; | ||
3265 | } | ||
3231 | 3266 | ||
3232 | if (state == QLCNIC_DEV_READY) { | 3267 | if (state == QLCNIC_DEV_READY) { |
3233 | QLC_SHARED_REG_WR32(adapter, QLCNIC_CRB_DEV_STATE, | 3268 | QLC_SHARED_REG_WR32(adapter, QLCNIC_CRB_DEV_STATE, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index 330d9a8774ad..686f460b1502 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -397,6 +397,7 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter) | |||
397 | { | 397 | { |
398 | struct net_device *netdev = adapter->netdev; | 398 | struct net_device *netdev = adapter->netdev; |
399 | 399 | ||
400 | rtnl_lock(); | ||
400 | if (netif_running(netdev)) | 401 | if (netif_running(netdev)) |
401 | __qlcnic_down(adapter, netdev); | 402 | __qlcnic_down(adapter, netdev); |
402 | 403 | ||
@@ -407,12 +408,15 @@ static int qlcnic_pci_sriov_disable(struct qlcnic_adapter *adapter) | |||
407 | /* After disabling SRIOV re-init the driver in default mode | 408 | /* After disabling SRIOV re-init the driver in default mode |
408 | configure opmode based on op_mode of function | 409 | configure opmode based on op_mode of function |
409 | */ | 410 | */ |
410 | if (qlcnic_83xx_configure_opmode(adapter)) | 411 | if (qlcnic_83xx_configure_opmode(adapter)) { |
412 | rtnl_unlock(); | ||
411 | return -EIO; | 413 | return -EIO; |
414 | } | ||
412 | 415 | ||
413 | if (netif_running(netdev)) | 416 | if (netif_running(netdev)) |
414 | __qlcnic_up(adapter, netdev); | 417 | __qlcnic_up(adapter, netdev); |
415 | 418 | ||
419 | rtnl_unlock(); | ||
416 | return 0; | 420 | return 0; |
417 | } | 421 | } |
418 | 422 | ||
@@ -533,6 +537,7 @@ static int qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, int num_vfs) | |||
533 | return -EIO; | 537 | return -EIO; |
534 | } | 538 | } |
535 | 539 | ||
540 | rtnl_lock(); | ||
536 | if (netif_running(netdev)) | 541 | if (netif_running(netdev)) |
537 | __qlcnic_down(adapter, netdev); | 542 | __qlcnic_down(adapter, netdev); |
538 | 543 | ||
@@ -555,6 +560,7 @@ static int qlcnic_pci_sriov_enable(struct qlcnic_adapter *adapter, int num_vfs) | |||
555 | __qlcnic_up(adapter, netdev); | 560 | __qlcnic_up(adapter, netdev); |
556 | 561 | ||
557 | error: | 562 | error: |
563 | rtnl_unlock(); | ||
558 | return err; | 564 | return err; |
559 | } | 565 | } |
560 | 566 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index c6165d05cc13..019f4377307f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -1272,6 +1272,7 @@ void qlcnic_remove_sysfs_entries(struct qlcnic_adapter *adapter) | |||
1272 | void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter) | 1272 | void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter) |
1273 | { | 1273 | { |
1274 | struct device *dev = &adapter->pdev->dev; | 1274 | struct device *dev = &adapter->pdev->dev; |
1275 | u32 state; | ||
1275 | 1276 | ||
1276 | if (device_create_bin_file(dev, &bin_attr_port_stats)) | 1277 | if (device_create_bin_file(dev, &bin_attr_port_stats)) |
1277 | dev_info(dev, "failed to create port stats sysfs entry"); | 1278 | dev_info(dev, "failed to create port stats sysfs entry"); |
@@ -1285,8 +1286,13 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter) | |||
1285 | if (device_create_bin_file(dev, &bin_attr_mem)) | 1286 | if (device_create_bin_file(dev, &bin_attr_mem)) |
1286 | dev_info(dev, "failed to create mem sysfs entry\n"); | 1287 | dev_info(dev, "failed to create mem sysfs entry\n"); |
1287 | 1288 | ||
1289 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); | ||
1290 | if (state == QLCNIC_DEV_FAILED || state == QLCNIC_DEV_BADBAD) | ||
1291 | return; | ||
1292 | |||
1288 | if (device_create_bin_file(dev, &bin_attr_pci_config)) | 1293 | if (device_create_bin_file(dev, &bin_attr_pci_config)) |
1289 | dev_info(dev, "failed to create pci config sysfs entry"); | 1294 | dev_info(dev, "failed to create pci config sysfs entry"); |
1295 | |||
1290 | if (device_create_file(dev, &dev_attr_beacon)) | 1296 | if (device_create_file(dev, &dev_attr_beacon)) |
1291 | dev_info(dev, "failed to create beacon sysfs entry"); | 1297 | dev_info(dev, "failed to create beacon sysfs entry"); |
1292 | 1298 | ||
@@ -1307,6 +1313,7 @@ void qlcnic_create_diag_entries(struct qlcnic_adapter *adapter) | |||
1307 | void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter) | 1313 | void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter) |
1308 | { | 1314 | { |
1309 | struct device *dev = &adapter->pdev->dev; | 1315 | struct device *dev = &adapter->pdev->dev; |
1316 | u32 state; | ||
1310 | 1317 | ||
1311 | device_remove_bin_file(dev, &bin_attr_port_stats); | 1318 | device_remove_bin_file(dev, &bin_attr_port_stats); |
1312 | 1319 | ||
@@ -1315,6 +1322,11 @@ void qlcnic_remove_diag_entries(struct qlcnic_adapter *adapter) | |||
1315 | device_remove_file(dev, &dev_attr_diag_mode); | 1322 | device_remove_file(dev, &dev_attr_diag_mode); |
1316 | device_remove_bin_file(dev, &bin_attr_crb); | 1323 | device_remove_bin_file(dev, &bin_attr_crb); |
1317 | device_remove_bin_file(dev, &bin_attr_mem); | 1324 | device_remove_bin_file(dev, &bin_attr_mem); |
1325 | |||
1326 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); | ||
1327 | if (state == QLCNIC_DEV_FAILED || state == QLCNIC_DEV_BADBAD) | ||
1328 | return; | ||
1329 | |||
1318 | device_remove_bin_file(dev, &bin_attr_pci_config); | 1330 | device_remove_bin_file(dev, &bin_attr_pci_config); |
1319 | device_remove_file(dev, &dev_attr_beacon); | 1331 | device_remove_file(dev, &dev_attr_beacon); |
1320 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) | 1332 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c index 10093f0c4c0f..6bc5db703920 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_dbg.c | |||
@@ -740,8 +740,8 @@ int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump) | |||
740 | int i; | 740 | int i; |
741 | 741 | ||
742 | if (!mpi_coredump) { | 742 | if (!mpi_coredump) { |
743 | netif_err(qdev, drv, qdev->ndev, "No memory available\n"); | 743 | netif_err(qdev, drv, qdev->ndev, "No memory allocated\n"); |
744 | return -ENOMEM; | 744 | return -EINVAL; |
745 | } | 745 | } |
746 | 746 | ||
747 | /* Try to get the spinlock, but dont worry if | 747 | /* Try to get the spinlock, but dont worry if |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c b/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c index ff2bf8a4e247..7ad146080c36 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_mpi.c | |||
@@ -1274,7 +1274,7 @@ void ql_mpi_reset_work(struct work_struct *work) | |||
1274 | return; | 1274 | return; |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | if (!ql_core_dump(qdev, qdev->mpi_coredump)) { | 1277 | if (qdev->mpi_coredump && !ql_core_dump(qdev, qdev->mpi_coredump)) { |
1278 | netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n"); | 1278 | netif_err(qdev, drv, qdev->ndev, "Core is dumped!\n"); |
1279 | qdev->core_is_dumped = 1; | 1279 | qdev->core_is_dumped = 1; |
1280 | queue_delayed_work(qdev->workqueue, | 1280 | queue_delayed_work(qdev->workqueue, |
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index 128d7cdf9eb2..c082562dbf4e 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c | |||
@@ -27,10 +27,10 @@ | |||
27 | 27 | ||
28 | /* A reboot/assertion causes the MCDI status word to be set after the | 28 | /* A reboot/assertion causes the MCDI status word to be set after the |
29 | * command word is set or a REBOOT event is sent. If we notice a reboot | 29 | * command word is set or a REBOOT event is sent. If we notice a reboot |
30 | * via these mechanisms then wait 20ms for the status word to be set. | 30 | * via these mechanisms then wait 250ms for the status word to be set. |
31 | */ | 31 | */ |
32 | #define MCDI_STATUS_DELAY_US 100 | 32 | #define MCDI_STATUS_DELAY_US 100 |
33 | #define MCDI_STATUS_DELAY_COUNT 200 | 33 | #define MCDI_STATUS_DELAY_COUNT 2500 |
34 | #define MCDI_STATUS_SLEEP_MS \ | 34 | #define MCDI_STATUS_SLEEP_MS \ |
35 | (MCDI_STATUS_DELAY_US * MCDI_STATUS_DELAY_COUNT / 1000) | 35 | (MCDI_STATUS_DELAY_US * MCDI_STATUS_DELAY_COUNT / 1000) |
36 | 36 | ||
@@ -800,9 +800,6 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc) | |||
800 | } else { | 800 | } else { |
801 | int count; | 801 | int count; |
802 | 802 | ||
803 | /* Nobody was waiting for an MCDI request, so trigger a reset */ | ||
804 | efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); | ||
805 | |||
806 | /* Consume the status word since efx_mcdi_rpc_finish() won't */ | 803 | /* Consume the status word since efx_mcdi_rpc_finish() won't */ |
807 | for (count = 0; count < MCDI_STATUS_DELAY_COUNT; ++count) { | 804 | for (count = 0; count < MCDI_STATUS_DELAY_COUNT; ++count) { |
808 | if (efx_mcdi_poll_reboot(efx)) | 805 | if (efx_mcdi_poll_reboot(efx)) |
@@ -810,6 +807,9 @@ static void efx_mcdi_ev_death(struct efx_nic *efx, int rc) | |||
810 | udelay(MCDI_STATUS_DELAY_US); | 807 | udelay(MCDI_STATUS_DELAY_US); |
811 | } | 808 | } |
812 | mcdi->new_epoch = true; | 809 | mcdi->new_epoch = true; |
810 | |||
811 | /* Nobody was waiting for an MCDI request, so trigger a reset */ | ||
812 | efx_schedule_reset(efx, RESET_TYPE_MC_FAILURE); | ||
813 | } | 813 | } |
814 | 814 | ||
815 | spin_unlock(&mcdi->iface_lock); | 815 | spin_unlock(&mcdi->iface_lock); |
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index c8f088ab5fdf..bdf697b184ae 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 32 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
33 | 33 | ||
34 | #define DRV_NAME "via-rhine" | 34 | #define DRV_NAME "via-rhine" |
35 | #define DRV_VERSION "1.5.0" | 35 | #define DRV_VERSION "1.5.1" |
36 | #define DRV_RELDATE "2010-10-09" | 36 | #define DRV_RELDATE "2010-10-09" |
37 | 37 | ||
38 | #include <linux/types.h> | 38 | #include <linux/types.h> |
@@ -1704,7 +1704,12 @@ static netdev_tx_t rhine_start_tx(struct sk_buff *skb, | |||
1704 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); | 1704 | cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); |
1705 | 1705 | ||
1706 | if (unlikely(vlan_tx_tag_present(skb))) { | 1706 | if (unlikely(vlan_tx_tag_present(skb))) { |
1707 | rp->tx_ring[entry].tx_status = cpu_to_le32((vlan_tx_tag_get(skb)) << 16); | 1707 | u16 vid_pcp = vlan_tx_tag_get(skb); |
1708 | |||
1709 | /* drop CFI/DEI bit, register needs VID and PCP */ | ||
1710 | vid_pcp = (vid_pcp & VLAN_VID_MASK) | | ||
1711 | ((vid_pcp & VLAN_PRIO_MASK) >> 1); | ||
1712 | rp->tx_ring[entry].tx_status = cpu_to_le32((vid_pcp) << 16); | ||
1708 | /* request tagging */ | 1713 | /* request tagging */ |
1709 | rp->tx_ring[entry].desc_length |= cpu_to_le32(0x020000); | 1714 | rp->tx_ring[entry].desc_length |= cpu_to_le32(0x020000); |
1710 | } | 1715 | } |
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 22478d54f5bb..1f2364126323 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c | |||
@@ -298,6 +298,12 @@ static int temac_dma_bd_init(struct net_device *ndev) | |||
298 | lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * (RX_BD_NUM - 1))); | 298 | lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * (RX_BD_NUM - 1))); |
299 | lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p); | 299 | lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p); |
300 | 300 | ||
301 | /* Init descriptor indexes */ | ||
302 | lp->tx_bd_ci = 0; | ||
303 | lp->tx_bd_next = 0; | ||
304 | lp->tx_bd_tail = 0; | ||
305 | lp->rx_bd_ci = 0; | ||
306 | |||
301 | return 0; | 307 | return 0; |
302 | 308 | ||
303 | out: | 309 | out: |
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index a34d6bf5e43b..cc70ecfc7062 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c | |||
@@ -429,11 +429,13 @@ static void slip_write_wakeup(struct tty_struct *tty) | |||
429 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) | 429 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) |
430 | return; | 430 | return; |
431 | 431 | ||
432 | spin_lock(&sl->lock); | ||
432 | if (sl->xleft <= 0) { | 433 | if (sl->xleft <= 0) { |
433 | /* Now serial buffer is almost free & we can start | 434 | /* Now serial buffer is almost free & we can start |
434 | * transmission of another packet */ | 435 | * transmission of another packet */ |
435 | sl->dev->stats.tx_packets++; | 436 | sl->dev->stats.tx_packets++; |
436 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 437 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
438 | spin_unlock(&sl->lock); | ||
437 | sl_unlock(sl); | 439 | sl_unlock(sl); |
438 | return; | 440 | return; |
439 | } | 441 | } |
@@ -441,6 +443,7 @@ static void slip_write_wakeup(struct tty_struct *tty) | |||
441 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 443 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); |
442 | sl->xleft -= actual; | 444 | sl->xleft -= actual; |
443 | sl->xhead += actual; | 445 | sl->xhead += actual; |
446 | spin_unlock(&sl->lock); | ||
444 | } | 447 | } |
445 | 448 | ||
446 | static void sl_tx_timeout(struct net_device *dev) | 449 | static void sl_tx_timeout(struct net_device *dev) |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 2dbb9460349d..c6867f926cff 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -303,7 +303,7 @@ static void dm9601_set_multicast(struct net_device *net) | |||
303 | rx_ctl |= 0x02; | 303 | rx_ctl |= 0x02; |
304 | } else if (net->flags & IFF_ALLMULTI || | 304 | } else if (net->flags & IFF_ALLMULTI || |
305 | netdev_mc_count(net) > DM_MAX_MCAST) { | 305 | netdev_mc_count(net) > DM_MAX_MCAST) { |
306 | rx_ctl |= 0x04; | 306 | rx_ctl |= 0x08; |
307 | } else if (!netdev_mc_empty(net)) { | 307 | } else if (!netdev_mc_empty(net)) { |
308 | struct netdev_hw_addr *ha; | 308 | struct netdev_hw_addr *ha; |
309 | 309 | ||
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 6312332afeba..3d6aaf79d8b2 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -714,7 +714,7 @@ static const struct usb_device_id products[] = { | |||
714 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 714 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
715 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ | 715 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ |
716 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 716 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
717 | {QMI_FIXED_INTF(0x1e2d, 0x12d1, 4)}, /* Cinterion PLxx */ | 717 | {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */ |
718 | 718 | ||
719 | /* 4. Gobi 1000 devices */ | 719 | /* 4. Gobi 1000 devices */ |
720 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 720 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 7b331e613e02..bf94e10a37c8 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1241,7 +1241,9 @@ static int build_dma_sg(const struct sk_buff *skb, struct urb *urb) | |||
1241 | if (num_sgs == 1) | 1241 | if (num_sgs == 1) |
1242 | return 0; | 1242 | return 0; |
1243 | 1243 | ||
1244 | urb->sg = kmalloc(num_sgs * sizeof(struct scatterlist), GFP_ATOMIC); | 1244 | /* reserve one for zero packet */ |
1245 | urb->sg = kmalloc((num_sgs + 1) * sizeof(struct scatterlist), | ||
1246 | GFP_ATOMIC); | ||
1245 | if (!urb->sg) | 1247 | if (!urb->sg) |
1246 | return -ENOMEM; | 1248 | return -ENOMEM; |
1247 | 1249 | ||
@@ -1305,7 +1307,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
1305 | if (build_dma_sg(skb, urb) < 0) | 1307 | if (build_dma_sg(skb, urb) < 0) |
1306 | goto drop; | 1308 | goto drop; |
1307 | } | 1309 | } |
1308 | entry->length = length = urb->transfer_buffer_length; | 1310 | length = urb->transfer_buffer_length; |
1309 | 1311 | ||
1310 | /* don't assume the hardware handles USB_ZERO_PACKET | 1312 | /* don't assume the hardware handles USB_ZERO_PACKET |
1311 | * NOTE: strictly conforming cdc-ether devices should expect | 1313 | * NOTE: strictly conforming cdc-ether devices should expect |
@@ -1317,15 +1319,18 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | |||
1317 | if (length % dev->maxpacket == 0) { | 1319 | if (length % dev->maxpacket == 0) { |
1318 | if (!(info->flags & FLAG_SEND_ZLP)) { | 1320 | if (!(info->flags & FLAG_SEND_ZLP)) { |
1319 | if (!(info->flags & FLAG_MULTI_PACKET)) { | 1321 | if (!(info->flags & FLAG_MULTI_PACKET)) { |
1320 | urb->transfer_buffer_length++; | 1322 | length++; |
1321 | if (skb_tailroom(skb)) { | 1323 | if (skb_tailroom(skb) && !urb->num_sgs) { |
1322 | skb->data[skb->len] = 0; | 1324 | skb->data[skb->len] = 0; |
1323 | __skb_put(skb, 1); | 1325 | __skb_put(skb, 1); |
1324 | } | 1326 | } else if (urb->num_sgs) |
1327 | sg_set_buf(&urb->sg[urb->num_sgs++], | ||
1328 | dev->padding_pkt, 1); | ||
1325 | } | 1329 | } |
1326 | } else | 1330 | } else |
1327 | urb->transfer_flags |= URB_ZERO_PACKET; | 1331 | urb->transfer_flags |= URB_ZERO_PACKET; |
1328 | } | 1332 | } |
1333 | entry->length = urb->transfer_buffer_length = length; | ||
1329 | 1334 | ||
1330 | spin_lock_irqsave(&dev->txq.lock, flags); | 1335 | spin_lock_irqsave(&dev->txq.lock, flags); |
1331 | retval = usb_autopm_get_interface_async(dev->intf); | 1336 | retval = usb_autopm_get_interface_async(dev->intf); |
@@ -1509,6 +1514,7 @@ void usbnet_disconnect (struct usb_interface *intf) | |||
1509 | 1514 | ||
1510 | usb_kill_urb(dev->interrupt); | 1515 | usb_kill_urb(dev->interrupt); |
1511 | usb_free_urb(dev->interrupt); | 1516 | usb_free_urb(dev->interrupt); |
1517 | kfree(dev->padding_pkt); | ||
1512 | 1518 | ||
1513 | free_netdev(net); | 1519 | free_netdev(net); |
1514 | } | 1520 | } |
@@ -1679,9 +1685,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1679 | /* initialize max rx_qlen and tx_qlen */ | 1685 | /* initialize max rx_qlen and tx_qlen */ |
1680 | usbnet_update_max_qlen(dev); | 1686 | usbnet_update_max_qlen(dev); |
1681 | 1687 | ||
1688 | if (dev->can_dma_sg && !(info->flags & FLAG_SEND_ZLP) && | ||
1689 | !(info->flags & FLAG_MULTI_PACKET)) { | ||
1690 | dev->padding_pkt = kzalloc(1, GFP_KERNEL); | ||
1691 | if (!dev->padding_pkt) | ||
1692 | goto out4; | ||
1693 | } | ||
1694 | |||
1682 | status = register_netdev (net); | 1695 | status = register_netdev (net); |
1683 | if (status) | 1696 | if (status) |
1684 | goto out4; | 1697 | goto out5; |
1685 | netif_info(dev, probe, dev->net, | 1698 | netif_info(dev, probe, dev->net, |
1686 | "register '%s' at usb-%s-%s, %s, %pM\n", | 1699 | "register '%s' at usb-%s-%s, %s, %pM\n", |
1687 | udev->dev.driver->name, | 1700 | udev->dev.driver->name, |
@@ -1699,6 +1712,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1699 | 1712 | ||
1700 | return 0; | 1713 | return 0; |
1701 | 1714 | ||
1715 | out5: | ||
1716 | kfree(dev->padding_pkt); | ||
1702 | out4: | 1717 | out4: |
1703 | usb_free_urb(dev->interrupt); | 1718 | usb_free_urb(dev->interrupt); |
1704 | out3: | 1719 | out3: |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index d1292fe746bc..2ef5b6219f3f 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -952,8 +952,7 @@ void vxlan_sock_release(struct vxlan_sock *vs) | |||
952 | 952 | ||
953 | spin_lock(&vn->sock_lock); | 953 | spin_lock(&vn->sock_lock); |
954 | hlist_del_rcu(&vs->hlist); | 954 | hlist_del_rcu(&vs->hlist); |
955 | smp_wmb(); | 955 | rcu_assign_sk_user_data(vs->sock->sk, NULL); |
956 | vs->sock->sk->sk_user_data = NULL; | ||
957 | vxlan_notify_del_rx_port(sk); | 956 | vxlan_notify_del_rx_port(sk); |
958 | spin_unlock(&vn->sock_lock); | 957 | spin_unlock(&vn->sock_lock); |
959 | 958 | ||
@@ -1048,8 +1047,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) | |||
1048 | 1047 | ||
1049 | port = inet_sk(sk)->inet_sport; | 1048 | port = inet_sk(sk)->inet_sport; |
1050 | 1049 | ||
1051 | smp_read_barrier_depends(); | 1050 | vs = rcu_dereference_sk_user_data(sk); |
1052 | vs = (struct vxlan_sock *)sk->sk_user_data; | ||
1053 | if (!vs) | 1051 | if (!vs) |
1054 | goto drop; | 1052 | goto drop; |
1055 | 1053 | ||
@@ -2302,8 +2300,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port, | |||
2302 | atomic_set(&vs->refcnt, 1); | 2300 | atomic_set(&vs->refcnt, 1); |
2303 | vs->rcv = rcv; | 2301 | vs->rcv = rcv; |
2304 | vs->data = data; | 2302 | vs->data = data; |
2305 | smp_wmb(); | 2303 | rcu_assign_sk_user_data(vs->sock->sk, vs); |
2306 | vs->sock->sk->sk_user_data = vs; | ||
2307 | 2304 | ||
2308 | spin_lock(&vn->sock_lock); | 2305 | spin_lock(&vn->sock_lock); |
2309 | hlist_add_head_rcu(&vs->hlist, vs_head(net, port)); | 2306 | hlist_add_head_rcu(&vs->hlist, vs_head(net, port)); |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 4ee472a5a4e4..ab9e3a8410bc 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -1270,13 +1270,6 @@ static void ath9k_antenna_check(struct ath_softc *sc, | |||
1270 | return; | 1270 | return; |
1271 | 1271 | ||
1272 | /* | 1272 | /* |
1273 | * All MPDUs in an aggregate will use the same LNA | ||
1274 | * as the first MPDU. | ||
1275 | */ | ||
1276 | if (rs->rs_isaggr && !rs->rs_firstaggr) | ||
1277 | return; | ||
1278 | |||
1279 | /* | ||
1280 | * Change the default rx antenna if rx diversity | 1273 | * Change the default rx antenna if rx diversity |
1281 | * chooses the other antenna 3 times in a row. | 1274 | * chooses the other antenna 3 times in a row. |
1282 | */ | 1275 | */ |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 35b515fe3ffa..5ac713d2ff5d 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -399,6 +399,7 @@ static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf) | |||
399 | tbf->bf_buf_addr = bf->bf_buf_addr; | 399 | tbf->bf_buf_addr = bf->bf_buf_addr; |
400 | memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len); | 400 | memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len); |
401 | tbf->bf_state = bf->bf_state; | 401 | tbf->bf_state = bf->bf_state; |
402 | tbf->bf_state.stale = false; | ||
402 | 403 | ||
403 | return tbf; | 404 | return tbf; |
404 | } | 405 | } |
@@ -1389,11 +1390,15 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1389 | u16 tid, u16 *ssn) | 1390 | u16 tid, u16 *ssn) |
1390 | { | 1391 | { |
1391 | struct ath_atx_tid *txtid; | 1392 | struct ath_atx_tid *txtid; |
1393 | struct ath_txq *txq; | ||
1392 | struct ath_node *an; | 1394 | struct ath_node *an; |
1393 | u8 density; | 1395 | u8 density; |
1394 | 1396 | ||
1395 | an = (struct ath_node *)sta->drv_priv; | 1397 | an = (struct ath_node *)sta->drv_priv; |
1396 | txtid = ATH_AN_2_TID(an, tid); | 1398 | txtid = ATH_AN_2_TID(an, tid); |
1399 | txq = txtid->ac->txq; | ||
1400 | |||
1401 | ath_txq_lock(sc, txq); | ||
1397 | 1402 | ||
1398 | /* update ampdu factor/density, they may have changed. This may happen | 1403 | /* update ampdu factor/density, they may have changed. This may happen |
1399 | * in HT IBSS when a beacon with HT-info is received after the station | 1404 | * in HT IBSS when a beacon with HT-info is received after the station |
@@ -1417,6 +1422,8 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
1417 | memset(txtid->tx_buf, 0, sizeof(txtid->tx_buf)); | 1422 | memset(txtid->tx_buf, 0, sizeof(txtid->tx_buf)); |
1418 | txtid->baw_head = txtid->baw_tail = 0; | 1423 | txtid->baw_head = txtid->baw_tail = 0; |
1419 | 1424 | ||
1425 | ath_txq_unlock_complete(sc, txq); | ||
1426 | |||
1420 | return 0; | 1427 | return 0; |
1421 | } | 1428 | } |
1422 | 1429 | ||
@@ -1555,8 +1562,10 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw, | |||
1555 | __skb_unlink(bf->bf_mpdu, tid_q); | 1562 | __skb_unlink(bf->bf_mpdu, tid_q); |
1556 | list_add_tail(&bf->list, &bf_q); | 1563 | list_add_tail(&bf->list, &bf_q); |
1557 | ath_set_rates(tid->an->vif, tid->an->sta, bf); | 1564 | ath_set_rates(tid->an->vif, tid->an->sta, bf); |
1558 | ath_tx_addto_baw(sc, tid, bf); | 1565 | if (bf_isampdu(bf)) { |
1559 | bf->bf_state.bf_type &= ~BUF_AGGR; | 1566 | ath_tx_addto_baw(sc, tid, bf); |
1567 | bf->bf_state.bf_type &= ~BUF_AGGR; | ||
1568 | } | ||
1560 | if (bf_tail) | 1569 | if (bf_tail) |
1561 | bf_tail->bf_next = bf; | 1570 | bf_tail->bf_next = bf; |
1562 | 1571 | ||
@@ -1950,7 +1959,9 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, | |||
1950 | if (bf_is_ampdu_not_probing(bf)) | 1959 | if (bf_is_ampdu_not_probing(bf)) |
1951 | txq->axq_ampdu_depth++; | 1960 | txq->axq_ampdu_depth++; |
1952 | 1961 | ||
1953 | bf = bf->bf_lastbf->bf_next; | 1962 | bf_last = bf->bf_lastbf; |
1963 | bf = bf_last->bf_next; | ||
1964 | bf_last->bf_next = NULL; | ||
1954 | } | 1965 | } |
1955 | } | 1966 | } |
1956 | } | 1967 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 64f4a2bc8dde..c3462b75bd08 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -464,8 +464,6 @@ static struct sdio_driver brcmf_sdmmc_driver = { | |||
464 | 464 | ||
465 | static int brcmf_sdio_pd_probe(struct platform_device *pdev) | 465 | static int brcmf_sdio_pd_probe(struct platform_device *pdev) |
466 | { | 466 | { |
467 | int ret; | ||
468 | |||
469 | brcmf_dbg(SDIO, "Enter\n"); | 467 | brcmf_dbg(SDIO, "Enter\n"); |
470 | 468 | ||
471 | brcmfmac_sdio_pdata = pdev->dev.platform_data; | 469 | brcmfmac_sdio_pdata = pdev->dev.platform_data; |
@@ -473,11 +471,7 @@ static int brcmf_sdio_pd_probe(struct platform_device *pdev) | |||
473 | if (brcmfmac_sdio_pdata->power_on) | 471 | if (brcmfmac_sdio_pdata->power_on) |
474 | brcmfmac_sdio_pdata->power_on(); | 472 | brcmfmac_sdio_pdata->power_on(); |
475 | 473 | ||
476 | ret = sdio_register_driver(&brcmf_sdmmc_driver); | 474 | return 0; |
477 | if (ret) | ||
478 | brcmf_err("sdio_register_driver failed: %d\n", ret); | ||
479 | |||
480 | return ret; | ||
481 | } | 475 | } |
482 | 476 | ||
483 | static int brcmf_sdio_pd_remove(struct platform_device *pdev) | 477 | static int brcmf_sdio_pd_remove(struct platform_device *pdev) |
@@ -500,6 +494,15 @@ static struct platform_driver brcmf_sdio_pd = { | |||
500 | } | 494 | } |
501 | }; | 495 | }; |
502 | 496 | ||
497 | void brcmf_sdio_register(void) | ||
498 | { | ||
499 | int ret; | ||
500 | |||
501 | ret = sdio_register_driver(&brcmf_sdmmc_driver); | ||
502 | if (ret) | ||
503 | brcmf_err("sdio_register_driver failed: %d\n", ret); | ||
504 | } | ||
505 | |||
503 | void brcmf_sdio_exit(void) | 506 | void brcmf_sdio_exit(void) |
504 | { | 507 | { |
505 | brcmf_dbg(SDIO, "Enter\n"); | 508 | brcmf_dbg(SDIO, "Enter\n"); |
@@ -510,18 +513,13 @@ void brcmf_sdio_exit(void) | |||
510 | sdio_unregister_driver(&brcmf_sdmmc_driver); | 513 | sdio_unregister_driver(&brcmf_sdmmc_driver); |
511 | } | 514 | } |
512 | 515 | ||
513 | void brcmf_sdio_init(void) | 516 | void __init brcmf_sdio_init(void) |
514 | { | 517 | { |
515 | int ret; | 518 | int ret; |
516 | 519 | ||
517 | brcmf_dbg(SDIO, "Enter\n"); | 520 | brcmf_dbg(SDIO, "Enter\n"); |
518 | 521 | ||
519 | ret = platform_driver_probe(&brcmf_sdio_pd, brcmf_sdio_pd_probe); | 522 | ret = platform_driver_probe(&brcmf_sdio_pd, brcmf_sdio_pd_probe); |
520 | if (ret == -ENODEV) { | 523 | if (ret == -ENODEV) |
521 | brcmf_dbg(SDIO, "No platform data available, registering without.\n"); | 524 | brcmf_dbg(SDIO, "No platform data available.\n"); |
522 | ret = sdio_register_driver(&brcmf_sdmmc_driver); | ||
523 | } | ||
524 | |||
525 | if (ret) | ||
526 | brcmf_err("driver registration failed: %d\n", ret); | ||
527 | } | 525 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h index f7c1985844e4..74156f84180c 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h | |||
@@ -156,10 +156,11 @@ extern int brcmf_bus_start(struct device *dev); | |||
156 | #ifdef CONFIG_BRCMFMAC_SDIO | 156 | #ifdef CONFIG_BRCMFMAC_SDIO |
157 | extern void brcmf_sdio_exit(void); | 157 | extern void brcmf_sdio_exit(void); |
158 | extern void brcmf_sdio_init(void); | 158 | extern void brcmf_sdio_init(void); |
159 | extern void brcmf_sdio_register(void); | ||
159 | #endif | 160 | #endif |
160 | #ifdef CONFIG_BRCMFMAC_USB | 161 | #ifdef CONFIG_BRCMFMAC_USB |
161 | extern void brcmf_usb_exit(void); | 162 | extern void brcmf_usb_exit(void); |
162 | extern void brcmf_usb_init(void); | 163 | extern void brcmf_usb_register(void); |
163 | #endif | 164 | #endif |
164 | 165 | ||
165 | #endif /* _BRCMF_BUS_H_ */ | 166 | #endif /* _BRCMF_BUS_H_ */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index e067aec1fbf1..40e7f854e10f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -1231,21 +1231,23 @@ u32 brcmf_get_chip_info(struct brcmf_if *ifp) | |||
1231 | return bus->chip << 4 | bus->chiprev; | 1231 | return bus->chip << 4 | bus->chiprev; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | static void brcmf_driver_init(struct work_struct *work) | 1234 | static void brcmf_driver_register(struct work_struct *work) |
1235 | { | 1235 | { |
1236 | brcmf_debugfs_init(); | ||
1237 | |||
1238 | #ifdef CONFIG_BRCMFMAC_SDIO | 1236 | #ifdef CONFIG_BRCMFMAC_SDIO |
1239 | brcmf_sdio_init(); | 1237 | brcmf_sdio_register(); |
1240 | #endif | 1238 | #endif |
1241 | #ifdef CONFIG_BRCMFMAC_USB | 1239 | #ifdef CONFIG_BRCMFMAC_USB |
1242 | brcmf_usb_init(); | 1240 | brcmf_usb_register(); |
1243 | #endif | 1241 | #endif |
1244 | } | 1242 | } |
1245 | static DECLARE_WORK(brcmf_driver_work, brcmf_driver_init); | 1243 | static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register); |
1246 | 1244 | ||
1247 | static int __init brcmfmac_module_init(void) | 1245 | static int __init brcmfmac_module_init(void) |
1248 | { | 1246 | { |
1247 | brcmf_debugfs_init(); | ||
1248 | #ifdef CONFIG_BRCMFMAC_SDIO | ||
1249 | brcmf_sdio_init(); | ||
1250 | #endif | ||
1249 | if (!schedule_work(&brcmf_driver_work)) | 1251 | if (!schedule_work(&brcmf_driver_work)) |
1250 | return -EBUSY; | 1252 | return -EBUSY; |
1251 | 1253 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 39e01a7c8556..f4aea47e0730 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
@@ -1539,7 +1539,7 @@ void brcmf_usb_exit(void) | |||
1539 | brcmf_release_fw(&fw_image_list); | 1539 | brcmf_release_fw(&fw_image_list); |
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | void brcmf_usb_init(void) | 1542 | void brcmf_usb_register(void) |
1543 | { | 1543 | { |
1544 | brcmf_dbg(USB, "Enter\n"); | 1544 | brcmf_dbg(USB, "Enter\n"); |
1545 | INIT_LIST_HEAD(&fw_image_list); | 1545 | INIT_LIST_HEAD(&fw_image_list); |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index 3a6544710c8a..edc5d105ff98 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | |||
@@ -457,6 +457,8 @@ static int brcms_ops_start(struct ieee80211_hw *hw) | |||
457 | if (err != 0) | 457 | if (err != 0) |
458 | brcms_err(wl->wlc->hw->d11core, "%s: brcms_up() returned %d\n", | 458 | brcms_err(wl->wlc->hw->d11core, "%s: brcms_up() returned %d\n", |
459 | __func__, err); | 459 | __func__, err); |
460 | |||
461 | bcma_core_pci_power_save(wl->wlc->hw->d11core->bus, true); | ||
460 | return err; | 462 | return err; |
461 | } | 463 | } |
462 | 464 | ||
@@ -479,6 +481,8 @@ static void brcms_ops_stop(struct ieee80211_hw *hw) | |||
479 | return; | 481 | return; |
480 | } | 482 | } |
481 | 483 | ||
484 | bcma_core_pci_power_save(wl->wlc->hw->d11core->bus, false); | ||
485 | |||
482 | /* put driver in down state */ | 486 | /* put driver in down state */ |
483 | spin_lock_bh(&wl->lock); | 487 | spin_lock_bh(&wl->lock); |
484 | brcms_down(wl); | 488 | brcms_down(wl); |
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c index f5e6b489ed32..899cad34ccd3 100644 --- a/drivers/net/wireless/cw1200/cw1200_spi.c +++ b/drivers/net/wireless/cw1200/cw1200_spi.c | |||
@@ -42,7 +42,6 @@ struct hwbus_priv { | |||
42 | spinlock_t lock; /* Serialize all bus operations */ | 42 | spinlock_t lock; /* Serialize all bus operations */ |
43 | wait_queue_head_t wq; | 43 | wait_queue_head_t wq; |
44 | int claimed; | 44 | int claimed; |
45 | int irq_disabled; | ||
46 | }; | 45 | }; |
47 | 46 | ||
48 | #define SDIO_TO_SPI_ADDR(addr) ((addr & 0x1f)>>2) | 47 | #define SDIO_TO_SPI_ADDR(addr) ((addr & 0x1f)>>2) |
@@ -238,8 +237,6 @@ static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id) | |||
238 | struct hwbus_priv *self = dev_id; | 237 | struct hwbus_priv *self = dev_id; |
239 | 238 | ||
240 | if (self->core) { | 239 | if (self->core) { |
241 | disable_irq_nosync(self->func->irq); | ||
242 | self->irq_disabled = 1; | ||
243 | cw1200_irq_handler(self->core); | 240 | cw1200_irq_handler(self->core); |
244 | return IRQ_HANDLED; | 241 | return IRQ_HANDLED; |
245 | } else { | 242 | } else { |
@@ -253,9 +250,10 @@ static int cw1200_spi_irq_subscribe(struct hwbus_priv *self) | |||
253 | 250 | ||
254 | pr_debug("SW IRQ subscribe\n"); | 251 | pr_debug("SW IRQ subscribe\n"); |
255 | 252 | ||
256 | ret = request_any_context_irq(self->func->irq, cw1200_spi_irq_handler, | 253 | ret = request_threaded_irq(self->func->irq, NULL, |
257 | IRQF_TRIGGER_HIGH, | 254 | cw1200_spi_irq_handler, |
258 | "cw1200_wlan_irq", self); | 255 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, |
256 | "cw1200_wlan_irq", self); | ||
259 | if (WARN_ON(ret < 0)) | 257 | if (WARN_ON(ret < 0)) |
260 | goto exit; | 258 | goto exit; |
261 | 259 | ||
@@ -273,22 +271,13 @@ exit: | |||
273 | 271 | ||
274 | static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self) | 272 | static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self) |
275 | { | 273 | { |
274 | int ret = 0; | ||
275 | |||
276 | pr_debug("SW IRQ unsubscribe\n"); | 276 | pr_debug("SW IRQ unsubscribe\n"); |
277 | disable_irq_wake(self->func->irq); | 277 | disable_irq_wake(self->func->irq); |
278 | free_irq(self->func->irq, self); | 278 | free_irq(self->func->irq, self); |
279 | 279 | ||
280 | return 0; | 280 | return ret; |
281 | } | ||
282 | |||
283 | static int cw1200_spi_irq_enable(struct hwbus_priv *self, int enable) | ||
284 | { | ||
285 | /* Disables are handled by the interrupt handler */ | ||
286 | if (enable && self->irq_disabled) { | ||
287 | enable_irq(self->func->irq); | ||
288 | self->irq_disabled = 0; | ||
289 | } | ||
290 | |||
291 | return 0; | ||
292 | } | 281 | } |
293 | 282 | ||
294 | static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) | 283 | static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) |
@@ -368,7 +357,6 @@ static struct hwbus_ops cw1200_spi_hwbus_ops = { | |||
368 | .unlock = cw1200_spi_unlock, | 357 | .unlock = cw1200_spi_unlock, |
369 | .align_size = cw1200_spi_align_size, | 358 | .align_size = cw1200_spi_align_size, |
370 | .power_mgmt = cw1200_spi_pm, | 359 | .power_mgmt = cw1200_spi_pm, |
371 | .irq_enable = cw1200_spi_irq_enable, | ||
372 | }; | 360 | }; |
373 | 361 | ||
374 | /* Probe Function to be called by SPI stack when device is discovered */ | 362 | /* Probe Function to be called by SPI stack when device is discovered */ |
diff --git a/drivers/net/wireless/cw1200/fwio.c b/drivers/net/wireless/cw1200/fwio.c index 0b2061bbc68b..acdff0f7f952 100644 --- a/drivers/net/wireless/cw1200/fwio.c +++ b/drivers/net/wireless/cw1200/fwio.c | |||
@@ -485,7 +485,7 @@ int cw1200_load_firmware(struct cw1200_common *priv) | |||
485 | 485 | ||
486 | /* Enable interrupt signalling */ | 486 | /* Enable interrupt signalling */ |
487 | priv->hwbus_ops->lock(priv->hwbus_priv); | 487 | priv->hwbus_ops->lock(priv->hwbus_priv); |
488 | ret = __cw1200_irq_enable(priv, 2); | 488 | ret = __cw1200_irq_enable(priv, 1); |
489 | priv->hwbus_ops->unlock(priv->hwbus_priv); | 489 | priv->hwbus_ops->unlock(priv->hwbus_priv); |
490 | if (ret < 0) | 490 | if (ret < 0) |
491 | goto unsubscribe; | 491 | goto unsubscribe; |
diff --git a/drivers/net/wireless/cw1200/hwbus.h b/drivers/net/wireless/cw1200/hwbus.h index 51dfb3a90735..8b2fc831c3de 100644 --- a/drivers/net/wireless/cw1200/hwbus.h +++ b/drivers/net/wireless/cw1200/hwbus.h | |||
@@ -28,7 +28,6 @@ struct hwbus_ops { | |||
28 | void (*unlock)(struct hwbus_priv *self); | 28 | void (*unlock)(struct hwbus_priv *self); |
29 | size_t (*align_size)(struct hwbus_priv *self, size_t size); | 29 | size_t (*align_size)(struct hwbus_priv *self, size_t size); |
30 | int (*power_mgmt)(struct hwbus_priv *self, bool suspend); | 30 | int (*power_mgmt)(struct hwbus_priv *self, bool suspend); |
31 | int (*irq_enable)(struct hwbus_priv *self, int enable); | ||
32 | }; | 31 | }; |
33 | 32 | ||
34 | #endif /* CW1200_HWBUS_H */ | 33 | #endif /* CW1200_HWBUS_H */ |
diff --git a/drivers/net/wireless/cw1200/hwio.c b/drivers/net/wireless/cw1200/hwio.c index 41bd7615ccaa..ff230b7aeedd 100644 --- a/drivers/net/wireless/cw1200/hwio.c +++ b/drivers/net/wireless/cw1200/hwio.c | |||
@@ -273,21 +273,6 @@ int __cw1200_irq_enable(struct cw1200_common *priv, int enable) | |||
273 | u16 val16; | 273 | u16 val16; |
274 | int ret; | 274 | int ret; |
275 | 275 | ||
276 | /* We need to do this hack because the SPI layer can sleep on I/O | ||
277 | and the general path involves I/O to the device in interrupt | ||
278 | context. | ||
279 | |||
280 | However, the initial enable call needs to go to the hardware. | ||
281 | |||
282 | We don't worry about shutdown because we do a full reset which | ||
283 | clears the interrupt enabled bits. | ||
284 | */ | ||
285 | if (priv->hwbus_ops->irq_enable) { | ||
286 | ret = priv->hwbus_ops->irq_enable(priv->hwbus_priv, enable); | ||
287 | if (ret || enable < 2) | ||
288 | return ret; | ||
289 | } | ||
290 | |||
291 | if (HIF_8601_SILICON == priv->hw_type) { | 276 | if (HIF_8601_SILICON == priv->hw_type) { |
292 | ret = __cw1200_reg_read_32(priv, ST90TDS_CONFIG_REG_ID, &val32); | 277 | ret = __cw1200_reg_read_32(priv, ST90TDS_CONFIG_REG_ID, &val32); |
293 | if (ret < 0) { | 278 | if (ret < 0) { |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index 21c688264708..1214c587fd08 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -150,7 +150,7 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv, | |||
150 | */ | 150 | */ |
151 | int | 151 | int |
152 | mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | 152 | mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, |
153 | struct mwifiex_ra_list_tbl *pra_list, int headroom, | 153 | struct mwifiex_ra_list_tbl *pra_list, |
154 | int ptrindex, unsigned long ra_list_flags) | 154 | int ptrindex, unsigned long ra_list_flags) |
155 | __releases(&priv->wmm.ra_list_spinlock) | 155 | __releases(&priv->wmm.ra_list_spinlock) |
156 | { | 156 | { |
@@ -160,6 +160,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
160 | int pad = 0, ret; | 160 | int pad = 0, ret; |
161 | struct mwifiex_tx_param tx_param; | 161 | struct mwifiex_tx_param tx_param; |
162 | struct txpd *ptx_pd = NULL; | 162 | struct txpd *ptx_pd = NULL; |
163 | int headroom = adapter->iface_type == MWIFIEX_USB ? 0 : INTF_HEADER_LEN; | ||
163 | 164 | ||
164 | skb_src = skb_peek(&pra_list->skb_head); | 165 | skb_src = skb_peek(&pra_list->skb_head); |
165 | if (!skb_src) { | 166 | if (!skb_src) { |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.h b/drivers/net/wireless/mwifiex/11n_aggr.h index 900e1c62a0cc..892098d6a696 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.h +++ b/drivers/net/wireless/mwifiex/11n_aggr.h | |||
@@ -26,7 +26,7 @@ | |||
26 | int mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv, | 26 | int mwifiex_11n_deaggregate_pkt(struct mwifiex_private *priv, |
27 | struct sk_buff *skb); | 27 | struct sk_buff *skb); |
28 | int mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | 28 | int mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, |
29 | struct mwifiex_ra_list_tbl *ptr, int headroom, | 29 | struct mwifiex_ra_list_tbl *ptr, |
30 | int ptr_index, unsigned long flags) | 30 | int ptr_index, unsigned long flags) |
31 | __releases(&priv->wmm.ra_list_spinlock); | 31 | __releases(&priv->wmm.ra_list_spinlock); |
32 | 32 | ||
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 2d761477d15e..a6c46f3b6e3a 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -1155,7 +1155,7 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, | |||
1155 | uint32_t conditions = le32_to_cpu(phs_cfg->params.hs_config.conditions); | 1155 | uint32_t conditions = le32_to_cpu(phs_cfg->params.hs_config.conditions); |
1156 | 1156 | ||
1157 | if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) && | 1157 | if (phs_cfg->action == cpu_to_le16(HS_ACTIVATE) && |
1158 | adapter->iface_type == MWIFIEX_SDIO) { | 1158 | adapter->iface_type != MWIFIEX_USB) { |
1159 | mwifiex_hs_activated_event(priv, true); | 1159 | mwifiex_hs_activated_event(priv, true); |
1160 | return 0; | 1160 | return 0; |
1161 | } else { | 1161 | } else { |
@@ -1167,8 +1167,7 @@ int mwifiex_ret_802_11_hs_cfg(struct mwifiex_private *priv, | |||
1167 | } | 1167 | } |
1168 | if (conditions != HS_CFG_CANCEL) { | 1168 | if (conditions != HS_CFG_CANCEL) { |
1169 | adapter->is_hs_configured = true; | 1169 | adapter->is_hs_configured = true; |
1170 | if (adapter->iface_type == MWIFIEX_USB || | 1170 | if (adapter->iface_type == MWIFIEX_USB) |
1171 | adapter->iface_type == MWIFIEX_PCIE) | ||
1172 | mwifiex_hs_activated_event(priv, true); | 1171 | mwifiex_hs_activated_event(priv, true); |
1173 | } else { | 1172 | } else { |
1174 | adapter->is_hs_configured = false; | 1173 | adapter->is_hs_configured = false; |
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index 2472d4b7f00e..1c70b8d09227 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
@@ -447,9 +447,6 @@ static int mwifiex_usb_suspend(struct usb_interface *intf, pm_message_t message) | |||
447 | */ | 447 | */ |
448 | adapter->is_suspended = true; | 448 | adapter->is_suspended = true; |
449 | 449 | ||
450 | for (i = 0; i < adapter->priv_num; i++) | ||
451 | netif_carrier_off(adapter->priv[i]->netdev); | ||
452 | |||
453 | if (atomic_read(&card->rx_cmd_urb_pending) && card->rx_cmd.urb) | 450 | if (atomic_read(&card->rx_cmd_urb_pending) && card->rx_cmd.urb) |
454 | usb_kill_urb(card->rx_cmd.urb); | 451 | usb_kill_urb(card->rx_cmd.urb); |
455 | 452 | ||
@@ -509,10 +506,6 @@ static int mwifiex_usb_resume(struct usb_interface *intf) | |||
509 | MWIFIEX_RX_CMD_BUF_SIZE); | 506 | MWIFIEX_RX_CMD_BUF_SIZE); |
510 | } | 507 | } |
511 | 508 | ||
512 | for (i = 0; i < adapter->priv_num; i++) | ||
513 | if (adapter->priv[i]->media_connected) | ||
514 | netif_carrier_on(adapter->priv[i]->netdev); | ||
515 | |||
516 | /* Disable Host Sleep */ | 509 | /* Disable Host Sleep */ |
517 | if (adapter->hs_activated) | 510 | if (adapter->hs_activated) |
518 | mwifiex_cancel_hs(mwifiex_get_priv(adapter, | 511 | mwifiex_cancel_hs(mwifiex_get_priv(adapter, |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index 2e8f9cdea54d..95fa3599b407 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
@@ -1239,8 +1239,7 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter) | |||
1239 | if (enable_tx_amsdu && mwifiex_is_amsdu_allowed(priv, tid) && | 1239 | if (enable_tx_amsdu && mwifiex_is_amsdu_allowed(priv, tid) && |
1240 | mwifiex_is_11n_aggragation_possible(priv, ptr, | 1240 | mwifiex_is_11n_aggragation_possible(priv, ptr, |
1241 | adapter->tx_buf_size)) | 1241 | adapter->tx_buf_size)) |
1242 | mwifiex_11n_aggregate_pkt(priv, ptr, INTF_HEADER_LEN, | 1242 | mwifiex_11n_aggregate_pkt(priv, ptr, ptr_index, flags); |
1243 | ptr_index, flags); | ||
1244 | /* ra_list_spinlock has been freed in | 1243 | /* ra_list_spinlock has been freed in |
1245 | mwifiex_11n_aggregate_pkt() */ | 1244 | mwifiex_11n_aggregate_pkt() */ |
1246 | else | 1245 | else |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index b9deef66cf4b..e328d3058c41 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -83,6 +83,7 @@ static struct usb_device_id p54u_table[] = { | |||
83 | {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ | 83 | {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ |
84 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ | 84 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ |
85 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ | 85 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ |
86 | {USB_DEVICE(0x07aa, 0x0020)}, /* Corega WLUSB2GTST USB */ | ||
86 | {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ | 87 | {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ |
87 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ | 88 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ |
88 | {USB_DEVICE(0x083a, 0x4531)}, /* T-Com Sinus 154 data II */ | 89 | {USB_DEVICE(0x083a, 0x4531)}, /* T-Com Sinus 154 data II */ |
@@ -979,6 +980,7 @@ static int p54u_load_firmware(struct ieee80211_hw *dev, | |||
979 | if (err) { | 980 | if (err) { |
980 | dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " | 981 | dev_err(&priv->udev->dev, "(p54usb) cannot load firmware %s " |
981 | "(%d)!\n", p54u_fwlist[i].fw, err); | 982 | "(%d)!\n", p54u_fwlist[i].fw, err); |
983 | usb_put_dev(udev); | ||
982 | } | 984 | } |
983 | 985 | ||
984 | return err; | 986 | return err; |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index cc03e7c87cbe..703258742d28 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -2057,7 +2057,7 @@ struct rtl_priv { | |||
2057 | that it points to the data allocated | 2057 | that it points to the data allocated |
2058 | beyond this structure like: | 2058 | beyond this structure like: |
2059 | rtl_pci_priv or rtl_usb_priv */ | 2059 | rtl_pci_priv or rtl_usb_priv */ |
2060 | u8 priv[0]; | 2060 | u8 priv[0] __aligned(sizeof(void *)); |
2061 | }; | 2061 | }; |
2062 | 2062 | ||
2063 | #define rtl_priv(hw) (((struct rtl_priv *)(hw)->priv)) | 2063 | #define rtl_priv(hw) (((struct rtl_priv *)(hw)->priv)) |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index a53782ef1540..b45bce20ad76 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -24,6 +24,12 @@ | |||
24 | struct backend_info { | 24 | struct backend_info { |
25 | struct xenbus_device *dev; | 25 | struct xenbus_device *dev; |
26 | struct xenvif *vif; | 26 | struct xenvif *vif; |
27 | |||
28 | /* This is the state that will be reflected in xenstore when any | ||
29 | * active hotplug script completes. | ||
30 | */ | ||
31 | enum xenbus_state state; | ||
32 | |||
27 | enum xenbus_state frontend_state; | 33 | enum xenbus_state frontend_state; |
28 | struct xenbus_watch hotplug_status_watch; | 34 | struct xenbus_watch hotplug_status_watch; |
29 | u8 have_hotplug_status_watch:1; | 35 | u8 have_hotplug_status_watch:1; |
@@ -136,6 +142,8 @@ static int netback_probe(struct xenbus_device *dev, | |||
136 | if (err) | 142 | if (err) |
137 | goto fail; | 143 | goto fail; |
138 | 144 | ||
145 | be->state = XenbusStateInitWait; | ||
146 | |||
139 | /* This kicks hotplug scripts, so do it immediately. */ | 147 | /* This kicks hotplug scripts, so do it immediately. */ |
140 | backend_create_xenvif(be); | 148 | backend_create_xenvif(be); |
141 | 149 | ||
@@ -208,24 +216,113 @@ static void backend_create_xenvif(struct backend_info *be) | |||
208 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); | 216 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); |
209 | } | 217 | } |
210 | 218 | ||
211 | 219 | static void backend_disconnect(struct backend_info *be) | |
212 | static void disconnect_backend(struct xenbus_device *dev) | ||
213 | { | 220 | { |
214 | struct backend_info *be = dev_get_drvdata(&dev->dev); | ||
215 | |||
216 | if (be->vif) | 221 | if (be->vif) |
217 | xenvif_disconnect(be->vif); | 222 | xenvif_disconnect(be->vif); |
218 | } | 223 | } |
219 | 224 | ||
220 | static void destroy_backend(struct xenbus_device *dev) | 225 | static void backend_connect(struct backend_info *be) |
221 | { | 226 | { |
222 | struct backend_info *be = dev_get_drvdata(&dev->dev); | 227 | if (be->vif) |
228 | connect(be); | ||
229 | } | ||
223 | 230 | ||
224 | if (be->vif) { | 231 | static inline void backend_switch_state(struct backend_info *be, |
225 | kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE); | 232 | enum xenbus_state state) |
226 | xenbus_rm(XBT_NIL, dev->nodename, "hotplug-status"); | 233 | { |
227 | xenvif_free(be->vif); | 234 | struct xenbus_device *dev = be->dev; |
228 | be->vif = NULL; | 235 | |
236 | pr_debug("%s -> %s\n", dev->nodename, xenbus_strstate(state)); | ||
237 | be->state = state; | ||
238 | |||
239 | /* If we are waiting for a hotplug script then defer the | ||
240 | * actual xenbus state change. | ||
241 | */ | ||
242 | if (!be->have_hotplug_status_watch) | ||
243 | xenbus_switch_state(dev, state); | ||
244 | } | ||
245 | |||
246 | /* Handle backend state transitions: | ||
247 | * | ||
248 | * The backend state starts in InitWait and the following transitions are | ||
249 | * allowed. | ||
250 | * | ||
251 | * InitWait -> Connected | ||
252 | * | ||
253 | * ^ \ | | ||
254 | * | \ | | ||
255 | * | \ | | ||
256 | * | \ | | ||
257 | * | \ | | ||
258 | * | \ | | ||
259 | * | V V | ||
260 | * | ||
261 | * Closed <-> Closing | ||
262 | * | ||
263 | * The state argument specifies the eventual state of the backend and the | ||
264 | * function transitions to that state via the shortest path. | ||
265 | */ | ||
266 | static void set_backend_state(struct backend_info *be, | ||
267 | enum xenbus_state state) | ||
268 | { | ||
269 | while (be->state != state) { | ||
270 | switch (be->state) { | ||
271 | case XenbusStateClosed: | ||
272 | switch (state) { | ||
273 | case XenbusStateInitWait: | ||
274 | case XenbusStateConnected: | ||
275 | pr_info("%s: prepare for reconnect\n", | ||
276 | be->dev->nodename); | ||
277 | backend_switch_state(be, XenbusStateInitWait); | ||
278 | break; | ||
279 | case XenbusStateClosing: | ||
280 | backend_switch_state(be, XenbusStateClosing); | ||
281 | break; | ||
282 | default: | ||
283 | BUG(); | ||
284 | } | ||
285 | break; | ||
286 | case XenbusStateInitWait: | ||
287 | switch (state) { | ||
288 | case XenbusStateConnected: | ||
289 | backend_connect(be); | ||
290 | backend_switch_state(be, XenbusStateConnected); | ||
291 | break; | ||
292 | case XenbusStateClosing: | ||
293 | case XenbusStateClosed: | ||
294 | backend_switch_state(be, XenbusStateClosing); | ||
295 | break; | ||
296 | default: | ||
297 | BUG(); | ||
298 | } | ||
299 | break; | ||
300 | case XenbusStateConnected: | ||
301 | switch (state) { | ||
302 | case XenbusStateInitWait: | ||
303 | case XenbusStateClosing: | ||
304 | case XenbusStateClosed: | ||
305 | backend_disconnect(be); | ||
306 | backend_switch_state(be, XenbusStateClosing); | ||
307 | break; | ||
308 | default: | ||
309 | BUG(); | ||
310 | } | ||
311 | break; | ||
312 | case XenbusStateClosing: | ||
313 | switch (state) { | ||
314 | case XenbusStateInitWait: | ||
315 | case XenbusStateConnected: | ||
316 | case XenbusStateClosed: | ||
317 | backend_switch_state(be, XenbusStateClosed); | ||
318 | break; | ||
319 | default: | ||
320 | BUG(); | ||
321 | } | ||
322 | break; | ||
323 | default: | ||
324 | BUG(); | ||
325 | } | ||
229 | } | 326 | } |
230 | } | 327 | } |
231 | 328 | ||
@@ -237,40 +334,33 @@ static void frontend_changed(struct xenbus_device *dev, | |||
237 | { | 334 | { |
238 | struct backend_info *be = dev_get_drvdata(&dev->dev); | 335 | struct backend_info *be = dev_get_drvdata(&dev->dev); |
239 | 336 | ||
240 | pr_debug("frontend state %s\n", xenbus_strstate(frontend_state)); | 337 | pr_debug("%s -> %s\n", dev->otherend, xenbus_strstate(frontend_state)); |
241 | 338 | ||
242 | be->frontend_state = frontend_state; | 339 | be->frontend_state = frontend_state; |
243 | 340 | ||
244 | switch (frontend_state) { | 341 | switch (frontend_state) { |
245 | case XenbusStateInitialising: | 342 | case XenbusStateInitialising: |
246 | if (dev->state == XenbusStateClosed) { | 343 | set_backend_state(be, XenbusStateInitWait); |
247 | pr_info("%s: prepare for reconnect\n", dev->nodename); | ||
248 | xenbus_switch_state(dev, XenbusStateInitWait); | ||
249 | } | ||
250 | break; | 344 | break; |
251 | 345 | ||
252 | case XenbusStateInitialised: | 346 | case XenbusStateInitialised: |
253 | break; | 347 | break; |
254 | 348 | ||
255 | case XenbusStateConnected: | 349 | case XenbusStateConnected: |
256 | if (dev->state == XenbusStateConnected) | 350 | set_backend_state(be, XenbusStateConnected); |
257 | break; | ||
258 | if (be->vif) | ||
259 | connect(be); | ||
260 | break; | 351 | break; |
261 | 352 | ||
262 | case XenbusStateClosing: | 353 | case XenbusStateClosing: |
263 | disconnect_backend(dev); | 354 | set_backend_state(be, XenbusStateClosing); |
264 | xenbus_switch_state(dev, XenbusStateClosing); | ||
265 | break; | 355 | break; |
266 | 356 | ||
267 | case XenbusStateClosed: | 357 | case XenbusStateClosed: |
268 | xenbus_switch_state(dev, XenbusStateClosed); | 358 | set_backend_state(be, XenbusStateClosed); |
269 | if (xenbus_dev_is_online(dev)) | 359 | if (xenbus_dev_is_online(dev)) |
270 | break; | 360 | break; |
271 | destroy_backend(dev); | ||
272 | /* fall through if not online */ | 361 | /* fall through if not online */ |
273 | case XenbusStateUnknown: | 362 | case XenbusStateUnknown: |
363 | set_backend_state(be, XenbusStateClosed); | ||
274 | device_unregister(&dev->dev); | 364 | device_unregister(&dev->dev); |
275 | break; | 365 | break; |
276 | 366 | ||
@@ -363,7 +453,9 @@ static void hotplug_status_changed(struct xenbus_watch *watch, | |||
363 | if (IS_ERR(str)) | 453 | if (IS_ERR(str)) |
364 | return; | 454 | return; |
365 | if (len == sizeof("connected")-1 && !memcmp(str, "connected", len)) { | 455 | if (len == sizeof("connected")-1 && !memcmp(str, "connected", len)) { |
366 | xenbus_switch_state(be->dev, XenbusStateConnected); | 456 | /* Complete any pending state change */ |
457 | xenbus_switch_state(be->dev, be->state); | ||
458 | |||
367 | /* Not interested in this watch anymore. */ | 459 | /* Not interested in this watch anymore. */ |
368 | unregister_hotplug_status_watch(be); | 460 | unregister_hotplug_status_watch(be); |
369 | } | 461 | } |
@@ -393,12 +485,8 @@ static void connect(struct backend_info *be) | |||
393 | err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, | 485 | err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, |
394 | hotplug_status_changed, | 486 | hotplug_status_changed, |
395 | "%s/%s", dev->nodename, "hotplug-status"); | 487 | "%s/%s", dev->nodename, "hotplug-status"); |
396 | if (err) { | 488 | if (!err) |
397 | /* Switch now, since we can't do a watch. */ | ||
398 | xenbus_switch_state(dev, XenbusStateConnected); | ||
399 | } else { | ||
400 | be->have_hotplug_status_watch = 1; | 489 | be->have_hotplug_status_watch = 1; |
401 | } | ||
402 | 490 | ||
403 | netif_wake_queue(be->vif->dev); | 491 | netif_wake_queue(be->vif->dev); |
404 | } | 492 | } |
diff --git a/drivers/of/address.c b/drivers/of/address.c index 556a7fb6ead3..4b9317bdb81c 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -489,7 +489,7 @@ static u64 __of_translate_address(struct device_node *dev, | |||
489 | int na, ns, pna, pns; | 489 | int na, ns, pna, pns; |
490 | u64 result = OF_BAD_ADDR; | 490 | u64 result = OF_BAD_ADDR; |
491 | 491 | ||
492 | pr_debug("OF: ** translation for device %s **\n", dev->full_name); | 492 | pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev)); |
493 | 493 | ||
494 | /* Increase refcount at current level */ | 494 | /* Increase refcount at current level */ |
495 | of_node_get(dev); | 495 | of_node_get(dev); |
@@ -504,13 +504,13 @@ static u64 __of_translate_address(struct device_node *dev, | |||
504 | bus->count_cells(dev, &na, &ns); | 504 | bus->count_cells(dev, &na, &ns); |
505 | if (!OF_CHECK_COUNTS(na, ns)) { | 505 | if (!OF_CHECK_COUNTS(na, ns)) { |
506 | printk(KERN_ERR "prom_parse: Bad cell count for %s\n", | 506 | printk(KERN_ERR "prom_parse: Bad cell count for %s\n", |
507 | dev->full_name); | 507 | of_node_full_name(dev)); |
508 | goto bail; | 508 | goto bail; |
509 | } | 509 | } |
510 | memcpy(addr, in_addr, na * 4); | 510 | memcpy(addr, in_addr, na * 4); |
511 | 511 | ||
512 | pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n", | 512 | pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n", |
513 | bus->name, na, ns, parent->full_name); | 513 | bus->name, na, ns, of_node_full_name(parent)); |
514 | of_dump_addr("OF: translating address:", addr, na); | 514 | of_dump_addr("OF: translating address:", addr, na); |
515 | 515 | ||
516 | /* Translate */ | 516 | /* Translate */ |
@@ -532,12 +532,12 @@ static u64 __of_translate_address(struct device_node *dev, | |||
532 | pbus->count_cells(dev, &pna, &pns); | 532 | pbus->count_cells(dev, &pna, &pns); |
533 | if (!OF_CHECK_COUNTS(pna, pns)) { | 533 | if (!OF_CHECK_COUNTS(pna, pns)) { |
534 | printk(KERN_ERR "prom_parse: Bad cell count for %s\n", | 534 | printk(KERN_ERR "prom_parse: Bad cell count for %s\n", |
535 | dev->full_name); | 535 | of_node_full_name(dev)); |
536 | break; | 536 | break; |
537 | } | 537 | } |
538 | 538 | ||
539 | pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n", | 539 | pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n", |
540 | pbus->name, pna, pns, parent->full_name); | 540 | pbus->name, pna, pns, of_node_full_name(parent)); |
541 | 541 | ||
542 | /* Apply bus translation */ | 542 | /* Apply bus translation */ |
543 | if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop)) | 543 | if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop)) |
diff --git a/drivers/of/base.c b/drivers/of/base.c index ced4c06d79b3..f2431091f4c1 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -272,9 +272,9 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun, | |||
272 | 272 | ||
273 | ac = of_n_addr_cells(cpun); | 273 | ac = of_n_addr_cells(cpun); |
274 | cell = of_get_property(cpun, prop_name, &prop_len); | 274 | cell = of_get_property(cpun, prop_name, &prop_len); |
275 | if (!cell) | 275 | if (!cell || !ac) |
276 | return false; | 276 | return false; |
277 | prop_len /= sizeof(*cell); | 277 | prop_len /= sizeof(*cell) * ac; |
278 | for (tid = 0; tid < prop_len; tid++) { | 278 | for (tid = 0; tid < prop_len; tid++) { |
279 | hwid = of_read_number(cell, ac); | 279 | hwid = of_read_number(cell, ac); |
280 | if (arch_match_cpu_phys_id(cpu, hwid)) { | 280 | if (arch_match_cpu_phys_id(cpu, hwid)) { |
@@ -287,6 +287,31 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun, | |||
287 | return false; | 287 | return false; |
288 | } | 288 | } |
289 | 289 | ||
290 | /* | ||
291 | * arch_find_n_match_cpu_physical_id - See if the given device node is | ||
292 | * for the cpu corresponding to logical cpu 'cpu'. Return true if so, | ||
293 | * else false. If 'thread' is non-NULL, the local thread number within the | ||
294 | * core is returned in it. | ||
295 | */ | ||
296 | bool __weak arch_find_n_match_cpu_physical_id(struct device_node *cpun, | ||
297 | int cpu, unsigned int *thread) | ||
298 | { | ||
299 | /* Check for non-standard "ibm,ppc-interrupt-server#s" property | ||
300 | * for thread ids on PowerPC. If it doesn't exist fallback to | ||
301 | * standard "reg" property. | ||
302 | */ | ||
303 | if (IS_ENABLED(CONFIG_PPC) && | ||
304 | __of_find_n_match_cpu_property(cpun, | ||
305 | "ibm,ppc-interrupt-server#s", | ||
306 | cpu, thread)) | ||
307 | return true; | ||
308 | |||
309 | if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread)) | ||
310 | return true; | ||
311 | |||
312 | return false; | ||
313 | } | ||
314 | |||
290 | /** | 315 | /** |
291 | * of_get_cpu_node - Get device node associated with the given logical CPU | 316 | * of_get_cpu_node - Get device node associated with the given logical CPU |
292 | * | 317 | * |
@@ -307,26 +332,10 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun, | |||
307 | */ | 332 | */ |
308 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) | 333 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) |
309 | { | 334 | { |
310 | struct device_node *cpun, *cpus; | 335 | struct device_node *cpun; |
311 | 336 | ||
312 | cpus = of_find_node_by_path("/cpus"); | 337 | for_each_node_by_type(cpun, "cpu") { |
313 | if (!cpus) { | 338 | if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread)) |
314 | pr_warn("Missing cpus node, bailing out\n"); | ||
315 | return NULL; | ||
316 | } | ||
317 | |||
318 | for_each_child_of_node(cpus, cpun) { | ||
319 | if (of_node_cmp(cpun->type, "cpu")) | ||
320 | continue; | ||
321 | /* Check for non-standard "ibm,ppc-interrupt-server#s" property | ||
322 | * for thread ids on PowerPC. If it doesn't exist fallback to | ||
323 | * standard "reg" property. | ||
324 | */ | ||
325 | if (IS_ENABLED(CONFIG_PPC) && | ||
326 | __of_find_n_match_cpu_property(cpun, | ||
327 | "ibm,ppc-interrupt-server#s", cpu, thread)) | ||
328 | return cpun; | ||
329 | if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread)) | ||
330 | return cpun; | 339 | return cpun; |
331 | } | 340 | } |
332 | return NULL; | 341 | return NULL; |
@@ -1183,6 +1192,15 @@ int of_property_count_strings(struct device_node *np, const char *propname) | |||
1183 | } | 1192 | } |
1184 | EXPORT_SYMBOL_GPL(of_property_count_strings); | 1193 | EXPORT_SYMBOL_GPL(of_property_count_strings); |
1185 | 1194 | ||
1195 | void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) | ||
1196 | { | ||
1197 | int i; | ||
1198 | printk("%s %s", msg, of_node_full_name(args->np)); | ||
1199 | for (i = 0; i < args->args_count; i++) | ||
1200 | printk(i ? ",%08x" : ":%08x", args->args[i]); | ||
1201 | printk("\n"); | ||
1202 | } | ||
1203 | |||
1186 | static int __of_parse_phandle_with_args(const struct device_node *np, | 1204 | static int __of_parse_phandle_with_args(const struct device_node *np, |
1187 | const char *list_name, | 1205 | const char *list_name, |
1188 | const char *cells_name, | 1206 | const char *cells_name, |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 1752988d6aa8..d385bb824772 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -31,18 +31,17 @@ | |||
31 | * @dev: Device node of the device whose interrupt is to be mapped | 31 | * @dev: Device node of the device whose interrupt is to be mapped |
32 | * @index: Index of the interrupt to map | 32 | * @index: Index of the interrupt to map |
33 | * | 33 | * |
34 | * This function is a wrapper that chains of_irq_map_one() and | 34 | * This function is a wrapper that chains of_irq_parse_one() and |
35 | * irq_create_of_mapping() to make things easier to callers | 35 | * irq_create_of_mapping() to make things easier to callers |
36 | */ | 36 | */ |
37 | unsigned int irq_of_parse_and_map(struct device_node *dev, int index) | 37 | unsigned int irq_of_parse_and_map(struct device_node *dev, int index) |
38 | { | 38 | { |
39 | struct of_irq oirq; | 39 | struct of_phandle_args oirq; |
40 | 40 | ||
41 | if (of_irq_map_one(dev, index, &oirq)) | 41 | if (of_irq_parse_one(dev, index, &oirq)) |
42 | return 0; | 42 | return 0; |
43 | 43 | ||
44 | return irq_create_of_mapping(oirq.controller, oirq.specifier, | 44 | return irq_create_of_mapping(&oirq); |
45 | oirq.size); | ||
46 | } | 45 | } |
47 | EXPORT_SYMBOL_GPL(irq_of_parse_and_map); | 46 | EXPORT_SYMBOL_GPL(irq_of_parse_and_map); |
48 | 47 | ||
@@ -79,33 +78,34 @@ struct device_node *of_irq_find_parent(struct device_node *child) | |||
79 | } | 78 | } |
80 | 79 | ||
81 | /** | 80 | /** |
82 | * of_irq_map_raw - Low level interrupt tree parsing | 81 | * of_irq_parse_raw - Low level interrupt tree parsing |
83 | * @parent: the device interrupt parent | 82 | * @parent: the device interrupt parent |
84 | * @intspec: interrupt specifier ("interrupts" property of the device) | 83 | * @addr: address specifier (start of "reg" property of the device) in be32 format |
85 | * @ointsize: size of the passed in interrupt specifier | 84 | * @out_irq: structure of_irq updated by this function |
86 | * @addr: address specifier (start of "reg" property of the device) | ||
87 | * @out_irq: structure of_irq filled by this function | ||
88 | * | 85 | * |
89 | * Returns 0 on success and a negative number on error | 86 | * Returns 0 on success and a negative number on error |
90 | * | 87 | * |
91 | * This function is a low-level interrupt tree walking function. It | 88 | * This function is a low-level interrupt tree walking function. It |
92 | * can be used to do a partial walk with synthetized reg and interrupts | 89 | * can be used to do a partial walk with synthetized reg and interrupts |
93 | * properties, for example when resolving PCI interrupts when no device | 90 | * properties, for example when resolving PCI interrupts when no device |
94 | * node exist for the parent. | 91 | * node exist for the parent. It takes an interrupt specifier structure as |
92 | * input, walks the tree looking for any interrupt-map properties, translates | ||
93 | * the specifier for each map, and then returns the translated map. | ||
95 | */ | 94 | */ |
96 | int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | 95 | int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) |
97 | u32 ointsize, const __be32 *addr, struct of_irq *out_irq) | ||
98 | { | 96 | { |
99 | struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; | 97 | struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; |
100 | const __be32 *tmp, *imap, *imask; | 98 | __be32 initial_match_array[MAX_PHANDLE_ARGS]; |
99 | const __be32 *match_array = initial_match_array; | ||
100 | const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = ~0 }; | ||
101 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; | 101 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; |
102 | int imaplen, match, i; | 102 | int imaplen, match, i; |
103 | 103 | ||
104 | pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", | 104 | #ifdef DEBUG |
105 | parent->full_name, be32_to_cpup(intspec), | 105 | of_print_phandle_args("of_irq_parse_raw: ", out_irq); |
106 | be32_to_cpup(intspec + 1), ointsize); | 106 | #endif |
107 | 107 | ||
108 | ipar = of_node_get(parent); | 108 | ipar = of_node_get(out_irq->np); |
109 | 109 | ||
110 | /* First get the #interrupt-cells property of the current cursor | 110 | /* First get the #interrupt-cells property of the current cursor |
111 | * that tells us how to interpret the passed-in intspec. If there | 111 | * that tells us how to interpret the passed-in intspec. If there |
@@ -126,9 +126,9 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | |||
126 | goto fail; | 126 | goto fail; |
127 | } | 127 | } |
128 | 128 | ||
129 | pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize); | 129 | pr_debug("of_irq_parse_raw: ipar=%s, size=%d\n", of_node_full_name(ipar), intsize); |
130 | 130 | ||
131 | if (ointsize != intsize) | 131 | if (out_irq->args_count != intsize) |
132 | return -EINVAL; | 132 | return -EINVAL; |
133 | 133 | ||
134 | /* Look for this #address-cells. We have to implement the old linux | 134 | /* Look for this #address-cells. We have to implement the old linux |
@@ -147,6 +147,16 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | |||
147 | 147 | ||
148 | pr_debug(" -> addrsize=%d\n", addrsize); | 148 | pr_debug(" -> addrsize=%d\n", addrsize); |
149 | 149 | ||
150 | /* Range check so that the temporary buffer doesn't overflow */ | ||
151 | if (WARN_ON(addrsize + intsize > MAX_PHANDLE_ARGS)) | ||
152 | goto fail; | ||
153 | |||
154 | /* Precalculate the match array - this simplifies match loop */ | ||
155 | for (i = 0; i < addrsize; i++) | ||
156 | initial_match_array[i] = addr ? addr[i] : 0; | ||
157 | for (i = 0; i < intsize; i++) | ||
158 | initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]); | ||
159 | |||
150 | /* Now start the actual "proper" walk of the interrupt tree */ | 160 | /* Now start the actual "proper" walk of the interrupt tree */ |
151 | while (ipar != NULL) { | 161 | while (ipar != NULL) { |
152 | /* Now check if cursor is an interrupt-controller and if it is | 162 | /* Now check if cursor is an interrupt-controller and if it is |
@@ -155,15 +165,19 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | |||
155 | if (of_get_property(ipar, "interrupt-controller", NULL) != | 165 | if (of_get_property(ipar, "interrupt-controller", NULL) != |
156 | NULL) { | 166 | NULL) { |
157 | pr_debug(" -> got it !\n"); | 167 | pr_debug(" -> got it !\n"); |
158 | for (i = 0; i < intsize; i++) | ||
159 | out_irq->specifier[i] = | ||
160 | of_read_number(intspec +i, 1); | ||
161 | out_irq->size = intsize; | ||
162 | out_irq->controller = ipar; | ||
163 | of_node_put(old); | 168 | of_node_put(old); |
164 | return 0; | 169 | return 0; |
165 | } | 170 | } |
166 | 171 | ||
172 | /* | ||
173 | * interrupt-map parsing does not work without a reg | ||
174 | * property when #address-cells != 0 | ||
175 | */ | ||
176 | if (addrsize && !addr) { | ||
177 | pr_debug(" -> no reg passed in when needed !\n"); | ||
178 | goto fail; | ||
179 | } | ||
180 | |||
167 | /* Now look for an interrupt-map */ | 181 | /* Now look for an interrupt-map */ |
168 | imap = of_get_property(ipar, "interrupt-map", &imaplen); | 182 | imap = of_get_property(ipar, "interrupt-map", &imaplen); |
169 | /* No interrupt map, check for an interrupt parent */ | 183 | /* No interrupt map, check for an interrupt parent */ |
@@ -176,34 +190,16 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | |||
176 | 190 | ||
177 | /* Look for a mask */ | 191 | /* Look for a mask */ |
178 | imask = of_get_property(ipar, "interrupt-map-mask", NULL); | 192 | imask = of_get_property(ipar, "interrupt-map-mask", NULL); |
179 | 193 | if (!imask) | |
180 | /* If we were passed no "reg" property and we attempt to parse | 194 | imask = dummy_imask; |
181 | * an interrupt-map, then #address-cells must be 0. | ||
182 | * Fail if it's not. | ||
183 | */ | ||
184 | if (addr == NULL && addrsize != 0) { | ||
185 | pr_debug(" -> no reg passed in when needed !\n"); | ||
186 | goto fail; | ||
187 | } | ||
188 | 195 | ||
189 | /* Parse interrupt-map */ | 196 | /* Parse interrupt-map */ |
190 | match = 0; | 197 | match = 0; |
191 | while (imaplen > (addrsize + intsize + 1) && !match) { | 198 | while (imaplen > (addrsize + intsize + 1) && !match) { |
192 | /* Compare specifiers */ | 199 | /* Compare specifiers */ |
193 | match = 1; | 200 | match = 1; |
194 | for (i = 0; i < addrsize && match; ++i) { | 201 | for (i = 0; i < (addrsize + intsize); i++, imaplen--) |
195 | __be32 mask = imask ? imask[i] | 202 | match = !((match_array[i] ^ *imap++) & imask[i]); |
196 | : cpu_to_be32(0xffffffffu); | ||
197 | match = ((addr[i] ^ imap[i]) & mask) == 0; | ||
198 | } | ||
199 | for (; i < (addrsize + intsize) && match; ++i) { | ||
200 | __be32 mask = imask ? imask[i] | ||
201 | : cpu_to_be32(0xffffffffu); | ||
202 | match = | ||
203 | ((intspec[i-addrsize] ^ imap[i]) & mask) == 0; | ||
204 | } | ||
205 | imap += addrsize + intsize; | ||
206 | imaplen -= addrsize + intsize; | ||
207 | 203 | ||
208 | pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen); | 204 | pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen); |
209 | 205 | ||
@@ -237,6 +233,8 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | |||
237 | newintsize, newaddrsize); | 233 | newintsize, newaddrsize); |
238 | 234 | ||
239 | /* Check for malformed properties */ | 235 | /* Check for malformed properties */ |
236 | if (WARN_ON(newaddrsize + newintsize > MAX_PHANDLE_ARGS)) | ||
237 | goto fail; | ||
240 | if (imaplen < (newaddrsize + newintsize)) | 238 | if (imaplen < (newaddrsize + newintsize)) |
241 | goto fail; | 239 | goto fail; |
242 | 240 | ||
@@ -248,12 +246,18 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | |||
248 | if (!match) | 246 | if (!match) |
249 | goto fail; | 247 | goto fail; |
250 | 248 | ||
251 | of_node_put(old); | 249 | /* |
252 | old = of_node_get(newpar); | 250 | * Successfully parsed an interrrupt-map translation; copy new |
251 | * interrupt specifier into the out_irq structure | ||
252 | */ | ||
253 | of_node_put(out_irq->np); | ||
254 | out_irq->np = of_node_get(newpar); | ||
255 | |||
256 | match_array = imap - newaddrsize - newintsize; | ||
257 | for (i = 0; i < newintsize; i++) | ||
258 | out_irq->args[i] = be32_to_cpup(imap - newintsize + i); | ||
259 | out_irq->args_count = intsize = newintsize; | ||
253 | addrsize = newaddrsize; | 260 | addrsize = newaddrsize; |
254 | intsize = newintsize; | ||
255 | intspec = imap - intsize; | ||
256 | addr = intspec - addrsize; | ||
257 | 261 | ||
258 | skiplevel: | 262 | skiplevel: |
259 | /* Iterate again with new parent */ | 263 | /* Iterate again with new parent */ |
@@ -264,46 +268,53 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, | |||
264 | } | 268 | } |
265 | fail: | 269 | fail: |
266 | of_node_put(ipar); | 270 | of_node_put(ipar); |
267 | of_node_put(old); | 271 | of_node_put(out_irq->np); |
268 | of_node_put(newpar); | 272 | of_node_put(newpar); |
269 | 273 | ||
270 | return -EINVAL; | 274 | return -EINVAL; |
271 | } | 275 | } |
272 | EXPORT_SYMBOL_GPL(of_irq_map_raw); | 276 | EXPORT_SYMBOL_GPL(of_irq_parse_raw); |
273 | 277 | ||
274 | /** | 278 | /** |
275 | * of_irq_map_one - Resolve an interrupt for a device | 279 | * of_irq_parse_one - Resolve an interrupt for a device |
276 | * @device: the device whose interrupt is to be resolved | 280 | * @device: the device whose interrupt is to be resolved |
277 | * @index: index of the interrupt to resolve | 281 | * @index: index of the interrupt to resolve |
278 | * @out_irq: structure of_irq filled by this function | 282 | * @out_irq: structure of_irq filled by this function |
279 | * | 283 | * |
280 | * This function resolves an interrupt, walking the tree, for a given | 284 | * This function resolves an interrupt for a node by walking the interrupt tree, |
281 | * device-tree node. It's the high level pendant to of_irq_map_raw(). | 285 | * finding which interrupt controller node it is attached to, and returning the |
286 | * interrupt specifier that can be used to retrieve a Linux IRQ number. | ||
282 | */ | 287 | */ |
283 | int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) | 288 | int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq) |
284 | { | 289 | { |
285 | struct device_node *p; | 290 | struct device_node *p; |
286 | const __be32 *intspec, *tmp, *addr; | 291 | const __be32 *intspec, *tmp, *addr; |
287 | u32 intsize, intlen; | 292 | u32 intsize, intlen; |
288 | int res = -EINVAL; | 293 | int i, res = -EINVAL; |
289 | 294 | ||
290 | pr_debug("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); | 295 | pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); |
291 | 296 | ||
292 | /* OldWorld mac stuff is "special", handle out of line */ | 297 | /* OldWorld mac stuff is "special", handle out of line */ |
293 | if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) | 298 | if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) |
294 | return of_irq_map_oldworld(device, index, out_irq); | 299 | return of_irq_parse_oldworld(device, index, out_irq); |
300 | |||
301 | /* Get the reg property (if any) */ | ||
302 | addr = of_get_property(device, "reg", NULL); | ||
295 | 303 | ||
296 | /* Get the interrupts property */ | 304 | /* Get the interrupts property */ |
297 | intspec = of_get_property(device, "interrupts", &intlen); | 305 | intspec = of_get_property(device, "interrupts", &intlen); |
298 | if (intspec == NULL) | 306 | if (intspec == NULL) { |
299 | return -EINVAL; | 307 | /* Try the new-style interrupts-extended */ |
308 | res = of_parse_phandle_with_args(device, "interrupts-extended", | ||
309 | "#interrupt-cells", index, out_irq); | ||
310 | if (res) | ||
311 | return -EINVAL; | ||
312 | return of_irq_parse_raw(addr, out_irq); | ||
313 | } | ||
300 | intlen /= sizeof(*intspec); | 314 | intlen /= sizeof(*intspec); |
301 | 315 | ||
302 | pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); | 316 | pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); |
303 | 317 | ||
304 | /* Get the reg property (if any) */ | ||
305 | addr = of_get_property(device, "reg", NULL); | ||
306 | |||
307 | /* Look for the interrupt parent. */ | 318 | /* Look for the interrupt parent. */ |
308 | p = of_irq_find_parent(device); | 319 | p = of_irq_find_parent(device); |
309 | if (p == NULL) | 320 | if (p == NULL) |
@@ -321,14 +332,20 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
321 | if ((index + 1) * intsize > intlen) | 332 | if ((index + 1) * intsize > intlen) |
322 | goto out; | 333 | goto out; |
323 | 334 | ||
324 | /* Get new specifier and map it */ | 335 | /* Copy intspec into irq structure */ |
325 | res = of_irq_map_raw(p, intspec + index * intsize, intsize, | 336 | intspec += index * intsize; |
326 | addr, out_irq); | 337 | out_irq->np = p; |
338 | out_irq->args_count = intsize; | ||
339 | for (i = 0; i < intsize; i++) | ||
340 | out_irq->args[i] = be32_to_cpup(intspec++); | ||
341 | |||
342 | /* Check if there are any interrupt-map translations to process */ | ||
343 | res = of_irq_parse_raw(addr, out_irq); | ||
327 | out: | 344 | out: |
328 | of_node_put(p); | 345 | of_node_put(p); |
329 | return res; | 346 | return res; |
330 | } | 347 | } |
331 | EXPORT_SYMBOL_GPL(of_irq_map_one); | 348 | EXPORT_SYMBOL_GPL(of_irq_parse_one); |
332 | 349 | ||
333 | /** | 350 | /** |
334 | * of_irq_to_resource - Decode a node's IRQ and return it as a resource | 351 | * of_irq_to_resource - Decode a node's IRQ and return it as a resource |
@@ -354,8 +371,8 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
354 | &name); | 371 | &name); |
355 | 372 | ||
356 | r->start = r->end = irq; | 373 | r->start = r->end = irq; |
357 | r->flags = IORESOURCE_IRQ; | 374 | r->flags = IORESOURCE_IRQ | irqd_get_trigger_type(irq_get_irq_data(irq)); |
358 | r->name = name ? name : dev->full_name; | 375 | r->name = name ? name : of_node_full_name(dev); |
359 | } | 376 | } |
360 | 377 | ||
361 | return irq; | 378 | return irq; |
@@ -368,9 +385,10 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource); | |||
368 | */ | 385 | */ |
369 | int of_irq_count(struct device_node *dev) | 386 | int of_irq_count(struct device_node *dev) |
370 | { | 387 | { |
388 | struct of_phandle_args irq; | ||
371 | int nr = 0; | 389 | int nr = 0; |
372 | 390 | ||
373 | while (of_irq_to_resource(dev, nr, NULL)) | 391 | while (of_irq_parse_one(dev, nr, &irq) == 0) |
374 | nr++; | 392 | nr++; |
375 | 393 | ||
376 | return nr; | 394 | return nr; |
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c index d86076431af6..8736bc7676c5 100644 --- a/drivers/of/of_pci_irq.c +++ b/drivers/of/of_pci_irq.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/export.h> | 4 | #include <linux/export.h> |
5 | 5 | ||
6 | /** | 6 | /** |
7 | * of_irq_map_pci - Resolve the interrupt for a PCI device | 7 | * of_irq_parse_pci - Resolve the interrupt for a PCI device |
8 | * @pdev: the device whose interrupt is to be resolved | 8 | * @pdev: the device whose interrupt is to be resolved |
9 | * @out_irq: structure of_irq filled by this function | 9 | * @out_irq: structure of_irq filled by this function |
10 | * | 10 | * |
@@ -14,7 +14,7 @@ | |||
14 | * PCI tree until an device-node is found, at which point it will finish | 14 | * PCI tree until an device-node is found, at which point it will finish |
15 | * resolving using the OF tree walking. | 15 | * resolving using the OF tree walking. |
16 | */ | 16 | */ |
17 | int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) | 17 | int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) |
18 | { | 18 | { |
19 | struct device_node *dn, *ppnode; | 19 | struct device_node *dn, *ppnode; |
20 | struct pci_dev *ppdev; | 20 | struct pci_dev *ppdev; |
@@ -29,7 +29,7 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) | |||
29 | */ | 29 | */ |
30 | dn = pci_device_to_OF_node(pdev); | 30 | dn = pci_device_to_OF_node(pdev); |
31 | if (dn) { | 31 | if (dn) { |
32 | rc = of_irq_map_one(dn, 0, out_irq); | 32 | rc = of_irq_parse_one(dn, 0, out_irq); |
33 | if (!rc) | 33 | if (!rc) |
34 | return rc; | 34 | return rc; |
35 | } | 35 | } |
@@ -84,9 +84,37 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) | |||
84 | pdev = ppdev; | 84 | pdev = ppdev; |
85 | } | 85 | } |
86 | 86 | ||
87 | out_irq->np = ppnode; | ||
88 | out_irq->args_count = 1; | ||
89 | out_irq->args[0] = lspec; | ||
87 | lspec_be = cpu_to_be32(lspec); | 90 | lspec_be = cpu_to_be32(lspec); |
88 | laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); | 91 | laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); |
89 | laddr[1] = laddr[2] = cpu_to_be32(0); | 92 | laddr[1] = laddr[2] = cpu_to_be32(0); |
90 | return of_irq_map_raw(ppnode, &lspec_be, 1, laddr, out_irq); | 93 | return of_irq_parse_raw(laddr, out_irq); |
91 | } | 94 | } |
92 | EXPORT_SYMBOL_GPL(of_irq_map_pci); | 95 | EXPORT_SYMBOL_GPL(of_irq_parse_pci); |
96 | |||
97 | /** | ||
98 | * of_irq_parse_and_map_pci() - Decode a PCI irq from the device tree and map to a virq | ||
99 | * @dev: The pci device needing an irq | ||
100 | * @slot: PCI slot number; passed when used as map_irq callback. Unused | ||
101 | * @pin: PCI irq pin number; passed when used as map_irq callback. Unused | ||
102 | * | ||
103 | * @slot and @pin are unused, but included in the function so that this | ||
104 | * function can be used directly as the map_irq callback to pci_fixup_irqs(). | ||
105 | */ | ||
106 | int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) | ||
107 | { | ||
108 | struct of_phandle_args oirq; | ||
109 | int ret; | ||
110 | |||
111 | ret = of_irq_parse_pci(dev, &oirq); | ||
112 | if (ret) { | ||
113 | dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret); | ||
114 | return 0; /* Proper return code 0 == NO_IRQ */ | ||
115 | } | ||
116 | |||
117 | return irq_create_of_mapping(&oirq); | ||
118 | } | ||
119 | EXPORT_SYMBOL_GPL(of_irq_parse_and_map_pci); | ||
120 | |||
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 0eb5c38b4e07..e21012bde639 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -9,18 +9,24 @@ | |||
9 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
12 | #include <linux/of_irq.h> | ||
12 | #include <linux/list.h> | 13 | #include <linux/list.h> |
13 | #include <linux/mutex.h> | 14 | #include <linux/mutex.h> |
14 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
15 | #include <linux/device.h> | 16 | #include <linux/device.h> |
16 | 17 | ||
17 | static bool selftest_passed = true; | 18 | static struct selftest_results { |
19 | int passed; | ||
20 | int failed; | ||
21 | } selftest_results; | ||
22 | |||
18 | #define selftest(result, fmt, ...) { \ | 23 | #define selftest(result, fmt, ...) { \ |
19 | if (!(result)) { \ | 24 | if (!(result)) { \ |
20 | pr_err("FAIL %s:%i " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ | 25 | selftest_results.failed++; \ |
21 | selftest_passed = false; \ | 26 | pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \ |
22 | } else { \ | 27 | } else { \ |
23 | pr_info("pass %s:%i\n", __FILE__, __LINE__); \ | 28 | selftest_results.passed++; \ |
29 | pr_debug("pass %s():%i\n", __func__, __LINE__); \ | ||
24 | } \ | 30 | } \ |
25 | } | 31 | } |
26 | 32 | ||
@@ -131,7 +137,6 @@ static void __init of_selftest_property_match_string(void) | |||
131 | struct device_node *np; | 137 | struct device_node *np; |
132 | int rc; | 138 | int rc; |
133 | 139 | ||
134 | pr_info("start\n"); | ||
135 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); | 140 | np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); |
136 | if (!np) { | 141 | if (!np) { |
137 | pr_err("No testcase data in device tree\n"); | 142 | pr_err("No testcase data in device tree\n"); |
@@ -154,6 +159,147 @@ static void __init of_selftest_property_match_string(void) | |||
154 | selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc); | 159 | selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc); |
155 | } | 160 | } |
156 | 161 | ||
162 | static void __init of_selftest_parse_interrupts(void) | ||
163 | { | ||
164 | struct device_node *np; | ||
165 | struct of_phandle_args args; | ||
166 | int i, rc; | ||
167 | |||
168 | np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); | ||
169 | if (!np) { | ||
170 | pr_err("missing testcase data\n"); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | for (i = 0; i < 4; i++) { | ||
175 | bool passed = true; | ||
176 | args.args_count = 0; | ||
177 | rc = of_irq_parse_one(np, i, &args); | ||
178 | |||
179 | passed &= !rc; | ||
180 | passed &= (args.args_count == 1); | ||
181 | passed &= (args.args[0] == (i + 1)); | ||
182 | |||
183 | selftest(passed, "index %i - data error on node %s rc=%i\n", | ||
184 | i, args.np->full_name, rc); | ||
185 | } | ||
186 | of_node_put(np); | ||
187 | |||
188 | np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); | ||
189 | if (!np) { | ||
190 | pr_err("missing testcase data\n"); | ||
191 | return; | ||
192 | } | ||
193 | |||
194 | for (i = 0; i < 4; i++) { | ||
195 | bool passed = true; | ||
196 | args.args_count = 0; | ||
197 | rc = of_irq_parse_one(np, i, &args); | ||
198 | |||
199 | /* Test the values from tests-phandle.dtsi */ | ||
200 | switch (i) { | ||
201 | case 0: | ||
202 | passed &= !rc; | ||
203 | passed &= (args.args_count == 1); | ||
204 | passed &= (args.args[0] == 9); | ||
205 | break; | ||
206 | case 1: | ||
207 | passed &= !rc; | ||
208 | passed &= (args.args_count == 3); | ||
209 | passed &= (args.args[0] == 10); | ||
210 | passed &= (args.args[1] == 11); | ||
211 | passed &= (args.args[2] == 12); | ||
212 | break; | ||
213 | case 2: | ||
214 | passed &= !rc; | ||
215 | passed &= (args.args_count == 2); | ||
216 | passed &= (args.args[0] == 13); | ||
217 | passed &= (args.args[1] == 14); | ||
218 | break; | ||
219 | case 3: | ||
220 | passed &= !rc; | ||
221 | passed &= (args.args_count == 2); | ||
222 | passed &= (args.args[0] == 15); | ||
223 | passed &= (args.args[1] == 16); | ||
224 | break; | ||
225 | default: | ||
226 | passed = false; | ||
227 | } | ||
228 | selftest(passed, "index %i - data error on node %s rc=%i\n", | ||
229 | i, args.np->full_name, rc); | ||
230 | } | ||
231 | of_node_put(np); | ||
232 | } | ||
233 | |||
234 | static void __init of_selftest_parse_interrupts_extended(void) | ||
235 | { | ||
236 | struct device_node *np; | ||
237 | struct of_phandle_args args; | ||
238 | int i, rc; | ||
239 | |||
240 | np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); | ||
241 | if (!np) { | ||
242 | pr_err("missing testcase data\n"); | ||
243 | return; | ||
244 | } | ||
245 | |||
246 | for (i = 0; i < 7; i++) { | ||
247 | bool passed = true; | ||
248 | rc = of_irq_parse_one(np, i, &args); | ||
249 | |||
250 | /* Test the values from tests-phandle.dtsi */ | ||
251 | switch (i) { | ||
252 | case 0: | ||
253 | passed &= !rc; | ||
254 | passed &= (args.args_count == 1); | ||
255 | passed &= (args.args[0] == 1); | ||
256 | break; | ||
257 | case 1: | ||
258 | passed &= !rc; | ||
259 | passed &= (args.args_count == 3); | ||
260 | passed &= (args.args[0] == 2); | ||
261 | passed &= (args.args[1] == 3); | ||
262 | passed &= (args.args[2] == 4); | ||
263 | break; | ||
264 | case 2: | ||
265 | passed &= !rc; | ||
266 | passed &= (args.args_count == 2); | ||
267 | passed &= (args.args[0] == 5); | ||
268 | passed &= (args.args[1] == 6); | ||
269 | break; | ||
270 | case 3: | ||
271 | passed &= !rc; | ||
272 | passed &= (args.args_count == 1); | ||
273 | passed &= (args.args[0] == 9); | ||
274 | break; | ||
275 | case 4: | ||
276 | passed &= !rc; | ||
277 | passed &= (args.args_count == 3); | ||
278 | passed &= (args.args[0] == 10); | ||
279 | passed &= (args.args[1] == 11); | ||
280 | passed &= (args.args[2] == 12); | ||
281 | break; | ||
282 | case 5: | ||
283 | passed &= !rc; | ||
284 | passed &= (args.args_count == 2); | ||
285 | passed &= (args.args[0] == 13); | ||
286 | passed &= (args.args[1] == 14); | ||
287 | break; | ||
288 | case 6: | ||
289 | passed &= !rc; | ||
290 | passed &= (args.args_count == 1); | ||
291 | passed &= (args.args[0] == 15); | ||
292 | break; | ||
293 | default: | ||
294 | passed = false; | ||
295 | } | ||
296 | |||
297 | selftest(passed, "index %i - data error on node %s rc=%i\n", | ||
298 | i, args.np->full_name, rc); | ||
299 | } | ||
300 | of_node_put(np); | ||
301 | } | ||
302 | |||
157 | static int __init of_selftest(void) | 303 | static int __init of_selftest(void) |
158 | { | 304 | { |
159 | struct device_node *np; | 305 | struct device_node *np; |
@@ -168,7 +314,10 @@ static int __init of_selftest(void) | |||
168 | pr_info("start of selftest - you will see error messages\n"); | 314 | pr_info("start of selftest - you will see error messages\n"); |
169 | of_selftest_parse_phandle_with_args(); | 315 | of_selftest_parse_phandle_with_args(); |
170 | of_selftest_property_match_string(); | 316 | of_selftest_property_match_string(); |
171 | pr_info("end of selftest - %s\n", selftest_passed ? "PASS" : "FAIL"); | 317 | of_selftest_parse_interrupts(); |
318 | of_selftest_parse_interrupts_extended(); | ||
319 | pr_info("end of selftest - %i passed, %i failed\n", | ||
320 | selftest_results.passed, selftest_results.failed); | ||
172 | return 0; | 321 | return 0; |
173 | } | 322 | } |
174 | late_initcall(of_selftest); | 323 | late_initcall(of_selftest); |
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 729d5a101d62..07ddb3a13c6e 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -645,19 +645,6 @@ static int __init mvebu_pcie_setup(int nr, struct pci_sys_data *sys) | |||
645 | return 1; | 645 | return 1; |
646 | } | 646 | } |
647 | 647 | ||
648 | static int __init mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
649 | { | ||
650 | struct of_irq oirq; | ||
651 | int ret; | ||
652 | |||
653 | ret = of_irq_map_pci(dev, &oirq); | ||
654 | if (ret) | ||
655 | return ret; | ||
656 | |||
657 | return irq_create_of_mapping(oirq.controller, oirq.specifier, | ||
658 | oirq.size); | ||
659 | } | ||
660 | |||
661 | static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys) | 648 | static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys) |
662 | { | 649 | { |
663 | struct mvebu_pcie *pcie = sys_to_pcie(sys); | 650 | struct mvebu_pcie *pcie = sys_to_pcie(sys); |
@@ -706,7 +693,7 @@ static void __init mvebu_pcie_enable(struct mvebu_pcie *pcie) | |||
706 | hw.private_data = (void **)&pcie; | 693 | hw.private_data = (void **)&pcie; |
707 | hw.setup = mvebu_pcie_setup; | 694 | hw.setup = mvebu_pcie_setup; |
708 | hw.scan = mvebu_pcie_scan_bus; | 695 | hw.scan = mvebu_pcie_scan_bus; |
709 | hw.map_irq = mvebu_pcie_map_irq; | 696 | hw.map_irq = of_irq_parse_and_map_pci; |
710 | hw.ops = &mvebu_pcie_ops; | 697 | hw.ops = &mvebu_pcie_ops; |
711 | hw.align_resource = mvebu_pcie_align_resource; | 698 | hw.align_resource = mvebu_pcie_align_resource; |
712 | 699 | ||
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index a138965c01cb..b8fcc38c0d11 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -490,7 +490,7 @@ exit: | |||
490 | * <devicename> <state> <pinname> are values that should match the pinctrl-maps | 490 | * <devicename> <state> <pinname> are values that should match the pinctrl-maps |
491 | * <newvalue> reflects the new config and is driver dependant | 491 | * <newvalue> reflects the new config and is driver dependant |
492 | */ | 492 | */ |
493 | static int pinconf_dbg_config_write(struct file *file, | 493 | static ssize_t pinconf_dbg_config_write(struct file *file, |
494 | const char __user *user_buf, size_t count, loff_t *ppos) | 494 | const char __user *user_buf, size_t count, loff_t *ppos) |
495 | { | 495 | { |
496 | struct pinctrl_maps *maps_node; | 496 | struct pinctrl_maps *maps_node; |
@@ -508,7 +508,7 @@ static int pinconf_dbg_config_write(struct file *file, | |||
508 | int i; | 508 | int i; |
509 | 509 | ||
510 | /* Get userspace string and assure termination */ | 510 | /* Get userspace string and assure termination */ |
511 | buf_size = min(count, (size_t)(sizeof(buf)-1)); | 511 | buf_size = min(count, sizeof(buf) - 1); |
512 | if (copy_from_user(buf, user_buf, buf_size)) | 512 | if (copy_from_user(buf, user_buf, buf_size)) |
513 | return -EFAULT; | 513 | return -EFAULT; |
514 | buf[buf_size] = 0; | 514 | buf[buf_size] = 0; |
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index 2689f8d01a1e..155b1b3a0e7a 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c | |||
@@ -663,18 +663,18 @@ static void exynos_pinctrl_resume(struct samsung_pinctrl_drv_data *drvdata) | |||
663 | /* pin banks of s5pv210 pin-controller */ | 663 | /* pin banks of s5pv210 pin-controller */ |
664 | static struct samsung_pin_bank s5pv210_pin_bank[] = { | 664 | static struct samsung_pin_bank s5pv210_pin_bank[] = { |
665 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), | 665 | EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00), |
666 | EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04), | 666 | EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpa1", 0x04), |
667 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08), | 667 | EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpb", 0x08), |
668 | EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c), | 668 | EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpc0", 0x0c), |
669 | EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10), | 669 | EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpc1", 0x10), |
670 | EXYNOS_PIN_BANK_EINTG(4, 0x0a0, "gpd0", 0x14), | 670 | EXYNOS_PIN_BANK_EINTG(4, 0x0a0, "gpd0", 0x14), |
671 | EXYNOS_PIN_BANK_EINTG(4, 0x0c0, "gpd1", 0x18), | 671 | EXYNOS_PIN_BANK_EINTG(6, 0x0c0, "gpd1", 0x18), |
672 | EXYNOS_PIN_BANK_EINTG(5, 0x0e0, "gpe0", 0x1c), | 672 | EXYNOS_PIN_BANK_EINTG(8, 0x0e0, "gpe0", 0x1c), |
673 | EXYNOS_PIN_BANK_EINTG(8, 0x100, "gpe1", 0x20), | 673 | EXYNOS_PIN_BANK_EINTG(5, 0x100, "gpe1", 0x20), |
674 | EXYNOS_PIN_BANK_EINTG(6, 0x120, "gpf0", 0x24), | 674 | EXYNOS_PIN_BANK_EINTG(8, 0x120, "gpf0", 0x24), |
675 | EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpf1", 0x28), | 675 | EXYNOS_PIN_BANK_EINTG(8, 0x140, "gpf1", 0x28), |
676 | EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpf2", 0x2c), | 676 | EXYNOS_PIN_BANK_EINTG(8, 0x160, "gpf2", 0x2c), |
677 | EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpf3", 0x30), | 677 | EXYNOS_PIN_BANK_EINTG(6, 0x180, "gpf3", 0x30), |
678 | EXYNOS_PIN_BANK_EINTG(7, 0x1a0, "gpg0", 0x34), | 678 | EXYNOS_PIN_BANK_EINTG(7, 0x1a0, "gpg0", 0x34), |
679 | EXYNOS_PIN_BANK_EINTG(7, 0x1c0, "gpg1", 0x38), | 679 | EXYNOS_PIN_BANK_EINTG(7, 0x1c0, "gpg1", 0x38), |
680 | EXYNOS_PIN_BANK_EINTG(7, 0x1e0, "gpg2", 0x3c), | 680 | EXYNOS_PIN_BANK_EINTG(7, 0x1e0, "gpg2", 0x3c), |
diff --git a/drivers/pinctrl/pinctrl-palmas.c b/drivers/pinctrl/pinctrl-palmas.c index 82638fac3cfa..30c4d356cb33 100644 --- a/drivers/pinctrl/pinctrl-palmas.c +++ b/drivers/pinctrl/pinctrl-palmas.c | |||
@@ -891,9 +891,10 @@ static int palmas_pinconf_set(struct pinctrl_dev *pctldev, | |||
891 | param = pinconf_to_config_param(configs[i]); | 891 | param = pinconf_to_config_param(configs[i]); |
892 | param_val = pinconf_to_config_argument(configs[i]); | 892 | param_val = pinconf_to_config_argument(configs[i]); |
893 | 893 | ||
894 | if (param == PIN_CONFIG_BIAS_PULL_PIN_DEFAULT) | ||
895 | continue; | ||
896 | |||
894 | switch (param) { | 897 | switch (param) { |
895 | case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: | ||
896 | return 0; | ||
897 | case PIN_CONFIG_BIAS_DISABLE: | 898 | case PIN_CONFIG_BIAS_DISABLE: |
898 | case PIN_CONFIG_BIAS_PULL_UP: | 899 | case PIN_CONFIG_BIAS_PULL_UP: |
899 | case PIN_CONFIG_BIAS_PULL_DOWN: | 900 | case PIN_CONFIG_BIAS_PULL_DOWN: |
diff --git a/drivers/pinctrl/pinctrl-tegra114.c b/drivers/pinctrl/pinctrl-tegra114.c index 622c4854977e..93c9e3899d5e 100644 --- a/drivers/pinctrl/pinctrl-tegra114.c +++ b/drivers/pinctrl/pinctrl-tegra114.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * Arthur: Pritesh Raithatha <praithatha@nvidia.com> | 6 | * Author: Pritesh Raithatha <praithatha@nvidia.com> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms and conditions of the GNU General Public License, | 9 | * under the terms and conditions of the GNU General Public License, |
@@ -2763,7 +2763,6 @@ static struct platform_driver tegra114_pinctrl_driver = { | |||
2763 | }; | 2763 | }; |
2764 | module_platform_driver(tegra114_pinctrl_driver); | 2764 | module_platform_driver(tegra114_pinctrl_driver); |
2765 | 2765 | ||
2766 | MODULE_ALIAS("platform:tegra114-pinctrl"); | ||
2767 | MODULE_AUTHOR("Pritesh Raithatha <praithatha@nvidia.com>"); | 2766 | MODULE_AUTHOR("Pritesh Raithatha <praithatha@nvidia.com>"); |
2768 | MODULE_DESCRIPTION("NVIDIA Tegra114 pincontrol driver"); | 2767 | MODULE_DESCRIPTION("NVIDIA Tegra114 pinctrl driver"); |
2769 | MODULE_LICENSE("GPL v2"); | 2768 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 1a7816390773..b9f2653e4ef9 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c | |||
@@ -709,7 +709,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt( | |||
709 | struct of_regulator_match **da9063_reg_matches) | 709 | struct of_regulator_match **da9063_reg_matches) |
710 | { | 710 | { |
711 | da9063_reg_matches = NULL; | 711 | da9063_reg_matches = NULL; |
712 | return PTR_ERR(-ENODEV); | 712 | return ERR_PTR(-ENODEV); |
713 | } | 713 | } |
714 | #endif | 714 | #endif |
715 | 715 | ||
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 488dfe7ce9a6..7e2b165972e6 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -201,13 +201,7 @@ static unsigned int palmas_smps_ramp_delay[4] = {0, 10000, 5000, 2500}; | |||
201 | #define SMPS_CTRL_MODE_ECO 0x02 | 201 | #define SMPS_CTRL_MODE_ECO 0x02 |
202 | #define SMPS_CTRL_MODE_PWM 0x03 | 202 | #define SMPS_CTRL_MODE_PWM 0x03 |
203 | 203 | ||
204 | /* These values are derived from the data sheet. And are the number of steps | 204 | #define PALMAS_SMPS_NUM_VOLTAGES 122 |
205 | * where there is a voltage change, the ranges at beginning and end of register | ||
206 | * max/min values where there are no change are ommitted. | ||
207 | * | ||
208 | * So they are basically (maxV-minV)/stepV | ||
209 | */ | ||
210 | #define PALMAS_SMPS_NUM_VOLTAGES 117 | ||
211 | #define PALMAS_SMPS10_NUM_VOLTAGES 2 | 205 | #define PALMAS_SMPS10_NUM_VOLTAGES 2 |
212 | #define PALMAS_LDO_NUM_VOLTAGES 50 | 206 | #define PALMAS_LDO_NUM_VOLTAGES 50 |
213 | 207 | ||
@@ -979,6 +973,7 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
979 | pmic->desc[id].min_uV = 900000; | 973 | pmic->desc[id].min_uV = 900000; |
980 | pmic->desc[id].uV_step = 50000; | 974 | pmic->desc[id].uV_step = 50000; |
981 | pmic->desc[id].linear_min_sel = 1; | 975 | pmic->desc[id].linear_min_sel = 1; |
976 | pmic->desc[id].enable_time = 500; | ||
982 | pmic->desc[id].vsel_reg = | 977 | pmic->desc[id].vsel_reg = |
983 | PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, | 978 | PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, |
984 | palmas_regs_info[id].vsel_addr); | 979 | palmas_regs_info[id].vsel_addr); |
@@ -997,6 +992,11 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
997 | pmic->desc[id].min_uV = 450000; | 992 | pmic->desc[id].min_uV = 450000; |
998 | pmic->desc[id].uV_step = 25000; | 993 | pmic->desc[id].uV_step = 25000; |
999 | } | 994 | } |
995 | |||
996 | /* LOD6 in vibrator mode will have enable time 2000us */ | ||
997 | if (pdata && pdata->ldo6_vibrator && | ||
998 | (id == PALMAS_REG_LDO6)) | ||
999 | pmic->desc[id].enable_time = 2000; | ||
1000 | } else { | 1000 | } else { |
1001 | pmic->desc[id].n_voltages = 1; | 1001 | pmic->desc[id].n_voltages = 1; |
1002 | pmic->desc[id].ops = &palmas_ops_extreg; | 1002 | pmic->desc[id].ops = &palmas_ops_extreg; |
diff --git a/drivers/regulator/ti-abb-regulator.c b/drivers/regulator/ti-abb-regulator.c index d8e3e1262bc2..20c271d49dcb 100644 --- a/drivers/regulator/ti-abb-regulator.c +++ b/drivers/regulator/ti-abb-regulator.c | |||
@@ -279,8 +279,12 @@ static int ti_abb_set_opp(struct regulator_dev *rdev, struct ti_abb *abb, | |||
279 | ti_abb_rmw(regs->opp_sel_mask, info->opp_sel, regs->control_reg, | 279 | ti_abb_rmw(regs->opp_sel_mask, info->opp_sel, regs->control_reg, |
280 | abb->base); | 280 | abb->base); |
281 | 281 | ||
282 | /* program LDO VBB vset override if needed */ | 282 | /* |
283 | if (abb->ldo_base) | 283 | * program LDO VBB vset override if needed for !bypass mode |
284 | * XXX: Do not switch sequence - for !bypass, LDO override reset *must* | ||
285 | * be performed *before* switch to bias mode else VBB glitches. | ||
286 | */ | ||
287 | if (abb->ldo_base && info->opp_sel != TI_ABB_NOMINAL_OPP) | ||
284 | ti_abb_program_ldovbb(dev, abb, info); | 288 | ti_abb_program_ldovbb(dev, abb, info); |
285 | 289 | ||
286 | /* Initiate ABB ldo change */ | 290 | /* Initiate ABB ldo change */ |
@@ -295,6 +299,14 @@ static int ti_abb_set_opp(struct regulator_dev *rdev, struct ti_abb *abb, | |||
295 | if (ret) | 299 | if (ret) |
296 | goto out; | 300 | goto out; |
297 | 301 | ||
302 | /* | ||
303 | * Reset LDO VBB vset override bypass mode | ||
304 | * XXX: Do not switch sequence - for bypass, LDO override reset *must* | ||
305 | * be performed *after* switch to bypass else VBB glitches. | ||
306 | */ | ||
307 | if (abb->ldo_base && info->opp_sel == TI_ABB_NOMINAL_OPP) | ||
308 | ti_abb_program_ldovbb(dev, abb, info); | ||
309 | |||
298 | out: | 310 | out: |
299 | return ret; | 311 | return ret; |
300 | } | 312 | } |
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index 1432b26ef2e9..2205fbc2c37b 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
@@ -63,7 +63,7 @@ static irqreturn_t wm831x_ldo_uv_irq(int irq, void *data) | |||
63 | */ | 63 | */ |
64 | 64 | ||
65 | static const struct regulator_linear_range wm831x_gp_ldo_ranges[] = { | 65 | static const struct regulator_linear_range wm831x_gp_ldo_ranges[] = { |
66 | { .min_uV = 900000, .max_uV = 1650000, .min_sel = 0, .max_sel = 14, | 66 | { .min_uV = 900000, .max_uV = 1600000, .min_sel = 0, .max_sel = 14, |
67 | .uV_step = 50000 }, | 67 | .uV_step = 50000 }, |
68 | { .min_uV = 1700000, .max_uV = 3300000, .min_sel = 15, .max_sel = 31, | 68 | { .min_uV = 1700000, .max_uV = 3300000, .min_sel = 15, .max_sel = 31, |
69 | .uV_step = 100000 }, | 69 | .uV_step = 100000 }, |
@@ -332,7 +332,7 @@ static struct platform_driver wm831x_gp_ldo_driver = { | |||
332 | */ | 332 | */ |
333 | 333 | ||
334 | static const struct regulator_linear_range wm831x_aldo_ranges[] = { | 334 | static const struct regulator_linear_range wm831x_aldo_ranges[] = { |
335 | { .min_uV = 1000000, .max_uV = 1650000, .min_sel = 0, .max_sel = 12, | 335 | { .min_uV = 1000000, .max_uV = 1600000, .min_sel = 0, .max_sel = 12, |
336 | .uV_step = 50000 }, | 336 | .uV_step = 50000 }, |
337 | { .min_uV = 1700000, .max_uV = 3500000, .min_sel = 13, .max_sel = 31, | 337 | { .min_uV = 1700000, .max_uV = 3500000, .min_sel = 13, .max_sel = 31, |
338 | .uV_step = 100000 }, | 338 | .uV_step = 100000 }, |
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 835b5f0f344e..61ca9292a429 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -543,7 +543,7 @@ static int wm8350_dcdc_set_suspend_mode(struct regulator_dev *rdev, | |||
543 | } | 543 | } |
544 | 544 | ||
545 | static const struct regulator_linear_range wm8350_ldo_ranges[] = { | 545 | static const struct regulator_linear_range wm8350_ldo_ranges[] = { |
546 | { .min_uV = 900000, .max_uV = 1750000, .min_sel = 0, .max_sel = 15, | 546 | { .min_uV = 900000, .max_uV = 1650000, .min_sel = 0, .max_sel = 15, |
547 | .uV_step = 50000 }, | 547 | .uV_step = 50000 }, |
548 | { .min_uV = 1800000, .max_uV = 3300000, .min_sel = 16, .max_sel = 31, | 548 | { .min_uV = 1800000, .max_uV = 3300000, .min_sel = 16, .max_sel = 31, |
549 | .uV_step = 100000 }, | 549 | .uV_step = 100000 }, |
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 8cd34bf644b3..77df9cb00688 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c | |||
@@ -145,9 +145,11 @@ bool __init sclp_has_linemode(void) | |||
145 | 145 | ||
146 | if (sccb->header.response_code != 0x20) | 146 | if (sccb->header.response_code != 0x20) |
147 | return 0; | 147 | return 0; |
148 | if (sccb->sclp_send_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK)) | 148 | if (!(sccb->sclp_send_mask & (EVTYP_OPCMD_MASK | EVTYP_PMSGCMD_MASK))) |
149 | return 1; | 149 | return 0; |
150 | return 0; | 150 | if (!(sccb->sclp_receive_mask & (EVTYP_MSG_MASK | EVTYP_PMSGCMD_MASK))) |
151 | return 0; | ||
152 | return 1; | ||
151 | } | 153 | } |
152 | 154 | ||
153 | bool __init sclp_has_vt220(void) | 155 | bool __init sclp_has_vt220(void) |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index a0f47c83fd62..3f4ca4e09a4c 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -810,7 +810,7 @@ static void tty3270_resize_work(struct work_struct *work) | |||
810 | struct winsize ws; | 810 | struct winsize ws; |
811 | 811 | ||
812 | screen = tty3270_alloc_screen(tp->n_rows, tp->n_cols); | 812 | screen = tty3270_alloc_screen(tp->n_rows, tp->n_cols); |
813 | if (!screen) | 813 | if (IS_ERR(screen)) |
814 | return; | 814 | return; |
815 | /* Switch to new output size */ | 815 | /* Switch to new output size */ |
816 | spin_lock_bh(&tp->view.lock); | 816 | spin_lock_bh(&tp->view.lock); |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index fd7cc566095a..d4ac60b4a56e 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -1583,7 +1583,7 @@ static int atmel_spi_probe(struct platform_device *pdev) | |||
1583 | /* Initialize the hardware */ | 1583 | /* Initialize the hardware */ |
1584 | ret = clk_prepare_enable(clk); | 1584 | ret = clk_prepare_enable(clk); |
1585 | if (ret) | 1585 | if (ret) |
1586 | goto out_unmap_regs; | 1586 | goto out_free_irq; |
1587 | spi_writel(as, CR, SPI_BIT(SWRST)); | 1587 | spi_writel(as, CR, SPI_BIT(SWRST)); |
1588 | spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ | 1588 | spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ |
1589 | if (as->caps.has_wdrbt) { | 1589 | if (as->caps.has_wdrbt) { |
@@ -1614,6 +1614,7 @@ out_free_dma: | |||
1614 | spi_writel(as, CR, SPI_BIT(SWRST)); | 1614 | spi_writel(as, CR, SPI_BIT(SWRST)); |
1615 | spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ | 1615 | spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ |
1616 | clk_disable_unprepare(clk); | 1616 | clk_disable_unprepare(clk); |
1617 | out_free_irq: | ||
1617 | free_irq(irq, master); | 1618 | free_irq(irq, master); |
1618 | out_unmap_regs: | 1619 | out_unmap_regs: |
1619 | iounmap(as->regs); | 1620 | iounmap(as->regs); |
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 5655acf55bfe..6416798828e7 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c | |||
@@ -226,7 +226,6 @@ static int spi_clps711x_probe(struct platform_device *pdev) | |||
226 | dev_name(&pdev->dev), hw); | 226 | dev_name(&pdev->dev), hw); |
227 | if (ret) { | 227 | if (ret) { |
228 | dev_err(&pdev->dev, "Can't request IRQ\n"); | 228 | dev_err(&pdev->dev, "Can't request IRQ\n"); |
229 | clk_put(hw->spi_clk); | ||
230 | goto clk_out; | 229 | goto clk_out; |
231 | } | 230 | } |
232 | 231 | ||
@@ -247,7 +246,6 @@ err_out: | |||
247 | gpio_free(hw->chipselect[i]); | 246 | gpio_free(hw->chipselect[i]); |
248 | 247 | ||
249 | spi_master_put(master); | 248 | spi_master_put(master); |
250 | kfree(master); | ||
251 | 249 | ||
252 | return ret; | 250 | return ret; |
253 | } | 251 | } |
@@ -263,7 +261,6 @@ static int spi_clps711x_remove(struct platform_device *pdev) | |||
263 | gpio_free(hw->chipselect[i]); | 261 | gpio_free(hw->chipselect[i]); |
264 | 262 | ||
265 | spi_unregister_master(master); | 263 | spi_unregister_master(master); |
266 | kfree(master); | ||
267 | 264 | ||
268 | return 0; | 265 | return 0; |
269 | } | 266 | } |
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 6cd07d13ecab..4e44575bd87a 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c | |||
@@ -476,15 +476,9 @@ static int dspi_probe(struct platform_device *pdev) | |||
476 | master->bus_num = bus_num; | 476 | master->bus_num = bus_num; |
477 | 477 | ||
478 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 478 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
479 | if (!res) { | ||
480 | dev_err(&pdev->dev, "can't get platform resource\n"); | ||
481 | ret = -EINVAL; | ||
482 | goto out_master_put; | ||
483 | } | ||
484 | |||
485 | dspi->base = devm_ioremap_resource(&pdev->dev, res); | 479 | dspi->base = devm_ioremap_resource(&pdev->dev, res); |
486 | if (!dspi->base) { | 480 | if (IS_ERR(dspi->base)) { |
487 | ret = -EINVAL; | 481 | ret = PTR_ERR(dspi->base); |
488 | goto out_master_put; | 482 | goto out_master_put; |
489 | } | 483 | } |
490 | 484 | ||
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index c1c936cf0ed4..84e342130a60 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -689,7 +689,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) | |||
689 | struct device_node *np = ofdev->dev.of_node; | 689 | struct device_node *np = ofdev->dev.of_node; |
690 | struct spi_master *master; | 690 | struct spi_master *master; |
691 | struct resource mem; | 691 | struct resource mem; |
692 | struct resource irq; | 692 | unsigned int irq; |
693 | int ret = -ENOMEM; | 693 | int ret = -ENOMEM; |
694 | 694 | ||
695 | ret = of_mpc8xxx_spi_probe(ofdev); | 695 | ret = of_mpc8xxx_spi_probe(ofdev); |
@@ -704,13 +704,13 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) | |||
704 | if (ret) | 704 | if (ret) |
705 | goto err; | 705 | goto err; |
706 | 706 | ||
707 | ret = of_irq_to_resource(np, 0, &irq); | 707 | irq = irq_of_parse_and_map(np, 0); |
708 | if (!ret) { | 708 | if (!ret) { |
709 | ret = -EINVAL; | 709 | ret = -EINVAL; |
710 | goto err; | 710 | goto err; |
711 | } | 711 | } |
712 | 712 | ||
713 | master = fsl_espi_probe(dev, &mem, irq.start); | 713 | master = fsl_espi_probe(dev, &mem, irq); |
714 | if (IS_ERR(master)) { | 714 | if (IS_ERR(master)) { |
715 | ret = PTR_ERR(master); | 715 | ret = PTR_ERR(master); |
716 | goto err; | 716 | goto err; |
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index 6148b1dae94c..8dcc1432f1f5 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c | |||
@@ -523,8 +523,10 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
523 | psc_num = master->bus_num; | 523 | psc_num = master->bus_num; |
524 | snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); | 524 | snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); |
525 | clk = devm_clk_get(dev, clk_name); | 525 | clk = devm_clk_get(dev, clk_name); |
526 | if (IS_ERR(clk)) | 526 | if (IS_ERR(clk)) { |
527 | ret = PTR_ERR(clk); | ||
527 | goto free_irq; | 528 | goto free_irq; |
529 | } | ||
528 | ret = clk_prepare_enable(clk); | 530 | ret = clk_prepare_enable(clk); |
529 | if (ret) | 531 | if (ret) |
530 | goto free_irq; | 532 | goto free_irq; |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 2eb06ee0b326..c1a50674c1e3 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -546,8 +546,17 @@ static irqreturn_t ssp_int(int irq, void *dev_id) | |||
546 | if (pm_runtime_suspended(&drv_data->pdev->dev)) | 546 | if (pm_runtime_suspended(&drv_data->pdev->dev)) |
547 | return IRQ_NONE; | 547 | return IRQ_NONE; |
548 | 548 | ||
549 | sccr1_reg = read_SSCR1(reg); | 549 | /* |
550 | * If the device is not yet in RPM suspended state and we get an | ||
551 | * interrupt that is meant for another device, check if status bits | ||
552 | * are all set to one. That means that the device is already | ||
553 | * powered off. | ||
554 | */ | ||
550 | status = read_SSSR(reg); | 555 | status = read_SSSR(reg); |
556 | if (status == ~0) | ||
557 | return IRQ_NONE; | ||
558 | |||
559 | sccr1_reg = read_SSCR1(reg); | ||
551 | 560 | ||
552 | /* Ignore possible writes if we don't need to write */ | 561 | /* Ignore possible writes if we don't need to write */ |
553 | if (!(sccr1_reg & SSCR1_TIE)) | 562 | if (!(sccr1_reg & SSCR1_TIE)) |
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 512b8893893b..a80376dc3a10 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
@@ -1428,6 +1428,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) | |||
1428 | S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, | 1428 | S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, |
1429 | sdd->regs + S3C64XX_SPI_INT_EN); | 1429 | sdd->regs + S3C64XX_SPI_INT_EN); |
1430 | 1430 | ||
1431 | pm_runtime_enable(&pdev->dev); | ||
1432 | |||
1431 | if (spi_register_master(master)) { | 1433 | if (spi_register_master(master)) { |
1432 | dev_err(&pdev->dev, "cannot register SPI master\n"); | 1434 | dev_err(&pdev->dev, "cannot register SPI master\n"); |
1433 | ret = -EBUSY; | 1435 | ret = -EBUSY; |
@@ -1440,8 +1442,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) | |||
1440 | mem_res, | 1442 | mem_res, |
1441 | sdd->rx_dma.dmach, sdd->tx_dma.dmach); | 1443 | sdd->rx_dma.dmach, sdd->tx_dma.dmach); |
1442 | 1444 | ||
1443 | pm_runtime_enable(&pdev->dev); | ||
1444 | |||
1445 | return 0; | 1445 | return 0; |
1446 | 1446 | ||
1447 | err3: | 1447 | err3: |
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 0b68cb592fa4..e488a90a98b8 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c | |||
@@ -296,6 +296,8 @@ static int hspi_probe(struct platform_device *pdev) | |||
296 | goto error1; | 296 | goto error1; |
297 | } | 297 | } |
298 | 298 | ||
299 | pm_runtime_enable(&pdev->dev); | ||
300 | |||
299 | master->num_chipselect = 1; | 301 | master->num_chipselect = 1; |
300 | master->bus_num = pdev->id; | 302 | master->bus_num = pdev->id; |
301 | master->setup = hspi_setup; | 303 | master->setup = hspi_setup; |
@@ -309,8 +311,6 @@ static int hspi_probe(struct platform_device *pdev) | |||
309 | goto error1; | 311 | goto error1; |
310 | } | 312 | } |
311 | 313 | ||
312 | pm_runtime_enable(&pdev->dev); | ||
313 | |||
314 | return 0; | 314 | return 0; |
315 | 315 | ||
316 | error1: | 316 | error1: |
diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 3ba4c5712dff..853f62b2b1a9 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c | |||
@@ -369,28 +369,23 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, | |||
369 | { | 369 | { |
370 | const struct ni_65xx_board *board = comedi_board(dev); | 370 | const struct ni_65xx_board *board = comedi_board(dev); |
371 | struct ni_65xx_private *devpriv = dev->private; | 371 | struct ni_65xx_private *devpriv = dev->private; |
372 | unsigned base_bitfield_channel; | 372 | int base_bitfield_channel; |
373 | const unsigned max_ports_per_bitfield = 5; | ||
374 | unsigned read_bits = 0; | 373 | unsigned read_bits = 0; |
375 | unsigned j; | 374 | int last_port_offset = ni_65xx_port_by_channel(s->n_chan - 1); |
375 | int port_offset; | ||
376 | 376 | ||
377 | base_bitfield_channel = CR_CHAN(insn->chanspec); | 377 | base_bitfield_channel = CR_CHAN(insn->chanspec); |
378 | for (j = 0; j < max_ports_per_bitfield; ++j) { | 378 | for (port_offset = ni_65xx_port_by_channel(base_bitfield_channel); |
379 | const unsigned port_offset = | 379 | port_offset <= last_port_offset; port_offset++) { |
380 | ni_65xx_port_by_channel(base_bitfield_channel) + j; | 380 | unsigned port = sprivate(s)->base_port + port_offset; |
381 | const unsigned port = | 381 | int base_port_channel = port_offset * ni_65xx_channels_per_port; |
382 | sprivate(s)->base_port + port_offset; | ||
383 | unsigned base_port_channel; | ||
384 | unsigned port_mask, port_data, port_read_bits; | 382 | unsigned port_mask, port_data, port_read_bits; |
385 | int bitshift; | 383 | int bitshift = base_port_channel - base_bitfield_channel; |
386 | if (port >= ni_65xx_total_num_ports(board)) | 384 | |
385 | if (bitshift >= 32) | ||
387 | break; | 386 | break; |
388 | base_port_channel = port_offset * ni_65xx_channels_per_port; | ||
389 | port_mask = data[0]; | 387 | port_mask = data[0]; |
390 | port_data = data[1]; | 388 | port_data = data[1]; |
391 | bitshift = base_port_channel - base_bitfield_channel; | ||
392 | if (bitshift >= 32 || bitshift <= -32) | ||
393 | break; | ||
394 | if (bitshift > 0) { | 389 | if (bitshift > 0) { |
395 | port_mask >>= bitshift; | 390 | port_mask >>= bitshift; |
396 | port_data >>= bitshift; | 391 | port_data >>= bitshift; |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 35b61f7d6c63..38e44b9abf0f 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -753,7 +753,8 @@ static void iscsit_unmap_iovec(struct iscsi_cmd *cmd) | |||
753 | 753 | ||
754 | static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn) | 754 | static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn) |
755 | { | 755 | { |
756 | struct iscsi_cmd *cmd; | 756 | LIST_HEAD(ack_list); |
757 | struct iscsi_cmd *cmd, *cmd_p; | ||
757 | 758 | ||
758 | conn->exp_statsn = exp_statsn; | 759 | conn->exp_statsn = exp_statsn; |
759 | 760 | ||
@@ -761,19 +762,23 @@ static void iscsit_ack_from_expstatsn(struct iscsi_conn *conn, u32 exp_statsn) | |||
761 | return; | 762 | return; |
762 | 763 | ||
763 | spin_lock_bh(&conn->cmd_lock); | 764 | spin_lock_bh(&conn->cmd_lock); |
764 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { | 765 | list_for_each_entry_safe(cmd, cmd_p, &conn->conn_cmd_list, i_conn_node) { |
765 | spin_lock(&cmd->istate_lock); | 766 | spin_lock(&cmd->istate_lock); |
766 | if ((cmd->i_state == ISTATE_SENT_STATUS) && | 767 | if ((cmd->i_state == ISTATE_SENT_STATUS) && |
767 | iscsi_sna_lt(cmd->stat_sn, exp_statsn)) { | 768 | iscsi_sna_lt(cmd->stat_sn, exp_statsn)) { |
768 | cmd->i_state = ISTATE_REMOVE; | 769 | cmd->i_state = ISTATE_REMOVE; |
769 | spin_unlock(&cmd->istate_lock); | 770 | spin_unlock(&cmd->istate_lock); |
770 | iscsit_add_cmd_to_immediate_queue(cmd, conn, | 771 | list_move_tail(&cmd->i_conn_node, &ack_list); |
771 | cmd->i_state); | ||
772 | continue; | 772 | continue; |
773 | } | 773 | } |
774 | spin_unlock(&cmd->istate_lock); | 774 | spin_unlock(&cmd->istate_lock); |
775 | } | 775 | } |
776 | spin_unlock_bh(&conn->cmd_lock); | 776 | spin_unlock_bh(&conn->cmd_lock); |
777 | |||
778 | list_for_each_entry_safe(cmd, cmd_p, &ack_list, i_conn_node) { | ||
779 | list_del(&cmd->i_conn_node); | ||
780 | iscsit_free_cmd(cmd, false); | ||
781 | } | ||
777 | } | 782 | } |
778 | 783 | ||
779 | static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd) | 784 | static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd) |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 14d1aed5af1d..ef6d836a4d09 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -1192,7 +1192,7 @@ get_target: | |||
1192 | */ | 1192 | */ |
1193 | alloc_tags: | 1193 | alloc_tags: |
1194 | tag_num = max_t(u32, ISCSIT_MIN_TAGS, queue_depth); | 1194 | tag_num = max_t(u32, ISCSIT_MIN_TAGS, queue_depth); |
1195 | tag_num += ISCSIT_EXTRA_TAGS; | 1195 | tag_num += (tag_num / 2) + ISCSIT_EXTRA_TAGS; |
1196 | tag_size = sizeof(struct iscsi_cmd) + conn->conn_transport->priv_size; | 1196 | tag_size = sizeof(struct iscsi_cmd) + conn->conn_transport->priv_size; |
1197 | 1197 | ||
1198 | ret = transport_alloc_session_tags(sess->se_sess, tag_num, tag_size); | 1198 | ret = transport_alloc_session_tags(sess->se_sess, tag_num, tag_size); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index f2de28e178fd..b0cac0c342e1 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -736,7 +736,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) | |||
736 | * Fallthrough | 736 | * Fallthrough |
737 | */ | 737 | */ |
738 | case ISCSI_OP_SCSI_TMFUNC: | 738 | case ISCSI_OP_SCSI_TMFUNC: |
739 | rc = transport_generic_free_cmd(&cmd->se_cmd, 1); | 739 | rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); |
740 | if (!rc && shutdown && se_cmd && se_cmd->se_sess) { | 740 | if (!rc && shutdown && se_cmd && se_cmd->se_sess) { |
741 | __iscsit_free_cmd(cmd, true, shutdown); | 741 | __iscsit_free_cmd(cmd, true, shutdown); |
742 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); | 742 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); |
@@ -752,7 +752,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) | |||
752 | se_cmd = &cmd->se_cmd; | 752 | se_cmd = &cmd->se_cmd; |
753 | __iscsit_free_cmd(cmd, true, shutdown); | 753 | __iscsit_free_cmd(cmd, true, shutdown); |
754 | 754 | ||
755 | rc = transport_generic_free_cmd(&cmd->se_cmd, 1); | 755 | rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); |
756 | if (!rc && shutdown && se_cmd->se_sess) { | 756 | if (!rc && shutdown && se_cmd->se_sess) { |
757 | __iscsit_free_cmd(cmd, true, shutdown); | 757 | __iscsit_free_cmd(cmd, true, shutdown); |
758 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); | 758 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 6c17295e8d7c..4714c6f8da4b 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -349,7 +349,16 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd) | |||
349 | { | 349 | { |
350 | struct se_device *dev = cmd->se_dev; | 350 | struct se_device *dev = cmd->se_dev; |
351 | 351 | ||
352 | cmd->se_cmd_flags |= SCF_COMPARE_AND_WRITE_POST; | 352 | /* |
353 | * Only set SCF_COMPARE_AND_WRITE_POST to force a response fall-through | ||
354 | * within target_complete_ok_work() if the command was successfully | ||
355 | * sent to the backend driver. | ||
356 | */ | ||
357 | spin_lock_irq(&cmd->t_state_lock); | ||
358 | if ((cmd->transport_state & CMD_T_SENT) && !cmd->scsi_status) | ||
359 | cmd->se_cmd_flags |= SCF_COMPARE_AND_WRITE_POST; | ||
360 | spin_unlock_irq(&cmd->t_state_lock); | ||
361 | |||
353 | /* | 362 | /* |
354 | * Unlock ->caw_sem originally obtained during sbc_compare_and_write() | 363 | * Unlock ->caw_sem originally obtained during sbc_compare_and_write() |
355 | * before the original READ I/O submission. | 364 | * before the original READ I/O submission. |
@@ -363,7 +372,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd) | |||
363 | { | 372 | { |
364 | struct se_device *dev = cmd->se_dev; | 373 | struct se_device *dev = cmd->se_dev; |
365 | struct scatterlist *write_sg = NULL, *sg; | 374 | struct scatterlist *write_sg = NULL, *sg; |
366 | unsigned char *buf, *addr; | 375 | unsigned char *buf = NULL, *addr; |
367 | struct sg_mapping_iter m; | 376 | struct sg_mapping_iter m; |
368 | unsigned int offset = 0, len; | 377 | unsigned int offset = 0, len; |
369 | unsigned int nlbas = cmd->t_task_nolb; | 378 | unsigned int nlbas = cmd->t_task_nolb; |
@@ -378,6 +387,15 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd) | |||
378 | */ | 387 | */ |
379 | if (!cmd->t_data_sg || !cmd->t_bidi_data_sg) | 388 | if (!cmd->t_data_sg || !cmd->t_bidi_data_sg) |
380 | return TCM_NO_SENSE; | 389 | return TCM_NO_SENSE; |
390 | /* | ||
391 | * Immediately exit + release dev->caw_sem if command has already | ||
392 | * been failed with a non-zero SCSI status. | ||
393 | */ | ||
394 | if (cmd->scsi_status) { | ||
395 | pr_err("compare_and_write_callback: non zero scsi_status:" | ||
396 | " 0x%02x\n", cmd->scsi_status); | ||
397 | goto out; | ||
398 | } | ||
381 | 399 | ||
382 | buf = kzalloc(cmd->data_length, GFP_KERNEL); | 400 | buf = kzalloc(cmd->data_length, GFP_KERNEL); |
383 | if (!buf) { | 401 | if (!buf) { |
@@ -508,6 +526,12 @@ sbc_compare_and_write(struct se_cmd *cmd) | |||
508 | cmd->transport_complete_callback = NULL; | 526 | cmd->transport_complete_callback = NULL; |
509 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 527 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
510 | } | 528 | } |
529 | /* | ||
530 | * Reset cmd->data_length to individual block_size in order to not | ||
531 | * confuse backend drivers that depend on this value matching the | ||
532 | * size of the I/O being submitted. | ||
533 | */ | ||
534 | cmd->data_length = cmd->t_task_nolb * dev->dev_attrib.block_size; | ||
511 | 535 | ||
512 | ret = cmd->execute_rw(cmd, cmd->t_bidi_data_sg, cmd->t_bidi_data_nents, | 536 | ret = cmd->execute_rw(cmd, cmd->t_bidi_data_sg, cmd->t_bidi_data_nents, |
513 | DMA_FROM_DEVICE); | 537 | DMA_FROM_DEVICE); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 84747cc1aac0..81e945eefbbd 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -236,17 +236,24 @@ int transport_alloc_session_tags(struct se_session *se_sess, | |||
236 | { | 236 | { |
237 | int rc; | 237 | int rc; |
238 | 238 | ||
239 | se_sess->sess_cmd_map = kzalloc(tag_num * tag_size, GFP_KERNEL); | 239 | se_sess->sess_cmd_map = kzalloc(tag_num * tag_size, |
240 | GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); | ||
240 | if (!se_sess->sess_cmd_map) { | 241 | if (!se_sess->sess_cmd_map) { |
241 | pr_err("Unable to allocate se_sess->sess_cmd_map\n"); | 242 | se_sess->sess_cmd_map = vzalloc(tag_num * tag_size); |
242 | return -ENOMEM; | 243 | if (!se_sess->sess_cmd_map) { |
244 | pr_err("Unable to allocate se_sess->sess_cmd_map\n"); | ||
245 | return -ENOMEM; | ||
246 | } | ||
243 | } | 247 | } |
244 | 248 | ||
245 | rc = percpu_ida_init(&se_sess->sess_tag_pool, tag_num); | 249 | rc = percpu_ida_init(&se_sess->sess_tag_pool, tag_num); |
246 | if (rc < 0) { | 250 | if (rc < 0) { |
247 | pr_err("Unable to init se_sess->sess_tag_pool," | 251 | pr_err("Unable to init se_sess->sess_tag_pool," |
248 | " tag_num: %u\n", tag_num); | 252 | " tag_num: %u\n", tag_num); |
249 | kfree(se_sess->sess_cmd_map); | 253 | if (is_vmalloc_addr(se_sess->sess_cmd_map)) |
254 | vfree(se_sess->sess_cmd_map); | ||
255 | else | ||
256 | kfree(se_sess->sess_cmd_map); | ||
250 | se_sess->sess_cmd_map = NULL; | 257 | se_sess->sess_cmd_map = NULL; |
251 | return -ENOMEM; | 258 | return -ENOMEM; |
252 | } | 259 | } |
@@ -412,7 +419,10 @@ void transport_free_session(struct se_session *se_sess) | |||
412 | { | 419 | { |
413 | if (se_sess->sess_cmd_map) { | 420 | if (se_sess->sess_cmd_map) { |
414 | percpu_ida_destroy(&se_sess->sess_tag_pool); | 421 | percpu_ida_destroy(&se_sess->sess_tag_pool); |
415 | kfree(se_sess->sess_cmd_map); | 422 | if (is_vmalloc_addr(se_sess->sess_cmd_map)) |
423 | vfree(se_sess->sess_cmd_map); | ||
424 | else | ||
425 | kfree(se_sess->sess_cmd_map); | ||
416 | } | 426 | } |
417 | kmem_cache_free(se_sess_cache, se_sess); | 427 | kmem_cache_free(se_sess_cache, se_sess); |
418 | } | 428 | } |
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 4d22e7d2adca..3da4fd10b9f8 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c | |||
@@ -298,8 +298,8 @@ static int target_xcopy_parse_segdesc_02(struct se_cmd *se_cmd, struct xcopy_op | |||
298 | (unsigned long long)xop->dst_lba); | 298 | (unsigned long long)xop->dst_lba); |
299 | 299 | ||
300 | if (dc != 0) { | 300 | if (dc != 0) { |
301 | xop->dbl = (desc[29] << 16) & 0xff; | 301 | xop->dbl = (desc[29] & 0xff) << 16; |
302 | xop->dbl |= (desc[30] << 8) & 0xff; | 302 | xop->dbl |= (desc[30] & 0xff) << 8; |
303 | xop->dbl |= desc[31] & 0xff; | 303 | xop->dbl |= desc[31] & 0xff; |
304 | 304 | ||
305 | pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl); | 305 | pr_debug("XCOPY seg desc 0x02: DC=1 w/ dbl: %u\n", xop->dbl); |
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index e61c36cbb866..c193af6a628f 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c | |||
@@ -636,6 +636,7 @@ struct console xenboot_console = { | |||
636 | .name = "xenboot", | 636 | .name = "xenboot", |
637 | .write = xenboot_write_console, | 637 | .write = xenboot_write_console, |
638 | .flags = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME, | 638 | .flags = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME, |
639 | .index = -1, | ||
639 | }; | 640 | }; |
640 | #endif /* CONFIG_EARLY_PRINTK */ | 641 | #endif /* CONFIG_EARLY_PRINTK */ |
641 | 642 | ||
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 01bf5eb4f238..7a744b69c3d1 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -2183,28 +2183,34 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, | |||
2183 | 2183 | ||
2184 | if (!input_available_p(tty, 0)) { | 2184 | if (!input_available_p(tty, 0)) { |
2185 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { | 2185 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) { |
2186 | retval = -EIO; | 2186 | up_read(&tty->termios_rwsem); |
2187 | break; | 2187 | tty_flush_to_ldisc(tty); |
2188 | } | 2188 | down_read(&tty->termios_rwsem); |
2189 | if (tty_hung_up_p(file)) | 2189 | if (!input_available_p(tty, 0)) { |
2190 | break; | 2190 | retval = -EIO; |
2191 | if (!timeout) | 2191 | break; |
2192 | break; | 2192 | } |
2193 | if (file->f_flags & O_NONBLOCK) { | 2193 | } else { |
2194 | retval = -EAGAIN; | 2194 | if (tty_hung_up_p(file)) |
2195 | break; | 2195 | break; |
2196 | } | 2196 | if (!timeout) |
2197 | if (signal_pending(current)) { | 2197 | break; |
2198 | retval = -ERESTARTSYS; | 2198 | if (file->f_flags & O_NONBLOCK) { |
2199 | break; | 2199 | retval = -EAGAIN; |
2200 | } | 2200 | break; |
2201 | n_tty_set_room(tty); | 2201 | } |
2202 | up_read(&tty->termios_rwsem); | 2202 | if (signal_pending(current)) { |
2203 | retval = -ERESTARTSYS; | ||
2204 | break; | ||
2205 | } | ||
2206 | n_tty_set_room(tty); | ||
2207 | up_read(&tty->termios_rwsem); | ||
2203 | 2208 | ||
2204 | timeout = schedule_timeout(timeout); | 2209 | timeout = schedule_timeout(timeout); |
2205 | 2210 | ||
2206 | down_read(&tty->termios_rwsem); | 2211 | down_read(&tty->termios_rwsem); |
2207 | continue; | 2212 | continue; |
2213 | } | ||
2208 | } | 2214 | } |
2209 | __set_current_state(TASK_RUNNING); | 2215 | __set_current_state(TASK_RUNNING); |
2210 | 2216 | ||
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c index 9f7ba6d8750a..7d76214612c7 100644 --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c | |||
@@ -1209,7 +1209,7 @@ static int cpm_uart_init_port(struct device_node *np, | |||
1209 | pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; | 1209 | pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; |
1210 | spin_lock_init(&pinfo->port.lock); | 1210 | spin_lock_init(&pinfo->port.lock); |
1211 | 1211 | ||
1212 | pinfo->port.irq = of_irq_to_resource(np, 0, NULL); | 1212 | pinfo->port.irq = irq_of_parse_and_map(np, 0); |
1213 | if (pinfo->port.irq == NO_IRQ) { | 1213 | if (pinfo->port.irq == NO_IRQ) { |
1214 | ret = -EINVAL; | 1214 | ret = -EINVAL; |
1215 | goto out_pram; | 1215 | goto out_pram; |
diff --git a/drivers/usb/chipidea/ci_hdrc_pci.c b/drivers/usb/chipidea/ci_hdrc_pci.c index 042320a6c6c7..d514332ac081 100644 --- a/drivers/usb/chipidea/ci_hdrc_pci.c +++ b/drivers/usb/chipidea/ci_hdrc_pci.c | |||
@@ -129,7 +129,12 @@ static DEFINE_PCI_DEVICE_TABLE(ci_hdrc_pci_id_table) = { | |||
129 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0829), | 129 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0829), |
130 | .driver_data = (kernel_ulong_t)&penwell_pci_platdata, | 130 | .driver_data = (kernel_ulong_t)&penwell_pci_platdata, |
131 | }, | 131 | }, |
132 | { 0, 0, 0, 0, 0, 0, 0 /* end: all zeroes */ } | 132 | { |
133 | /* Intel Clovertrail */ | ||
134 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xe006), | ||
135 | .driver_data = (kernel_ulong_t)&penwell_pci_platdata, | ||
136 | }, | ||
137 | { 0 } /* end: all zeroes */ | ||
133 | }; | 138 | }; |
134 | MODULE_DEVICE_TABLE(pci, ci_hdrc_pci_id_table); | 139 | MODULE_DEVICE_TABLE(pci, ci_hdrc_pci_id_table); |
135 | 140 | ||
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 0658908d8968..44cf775a8627 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -2256,6 +2256,8 @@ static int ffs_func_bind(struct usb_configuration *c, | |||
2256 | data->raw_descs + ret, | 2256 | data->raw_descs + ret, |
2257 | (sizeof data->raw_descs) - ret, | 2257 | (sizeof data->raw_descs) - ret, |
2258 | __ffs_func_bind_do_descs, func); | 2258 | __ffs_func_bind_do_descs, func); |
2259 | if (unlikely(ret < 0)) | ||
2260 | goto error; | ||
2259 | } | 2261 | } |
2260 | 2262 | ||
2261 | /* | 2263 | /* |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index cc9207473dbc..0ac6064aa3b8 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -2054,7 +2054,7 @@ static struct pxa25x_udc memory = { | |||
2054 | /* | 2054 | /* |
2055 | * probe - binds to the platform device | 2055 | * probe - binds to the platform device |
2056 | */ | 2056 | */ |
2057 | static int __init pxa25x_udc_probe(struct platform_device *pdev) | 2057 | static int pxa25x_udc_probe(struct platform_device *pdev) |
2058 | { | 2058 | { |
2059 | struct pxa25x_udc *dev = &memory; | 2059 | struct pxa25x_udc *dev = &memory; |
2060 | int retval, irq; | 2060 | int retval, irq; |
@@ -2203,7 +2203,7 @@ static void pxa25x_udc_shutdown(struct platform_device *_dev) | |||
2203 | pullup_off(); | 2203 | pullup_off(); |
2204 | } | 2204 | } |
2205 | 2205 | ||
2206 | static int __exit pxa25x_udc_remove(struct platform_device *pdev) | 2206 | static int pxa25x_udc_remove(struct platform_device *pdev) |
2207 | { | 2207 | { |
2208 | struct pxa25x_udc *dev = platform_get_drvdata(pdev); | 2208 | struct pxa25x_udc *dev = platform_get_drvdata(pdev); |
2209 | 2209 | ||
@@ -2294,7 +2294,8 @@ static int pxa25x_udc_resume(struct platform_device *dev) | |||
2294 | 2294 | ||
2295 | static struct platform_driver udc_driver = { | 2295 | static struct platform_driver udc_driver = { |
2296 | .shutdown = pxa25x_udc_shutdown, | 2296 | .shutdown = pxa25x_udc_shutdown, |
2297 | .remove = __exit_p(pxa25x_udc_remove), | 2297 | .probe = pxa25x_udc_probe, |
2298 | .remove = pxa25x_udc_remove, | ||
2298 | .suspend = pxa25x_udc_suspend, | 2299 | .suspend = pxa25x_udc_suspend, |
2299 | .resume = pxa25x_udc_resume, | 2300 | .resume = pxa25x_udc_resume, |
2300 | .driver = { | 2301 | .driver = { |
@@ -2303,7 +2304,7 @@ static struct platform_driver udc_driver = { | |||
2303 | }, | 2304 | }, |
2304 | }; | 2305 | }; |
2305 | 2306 | ||
2306 | module_platform_driver_probe(udc_driver, pxa25x_udc_probe); | 2307 | module_platform_driver(udc_driver); |
2307 | 2308 | ||
2308 | MODULE_DESCRIPTION(DRIVER_DESC); | 2309 | MODULE_DESCRIPTION(DRIVER_DESC); |
2309 | MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); | 2310 | MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 6bddf1aa2347..a8a99e4748d5 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -543,7 +543,7 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg, | |||
543 | * FIFO, requests of >512 cause the endpoint to get stuck with a | 543 | * FIFO, requests of >512 cause the endpoint to get stuck with a |
544 | * fragment of the end of the transfer in it. | 544 | * fragment of the end of the transfer in it. |
545 | */ | 545 | */ |
546 | if (can_write > 512) | 546 | if (can_write > 512 && !periodic) |
547 | can_write = 512; | 547 | can_write = 512; |
548 | 548 | ||
549 | /* | 549 | /* |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 4047cbb91bac..bd4138d80a48 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -535,6 +535,9 @@ static int dsps_probe(struct platform_device *pdev) | |||
535 | struct dsps_glue *glue; | 535 | struct dsps_glue *glue; |
536 | int ret; | 536 | int ret; |
537 | 537 | ||
538 | if (!strcmp(pdev->name, "musb-hdrc")) | ||
539 | return -ENODEV; | ||
540 | |||
538 | match = of_match_node(musb_dsps_of_match, pdev->dev.of_node); | 541 | match = of_match_node(musb_dsps_of_match, pdev->dev.of_node); |
539 | if (!match) { | 542 | if (!match) { |
540 | dev_err(&pdev->dev, "fail to get matching of_match struct\n"); | 543 | dev_err(&pdev->dev, "fail to get matching of_match struct\n"); |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 9a08679d204d..b19ed213ab85 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1790,6 +1790,10 @@ int musb_gadget_setup(struct musb *musb) | |||
1790 | musb->g.max_speed = USB_SPEED_HIGH; | 1790 | musb->g.max_speed = USB_SPEED_HIGH; |
1791 | musb->g.speed = USB_SPEED_UNKNOWN; | 1791 | musb->g.speed = USB_SPEED_UNKNOWN; |
1792 | 1792 | ||
1793 | MUSB_DEV_MODE(musb); | ||
1794 | musb->xceiv->otg->default_a = 0; | ||
1795 | musb->xceiv->state = OTG_STATE_B_IDLE; | ||
1796 | |||
1793 | /* this "gadget" abstracts/virtualizes the controller */ | 1797 | /* this "gadget" abstracts/virtualizes the controller */ |
1794 | musb->g.name = musb_driver_name; | 1798 | musb->g.name = musb_driver_name; |
1795 | musb->g.is_otg = 1; | 1799 | musb->g.is_otg = 1; |
@@ -1849,7 +1853,6 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
1849 | musb->gadget_driver = driver; | 1853 | musb->gadget_driver = driver; |
1850 | 1854 | ||
1851 | spin_lock_irqsave(&musb->lock, flags); | 1855 | spin_lock_irqsave(&musb->lock, flags); |
1852 | musb->is_active = 1; | ||
1853 | 1856 | ||
1854 | otg_set_peripheral(otg, &musb->g); | 1857 | otg_set_peripheral(otg, &musb->g); |
1855 | musb->xceiv->state = OTG_STATE_B_IDLE; | 1858 | musb->xceiv->state = OTG_STATE_B_IDLE; |
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c index b2f29c9aebbf..02799a5efcd4 100644 --- a/drivers/usb/phy/phy-gpio-vbus-usb.c +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c | |||
@@ -241,7 +241,7 @@ static int gpio_vbus_set_suspend(struct usb_phy *phy, int suspend) | |||
241 | 241 | ||
242 | /* platform driver interface */ | 242 | /* platform driver interface */ |
243 | 243 | ||
244 | static int __init gpio_vbus_probe(struct platform_device *pdev) | 244 | static int gpio_vbus_probe(struct platform_device *pdev) |
245 | { | 245 | { |
246 | struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev); | 246 | struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev); |
247 | struct gpio_vbus_data *gpio_vbus; | 247 | struct gpio_vbus_data *gpio_vbus; |
@@ -349,7 +349,7 @@ err_gpio: | |||
349 | return err; | 349 | return err; |
350 | } | 350 | } |
351 | 351 | ||
352 | static int __exit gpio_vbus_remove(struct platform_device *pdev) | 352 | static int gpio_vbus_remove(struct platform_device *pdev) |
353 | { | 353 | { |
354 | struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev); | 354 | struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev); |
355 | struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev); | 355 | struct gpio_vbus_mach_info *pdata = dev_get_platdata(&pdev->dev); |
@@ -398,8 +398,6 @@ static const struct dev_pm_ops gpio_vbus_dev_pm_ops = { | |||
398 | }; | 398 | }; |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | /* NOTE: the gpio-vbus device may *NOT* be hotplugged */ | ||
402 | |||
403 | MODULE_ALIAS("platform:gpio-vbus"); | 401 | MODULE_ALIAS("platform:gpio-vbus"); |
404 | 402 | ||
405 | static struct platform_driver gpio_vbus_driver = { | 403 | static struct platform_driver gpio_vbus_driver = { |
@@ -410,10 +408,11 @@ static struct platform_driver gpio_vbus_driver = { | |||
410 | .pm = &gpio_vbus_dev_pm_ops, | 408 | .pm = &gpio_vbus_dev_pm_ops, |
411 | #endif | 409 | #endif |
412 | }, | 410 | }, |
413 | .remove = __exit_p(gpio_vbus_remove), | 411 | .probe = gpio_vbus_probe, |
412 | .remove = gpio_vbus_remove, | ||
414 | }; | 413 | }; |
415 | 414 | ||
416 | module_platform_driver_probe(gpio_vbus_driver, gpio_vbus_probe); | 415 | module_platform_driver(gpio_vbus_driver); |
417 | 416 | ||
418 | MODULE_DESCRIPTION("simple GPIO controlled OTG transceiver driver"); | 417 | MODULE_DESCRIPTION("simple GPIO controlled OTG transceiver driver"); |
419 | MODULE_AUTHOR("Philipp Zabel"); | 418 | MODULE_AUTHOR("Philipp Zabel"); |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 1cf6f125f5f0..80a7104d5ddb 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -81,6 +81,7 @@ static void option_instat_callback(struct urb *urb); | |||
81 | 81 | ||
82 | #define HUAWEI_VENDOR_ID 0x12D1 | 82 | #define HUAWEI_VENDOR_ID 0x12D1 |
83 | #define HUAWEI_PRODUCT_E173 0x140C | 83 | #define HUAWEI_PRODUCT_E173 0x140C |
84 | #define HUAWEI_PRODUCT_E1750 0x1406 | ||
84 | #define HUAWEI_PRODUCT_K4505 0x1464 | 85 | #define HUAWEI_PRODUCT_K4505 0x1464 |
85 | #define HUAWEI_PRODUCT_K3765 0x1465 | 86 | #define HUAWEI_PRODUCT_K3765 0x1465 |
86 | #define HUAWEI_PRODUCT_K4605 0x14C6 | 87 | #define HUAWEI_PRODUCT_K4605 0x14C6 |
@@ -567,6 +568,8 @@ static const struct usb_device_id option_ids[] = { | |||
567 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, | 568 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, |
568 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), | 569 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), |
569 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, | 570 | .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, |
571 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1750, 0xff, 0xff, 0xff), | ||
572 | .driver_info = (kernel_ulong_t) &net_intf2_blacklist }, | ||
570 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) }, | 573 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) }, |
571 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1442, USB_CLASS_COMM, 0x02, 0xff) }, | 574 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1442, USB_CLASS_COMM, 0x02, 0xff) }, |
572 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), | 575 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 592b31698fc8..ce5221fa393a 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -728,7 +728,12 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq, | |||
728 | } | 728 | } |
729 | se_sess = tv_nexus->tvn_se_sess; | 729 | se_sess = tv_nexus->tvn_se_sess; |
730 | 730 | ||
731 | tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_KERNEL); | 731 | tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_ATOMIC); |
732 | if (tag < 0) { | ||
733 | pr_err("Unable to obtain tag for tcm_vhost_cmd\n"); | ||
734 | return ERR_PTR(-ENOMEM); | ||
735 | } | ||
736 | |||
732 | cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[tag]; | 737 | cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[tag]; |
733 | sg = cmd->tvc_sgl; | 738 | sg = cmd->tvc_sgl; |
734 | pages = cmd->tvc_upages; | 739 | pages = cmd->tvc_upages; |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 5be5e3d14f79..19f3c3fc65f4 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -802,6 +802,12 @@ static int hpwdt_init_one(struct pci_dev *dev, | |||
802 | return -ENODEV; | 802 | return -ENODEV; |
803 | } | 803 | } |
804 | 804 | ||
805 | /* | ||
806 | * Ignore all auxilary iLO devices with the following PCI ID | ||
807 | */ | ||
808 | if (dev->subsystem_device == 0x1979) | ||
809 | return -ENODEV; | ||
810 | |||
805 | if (pci_enable_device(dev)) { | 811 | if (pci_enable_device(dev)) { |
806 | dev_warn(&dev->dev, | 812 | dev_warn(&dev->dev, |
807 | "Not possible to enable PCI Device: 0x%x:0x%x.\n", | 813 | "Not possible to enable PCI Device: 0x%x:0x%x.\n", |
diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c index 491419e0772a..5c3d4df63e68 100644 --- a/drivers/watchdog/kempld_wdt.c +++ b/drivers/watchdog/kempld_wdt.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #define KEMPLD_WDT_STAGE_TIMEOUT(x) (0x1b + (x) * 4) | 35 | #define KEMPLD_WDT_STAGE_TIMEOUT(x) (0x1b + (x) * 4) |
36 | #define KEMPLD_WDT_STAGE_CFG(x) (0x18 + (x)) | 36 | #define KEMPLD_WDT_STAGE_CFG(x) (0x18 + (x)) |
37 | #define STAGE_CFG_GET_PRESCALER(x) (((x) & 0x30) >> 4) | 37 | #define STAGE_CFG_GET_PRESCALER(x) (((x) & 0x30) >> 4) |
38 | #define STAGE_CFG_SET_PRESCALER(x) (((x) & 0x30) << 4) | 38 | #define STAGE_CFG_SET_PRESCALER(x) (((x) & 0x3) << 4) |
39 | #define STAGE_CFG_PRESCALER_MASK 0x30 | 39 | #define STAGE_CFG_PRESCALER_MASK 0x30 |
40 | #define STAGE_CFG_ACTION_MASK 0x7 | 40 | #define STAGE_CFG_ACTION_MASK 0x7 |
41 | #define STAGE_CFG_ASSERT (1 << 3) | 41 | #define STAGE_CFG_ASSERT (1 << 3) |
diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c index 1f94b42764aa..f6caa77151c7 100644 --- a/drivers/watchdog/sunxi_wdt.c +++ b/drivers/watchdog/sunxi_wdt.c | |||
@@ -146,7 +146,7 @@ static const struct watchdog_ops sunxi_wdt_ops = { | |||
146 | .set_timeout = sunxi_wdt_set_timeout, | 146 | .set_timeout = sunxi_wdt_set_timeout, |
147 | }; | 147 | }; |
148 | 148 | ||
149 | static int __init sunxi_wdt_probe(struct platform_device *pdev) | 149 | static int sunxi_wdt_probe(struct platform_device *pdev) |
150 | { | 150 | { |
151 | struct sunxi_wdt_dev *sunxi_wdt; | 151 | struct sunxi_wdt_dev *sunxi_wdt; |
152 | struct resource *res; | 152 | struct resource *res; |
@@ -187,7 +187,7 @@ static int __init sunxi_wdt_probe(struct platform_device *pdev) | |||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static int __exit sunxi_wdt_remove(struct platform_device *pdev) | 190 | static int sunxi_wdt_remove(struct platform_device *pdev) |
191 | { | 191 | { |
192 | struct sunxi_wdt_dev *sunxi_wdt = platform_get_drvdata(pdev); | 192 | struct sunxi_wdt_dev *sunxi_wdt = platform_get_drvdata(pdev); |
193 | 193 | ||
diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c index 42913f131dc2..c9b0c627fe7e 100644 --- a/drivers/watchdog/ts72xx_wdt.c +++ b/drivers/watchdog/ts72xx_wdt.c | |||
@@ -310,7 +310,8 @@ static long ts72xx_wdt_ioctl(struct file *file, unsigned int cmd, | |||
310 | 310 | ||
311 | case WDIOC_GETSTATUS: | 311 | case WDIOC_GETSTATUS: |
312 | case WDIOC_GETBOOTSTATUS: | 312 | case WDIOC_GETBOOTSTATUS: |
313 | return put_user(0, p); | 313 | error = put_user(0, p); |
314 | break; | ||
314 | 315 | ||
315 | case WDIOC_KEEPALIVE: | 316 | case WDIOC_KEEPALIVE: |
316 | ts72xx_wdt_kick(wdt); | 317 | ts72xx_wdt_kick(wdt); |