All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: gasket: Create a new variable to improve readability
@ 2019-03-16 19:54 anushkacharu9
  2019-03-17 10:13 ` [Outreachy kernel] " Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: anushkacharu9 @ 2019-03-16 19:54 UTC (permalink / raw)
  To: gregkh, outreachy-kernel; +Cc: Anushka Shukla

From: Anushka Shukla <anushkacharu9@gmail.com>

- Define a new variable temp_table.
- Modify it to maintain Linux Kernel Coding style.

Signed-off-by: Anushka Shukla <anushkacharu9@gmail.com>
---
 drivers/staging/gasket/apex_driver.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
index 7c2ffa467557..d0fffb51c9c4 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -526,21 +526,22 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr,
 	}
 
 	type = (enum sysfs_attribute_type)gasket_attr->data.attr_type;
+	struct gasket_page_table *temp_table = 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]));
+				gasket_page_table_num_entries(temp_table);
+				       
 		break;
 	case ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE:
 		ret = scnprintf(buf, PAGE_SIZE, "%u\n",
-				gasket_page_table_num_entries
-				       (gasket_dev->page_table[0]));
+				gasket_page_table_num_entries(temp_table);
+				       
 		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]));
+				gasket_page_table_num_active_pages(temp_table);
+				       
 		break;
 	default:
 		dev_dbg(gasket_dev->dev, "Unknown attribute: %s\n",
-- 
2.17.1



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

* Re: [Outreachy kernel] [PATCH] Staging: gasket: Create a new variable to improve readability
  2019-03-16 19:54 [PATCH] Staging: gasket: Create a new variable to improve readability anushkacharu9
@ 2019-03-17 10:13 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-03-17 10:13 UTC (permalink / raw)
  To: anushkacharu9; +Cc: outreachy-kernel

On Sun, Mar 17, 2019 at 01:24:27AM +0530, anushkacharu9@gmail.com wrote:
> From: Anushka Shukla <anushkacharu9@gmail.com>
> 
> - Define a new variable temp_table.
> - Modify it to maintain Linux Kernel Coding style.

What is "it" here?

> 
> Signed-off-by: Anushka Shukla <anushkacharu9@gmail.com>
> ---
>  drivers/staging/gasket/apex_driver.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
> index 7c2ffa467557..d0fffb51c9c4 100644
> --- a/drivers/staging/gasket/apex_driver.c
> +++ b/drivers/staging/gasket/apex_driver.c
> @@ -526,21 +526,22 @@ static ssize_t sysfs_show(struct device *device, struct device_attribute *attr,
>  	}
>  
>  	type = (enum sysfs_attribute_type)gasket_attr->data.attr_type;
> +	struct gasket_page_table *temp_table = gasket_dev->page_table[0]

Did you build this code?  The compiler should have complained a lot
about this :(

>  	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]));
> +				gasket_page_table_num_entries(temp_table);
> +				       

Always run your patches through checkpatch.pl before sending them out,
so that a maintainer does not have to tell you to run them through
checkpatch.pl :)

thanks,

greg k-h


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

end of thread, other threads:[~2019-03-17 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-16 19:54 [PATCH] Staging: gasket: Create a new variable to improve readability anushkacharu9
2019-03-17 10:13 ` [Outreachy kernel] " Greg KH

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.