Re: [PATCH v5 02/11] usb: musb: kill global and static for multi instance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Jul 25, 2012 at 05:42:06PM +0530, Ajay Kumar Gupta wrote:
> @@ -240,20 +238,24 @@ int __devinit musb_init_debugfs(struct musb *musb)
>  	struct dentry		*root;
>  	struct dentry		*file;
>  	int			ret;
> +	char			name[10];
>  
> -	root = debugfs_create_dir("musb", NULL);
> +	sprintf(name, "musb%d", musb->id);
> +	root = debugfs_create_dir(name, NULL);

I told you to use dev_name(musb) for a reason. See what happens when you
use dev_name(musb);

Do you not think about the other users of this driver ? Do you not know
what's the ID on platform_devices which "don't have an ID" ?? The
drivers core set it to -1, then on everybody who's got a single musb
instance, will have to access the "musb-1" directory. That doesn't seem
nice.

Just use dev_name(musb).

>  	if (!root) {
>  		ret = -ENOMEM;
>  		goto err0;
>  	}
>  
> -	file = debugfs_create_file("regdump", S_IRUGO, root, musb,
> +	sprintf(name, "regdump%d", musb->id);
> +	file = debugfs_create_file(name, S_IRUGO, root, musb,
>  			&musb_regdump_fops);
>  	if (!file) {
>  		ret = -ENOMEM;
>  		goto err1;
>  	}
>  
> +	sprintf(name, "testmode%d", musb->id);

this is unnecessary!! Only the directory name needs this trick,
whatever's under the root directory does not need any ID appended to it.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux