Re: [PATCH] USB: mon: Allow to use usbmon without debugfs

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

 



On 2011-07-06 at 05:33:58 +0200, Pete Zaitcev <zaitcev@xxxxxxxxxx> wrote:
> On Tue,  5 Jul 2011 13:37:50 +0200
> Tobias Klauser <tklauser@xxxxxxxxxx> wrote:
> 
> > Do not bail out in mon_init() if debugfs is not available, instead just
> > print the warning but go ahead loading the binary API.
> 
> > --- a/drivers/usb/mon/mon_main.c
> >  
> > -	if ((rc = mon_text_init()) != 0)
> > -		goto err_text;
> > +	if (mon_text_init() != 0)
> > +		printk(KERN_WARNING TAG ": debugfs is not available\n");
> >  	if ((rc = mon_bin_init()) != 0)
> > @@ -739,14 +742,9 @@ int __init mon_text_init(void)
> >  
> >  	mondir = debugfs_create_dir("usbmon", usb_debug_root);
> > -	if (IS_ERR(mondir)) {
> > -		printk(KERN_NOTICE TAG ": debugfs is not available\n");
> > -		return -ENODEV;
> > -	}
> > -	if (mondir == NULL) {
> > -		printk(KERN_NOTICE TAG ": unable to create usbmon directory\n");
> > +	if (IS_ERR_OR_NULL(mondir))
> >  		return -ENODEV;
> > -	}
> > +
> >  	mon_dir = mondir;
> 
> This looks like going in the right direction, but do we even want the
> warning anymore? Perhaps we ought to retain the split: if debugfs_create_dir
> exited with -ENODEV, skip mon_text_init quietly, otherwise print a
> specific message (my original code is guilty in dumping all error
> returns in one pile).

True. In my naivity it merged together the check for the return value of
debugfs_create_dir, but kerneldoc to debugfs_create_dir says
differently:

 * If an error occurs, %NULL will be returned.
 *
 * If debugfs is not enabled in the kernel, the value -%ENODEV will be
 * returned.

I'll implement it as you suggest and send an updated patch.

Thanks
Tobias
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux