linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Greg KH <greg@kroah.com>
Cc: Johan Hovold <johan@kernel.org>,
	Janne Kanniainen <janne.kanniainen@gmail.com>,
	jkosina@suse.cz, cooloney@gmail.com,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH v10] leds: USB: HID: Add support for MSI GT683R led panels
Date: Mon, 23 Jun 2014 22:44:30 +0200	[thread overview]
Message-ID: <20140623204430.GC15945@localhost> (raw)
In-Reply-To: <20140623202448.GB29035@kroah.com>

On Mon, Jun 23, 2014 at 04:24:48PM -0400, Greg KH wrote:
> On Mon, Jun 23, 2014 at 09:52:12PM +0200, Johan Hovold wrote:
> > On Mon, Jun 23, 2014 at 03:40:59PM -0400, Greg KH wrote:
> > > On Mon, Jun 23, 2014 at 09:31:34PM +0200, Johan Hovold wrote:
> > > > On Mon, Jun 23, 2014 at 02:24:32PM -0400, Greg KH wrote:
> > > > > On Mon, Jun 23, 2014 at 02:23:24PM -0400, Greg KH wrote:
> > > > > > On Mon, Jun 23, 2014 at 08:16:48PM +0300, Janne Kanniainen wrote:
> > > > > > > +	ret = sysfs_create_group(&led->hdev->dev.kobj, &gt683r_attribute_group);
> > > > > > > +	if (ret) {
> > > > > > > +		hid_err(hdev, "failed to create sysfs attributes\n");
> > > > > > > +		goto fail;
> > > > > > > +	}
> > > > > > 
> > > > > > No, you need to set the attribute group _before_ you call
> > > > > > led_classdev_register, as that is where the device will be created in
> > > > > > sysfs.  Surely the other led drivers already do this?  I'm almost afraid
> > > > > > to go look...
> > > > > 
> > > > > Yes, they do it already, set .dev_attr_group and you should be fine.
> > > > 
> > > > But this isn't an attribute of the LEDs but rather of the parent HID
> > > > device that is being probed (the led_mode is common to all three LEDs
> > > > and thus belongs in the parent device, right?).
> > > 
> > > Then that's even worse :(
> > > 
> > > The sysfs attribute should be on the class device here for the LED, you
> > > should not put an attribute on a device you are not the driver for.
> > 
> > But this is the driver for the HID device, which then in turn has three
> > individual LEDs. This particular device isn't really an input device
> > (the actual keyboard in this case appears to be connected over PS2), but
> > there are several HID drivers which are primarily input devices with
> > LEDs as sub-devices (e.g. drivers/hid/hid-lg4ff.c).
> 
> I don't know the specifics here, but as you just created a class device,
> why aren't the attributes on that class device?  Shouldn't that be the
> logical place for it, instead of having them on some "random" other type
> of device?

This is a non-standard attribute of this particular laptop. It has three
individual LEDs that can be enabled separately (using standard LED class
attributes), but they will all three be in the same "mode" (which here
apparently means that they can be fully on, vary with the volume(?!), or
pulse synchronously when enabled).

If we were to implement this mode attribute as a class attribute,
changing the mode of of one LED would also change the mode of the other
two devices (LEDs). Therefore I think it has to be an attribute of the
parent HID device (that the driver is for).

> Userspace will never be notified that the attribute is on
> that device due to the file being created "later", and tools using
> libudev and the like will be looking at the LED class device, not the
> "parent" device for any specific LED stuff.

Yeah, that seems to be the case. I doubt anyone will care much about
this particular custom attribute, but sure, setting the led_mode of the
HID device from an udev rule could be problematic.

> but if this really is the way that all LED devices work, and userspace
> programs are expecting this, that's seems odd.

