Re: [RFC PATCH v4 01/25] virtual-bus: Implementation of Virtual Bus

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

 



On Fri, Feb 14, 2020 at 04:34:55PM -0400, Jason Gunthorpe wrote:
> On Fri, Feb 14, 2020 at 09:02:40AM -0800, Greg KH wrote:
> > > +	put_device(&vdev->dev);
> > > +	ida_simple_remove(&virtbus_dev_ida, vdev->id);
> > 
> > You need to do this before put_device().
> 
> Shouldn't it be in the release function? The ida index should not be
> re-used until the kref goes to zero..

Doesn't really matter, once you have unregistered it, you can reuse it.
But yes, putting it in release() is the safest thing to do.

> > > +struct virtbus_device {
> > > +	struct device dev;
> > > +	const char *name;
> > > +	void (*release)(struct virtbus_device *);
> > > +	int id;
> > > +	const struct virtbus_dev_id *matched_element;
> > > +};
> > 
> > Any reason you need to make "struct virtbus_device" a public structure
> > at all? 
> 
> The general point of this scheme is to do this in a public header:
> 
> +struct iidc_virtbus_object {
> +	struct virtbus_device vdev;
> +	struct iidc_peer_dev *peer_dev;
> +};
> 
> And then this when the driver binds:

Ah, yes, nevermind, I missed that.

greg k-h



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux