X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=include%2Fmedia%2Fv4l2-device.h;h=5d5d550e63ad0e2c7a0c1811a42e1f031743068a;hb=d8d9129ea28e2177749627c82962feb26e8d11e9;hp=3d8e96f6ceb30716d29c6f6e83793e26f1aef2e8;hpb=98ec633972a70cf71d71bc8762804f0af4792d08;p=safe%2Fjmp%2Flinux-2.6 diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index 3d8e96f..5d5d550 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h @@ -30,7 +30,7 @@ basic V4L2 device-level support. */ -#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) +#define V4L2_DEVICE_NAME_SIZE (20 + 16) struct v4l2_device { /* dev->driver_data points to this struct. @@ -53,7 +53,32 @@ struct v4l2_device { dev may be NULL in rare cases (ISA devices). In that case you must fill in the v4l2_dev->name field before calling this function. */ int __must_check v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev); -/* Set v4l2_dev->dev->driver_data to NULL and unregister all sub-devices */ + +/* Optional function to initialize the name field of struct v4l2_device using + the driver name and a driver-global atomic_t instance. + This function will increment the instance counter and returns the instance + value used in the name. + + Example: + + static atomic_t drv_instance = ATOMIC_INIT(0); + + ... + + instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance); + + The first time this is called the name field will be set to foo0 and + this function returns 0. If the name ends with a digit (e.g. cx18), + then the name will be set to cx18-0 since cx180 looks really odd. */ +int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename, + atomic_t *instance); + +/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects. + Since the parent disappears this ensures that v4l2_dev doesn't have an + invalid parent pointer. */ +void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); + +/* Unregister all sub-devices and any other resources related to v4l2_dev. */ void v4l2_device_unregister(struct v4l2_device *v4l2_dev); /* Register a subdev with a v4l2 device. While registered the subdev module