staging: unisys: Eliminate visor_memregion_create()
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>
This commit is contained in:
parent
330782577e
commit
aefebaa5bc
3 changed files with 11 additions and 30 deletions
|
@ -57,9 +57,8 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
|
||||||
struct visorchannel *channel;
|
struct visorchannel *channel;
|
||||||
int err;
|
int err;
|
||||||
size_t size = sizeof(struct channel_header);
|
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)
|
if (!channel)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -67,12 +66,18 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channel_bytes,
|
||||||
spin_lock_init(&channel->insert_lock);
|
spin_lock_init(&channel->insert_lock);
|
||||||
spin_lock_init(&channel->remove_lock);
|
spin_lock_init(&channel->remove_lock);
|
||||||
|
|
||||||
/* prepare chan_hdr (abstraction to read/write channel memory) */
|
if (!request_mem_region(physaddr, size, MYDRVNAME))
|
||||||
memregion = visor_memregion_create(&channel->memregion, physaddr, size);
|
|
||||||
|
|
||||||
if (!memregion)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
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,
|
err = visor_memregion_read(&channel->memregion, 0, &channel->chan_hdr,
|
||||||
sizeof(struct channel_header));
|
sizeof(struct channel_header));
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -29,8 +29,6 @@ struct memregion {
|
||||||
void __iomem *mapped;
|
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_resize(struct memregion *memregion, ulong newsize);
|
||||||
int visor_memregion_read(struct memregion *memregion,
|
int visor_memregion_read(struct memregion *memregion,
|
||||||
ulong offset, void *dest, ulong nbytes);
|
ulong offset, void *dest, ulong nbytes);
|
||||||
|
|
|
@ -28,28 +28,6 @@
|
||||||
static int mapit(struct memregion *memregion);
|
static int mapit(struct memregion *memregion);
|
||||||
static void unmapit(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
|
static int
|
||||||
mapit(struct memregion *memregion)
|
mapit(struct memregion *memregion)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue