All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Stefan Roese <sr@denx.de>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yegor Yefremov <yegorslists@googlemail.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Giulio Benetti <giulio.benetti@micronovasrl.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 2/2 v5] tty/serial/8250: use mctrl_gpio helpers
Date: Thu, 13 Jun 2019 14:05:29 +0300	[thread overview]
Message-ID: <20190613110529.GR9224@smile.fi.intel.com> (raw)
In-Reply-To: <6a4f1001-b023-c972-7b36-6d2f8f9a3fa8@denx.de>

On Thu, Jun 13, 2019 at 07:32:39AM +0200, Stefan Roese wrote:
> On 12.06.19 11:16, Andy Shevchenko wrote:
> > On Wed, Jun 12, 2019 at 10:13:05AM +0200, Stefan Roese wrote:
> > > On 11.06.19 16:48, Andy Shevchenko wrote:

> > > Do you something like this in mind?
> > 
> > More likely
> > 
> > static inline int serial8250_MCR_to_TIOCM(int mcr)
> 
> MSR_to_TIOCM (see below) ...

Yes. true.

> > {
> > 	int tiocm = 0;
> > 
> > 	if (mcr & ...)
> > 		tiocm |= ...;
> > 	...
> > 
> > 	return tiocm;
> > }
> > 
> > static inline int serial8250_TIOCM_to_MCR(int tiocm)
> > {
> > 	... in a similar way ...
> > }
> 
> While implementing such wrapper functions I noticed, that get_mctrl() /
> set_mctrl() need TIOCM->MCR and MSR->TIOCM (notice MSR vs MCR here) but
> serial8250_in_MCR() needs MCR->TIOCM. So there is not that much
> overlay here.

It seems not only this driver is using such conversion. It's even possible to
move it to serial level for all.

> Additionally the wrappers would need to handle all bits
> and only some of them are needed in serial8250_in/out_MCR(),
> so I would
> need to add masking here as well.

I don't see this. You will get a value for exclusive bits only. No additional
mask would be needed.

> For my taste its not really worth adding these wrappers as they won't
> make things much clearer (if at all).

Hmm.. For me it would be quite clear if something with proposed name would be
called in the code.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2019-06-13 11:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 10:56 [PATCH 1/2 v5] serial: mctrl_gpio: Check if GPIO property exisits before requesting it Stefan Roese
2019-06-11 10:56 ` [PATCH 2/2 v5] tty/serial/8250: use mctrl_gpio helpers Stefan Roese
2019-06-11 12:44   ` Andy Shevchenko
2019-06-11 14:02     ` Stefan Roese
2019-06-11 14:48       ` Andy Shevchenko
2019-06-12  8:13         ` Stefan Roese
2019-06-12  9:16           ` Andy Shevchenko
2019-06-13  5:32             ` Stefan Roese
2019-06-13 11:05               ` Andy Shevchenko [this message]
2019-06-18  7:49   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190613110529.GR9224@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=giulio.benetti@micronovasrl.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=sr@denx.de \
    --cc=yegorslists@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.