linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@systec-electronic.com>
To: linux-hotplug@vger.kernel.org
Subject: automatic sysfs attribute creation
Date: Wed, 21 Aug 2013 15:17:15 +0000	[thread overview]
Message-ID: <7214233.AEam3A6dd5@ws-stein> (raw)

Hello,

I've read Greg's blog post about sysfs attributes at http://www.kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/. We've used attribute groups for the whole time, but the post made me wondering whether our drivers might be affected by that too. Unfortunately the blog mentions only struct class, struct bus, struct device and so on. I couldn't find anything about USB interfaces or struct net_device. At least the latter has const struct attribute_group *sysfs_groups[4]; itself. So I tried setting sysfs_groups[0] in the probe function of my usb_driver before calling register_candev (which in return set the attribute groups in struct device later). So IMHO the sysfs files should be created before the new CAN interface is announced to userspace.
But I get the exact problem Greg describes: A udev rules shall set an attribute during ACTION="add". This USB device create 2 CAN interfaces and only on one device the attribute is set correctly. _Unless_: the rule file is named 75-usbcan.rules in /etc/udev/rules.d or has a higher number at the beginning. This indicates a race condition to me.
Am I doing anything wrong here? The described way should have prevented this.
BTW: Is there something similar for the USB device driver?

Regards and thanks in advance
Alexander


             reply	other threads:[~2013-08-21 15:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21 15:17 Alexander Stein [this message]
2013-08-21 17:44 ` automatic sysfs attribute creation Greg KH

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=7214233.AEam3A6dd5@ws-stein \
    --to=alexander.stein@systec-electronic.com \
    --cc=linux-hotplug@vger.kernel.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 read-only IMAP folder(s) and NNTP newsgroup(s).