From: Joe Perches <joe@perches.com> To: Mahak Gupta <gmahak1@gmail.com>, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, rcy@google.com, benchan@chromium.org, toddpoynor@google.com, rspringer@google.com Subject: Re: [PATCH] staging: gasket: fix indentation and lines ending with open parenthesis Date: Sun, 07 Feb 2021 09:46:50 -0800 [thread overview] Message-ID: <45cde3a597e932e3e81264034455582b21e72642.camel@perches.com> (raw) In-Reply-To: <20210207140928.11029-1-gmahak1@gmail.com> 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;
WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com> To: Mahak Gupta <gmahak1@gmail.com>, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, rcy@google.com, benchan@chromium.org, toddpoynor@google.com, rspringer@google.com Subject: Re: [PATCH] staging: gasket: fix indentation and lines ending with open parenthesis Date: Sun, 07 Feb 2021 09:46:50 -0800 [thread overview] Message-ID: <45cde3a597e932e3e81264034455582b21e72642.camel@perches.com> (raw) In-Reply-To: <20210207140928.11029-1-gmahak1@gmail.com> 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@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2021-02-07 17:47 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-07 14:09 [PATCH] staging: gasket: fix indentation and lines ending with open parenthesis Mahak Gupta 2021-02-07 14:09 ` Mahak Gupta 2021-02-07 14:35 ` Greg KH 2021-02-07 14:35 ` Greg KH 2021-02-07 16:31 ` Joe Perches 2021-02-07 16:31 ` Joe Perches 2021-02-07 17:46 ` Joe Perches [this message] 2021-02-07 17:46 ` Joe Perches 2021-02-08 2:55 Mahak Gupta 2021-02-08 2:55 ` Mahak Gupta
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=45cde3a597e932e3e81264034455582b21e72642.camel@perches.com \ --to=joe@perches.com \ --cc=benchan@chromium.org \ --cc=devel@driverdev.osuosl.org \ --cc=gmahak1@gmail.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-kernel@vger.kernel.org \ --cc=rcy@google.com \ --cc=rspringer@google.com \ --cc=toddpoynor@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.