Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-fbdev@vger.kernel.org
Subject: [PATCH 1/2] fbdev: sh_mobile_meram: Add MERAM operations wrappers
Date: Thu, 31 May 2012 16:33:59 +0000	[thread overview]
Message-ID: <1338482040-29827-2-git-send-email-laurent.pinchart@ideasonboard.com> (raw)

Remove direct dependency on the MERAM driver implementation by
introducing inline wrappers for MERAM operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/video/sh_mobile_meram.c |   24 ++++++++++++------------
 include/video/sh_mobile_meram.h |   28 ++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
index 82ba830..c51849f 100644
--- a/drivers/video/sh_mobile_meram.c
+++ b/drivers/video/sh_mobile_meram.c
@@ -444,11 +444,11 @@ static void meram_deinit(struct sh_mobile_meram_priv *priv,
  * Registration/unregistration
  */
 
-static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
-				      const struct sh_mobile_meram_cfg *cfg,
-				      unsigned int xres, unsigned int yres,
-				      unsigned int pixelformat,
-				      unsigned int *pitch)
+static void *__sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
+					const struct sh_mobile_meram_cfg *cfg,
+					unsigned int xres, unsigned int yres,
+					unsigned int pixelformat,
+					unsigned int *pitch)
 {
 	struct sh_mobile_meram_fb_cache *cache;
 	struct sh_mobile_meram_priv *priv = pdata->priv;
@@ -495,7 +495,7 @@ err:
 }
 
 static void
-sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
+__sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
 {
 	struct sh_mobile_meram_fb_cache *cache = data;
 	struct sh_mobile_meram_priv *priv = pdata->priv;
@@ -513,9 +513,9 @@ sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
 }
 
 static void
-sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
-		       unsigned long base_addr_y, unsigned long base_addr_c,
-		       unsigned long *icb_addr_y, unsigned long *icb_addr_c)
+__sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
+			 unsigned long base_addr_y, unsigned long base_addr_c,
+			 unsigned long *icb_addr_y, unsigned long *icb_addr_c)
 {
 	struct sh_mobile_meram_fb_cache *cache = data;
 	struct sh_mobile_meram_priv *priv = pdata->priv;
@@ -530,9 +530,9 @@ sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
 
 static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
 	.module			= THIS_MODULE,
-	.meram_register		= sh_mobile_meram_register,
-	.meram_unregister	= sh_mobile_meram_unregister,
-	.meram_update		= sh_mobile_meram_update,
+	.meram_register		= __sh_mobile_meram_register,
+	.meram_unregister	= __sh_mobile_meram_unregister,
+	.meram_update		= __sh_mobile_meram_update,
 };
 
 /* -----------------------------------------------------------------------------
diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
index 29b2fd3..b03f823 100644
--- a/include/video/sh_mobile_meram.h
+++ b/include/video/sh_mobile_meram.h
@@ -60,4 +60,32 @@ struct sh_mobile_meram_ops {
 			     unsigned long *icb_addr_c);
 };
 
+static inline void *
+sh_mobile_meram_register(struct sh_mobile_meram_info *mdev,
+			 const struct sh_mobile_meram_cfg *cfg,
+			 unsigned int xres, unsigned int yres,
+			 unsigned int pixelformat, unsigned int *pitch)
+{
+	if (mdev = NULL || mdev->ops = NULL || cfg = NULL)
+		return NULL;
+
+	return mdev->ops->meram_register(mdev, cfg, xres, yres, pixelformat,
+					 pitch);
+}
+
+static inline void
+sh_mobile_meram_unregister(struct sh_mobile_meram_info *mdev, void *data)
+{
+	mdev->ops->meram_unregister(mdev, data);
+}
+
+static inline void
+sh_mobile_meram_update(struct sh_mobile_meram_info *mdev, void *data,
+		       unsigned long base_addr_y, unsigned long base_addr_c,
+		       unsigned long *icb_addr_y, unsigned long *icb_addr_c)
+{
+	mdev->ops->meram_update(mdev, data, base_addr_y, base_addr_c,
+				icb_addr_y, icb_addr_c);
+}
+
 #endif /* __VIDEO_SH_MOBILE_MERAM_H__  */
-- 
1.7.3.4


                 reply	other threads:[~2012-05-31 16:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338482040-29827-2-git-send-email-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox