* [PATCH] container_of: remove container_of_safe()
@ 2022-10-24 12:39 Greg Kroah-Hartman
2022-10-24 13:14 ` Rafael J. Wysocki
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-10-24 12:39 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, Sakari Ailus, Andy Shevchenko,
Rafael J. Wysocki
It came in from a staging driver that has been long removed from the
tree, and there are no in-kernel users of the macro, and it's very
dubious if anyone should ever use this thing, so just remove it
entirely.
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/container_of.h | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/include/linux/container_of.h b/include/linux/container_of.h
index 2f4944b791b8..a6f242137b11 100644
--- a/include/linux/container_of.h
+++ b/include/linux/container_of.h
@@ -21,20 +21,4 @@
"pointer type mismatch in container_of()"); \
((type *)(__mptr - offsetof(type, member))); })
-/**
- * container_of_safe - cast a member of a structure out to the containing structure
- * @ptr: the pointer to the member.
- * @type: the type of the container struct this is embedded in.
- * @member: the name of the member within the struct.
- *
- * If IS_ERR_OR_NULL(ptr), ptr is returned unchanged.
- */
-#define container_of_safe(ptr, type, member) ({ \
- void *__mptr = (void *)(ptr); \
- static_assert(__same_type(*(ptr), ((type *)0)->member) || \
- __same_type(*(ptr), void), \
- "pointer type mismatch in container_of_safe()"); \
- IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) : \
- ((type *)(__mptr - offsetof(type, member))); })
-
#endif /* _LINUX_CONTAINER_OF_H */
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] container_of: remove container_of_safe()
2022-10-24 12:39 [PATCH] container_of: remove container_of_safe() Greg Kroah-Hartman
@ 2022-10-24 13:14 ` Rafael J. Wysocki
2022-10-24 13:20 ` Andy Shevchenko
2022-10-24 19:04 ` Sakari Ailus
2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2022-10-24 13:14 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-kernel, Sakari Ailus, Andy Shevchenko, Rafael J. Wysocki
On Mon, Oct 24, 2022 at 2:56 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> It came in from a staging driver that has been long removed from the
> tree, and there are no in-kernel users of the macro, and it's very
> dubious if anyone should ever use this thing, so just remove it
> entirely.
>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
> ---
> include/linux/container_of.h | 16 ----------------
> 1 file changed, 16 deletions(-)
>
> diff --git a/include/linux/container_of.h b/include/linux/container_of.h
> index 2f4944b791b8..a6f242137b11 100644
> --- a/include/linux/container_of.h
> +++ b/include/linux/container_of.h
> @@ -21,20 +21,4 @@
> "pointer type mismatch in container_of()"); \
> ((type *)(__mptr - offsetof(type, member))); })
>
> -/**
> - * container_of_safe - cast a member of a structure out to the containing structure
> - * @ptr: the pointer to the member.
> - * @type: the type of the container struct this is embedded in.
> - * @member: the name of the member within the struct.
> - *
> - * If IS_ERR_OR_NULL(ptr), ptr is returned unchanged.
> - */
> -#define container_of_safe(ptr, type, member) ({ \
> - void *__mptr = (void *)(ptr); \
> - static_assert(__same_type(*(ptr), ((type *)0)->member) || \
> - __same_type(*(ptr), void), \
> - "pointer type mismatch in container_of_safe()"); \
> - IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) : \
> - ((type *)(__mptr - offsetof(type, member))); })
> -
> #endif /* _LINUX_CONTAINER_OF_H */
> --
> 2.38.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] container_of: remove container_of_safe()
2022-10-24 12:39 [PATCH] container_of: remove container_of_safe() Greg Kroah-Hartman
2022-10-24 13:14 ` Rafael J. Wysocki
@ 2022-10-24 13:20 ` Andy Shevchenko
2022-10-24 19:04 ` Sakari Ailus
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-10-24 13:20 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Sakari Ailus, Rafael J. Wysocki
On Mon, Oct 24, 2022 at 02:39:33PM +0200, Greg Kroah-Hartman wrote:
> It came in from a staging driver that has been long removed from the
> tree, and there are no in-kernel users of the macro, and it's very
> dubious if anyone should ever use this thing, so just remove it
> entirely.
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> include/linux/container_of.h | 16 ----------------
> 1 file changed, 16 deletions(-)
>
> diff --git a/include/linux/container_of.h b/include/linux/container_of.h
> index 2f4944b791b8..a6f242137b11 100644
> --- a/include/linux/container_of.h
> +++ b/include/linux/container_of.h
> @@ -21,20 +21,4 @@
> "pointer type mismatch in container_of()"); \
> ((type *)(__mptr - offsetof(type, member))); })
>
> -/**
> - * container_of_safe - cast a member of a structure out to the containing structure
> - * @ptr: the pointer to the member.
> - * @type: the type of the container struct this is embedded in.
> - * @member: the name of the member within the struct.
> - *
> - * If IS_ERR_OR_NULL(ptr), ptr is returned unchanged.
> - */
> -#define container_of_safe(ptr, type, member) ({ \
> - void *__mptr = (void *)(ptr); \
> - static_assert(__same_type(*(ptr), ((type *)0)->member) || \
> - __same_type(*(ptr), void), \
> - "pointer type mismatch in container_of_safe()"); \
> - IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) : \
> - ((type *)(__mptr - offsetof(type, member))); })
> -
> #endif /* _LINUX_CONTAINER_OF_H */
> --
> 2.38.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] container_of: remove container_of_safe()
2022-10-24 12:39 [PATCH] container_of: remove container_of_safe() Greg Kroah-Hartman
2022-10-24 13:14 ` Rafael J. Wysocki
2022-10-24 13:20 ` Andy Shevchenko
@ 2022-10-24 19:04 ` Sakari Ailus
2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2022-10-24 19:04 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel, Andy Shevchenko, Rafael J. Wysocki
On Mon, Oct 24, 2022 at 02:39:33PM +0200, Greg Kroah-Hartman wrote:
> It came in from a staging driver that has been long removed from the
> tree, and there are no in-kernel users of the macro, and it's very
> dubious if anyone should ever use this thing, so just remove it
> entirely.
>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Thanks!
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-24 21:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-24 12:39 [PATCH] container_of: remove container_of_safe() Greg Kroah-Hartman
2022-10-24 13:14 ` Rafael J. Wysocki
2022-10-24 13:20 ` Andy Shevchenko
2022-10-24 19:04 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox