From: Greg KH <gregkh@linuxfoundation.org>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: "Richard Purdie" <rpurdie@rpsys.net>,
"Jacek Anaszewski" <j.anaszewski@samsung.com>,
"Felipe Balbi" <balbi@kernel.org>,
"Peter Chen" <hzpeterchen@gmail.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"Rafał Miłecki" <rafal@milecki.pl>,
"Jonathan Corbet" <corbet@lwn.net>,
"Ezequiel Garcia" <ezequiel@vanguardiasur.com.ar>,
"Matthias Brugger" <mbrugger@suse.com>,
"Boris Brezillon" <boris.brezillon@free-electrons.com>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Stephan Linz" <linz@li-pro.net>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>
Subject: Re: [PATCH V3] leds: trigger: Introduce an USB port trigger
Date: Thu, 25 Aug 2016 08:53:05 -0400 [thread overview]
Message-ID: <20160825125305.GB15567@kroah.com> (raw)
In-Reply-To: <CACna6rz2YAFjkdmoZw8o29_EjV_z39tnK3osHvKoVHHOyLnXKg@mail.gmail.com>
On Thu, Aug 25, 2016 at 07:14:52AM +0200, Rafał Miłecki wrote:
> On 24 August 2016 at 23:04, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Aug 24, 2016 at 11:29:51AM +0200, Rafał Miłecki wrote:
> >> On 24 August 2016 at 11:22, Greg KH <gregkh@linuxfoundation.org> wrote:
> >> > On Wed, Aug 24, 2016 at 12:03:29AM +0200, Rafał Miłecki wrote:
> >> >> +static ssize_t ports_show(struct device *dev, struct device_attribute *attr,
> >> >> + char *buf)
> >> >> +{
> >> >> + struct led_classdev *led_cdev = dev_get_drvdata(dev);
> >> >> + struct usbport_trig_data *usbport_data = led_cdev->trigger_data;
> >> >> + struct usbport_trig_port *port;
> >> >> + ssize_t ret = 0;
> >> >> + int len;
> >> >> +
> >> >> + list_for_each_entry(port, &usbport_data->ports, list) {
> >> >> + len = sprintf(buf + ret, "%s\n", port->name);
> >> >> + if (len >= 0)
> >> >> + ret += len;
> >> >> + }
> >> >> +
> >> >> + return ret;
> >> >> +}
> >> >
> >> > sysfs is "one value per file", here you are listing a bunch of things in
> >> > one sysfs file. Please don't do that.
> >>
> >> OK. What do you think about creating "ports" subdirectory and creating
> >> file-per-port in it? Then I'd need to bring back something like
> >> "new_port" and "remove_port". Does it sound OK?
> >
> > Maybe, I don't know. Why is "USB" somehow unique here? Why isn't this
> > the same for PCI slots/ports? pccard? sdcard? thunderbolt?
>
> Good question. I would like to extend this USB port trigger in the
> future by reacting to USB activity. This involves playing with URBs
> and I believe that at that point it'd be getting too much USB specific
> to /rule them all/.
Oh that's never going to work, sorry. USB "activity" happens deep in
USB host controller hardware, not up at the kernel level at all. It's
just too fast, and would take up too much CPU to do it otherwise. Heck,
even old UHCI 1.1 USB controllers did this.
USB "activity" happens all the time, look at a USB bus analyzer if you
want to see what goes on. Teasing out what is "real data" and what is
just "normal bus activity" is impossible at the kernel level, and really
makes no sense at all (your led would just be "on" all the time.)
Are you sure you know how USB works? Writing things like this makes me
really worry...
greg k-h
next prev parent reply other threads:[~2016-08-25 12:52 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 22:03 [PATCH V3] leds: trigger: Introduce an USB port trigger Rafał Miłecki
2016-08-24 9:21 ` Greg KH
2016-08-24 9:26 ` Rafał Miłecki
2016-08-24 21:04 ` Greg KH
2016-08-24 9:22 ` Greg KH
2016-08-24 9:29 ` Rafał Miłecki
2016-08-24 21:04 ` Greg KH
2016-08-25 5:14 ` Rafał Miłecki
2016-08-25 12:53 ` Greg KH [this message]
2016-08-25 18:39 ` Bjørn Mork
2016-08-25 20:55 ` Greg KH
2016-08-24 10:49 ` Matthias Brugger
2016-08-24 11:02 ` Rafał Miłecki
2016-08-24 11:27 ` Matthias Brugger
2016-08-24 17:52 ` [PATCH RFC V3.5] " Rafał Miłecki
2016-08-24 18:48 ` Bjørn Mork
2016-08-24 20:42 ` Rafał Miłecki
2016-08-25 8:03 ` Jacek Anaszewski
2016-08-25 8:27 ` Matthias Brugger
2016-08-25 8:29 ` Rafał Miłecki
2016-08-25 9:04 ` Jacek Anaszewski
2016-08-25 14:30 ` Alan Stern
2016-08-25 18:48 ` Jacek Anaszewski
2016-08-25 19:35 ` Alan Stern
2016-08-25 20:08 ` Alan Stern
2016-08-26 15:58 ` Rafał Miłecki
2016-08-29 7:41 ` Jacek Anaszewski
2016-08-29 8:05 ` Pavel Machek
2016-08-29 8:21 ` Rafał Miłecki
2016-08-29 8:41 ` Pavel Machek
2016-08-29 9:01 ` Rafał Miłecki
2016-08-26 19:50 ` Pavel Machek
2016-08-29 8:29 ` Jacek Anaszewski
2016-08-26 19:48 ` Pavel Machek
2016-08-25 8:32 ` Rafał Miłecki
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=20160825125305.GB15567@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=balbi@kernel.org \
--cc=boris.brezillon@free-electrons.com \
--cc=corbet@lwn.net \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=geert@linux-m68k.org \
--cc=hzpeterchen@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linz@li-pro.net \
--cc=mbrugger@suse.com \
--cc=rafal@milecki.pl \
--cc=rpurdie@rpsys.net \
--cc=zajec5@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox