Skip to content

Commit f458488

Browse files
storulfgregkh
authored andcommitted
amba: Initialize dma_parms for amba devices
It's currently the amba driver's responsibility to initialize the pointer, dma_parms, for its corresponding struct device. The benefit with this approach allows us to avoid the initialization and to not waste memory for the struct device_dma_parameters, as this can be decided on a case by case basis. However, it has turned out that this approach is not very practical. Not only does it lead to open coding, but also to real errors. In principle callers of dma_set_max_seg_size() doesn't check the error code, but just assumes it succeeds. For these reasons, let's do the initialization from the common amba bus at the device registration point. This also follows the way the PCI devices are being managed, see pci_device_add(). Suggested-by: Christoph Hellwig <[email protected]> Cc: Russell King <[email protected]> Cc: <[email protected]> Tested-by: Haibo Chen <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9495b7e commit f458488

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

drivers/amba/bus.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ static void amba_device_initialize(struct amba_device *dev, const char *name)
645645
dev->dev.release = amba_device_release;
646646
dev->dev.bus = &amba_bustype;
647647
dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
648+
dev->dev.dma_parms = &dev->dma_parms;
648649
dev->res.name = dev_name(&dev->dev);
649650
}
650651

include/linux/amba/bus.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct amba_device {
6565
struct device dev;
6666
struct resource res;
6767
struct clk *pclk;
68+
struct device_dma_parameters dma_parms;
6869
unsigned int periphid;
6970
unsigned int cid;
7071
struct amba_cs_uci_id uci;

0 commit comments

Comments
 (0)