* [PATCH] Fix various coding style problem
@ 2015-08-09 15:48 Swee Hua Law
2015-08-10 4:44 ` Sudip Mukherjee
2015-08-10 13:54 ` [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series Swee Hua Law
0 siblings, 2 replies; 7+ messages in thread
From: Swee Hua Law @ 2015-08-09 15:48 UTC (permalink / raw)
To: oleg.drokin, andreas.dilger, gregkh
Cc: elfring, linux.kernel, Julia.Lawall, sweehua81, HPDD-discuss,
devel, linux-kernel
1) do not initialise globals to NULL
2) improve readability of hlist_for_each_entry_safe()
3) move */ to a separate line
4) change symbol == NULL to !symbol
Signed-off-by: Swee Hua Law <sweehua81@gmail.com>
---
drivers/staging/lustre/lustre/llite/remote_perm.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c
index a581826..39022ea 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -54,8 +54,8 @@
#include "../include/lustre_param.h"
#include "llite_internal.h"
-struct kmem_cache *ll_remote_perm_cachep = NULL;
-struct kmem_cache *ll_rmtperm_hash_cachep = NULL;
+struct kmem_cache *ll_remote_perm_cachep;
+struct kmem_cache *ll_rmtperm_hash_cachep;
static inline struct ll_remote_perm *alloc_ll_remote_perm(void)
{
@@ -104,8 +104,7 @@ void free_rmtperm_hash(struct hlist_head *hash)
return;
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++)
- hlist_for_each_entry_safe(lrp, next, hash + i,
- lrp_list)
+ hlist_for_each_entry_safe(lrp, next, hash + i, lrp_list)
free_ll_remote_perm(lrp);
OBD_SLAB_FREE(hash, ll_rmtperm_hash_cachep,
REMOTE_PERM_HASHSIZE * sizeof(*hash));
@@ -117,7 +116,8 @@ static inline int remote_perm_hashfunc(uid_t uid)
}
/* NB: setxid permission is not checked here, instead it's done on
- * MDT when client get remote permission. */
+ * MDT when client get remote permission.
+ */
static int do_check_remote_perm(struct ll_inode_info *lli, int mask)
{
struct hlist_head *head;
@@ -184,7 +184,7 @@ int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm)
if (!lli->lli_remote_perms) {
perm_hash = alloc_rmtperm_hash();
- if (perm_hash == NULL) {
+ if (!perm_hash) {
CERROR("alloc lli_remote_perms failed!\n");
return -ENOMEM;
}
@@ -287,7 +287,7 @@ int lustre_check_remote_perm(struct inode *inode, int mask)
perm = req_capsule_server_swab_get(&req->rq_pill, &RMF_ACL,
lustre_swab_mdt_remote_perm);
- if (unlikely(perm == NULL)) {
+ if (unlikely(!perm)) {
mutex_unlock(&lli->lli_rmtperm_mutex);
rc = -EPROTO;
break;
@@ -321,8 +321,7 @@ void ll_free_remote_perms(struct inode *inode)
spin_lock(&lli->lli_lock);
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++) {
- hlist_for_each_entry_safe(lrp, node, next, hash + i,
- lrp_list)
+ hlist_for_each_entry_safe(lrp, node, next, hash + i, lrp_list)
free_ll_remote_perm(lrp);
}
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] Fix various coding style problem
2015-08-09 15:48 [PATCH] Fix various coding style problem Swee Hua Law
@ 2015-08-10 4:44 ` Sudip Mukherjee
2015-08-10 13:54 ` [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series Swee Hua Law
1 sibling, 0 replies; 7+ messages in thread
From: Sudip Mukherjee @ 2015-08-10 4:44 UTC (permalink / raw)
To: Swee Hua Law
Cc: oleg.drokin, andreas.dilger, gregkh, devel, linux.kernel,
linux-kernel, HPDD-discuss, Julia.Lawall, elfring
On Sun, Aug 09, 2015 at 11:48:34PM +0800, Swee Hua Law wrote:
> 1) do not initialise globals to NULL
> 2) improve readability of hlist_for_each_entry_safe()
> 3) move */ to a separate line
> 4) change symbol == NULL to !symbol
These were many different changes in a single patch. Please break them
into separate patches and send it in a series.
regards
sudip
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series
2015-08-09 15:48 [PATCH] Fix various coding style problem Swee Hua Law
2015-08-10 4:44 ` Sudip Mukherjee
@ 2015-08-10 13:54 ` Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 1/4] staging: lustre: checkpatch: do not init global to NULL Swee Hua Law
` (3 more replies)
1 sibling, 4 replies; 7+ messages in thread
From: Swee Hua Law @ 2015-08-10 13:54 UTC (permalink / raw)
To: oleg.drokin, andreas.dilger, gregkh
Cc: elfring, linux.kernel, Julia.Lawall, sweehua81, HPDD-discuss,
devel, linux-kernel
Split patch into series.
Fix various coding style issue in remote_perm.c:
[PATCH V2 1/4] staging: lustre: checkpatch: do not init global to NULL
[PATCH V2 2/4] staging: lustre: checkpatch: symbol == NULL should be !symbol
[PATCH V2 3/4] staging: lustre: checkpatch: move */ block comment to next line
[PATCH V2 4/4] staging: lustre: checkpatch: argument alignment for readability
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH V2 1/4] staging: lustre: checkpatch: do not init global to NULL
2015-08-10 13:54 ` [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series Swee Hua Law
@ 2015-08-10 13:54 ` Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 2/4] staging: lustre: checkpatch: symbol == NULL should be !symbol Swee Hua Law
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Swee Hua Law @ 2015-08-10 13:54 UTC (permalink / raw)
To: oleg.drokin, andreas.dilger, gregkh
Cc: elfring, linux.kernel, Julia.Lawall, sweehua81, HPDD-discuss,
devel, linux-kernel
Fix checkpatch problem: remove NULL assignment fro global variable
Signed-off-by: Swee Hua Law <sweehua81@gmail.com>
---
drivers/staging/lustre/lustre/llite/remote_perm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c
index a581826..c9a7816 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -54,8 +54,8 @@
#include "../include/lustre_param.h"
#include "llite_internal.h"
-struct kmem_cache *ll_remote_perm_cachep = NULL;
-struct kmem_cache *ll_rmtperm_hash_cachep = NULL;
+struct kmem_cache *ll_remote_perm_cachep;
+struct kmem_cache *ll_rmtperm_hash_cachep;
static inline struct ll_remote_perm *alloc_ll_remote_perm(void)
{
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH V2 2/4] staging: lustre: checkpatch: symbol == NULL should be !symbol
2015-08-10 13:54 ` [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 1/4] staging: lustre: checkpatch: do not init global to NULL Swee Hua Law
@ 2015-08-10 13:54 ` Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 3/4] staging: lustre: checkpatch: move */ block comment to next line Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 4/4] staging: lustre: checkpatch: argument alignment for readability Swee Hua Law
3 siblings, 0 replies; 7+ messages in thread
From: Swee Hua Law @ 2015-08-10 13:54 UTC (permalink / raw)
To: oleg.drokin, andreas.dilger, gregkh
Cc: elfring, linux.kernel, Julia.Lawall, sweehua81, HPDD-discuss,
devel, linux-kernel
Fix checkpatch problem: change == NULL comparison to !symbol
Signed-off-by: Swee Hua Law <sweehua81@gmail.com>
---
drivers/staging/lustre/lustre/llite/remote_perm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c
index c9a7816..aeda91a 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -184,7 +184,7 @@ int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm)
if (!lli->lli_remote_perms) {
perm_hash = alloc_rmtperm_hash();
- if (perm_hash == NULL) {
+ if (!perm_hash) {
CERROR("alloc lli_remote_perms failed!\n");
return -ENOMEM;
}
@@ -287,7 +287,7 @@ int lustre_check_remote_perm(struct inode *inode, int mask)
perm = req_capsule_server_swab_get(&req->rq_pill, &RMF_ACL,
lustre_swab_mdt_remote_perm);
- if (unlikely(perm == NULL)) {
+ if (unlikely(!perm)) {
mutex_unlock(&lli->lli_rmtperm_mutex);
rc = -EPROTO;
break;
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH V2 3/4] staging: lustre: checkpatch: move */ block comment to next line
2015-08-10 13:54 ` [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 1/4] staging: lustre: checkpatch: do not init global to NULL Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 2/4] staging: lustre: checkpatch: symbol == NULL should be !symbol Swee Hua Law
@ 2015-08-10 13:54 ` Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 4/4] staging: lustre: checkpatch: argument alignment for readability Swee Hua Law
3 siblings, 0 replies; 7+ messages in thread
From: Swee Hua Law @ 2015-08-10 13:54 UTC (permalink / raw)
To: oleg.drokin, andreas.dilger, gregkh
Cc: elfring, linux.kernel, Julia.Lawall, sweehua81, HPDD-discuss,
devel, linux-kernel
Fix checkpatch problem: move */ from end of line to new line
Signed-off-by: Swee Hua Law <sweehua81@gmail.com>
---
drivers/staging/lustre/lustre/llite/remote_perm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c
index aeda91a..49d78a3 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -117,7 +117,8 @@ static inline int remote_perm_hashfunc(uid_t uid)
}
/* NB: setxid permission is not checked here, instead it's done on
- * MDT when client get remote permission. */
+ * MDT when client get remote permission.
+ */
static int do_check_remote_perm(struct ll_inode_info *lli, int mask)
{
struct hlist_head *head;
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH V2 4/4] staging: lustre: checkpatch: argument alignment for readability
2015-08-10 13:54 ` [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series Swee Hua Law
` (2 preceding siblings ...)
2015-08-10 13:54 ` [PATCH V2 3/4] staging: lustre: checkpatch: move */ block comment to next line Swee Hua Law
@ 2015-08-10 13:54 ` Swee Hua Law
3 siblings, 0 replies; 7+ messages in thread
From: Swee Hua Law @ 2015-08-10 13:54 UTC (permalink / raw)
To: oleg.drokin, andreas.dilger, gregkh
Cc: elfring, linux.kernel, Julia.Lawall, sweehua81, HPDD-discuss,
devel, linux-kernel
Fix checkpatch problem: move last argument of the hlist..() back to same line
Signed-off-by: Swee Hua Law <sweehua81@gmail.com>
---
drivers/staging/lustre/lustre/llite/remote_perm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c
index 49d78a3..39022ea 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -104,8 +104,7 @@ void free_rmtperm_hash(struct hlist_head *hash)
return;
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++)
- hlist_for_each_entry_safe(lrp, next, hash + i,
- lrp_list)
+ hlist_for_each_entry_safe(lrp, next, hash + i, lrp_list)
free_ll_remote_perm(lrp);
OBD_SLAB_FREE(hash, ll_rmtperm_hash_cachep,
REMOTE_PERM_HASHSIZE * sizeof(*hash));
@@ -322,8 +321,7 @@ void ll_free_remote_perms(struct inode *inode)
spin_lock(&lli->lli_lock);
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++) {
- hlist_for_each_entry_safe(lrp, node, next, hash + i,
- lrp_list)
+ hlist_for_each_entry_safe(lrp, node, next, hash + i, lrp_list)
free_ll_remote_perm(lrp);
}
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-08-10 13:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-09 15:48 [PATCH] Fix various coding style problem Swee Hua Law
2015-08-10 4:44 ` Sudip Mukherjee
2015-08-10 13:54 ` [PATCH V2 0/4] staging: lustre: split checkpatch fix for remote_perm.c into series Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 1/4] staging: lustre: checkpatch: do not init global to NULL Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 2/4] staging: lustre: checkpatch: symbol == NULL should be !symbol Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 3/4] staging: lustre: checkpatch: move */ block comment to next line Swee Hua Law
2015-08-10 13:54 ` [PATCH V2 4/4] staging: lustre: checkpatch: argument alignment for readability Swee Hua Law
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.