* Adding a kobject in the device model hierarchy
@ 2011-01-01 16:28 Prabhu nath
2011-01-02 2:50 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Prabhu nath @ 2011-01-01 16:28 UTC (permalink / raw)
To: kernelnewbies
Dear All,
I have written one pseudo char driver. I have initialized the device
generic structure
with cdev_init function. This will initialize the kobject structure
embedded within struct cdev
with appropriate ktype. If I want to add this kobject in
/sys/devices/virtual/misc/ location
of sysfs, how is the following fields set
* kobj->parent
* kobj->kset
* kobj->kset->obj.
Also, in general how to look out for the parent kobject ? Would like to
know, if there are
mechanisms provisioned by Linux Kernel.
Robert: My 2 cents as I am reading the LKD(3rd edition), it would be
appropriate to add one
example as a solution to the above problem. Generally, it has
been told as
kobj->kset = my_kset in Page # 353.
Note: Even in LDD(3rd editon page 369). It has been mentioned that "The
kobject's kset field must be
pointed at the kset of interest"
Thanks,
Prabhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110101/0dc4abe1/attachment.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Adding a kobject in the device model hierarchy
2011-01-01 16:28 Adding a kobject in the device model hierarchy Prabhu nath
@ 2011-01-02 2:50 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2011-01-02 2:50 UTC (permalink / raw)
To: kernelnewbies
On Sat, Jan 01, 2011 at 09:58:11PM +0530, Prabhu nath wrote:
> Dear All,
>
> I have written one pseudo char driver. I have initialized the device
> generic structure
> with cdev_init function. This will initialize the kobject structure
> embedded within struct cdev
> with appropriate ktype.
But NEVER touch that kobject, it is not for your use at all.
> If I want to add this kobject in
> /sys/devices/virtual/misc/ location
> of sysfs, how is the following fields set
> * kobj->parent
> * kobj->kset
> * kobj->kset->obj.
Nope, you need your own struct device, do not use the kobject in the
cdev, again, it is NOT for use at all. It is private to a cdev and
I need to figure out a way to make it so that you can't even see it one
day to keep people from trying to use it.
good luck,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-02 2:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-01 16:28 Adding a kobject in the device model hierarchy Prabhu nath
2011-01-02 2:50 ` Greg KH
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).