Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6 -26
+4 -24
arch/powerpc/kernel/setup-common.c
··· 709 709 pr_info("%s\n", s); 710 710 } 711 711 712 - static int ppc_dflt_bus_notify(struct notifier_block *nb, 713 - unsigned long action, void *data) 712 + void arch_setup_pdev_archdata(struct platform_device *pdev) 714 713 { 715 - struct device *dev = data; 716 - 717 - /* We are only intereted in device addition */ 718 - if (action != BUS_NOTIFY_ADD_DEVICE) 719 - return 0; 720 - 721 - set_dma_ops(dev, &dma_direct_ops); 722 - 723 - return NOTIFY_DONE; 714 + pdev->archdata.dma_mask = DMA_BIT_MASK(32); 715 + pdev->dev.dma_mask = &pdev->archdata.dma_mask; 716 + set_dma_ops(&pdev->dev, &dma_direct_ops); 724 717 } 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 - } 736 - 737 - arch_initcall(setup_bus_notifier);
+2 -2
drivers/of/platform.c
··· 153 153 } 154 154 155 155 dev->dev.of_node = of_node_get(np); 156 - #if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE) 156 + #if defined(CONFIG_MICROBLAZE) 157 157 dev->dev.dma_mask = &dev->archdata.dma_mask; 158 158 #endif 159 159 dev->dev.parent = parent; ··· 189 189 if (!dev) 190 190 return NULL; 191 191 192 - #if defined(CONFIG_PPC) || defined(CONFIG_MICROBLAZE) 192 + #if defined(CONFIG_MICROBLAZE) 193 193 dev->archdata.dma_mask = 0xffffffffUL; 194 194 #endif 195 195 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);