Skip to contentSkip to conversation

PPC4xx: Generalizing ADMA driver modifications

PATCH In review [email protected] 2 participants 4 messages Sep 23, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 PPC4xx: Generalizing ADMA driver modifications

From: Tirumala Marri <[email protected]>

This patch generalizes the existing drver/dma/ppc4xx/adma.c, so that common code can be shared between different similar DMA engine drivers in other SoCs. Also Makefile and Kconfig changed to accommodate PPC4XX.

---
V1:
* No change.

---
 arch/powerpc/include/asm/async_tx.h |    4 +-
 drivers/dma/Kconfig                 |    6 +-
 drivers/dma/Makefile                |    2 +-
 drivers/dma/ppc4xx/Makefile         |    2 +-
 drivers/dma/ppc4xx/adma.c           | 4437 +++--------------------------------
 drivers/dma/ppc4xx/adma.h           |   92 +-
 6 files changed, 354 insertions(+), 4189 deletions(-)
arch/powerpc/include/asm/async_tx.h +2 -2
index 8b2dc55..ae340dd 100644
@@ -25,13 +25,13 @@
 
 #if defined(CONFIG_440SPe) || defined(CONFIG_440SP)
 extern struct dma_chan *
-ppc440spe_async_tx_find_best_channel(enum dma_transaction_type cap,
+ppc4xx_async_tx_find_best_channel(enum dma_transaction_type cap,
 	struct page **dst_lst, int dst_cnt, struct page **src_lst,
 	int src_cnt, size_t src_sz);
 
 #define async_tx_find_channel(dep, cap, dst_lst, dst_cnt, src_lst, \
 			      src_cnt, src_sz) \
-	ppc440spe_async_tx_find_best_channel(cap, dst_lst, dst_cnt, src_lst, \
+	ppc4xx_async_tx_find_best_channel(cap, dst_lst, dst_cnt, src_lst, \
 					     src_cnt, src_sz)
 #else
 
drivers/dma/Kconfig +3 -3
index 9520cf0..69df561 100644
@@ -161,13 +161,13 @@ config STE_DMA40
 	help
 	  Support for ST-Ericsson DMA40 controller
 
-config AMCC_PPC440SPE_ADMA
-	tristate "AMCC PPC440SPe ADMA support"
+config AMCC_PPC4XX_ADMA
+	tristate "AMCC PPC4XX ADMA support"
 	depends on 440SPe || 440SP
 	select DMA_ENGINE
 	select ARCH_HAS_ASYNC_TX_FIND_CHANNEL
 	help
-	  Enable support for the AMCC PPC440SPe RAID engines.
+	  Enable support for the AMCC PPC4XX RAID engines.
 
 config TIMB_DMA
 	tristate "Timberdale FPGA DMA support"
drivers/dma/Makefile +1 -1
index 72bd703..295e2f7 100644
@@ -20,7 +20,7 @@ obj-$(CONFIG_MX3_IPU) += ipu/
 obj-$(CONFIG_TXX9_DMAC) += txx9dmac.o
 obj-$(CONFIG_SH_DMAE) += shdma.o
 obj-$(CONFIG_COH901318) += coh901318.o coh901318_lli.o
-obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/
+obj-$(CONFIG_AMCC_PPC4XX_ADMA) += ppc4xx/
 obj-$(CONFIG_TIMB_DMA) += timb_dma.o
 obj-$(CONFIG_STE_DMA40) += ste_dma40.o ste_dma40_ll.o
 obj-$(CONFIG_PL330_DMA) += pl330.o
drivers/dma/ppc4xx/Makefile +1 -1
index b3d259b..463f985 100644
@@ -1 +1 @@
-obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += adma.o
+obj-$(CONFIG_AMCC_PPC4XX_ADMA) += ppc4xx-adma.o adma.o
drivers/dma/ppc4xx/adma.c +320 -4117

2,959 lines not on this page · raw message

drivers/dma/ppc4xx/adma.h +27 -65

92 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.1.rc3

Part of the diff is not shown here. View the raw message.

#1 lore raw
Quoted 11 lines · On 9/23/2010 3:10 PM, [email protected] wrote:

From: Tirumala Marri<[email protected]>

This patch generalizes the existing drver/dma/ppc4xx/adma.c, so that common code can be shared between different similar DMA engine drivers in other SoCs. Also Makefile and Kconfig changed to accommodate PPC4XX.

---
V1:
* No change.

Quoted 8 lines
---
  arch/powerpc/include/asm/async_tx.h |    4 +-
  drivers/dma/Kconfig                 |    6 +-
  drivers/dma/Makefile                |    2 +-
  drivers/dma/ppc4xx/Makefile         |    2 +-
  drivers/dma/ppc4xx/adma.c           | 4437 +++--------------------------------
  drivers/dma/ppc4xx/adma.h           |   92 +-
  6 files changed, 354 insertions(+), 4189 deletions(-)

Did you look at this changelog before sending? It just deletes 4000 lines of code??

Moving and renaming code in one patch makes it very difficult to verify the result. When generalizing code the first thing I want to see with a very quick glance at the patch(es) is that the existing implementation is not harmed. One way to go about this is to first identify the portions of existing code that you want to reuse in your driver and the pieces that are truly ppc440spe specific. Move the ppc440spe pieces to their own file (get this reviewed and approved by the ppc440spe authors). The remaining code in adma.c will be assumed generic. You can then have another patch to do a simple s/ppc440spe/ppc4xx/ in adma.c (no other logic changes or code movement). Then you can introduce your ppc460ex unique implementation that calls into adma.c.

I don't want to see patches along the lines of "rename drivers/dma/ppc4xx/adma.c to drivers/dma/ppc4xx/ppc4xx-adma.c" because that is just redundant. Assume that the existing generic file names are where the common code will lie and then add hw-implementation specific files to call into that base.

Another rule is that the conversion should be bisectable at every step, I should be able to apply each patch in the series and still have a functional/runnable result.

--
Dan

#2 lore raw
Quoted 3 lines

Did you look at this changelog before sending? It just deletes 4000 lines of code??

[Marri] The reason I have to send it in different file is the size of the patch.
There seem to be issue with patch sizes 200k or more.

#3 lore raw
Quoted 6 lines · Tirumala Marri
Quoted 3 lines

Did you look at this changelog before sending? It just deletes 4000 lines of code??

[Marri] The reason I have to send it in different file is the size of the patch.
There seem to be issue with patch sizes 200k or more.

Quoted 11 lines · Read the rest of what I

Moving and renaming code in one patch makes it very difficult to verify the result. When generalizing code the first thing I want to see with a very quick glance at the patch(es) is that the existing implementation is not harmed. One way to go about this is to first identify the portions of existing code that you want to reuse in your driver and the pieces that are truly ppc440spe specific. Move the ppc440spe pieces to their own file (get this reviewed and approved by the ppc440spe authors). The remaining code in adma.c will be assumed generic. You can then have another patch to do a simple s/ppc440spe/ppc4xx/ in adma.c (no other logic changes or code movement). Then you can introduce your ppc460ex unique implementation that calls into adma.c.

The patch would not be so large if you leave the existing code where it is and move the implementation specific pieces to their own file.

--
Dan