On Sun, 2021-02-07 at 19:39 +0530, Mahak Gupta wrote: > 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. Perhaps try using temporaries to reduce line length when used multiple times... Something like: --- drivers/staging/gasket/gasket_ioctl.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c index e3047d36d8db..3cb2227d5972 100644 --- a/drivers/staging/gasket/gasket_ioctl.c +++ b/drivers/staging/gasket/gasket_ioctl.c @@ -44,6 +44,7 @@ static int gasket_read_page_table_size(struct gasket_dev *gasket_dev, { 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, @@ -70,6 +71,7 @@ static int gasket_read_simple_page_table_size(struct gasket_dev *gasket_dev, { 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, @@ -97,6 +99,7 @@ static int gasket_partition_page_table(struct gasket_dev *gasket_dev, 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,9 @@ 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 +123,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 +134,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,12 +146,13 @@ 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], + 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], + return gasket_page_table_map(table, ibuf.host_address, ibuf.device_address, ibuf.size / PAGE_SIZE); } @@ -157,6 +162,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,11 +174,12 @@ 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], + 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], + gasket_page_table_unmap(table, ibuf.device_address, ibuf.size / PAGE_SIZE); return 0; _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel