summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/imx258.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzk@kernel.org>2021-01-27 20:46:34 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-02-06 11:36:29 +0300
commit2b585242b8619799fab2d0840f35cc936ed88749 (patch)
treec29284e65d8aeb113798a5ed361f26e07b2d77bc /drivers/media/i2c/imx258.c
parent9d14932d3eb0644684aa85b4f2dd5a90c455b2be (diff)
downloadlinux-2b585242b8619799fab2d0840f35cc936ed88749.tar.xz
media: i2c: imx258: simplify getting state container
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> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c/imx258.c')
-rw-r--r--drivers/media/i2c/imx258.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index ba7f29622974..505981e02cff 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -1018,8 +1018,7 @@ err_unlock:
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;