Re: [PATCH] Fixed parentheses malpractice in apex_driver.c

2019-09-07 Thread Dan Carpenter
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


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Fixed parentheses malpractice in apex_driver.c

2019-09-07 Thread Sandro Volery


> On 7 Sep 2019, at 16:39, Dan Carpenter  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 
>> ---
>  ^^^
> 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
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Fixed parentheses malpractice in apex_driver.c

2019-09-07 Thread Dan Carpenter
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 
> ---
  ^^^
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

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Fixed parentheses malpractice in apex_driver.c

2019-09-06 Thread Joe Perches
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;


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Fixed parentheses malpractice in apex_driver.c

2019-09-06 Thread volery
There were some parentheses at the end of lines, which I took care of.
This is my first patch.

Signed-off-by: Sandro Volery 
---
 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

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel