From: H Hartley Sweeten Date: Thu, 19 Dec 2013 23:31:59 +0000 (-0700) Subject: staging: comedi: ni_tio.h: remove subdev_to_counter() X-Git-Tag: v5.15~18493^2~186 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00edbc31d8f6c84870041d5841663e72b449b170;p=platform%2Fkernel%2Flinux-starfive.git staging: comedi: ni_tio.h: remove subdev_to_counter() This inline helper function simply returns the s->private void *. Remove the helper and just get the s->private void * directly where needed. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 0a7790bea..f7a9565 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -815,11 +815,9 @@ static void ni_660x_release_mite_channel(struct comedi_device *dev, static int ni_660x_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { + struct ni_gpct *counter = s->private; int retval; - struct ni_gpct *counter = subdev_to_counter(s); -/* const struct comedi_cmd *cmd = &s->async->cmd; */ - retval = ni_660x_request_mite_channel(dev, counter, COMEDI_INPUT); if (retval) { comedi_error(dev, @@ -835,14 +833,14 @@ static int ni_660x_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int ni_660x_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - struct ni_gpct *counter = subdev_to_counter(s); + struct ni_gpct *counter = s->private; return ni_tio_cmdtest(counter, cmd); } static int ni_660x_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - struct ni_gpct *counter = subdev_to_counter(s); + struct ni_gpct *counter = s->private; int retval; retval = ni_tio_cancel(counter); @@ -866,7 +864,9 @@ static void set_tio_counterswap(struct comedi_device *dev, int chipset) static void ni_660x_handle_gpct_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) { - ni_tio_handle_interrupt(subdev_to_counter(s), s); + struct ni_gpct *counter = s->private; + + ni_tio_handle_interrupt(counter, s); if (s->async->events) { if (s->async->events & (COMEDI_CB_EOA | COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW)) { @@ -901,11 +901,12 @@ static int ni_660x_input_poll(struct comedi_device *dev, struct comedi_subdevice *s) { struct ni_660x_private *devpriv = dev->private; + struct ni_gpct *counter = s->private; unsigned long flags; /* lock to avoid race with comedi_poll */ spin_lock_irqsave(&devpriv->interrupt_lock, flags); - mite_sync_input_dma(subdev_to_counter(s)->mite_chan, s->async); + mite_sync_input_dma(counter->mite_chan, s->async); spin_unlock_irqrestore(&devpriv->interrupt_lock, flags); return comedi_buf_read_n_available(s->async); } @@ -915,10 +916,10 @@ static int ni_660x_buf_change(struct comedi_device *dev, unsigned long new_size) { struct ni_660x_private *devpriv = dev->private; + struct ni_gpct *counter = s->private; int ret; - ret = mite_buf_change(mite_ring(devpriv, subdev_to_counter(s)), - s->async); + ret = mite_buf_change(mite_ring(devpriv, counter), s->async); if (ret < 0) return ret; @@ -978,7 +979,9 @@ static int ni_660x_GPCT_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - return ni_tio_rinsn(subdev_to_counter(s), insn, data); + struct ni_gpct *counter = s->private; + + return ni_tio_rinsn(counter, insn, data); } static void init_tio_chip(struct comedi_device *dev, int chipset) @@ -1003,14 +1006,18 @@ static int ni_660x_GPCT_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - return ni_tio_insn_config(subdev_to_counter(s), insn, data); + struct ni_gpct *counter = s->private; + + return ni_tio_insn_config(counter, insn, data); } static int ni_660x_GPCT_winsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - return ni_tio_winsn(subdev_to_counter(s), insn, data); + struct ni_gpct *counter = s->private; + + return ni_tio_winsn(counter, insn, data); } static int ni_660x_dio_insn_bits(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/ni_tio.h b/drivers/staging/comedi/drivers/ni_tio.h index d205da0..f4f251d 100644 --- a/drivers/staging/comedi/drivers/ni_tio.h +++ b/drivers/staging/comedi/drivers/ni_tio.h @@ -150,9 +150,4 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *, int *gate_error, int *tc_error, int *perm_stale_data, int *stale_data); -static inline struct ni_gpct *subdev_to_counter(struct comedi_subdevice *s) -{ - return s->private; -} - #endif /* _COMEDI_NI_TIO_H */