From patchwork Wed Sep 23 15:21:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 67301 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1kL6Ub-003jy3-1T; Wed, 23 Sep 2020 15:15:37 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726806AbgIWPV5 (ORCPT + 1 other); Wed, 23 Sep 2020 11:21:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:41264 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgIWPV4 (ORCPT ); Wed, 23 Sep 2020 11:21:56 -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 A2C31221E7; Wed, 23 Sep 2020 15:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600874516; bh=+tyuJ8q5tjs0jpFIPnpAR8bb5kiLEh5MWM0XHwgZgz0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sUCUIUoUUR9CrF6o2sXj2S9Tqz0z+l8tXQnNuiXIROgOWFhTBxOz7rsEcDBSJOevC 00WjyLhmw9x7dboS2T/3gaI8ExtLKsCxCKCnqSJV0FzhJSi2n3QzScek8DXfgIzuhu 7qQ72iMlLyMWV6ZafCcBdrq+USeQLLqHzE2N+V9o= From: Krzysztof Kozlowski To: Sakari Ailus , Mauro Carvalho Chehab , Rob Herring , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Krzysztof Kozlowski , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/4] media: i2c: imx258: simplify getting state container Date: Wed, 23 Sep 2020 17:21:28 +0200 Message-Id: <20200923152129.21736-3-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200923152129.21736-1-krzk@kernel.org> References: <20200923152129.21736-1-krzk@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -3.1 (---) X-LSpam-Report: No, score=-3.1 required=5.0 tests=BAYES_00=-1.9,DKIMWL_WL_HIGH=0.001,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VALID_EF=-0.1,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no 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 --- Changes since v3: 1. None Changes since v2: 1. New patch --- drivers/media/i2c/imx258.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c index ed79bfb4c991..ae183b0dbba9 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -1018,8 +1018,7 @@ static int imx258_set_stream(struct v4l2_subdev *sd, int enable) static int __maybe_unused imx258_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 imx258 *imx258 = to_imx258(sd); if (imx258->streaming) @@ -1030,8 +1029,7 @@ static int __maybe_unused imx258_suspend(struct device *dev) static int __maybe_unused imx258_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 imx258 *imx258 = to_imx258(sd); int ret;