mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Hollis Blanchard <hollisb@us.ibm.com>
Cc: Greg KH <gregkh@us.ibm.com>, linux-kernel@vger.kernel.org
Subject: Re: kobj_to_dev ?
Date: Fri, 16 Jan 2004 16:17:39 -0800	[thread overview]
Message-ID: <20040117001739.GB3840@kroah.com> (raw)
In-Reply-To: <3FC7B008-487C-11D8-AED9-000A95A0560C@us.ibm.com>

On Fri, Jan 16, 2004 at 05:32:29PM -0600, Hollis Blanchard wrote:
> Hi Greg, could this be added to device.h:
> 
> --- 1.112/include/linux/device.h        Wed Jan  7 23:58:16 2004
> +++ edited/include/linux/device.h       Fri Jan 16 17:35:04 2004
> @@ -279,6 +279,8 @@
>         void    (*release)(struct device * dev);
>  };
> 
> +#define kobj_to_dev(k) container_of((k), struct device, kobj)
> +
>  static inline struct device *
>  list_to_dev(struct list_head *node)
>  {
> 
> I'm using it as the following (inspired by find_bus), and it seems like 
> it would make sense to put in device.h.

How about just adding a find_device() function to the driver core, where
you pass in a name and a type, so that others can use it?

> As a side node, since those #defines don't to type-checking, would it 
> make sense to name them with both types? E.g. "kobj_to_dev" instead of 
> just "to_dev"?

The compiler does the typechecking for you :)

thanks,

greg k-h

  reply	other threads:[~2004-01-17  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 23:32 Hollis Blanchard
2004-01-17  0:17 ` Greg KH [this message]
2004-01-19 20:26   ` Hollis Blanchard
2004-01-20  0:04     ` Greg KH
2004-01-20  0:25       ` Hollis Blanchard
2004-01-20  0:53         ` Greg KH
2004-01-20  3:18           ` Hollis Blanchard

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=20040117001739.GB3840@kroah.com \
    --to=greg@kroah.com \
    --cc=gregkh@us.ibm.com \
    --cc=hollisb@us.ibm.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®