[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200214204500.GC4086224@kroah.com>
Date: Fri, 14 Feb 2020 15:45:00 -0500
From: Greg KH <gregkh@...uxfoundation.org>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Jeff Kirsher <jeffrey.t.kirsher@...el.com>, davem@...emloft.net,
Dave Ertman <david.m.ertman@...el.com>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, nhorman@...hat.com,
sassmann@...hat.com, parav@...lanox.com, galpress@...zon.com,
selvin.xavier@...adcom.com, sriharsha.basavapatna@...adcom.com,
benve@...co.com, bharat@...lsio.com, xavier.huwei@...wei.com,
yishaih@...lanox.com, leonro@...lanox.com, mkalderon@...vell.com,
aditr@...are.com, Kiran Patil <kiran.patil@...el.com>,
Andrew Bowers <andrewx.bowers@...el.com>
Subject: Re: [RFC PATCH v4 01/25] virtual-bus: Implementation of Virtual Bus
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
Powered by blists - more mailing lists