Staging: lustre: obdclass: Use list_first_entry_or_null
PATCH 1/1 Staging: lustre: obdclass: Use list_first_entry_or_null
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 <[email protected]>
--- drivers/staging/lustre/lustre/obdclass/genops.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/obdclass/genops.c +8 -8
@@ -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);
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 18 lines · Bhumika Goyal
This patch replaces
list_emptyandlist_entrywithlist_first_entry_or_nullas 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){
...
}
Quoted 4 lines
Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/lustre/lustre/obdclass/genops.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Does not apply to my tree :(