From patchwork Mon Sep 21 16:23:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11790471 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3578618 for ; Mon, 21 Sep 2020 16:26:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA050238E2 for ; Mon, 21 Sep 2020 16:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705603; bh=gC+DNSToyQJ3fKm3T67rR1nazhYlUpk4FDv6x9LB+zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uwYGKe5ZBzfCCmNjeZLKlrYebfLiGPXgiutd853XobZLEnc79tFDLGWR+iIY4R01i hieKfb3+LyPPAtgUAT66xOK8NfgRCzGnOeezN80kQQKLOO6PaJpj+Cn7w1aX8JZ0et nklHbAvy2GsMB6TXgHuqeSmSko1b9xeaUHxk5UXY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728442AbgIUQ0m (ORCPT ); Mon, 21 Sep 2020 12:26:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:53234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbgIUQ0l (ORCPT ); Mon, 21 Sep 2020 12:26:41 -0400 Received: from localhost.localdomain (unknown [194.230.155.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2ABA238D6; Mon, 21 Sep 2020 16:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705601; bh=gC+DNSToyQJ3fKm3T67rR1nazhYlUpk4FDv6x9LB+zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RkNeHKUyPU6Me0yH8Oukc9vEK2k+aoehoZnss5N3C0NVQNlR3XfJnVQGHo1q8VMVu mw02kmaiBrD7pAPiihB55J8KsVNooG7DHtz8BuHqZHX2ZkP4IaUQZdB3MyksyeWDcA y4Zbq2RVVomQghvjooZVH/dW+GGcFj+oJqUcYF+4= From: Krzysztof Kozlowski To: Pavel Machek , Sakari Ailus , Mauro Carvalho Chehab , Lars-Peter Clausen , Tianshu Qiu , Dongchun Zhu , Shawn Tu , Ricardo Ribalda , Dave Stevenson , Manivannan Sadhasivam , Bingbu Cao , Rui Miguel Silva , Shunqian Zheng , Chiranjeevi Rapolu , Hyungwoo Yang , Wenyou Yang , Hans Verkuil , Marco Felsch , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 20/25] media: i2c: ov5675: simplify getting state container Date: Mon, 21 Sep 2020 18:23:37 +0200 Message-Id: <20200921162342.7348-20-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200921162342.7348-1-krzk@kernel.org> References: <20200921162342.7348-1-krzk@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pointer to 'struct v4l2_subdev' is stored in drvdata via v4l2_i2c_subdev_init() so there is no point of a dance like: struct i2c_client *client = to_i2c_client(struct device *dev) struct v4l2_subdev *sd = i2c_get_clientdata(client); This allows to remove local variable 'client' and few pointer dereferences. Signed-off-by: Krzysztof Kozlowski --- drivers/media/i2c/ov5675.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c index 9540ce8918f0..5e35808037ad 100644 --- a/drivers/media/i2c/ov5675.c +++ b/drivers/media/i2c/ov5675.c @@ -889,8 +889,7 @@ static int ov5675_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused ov5675_suspend(struct device *dev) { - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *sd = i2c_get_clientdata(client); + struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ov5675 *ov5675 = to_ov5675(sd); mutex_lock(&ov5675->mutex); @@ -904,8 +903,7 @@ static int __maybe_unused ov5675_suspend(struct device *dev) static int __maybe_unused ov5675_resume(struct device *dev) { - struct i2c_client *client = to_i2c_client(dev); - struct v4l2_subdev *sd = i2c_get_clientdata(client); + struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ov5675 *ov5675 = to_ov5675(sd); int ret;