From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Rodolfo Giometti
<giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Kumar Gala
<galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
Subject: Re: Again on virtual i2c adapter support.
Date: Fri, 23 Jan 2009 01:39:38 -0800 [thread overview]
Message-ID: <200901230139.38785.david-b@pacbell.net> (raw)
In-Reply-To: <20090123095110.7b0c7b82-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
On Friday 23 January 2009, Jean Delvare wrote:
> > --- a/drivers/i2c/i2c-core.c
> > +++ b/drivers/i2c/i2c-core.c
> > @@ -799,10 +799,10 @@ void i2c_del_driver(struct i2c_driver *driver)
> > class_for_each_device(&i2c_adapter_class, NULL, driver,
> > __detach_adapter);
> >
> > + mutex_unlock(&core_lock);
> > +
> > driver_unregister(&driver->driver);
> > pr_debug("i2c-core: driver [%s] unregistered\n",
> > driver->driver.name);
> > -
> > - mutex_unlock(&core_lock);
> > }
> > EXPORT_SYMBOL(i2c_del_driver);
> >
> > Unluckely I'm not an i2c guru so I'd like to ask to you. If such
> > modification is correct I can provide a simple support with no
> > modifications to the i2c core! Apart this one, of course... :)
>
> Honestly, I am not sure either. The locking model isn't completely
> cleared yet,
All legacy locking in the I2C core is problematic -- courtesy
of the original (lack-of-)design. The core_lock is the worst
offender; it's mostly there to support some wierdness when
removing legacy drivers, and I recall thinking that it works
more by luck (and lack of heavy use!) than correctness.
> we still need to get rid of the 3 dozen remaining legacy
> i2c chip drivers before we can finish it. I _think_ the above it
> correct, after all we do not hold the lock when calling
> driver_register() so I can't see why we would need to hold it when
> calling driver_unregister()... unless either i2c_client_release() or
> i2c_client_dev_release() needs this.
>
> David should know better, as he designed the thing in the first place.
No I didn't ... I worked on making it play better with the
driver model, and simplifying a bunch of the rest. I gave
up on fixing the legacy locking ... other than that patch
to remove i2c_adapter.clist_lock, a while back, I think the
only real fix is getting rid of those legacy calls (thus
using only the driver-model internal locks).
> David, can you please comment on the proposed change?
If it's a legacy driver, it will already have been decoupled
from devices, so the nastiest bit of stuff will have gotten
the protection it needs. New-style drivers shouldn't care
about the legacy stuff at all. So that much looks plausible.
But I don't have the patience to really analyse the other
locking implications; there were some rude and un-obvious
things lurking there, including abuse of complete() for
the legacy i2c_client lifecycle.
- Dave
next prev parent reply other threads:[~2009-01-23 9:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-22 15:02 Again on virtual i2c adapter support Rodolfo Giometti
[not found] ` <20090122150230.GA10952-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org>
2009-01-23 8:51 ` Jean Delvare
[not found] ` <20090123095110.7b0c7b82-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-01-23 9:23 ` Peter Korsgaard
[not found] ` <878wp2ml52.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>
2009-01-23 9:36 ` Jean Delvare
[not found] ` <20090123103659.38a25c30-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-01-23 9:49 ` Peter Korsgaard
[not found] ` <874ozqmjwq.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>
2009-01-23 14:16 ` Jean Delvare
[not found] ` <20090123151613.7424fa4f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-01-23 15:04 ` Peter Korsgaard
2009-01-23 13:48 ` Rodolfo Giometti
[not found] ` <20090123134833.GH12256-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org>
2009-01-23 14:01 ` Peter Korsgaard
2009-01-23 17:27 ` Michelle Konzack
[not found] ` <20090123172747.GB24751-qCYv2r+mE47ltxMxsNcu6w@public.gmane.org>
2009-01-23 18:52 ` Peter Korsgaard
2009-01-23 9:39 ` David Brownell [this message]
[not found] ` <200901230139.38785.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2009-01-23 14:21 ` Jean Delvare
2009-01-23 13:44 ` Rodolfo Giometti
2009-01-23 14:24 ` Jean Delvare
[not found] ` <20090123152434.423ba1e7-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-01-23 14:34 ` Rodolfo Giometti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200901230139.38785.david-b@pacbell.net \
--to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
--cc=galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
--cc=giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox