> -     if (unlikely(dev == NULL || dev->archdata.dma_ops == NULL))
> +
> +     if (unlikely(dev == NULL) || dev->archdata.dma_ops == NULL) {
> +#ifdef CONFIG_PPC64
>               return NULL;
> +#else
> +             /* Use default on 32-bit if dma_ops is not set up */
> +             return &dma_direct_ops;
> +#endif
> +     }
> +

This is okay for the transition, but I think long-term it should
be setup for all busses.

>  }
>  
> @@ -132,7 +154,14 @@ static inline dma_addr_t dma_map_single_attrs(struct 
> device *dev,
>       struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
>  
>       BUG_ON(!dma_ops);
> -     return dma_ops->map_single(dev, cpu_addr, size, direction, attrs);
> +
> +     if (dma_ops->map_single)
> +             return dma_ops->map_single(dev, cpu_addr, size, direction,
> +                                        attrs);
> +
> +     return dma_ops->map_page(dev, virt_to_page(cpu_addr),
> +                              (unsigned long)cpu_addr % PAGE_SIZE, size,
> +                              direction, attrs);

Why would a dma ops implementation not provide map_single/unmap_single?

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to