diff mbox

[4/4] drm/panel: s6e8aa0: Use static inline for upcasting

Message ID 1406013141-18552-4-git-send-email-thierry.reding@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Thierry Reding July 22, 2014, 7:12 a.m. UTC
From: Thierry Reding <treding@nvidia.com>

Use a static inline function for upcasting a struct drm_panel to the
driver-specific structure. The advantage over using a macro is that it
gives us additional type checking.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/panel/panel-s6e8aa0.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Andrzej Hajda July 22, 2014, 7:33 a.m. UTC | #1
On 07/22/2014 09:12 AM, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> Use a static inline function for upcasting a struct drm_panel to the
> driver-specific structure. The advantage over using a macro is that it
> gives us additional type checking.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Andrzej Hajda <a.hajda@samsung.com>

> ---
>  drivers/gpu/drm/panel/panel-s6e8aa0.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c
> index d39bee36816c..6034d300d218 100644
> --- a/drivers/gpu/drm/panel/panel-s6e8aa0.c
> +++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c
> @@ -120,7 +120,10 @@ struct s6e8aa0 {
>  	int error;
>  };
>  
> -#define panel_to_s6e8aa0(p) container_of(p, struct s6e8aa0, panel)
> +static inline struct s6e8aa0 *panel_to_s6e8aa0(struct drm_panel *panel)
> +{
> +	return container_of(panel, struct s6e8aa0, panel);
> +}
>  
>  static int s6e8aa0_clear_error(struct s6e8aa0 *ctx)
>  {
diff mbox

Patch

diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c b/drivers/gpu/drm/panel/panel-s6e8aa0.c
index d39bee36816c..6034d300d218 100644
--- a/drivers/gpu/drm/panel/panel-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c
@@ -120,7 +120,10 @@  struct s6e8aa0 {
 	int error;
 };
 
-#define panel_to_s6e8aa0(p) container_of(p, struct s6e8aa0, panel)
+static inline struct s6e8aa0 *panel_to_s6e8aa0(struct drm_panel *panel)
+{
+	return container_of(panel, struct s6e8aa0, panel);
+}
 
 static int s6e8aa0_clear_error(struct s6e8aa0 *ctx)
 {