Return-Path: Date: Sat, 27 Aug 2016 00:24:25 +0200 From: Pavel Machek To: Rob Herring Cc: Greg Kroah-Hartman , Marcel Holtmann , Jiri Slaby , Sebastian Reichel , Arnd Bergmann , "Dr . H . Nikolaus Schaller" , Alan Cox , Loic Poulain , Peter Hurley , NeilBrown , Linus Walleij , "open list:BLUETOOTH DRIVERS" , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH 4/6] serio: serport: add support for buffered write and receive Message-ID: <20160826222425.GA1140@amd> References: <20160824232437.9446-1-robh@kernel.org> <20160824232437.9446-6-robh@kernel.org> <20160826201202.GA27227@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: List-ID: On Fri 2016-08-26 16:27:35, Rob Herring wrote: > On Fri, Aug 26, 2016 at 3:12 PM, Pavel Machek wrote: > > Hi! > > > >> @@ -133,26 +133,29 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c > >> if (!test_bit(SERPORT_ACTIVE, &serport->flags)) > >> goto out; > >> > >> - for (i = 0; i < count; i++) { > >> - if (fp) { > >> - switch (fp[i]) { > >> - case TTY_FRAME: > >> - ch_flags = SERIO_FRAME; > >> - break; > >> - > >> - case TTY_PARITY: > >> - ch_flags = SERIO_PARITY; > >> - break; > >> - > >> - default: > >> - ch_flags = 0; > >> - break; > >> + if (serio_buffered_mode_enabled(serport->serio)) { > >> + serio_receive_buf(serport->serio, cp, count); > > > > Elsewhere: > > + /* Use buffer receive if the driver provides a callback */ > > + if (drv->receive_buf) > > + set_bit(SERIO_MODE_BUFFERED, &drv->flags); > > > > Could we use if (drv->receive_buf) above directly, and not require the > > bitfield? > > I'm allowing for allowing drivers to provide both functions and be > able to switch between them. However, I didn't provide any mechanism > to do so yet. Dunno -- does switching make sense? IMO we'd want to migrate all the drivers to the "blocks" interface... no need to switch between the two. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html