staging: unisys: Eliminate visor_memregion_create()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 5 May 2015 22:36:49 +0000 (18:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 13:27:28 +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 150e3df89001602a4055303dffefd01e69080b04..f278739514f72b76f3df26e5e5a88981eb3d6d88 100644 (file)
@@ -57,9 +57,8 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
        struct visorchannel *channel;
        int err;
        size_t size = sizeof(struct channel_header);
-       struct memregion *memregion;
 
-       channel = kmalloc(sizeof(*channel), GFP_KERNEL|__GFP_NORETRY);
+       channel = kzalloc(sizeof(*channel), GFP_KERNEL|__GFP_NORETRY);
        if (!channel)
                goto cleanup;
 
@@ -67,11 +66,17 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
        spin_lock_init(&channel->insert_lock);
        spin_lock_init(&channel->remove_lock);
 
-       /* prepare chan_hdr (abstraction to read/write channel memory) */
-       memregion = visor_memregion_create(&channel->memregion, physaddr, size);
+       if (!request_mem_region(physaddr, size, MYDRVNAME))
+               goto cleanup;
 
-       if (!memregion)
+       channel->memregion.mapped = ioremap_cache(physaddr, size);
+       if (!channel->memregion.mapped) {
+               release_mem_region(physaddr, size);
                goto cleanup;
+       }
+
+       channel->memregion.physaddr = physaddr;
+       channel->memregion.nbytes = size;
 
        err = visor_memregion_read(&channel->memregion, 0, &channel->chan_hdr,
                                   sizeof(struct channel_header));
index 3826fe6c24461124999e9a14b4dbdf091720c748..cb3dbc50cd8ee42c52d02d431b3a37ef9df2929a 100644 (file)
@@ -29,8 +29,6 @@ struct memregion {
        void __iomem *mapped;
 };
 
-struct memregion *visor_memregion_create(struct memregion *memregion,
-                                        HOSTADDRESS physaddr, ulong nbytes);
 int visor_memregion_resize(struct memregion *memregion, ulong newsize);
 int visor_memregion_read(struct memregion *memregion,
                         ulong offset, void *dest, ulong nbytes);
index a575ecc5c3d76d8838c3f4c41bf48f5474dff51b..0c7bed010c84238a6ce640cf7f55a8b80cee5ec0 100644 (file)
 static int mapit(struct memregion *memregion);
 static void unmapit(struct memregion *memregion);
 
-struct memregion *
-visor_memregion_create(struct memregion *memregion,
-                      HOSTADDRESS physaddr, ulong nbytes)
-{
-       struct memregion *rc = NULL;
-
-       memregion->physaddr = physaddr;
-       memregion->nbytes = nbytes;
-       if (mapit(memregion)) {
-               rc = NULL;
-               goto cleanup;
-       }
-       rc = memregion;
-cleanup:
-       if (rc == NULL) {
-               visor_memregion_destroy(memregion);
-               memregion = NULL;
-       }
-       return rc;
-}
-EXPORT_SYMBOL_GPL(visor_memregion_create);
-
 static int
 mapit(struct memregion *memregion)
 {