Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162319AbbKTJZH (ORCPT ); Fri, 20 Nov 2015 04:25:07 -0500 Received: from mail-bl2on0131.outbound.protection.outlook.com ([65.55.169.131]:36512 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161167AbbKTJY6 (ORCPT ); Fri, 20 Nov 2015 04:24:58 -0500 Authentication-Results: spf=permerror (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; samsung.com; dkim=none (message not signed) header.d=none;samsung.com; dmarc=none action=none header.from=freescale.com; Date: Fri, 20 Nov 2015 17:22:06 +0800 From: Peter Chen To: Marek Szyprowski CC: , , "Ruslan Bilovol" , Bartlomiej Zolnierkiewicz Subject: Re: [PATCH v6 2/4] usb: gadget: configfs: pass UDC name via usb_gadget_driver struct Message-ID: <20151120092205.GE30829@shlinux2> References: <1448009652-14716-1-git-send-email-m.szyprowski@samsung.com> <1448009652-14716-3-git-send-email-m.szyprowski@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1448009652-14716-3-git-send-email-m.szyprowski@samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD018;1:KzSeaNLGOY2S6oqDoV7zN3ier3Flgj+RW78r063ywAwGbOMYhfqRjQSO70x7CJ+MgHxmlG5P/tvli1BHgY7P3dkucA8KHXZVP2R/GLYw6+mQVhXb3bxq/zCFGP3NH/Ji5+fjq4gicWwp+Is0JFiPRI6mitU8lpN/4pO1APT40GzpsmNc6gVClWn8UG9P9t60u5u38EM8ziWDCgCV0JtoSFb9CXlROWrvacFnoCK32n5H0QKvCWb9k2BHZc6kZBxNHCwhhlL8iHM+Tm9xyl8ZybRkEgXxEDfA+eP1KXugycDC6HEGVYFCt94cFhzkzH+pTuFZPjLTmTtsJ0Tse7aXhvO4yWP9pf/1myQID0eZz/gSfv5h8GBM1XgdMFISLmbXuLHNNo0S8a+3F8OJcrvGKQ== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1060300003)(448002)(199003)(24454002)(189002)(23726002)(77096005)(106466001)(104016004)(47776003)(2950100001)(606003)(81156007)(11100500001)(4001350100001)(5890100001)(97736004)(33716001)(110436001)(110136002)(5007970100001)(50466002)(5001960100002)(6806005)(50986999)(4290100001)(19580405001)(33656002)(46406003)(76176999)(92566002)(5001920100001)(19580395003)(97756001)(87936001)(85326001)(83506001)(86362001)(5008740100001)(54356999);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB554;H:tx30smr01.am.freescale.net;FPR:;SPF:PermError;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB554;2:kkOi4i6RUp3O2wA92GPWFmC3IFXP90NQO5wLI7Ox7iiwaPmh1N+gK6/PFigQfEeA9ICosPFFQdlyu6Oy5LfJptOt0C0yN9c1I06lMIHTvVxPZB2AurlUlNmo9V48gGb/oLK+QpPOAr433ZCxgid9EqZsVCMDBb/yXorqeMYUbZ8=;3:71f0MZRM/3Yk79GiktdlRtxE1ZiNovosyh1hFJE3Gmgk646K6DLMtSHmdPkuJEigJLExpgvRRmylSrn4YxeSJh4seoaPADRU2o4TfWRPJYn9n66mH5D+zb4oYokm7g230l5QmgzCLreDoDTbaN8Vqo8x7RD8CStgNSHl71++ymOyjg6pSQ588Hlg3B1nKoG6K1Ong69Z/TM3/0W+zrf2xMeVRGvlJw3ZCHcpeWadLzs=;25:vCeQMkG22JnS0RuEYCmTSmraDvXDf7Nv4kIcdj85ixz///1GFvqh0ENWIX+PU88lZ30F2ghQSEGRgLfOP6jrli5CYBjz3xMGjnEVnmnbmoyGX7njtdzkqeYJLOm3mZf646qELkI/WOGN247BcrGPMpqmNn/buVJ1XXjp99HBnCh/8vkhbfGB8Wk+16mH/r83kaeQbwG1GUlplDLNiAI77e+NQ5BZ/qRH+lmbbdXATfSFItvqPtpZYDFrCC1jYSIudQfXEsE+bjH2QbPLID9XDA== X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:BY2PR03MB554; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB554;20:QOBnc88EoSoVtajskH1KCAY+aJ1+iT7WHf3uQdpnIX5yiaRLnL5cqNpXk8Mt2ckopTBQOkzYu1Ik/QgV5ApQKEQ+Y1RBiWkHqVMT6JHBHpwLWxPziNMQYiEmmfsQxT6LdkSyvRBBPLTO9brFQ1vTvh42qPk9Pqq1whij3gVxdnfvyTnkb0jOzf513NLacfXE+FdmTQmQH5G4hXCwKku5tQATqVQiX2TlL6elkNI/b/5Uce9bsCpvlyoh7SRcRaB55OXGwdD1QKsfTvPRCNwCMsaUsoulLovIhmzUlnvVLQqKwbkRh1F16Grv7+Y8hP5rrFqUUFwrBs07cKs3O9k/eiKZsG1wwb3iQzH3tFJhfcU=;4:0ZBwyvwSXx/u9fuCutdsEmmv81bWJqT1ZLhts4AhDMznA6CqxXxIafjeN1Uz3FLBLwmTmQuR/lOqReMZusrRA3Yh6VyBH3W9ePyRGgmQe7QaFoWEZ7D26ySLO1ptf/pNkivfdGLIA8TprkQuXBTUnyT204twxj+QV6MBtysNFgp8HPiaVi93TLxsPHz58JBsf8oY0UVb/zwSFYKj15CbeheBFxVSwUCDgA4mPoG5H9WQ0jIJo3ReMGZC6Ex9wSow27naHupiqDZguQvz6xYXHjIcmOzvc84tWFCMuH9hC/U1t9f61KL2+AL2DkPfcs17z60EjxsowtVvKDG5iW8M5PYiAIe/xLZSOICyGr7p0U+h3FeTr+yJBeFTa2C+q7pVGzuTrZlT+Izut9IAXX7Q1w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(1201001)(520078)(3002001)(10201501046);SRVR:BY2PR03MB554;BCL:1;PCL:0;RULEID:;SRVR:BY2PR03MB554; X-Forefront-PRVS: 07665BE9D1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR03MB554;23:S0gAYYQ63iitEYP19Rz1O+RvFWdmZ0OWDkW7akpdcN?= =?us-ascii?Q?lYXuJyWPtPMG3/Pt55f++HsCGzbJoPwnQ13V8hkQ5q5TymGac0LdeiIye3l0?= =?us-ascii?Q?eE9x5u/8h6xNUT0NGMLWRDCfq7W7nkBQHsDedGIcM+g6d9StL3OP1U7d0kiX?= =?us-ascii?Q?LGAUmDMUogv8U2Vy767QpZV2535ukTWoeIlkw8UehKgepSIJVIDnIdbuY5EI?= =?us-ascii?Q?u+an8V9ImnzN3XeZ4sHMK4fnP0aAQq7MgWf9T9Hk5eIqtf7+BBDD92U07lWG?= =?us-ascii?Q?fcoJn0ODIQebg6+qcg8WSxjelw+J+aPr3Z6I0w4Ck/K1djd23r92pBb9KRPe?= =?us-ascii?Q?sm/RYITjyYCI5Rx4IH+/MSEUVqtquk81+qsFUEuem7jF04dloPnHIf3+5XJz?= =?us-ascii?Q?xW4xBFZztCYY8eYQIIjZI0nCd6IjEiNwHvaP9hkw26sRYjB1UTPv0JqhY7pH?= =?us-ascii?Q?EGqGqdT1eEVa+Km036ciuu7cWf2fIjH1PKGG70ifXXyTJ0NCgnDtLg8w6qyn?= =?us-ascii?Q?agMMfftOcRUtpI9VfHVSCcRwGqyK9JlMpBRokTGSkggUMyRAS8TTU6V6eiQV?= =?us-ascii?Q?sAsY7LRjIrtxO5baKRA/tEU1BNthNSgV7SOnkJkFrT+8mywoDgLrbvzk91wL?= =?us-ascii?Q?APfnIcQgo6nU9v8t8TbJZg/wHQSJ6lj9tYwcpU4WDyjGcbJ0kF4IPizvjc8R?= =?us-ascii?Q?QV7M4/bc41WIrD1bxDfF2vbBmLNCdUu1lSrbjUbgFFpFzUcNcL1mi4Gx1kr9?= =?us-ascii?Q?j2ZB4+zIW6v4miTD6zCKEHFYf8AMgqOhgkNY973Ijj6W4kXNsWcIaUB46t3x?= =?us-ascii?Q?F/6UH7c7vGBAk14GveatJUEM1xLKukzqmCrk63RL8R1QcxY0i1+C5Z3tBPrA?= =?us-ascii?Q?XLz1XHSLf09Iq9Fw8NHuy46w4f/Asq3rtbhAuF8otbdTQlKv/jQQzWcTmEZe?= =?us-ascii?Q?CxhEK+rIYkQu8KVFh4CuCoTTTDTgvQsyoD3HbLP7ihgcB8tkvhqgGPNt8hAK?= =?us-ascii?Q?vjIw21wUoZWx1kjue5Wvcn/Hte4ZtCWjVJi0ZXNMR2qbNM3vHHX/UxgGjAH5?= =?us-ascii?Q?c+9Q6P4lVcKlU5nOPSXt0kTD9nwL842xK57AuHBqtN4c/MohKzlB5kpfwDEZ?= =?us-ascii?Q?V68R1K/xKqLZWD4cKwabIWQ4g8rWh8?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB554;5:N7VfRgSwrIVHAgAj6KCGaTEL2UP2dXrsNdi9n4g+azdvskklPVtIHqvHU7h0p0CtmQI20gNhGuebqb1x1MAV2OFoCZ/JBiNC9heWBR8ksMJs1M01vfnyk/dwQJ3bdPTYItB1dZFC15x5Gl3Rslh7LQ==;24:RDo45UF3M6uafmKZnl/iT+ldDm14u3VbfK5lOqn1nIFQah1PDMLNxWrwxg4HAKq2zO9MGEI/s/R349osejz7BsyZuTeCKJFElUT5gUjm+0U=;20:ewbGPkJIikCptzJ3XD5ZYp1XGEiyqIqqFv/fqpBCVskgJLRlVSWVZH/vezdndAC6BbEZlIURuzpte7tK4k2doQ== SpamDiagnosticOutput: 1:5 SpamDiagnosticMetadata: 00000000%2D0000%2D0000%2D0000%2D000000000000 SpamDiagnosticMetadata: 1 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2015 09:24:55.0450 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB554 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3766 Lines: 117 On Fri, Nov 20, 2015 at 09:54:10AM +0100, Marek Szyprowski wrote: > From: Ruslan Bilovol > > Now when udc-core supports binding to specific UDC by passing > its name via 'udc_name' member of usb_gadget_driver struct, > switch to this generic approach. > > Tested-by: Maxime Ripard > Signed-off-by: Ruslan Bilovol > Signed-off-by: Marek Szyprowski > --- > drivers/usb/gadget/configfs.c | 27 ++++++++++++++------------- > 1 file changed, 14 insertions(+), 13 deletions(-) > > diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c > index 163d305..0bc6865 100644 > --- a/drivers/usb/gadget/configfs.c > +++ b/drivers/usb/gadget/configfs.c > @@ -56,7 +56,6 @@ struct gadget_info { > struct list_head string_list; > struct list_head available_func; > > - const char *udc_name; > struct usb_composite_driver composite; > struct usb_composite_dev cdev; > bool use_os_desc; > @@ -233,21 +232,21 @@ static ssize_t gadget_dev_desc_bcdUSB_store(struct config_item *item, > > static ssize_t gadget_dev_desc_UDC_show(struct config_item *item, char *page) > { > - return sprintf(page, "%s\n", to_gadget_info(item)->udc_name ?: ""); > + return sprintf(page, "%s\n", to_gadget_info(item)->composite.gadget_driver.udc_name ?: ""); > } > > static int unregister_gadget(struct gadget_info *gi) > { > int ret; > > - if (!gi->udc_name) > + if (!gi->composite.gadget_driver.udc_name) > return -ENODEV; > > ret = usb_gadget_unregister_driver(&gi->composite.gadget_driver); > if (ret) > return ret; > - kfree(gi->udc_name); > - gi->udc_name = NULL; > + kfree(gi->composite.gadget_driver.udc_name); > + gi->composite.gadget_driver.udc_name = NULL; > return 0; > } > > @@ -271,14 +270,16 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item, > if (ret) > goto err; > } else { > - if (gi->udc_name) { > + if (gi->composite.gadget_driver.udc_name) { > ret = -EBUSY; > goto err; > } > - ret = usb_udc_attach_driver(name, &gi->composite.gadget_driver); > - if (ret) > + gi->composite.gadget_driver.udc_name = name; > + ret = usb_gadget_probe_driver(&gi->composite.gadget_driver); > + if (ret) { > + gi->composite.gadget_driver.udc_name = NULL; > goto err; > - gi->udc_name = name; > + } > } > mutex_unlock(&gi->lock); > return len; > @@ -427,9 +428,9 @@ static int config_usb_cfg_unlink( > * remove the function. > */ > mutex_lock(&gi->lock); > - if (gi->udc_name) > + if (gi->composite.gadget_driver.udc_name) > unregister_gadget(gi); > - WARN_ON(gi->udc_name); > + WARN_ON(gi->composite.gadget_driver.udc_name); > > list_for_each_entry(f, &cfg->func_list, list) { > if (f->fi == fi) { > @@ -873,10 +874,10 @@ static int os_desc_unlink(struct config_item *os_desc_ci, > struct usb_composite_dev *cdev = &gi->cdev; > > mutex_lock(&gi->lock); > - if (gi->udc_name) > + if (gi->composite.gadget_driver.udc_name) > unregister_gadget(gi); > cdev->os_desc_config = NULL; > - WARN_ON(gi->udc_name); > + WARN_ON(gi->composite.gadget_driver.udc_name); > mutex_unlock(&gi->lock); > return 0; > } > -- Applying: usb: gadget: configfs: pass UDC name via usb_gadget_driver struct WARNING: line over 80 characters #18: FILE: drivers/usb/gadget/configfs.c:235: + return sprintf(page, "%s\n", to_gadget_info(item)->composite.gadget_driver.udc_name ?: ""); -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/