Commit 9ff24fd5 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_labpc_isadma: tidy up labpc_init_dma_chan()

DMA support is optional for the labpc driver. The return value from
labpc_init_dma_chan() is not even checked by the caller.

Change the return type to void and tidy up the function a bit.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4d1c15c0
...@@ -163,28 +163,24 @@ void labpc_handle_dma_status(struct comedi_device *dev) ...@@ -163,28 +163,24 @@ void labpc_handle_dma_status(struct comedi_device *dev)
} }
EXPORT_SYMBOL_GPL(labpc_handle_dma_status); EXPORT_SYMBOL_GPL(labpc_handle_dma_status);
int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan) void labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan)
{ {
struct labpc_private *devpriv = dev->private; struct labpc_private *devpriv = dev->private;
struct labpc_dma_desc *dma = &devpriv->dma_desc; struct labpc_dma_desc *dma = &devpriv->dma_desc;
void *dma_buffer;
unsigned long dma_flags; unsigned long dma_flags;
int ret;
if (dma_chan != 1 && dma_chan != 3) if (dma_chan != 1 && dma_chan != 3)
return -EINVAL; return;
dma_buffer = kmalloc(dma_buffer_size, GFP_KERNEL | GFP_DMA); if (request_dma(dma_chan, dev->board_name))
if (!dma_buffer) return;
return -ENOMEM;
ret = request_dma(dma_chan, dev->board_name); dma->virt_addr = kmalloc(dma_buffer_size, GFP_KERNEL | GFP_DMA);
if (ret) { if (!dma->virt_addr) {
kfree(dma_buffer); free_dma(dma_chan);
return ret; return;
} }
dma->virt_addr = dma_buffer;
dma->chan = dma_chan; dma->chan = dma_chan;
dma->hw_addr = virt_to_bus(dma->virt_addr); dma->hw_addr = virt_to_bus(dma->virt_addr);
...@@ -192,8 +188,6 @@ int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan) ...@@ -192,8 +188,6 @@ int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan)
disable_dma(dma->chan); disable_dma(dma->chan);
set_dma_mode(dma->chan, DMA_MODE_READ); set_dma_mode(dma->chan, DMA_MODE_READ);
release_dma_lock(dma_flags); release_dma_lock(dma_flags);
return 0;
} }
EXPORT_SYMBOL_GPL(labpc_init_dma_chan); EXPORT_SYMBOL_GPL(labpc_init_dma_chan);
......
...@@ -16,7 +16,7 @@ static inline bool labpc_have_dma_chan(struct comedi_device *dev) ...@@ -16,7 +16,7 @@ static inline bool labpc_have_dma_chan(struct comedi_device *dev)
return (bool)devpriv->dma_desc.chan; return (bool)devpriv->dma_desc.chan;
} }
int labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan); void labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan);
void labpc_free_dma_chan(struct comedi_device *dev); void labpc_free_dma_chan(struct comedi_device *dev);
void labpc_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s); void labpc_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s);
void labpc_drain_dma(struct comedi_device *dev); void labpc_drain_dma(struct comedi_device *dev);
...@@ -29,10 +29,9 @@ static inline bool labpc_have_dma_chan(struct comedi_device *dev) ...@@ -29,10 +29,9 @@ static inline bool labpc_have_dma_chan(struct comedi_device *dev)
return false; return false;
} }
static inline int labpc_init_dma_chan(struct comedi_device *dev, static inline void labpc_init_dma_chan(struct comedi_device *dev,
unsigned int dma_chan) unsigned int dma_chan)
{ {
return -ENOTSUPP;
} }
static inline void labpc_free_dma_chan(struct comedi_device *dev) static inline void labpc_free_dma_chan(struct comedi_device *dev)
......
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