From: Greg KH <gregkh@linuxfoundation.org>
To: David Graham White <dgwhite11@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: base: core: Removed superfluous calls to put_device in device_destroy and to kobject deletion functions in device_del.
Date: Sun, 21 Jul 2013 08:59:37 -0700 [thread overview]
Message-ID: <20130721155937.GB19774@kroah.com> (raw)
In-Reply-To: <1374420899-2525-1-git-send-email-dgwhite11@gmail.com>
On Sun, Jul 21, 2013 at 11:34:59AM -0400, David Graham White wrote:
> When device_destroy is called and the device's embedded kobject may be removed,
> this would occur with the call to put_device in device_unregister. Further,
> put_device should take care of cleaning up the kobject without the need to
> call kobject_del indepenedently in device_del.
>
> Signed-off-by: David Graham White <dgwhite11@gmail.com>
> ---
> drivers/base/core.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 8856d74..d6494ee 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -1292,9 +1292,7 @@ void device_del(struct device *dev)
> */
> if (platform_notify_remove)
> platform_notify_remove(dev);
> - kobject_uevent(&dev->kobj, KOBJ_REMOVE);
> cleanup_device_parent(dev);
> - kobject_del(&dev->kobj);
> put_device(parent);
> }
>
> @@ -1849,10 +1847,8 @@ void device_destroy(struct class *class, dev_t devt)
> struct device *dev;
>
> dev = class_find_device(class, NULL, &devt, __match_devt);
> - if (dev) {
> - put_device(dev);
> + if (dev)
> device_unregister(dev);
> - }
> }
> EXPORT_SYMBOL_GPL(device_destroy);
Are you sure about this. It seems that every few years someone tries to
make this type of "fix" to the driver code, only to find out that this
really was needed.
Have you tested this to ensure that things get cleaned up properly?
thanks,
greg k-h
prev parent reply other threads:[~2013-07-21 15:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-21 15:34 David Graham White
2013-07-21 15:59 ` Greg KH [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=20130721155937.GB19774@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dgwhite11@gmail.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
all inboxes | Powered by JetHome®