Commit 78f3c9d2 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Vinod Koul

dma: dw: improve comparison with ~0

In general ~0 does not fit some integer types. Let's do a helper to make a
comparison with that constant properly.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent be480dcb
...@@ -37,16 +37,22 @@ ...@@ -37,16 +37,22 @@
* which does not support descriptor writeback. * which does not support descriptor writeback.
*/ */
static inline bool is_request_line_unset(struct dw_dma_chan *dwc)
{
return dwc->request_line == (typeof(dwc->request_line))~0;
}
static inline void dwc_set_masters(struct dw_dma_chan *dwc) static inline void dwc_set_masters(struct dw_dma_chan *dwc)
{ {
struct dw_dma *dw = to_dw_dma(dwc->chan.device); struct dw_dma *dw = to_dw_dma(dwc->chan.device);
struct dw_dma_slave *dws = dwc->chan.private; struct dw_dma_slave *dws = dwc->chan.private;
unsigned char mmax = dw->nr_masters - 1; unsigned char mmax = dw->nr_masters - 1;
if (dwc->request_line == ~0) { if (!is_request_line_unset(dwc))
dwc->src_master = min_t(unsigned char, mmax, dwc_get_sms(dws)); return;
dwc->dst_master = min_t(unsigned char, mmax, dwc_get_dms(dws));
} dwc->src_master = min_t(unsigned char, mmax, dwc_get_sms(dws));
dwc->dst_master = min_t(unsigned char, mmax, dwc_get_dms(dws));
} }
#define DWC_DEFAULT_CTLLO(_chan) ({ \ #define DWC_DEFAULT_CTLLO(_chan) ({ \
...@@ -984,7 +990,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig) ...@@ -984,7 +990,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
dwc->direction = sconfig->direction; dwc->direction = sconfig->direction;
/* Take the request line from slave_id member */ /* Take the request line from slave_id member */
if (dwc->request_line == ~0) if (is_request_line_unset(dwc))
dwc->request_line = sconfig->slave_id; dwc->request_line = sconfig->slave_id;
convert_burst(&dwc->dma_sconfig.src_maxburst); convert_burst(&dwc->dma_sconfig.src_maxburst);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment