Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755547AbbKRMHj (ORCPT ); Wed, 18 Nov 2015 07:07:39 -0500 Received: from smtp-out4.electric.net ([192.162.216.194]:64632 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501AbbKRMHi (ORCPT ); Wed, 18 Nov 2015 07:07:38 -0500 From: David Laight To: "'Baolin Wang'" , Andy Shevchenko CC: Felipe Balbi , Greg Kroah-Hartman , "r.baldyga@samsung.com" , "fabio.estevam@freescale.com" , Philip Oberstaller , Peter Hurley , "scottwood@freescale.com" , Mark Brown , USB , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] usb: gadget: Add the console support for usb-to-serial port Thread-Topic: [PATCH] usb: gadget: Add the console support for usb-to-serial port Thread-Index: AQHRIe3+xdFoq8zvHUCNPZkRquVhoJ6hroNA Date: Wed, 18 Nov 2015 12:05:59 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CBD539B@AcuExch.aculab.com> References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id tAIC7ifa017148 Content-Length: 1821 Lines: 43 From: Baolin Wang > Sent: 18 November 2015 10:45 > On 18 November 2015 at 17:32, Andy Shevchenko wrote: > > On Wed, Nov 18, 2015 at 4:15 AM, Baolin Wang wrote: > >> On 17 November 2015 at 21:34, Andy Shevchenko wrote: > >>> On Mon, Nov 16, 2015 at 9:05 AM, Baolin Wang wrote: > >>>> It dose not work when we want to use the usb-to-serial port based > >>>> on one usb gadget as a console. Thus this patch adds the console > >>>> initialization to support this request. > >>> > > > >>>> +#define GS_BUFFER_SIZE (4096) > >>> Redundant parens > >> OK. I'll remove it. > >> > >>>> +#define GS_CONSOLE_BUF_SIZE (2 * GS_BUFFER_SIZE) > >>>> + > >>>> +struct gscons_info { > >>>> + struct gs_port *port; > >>>> + struct tty_driver *tty_driver; > >>>> + struct work_struct work; > >>>> + int buf_tail; > >>>> + char buf[GS_CONSOLE_BUF_SIZE]; > >>> > >>> Can't be malloced once? > >> The 'gscons_info' structure is malloced once. > > > > In state of high fragmentation is quite hard to find big memory chunks. > > I would split it to two allocations, though if maintainers are okay > > with your code, then I'm also okay. > > > > Make sense. But I think the major memory of the 'struct gscons_info' > is for the 'buf' member, so I still think no need to allocate it 2 > times. It may be worth just reducing GS_BUFFER_SIZE slightly so that the gscons_info structure itself is less than 8k. If you can't get 2 adjacent pages then a lot of things will fail. David ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?