[media] smiapp: create pad links after subdev registration
authorJavier Martinez Canillas <javier@osg.samsung.com>
Thu, 3 Sep 2015 12:00:27 +0000 (09:00 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:18:46 +0000 (12:18 -0200)
The smiapp driver creates the pads links before the media entity is
registered with the media device. This doesn't work now that object
IDs are used to create links so the media_device has to be set.

Move entity registration logic before pads links creation.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/smiapp/smiapp-core.c

index cf0cd507c2d0c3e06cb79c89a1cabfaabb410257..df4f8824c344bac4028019b44f9ebc70a294f7d5 100644 (file)
@@ -2495,23 +2495,23 @@ static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
                        return rval;
                }
 
-               rval = media_create_pad_link(&this->sd.entity,
-                                               this->source_pad,
-                                               &last->sd.entity,
-                                               last->sink_pad,
-                                               MEDIA_LNK_FL_ENABLED |
-                                               MEDIA_LNK_FL_IMMUTABLE);
+               rval = v4l2_device_register_subdev(sensor->src->sd.v4l2_dev,
+                                                  &this->sd);
                if (rval) {
                        dev_err(&client->dev,
-                               "media_create_pad_link failed\n");
+                               "v4l2_device_register_subdev failed\n");
                        return rval;
                }
 
-               rval = v4l2_device_register_subdev(sensor->src->sd.v4l2_dev,
-                                                  &this->sd);
+               rval = media_create_pad_link(&this->sd.entity,
+                                            this->source_pad,
+                                            &last->sd.entity,
+                                            last->sink_pad,
+                                            MEDIA_LNK_FL_ENABLED |
+                                            MEDIA_LNK_FL_IMMUTABLE);
                if (rval) {
                        dev_err(&client->dev,
-                               "v4l2_device_register_subdev failed\n");
+                               "media_create_pad_link failed\n");
                        return rval;
                }
        }