Skip to content

Commit ed08d93

Browse files
qzedjwrdegoede
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 3279dec commit ed08d93

File tree

1 file changed

+1
-5
lines changed
  • include/linux/surface_aggregator

1 file changed

+1
-5
lines changed

include/linux/surface_aggregator/device.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,7 @@ static inline bool is_ssam_device(struct device *d)
243243
* Return: Returns the pointer to the &struct ssam_device_driver wrapping the
244244
* given device driver @d.
245245
*/
246-
static inline
247-
struct ssam_device_driver *to_ssam_device_driver(struct device_driver *d)
248-
{
249-
return container_of(d, struct ssam_device_driver, driver);
250-
}
246+
#define to_ssam_device_driver(d) container_of_const(d, struct ssam_device_driver, driver)
251247

252248
const struct ssam_device_id *ssam_device_id_match(const struct ssam_device_id *table,
253249
const struct ssam_device_uid uid);

0 commit comments

Comments
 (0)