[v1,04/19] uvcvideo: Create separate debugfs entries for each streaming interface.

Message ID 1377829038-4726-5-git-send-email-posciak@chromium.org (mailing list archive)
State Changes Requested, archived
Delegated to: Laurent Pinchart
Headers

Commit Message

Pawel Osciak Aug. 30, 2013, 2:17 a.m. UTC
  Add interface number to debugfs entry name to be able to create separate
entries for each streaming interface for devices exposing more than one,
instead of failing to create more than one.

Signed-off-by: Pawel Osciak <posciak@chromium.org>
---
 drivers/media/usb/uvc/uvc_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Laurent Pinchart Sept. 3, 2013, 8:28 p.m. UTC | #1
Hi Pawel,

Thank you for the patch.

On Friday 30 August 2013 11:17:03 Pawel Osciak wrote:
> Add interface number to debugfs entry name to be able to create separate
> entries for each streaming interface for devices exposing more than one,
> instead of failing to create more than one.
> 
> Signed-off-by: Pawel Osciak <posciak@chromium.org>
> ---
>  drivers/media/usb/uvc/uvc_debugfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_debugfs.c
> b/drivers/media/usb/uvc/uvc_debugfs.c index 14561a5..0663fbd 100644
> --- a/drivers/media/usb/uvc/uvc_debugfs.c
> +++ b/drivers/media/usb/uvc/uvc_debugfs.c
> @@ -84,7 +84,8 @@ int uvc_debugfs_init_stream(struct uvc_streaming *stream)
>  	if (uvc_debugfs_root_dir == NULL)
>  		return -ENODEV;
> 
> -	sprintf(dir_name, "%u-%u", udev->bus->busnum, udev->devnum);
> +	sprintf(dir_name, "%u-%u-%u", udev->bus->busnum, udev->devnum,

What about %u-%u.%u ? The USB subsystem names devices using devnum.intfnum 
(which can be seen in /sys/bus/usb/devices/ for instance), so I believe it 
would be a good idea to follow the same naming conventions.

> +			stream->intfnum);
> 
>  	dent = debugfs_create_dir(dir_name, uvc_debugfs_root_dir);
>  	if (IS_ERR_OR_NULL(dent)) {
  

Patch

diff --git a/drivers/media/usb/uvc/uvc_debugfs.c b/drivers/media/usb/uvc/uvc_debugfs.c
index 14561a5..0663fbd 100644
--- a/drivers/media/usb/uvc/uvc_debugfs.c
+++ b/drivers/media/usb/uvc/uvc_debugfs.c
@@ -84,7 +84,8 @@  int uvc_debugfs_init_stream(struct uvc_streaming *stream)
 	if (uvc_debugfs_root_dir == NULL)
 		return -ENODEV;
 
-	sprintf(dir_name, "%u-%u", udev->bus->busnum, udev->devnum);
+	sprintf(dir_name, "%u-%u-%u", udev->bus->busnum, udev->devnum,
+			stream->intfnum);
 
 	dent = debugfs_create_dir(dir_name, uvc_debugfs_root_dir);
 	if (IS_ERR_OR_NULL(dent)) {