From: Thierry Reding Date: Tue, 5 Aug 2014 07:01:32 +0000 (+0200) Subject: drm/dsi: Replace upcasting macro by function X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=77df01dcd3040a7d664d85d085d4a21533824bc1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/dsi: Replace upcasting macro by function Using a function instead of a macro provides proper type checking. Signed-off-by: Thierry Reding --- diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 7b5e1a9244e1..2bb55b8b9031 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -123,7 +123,10 @@ struct mipi_dsi_device { unsigned long mode_flags; }; -#define to_mipi_dsi_device(d) container_of(d, struct mipi_dsi_device, dev) +static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev) +{ + return container_of(dev, struct mipi_dsi_device, dev); +} int mipi_dsi_attach(struct mipi_dsi_device *dsi); int mipi_dsi_detach(struct mipi_dsi_device *dsi); @@ -146,7 +149,11 @@ struct mipi_dsi_driver { void (*shutdown)(struct mipi_dsi_device *dsi); }; -#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) +static inline struct mipi_dsi_driver * +to_mipi_dsi_driver(struct device_driver *driver) +{ + return container_of(driver, struct mipi_dsi_driver, driver); +} static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi) {