diff options
author | Mike Isely <isely@pobox.com> | 2009-10-11 23:13:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:40:58 -0500 |
commit | 4a89baa2e140fd4a12be55e03f8ebe1acabb1328 (patch) | |
tree | d07ffc40947e32b3ab1240b7664d62adf2127e7b /drivers/media/video | |
parent | 5abaa530bfe10e2a446679442b283f865a444a32 (diff) |
V4L/DVB (13222): pvrusb2: Make more info available to udev
pvrusb2: Associate V4L device node in sysfs with the underlying USB
device. This opens the door to device information tracking in udev
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 2d8825e5b1be..6aa48e0ae731 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
@@ -913,6 +913,15 @@ static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) | |||
913 | } | 913 | } |
914 | 914 | ||
915 | 915 | ||
916 | static void pvr2_v4l2_dev_disassociate_parent(struct pvr2_v4l2_dev *dip) | ||
917 | { | ||
918 | if (!dip) return; | ||
919 | if (!dip->devbase.parent) return; | ||
920 | dip->devbase.parent = NULL; | ||
921 | device_move(&dip->devbase.dev, NULL, DPM_ORDER_NONE); | ||
922 | } | ||
923 | |||
924 | |||
916 | static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) | 925 | static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) |
917 | { | 926 | { |
918 | if (vp->dev_video) { | 927 | if (vp->dev_video) { |
@@ -943,6 +952,8 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp) | |||
943 | struct pvr2_v4l2 *vp; | 952 | struct pvr2_v4l2 *vp; |
944 | vp = container_of(chp,struct pvr2_v4l2,channel); | 953 | vp = container_of(chp,struct pvr2_v4l2,channel); |
945 | if (!vp->channel.mc_head->disconnect_flag) return; | 954 | if (!vp->channel.mc_head->disconnect_flag) return; |
955 | pvr2_v4l2_dev_disassociate_parent(vp->dev_video); | ||
956 | pvr2_v4l2_dev_disassociate_parent(vp->dev_radio); | ||
946 | if (vp->vfirst) return; | 957 | if (vp->vfirst) return; |
947 | pvr2_v4l2_destroy_no_lock(vp); | 958 | pvr2_v4l2_destroy_no_lock(vp); |
948 | } | 959 | } |
@@ -1250,12 +1261,13 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, | |||
1250 | struct pvr2_v4l2 *vp, | 1261 | struct pvr2_v4l2 *vp, |
1251 | int v4l_type) | 1262 | int v4l_type) |
1252 | { | 1263 | { |
1264 | struct usb_device *usbdev; | ||
1253 | int mindevnum; | 1265 | int mindevnum; |
1254 | int unit_number; | 1266 | int unit_number; |
1255 | int *nr_ptr = NULL; | 1267 | int *nr_ptr = NULL; |
1256 | dip->v4lp = vp; | 1268 | dip->v4lp = vp; |
1257 | 1269 | ||
1258 | 1270 | usbdev = pvr2_hdw_get_dev(vp->channel.mc_head->hdw); | |
1259 | dip->v4l_type = v4l_type; | 1271 | dip->v4l_type = v4l_type; |
1260 | switch (v4l_type) { | 1272 | switch (v4l_type) { |
1261 | case VFL_TYPE_GRABBER: | 1273 | case VFL_TYPE_GRABBER: |
@@ -1296,6 +1308,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, | |||
1296 | if (nr_ptr && (unit_number >= 0) && (unit_number < PVR_NUM)) { | 1308 | if (nr_ptr && (unit_number >= 0) && (unit_number < PVR_NUM)) { |
1297 | mindevnum = nr_ptr[unit_number]; | 1309 | mindevnum = nr_ptr[unit_number]; |
1298 | } | 1310 | } |
1311 | dip->devbase.parent = &usbdev->dev; | ||
1299 | if ((video_register_device(&dip->devbase, | 1312 | if ((video_register_device(&dip->devbase, |
1300 | dip->v4l_type, mindevnum) < 0) && | 1313 | dip->v4l_type, mindevnum) < 0) && |
1301 | (video_register_device(&dip->devbase, | 1314 | (video_register_device(&dip->devbase, |