Lines Matching full:sd
90 struct v4l2_subdev *sd, *next; in v4l2_device_unregister() local
99 list_for_each_entry_safe(sd, next, &v4l2_dev->subdevs, list) { in v4l2_device_unregister()
100 v4l2_device_unregister_subdev(sd); in v4l2_device_unregister()
101 if (sd->flags & V4L2_SUBDEV_FL_IS_I2C) in v4l2_device_unregister()
102 v4l2_i2c_subdev_unregister(sd); in v4l2_device_unregister()
103 else if (sd->flags & V4L2_SUBDEV_FL_IS_SPI) in v4l2_device_unregister()
104 v4l2_spi_subdev_unregister(sd); in v4l2_device_unregister()
112 struct v4l2_subdev *sd, struct module *module) in __v4l2_device_register_subdev() argument
117 if (!v4l2_dev || !sd || sd->v4l2_dev || !sd->name[0]) in __v4l2_device_register_subdev()
127 sd->owner_v4l2_dev = v4l2_dev->dev && v4l2_dev->dev->driver && in __v4l2_device_register_subdev()
130 if (!sd->owner_v4l2_dev && !try_module_get(module)) in __v4l2_device_register_subdev()
133 sd->v4l2_dev = v4l2_dev; in __v4l2_device_register_subdev()
135 err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler, in __v4l2_device_register_subdev()
143 err = media_device_register_entity(v4l2_dev->mdev, &sd->entity); in __v4l2_device_register_subdev()
149 if (sd->internal_ops && sd->internal_ops->registered) { in __v4l2_device_register_subdev()
150 err = sd->internal_ops->registered(sd); in __v4l2_device_register_subdev()
155 sd->owner = module; in __v4l2_device_register_subdev()
158 list_add_tail(&sd->list, &v4l2_dev->subdevs); in __v4l2_device_register_subdev()
165 media_device_unregister_entity(&sd->entity); in __v4l2_device_register_subdev()
168 if (!sd->owner_v4l2_dev) in __v4l2_device_register_subdev()
169 module_put(sd->owner); in __v4l2_device_register_subdev()
170 sd->v4l2_dev = NULL; in __v4l2_device_register_subdev()
175 static void v4l2_subdev_release(struct v4l2_subdev *sd) in v4l2_subdev_release() argument
177 struct module *owner = !sd->owner_v4l2_dev ? sd->owner : NULL; in v4l2_subdev_release()
179 if (sd->internal_ops && sd->internal_ops->release) in v4l2_subdev_release()
180 sd->internal_ops->release(sd); in v4l2_subdev_release()
181 sd->devnode = NULL; in v4l2_subdev_release()
195 struct v4l2_subdev *sd; in __v4l2_device_register_subdev_nodes() local
201 list_for_each_entry(sd, &v4l2_dev->subdevs, list) { in __v4l2_device_register_subdev_nodes()
202 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_DEVNODE)) in __v4l2_device_register_subdev_nodes()
205 if (sd->devnode) in __v4l2_device_register_subdev_nodes()
214 video_set_drvdata(vdev, sd); in __v4l2_device_register_subdev_nodes()
215 strscpy(vdev->name, sd->name, sizeof(vdev->name)); in __v4l2_device_register_subdev_nodes()
216 vdev->dev_parent = sd->dev; in __v4l2_device_register_subdev_nodes()
220 vdev->ctrl_handler = sd->ctrl_handler; in __v4l2_device_register_subdev_nodes()
223 sd->devnode = vdev; in __v4l2_device_register_subdev_nodes()
225 sd->owner); in __v4l2_device_register_subdev_nodes()
227 sd->devnode = NULL; in __v4l2_device_register_subdev_nodes()
232 sd->entity.info.dev.major = VIDEO_MAJOR; in __v4l2_device_register_subdev_nodes()
233 sd->entity.info.dev.minor = vdev->minor; in __v4l2_device_register_subdev_nodes()
239 link = media_create_intf_link(&sd->entity, in __v4l2_device_register_subdev_nodes()
253 list_for_each_entry(sd, &v4l2_dev->subdevs, list) { in __v4l2_device_register_subdev_nodes()
254 if (!sd->devnode) in __v4l2_device_register_subdev_nodes()
256 video_unregister_device(sd->devnode); in __v4l2_device_register_subdev_nodes()
263 void v4l2_device_unregister_subdev(struct v4l2_subdev *sd) in v4l2_device_unregister_subdev() argument
268 if (sd == NULL || sd->v4l2_dev == NULL) in v4l2_device_unregister_subdev()
271 v4l2_dev = sd->v4l2_dev; in v4l2_device_unregister_subdev()
274 list_del(&sd->list); in v4l2_device_unregister_subdev()
277 if (sd->internal_ops && sd->internal_ops->unregistered) in v4l2_device_unregister_subdev()
278 sd->internal_ops->unregistered(sd); in v4l2_device_unregister_subdev()
279 sd->v4l2_dev = NULL; in v4l2_device_unregister_subdev()
287 media_device_unregister_entity(&sd->entity); in v4l2_device_unregister_subdev()
290 if (sd->devnode) in v4l2_device_unregister_subdev()
291 video_unregister_device(sd->devnode); in v4l2_device_unregister_subdev()
293 v4l2_subdev_release(sd); in v4l2_device_unregister_subdev()