public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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 20:26:24 -0700	[thread overview]
Message-ID: <20061020032624.GA7620@kroah.com> (raw)
In-Reply-To: <1161309350.10524.119.camel@localhost.localdomain>

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?

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 :)



>  	device_pm_remove(dev);
>  	kobject_uevent(&dev->kobj, KOBJ_REMOVE);
>  	kobject_del(&dev->kobj);
> @@ -836,3 +845,15 @@ int device_rename(struct device *dev, ch
>  
>  	return error;
>  }
> +
> +int register_device_notifier(struct notifier_block *nb)
> +{
> +	return blocking_notifier_chain_register(&device_notifier, nb);
> +}
> +EXPORT_SYMBOL(register_device_notifier);
> +
> +int unregister_device_notifier(struct notifier_block *nb)
> +{
> +	return blocking_notifier_chain_unregister(&device_notifier, nb);
> +}
> +EXPORT_SYMBOL(unregister_device_notifier);

All driver core exports should be _GPL() please.

thanks,

greg k-h

  reply	other threads:[~2006-10-20  3:27 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 [this message]
2006-10-20  4:29   ` Benjamin Herrenschmidt
2006-10-20  4:44     ` Greg KH
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=20061020032624.GA7620@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