linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: event sequencing
Date: Tue, 01 Mar 2005 08:01:43 +0000	[thread overview]
Message-ID: <20050301080143.GD3890@kroah.com> (raw)
In-Reply-To: <9e473391050225081838f673c7@mail.gmail.com>

On Mon, Feb 28, 2005 at 04:13:23PM -0500, Jon Smirl wrote:
> On Mon, 28 Feb 2005 11:56:43 -0800, Greg KH <greg@kroah.com> wrote:
> > I like the idea of your patch, but I think it breaks when we remove the
> > class_device device, right?  Or if we remove the parent class_device
> > first.
> 
> Added code to inc the parent's ref count. 
> BTW if parent is NULL the later call to
> class_device_add_attrs(class_dev); is going to trap.
> 
> [jonsmirl@jonsmirl base]$ bk diffs -u
> === class.c 1.57 vs edited ==> --- 1.57/drivers/base/class.c   2004-12-21 19:29:34 -05:00
> +++ edited/class.c      2005-02-28 16:10:04 -05:00
> @@ -417,8 +417,9 @@
> 
>         /* first, register with generic layer. */
>         kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id);
> -       if (parent)
> +       if (parent && !class_dev->kobj.parent)
>                 class_dev->kobj.parent = &parent->subsys.kset.kobj;
> +       class_dev->kobj.parent = kobject_get(class_dev->kobj.parent);
> 
>         if ((error = kobject_add(&class_dev->kobj)))
>                 goto register_done;
> @@ -467,6 +468,7 @@
>         class_device_driver_unlink(class_dev);
>         class_device_remove_attrs(class_dev);
> 
> +       kobject_put(class_dev->kobj.parent);
>         kobject_del(&class_dev->kobj);
> 
>         if (parent)

And this works ok for you?  Hm, we don't really need to walk class
devices in "order" like we do for real devices, so this might be
acceptable.  But it just feels wrong, and I _know_ people will get this
wrong (everyone gets the class code wrong the first time they do it.)
We're trying to make this simpler, not more complex, with hidden "if you
set this pointer before you call a function, this magic happens..."

Anyway, let's do this properly, it's on the todo list, and will get done
in a few weeks.

thanks,

greg k-h


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2005-03-01  8:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-25 16:18 event sequencing Jon Smirl
2005-02-25 16:53 ` Kay Sievers
2005-02-25 21:56 ` Jon Smirl
2005-02-26  0:16 ` Jon Smirl
2005-02-26  0:46 ` Kay Sievers
2005-02-26  1:18 ` Jon Smirl
2005-02-26  3:27 ` Greg KH
2005-02-26  3:29 ` Greg KH
2005-02-26  3:43 ` Kay Sievers
2005-02-26  3:58 ` Greg KH
2005-02-26  5:08 ` Kay Sievers
2005-02-26  5:35 ` Greg KH
2005-02-26  6:25 ` Jon Smirl
2005-02-26 13:11 ` Kay Sievers
2005-02-26 14:00 ` Kay Sievers
2005-02-26 17:34 ` Jon Smirl
2005-02-26 17:37 ` Jon Smirl
2005-02-26 18:28 ` Kay Sievers
2005-02-26 19:17 ` Jon Smirl
2005-02-26 19:41 ` Kay Sievers
2005-02-27  0:27 ` Jon Smirl
2005-02-28  4:53 ` Jon Smirl
2005-02-28 11:25 ` Kay Sievers
2005-02-28 19:07 ` Jon Smirl
2005-02-28 19:51 ` Greg KH
2005-02-28 19:52 ` Greg KH
2005-02-28 19:56 ` Greg KH
2005-02-28 21:13 ` Jon Smirl
2005-03-01  8:01 ` Greg KH [this message]
2005-03-01  8:30 ` Jon Smirl
2005-03-01  8:41 ` Greg KH

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=20050301080143.GD3890@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-hotplug@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;
as well as URLs for NNTP newsgroup(s).