staging: unisys: Eliminate visor_memregion_write()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 5 May 2015 22:36:59 +0000 (18:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:27:30 +0000 (15:27 +0200)
visorchannel's signal code should call visorchannel_write() directly.
This is more consistent and cleaner, and allows us to remove the last
memregion call.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorbus/visorchannel.c
drivers/staging/unisys/visorutil/memregion.h
drivers/staging/unisys/visorutil/memregion_direct.c

index 549128d29892d42097d9c94e6e309ff9ccf80bc6..564d32521a4b9eca8748a65de27a97a4a6a59af2 100644 (file)
@@ -250,8 +250,8 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch,
 
                if (nbytes < thisbytes)
                        thisbytes = nbytes;
-               err = visor_memregion_write(&channel->memregion,
-                                           offset + written, buf, thisbytes);
+               err = visorchannel_write(channel, offset + written,
+                                        buf, thisbytes);
                if (err)
                        goto cleanup;
 
@@ -290,12 +290,12 @@ EXPORT_SYMBOL_GPL(visorchannel_get_header);
 /** Write the contents of a specific field within a SIGNAL_QUEUE_HEADER back
  *  into host memory
  */
-#define SIG_WRITE_FIELD(channel, queue, sig_hdr, FIELD)                        \
-       (visor_memregion_write(&channel->memregion,                     \
-                              SIG_QUEUE_OFFSET(&channel->chan_hdr, queue)+ \
-                              offsetof(struct signal_queue_header, FIELD),\
-                              &((sig_hdr)->FIELD),                     \
-                              sizeof((sig_hdr)->FIELD)) >= 0)
+#define SIG_WRITE_FIELD(channel, queue, sig_hdr, FIELD)                         \
+       (visorchannel_write(channel,                                     \
+                           SIG_QUEUE_OFFSET(&channel->chan_hdr, queue)+ \
+                           offsetof(struct signal_queue_header, FIELD), \
+                           &((sig_hdr)->FIELD),                         \
+                           sizeof((sig_hdr)->FIELD)) >= 0)
 
 static BOOL
 sig_read_header(struct visorchannel *channel, u32 queue,
@@ -340,9 +340,8 @@ sig_write_data(struct visorchannel *channel, u32 queue,
        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);
+       err = visorchannel_write(channel, signal_data_offset,
+                                data, sig_hdr->signal_size);
        if (err)
                return FALSE;
 
@@ -403,13 +402,12 @@ signalinsert_inner(struct visorchannel *channel, u32 queue, void *msg)
        sig_hdr.head = ((sig_hdr.head + 1) % sig_hdr.max_slots);
        if (sig_hdr.head == sig_hdr.tail) {
                sig_hdr.num_overflows++;
-               visor_memregion_write(&channel->memregion,
-                                     SIG_QUEUE_OFFSET(&channel->chan_hdr,
-                                                      queue) +
-                                     offsetof(struct signal_queue_header,
-                                              num_overflows),
-                                     &(sig_hdr.num_overflows),
-                                     sizeof(sig_hdr.num_overflows));
+               visorchannel_write(channel,
+                                  SIG_QUEUE_OFFSET(&channel->chan_hdr, queue) +
+                                  offsetof(struct signal_queue_header,
+                                           num_overflows),
+                                  &(sig_hdr.num_overflows),
+                                  sizeof(sig_hdr.num_overflows));
                return FALSE;
        }
 
index 4122b48f67075c393ab7f684bd7e7d68ea212aa1..62036cd6153df38c3f1b023ca7a3ae850ba8bae9 100644 (file)
@@ -29,8 +29,6 @@ struct memregion {
        void __iomem *mapped;
 };
 
-int visor_memregion_write(struct memregion *memregion,
-                         ulong offset, void *src, ulong nbytes);
 void memregion_dump(struct memregion *memregion, char *s,
                    ulong off, ulong len, struct seq_file *seq);
 
index 17b1033a88263749cc5ae6d500efcc2705a216ef..818f6a8b54c5d12680f9247cd2b54cdb8842bc26 100644 (file)
 #include "memregion.h"
 
 #define MYDRVNAME "memregion"
-
-int
-visor_memregion_write(struct memregion *memregion, ulong offset, void *src,
-                     ulong nbytes)
-{
-       if (offset + nbytes > memregion->nbytes)
-               return -EIO;
-
-       memcpy_toio(memregion->mapped + offset, src, nbytes);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(visor_memregion_write);