net: ethernet: ti: davinci_cpdma: move cpdma channel struct macroses to internals
Keep the driver internals in C file. Currently it's not required for drivers to know rx or tx a channel is, except create function. So correct "channel create" function, and use all channel struct macroses only for internal use. Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
e05107e6b7
commit
925d65e6d8
@@ -124,6 +124,13 @@ struct cpdma_chan {
|
||||
int int_set, int_clear, td;
|
||||
};
|
||||
|
||||
#define tx_chan_num(chan) (chan)
|
||||
#define rx_chan_num(chan) ((chan) + CPDMA_MAX_CHANNELS)
|
||||
#define is_rx_chan(chan) ((chan)->chan_num >= CPDMA_MAX_CHANNELS)
|
||||
#define is_tx_chan(chan) (!is_rx_chan(chan))
|
||||
#define __chan_linear(chan_num) ((chan_num) & (CPDMA_MAX_CHANNELS - 1))
|
||||
#define chan_linear(chan) __chan_linear((chan)->chan_num)
|
||||
|
||||
/* The following make access to common cpdma_ctlr params more readable */
|
||||
#define dmaregs params.dmaregs
|
||||
#define num_chan params.num_chan
|
||||
@@ -441,12 +448,14 @@ static void cpdma_chan_split_pool(struct cpdma_ctlr *ctlr)
|
||||
}
|
||||
|
||||
struct cpdma_chan *cpdma_chan_create(struct cpdma_ctlr *ctlr, int chan_num,
|
||||
cpdma_handler_fn handler)
|
||||
cpdma_handler_fn handler, int rx_type)
|
||||
{
|
||||
int offset = chan_num * 4;
|
||||
struct cpdma_chan *chan;
|
||||
int offset = (chan_num % CPDMA_MAX_CHANNELS) * 4;
|
||||
unsigned long flags;
|
||||
|
||||
chan_num = rx_type ? rx_chan_num(chan_num) : tx_chan_num(chan_num);
|
||||
|
||||
if (__chan_linear(chan_num) >= ctlr->num_chan)
|
||||
return NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user