lkml.org 
[lkml]   [2009]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/2] dw_dmac: add cyclic API to DW DMA driver
    Sosnowski, Maciej wrote:
    > > +void dw_dma_cyclic_stop(struct dma_chan *chan)
    > > +{
    > > + struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
    > > + struct dw_dma *dw = to_dw_dma(dwc->chan.device);
    > > +
    > > + channel_clear_bit(dw, CH_EN, dwc->mask);
    > > + while (dma_readl(dw, CH_EN) & dwc->mask)
    > > + cpu_relax();
    > > +}
    >
    > Don't you need locks in dw_dma_cyclic_stop?

    Good question. On one hand, if cyclic_start() can race with
    cyclic_stop(), the client probably has more serious issues to deal
    with. On the other hand, if something ever manages to set the CH_EN bit
    at the wrong moment, the loop may never finish.

    So it's probably safest to wrap it in spin_lock_bh(). You should
    probably add a note that this function can not be called from interrupt
    context too.

    Haavard


    \
     
     \ /
      Last update: 2009-04-01 10:33    [W:0.019 / U:30.016 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site