All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Sverdlin <alexander.sverdlin-OYasijW0DpE@public.gmane.org>
To: ext Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"Eric W. Biederman"
	<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH] i2c: suppress lockdep warning on delete_device
Date: Fri, 17 May 2013 18:25:27 +0200	[thread overview]
Message-ID: <519659F7.90608@nsn.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1305171116500.1012-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>

Hi!

On 05/17/2013 05:31 PM, ext Alan Stern wrote:
>>>> i2c: suppress lockdep warning on delete_device
>>>>
>>>> Since commit 846f99749ab68bbc7f75c74fec305de675b1a1bf the following lockdep
>>>> warning is thrown in case i2c device is removed (via delete_device sysfs
>>>> attribute) which contains subdevices (e.g. i2c multiplexer):
>>>
>>> Can you explain this in a little more detail?  Exactly what does the
>>> delete_device attribute do, when called for device D?
>>>
>>> That is, what does a write to /sys/bus/i2c/devices/D/delete_device do?
>>
>> Like USB with its hubs, I2C structure could be tree-like, with I2C multiplexers.
>> delete_device attribute removes I2C device from the subsystem, which is usually not
>> a problem, except the case when device is a multiplexer and sub-devices should be
>> removed first. Here we have the problem: holding a "s_active" lock on
>> "delete_device" attribute of a parent (multiplexer) we need to delete children, but
>> they were created with the same static attribute "delete_device".
>>
>> The safety of this operation is exactly the same as in USB case... Any more clever
>> lockdep annotation is exactly not so easy...
>
> If I understand you correctly, if D is an I2C multiplexer then writing
> to /sys/bus/i2c/devices/D/delete_device will get rid of all of D's
> children (and their descendants) and will also get rid of D itself --
> right?
>
> That's _not_ what the USB attributes do.  For example, if D is a USB
> hub then writing 0 to /sys/bus/usb/devices/D/bConfigurationValue will
> get rid of all D's descendants but will not get rid of D.

Well, seems that what I've described above wasn't precise enough...
Actually only "bus controllers" have "delete_device" attribute. Simple devices
on the bus do not have it. User write an address of the slave device to this
attribute to delete it. This works fine for simple devices. In case of multiplexer
(which is in turn also a "bus controller") there are nested "delete_device"
attributes. So it's only possible to delete child nodes and not the controller itself,
writing to its "delete_device". So from my POV, it fits to USB concept...

> Instead of doing it this way, the attribute method should call
> device_schedule_callback().  See commit d9a9cdfb078d.

-- 
Best regards,
Alexander Sverdlin.

  parent reply	other threads:[~2013-05-17 16:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-17 12:56 [PATCH] i2c: suppress lockdep warning on delete_device Alexander Sverdlin
     [not found] ` <51962903.9050901-OYasijW0DpE@public.gmane.org>
2013-05-17 14:42   ` Alan Stern
     [not found]     ` <Pine.LNX.4.44L0.1305171040580.1012-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-05-17 15:02       ` Alexander Sverdlin
     [not found]         ` <51964675.6030807-OYasijW0DpE@public.gmane.org>
2013-05-17 15:31           ` Alan Stern
     [not found]             ` <Pine.LNX.4.44L0.1305171116500.1012-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-05-17 16:25               ` Alexander Sverdlin [this message]
     [not found]                 ` <519659F7.90608-OYasijW0DpE@public.gmane.org>
2013-05-17 17:16                   ` Alan Stern
2013-05-17 20:47   ` Wolfram Sang

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=519659F7.90608@nsn.com \
    --to=alexander.sverdlin-oyasijw0dpe@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.