linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Pavel Machek <pavel@ucw.cz>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	Dongchun Zhu <dongchun.zhu@mediatek.com>,
	Shawn Tu <shawnx.tu@intel.com>,
	Ricardo Ribalda <ribalda@kernel.org>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Bingbu Cao <bingbu.cao@intel.com>,
	Rui Miguel Silva <rmfrfs@gmail.com>,
	Shunqian Zheng <zhengsq@rock-chips.com>,
	Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>,
	Hyungwoo Yang <hyungwoo.yang@intel.com>,
	Wenyou Yang <wenyou.yang@microchip.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Subject: [RESEND PATCH 22/25] media: i2c: ov7740: simplify getting state container
Date: Thu, 29 Oct 2020 17:42:36 +0100	[thread overview]
Message-ID: <20201029164239.84240-22-krzk@kernel.org> (raw)
In-Reply-To: <20201029164239.84240-1-krzk@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 <krzk@kernel.org>
---
 drivers/media/i2c/ov7740.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c
index 5832461c032d..47a9003d29d6 100644
--- a/drivers/media/i2c/ov7740.c
+++ b/drivers/media/i2c/ov7740.c
@@ -1176,8 +1176,7 @@ static int ov7740_remove(struct i2c_client *client)
 
 static int __maybe_unused ov7740_runtime_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 ov7740 *ov7740 = container_of(sd, struct ov7740, subdev);
 
 	ov7740_set_power(ov7740, 0);
@@ -1187,8 +1186,7 @@ static int __maybe_unused ov7740_runtime_suspend(struct device *dev)
 
 static int __maybe_unused ov7740_runtime_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 ov7740 *ov7740 = container_of(sd, struct ov7740, subdev);
 
 	return ov7740_set_power(ov7740, 1);
-- 
2.25.1


  parent reply	other threads:[~2020-10-29 16:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 16:42 [RESEND PATCH 01/25] media: i2c: imx214: simplify getting state container Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 02/25] media: i2c: imx219: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 03/25] media: i2c: imx290: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 04/25] media: i2c: imx319: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 05/25] media: i2c: imx319: silence unused acpi_device_id warning Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 06/25] media: i2c: imx355: simplify getting state container Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 07/25] media: i2c: imx355: silence unused acpi_device_id warning Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 08/25] media: i2c: ad5820: simplify getting state container Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 09/25] media: i2c: adp1653: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 10/25] media: i2c: adv7180: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 11/25] media: i2c: ak7375: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 12/25] media: i2c: dw9768: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 13/25] media: i2c: et8ek8: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 14/25] media: i2c: hi556: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 15/25] media: i2c: ov13858: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 16/25] media: i2c: ov2680: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 17/25] media: i2c: ov2685: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 18/25] media: i2c: ov2740: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 19/25] media: i2c: ov5670: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 20/25] media: i2c: ov5675: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 21/25] media: i2c: ov5695: " Krzysztof Kozlowski
2020-10-29 16:42 ` Krzysztof Kozlowski [this message]
2020-10-29 16:42 ` [RESEND PATCH 23/25] media: i2c: ov8856: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 24/25] media: i2c: smiapp: " Krzysztof Kozlowski
2020-10-29 16:42 ` [RESEND PATCH 25/25] media: i2c: tvp5150: " Krzysztof Kozlowski
2020-10-30  9:17 ` [RESEND PATCH 01/25] media: i2c: imx214: " Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201029164239.84240-22-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=bingbu.cao@intel.com \
    --cc=chiranjeevi.rapolu@intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dongchun.zhu@mediatek.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=hyungwoo.yang@intel.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mchehab@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=ribalda@kernel.org \
    --cc=rmfrfs@gmail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=shawnx.tu@intel.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=wenyou.yang@microchip.com \
    --cc=zhengsq@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).