Commit 77df01dc authored by Thierry Reding's avatar Thierry Reding

drm/dsi: Replace upcasting macro by function

Using a function instead of a macro provides proper type checking.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent dff2ed27
...@@ -123,7 +123,10 @@ struct mipi_dsi_device { ...@@ -123,7 +123,10 @@ struct mipi_dsi_device {
unsigned long mode_flags; 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_attach(struct mipi_dsi_device *dsi);
int mipi_dsi_detach(struct mipi_dsi_device *dsi); int mipi_dsi_detach(struct mipi_dsi_device *dsi);
...@@ -146,7 +149,11 @@ struct mipi_dsi_driver { ...@@ -146,7 +149,11 @@ struct mipi_dsi_driver {
void (*shutdown)(struct mipi_dsi_device *dsi); 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) static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment