]> git.ipfire.org Git - thirdparty/linux.git/commit
serdev: Convert to_serdev_*() helpers to macros and use container_of_const()
authorManivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Thu, 26 Mar 2026 08:06:29 +0000 (13:36 +0530)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 31 Mar 2026 07:48:42 +0000 (09:48 +0200)
commite7fef85039ccdba67d97b2a09f313aceeb6691c8
tree6d6e8ecc2aa4a325a233125d17081396a2d34053
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
serdev: Convert to_serdev_*() helpers to macros and use container_of_const()

If these helpers receive the 'const struct device' pointer, then the const
qualifier will get dropped, leading to below warning:

warning: passing argument 1 of ‘to_serdev_device_driver’ discards 'const'
qualifier from pointer target type [-Wdiscarded-qualifiers]

This is not an issue as of now, but with the future commits adding serdev
device based driver matching, this warning will get triggered. Hence,
convert these helpers to macros so that the qualifier get preserved and
also use container_of_const() as container_of() is deprecated.

Tested-by: Hans de Goede <johannes.goede@oss.qualcomm.com> # ThinkPad T14s gen6 (arm64)
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20260326-pci-m2-e-v7-1-43324a7866e6@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
include/linux/serdev.h