linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing
@ 2016-09-21 10:26 Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 1/9] dmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id structs Peter Ujfalusi
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

Hi,

Changes since v1:
- added the compiler warning message to ti-dma-crossbar enum type patch
- moved the Kconfig patches at the end of the seris

The following series will enable unconditional COMPILE_TEST coverage for the
following drivers: omap-dma, edma and ti-dma-crossbar

The series includes fixes noticed when compiling the drivers for x86_64 and
aarch64.

Replaces the patch Vinod sent to enable partial compile testing for omap-dma:
http://www.spinics.net/lists/dmaengine/msg11025.html

Regards,
Peter
---
Peter Ujfalusi (9):
  dmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id
    structs
  dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC)
  dmaengine: edma: Use correct type for of_find_property() third
    parameter
  dmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP
    configs
  dmaengine: ti-dma-crossbar: Correct type for of_find_property() third
    parameter
  dmaengine: ti-dma-crossbar: Use enum for crossbar type
  dmaengine: edma: enable COMPILE_TEST
  dmaengine: omap-dma: enable COMPILE_TEST
  dmaengine: ti-dma-crossbar: enable COMPILE_TEST

 drivers/dma/Kconfig           |  8 ++++----
 drivers/dma/edma.c            | 15 ++++++++++-----
 drivers/dma/ti-dma-crossbar.c | 12 +++++++-----
 include/linux/omap-dma.h      | 19 +++++++++++++++++++
 4 files changed, 40 insertions(+), 14 deletions(-)

--
2.10.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/9] dmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id structs
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC) Peter Ujfalusi
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

The MODULE_DEVICE_TABLE() were missing from the driver for the of_device_id
structures.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/edma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 3d277fa76c1a..c2098a4b4dcf 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -274,11 +274,13 @@ static const struct of_device_id edma_of_ids[] = {
 	},
 	{}
 };
+MODULE_DEVICE_TABLE(of, edma_of_ids);
 
 static const struct of_device_id edma_tptc_of_ids[] = {
 	{ .compatible = "ti,edma3-tptc", },
 	{}
 };
+MODULE_DEVICE_TABLE(of, edma_tptc_of_ids);
 
 static inline unsigned int edma_read(struct edma_cc *ecc, int offset)
 {
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC)
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 1/9] dmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id structs Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:31   ` Arnd Bergmann
  2016-09-21 10:26 ` [PATCH v2 3/9] dmaengine: edma: Use correct type for of_find_property() third parameter Peter Ujfalusi
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

Fixes the following warning when compiling the driver for 64bit
architectures (x86_64 for example):
drivers/dma/edma.c:2185:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   if (match && (u32)match->data == EDMA_BINDING_TPCC)
                ^

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/edma.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index c2098a4b4dcf..4c8818278fcc 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -261,8 +261,11 @@ static const struct edmacc_param dummy_paramset = {
 	.ccnt = 1,
 };
 
-#define EDMA_BINDING_LEGACY	0
-#define EDMA_BINDING_TPCC	1
+enum edma_binding_type {
+	EDMA_BINDING_LEGACY = 0,
+	EDMA_BINDING_TPCC,
+};
+
 static const struct of_device_id edma_of_ids[] = {
 	{
 		.compatible = "ti,edma3",
@@ -2184,7 +2187,8 @@ static int edma_probe(struct platform_device *pdev)
 		const struct of_device_id *match;
 
 		match = of_match_node(edma_of_ids, node);
-		if (match && (u32)match->data == EDMA_BINDING_TPCC)
+		if (match &&
+		    (enum edma_binding_type)match->data == EDMA_BINDING_TPCC)
 			legacy_mode = false;
 
 		info = edma_setup_info_from_dt(dev, legacy_mode);
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/9] dmaengine: edma: Use correct type for of_find_property() third parameter
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 1/9] dmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id structs Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC) Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 4/9] dmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP configs Peter Ujfalusi
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

