From: Greg KH <greg@kroah.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, Len Brown <len.brown@intel.com>,
Deepak Saxena <dsaxena@plexity.net>
Subject: Re: [PATCH] Add device addition/removal notifier
Date: Thu, 19 Oct 2006 21:44:54 -0700 [thread overview]
Message-ID: <20061020044454.GA8627@kroah.com> (raw)
In-Reply-To: <1161318564.10524.131.camel@localhost.localdomain>
On Fri, Oct 20, 2006 at 02:29:24PM +1000, Benjamin Herrenschmidt wrote:
> On Thu, 2006-10-19 at 20:26 -0700, Greg KH wrote:
> > On Fri, Oct 20, 2006 at 11:55:50AM +1000, Benjamin Herrenschmidt wrote:
> > > @@ -608,12 +615,14 @@ void device_del(struct device * dev)
> > > device_remove_groups(dev);
> > > device_remove_attrs(dev);
> > >
> > > + bus_remove_device(dev);
> > > /* Notify the platform of the removal, in case they
> > > * need to do anything...
> > > */
> > > if (platform_notify_remove)
> > > platform_notify_remove(dev);
> > > - bus_remove_device(dev);
> > > + blocking_notifier_call_chain(&device_notifier, DEVICE_NOTIFY_DEL_DEV,
> > > + dev);
> >
> > Why did you move the call to bus_remove_device() to be before the
> > platform_notify_remove() and notifier is called?
>
> I sent a mail about that a couple of days ago. The current behaviour is
> bogus imho. (mail subjet was [PATCH/RFC] Call platform_notify_remove
> later, and Len Brown who uses that hook in ACPI agreed).
>
> Basically, we notify the platform of insertion before we bind devices to
> busses & drivers (so the platform can do fixups, allocate auxilliary
> data structures, whatever else...) and thus we should notify the
> platform of removal -after- we unbind from the bus and driver where it
> will then destroy those data structures).
>
> In my case, I need to hookup the DMA ops pointers. It would be very
> bogus to destroy those before the driver remove() has been called.
Ok, as long as you all agree that this does change the behavior, it's
fine with me :)
> > And I don't think this is really going to work well. You have created a
> > notifier for all devices in the system, right? How do you know what
> > type of struct device is being passed to your notifier callback? At
> > least with the platform callback, you knew it was a platform device :)
>
> No I didn't. The platform_notify callback was called for any device as
> is my notifier :)
>
> All I did was to add a notifier chain in addition to the old function
> pointer with the intend of deprecating the function pointer :)
>
> You can know what type of device you are called for by comparing the
> device->bus to the address of the bus type data structure. That's the
> only way to do so but it works pretty fine. (There are actually some
> severe issues with the device model and with PCI around that area that
> I'm hitting trying to clean up some of the powerpc mess but let's handle
> one problem at a time).
>
> On PowerPC, for example, I'll use that notifier in at least 2 different
> places: For PCI, I need to use the "delete" callback to destroy the
> auxilliary data structure containing the DMA ops (it's currently created
> by some PCI fixup code, but I might also migrate that to the "add"
> callback. The other place is for platforms like Cell that are now
> growing DMA capable non-PCI devices, that I'm catching in the cell
> specific iommu code via that notifier, to hook them up to the right DMA
> ops.
Ok, then perhaps you just want a bus specific callback for the devices
on that bus? That would be much simpler and keep you from having to do
that mess with the different tests of bus type.
Actually, that's the only thing that really makes sense here, now that I
think about it, the platform_notify doesn't really make any sense...
thanks,
greg k-h
next prev parent reply other threads:[~2006-10-20 5:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-20 1:55 [PATCH] Add device addition/removal notifier Benjamin Herrenschmidt
2006-10-20 3:26 ` Greg KH
2006-10-20 4:29 ` Benjamin Herrenschmidt
2006-10-20 4:44 ` Greg KH [this message]
2006-10-20 5:42 ` Benjamin Herrenschmidt
2006-10-20 6:16 ` Greg KH
2006-10-20 7:19 ` Benjamin Herrenschmidt
2006-10-20 7:35 ` Benjamin Herrenschmidt
2006-10-20 10:08 ` Paul Mackerras
2006-10-23 4:47 ` [PATCH] Call platform_notify_remove later Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2006-10-19 7:56 [PATCH] Add device addition/removal notifier Benjamin Herrenschmidt
2006-10-19 15:55 ` Randy Dunlap
2006-10-20 1:53 ` Benjamin Herrenschmidt
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=20061020044454.GA8627@kroah.com \
--to=greg@kroah.com \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=dsaxena@plexity.net \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.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