In preparation to move the call to max9286_check_config_link() in the notifier's bound callback, move the notifier's ops below the max9286_check_config_link() function. Cosmetic change, no functional changes intended. Signed-off-by: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx> --- drivers/media/i2c/max9286.c | 114 ++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c index ab84f0fa66dc..3c2c1f506983 100644 --- a/drivers/media/i2c/max9286.c +++ b/drivers/media/i2c/max9286.c @@ -445,63 +445,6 @@ static void max9286_configure_i2c(struct max9286_priv *priv, bool localack) usleep_range(3000, 5000); } -/* ----------------------------------------------------------------------------- - * V4L2 Subdev - */ - -static int max9286_notify_bound(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *subdev, - struct v4l2_async_subdev *asd) -{ - struct max9286_priv *priv = sd_to_max9286(notifier->sd); - struct max9286_source *source = asd_to_max9286_source(asd); - unsigned int index = to_index(priv, source); - unsigned int src_pad; - int ret; - - ret = media_entity_get_fwnode_pad(&subdev->entity, - source->fwnode, - MEDIA_PAD_FL_SOURCE); - if (ret < 0) { - dev_err(&priv->client->dev, - "Failed to find pad for %s\n", subdev->name); - return ret; - } - - source->sd = subdev; - src_pad = ret; - - ret = media_create_pad_link(&source->sd->entity, src_pad, - &priv->sd.entity, index, - MEDIA_LNK_FL_ENABLED | - MEDIA_LNK_FL_IMMUTABLE); - if (ret) { - dev_err(&priv->client->dev, - "Unable to link %s:%u -> %s:%u\n", - source->sd->name, src_pad, priv->sd.name, index); - return ret; - } - - dev_dbg(&priv->client->dev, "Bound %s pad: %u on index %u\n", - subdev->name, src_pad, index); - - return 0; -} - -static void max9286_notify_unbind(struct v4l2_async_notifier *notifier, - struct v4l2_subdev *subdev, - struct v4l2_async_subdev *asd) -{ - struct max9286_source *source = asd_to_max9286_source(asd); - - source->sd = NULL; -} - -static const struct v4l2_async_notifier_operations max9286_notify_ops = { - .bound = max9286_notify_bound, - .unbind = max9286_notify_unbind, -}; - /* * max9286_check_config_link() - Detect and wait for configuration links * @@ -602,6 +545,63 @@ static int max9286_check_video_links(struct max9286_priv *priv) return 0; } +/* ----------------------------------------------------------------------------- + * V4L2 Subdev + */ + +static int max9286_notify_bound(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) +{ + struct max9286_priv *priv = sd_to_max9286(notifier->sd); + struct max9286_source *source = asd_to_max9286_source(asd); + unsigned int index = to_index(priv, source); + unsigned int src_pad; + int ret; + + ret = media_entity_get_fwnode_pad(&subdev->entity, + source->fwnode, + MEDIA_PAD_FL_SOURCE); + if (ret < 0) { + dev_err(&priv->client->dev, + "Failed to find pad for %s\n", subdev->name); + return ret; + } + + source->sd = subdev; + src_pad = ret; + + ret = media_create_pad_link(&source->sd->entity, src_pad, + &priv->sd.entity, index, + MEDIA_LNK_FL_ENABLED | + MEDIA_LNK_FL_IMMUTABLE); + if (ret) { + dev_err(&priv->client->dev, + "Unable to link %s:%u -> %s:%u\n", + source->sd->name, src_pad, priv->sd.name, index); + return ret; + } + + dev_dbg(&priv->client->dev, "Bound %s pad: %u on index %u\n", + subdev->name, src_pad, index); + + return 0; +} + +static void max9286_notify_unbind(struct v4l2_async_notifier *notifier, + struct v4l2_subdev *subdev, + struct v4l2_async_subdev *asd) +{ + struct max9286_source *source = asd_to_max9286_source(asd); + + source->sd = NULL; +} + +static const struct v4l2_async_notifier_operations max9286_notify_ops = { + .bound = max9286_notify_bound, + .unbind = max9286_notify_unbind, +}; + static int max9286_s_stream(struct v4l2_subdev *sd, int enable) { struct max9286_priv *priv = sd_to_max9286(sd); -- 2.24.0