public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Cox <alan@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	linux-media@vger.kernel.org, devel@driverdev.osuosl.org
Subject: [PATCH 6/7] staging: atomisp: Ignore errors from second gpio in ov2680 driver
Date: Sun, 28 May 2017 14:31:52 +0200	[thread overview]
Message-ID: <20170528123153.18613-6-hdegoede@redhat.com> (raw)
In-Reply-To: <20170528123153.18613-1-hdegoede@redhat.com>

As the existing comment in the driver indicates the sensor has only 1 pin,
but some boards may have 2 gpios defined and we toggle both as we we don't
know which one is the right one. However if the ACPI resources table
defines only 1 gpio (as expected) the gpio1_ctrl call will always fail,
causing the probing of the driver to file.

This commit ignore the return value of the gpio1_ctrl call, fixing this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/staging/media/atomisp/i2c/ov2680.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/ov2680.c b/drivers/staging/media/atomisp/i2c/ov2680.c
index 449aa2aa276f..6dd466558701 100644
--- a/drivers/staging/media/atomisp/i2c/ov2680.c
+++ b/drivers/staging/media/atomisp/i2c/ov2680.c
@@ -885,11 +885,12 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag)
 	if (flag) {
 		ret = dev->platform_data->gpio0_ctrl(sd, 1);
 		usleep_range(10000, 15000);
-		ret |= dev->platform_data->gpio1_ctrl(sd, 1);
+		/* Ignore return from second gpio, it may not be there */
+		dev->platform_data->gpio1_ctrl(sd, 1);
 		usleep_range(10000, 15000);
 	} else {
-		ret = dev->platform_data->gpio1_ctrl(sd, 0);
-		ret |= dev->platform_data->gpio0_ctrl(sd, 0);
+		dev->platform_data->gpio1_ctrl(sd, 0);
+		ret = dev->platform_data->gpio0_ctrl(sd, 0);
 	}
 	return ret;
 }
-- 
2.13.0

  parent reply	other threads:[~2017-05-28 12:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-28 12:31 [PATCH 1/7] staging: atomisp: Fix calling efivar_entry_get() with unaligned arguments Hans de Goede
2017-05-28 12:31 ` [PATCH 2/7] staging: atomisp: Do not call dev_warn with a NULL device Hans de Goede
2017-05-28 13:06   ` Andy Shevchenko
2017-05-28 12:31 ` [PATCH 3/7] staging: atomisp: Set step to 0 for mt9m114 menu control Hans de Goede
2017-05-28 12:31 ` [PATCH 4/7] staging: atomisp: Add INT0310 ACPI id to gc0310 driver Hans de Goede
2017-05-28 12:31 ` [PATCH 5/7] staging: atomisp: Add OVTI2680 ACPI id to ov2680 driver Hans de Goede
2017-05-28 12:31 ` Hans de Goede [this message]
2017-05-28 12:31 ` [PATCH 7/7] staging: atomisp: Make ov2680 driver less chatty Hans de Goede

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=20170528123153.18613-6-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=alan@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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