Skip to contentSkip to conversation

Staging: gasket: Create a new variable to improve readability

PATCH In review [email protected] 2 participants 2 messages Mar 16, 2019 – Mar 17, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: gasket: Create a new variable to improve readability

From: Anushka Shukla <[email protected]>

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

---
 drivers/staging/gasket/apex_driver.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/gasket/apex_driver.c +7 -6
index 7c2ffa467557..d0fffb51c9c4 100644
@@ -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",
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · On Sun, Mar 17, 2019 at 01:24:27AM +0530, [email protected] wrote:

From: Anushka Shukla <[email protected]>

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

What is "it" here?

Quoted 11 lines
---
 drivers/staging/gasket/apex_driver.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/gasket/apex_driver.c +0 -0
index 7c2ffa467557..d0fffb51c9c4 100644

drivers/staging/gasket/apex_driver.c static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, · line 529

Quoted 4 lines
drivers/staging/gasket/apex_driver.c +1 -0
@@ -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 :(

drivers/staging/gasket/apex_driver.c static ssize_t sysfs_show(struct device *device, struct device_attribute *attr, · line 534

Quoted 7 lines
drivers/staging/gasket/apex_driver.c +2 -2
 	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