From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756005AbcEEHbk (ORCPT ); Thu, 5 May 2016 03:31:40 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:11562 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbcEEHbi (ORCPT ); Thu, 5 May 2016 03:31:38 -0400 Date: Thu, 05 May 2016 09:31:33 +0200 From: Krzysztof Opasiak Subject: Re: [PATCH 1/2] usb: configfs: allow UDC binding rule configured as binding to *any* UDC In-reply-to: <0C18FE92A7765D4EB9EE5D38D86A563A05D2CE79@SHSMSX103.ccr.corp.intel.com> To: "Du, Changbin" , "balbi@kernel.org" Cc: "gregkh@linuxfoundation.org" , "corbet@lwn.net" , "linux-usb@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Du, Changbin" , "Du@vger.kernel.org" Message-id: <572AF6D5.9090406@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-AuditID: cbfec7f4-f796c6d000001486-28-572af6d6f42c X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsVy+t/xy7rXvmmFGzw5bGxxrO0Ju8WTa+eY LDZePM5k8eRAO6PFihU7GS2aF69ns1jYtoTF4vKuOWwWi5a1MjtweuycdZfdY/Gel0wem1Z1 snnsn7sGyO2bzOrxeZNcAFsUl01Kak5mWWqRvl0CV8bs/jfsBS+FK56fq21g3MbfxcjJISFg IrF//kwWCFtM4sK99WxdjFwcQgJLGSVe7t3KBOE8Z5SYvvwcE0iVsECyxPT1rewgtohAsMTR Gw0sEEVvGCXmzu4Gc5gFPjBJ/DqylrGLkYODTUBfYt4uUZAGXgEtibOLOsDWsQioSuzqXs4M YosKREg8mXuSEaJGUOLH5HtgNZwCYRKP92xmAhnDLKAncf+iFkiYWUBeYvOat8wTGAVmIemY hVA1C0nVAkbmVYyiqaXJBcVJ6bmGesWJucWleel6yfm5mxghEfBlB+PiY1aHGAU4GJV4eA/M 1woXYk0sK67MPcQowcGsJMI76w1QiDclsbIqtSg/vqg0J7X4EKM0B4uSOO/cXe9DhATSE0tS s1NTC1KLYLJMHJxSDYwLpm739H6+OOLpHp+XW58oxSS79b89ctVuvcbckz/ieE8cLZr0dVbe kawr654WfOvyM5ztJvfzlkf48lO3DfpDZ9+arfPpwSyrbRLH7y169PqpFWtZqLHi/zPzchTZ l8VenSjx60VgRv1S8VJrZ9b0AN4dcadZdy4x7dyU+yvOIMJf8/V32/jLSizFGYmGWsxFxYkA zTrrsnwCAAA= References: <1462244665-27681-1-git-send-email-changbin.du@intel.com> <1462244665-27681-2-git-send-email-changbin.du@intel.com> <5729AF76.7080508@samsung.com> <0C18FE92A7765D4EB9EE5D38D86A563A05D2CE79@SHSMSX103.ccr.corp.intel.com> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 05/05/2016 07:46 AM, Du, Changbin wrote: > Hi, >>> On most platforms, there is only one device controller available. >>> In this case, we desn't care the UDC's name. So let's ignore the >>> name by setting 'UDC' to 'any'. >> >> Hmm libubsgx allows to do this for a very long time. You simply pass >> NULL instead of pointer to usbg_udc. >> >> It is also possible to do this from command line, just simply: >> >> $ echo `ls -1 /sys/class/udc | head -n 1` > UDC >> >> So if we can easily do this from user space what's the benefit of adding >> this special "any" keyword to kernel? >> > Well, it is just for *easy to use*. Looking up /sys/class/udc mostly > can be skipped. The UDC core support this convenience behavior, > so why don't we export it with a little change? > Well, I'm not sure if any configfs interface has been proposed as easy to use from cmd line. I think they all has been proposed as *usable* from cmd line but not necessarily *easy to use*. That's why most of configfs clients has some support in userspace. For example for target there is a taget-cli and for usb gadget we have libusbg/libusbgx. So the functionality which you proposed here is not only already implemented in libusbgx but also can be easily achieved from cmd line like I showed above. In addition this patch will break existing userspace tools (at least libusbgx for sure) as it assumes that: cat UDC should return an empty string or an valid UDC name which can be found inside /sys/class/udc. After this patch the kernel can return some kind of magic string "any" which obviously will cannot be found in udc dir. >>> And also we can change UDC name >>> at any time if it is not binded (no need set to "" first). >>> >> >> Not sure if: >> >> $ echo "" > UDC >> >> is really a problem. Personally I'm quite used to situation in which I >> have to turn the light off before turning it on once again;) >> > That is not a problem. But just avoid pseudo 'busy'. If gadget is not > bind, it is free to reconfigure it. So seem no need block re-configuration. > What do you mean pseudo 'busy'? If we do: echo > UDC then gadget should be really bound to some udc and potentially really busy. > In a word, this patch is just an improvement, not to fix any issues or > add new function. So it doesn't add any new functionality and breaks existing user space tools. Cheers, -- Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics