forked from luck/tmp_suning_uos_patched
drivers: remove force dma flag from buses
With each bus implementing its own DMA configuration callback, there is no need for bus to explicitly set the force_dma flag. Modify the of_dma_configure function to accept an input parameter which specifies if implicit DMA configuration is required when it is not described by the firmware. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> # PCI parts Reviewed-by: Rob Herring <robh@kernel.org> [hch: tweaked the changelog a bit] Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
07397df29e
commit
3d6ce86ee7
|
@ -204,7 +204,6 @@ struct bus_type amba_bustype = {
|
|||
.uevent = amba_uevent,
|
||||
.dma_configure = platform_dma_configure,
|
||||
.pm = &amba_pm,
|
||||
.force_dma = true,
|
||||
};
|
||||
|
||||
static int __init amba_init(void)
|
||||
|
|
|
@ -1136,7 +1136,7 @@ int platform_dma_configure(struct device *dev)
|
|||
int ret = 0;
|
||||
|
||||
if (dev->of_node) {
|
||||
ret = of_dma_configure(dev, dev->of_node);
|
||||
ret = of_dma_configure(dev, dev->of_node, true);
|
||||
} else if (has_acpi_companion(dev)) {
|
||||
attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode));
|
||||
if (attr != DEV_DMA_NOT_SUPPORTED)
|
||||
|
@ -1159,7 +1159,6 @@ struct bus_type platform_bus_type = {
|
|||
.uevent = platform_uevent,
|
||||
.dma_configure = platform_dma_configure,
|
||||
.pm = &platform_dev_pm_ops,
|
||||
.force_dma = true,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(platform_bus_type);
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ static void bcma_of_fill_device(struct device *parent,
|
|||
|
||||
core->irq = bcma_of_get_irq(parent, core, 0);
|
||||
|
||||
of_dma_configure(&core->dev, node);
|
||||
of_dma_configure(&core->dev, node, false);
|
||||
}
|
||||
|
||||
unsigned int bcma_core_irq(struct bcma_device *core, int num)
|
||||
|
|
|
@ -398,7 +398,7 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
|
|||
}
|
||||
of_node_get(child);
|
||||
new_pdev->dev.of_node = child;
|
||||
of_dma_configure(&new_pdev->dev, child);
|
||||
of_dma_configure(&new_pdev->dev, child, true);
|
||||
/*
|
||||
* It is assumed that calling of_msi_configure is safe on
|
||||
* platforms with or without MSI support.
|
||||
|
|
|
@ -316,7 +316,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)
|
|||
|
||||
static int host1x_dma_configure(struct device *dev)
|
||||
{
|
||||
return of_dma_configure(dev, dev->of_node);
|
||||
return of_dma_configure(dev, dev->of_node, true);
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops host1x_device_pm_ops = {
|
||||
|
@ -333,7 +333,6 @@ struct bus_type host1x_bus_type = {
|
|||
.match = host1x_device_match,
|
||||
.dma_configure = host1x_dma_configure,
|
||||
.pm = &host1x_device_pm_ops,
|
||||
.force_dma = true,
|
||||
};
|
||||
|
||||
static void __host1x_device_del(struct host1x_device *device)
|
||||
|
@ -422,7 +421,7 @@ static int host1x_device_add(struct host1x *host1x,
|
|||
device->dev.bus = &host1x_bus_type;
|
||||
device->dev.parent = host1x->dev;
|
||||
|
||||
of_dma_configure(&device->dev, host1x->dev->of_node);
|
||||
of_dma_configure(&device->dev, host1x->dev->of_node, true);
|
||||
|
||||
err = host1x_device_parse_dt(device, driver);
|
||||
if (err < 0) {
|
||||
|
|
|
@ -76,6 +76,8 @@ int of_device_add(struct platform_device *ofdev)
|
|||
* of_dma_configure - Setup DMA configuration
|
||||
* @dev: Device to apply DMA configuration
|
||||
* @np: Pointer to OF node having DMA configuration
|
||||
* @force_dma: Whether device is to be set up by of_dma_configure() even if
|
||||
* DMA capability is not explicitly described by firmware.
|
||||
*
|
||||
* Try to get devices's DMA configuration from DT and update it
|
||||
* accordingly.
|
||||
|
@ -84,7 +86,7 @@ int of_device_add(struct platform_device *ofdev)
|
|||
* can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events
|
||||
* to fix up DMA configuration.
|
||||
*/
|
||||
int of_dma_configure(struct device *dev, struct device_node *np)
|
||||
int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma)
|
||||
{
|
||||
u64 dma_addr, paddr, size = 0;
|
||||
int ret;
|
||||
|
@ -100,7 +102,7 @@ int of_dma_configure(struct device *dev, struct device_node *np)
|
|||
* DMA configuration regardless of whether "dma-ranges" is
|
||||
* correctly specified or not.
|
||||
*/
|
||||
if (!dev->bus->force_dma)
|
||||
if (!force_dma)
|
||||
return ret == -ENODEV ? 0 : ret;
|
||||
|
||||
dma_addr = offset = 0;
|
||||
|
|
|
@ -353,7 +353,7 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
|
|||
/* ensure that dma_ops is set for virtual devices
|
||||
* using reserved memory
|
||||
*/
|
||||
of_dma_configure(dev, np);
|
||||
of_dma_configure(dev, np, true);
|
||||
|
||||
dev_info(dev, "assigned reserved memory node %s\n", rmem->name);
|
||||
} else {
|
||||
|
|
|
@ -1595,7 +1595,7 @@ static int pci_dma_configure(struct device *dev)
|
|||
|
||||
if (IS_ENABLED(CONFIG_OF) && bridge->parent &&
|
||||
bridge->parent->of_node) {
|
||||
ret = of_dma_configure(dev, bridge->parent->of_node);
|
||||
ret = of_dma_configure(dev, bridge->parent->of_node, true);
|
||||
} else if (has_acpi_companion(bridge)) {
|
||||
struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
|
||||
enum dev_dma_attr attr = acpi_get_dma_attr(adev);
|
||||
|
@ -1621,7 +1621,6 @@ struct bus_type pci_bus_type = {
|
|||
.pm = PCI_PM_OPS_PTR,
|
||||
.num_vf = pci_bus_num_vf,
|
||||
.dma_configure = pci_dma_configure,
|
||||
.force_dma = true,
|
||||
};
|
||||
EXPORT_SYMBOL(pci_bus_type);
|
||||
|
||||
|
|
|
@ -98,8 +98,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
|
|||
* @p: The private data of the driver core, only the driver core can
|
||||
* touch this.
|
||||
* @lock_key: Lock class key for use by the lock validator
|
||||
* @force_dma: Assume devices on this bus should be set up by dma_configure()
|
||||
* even if DMA capability is not explicitly described by firmware.
|
||||
*
|
||||
* A bus is a channel between the processor and one or more devices. For the
|
||||
* purposes of the device model, all devices are connected via a bus, even if
|
||||
|
@ -140,8 +138,6 @@ struct bus_type {
|
|||
|
||||
struct subsys_private *p;
|
||||
struct lock_class_key lock_key;
|
||||
|
||||
bool force_dma;
|
||||
};
|
||||
|
||||
extern int __must_check bus_register(struct bus_type *bus);
|
||||
|
|
|
@ -55,7 +55,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
|
|||
return of_node_get(cpu_dev->of_node);
|
||||
}
|
||||
|
||||
int of_dma_configure(struct device *dev, struct device_node *np);
|
||||
int of_dma_configure(struct device *dev,
|
||||
struct device_node *np,
|
||||
bool force_dma);
|
||||
void of_dma_deconfigure(struct device *dev);
|
||||
#else /* CONFIG_OF */
|
||||
|
||||
|
@ -105,7 +107,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline int of_dma_configure(struct device *dev, struct device_node *np)
|
||||
static inline int of_dma_configure(struct device *dev,
|
||||
struct device_node *np,
|
||||
bool force_dma)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user