From 2fadffc0bb2e0b33ebee72be172073f84624bc3d Mon Sep 17 00:00:00 2001
From: Ian Abbott <abbotti@mev.co.uk>
Date: Tue, 6 May 2014 13:12:02 +0100
Subject: [PATCH] staging: comedi: pass subdevice to comedi_buf_memcpy_from()

Change the parameters of `comedi_buf_memcpy_from()` to pass a pointer to
the comedi subdevice instead of a pointer to the "async" structure
belonging to the subdevice.

The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/comedi_buf.c        | 3 ++-
 drivers/staging/comedi/comedidev.h         | 2 +-
 drivers/staging/comedi/drivers/comedi_fc.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c
index de850f3fd49d..199ebb48974c 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -472,10 +472,11 @@ void comedi_buf_memcpy_to(struct comedi_subdevice *s, unsigned int offset,
 }
 EXPORT_SYMBOL_GPL(comedi_buf_memcpy_to);
 
-void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset,
+void comedi_buf_memcpy_from(struct comedi_subdevice *s, unsigned int offset,
 			    void *dest, unsigned int nbytes)
 {
 	void *src;
+	struct comedi_async *async = s->async;
 	unsigned int read_ptr = async->buf_read_ptr + offset;
 
 	if (read_ptr >= async->prealloc_bufsz)
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index 221db717ebc4..0a68006e2c21 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -348,7 +348,7 @@ int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x);
 
 void comedi_buf_memcpy_to(struct comedi_subdevice *s, unsigned int offset,
 			  const void *source, unsigned int num_bytes);
-void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset,
+void comedi_buf_memcpy_from(struct comedi_subdevice *s, unsigned int offset,
 			    void *destination, unsigned int num_bytes);
 
 /* drivers.c - general comedi driver functions */
diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c
index 81749a778de0..5eff9d1cd072 100644
--- a/drivers/staging/comedi/drivers/comedi_fc.c
+++ b/drivers/staging/comedi/drivers/comedi_fc.c
@@ -92,7 +92,7 @@ unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *s,
 		return 0;
 
 	num_bytes = comedi_buf_read_alloc(async, num_bytes);
-	comedi_buf_memcpy_from(async, 0, data, num_bytes);
+	comedi_buf_memcpy_from(s, 0, data, num_bytes);
 	comedi_buf_read_free(async, num_bytes);
 	cfc_inc_scan_progress(s, num_bytes);
 	async->events |= COMEDI_CB_BLOCK;
-- 
2.34.1