staging: unisys: memregion: Eliminate visor_memregion_resize()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 5 May 2015 22:36:51 +0000 (18:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:27:29 +0000 (15:27 +0200)
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 42fabeafc01ea3e099e791ebc9261f9082366991..cfbb19f781398709a7834411793c6c56fe9e0e01 100644 (file)
@@ -89,9 +89,22 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
        if (uuid_le_cmp(guid, NULL_UUID_LE) == 0)
                guid = channel->chan_hdr.chtype;
 
-       err = visor_memregion_resize(&channel->memregion, channel_bytes);
-       if (err)
+       iounmap(channel->memregion.mapped);
+       release_mem_region(channel->memregion.physaddr,
+                          channel->memregion.nbytes);
+       channel->memregion.mapped = NULL;
+       if (!request_mem_region(channel->memregion.physaddr, channel_bytes,
+                               MYDRVNAME))
+               goto cleanup;
+
+       channel->memregion.mapped = ioremap_cache(channel->memregion.physaddr,
+                                                 channel_bytes);
+       if (!channel->memregion.mapped) {
+               release_mem_region(channel->memregion.physaddr, channel_bytes);
                goto cleanup;
+       }
+
+       channel->memregion.nbytes = channel_bytes;
 
        channel->size = channel_bytes;
        channel->guid = guid;
index 60d0dc9f07bcc6058ed2c64f4fe9f08c66b5ecf9..57d617f901294a74dd92a26981bfd202d0af56c8 100644 (file)
@@ -29,7 +29,6 @@ struct memregion {
        void __iomem *mapped;
 };
 
-int visor_memregion_resize(struct memregion *memregion, ulong newsize);
 int visor_memregion_read(struct memregion *memregion,
                         ulong offset, void *dest, ulong nbytes);
 int visor_memregion_write(struct memregion *memregion,
index 79ef4c5c686b54c7f02e900a449be8fb71287490..fa7a4060c20c30832a2d84c431a253d2be1e86fb 100644 (file)
@@ -76,22 +76,6 @@ visor_memregion_get_pointer(struct memregion *memregion)
 }
 EXPORT_SYMBOL_GPL(visor_memregion_get_pointer);
 
-int
-visor_memregion_resize(struct memregion *memregion, ulong newsize)
-{
-       int rc;
-
-       if (newsize == memregion->nbytes)
-               return 0;
-
-       unmapit(memregion);
-       memregion->nbytes = newsize;
-       rc = mapit(memregion);
-
-       return rc;
-}
-EXPORT_SYMBOL_GPL(visor_memregion_resize);
-
 int
 visor_memregion_read(struct memregion *memregion, ulong offset, void *dest,
                     ulong nbytes)