ARM: SAMSUNG: dma: Remove unnecessary code
Subsystems (3)
PATCH 1/1 ARM: SAMSUNG: dma: Remove unnecessary code
This patch removes the usage of DMACH_DT_PROP and dt_dmach_prop from dma code as the new generic dma dt binding support has been added.
---
The functionality of this patch is dependent on following patches in the link.
http://www.mail-archive.com/[email protected]/msg15402.html
This patch is made based on Mark Brown next branch.
arch/arm/mach-s3c24xx/include/mach/dma.h | 1 - arch/arm/mach-s3c64xx/include/mach/dma.h | 1 - arch/arm/plat-samsung/dma-ops.c | 10 +--------- arch/arm/plat-samsung/include/plat/dma-ops.h | 1 - arch/arm/plat-samsung/include/plat/dma-pl330.h | 1 - 5 files changed, 1 insertions(+), 13 deletions(-)
arch/arm/mach-s3c24xx/include/mach/dma.h +0 -1
@@ -24,7 +24,6 @@*/ enum dma_ch { -DMACH_DT_PROP =-1 ,/* not yet supported, do not use */ DMACH_XD0 =0 ,DMACH_XD1 ,DMACH_SDI ,
arch/arm/mach-s3c64xx/include/mach/dma.h +0 -1
@@ -21,7 +21,6 @@*/ enum dma_ch {/* DMA0/SDMA0 */ -DMACH_DT_PROP =-1 ,/* not yet supported, do not use */ DMACH_UART0 =0 ,DMACH_UART0_SRC2 ,DMACH_UART1 ,
arch/arm/plat-samsung/dma-ops.c +1 -9
@@ -23,23 +23,15 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch, struct device *dev, char *ch_name) { dma_cap_mask_t mask; -void *filter_param;dma_cap_zero (mask);dma_cap_set (param->cap, mask); -/* -* If a dma channel property of a device node from device tree is -* specified, use that as the fliter parameter. -*/ - filter_param = (dma_ch ==DMACH_DT_PROP ) ? - (void *)param->dt_dmach_prop : (void *)dma_ch; -if (dev->of_node)return (unsigned )dma_request_slave_channel (dev, ch_name);else return (unsigned )dma_request_channel (mask, pl330_filter, - filter_param); + (void *)dma_ch); }static int samsung_dmadev_release (unsigned ch,void *param)
arch/arm/plat-samsung/include/plat/dma-ops.h +0 -1
@@ -18,7 +18,6 @@struct samsung_dma_req {enum dma_transaction_type cap; -struct property *dt_dmach_prop;struct s3c2410_dma_client *client; };
arch/arm/plat-samsung/include/plat/dma-pl330.h +0 -1
@@ -21,7 +21,6 @@* use these just as IDs. */ enum dma_ch { -DMACH_DT_PROP =-1 ,DMACH_UART0_RX =0 ,DMACH_UART0_TX ,DMACH_UART1_RX ,
Signature · 1 line
1.7.4.4
PATCH 1/1 ARM: SAMSUNG: dma: Remove unnecessary code
Quoted 17 lines · Padmavathi Venna
arch/arm/plat-samsung/dma-ops.c +0
-5@@ -23,23 +23,15 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch, struct device *dev, char *ch_name) { dma_cap_mask_t mask; -void *filter_param;dma_cap_zero (mask);dma_cap_set (param->cap, mask); -/* -* If a dma channel property of a device node from device tree is -* specified, use that as the fliter parameter. -*/
arch/arm/plat-samsung/dma-ops.c static unsigned samsung_dmadev_request(enum dma_ch dma_ch, · line 35
Quoted 10 lines
arch/arm/plat-samsung/dma-ops.c +1
-4- filter_param = (dma_ch ==DMACH_DT_PROP ) ? - (void *)param->dt_dmach_prop : (void *)dma_ch; -if (dev->of_node)return (unsigned )dma_request_slave_channel (dev, ch_name);else return (unsigned )dma_request_channel (mask, pl330_filter, - filter_param); + (void *)dma_ch); }
This still looks wrong to me, because the pl330_filter function now tkes a struct dma_pl330_filter_args pointer argument, not dma_ch name.
Arnd
PATCH 1/1 ARM: SAMSUNG: dma: Remove unnecessary code
Hi Arnd,
Quoted 23 lines · Arnd Bergmann
Quoted 22 lines · Padmavathi Venna
arch/arm/plat-samsung/dma-ops.c +0
-8@@ -23,23 +23,15 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch, struct device *dev, char *ch_name) { dma_cap_mask_t mask; -void *filter_param;dma_cap_zero (mask);dma_cap_set (param->cap, mask); -/* -* If a dma channel property of a device node from device tree is -* specified, use that as the fliter parameter. -*/ - filter_param = (dma_ch ==DMACH_DT_PROP ) ? - (void *)param->dt_dmach_prop : (void *)dma_ch; -if (dev->of_node)return (unsigned )dma_request_slave_channel (dev, ch_name);
Quoted 8 lines
arch/arm/plat-samsung/dma-ops.c static unsigned samsung_dmadev_request(enum dma_ch dma_ch, · line 35
Quoted 5 lines
arch/arm/plat-samsung/dma-ops.c +1
-1else return (unsigned )dma_request_channel (mask, pl330_filter, - filter_param); + (void *)dma_ch); }This still looks wrong to me, because the
pl330_filterfunction now tkes a structdma_pl330_filter_argspointer argument, notdma_chname.
Below is my understanding about generic dma and our discussion on previous versions of my patches.
I can?t pass single dma channel number(may be not dma_ch name in your comment above) as void* argument to pl330_filter. Because I also need to compare against the dma controller device node, as my requested channel can belong to any of the available dma controller on SoC. So I either need to pass pointer to dma_spec as void* argument which holds the dma controller node and required channel number or I can pass pointer to dma_pl330_filter_args as per your dw_dmac patches.
If I pass pointer to dma_spec I can have a check like below in my filter function
return ((chan->private == dma_spec->np) && (chan->chan_id == dma_spec->args[0]))
Or if I pass dma_pl330_filter_args I can have a check like below. return ((chan->device == &fargs->pdmac->ddma) && (chan->chan_id == fargs->chan_id));
I modified the pl330_filter function based on your dw_dmac patches. Indeed I don?t need to pass pointer to pdmac object as 3rd arg in of_dma_controller_register . Even I pass NULL here works for me. Can I pass NULL here as the third argument in of_dma_controller_register? Please clarify me which is best way of doing this and correct me if my understanding is wrong.
Quoted 2 lines
Arnd
Thanks
Padma
PATCH 1/1 ARM: SAMSUNG: dma: Remove unnecessary code
Quoted 36 lines · Padma Venkat
Quoted 23 lines · Arnd Bergmann
Quoted 22 lines · Padmavathi Venna
arch/arm/plat-samsung/dma-ops.c +0
-8@@ -23,23 +23,15 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch, struct device *dev, char *ch_name) { dma_cap_mask_t mask; -void *filter_param;dma_cap_zero (mask);dma_cap_set (param->cap, mask); -/* -* If a dma channel property of a device node from device tree is -* specified, use that as the fliter parameter. -*/ - filter_param = (dma_ch ==DMACH_DT_PROP ) ? - (void *)param->dt_dmach_prop : (void *)dma_ch; -if (dev->of_node)return (unsigned )dma_request_slave_channel (dev, ch_name);Quoted 8 lines
arch/arm/plat-samsung/dma-ops.c static unsigned samsung_dmadev_request(enum dma_ch dma_ch, · line 35
Quoted 5 lines
arch/arm/plat-samsung/dma-ops.c +1
-1else return (unsigned )dma_request_channel (mask, pl330_filter, - filter_param); + (void *)dma_ch); }This still looks wrong to me, because the
pl330_filterfunction now tkes a structdma_pl330_filter_argspointer argument, notdma_chname.Below is my understanding about generic dma and our discussion on previous versions of my patches.
Quoted 7 lines
I can?t pass single dma channel
number(may be not dma_ch name in your comment above)as void* argument topl330_filter. Because I also need to compare against the dma controller device node, as my requested channel can belong to any of the available dma controller on SoC. So I either need to pass pointer todma_specas void* argument which holds the dma controller node and required channel number or I can pass pointer todma_pl330_filter_argsas per yourdw_dmacpatches.
Right.
Quoted 4 lines
If I pass pointer to
dma_specI can have a check like below in my filter function
return ((chan->private==dma_spec->np) && (chan->chan_id== dma_spec->args[0]))
Quoted 8 lines
Or if I pass
dma_pl330_filter_argsI can have a check like below. return ((chan->device==&fargs->pdmac->ddma) && (chan->chan_id==fargs->chan_id));I modified the
pl330_filterfunction based on yourdw_dmacpatches. Indeed I don?t need to pass pointer to pdmac object as 3rd arg inof_dma_controller_register. Even I pass NULL here works for me. Can I pass NULL here as the third argument inof_dma_controller_register?
These are all not the issues I am referring to in my comment above. I think it works either way, even if you pass NULL to of_dma_controller_register, although using it for the pdmac object seems cleaner to me.
Quoted 2 lines
Please clarify me which is best way of doing this and correct me if my understanding is wrong.
My point was that in the samsung_dmadev_request quoted above, you refer to the same pl330_filter filter function, but the argument there is a pointer to 'enum dma_ch', which is not compatible with any of the methods you list, neither the dma_pl330_filter_args nor the raw property.
Also, if you change the calling conventions for the pl330_filter function, you should change both the caller and the function in the same patch.
Arnd
PATCH 1/1 ARM: SAMSUNG: dma: Remove unnecessary code
Hi Arnd,
Quoted 74 lines · Arnd Bergmann
Quoted 36 lines · Padma Venkat
Quoted 23 lines · Arnd Bergmann
Quoted 22 lines · Padmavathi Venna
arch/arm/plat-samsung/dma-ops.c +0
-8@@ -23,23 +23,15 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch, struct device *dev, char *ch_name) { dma_cap_mask_t mask; -void *filter_param;dma_cap_zero (mask);dma_cap_set (param->cap, mask); -/* -* If a dma channel property of a device node from device tree is -* specified, use that as the fliter parameter. -*/ - filter_param = (dma_ch ==DMACH_DT_PROP ) ? - (void *)param->dt_dmach_prop : (void *)dma_ch; -if (dev->of_node)return (unsigned )dma_request_slave_channel (dev, ch_name);Quoted 8 lines
arch/arm/plat-samsung/dma-ops.c static unsigned samsung_dmadev_request(enum dma_ch dma_ch, · line 35
Quoted 5 lines
arch/arm/plat-samsung/dma-ops.c +1
-1else return (unsigned )dma_request_channel (mask, pl330_filter, - filter_param); + (void *)dma_ch); }This still looks wrong to me, because the
pl330_filterfunction now tkes a structdma_pl330_filter_argspointer argument, notdma_chname.Below is my understanding about generic dma and our discussion on previous versions of my patches.
Quoted 7 lines
I can?t pass single dma channel
number(may be not dma_ch name in your comment above)as void* argument topl330_filter. Because I also need to compare against the dma controller device node, as my requested channel can belong to any of the available dma controller on SoC. So I either need to pass pointer todma_specas void* argument which holds the dma controller node and required channel number or I can pass pointer todma_pl330_filter_argsas per yourdw_dmacpatches.Right.
Quoted 4 lines
If I pass pointer to
dma_specI can have a check like below in my filter function
return ((chan->private==dma_spec->np) && (chan->chan_id== dma_spec->args[0]))Quoted 8 lines
Or if I pass
dma_pl330_filter_argsI can have a check like below. return ((chan->device==&fargs->pdmac->ddma) && (chan->chan_id==fargs->chan_id));I modified the
pl330_filterfunction based on yourdw_dmacpatches. Indeed I don?t need to pass pointer to pdmac object as 3rd arg inof_dma_controller_register. Even I pass NULL here works for me. Can I pass NULL here as the third argument inof_dma_controller_register?These are all not the issues I am referring to in my comment above. I think it works either way, even if you pass NULL to
of_dma_controller_register, although using it for the pdmac object seems cleaner to me.Quoted 2 lines
Please clarify me which is best way of doing this and correct me if my understanding is wrong.
My point was that in the
samsung_dmadev_requestquoted above, you refer to the samepl330_filterfilter function, but the argument there is a pointer to 'enumdma_ch', which is not compatible with any of the methods you list, neither thedma_pl330_filter_argsnor the raw property.
Quoted 3 lines
Also, if you change the calling conventions for the
pl330_filterfunction, you should change both the caller and the function in the same patch.
In none of my patches I have changed the pl330_filter args. This function always takes the same argument void*. In non-DT case 'enum dma_ch' was typecasted to void* and in DT case I am passing a pointer to dma_pl330_filter_args and in pl330_filter function they are converted back. In both cases it finally comes down to dma_request_channel which takes them as void* which in turn calls the pl330_filter.
I think this is what you are pointing to. Please let me know if I am still wrong :( .
Quoted 6 lines
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks
Padma
PATCH 1/1 ARM: SAMSUNG: dma: Remove unnecessary code
Quoted 10 lines · Padma Venkat
In none of my patches I have changed the
pl330_filterargs. This function always takes the same argument void*. In non-DT case 'enumdma_ch' was typecasted to void* and in DT case I am passing a pointer todma_pl330_filter_argsand inpl330_filterfunction they are converted back. In both cases it finally comes down todma_request_channelwhich takes them as void* which in turn calls thepl330_filter.I think this is what you are pointing to. Please let me know if I am still wrong :( .
I think I see the misunderstanding now. The pl330_filter function you have actually interprets the void* argument differently, based on whether the pl330 device was instantiated from device tree or not. I failed to see this, and you are probably right that this works correctly.
It is however a rather unusual interface, and it would be safer and easier to understand if you used separate filter functions for the two cases, like this:
bool pl330_filter(struct dma_chan *chan, void *param)
{
u8 *peri_id;
if (chan->device->dev->driver != &pl330_driver.drv)
return false;
peri_id = chan->private;
return *peri_id == (unsigned)param;
}EXPORT_SYMBOL(pl330_filter);
static bool pl330_dt_filter(struct dma_chan *chan, void *param)
{
struct dma_pl330_filter_args *fargs = param;
if (chan->device != &fargs->pdmac->ddma)
return false;
return (chan->chan_id == fargs->chan_id);
}So this is not a correctness issue, but more one of readability. I would assume however that if I was misunderstanding the code, the next person also wouldn't know what is going on here if you have one filter function that performs two completely different tasks.
Arnd