Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2758855yba; Sun, 28 Apr 2019 08:22:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbCQIcAR2jBmHlDIbiJ97yoC/1Nqhnzb3K5Vgoq/ZsBN8qd/vji8gkPr04jah65HJPU2HX X-Received: by 2002:a62:292:: with SMTP id 140mr59646732pfc.206.1556464961656; Sun, 28 Apr 2019 08:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556464961; cv=none; d=google.com; s=arc-20160816; b=0P3xZrsXIRsZLE+ML+jl8cB5a4pGrNBrkcj9VJeJsYMPHx24d1+iCxBu00SzmNp2aP RUFEyXBC2hTis7wl13mhGlOfTAZxBAIucYsGW2jC7MU/cSQN1nJD5SspdhxTqT7cyKfr KSk8n8jayawg4eFbpm7E19eu15J1LWM621brD0pmmyPp8JoAEPLRBlzSA30rWES3ZgrC wgMARRXAAFX7Bx8dmJ4o9e9TO8mTAdt7g+oWDsG5pWCcJtF3lfbn66Slnb9RXb+6zZ5Q B/zs2fdFaPFwjlxqSH0qS0L181sRXfyOqsJufkH5NMKSBPECmHch4uuOQEmMEKipNaXS EirA== 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=eH11hcFEZT+aTY0/G6+wKPZZcS0KEClYM38L1bqky2g=; b=t2q4sCqBdaPrc8EiDlJRuPkT4djneiiz9jj0y+i9Sp4YqtZS34ZbQ52ewpBsR3xUtg vY9a/3Onl+Fn8m3W2uzJB/MBph4vOOA7h6ilt7i3OP8QufZiU/wF1szFHg0LzzUmjaXs kYClPVAiuk18BZk3CQpSZGNghpkd0VGdXoILw/zcmEckw1sychDfs4eMaPjMfymUMTzI ijStCE+UqSlYm7fd5USSiqMH2RaHMMM4ZvMDngMyG7cNLYwhht8FDfRIB0YNwMrerShW jszPHRglKnpGd8wePADgloNOSpGJZwBqi6s3yo65oDS32DbuBZmcP16QWWKGbDIoxCG9 zJhA== 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 w7si28830441pgs.230.2019.04.28.08.22.14; Sun, 28 Apr 2019 08:22:41 -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 S1726810AbfD1PS5 (ORCPT + 99 others); Sun, 28 Apr 2019 11:18:57 -0400 Received: from mga03.intel.com ([134.134.136.65]:34018 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726741AbfD1PS5 (ORCPT ); Sun, 28 Apr 2019 11:18:57 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2019 08:18:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,406,1549958400"; d="scan'208";a="341531946" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga005.fm.intel.com with ESMTP; 28 Apr 2019 08:18:51 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hKlZo-0005Ys-RD; Sun, 28 Apr 2019 18:18:48 +0300 Date: Sun, 28 Apr 2019 18:18:48 +0300 From: Andy Shevchenko To: "Enrico Weigelt, metux IT consult" Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, andrew@aj.id.au, macro@linux-mips.org, vz@mleia.com, slemieux.tyco@gmail.com, khilman@baylibre.com, liviu.dudau@arm.com, sudeep.holla@arm.com, lorenzo.pieralisi@arm.com, davem@davemloft.net, jacmet@sunsite.dk, linux@prisktech.co.nz, matthias.bgg@gmail.com, linux-mips@vger.kernel.org, linux-serial@vger.kernel.org, linux-ia64@vger.kernel.org, linux-amlogic@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, sparclinux@vger.kernel.org Subject: Re: [PATCH 36/41] drivers: tty: serial: 8250: store mmio resource size in port struct Message-ID: <20190428151848.GO9224@smile.fi.intel.com> References: <1556369542-13247-1-git-send-email-info@metux.net> <1556369542-13247-37-git-send-email-info@metux.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1556369542-13247-37-git-send-email-info@metux.net> 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 Sat, Apr 27, 2019 at 02:52:17PM +0200, Enrico Weigelt, metux IT consult wrote: > The io resource size is currently recomputed when it's needed but this > actually needs to be done once (or drivers could specify fixed values) io -> IO > > Simplify that by doing this computation only once and storing the result > into the mapsize field. serial8250_register_8250_port() is now called > only once on driver init, the previous call sites now just fetch the > value from the mapsize field. Do I understand correctly that this has no side effects? Which hardware did you test this on? > @@ -979,6 +979,9 @@ int serial8250_register_8250_port(struct uart_8250_port *up) > if (up->port.uartclk == 0) > return -EINVAL; > > + /* compute the mapsize in case the driver didn't specify one */ > + up->mapsize = serial8250_port_size(up); I don't know all quirks in 8250 drivers by heart, though can you guarantee that at this point the device reports correct IO resource size? (If I'm not mistaken some broken hardware needs some magic to be done before card can be properly handled) > - unsigned int size = serial8250_port_size(up); > struct uart_port *port = &up->port; > - int ret = 0; This and Co is a separate change that can be done in its own patch. > + port->membase = ioremap_nocache(port->mapbase, > + port->mapsize); You may increase readability by introducing temporary variables ... mapbase = port->mapbase; ... mapsize = port->mapsize; ... port->membase = ioremap_nocache(mapbase, mapsize); ... -- With Best Regards, Andy Shevchenko