From patchwork Mon Sep 21 16:23:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11790435 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 7E00C618 for ; Mon, 21 Sep 2020 16:24:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65D0022262 for ; Mon, 21 Sep 2020 16:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705482; bh=hDidQZYFHfLHz/CQtAaJ7CeQCwScLN6A0yf7sRL/q5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SdYOrWm/xoSMJK7L2Nt0zZ5TxC1ULJVRgGZiRqSt++BgTcNKksMHZ4zAwwprJr7TW DfiEE6c+dtFY6dn/mewz7hRbATLaaeLT9vZZEfmIBwR+JF6HdNTf7t6TqYrG3A7oIY XC+32OyVsAjtZ5Nty392kEcZuOuQz+w90+6Yh5V0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728308AbgIUQYj (ORCPT ); Mon, 21 Sep 2020 12:24:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:51452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbgIUQYi (ORCPT ); Mon, 21 Sep 2020 12:24:38 -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 93C142311D; Mon, 21 Sep 2020 16:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705478; bh=hDidQZYFHfLHz/CQtAaJ7CeQCwScLN6A0yf7sRL/q5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QhhzmpwaGvDEsBJhKdganuogEOi+Zys7foCWrqHjXFtKZSvVOWdX6oHYKZJ+DEIRU eVS9TOIMUV4c1GuIr9mHo7x5fRSgHPVm+TkV2pQm87NmiFjG8AW/yEI1rrNLcHi2UX fbIe8JdDH6O8m8VkiDxi0y3Ficn9QEK76Wyfq76k= 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 06/25] media: i2c: imx355: simplify getting state container Date: Mon, 21 Sep 2020 18:23:23 +0200 Message-Id: <20200921162342.7348-6-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/imx355.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c index bed293b60e50..51245e71b411 100644 --- a/drivers/media/i2c/imx355.c +++ b/drivers/media/i2c/imx355.c @@ -1480,8 +1480,7 @@ static int imx355_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused imx355_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 imx355 *imx355 = to_imx355(sd); if (imx355->streaming) @@ -1492,8 +1491,7 @@ static int __maybe_unused imx355_suspend(struct device *dev) static int __maybe_unused imx355_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 imx355 *imx355 = to_imx355(sd); int ret;