diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2011-07-08 01:17:27 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2011-07-08 01:21:36 -0400 |
commit | 314b02f503c2c219fde0fcf6f086fda415f8a847 (patch) | |
tree | 7f41ae421e6cb11d821175465b1346851a600292 | |
parent | a77ce8167cc1d0370fcb1d79b367d62e050cb2b0 (diff) |
powerpc: implement arch_setup_pdev_archdata
We have a long standing issues with platform devices not have a valid
dma_mask pointer. This hasn't been an issue to date as no platform
device has tried to set its dma_mask value to a non-default value.
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 28 | ||||
-rw-r--r-- | drivers/of/platform.c | 4 |
2 files changed, 6 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index e053b1641de3..c600faf114d7 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -709,29 +709,9 @@ void ppc_printk_progress(char *s, unsigned short hex) | |||
709 | pr_info("%s\n", s); | 709 | pr_info("%s\n", s); |
710 | } | 710 | } |
711 | 711 | ||
712 | static int ppc_dflt_bus_notify(struct notifier_block *nb, | 712 | void arch_setup_pdev_archdata(struct platform_device *pdev) |
713 | unsigned long action, void *data) | ||
714 | { | 713 | { |
715 | struct device *dev = data; | 714 | pdev->archdata.dma_mask = DMA_BIT_MASK(32); |
716 | 715 | pdev->dev.dma_mask = &pdev->archdata.dma_mask; | |
717 | /* We are only intereted in device addition */ | 716 | set_dma_ops(&pdev->dev, &dma_direct_ops); |
718 | if (action != BUS_NOTIFY_ADD_DEVICE) | ||
719 | return 0; | ||
720 | |||
721 | set_dma_ops(dev, &dma_direct_ops); | ||
722 | |||
723 | return NOTIFY_DONE; | ||
724 | } | ||
725 | |||
726 | static struct notifier_block ppc_dflt_plat_bus_notifier = { | ||
727 | .notifier_call = ppc_dflt_bus_notify, | ||
728 | .priority = INT_MAX, | ||
729 | }; | ||
730 | |||
731 | static int __init setup_bus_notifier(void) | ||
732 | { | ||
733 | bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier); | ||
734 | return 0; | ||
735 | } | 717 | } |
736 | |||
737 | arch_initcall(setup_bus_notifier); | ||
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 63d3cb73bdb9..cfc6a7969401 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -153,7 +153,7 @@ struct platform_device *of_device_alloc(struct device_node *np, | |||
153 | } | 153 | } |
154 | 154 | ||
155 | dev->dev.of_node = of_node_get(np); | 155 | dev->dev.of_node = of_node_get(np); |
156 | #if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE) | 156 | #if defined(CONFIG_MICROBLAZE) |
157 | dev->dev.dma_mask = &dev->archdata.dma_mask; | 157 | dev->dev.dma_mask = &dev->archdata.dma_mask; |
158 | #endif | 158 | #endif |
159 | dev->dev.parent = parent; | 159 | dev->dev.parent = parent; |
@@ -189,7 +189,7 @@ struct platform_device *of_platform_device_create(struct device_node *np, | |||
189 | if (!dev) | 189 | if (!dev) |
190 | return NULL; | 190 | return NULL; |
191 | 191 | ||
192 | #if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE) | 192 | #if defined(CONFIG_MICROBLAZE) |
193 | dev->archdata.dma_mask = 0xffffffffUL; | 193 | dev->archdata.dma_mask = 0xffffffffUL; |
194 | #endif | 194 | #endif |
195 | dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); | 195 | dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); |