Skip to contentSkip to conversation

Cleanup for staging lustre obdclass

PATCH Superseded Dafna Hirschfeld 2 participants 8 messages Mar 4, 2018 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Cleanup for staging lustre obdclass

Fixes of issues found with checkpatch.pl for the lustre obdclass driver.

Changes in v2:
patch 1:
1. Revert moving the constant to the right side of comparisons in order to keep the condition in the form of
'lower bound <= val && val <= upper bound'

2. Revert returning '!!ptr' instead of 'ptr != NULL' since this is not part of an 'if' statement.

patches 2+3:
No Change.

Dafna Hirschfeld (3):
staging: lustre: obdclass: Fix comparison to NULL
staging: lustre: obdclass: Add 'const' to char* array
staging: lustre: obdclass: Replace 'unsigned' with 'unsigned int'

 drivers/staging/lustre/lustre/obdclass/cl_lock.c        | 2 +-
 drivers/staging/lustre/lustre/obdclass/cl_object.c      | 2 +-
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 ++--
 drivers/staging/lustre/lustre/obdclass/lu_object.c      | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/3 staging: lustre: obdclass: Fix comparison to NULL

Replace comparison to NULL with a 'not' operator.
Issue found with checkpatch.

---
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1 -1
index e1f4ef2..64cc746 100644
@@ -1585,7 +1585,7 @@ int ldebugfs_seq_create(struct dentry *parent, const char *name,
 	struct dentry *entry;
 
 	/* Disallow secretly (un)writable entries. */
-	LASSERT((seq_fops->write == NULL) == ((mode & 0222) == 0));
+	LASSERT((!seq_fops->write) == ((mode & 0222) == 0));
 
 	entry = debugfs_create_file(name, mode, parent, data, seq_fops);
 	if (IS_ERR_OR_NULL(entry))
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 2/3 staging: lustre: obdclass: Add 'const' to char* array

In reply to Dafna Hirschfeld

Replace 'const char*' arrays with 'const char * const' since the values in the arrays are not changed. Issues found with checkpatch.pl

---
 drivers/staging/lustre/lustre/obdclass/cl_lock.c   | 2 +-
 drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/obdclass/cl_lock.c +1 -1
index 3b683b7..9ca29a2 100644
@@ -224,7 +224,7 @@ EXPORT_SYMBOL(cl_lock_release);
 
 const char *cl_lock_mode_name(const enum cl_lock_mode mode)
 {
-	static const char *names[] = {
+	static const char * const names[] = {
 		[CLM_READ]    = "R",
 		[CLM_WRITE]   = "W",
 		[CLM_GROUP]   = "G"
drivers/staging/lustre/lustre/obdclass/cl_object.c +1 -1
index 7b18d77..7809f6a 100644
@@ -495,7 +495,7 @@ static struct cache_stats cl_env_stats = {
 int cl_site_stats_print(const struct cl_site *site, struct seq_file *m)
 {
 	size_t i;
-	static const char *pstate[] = {
+	static const char * const pstate[] = {
 		[CPS_CACHED]  = "c",
 		[CPS_OWNED]   = "o",
 		[CPS_PAGEOUT] = "w",
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 3/3 staging: lustre: obdclass: Replace 'unsigned' with 'unsigned int'

In reply to Dafna Hirschfeld

Replace 'unsigned' with 'unsigned int' to improve readability. Issues found with checkpatch.pl

---
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +-
 drivers/staging/lustre/lustre/obdclass/lu_object.c      | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1 -1
index 64cc746..2ed3505 100644
@@ -1467,7 +1467,7 @@ int lprocfs_write_frac_u64_helper(const char __user *buffer,
 {
 	char kernbuf[22], *end, *pbuf;
 	__u64 whole, frac = 0, units;
-	unsigned frac_d = 1;
+	unsigned int frac_d = 1;
 	int sign = 1;
 
 	if (count > (sizeof(kernbuf) - 1))
drivers/staging/lustre/lustre/obdclass/lu_object.c +4 -4
index cca6881..964e854 100644
@@ -1797,10 +1797,10 @@ int lu_env_refill(struct lu_env *env)
 EXPORT_SYMBOL(lu_env_refill);
 
 struct lu_site_stats {
-	unsigned	lss_populated;
-	unsigned	lss_max_search;
-	unsigned	lss_total;
-	unsigned	lss_busy;
+	unsigned int	lss_populated;
+	unsigned int	lss_max_search;
+	unsigned int	lss_total;
+	unsigned int	lss_busy;
 };
 
 static void lu_site_stats_get(struct cfs_hash *hs,
Signature · 1 line
2.7.4
Acked-by on v2 1/3
#2 lore raw

Re: [Outreachy kernel] [PATCH v2 1/3] staging: lustre: obdclass: Fix comparison to NULL

In reply to Dafna Hirschfeld
Quoted 4 lines · Dafna Hirschfeld

Replace comparison to NULL with a 'not' operator.
Issue found with checkpatch.

Quoted 9 lines
---
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +0 -0
index e1f4ef2..64cc746 100644

drivers/staging/lustre/lustre/obdclass/lprocfs_status.c int ldebugfs_seq_create(struct dentry *parent, const char *name, · line 1588

Quoted 5 lines
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +1 -1
@@ -1585,7 +1585,7 @@ int ldebugfs_seq_create(struct dentry *parent, const char *name,
 	struct dentry *entry;
 
 	/* Disallow secretly (un)writable entries. */
-	LASSERT((seq_fops->write == NULL) == ((mode & 0222) == 0));
+	LASSERT((!seq_fops->write) == ((mode & 0222) == 0));

! actually binds more tightly than ==, but I think that keeping the parentheses is helpful for clarity.

julia

Quoted 13 lines
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +0 -1
 	entry = debugfs_create_file(name, mode, parent, data, seq_fops);
 	if (IS_ERR_OR_NULL(entry))
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/2af5f92fecc211d04770d19600874f3345f97200.1520153895.git.dafna3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#5 lore raw
In reply to Dafna Hirschfeld
Quoted 8 lines · Dafna Hirschfeld

Fixes of issues found with checkpatch.pl for the lustre obdclass driver.

Changes in v2:
patch 1:
1. Revert moving the constant to the right side of comparisons in order to keep the condition in the form of
'lower bound <= val && val <= upper bound'

Quoted 5 lines

2. Revert returning '!!ptr' instead of 'ptr != NULL' since this is not part of an 'if' statement.

patches 2+3:
No Change.

I think I acked these two. You should keep the ack in the resubmission.

julia

Quoted 22 lines

Dafna Hirschfeld (3):
staging: lustre: obdclass: Fix comparison to NULL
staging: lustre: obdclass: Add 'const' to char* array
staging: lustre: obdclass: Replace 'unsigned' with 'unsigned int'

 drivers/staging/lustre/lustre/obdclass/cl_lock.c        | 2 +-
 drivers/staging/lustre/lustre/obdclass/cl_object.c      | 2 +-
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 ++--
 drivers/staging/lustre/lustre/obdclass/lu_object.c      | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

--
2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cover.1520153895.git.dafna3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#6 lore raw
Quoted 15 lines · Julia Lawall
Quoted 11 lines · Dafna Hirschfeld

Fixes of issues found with checkpatch.pl for the lustre obdclass driver.

Changes in v2:
patch 1:
1. Revert moving the constant to the right side of comparisons in order to keep the condition in the form of
'lower bound <= val && val <= upper bound'

2. Revert returning '!!ptr' instead of 'ptr != NULL' since this is not part of an 'if' statement.

Quoted 7 lines
Quoted 2 lines

patches 2+3:
No Change.

I think I acked these two. You should keep the ack in the resubmission.

julia

Hi, you did ack, shell I send another version with your acks ?

Quoted 22 lines
Quoted 22 lines

Dafna Hirschfeld (3):
staging: lustre: obdclass: Fix comparison to NULL
staging: lustre: obdclass: Add 'const' to char* array
staging: lustre: obdclass: Replace 'unsigned' with 'unsigned int'

 drivers/staging/lustre/lustre/obdclass/cl_lock.c        | 2 +-
 drivers/staging/lustre/lustre/obdclass/cl_object.c      | 2 +-
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 ++--
 drivers/staging/lustre/lustre/obdclass/lu_object.c      | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

--
2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cover.1520153895.git.dafna3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#7 lore raw
Quoted 16 lines · Dafna Hirschfeld
Quoted 15 lines · Julia Lawall
Quoted 11 lines · Dafna Hirschfeld

Fixes of issues found with checkpatch.pl for the lustre obdclass driver.

Changes in v2:
patch 1:
1. Revert moving the constant to the right side of comparisons in order to keep the condition in the form of
'lower bound <= val && val <= upper bound'

2. Revert returning '!!ptr' instead of 'ptr != NULL' since this is not part of an 'if' statement.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

patches 2+3:
No Change.

I think I acked these two. You should keep the ack in the resubmission.

julia

Hi, you did ack, shell I send another version with your acks ?

Sure. Thanks.

julia

Quoted 31 lines
Quoted 16 lines
Quoted 16 lines

Dafna Hirschfeld (3):
staging: lustre: obdclass: Fix comparison to NULL
staging: lustre: obdclass: Add 'const' to char* array
staging: lustre: obdclass: Replace 'unsigned' with 'unsigned int'

 drivers/staging/lustre/lustre/obdclass/cl_lock.c        | 2 +-
 drivers/staging/lustre/lustre/obdclass/cl_object.c      | 2 +-
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 4 ++--
 drivers/staging/lustre/lustre/obdclass/lu_object.c      | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

--
2.7.4

Quoted 7 lines
Quoted 7 lines

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/cover.1520153895.git.dafna3%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAJ1myNQ4EL6od8MOEh7JpoFUr6fKS7bwvcS0P8QDP5fDc4nCew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.