Johan

  reply	other threads:[~2014-06-23 20:45 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 21:29 [PATCH v2] leds: USB: Add support for MSI GT683R led panels Janne Kanniainen
2014-06-06  9:47 ` Johan Hovold
2014-06-07 10:12   ` Janne Kanniainen
2014-06-09 11:42     ` Johan Hovold
2014-06-10 21:10       ` Janne Kanniainen
2014-06-10 21:21         ` [PATCH v3] leds: USB: HID: " Janne Kanniainen
2014-06-11 11:25           ` Jiri Kosina
2014-06-11 14:06             ` Johan Hovold
2014-06-11 14:05           ` Johan Hovold
2014-06-11 15:30             ` Johan Hovold
2014-06-11 17:34             ` Johan Hovold
2014-06-11 22:48               ` [PATCH v4] " Janne Kanniainen
2014-06-12  9:06                 ` Johan Hovold
2014-06-12 20:34                   ` [PATCH v5] " Janne Kanniainen
2014-06-13  7:54                     ` Johan Hovold
2014-06-13 17:19                       ` Janne Kanniainen
2014-06-15 14:59                         ` Janne Kanniainen
2014-06-16  7:39                           ` Johan Hovold
2014-06-16 17:23                       ` [PATCH v6] " Janne Kanniainen
2014-06-16 22:01                         ` Janne Kanniainen
2014-06-17 13:46                           ` Johan Hovold
2014-06-17 16:41                             ` [PATCH v8] " Janne Kanniainen
2014-06-18  7:39                               ` Johan Hovold
2014-06-18 16:05                                 ` [PATCH v9] " Janne Kanniainen
2014-06-18 16:11                                   ` Johan Hovold
2014-06-18 18:41                                     ` Janne Kanniainen
2014-06-18 18:46                                       ` Johan Hovold
2014-06-18 22:10                                     ` Jiri Kosina
2014-06-23 14:35                                   ` Oliver Neukum
2014-06-23 14:42                                     ` Johan Hovold
2014-06-23 16:17                                       ` Greg KH
2014-06-23 17:16                                         ` [PATCH v10] " Janne Kanniainen
2014-06-23 17:27                                           ` Johan Hovold
2014-06-23 18:23                                           ` Greg KH
2014-06-23 18:24                                             ` Greg KH
2014-06-23 19:31                                               ` Johan Hovold
2014-06-23 19:40                                                 ` Greg KH
2014-06-23 19:52                                                   ` Johan Hovold
2014-06-23 20:24                                                     ` Greg KH
2014-06-23 20:44                                                       ` Johan Hovold [this message]
2014-06-24 13:10                                                         ` Bjørn Mork
2014-06-24 14:50                                                           ` Johan Hovold
2014-06-24 19:38                                                             ` [PATCH 1/2] HID: leds: fix race condition in MSI GT683R driver Janne Kanniainen
2014-06-24 19:38                                                               ` [PATCH 2/2] HID: leds: move led_mode attribute to led-class devices " Janne Kanniainen
2014-06-24 19:56                                                                 ` Greg KH
2014-06-25 11:55                                                                   ` Johan Hovold
2014-06-25 15:59                                                                     ` [PATCH 2/2 v2] HID: leds: Use attribute-groups " Janne Kanniainen
2014-06-25 17:41                                                                       ` Johan Hovold
2014-06-25 18:13                                                                         ` [PATCH 2/2 v3] HID: leds: move led_mode attribute to led-class devices " Janne Kanniainen
2014-06-30 10:39                                                                           ` Johan Hovold
2014-07-01 17:50                                                                             ` [PATCH 2/2 v4] " Janne Kanniainen
2014-07-01 20:16                                                                               ` Johan Hovold
2014-07-02 17:37                                                                                 ` [PATCH 2/2 v5] " Janne Kanniainen
2014-07-03  8:28                                                                                   ` Johan Hovold
2014-07-03 17:17                                                                                     ` [PATCH 1/2 v6] HID: gt683r: fix race condition Janne Kanniainen
2014-07-03 17:17                                                                                       ` [PATCH 2/2 v6] HID: gt683r: move mode attribute to led-class devices Janne Kanniainen
2014-07-03 17:40                                                                                         ` Johan Hovold
2014-07-03 18:17                                                                                           ` Bryan Wu
2014-07-03 18:28                                                                                             ` Janne Kanniainen
2014-07-03 17:34                                                                                       ` [PATCH 1/2 v6] HID: gt683r: fix race condition Johan Hovold
2014-07-03 18:13                                                                                         ` Bryan Wu
2014-06-25 19:09                                                                         ` [PATCH 2/2 v2] HID: leds: Use attribute-groups in MSI GT683R driver Jiri Kosina
2014-06-25 22:55                                                                           ` Bryan Wu
2014-06-30 10:47                                                                             ` Johan Hovold
2014-06-30 11:33                                                                               ` Jiri Kosina
2014-06-30 23:17                                                                                 ` Bryan Wu
2014-07-01  8:48                                                                                   ` Johan Hovold
2014-07-01 15:48                                                                                     ` Bryan Wu
2014-07-01 17:53                                                                                       ` Janne Kanniainen
2014-07-02  8:56                                                                                       ` Jiri Kosina
2014-06-23 16:20                                       ` [PATCH v9] leds: USB: HID: Add support for MSI GT683R led panels Janne Kanniainen
2014-06-14 22:42                     ` [PATCH v5] " Pavel Machek
2014-06-14 23:23                       ` Janne Kanniainen
2014-06-16  7:45                         ` Johan Hovold

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=20140623204430.GC15945@localhost \
    --to=johan@kernel.org \
    --cc=cooloney@gmail.com \
    --cc=greg@kroah.com \
    --cc=janne.kanniainen@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-usb@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 NNTP newsgroup(s).