Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6718245imu; Mon, 3 Dec 2018 01:27:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/VxQnHTlqKnSC+1p3Jn2IFoosWm9sHluJCKcSY1syLzLTUNs89neMwABjV27Dk8AfCSAI7V X-Received: by 2002:a62:1112:: with SMTP id z18mr14970500pfi.173.1543829275475; Mon, 03 Dec 2018 01:27:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543829275; cv=none; d=google.com; s=arc-20160816; b=qWAY9Nop5hr6uClESeDjIwbQDq5NaiJHsMdMhhoYR2tsDC5coq9RgqavLlJuPUdoiG JIbo9p/3Ft983Bee+HO/pIs1SfAfHPF6edcvZIX2cnOi6p+txZBava/P+uhfRPqfoxPm 7OTGmG8vCvA8nYFRpmTkBIKT246AB4X6fJNgSWdNIz0vMr06ryQH/9/WQ9nIilmqj2q5 j/nU4hJ2o/il83IZcmz8fyoPb22nrpy2kRKERs9Yvw2jjWsnhM/wCwLY3QkmNCYbgSZb D7guJSXXLu0JgS4rB9UkX+oD0t/RoRytPqtzB+4RauyHLnLf33nxSSmktnHayx7Ht1we aaRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eQpCfpIrbfdhUwDtFFizKV/Mg/I6D9g1P8O0splyJ2Q=; b=jTYoqUY1BvOhcfUC2rsTwm79uwEcEePuPm20cUgRxLA4gIv6XbzSj+t+MzhY8wH2/v +WurtE5y3et9sh5lQg8BViBanbjDXsHeLdjYwEHPy1inPViH2784KkxCde3jtiQhaL9n DrEi7gA3dLfo6OCZ6n4qtmw/hRU5ZIQn9JUXQJN6D2uPv8C5HRSsCYWCruVw5JRtC1Sf 2/gXcPqeZbVYL99OnX2oEReVm6lC1+dEsCbj88BGawKJ3Z+g9fBBFIFv4FSqnVYznImC pokPAQ00Pv1YCDNr8TCahx+1UbxbZTmwemBsIw1CzkPWrBgrynCyrUpcBZKmSIDJq2II l89Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fn4ldKhh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l30si2798778plg.113.2018.12.03.01.27.40; Mon, 03 Dec 2018 01:27:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fn4ldKhh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725990AbeLCJ0B (ORCPT + 99 others); Mon, 3 Dec 2018 04:26:01 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38096 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbeLCJ0B (ORCPT ); Mon, 3 Dec 2018 04:26:01 -0500 Received: by mail-qt1-f195.google.com with SMTP id p17so12889325qtl.5; Mon, 03 Dec 2018 01:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eQpCfpIrbfdhUwDtFFizKV/Mg/I6D9g1P8O0splyJ2Q=; b=Fn4ldKhhEBCpvbLc4uHN8PBScCJzhernTZ58qcvrb5+9qDL9ozlOM/YEfdXFil/ha6 xUSRoLHL1Et2XcDRxHn9Dhjnw+bgL0pSQzAWaVXOeBR6W+LcTouKVd0iLQMJkTPmaFnU 6exhTfTePSI9S5yoB554Y42ksbRc7dkKqQe5xdyBZ3jFzA0xzg/8In4hn9qQox5aN0+6 9ZtC1eatSOPD7Ojvgzie4LcLXOWjG5+7UK2ZFVSN6r+b3WWOykqL6z/K8TH8dRH40RUo NrSEyYSdNDqzs3W1OlY9VOrlZRv+7sPYNyrpUqgBF4eXCXZVwkgUEPwR26ilIrHzsGYK 43HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eQpCfpIrbfdhUwDtFFizKV/Mg/I6D9g1P8O0splyJ2Q=; b=uiXyihgzmifq9TwqMwlg7e/qqCpcxlF9Js1LRKaCRPjHKhXUfzrLEM7T67lvlLP3PY VBFqtZWvZC3g75cASEFdcFiIttN0bPf1dvIHt5pAGB+hi/UDpdEn6paqQWO0WkYrTHfC SQMcQWRVYunmT8L8Ro0QIijyNjVgkyjWrM5avL9jZX8NjmLCbzsN31bWUM4txC4MhjSp vz/RE4TZgcUcXHnP5XFAg5SwRaUWoZrDj5obsrROtlvZT6Cmvk5hG0bgtiqRQvcP9CW6 STpI4tOPL2iskvZ6rq5IRw+dVCzrcyW8tqn15SlZLjNx1XN2zlOTlJ/RDjXmu2bKWMTV kiAQ== X-Gm-Message-State: AA+aEWZTfxF65c0m+g+7nbO48NddWm0Km/aUceMevXcdpGiXDkDJnlNw TiM4ZszUjXjEvaLr4ErAkFasskyElTELMnW1OZo= X-Received: by 2002:ac8:6151:: with SMTP id d17mr14378795qtm.194.1543829147508; Mon, 03 Dec 2018 01:25:47 -0800 (PST) MIME-Version: 1.0 References: <20181203034515.91412-1-chenyu56@huawei.com> <20181203034515.91412-12-chenyu56@huawei.com> In-Reply-To: <20181203034515.91412-12-chenyu56@huawei.com> From: Andy Shevchenko Date: Mon, 3 Dec 2018 11:25:36 +0200 Message-ID: Subject: Re: [PATCH v1 11/12] usb: gadget: Add configfs attribuite for controling match_existing_only To: chenyu56@huawei.com Cc: USB , devicetree , Linux Kernel Mailing List , Suzhuangluan , Kongfei , Felipe Balbi , Greg Kroah-Hartman , John Stultz , Wangbinghui Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 3, 2018 at 5:47 AM Yu Chen wrote: > > Currently the "match_existing_only" of usb_gadget_driver in configfs is > set to one which is not flexible. > Dwc3 udc will be removed when usb core switch to host mode. This causes > failure of writing name of dwc3 udc to configfs's UDC attribuite. > To fix this we need to add a way to change the config of > "match_existing_only". > This patch adds a configfs attribuite for controling match_existing_only > which allow user to config "match_existing_only". > +static ssize_t gadget_driver_match_existing_only_store(struct config_item *item, > + const char *page, size_t len) > +{ > + struct usb_gadget_driver *gadget_driver = > + &(to_gadget_info(item)->composite.gadget_driver); It would be easier for reader to see two lines with two variables instead of this. > + bool match_existing_only; > + int ret; > + > + ret = kstrtobool(page, &match_existing_only); > + if (ret) > + return ret; > + > + if (match_existing_only) > + gadget_driver->match_existing_only = 1; > + else > + gadget_driver->match_existing_only = 0; gadget_driver->match_existing_only = match_existing_only; But the question rather why is it not direct parameter to kstrtobool? > + > + return len; > +} > + struct usb_gadget_driver *gadget_driver = > + &(to_gadget_info(item)->composite.gadget_driver); Make it neat. -- With Best Regards, Andy Shevchenko