The correct type is int and not for the third parameter of
of_find_property().
Fixes compilation for 64bit architectures (x86_64, aarch64).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/edma.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 4c8818278fcc..16c0bb92fa4d 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -2024,8 +2024,7 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev,
 {
 	struct edma_soc_info *info;
 	struct property *prop;
-	size_t sz;
-	int ret;
+	int sz, ret;
 
 	info = devm_kzalloc(dev, sizeof(struct edma_soc_info), GFP_KERNEL);
 	if (!info)
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/9] dmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP configs
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
                   ` (2 preceding siblings ...)
  2016-09-21 10:26 ` [PATCH v2 3/9] dmaengine: edma: Use correct type for of_find_property() third parameter Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 5/9] dmaengine: ti-dma-crossbar: Correct type for of_find_property() third parameter Peter Ujfalusi
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

The DMAengine driver for omap-dma use three function calls from the
plat-omap legacy driver. When the DMAengine driver is built when ARCH_OMAP
is not set, the compilation will fail due to missing symbols.
Add empty inline functions to allow the DMAengine driver to be compiled
with COMPILE_TEST.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 include/linux/omap-dma.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 1d99b61adc65..290081620b3e 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -297,6 +297,7 @@ struct omap_system_dma_plat_info {
 #define dma_omap15xx()	__dma_omap15xx(d)
 #define dma_omap16xx()	__dma_omap16xx(d)
 
+#if defined(CONFIG_ARCH_OMAP)
 extern struct omap_system_dma_plat_info *omap_get_plat_info(void);
 
 extern void omap_set_dma_priority(int lch, int dst_port, int priority);
@@ -355,4 +356,22 @@ static inline int omap_lcd_dma_running(void)
 }
 #endif
 
+#else /* CONFIG_ARCH_OMAP */
+
+static inline struct omap_system_dma_plat_info *omap_get_plat_info(void)
+{
+	return NULL;
+}
+
+static inline int omap_request_dma(int dev_id, const char *dev_name,
+			void (*callback)(int lch, u16 ch_status, void *data),
+			void *data, int *dma_ch)
+{
+	return -ENODEV;
+}
+
+static inline void omap_free_dma(int ch) { }
+
+#endif /* CONFIG_ARCH_OMAP */
+
 #endif /* __LINUX_OMAP_DMA_H */
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/9] dmaengine: ti-dma-crossbar: Correct type for of_find_property() third parameter
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
                   ` (3 preceding siblings ...)
  2016-09-21 10:26 ` [PATCH v2 4/9] dmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP configs Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 6/9] dmaengine: ti-dma-crossbar: Use enum for crossbar type Peter Ujfalusi
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

The correct type is int and not for the third parameter of
of_find_property().
Fixes compilation for 64bit architectures (x86_64, aarch64).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/ti-dma-crossbar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index 5ae294b256a7..e4f3bd1ae264 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -311,7 +311,7 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev)
 	struct property *prop;
 	struct resource *res;
 	u32 safe_val;
-	size_t sz;
+	int sz;
 	void __iomem *iomem;
 	int i, ret;
 
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 6/9] dmaengine: ti-dma-crossbar: Use enum for crossbar type
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
                   ` (4 preceding siblings ...)
  2016-09-21 10:26 ` [PATCH v2 5/9] dmaengine: ti-dma-crossbar: Correct type for of_find_property() third parameter Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 7/9] dmaengine: edma: enable COMPILE_TEST Peter Ujfalusi
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

Fixes compiler warnings on 64bit architectures:

drivers/dma/ti-dma-crossbar.c: In function ‘ti_dra7_xbar_probe’:
drivers/dma/ti-dma-crossbar.c:398:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  xbar->dma_offset = (u32)match->data;
                     ^
