Commit a3b726c1 authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman

staging: unisys: visorbus: fix newlines for visorchannel

Remove extraneous blank lines and add some lines that are needed. General
philosophy -- declaration, space, pre-conditions (if needed), space, then
rest of function.
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarTim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 473659df
...@@ -57,6 +57,7 @@ void visorchannel_destroy(struct visorchannel *channel) ...@@ -57,6 +57,7 @@ void visorchannel_destroy(struct visorchannel *channel)
{ {
if (!channel) if (!channel)
return; return;
if (channel->mapped) { if (channel->mapped) {
memunmap(channel->mapped); memunmap(channel->mapped);
if (channel->requested) if (channel->requested)
...@@ -122,7 +123,6 @@ int visorchannel_read(struct visorchannel *channel, ulong offset, void *dest, ...@@ -122,7 +123,6 @@ int visorchannel_read(struct visorchannel *channel, ulong offset, void *dest,
return -EIO; return -EIO;
memcpy(dest, channel->mapped + offset, nbytes); memcpy(dest, channel->mapped + offset, nbytes);
return 0; return 0;
} }
...@@ -140,9 +140,7 @@ int visorchannel_write(struct visorchannel *channel, ulong offset, void *dest, ...@@ -140,9 +140,7 @@ int visorchannel_write(struct visorchannel *channel, ulong offset, void *dest,
memcpy(((char *)(&channel->chan_hdr)) + offset, memcpy(((char *)(&channel->chan_hdr)) + offset,
dest, copy_size); dest, copy_size);
} }
memcpy(channel->mapped + offset, dest, nbytes); memcpy(channel->mapped + offset, dest, nbytes);
return 0; return 0;
} }
...@@ -226,32 +224,25 @@ static int signalremove_inner(struct visorchannel *channel, u32 queue, ...@@ -226,32 +224,25 @@ static int signalremove_inner(struct visorchannel *channel, u32 queue,
error = sig_read_header(channel, queue, &sig_hdr); error = sig_read_header(channel, queue, &sig_hdr);
if (error) if (error)
return error; return error;
/* No signals to remove; have caller try again. */ /* No signals to remove; have caller try again. */
if (sig_hdr.head == sig_hdr.tail) if (sig_hdr.head == sig_hdr.tail)
return -EAGAIN; return -EAGAIN;
sig_hdr.tail = (sig_hdr.tail + 1) % sig_hdr.max_slots; sig_hdr.tail = (sig_hdr.tail + 1) % sig_hdr.max_slots;
error = sig_read_data(channel, queue, &sig_hdr, sig_hdr.tail, msg); error = sig_read_data(channel, queue, &sig_hdr, sig_hdr.tail, msg);
if (error) if (error)
return error; return error;
sig_hdr.num_received++; sig_hdr.num_received++;
/* /*
* For each data field in SIGNAL_QUEUE_HEADER that was modified, update * For each data field in SIGNAL_QUEUE_HEADER that was modified, update
* host memory. Required for channel sync. * host memory. Required for channel sync.
*/ */
mb(); mb();
error = SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail); error = SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail);
if (error) if (error)
return error; return error;
error = SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received); error = SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received);
if (error) if (error)
return error; return error;
return 0; return 0;
} }
...@@ -288,7 +279,6 @@ static bool queue_empty(struct visorchannel *channel, u32 queue) ...@@ -288,7 +279,6 @@ static bool queue_empty(struct visorchannel *channel, u32 queue)
if (sig_read_header(channel, queue, &sig_hdr)) if (sig_read_header(channel, queue, &sig_hdr))
return true; return true;
return (sig_hdr.head == sig_hdr.tail); return (sig_hdr.head == sig_hdr.tail);
} }
...@@ -308,11 +298,9 @@ bool visorchannel_signalempty(struct visorchannel *channel, u32 queue) ...@@ -308,11 +298,9 @@ bool visorchannel_signalempty(struct visorchannel *channel, u32 queue)
if (!channel->needs_lock) if (!channel->needs_lock)
return queue_empty(channel, queue); return queue_empty(channel, queue);
spin_lock_irqsave(&channel->remove_lock, flags); spin_lock_irqsave(&channel->remove_lock, flags);
rc = queue_empty(channel, queue); rc = queue_empty(channel, queue);
spin_unlock_irqrestore(&channel->remove_lock, flags); spin_unlock_irqrestore(&channel->remove_lock, flags);
return rc; return rc;
} }
EXPORT_SYMBOL_GPL(visorchannel_signalempty); EXPORT_SYMBOL_GPL(visorchannel_signalempty);
...@@ -326,7 +314,6 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, ...@@ -326,7 +314,6 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue,
err = sig_read_header(channel, queue, &sig_hdr); err = sig_read_header(channel, queue, &sig_hdr);
if (err) if (err)
return err; return err;
sig_hdr.head = (sig_hdr.head + 1) % sig_hdr.max_slots; sig_hdr.head = (sig_hdr.head + 1) % sig_hdr.max_slots;
if (sig_hdr.head == sig_hdr.tail) { if (sig_hdr.head == sig_hdr.tail) {
sig_hdr.num_overflows++; sig_hdr.num_overflows++;
...@@ -335,26 +322,21 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue, ...@@ -335,26 +322,21 @@ static int signalinsert_inner(struct visorchannel *channel, u32 queue,
return err; return err;
return -EIO; return -EIO;
} }
err = sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg); err = sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg);
if (err) if (err)
return err; return err;
sig_hdr.num_sent++; sig_hdr.num_sent++;
/* /*
* For each data field in SIGNAL_QUEUE_HEADER that was modified, update * For each data field in SIGNAL_QUEUE_HEADER that was modified, update
* host memory. Required for channel sync. * host memory. Required for channel sync.
*/ */
mb(); mb();
err = SIG_WRITE_FIELD(channel, queue, &sig_hdr, head); err = SIG_WRITE_FIELD(channel, queue, &sig_hdr, head);
if (err) if (err)
return err; return err;
err = SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_sent); err = SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_sent);
if (err) if (err)
return err; return err;
return 0; return 0;
} }
...@@ -386,11 +368,9 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, ...@@ -386,11 +368,9 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp,
channel = kzalloc(sizeof(*channel), gfp); channel = kzalloc(sizeof(*channel), gfp);
if (!channel) if (!channel)
return NULL; return NULL;
channel->needs_lock = needs_lock; channel->needs_lock = needs_lock;
spin_lock_init(&channel->insert_lock); spin_lock_init(&channel->insert_lock);
spin_lock_init(&channel->remove_lock); spin_lock_init(&channel->remove_lock);
/* /*
* Video driver constains the efi framebuffer so it will get a conflict * Video driver constains the efi framebuffer so it will get a conflict
* resource when requesting its full mem region. Since we are only * resource when requesting its full mem region. Since we are only
...@@ -401,21 +381,17 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, ...@@ -401,21 +381,17 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp,
if (!channel->requested && !guid_equal(guid, &visor_video_guid)) if (!channel->requested && !guid_equal(guid, &visor_video_guid))
/* we only care about errors if this is not the video channel */ /* we only care about errors if this is not the video channel */
goto err_destroy_channel; goto err_destroy_channel;
channel->mapped = memremap(physaddr, size, MEMREMAP_WB); channel->mapped = memremap(physaddr, size, MEMREMAP_WB);
if (!channel->mapped) { if (!channel->mapped) {
release_mem_region(physaddr, size); release_mem_region(physaddr, size);
goto err_destroy_channel; goto err_destroy_channel;
} }
channel->physaddr = physaddr; channel->physaddr = physaddr;
channel->nbytes = size; channel->nbytes = size;
err = visorchannel_read(channel, 0, &channel->chan_hdr, size); err = visorchannel_read(channel, 0, &channel->chan_hdr, size);
if (err) if (err)
goto err_destroy_channel; goto err_destroy_channel;
size = (ulong)channel->chan_hdr.size; size = (ulong)channel->chan_hdr.size;
memunmap(channel->mapped); memunmap(channel->mapped);
if (channel->requested) if (channel->requested)
release_mem_region(channel->physaddr, channel->nbytes); release_mem_region(channel->physaddr, channel->nbytes);
...@@ -425,13 +401,11 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp, ...@@ -425,13 +401,11 @@ static struct visorchannel *visorchannel_create_guts(u64 physaddr, gfp_t gfp,
if (!channel->requested && !guid_equal(guid, &visor_video_guid)) if (!channel->requested && !guid_equal(guid, &visor_video_guid))
/* we only care about errors if this is not the video channel */ /* we only care about errors if this is not the video channel */
goto err_destroy_channel; goto err_destroy_channel;
channel->mapped = memremap(channel->physaddr, size, MEMREMAP_WB); channel->mapped = memremap(channel->physaddr, size, MEMREMAP_WB);
if (!channel->mapped) { if (!channel->mapped) {
release_mem_region(channel->physaddr, size); release_mem_region(channel->physaddr, size);
goto err_destroy_channel; goto err_destroy_channel;
} }
channel->nbytes = size; channel->nbytes = size;
guid_copy(&channel->guid, guid); guid_copy(&channel->guid, guid);
return channel; return channel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment