From patchwork Fri Apr 12 23:43:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 10899249 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1626218B7 for ; Fri, 12 Apr 2019 23:45:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01B7A28D7D for ; Fri, 12 Apr 2019 23:45:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA41528EFC; Fri, 12 Apr 2019 23:45:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1B0C28EA4 for ; Fri, 12 Apr 2019 23:45:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbfDLXpi (ORCPT ); Fri, 12 Apr 2019 19:45:38 -0400 Received: from bin-mail-out-06.binero.net ([195.74.38.229]:61871 "EHLO bin-mail-out-06.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbfDLXph (ORCPT ); Fri, 12 Apr 2019 19:45:37 -0400 X-Halon-ID: 0e9934f1-5d7d-11e9-8fa2-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 0e9934f1-5d7d-11e9-8fa2-005056917a89; Sat, 13 Apr 2019 01:45:31 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Laurent Pinchart , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 6/8] rcar-vin: Merge helpers dealing with powering the parallel subdevice Date: Sat, 13 Apr 2019 01:43:57 +0200 Message-Id: <20190412234359.5079-7-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190412234359.5079-1-niklas.soderlund+renesas@ragnatech.se> References: <20190412234359.5079-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The two power helpers are now only dealing with the parallel subdevice, merge them into a single rvin_power_parallel() helper to reduce code duplication. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 5a9658b7d848fc86..3b4624c117aaba18 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -749,23 +749,13 @@ static const struct v4l2_ioctl_ops rvin_mc_ioctl_ops = { * File Operations */ -static int rvin_power_on(struct rvin_dev *vin) +static int rvin_power_parallel(struct rvin_dev *vin, int on) { - int ret; struct v4l2_subdev *sd = vin_to_source(vin); - - ret = v4l2_subdev_call(sd, core, s_power, 1); - if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) - return ret; - return 0; -} - -static int rvin_power_off(struct rvin_dev *vin) -{ + int power = on ? 1 : 0; int ret; - struct v4l2_subdev *sd = vin_to_source(vin); - ret = v4l2_subdev_call(sd, core, s_power, 0); + ret = v4l2_subdev_call(sd, core, s_power, power); if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) return ret; @@ -777,7 +767,7 @@ static int rvin_initialize_device(struct file *file) struct rvin_dev *vin = video_drvdata(file); int ret; - ret = rvin_power_on(vin); + ret = rvin_power_parallel(vin, 1); if (ret < 0) return ret; @@ -844,7 +834,7 @@ static int rvin_release(struct file *file) * Then de-initialize hw module. */ if (fh_singular) - rvin_power_off(vin); + rvin_power_parallel(vin, 0); pm_runtime_put(vin->dev);