linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fixed parentheses malpractice in apex_driver.c
@ 2019-09-06 18:38 volery
  2019-09-06 20:55 ` Joe Perches
  2019-09-07 14:38 ` Dan Carpenter
  0 siblings, 2 replies; 12+ messages in thread
From: volery @ 2019-09-06 18:38 UTC (permalink / raw)
  To: rspringer, toddpoynor, benchan, gregkh, devel, linux-kernel

There were some parentheses at the end of lines, which I took care of.
This is my first patch.

Signed-off-by: Sandro Volery <sandro@volery.com>
---
 drivers/staging/gasket/apex_driver.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
index 464648ee2036..78ebd590f877 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -527,17 +527,20 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr,
 	switch (type) {
 	case ATTR_KERNEL_HIB_PAGE_TABLE_SIZE:
 		ret = scnprintf(buf, PAGE_SIZE, "%u\n",
-				gasket_page_table_num_entries(
+				gasket_page_table_num_entries
+				(
 					gasket_dev->page_table[0]));
 		break;
 	case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE:
 		ret = scnprintf(buf, PAGE_SIZE, "%u\n",
-				gasket_page_table_num_simple_entries(
+				gasket_page_table_num_simple_entries
+				(
 					gasket_dev->page_table[0]));
 		break;
 	case ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES:
 		ret = scnprintf(buf, PAGE_SIZE, "%u\n",
-				gasket_page_table_num_active_pages(
+				gasket_page_table_num_active_pages
+				(
 					gasket_dev->page_table[0]));
 		break;
 	default:
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-06 18:38 [PATCH] Fixed parentheses malpractice in apex_driver.c volery
@ 2019-09-06 20:55 ` Joe Perches
  2019-09-07 14:38 ` Dan Carpenter
  1 sibling, 0 replies; 12+ messages in thread
From: Joe Perches @ 2019-09-06 20:55 UTC (permalink / raw)
  To: volery, rspringer, toddpoynor, benchan, gregkh, devel, linux-kernel

On Fri, 2019-09-06 at 20:38 +0200, volery wrote:
> There were some parentheses at the end of lines, which I took care of.

Not every instance of this checkpatch warning should be changed.

This specific instance is because it uses very long identifiers
and really maybe should just be left alone.

> This is my first patch.

Welcome, try again though.

If you really want to do something here maybe do something like
use temporaries to reduce line length and remove multiple
scnprintf statements.  This would also reduce object size.

---
 drivers/staging/gasket/apex_driver.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
index 2973bb920a26..ae1a3a14dde6 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -509,6 +509,8 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr,
 	struct gasket_dev *gasket_dev;
 	struct gasket_sysfs_attribute *gasket_attr;
 	enum sysfs_attribute_type type;
+	struct gasket_page_table *gpt;
+	uint val;
 
 	gasket_dev = gasket_sysfs_get_device_data(device);
 	if (!gasket_dev) {
@@ -524,29 +526,27 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr,
 	}
 
 	type = (enum sysfs_attribute_type)gasket_attr->data.attr_type;
+	gpt = gasket_dev->page_table[0];
 	switch (type) {
 	case ATTR_KERNEL_HIB_PAGE_TABLE_SIZE:
-		ret = scnprintf(buf, PAGE_SIZE, "%u\n",
-				gasket_page_table_num_entries(
-					gasket_dev->page_table[0]));
+		val = gasket_page_table_num_entries(gpt);
 		break;
 	case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE:
-		ret = scnprintf(buf, PAGE_SIZE, "%u\n",
-				gasket_page_table_num_simple_entries(
-					gasket_dev->page_table[0]));
+		val = gasket_page_table_num_simple_entries(gpt);
 		break;
 	case ATTR_KERNEL_HIB_NUM_ACTIVE_PAGES:
-		ret = scnprintf(buf, PAGE_SIZE, "%u\n",
-				gasket_page_table_num_active_pages(
-					gasket_dev->page_table[0]));
+		val = gasket_page_table_num_active_pages(gpt);
 		break;
 	default:
 		dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n",
 			attr->attr.name);
 		ret = 0;
-		break;
+		goto exit;
 	}
 
+	ret = scnprintf(buf, PAGE_SIZE, "%u\n", val);
+
+exit:
 	gasket_sysfs_put_attr(device, gasket_attr);
 	gasket_sysfs_put_device_data(device, gasket_dev);
 	return ret;



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-06 18:38 [PATCH] Fixed parentheses malpractice in apex_driver.c volery
  2019-09-06 20:55 ` Joe Perches
@ 2019-09-07 14:38 ` Dan Carpenter
  2019-09-07 14:48   ` Sandro Volery
  1 sibling, 1 reply; 12+ messages in thread
From: Dan Carpenter @ 2019-09-07 14:38 UTC (permalink / raw)
  To: volery; +Cc: rspringer, toddpoynor, benchan, gregkh, devel, linux-kernel

You need a subject prefix.  It should be something like:

[PATCH] Staging: gasket: Fix parentheses malpractice in apex_driver.c

Generally "Fix" is considered better style than "Fixed".  We aren't
going to care about that in staging, but the patch prefix is mandatory
so you will need to redo it anyway and might as well fix that as well.

On Fri, Sep 06, 2019 at 08:38:01PM +0200, volery wrote:
> There were some parentheses at the end of lines, which I took care of.
> This is my first patch.
  ^^^^^^^^^^^^^^^^^^^^^^

Put this sort of comments after the --- cut off line

> 
> Signed-off-by: Sandro Volery <sandro@volery.com>
> ---
  ^^^
Put it here.  It will be removed when we apply the patch so it won't
be recorded in the git log.

>  drivers/staging/gasket/apex_driver.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Joe's comments are, of course, correct as well.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-07 14:38 ` Dan Carpenter
@ 2019-09-07 14:48   ` Sandro Volery
  2019-09-07 14:52     ` Dan Carpenter
  0 siblings, 1 reply; 12+ messages in thread
From: Sandro Volery @ 2019-09-07 14:48 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: rspringer, toddpoynor, benchan, gregkh, devel, linux-kernel



> On 7 Sep 2019, at 16:39, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> You need a subject prefix.  It should be something like:
> 
> [PATCH] Staging: gasket: Fix parentheses malpractice in apex_driver.c
> 

Thanks for the reply! I'll try to do that better for my next patch.

> Generally "Fix" is considered better style than "Fixed".  We aren't
> going to care about that in staging, but the patch prefix is mandatory
> so you will need to redo it anyway and might as well fix that as well.
> 
>> On Fri, Sep 06, 2019 at 08:38:01PM +0200, volery wrote:
>> There were some parentheses at the end of lines, which I took care of.
>> This is my first patch.
>  ^^^^^^^^^^^^^^^^^^^^^^
> Put this sort of comments after the --- cut off line
> 
>> 
>> Signed-off-by: Sandro Volery <sandro@volery.com>
>> ---
>  ^^^
> Put it here.  It will be removed when we apply the patch so it won't
> be recorded in the git log.
> 

Alright :)

>> drivers/staging/gasket/apex_driver.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
> 
> Joe's comments are, of course, correct as well.
> 
> regards,
> dan carpenter
> 

I'll take a look at Joe's suggestions too sometime tonight. I'd feel kinda bad tho if I just apply his work and send it in?

- Sandro Volery

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-07 14:48   ` Sandro Volery
@ 2019-09-07 14:52     ` Dan Carpenter
  0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2019-09-07 14:52 UTC (permalink / raw)
  To: Sandro Volery; +Cc: rspringer, toddpoynor, benchan, gregkh, devel, linux-kernel

On Sat, Sep 07, 2019 at 04:48:21PM +0200, Sandro Volery wrote:
> > Joe's comments are, of course, correct as well.
> > 
> > regards,
> > dan carpenter
> > 
> 
> I'll take a look at Joe's suggestions too sometime tonight. I'd feel kinda bad tho if I just apply his work and send it in?

Don't feel bad.  Just do it.  Give him credit in the commit message if
you want.  "Thanks to Joe Perches for his help."

I sometimes give people word for word patches and they don't copy it
exactly and I wonder if this is why...  My exact patch was the best one.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-09 16:14         ` Joe Perches
@ 2019-09-09 16:36           ` Sandro Volery
  0 siblings, 0 replies; 12+ messages in thread
From: Sandro Volery @ 2019-09-09 16:36 UTC (permalink / raw)
  To: Joe Perches; +Cc: Dan Carpenter, linux-kernel



> On 9 Sep 2019, at 18:15, Joe Perches <joe@perches.com> wrote:
> 
> On Sat, 2019-09-07 at 18:12 +0200, Sandro Volery wrote:
>> Alright, I'll do that when I get home tonight!
> 
> I'm going to assume this is not an actual problem.
> 

Oh yeah I'm sorry, I was all busy reading documentations 
about the Kernel and stuff ;)
I got it to work, I actually just had my gitconfig name set as 'volery'.

Thanks




>> Thanks,
>> Sandro V
>> 
>>>> On 7 Sep 2019, at 18:08, Joe Perches <joe@perches.com> wrote:
>>> 
>>> On Sat, 2019-09-07 at 17:56 +0200, Sandro Volery wrote:
>>>>>> On 7 Sep 2019, at 17:44, Joe Perches <joe@perches.com> wrote:
>>>>> 
>>>>> On Sat, 2019-09-07 at 17:34 +0200, Sandro Volery wrote:
>>>>>> On patchwork I entered 'volery' as my username because I didn't know better, and now checkpatch always complains when I add 'signed-off-by' with my actual full name.
>>>>> 
>>>>> How does checkpatch complain?
>>>>> There is no connection between patchwork
>>>>> and checkpatch.
>>>> 
>>>> Checkpatch tells me that I haven't used 'volery' as
>>>> my signed off name.
>>> 
>>> Please send the both the patch and the actual checkpatch output
>>> you get when running 'perl ./scripts/checkpatch.pl <patch>'
>>> 
>>> If this patch is a commit in your own local git tree:
>>> 
>>> $ git format-patch -1 --stdout <commit_id> > tmp
>>> $ perl ./scripts/checkpatch.pl --strict tmp
>>> 
>>> and send tmp and the checkpatch output.
>>> 
>>> 
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-07 16:12       ` Sandro Volery
@ 2019-09-09 16:14         ` Joe Perches
  2019-09-09 16:36           ` Sandro Volery
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2019-09-09 16:14 UTC (permalink / raw)
  To: Sandro Volery; +Cc: Dan Carpenter, linux-kernel

On Sat, 2019-09-07 at 18:12 +0200, Sandro Volery wrote:
> Alright, I'll do that when I get home tonight!

I'm going to assume this is not an actual problem.

> Thanks,
> Sandro V
> 
> > On 7 Sep 2019, at 18:08, Joe Perches <joe@perches.com> wrote:
> > 
> > On Sat, 2019-09-07 at 17:56 +0200, Sandro Volery wrote:
> > > > > On 7 Sep 2019, at 17:44, Joe Perches <joe@perches.com> wrote:
> > > > 
> > > > On Sat, 2019-09-07 at 17:34 +0200, Sandro Volery wrote:
> > > > > On patchwork I entered 'volery' as my username because I didn't know better, and now checkpatch always complains when I add 'signed-off-by' with my actual full name.
> > > > 
> > > > How does checkpatch complain?
> > > > There is no connection between patchwork
> > > > and checkpatch.
> > > 
> > > Checkpatch tells me that I haven't used 'volery' as
> > > my signed off name.
> > 
> > Please send the both the patch and the actual checkpatch output
> > you get when running 'perl ./scripts/checkpatch.pl <patch>'
> > 
> > If this patch is a commit in your own local git tree:
> > 
> > $ git format-patch -1 --stdout <commit_id> > tmp
> > $ perl ./scripts/checkpatch.pl --strict tmp
> > 
> > and send tmp and the checkpatch output.
> > 
> > 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-07 16:08     ` Joe Perches
@ 2019-09-07 16:12       ` Sandro Volery
  2019-09-09 16:14         ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Sandro Volery @ 2019-09-07 16:12 UTC (permalink / raw)
  To: Joe Perches; +Cc: Dan Carpenter, linux-kernel

Alright, I'll do that when I get home tonight!

Thanks,
Sandro V

> On 7 Sep 2019, at 18:08, Joe Perches <joe@perches.com> wrote:
> 
> On Sat, 2019-09-07 at 17:56 +0200, Sandro Volery wrote:
>>>> On 7 Sep 2019, at 17:44, Joe Perches <joe@perches.com> wrote:
>>> 
>>> On Sat, 2019-09-07 at 17:34 +0200, Sandro Volery wrote:
>>>> On patchwork I entered 'volery' as my username because I didn't know better, and now checkpatch always complains when I add 'signed-off-by' with my actual full name.
>>> 
>>> How does checkpatch complain?
>>> There is no connection between patchwork
>>> and checkpatch.
>> 
>> Checkpatch tells me that I haven't used 'volery' as
>> my signed off name.
> 
> Please send the both the patch and the actual checkpatch output
> you get when running 'perl ./scripts/checkpatch.pl <patch>'
> 
> If this patch is a commit in your own local git tree:
> 
> $ git format-patch -1 --stdout <commit_id> > tmp
> $ perl ./scripts/checkpatch.pl --strict tmp
> 
> and send tmp and the checkpatch output.
> 
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-07 15:56   ` Sandro Volery
@ 2019-09-07 16:08     ` Joe Perches
  2019-09-07 16:12       ` Sandro Volery
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2019-09-07 16:08 UTC (permalink / raw)
  To: Sandro Volery; +Cc: Dan Carpenter, linux-kernel

On Sat, 2019-09-07 at 17:56 +0200, Sandro Volery wrote:
> > On 7 Sep 2019, at 17:44, Joe Perches <joe@perches.com> wrote:
> > 
> > On Sat, 2019-09-07 at 17:34 +0200, Sandro Volery wrote:
> > > On patchwork I entered 'volery' as my username because I didn't know better, and now checkpatch always complains when I add 'signed-off-by' with my actual full name.
> > 
> > How does checkpatch complain?
> > There is no connection between patchwork
> > and checkpatch.
> 
> Checkpatch tells me that I haven't used 'volery' as
> my signed off name.

Please send the both the patch and the actual checkpatch output
you get when running 'perl ./scripts/checkpatch.pl <patch>'

If this patch is a commit in your own local git tree:

$ git format-patch -1 --stdout <commit_id> > tmp
$ perl ./scripts/checkpatch.pl --strict tmp

and send tmp and the checkpatch output.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-07 15:44 ` Joe Perches
@ 2019-09-07 15:56   ` Sandro Volery
  2019-09-07 16:08     ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Sandro Volery @ 2019-09-07 15:56 UTC (permalink / raw)
  To: Joe Perches; +Cc: Dan Carpenter, linux-kernel



> On 7 Sep 2019, at 17:44, Joe Perches <joe@perches.com> wrote:
> 
> On Sat, 2019-09-07 at 17:34 +0200, Sandro Volery wrote:
>> On patchwork I entered 'volery' as my username because I didn't know better, and now checkpatch always complains when I add 'signed-off-by' with my actual full name.
> 
> How does checkpatch complain?
> There is no connection between patchwork
> and checkpatch.

Checkpatch tells me that I haven't used 'volery' as
my signed off name.


> 
> And do please set your email client to use shorter line lengths
> or remember to add returns.
> 
> 72 or so is typical.
> 

Alright! Using my phone right now as I
am out of office but will do :)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
  2019-09-07 15:34 Sandro Volery
