public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Greg KH <greg@kroah.com>
Cc: Matthew Wilcox <willy@debian.org>,
	Patrick Mochel <mochel@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: kobjects, sysfs and the driver model make my head hurt
Date: Sun, 06 Jul 2003 12:54:32 -0400	[thread overview]
Message-ID: <3F085448.6010503@pobox.com> (raw)
In-Reply-To: <20030706164626.GA17596@kroah.com>

Greg KH wrote:
>>(a)	kobj = kobject_get(kobj);
> 
> 
> This is the way to call kobject_get(), as the object we get after the
> function returns is the one we can then safely use.
[...]
> Think of it as, "now we can use this kobject, not the one before calling
> kobject_get()".


Doesn't matter.  There is still absolutely no reason for the additional 
pointer storage.  I agree with with you "Thinks of it as", but also add 
my own:  think of it as a spinlock function.  It doesn't return any 
value, but you can't touch the locked object(s) before you call the 
function.

The alloc functions return pointers.  The _get functions never need to, 
because logically there should always we at least one ref when we are 
calling _get.  (unless we want _get to notice an OBJ_FREEING flag and 
fail, that is...)

	Jeff




      reply	other threads:[~2003-07-06 16:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-06 16:33 kobjects, sysfs and the driver model make my head hurt Matthew Wilcox
2003-07-06 16:42 ` Davide Libenzi
2003-07-06 17:03   ` James Morris
2003-07-06 17:15     ` Jeff Garzik
2003-07-07  7:05   ` Johan.Adolfsson
2003-07-06 16:46 ` Greg KH
2003-07-06 16:54   ` Jeff Garzik [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=3F085448.6010503@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=willy@debian.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