From: Greg KH <greg@kroah.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Roland Dreier <roland@topspin.com>,
Germano <germano.barreiro@cyclades.com>,
Scott_Kilau@digi.com, linux-kernel@vger.kernel.org
Subject: Re: patch for sysfs in the cyclades driver
Date: Thu, 4 Nov 2004 09:42:45 -0800 [thread overview]
Message-ID: <20041104174245.GD16389@kroah.com> (raw)
In-Reply-To: <20041104142925.GB9431@logos.cnet>
On Thu, Nov 04, 2004 at 12:29:25PM -0200, Marcelo Tosatti wrote:
> On Thu, Nov 04, 2004 at 08:58:21AM -0800, Roland Dreier wrote:
> > Marcelo> The problem was class_simple only contains the "dev"
> > Marcelo> attribute. You can't add other attributes to it.
> >
> > I believe, based on the comment in class_simple.c:
> >
> > Any further sysfs files that might be required can be created using this pointer.
> >
> > and the implementation in in drivers/scsi/st.c, that there's no
> > problem adding attributes to a device in a simple class. You can just
> > use class_set_devdata() on your class_device to set whatever context
> > you need to get back to your internal structures, and then use
> > class_device_create_file() to add the attributes.
> >
> > I assume this is OK (since there is already one in-kernel driver doing
> > it), but Greg, can you confirm that it's definitely OK for a driver to
> > use class_set_devdata() on a class_device from class_simple_device_add()?
>
> Hi Roland,
>
> Oh thanks, I didnt knew the existance of such possibily.
>
> I once asked here on the list:
>
> ---------
>
> Hope this is not a FAQ.
>
> I want to export some read-only attributes (statistics) from cyclades.c char
> driver to userspace via sysfs.
>
> I can't figure out the right place to do it - I could create a class under
> /sys/class/cyclades for example, but that doesnt sound right since this
> is not a "class" of device, but a device itself.
>
> Hooking the statistics into /sys/class/tty/ttyC$/ sounds reasonable, but
> its not possible it seems because "tty" is a class_simple class, which only implements
> the "dev" attribute.
>
> ------ Greg answer was:
>
> For a driver only attribute, you want them to show up in the place for
> the driver (like under /sys/bus/pci/driver/MY_FOO_DRIVER/). To do that
> use the DRIVER_ATTR() and the driver_add_file() functions. For
> examples, see the other drivers that use these functions.
>
>
> But I hope you are right - /sys/class/tty/tty$/
> sounds the correct place for those files - I thought a "class_tty"
> class was required for new attributes.
No, Roland is right, just use the class_device pointer you get back from
the core when a tty device is created.
Right now we aren't saving the pointer anywhere (see
tty_register_device() for where it is created.) Just add that to the
proper tty_device structure, and you should be fine (yeah, it's going to
be a pain, and you will quickly see why I didn't do that in the first
place, but it is going to need to be changed eventually...)
Good luck,
greg k-h
next prev parent reply other threads:[~2004-11-04 17:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-03 13:09 patch for sysfs in the cyclades driver Germano
2004-11-04 10:25 ` Marcelo Tosatti
2004-11-04 16:58 ` Roland Dreier
2004-11-04 14:29 ` Marcelo Tosatti
2004-11-04 17:40 ` Roland Dreier
2004-11-04 17:44 ` Greg KH
2004-11-04 17:42 ` Greg KH [this message]
2004-11-04 17:40 ` Greg KH
2004-11-04 19:05 ` Roland Dreier
2004-11-04 19:17 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2004-11-04 17:50 Kilau, Scott
2004-11-04 18:28 ` Germano
2004-11-04 16:40 Kilau, Scott
2004-11-04 17:39 ` Greg KH
2004-11-03 22:35 Kilau, Scott
2004-11-03 23:08 ` Greg KH
2004-11-03 20:20 Kilau, Scott
2004-11-03 21:23 ` Greg KH
2004-11-03 19:55 Kilau, Scott
2004-11-03 20:03 ` Greg KH
[not found] <71A17D6448EC0140B44BCEB8CD0DA36E04B9D812@minimail.digi.com>
2004-11-03 2:28 ` Greg KH
2004-10-28 18:56 Germano Barreiro
2004-10-30 4:40 ` Greg KH
2004-11-01 17:01 ` germano.barreiro
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=20041104174245.GD16389@kroah.com \
--to=greg@kroah.com \
--cc=Scott_Kilau@digi.com \
--cc=germano.barreiro@cyclades.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=roland@topspin.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.