dma: mmp_pdma: add support for residue reporting
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
A channel can accommodate more than one transaction, each consisting of multiple descriptors, the last of which has the DCMD_ENDIRQEN bit set.
In order to report the channel's residue, we hence have to walk the list of running descriptors, look for those which match the cookie, and then try to find the descriptor which defines upper and lower boundaries that embrace the current transport pointer. Once it is found, walk forward until we find the descriptor that tells us about the end of a transaction via a set DCMD_ENDIRQEN bit.
---
Hi Vinod, everyone,
I'd like to get the disussion regarding this patch started again which left off here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/217429.html
I think the biggest issue in the previous discussion was a confusion about the term 'descriptor', as it refers to both the internal pdma implementation detail as well as the handle used in the dma subsystem.
I hope I explained that well enough in the link above.
Many thanks,
Daniel
drivers/dma/mmp_pdma.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-)
drivers/dma/mmp_pdma.c +84 -3
@@ -29,8 +29,8 @@#define DALGN 0x00a0#define DINT 0x00f0#define DDADR 0x0200 -#define DSADR 0x0204 -#define DTADR 0x0208 +#define DSADR (n) (0x0204 + ((n) << 4)) +#define DTADR (n) (0x0208 + ((n) << 4))#define DCMD 0x020c#define DCSR_RUN BIT(31)/* Run Bit (read / write) */
@@ -748,11 +748,92 @@ static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd,return 0 ; } +static unsigned int mmp_pdma_residue (struct mmp_pdma_chan *chan, +dma_cookie_t cookie) +{ +struct mmp_pdma_desc_sw *sw; +u32 curr, residue =0 ; +bool passed = false; +bool cyclic = chan->cyclic_first !=NULL ; + +/* +* If the channel does not have a phy pointer anymore, it has already +* been completed. Therefore, its residue is 0. +*/ +if (!chan->phy) +return 0 ; + +if (chan->dir ==DMA_DEV_TO_MEM ) + curr =readl (chan->phy->base +DTADR (chan->phy->idx)); +else + curr =readl (chan->phy->base +DSADR (chan->phy->idx)); + +list_for_each_entry (sw, &chan->chain_running, node) { +u32 start, end, len; + +if (chan->dir ==DMA_DEV_TO_MEM ) + start = sw->desc.dtadr; +else + start = sw->desc.dsadr; + + len = sw->desc.dcmd &DCMD_LENGTH ; + end = start + len; + +/* +* 'passed' will be latched once we found the descriptor which +* lies inside the boundaries of the curr pointer. All +* descriptors that occur in the list _after_ we found that +* partially handled descriptor are still to be processed and +* are hence added to the residual bytes counter. +*/ + +if (passed) { + residue += len; + }else if (curr >= start && curr <= end) { + residue += end - curr; + passed = true; + } + +/* +* Descriptors that have the ENDIRQEN bit set mark the end of a +* transaction chain, and the cookie assigned with it has been +* returned previously from mmp_pdma_tx_submit(). +* +* In case we have multiple transactions in the running chain, +* and the cookie does not match the one the user asked us +* about, reset the state variables and start over. +* +* This logic does not apply to cyclic transactions, where all +* descriptors have the ENDIRQEN bit set, and for which we +* can't have multiple transactions on one channel anyway. +*/ +if (cyclic || !(sw->desc.dcmd &DCMD_ENDIRQEN )) +continue ; + +if (sw->async_tx.cookie == cookie) { +return residue; + }else { + residue =0 ; + passed = false; + } + } + +/* We should only get here in case of cyclic transactions */ +return residue; +} +static enum dma_status mmp_pdma_tx_status (struct dma_chan *dchan,dma_cookie_t cookie,struct dma_tx_state *txstate) { -return dma_cookie_status (dchan, cookie, txstate); +struct mmp_pdma_chan *chan =to_mmp_pdma_chan (dchan); +enum dma_status ret; + + ret =dma_cookie_status (dchan, cookie, txstate); +if (likely (ret !=DMA_ERROR )) +dma_set_residue (txstate,mmp_pdma_residue (chan, cookie)); + +return ret; }/**
Signature · 1 line
1.8.5.3
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 10 lines · Daniel Mack
A channel can accommodate more than one transaction, each consisting of multiple descriptors, the last of which has the
DCMD_ENDIRQENbit set.In order to report the channel's residue, we hence have to walk the list of running descriptors, look for those which match the cookie, and then try to find the descriptor which defines upper and lower boundaries that embrace the current transport pointer. Once it is found, walk forward until we find the descriptor that tells us about the end of a transaction via a set
DCMD_ENDIRQENbit.
Quoted 7 lines
Signed-off-by Daniel Mack <[email protected]>---
Hi Vinod, everyone,
I'd like to get the disussion regarding this patch started again which left off here:
Sorry for delay, This hit my inboxwhen my vacation started...
Quoted 93 lines
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/217429.html
I think the biggest issue in the previous discussion was a confusion about the term 'descriptor', as it refers to both the internal pdma implementation detail as well as the handle used in the dma subsystem.
I hope I explained that well enough in the link above.
Many thanks,
Danieldrivers/dma/mmp_pdma.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-)drivers/dma/mmp_pdma.c +60
-2@@ -29,8 +29,8 @@#define DALGN 0x00a0#define DINT 0x00f0#define DDADR 0x0200 -#define DSADR 0x0204 -#define DTADR 0x0208 +#define DSADR (n) (0x0204 + ((n) << 4)) +#define DTADR (n) (0x0208 + ((n) << 4))#define DCMD 0x020c#define DCSR_RUN BIT(31)/* Run Bit (read / write) */ @@ -748,11 +748,92 @@ static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd,return 0 ; } +static unsigned int mmp_pdma_residue (struct mmp_pdma_chan *chan, +dma_cookie_t cookie) +{ +struct mmp_pdma_desc_sw *sw; +u32 curr, residue =0 ; +bool passed = false; +bool cyclic = chan->cyclic_first !=NULL ; + +/* +* If the channel does not have a phy pointer anymore, it has already +* been completed. Therefore, its residue is 0. +*/ +if (!chan->phy) +return 0 ; + +if (chan->dir ==DMA_DEV_TO_MEM ) + curr =readl (chan->phy->base +DTADR (chan->phy->idx)); +else + curr =readl (chan->phy->base +DSADR (chan->phy->idx)); + +list_for_each_entry (sw, &chan->chain_running, node) { +u32 start, end, len; + +if (chan->dir ==DMA_DEV_TO_MEM ) + start = sw->desc.dtadr; +else + start = sw->desc.dsadr; + + len = sw->desc.dcmd &DCMD_LENGTH ; + end = start + len; + +/* +* 'passed' will be latched once we found the descriptor which +* lies inside the boundaries of the curr pointer. All +* descriptors that occur in the list _after_ we found that +* partially handled descriptor are still to be processed and +* are hence added to the residual bytes counter. +*/ + +if (passed) { + residue += len; + }else if (curr >= start && curr <= end) { + residue += end - curr; + passed = true; + } + +/* +* Descriptors that have the ENDIRQEN bit set mark the end of a +* transaction chain, and the cookie assigned with it has been +* returned previously from mmp_pdma_tx_submit(). +* +* In case we have multiple transactions in the running chain, +* and the cookie does not match the one the user asked us +* about, reset the state variables and start over. +* +* This logic does not apply to cyclic transactions, where all +* descriptors have the ENDIRQEN bit set, and for which we +* can't have multiple transactions on one channel anyway.
drivers/dma/mmp_pdma.c static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd, · line 818
Quoted 10 lines
drivers/dma/mmp_pdma.c +10
-0+*/ +if (cyclic || !(sw->desc.dcmd &DCMD_ENDIRQEN )) +continue ; + +if (sw->async_tx.cookie == cookie) { +return residue; + }else { + residue =0 ; + passed = false; + }
for cookie in queue, the residue is not 0 but complete length of transaction. Possibly you should check this in mmp_pdma_tx_status and only invoke current function for current transaction.
Secondly, if you have 3 descriptor in the chain_running, the residue on last will add all lengths till last one, that is not something we wnat. Perhpas when you fix above it should be okay
Quoted 7 lines
drivers/dma/mmp_pdma.c +6
-0+ } + +/* We should only get here in case of cyclic transactions */ +return residue; +} + static enum dma_status mmp_pdma_tx_status(struct dma_chan *dchan,
drivers/dma/mmp_pdma.c static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd, · line 834
Quoted 10 lines
drivers/dma/mmp_pdma.c +6
-1dma_cookie_t cookie, struct dma_tx_state *txstate) { - return dma_cookie_status(dchan, cookie, txstate); + struct mmp_pdma_chan *chan = to_mmp_pdma_chan(dchan); +enum dma_status ret; + + ret =dma_cookie_status (dchan, cookie, txstate); +if (likely (ret !=DMA_ERROR )) +dma_set_residue (txstate,mmp_pdma_residue (chan, cookie));
Pls check if resuide is not NULL, then only invoke mmp_pdma_residue()
Signature · 1 line
~Vinod
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Hi Vinod,
Quoted 2 lines · Vinod Koul
On Mon, Feb 17, 2014 at 12:29:06PM +0100, Daniel Mack wrote:
Sorry for delay, This hit my inboxwhen my vacation started...
No problem :)
Quoted 61 lines
Quoted 61 lines
drivers/dma/mmp_pdma.c +61
-0+static unsigned int mmp_pdma_residue (struct mmp_pdma_chan *chan, +dma_cookie_t cookie) +{ +struct mmp_pdma_desc_sw *sw; +u32 curr, residue =0 ; +bool passed = false; +bool cyclic = chan->cyclic_first !=NULL ; + +/* +* If the channel does not have a phy pointer anymore, it has already +* been completed. Therefore, its residue is 0. +*/ +if (!chan->phy) +return 0 ; + +if (chan->dir ==DMA_DEV_TO_MEM ) + curr =readl (chan->phy->base +DTADR (chan->phy->idx)); +else + curr =readl (chan->phy->base +DSADR (chan->phy->idx)); + +list_for_each_entry (sw, &chan->chain_running, node) { +u32 start, end, len; + +if (chan->dir ==DMA_DEV_TO_MEM ) + start = sw->desc.dtadr; +else + start = sw->desc.dsadr; + + len = sw->desc.dcmd &DCMD_LENGTH ; + end = start + len; + +/* +* 'passed' will be latched once we found the descriptor which +* lies inside the boundaries of the curr pointer. All +* descriptors that occur in the list _after_ we found that +* partially handled descriptor are still to be processed and +* are hence added to the residual bytes counter. +*/ + +if (passed) { + residue += len; + }else if (curr >= start && curr <= end) { + residue += end - curr; + passed = true; + } + +/* +* Descriptors that have the ENDIRQEN bit set mark the end of a +* transaction chain, and the cookie assigned with it has been +* returned previously from mmp_pdma_tx_submit(). +* +* In case we have multiple transactions in the running chain, +* and the cookie does not match the one the user asked us +* about, reset the state variables and start over. +* +* This logic does not apply to cyclic transactions, where all +* descriptors have the ENDIRQEN bit set, and for which we +* can't have multiple transactions on one channel anyway. +*/ +if (cyclic || !(sw->desc.dcmd &DCMD_ENDIRQEN )) +continue ;
Quoted 8 lines
drivers/dma/mmp_pdma.c static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd, · line 818
Quoted 7 lines
drivers/dma/mmp_pdma.c +7
-0+ +if (sw->async_tx.cookie == cookie) { +return residue; + }else { + residue =0 ; + passed = false; + }for cookie in queue, the residue is not 0 but complete length of transaction.
Hmm, the code quoted above simply resets the internal residue counter to 0, and the loop will continue increasing it as it iterates more members of the chain_running list. Maybe the example below clarifies.
Again, the problem here is that we have multiple mmp_pdma_desc_sw members that belong to the same transaction.
Quoted 2 lines
Possibly you should check this in
mmp_pdma_tx_statusand only invoke current function for current transaction.
I can't, because I don't have a specific pointer that leads me to the current transaction inside the chain_running list. That's why I have to walk the list at all.
Quoted 2 lines
Secondly, if you have 3 descriptor in the
chain_running, the residue on last will add all lengths till last one, that is not something we wnat.
Not sure wheter I follow, or if I still have a knot in my brain in understanding how the residue logic is supposed to work. Allow me illustrate this with an example, maybe that'd help either one of the two of us :)
Let's assume we have 3 descriptors (in terms of mmp_pdma_desc_sw) in chain_running, and let's assume there's only one transaction, so all 3 descriptors are nicely chained up and the last one has the cookie we're looking for. Further, let's assume the DMA engine is half way through on the 2nd descriptor, at byte 1500.
So the layout looks something like this:
bytes: 0 1024 2048 3072
descs: |----(1)----|----(2)----|----(3)----|
curr: ^
What will happen with the code above is:
1. We start off with passed=false and residue=0
2. The first descriptor is looked at, /passed/ is false, and (curr >= start && curr <= end) is false, so residue remains 0.
3. The second descriptor is looked at, /passed/ is false, but (curr >= start && curr <= end) is true, and the residue is increased by what's left to do in this descriptor, and /passed/ is latched so we know we've passed /curr/ in the iteration.
4. The third descriptor is looked at, and as we've passed the /curr/ mark, all bytes of the descriptor are still to go, and so we add the entire length of that third descriptor to the residue sum.
5. The cookie comparison in the end simply exists to address the fact that we might have operated on an unreleated descriptor, and we have to start over.
So in short, the logic will return the bytes that are not yet processed for a specific transaction, which is the expected thing to do, right?
Quoted 4 lines
drivers/dma/mmp_pdma.c static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd, · line 834
Quoted 3 lines
drivers/dma/mmp_pdma.c +3
-0+ ret =dma_cookie_status (dchan, cookie, txstate); +if (likely (ret !=DMA_ERROR )) +dma_set_residue (txstate,mmp_pdma_residue (chan, cookie));Pls check if resuide is not NULL, then only invoke
mmp_pdma_residue()
Did you mean "Pls check if *txstate* is not NULL"? I can fix that, yes.
Thanks again for your time!
Daniel
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 8 lines · Daniel Mack
Quoted 1 line
for cookie in queue, the residue is not 0 but complete length of transaction.
Hmm, the code quoted above simply resets the internal residue counter to 0, and the loop will continue increasing it as it iterates more members of the
chain_runninglist. Maybe the example below clarifies.Again, the problem here is that we have multiple
mmp_pdma_desc_swmembers that belong to the same transaction.
Okay i missed that point, again.
Quoted 45 lines
Quoted 3 lines
Possibly you should check this in
mmp_pdma_tx_statusand only invoke current function for current transaction.I can't, because I don't have a specific pointer that leads me to the current transaction inside the
chain_runninglist. That's why I have to walk the list at all.Quoted 2 lines
Secondly, if you have 3 descriptor in the
chain_running, the residue on last will add all lengths till last one, that is not something we wnat.Not sure wheter I follow, or if I still have a knot in my brain in understanding how the residue logic is supposed to work. Allow me illustrate this with an example, maybe that'd help either one of the two of us :)
Let's assume we have 3 descriptors (in terms of
mmp_pdma_desc_sw) inchain_running, and let's assume there's only one transaction, so all 3 descriptors are nicely chained up and the last one has the cookie we're looking for. Further, let's assume the DMA engine is half way through on the 2nd descriptor, at byte 1500.So the layout looks something like this:
bytes: 0 1024 2048 3072
descs: |----(1)----|----(2)----|----(3)----|
curr: ^What will happen with the code above is:
1. We start off with passed=false and residue=0
2. The first descriptor is looked at, /passed/ is false, and (curr >= start && curr <= end) is false, so residue remains 0.
3. The second descriptor is looked at, /passed/ is false, but (curr >= start && curr <= end) is true, and the residue is increased by what's left to do in this descriptor, and /passed/ is latched so we know we've passed /curr/ in the iteration.
4. The third descriptor is looked at, and as we've passed the /curr/ mark, all bytes of the descriptor are still to go, and so we add the entire length of that third descriptor to the residue sum.
5. The cookie comparison in the end simply exists to address the fact that we might have operated on an unreleated descriptor, and we have to start over.
Quoted 2 lines
So in short, the logic will return the bytes that are not yet processed for a specific transaction, which is the expected thing to do, right?
Looks fine then BUT I have another questions.
Assuming that you have two txn submitted and driver split them to 3 descriptors each, then in that case the driver would walk over all 6 descriptors and sum up the value, which would lead to incorrect residue. It will work for single pending txn only, right?
While at it and looking at the code again, I think right solution maybe to update the parent child in the descriptors. So on query you simply walk the list for all child descriptors and continue. But the parent and child are defined under CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH.
So adding Dan (his updated email id), would it be okay if we make these as generic in descriptor and use them to manage larger length transactions in drivers?
Quoted 7 lines
Quoted 5 lines
drivers/dma/mmp_pdma.c static int mmp_pdma_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd, · line 834
Quoted 4 lines
drivers/dma/mmp_pdma.c +3
-0+ ret =dma_cookie_status (dchan, cookie, txstate); +if (likely (ret !=DMA_ERROR )) +dma_set_residue (txstate,mmp_pdma_residue (chan, cookie));Pls check if resuide is not NULL, then only invoke
mmp_pdma_residue()Did you mean "Pls check if *txstate* is not NULL"? I can fix that, yes.
Yup!
Quoted 5 lines
Thanks again for your time!
Daniel
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Hi Vinod,
Quoted 6 lines · Vinod Koul
Quoted 4 lines · Daniel Mack
5. The cookie comparison in the end simply exists to address the fact that we might have operated on an unreleated descriptor, and we have to start over.
Quoted 8 lines
Quoted 2 lines
So in short, the logic will return the bytes that are not yet processed for a specific transaction, which is the expected thing to do, right?
Looks fine then BUT I have another questions.
Assuming that you have two txn submitted and driver split them to 3 descriptors each, then in that case the driver would walk over all 6 descriptors and sum up the value, which would lead to incorrect residue. It will work for single pending txn only, right?
No, because each of the two txn would have a different cookie set, and the residue function is called for one specific cookie so we know which one we're looking for. That's the reason why we start over if at the end of an iterated transaction chain, if we recognize that the cookie doesn't match, we start over.
Quoted 4 lines
While at it and looking at the code again, I think right solution maybe to update the parent child in the descriptors. So on query you simply walk the list for all child descriptors and continue. But the parent and child are defined under
CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH.
That's another solution, but it's redundant information after all. Ultimately, it makes the driver more complicated and introduces one more area of potentially inconsistent pointers.
Quoted 3 lines
So adding Dan (his updated email id), would it be okay if we make these as generic in descriptor and use them to manage larger length transactions in drivers?
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
Quoted 2 lines
Quoted 1 line
Did you mean "Pls check if *txstate* is not NULL"? I can fix that, yes.
Yup!
Ok, but I'll wait with that until we have agreed on the details above :)
Thanks,
Daniel
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 33 lines · Daniel Mack
Hi Vinod,
Quoted 6 lines · Vinod Koul
Quoted 4 lines · Daniel Mack
5. The cookie comparison in the end simply exists to address the fact that we might have operated on an unreleated descriptor, and we have to start over.
Quoted 8 lines
Quoted 2 lines
So in short, the logic will return the bytes that are not yet processed for a specific transaction, which is the expected thing to do, right?
Looks fine then BUT I have another questions.
Assuming that you have two txn submitted and driver split them to 3 descriptors each, then in that case the driver would walk over all 6 descriptors and sum up the value, which would lead to incorrect residue. It will work for single pending txn only, right?
No, because each of the two txn would have a different cookie set, and the residue function is called for one specific cookie so we know which one we're looking for. That's the reason why we start over if at the end of an iterated transaction chain, if we recognize that the cookie doesn't match, we start over.
Quoted 4 lines
While at it and looking at the code again, I think right solution maybe to update the parent child in the descriptors. So on query you simply walk the list for all child descriptors and continue. But the parent and child are defined under
CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH.That's another solution, but it's redundant information after all. Ultimately, it makes the driver more complicated and introduces one more area of potentially inconsistent pointers.
Quoted 6 lines
Quoted 3 lines
So adding Dan (his updated email id), would it be okay if we make these as generic in descriptor and use them to manage larger length transactions in drivers?
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
That is because you are maintaining the current descriptors in chain_running. If we use above method then you dont need to use this, right?
Signature · 1 line
~Vinod
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 34 lines · Vinod Koul
Quoted 33 lines · Daniel Mack
Hi Vinod,
Quoted 6 lines · Vinod Koul
Quoted 4 lines · Daniel Mack
5. The cookie comparison in the end simply exists to address the fact that we might have operated on an unreleated descriptor, and we have to start over.
Quoted 8 lines
Quoted 2 lines
So in short, the logic will return the bytes that are not yet processed for a specific transaction, which is the expected thing to do, right?
Looks fine then BUT I have another questions.
Assuming that you have two txn submitted and driver split them to 3 descriptors each, then in that case the driver would walk over all 6 descriptors and sum up the value, which would lead to incorrect residue. It will work for single pending txn only, right?
No, because each of the two txn would have a different cookie set, and the residue function is called for one specific cookie so we know which one we're looking for. That's the reason why we start over if at the end of an iterated transaction chain, if we recognize that the cookie doesn't match, we start over.
Quoted 4 lines
While at it and looking at the code again, I think right solution maybe to update the parent child in the descriptors. So on query you simply walk the list for all child descriptors and continue. But the parent and child are defined under
CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH.That's another solution, but it's redundant information after all. Ultimately, it makes the driver more complicated and introduces one more area of potentially inconsistent pointers.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
So adding Dan (his updated email id), would it be okay if we make these as generic in descriptor and use them to manage larger length transactions in drivers?
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
That is because you are maintaining the current descriptors in
chain_running. If we use above method then you dont need to use this, right?
Jup, but that would result in a rewrite of larger parts of the code. The concept of hot-linking the two list so there's only one resulting list of currently active descriptors is built-in deeply into the driver's concept.
Thanks,
Daniel
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 9 lines · Daniel Mack
Quoted 4 lines
Quoted 2 lines
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
That is because you are maintaining the current descriptors in
chain_running. If we use above method then you dont need to use this, right?Jup, but that would result in a rewrite of larger parts of the code. The concept of hot-linking the two list so there's only one resulting list of currently active descriptors is built-in deeply into the driver's concept.
Ah I suspected so :)
I think for now this is fine you can perhaps upgrade this later :)
Signature · 1 line
~Vinod
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 6 lines · Vinod Koul
Quoted 5 lines · Daniel Mack
Quoted 4 lines
Quoted 2 lines
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
That is because you are maintaining the current descriptors in
chain_running. If we use above method then you dont need to use this, right?
Quoted 7 lines
Quoted 4 lines
Jup, but that would result in a rewrite of larger parts of the code. The concept of hot-linking the two list so there's only one resulting list of currently active descriptors is built-in deeply into the driver's concept.
Ah I suspected so :)
I think for now this is fine you can perhaps upgrade this later :)
So, do you want me to resend with the minor dma_set_residue() change?
Thanks,
Daniel
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 11 lines · Daniel Mack
Quoted 10 lines · Vinod Koul
Quoted 9 lines · Daniel Mack
Quoted 4 lines
Quoted 2 lines
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
That is because you are maintaining the current descriptors in
chain_running. If we use above method then you dont need to use this, right?Jup, but that would result in a rewrite of larger parts of the code. The concept of hot-linking the two list so there's only one resulting list of currently active descriptors is built-in deeply into the driver's concept.
Quoted 5 lines
Quoted 3 lines
Ah I suspected so :)
I think for now this is fine you can perhaps upgrade this later :)
So, do you want me to resend with the minor
dma_set_residue()change?
Yes please...
Signature · 1 line
~Vinod
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 12 lines · Vinod Koul
Quoted 11 lines · Daniel Mack
Quoted 10 lines · Vinod Koul
Quoted 9 lines · Daniel Mack
Quoted 4 lines
Quoted 2 lines
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
That is because you are maintaining the current descriptors in
chain_running. If we use above method then you dont need to use this, right?Jup, but that would result in a rewrite of larger parts of the code. The concept of hot-linking the two list so there's only one resulting list of currently active descriptors is built-in deeply into the driver's concept.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Ah I suspected so :)
I think for now this is fine you can perhaps upgrade this later :)
So, do you want me to resend with the minor
dma_set_residue()change?Yes please...
Ah, just checked again and my call to
dma_set_residue(txstate, mmp_pdma_residue(chan, cookie));
resolves to ...
static inline void dma_set_residue(struct dma_tx_state *state, u32 residue)
{
if (state)
state->residue = residue;
}So there's no need to check for txstate != NULL on the caller side :)
Thanks,
Daniel
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Hi Vinod,
Quoted 27 lines · Daniel Mack
Quoted 12 lines · Vinod Koul
Quoted 11 lines · Daniel Mack
Quoted 10 lines · Vinod Koul
Quoted 9 lines · Daniel Mack
Quoted 4 lines
Quoted 2 lines
It might add to the readability of the drivers, but for the current case, I don't think it's really necessary.
That is because you are maintaining the current descriptors in
chain_running. If we use above method then you dont need to use this, right?Jup, but that would result in a rewrite of larger parts of the code. The concept of hot-linking the two list so there's only one resulting list of currently active descriptors is built-in deeply into the driver's concept.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Ah I suspected so :)
I think for now this is fine you can perhaps upgrade this later :)
So, do you want me to resend with the minor
dma_set_residue()change?Yes please...
Ah, just checked again and my call to
dma_set_residue(txstate, mmp_pdma_residue(chan, cookie));resolves to ...
Quoted 8 lines
static inline void
dma_set_residue(struct dma_tx_state *state, u32 residue){ if (state) state->residue = residue; }So there's no need to check for txstate != NULL on the caller side :)
Just in case you missed that over the other mmp_pdma patches: as pointed out above, dma_set_residue() already does the NULL pointer check you asked for, so there's nothing to fix up here. IIRC, we were eventually on the same page regarding all the other details, right?
Many thanks,
Daniel
PATCH RESEND 1/1 dma: mmp_pdma: add support for residue reporting
Quoted 8 lines · Daniel Mack
Hi Vinod,
On 04/16/2014 06:40 PM, Daniel Mack wrote:
Just in case you missed that over the other
mmp_pdmapatches: as pointed out above,dma_set_residue()already does the NULL pointer check you asked for, so there's nothing to fix up here. IIRC, we were eventually on the same page regarding all the other details, right?
Yes and now i have applied the patch.
Thanks
Signature · 1 line
~Vinod