Re: usbmon: Add class for the binary API

Greg KH <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Sat, Feb 24, 2007 at 07:06:43PM -0800, Pete Zaitcev wrote:
> This patch adds a class which allows for an easier integration with udev.
> 
> Signed-off-by: Paolo Abeni <[email protected]>
> Signed-off-by: Pete Zaitcev <[email protected]>
> 
> ---
> 
> Paolo, I touched up two places:
>  - class_create returns ERR_PTR on error, not NULL
>  - I prefer a LIFO order of construction/destruction in case of
>    lifetime issues
> 
> Otherwise, it's your patch. I verified with double-diffing.
> But make sure to re-apply and re-test, please.
> 
> diff -urp -X dontdiff linux-2.6.21-rc1-gregkh-mon/drivers/usb/mon/mon_bin.c linux-2.6.20-mon/drivers/usb/mon/mon_bin.c
> --- linux-2.6.21-rc1-gregkh-mon/drivers/usb/mon/mon_bin.c	2007-02-24 18:00:29.000000000 -0800
> +++ linux-2.6.20-mon/drivers/usb/mon/mon_bin.c	2007-02-24 18:56:56.000000000 -0800
> @@ -172,6 +201,7 @@ static inline struct mon_bin_hdr *MON_OF
>  
>  #define MON_RING_EMPTY(rp)	((rp)->b_cnt == 0)
>  
> +static struct class *mon_bin_class;
>  static dev_t mon_bin_dev0;
>  static struct cdev mon_bin_cdev;
>  
> @@ -1142,10 +1243,35 @@ static void mon_free_buff(struct mon_pgm
>  		free_page((unsigned long) map[n].ptr);
>  }
>  
> +int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus)
> +{
> +	struct device *dev;
> +	unsigned minor = ubus->busnum;
> +
> +	if (minor >= MON_BIN_MAX_MINOR)
> +		return 0;
> +
> +	dev = device_create(mon_bin_class, NULL,
> +			MKDEV(MAJOR(mon_bin_dev0), minor), "usbmon%d", minor);
>

Don't you really want to tie this device to a "real" device that we
already have?  Like the usb_bus?  What's wrong with using that as the
parent here?

I think the tree will look better if you do that, can you try it?

thanks,

greg k-h

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.