[PATCH 042/141] staging: unisys: fix sig_read_data and sig_read_data functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

The sig_read_data() and sig_write_data() functions are involved in 2 steps
of calls.  They really don't need to be and this makes for much simpler
code.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>
Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/visorbus/visorchannel.c | 46 ++++++++++++--------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 30bedcc..d7ddc3a 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -318,42 +318,38 @@ sig_read_header(struct visorchannel *channel, u32 queue,
 	return TRUE;
 }
 
-static BOOL
-sig_do_data(struct visorchannel *channel, u32 queue,
-	    struct signal_queue_header *sig_hdr, u32 slot, void *data,
-	    BOOL is_write)
+static inline BOOL
+sig_read_data(struct visorchannel *channel, u32 queue,
+	      struct signal_queue_header *sig_hdr, u32 slot, void *data)
 {
 	int err;
 	int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue,
 						 sig_hdr, slot);
-	if (is_write) {
-		err = visor_memregion_write(channel->memregion,
-					    signal_data_offset,
-					    data, sig_hdr->signal_size);
-		if (err)
-			return FALSE;
-	} else {
-		err = visor_memregion_read(channel->memregion,
-					   signal_data_offset,
-					   data, sig_hdr->signal_size);
-		if (err)
-			return FALSE;
-	}
-	return TRUE;
-}
 
-static inline BOOL
-sig_read_data(struct visorchannel *channel, u32 queue,
-	      struct signal_queue_header *sig_hdr, u32 slot, void *data)
-{
-	return sig_do_data(channel, queue, sig_hdr, slot, data, FALSE);
+	err = visor_memregion_read(channel->memregion,
+				   signal_data_offset,
+				   data, sig_hdr->signal_size);
+	if (err)
+		return FALSE;
+
+	return TRUE;
 }
 
 static inline BOOL
 sig_write_data(struct visorchannel *channel, u32 queue,
 	       struct signal_queue_header *sig_hdr, u32 slot, void *data)
 {
-	return sig_do_data(channel, queue, sig_hdr, slot, data, TRUE);
+	int err;
+	int signal_data_offset = SIG_DATA_OFFSET(&channel->chan_hdr, queue,
+						 sig_hdr, slot);
+
+	err = visor_memregion_write(channel->memregion,
+				    signal_data_offset,
+				    data, sig_hdr->signal_size);
+	if (err)
+		return FALSE;
+
+	return TRUE;
 }
 
 static BOOL
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux