Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/dsi: Replace upcasting macro by function

Using a function instead of a macro provides proper type checking.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+9 -2
+9 -2
include/drm/drm_mipi_dsi.h
··· 123 123 unsigned long mode_flags; 124 124 }; 125 125 126 - #define to_mipi_dsi_device(d) container_of(d, struct mipi_dsi_device, dev) 126 + static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev) 127 + { 128 + return container_of(dev, struct mipi_dsi_device, dev); 129 + } 127 130 128 131 int mipi_dsi_attach(struct mipi_dsi_device *dsi); 129 132 int mipi_dsi_detach(struct mipi_dsi_device *dsi); ··· 149 146 void (*shutdown)(struct mipi_dsi_device *dsi); 150 147 }; 151 148 152 - #define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) 149 + static inline struct mipi_dsi_driver * 150 + to_mipi_dsi_driver(struct device_driver *driver) 151 + { 152 + return container_of(driver, struct mipi_dsi_driver, driver); 153 + } 153 154 154 155 static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi) 155 156 {