diff options
30 files changed, 218 insertions, 112 deletions
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c index ea453532a33c..075d87acd12a 100644 --- a/arch/mips/pci/pci-lantiq.c +++ b/arch/mips/pci/pci-lantiq.c | |||
@@ -129,7 +129,7 @@ static int __devinit ltq_pci_startup(struct platform_device *pdev) | |||
129 | 129 | ||
130 | /* setup reset gpio used by pci */ | 130 | /* setup reset gpio used by pci */ |
131 | reset_gpio = of_get_named_gpio(node, "gpio-reset", 0); | 131 | reset_gpio = of_get_named_gpio(node, "gpio-reset", 0); |
132 | if (reset_gpio > 0) | 132 | if (gpio_is_valid(reset_gpio)) |
133 | devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset"); | 133 | devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset"); |
134 | 134 | ||
135 | /* enable auto-switching between PCI and EBU */ | 135 | /* enable auto-switching between PCI and EBU */ |
@@ -192,7 +192,7 @@ static int __devinit ltq_pci_startup(struct platform_device *pdev) | |||
192 | ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN); | 192 | ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN); |
193 | 193 | ||
194 | /* toggle reset pin */ | 194 | /* toggle reset pin */ |
195 | if (reset_gpio > 0) { | 195 | if (gpio_is_valid(reset_gpio)) { |
196 | __gpio_set_value(reset_gpio, 0); | 196 | __gpio_set_value(reset_gpio, 0); |
197 | wmb(); | 197 | wmb(); |
198 | mdelay(1); | 198 | mdelay(1); |
diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h index 08251d6f6b11..ac519bbd42ff 100644 --- a/arch/mn10300/include/asm/thread_info.h +++ b/arch/mn10300/include/asm/thread_info.h | |||
@@ -123,7 +123,7 @@ static inline unsigned long current_stack_pointer(void) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | #ifndef CONFIG_KGDB | 125 | #ifndef CONFIG_KGDB |
126 | void arch_release_thread_info(struct thread_info *ti) | 126 | void arch_release_thread_info(struct thread_info *ti); |
127 | #endif | 127 | #endif |
128 | #define get_thread_info(ti) get_task_struct((ti)->task) | 128 | #define get_thread_info(ti) get_task_struct((ti)->task) |
129 | #define put_thread_info(ti) put_task_struct((ti)->task) | 129 | #define put_thread_info(ti) put_task_struct((ti)->task) |
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index 6eb75b80488c..0554ab062bdc 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h | |||
@@ -86,8 +86,8 @@ static inline bool arch_irqs_disabled(void) | |||
86 | } | 86 | } |
87 | 87 | ||
88 | #ifdef CONFIG_PPC_BOOK3E | 88 | #ifdef CONFIG_PPC_BOOK3E |
89 | #define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory"); | 89 | #define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory") |
90 | #define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory"); | 90 | #define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory") |
91 | #else | 91 | #else |
92 | #define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1) | 92 | #define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1) |
93 | #define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1) | 93 | #define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1) |
@@ -125,6 +125,8 @@ static inline bool arch_irq_disabled_regs(struct pt_regs *regs) | |||
125 | return !regs->softe; | 125 | return !regs->softe; |
126 | } | 126 | } |
127 | 127 | ||
128 | extern bool prep_irq_for_idle(void); | ||
129 | |||
128 | #else /* CONFIG_PPC64 */ | 130 | #else /* CONFIG_PPC64 */ |
129 | 131 | ||
130 | #define SET_MSR_EE(x) mtmsr(x) | 132 | #define SET_MSR_EE(x) mtmsr(x) |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 1b415027ec0e..1f017bb7a7ce 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -229,7 +229,7 @@ notrace void arch_local_irq_restore(unsigned long en) | |||
229 | */ | 229 | */ |
230 | if (unlikely(irq_happened != PACA_IRQ_HARD_DIS)) | 230 | if (unlikely(irq_happened != PACA_IRQ_HARD_DIS)) |
231 | __hard_irq_disable(); | 231 | __hard_irq_disable(); |
232 | #ifdef CONFIG_TRACE_IRQFLAG | 232 | #ifdef CONFIG_TRACE_IRQFLAGS |
233 | else { | 233 | else { |
234 | /* | 234 | /* |
235 | * We should already be hard disabled here. We had bugs | 235 | * We should already be hard disabled here. We had bugs |
@@ -286,6 +286,52 @@ void notrace restore_interrupts(void) | |||
286 | __hard_irq_enable(); | 286 | __hard_irq_enable(); |
287 | } | 287 | } |
288 | 288 | ||
289 | /* | ||
290 | * This is a helper to use when about to go into idle low-power | ||
291 | * when the latter has the side effect of re-enabling interrupts | ||
292 | * (such as calling H_CEDE under pHyp). | ||
293 | * | ||
294 | * You call this function with interrupts soft-disabled (this is | ||
295 | * already the case when ppc_md.power_save is called). The function | ||
296 | * will return whether to enter power save or just return. | ||
297 | * | ||
298 | * In the former case, it will have notified lockdep of interrupts | ||
299 | * being re-enabled and generally sanitized the lazy irq state, | ||
300 | * and in the latter case it will leave with interrupts hard | ||
301 | * disabled and marked as such, so the local_irq_enable() call | ||
302 | * in cpu_idle() will properly re-enable everything. | ||
303 | */ | ||
304 | bool prep_irq_for_idle(void) | ||
305 | { | ||
306 | /* | ||
307 | * First we need to hard disable to ensure no interrupt | ||
308 | * occurs before we effectively enter the low power state | ||
309 | */ | ||
310 | hard_irq_disable(); | ||
311 | |||
312 | /* | ||
313 | * If anything happened while we were soft-disabled, | ||
314 | * we return now and do not enter the low power state. | ||
315 | */ | ||
316 | if (lazy_irq_pending()) | ||
317 | return false; | ||
318 | |||
319 | /* Tell lockdep we are about to re-enable */ | ||
320 | trace_hardirqs_on(); | ||
321 | |||
322 | /* | ||
323 | * Mark interrupts as soft-enabled and clear the | ||
324 | * PACA_IRQ_HARD_DIS from the pending mask since we | ||
325 | * are about to hard enable as well as a side effect | ||
326 | * of entering the low power state. | ||
327 | */ | ||
328 | local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS; | ||
329 | local_paca->soft_enabled = 1; | ||
330 | |||
331 | /* Tell the caller to enter the low power state */ | ||
332 | return true; | ||
333 | } | ||
334 | |||
289 | #endif /* CONFIG_PPC64 */ | 335 | #endif /* CONFIG_PPC64 */ |
290 | 336 | ||
291 | int arch_show_interrupts(struct seq_file *p, int prec) | 337 | int arch_show_interrupts(struct seq_file *p, int prec) |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 6e8f677f5646..1e95556dc692 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -639,7 +639,7 @@ static void __init parse_drconf_memory(struct device_node *memory) | |||
639 | unsigned int n, rc, ranges, is_kexec_kdump = 0; | 639 | unsigned int n, rc, ranges, is_kexec_kdump = 0; |
640 | unsigned long lmb_size, base, size, sz; | 640 | unsigned long lmb_size, base, size, sz; |
641 | int nid; | 641 | int nid; |
642 | struct assoc_arrays aa; | 642 | struct assoc_arrays aa = { .arrays = NULL }; |
643 | 643 | ||
644 | n = of_get_drconf_memory(memory, &dm); | 644 | n = of_get_drconf_memory(memory, &dm); |
645 | if (!n) | 645 | if (!n) |
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c index efdacc829576..d17e98bc0c10 100644 --- a/arch/powerpc/platforms/cell/pervasive.c +++ b/arch/powerpc/platforms/cell/pervasive.c | |||
@@ -42,11 +42,9 @@ static void cbe_power_save(void) | |||
42 | { | 42 | { |
43 | unsigned long ctrl, thread_switch_control; | 43 | unsigned long ctrl, thread_switch_control; |
44 | 44 | ||
45 | /* | 45 | /* Ensure our interrupt state is properly tracked */ |
46 | * We need to hard disable interrupts, the local_irq_enable() done by | 46 | if (!prep_irq_for_idle()) |
47 | * our caller upon return will hard re-enable. | 47 | return; |
48 | */ | ||
49 | hard_irq_disable(); | ||
50 | 48 | ||
51 | ctrl = mfspr(SPRN_CTRLF); | 49 | ctrl = mfspr(SPRN_CTRLF); |
52 | 50 | ||
@@ -81,6 +79,9 @@ static void cbe_power_save(void) | |||
81 | */ | 79 | */ |
82 | ctrl &= ~(CTRL_RUNLATCH | CTRL_TE); | 80 | ctrl &= ~(CTRL_RUNLATCH | CTRL_TE); |
83 | mtspr(SPRN_CTRLT, ctrl); | 81 | mtspr(SPRN_CTRLT, ctrl); |
82 | |||
83 | /* Re-enable interrupts in MSR */ | ||
84 | __hard_irq_enable(); | ||
84 | } | 85 | } |
85 | 86 | ||
86 | static int cbe_system_reset_exception(struct pt_regs *regs) | 87 | static int cbe_system_reset_exception(struct pt_regs *regs) |
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c index e61483e8e960..c71be66bd5dc 100644 --- a/arch/powerpc/platforms/pseries/processor_idle.c +++ b/arch/powerpc/platforms/pseries/processor_idle.c | |||
@@ -99,15 +99,18 @@ out: | |||
99 | static void check_and_cede_processor(void) | 99 | static void check_and_cede_processor(void) |
100 | { | 100 | { |
101 | /* | 101 | /* |
102 | * Interrupts are soft-disabled at this point, | 102 | * Ensure our interrupt state is properly tracked, |
103 | * but not hard disabled. So an interrupt might have | 103 | * also checks if no interrupt has occurred while we |
104 | * occurred before entering NAP, and would be potentially | 104 | * were soft-disabled |
105 | * lost (edge events, decrementer events, etc...) unless | ||
106 | * we first hard disable then check. | ||
107 | */ | 105 | */ |
108 | hard_irq_disable(); | 106 | if (prep_irq_for_idle()) { |
109 | if (!lazy_irq_pending()) | ||
110 | cede_processor(); | 107 | cede_processor(); |
108 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
109 | /* Ensure that H_CEDE returns with IRQs on */ | ||
110 | if (WARN_ON(!(mfmsr() & MSR_EE))) | ||
111 | __hard_irq_enable(); | ||
112 | #endif | ||
113 | } | ||
111 | } | 114 | } |
112 | 115 | ||
113 | static int dedicated_cede_loop(struct cpuidle_device *dev, | 116 | static int dedicated_cede_loop(struct cpuidle_device *dev, |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index c4067d0141f7..542f0c04b695 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -136,7 +136,7 @@ config GPIO_MPC8XXX | |||
136 | 136 | ||
137 | config GPIO_MSM_V1 | 137 | config GPIO_MSM_V1 |
138 | tristate "Qualcomm MSM GPIO v1" | 138 | tristate "Qualcomm MSM GPIO v1" |
139 | depends on GPIOLIB && ARCH_MSM | 139 | depends on GPIOLIB && ARCH_MSM && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) |
140 | help | 140 | help |
141 | Say yes here to support the GPIO interface on ARM v6 based | 141 | Say yes here to support the GPIO interface on ARM v6 based |
142 | Qualcomm MSM chips. Most of the pins on the MSM can be | 142 | Qualcomm MSM chips. Most of the pins on the MSM can be |
diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c index 9e9947cb86a3..1077754f8289 100644 --- a/drivers/gpio/devres.c +++ b/drivers/gpio/devres.c | |||
@@ -98,6 +98,7 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio, | |||
98 | 98 | ||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | EXPORT_SYMBOL(devm_gpio_request_one); | ||
101 | 102 | ||
102 | /** | 103 | /** |
103 | * devm_gpio_free - free an interrupt | 104 | * devm_gpio_free - free an interrupt |
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index c337143b18f8..c89c4c1e668d 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
@@ -398,10 +398,12 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
398 | writel(~0, port->base + GPIO_ISR); | 398 | writel(~0, port->base + GPIO_ISR); |
399 | 399 | ||
400 | if (mxc_gpio_hwtype == IMX21_GPIO) { | 400 | if (mxc_gpio_hwtype == IMX21_GPIO) { |
401 | /* setup one handler for all GPIO interrupts */ | 401 | /* |
402 | if (pdev->id == 0) | 402 | * Setup one handler for all GPIO interrupts. Actually setting |
403 | irq_set_chained_handler(port->irq, | 403 | * the handler is needed only once, but doing it for every port |
404 | mx2_gpio_irq_handler); | 404 | * is more robust and easier. |
405 | */ | ||
406 | irq_set_chained_handler(port->irq, mx2_gpio_irq_handler); | ||
405 | } else { | 407 | } else { |
406 | /* setup one handler for each entry */ | 408 | /* setup one handler for each entry */ |
407 | irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); | 409 | irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c4ed1722734c..4fbc208c32cf 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank) | |||
174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { | 174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { |
175 | clk_enable(bank->dbck); | 175 | clk_enable(bank->dbck); |
176 | bank->dbck_enabled = true; | 176 | bank->dbck_enabled = true; |
177 | |||
178 | __raw_writel(bank->dbck_enable_mask, | ||
179 | bank->base + bank->regs->debounce_en); | ||
177 | } | 180 | } |
178 | } | 181 | } |
179 | 182 | ||
180 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) | 183 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) |
181 | { | 184 | { |
182 | if (bank->dbck_enable_mask && bank->dbck_enabled) { | 185 | if (bank->dbck_enable_mask && bank->dbck_enabled) { |
186 | /* | ||
187 | * Disable debounce before cutting it's clock. If debounce is | ||
188 | * enabled but the clock is not, GPIO module seems to be unable | ||
189 | * to detect events and generate interrupts at least on OMAP3. | ||
190 | */ | ||
191 | __raw_writel(0, bank->base + bank->regs->debounce_en); | ||
192 | |||
183 | clk_disable(bank->dbck); | 193 | clk_disable(bank->dbck); |
184 | bank->dbck_enabled = false; | 194 | bank->dbck_enabled = false; |
185 | } | 195 | } |
@@ -1081,7 +1091,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
1081 | bank->is_mpuio = pdata->is_mpuio; | 1091 | bank->is_mpuio = pdata->is_mpuio; |
1082 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; | 1092 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; |
1083 | bank->loses_context = pdata->loses_context; | 1093 | bank->loses_context = pdata->loses_context; |
1084 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
1085 | bank->regs = pdata->regs; | 1094 | bank->regs = pdata->regs; |
1086 | #ifdef CONFIG_OF_GPIO | 1095 | #ifdef CONFIG_OF_GPIO |
1087 | bank->chip.of_node = of_node_get(node); | 1096 | bank->chip.of_node = of_node_get(node); |
@@ -1135,6 +1144,9 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
1135 | omap_gpio_chip_init(bank); | 1144 | omap_gpio_chip_init(bank); |
1136 | omap_gpio_show_rev(bank); | 1145 | omap_gpio_show_rev(bank); |
1137 | 1146 | ||
1147 | if (bank->loses_context) | ||
1148 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
1149 | |||
1138 | pm_runtime_put(bank->dev); | 1150 | pm_runtime_put(bank->dev); |
1139 | 1151 | ||
1140 | list_add_tail(&bank->node, &omap_gpio_list); | 1152 | list_add_tail(&bank->node, &omap_gpio_list); |
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index 38416be8ba11..6064fb376e11 100644 --- a/drivers/gpio/gpio-sta2x11.c +++ b/drivers/gpio/gpio-sta2x11.c | |||
@@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev) | |||
383 | } | 383 | } |
384 | spin_lock_init(&chip->lock); | 384 | spin_lock_init(&chip->lock); |
385 | gsta_gpio_setup(chip); | 385 | gsta_gpio_setup(chip); |
386 | for (i = 0; i < GSTA_NR_GPIO; i++) | 386 | if (gpio_pdata) |
387 | gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); | 387 | for (i = 0; i < GSTA_NR_GPIO; i++) |
388 | gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); | ||
388 | 389 | ||
389 | /* 384 was used in previous code: be compatible for other drivers */ | 390 | /* 384 was used in previous code: be compatible for other drivers */ |
390 | err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); | 391 | err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); |
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index c1ad2884f2ed..11f29c82253c 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c | |||
@@ -149,6 +149,9 @@ static int __devinit tps65910_gpio_probe(struct platform_device *pdev) | |||
149 | tps65910_gpio->gpio_chip.set = tps65910_gpio_set; | 149 | tps65910_gpio->gpio_chip.set = tps65910_gpio_set; |
150 | tps65910_gpio->gpio_chip.get = tps65910_gpio_get; | 150 | tps65910_gpio->gpio_chip.get = tps65910_gpio_get; |
151 | tps65910_gpio->gpio_chip.dev = &pdev->dev; | 151 | tps65910_gpio->gpio_chip.dev = &pdev->dev; |
152 | #ifdef CONFIG_OF_GPIO | ||
153 | tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node; | ||
154 | #endif | ||
152 | if (pdata && pdata->gpio_base) | 155 | if (pdata && pdata->gpio_base) |
153 | tps65910_gpio->gpio_chip.base = pdata->gpio_base; | 156 | tps65910_gpio->gpio_chip.base = pdata->gpio_base; |
154 | else | 157 | else |
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c index 92ea5350dfe9..aa61ad2fcaaa 100644 --- a/drivers/gpio/gpio-wm8994.c +++ b/drivers/gpio/gpio-wm8994.c | |||
@@ -89,8 +89,11 @@ static int wm8994_gpio_direction_out(struct gpio_chip *chip, | |||
89 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); | 89 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); |
90 | struct wm8994 *wm8994 = wm8994_gpio->wm8994; | 90 | struct wm8994 *wm8994 = wm8994_gpio->wm8994; |
91 | 91 | ||
92 | if (value) | ||
93 | value = WM8994_GPN_LVL; | ||
94 | |||
92 | return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, | 95 | return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, |
93 | WM8994_GPN_DIR, 0); | 96 | WM8994_GPN_DIR | WM8994_GPN_LVL, value); |
94 | } | 97 | } |
95 | 98 | ||
96 | static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 99 | static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 61c9cf15fa52..1201a15784c3 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c | |||
@@ -345,7 +345,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, | |||
345 | spin_lock_init(&hwlock->lock); | 345 | spin_lock_init(&hwlock->lock); |
346 | hwlock->bank = bank; | 346 | hwlock->bank = bank; |
347 | 347 | ||
348 | ret = hwspin_lock_register_single(hwlock, i); | 348 | ret = hwspin_lock_register_single(hwlock, base_id + i); |
349 | if (ret) | 349 | if (ret) |
350 | goto reg_failed; | 350 | goto reg_failed; |
351 | } | 351 | } |
@@ -354,7 +354,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, | |||
354 | 354 | ||
355 | reg_failed: | 355 | reg_failed: |
356 | while (--i >= 0) | 356 | while (--i >= 0) |
357 | hwspin_lock_unregister_single(i); | 357 | hwspin_lock_unregister_single(base_id + i); |
358 | return ret; | 358 | return ret; |
359 | } | 359 | } |
360 | EXPORT_SYMBOL_GPL(hwspin_lock_register); | 360 | EXPORT_SYMBOL_GPL(hwspin_lock_register); |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index a2e418cba0ff..625626391f2d 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -83,6 +83,8 @@ static struct iommu_ops amd_iommu_ops; | |||
83 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); | 83 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); |
84 | int amd_iommu_max_glx_val = -1; | 84 | int amd_iommu_max_glx_val = -1; |
85 | 85 | ||
86 | static struct dma_map_ops amd_iommu_dma_ops; | ||
87 | |||
86 | /* | 88 | /* |
87 | * general struct to manage commands send to an IOMMU | 89 | * general struct to manage commands send to an IOMMU |
88 | */ | 90 | */ |
@@ -402,7 +404,7 @@ static void amd_iommu_stats_init(void) | |||
402 | return; | 404 | return; |
403 | 405 | ||
404 | de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, | 406 | de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, |
405 | (u32 *)&amd_iommu_unmap_flush); | 407 | &amd_iommu_unmap_flush); |
406 | 408 | ||
407 | amd_iommu_stats_add(&compl_wait); | 409 | amd_iommu_stats_add(&compl_wait); |
408 | amd_iommu_stats_add(&cnt_map_single); | 410 | amd_iommu_stats_add(&cnt_map_single); |
@@ -2267,6 +2269,13 @@ static int device_change_notifier(struct notifier_block *nb, | |||
2267 | list_add_tail(&dma_domain->list, &iommu_pd_list); | 2269 | list_add_tail(&dma_domain->list, &iommu_pd_list); |
2268 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); | 2270 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); |
2269 | 2271 | ||
2272 | dev_data = get_dev_data(dev); | ||
2273 | |||
2274 | if (!dev_data->passthrough) | ||
2275 | dev->archdata.dma_ops = &amd_iommu_dma_ops; | ||
2276 | else | ||
2277 | dev->archdata.dma_ops = &nommu_dma_ops; | ||
2278 | |||
2270 | break; | 2279 | break; |
2271 | case BUS_NOTIFY_DEL_DEVICE: | 2280 | case BUS_NOTIFY_DEL_DEVICE: |
2272 | 2281 | ||
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 542024ba6dba..a33612f3206f 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -129,7 +129,7 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have | |||
129 | to handle */ | 129 | to handle */ |
130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings | 130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings |
131 | we find in ACPI */ | 131 | we find in ACPI */ |
132 | bool amd_iommu_unmap_flush; /* if true, flush on every unmap */ | 132 | u32 amd_iommu_unmap_flush; /* if true, flush on every unmap */ |
133 | 133 | ||
134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the | 134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the |
135 | system */ | 135 | system */ |
@@ -1641,6 +1641,8 @@ static int __init amd_iommu_init(void) | |||
1641 | 1641 | ||
1642 | amd_iommu_init_api(); | 1642 | amd_iommu_init_api(); |
1643 | 1643 | ||
1644 | x86_platform.iommu_shutdown = disable_iommus; | ||
1645 | |||
1644 | if (iommu_pass_through) | 1646 | if (iommu_pass_through) |
1645 | goto out; | 1647 | goto out; |
1646 | 1648 | ||
@@ -1649,8 +1651,6 @@ static int __init amd_iommu_init(void) | |||
1649 | else | 1651 | else |
1650 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); | 1652 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); |
1651 | 1653 | ||
1652 | x86_platform.iommu_shutdown = disable_iommus; | ||
1653 | |||
1654 | out: | 1654 | out: |
1655 | return ret; | 1655 | return ret; |
1656 | 1656 | ||
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index 24355559a2ad..c1b1d489817e 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h | |||
@@ -652,7 +652,7 @@ extern unsigned long *amd_iommu_pd_alloc_bitmap; | |||
652 | * If true, the addresses will be flushed on unmap time, not when | 652 | * If true, the addresses will be flushed on unmap time, not when |
653 | * they are reused | 653 | * they are reused |
654 | */ | 654 | */ |
655 | extern bool amd_iommu_unmap_flush; | 655 | extern u32 amd_iommu_unmap_flush; |
656 | 656 | ||
657 | /* Smallest number of PASIDs supported by any IOMMU in the system */ | 657 | /* Smallest number of PASIDs supported by any IOMMU in the system */ |
658 | extern u32 amd_iommu_max_pasids; | 658 | extern u32 amd_iommu_max_pasids; |
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index ecd679043d77..3f3d09d560ea 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c | |||
@@ -550,13 +550,13 @@ static int alloc_pdir(struct smmu_as *as) | |||
550 | return 0; | 550 | return 0; |
551 | 551 | ||
552 | as->pte_count = devm_kzalloc(smmu->dev, | 552 | as->pte_count = devm_kzalloc(smmu->dev, |
553 | sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_KERNEL); | 553 | sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_ATOMIC); |
554 | if (!as->pte_count) { | 554 | if (!as->pte_count) { |
555 | dev_err(smmu->dev, | 555 | dev_err(smmu->dev, |
556 | "failed to allocate smmu_device PTE cunters\n"); | 556 | "failed to allocate smmu_device PTE cunters\n"); |
557 | return -ENOMEM; | 557 | return -ENOMEM; |
558 | } | 558 | } |
559 | as->pdir_page = alloc_page(GFP_KERNEL | __GFP_DMA); | 559 | as->pdir_page = alloc_page(GFP_ATOMIC | __GFP_DMA); |
560 | if (!as->pdir_page) { | 560 | if (!as->pdir_page) { |
561 | dev_err(smmu->dev, | 561 | dev_err(smmu->dev, |
562 | "failed to allocate smmu_device page directory\n"); | 562 | "failed to allocate smmu_device page directory\n"); |
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 6c31e46a1fd2..b9c6f17eabb2 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
@@ -2070,10 +2070,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2070 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); | 2070 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); |
2071 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), | 2071 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), |
2072 | v4l2_ctrl_g_ctrl(sd->red)); | 2072 | v4l2_ctrl_g_ctrl(sd->red)); |
2073 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); | 2073 | if (sd->gain) |
2074 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); | 2074 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); |
2075 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | 2075 | if (sd->exposure) |
2076 | v4l2_ctrl_g_ctrl(sd->vflip)); | 2076 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); |
2077 | if (sd->hflip) | ||
2078 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | ||
2079 | v4l2_ctrl_g_ctrl(sd->vflip)); | ||
2077 | 2080 | ||
2078 | reg_w1(gspca_dev, 0x1007, 0x20); | 2081 | reg_w1(gspca_dev, 0x1007, 0x20); |
2079 | reg_w1(gspca_dev, 0x1061, 0x03); | 2082 | reg_w1(gspca_dev, 0x1061, 0x03); |
@@ -2176,7 +2179,7 @@ static void sd_dqcallback(struct gspca_dev *gspca_dev) | |||
2176 | struct sd *sd = (struct sd *) gspca_dev; | 2179 | struct sd *sd = (struct sd *) gspca_dev; |
2177 | int avg_lum; | 2180 | int avg_lum; |
2178 | 2181 | ||
2179 | if (!v4l2_ctrl_g_ctrl(sd->autogain)) | 2182 | if (sd->autogain == NULL || !v4l2_ctrl_g_ctrl(sd->autogain)) |
2180 | return; | 2183 | return; |
2181 | 2184 | ||
2182 | avg_lum = atomic_read(&sd->avg_lum); | 2185 | avg_lum = atomic_read(&sd->avg_lum); |
diff --git a/drivers/of/base.c b/drivers/of/base.c index eada3f4ef801..d9bfd49b1935 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -511,22 +511,6 @@ out: | |||
511 | } | 511 | } |
512 | EXPORT_SYMBOL(of_find_node_with_property); | 512 | EXPORT_SYMBOL(of_find_node_with_property); |
513 | 513 | ||
514 | static const struct of_device_id *of_match_compat(const struct of_device_id *matches, | ||
515 | const char *compat) | ||
516 | { | ||
517 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { | ||
518 | const char *cp = matches->compatible; | ||
519 | int len = strlen(cp); | ||
520 | |||
521 | if (len > 0 && of_compat_cmp(compat, cp, len) == 0) | ||
522 | return matches; | ||
523 | |||
524 | matches++; | ||
525 | } | ||
526 | |||
527 | return NULL; | ||
528 | } | ||
529 | |||
530 | /** | 514 | /** |
531 | * of_match_node - Tell if an device_node has a matching of_match structure | 515 | * of_match_node - Tell if an device_node has a matching of_match structure |
532 | * @matches: array of of device match structures to search in | 516 | * @matches: array of of device match structures to search in |
@@ -537,18 +521,9 @@ static const struct of_device_id *of_match_compat(const struct of_device_id *mat | |||
537 | const struct of_device_id *of_match_node(const struct of_device_id *matches, | 521 | const struct of_device_id *of_match_node(const struct of_device_id *matches, |
538 | const struct device_node *node) | 522 | const struct device_node *node) |
539 | { | 523 | { |
540 | struct property *prop; | ||
541 | const char *cp; | ||
542 | |||
543 | if (!matches) | 524 | if (!matches) |
544 | return NULL; | 525 | return NULL; |
545 | 526 | ||
546 | of_property_for_each_string(node, "compatible", prop, cp) { | ||
547 | const struct of_device_id *match = of_match_compat(matches, cp); | ||
548 | if (match) | ||
549 | return match; | ||
550 | } | ||
551 | |||
552 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { | 527 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { |
553 | int match = 1; | 528 | int match = 1; |
554 | if (matches->name[0]) | 529 | if (matches->name[0]) |
@@ -557,7 +532,10 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches, | |||
557 | if (matches->type[0]) | 532 | if (matches->type[0]) |
558 | match &= node->type | 533 | match &= node->type |
559 | && !strcmp(matches->type, node->type); | 534 | && !strcmp(matches->type, node->type); |
560 | if (match && !matches->compatible[0]) | 535 | if (matches->compatible[0]) |
536 | match &= of_device_is_compatible(node, | ||
537 | matches->compatible); | ||
538 | if (match) | ||
561 | return matches; | 539 | return matches; |
562 | matches++; | 540 | matches++; |
563 | } | 541 | } |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 09a737c868b5..8b4b3829d9e7 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2519,9 +2519,12 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
2519 | { | 2519 | { |
2520 | struct regulator_dev *rdev = regulator->rdev; | 2520 | struct regulator_dev *rdev = regulator->rdev; |
2521 | struct regulator *consumer; | 2521 | struct regulator *consumer; |
2522 | int ret, output_uV, input_uV, total_uA_load = 0; | 2522 | int ret, output_uV, input_uV = 0, total_uA_load = 0; |
2523 | unsigned int mode; | 2523 | unsigned int mode; |
2524 | 2524 | ||
2525 | if (rdev->supply) | ||
2526 | input_uV = regulator_get_voltage(rdev->supply); | ||
2527 | |||
2525 | mutex_lock(&rdev->mutex); | 2528 | mutex_lock(&rdev->mutex); |
2526 | 2529 | ||
2527 | /* | 2530 | /* |
@@ -2554,10 +2557,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
2554 | goto out; | 2557 | goto out; |
2555 | } | 2558 | } |
2556 | 2559 | ||
2557 | /* get input voltage */ | 2560 | /* No supply? Use constraint voltage */ |
2558 | input_uV = 0; | ||
2559 | if (rdev->supply) | ||
2560 | input_uV = regulator_get_voltage(rdev->supply); | ||
2561 | if (input_uV <= 0) | 2561 | if (input_uV <= 0) |
2562 | input_uV = rdev->constraints->input_uV; | 2562 | input_uV = rdev->constraints->input_uV; |
2563 | if (input_uV <= 0) { | 2563 | if (input_uV <= 0) { |
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 24d880e78ec6..f8d818abf98c 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig | |||
@@ -4,9 +4,11 @@ menu "Remoteproc drivers (EXPERIMENTAL)" | |||
4 | config REMOTEPROC | 4 | config REMOTEPROC |
5 | tristate | 5 | tristate |
6 | depends on EXPERIMENTAL | 6 | depends on EXPERIMENTAL |
7 | select FW_CONFIG | ||
7 | 8 | ||
8 | config OMAP_REMOTEPROC | 9 | config OMAP_REMOTEPROC |
9 | tristate "OMAP remoteproc support" | 10 | tristate "OMAP remoteproc support" |
11 | depends on EXPERIMENTAL | ||
10 | depends on ARCH_OMAP4 | 12 | depends on ARCH_OMAP4 |
11 | depends on OMAP_IOMMU | 13 | depends on OMAP_IOMMU |
12 | select REMOTEPROC | 14 | select REMOTEPROC |
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 75506ec2840e..39d3aa41adda 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c | |||
@@ -188,6 +188,26 @@ static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
188 | rpdev->id.name); | 188 | rpdev->id.name); |
189 | } | 189 | } |
190 | 190 | ||
191 | /** | ||
192 | * __ept_release() - deallocate an rpmsg endpoint | ||
193 | * @kref: the ept's reference count | ||
194 | * | ||
195 | * This function deallocates an ept, and is invoked when its @kref refcount | ||
196 | * drops to zero. | ||
197 | * | ||
198 | * Never invoke this function directly! | ||
199 | */ | ||
200 | static void __ept_release(struct kref *kref) | ||
201 | { | ||
202 | struct rpmsg_endpoint *ept = container_of(kref, struct rpmsg_endpoint, | ||
203 | refcount); | ||
204 | /* | ||
205 | * At this point no one holds a reference to ept anymore, | ||
206 | * so we can directly free it | ||
207 | */ | ||
208 | kfree(ept); | ||
209 | } | ||
210 | |||
191 | /* for more info, see below documentation of rpmsg_create_ept() */ | 211 | /* for more info, see below documentation of rpmsg_create_ept() */ |
192 | static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, | 212 | static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, |
193 | struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb, | 213 | struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb, |
@@ -206,6 +226,9 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, | |||
206 | return NULL; | 226 | return NULL; |
207 | } | 227 | } |
208 | 228 | ||
229 | kref_init(&ept->refcount); | ||
230 | mutex_init(&ept->cb_lock); | ||
231 | |||
209 | ept->rpdev = rpdev; | 232 | ept->rpdev = rpdev; |
210 | ept->cb = cb; | 233 | ept->cb = cb; |
211 | ept->priv = priv; | 234 | ept->priv = priv; |
@@ -238,7 +261,7 @@ rem_idr: | |||
238 | idr_remove(&vrp->endpoints, request); | 261 | idr_remove(&vrp->endpoints, request); |
239 | free_ept: | 262 | free_ept: |
240 | mutex_unlock(&vrp->endpoints_lock); | 263 | mutex_unlock(&vrp->endpoints_lock); |
241 | kfree(ept); | 264 | kref_put(&ept->refcount, __ept_release); |
242 | return NULL; | 265 | return NULL; |
243 | } | 266 | } |
244 | 267 | ||
@@ -302,11 +325,17 @@ EXPORT_SYMBOL(rpmsg_create_ept); | |||
302 | static void | 325 | static void |
303 | __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) | 326 | __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) |
304 | { | 327 | { |
328 | /* make sure new inbound messages can't find this ept anymore */ | ||
305 | mutex_lock(&vrp->endpoints_lock); | 329 | mutex_lock(&vrp->endpoints_lock); |
306 | idr_remove(&vrp->endpoints, ept->addr); | 330 | idr_remove(&vrp->endpoints, ept->addr); |
307 | mutex_unlock(&vrp->endpoints_lock); | 331 | mutex_unlock(&vrp->endpoints_lock); |
308 | 332 | ||
309 | kfree(ept); | 333 | /* make sure in-flight inbound messages won't invoke cb anymore */ |
334 | mutex_lock(&ept->cb_lock); | ||
335 | ept->cb = NULL; | ||
336 | mutex_unlock(&ept->cb_lock); | ||
337 | |||
338 | kref_put(&ept->refcount, __ept_release); | ||
310 | } | 339 | } |
311 | 340 | ||
312 | /** | 341 | /** |
@@ -790,12 +819,28 @@ static void rpmsg_recv_done(struct virtqueue *rvq) | |||
790 | 819 | ||
791 | /* use the dst addr to fetch the callback of the appropriate user */ | 820 | /* use the dst addr to fetch the callback of the appropriate user */ |
792 | mutex_lock(&vrp->endpoints_lock); | 821 | mutex_lock(&vrp->endpoints_lock); |
822 | |||
793 | ept = idr_find(&vrp->endpoints, msg->dst); | 823 | ept = idr_find(&vrp->endpoints, msg->dst); |
824 | |||
825 | /* let's make sure no one deallocates ept while we use it */ | ||
826 | if (ept) | ||
827 | kref_get(&ept->refcount); | ||
828 | |||
794 | mutex_unlock(&vrp->endpoints_lock); | 829 | mutex_unlock(&vrp->endpoints_lock); |
795 | 830 | ||
796 | if (ept && ept->cb) | 831 | if (ept) { |
797 | ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, msg->src); | 832 | /* make sure ept->cb doesn't go away while we use it */ |
798 | else | 833 | mutex_lock(&ept->cb_lock); |
834 | |||
835 | if (ept->cb) | ||
836 | ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, | ||
837 | msg->src); | ||
838 | |||
839 | mutex_unlock(&ept->cb_lock); | ||
840 | |||
841 | /* farewell, ept, we don't need you anymore */ | ||
842 | kref_put(&ept->refcount, __ept_release); | ||
843 | } else | ||
799 | dev_warn(dev, "msg received with no recepient\n"); | 844 | dev_warn(dev, "msg received with no recepient\n"); |
800 | 845 | ||
801 | /* publish the real size of the buffer */ | 846 | /* publish the real size of the buffer */ |
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c index ced26c8ccd57..0d2ea0c224c3 100644 --- a/drivers/tty/hvc/hvc_opal.c +++ b/drivers/tty/hvc/hvc_opal.c | |||
@@ -401,7 +401,7 @@ out: | |||
401 | } | 401 | } |
402 | 402 | ||
403 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW | 403 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW |
404 | void __init udbg_init_debug_opal(void) | 404 | void __init udbg_init_debug_opal_raw(void) |
405 | { | 405 | { |
406 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; | 406 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; |
407 | hvc_opal_privs[index] = &hvc_opal_boot_priv; | 407 | hvc_opal_privs[index] = &hvc_opal_boot_priv; |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index bfbc15ca38dd..0908e6044333 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -47,7 +47,7 @@ struct virtio_balloon | |||
47 | struct task_struct *thread; | 47 | struct task_struct *thread; |
48 | 48 | ||
49 | /* Waiting for host to ack the pages we released. */ | 49 | /* Waiting for host to ack the pages we released. */ |
50 | struct completion acked; | 50 | wait_queue_head_t acked; |
51 | 51 | ||
52 | /* Number of balloon pages we've told the Host we're not using. */ | 52 | /* Number of balloon pages we've told the Host we're not using. */ |
53 | unsigned int num_pages; | 53 | unsigned int num_pages; |
@@ -89,29 +89,25 @@ static struct page *balloon_pfn_to_page(u32 pfn) | |||
89 | 89 | ||
90 | static void balloon_ack(struct virtqueue *vq) | 90 | static void balloon_ack(struct virtqueue *vq) |
91 | { | 91 | { |
92 | struct virtio_balloon *vb; | 92 | struct virtio_balloon *vb = vq->vdev->priv; |
93 | unsigned int len; | ||
94 | 93 | ||
95 | vb = virtqueue_get_buf(vq, &len); | 94 | wake_up(&vb->acked); |
96 | if (vb) | ||
97 | complete(&vb->acked); | ||
98 | } | 95 | } |
99 | 96 | ||
100 | static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | 97 | static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) |
101 | { | 98 | { |
102 | struct scatterlist sg; | 99 | struct scatterlist sg; |
100 | unsigned int len; | ||
103 | 101 | ||
104 | sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); | 102 | sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); |
105 | 103 | ||
106 | init_completion(&vb->acked); | ||
107 | |||
108 | /* We should always be able to add one buffer to an empty queue. */ | 104 | /* We should always be able to add one buffer to an empty queue. */ |
109 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) | 105 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
110 | BUG(); | 106 | BUG(); |
111 | virtqueue_kick(vq); | 107 | virtqueue_kick(vq); |
112 | 108 | ||
113 | /* When host has read buffer, this completes via balloon_ack */ | 109 | /* When host has read buffer, this completes via balloon_ack */ |
114 | wait_for_completion(&vb->acked); | 110 | wait_event(vb->acked, virtqueue_get_buf(vq, &len)); |
115 | } | 111 | } |
116 | 112 | ||
117 | static void set_page_pfns(u32 pfns[], struct page *page) | 113 | static void set_page_pfns(u32 pfns[], struct page *page) |
@@ -231,12 +227,8 @@ static void update_balloon_stats(struct virtio_balloon *vb) | |||
231 | */ | 227 | */ |
232 | static void stats_request(struct virtqueue *vq) | 228 | static void stats_request(struct virtqueue *vq) |
233 | { | 229 | { |
234 | struct virtio_balloon *vb; | 230 | struct virtio_balloon *vb = vq->vdev->priv; |
235 | unsigned int len; | ||
236 | 231 | ||
237 | vb = virtqueue_get_buf(vq, &len); | ||
238 | if (!vb) | ||
239 | return; | ||
240 | vb->need_stats_update = 1; | 232 | vb->need_stats_update = 1; |
241 | wake_up(&vb->config_change); | 233 | wake_up(&vb->config_change); |
242 | } | 234 | } |
@@ -245,11 +237,14 @@ static void stats_handle_request(struct virtio_balloon *vb) | |||
245 | { | 237 | { |
246 | struct virtqueue *vq; | 238 | struct virtqueue *vq; |
247 | struct scatterlist sg; | 239 | struct scatterlist sg; |
240 | unsigned int len; | ||
248 | 241 | ||
249 | vb->need_stats_update = 0; | 242 | vb->need_stats_update = 0; |
250 | update_balloon_stats(vb); | 243 | update_balloon_stats(vb); |
251 | 244 | ||
252 | vq = vb->stats_vq; | 245 | vq = vb->stats_vq; |
246 | if (!virtqueue_get_buf(vq, &len)) | ||
247 | return; | ||
253 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); | 248 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); |
254 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) | 249 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
255 | BUG(); | 250 | BUG(); |
@@ -358,6 +353,7 @@ static int virtballoon_probe(struct virtio_device *vdev) | |||
358 | INIT_LIST_HEAD(&vb->pages); | 353 | INIT_LIST_HEAD(&vb->pages); |
359 | vb->num_pages = 0; | 354 | vb->num_pages = 0; |
360 | init_waitqueue_head(&vb->config_change); | 355 | init_waitqueue_head(&vb->config_change); |
356 | init_waitqueue_head(&vb->acked); | ||
361 | vb->vdev = vdev; | 357 | vb->vdev = vdev; |
362 | vb->need_stats_update = 0; | 358 | vb->need_stats_update = 0; |
363 | 359 | ||
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index f07fc2d08159..2e31e8b3a190 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -22,8 +22,8 @@ | |||
22 | /* Gpio pin is open source */ | 22 | /* Gpio pin is open source */ |
23 | #define GPIOF_OPEN_SOURCE (1 << 3) | 23 | #define GPIOF_OPEN_SOURCE (1 << 3) |
24 | 24 | ||
25 | #define GPIOF_EXPORT (1 << 2) | 25 | #define GPIOF_EXPORT (1 << 4) |
26 | #define GPIOF_EXPORT_CHANGEABLE (1 << 3) | 26 | #define GPIOF_EXPORT_CHANGEABLE (1 << 5) |
27 | #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) | 27 | #define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT) |
28 | #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) | 28 | #define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE) |
29 | 29 | ||
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h index a8e50e44203c..82a673905edb 100644 --- a/include/linux/rpmsg.h +++ b/include/linux/rpmsg.h | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <linux/types.h> | 38 | #include <linux/types.h> |
39 | #include <linux/device.h> | 39 | #include <linux/device.h> |
40 | #include <linux/mod_devicetable.h> | 40 | #include <linux/mod_devicetable.h> |
41 | #include <linux/kref.h> | ||
42 | #include <linux/mutex.h> | ||
41 | 43 | ||
42 | /* The feature bitmap for virtio rpmsg */ | 44 | /* The feature bitmap for virtio rpmsg */ |
43 | #define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ | 45 | #define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */ |
@@ -120,7 +122,9 @@ typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32); | |||
120 | /** | 122 | /** |
121 | * struct rpmsg_endpoint - binds a local rpmsg address to its user | 123 | * struct rpmsg_endpoint - binds a local rpmsg address to its user |
122 | * @rpdev: rpmsg channel device | 124 | * @rpdev: rpmsg channel device |
125 | * @refcount: when this drops to zero, the ept is deallocated | ||
123 | * @cb: rx callback handler | 126 | * @cb: rx callback handler |
127 | * @cb_lock: must be taken before accessing/changing @cb | ||
124 | * @addr: local rpmsg address | 128 | * @addr: local rpmsg address |
125 | * @priv: private data for the driver's use | 129 | * @priv: private data for the driver's use |
126 | * | 130 | * |
@@ -140,7 +144,9 @@ typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32); | |||
140 | */ | 144 | */ |
141 | struct rpmsg_endpoint { | 145 | struct rpmsg_endpoint { |
142 | struct rpmsg_channel *rpdev; | 146 | struct rpmsg_channel *rpdev; |
147 | struct kref refcount; | ||
143 | rpmsg_rx_cb_t cb; | 148 | rpmsg_rx_cb_t cb; |
149 | struct mutex cb_lock; | ||
144 | u32 addr; | 150 | u32 addr; |
145 | void *priv; | 151 | void *priv; |
146 | }; | 152 | }; |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 2097684cf194..b303dfc7dce0 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -901,13 +901,10 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode) | |||
901 | mutex_unlock(&cgroup_mutex); | 901 | mutex_unlock(&cgroup_mutex); |
902 | 902 | ||
903 | /* | 903 | /* |
904 | * We want to drop the active superblock reference from the | 904 | * Drop the active superblock reference that we took when we |
905 | * cgroup creation after all the dentry refs are gone - | 905 | * created the cgroup |
906 | * kill_sb gets mighty unhappy otherwise. Mark | ||
907 | * dentry->d_fsdata with cgroup_diput() to tell | ||
908 | * cgroup_d_release() to call deactivate_super(). | ||
909 | */ | 906 | */ |
910 | dentry->d_fsdata = cgroup_diput; | 907 | deactivate_super(cgrp->root->sb); |
911 | 908 | ||
912 | /* | 909 | /* |
913 | * if we're getting rid of the cgroup, refcount should ensure | 910 | * if we're getting rid of the cgroup, refcount should ensure |
@@ -933,13 +930,6 @@ static int cgroup_delete(const struct dentry *d) | |||
933 | return 1; | 930 | return 1; |
934 | } | 931 | } |
935 | 932 | ||
936 | static void cgroup_d_release(struct dentry *dentry) | ||
937 | { | ||
938 | /* did cgroup_diput() tell me to deactivate super? */ | ||
939 | if (dentry->d_fsdata == cgroup_diput) | ||
940 | deactivate_super(dentry->d_sb); | ||
941 | } | ||
942 | |||
943 | static void remove_dir(struct dentry *d) | 933 | static void remove_dir(struct dentry *d) |
944 | { | 934 | { |
945 | struct dentry *parent = dget(d->d_parent); | 935 | struct dentry *parent = dget(d->d_parent); |
@@ -1547,7 +1537,6 @@ static int cgroup_get_rootdir(struct super_block *sb) | |||
1547 | static const struct dentry_operations cgroup_dops = { | 1537 | static const struct dentry_operations cgroup_dops = { |
1548 | .d_iput = cgroup_diput, | 1538 | .d_iput = cgroup_diput, |
1549 | .d_delete = cgroup_delete, | 1539 | .d_delete = cgroup_delete, |
1550 | .d_release = cgroup_d_release, | ||
1551 | }; | 1540 | }; |
1552 | 1541 | ||
1553 | struct inode *inode = | 1542 | struct inode *inode = |
@@ -3894,8 +3883,12 @@ static void css_dput_fn(struct work_struct *work) | |||
3894 | { | 3883 | { |
3895 | struct cgroup_subsys_state *css = | 3884 | struct cgroup_subsys_state *css = |
3896 | container_of(work, struct cgroup_subsys_state, dput_work); | 3885 | container_of(work, struct cgroup_subsys_state, dput_work); |
3886 | struct dentry *dentry = css->cgroup->dentry; | ||
3887 | struct super_block *sb = dentry->d_sb; | ||
3897 | 3888 | ||
3898 | dput(css->cgroup->dentry); | 3889 | atomic_inc(&sb->s_active); |
3890 | dput(dentry); | ||
3891 | deactivate_super(sb); | ||
3899 | } | 3892 | } |
3900 | 3893 | ||
3901 | static void init_cgroup_css(struct cgroup_subsys_state *css, | 3894 | static void init_cgroup_css(struct cgroup_subsys_state *css, |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 518aea714d21..66ce41489133 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -78,7 +78,7 @@ static LIST_HEAD(free_entries); | |||
78 | static DEFINE_SPINLOCK(free_entries_lock); | 78 | static DEFINE_SPINLOCK(free_entries_lock); |
79 | 79 | ||
80 | /* Global disable flag - will be set in case of an error */ | 80 | /* Global disable flag - will be set in case of an error */ |
81 | static bool global_disable __read_mostly; | 81 | static u32 global_disable __read_mostly; |
82 | 82 | ||
83 | /* Global error count */ | 83 | /* Global error count */ |
84 | static u32 error_count; | 84 | static u32 error_count; |
@@ -657,7 +657,7 @@ static int dma_debug_fs_init(void) | |||
657 | 657 | ||
658 | global_disable_dent = debugfs_create_bool("disabled", 0444, | 658 | global_disable_dent = debugfs_create_bool("disabled", 0444, |
659 | dma_debug_dent, | 659 | dma_debug_dent, |
660 | (u32 *)&global_disable); | 660 | &global_disable); |
661 | if (!global_disable_dent) | 661 | if (!global_disable_dent) |
662 | goto out_err; | 662 | goto out_err; |
663 | 663 | ||