amba: move to_amba_device() to use container_of_const
authorPrathu Baronia <prathubaronia2011@gmail.com>
Thu, 18 May 2023 13:46:56 +0000 (19:16 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 May 2023 18:01:32 +0000 (19:01 +0100)
to_amba_device() now properly keeps the const-ness of the dev pointer
passed into it, while as before it could be lost.

Signed-off-by: Prathu Baronia <prathubaronia2011@gmail.com>
Link: https://lore.kernel.org/r/20230518134656.9559-1-prathubaronia2011@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/amba/bus.h

index 5001e14c5c06ddac13d6cb64d0d50d8e8b4c7b17..c60a6a14638caa0163ffe0ea20d376b54b1b95ba 100644 (file)
@@ -107,7 +107,7 @@ enum amba_vendor {
 
 extern struct bus_type amba_bustype;
 
-#define to_amba_device(d)      container_of(d, struct amba_device, dev)
+#define to_amba_device(d)      container_of_const(d, struct amba_device, dev)
 
 #define amba_get_drvdata(d)    dev_get_drvdata(&d->dev)
 #define amba_set_drvdata(d,p)  dev_set_drvdata(&d->dev, p)