@ 2019-09-07 15:44 ` Joe Perches
  2019-09-07 15:56   ` Sandro Volery
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2019-09-07 15:44 UTC (permalink / raw)
  To: Sandro Volery, Dan Carpenter; +Cc: linux-kernel

On Sat, 2019-09-07 at 17:34 +0200, Sandro Volery wrote:
> On patchwork I entered 'volery' as my username because I didn't know better, and now checkpatch always complains when I add 'signed-off-by' with my actual full name.

How does checkpatch complain?
There is no connection between patchwork
and checkpatch.

And do please set your email client to use shorter line lengths
or remember to add returns.

72 or so is typical.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Fixed parentheses malpractice in apex_driver.c
@ 2019-09-07 15:34 Sandro Volery
  2019-09-07 15:44 ` Joe Perches
  0 siblings, 1 reply; 12+ messages in thread
From: Sandro Volery @ 2019-09-07 15:34 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-kernel



> On 7 Sep 2019, at 16:52, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 

Alright, thanks!

Some stupid other question:

On patchwork I entered 'volery' as my username because I didn't know better, and now checkpatch always complains when I add 'signed-off-by' with my actual full name.

How can I avoid that?

Regards,
Sandro V.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-09-09 16:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 18:38 [PATCH] Fixed parentheses malpractice in apex_driver.c volery
2019-09-06 20:55 ` Joe Perches
2019-09-07 14:38 ` Dan Carpenter
2019-09-07 14:48   ` Sandro Volery
2019-09-07 14:52     ` Dan Carpenter
2019-09-07 15:34 Sandro Volery
2019-09-07 15:44 ` Joe Perches
2019-09-07 15:56   ` Sandro Volery
2019-09-07 16:08     ` Joe Perches
2019-09-07 16:12       ` Sandro Volery
2019-09-09 16:14         ` Joe Perches
2019-09-09 16:36           ` Sandro Volery

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).