Commit 52bcc7d9 authored by Roman Kiryanov's avatar Roman Kiryanov Committed by Greg Kroah-Hartman

platform: goldfish: pipe: Fix alignment to match parenthesis

checkpatch: Alignment should match open parenthesis.
Signed-off-by: default avatarRoman Kiryanov <rkir@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 562a74de
...@@ -252,10 +252,12 @@ static int goldfish_pipe_error_convert(int status) ...@@ -252,10 +252,12 @@ static int goldfish_pipe_error_convert(int status)
} }
} }
static int pin_user_pages(unsigned long first_page, unsigned long last_page, static int pin_user_pages(unsigned long first_page,
unsigned int last_page_size, int is_write, unsigned long last_page,
struct page *pages[MAX_BUFFERS_PER_COMMAND], unsigned int last_page_size,
unsigned int *iter_last_page_size) int is_write,
struct page *pages[MAX_BUFFERS_PER_COMMAND],
unsigned int *iter_last_page_size)
{ {
int ret; int ret;
int requested_pages = ((last_page - first_page) >> PAGE_SHIFT) + 1; int requested_pages = ((last_page - first_page) >> PAGE_SHIFT) + 1;
...@@ -267,8 +269,8 @@ static int pin_user_pages(unsigned long first_page, unsigned long last_page, ...@@ -267,8 +269,8 @@ static int pin_user_pages(unsigned long first_page, unsigned long last_page,
*iter_last_page_size = last_page_size; *iter_last_page_size = last_page_size;
} }
ret = get_user_pages_fast( ret = get_user_pages_fast(first_page, requested_pages, !is_write,
first_page, requested_pages, !is_write, pages); pages);
if (ret <= 0) if (ret <= 0)
return -EFAULT; return -EFAULT;
if (ret < requested_pages) if (ret < requested_pages)
...@@ -278,7 +280,7 @@ static int pin_user_pages(unsigned long first_page, unsigned long last_page, ...@@ -278,7 +280,7 @@ static int pin_user_pages(unsigned long first_page, unsigned long last_page,
} }
static void release_user_pages(struct page **pages, int pages_count, static void release_user_pages(struct page **pages, int pages_count,
int is_write, s32 consumed_size) int is_write, s32 consumed_size)
{ {
int i; int i;
...@@ -290,12 +292,15 @@ static void release_user_pages(struct page **pages, int pages_count, ...@@ -290,12 +292,15 @@ static void release_user_pages(struct page **pages, int pages_count,
} }
/* Populate the call parameters, merging adjacent pages together */ /* Populate the call parameters, merging adjacent pages together */
static void populate_rw_params( static void populate_rw_params(struct page **pages,
struct page **pages, int pages_count, int pages_count,
unsigned long address, unsigned long address_end, unsigned long address,
unsigned long first_page, unsigned long last_page, unsigned long address_end,
unsigned int iter_last_page_size, int is_write, unsigned long first_page,
struct goldfish_pipe_command *command) unsigned long last_page,
unsigned int iter_last_page_size,
int is_write,
struct goldfish_pipe_command *command)
{ {
/* /*
* Process the first page separately - it's the only page that * Process the first page separately - it's the only page that
...@@ -327,16 +332,20 @@ static void populate_rw_params( ...@@ -327,16 +332,20 @@ static void populate_rw_params(
} }
static int transfer_max_buffers(struct goldfish_pipe *pipe, static int transfer_max_buffers(struct goldfish_pipe *pipe,
unsigned long address, unsigned long address_end, int is_write, unsigned long address,
unsigned long last_page, unsigned int last_page_size, unsigned long address_end,
s32 *consumed_size, int *status) int is_write,
unsigned long last_page,
unsigned int last_page_size,
s32 *consumed_size,
int *status)
{ {
static struct page *pages[MAX_BUFFERS_PER_COMMAND]; static struct page *pages[MAX_BUFFERS_PER_COMMAND];
unsigned long first_page = address & PAGE_MASK; unsigned long first_page = address & PAGE_MASK;
unsigned int iter_last_page_size; unsigned int iter_last_page_size;
int pages_count = pin_user_pages(first_page, last_page, int pages_count = pin_user_pages(first_page, last_page,
last_page_size, is_write, last_page_size, is_write,
pages, &iter_last_page_size); pages, &iter_last_page_size);
if (pages_count < 0) if (pages_count < 0)
return pages_count; return pages_count;
...@@ -346,8 +355,8 @@ static int transfer_max_buffers(struct goldfish_pipe *pipe, ...@@ -346,8 +355,8 @@ static int transfer_max_buffers(struct goldfish_pipe *pipe,
return -ERESTARTSYS; return -ERESTARTSYS;
populate_rw_params(pages, pages_count, address, address_end, populate_rw_params(pages, pages_count, address, address_end,
first_page, last_page, iter_last_page_size, is_write, first_page, last_page, iter_last_page_size, is_write,
pipe->command_buffer); pipe->command_buffer);
/* Transfer the data */ /* Transfer the data */
*status = goldfish_pipe_cmd_locked(pipe, *status = goldfish_pipe_cmd_locked(pipe,
...@@ -374,7 +383,7 @@ static int wait_for_host_signal(struct goldfish_pipe *pipe, int is_write) ...@@ -374,7 +383,7 @@ static int wait_for_host_signal(struct goldfish_pipe *pipe, int is_write)
while (test_bit(wake_bit, &pipe->flags)) { while (test_bit(wake_bit, &pipe->flags)) {
if (wait_event_interruptible(pipe->wake_queue, if (wait_event_interruptible(pipe->wake_queue,
!test_bit(wake_bit, &pipe->flags))) !test_bit(wake_bit, &pipe->flags)))
return -ERESTARTSYS; return -ERESTARTSYS;
if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags)) if (test_bit(BIT_CLOSED_ON_HOST, &pipe->flags))
...@@ -385,7 +394,9 @@ static int wait_for_host_signal(struct goldfish_pipe *pipe, int is_write) ...@@ -385,7 +394,9 @@ static int wait_for_host_signal(struct goldfish_pipe *pipe, int is_write)
} }
static ssize_t goldfish_pipe_read_write(struct file *filp, static ssize_t goldfish_pipe_read_write(struct file *filp,
char __user *buffer, size_t bufflen, int is_write) char __user *buffer,
size_t bufflen,
int is_write)
{ {
struct goldfish_pipe *pipe = filp->private_data; struct goldfish_pipe *pipe = filp->private_data;
int count = 0, ret = -EINVAL; int count = 0, ret = -EINVAL;
...@@ -400,7 +411,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, ...@@ -400,7 +411,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp,
return 0; return 0;
/* Check the buffer range for access */ /* Check the buffer range for access */
if (unlikely(!access_ok(is_write ? VERIFY_WRITE : VERIFY_READ, if (unlikely(!access_ok(is_write ? VERIFY_WRITE : VERIFY_READ,
buffer, bufflen))) buffer, bufflen)))
return -EFAULT; return -EFAULT;
address = (unsigned long)buffer; address = (unsigned long)buffer;
...@@ -413,8 +424,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, ...@@ -413,8 +424,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp,
int status; int status;
ret = transfer_max_buffers(pipe, address, address_end, is_write, ret = transfer_max_buffers(pipe, address, address_end, is_write,
last_page, last_page_size, &consumed_size, last_page, last_page_size,
&status); &consumed_size, &status);
if (ret < 0) if (ret < 0)
break; break;
...@@ -467,19 +478,21 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, ...@@ -467,19 +478,21 @@ static ssize_t goldfish_pipe_read_write(struct file *filp,
} }
static ssize_t goldfish_pipe_read(struct file *filp, char __user *buffer, static ssize_t goldfish_pipe_read(struct file *filp, char __user *buffer,
size_t bufflen, loff_t *ppos) size_t bufflen, loff_t *ppos)
{ {
return goldfish_pipe_read_write(filp, buffer, bufflen, return goldfish_pipe_read_write(filp, buffer, bufflen,
/* is_write */ 0); /* is_write */ 0);
} }
static ssize_t goldfish_pipe_write(struct file *filp, static ssize_t goldfish_pipe_write(struct file *filp,
const char __user *buffer, size_t bufflen, const char __user *buffer, size_t bufflen,
loff_t *ppos) loff_t *ppos)
{ {
return goldfish_pipe_read_write(filp, /* cast away the const */
/* cast away the const */(char __user *)buffer, bufflen, char __user *no_const_buffer = (char __user *)buffer;
/* is_write */ 1);
return goldfish_pipe_read_write(filp, no_const_buffer, bufflen,
/* is_write */ 1);
} }
static __poll_t goldfish_pipe_poll(struct file *filp, poll_table *wait) static __poll_t goldfish_pipe_poll(struct file *filp, poll_table *wait)
...@@ -507,7 +520,7 @@ static __poll_t goldfish_pipe_poll(struct file *filp, poll_table *wait) ...@@ -507,7 +520,7 @@ static __poll_t goldfish_pipe_poll(struct file *filp, poll_table *wait)
} }
static void signalled_pipes_add_locked(struct goldfish_pipe_dev *dev, static void signalled_pipes_add_locked(struct goldfish_pipe_dev *dev,
u32 id, u32 flags) u32 id, u32 flags)
{ {
struct goldfish_pipe *pipe; struct goldfish_pipe *pipe;
...@@ -529,7 +542,7 @@ static void signalled_pipes_add_locked(struct goldfish_pipe_dev *dev, ...@@ -529,7 +542,7 @@ static void signalled_pipes_add_locked(struct goldfish_pipe_dev *dev,
} }
static void signalled_pipes_remove_locked(struct goldfish_pipe_dev *dev, static void signalled_pipes_remove_locked(struct goldfish_pipe_dev *dev,
struct goldfish_pipe *pipe) struct goldfish_pipe *pipe)
{ {
if (pipe->prev_signalled) if (pipe->prev_signalled)
pipe->prev_signalled->next_signalled = pipe->next_signalled; pipe->prev_signalled->next_signalled = pipe->next_signalled;
...@@ -805,7 +818,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) ...@@ -805,7 +818,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev)
dev->first_signalled_pipe = NULL; dev->first_signalled_pipe = NULL;
dev->pipes_capacity = INITIAL_PIPES_CAPACITY; dev->pipes_capacity = INITIAL_PIPES_CAPACITY;
dev->pipes = kcalloc(dev->pipes_capacity, sizeof(*dev->pipes), dev->pipes = kcalloc(dev->pipes_capacity, sizeof(*dev->pipes),
GFP_KERNEL); GFP_KERNEL);
if (!dev->pipes) if (!dev->pipes)
return -ENOMEM; return -ENOMEM;
......
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