Message ID | 20180221161040.22246-2-noltari@gmail.com |
---|---|
State | Superseded, archived |
Headers | show |
Series | bmips: add bcm6348-enet support | expand |
On 21 February 2018 at 09:10, Álvaro Fernández Rojas <noltari@gmail.com> wrote: > Move dma_ops to a separate header file, following other uclass implementations. > While doing so, this patch also improves dma_ops documentation. > > Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> > --- > v3: Introduce changes reported by Simon Glass: > - Improve dma-uclass.h documentation. > - Switch to live tree API. > > drivers/dma/dma-uclass.c | 3 ++- > include/dma-uclass.h | 39 +++++++++++++++++++++++++++++++++++++++ > include/dma.h | 22 ---------------------- > 3 files changed, 41 insertions(+), 23 deletions(-) > create mode 100644 include/dma-uclass.h Reviewed-by: Simon Glass <sjg@chromium.org>
On 02/22/2018 10:18 AM, Simon Glass wrote: > On 21 February 2018 at 09:10, Álvaro Fernández Rojas <noltari@gmail.com> wrote: >> Move dma_ops to a separate header file, following other uclass implementations. >> While doing so, this patch also improves dma_ops documentation. >> >> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> >> --- >> v3: Introduce changes reported by Simon Glass: >> - Improve dma-uclass.h documentation. >> - Switch to live tree API. >> >> drivers/dma/dma-uclass.c | 3 ++- >> include/dma-uclass.h | 39 +++++++++++++++++++++++++++++++++++++++ >> include/dma.h | 22 ---------------------- >> 3 files changed, 41 insertions(+), 23 deletions(-) >> create mode 100644 include/dma-uclass.h > > Reviewed-by: Simon Glass <sjg@chromium.org> this patch will break build of existing DMA drivers, as the do not have #include <dma-uclass.h>. drivers/dma/ti-edma3.c:563:21: error: variable 'ti_edma3_ops' has initializer but incomplete type static const struct dma_ops ti_edma3_ops = { ^~~~~~~ drivers/dma/ti-edma3.c:564:2: error: unknown field 'transfer' specified in initializer .transfer = ti_edma3_transfer, ^ drivers/dma/ti-edma3.c:564:14: warning: excess elements in struct initializer .transfer = ti_edma3_transfer, ^~~~~~~~~~~~~~~~~ drivers/dma/ti-edma3.c:564:14: note: (near initialization for 'ti_edma3_ops') drivers/dma/ti-edma3.c:563:29: error: storage size of 'ti_edma3_ops' isn't known static const struct dma_ops ti_edma3_ops = { ^~~~~~~~~~~~ make[1]: *** [drivers/dma/ti-edma3.o] Error 1
Hi Grygorii, Thanks for reporting that, it should be fixed on v5. Regards, Álvaro. El 05/03/2018 a las 20:35, Grygorii Strashko escribió: > > On 02/22/2018 10:18 AM, Simon Glass wrote: >> On 21 February 2018 at 09:10, Álvaro Fernández Rojas <noltari@gmail.com> wrote: >>> Move dma_ops to a separate header file, following other uclass implementations. >>> While doing so, this patch also improves dma_ops documentation. >>> >>> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> >>> --- >>> v3: Introduce changes reported by Simon Glass: >>> - Improve dma-uclass.h documentation. >>> - Switch to live tree API. >>> >>> drivers/dma/dma-uclass.c | 3 ++- >>> include/dma-uclass.h | 39 +++++++++++++++++++++++++++++++++++++++ >>> include/dma.h | 22 ---------------------- >>> 3 files changed, 41 insertions(+), 23 deletions(-) >>> create mode 100644 include/dma-uclass.h >> Reviewed-by: Simon Glass <sjg@chromium.org> > this patch will break build of existing DMA drivers, as > the do not have #include <dma-uclass.h>. > > drivers/dma/ti-edma3.c:563:21: error: variable 'ti_edma3_ops' has initializer but incomplete type > static const struct dma_ops ti_edma3_ops = { > ^~~~~~~ > drivers/dma/ti-edma3.c:564:2: error: unknown field 'transfer' specified in initializer > .transfer = ti_edma3_transfer, > ^ > drivers/dma/ti-edma3.c:564:14: warning: excess elements in struct initializer > .transfer = ti_edma3_transfer, > ^~~~~~~~~~~~~~~~~ > drivers/dma/ti-edma3.c:564:14: note: (near initialization for 'ti_edma3_ops') > drivers/dma/ti-edma3.c:563:29: error: storage size of 'ti_edma3_ops' isn't known > static const struct dma_ops ti_edma3_ops = { > ^~~~~~~~~~~~ > make[1]: *** [drivers/dma/ti-edma3.o] Error 1 > >
diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c index 3d0ce22fbc..6fd4e1b35d 100644 --- a/drivers/dma/dma-uclass.c +++ b/drivers/dma/dma-uclass.c @@ -10,10 +10,11 @@ */ #include <common.h> -#include <dma.h> #include <dm.h> #include <dm/uclass-internal.h> #include <dm/device-internal.h> +#include <dma.h> +#include <dma-uclass.h> #include <errno.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/include/dma-uclass.h b/include/dma-uclass.h new file mode 100644 index 0000000000..abf750a5ce --- /dev/null +++ b/include/dma-uclass.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2018 Álvaro Fernández Rojas <noltari@gmail.com> + * Copyright (C) 2015 Texas Instruments Incorporated <www.ti.com> + * Written by Mugunthan V N <mugunthanvnm@ti.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _DMA_UCLASS_H +#define _DMA_UCLASS_H + +/* See dma.h for background documentation. */ + +#include <dma.h> + +/* + * struct dma_ops - Driver model DMA operations + * + * The uclass interface is implemented by all DMA devices which use + * driver model. + */ +struct dma_ops { + /** + * transfer() - Issue a DMA transfer. The implementation must + * wait until the transfer is done. + * + * @dev: The DMA device + * @direction: direction of data transfer (should be one from + * enum dma_direction) + * @dst: The destination pointer. + * @src: The source pointer. + * @len: Length of the data to be copied (number of bytes). + * @return zero on success, or -ve error code. + */ + int (*transfer)(struct udevice *dev, int direction, void *dst, + void *src, size_t len); +}; + +#endif /* _DMA_UCLASS_H */ diff --git a/include/dma.h b/include/dma.h index 71fa77f2ea..89320f10d9 100644 --- a/include/dma.h +++ b/include/dma.h @@ -28,28 +28,6 @@ enum dma_direction { #define DMA_SUPPORTS_DEV_TO_DEV BIT(3) /* - * struct dma_ops - Driver model DMA operations - * - * The uclass interface is implemented by all DMA devices which use - * driver model. - */ -struct dma_ops { - /* - * Get the current timer count - * - * @dev: The DMA device - * @direction: direction of data transfer should be one from - enum dma_direction - * @dst: Destination pointer - * @src: Source pointer - * @len: Length of the data to be copied. - * @return: 0 if OK, -ve on error - */ - int (*transfer)(struct udevice *dev, int direction, void *dst, - void *src, size_t len); -}; - -/* * struct dma_dev_priv - information about a device used by the uclass * * @supported: mode of transfers that DMA can support, should be
Move dma_ops to a separate header file, following other uclass implementations. While doing so, this patch also improves dma_ops documentation. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> --- v3: Introduce changes reported by Simon Glass: - Improve dma-uclass.h documentation. - Switch to live tree API. drivers/dma/dma-uclass.c | 3 ++- include/dma-uclass.h | 39 +++++++++++++++++++++++++++++++++++++++ include/dma.h | 22 ---------------------- 3 files changed, 41 insertions(+), 23 deletions(-) create mode 100644 include/dma-uclass.h