From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johan Hovold Subject: Re: [PATCH 2/2 v4] HID: leds: move led_mode attribute to led-class devices in MSI GT683R driver Date: Tue, 1 Jul 2014 22:16:27 +0200 Message-ID: <20140701201627.GA30605@localhost> References: <20140630103911.GA2486@localhost> <1404237054-12906-1-git-send-email-janne.kanniainen@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1404237054-12906-1-git-send-email-janne.kanniainen@gmail.com> Sender: linux-kernel-owner@vger.kernel.org To: Janne Kanniainen Cc: johan@kernel.org, cooloney@gmail.com, jkosina@suse.cz, greg@kroah.com, bjorn@mork.no, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, linux-usb@vger.kernel.org, linux-input@vger.kernel.org List-Id: linux-input@vger.kernel.org On Tue, Jul 01, 2014 at 08:50:54PM +0300, Janne Kanniainen wrote: > -static DEVICE_ATTR_RW(leds_mode); > +static DEVICE_ATTR_RW(mode); > + > +static struct attribute *gt683r_led_attrs[] = { > + &dev_attr_mode.attr, > + NULL > +}; > + > +ATTRIBUTE_GROUPS(gt683r_led); I was referring to the name field of struct attribute_group (and not of struct hid_driver). Specifically, that means that you cannot use the ATTRIBUTE_GROUPS macro (which leaves the name field unset), but rather should define the two corresponding structs directly as follows: static const struct attribute_group gt683r_led_group = { .name = "gt683r", .attrs = gt683r_led_attrs, }; static const struct attribute_group *gt683r_led_groups[] = { >683r_led_group, NULL }; That way the mode attribute will be created in a subdirectory (named gt683r) of the led class device. > static int gt683r_led_probe(struct hid_device *hdev, > const struct hid_device_id *id) > @@ -261,6 +270,8 @@ static int gt683r_led_probe(struct hid_device *hdev, > led->led_devs[i].name = name; > led->led_devs[i].max_brightness = 1; > led->led_devs[i].brightness_set = gt683r_brightness_set; > + led->led_devs[i].groups = gt683r_led_groups; > + > ret = led_classdev_register(&hdev->dev, &led->led_devs[i]); > if (ret) { > hid_err(hdev, "could not register led device\n"); > @@ -268,12 +279,6 @@ static int gt683r_led_probe(struct hid_device *hdev, > } > } > @@ -298,7 +302,7 @@ static void gt683r_led_remove(struct hid_device *hdev) > static struct hid_driver gt683r_led_driver = { > .probe = gt683r_led_probe, > .remove = gt683r_led_remove, > - .name = "gt683r_led", > + .name = "gt683r", So you should skip this bit. > .id_table = gt683r_led_id, > }; Johan