From patchwork Wed Nov 4 10:36:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 315045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89F0FC2D0A3 for ; Wed, 4 Nov 2020 10:37:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4283721734 for ; Wed, 4 Nov 2020 10:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728867AbgKDKhN (ORCPT ); Wed, 4 Nov 2020 05:37:13 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:52471 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729370AbgKDKhN (ORCPT ); Wed, 4 Nov 2020 05:37:13 -0500 X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 70F782000C; Wed, 4 Nov 2020 10:37:09 +0000 (UTC) From: Jacopo Mondi To: linux-media@vger.kernel.org Cc: Jacopo Mondi , mchehab@kernel.org, sakari.ailus@linux.intel.com, hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, roman.kovalivskyi@globallogic.com, dafna.hirschfeld@collabora.com, dave.stevenson@raspberrypi.org, naush@raspberrypi.com, erosca@de.adit-jv.com Subject: [PATCH v2 13/30] media: ov5647: Rationalize driver structure name Date: Wed, 4 Nov 2020 11:36:05 +0100 Message-Id: <20201104103622.595908-14-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201104103622.595908-1-jacopo@jmondi.org> References: <20201104103622.595908-1-jacopo@jmondi.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The driver structure name is referred to with different names ('ov5647', 'state', 'sensor') in different functions in the driver. Polish this up by using 'struct ov5647 *sensor' everywhere. Signed-off-by: Jacopo Mondi --- drivers/media/i2c/ov5647.c | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index 4a009848cefc8..91193706b6fe1 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -98,7 +98,7 @@ struct ov5647 { struct v4l2_ctrl_handler ctrls; }; -static inline struct ov5647 *to_state(struct v4l2_subdev *sd) +static inline struct ov5647 *to_sensor(struct v4l2_subdev *sd) { return container_of(sd, struct ov5647, sd); } @@ -310,7 +310,7 @@ static int ov5647_set_mode(struct v4l2_subdev *sd) static int ov5647_stream_on(struct v4l2_subdev *sd) { struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov5647 *ov5647 = to_state(sd); + struct ov5647 *sensor = to_sensor(sd); u8 val = MIPI_CTRL00_BUS_IDLE; int ret; @@ -325,7 +325,7 @@ static int ov5647_stream_on(struct v4l2_subdev *sd) if (ret) return ret; - if (ov5647->clock_ncont) + if (sensor->clock_ncont) val |= MIPI_CTRL00_CLOCK_LANE_GATE | MIPI_CTRL00_LINE_SYNC_ENABLE; @@ -376,20 +376,20 @@ static int set_sw_standby(struct v4l2_subdev *sd, bool standby) static int ov5647_sensor_power(struct v4l2_subdev *sd, int on) { struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov5647 *ov5647 = to_state(sd); + struct ov5647 *sensor = to_sensor(sd); int ret = 0; - mutex_lock(&ov5647->lock); + mutex_lock(&sensor->lock); - if (on && !ov5647->power_count) { + if (on && !sensor->power_count) { dev_dbg(&client->dev, "OV5647 power on\n"); - if (ov5647->pwdn) { - gpiod_set_value_cansleep(ov5647->pwdn, 0); + if (sensor->pwdn) { + gpiod_set_value_cansleep(sensor->pwdn, 0); msleep(PWDN_ACTIVE_DELAY_MS); } - ret = clk_prepare_enable(ov5647->xclk); + ret = clk_prepare_enable(sensor->xclk); if (ret < 0) { dev_err(&client->dev, "clk prepare enable failed\n"); goto out; @@ -398,7 +398,7 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on) ret = ov5647_write_array(sd, sensor_oe_enable_regs, ARRAY_SIZE(sensor_oe_enable_regs)); if (ret < 0) { - clk_disable_unprepare(ov5647->xclk); + clk_disable_unprepare(sensor->xclk); dev_err(&client->dev, "write sensor_oe_enable_regs error\n"); goto out; @@ -407,12 +407,12 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on) /* Stream off to coax lanes into LP-11 state. */ ret = ov5647_stream_off(sd); if (ret < 0) { - clk_disable_unprepare(ov5647->xclk); + clk_disable_unprepare(sensor->xclk); dev_err(&client->dev, "Camera not available, check Power\n"); goto out; } - } else if (!on && ov5647->power_count == 1) { + } else if (!on && sensor->power_count == 1) { dev_dbg(&client->dev, "OV5647 power off\n"); ret = ov5647_write_array(sd, sensor_oe_disable_regs, @@ -424,16 +424,16 @@ static int ov5647_sensor_power(struct v4l2_subdev *sd, int on) if (ret < 0) dev_dbg(&client->dev, "soft stby failed\n"); - clk_disable_unprepare(ov5647->xclk); - gpiod_set_value_cansleep(ov5647->pwdn, 1); + clk_disable_unprepare(sensor->xclk); + gpiod_set_value_cansleep(sensor->pwdn, 1); } /* Update the power count. */ - ov5647->power_count += on ? 1 : -1; - WARN_ON(ov5647->power_count < 0); + sensor->power_count += on ? 1 : -1; + WARN_ON(sensor->power_count < 0); out: - mutex_unlock(&ov5647->lock); + mutex_unlock(&sensor->lock); return ret; } @@ -473,7 +473,7 @@ static const struct v4l2_subdev_core_ops ov5647_subdev_core_ops = { static int ov5647_s_stream(struct v4l2_subdev *sd, int enable) { - struct ov5647 *sensor = to_state(sd); + struct ov5647 *sensor = to_sensor(sd); int ret; mutex_lock(&sensor->lock); @@ -863,13 +863,13 @@ static int ov5647_probe(struct i2c_client *client) static int ov5647_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); - struct ov5647 *ov5647 = to_state(sd); + struct ov5647 *sensor = to_sensor(sd); - v4l2_async_unregister_subdev(&ov5647->sd); - media_entity_cleanup(&ov5647->sd.entity); - v4l2_ctrl_handler_free(&ov5647->ctrls); + v4l2_async_unregister_subdev(&sensor->sd); + media_entity_cleanup(&sensor->sd.entity); + v4l2_ctrl_handler_free(&sensor->ctrls); v4l2_device_unregister_subdev(sd); - mutex_destroy(&ov5647->lock); + mutex_destroy(&sensor->lock); return 0; }