lkml.org 
[lkml]   [2021]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] staging: gasket: fix indentation and lines ending with open parenthesis
Date
This patch fixes warnings of 'checkpatch.pl'. According to
Linux coding guidelines, code should be aligned properly to
match with open parenthesis and lines should not end with
open parenthesis.

Signed-off-by: Mahak Gupta <gmahak1@gmail.com>
---
Changes since v1:
- Use temporary variables to shorten long lines. This variable was used multiple times.
---
drivers/staging/gasket/gasket_ioctl.c | 42 ++++++++++++++-------------
1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c
index e3047d36d8db..aa65f4fbf860 100644
--- a/drivers/staging/gasket/gasket_ioctl.c
+++ b/drivers/staging/gasket/gasket_ioctl.c
@@ -40,10 +40,11 @@ static int gasket_set_event_fd(struct gasket_dev *gasket_dev,

/* Read the size of the page table. */
static int gasket_read_page_table_size(struct gasket_dev *gasket_dev,
- struct gasket_page_table_ioctl __user *argp)
+ struct gasket_page_table_ioctl __user *argp)
{
int ret = 0;
struct gasket_page_table_ioctl ibuf;
+ struct gasket_page_table *table;

if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl)))
return -EFAULT;
@@ -51,8 +52,8 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev,
if (ibuf.page_table_index >= gasket_dev->num_page_tables)
return -EFAULT;

- ibuf.size = gasket_page_table_num_entries(
- gasket_dev->page_table[ibuf.page_table_index]);
+ table = gasket_dev->page_table[ibuf.page_table_index];
+ ibuf.size = gasket_page_table_num_entries(table);

trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size,
ibuf.host_address,
@@ -66,10 +67,11 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev,

/* Read the size of the simple page table. */
static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev,
- struct gasket_page_table_ioctl __user *argp)
+ struct gasket_page_table_ioctl __user *argp)
{
int ret = 0;
struct gasket_page_table_ioctl ibuf;
+ struct gasket_page_table *table;

if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl)))
return -EFAULT;
@@ -77,8 +79,8 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev,
if (ibuf.page_table_index >= gasket_dev->num_page_tables)
return -EFAULT;

- ibuf.size =
- gasket_page_table_num_simple_entries(gasket_dev->page_table[ibuf.page_table_index]);
+ table = gasket_dev->page_table[ibuf.page_table_index];
+ ibuf.size = gasket_page_table_num_simple_entries(table);

trace_gasket_ioctl_page_table_data(ibuf.page_table_index, ibuf.size,
ibuf.host_address,
@@ -92,11 +94,12 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev,

/* Set the boundary between the simple and extended page tables. */
static int gasket_partition_page_table(struct gasket_dev *gasket_dev,
- struct gasket_page_table_ioctl __user *argp)
+ struct gasket_page_table_ioctl __user *argp)
{
int ret;
struct gasket_page_table_ioctl ibuf;
uint max_page_table_size;
+ struct gasket_page_table *table;

if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl)))
return -EFAULT;
@@ -107,8 +110,8 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev,

if (ibuf.page_table_index >= gasket_dev->num_page_tables)
return -EFAULT;
- max_page_table_size = gasket_page_table_max_size(
- gasket_dev->page_table[ibuf.page_table_index]);
+ table = gasket_dev->page_table[ibuf.page_table_index];
+ max_page_table_size = gasket_page_table_max_size(table);

if (ibuf.size > max_page_table_size) {
dev_dbg(gasket_dev->dev,
@@ -119,8 +122,7 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev,

mutex_lock(&gasket_dev->mutex);

- ret = gasket_page_table_partition(
- gasket_dev->page_table[ibuf.page_table_index], ibuf.size);
+ ret = gasket_page_table_partition(table, ibuf.size);
mutex_unlock(&gasket_dev->mutex);

return ret;
@@ -131,6 +133,7 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev,
struct gasket_page_table_ioctl __user *argp)
{
struct gasket_page_table_ioctl ibuf;
+ struct gasket_page_table *table;

if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl)))
return -EFAULT;
@@ -142,13 +145,12 @@ static int gasket_map_buffers(struct gasket_dev *gasket_dev,
if (ibuf.page_table_index >= gasket_dev->num_page_tables)
return -EFAULT;

- if (gasket_page_table_are_addrs_bad(gasket_dev->page_table[ibuf.page_table_index],
- ibuf.host_address,
+ table = gasket_dev->page_table[ibuf.page_table_index];
+ if (gasket_page_table_are_addrs_bad(table, ibuf.host_address,
ibuf.device_address, ibuf.size))
return -EINVAL;

- return gasket_page_table_map(gasket_dev->page_table[ibuf.page_table_index],
- ibuf.host_address, ibuf.device_address,
+ return gasket_page_table_map(table, ibuf.host_address, ibuf.device_address,
ibuf.size / PAGE_SIZE);
}

@@ -157,6 +159,7 @@ static int gasket_unmap_buffers(struct gasket_dev *gasket_dev,
struct gasket_page_table_ioctl __user *argp)
{
struct gasket_page_table_ioctl ibuf;
+ struct gasket_page_table *table;

if (copy_from_user(&ibuf, argp, sizeof(struct gasket_page_table_ioctl)))
return -EFAULT;
@@ -168,12 +171,11 @@ static int gasket_unmap_buffers(struct gasket_dev *gasket_dev,
if (ibuf.page_table_index >= gasket_dev->num_page_tables)
return -EFAULT;

- if (gasket_page_table_is_dev_addr_bad(gasket_dev->page_table[ibuf.page_table_index],
- ibuf.device_address, ibuf.size))
+ table = gasket_dev->page_table[ibuf.page_table_index];
+ if (gasket_page_table_is_dev_addr_bad(table, ibuf.device_address, ibuf.size))
return -EINVAL;

- gasket_page_table_unmap(gasket_dev->page_table[ibuf.page_table_index],
- ibuf.device_address, ibuf.size / PAGE_SIZE);
+ gasket_page_table_unmap(table, ibuf.device_address, ibuf.size / PAGE_SIZE);

return 0;
}
@@ -183,7 +185,7 @@ static int gasket_unmap_buffers(struct gasket_dev *gasket_dev,
* corresponding memory.
*/
static int gasket_config_coherent_allocator(struct gasket_dev *gasket_dev,
- struct gasket_coherent_alloc_config_ioctl __user *argp)
+ struct gasket_coherent_alloc_config_ioctl __user *argp)
{
int ret;
struct gasket_coherent_alloc_config_ioctl ibuf;
--
2.17.1
\
 
 \ /
  Last update: 2021-02-08 04:01    [W:0.028 / U:4.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site