diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2021-01-18 04:52:58 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-02-06 11:18:53 +0300 |
commit | b01edcbd409cf713ff4516c6e1e057834b4b43d6 (patch) | |
tree | 181ddb81830a3313b09cd3dd007b184c874199d0 /drivers/media/platform/pxa_camera.c | |
parent | c1cc236250629f3181e2b98c16db2642e295278a (diff) | |
download | linux-b01edcbd409cf713ff4516c6e1e057834b4b43d6.tar.xz |
media: v4l2-async: Improve v4l2_async_notifier_add_*_subdev() API
The functions that add an async subdev to an async subdev notifier take
as an argument the size of the container structure they need to
allocate. This is error prone, as passing an invalid size will not be
caught by the compiler. Wrap those functions in macros that take a
container type instead of a size, and cast the returned pointer to the
desired type. The compiler will catch mistakes if the incorrect type is
passed to the macro, as the assignment types won't match.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> (core+ti-cal)
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform/pxa_camera.c')
-rw-r--r-- | drivers/media/platform/pxa_camera.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index b579ce2e93b6..7f92de351c52 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -2259,7 +2259,7 @@ static int pxa_camera_pdata_from_dt(struct device *dev, asd = v4l2_async_notifier_add_fwnode_remote_subdev( &pcdev->notifier, of_fwnode_handle(np), - sizeof(*asd)); + struct v4l2_async_subdev); if (IS_ERR(asd)) err = PTR_ERR(asd); out: @@ -2309,7 +2309,7 @@ static int pxa_camera_probe(struct platform_device *pdev) &pcdev->notifier, pcdev->pdata->sensor_i2c_adapter_id, pcdev->pdata->sensor_i2c_address, - sizeof(*asd)); + struct v4l2_async_subdev); if (IS_ERR(asd)) err = PTR_ERR(asd); } else if (pdev->dev.of_node) { |