[media] smiapp: Register async subdev
[deliverable/linux.git] / drivers / media / i2c / smiapp / smiapp-core.c
index 0df5070e73c7581ca0947f4f756560aae2ab4f1c..2c65ff3ed769945bfcad09de1c732ed0c5f300e5 100644 (file)
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
  */
 
 #include <linux/clk.h>
@@ -2464,8 +2458,6 @@ static int smiapp_identify_module(struct v4l2_subdev *subdev)
                minfo->name, minfo->manufacturer_id, minfo->model_id,
                minfo->revision_number_major);
 
-       strlcpy(subdev->name, sensor->minfo.name, sizeof(subdev->name));
-
        return 0;
 }
 
@@ -2950,8 +2942,21 @@ static int smiapp_probe(struct i2c_client *client,
        sensor->src->sensor = sensor;
 
        sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE;
-       return media_entity_init(&sensor->src->sd.entity, 2,
+       rval = media_entity_init(&sensor->src->sd.entity, 2,
                                 sensor->src->pads, 0);
+       if (rval < 0)
+               return rval;
+
+       rval = v4l2_async_register_subdev(&sensor->src->sd);
+       if (rval < 0)
+               goto out_media_entity_cleanup;
+
+       return 0;
+
+out_media_entity_cleanup:
+       media_entity_cleanup(&sensor->src->sd.entity);
+
+       return rval;
 }
 
 static int smiapp_remove(struct i2c_client *client)
@@ -2960,6 +2965,8 @@ static int smiapp_remove(struct i2c_client *client)
        struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
        unsigned int i;
 
+       v4l2_async_unregister_subdev(subdev);
+
        if (sensor->power_count) {
                if (gpio_is_valid(sensor->platform_data->xshutdown))
                        gpio_set_value(sensor->platform_data->xshutdown, 0);
This page took 0.024825 seconds and 5 git commands to generate.