Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1490051
| From | Lukas Wunner <lukas@wunner.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support |
| Date | 2016-09-23 15:10 +0200 |
| Message-ID | <skyoN-44f-15@gated-at.bofh.it> (permalink) |
| References | <sff3r-2Cw-3@gated-at.bofh.it> <shN0Z-4mm-5@gated-at.bofh.it> <shN0Z-4mm-7@gated-at.bofh.it> <si0rf-4Fp-19@gated-at.bofh.it> <sjfxU-37W-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Sep 20, 2016 at 12:46:30AM +0200, Lukas Wunner wrote:
> On Fri, Sep 16, 2016 at 02:33:55PM +0200, Rafael J. Wysocki wrote:
> > +void device_links_unbind_consumers(struct device *dev)
> > +{
> > + struct device_link *link;
> > + int idx;
> > +
> > + start:
> > + idx = device_links_read_lock();
> > +
> > + list_for_each_entry_rcu(link, &dev->links_to_consumers, s_node) {
> > + enum device_link_status status;
> > +
> > + if (link->flags & DEVICE_LINK_STATELESS)
> > + continue;
> > +
> > + spin_lock(&link->lock);
> > + status = link->status;
> > + if (status == DEVICE_LINK_CONSUMER_PROBE) {
> > + spin_unlock(&link->lock);
> > +
> > + device_links_read_unlock(idx);
> > +
> > + wait_for_device_probe();
> > + goto start;
> > + }
> > + link->status = DEVICE_LINK_SUPPLIER_UNBIND;
> > + if (status == DEVICE_LINK_ACTIVE) {
> > + struct device *consumer = link->consumer;
> > +
> > + get_device(consumer);
>
> As long as the struct device_link exists, a ref is held on the
> supplier and consumer. Why acquire another ref here?
I'm withdrawing this particular comment as I failed to see that
device_links_read_unlock() is called next, so nothing prevents
the device link from being deleted, same for the consumer, thus
the ref needs to be acquired for device_release_driver_internal()
and this portion of Rafael's code seems perfectly correct.
Thanks & sorry for the noise,
Lukas
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 00:10 +0200
Re: [RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support Marek Szyprowski <m.szyprowski@samsung.com> - 2016-09-16 10:00 +0200
Re: [RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-16 14:10 +0200
[Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-16 14:30 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-20 00:50 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-23 15:10 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-23 15:40 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-26 19:00 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-27 14:20 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-27 11:00 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-27 14:00 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-28 12:50 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support "Rafael J. Wysocki" <rafael@kernel.org> - 2016-09-28 13:40 +0200
Re: [Update][RFC/RFT][PATCH v3 2/5] driver core: Functional dependencies tracking support Lukas Wunner <lukas@wunner.de> - 2016-09-29 12:40 +0200
csiph-web