diff options
Diffstat (limited to 'drivers')
63 files changed, 652 insertions, 412 deletions
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index 7652e8dc188f..21b0bc6a9c96 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c | |||
@@ -1225,11 +1225,13 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1225 | card->config_regs = pci_iomap(dev, 0, CONFIG_RAM_SIZE); | 1225 | card->config_regs = pci_iomap(dev, 0, CONFIG_RAM_SIZE); |
1226 | if (!card->config_regs) { | 1226 | if (!card->config_regs) { |
1227 | dev_warn(&dev->dev, "Failed to ioremap config registers\n"); | 1227 | dev_warn(&dev->dev, "Failed to ioremap config registers\n"); |
1228 | err = -ENOMEM; | ||
1228 | goto out_release_regions; | 1229 | goto out_release_regions; |
1229 | } | 1230 | } |
1230 | card->buffers = pci_iomap(dev, 1, DATA_RAM_SIZE); | 1231 | card->buffers = pci_iomap(dev, 1, DATA_RAM_SIZE); |
1231 | if (!card->buffers) { | 1232 | if (!card->buffers) { |
1232 | dev_warn(&dev->dev, "Failed to ioremap data buffers\n"); | 1233 | dev_warn(&dev->dev, "Failed to ioremap data buffers\n"); |
1234 | err = -ENOMEM; | ||
1233 | goto out_unmap_config; | 1235 | goto out_unmap_config; |
1234 | } | 1236 | } |
1235 | 1237 | ||
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c index 24b5b020753a..a23ac0c724f0 100644 --- a/drivers/clk/at91/clk-usb.c +++ b/drivers/clk/at91/clk-usb.c | |||
@@ -52,29 +52,26 @@ static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw, | |||
52 | 52 | ||
53 | tmp = pmc_read(pmc, AT91_PMC_USB); | 53 | tmp = pmc_read(pmc, AT91_PMC_USB); |
54 | usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; | 54 | usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; |
55 | return parent_rate / (usbdiv + 1); | 55 | |
56 | return DIV_ROUND_CLOSEST(parent_rate, (usbdiv + 1)); | ||
56 | } | 57 | } |
57 | 58 | ||
58 | static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | 59 | static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, |
59 | unsigned long *parent_rate) | 60 | unsigned long *parent_rate) |
60 | { | 61 | { |
61 | unsigned long div; | 62 | unsigned long div; |
62 | unsigned long bestrate; | 63 | |
63 | unsigned long tmp; | 64 | if (!rate) |
65 | return -EINVAL; | ||
64 | 66 | ||
65 | if (rate >= *parent_rate) | 67 | if (rate >= *parent_rate) |
66 | return *parent_rate; | 68 | return *parent_rate; |
67 | 69 | ||
68 | div = *parent_rate / rate; | 70 | div = DIV_ROUND_CLOSEST(*parent_rate, rate); |
69 | if (div >= SAM9X5_USB_MAX_DIV) | 71 | if (div > SAM9X5_USB_MAX_DIV + 1) |
70 | return *parent_rate / (SAM9X5_USB_MAX_DIV + 1); | 72 | div = SAM9X5_USB_MAX_DIV + 1; |
71 | |||
72 | bestrate = *parent_rate / div; | ||
73 | tmp = *parent_rate / (div + 1); | ||
74 | if (bestrate - rate > rate - tmp) | ||
75 | bestrate = tmp; | ||
76 | 73 | ||
77 | return bestrate; | 74 | return DIV_ROUND_CLOSEST(*parent_rate, div); |
78 | } | 75 | } |
79 | 76 | ||
80 | static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) | 77 | static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) |
@@ -106,9 +103,13 @@ static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | |||
106 | u32 tmp; | 103 | u32 tmp; |
107 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); | 104 | struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); |
108 | struct at91_pmc *pmc = usb->pmc; | 105 | struct at91_pmc *pmc = usb->pmc; |
109 | unsigned long div = parent_rate / rate; | 106 | unsigned long div; |
107 | |||
108 | if (!rate) | ||
109 | return -EINVAL; | ||
110 | 110 | ||
111 | if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV) | 111 | div = DIV_ROUND_CLOSEST(parent_rate, rate); |
112 | if (div > SAM9X5_USB_MAX_DIV + 1 || !div) | ||
112 | return -EINVAL; | 113 | return -EINVAL; |
113 | 114 | ||
114 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; | 115 | tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; |
@@ -253,7 +254,7 @@ static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, | |||
253 | 254 | ||
254 | tmp_parent_rate = rate * usb->divisors[i]; | 255 | tmp_parent_rate = rate * usb->divisors[i]; |
255 | tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); | 256 | tmp_parent_rate = __clk_round_rate(parent, tmp_parent_rate); |
256 | tmprate = tmp_parent_rate / usb->divisors[i]; | 257 | tmprate = DIV_ROUND_CLOSEST(tmp_parent_rate, usb->divisors[i]); |
257 | if (tmprate < rate) | 258 | if (tmprate < rate) |
258 | tmpdiff = rate - tmprate; | 259 | tmpdiff = rate - tmprate; |
259 | else | 260 | else |
@@ -281,10 +282,10 @@ static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, | |||
281 | struct at91_pmc *pmc = usb->pmc; | 282 | struct at91_pmc *pmc = usb->pmc; |
282 | unsigned long div; | 283 | unsigned long div; |
283 | 284 | ||
284 | if (!rate || parent_rate % rate) | 285 | if (!rate) |
285 | return -EINVAL; | 286 | return -EINVAL; |
286 | 287 | ||
287 | div = parent_rate / rate; | 288 | div = DIV_ROUND_CLOSEST(parent_rate, rate); |
288 | 289 | ||
289 | for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { | 290 | for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { |
290 | if (usb->divisors[i] == div) { | 291 | if (usb->divisors[i] == div) { |
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 18a9de29df0e..c0a842b335c5 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c | |||
@@ -263,6 +263,14 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate, | |||
263 | if (!rate) | 263 | if (!rate) |
264 | rate = 1; | 264 | rate = 1; |
265 | 265 | ||
266 | /* if read only, just return current value */ | ||
267 | if (divider->flags & CLK_DIVIDER_READ_ONLY) { | ||
268 | bestdiv = readl(divider->reg) >> divider->shift; | ||
269 | bestdiv &= div_mask(divider); | ||
270 | bestdiv = _get_div(divider, bestdiv); | ||
271 | return bestdiv; | ||
272 | } | ||
273 | |||
266 | maxdiv = _get_maxdiv(divider); | 274 | maxdiv = _get_maxdiv(divider); |
267 | 275 | ||
268 | if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { | 276 | if (!(__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT)) { |
@@ -361,11 +369,6 @@ const struct clk_ops clk_divider_ops = { | |||
361 | }; | 369 | }; |
362 | EXPORT_SYMBOL_GPL(clk_divider_ops); | 370 | EXPORT_SYMBOL_GPL(clk_divider_ops); |
363 | 371 | ||
364 | const struct clk_ops clk_divider_ro_ops = { | ||
365 | .recalc_rate = clk_divider_recalc_rate, | ||
366 | }; | ||
367 | EXPORT_SYMBOL_GPL(clk_divider_ro_ops); | ||
368 | |||
369 | static struct clk *_register_divider(struct device *dev, const char *name, | 372 | static struct clk *_register_divider(struct device *dev, const char *name, |
370 | const char *parent_name, unsigned long flags, | 373 | const char *parent_name, unsigned long flags, |
371 | void __iomem *reg, u8 shift, u8 width, | 374 | void __iomem *reg, u8 shift, u8 width, |
@@ -391,10 +394,7 @@ static struct clk *_register_divider(struct device *dev, const char *name, | |||
391 | } | 394 | } |
392 | 395 | ||
393 | init.name = name; | 396 | init.name = name; |
394 | if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) | 397 | init.ops = &clk_divider_ops; |
395 | init.ops = &clk_divider_ro_ops; | ||
396 | else | ||
397 | init.ops = &clk_divider_ops; | ||
398 | init.flags = flags | CLK_IS_BASIC; | 398 | init.flags = flags | CLK_IS_BASIC; |
399 | init.parent_names = (parent_name ? &parent_name: NULL); | 399 | init.parent_names = (parent_name ? &parent_name: NULL); |
400 | init.num_parents = (parent_name ? 1 : 0); | 400 | init.num_parents = (parent_name ? 1 : 0); |
diff --git a/drivers/clk/pxa/clk-pxa27x.c b/drivers/clk/pxa/clk-pxa27x.c index b345cc791e5d..88b9fe13fa44 100644 --- a/drivers/clk/pxa/clk-pxa27x.c +++ b/drivers/clk/pxa/clk-pxa27x.c | |||
@@ -322,7 +322,7 @@ static unsigned long clk_pxa27x_memory_get_rate(struct clk_hw *hw, | |||
322 | unsigned long ccsr = CCSR; | 322 | unsigned long ccsr = CCSR; |
323 | 323 | ||
324 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); | 324 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); |
325 | a = cccr & CCCR_A_BIT; | 325 | a = cccr & (1 << CCCR_A_BIT); |
326 | l = ccsr & CCSR_L_MASK; | 326 | l = ccsr & CCSR_L_MASK; |
327 | 327 | ||
328 | if (osc_forced || a) | 328 | if (osc_forced || a) |
@@ -341,7 +341,7 @@ static u8 clk_pxa27x_memory_get_parent(struct clk_hw *hw) | |||
341 | unsigned long ccsr = CCSR; | 341 | unsigned long ccsr = CCSR; |
342 | 342 | ||
343 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); | 343 | osc_forced = ccsr & (1 << CCCR_CPDIS_BIT); |
344 | a = cccr & CCCR_A_BIT; | 344 | a = cccr & (1 << CCCR_A_BIT); |
345 | if (osc_forced) | 345 | if (osc_forced) |
346 | return PXA_MEM_13Mhz; | 346 | return PXA_MEM_13Mhz; |
347 | if (a) | 347 | if (a) |
diff --git a/drivers/clk/qcom/mmcc-apq8084.c b/drivers/clk/qcom/mmcc-apq8084.c index dab988ab8cf1..157139a5c1ca 100644 --- a/drivers/clk/qcom/mmcc-apq8084.c +++ b/drivers/clk/qcom/mmcc-apq8084.c | |||
@@ -3122,7 +3122,7 @@ static struct clk_regmap *mmcc_apq8084_clocks[] = { | |||
3122 | [ESC1_CLK_SRC] = &esc1_clk_src.clkr, | 3122 | [ESC1_CLK_SRC] = &esc1_clk_src.clkr, |
3123 | [HDMI_CLK_SRC] = &hdmi_clk_src.clkr, | 3123 | [HDMI_CLK_SRC] = &hdmi_clk_src.clkr, |
3124 | [VSYNC_CLK_SRC] = &vsync_clk_src.clkr, | 3124 | [VSYNC_CLK_SRC] = &vsync_clk_src.clkr, |
3125 | [RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, | 3125 | [MMSS_RBCPR_CLK_SRC] = &rbcpr_clk_src.clkr, |
3126 | [RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr, | 3126 | [RBBMTIMER_CLK_SRC] = &rbbmtimer_clk_src.clkr, |
3127 | [MAPLE_CLK_SRC] = &maple_clk_src.clkr, | 3127 | [MAPLE_CLK_SRC] = &maple_clk_src.clkr, |
3128 | [VDP_CLK_SRC] = &vdp_clk_src.clkr, | 3128 | [VDP_CLK_SRC] = &vdp_clk_src.clkr, |
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c index 1e68bff481b8..880a266f0143 100644 --- a/drivers/clk/rockchip/clk.c +++ b/drivers/clk/rockchip/clk.c | |||
@@ -90,9 +90,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, | |||
90 | div->width = div_width; | 90 | div->width = div_width; |
91 | div->lock = lock; | 91 | div->lock = lock; |
92 | div->table = div_table; | 92 | div->table = div_table; |
93 | div_ops = (div_flags & CLK_DIVIDER_READ_ONLY) | 93 | div_ops = &clk_divider_ops; |
94 | ? &clk_divider_ro_ops | ||
95 | : &clk_divider_ops; | ||
96 | } | 94 | } |
97 | 95 | ||
98 | clk = clk_register_composite(NULL, name, parent_names, num_parents, | 96 | clk = clk_register_composite(NULL, name, parent_names, num_parents, |
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c index efb17c3ee120..f4a9c0058b4d 100644 --- a/drivers/clocksource/sun4i_timer.c +++ b/drivers/clocksource/sun4i_timer.c | |||
@@ -182,6 +182,12 @@ static void __init sun4i_timer_init(struct device_node *node) | |||
182 | /* Make sure timer is stopped before playing with interrupts */ | 182 | /* Make sure timer is stopped before playing with interrupts */ |
183 | sun4i_clkevt_time_stop(0); | 183 | sun4i_clkevt_time_stop(0); |
184 | 184 | ||
185 | sun4i_clockevent.cpumask = cpu_possible_mask; | ||
186 | sun4i_clockevent.irq = irq; | ||
187 | |||
188 | clockevents_config_and_register(&sun4i_clockevent, rate, | ||
189 | TIMER_SYNC_TICKS, 0xffffffff); | ||
190 | |||
185 | ret = setup_irq(irq, &sun4i_timer_irq); | 191 | ret = setup_irq(irq, &sun4i_timer_irq); |
186 | if (ret) | 192 | if (ret) |
187 | pr_warn("failed to setup irq %d\n", irq); | 193 | pr_warn("failed to setup irq %d\n", irq); |
@@ -189,12 +195,6 @@ static void __init sun4i_timer_init(struct device_node *node) | |||
189 | /* Enable timer0 interrupt */ | 195 | /* Enable timer0 interrupt */ |
190 | val = readl(timer_base + TIMER_IRQ_EN_REG); | 196 | val = readl(timer_base + TIMER_IRQ_EN_REG); |
191 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); | 197 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); |
192 | |||
193 | sun4i_clockevent.cpumask = cpu_possible_mask; | ||
194 | sun4i_clockevent.irq = irq; | ||
195 | |||
196 | clockevents_config_and_register(&sun4i_clockevent, rate, | ||
197 | TIMER_SYNC_TICKS, 0xffffffff); | ||
198 | } | 198 | } |
199 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", | 199 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", |
200 | sun4i_timer_init); | 200 | sun4i_timer_init); |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 7784911d78ef..00fc59762e0d 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -185,6 +185,16 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
185 | if (rdev->flags & RADEON_IS_AGP) | 185 | if (rdev->flags & RADEON_IS_AGP) |
186 | return false; | 186 | return false; |
187 | 187 | ||
188 | /* | ||
189 | * Older chips have a HW limitation, they can only generate 40 bits | ||
190 | * of address for "64-bit" MSIs which breaks on some platforms, notably | ||
191 | * IBM POWER servers, so we limit them | ||
192 | */ | ||
193 | if (rdev->family < CHIP_BONAIRE) { | ||
194 | dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); | ||
195 | rdev->pdev->no_64bit_msi = 1; | ||
196 | } | ||
197 | |||
188 | /* force MSI on */ | 198 | /* force MSI on */ |
189 | if (radeon_msi == 1) | 199 | if (radeon_msi == 1) |
190 | return true; | 200 | return true; |
diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c index 6aac695b1688..9b55e673b67c 100644 --- a/drivers/hwmon/g762.c +++ b/drivers/hwmon/g762.c | |||
@@ -1084,10 +1084,8 @@ static int g762_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
1084 | if (ret) | 1084 | if (ret) |
1085 | goto clock_dis; | 1085 | goto clock_dis; |
1086 | 1086 | ||
1087 | data->hwmon_dev = devm_hwmon_device_register_with_groups(dev, | 1087 | data->hwmon_dev = hwmon_device_register_with_groups(dev, client->name, |
1088 | client->name, | 1088 | data, g762_groups); |
1089 | data, | ||
1090 | g762_groups); | ||
1091 | if (IS_ERR(data->hwmon_dev)) { | 1089 | if (IS_ERR(data->hwmon_dev)) { |
1092 | ret = PTR_ERR(data->hwmon_dev); | 1090 | ret = PTR_ERR(data->hwmon_dev); |
1093 | goto clock_dis; | 1091 | goto clock_dis; |
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c index 22c096ce39ad..513bd6d14293 100644 --- a/drivers/iio/accel/bmc150-accel.c +++ b/drivers/iio/accel/bmc150-accel.c | |||
@@ -44,6 +44,9 @@ | |||
44 | 44 | ||
45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B | 45 | #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B |
46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 | 46 | #define BMC150_ACCEL_ANY_MOTION_MASK 0x07 |
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_X BIT(0) | ||
48 | #define BMC150_ACCEL_ANY_MOTION_BIT_Y BIT(1) | ||
49 | #define BMC150_ACCEL_ANY_MOTION_BIT_Z BIT(2) | ||
47 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) | 50 | #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3) |
48 | 51 | ||
49 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 | 52 | #define BMC150_ACCEL_REG_PMU_LPW 0x11 |
@@ -92,9 +95,9 @@ | |||
92 | #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF | 95 | #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF |
93 | 96 | ||
94 | /* Slope duration in terms of number of samples */ | 97 | /* Slope duration in terms of number of samples */ |
95 | #define BMC150_ACCEL_DEF_SLOPE_DURATION 2 | 98 | #define BMC150_ACCEL_DEF_SLOPE_DURATION 1 |
96 | /* in terms of multiples of g's/LSB, based on range */ | 99 | /* in terms of multiples of g's/LSB, based on range */ |
97 | #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 5 | 100 | #define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 1 |
98 | 101 | ||
99 | #define BMC150_ACCEL_REG_XOUT_L 0x02 | 102 | #define BMC150_ACCEL_REG_XOUT_L 0x02 |
100 | 103 | ||
@@ -536,6 +539,9 @@ static int bmc150_accel_set_power_state(struct bmc150_accel_data *data, bool on) | |||
536 | if (ret < 0) { | 539 | if (ret < 0) { |
537 | dev_err(&data->client->dev, | 540 | dev_err(&data->client->dev, |
538 | "Failed: bmc150_accel_set_power_state for %d\n", on); | 541 | "Failed: bmc150_accel_set_power_state for %d\n", on); |
542 | if (on) | ||
543 | pm_runtime_put_noidle(&data->client->dev); | ||
544 | |||
539 | return ret; | 545 | return ret; |
540 | } | 546 | } |
541 | 547 | ||
@@ -811,6 +817,7 @@ static int bmc150_accel_write_event_config(struct iio_dev *indio_dev, | |||
811 | 817 | ||
812 | ret = bmc150_accel_setup_any_motion_interrupt(data, state); | 818 | ret = bmc150_accel_setup_any_motion_interrupt(data, state); |
813 | if (ret < 0) { | 819 | if (ret < 0) { |
820 | bmc150_accel_set_power_state(data, false); | ||
814 | mutex_unlock(&data->mutex); | 821 | mutex_unlock(&data->mutex); |
815 | return ret; | 822 | return ret; |
816 | } | 823 | } |
@@ -846,7 +853,7 @@ static const struct attribute_group bmc150_accel_attrs_group = { | |||
846 | 853 | ||
847 | static const struct iio_event_spec bmc150_accel_event = { | 854 | static const struct iio_event_spec bmc150_accel_event = { |
848 | .type = IIO_EV_TYPE_ROC, | 855 | .type = IIO_EV_TYPE_ROC, |
849 | .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, | 856 | .dir = IIO_EV_DIR_EITHER, |
850 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | | 857 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | |
851 | BIT(IIO_EV_INFO_ENABLE) | | 858 | BIT(IIO_EV_INFO_ENABLE) | |
852 | BIT(IIO_EV_INFO_PERIOD) | 859 | BIT(IIO_EV_INFO_PERIOD) |
@@ -1054,6 +1061,7 @@ static int bmc150_accel_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
1054 | else | 1061 | else |
1055 | ret = bmc150_accel_setup_new_data_interrupt(data, state); | 1062 | ret = bmc150_accel_setup_new_data_interrupt(data, state); |
1056 | if (ret < 0) { | 1063 | if (ret < 0) { |
1064 | bmc150_accel_set_power_state(data, false); | ||
1057 | mutex_unlock(&data->mutex); | 1065 | mutex_unlock(&data->mutex); |
1058 | return ret; | 1066 | return ret; |
1059 | } | 1067 | } |
@@ -1092,12 +1100,26 @@ static irqreturn_t bmc150_accel_event_handler(int irq, void *private) | |||
1092 | else | 1100 | else |
1093 | dir = IIO_EV_DIR_RISING; | 1101 | dir = IIO_EV_DIR_RISING; |
1094 | 1102 | ||
1095 | if (ret & BMC150_ACCEL_ANY_MOTION_MASK) | 1103 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X) |
1104 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1105 | 0, | ||
1106 | IIO_MOD_X, | ||
1107 | IIO_EV_TYPE_ROC, | ||
1108 | dir), | ||
1109 | data->timestamp); | ||
1110 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y) | ||
1096 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | 1111 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, |
1097 | 0, | 1112 | 0, |
1098 | IIO_MOD_X_OR_Y_OR_Z, | 1113 | IIO_MOD_Y, |
1099 | IIO_EV_TYPE_ROC, | 1114 | IIO_EV_TYPE_ROC, |
1100 | IIO_EV_DIR_EITHER), | 1115 | dir), |
1116 | data->timestamp); | ||
1117 | if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z) | ||
1118 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, | ||
1119 | 0, | ||
1120 | IIO_MOD_Z, | ||
1121 | IIO_EV_TYPE_ROC, | ||
1122 | dir), | ||
1101 | data->timestamp); | 1123 | data->timestamp); |
1102 | ack_intr_status: | 1124 | ack_intr_status: |
1103 | if (!data->dready_trigger_on) | 1125 | if (!data->dready_trigger_on) |
@@ -1354,10 +1376,14 @@ static int bmc150_accel_runtime_suspend(struct device *dev) | |||
1354 | { | 1376 | { |
1355 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); | 1377 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
1356 | struct bmc150_accel_data *data = iio_priv(indio_dev); | 1378 | struct bmc150_accel_data *data = iio_priv(indio_dev); |
1379 | int ret; | ||
1357 | 1380 | ||
1358 | dev_dbg(&data->client->dev, __func__); | 1381 | dev_dbg(&data->client->dev, __func__); |
1382 | ret = bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); | ||
1383 | if (ret < 0) | ||
1384 | return -EAGAIN; | ||
1359 | 1385 | ||
1360 | return bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0); | 1386 | return 0; |
1361 | } | 1387 | } |
1362 | 1388 | ||
1363 | static int bmc150_accel_runtime_resume(struct device *dev) | 1389 | static int bmc150_accel_runtime_resume(struct device *dev) |
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index a23e58c4ed99..320aa72c0349 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c | |||
@@ -269,6 +269,8 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *data, int range_index) | |||
269 | return ret; | 269 | return ret; |
270 | } | 270 | } |
271 | 271 | ||
272 | ret &= ~(KXCJK1013_REG_CTRL1_BIT_GSEL0 | | ||
273 | KXCJK1013_REG_CTRL1_BIT_GSEL1); | ||
272 | ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3); | 274 | ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3); |
273 | ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4); | 275 | ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4); |
274 | 276 | ||
diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index b58d6302521f..d095efe1ba14 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c | |||
@@ -152,6 +152,7 @@ static void men_z188_remove(struct mcb_device *dev) | |||
152 | 152 | ||
153 | static const struct mcb_device_id men_z188_ids[] = { | 153 | static const struct mcb_device_id men_z188_ids[] = { |
154 | { .device = 0xbc }, | 154 | { .device = 0xbc }, |
155 | { } | ||
155 | }; | 156 | }; |
156 | MODULE_DEVICE_TABLE(mcb, men_z188_ids); | 157 | MODULE_DEVICE_TABLE(mcb, men_z188_ids); |
157 | 158 | ||
diff --git a/drivers/iio/gyro/bmg160.c b/drivers/iio/gyro/bmg160.c index 1f967e0d688e..d2fa526740ca 100644 --- a/drivers/iio/gyro/bmg160.c +++ b/drivers/iio/gyro/bmg160.c | |||
@@ -67,6 +67,9 @@ | |||
67 | #define BMG160_REG_INT_EN_0 0x15 | 67 | #define BMG160_REG_INT_EN_0 0x15 |
68 | #define BMG160_DATA_ENABLE_INT BIT(7) | 68 | #define BMG160_DATA_ENABLE_INT BIT(7) |
69 | 69 | ||
70 | #define BMG160_REG_INT_EN_1 0x16 | ||
71 | #define BMG160_INT1_BIT_OD BIT(1) | ||
72 | |||
70 | #define BMG160_REG_XOUT_L 0x02 | 73 | #define BMG160_REG_XOUT_L 0x02 |
71 | #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2)) | 74 | #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2)) |
72 | 75 | ||
@@ -82,6 +85,9 @@ | |||
82 | 85 | ||
83 | #define BMG160_REG_INT_STATUS_2 0x0B | 86 | #define BMG160_REG_INT_STATUS_2 0x0B |
84 | #define BMG160_ANY_MOTION_MASK 0x07 | 87 | #define BMG160_ANY_MOTION_MASK 0x07 |
88 | #define BMG160_ANY_MOTION_BIT_X BIT(0) | ||
89 | #define BMG160_ANY_MOTION_BIT_Y BIT(1) | ||
90 | #define BMG160_ANY_MOTION_BIT_Z BIT(2) | ||
85 | 91 | ||
86 | #define BMG160_REG_TEMP 0x08 | 92 | #define BMG160_REG_TEMP 0x08 |
87 | #define BMG160_TEMP_CENTER_VAL 23 | 93 | #define BMG160_TEMP_CENTER_VAL 23 |
@@ -222,6 +228,19 @@ static int bmg160_chip_init(struct bmg160_data *data) | |||
222 | data->slope_thres = ret; | 228 | data->slope_thres = ret; |
223 | 229 | ||
224 | /* Set default interrupt mode */ | 230 | /* Set default interrupt mode */ |
231 | ret = i2c_smbus_read_byte_data(data->client, BMG160_REG_INT_EN_1); | ||
232 | if (ret < 0) { | ||
233 | dev_err(&data->client->dev, "Error reading reg_int_en_1\n"); | ||
234 | return ret; | ||
235 | } | ||
236 | ret &= ~BMG160_INT1_BIT_OD; | ||
237 | ret = i2c_smbus_write_byte_data(data->client, | ||
238 | BMG160_REG_INT_EN_1, ret); | ||
239 | if (ret < 0) { | ||
240 | dev_err(&data->client->dev, "Error writing reg_int_en_1\n"); | ||
241 | return ret; | ||
242 | } | ||
243 | |||
225 | ret = i2c_smbus_write_byte_data(data->client, | 244 | ret = i2c_smbus_write_byte_data(data->client, |
226 | BMG160_REG_INT_RST_LATCH, | 245 | BMG160_REG_INT_RST_LATCH, |
227 | BMG160_INT_MODE_LATCH_INT | | 246 | BMG160_INT_MODE_LATCH_INT | |
@@ -250,6 +269,9 @@ static int bmg160_set_power_state(struct bmg160_data *data, bool on) | |||
250 | if (ret < 0) { | 269 | if (ret < 0) { |
251 | dev_err(&data->client->dev, | 270 | dev_err(&data->client->dev, |
252 | "Failed: bmg160_set_power_state for %d\n", on); | 271 | "Failed: bmg160_set_power_state for %d\n", on); |
272 | if (on) | ||
273 | pm_runtime_put_noidle(&data->client->dev); | ||
274 | |||
253 | return ret; | 275 | return ret; |
254 | } | 276 | } |
255 | #endif | 277 | #endif |
@@ -705,6 +727,7 @@ static int bmg160_write_event_config(struct iio_dev *indio_dev, | |||
705 | 727 | ||
706 | ret = bmg160_setup_any_motion_interrupt(data, state); | 728 | ret = bmg160_setup_any_motion_interrupt(data, state); |
707 | if (ret < 0) { | 729 | if (ret < 0) { |
730 | bmg160_set_power_state(data, false); | ||
708 | mutex_unlock(&data->mutex); | 731 | mutex_unlock(&data->mutex); |
709 | return ret; | 732 | return ret; |
710 | } | 733 | } |
@@ -743,7 +766,7 @@ static const struct attribute_group bmg160_attrs_group = { | |||
743 | 766 | ||
744 | static const struct iio_event_spec bmg160_event = { | 767 | static const struct iio_event_spec bmg160_event = { |
745 | .type = IIO_EV_TYPE_ROC, | 768 | .type = IIO_EV_TYPE_ROC, |
746 | .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, | 769 | .dir = IIO_EV_DIR_EITHER, |
747 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | | 770 | .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) | |
748 | BIT(IIO_EV_INFO_ENABLE) | 771 | BIT(IIO_EV_INFO_ENABLE) |
749 | }; | 772 | }; |
@@ -871,6 +894,7 @@ static int bmg160_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
871 | else | 894 | else |
872 | ret = bmg160_setup_new_data_interrupt(data, state); | 895 | ret = bmg160_setup_new_data_interrupt(data, state); |
873 | if (ret < 0) { | 896 | if (ret < 0) { |
897 | bmg160_set_power_state(data, false); | ||
874 | mutex_unlock(&data->mutex); | 898 | mutex_unlock(&data->mutex); |
875 | return ret; | 899 | return ret; |
876 | } | 900 | } |
@@ -908,10 +932,24 @@ static irqreturn_t bmg160_event_handler(int irq, void *private) | |||
908 | else | 932 | else |
909 | dir = IIO_EV_DIR_FALLING; | 933 | dir = IIO_EV_DIR_FALLING; |
910 | 934 | ||
911 | if (ret & BMG160_ANY_MOTION_MASK) | 935 | if (ret & BMG160_ANY_MOTION_BIT_X) |
912 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | 936 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, |
913 | 0, | 937 | 0, |
914 | IIO_MOD_X_OR_Y_OR_Z, | 938 | IIO_MOD_X, |
939 | IIO_EV_TYPE_ROC, | ||
940 | dir), | ||
941 | data->timestamp); | ||
942 | if (ret & BMG160_ANY_MOTION_BIT_Y) | ||
943 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
944 | 0, | ||
945 | IIO_MOD_Y, | ||
946 | IIO_EV_TYPE_ROC, | ||
947 | dir), | ||
948 | data->timestamp); | ||
949 | if (ret & BMG160_ANY_MOTION_BIT_Z) | ||
950 | iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL, | ||
951 | 0, | ||
952 | IIO_MOD_Z, | ||
915 | IIO_EV_TYPE_ROC, | 953 | IIO_EV_TYPE_ROC, |
916 | dir), | 954 | dir), |
917 | data->timestamp); | 955 | data->timestamp); |
@@ -1169,8 +1207,15 @@ static int bmg160_runtime_suspend(struct device *dev) | |||
1169 | { | 1207 | { |
1170 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); | 1208 | struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
1171 | struct bmg160_data *data = iio_priv(indio_dev); | 1209 | struct bmg160_data *data = iio_priv(indio_dev); |
1210 | int ret; | ||
1211 | |||
1212 | ret = bmg160_set_mode(data, BMG160_MODE_SUSPEND); | ||
1213 | if (ret < 0) { | ||
1214 | dev_err(&data->client->dev, "set mode failed\n"); | ||
1215 | return -EAGAIN; | ||
1216 | } | ||
1172 | 1217 | ||
1173 | return bmg160_set_mode(data, BMG160_MODE_SUSPEND); | 1218 | return 0; |
1174 | } | 1219 | } |
1175 | 1220 | ||
1176 | static int bmg160_runtime_resume(struct device *dev) | 1221 | static int bmg160_runtime_resume(struct device *dev) |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2ed7905a068f..fc55f0d15b70 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -1179,9 +1179,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; | 1181 | ep_irq_in = &intf->cur_altsetting->endpoint[1].desc; |
1182 | usb_fill_bulk_urb(xpad->bulk_out, udev, | 1182 | if (usb_endpoint_is_bulk_out(ep_irq_in)) { |
1183 | usb_sndbulkpipe(udev, ep_irq_in->bEndpointAddress), | 1183 | usb_fill_bulk_urb(xpad->bulk_out, udev, |
1184 | xpad->bdata, XPAD_PKT_LEN, xpad_bulk_out, xpad); | 1184 | usb_sndbulkpipe(udev, |
1185 | ep_irq_in->bEndpointAddress), | ||
1186 | xpad->bdata, XPAD_PKT_LEN, | ||
1187 | xpad_bulk_out, xpad); | ||
1188 | } else { | ||
1189 | usb_fill_int_urb(xpad->bulk_out, udev, | ||
1190 | usb_sndintpipe(udev, | ||
1191 | ep_irq_in->bEndpointAddress), | ||
1192 | xpad->bdata, XPAD_PKT_LEN, | ||
1193 | xpad_bulk_out, xpad, 0); | ||
1194 | } | ||
1185 | 1195 | ||
1186 | /* | 1196 | /* |
1187 | * Submit the int URB immediately rather than waiting for open | 1197 | * Submit the int URB immediately rather than waiting for open |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 3fcb6b3cb0bd..f2b978026407 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -428,14 +428,6 @@ static void elantech_report_trackpoint(struct psmouse *psmouse, | |||
428 | int x, y; | 428 | int x, y; |
429 | u32 t; | 429 | u32 t; |
430 | 430 | ||
431 | if (dev_WARN_ONCE(&psmouse->ps2dev.serio->dev, | ||
432 | !tp_dev, | ||
433 | psmouse_fmt("Unexpected trackpoint message\n"))) { | ||
434 | if (etd->debug == 1) | ||
435 | elantech_packet_dump(psmouse); | ||
436 | return; | ||
437 | } | ||
438 | |||
439 | t = get_unaligned_le32(&packet[0]); | 431 | t = get_unaligned_le32(&packet[0]); |
440 | 432 | ||
441 | switch (t & ~7U) { | 433 | switch (t & ~7U) { |
@@ -793,7 +785,7 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) | |||
793 | unsigned char packet_type = packet[3] & 0x03; | 785 | unsigned char packet_type = packet[3] & 0x03; |
794 | bool sanity_check; | 786 | bool sanity_check; |
795 | 787 | ||
796 | if ((packet[3] & 0x0f) == 0x06) | 788 | if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) |
797 | return PACKET_TRACKPOINT; | 789 | return PACKET_TRACKPOINT; |
798 | 790 | ||
799 | /* | 791 | /* |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 2a7a9174c702..f9472920d986 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -143,6 +143,10 @@ static const struct min_max_quirk min_max_pnpid_table[] = { | |||
143 | (const char * const []){"LEN2001", NULL}, | 143 | (const char * const []){"LEN2001", NULL}, |
144 | 1024, 5022, 2508, 4832 | 144 | 1024, 5022, 2508, 4832 |
145 | }, | 145 | }, |
146 | { | ||
147 | (const char * const []){"LEN2006", NULL}, | ||
148 | 1264, 5675, 1171, 4688 | ||
149 | }, | ||
146 | { } | 150 | { } |
147 | }; | 151 | }; |
148 | 152 | ||
diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c index 6ae3cdee0681..cc4f9d80122e 100644 --- a/drivers/irqchip/irq-atmel-aic-common.c +++ b/drivers/irqchip/irq-atmel-aic-common.c | |||
@@ -217,8 +217,9 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node, | |||
217 | } | 217 | } |
218 | 218 | ||
219 | ret = irq_alloc_domain_generic_chips(domain, 32, 1, name, | 219 | ret = irq_alloc_domain_generic_chips(domain, 32, 1, name, |
220 | handle_level_irq, 0, 0, | 220 | handle_fasteoi_irq, |
221 | IRQCHIP_SKIP_SET_WAKE); | 221 | IRQ_NOREQUEST | IRQ_NOPROBE | |
222 | IRQ_NOAUTOEN, 0, 0); | ||
222 | if (ret) | 223 | if (ret) |
223 | goto err_domain_remove; | 224 | goto err_domain_remove; |
224 | 225 | ||
@@ -230,7 +231,6 @@ struct irq_domain *__init aic_common_of_init(struct device_node *node, | |||
230 | gc->unused = 0; | 231 | gc->unused = 0; |
231 | gc->wake_enabled = ~0; | 232 | gc->wake_enabled = ~0; |
232 | gc->chip_types[0].type = IRQ_TYPE_SENSE_MASK; | 233 | gc->chip_types[0].type = IRQ_TYPE_SENSE_MASK; |
233 | gc->chip_types[0].handler = handle_fasteoi_irq; | ||
234 | gc->chip_types[0].chip.irq_eoi = irq_gc_eoi; | 234 | gc->chip_types[0].chip.irq_eoi = irq_gc_eoi; |
235 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; | 235 | gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake; |
236 | gc->chip_types[0].chip.irq_shutdown = aic_common_shutdown; | 236 | gc->chip_types[0].chip.irq_shutdown = aic_common_shutdown; |
diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c index b9f4fb808e49..5fb38a2ac226 100644 --- a/drivers/irqchip/irq-bcm7120-l2.c +++ b/drivers/irqchip/irq-bcm7120-l2.c | |||
@@ -101,9 +101,9 @@ static int bcm7120_l2_intc_init_one(struct device_node *dn, | |||
101 | int parent_irq; | 101 | int parent_irq; |
102 | 102 | ||
103 | parent_irq = irq_of_parse_and_map(dn, irq); | 103 | parent_irq = irq_of_parse_and_map(dn, irq); |
104 | if (parent_irq < 0) { | 104 | if (!parent_irq) { |
105 | pr_err("failed to map interrupt %d\n", irq); | 105 | pr_err("failed to map interrupt %d\n", irq); |
106 | return parent_irq; | 106 | return -EINVAL; |
107 | } | 107 | } |
108 | 108 | ||
109 | data->irq_map_mask |= be32_to_cpup(map_mask + irq); | 109 | data->irq_map_mask |= be32_to_cpup(map_mask + irq); |
diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index c15c840987d2..14691a4cb84c 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c | |||
@@ -135,9 +135,9 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np, | |||
135 | __raw_writel(0xffffffff, data->base + CPU_CLEAR); | 135 | __raw_writel(0xffffffff, data->base + CPU_CLEAR); |
136 | 136 | ||
137 | data->parent_irq = irq_of_parse_and_map(np, 0); | 137 | data->parent_irq = irq_of_parse_and_map(np, 0); |
138 | if (data->parent_irq < 0) { | 138 | if (!data->parent_irq) { |
139 | pr_err("failed to find parent interrupt\n"); | 139 | pr_err("failed to find parent interrupt\n"); |
140 | ret = data->parent_irq; | 140 | ret = -EINVAL; |
141 | goto out_unmap; | 141 | goto out_unmap; |
142 | } | 142 | } |
143 | 143 | ||
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index b9625968daac..4f4c2a7888e5 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c | |||
@@ -377,6 +377,29 @@ static irqreturn_t bcm_sf2_switch_1_isr(int irq, void *dev_id) | |||
377 | return IRQ_HANDLED; | 377 | return IRQ_HANDLED; |
378 | } | 378 | } |
379 | 379 | ||
380 | static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) | ||
381 | { | ||
382 | unsigned int timeout = 1000; | ||
383 | u32 reg; | ||
384 | |||
385 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
386 | reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; | ||
387 | core_writel(priv, reg, CORE_WATCHDOG_CTRL); | ||
388 | |||
389 | do { | ||
390 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
391 | if (!(reg & SOFTWARE_RESET)) | ||
392 | break; | ||
393 | |||
394 | usleep_range(1000, 2000); | ||
395 | } while (timeout-- > 0); | ||
396 | |||
397 | if (timeout == 0) | ||
398 | return -ETIMEDOUT; | ||
399 | |||
400 | return 0; | ||
401 | } | ||
402 | |||
380 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) | 403 | static int bcm_sf2_sw_setup(struct dsa_switch *ds) |
381 | { | 404 | { |
382 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; | 405 | const char *reg_names[BCM_SF2_REGS_NUM] = BCM_SF2_REGS_NAME; |
@@ -404,11 +427,18 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) | |||
404 | *base = of_iomap(dn, i); | 427 | *base = of_iomap(dn, i); |
405 | if (*base == NULL) { | 428 | if (*base == NULL) { |
406 | pr_err("unable to find register: %s\n", reg_names[i]); | 429 | pr_err("unable to find register: %s\n", reg_names[i]); |
407 | return -ENODEV; | 430 | ret = -ENOMEM; |
431 | goto out_unmap; | ||
408 | } | 432 | } |
409 | base++; | 433 | base++; |
410 | } | 434 | } |
411 | 435 | ||
436 | ret = bcm_sf2_sw_rst(priv); | ||
437 | if (ret) { | ||
438 | pr_err("unable to software reset switch: %d\n", ret); | ||
439 | goto out_unmap; | ||
440 | } | ||
441 | |||
412 | /* Disable all interrupts and request them */ | 442 | /* Disable all interrupts and request them */ |
413 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); | 443 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_MASK_SET); |
414 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); | 444 | intrl2_0_writel(priv, 0xffffffff, INTRL2_CPU_CLEAR); |
@@ -484,7 +514,8 @@ out_free_irq0: | |||
484 | out_unmap: | 514 | out_unmap: |
485 | base = &priv->core; | 515 | base = &priv->core; |
486 | for (i = 0; i < BCM_SF2_REGS_NUM; i++) { | 516 | for (i = 0; i < BCM_SF2_REGS_NUM; i++) { |
487 | iounmap(*base); | 517 | if (*base) |
518 | iounmap(*base); | ||
488 | base++; | 519 | base++; |
489 | } | 520 | } |
490 | return ret; | 521 | return ret; |
@@ -733,29 +764,6 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) | |||
733 | return 0; | 764 | return 0; |
734 | } | 765 | } |
735 | 766 | ||
736 | static int bcm_sf2_sw_rst(struct bcm_sf2_priv *priv) | ||
737 | { | ||
738 | unsigned int timeout = 1000; | ||
739 | u32 reg; | ||
740 | |||
741 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
742 | reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET; | ||
743 | core_writel(priv, reg, CORE_WATCHDOG_CTRL); | ||
744 | |||
745 | do { | ||
746 | reg = core_readl(priv, CORE_WATCHDOG_CTRL); | ||
747 | if (!(reg & SOFTWARE_RESET)) | ||
748 | break; | ||
749 | |||
750 | usleep_range(1000, 2000); | ||
751 | } while (timeout-- > 0); | ||
752 | |||
753 | if (timeout == 0) | ||
754 | return -ETIMEDOUT; | ||
755 | |||
756 | return 0; | ||
757 | } | ||
758 | |||
759 | static int bcm_sf2_sw_resume(struct dsa_switch *ds) | 767 | static int bcm_sf2_sw_resume(struct dsa_switch *ds) |
760 | { | 768 | { |
761 | struct bcm_sf2_priv *priv = ds_to_priv(ds); | 769 | struct bcm_sf2_priv *priv = ds_to_priv(ds); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 2dc001559a97..43fd1b72c1ea 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8563,7 +8563,8 @@ static int tg3_init_rings(struct tg3 *tp) | |||
8563 | if (tnapi->rx_rcb) | 8563 | if (tnapi->rx_rcb) |
8564 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); | 8564 | memset(tnapi->rx_rcb, 0, TG3_RX_RCB_RING_BYTES(tp)); |
8565 | 8565 | ||
8566 | if (tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { | 8566 | if (tnapi->prodring.rx_std && |
8567 | tg3_rx_prodring_alloc(tp, &tnapi->prodring)) { | ||
8567 | tg3_free_rings(tp); | 8568 | tg3_free_rings(tp); |
8568 | return -ENOMEM; | 8569 | return -ENOMEM; |
8569 | } | 8570 | } |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 9070b98e15c4..dc77ec2bdafd 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4311,11 +4311,16 @@ static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh) | |||
4311 | return -EOPNOTSUPP; | 4311 | return -EOPNOTSUPP; |
4312 | 4312 | ||
4313 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); | 4313 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); |
4314 | if (!br_spec) | ||
4315 | return -EINVAL; | ||
4314 | 4316 | ||
4315 | nla_for_each_nested(attr, br_spec, rem) { | 4317 | nla_for_each_nested(attr, br_spec, rem) { |
4316 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | 4318 | if (nla_type(attr) != IFLA_BRIDGE_MODE) |
4317 | continue; | 4319 | continue; |
4318 | 4320 | ||
4321 | if (nla_len(attr) < sizeof(mode)) | ||
4322 | return -EINVAL; | ||
4323 | |||
4319 | mode = nla_get_u16(attr); | 4324 | mode = nla_get_u16(attr); |
4320 | if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) | 4325 | if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) |
4321 | return -EINVAL; | 4326 | return -EINVAL; |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index b0e12e7c4a3d..3c0221620c9d 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -1012,7 +1012,8 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx) | |||
1012 | /* igb_get_stats64() might access the rings on this vector, | 1012 | /* igb_get_stats64() might access the rings on this vector, |
1013 | * we must wait a grace period before freeing it. | 1013 | * we must wait a grace period before freeing it. |
1014 | */ | 1014 | */ |
1015 | kfree_rcu(q_vector, rcu); | 1015 | if (q_vector) |
1016 | kfree_rcu(q_vector, rcu); | ||
1016 | } | 1017 | } |
1017 | 1018 | ||
1018 | /** | 1019 | /** |
@@ -1792,8 +1793,10 @@ void igb_down(struct igb_adapter *adapter) | |||
1792 | adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; | 1793 | adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE; |
1793 | 1794 | ||
1794 | for (i = 0; i < adapter->num_q_vectors; i++) { | 1795 | for (i = 0; i < adapter->num_q_vectors; i++) { |
1795 | napi_synchronize(&(adapter->q_vector[i]->napi)); | 1796 | if (adapter->q_vector[i]) { |
1796 | napi_disable(&(adapter->q_vector[i]->napi)); | 1797 | napi_synchronize(&adapter->q_vector[i]->napi); |
1798 | napi_disable(&adapter->q_vector[i]->napi); | ||
1799 | } | ||
1797 | } | 1800 | } |
1798 | 1801 | ||
1799 | 1802 | ||
@@ -3714,7 +3717,8 @@ static void igb_free_all_tx_resources(struct igb_adapter *adapter) | |||
3714 | int i; | 3717 | int i; |
3715 | 3718 | ||
3716 | for (i = 0; i < adapter->num_tx_queues; i++) | 3719 | for (i = 0; i < adapter->num_tx_queues; i++) |
3717 | igb_free_tx_resources(adapter->tx_ring[i]); | 3720 | if (adapter->tx_ring[i]) |
3721 | igb_free_tx_resources(adapter->tx_ring[i]); | ||
3718 | } | 3722 | } |
3719 | 3723 | ||
3720 | void igb_unmap_and_free_tx_resource(struct igb_ring *ring, | 3724 | void igb_unmap_and_free_tx_resource(struct igb_ring *ring, |
@@ -3779,7 +3783,8 @@ static void igb_clean_all_tx_rings(struct igb_adapter *adapter) | |||
3779 | int i; | 3783 | int i; |
3780 | 3784 | ||
3781 | for (i = 0; i < adapter->num_tx_queues; i++) | 3785 | for (i = 0; i < adapter->num_tx_queues; i++) |
3782 | igb_clean_tx_ring(adapter->tx_ring[i]); | 3786 | if (adapter->tx_ring[i]) |
3787 | igb_clean_tx_ring(adapter->tx_ring[i]); | ||
3783 | } | 3788 | } |
3784 | 3789 | ||
3785 | /** | 3790 | /** |
@@ -3816,7 +3821,8 @@ static void igb_free_all_rx_resources(struct igb_adapter *adapter) | |||
3816 | int i; | 3821 | int i; |
3817 | 3822 | ||
3818 | for (i = 0; i < adapter->num_rx_queues; i++) | 3823 | for (i = 0; i < adapter->num_rx_queues; i++) |
3819 | igb_free_rx_resources(adapter->rx_ring[i]); | 3824 | if (adapter->rx_ring[i]) |
3825 | igb_free_rx_resources(adapter->rx_ring[i]); | ||
3820 | } | 3826 | } |
3821 | 3827 | ||
3822 | /** | 3828 | /** |
@@ -3871,7 +3877,8 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter) | |||
3871 | int i; | 3877 | int i; |
3872 | 3878 | ||
3873 | for (i = 0; i < adapter->num_rx_queues; i++) | 3879 | for (i = 0; i < adapter->num_rx_queues; i++) |
3874 | igb_clean_rx_ring(adapter->rx_ring[i]); | 3880 | if (adapter->rx_ring[i]) |
3881 | igb_clean_rx_ring(adapter->rx_ring[i]); | ||
3875 | } | 3882 | } |
3876 | 3883 | ||
3877 | /** | 3884 | /** |
@@ -7401,6 +7408,8 @@ static int igb_resume(struct device *dev) | |||
7401 | pci_restore_state(pdev); | 7408 | pci_restore_state(pdev); |
7402 | pci_save_state(pdev); | 7409 | pci_save_state(pdev); |
7403 | 7410 | ||
7411 | if (!pci_device_is_present(pdev)) | ||
7412 | return -ENODEV; | ||
7404 | err = pci_enable_device_mem(pdev); | 7413 | err = pci_enable_device_mem(pdev); |
7405 | if (err) { | 7414 | if (err) { |
7406 | dev_err(&pdev->dev, | 7415 | dev_err(&pdev->dev, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 932f77961d66..52776f9e1f71 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -3968,8 +3968,8 @@ void ixgbe_set_rx_mode(struct net_device *netdev) | |||
3968 | * if SR-IOV and VMDQ are disabled - otherwise ensure | 3968 | * if SR-IOV and VMDQ are disabled - otherwise ensure |
3969 | * that hardware VLAN filters remain enabled. | 3969 | * that hardware VLAN filters remain enabled. |
3970 | */ | 3970 | */ |
3971 | if (!(adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | | 3971 | if (adapter->flags & (IXGBE_FLAG_VMDQ_ENABLED | |
3972 | IXGBE_FLAG_SRIOV_ENABLED))) | 3972 | IXGBE_FLAG_SRIOV_ENABLED)) |
3973 | vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN); | 3973 | vlnctrl |= (IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN); |
3974 | } else { | 3974 | } else { |
3975 | if (netdev->flags & IFF_ALLMULTI) { | 3975 | if (netdev->flags & IFF_ALLMULTI) { |
@@ -7731,6 +7731,8 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, | |||
7731 | return -EOPNOTSUPP; | 7731 | return -EOPNOTSUPP; |
7732 | 7732 | ||
7733 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); | 7733 | br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); |
7734 | if (!br_spec) | ||
7735 | return -EINVAL; | ||
7734 | 7736 | ||
7735 | nla_for_each_nested(attr, br_spec, rem) { | 7737 | nla_for_each_nested(attr, br_spec, rem) { |
7736 | __u16 mode; | 7738 | __u16 mode; |
@@ -7739,6 +7741,9 @@ static int ixgbe_ndo_bridge_setlink(struct net_device *dev, | |||
7739 | if (nla_type(attr) != IFLA_BRIDGE_MODE) | 7741 | if (nla_type(attr) != IFLA_BRIDGE_MODE) |
7740 | continue; | 7742 | continue; |
7741 | 7743 | ||
7744 | if (nla_len(attr) < sizeof(mode)) | ||
7745 | return -EINVAL; | ||
7746 | |||
7742 | mode = nla_get_u16(attr); | 7747 | mode = nla_get_u16(attr); |
7743 | if (mode == BRIDGE_MODE_VEPA) { | 7748 | if (mode == BRIDGE_MODE_VEPA) { |
7744 | reg = 0; | 7749 | reg = 0; |
@@ -8041,6 +8046,7 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8041 | int i, err, pci_using_dac, expected_gts; | 8046 | int i, err, pci_using_dac, expected_gts; |
8042 | unsigned int indices = MAX_TX_QUEUES; | 8047 | unsigned int indices = MAX_TX_QUEUES; |
8043 | u8 part_str[IXGBE_PBANUM_LENGTH]; | 8048 | u8 part_str[IXGBE_PBANUM_LENGTH]; |
8049 | bool disable_dev = false; | ||
8044 | #ifdef IXGBE_FCOE | 8050 | #ifdef IXGBE_FCOE |
8045 | u16 device_caps; | 8051 | u16 device_caps; |
8046 | #endif | 8052 | #endif |
@@ -8435,13 +8441,14 @@ err_sw_init: | |||
8435 | iounmap(adapter->io_addr); | 8441 | iounmap(adapter->io_addr); |
8436 | kfree(adapter->mac_table); | 8442 | kfree(adapter->mac_table); |
8437 | err_ioremap: | 8443 | err_ioremap: |
8444 | disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); | ||
8438 | free_netdev(netdev); | 8445 | free_netdev(netdev); |
8439 | err_alloc_etherdev: | 8446 | err_alloc_etherdev: |
8440 | pci_release_selected_regions(pdev, | 8447 | pci_release_selected_regions(pdev, |
8441 | pci_select_bars(pdev, IORESOURCE_MEM)); | 8448 | pci_select_bars(pdev, IORESOURCE_MEM)); |
8442 | err_pci_reg: | 8449 | err_pci_reg: |
8443 | err_dma: | 8450 | err_dma: |
8444 | if (!adapter || !test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) | 8451 | if (!adapter || disable_dev) |
8445 | pci_disable_device(pdev); | 8452 | pci_disable_device(pdev); |
8446 | return err; | 8453 | return err; |
8447 | } | 8454 | } |
@@ -8459,6 +8466,7 @@ static void ixgbe_remove(struct pci_dev *pdev) | |||
8459 | { | 8466 | { |
8460 | struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); | 8467 | struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); |
8461 | struct net_device *netdev = adapter->netdev; | 8468 | struct net_device *netdev = adapter->netdev; |
8469 | bool disable_dev; | ||
8462 | 8470 | ||
8463 | ixgbe_dbg_adapter_exit(adapter); | 8471 | ixgbe_dbg_adapter_exit(adapter); |
8464 | 8472 | ||
@@ -8508,11 +8516,12 @@ static void ixgbe_remove(struct pci_dev *pdev) | |||
8508 | e_dev_info("complete\n"); | 8516 | e_dev_info("complete\n"); |
8509 | 8517 | ||
8510 | kfree(adapter->mac_table); | 8518 | kfree(adapter->mac_table); |
8519 | disable_dev = !test_and_set_bit(__IXGBE_DISABLED, &adapter->state); | ||
8511 | free_netdev(netdev); | 8520 | free_netdev(netdev); |
8512 | 8521 | ||
8513 | pci_disable_pcie_error_reporting(pdev); | 8522 | pci_disable_pcie_error_reporting(pdev); |
8514 | 8523 | ||
8515 | if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state)) | 8524 | if (disable_dev) |
8516 | pci_disable_device(pdev); | 8525 | pci_disable_device(pdev); |
8517 | } | 8526 | } |
8518 | 8527 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index d718ca0f88da..16f617b5749e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -1546,7 +1546,7 @@ static int qp_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd, | |||
1546 | 1546 | ||
1547 | switch (op) { | 1547 | switch (op) { |
1548 | case RES_OP_RESERVE: | 1548 | case RES_OP_RESERVE: |
1549 | count = get_param_l(&in_param); | 1549 | count = get_param_l(&in_param) & 0xffffff; |
1550 | align = get_param_h(&in_param); | 1550 | align = get_param_h(&in_param); |
1551 | err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); | 1551 | err = mlx4_grant_resource(dev, slave, RES_QP, count, 0); |
1552 | if (err) | 1552 | if (err) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 15814b79ff10..07054ce84ba8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -188,12 +188,6 @@ static int stmmac_probe_config_dt(struct platform_device *pdev, | |||
188 | */ | 188 | */ |
189 | plat->maxmtu = JUMBO_LEN; | 189 | plat->maxmtu = JUMBO_LEN; |
190 | 190 | ||
191 | /* Set default value for multicast hash bins */ | ||
192 | plat->multicast_filter_bins = HASH_TABLE_SIZE; | ||
193 | |||
194 | /* Set default value for unicast filter entries */ | ||
195 | plat->unicast_filter_entries = 1; | ||
196 | |||
197 | /* | 191 | /* |
198 | * Currently only the properties needed on SPEAr600 | 192 | * Currently only the properties needed on SPEAr600 |
199 | * are provided. All other properties should be added | 193 | * are provided. All other properties should be added |
@@ -281,6 +275,13 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) | |||
281 | return PTR_ERR(addr); | 275 | return PTR_ERR(addr); |
282 | 276 | ||
283 | plat_dat = dev_get_platdata(&pdev->dev); | 277 | plat_dat = dev_get_platdata(&pdev->dev); |
278 | |||
279 | /* Set default value for multicast hash bins */ | ||
280 | plat_dat->multicast_filter_bins = HASH_TABLE_SIZE; | ||
281 | |||
282 | /* Set default value for unicast filter entries */ | ||
283 | plat_dat->unicast_filter_entries = 1; | ||
284 | |||
284 | if (pdev->dev.of_node) { | 285 | if (pdev->dev.of_node) { |
285 | if (!plat_dat) | 286 | if (!plat_dat) |
286 | plat_dat = devm_kzalloc(&pdev->dev, | 287 | plat_dat = devm_kzalloc(&pdev->dev, |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index e9f81d463659..d802a1ae4560 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2299,9 +2299,9 @@ static struct socket *vxlan_create_sock(struct net *net, bool ipv6, | |||
2299 | if (ipv6) { | 2299 | if (ipv6) { |
2300 | udp_conf.family = AF_INET6; | 2300 | udp_conf.family = AF_INET6; |
2301 | udp_conf.use_udp6_tx_checksums = | 2301 | udp_conf.use_udp6_tx_checksums = |
2302 | !!(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); | 2302 | !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX); |
2303 | udp_conf.use_udp6_rx_checksums = | 2303 | udp_conf.use_udp6_rx_checksums = |
2304 | !!(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); | 2304 | !(flags & VXLAN_F_UDP_ZERO_CSUM6_RX); |
2305 | } else { | 2305 | } else { |
2306 | udp_conf.family = AF_INET; | 2306 | udp_conf.family = AF_INET; |
2307 | udp_conf.local_ip.s_addr = INADDR_ANY; | 2307 | udp_conf.local_ip.s_addr = INADDR_ANY; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index 6f7ae5f7bdae..649fdae77383 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
@@ -155,6 +155,7 @@ enum iwl_ucode_tlv_api { | |||
155 | * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests | 155 | * @IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT: supports Quiet Period requests |
156 | * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA), | 156 | * @IWL_UCODE_TLV_CAPA_DQA_SUPPORT: supports dynamic queue allocation (DQA), |
157 | * which also implies support for the scheduler configuration command | 157 | * which also implies support for the scheduler configuration command |
158 | * @IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT: supports Hot Spot Command | ||
158 | */ | 159 | */ |
159 | enum iwl_ucode_tlv_capa { | 160 | enum iwl_ucode_tlv_capa { |
160 | IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), | 161 | IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), |
@@ -163,6 +164,7 @@ enum iwl_ucode_tlv_capa { | |||
163 | IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), | 164 | IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), |
164 | IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), | 165 | IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), |
165 | IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), | 166 | IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), |
167 | IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = BIT(18), | ||
166 | }; | 168 | }; |
167 | 169 | ||
168 | /* The default calibrate table size if not specified by firmware file */ | 170 | /* The default calibrate table size if not specified by firmware file */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 57325589ee5b..1ee9dcd26ad9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -2486,9 +2486,15 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw, | |||
2486 | 2486 | ||
2487 | switch (vif->type) { | 2487 | switch (vif->type) { |
2488 | case NL80211_IFTYPE_STATION: | 2488 | case NL80211_IFTYPE_STATION: |
2489 | /* Use aux roc framework (HS20) */ | 2489 | if (mvm->fw->ucode_capa.capa[0] & |
2490 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | 2490 | IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT) { |
2491 | vif, duration); | 2491 | /* Use aux roc framework (HS20) */ |
2492 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | ||
2493 | vif, duration); | ||
2494 | goto out_unlock; | ||
2495 | } | ||
2496 | IWL_ERR(mvm, "hotspot not supported\n"); | ||
2497 | ret = -EINVAL; | ||
2492 | goto out_unlock; | 2498 | goto out_unlock; |
2493 | case NL80211_IFTYPE_P2P_DEVICE: | 2499 | case NL80211_IFTYPE_P2P_DEVICE: |
2494 | /* handle below */ | 2500 | /* handle below */ |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 61f5d36eca6a..846a2e6e34d8 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -2249,6 +2249,16 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
2249 | /*like read eeprom and so on */ | 2249 | /*like read eeprom and so on */ |
2250 | rtlpriv->cfg->ops->read_eeprom_info(hw); | 2250 | rtlpriv->cfg->ops->read_eeprom_info(hw); |
2251 | 2251 | ||
2252 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
2253 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
2254 | err = -ENODEV; | ||
2255 | goto fail3; | ||
2256 | } | ||
2257 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
2258 | |||
2259 | /*aspm */ | ||
2260 | rtl_pci_init_aspm(hw); | ||
2261 | |||
2252 | /* Init mac80211 sw */ | 2262 | /* Init mac80211 sw */ |
2253 | err = rtl_init_core(hw); | 2263 | err = rtl_init_core(hw); |
2254 | if (err) { | 2264 | if (err) { |
@@ -2264,16 +2274,6 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
2264 | goto fail3; | 2274 | goto fail3; |
2265 | } | 2275 | } |
2266 | 2276 | ||
2267 | if (rtlpriv->cfg->ops->init_sw_vars(hw)) { | ||
2268 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); | ||
2269 | err = -ENODEV; | ||
2270 | goto fail3; | ||
2271 | } | ||
2272 | rtlpriv->cfg->ops->init_sw_leds(hw); | ||
2273 | |||
2274 | /*aspm */ | ||
2275 | rtl_pci_init_aspm(hw); | ||
2276 | |||
2277 | err = ieee80211_register_hw(hw); | 2277 | err = ieee80211_register_hw(hw); |
2278 | if (err) { | 2278 | if (err) { |
2279 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 2279 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c index 310d3163dc5b..8ec8200002c7 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c | |||
@@ -3672,8 +3672,9 @@ static void rtl8821ae_update_hal_rate_mask(struct ieee80211_hw *hw, | |||
3672 | mac->opmode == NL80211_IFTYPE_ADHOC) | 3672 | mac->opmode == NL80211_IFTYPE_ADHOC) |
3673 | macid = sta->aid + 1; | 3673 | macid = sta->aid + 1; |
3674 | if (wirelessmode == WIRELESS_MODE_N_5G || | 3674 | if (wirelessmode == WIRELESS_MODE_N_5G || |
3675 | wirelessmode == WIRELESS_MODE_AC_5G) | 3675 | wirelessmode == WIRELESS_MODE_AC_5G || |
3676 | ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ]; | 3676 | wirelessmode == WIRELESS_MODE_A) |
3677 | ratr_bitmap = sta->supp_rates[NL80211_BAND_5GHZ] << 4; | ||
3677 | else | 3678 | else |
3678 | ratr_bitmap = sta->supp_rates[NL80211_BAND_2GHZ]; | 3679 | ratr_bitmap = sta->supp_rates[NL80211_BAND_2GHZ]; |
3679 | 3680 | ||
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 4e56a27f9689..fab0d4b42f58 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -39,7 +39,7 @@ struct backend_info { | |||
39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); | 39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); |
40 | static void connect(struct backend_info *be); | 40 | static void connect(struct backend_info *be); |
41 | static int read_xenbus_vif_flags(struct backend_info *be); | 41 | static int read_xenbus_vif_flags(struct backend_info *be); |
42 | static void backend_create_xenvif(struct backend_info *be); | 42 | static int backend_create_xenvif(struct backend_info *be); |
43 | static void unregister_hotplug_status_watch(struct backend_info *be); | 43 | static void unregister_hotplug_status_watch(struct backend_info *be); |
44 | static void set_backend_state(struct backend_info *be, | 44 | static void set_backend_state(struct backend_info *be, |
45 | enum xenbus_state state); | 45 | enum xenbus_state state); |
@@ -352,7 +352,9 @@ static int netback_probe(struct xenbus_device *dev, | |||
352 | be->state = XenbusStateInitWait; | 352 | be->state = XenbusStateInitWait; |
353 | 353 | ||
354 | /* This kicks hotplug scripts, so do it immediately. */ | 354 | /* This kicks hotplug scripts, so do it immediately. */ |
355 | backend_create_xenvif(be); | 355 | err = backend_create_xenvif(be); |
356 | if (err) | ||
357 | goto fail; | ||
356 | 358 | ||
357 | return 0; | 359 | return 0; |
358 | 360 | ||
@@ -397,19 +399,19 @@ static int netback_uevent(struct xenbus_device *xdev, | |||
397 | } | 399 | } |
398 | 400 | ||
399 | 401 | ||
400 | static void backend_create_xenvif(struct backend_info *be) | 402 | static int backend_create_xenvif(struct backend_info *be) |
401 | { | 403 | { |
402 | int err; | 404 | int err; |
403 | long handle; | 405 | long handle; |
404 | struct xenbus_device *dev = be->dev; | 406 | struct xenbus_device *dev = be->dev; |
405 | 407 | ||
406 | if (be->vif != NULL) | 408 | if (be->vif != NULL) |
407 | return; | 409 | return 0; |
408 | 410 | ||
409 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); | 411 | err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle); |
410 | if (err != 1) { | 412 | if (err != 1) { |
411 | xenbus_dev_fatal(dev, err, "reading handle"); | 413 | xenbus_dev_fatal(dev, err, "reading handle"); |
412 | return; | 414 | return (err < 0) ? err : -EINVAL; |
413 | } | 415 | } |
414 | 416 | ||
415 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); | 417 | be->vif = xenvif_alloc(&dev->dev, dev->otherend_id, handle); |
@@ -417,10 +419,11 @@ static void backend_create_xenvif(struct backend_info *be) | |||
417 | err = PTR_ERR(be->vif); | 419 | err = PTR_ERR(be->vif); |
418 | be->vif = NULL; | 420 | be->vif = NULL; |
419 | xenbus_dev_fatal(dev, err, "creating interface"); | 421 | xenbus_dev_fatal(dev, err, "creating interface"); |
420 | return; | 422 | return err; |
421 | } | 423 | } |
422 | 424 | ||
423 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); | 425 | kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); |
426 | return 0; | ||
424 | } | 427 | } |
425 | 428 | ||
426 | static void backend_disconnect(struct backend_info *be) | 429 | static void backend_disconnect(struct backend_info *be) |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 9fab30af0e75..084587d7cd13 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -590,6 +590,20 @@ static struct msi_desc *msi_setup_entry(struct pci_dev *dev) | |||
590 | return entry; | 590 | return entry; |
591 | } | 591 | } |
592 | 592 | ||
593 | static int msi_verify_entries(struct pci_dev *dev) | ||
594 | { | ||
595 | struct msi_desc *entry; | ||
596 | |||
597 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
598 | if (!dev->no_64bit_msi || !entry->msg.address_hi) | ||
599 | continue; | ||
600 | dev_err(&dev->dev, "Device has broken 64-bit MSI but arch" | ||
601 | " tried to assign one above 4G\n"); | ||
602 | return -EIO; | ||
603 | } | ||
604 | return 0; | ||
605 | } | ||
606 | |||
593 | /** | 607 | /** |
594 | * msi_capability_init - configure device's MSI capability structure | 608 | * msi_capability_init - configure device's MSI capability structure |
595 | * @dev: pointer to the pci_dev data structure of MSI device function | 609 | * @dev: pointer to the pci_dev data structure of MSI device function |
@@ -627,6 +641,13 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
627 | return ret; | 641 | return ret; |
628 | } | 642 | } |
629 | 643 | ||
644 | ret = msi_verify_entries(dev); | ||
645 | if (ret) { | ||
646 | msi_mask_irq(entry, mask, ~mask); | ||
647 | free_msi_irqs(dev); | ||
648 | return ret; | ||
649 | } | ||
650 | |||
630 | ret = populate_msi_sysfs(dev); | 651 | ret = populate_msi_sysfs(dev); |
631 | if (ret) { | 652 | if (ret) { |
632 | msi_mask_irq(entry, mask, ~mask); | 653 | msi_mask_irq(entry, mask, ~mask); |
@@ -739,6 +760,11 @@ static int msix_capability_init(struct pci_dev *dev, | |||
739 | if (ret) | 760 | if (ret) |
740 | goto out_avail; | 761 | goto out_avail; |
741 | 762 | ||
763 | /* Check if all MSI entries honor device restrictions */ | ||
764 | ret = msi_verify_entries(dev); | ||
765 | if (ret) | ||
766 | goto out_free; | ||
767 | |||
742 | /* | 768 | /* |
743 | * Some devices require MSI-X to be enabled before we can touch the | 769 | * Some devices require MSI-X to be enabled before we can touch the |
744 | * MSI-X registers. We need to mask all the vectors to prevent | 770 | * MSI-X registers. We need to mask all the vectors to prevent |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 79e5c94107a9..72533c58c1f3 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -412,6 +412,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
412 | struct fc_frame_header *fh; | 412 | struct fc_frame_header *fh; |
413 | struct fcoe_rcv_info *fr; | 413 | struct fcoe_rcv_info *fr; |
414 | struct fcoe_percpu_s *bg; | 414 | struct fcoe_percpu_s *bg; |
415 | struct sk_buff *tmp_skb; | ||
415 | unsigned short oxid; | 416 | unsigned short oxid; |
416 | 417 | ||
417 | interface = container_of(ptype, struct bnx2fc_interface, | 418 | interface = container_of(ptype, struct bnx2fc_interface, |
@@ -424,6 +425,12 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
424 | goto err; | 425 | goto err; |
425 | } | 426 | } |
426 | 427 | ||
428 | tmp_skb = skb_share_check(skb, GFP_ATOMIC); | ||
429 | if (!tmp_skb) | ||
430 | goto err; | ||
431 | |||
432 | skb = tmp_skb; | ||
433 | |||
427 | if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { | 434 | if (unlikely(eth_hdr(skb)->h_proto != htons(ETH_P_FCOE))) { |
428 | printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n"); | 435 | printk(KERN_ERR PFX "bnx2fc_rcv: Wrong FC type frame\n"); |
429 | goto err; | 436 | goto err; |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index 49014a143c6a..c1d04d4d3c6c 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -202,6 +202,7 @@ static struct { | |||
202 | {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, | 202 | {"IOMEGA", "Io20S *F", NULL, BLIST_KEY}, |
203 | {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, | 203 | {"INSITE", "Floptical F*8I", NULL, BLIST_KEY}, |
204 | {"INSITE", "I325VM", NULL, BLIST_KEY}, | 204 | {"INSITE", "I325VM", NULL, BLIST_KEY}, |
205 | {"Intel", "Multi-Flex", NULL, BLIST_NO_RSOC}, | ||
205 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, | 206 | {"iRiver", "iFP Mass Driver", NULL, BLIST_NOT_LOCKABLE | BLIST_INQUIRY_36}, |
206 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, | 207 | {"LASOUND", "CDX7405", "3.10", BLIST_MAX5LUN | BLIST_SINGLELUN}, |
207 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 208 | {"MATSHITA", "PD-1", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 8adf067ff019..1c3467b82566 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c | |||
@@ -102,7 +102,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
102 | clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), | 102 | clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), |
103 | GFP_KERNEL); | 103 | GFP_KERNEL); |
104 | if (!clkfreq) { | 104 | if (!clkfreq) { |
105 | dev_err(dev, "%s: no memory\n", "freq-table-hz"); | ||
106 | ret = -ENOMEM; | 105 | ret = -ENOMEM; |
107 | goto out; | 106 | goto out; |
108 | } | 107 | } |
@@ -112,19 +111,19 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
112 | if (ret && (ret != -EINVAL)) { | 111 | if (ret && (ret != -EINVAL)) { |
113 | dev_err(dev, "%s: error reading array %d\n", | 112 | dev_err(dev, "%s: error reading array %d\n", |
114 | "freq-table-hz", ret); | 113 | "freq-table-hz", ret); |
115 | goto free_clkfreq; | 114 | return ret; |
116 | } | 115 | } |
117 | 116 | ||
118 | for (i = 0; i < sz; i += 2) { | 117 | for (i = 0; i < sz; i += 2) { |
119 | ret = of_property_read_string_index(np, | 118 | ret = of_property_read_string_index(np, |
120 | "clock-names", i/2, (const char **)&name); | 119 | "clock-names", i/2, (const char **)&name); |
121 | if (ret) | 120 | if (ret) |
122 | goto free_clkfreq; | 121 | goto out; |
123 | 122 | ||
124 | clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); | 123 | clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); |
125 | if (!clki) { | 124 | if (!clki) { |
126 | ret = -ENOMEM; | 125 | ret = -ENOMEM; |
127 | goto free_clkfreq; | 126 | goto out; |
128 | } | 127 | } |
129 | 128 | ||
130 | clki->min_freq = clkfreq[i]; | 129 | clki->min_freq = clkfreq[i]; |
@@ -134,8 +133,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) | |||
134 | clki->min_freq, clki->max_freq, clki->name); | 133 | clki->min_freq, clki->max_freq, clki->name); |
135 | list_add_tail(&clki->list, &hba->clk_list_head); | 134 | list_add_tail(&clki->list, &hba->clk_list_head); |
136 | } | 135 | } |
137 | free_clkfreq: | ||
138 | kfree(clkfreq); | ||
139 | out: | 136 | out: |
140 | return ret; | 137 | return ret; |
141 | } | 138 | } |
@@ -162,10 +159,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, | |||
162 | } | 159 | } |
163 | 160 | ||
164 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); | 161 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); |
165 | if (!vreg) { | 162 | if (!vreg) |
166 | dev_err(dev, "No memory for %s regulator\n", name); | 163 | return -ENOMEM; |
167 | goto out; | ||
168 | } | ||
169 | 164 | ||
170 | vreg->name = kstrdup(name, GFP_KERNEL); | 165 | vreg->name = kstrdup(name, GFP_KERNEL); |
171 | 166 | ||
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 497c38a4a866..605ca60e8a10 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -744,6 +744,8 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) | |||
744 | if (!ufshcd_is_clkgating_allowed(hba)) | 744 | if (!ufshcd_is_clkgating_allowed(hba)) |
745 | return; | 745 | return; |
746 | device_remove_file(hba->dev, &hba->clk_gating.delay_attr); | 746 | device_remove_file(hba->dev, &hba->clk_gating.delay_attr); |
747 | cancel_work_sync(&hba->clk_gating.ungate_work); | ||
748 | cancel_delayed_work_sync(&hba->clk_gating.gate_work); | ||
747 | } | 749 | } |
748 | 750 | ||
749 | /* Must be called with host lock acquired */ | 751 | /* Must be called with host lock acquired */ |
@@ -2246,6 +2248,22 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba) | |||
2246 | return ret; | 2248 | return ret; |
2247 | } | 2249 | } |
2248 | 2250 | ||
2251 | /** | ||
2252 | * ufshcd_init_pwr_info - setting the POR (power on reset) | ||
2253 | * values in hba power info | ||
2254 | * @hba: per-adapter instance | ||
2255 | */ | ||
2256 | static void ufshcd_init_pwr_info(struct ufs_hba *hba) | ||
2257 | { | ||
2258 | hba->pwr_info.gear_rx = UFS_PWM_G1; | ||
2259 | hba->pwr_info.gear_tx = UFS_PWM_G1; | ||
2260 | hba->pwr_info.lane_rx = 1; | ||
2261 | hba->pwr_info.lane_tx = 1; | ||
2262 | hba->pwr_info.pwr_rx = SLOWAUTO_MODE; | ||
2263 | hba->pwr_info.pwr_tx = SLOWAUTO_MODE; | ||
2264 | hba->pwr_info.hs_rate = 0; | ||
2265 | } | ||
2266 | |||
2249 | /** | 2267 | /** |
2250 | * ufshcd_get_max_pwr_mode - reads the max power mode negotiated with device | 2268 | * ufshcd_get_max_pwr_mode - reads the max power mode negotiated with device |
2251 | * @hba: per-adapter instance | 2269 | * @hba: per-adapter instance |
@@ -2844,8 +2862,13 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev) | |||
2844 | hba = shost_priv(sdev->host); | 2862 | hba = shost_priv(sdev->host); |
2845 | scsi_deactivate_tcq(sdev, hba->nutrs); | 2863 | scsi_deactivate_tcq(sdev, hba->nutrs); |
2846 | /* Drop the reference as it won't be needed anymore */ | 2864 | /* Drop the reference as it won't be needed anymore */ |
2847 | if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) | 2865 | if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN) { |
2866 | unsigned long flags; | ||
2867 | |||
2868 | spin_lock_irqsave(hba->host->host_lock, flags); | ||
2848 | hba->sdev_ufs_device = NULL; | 2869 | hba->sdev_ufs_device = NULL; |
2870 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
2871 | } | ||
2849 | } | 2872 | } |
2850 | 2873 | ||
2851 | /** | 2874 | /** |
@@ -4062,6 +4085,8 @@ static void ufshcd_init_icc_levels(struct ufs_hba *hba) | |||
4062 | static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) | 4085 | static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) |
4063 | { | 4086 | { |
4064 | int ret = 0; | 4087 | int ret = 0; |
4088 | struct scsi_device *sdev_rpmb; | ||
4089 | struct scsi_device *sdev_boot; | ||
4065 | 4090 | ||
4066 | hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, | 4091 | hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, |
4067 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); | 4092 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_UFS_DEVICE_WLUN), NULL); |
@@ -4070,26 +4095,27 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) | |||
4070 | hba->sdev_ufs_device = NULL; | 4095 | hba->sdev_ufs_device = NULL; |
4071 | goto out; | 4096 | goto out; |
4072 | } | 4097 | } |
4098 | scsi_device_put(hba->sdev_ufs_device); | ||
4073 | 4099 | ||
4074 | hba->sdev_boot = __scsi_add_device(hba->host, 0, 0, | 4100 | sdev_boot = __scsi_add_device(hba->host, 0, 0, |
4075 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); | 4101 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); |
4076 | if (IS_ERR(hba->sdev_boot)) { | 4102 | if (IS_ERR(sdev_boot)) { |
4077 | ret = PTR_ERR(hba->sdev_boot); | 4103 | ret = PTR_ERR(sdev_boot); |
4078 | hba->sdev_boot = NULL; | ||
4079 | goto remove_sdev_ufs_device; | 4104 | goto remove_sdev_ufs_device; |
4080 | } | 4105 | } |
4106 | scsi_device_put(sdev_boot); | ||
4081 | 4107 | ||
4082 | hba->sdev_rpmb = __scsi_add_device(hba->host, 0, 0, | 4108 | sdev_rpmb = __scsi_add_device(hba->host, 0, 0, |
4083 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); | 4109 | ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); |
4084 | if (IS_ERR(hba->sdev_rpmb)) { | 4110 | if (IS_ERR(sdev_rpmb)) { |
4085 | ret = PTR_ERR(hba->sdev_rpmb); | 4111 | ret = PTR_ERR(sdev_rpmb); |
4086 | hba->sdev_rpmb = NULL; | ||
4087 | goto remove_sdev_boot; | 4112 | goto remove_sdev_boot; |
4088 | } | 4113 | } |
4114 | scsi_device_put(sdev_rpmb); | ||
4089 | goto out; | 4115 | goto out; |
4090 | 4116 | ||
4091 | remove_sdev_boot: | 4117 | remove_sdev_boot: |
4092 | scsi_remove_device(hba->sdev_boot); | 4118 | scsi_remove_device(sdev_boot); |
4093 | remove_sdev_ufs_device: | 4119 | remove_sdev_ufs_device: |
4094 | scsi_remove_device(hba->sdev_ufs_device); | 4120 | scsi_remove_device(hba->sdev_ufs_device); |
4095 | out: | 4121 | out: |
@@ -4097,30 +4123,6 @@ out: | |||
4097 | } | 4123 | } |
4098 | 4124 | ||
4099 | /** | 4125 | /** |
4100 | * ufshcd_scsi_remove_wlus - Removes the W-LUs which were added by | ||
4101 | * ufshcd_scsi_add_wlus() | ||
4102 | * @hba: per-adapter instance | ||
4103 | * | ||
4104 | */ | ||
4105 | static void ufshcd_scsi_remove_wlus(struct ufs_hba *hba) | ||
4106 | { | ||
4107 | if (hba->sdev_ufs_device) { | ||
4108 | scsi_remove_device(hba->sdev_ufs_device); | ||
4109 | hba->sdev_ufs_device = NULL; | ||
4110 | } | ||
4111 | |||
4112 | if (hba->sdev_boot) { | ||
4113 | scsi_remove_device(hba->sdev_boot); | ||
4114 | hba->sdev_boot = NULL; | ||
4115 | } | ||
4116 | |||
4117 | if (hba->sdev_rpmb) { | ||
4118 | scsi_remove_device(hba->sdev_rpmb); | ||
4119 | hba->sdev_rpmb = NULL; | ||
4120 | } | ||
4121 | } | ||
4122 | |||
4123 | /** | ||
4124 | * ufshcd_probe_hba - probe hba to detect device and initialize | 4126 | * ufshcd_probe_hba - probe hba to detect device and initialize |
4125 | * @hba: per-adapter instance | 4127 | * @hba: per-adapter instance |
4126 | * | 4128 | * |
@@ -4134,6 +4136,8 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) | |||
4134 | if (ret) | 4136 | if (ret) |
4135 | goto out; | 4137 | goto out; |
4136 | 4138 | ||
4139 | ufshcd_init_pwr_info(hba); | ||
4140 | |||
4137 | /* UniPro link is active now */ | 4141 | /* UniPro link is active now */ |
4138 | ufshcd_set_link_active(hba); | 4142 | ufshcd_set_link_active(hba); |
4139 | 4143 | ||
@@ -4264,12 +4268,18 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, | |||
4264 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, | 4268 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, |
4265 | struct ufs_vreg *vreg) | 4269 | struct ufs_vreg *vreg) |
4266 | { | 4270 | { |
4271 | if (!vreg) | ||
4272 | return 0; | ||
4273 | |||
4267 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); | 4274 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); |
4268 | } | 4275 | } |
4269 | 4276 | ||
4270 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, | 4277 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, |
4271 | struct ufs_vreg *vreg) | 4278 | struct ufs_vreg *vreg) |
4272 | { | 4279 | { |
4280 | if (!vreg) | ||
4281 | return 0; | ||
4282 | |||
4273 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); | 4283 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); |
4274 | } | 4284 | } |
4275 | 4285 | ||
@@ -4471,7 +4481,7 @@ out: | |||
4471 | if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) | 4481 | if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled) |
4472 | clk_disable_unprepare(clki->clk); | 4482 | clk_disable_unprepare(clki->clk); |
4473 | } | 4483 | } |
4474 | } else if (!ret && on) { | 4484 | } else if (on) { |
4475 | spin_lock_irqsave(hba->host->host_lock, flags); | 4485 | spin_lock_irqsave(hba->host->host_lock, flags); |
4476 | hba->clk_gating.state = CLKS_ON; | 4486 | hba->clk_gating.state = CLKS_ON; |
4477 | spin_unlock_irqrestore(hba->host->host_lock, flags); | 4487 | spin_unlock_irqrestore(hba->host->host_lock, flags); |
@@ -4675,11 +4685,25 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, | |||
4675 | { | 4685 | { |
4676 | unsigned char cmd[6] = { START_STOP }; | 4686 | unsigned char cmd[6] = { START_STOP }; |
4677 | struct scsi_sense_hdr sshdr; | 4687 | struct scsi_sense_hdr sshdr; |
4678 | struct scsi_device *sdp = hba->sdev_ufs_device; | 4688 | struct scsi_device *sdp; |
4689 | unsigned long flags; | ||
4679 | int ret; | 4690 | int ret; |
4680 | 4691 | ||
4681 | if (!sdp || !scsi_device_online(sdp)) | 4692 | spin_lock_irqsave(hba->host->host_lock, flags); |
4682 | return -ENODEV; | 4693 | sdp = hba->sdev_ufs_device; |
4694 | if (sdp) { | ||
4695 | ret = scsi_device_get(sdp); | ||
4696 | if (!ret && !scsi_device_online(sdp)) { | ||
4697 | ret = -ENODEV; | ||
4698 | scsi_device_put(sdp); | ||
4699 | } | ||
4700 | } else { | ||
4701 | ret = -ENODEV; | ||
4702 | } | ||
4703 | spin_unlock_irqrestore(hba->host->host_lock, flags); | ||
4704 | |||
4705 | if (ret) | ||
4706 | return ret; | ||
4683 | 4707 | ||
4684 | /* | 4708 | /* |
4685 | * If scsi commands fail, the scsi mid-layer schedules scsi error- | 4709 | * If scsi commands fail, the scsi mid-layer schedules scsi error- |
@@ -4718,6 +4742,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, | |||
4718 | if (!ret) | 4742 | if (!ret) |
4719 | hba->curr_dev_pwr_mode = pwr_mode; | 4743 | hba->curr_dev_pwr_mode = pwr_mode; |
4720 | out: | 4744 | out: |
4745 | scsi_device_put(sdp); | ||
4721 | hba->host->eh_noresume = 0; | 4746 | hba->host->eh_noresume = 0; |
4722 | return ret; | 4747 | return ret; |
4723 | } | 4748 | } |
@@ -5087,7 +5112,7 @@ int ufshcd_system_suspend(struct ufs_hba *hba) | |||
5087 | int ret = 0; | 5112 | int ret = 0; |
5088 | 5113 | ||
5089 | if (!hba || !hba->is_powered) | 5114 | if (!hba || !hba->is_powered) |
5090 | goto out; | 5115 | return 0; |
5091 | 5116 | ||
5092 | if (pm_runtime_suspended(hba->dev)) { | 5117 | if (pm_runtime_suspended(hba->dev)) { |
5093 | if (hba->rpm_lvl == hba->spm_lvl) | 5118 | if (hba->rpm_lvl == hba->spm_lvl) |
@@ -5231,7 +5256,6 @@ EXPORT_SYMBOL(ufshcd_shutdown); | |||
5231 | void ufshcd_remove(struct ufs_hba *hba) | 5256 | void ufshcd_remove(struct ufs_hba *hba) |
5232 | { | 5257 | { |
5233 | scsi_remove_host(hba->host); | 5258 | scsi_remove_host(hba->host); |
5234 | ufshcd_scsi_remove_wlus(hba); | ||
5235 | /* disable interrupts */ | 5259 | /* disable interrupts */ |
5236 | ufshcd_disable_intr(hba, hba->intr_mask); | 5260 | ufshcd_disable_intr(hba, hba->intr_mask); |
5237 | ufshcd_hba_stop(hba); | 5261 | ufshcd_hba_stop(hba); |
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 58ecdff5065c..4a574aa45855 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h | |||
@@ -392,8 +392,6 @@ struct ufs_hba { | |||
392 | * "UFS device" W-LU. | 392 | * "UFS device" W-LU. |
393 | */ | 393 | */ |
394 | struct scsi_device *sdev_ufs_device; | 394 | struct scsi_device *sdev_ufs_device; |
395 | struct scsi_device *sdev_rpmb; | ||
396 | struct scsi_device *sdev_boot; | ||
397 | 395 | ||
398 | enum ufs_dev_pwr_mode curr_dev_pwr_mode; | 396 | enum ufs_dev_pwr_mode curr_dev_pwr_mode; |
399 | enum uic_link_state uic_link_state; | 397 | enum uic_link_state uic_link_state; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 72e12bad14b9..d0d5542efc06 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -376,9 +376,6 @@ static void pump_transfers(unsigned long data) | |||
376 | chip = dws->cur_chip; | 376 | chip = dws->cur_chip; |
377 | spi = message->spi; | 377 | spi = message->spi; |
378 | 378 | ||
379 | if (unlikely(!chip->clk_div)) | ||
380 | chip->clk_div = dws->max_freq / chip->speed_hz; | ||
381 | |||
382 | if (message->state == ERROR_STATE) { | 379 | if (message->state == ERROR_STATE) { |
383 | message->status = -EIO; | 380 | message->status = -EIO; |
384 | goto early_exit; | 381 | goto early_exit; |
@@ -419,7 +416,7 @@ static void pump_transfers(unsigned long data) | |||
419 | if (transfer->speed_hz) { | 416 | if (transfer->speed_hz) { |
420 | speed = chip->speed_hz; | 417 | speed = chip->speed_hz; |
421 | 418 | ||
422 | if (transfer->speed_hz != speed) { | 419 | if ((transfer->speed_hz != speed) || (!chip->clk_div)) { |
423 | speed = transfer->speed_hz; | 420 | speed = transfer->speed_hz; |
424 | 421 | ||
425 | /* clk_div doesn't support odd number */ | 422 | /* clk_div doesn't support odd number */ |
@@ -581,7 +578,6 @@ static int dw_spi_setup(struct spi_device *spi) | |||
581 | dev_err(&spi->dev, "No max speed HZ parameter\n"); | 578 | dev_err(&spi->dev, "No max speed HZ parameter\n"); |
582 | return -EINVAL; | 579 | return -EINVAL; |
583 | } | 580 | } |
584 | chip->speed_hz = spi->max_speed_hz; | ||
585 | 581 | ||
586 | chip->tmode = 0; /* Tx & Rx */ | 582 | chip->tmode = 0; /* Tx & Rx */ |
587 | /* Default SPI mode is SCPOL = 0, SCPH = 0 */ | 583 | /* Default SPI mode is SCPOL = 0, SCPH = 0 */ |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 39e2c0a55a28..f63de781c729 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -562,9 +562,9 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
562 | 562 | ||
563 | sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); | 563 | sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); |
564 | txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | | 564 | txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
565 | sspi->word_width; | 565 | (sspi->word_width >> 1); |
566 | rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | | 566 | rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
567 | sspi->word_width; | 567 | (sspi->word_width >> 1); |
568 | 568 | ||
569 | if (!(spi->mode & SPI_CS_HIGH)) | 569 | if (!(spi->mode & SPI_CS_HIGH)) |
570 | regval |= SIRFSOC_SPI_CS_IDLE_STAT; | 570 | regval |= SIRFSOC_SPI_CS_IDLE_STAT; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ebcb33df2eb2..50f20f243981 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -615,13 +615,13 @@ static int spi_map_buf(struct spi_master *master, struct device *dev, | |||
615 | sg_free_table(sgt); | 615 | sg_free_table(sgt); |
616 | return -ENOMEM; | 616 | return -ENOMEM; |
617 | } | 617 | } |
618 | sg_buf = page_address(vm_page) + | 618 | sg_set_page(&sgt->sgl[i], vm_page, |
619 | ((size_t)buf & ~PAGE_MASK); | 619 | min, offset_in_page(buf)); |
620 | } else { | 620 | } else { |
621 | sg_buf = buf; | 621 | sg_buf = buf; |
622 | sg_set_buf(&sgt->sgl[i], sg_buf, min); | ||
622 | } | 623 | } |
623 | 624 | ||
624 | sg_set_buf(&sgt->sgl[i], sg_buf, min); | ||
625 | 625 | ||
626 | buf += min; | 626 | buf += min; |
627 | len -= min; | 627 | len -= min; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 9935e66935af..eddef9cd2e16 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c | |||
@@ -275,11 +275,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, | |||
275 | if (check_fwstate(pmlmepriv, _FW_LINKED) == true) | 275 | if (check_fwstate(pmlmepriv, _FW_LINKED) == true) |
276 | rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); | 276 | rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); |
277 | 277 | ||
278 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 278 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
279 | if (ph2c == NULL) | 279 | if (ph2c == NULL) |
280 | return _FAIL; | 280 | return _FAIL; |
281 | 281 | ||
282 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); | 282 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); |
283 | if (psurveyPara == NULL) { | 283 | if (psurveyPara == NULL) { |
284 | kfree(ph2c); | 284 | kfree(ph2c); |
285 | return _FAIL; | 285 | return _FAIL; |
@@ -405,7 +405,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) | |||
405 | else | 405 | else |
406 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); | 406 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid)); |
407 | 407 | ||
408 | pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 408 | pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
409 | if (pcmd == NULL) { | 409 | if (pcmd == NULL) { |
410 | res = _FAIL; | 410 | res = _FAIL; |
411 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); | 411 | RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n")); |
@@ -755,13 +755,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter) | |||
755 | u8 res = _SUCCESS; | 755 | u8 res = _SUCCESS; |
756 | 756 | ||
757 | 757 | ||
758 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 758 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
759 | if (ph2c == NULL) { | 759 | if (ph2c == NULL) { |
760 | res = _FAIL; | 760 | res = _FAIL; |
761 | goto exit; | 761 | goto exit; |
762 | } | 762 | } |
763 | 763 | ||
764 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 764 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
765 | if (pdrvextra_cmd_parm == NULL) { | 765 | if (pdrvextra_cmd_parm == NULL) { |
766 | kfree(ph2c); | 766 | kfree(ph2c); |
767 | res = _FAIL; | 767 | res = _FAIL; |
@@ -967,13 +967,13 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue) | |||
967 | u8 res = _SUCCESS; | 967 | u8 res = _SUCCESS; |
968 | 968 | ||
969 | if (enqueue) { | 969 | if (enqueue) { |
970 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 970 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
971 | if (ph2c == NULL) { | 971 | if (ph2c == NULL) { |
972 | res = _FAIL; | 972 | res = _FAIL; |
973 | goto exit; | 973 | goto exit; |
974 | } | 974 | } |
975 | 975 | ||
976 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 976 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
977 | if (pdrvextra_cmd_parm == NULL) { | 977 | if (pdrvextra_cmd_parm == NULL) { |
978 | kfree(ph2c); | 978 | kfree(ph2c); |
979 | res = _FAIL; | 979 | res = _FAIL; |
@@ -1010,13 +1010,13 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time) | |||
1010 | 1010 | ||
1011 | u8 res = _SUCCESS; | 1011 | u8 res = _SUCCESS; |
1012 | 1012 | ||
1013 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 1013 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
1014 | if (ph2c == NULL) { | 1014 | if (ph2c == NULL) { |
1015 | res = _FAIL; | 1015 | res = _FAIL; |
1016 | goto exit; | 1016 | goto exit; |
1017 | } | 1017 | } |
1018 | 1018 | ||
1019 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 1019 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
1020 | if (pdrvextra_cmd_parm == NULL) { | 1020 | if (pdrvextra_cmd_parm == NULL) { |
1021 | kfree(ph2c); | 1021 | kfree(ph2c); |
1022 | res = _FAIL; | 1022 | res = _FAIL; |
@@ -1088,13 +1088,13 @@ u8 rtw_ps_cmd(struct adapter *padapter) | |||
1088 | 1088 | ||
1089 | u8 res = _SUCCESS; | 1089 | u8 res = _SUCCESS; |
1090 | 1090 | ||
1091 | ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 1091 | ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
1092 | if (ppscmd == NULL) { | 1092 | if (ppscmd == NULL) { |
1093 | res = _FAIL; | 1093 | res = _FAIL; |
1094 | goto exit; | 1094 | goto exit; |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL); | 1097 | pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC); |
1098 | if (pdrvextra_cmd_parm == NULL) { | 1098 | if (pdrvextra_cmd_parm == NULL) { |
1099 | kfree(ppscmd); | 1099 | kfree(ppscmd); |
1100 | res = _FAIL; | 1100 | res = _FAIL; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 5ba5099ec20d..70b1bc3e0e63 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | |||
@@ -4241,12 +4241,12 @@ void report_survey_event(struct adapter *padapter, | |||
4241 | pcmdpriv = &padapter->cmdpriv; | 4241 | pcmdpriv = &padapter->cmdpriv; |
4242 | 4242 | ||
4243 | 4243 | ||
4244 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4244 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4245 | if (pcmd_obj == NULL) | 4245 | if (pcmd_obj == NULL) |
4246 | return; | 4246 | return; |
4247 | 4247 | ||
4248 | cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); | 4248 | cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); |
4249 | pevtcmd = kzalloc(cmdsz, GFP_KERNEL); | 4249 | pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); |
4250 | if (pevtcmd == NULL) { | 4250 | if (pevtcmd == NULL) { |
4251 | kfree(pcmd_obj); | 4251 | kfree(pcmd_obj); |
4252 | return; | 4252 | return; |
@@ -4339,12 +4339,12 @@ void report_join_res(struct adapter *padapter, int res) | |||
4339 | struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); | 4339 | struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); |
4340 | struct cmd_priv *pcmdpriv = &padapter->cmdpriv; | 4340 | struct cmd_priv *pcmdpriv = &padapter->cmdpriv; |
4341 | 4341 | ||
4342 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4342 | pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4343 | if (pcmd_obj == NULL) | 4343 | if (pcmd_obj == NULL) |
4344 | return; | 4344 | return; |
4345 | 4345 | ||
4346 | cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); | 4346 | cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); |
4347 | pevtcmd = kzalloc(cmdsz, GFP_KERNEL); | 4347 | pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); |
4348 | if (pevtcmd == NULL) { | 4348 | if (pevtcmd == NULL) { |
4349 | kfree(pcmd_obj); | 4349 | kfree(pcmd_obj); |
4350 | return; | 4350 | return; |
@@ -4854,11 +4854,11 @@ void survey_timer_hdl(void *function_context) | |||
4854 | pmlmeext->scan_abort = false;/* reset */ | 4854 | pmlmeext->scan_abort = false;/* reset */ |
4855 | } | 4855 | } |
4856 | 4856 | ||
4857 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); | 4857 | ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); |
4858 | if (ph2c == NULL) | 4858 | if (ph2c == NULL) |
4859 | goto exit_survey_timer_hdl; | 4859 | goto exit_survey_timer_hdl; |
4860 | 4860 | ||
4861 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL); | 4861 | psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC); |
4862 | if (psurveyPara == NULL) { | 4862 | if (psurveyPara == NULL) { |
4863 | kfree(ph2c); | 4863 | kfree(ph2c); |
4864 | goto exit_survey_timer_hdl; | 4864 | goto exit_survey_timer_hdl; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 33ccbbbd8ed6..d300369977fa 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c | |||
@@ -935,7 +935,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) | |||
935 | return true; | 935 | return true; |
936 | } | 936 | } |
937 | 937 | ||
938 | bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL); | 938 | bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); |
939 | 939 | ||
940 | subtype = GetFrameSubType(pframe) >> 4; | 940 | subtype = GetFrameSubType(pframe) >> 4; |
941 | 941 | ||
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index 407a318b09db..2f87150a21b7 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
@@ -47,6 +47,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ | 47 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 48 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | 49 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ |
50 | {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ | ||
50 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ | 51 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ |
51 | {} /* Terminating entry */ | 52 | {} /* Terminating entry */ |
52 | }; | 53 | }; |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 1ab0018271c5..ad09e51ffae4 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -50,15 +50,14 @@ struct cpufreq_cooling_device { | |||
50 | unsigned int cpufreq_state; | 50 | unsigned int cpufreq_state; |
51 | unsigned int cpufreq_val; | 51 | unsigned int cpufreq_val; |
52 | struct cpumask allowed_cpus; | 52 | struct cpumask allowed_cpus; |
53 | struct list_head node; | ||
53 | }; | 54 | }; |
54 | static DEFINE_IDR(cpufreq_idr); | 55 | static DEFINE_IDR(cpufreq_idr); |
55 | static DEFINE_MUTEX(cooling_cpufreq_lock); | 56 | static DEFINE_MUTEX(cooling_cpufreq_lock); |
56 | 57 | ||
57 | static unsigned int cpufreq_dev_count; | 58 | static unsigned int cpufreq_dev_count; |
58 | 59 | ||
59 | /* notify_table passes value to the CPUFREQ_ADJUST callback function. */ | 60 | static LIST_HEAD(cpufreq_dev_list); |
60 | #define NOTIFY_INVALID NULL | ||
61 | static struct cpufreq_cooling_device *notify_device; | ||
62 | 61 | ||
63 | /** | 62 | /** |
64 | * get_idr - function to get a unique id. | 63 | * get_idr - function to get a unique id. |
@@ -287,15 +286,12 @@ static int cpufreq_apply_cooling(struct cpufreq_cooling_device *cpufreq_device, | |||
287 | 286 | ||
288 | cpufreq_device->cpufreq_state = cooling_state; | 287 | cpufreq_device->cpufreq_state = cooling_state; |
289 | cpufreq_device->cpufreq_val = clip_freq; | 288 | cpufreq_device->cpufreq_val = clip_freq; |
290 | notify_device = cpufreq_device; | ||
291 | 289 | ||
292 | for_each_cpu(cpuid, mask) { | 290 | for_each_cpu(cpuid, mask) { |
293 | if (is_cpufreq_valid(cpuid)) | 291 | if (is_cpufreq_valid(cpuid)) |
294 | cpufreq_update_policy(cpuid); | 292 | cpufreq_update_policy(cpuid); |
295 | } | 293 | } |
296 | 294 | ||
297 | notify_device = NOTIFY_INVALID; | ||
298 | |||
299 | return 0; | 295 | return 0; |
300 | } | 296 | } |
301 | 297 | ||
@@ -316,21 +312,28 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, | |||
316 | { | 312 | { |
317 | struct cpufreq_policy *policy = data; | 313 | struct cpufreq_policy *policy = data; |
318 | unsigned long max_freq = 0; | 314 | unsigned long max_freq = 0; |
315 | struct cpufreq_cooling_device *cpufreq_dev; | ||
319 | 316 | ||
320 | if (event != CPUFREQ_ADJUST || notify_device == NOTIFY_INVALID) | 317 | if (event != CPUFREQ_ADJUST) |
321 | return 0; | 318 | return 0; |
322 | 319 | ||
323 | if (cpumask_test_cpu(policy->cpu, ¬ify_device->allowed_cpus)) | 320 | mutex_lock(&cooling_cpufreq_lock); |
324 | max_freq = notify_device->cpufreq_val; | 321 | list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { |
325 | else | 322 | if (!cpumask_test_cpu(policy->cpu, |
326 | return 0; | 323 | &cpufreq_dev->allowed_cpus)) |
324 | continue; | ||
325 | |||
326 | if (!cpufreq_dev->cpufreq_val) | ||
327 | cpufreq_dev->cpufreq_val = get_cpu_frequency( | ||
328 | cpumask_any(&cpufreq_dev->allowed_cpus), | ||
329 | cpufreq_dev->cpufreq_state); | ||
327 | 330 | ||
328 | /* Never exceed user_policy.max */ | 331 | max_freq = cpufreq_dev->cpufreq_val; |
329 | if (max_freq > policy->user_policy.max) | ||
330 | max_freq = policy->user_policy.max; | ||
331 | 332 | ||
332 | if (policy->max != max_freq) | 333 | if (policy->max != max_freq) |
333 | cpufreq_verify_within_limits(policy, 0, max_freq); | 334 | cpufreq_verify_within_limits(policy, 0, max_freq); |
335 | } | ||
336 | mutex_unlock(&cooling_cpufreq_lock); | ||
334 | 337 | ||
335 | return 0; | 338 | return 0; |
336 | } | 339 | } |
@@ -486,6 +489,7 @@ __cpufreq_cooling_register(struct device_node *np, | |||
486 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, | 489 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, |
487 | CPUFREQ_POLICY_NOTIFIER); | 490 | CPUFREQ_POLICY_NOTIFIER); |
488 | cpufreq_dev_count++; | 491 | cpufreq_dev_count++; |
492 | list_add(&cpufreq_dev->node, &cpufreq_dev_list); | ||
489 | 493 | ||
490 | mutex_unlock(&cooling_cpufreq_lock); | 494 | mutex_unlock(&cooling_cpufreq_lock); |
491 | 495 | ||
@@ -549,6 +553,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) | |||
549 | 553 | ||
550 | cpufreq_dev = cdev->devdata; | 554 | cpufreq_dev = cdev->devdata; |
551 | mutex_lock(&cooling_cpufreq_lock); | 555 | mutex_lock(&cooling_cpufreq_lock); |
556 | list_del(&cpufreq_dev->node); | ||
552 | cpufreq_dev_count--; | 557 | cpufreq_dev_count--; |
553 | 558 | ||
554 | /* Unregister the notifier for the last cpufreq cooling device */ | 559 | /* Unregister the notifier for the last cpufreq cooling device */ |
diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c index 3f5ad25ddca8..b6be572704a4 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.c +++ b/drivers/thermal/samsung/exynos_thermal_common.c | |||
@@ -417,13 +417,10 @@ void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf) | |||
417 | 417 | ||
418 | th_zone = sensor_conf->pzone_data; | 418 | th_zone = sensor_conf->pzone_data; |
419 | 419 | ||
420 | if (th_zone->therm_dev) | 420 | thermal_zone_device_unregister(th_zone->therm_dev); |
421 | thermal_zone_device_unregister(th_zone->therm_dev); | ||
422 | 421 | ||
423 | for (i = 0; i < th_zone->cool_dev_size; i++) { | 422 | for (i = 0; i < th_zone->cool_dev_size; ++i) |
424 | if (th_zone->cool_dev[i]) | 423 | cpufreq_cooling_unregister(th_zone->cool_dev[i]); |
425 | cpufreq_cooling_unregister(th_zone->cool_dev[i]); | ||
426 | } | ||
427 | 424 | ||
428 | dev_info(sensor_conf->dev, | 425 | dev_info(sensor_conf->dev, |
429 | "Exynos: Kernel Thermal management unregistered\n"); | 426 | "Exynos: Kernel Thermal management unregistered\n"); |
diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 90163b384660..d1ec5804c0bb 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c | |||
@@ -275,6 +275,7 @@ int st_thermal_unregister(struct platform_device *pdev) | |||
275 | } | 275 | } |
276 | EXPORT_SYMBOL_GPL(st_thermal_unregister); | 276 | EXPORT_SYMBOL_GPL(st_thermal_unregister); |
277 | 277 | ||
278 | #ifdef CONFIG_PM_SLEEP | ||
278 | static int st_thermal_suspend(struct device *dev) | 279 | static int st_thermal_suspend(struct device *dev) |
279 | { | 280 | { |
280 | struct platform_device *pdev = to_platform_device(dev); | 281 | struct platform_device *pdev = to_platform_device(dev); |
@@ -305,6 +306,8 @@ static int st_thermal_resume(struct device *dev) | |||
305 | 306 | ||
306 | return 0; | 307 | return 0; |
307 | } | 308 | } |
309 | #endif | ||
310 | |||
308 | SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); | 311 | SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); |
309 | EXPORT_SYMBOL_GPL(st_thermal_pm_ops); | 312 | EXPORT_SYMBOL_GPL(st_thermal_pm_ops); |
310 | 313 | ||
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 56982da4a9e9..bf355050eab6 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -240,32 +240,6 @@ static int of_platform_serial_remove(struct platform_device *ofdev) | |||
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
243 | #ifdef CONFIG_PM_SLEEP | ||
244 | static int of_serial_suspend(struct device *dev) | ||
245 | { | ||
246 | struct of_serial_info *info = dev_get_drvdata(dev); | ||
247 | |||
248 | serial8250_suspend_port(info->line); | ||
249 | if (info->clk) | ||
250 | clk_disable_unprepare(info->clk); | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | static int of_serial_resume(struct device *dev) | ||
256 | { | ||
257 | struct of_serial_info *info = dev_get_drvdata(dev); | ||
258 | |||
259 | if (info->clk) | ||
260 | clk_prepare_enable(info->clk); | ||
261 | |||
262 | serial8250_resume_port(info->line); | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | #endif | ||
267 | static SIMPLE_DEV_PM_OPS(of_serial_pm_ops, of_serial_suspend, of_serial_resume); | ||
268 | |||
269 | /* | 243 | /* |
270 | * A few common types, add more as needed. | 244 | * A few common types, add more as needed. |
271 | */ | 245 | */ |
@@ -297,7 +271,6 @@ static struct platform_driver of_platform_serial_driver = { | |||
297 | .name = "of_serial", | 271 | .name = "of_serial", |
298 | .owner = THIS_MODULE, | 272 | .owner = THIS_MODULE, |
299 | .of_match_table = of_platform_serial_table, | 273 | .of_match_table = of_platform_serial_table, |
300 | .pm = &of_serial_pm_ops, | ||
301 | }, | 274 | }, |
302 | .probe = of_platform_serial_probe, | 275 | .probe = of_platform_serial_probe, |
303 | .remove = of_platform_serial_remove, | 276 | .remove = of_platform_serial_remove, |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 39b4081b632d..96fafed92b76 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -44,6 +44,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
44 | /* Creative SB Audigy 2 NX */ | 44 | /* Creative SB Audigy 2 NX */ |
45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, | 45 | { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, |
46 | 46 | ||
47 | /* Microsoft Wireless Laser Mouse 6000 Receiver */ | ||
48 | { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
49 | |||
47 | /* Microsoft LifeCam-VX700 v2.0 */ | 50 | /* Microsoft LifeCam-VX700 v2.0 */ |
48 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, |
49 | 52 | ||
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 711b23019d54..df38e7ef4976 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -791,6 +791,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
791 | 791 | ||
792 | trb = dwc->ep0_trb; | 792 | trb = dwc->ep0_trb; |
793 | 793 | ||
794 | r = next_request(&ep0->request_list); | ||
795 | if (!r) | ||
796 | return; | ||
797 | |||
794 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); | 798 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); |
795 | if (status == DWC3_TRBSTS_SETUP_PENDING) { | 799 | if (status == DWC3_TRBSTS_SETUP_PENDING) { |
796 | dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); | 800 | dwc3_trace(trace_dwc3_ep0, "Setup Pending received"); |
@@ -801,10 +805,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
801 | return; | 805 | return; |
802 | } | 806 | } |
803 | 807 | ||
804 | r = next_request(&ep0->request_list); | ||
805 | if (!r) | ||
806 | return; | ||
807 | |||
808 | ur = &r->request; | 808 | ur = &r->request; |
809 | 809 | ||
810 | length = trb->size & DWC3_TRB_SIZE_MASK; | 810 | length = trb->size & DWC3_TRB_SIZE_MASK; |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 696160d48ae8..388cfd83b6b6 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/device.h> | ||
26 | #include <asm/unaligned.h> | 25 | #include <asm/unaligned.h> |
27 | 26 | ||
28 | #include "xhci.h" | 27 | #include "xhci.h" |
@@ -1149,9 +1148,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1149 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1148 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME |
1150 | * is enabled, so also enable remote wake here. | 1149 | * is enabled, so also enable remote wake here. |
1151 | */ | 1150 | */ |
1152 | if (hcd->self.root_hub->do_remote_wakeup | 1151 | if (hcd->self.root_hub->do_remote_wakeup) { |
1153 | && device_may_wakeup(hcd->self.controller)) { | ||
1154 | |||
1155 | if (t1 & PORT_CONNECT) { | 1152 | if (t1 & PORT_CONNECT) { |
1156 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | 1153 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; |
1157 | t2 &= ~PORT_WKCONN_E; | 1154 | t2 &= ~PORT_WKCONN_E; |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 9a69b1f1b300..142b601f9563 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -281,7 +281,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) | |||
281 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) | 281 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) |
282 | pdev->no_d3cold = true; | 282 | pdev->no_d3cold = true; |
283 | 283 | ||
284 | return xhci_suspend(xhci); | 284 | return xhci_suspend(xhci, do_wakeup); |
285 | } | 285 | } |
286 | 286 | ||
287 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) | 287 | static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0cd674b..646300cbe5f7 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -204,7 +204,15 @@ static int xhci_plat_suspend(struct device *dev) | |||
204 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 204 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
205 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 205 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
206 | 206 | ||
207 | return xhci_suspend(xhci); | 207 | /* |
208 | * xhci_suspend() needs `do_wakeup` to know whether host is allowed | ||
209 | * to do wakeup during suspend. Since xhci_plat_suspend is currently | ||
210 | * only designed for system suspend, device_may_wakeup() is enough | ||
211 | * to dertermine whether host is allowed to do wakeup. Need to | ||
212 | * reconsider this when xhci_plat_suspend enlarges its scope, e.g., | ||
213 | * also applies to runtime suspend. | ||
214 | */ | ||
215 | return xhci_suspend(xhci, device_may_wakeup(dev)); | ||
208 | } | 216 | } |
209 | 217 | ||
210 | static int xhci_plat_resume(struct device *dev) | 218 | static int xhci_plat_resume(struct device *dev) |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index bc6fcbc16f61..06433aec81d7 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1067,9 +1067,8 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, | |||
1067 | false); | 1067 | false); |
1068 | xhci_ring_cmd_db(xhci); | 1068 | xhci_ring_cmd_db(xhci); |
1069 | } else { | 1069 | } else { |
1070 | /* Clear our internal halted state and restart the ring(s) */ | 1070 | /* Clear our internal halted state */ |
1071 | xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; | 1071 | xhci->devs[slot_id]->eps[ep_index].ep_state &= ~EP_HALTED; |
1072 | ring_doorbell_for_active_rings(xhci, slot_id, ep_index); | ||
1073 | } | 1072 | } |
1074 | } | 1073 | } |
1075 | 1074 | ||
@@ -1823,22 +1822,13 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1823 | ep->stopped_td = td; | 1822 | ep->stopped_td = td; |
1824 | return 0; | 1823 | return 0; |
1825 | } else { | 1824 | } else { |
1826 | if (trb_comp_code == COMP_STALL) { | 1825 | if (trb_comp_code == COMP_STALL || |
1827 | /* The transfer is completed from the driver's | 1826 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
1828 | * perspective, but we need to issue a set dequeue | 1827 | trb_comp_code)) { |
1829 | * command for this stalled endpoint to move the dequeue | 1828 | /* Issue a reset endpoint command to clear the host side |
1830 | * pointer past the TD. We can't do that here because | 1829 | * halt, followed by a set dequeue command to move the |
1831 | * the halt condition must be cleared first. Let the | 1830 | * dequeue pointer past the TD. |
1832 | * USB class driver clear the stall later. | 1831 | * The class driver clears the device side halt later. |
1833 | */ | ||
1834 | ep->stopped_td = td; | ||
1835 | ep->stopped_stream = ep_ring->stream_id; | ||
1836 | } else if (xhci_requires_manual_halt_cleanup(xhci, | ||
1837 | ep_ctx, trb_comp_code)) { | ||
1838 | /* Other types of errors halt the endpoint, but the | ||
1839 | * class driver doesn't call usb_reset_endpoint() unless | ||
1840 | * the error is -EPIPE. Clear the halted status in the | ||
1841 | * xHCI hardware manually. | ||
1842 | */ | 1832 | */ |
1843 | xhci_cleanup_halted_endpoint(xhci, | 1833 | xhci_cleanup_halted_endpoint(xhci, |
1844 | slot_id, ep_index, ep_ring->stream_id, | 1834 | slot_id, ep_index, ep_ring->stream_id, |
@@ -1958,9 +1948,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
1958 | else | 1948 | else |
1959 | td->urb->actual_length = 0; | 1949 | td->urb->actual_length = 0; |
1960 | 1950 | ||
1961 | xhci_cleanup_halted_endpoint(xhci, | 1951 | return finish_td(xhci, td, event_trb, event, ep, status, false); |
1962 | slot_id, ep_index, 0, td, event_trb); | ||
1963 | return finish_td(xhci, td, event_trb, event, ep, status, true); | ||
1964 | } | 1952 | } |
1965 | /* | 1953 | /* |
1966 | * Did we transfer any data, despite the errors that might have | 1954 | * Did we transfer any data, despite the errors that might have |
@@ -2519,17 +2507,8 @@ cleanup: | |||
2519 | if (ret) { | 2507 | if (ret) { |
2520 | urb = td->urb; | 2508 | urb = td->urb; |
2521 | urb_priv = urb->hcpriv; | 2509 | urb_priv = urb->hcpriv; |
2522 | /* Leave the TD around for the reset endpoint function | 2510 | |
2523 | * to use(but only if it's not a control endpoint, | 2511 | xhci_urb_free_priv(xhci, urb_priv); |
2524 | * since we already queued the Set TR dequeue pointer | ||
2525 | * command for stalled control endpoints). | ||
2526 | */ | ||
2527 | if (usb_endpoint_xfer_control(&urb->ep->desc) || | ||
2528 | (trb_comp_code != COMP_STALL && | ||
2529 | trb_comp_code != COMP_BABBLE)) | ||
2530 | xhci_urb_free_priv(xhci, urb_priv); | ||
2531 | else | ||
2532 | kfree(urb_priv); | ||
2533 | 2512 | ||
2534 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); | 2513 | usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); |
2535 | if ((urb->actual_length != urb->transfer_buffer_length && | 2514 | if ((urb->actual_length != urb->transfer_buffer_length && |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2a5d45b4cb15..033b46c470bd 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -35,6 +35,8 @@ | |||
35 | #define DRIVER_AUTHOR "Sarah Sharp" | 35 | #define DRIVER_AUTHOR "Sarah Sharp" |
36 | #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" | 36 | #define DRIVER_DESC "'eXtensible' Host Controller (xHC) Driver" |
37 | 37 | ||
38 | #define PORT_WAKE_BITS (PORT_WKOC_E | PORT_WKDISC_E | PORT_WKCONN_E) | ||
39 | |||
38 | /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ | 40 | /* Some 0.95 hardware can't handle the chain bit on a Link TRB being cleared */ |
39 | static int link_quirk; | 41 | static int link_quirk; |
40 | module_param(link_quirk, int, S_IRUGO | S_IWUSR); | 42 | module_param(link_quirk, int, S_IRUGO | S_IWUSR); |
@@ -851,13 +853,47 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) | |||
851 | xhci_set_cmd_ring_deq(xhci); | 853 | xhci_set_cmd_ring_deq(xhci); |
852 | } | 854 | } |
853 | 855 | ||
856 | static void xhci_disable_port_wake_on_bits(struct xhci_hcd *xhci) | ||
857 | { | ||
858 | int port_index; | ||
859 | __le32 __iomem **port_array; | ||
860 | unsigned long flags; | ||
861 | u32 t1, t2; | ||
862 | |||
863 | spin_lock_irqsave(&xhci->lock, flags); | ||
864 | |||
865 | /* disble usb3 ports Wake bits*/ | ||
866 | port_index = xhci->num_usb3_ports; | ||
867 | port_array = xhci->usb3_ports; | ||
868 | while (port_index--) { | ||
869 | t1 = readl(port_array[port_index]); | ||
870 | t1 = xhci_port_state_to_neutral(t1); | ||
871 | t2 = t1 & ~PORT_WAKE_BITS; | ||
872 | if (t1 != t2) | ||
873 | writel(t2, port_array[port_index]); | ||
874 | } | ||
875 | |||
876 | /* disble usb2 ports Wake bits*/ | ||
877 | port_index = xhci->num_usb2_ports; | ||
878 | port_array = xhci->usb2_ports; | ||
879 | while (port_index--) { | ||
880 | t1 = readl(port_array[port_index]); | ||
881 | t1 = xhci_port_state_to_neutral(t1); | ||
882 | t2 = t1 & ~PORT_WAKE_BITS; | ||
883 | if (t1 != t2) | ||
884 | writel(t2, port_array[port_index]); | ||
885 | } | ||
886 | |||
887 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
888 | } | ||
889 | |||
854 | /* | 890 | /* |
855 | * Stop HC (not bus-specific) | 891 | * Stop HC (not bus-specific) |
856 | * | 892 | * |
857 | * This is called when the machine transition into S3/S4 mode. | 893 | * This is called when the machine transition into S3/S4 mode. |
858 | * | 894 | * |
859 | */ | 895 | */ |
860 | int xhci_suspend(struct xhci_hcd *xhci) | 896 | int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) |
861 | { | 897 | { |
862 | int rc = 0; | 898 | int rc = 0; |
863 | unsigned int delay = XHCI_MAX_HALT_USEC; | 899 | unsigned int delay = XHCI_MAX_HALT_USEC; |
@@ -868,6 +904,10 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
868 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) | 904 | xhci->shared_hcd->state != HC_STATE_SUSPENDED) |
869 | return -EINVAL; | 905 | return -EINVAL; |
870 | 906 | ||
907 | /* Clear root port wake on bits if wakeup not allowed. */ | ||
908 | if (!do_wakeup) | ||
909 | xhci_disable_port_wake_on_bits(xhci); | ||
910 | |||
871 | /* Don't poll the roothubs on bus suspend. */ | 911 | /* Don't poll the roothubs on bus suspend. */ |
872 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); | 912 | xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); |
873 | clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); | 913 | clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); |
@@ -2912,68 +2952,33 @@ void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, | |||
2912 | } | 2952 | } |
2913 | } | 2953 | } |
2914 | 2954 | ||
2915 | /* Deal with stalled endpoints. The core should have sent the control message | 2955 | /* Called when clearing halted device. The core should have sent the control |
2916 | * to clear the halt condition. However, we need to make the xHCI hardware | 2956 | * message to clear the device halt condition. The host side of the halt should |
2917 | * reset its sequence number, since a device will expect a sequence number of | 2957 | * already be cleared with a reset endpoint command issued when the STALL tx |
2918 | * zero after the halt condition is cleared. | 2958 | * event was received. |
2959 | * | ||
2919 | * Context: in_interrupt | 2960 | * Context: in_interrupt |
2920 | */ | 2961 | */ |
2962 | |||
2921 | void xhci_endpoint_reset(struct usb_hcd *hcd, | 2963 | void xhci_endpoint_reset(struct usb_hcd *hcd, |
2922 | struct usb_host_endpoint *ep) | 2964 | struct usb_host_endpoint *ep) |
2923 | { | 2965 | { |
2924 | struct xhci_hcd *xhci; | 2966 | struct xhci_hcd *xhci; |
2925 | struct usb_device *udev; | ||
2926 | unsigned int ep_index; | ||
2927 | unsigned long flags; | ||
2928 | int ret; | ||
2929 | struct xhci_virt_ep *virt_ep; | ||
2930 | struct xhci_command *command; | ||
2931 | 2967 | ||
2932 | xhci = hcd_to_xhci(hcd); | 2968 | xhci = hcd_to_xhci(hcd); |
2933 | udev = (struct usb_device *) ep->hcpriv; | ||
2934 | /* Called with a root hub endpoint (or an endpoint that wasn't added | ||
2935 | * with xhci_add_endpoint() | ||
2936 | */ | ||
2937 | if (!ep->hcpriv) | ||
2938 | return; | ||
2939 | ep_index = xhci_get_endpoint_index(&ep->desc); | ||
2940 | virt_ep = &xhci->devs[udev->slot_id]->eps[ep_index]; | ||
2941 | if (!virt_ep->stopped_td) { | ||
2942 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2943 | "Endpoint 0x%x not halted, refusing to reset.", | ||
2944 | ep->desc.bEndpointAddress); | ||
2945 | return; | ||
2946 | } | ||
2947 | if (usb_endpoint_xfer_control(&ep->desc)) { | ||
2948 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2949 | "Control endpoint stall already handled."); | ||
2950 | return; | ||
2951 | } | ||
2952 | 2969 | ||
2953 | command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC); | ||
2954 | if (!command) | ||
2955 | return; | ||
2956 | |||
2957 | xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, | ||
2958 | "Queueing reset endpoint command"); | ||
2959 | spin_lock_irqsave(&xhci->lock, flags); | ||
2960 | ret = xhci_queue_reset_ep(xhci, command, udev->slot_id, ep_index); | ||
2961 | /* | 2970 | /* |
2962 | * Can't change the ring dequeue pointer until it's transitioned to the | 2971 | * We might need to implement the config ep cmd in xhci 4.8.1 note: |
2963 | * stopped state, which is only upon a successful reset endpoint | 2972 | * The Reset Endpoint Command may only be issued to endpoints in the |
2964 | * command. Better hope that last command worked! | 2973 | * Halted state. If software wishes reset the Data Toggle or Sequence |
2974 | * Number of an endpoint that isn't in the Halted state, then software | ||
2975 | * may issue a Configure Endpoint Command with the Drop and Add bits set | ||
2976 | * for the target endpoint. that is in the Stopped state. | ||
2965 | */ | 2977 | */ |
2966 | if (!ret) { | ||
2967 | xhci_cleanup_stalled_ring(xhci, udev, ep_index); | ||
2968 | kfree(virt_ep->stopped_td); | ||
2969 | xhci_ring_cmd_db(xhci); | ||
2970 | } | ||
2971 | virt_ep->stopped_td = NULL; | ||
2972 | virt_ep->stopped_stream = 0; | ||
2973 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
2974 | 2978 | ||
2975 | if (ret) | 2979 | /* For now just print debug to follow the situation */ |
2976 | xhci_warn(xhci, "FIXME allocate a new ring segment\n"); | 2980 | xhci_dbg(xhci, "Endpoint 0x%x ep reset callback called\n", |
2981 | ep->desc.bEndpointAddress); | ||
2977 | } | 2982 | } |
2978 | 2983 | ||
2979 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, | 2984 | static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index df76d642e719..d745715a1e2f 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1746,7 +1746,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); | |||
1746 | void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *)); | 1746 | void xhci_init_driver(struct hc_driver *drv, int (*setup_fn)(struct usb_hcd *)); |
1747 | 1747 | ||
1748 | #ifdef CONFIG_PM | 1748 | #ifdef CONFIG_PM |
1749 | int xhci_suspend(struct xhci_hcd *xhci); | 1749 | int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup); |
1750 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated); | 1750 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated); |
1751 | #else | 1751 | #else |
1752 | #define xhci_suspend NULL | 1752 | #define xhci_suspend NULL |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index cfd009dc4018..6c4eb3cf5efd 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = { | |||
120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ | 120 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ |
121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ | 121 | { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */ |
122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ | 122 | { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ |
123 | { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */ | ||
123 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ | 124 | { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ |
124 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ | 125 | { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ |
125 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 126 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0dad8ce5a609..1ebb351b9e9a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -470,6 +470,39 @@ static const struct usb_device_id id_table_combined[] = { | |||
470 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, | 470 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FD_PID) }, |
471 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, | 471 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FE_PID) }, |
472 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, | 472 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_01FF_PID) }, |
473 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_4701_PID) }, | ||
474 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9300_PID) }, | ||
475 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9301_PID) }, | ||
476 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9302_PID) }, | ||
477 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9303_PID) }, | ||
478 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9304_PID) }, | ||
479 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9305_PID) }, | ||
480 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9306_PID) }, | ||
481 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9307_PID) }, | ||
482 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9308_PID) }, | ||
483 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9309_PID) }, | ||
484 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930A_PID) }, | ||
485 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930B_PID) }, | ||
486 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930C_PID) }, | ||
487 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930D_PID) }, | ||
488 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930E_PID) }, | ||
489 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_930F_PID) }, | ||
490 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9310_PID) }, | ||
491 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9311_PID) }, | ||
492 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9312_PID) }, | ||
493 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9313_PID) }, | ||
494 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9314_PID) }, | ||
495 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9315_PID) }, | ||
496 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9316_PID) }, | ||
497 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9317_PID) }, | ||
498 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9318_PID) }, | ||
499 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_9319_PID) }, | ||
500 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931A_PID) }, | ||
501 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931B_PID) }, | ||
502 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931C_PID) }, | ||
503 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931D_PID) }, | ||
504 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931E_PID) }, | ||
505 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_931F_PID) }, | ||
473 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, | 506 | { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, |
474 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, | 507 | { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, |
475 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, | 508 | { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 6786b705ccf6..e52409c9be99 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -926,8 +926,8 @@ | |||
926 | #define BAYER_CONTOUR_CABLE_PID 0x6001 | 926 | #define BAYER_CONTOUR_CABLE_PID 0x6001 |
927 | 927 | ||
928 | /* | 928 | /* |
929 | * The following are the values for the Matrix Orbital FTDI Range | 929 | * Matrix Orbital Intelligent USB displays. |
930 | * Anything in this range will use an FT232RL. | 930 | * http://www.matrixorbital.com |
931 | */ | 931 | */ |
932 | #define MTXORB_VID 0x1B3D | 932 | #define MTXORB_VID 0x1B3D |
933 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 | 933 | #define MTXORB_FTDI_RANGE_0100_PID 0x0100 |
@@ -1186,8 +1186,39 @@ | |||
1186 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD | 1186 | #define MTXORB_FTDI_RANGE_01FD_PID 0x01FD |
1187 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE | 1187 | #define MTXORB_FTDI_RANGE_01FE_PID 0x01FE |
1188 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF | 1188 | #define MTXORB_FTDI_RANGE_01FF_PID 0x01FF |
1189 | 1189 | #define MTXORB_FTDI_RANGE_4701_PID 0x4701 | |
1190 | 1190 | #define MTXORB_FTDI_RANGE_9300_PID 0x9300 | |
1191 | #define MTXORB_FTDI_RANGE_9301_PID 0x9301 | ||
1192 | #define MTXORB_FTDI_RANGE_9302_PID 0x9302 | ||
1193 | #define MTXORB_FTDI_RANGE_9303_PID 0x9303 | ||
1194 | #define MTXORB_FTDI_RANGE_9304_PID 0x9304 | ||
1195 | #define MTXORB_FTDI_RANGE_9305_PID 0x9305 | ||
1196 | #define MTXORB_FTDI_RANGE_9306_PID 0x9306 | ||
1197 | #define MTXORB_FTDI_RANGE_9307_PID 0x9307 | ||
1198 | #define MTXORB_FTDI_RANGE_9308_PID 0x9308 | ||
1199 | #define MTXORB_FTDI_RANGE_9309_PID 0x9309 | ||
1200 | #define MTXORB_FTDI_RANGE_930A_PID 0x930A | ||
1201 | #define MTXORB_FTDI_RANGE_930B_PID 0x930B | ||
1202 | #define MTXORB_FTDI_RANGE_930C_PID 0x930C | ||
1203 | #define MTXORB_FTDI_RANGE_930D_PID 0x930D | ||
1204 | #define MTXORB_FTDI_RANGE_930E_PID 0x930E | ||
1205 | #define MTXORB_FTDI_RANGE_930F_PID 0x930F | ||
1206 | #define MTXORB_FTDI_RANGE_9310_PID 0x9310 | ||
1207 | #define MTXORB_FTDI_RANGE_9311_PID 0x9311 | ||
1208 | #define MTXORB_FTDI_RANGE_9312_PID 0x9312 | ||
1209 | #define MTXORB_FTDI_RANGE_9313_PID 0x9313 | ||
1210 | #define MTXORB_FTDI_RANGE_9314_PID 0x9314 | ||
1211 | #define MTXORB_FTDI_RANGE_9315_PID 0x9315 | ||
1212 | #define MTXORB_FTDI_RANGE_9316_PID 0x9316 | ||
1213 | #define MTXORB_FTDI_RANGE_9317_PID 0x9317 | ||
1214 | #define MTXORB_FTDI_RANGE_9318_PID 0x9318 | ||
1215 | #define MTXORB_FTDI_RANGE_9319_PID 0x9319 | ||
1216 | #define MTXORB_FTDI_RANGE_931A_PID 0x931A | ||
1217 | #define MTXORB_FTDI_RANGE_931B_PID 0x931B | ||
1218 | #define MTXORB_FTDI_RANGE_931C_PID 0x931C | ||
1219 | #define MTXORB_FTDI_RANGE_931D_PID 0x931D | ||
1220 | #define MTXORB_FTDI_RANGE_931E_PID 0x931E | ||
1221 | #define MTXORB_FTDI_RANGE_931F_PID 0x931F | ||
1191 | 1222 | ||
1192 | /* | 1223 | /* |
1193 | * The Mobility Lab (TML) | 1224 | * The Mobility Lab (TML) |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 93cb7cebda62..077c714f1285 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -311,24 +311,30 @@ static void usa26_indat_callback(struct urb *urb) | |||
311 | if ((data[0] & 0x80) == 0) { | 311 | if ((data[0] & 0x80) == 0) { |
312 | /* no errors on individual bytes, only | 312 | /* no errors on individual bytes, only |
313 | possible overrun err */ | 313 | possible overrun err */ |
314 | if (data[0] & RXERROR_OVERRUN) | 314 | if (data[0] & RXERROR_OVERRUN) { |
315 | err = TTY_OVERRUN; | 315 | tty_insert_flip_char(&port->port, 0, |
316 | else | 316 | TTY_OVERRUN); |
317 | err = 0; | 317 | } |
318 | for (i = 1; i < urb->actual_length ; ++i) | 318 | for (i = 1; i < urb->actual_length ; ++i) |
319 | tty_insert_flip_char(&port->port, data[i], err); | 319 | tty_insert_flip_char(&port->port, data[i], |
320 | TTY_NORMAL); | ||
320 | } else { | 321 | } else { |
321 | /* some bytes had errors, every byte has status */ | 322 | /* some bytes had errors, every byte has status */ |
322 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); | 323 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); |
323 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 324 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
324 | int stat = data[i], flag = 0; | 325 | int stat = data[i]; |
325 | if (stat & RXERROR_OVERRUN) | 326 | int flag = TTY_NORMAL; |
326 | flag |= TTY_OVERRUN; | 327 | |
327 | if (stat & RXERROR_FRAMING) | 328 | if (stat & RXERROR_OVERRUN) { |
328 | flag |= TTY_FRAME; | 329 | tty_insert_flip_char(&port->port, 0, |
329 | if (stat & RXERROR_PARITY) | 330 | TTY_OVERRUN); |
330 | flag |= TTY_PARITY; | 331 | } |
331 | /* XXX should handle break (0x10) */ | 332 | /* XXX should handle break (0x10) */ |
333 | if (stat & RXERROR_PARITY) | ||
334 | flag = TTY_PARITY; | ||
335 | else if (stat & RXERROR_FRAMING) | ||
336 | flag = TTY_FRAME; | ||
337 | |||
332 | tty_insert_flip_char(&port->port, data[i+1], | 338 | tty_insert_flip_char(&port->port, data[i+1], |
333 | flag); | 339 | flag); |
334 | } | 340 | } |
@@ -649,14 +655,19 @@ static void usa49_indat_callback(struct urb *urb) | |||
649 | } else { | 655 | } else { |
650 | /* some bytes had errors, every byte has status */ | 656 | /* some bytes had errors, every byte has status */ |
651 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 657 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
652 | int stat = data[i], flag = 0; | 658 | int stat = data[i]; |
653 | if (stat & RXERROR_OVERRUN) | 659 | int flag = TTY_NORMAL; |
654 | flag |= TTY_OVERRUN; | 660 | |
655 | if (stat & RXERROR_FRAMING) | 661 | if (stat & RXERROR_OVERRUN) { |
656 | flag |= TTY_FRAME; | 662 | tty_insert_flip_char(&port->port, 0, |
657 | if (stat & RXERROR_PARITY) | 663 | TTY_OVERRUN); |
658 | flag |= TTY_PARITY; | 664 | } |
659 | /* XXX should handle break (0x10) */ | 665 | /* XXX should handle break (0x10) */ |
666 | if (stat & RXERROR_PARITY) | ||
667 | flag = TTY_PARITY; | ||
668 | else if (stat & RXERROR_FRAMING) | ||
669 | flag = TTY_FRAME; | ||
670 | |||
660 | tty_insert_flip_char(&port->port, data[i+1], | 671 | tty_insert_flip_char(&port->port, data[i+1], |
661 | flag); | 672 | flag); |
662 | } | 673 | } |
@@ -713,15 +724,19 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
713 | */ | 724 | */ |
714 | for (x = 0; x + 1 < len && | 725 | for (x = 0; x + 1 < len && |
715 | i + 1 < urb->actual_length; x += 2) { | 726 | i + 1 < urb->actual_length; x += 2) { |
716 | int stat = data[i], flag = 0; | 727 | int stat = data[i]; |
728 | int flag = TTY_NORMAL; | ||
717 | 729 | ||
718 | if (stat & RXERROR_OVERRUN) | 730 | if (stat & RXERROR_OVERRUN) { |
719 | flag |= TTY_OVERRUN; | 731 | tty_insert_flip_char(&port->port, 0, |
720 | if (stat & RXERROR_FRAMING) | 732 | TTY_OVERRUN); |
721 | flag |= TTY_FRAME; | 733 | } |
722 | if (stat & RXERROR_PARITY) | ||
723 | flag |= TTY_PARITY; | ||
724 | /* XXX should handle break (0x10) */ | 734 | /* XXX should handle break (0x10) */ |
735 | if (stat & RXERROR_PARITY) | ||
736 | flag = TTY_PARITY; | ||
737 | else if (stat & RXERROR_FRAMING) | ||
738 | flag = TTY_FRAME; | ||
739 | |||
725 | tty_insert_flip_char(&port->port, data[i+1], | 740 | tty_insert_flip_char(&port->port, data[i+1], |
726 | flag); | 741 | flag); |
727 | i += 2; | 742 | i += 2; |
@@ -773,25 +788,31 @@ static void usa90_indat_callback(struct urb *urb) | |||
773 | if ((data[0] & 0x80) == 0) { | 788 | if ((data[0] & 0x80) == 0) { |
774 | /* no errors on individual bytes, only | 789 | /* no errors on individual bytes, only |
775 | possible overrun err*/ | 790 | possible overrun err*/ |
776 | if (data[0] & RXERROR_OVERRUN) | 791 | if (data[0] & RXERROR_OVERRUN) { |
777 | err = TTY_OVERRUN; | 792 | tty_insert_flip_char(&port->port, 0, |
778 | else | 793 | TTY_OVERRUN); |
779 | err = 0; | 794 | } |
780 | for (i = 1; i < urb->actual_length ; ++i) | 795 | for (i = 1; i < urb->actual_length ; ++i) |
781 | tty_insert_flip_char(&port->port, | 796 | tty_insert_flip_char(&port->port, |
782 | data[i], err); | 797 | data[i], TTY_NORMAL); |
783 | } else { | 798 | } else { |
784 | /* some bytes had errors, every byte has status */ | 799 | /* some bytes had errors, every byte has status */ |
785 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); | 800 | dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__); |
786 | for (i = 0; i + 1 < urb->actual_length; i += 2) { | 801 | for (i = 0; i + 1 < urb->actual_length; i += 2) { |
787 | int stat = data[i], flag = 0; | 802 | int stat = data[i]; |
788 | if (stat & RXERROR_OVERRUN) | 803 | int flag = TTY_NORMAL; |
789 | flag |= TTY_OVERRUN; | 804 | |
790 | if (stat & RXERROR_FRAMING) | 805 | if (stat & RXERROR_OVERRUN) { |
791 | flag |= TTY_FRAME; | 806 | tty_insert_flip_char( |
792 | if (stat & RXERROR_PARITY) | 807 | &port->port, 0, |
793 | flag |= TTY_PARITY; | 808 | TTY_OVERRUN); |
809 | } | ||
794 | /* XXX should handle break (0x10) */ | 810 | /* XXX should handle break (0x10) */ |
811 | if (stat & RXERROR_PARITY) | ||
812 | flag = TTY_PARITY; | ||
813 | else if (stat & RXERROR_FRAMING) | ||
814 | flag = TTY_FRAME; | ||
815 | |||
795 | tty_insert_flip_char(&port->port, | 816 | tty_insert_flip_char(&port->port, |
796 | data[i+1], flag); | 817 | data[i+1], flag); |
797 | } | 818 | } |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index a7fe664b6b7d..70a098de429f 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -490,10 +490,9 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, | |||
490 | if (*tty_flag == TTY_NORMAL) | 490 | if (*tty_flag == TTY_NORMAL) |
491 | *tty_flag = TTY_FRAME; | 491 | *tty_flag = TTY_FRAME; |
492 | } | 492 | } |
493 | if (lsr & UART_LSR_OE){ | 493 | if (lsr & UART_LSR_OE) { |
494 | port->icount.overrun++; | 494 | port->icount.overrun++; |
495 | if (*tty_flag == TTY_NORMAL) | 495 | tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); |
496 | *tty_flag = TTY_OVERRUN; | ||
497 | } | 496 | } |
498 | } | 497 | } |
499 | 498 | ||
@@ -511,12 +510,8 @@ static void ssu100_process_read_urb(struct urb *urb) | |||
511 | if ((len >= 4) && | 510 | if ((len >= 4) && |
512 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && | 511 | (packet[0] == 0x1b) && (packet[1] == 0x1b) && |
513 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { | 512 | ((packet[2] == 0x00) || (packet[2] == 0x01))) { |
514 | if (packet[2] == 0x00) { | 513 | if (packet[2] == 0x00) |
515 | ssu100_update_lsr(port, packet[3], &flag); | 514 | ssu100_update_lsr(port, packet[3], &flag); |
516 | if (flag == TTY_OVERRUN) | ||
517 | tty_insert_flip_char(&port->port, 0, | ||
518 | TTY_OVERRUN); | ||
519 | } | ||
520 | if (packet[2] == 0x01) | 515 | if (packet[2] == 0x01) |
521 | ssu100_update_msr(port, packet[3]); | 516 | ssu100_update_msr(port, packet[3]); |
522 | 517 | ||
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 2fefaf923e4a..18a283d6de1c 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -103,3 +103,10 @@ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | |||
103 | "VL711", | 103 | "VL711", |
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
105 | US_FL_NO_ATA_1X), | 105 | US_FL_NO_ATA_1X), |
106 | |||
107 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
108 | UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999, | ||
109 | "Hitachi", | ||
110 | "External HDD", | ||
111 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
112 | US_FL_IGNORE_UAS), | ||