static struct video_device *video_device[VIDEO_NUM_DEVICES];
数组元素赋值:
/* Should not happen since we thought this minor was free */
WARN_ON(video_device[vdev->minor] != NULL);
vdev->index = get_index(vdev);
video_device[vdev->minor] = vdev;
得到数组元素
struct video_device *video_devdata(struct file *file)
{
return video_device[iminor(file_inode(file))];
}
EXPORT_SYMBOL(video_devdata);
清空数组元素
/* Free up this device for reuse */
video_device[vdev->minor] = NULL;