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 08/25] media: i2c: ad5820: simplify getting state container
Date: Thu, 29 Oct 2020 17:42:22 +0100 [thread overview]
Message-ID: <20201029164239.84240-8-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/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)
--
2.25.1
next prev parent reply other threads:[~2020-10-29 16:43 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 ` Krzysztof Kozlowski [this message]
2020-10-29 16:42 ` [RESEND PATCH 09/25] media: i2c: adp1653: simplify getting state container 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 ` [RESEND PATCH 22/25] media: i2c: ov7740: " Krzysztof Kozlowski
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-8-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).