summaryrefslogtreecommitdiff
path: root/include/linux/usb.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-10-16 12:41:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-10-20 12:05:12 +0200
commit7ebe49b76a001b10b007193b1771f33e6cbc4f3f (patch)
treec5887e31dfc10473092e3b3423666b903dc99b0a /include/linux/usb.h
parent9abf2313adc1ca1b6180c508c25f22f9395cc780 (diff)
driver core: allow kobj_to_dev() to take a const pointer
If a const * to a kobject is passed to kobj_to_dev(), we want to return back a const * to a device as the driver core shouldn't be modifying a constant structure. But when dealing with container_of() the pointer const attribute is cast away, so we need to manually handle this by determining the type of the pointer passed in to know the type of the pointer to pass out. Luckily _Generic can do this type of magic, and as the kernel now supports C11 it is availble to us to handle this type of build-time type detection. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221016104126.1259809-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb.h')
0 files changed, 0 insertions, 0 deletions