From: Maximilian Luz Date: Thu, 25 May 2023 20:50:41 +0000 (+0200) Subject: platform/surface: aggregator: Make to_ssam_device_driver() respect constness X-Git-Tag: v6.6.7~2643^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed08d937eaa4f18aa26e47fe6b937205a4745045;p=platform%2Fkernel%2Flinux-starfive.git platform/surface: aggregator: Make to_ssam_device_driver() respect constness Make to_ssam_device_driver() a bit safer by replacing container_of() with container_of_const() to respect the constness of the passed in pointer, instead of silently discarding any const specifications. This change also makes it more similar to to_ssam_device(), which already uses container_of_const(). Signed-off-by: Maximilian Luz Link: https://lore.kernel.org/r/20230525205041.2774947-1-luzmaximilian@gmail.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede --- diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h index df81043..42b249b 100644 --- a/include/linux/surface_aggregator/device.h +++ b/include/linux/surface_aggregator/device.h @@ -243,11 +243,7 @@ static inline bool is_ssam_device(struct device *d) * Return: Returns the pointer to the &struct ssam_device_driver wrapping the * given device driver @d. */ -static inline -struct ssam_device_driver *to_ssam_device_driver(struct device_driver *d) -{ - return container_of(d, struct ssam_device_driver, driver); -} +#define to_ssam_device_driver(d) container_of_const(d, struct ssam_device_driver, driver) const struct ssam_device_id *ssam_device_id_match(const struct ssam_device_id *table, const struct ssam_device_uid uid);