diff options
| author | Dan Williams <dan.j.williams@intel.com> | 2017-04-13 07:59:01 +0300 |
|---|---|---|
| committer | Dan Williams <dan.j.williams@intel.com> | 2017-04-13 07:59:01 +0300 |
| commit | bfca9acf1a5df0ff98fbf47e363adb48612bb7ec (patch) | |
| tree | a50287c88fdc60a73912d205d7bce41b7af53827 /include/linux/list_nulls.h | |
| parent | 92a3fa075d3d2716b9c662814540f1d660cbf2f5 (diff) | |
| parent | 11e63f6d920d6f2dfd3cd421e939a4aec9a58dcd (diff) | |
| download | linux-bfca9acf1a5df0ff98fbf47e363adb48612bb7ec.tar.xz | |
Merge branch 'for-4.11/libnvdimm' into for-4.12/dax
Diffstat (limited to 'include/linux/list_nulls.h')
| -rw-r--r-- | include/linux/list_nulls.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h index b01fe1009084..87ff4f58a2f0 100644 --- a/include/linux/list_nulls.h +++ b/include/linux/list_nulls.h @@ -29,6 +29,11 @@ struct hlist_nulls_node { ((ptr)->first = (struct hlist_nulls_node *) NULLS_MARKER(nulls)) #define hlist_nulls_entry(ptr, type, member) container_of(ptr,type,member) + +#define hlist_nulls_entry_safe(ptr, type, member) \ + ({ typeof(ptr) ____ptr = (ptr); \ + !is_a_nulls(____ptr) ? hlist_nulls_entry(____ptr, type, member) : NULL; \ + }) /** * ptr_is_a_nulls - Test if a ptr is a nulls * @ptr: ptr to be tested |
