The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] Driver core: move the bus notifier call points (fwd)
Date: Tue, 09 Dec 2008 08:52:22 +1100	[thread overview]
Message-ID: <1228773142.7101.38.camel@pasglop> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0812081012030.2476-100000@iolanthe.rowland.org>

On Mon, 2008-12-08 at 10:14 -0500, Alan Stern wrote:
> Ben:
> 
> After posting the patch below, I noticed that you were the person who 
> originally added the bus notifier code.  You don't see any problems 
> with this code motion, do you?

I think it should be fine. I need to make sure the driver isn't bound
yet, that's my main requirement, since I use those callbacks to setup
the DMA operations & iommu for the device on Cell.

Cheers,
Ben.

> Alan Stern
> 
> 
> 
> This patch (as1184) changes the location of the notifications in
> device_add() and device_del().  Now the BUS_NOTIFY_ADD_DEVICE message
> is sent after dpm_sysfs_add(), which is necessary for clients that
> want to add attributes to the power/ subdirectory.  The
> BUS_NOTIFY_DEL_DEVICE message is correspondingly moved before
> dpm_sysfs_remove().
> 
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> 
> ---
> 
> Index: usb-2.6/drivers/base/core.c
> ===================================================================
> --- usb-2.6.orig/drivers/base/core.c
> +++ usb-2.6/drivers/base/core.c
> @@ -884,11 +884,6 @@ int device_add(struct device *dev)
>  	if (platform_notify)
>  		platform_notify(dev);
>  
> -	/* notify clients of device entry (new way) */
> -	if (dev->bus)
> -		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> -					     BUS_NOTIFY_ADD_DEVICE, dev);
> -
>  	error = device_create_file(dev, &uevent_attr);
>  	if (error)
>  		goto attrError;
> @@ -916,6 +911,14 @@ int device_add(struct device *dev)
>  	if (error)
>  		goto DPMError;
>  	device_pm_add(dev);
> +
> +	/* Notify clients of device addition.  This call must come
> +	 * after dpm_sysf_add() and before kobject_uevent().
> +	 */
> +	if (dev->bus)
> +		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> +					     BUS_NOTIFY_ADD_DEVICE, dev);
> +
>  	kobject_uevent(&dev->kobj, KOBJ_ADD);
>  	bus_attach_device(dev);
>  	if (parent)
> @@ -940,9 +943,6 @@ done:
>   DPMError:
>  	bus_remove_device(dev);
>   BusError:
> -	if (dev->bus)
> -		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> -					     BUS_NOTIFY_DEL_DEVICE, dev);
>  	device_remove_attrs(dev);
>   AttrsError:
>  	device_remove_class_symlinks(dev);
> @@ -1027,6 +1027,12 @@ void device_del(struct device *dev)
>  	struct device *parent = dev->parent;
>  	struct class_interface *class_intf;
>  
> +	/* Notify clients of device removal.  This call must come
> +	 * before dpm_sysfs_remove().
> +	 */
> +	if (dev->bus)
> +		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> +					     BUS_NOTIFY_DEL_DEVICE, dev);
>  	device_pm_remove(dev);
>  	dpm_sysfs_remove(dev);
>  	if (parent)
> @@ -1064,9 +1070,6 @@ void device_del(struct device *dev)
>  	 */
>  	if (platform_notify_remove)
>  		platform_notify_remove(dev);
> -	if (dev->bus)
> -		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
> -					     BUS_NOTIFY_DEL_DEVICE, dev);
>  	kobject_uevent(&dev->kobj, KOBJ_REMOVE);
>  	cleanup_device_parent(dev);
>  	if (!list_empty(&dev->klist_children.k_list))
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


      reply	other threads:[~2008-12-08 21:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-08 15:14 [PATCH 1/2] Driver core: move the bus notifier call points (fwd) Alan Stern
2008-12-08 21:52 ` Benjamin Herrenschmidt [this message]

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=1228773142.7101.38.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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