All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Subject: [PATCH 1/5] smiapp: Unify enforced and need-based 8-bit read
Date: Wed, 31 Aug 2016 10:42:01 +0300	[thread overview]
Message-ID: <1472629325-30875-2-git-send-email-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <1472629325-30875-1-git-send-email-sakari.ailus@linux.intel.com>

From: Sakari Ailus <sakari.ailus@iki.fi>

Unify enforced 8-bit read access with that based on actual need.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/smiapp/smiapp-regs.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-regs.c b/drivers/media/i2c/smiapp/smiapp-regs.c
index 6b6c20b..1e501c0 100644
--- a/drivers/media/i2c/smiapp/smiapp-regs.c
+++ b/drivers/media/i2c/smiapp/smiapp-regs.c
@@ -188,7 +188,8 @@ int smiapp_read_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val)
 				   SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY));
 }
 
-int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
+static int smiapp_read_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val,
+			     bool force8)
 {
 	int rval;
 
@@ -199,21 +200,20 @@ int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
 	if (rval < 0)
 		return rval;
 
+	if (force8)
+		return __smiapp_read(sensor, reg, val, true);
+
 	return smiapp_read_no_quirk(sensor, reg, val);
 }
 
-int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val)
+int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
 {
-	int rval;
-
-	*val = 0;
-	rval = smiapp_call_quirk(sensor, reg_access, false, &reg, val);
-	if (rval == -ENOIOCTLCMD)
-		return 0;
-	if (rval < 0)
-		return rval;
+	return smiapp_read_quirk(sensor, reg, val, false);
+}
 
-	return __smiapp_read(sensor, reg, val, true);
+int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val)
+{
+	return smiapp_read_quirk(sensor, reg, val, true);
 }
 
 int smiapp_write_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val)
-- 
2.7.4


  reply	other threads:[~2016-08-31  7:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-31  7:42 [PATCH 0/5] smiapp cleanups, retry probe if getting clock fails Sakari Ailus
2016-08-31  7:42 ` Sakari Ailus [this message]
2016-08-31  7:42 ` [PATCH 2/5] smiapp: Rename smiapp_platform_data as smiapp_hwconfig Sakari Ailus
2016-08-31  7:42 ` [PATCH 3/5] smiapp: Return -EPROBE_DEFER if the clock cannot be obtained Sakari Ailus
2016-08-31 12:13   ` Sebastian Reichel
2016-08-31 12:57   ` [PATCH v1.1 " Sakari Ailus
2016-08-31 13:57     ` Sebastian Reichel
2016-08-31 13:00   ` [PATCH v1.1 5/5] smiapp: Switch to gpiod API for GPIO control Sakari Ailus
2016-08-31 14:18     ` Sebastian Reichel
2016-09-01  6:48     ` [PATCH v1.2 " Sakari Ailus
2016-09-01 11:50       ` Sebastian Reichel
2016-08-31  7:42 ` [PATCH 4/5] smiapp: Constify the regs argument to smiapp_write_8s() Sakari Ailus
2016-08-31  7:42 ` [PATCH 5/5] smiapp: Switch to gpiod API for GPIO control Sakari Ailus
2016-08-31 12:09   ` Sebastian Reichel
2016-08-31 12:42     ` Sakari Ailus
2016-08-31 12:21 ` [PATCH 0/5] smiapp cleanups, retry probe if getting clock fails Sebastian Reichel
2016-08-31 13:01 ` [PATCH v1.1 6/6] smiapp: Remove set_xclk() callback from hwconfig Sakari Ailus
2016-08-31 14:21   ` Sebastian Reichel

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=1472629325-30875-2-git-send-email-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.