drivers/dma/ti-dma-crossbar.c: In function ‘ti_dma_xbar_probe’:
drivers/dma/ti-dma-crossbar.c:431:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  switch ((u32)match->data) {
          ^

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/ti-dma-crossbar.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index e4f3bd1ae264..876e4ccaf033 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -16,8 +16,10 @@
 #include <linux/of_device.h>
 #include <linux/of_dma.h>
 
-#define TI_XBAR_DRA7		0
-#define TI_XBAR_AM335X		1
+enum ti_xbar_type {
+	TI_XBAR_DRA7 = 0,
+	TI_XBAR_AM335X,
+};
 
 static const struct of_device_id ti_dma_xbar_match[] = {
 	{
@@ -395,7 +397,7 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev)
 
 	xbar->dmarouter.dev = &pdev->dev;
 	xbar->dmarouter.route_free = ti_dra7_xbar_free;
-	xbar->dma_offset = (u32)match->data;
+	xbar->dma_offset = (enum ti_xbar_type)match->data;
 
 	mutex_init(&xbar->mutex);
 	platform_set_drvdata(pdev, xbar);
@@ -428,7 +430,7 @@ static int ti_dma_xbar_probe(struct platform_device *pdev)
 	if (unlikely(!match))
 		return -EINVAL;
 
-	switch ((u32)match->data) {
+	switch ((enum ti_xbar_type)match->data) {
 	case TI_XBAR_DRA7:
 		ret = ti_dra7_xbar_probe(pdev);
 		break;
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 7/9] dmaengine: edma: enable COMPILE_TEST
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
                   ` (5 preceding siblings ...)
  2016-09-21 10:26 ` [PATCH v2 6/9] dmaengine: ti-dma-crossbar: Use enum for crossbar type Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 8/9] dmaengine: omap-dma: " Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 9/9] dmaengine: ti-dma-crossbar: " Peter Ujfalusi
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index fe2dbb811e19..4348249b943a 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -515,7 +515,7 @@ config TI_DMA_CROSSBAR
 
 config TI_EDMA
 	bool "TI EDMA support"
-	depends on ARCH_DAVINCI || ARCH_OMAP || ARCH_KEYSTONE
+	depends on ARCH_DAVINCI || ARCH_OMAP || ARCH_KEYSTONE || COMPILE_TEST
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	select TI_DMA_CROSSBAR if ARCH_OMAP
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 8/9] dmaengine: omap-dma: enable COMPILE_TEST
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
                   ` (6 preceding siblings ...)
  2016-09-21 10:26 ` [PATCH v2 7/9] dmaengine: edma: enable COMPILE_TEST Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  2016-09-21 10:26 ` [PATCH v2 9/9] dmaengine: ti-dma-crossbar: " Peter Ujfalusi
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 4348249b943a..84647d6cb2f4 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -130,7 +130,7 @@ config DMA_JZ4780
 
 config DMA_OMAP
 	tristate "OMAP DMA support"
-	depends on ARCH_OMAP
+	depends on ARCH_OMAP || COMPILE_TEST
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	select TI_DMA_CROSSBAR if SOC_DRA7XX
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 9/9] dmaengine: ti-dma-crossbar: enable COMPILE_TEST
  2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
                   ` (7 preceding siblings ...)
  2016-09-21 10:26 ` [PATCH v2 8/9] dmaengine: omap-dma: " Peter Ujfalusi
@ 2016-09-21 10:26 ` Peter Ujfalusi
  8 siblings, 0 replies; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 10:26 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams
  Cc: arnd, dmaengine, linux-kernel, linux-omap, linux-arm-kernel, tony

To get more coverage, enable COMPILE_TEST for this driver.
When compile testing eDMA or omap-dma, select also the ti-dma-crossbar so
it is also covered by the compile testing.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/dma/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 84647d6cb2f4..1c11628062ad 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -133,7 +133,7 @@ config DMA_OMAP
 	depends on ARCH_OMAP || COMPILE_TEST
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
-	select TI_DMA_CROSSBAR if SOC_DRA7XX
+	select TI_DMA_CROSSBAR if (SOC_DRA7XX || COMPILE_TEST)
 
 config DMA_SA11X0
 	tristate "SA-11x0 DMA support"
@@ -518,7 +518,7 @@ config TI_EDMA
 	depends on ARCH_DAVINCI || ARCH_OMAP || ARCH_KEYSTONE || COMPILE_TEST
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
-	select TI_DMA_CROSSBAR if ARCH_OMAP
+	select TI_DMA_CROSSBAR if (ARCH_OMAP || COMPILE_TEST)
 	default n
 	help
 	  Enable support for the TI EDMA controller. This DMA
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC)
  2016-09-21 10:26 ` [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC) Peter Ujfalusi
@ 2016-09-21 10:31   ` Arnd Bergmann
  2016-09-21 11:07     ` Peter Ujfalusi
  0 siblings, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2016-09-21 10:31 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: vinod.koul, dan.j.williams, dmaengine, linux-kernel, linux-omap,
	linux-arm-kernel, tony

On Wednesday, September 21, 2016 1:26:30 PM CEST Peter Ujfalusi wrote:
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index c2098a4b4dcf..4c8818278fcc 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -261,8 +261,11 @@ static const struct edmacc_param dummy_paramset = {
>         .ccnt = 1,
>  };
>  
> -#define EDMA_BINDING_LEGACY    0
> -#define EDMA_BINDING_TPCC      1
> +enum edma_binding_type {
> +       EDMA_BINDING_LEGACY = 0,
> +       EDMA_BINDING_TPCC,
> +};
> +
>  static const struct of_device_id edma_of_ids[] = {
>         {
>                 .compatible = "ti,edma3",
> @@ -2184,7 +2187,8 @@ static int edma_probe(struct platform_device *pdev)
>                 const struct of_device_id *match;
>  
>                 match = of_match_node(edma_of_ids, node);
> -               if (match && (u32)match->data == EDMA_BINDING_TPCC)
> +               if (match &&
> +                   (enum edma_binding_type)match->data == EDMA_BINDING_TPCC)
>                         legacy_mode = false;
>  
>                 info = edma_setup_info_from_dt(dev, legacy_mode);
> -- 
> 2.10.0
> 

Are you sure this works on all architectures? IIRC the size of an enum
is implementation defined, so this could still fail sometimes.

I tend to use 'uintptr_t' for the cast instead.

	Arnd

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC)
  2016-09-21 10:31   ` Arnd Bergmann
@ 2016-09-21 11:07     ` Peter Ujfalusi
  2016-09-21 11:38       ` Arnd Bergmann
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Ujfalusi @ 2016-09-21 11:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: vinod.koul, dan.j.williams, dmaengine, linux-kernel, linux-omap,
	linux-arm-kernel, tony

On 09/21/16 13:31, Arnd Bergmann wrote:
> On Wednesday, September 21, 2016 1:26:30 PM CEST Peter Ujfalusi wrote:
>> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
>> index c2098a4b4dcf..4c8818278fcc 100644
>> --- a/drivers/dma/edma.c
>> +++ b/drivers/dma/edma.c
>> @@ -261,8 +261,11 @@ static const struct edmacc_param dummy_paramset = {
>>         .ccnt = 1,
>>  };
>>  
>> -#define EDMA_BINDING_LEGACY    0
>> -#define EDMA_BINDING_TPCC      1
>> +enum edma_binding_type {
>> +       EDMA_BINDING_LEGACY = 0,
>> +       EDMA_BINDING_TPCC,
>> +};



>> +
>>  static const struct of_device_id edma_of_ids[] = {
>>         {
>>                 .compatible = "ti,edma3",
>> @@ -2184,7 +2187,8 @@ static int edma_probe(struct platform_device *pdev)
>>                 const struct of_device_id *match;
>>  
>>                 match = of_match_node(edma_of_ids, node);
>> -               if (match && (u32)match->data == EDMA_BINDING_TPCC)
>> +               if (match &&
>> +                   (enum edma_binding_type)match->data == EDMA_BINDING_TPCC)
>>                         legacy_mode = false;
>>  
>>                 info = edma_setup_info_from_dt(dev, legacy_mode);
>> -- 
>> 2.10.0
>>
> 
> Are you sure this works on all architectures? IIRC the size of an enum
> is implementation defined, so this could still fail sometimes.

True, some arch have HW type for enum or something similar.

> 
> I tend to use 'uintptr_t' for the cast instead.

What about keeping the defines and:

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 3e9606b08340..493fdf30e8b8 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -263,14 +263,19 @@ static const struct edmacc_param dummy_paramset = {

 #define EDMA_BINDING_LEGACY	0
 #define EDMA_BINDING_TPCC	1
+static const u32 edma_binding_type[] = {
+	[EDMA_BINDING_LEGACY] = EDMA_BINDING_LEGACY,
+	[EDMA_BINDING_TPCC] = EDMA_BINDING_TPCC,
+};
+
 static const struct of_device_id edma_of_ids[] = {
 	{
 		.compatible = "ti,edma3",
-		.data = (void *)EDMA_BINDING_LEGACY,
+		.data = (void *)&edma_binding_type[EDMA_BINDING_LEGACY],
 	},
 	{
 		.compatible = "ti,edma3-tpcc",
-		.data = (void *)EDMA_BINDING_TPCC,
+		.data = (void *)&edma_binding_type[EDMA_BINDING_TPCC],
 	},
 	{}
 };
@@ -2183,7 +2188,7 @@ static int edma_probe(struct platform_device *pdev)
 		const struct of_device_id *match;

 		match = of_match_node(edma_of_ids, node);
-		if (match && (u32)match->data == EDMA_BINDING_TPCC)
+		if (match && (*(u32*)match->data) == EDMA_BINDING_TPCC)
 			legacy_mode = false;

 		info = edma_setup_info_from_dt(dev, legacy_mode);


same for the ti-dma-crossbar.

-- 
Péter

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC)
  2016-09-21 11:07     ` Peter Ujfalusi
@ 2016-09-21 11:38       ` Arnd Bergmann
  0 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2016-09-21 11:38 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: vinod.koul, dan.j.williams, dmaengine, linux-kernel, linux-omap,
	linux-arm-kernel, tony

On Wednesday, September 21, 2016 2:07:22 PM CEST Peter Ujfalusi wrote:
> > 
> > I tend to use 'uintptr_t' for the cast instead.
> 
> What about keeping the defines and:
> 
> diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
> index 3e9606b08340..493fdf30e8b8 100644
> --- a/drivers/dma/edma.c
> +++ b/drivers/dma/edma.c
> @@ -263,14 +263,19 @@ static const struct edmacc_param dummy_paramset = {
> 
>  #define EDMA_BINDING_LEGACY    0
>  #define EDMA_BINDING_TPCC      1
> +static const u32 edma_binding_type[] = {
> +       [EDMA_BINDING_LEGACY] = EDMA_BINDING_LEGACY,
> +       [EDMA_BINDING_TPCC] = EDMA_BINDING_TPCC,
> +};
> +
>  static const struct of_device_id edma_of_ids[] = {
>         {
>                 .compatible = "ti,edma3",
> -               .data = (void *)EDMA_BINDING_LEGACY,
> +               .data = (void *)&edma_binding_type[EDMA_BINDING_LEGACY],
>         },
>         {
>                 .compatible = "ti,edma3-tpcc",
> -               .data = (void *)EDMA_BINDING_TPCC,
> +               .data = (void *)&edma_binding_type[EDMA_BINDING_TPCC],
>         },
>         {}

You can drop the cast to (void *) here, otherwise looks good.

	Arnd

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-09-21 11:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 10:26 [PATCH v2 0/9] dmaengine: ti drivers: enable COMPILE_TESTing Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 1/9] dmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id structs Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 2/9] dmaengine: edma: Use enum for eDMA binding type (legacy vs TPCC) Peter Ujfalusi
2016-09-21 10:31   ` Arnd Bergmann
2016-09-21 11:07     ` Peter Ujfalusi
2016-09-21 11:38       ` Arnd Bergmann
2016-09-21 10:26 ` [PATCH v2 3/9] dmaengine: edma: Use correct type for of_find_property() third parameter Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 4/9] dmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP configs Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 5/9] dmaengine: ti-dma-crossbar: Correct type for of_find_property() third parameter Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 6/9] dmaengine: ti-dma-crossbar: Use enum for crossbar type Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 7/9] dmaengine: edma: enable COMPILE_TEST Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 8/9] dmaengine: omap-dma: " Peter Ujfalusi
2016-09-21 10:26 ` [PATCH v2 9/9] dmaengine: ti-dma-crossbar: " Peter Ujfalusi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).