* [PATCH] Staging: lustre: obdclass: Use list_first_entry_or_null
@ 2016-03-06 14:39 Bhumika Goyal
2016-03-11 17:08 ` [Outreachy kernel] " Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2016-03-06 14:39 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Bhumika Goyal
This patch replaces list_empty and list_entry with
list_first_entry_or_null as it makes the code cleare to read. Also removed the
{} around if-statement.
Done using coccinelle:
@@
expression e1,e2;
statement S;
@@
- if(!list_empty(...)){
e2=
- list_entry(e1.next,
+ list_first_entry_or_null(&e1,
...);
+ if(e2){
...
}
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
drivers/staging/lustre/lustre/obdclass/genops.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index cf97b8f0..08b17d1 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -1123,18 +1123,18 @@ static void obd_zombie_impexp_cull(void)
spin_lock(&obd_zombie_impexp_lock);
import = NULL;
- if (!list_empty(&obd_zombie_imports)) {
- import = list_entry(obd_zombie_imports.next,
- struct obd_import,
- imp_zombie_chain);
+ import = list_first_entry_or_null(&obd_zombie_imports,
+ struct obd_import,
+ imp_zombie_chain);
+ if (import)
list_del_init(&import->imp_zombie_chain);
export = NULL;
- if (!list_empty(&obd_zombie_exports)) {
- export = list_entry(obd_zombie_exports.next,
- struct obd_export,
- exp_obd_chain);
+ export = list_first_entry_or_null(&obd_zombie_exports,
+ struct obd_export,
+ exp_obd_chain);
+ if (export)
list_del_init(&export->exp_obd_chain);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Outreachy kernel] [PATCH] Staging: lustre: obdclass: Use list_first_entry_or_null
2016-03-06 14:39 [PATCH] Staging: lustre: obdclass: Use list_first_entry_or_null Bhumika Goyal
@ 2016-03-11 17:08 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2016-03-11 17:08 UTC (permalink / raw)
To: Bhumika Goyal; +Cc: outreachy-kernel
On Sun, Mar 06, 2016 at 08:09:38PM +0530, Bhumika Goyal wrote:
> This patch replaces list_empty and list_entry with
> list_first_entry_or_null as it makes the code cleare to read. Also removed the
> {} around if-statement.
> Done using coccinelle:
>
> @@
> expression e1,e2;
> statement S;
> @@
> - if(!list_empty(...)){
> e2=
> - list_entry(e1.next,
> + list_first_entry_or_null(&e1,
> ...);
> + if(e2){
> ...
> }
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
> drivers/staging/lustre/lustre/obdclass/genops.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
Does not apply to my tree :(
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-11 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-06 14:39 [PATCH] Staging: lustre: obdclass: Use list_first_entry_or_null Bhumika Goyal
2016-03-11 17:08 ` [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.