Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7038390ybi; Thu, 13 Jun 2019 08:32:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyN8go5Y4biEZXfIUHNhMZppZQUrFKwpYVarA35qqTwareNPU2uKIRdvClJg6yg9s9hVXWX X-Received: by 2002:a17:902:8609:: with SMTP id f9mr82351593plo.252.1560439944655; Thu, 13 Jun 2019 08:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560439944; cv=none; d=google.com; s=arc-20160816; b=N6ocJxrXAJQ2Fga4Vn4n8AxhGcNjmqAlvl7qfa4PpscuA0hk+yyGNIGQaDzrMai/9Q d6Vi8XcT/PSxaV1YLvhEdfZPvlH1SQ1E4gJ91aPsp0GE/svvMDLEsvwTBMc3A8YMP862 RFfI44q3zEhrBCWFexYhxA6F+fHhgY1LuqmU9K9Gfw+UpVhL+d0vrx0hMh/mra2AEVKx Bm/inMHJT1J8g1NHrFGpOXREl14qKEIQjQEXo54plIVvGrStRPGIP2XUiMXoY8ISn0/w FdjALAk2zErL84fjMuyf8boB3mKIQEr04zEzTGXxm6HdAReI3124eug/zVI5EeqticwU 2K+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=iHso+uACBGQsF7oDYTx/F0x7fa7aB0JTQBb2gE8l4l4=; b=qYOhVJ4OPacM7rDIEgTnWUFAoBD0fjX8XlgvQ7Z7rrQMrgIUuIL7cU3KjFSptv6WaR l/Idg/2S24dmPFWURYwkyHOr2A4Q8dpGiEhJb/px+vtCUDB8DfSYy5Hhhe4p/+sU+XFG q7lhCcUbvnRSM8BAPuao7sCbPSLORrZAiwTHrm/4E7zFx2KoFGPIk0/eQKa3wU0hSlVG YqrODuku0EAJF6iwOdaWGq0JOw+uEx3AwpHkLUeQ1AXXy5L29C6DW3kFYxEuaUSnkdYZ iVH0a+m0LHziv2WscjAMeEEOHELXAduGQTFzJ8rd7yAvIXJzSL4tZw3+dPhoypTS4M1a PlpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si55667pgq.194.2019.06.13.08.32.08; Thu, 13 Jun 2019 08:32:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727817AbfFMPbK (ORCPT + 99 others); Thu, 13 Jun 2019 11:31:10 -0400 Received: from mga05.intel.com ([192.55.52.43]:20387 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728631AbfFMLFd (ORCPT ); Thu, 13 Jun 2019 07:05:33 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2019 04:05:32 -0700 X-ExtLoop1: 1 Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga001.jf.intel.com with ESMTP; 13 Jun 2019 04:05:30 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hbNXt-0003ZP-BF; Thu, 13 Jun 2019 14:05:29 +0300 Date: Thu, 13 Jun 2019 14:05:29 +0300 From: Andy Shevchenko To: Stefan Roese Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Yegor Yefremov , Mika Westerberg , Giulio Benetti , Greg Kroah-Hartman Subject: Re: [PATCH 2/2 v5] tty/serial/8250: use mctrl_gpio helpers Message-ID: <20190613110529.GR9224@smile.fi.intel.com> References: <20190611105603.4435-1-sr@denx.de> <20190611105603.4435-2-sr@denx.de> <20190611124415.GT9224@smile.fi.intel.com> <85f0d39c-e5d8-320b-e611-d956630a629f@denx.de> <20190611144828.GX9224@smile.fi.intel.com> <12e5180e-b4a0-e5fa-bcad-ddc8103d644c@denx.de> <20190612091621.GA9224@smile.fi.intel.com> <6a4f1001-b023-c972-7b36-6d2f8f9a3fa8@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a4f1001-b023-c972-7b36-6d2f8f9a3fa8@denx.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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