From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Sat, 1 Jan 2011 18:50:32 -0800 Subject: Adding a kobject in the device model hierarchy In-Reply-To: References: Message-ID: <20110102025032.GA24748@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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