From patchwork Mon Sep 21 16:23:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 11790439 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 4209F618 for ; Mon, 21 Sep 2020 16:24:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 241C323119 for ; Mon, 21 Sep 2020 16:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705495; bh=P0jvNjjhgra13TjWEU6bNdPuzscnOCE65YgyQ0Wa8Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bzhLcygZfWfmPoI4+Jnb3q6ZByaGVb73Rzkqgx5Vojp2e+z7kx1Ip9CpdzZmhUjH+ I9bZgJw5f3k3yAxIGflmBuNZtAEZk17ro+4Wgb2qN+rC9rU+GSt3IZ5eQoI2x4b36Q nlqiP+nKEfbhrVyjyZAPYqAsofmMxB2R/frUW/IU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728323AbgIUQYw (ORCPT ); Mon, 21 Sep 2020 12:24:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:51664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbgIUQYv (ORCPT ); Mon, 21 Sep 2020 12:24:51 -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 EBA5022262; Mon, 21 Sep 2020 16:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600705491; bh=P0jvNjjhgra13TjWEU6bNdPuzscnOCE65YgyQ0Wa8Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JfPfRqA2Uy9bLcj7IEndyU+ovjavnS/nsWRcIB9B71U+5zaLLmZsgJdnfH2ATws1b Ma7oypg5TPpn9mZl9WCy9fgVn4lyhHEKoe7IpDxge2enVBy7ppx9cJ9rLGQ3aKrxPM SI1GVWTO/HkOaSQvLvAHXble/cNre0KH28vTZz3I= 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 08/25] media: i2c: ad5820: simplify getting state container Date: Mon, 21 Sep 2020 18:23:25 +0200 Message-Id: <20200921162342.7348-8-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/ad5820.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c index 19c74db0649f..2958a4694461 100644 --- a/drivers/media/i2c/ad5820.c +++ b/drivers/media/i2c/ad5820.c @@ -270,8 +270,7 @@ static const struct v4l2_subdev_internal_ops ad5820_internal_ops = { */ static int __maybe_unused ad5820_suspend(struct device *dev) { - struct i2c_client *client = container_of(dev, struct i2c_client, dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct v4l2_subdev *subdev = dev_get_drvdata(dev); struct ad5820_device *coil = to_ad5820_device(subdev); if (!coil->power_count) @@ -282,8 +281,7 @@ static int __maybe_unused ad5820_suspend(struct device *dev) static int __maybe_unused ad5820_resume(struct device *dev) { - struct i2c_client *client = container_of(dev, struct i2c_client, dev); - struct v4l2_subdev *subdev = i2c_get_clientdata(client); + struct v4l2_subdev *subdev = dev_get_drvdata(dev); struct ad5820_device *coil = to_ad5820_device(subdev); if (!coil->power_count)