Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1470978 > unrolled thread

Re: [RFC PATCH 4/6] serio: serport: add support for buffered write and receive

Started byPavel Machek <pavel@ucw.cz>
First post2016-08-26 22:20 +0200
Last post2016-08-27 00:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH 4/6] serio: serport: add support for buffered write  and receive Pavel Machek <pavel@ucw.cz> - 2016-08-26 22:20 +0200
    Re: [RFC PATCH 4/6] serio: serport: add support for buffered write  and receive Rob Herring <robh@kernel.org> - 2016-08-26 23:40 +0200
      Re: [RFC PATCH 4/6] serio: serport: add support for buffered write  and receive Pavel Machek <pavel@ucw.cz> - 2016-08-27 00:30 +0200

#1470978 — Re: [RFC PATCH 4/6] serio: serport: add support for buffered write and receive

FromPavel Machek <pavel@ucw.cz>
Date2016-08-26 22:20 +0200
SubjectRe: [RFC PATCH 4/6] serio: serport: add support for buffered write and receive
Message-ID<savLA-3ml-7@gated-at.bofh.it>
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?

Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[toc] | [next] | [standalone]


#1471007

FromRob Herring <robh@kernel.org>
Date2016-08-26 23:40 +0200
Message-ID<sax10-41h-13@gated-at.bofh.it>
In reply to#1470978
On Fri, Aug 26, 2016 at 3:12 PM, Pavel Machek <pavel@ucw.cz> 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.

Rob

[toc] | [prev] | [next] | [standalone]


#1471019

FromPavel Machek <pavel@ucw.cz>
Date2016-08-27 00:30 +0200
Message-ID<saxNn-4Bu-5@gated-at.bofh.it>
In reply to#1471007
On Fri 2016-08-26 16:27:35, Rob Herring wrote:
> On Fri, Aug 26, 2016 at 3:12 PM, Pavel Machek <pavel@ucw.cz> 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web