From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Confusion in kobjects
Date: Wed, 4 May 2011 07:59:37 -0700 [thread overview]
Message-ID: <20110504145937.GA12659@kroah.com> (raw)
In-Reply-To: <BANLkTina-q5sGJ4hOOHBbjKdqHqLSEGM+w@mail.gmail.com>
On Wed, May 04, 2011 at 07:26:44PM +0530, Vikram Narayanan wrote:
> The kernel doc (kobject.txt) says that
>
> "No structure should EVER have more than one kobject embedded within it.
> If it does, the reference counting for the object is sure to be messed
> up and incorrect, and your code will be buggy. So do not do this. "
>
> But in the file drivers/uio/uio.c, a structure has two such kobjects.
>
> struct uio_device {
> struct module *owner;
> struct device *dev;
> int minor;
> atomic_t event;
> struct fasync_struct *async_queue;
> wait_queue_head_t wait;
> int vma_count;
> struct uio_info *info;
> struct kobject *map_dir;
> struct kobject *portio_dir;
> };
>
> So, What is the exception for this structure? Is this right? If yes,
> can someone explain why it is right, and where should we use it?
There are not more than one kobject _IN_ the structure. It merely
has pointers to more than one kobject (three actually), which is fine to
do.
Hope this helps,
greg k-h
next prev parent reply other threads:[~2011-05-04 14:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 13:56 Confusion in kobjects Vikram Narayanan
2011-05-04 14:59 ` Greg KH [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-05-04 16:26 Vikram Narayanan
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=20110504145937.GA12659@kroah.com \
--to=greg@kroah.com \
--cc=kernelnewbies@lists.kernelnewbies.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).