From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Re: [PATCH RFC V3.5] leds: trigger: Introduce an USB port trigger Date: Mon, 29 Aug 2016 10:05:52 +0200 Message-ID: <20160829080551.GA7987@amd> References: <57BF3D64.3090402@gmail.com> <25cdf5e1-c3b5-e8a3-8213-f35a6f6160c2@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <25cdf5e1-c3b5-e8a3-8213-f35a6f6160c2@samsung.com> Sender: linux-kernel-owner@vger.kernel.org To: Jacek Anaszewski Cc: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jacek Anaszewski , Alan Stern , Richard Purdie , Felipe Balbi , Greg KH , Peter Chen , "linux-usb@vger.kernel.org" , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jonathan Corbet , Ezequiel Garcia , Stephan Linz , Matthias Brugger , Boris Brezillon , Geert Uytterhoeven , "open list:DOCUMENTATION" , open list , open list:LED SUBSY List-Id: linux-leds@vger.kernel.org Hi! > >2) Having "ports" subdir with RW files, one per each existing physical port > >In this situation we don't need "new_port" or "remove_port". If we > >want port to be observable we just do: > >echo 1 > 1-1 > >Implementing this solution needs reading more details from USB subsystem. > > The situation here is clear IMO - the number of USB ports in the system > can change dynamically. I'm not sure if this can be handled easily with > sysfs, where we usually expose an interface for known set of settings. > struct attribute arrays are usually defined statically at the compile > time and filled with the variables, that are created with DEVICE_ATTR > macro. sysfs already exposes current view of all usb devices. Just use it. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932669AbcH2IF7 (ORCPT ); Mon, 29 Aug 2016 04:05:59 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:54835 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932511AbcH2IF4 (ORCPT ); Mon, 29 Aug 2016 04:05:56 -0400 Date: Mon, 29 Aug 2016 10:05:52 +0200 From: Pavel Machek To: Jacek Anaszewski Cc: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jacek Anaszewski , Alan Stern , Richard Purdie , Felipe Balbi , Greg KH , Peter Chen , "linux-usb@vger.kernel.org" , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Jonathan Corbet , Ezequiel Garcia , Stephan Linz , Matthias Brugger , Boris Brezillon , Geert Uytterhoeven , "open list:DOCUMENTATION" , open list , "open list:LED SUBSYSTEM" Subject: Re: [PATCH RFC V3.5] leds: trigger: Introduce an USB port trigger Message-ID: <20160829080551.GA7987@amd> References: <57BF3D64.3090402@gmail.com> <25cdf5e1-c3b5-e8a3-8213-f35a6f6160c2@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25cdf5e1-c3b5-e8a3-8213-f35a6f6160c2@samsung.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > >2) Having "ports" subdir with RW files, one per each existing physical port > >In this situation we don't need "new_port" or "remove_port". If we > >want port to be observable we just do: > >echo 1 > 1-1 > >Implementing this solution needs reading more details from USB subsystem. > > The situation here is clear IMO - the number of USB ports in the system > can change dynamically. I'm not sure if this can be handled easily with > sysfs, where we usually expose an interface for known set of settings. > struct attribute arrays are usually defined statically at the compile > time and filled with the variables, that are created with DEVICE_ATTR > macro. sysfs already exposes current view of all usb devices. Just use it. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html