From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Mon, 19 Jun 2017 08:55:22 +0800 Subject: Is there any way to add an =?utf-8?Q?a?= =?utf-8?Q?ttribute_under_sysfs_at_the_=E2=80=9Cplatform=E2=80=9D?= level? In-Reply-To: <20170618143836.GA7147@home> References: <20170618143836.GA7147@home> Message-ID: <20170619005522.GB995@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Sun, Jun 18, 2017 at 05:38:36PM +0300, Roman Storozhenko wrote: > Hello everybody! > > I am trying to modify "pcspkr" driver undere linux kernel source tree. I added a new line there: > > sample_id_dir = kobject_create_and_add("devices/platform/pcspkr/sample", NULL); Ick, really? What are you trying to do with "raw" kobjects? > It works and creates kobject without errors. I checked this in the driver code and in the dmesg output. But "sample" catalog isn't appear under "/sys/devices/platform/pcspkr/". Are you sure? Odds are you really did create a kobject with that name, but note, the name will have '/' characters in it :) If you want a kobject in a specific directory, you have to give it the parent kobject directory directly, you can not give a "path" to the kobject name, sorry, that's not how it works. The kobject documentation should help you out here, have you read it? good luck! greg k-h