]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: i2c: imx258: simplify getting state container
authorKrzysztof Kozlowski <krzk@kernel.org>
Wed, 27 Jan 2021 17:46:34 +0000 (18:46 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 6 Feb 2021 08:36:29 +0000 (09:36 +0100)
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>
drivers/media/i2c/imx258.c

index ba7f296229747d47fd5f14c2f038fbc4533b6d57..505981e02cff22ebcbc67dde2be294ba3e4c736a 100644 (file)
@@ -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;