Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp906301ybm; Tue, 21 May 2019 05:44:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwd48azWUXWMKgL4qdxMmuNMSxHbE3Df4CeybW2T+wtEfNeIFJxG8IVZCGWIfhEmgA+nIar X-Received: by 2002:a17:902:8a4:: with SMTP id 33mr54566603pll.19.1558442646474; Tue, 21 May 2019 05:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558442646; cv=none; d=google.com; s=arc-20160816; b=dLgYylepFR9FtRH2MUjQNXW3XiQAqI2EG74/5KZdwJcVXBJC2CvxhrRaI/hnkaEYcE +pqWizRdYGdnQFhZnkUaPspY2mdH3WAXDT/TeWya0PY72mRcm2C1PlVJj34pkZIBxXYD XKo3KDL2ZxoCqr+lnV5iih8YYwVPRm035r0f2OAZYFoOptlNxku8yEYYsJw/JBrfBumS Y2thehz6Upv22B6tNAiNZVpv3HrFaR+Te4W18nGup6F55QreNtuS4h7wYaTvDRIHuejU Q4NkvMLM3zRo4L4EmIQSIqFravMSE8PS3RceLM0qqVKrbEaNBR02sNeOU1aj4ZRuNPA3 OEwg== 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=rb10/UfnpbRafciSaDtaMJTxpHZ3ACDgQ8dGlSF0xTU=; b=ZnlmyBZaC1a+f0im8+pg8drLhhng/wDuuT6vaGTIvR9yrTAGYcJB2siWZTM6vKdoVK X5m00CTFtxTAivG2cZOYg3rsxMEK9MSG1g4w9I9bE5au1CrZBW7p6GJwp51FCvHrOOf0 ouIDbDHX2Vxa1azmHbvjXKm96gB/LW00KwYOkrXbIbRU/xRwjvzPaebdKOEtiMLAimdy /Ngau5X57cFXg+ZBwmBfL/qFut681l6k2aiseB1lctMLWgJwp2F1gSqLEs3xziFBGS3y D24skggG8KmFnAg07BhlsINo1ZOO6FyP7Bwj6agASI/pdzEfchqWeh1fRnrtIPS9REJz yvww== 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 p7si12088987pgf.532.2019.05.21.05.43.51; Tue, 21 May 2019 05:44:06 -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 S1728066AbfEUMmI (ORCPT + 99 others); Tue, 21 May 2019 08:42:08 -0400 Received: from mga06.intel.com ([134.134.136.31]:37645 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727819AbfEUMmH (ORCPT ); Tue, 21 May 2019 08:42:07 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2019 05:42:07 -0700 X-ExtLoop1: 1 Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by fmsmga006.fm.intel.com with ESMTP; 21 May 2019 05:42:03 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hT45i-00081U-Q2; Tue, 21 May 2019 15:42:02 +0300 Date: Tue, 21 May 2019 15:42:02 +0300 From: Andy Shevchenko To: Esben Haabendal Cc: Greg Kroah-Hartman , linux-serial@vger.kernel.org, Lee Jones , Enrico Weigelt , Jiri Slaby , Darwin Dingel , Jisheng Zhang , Sebastian Andrzej Siewior , He Zhe , Marek Vasut , Douglas Anderson , Paul Burton , linux-kernel@vger.kernel.org Subject: Re: [PATCH resend] serial: 8250: Add support for using platform_device resources Message-ID: <20190521124202.GE9224@smile.fi.intel.com> References: <20190430140416.4707-1-esben@geanix.com> <20190521113426.16790-1-esben@geanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190521113426.16790-1-esben@geanix.com> 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 Tue, May 21, 2019 at 01:34:26PM +0200, Esben Haabendal wrote: > Allow getting memory resource (mapbase or iobase) as well as irq from > platform_device resources. > > The UPF_DEV_RESOURCES flag must be set for devices where platform_device > resources are to be used. When not set, driver behaves as before. > > This allows use of the serial8250 driver together with devices with > resources added by platform_device_add_resources(), such as mfd child > devices added with mfd_add_devices(). > > When UPF_DEV_RESOURCES flag is set, the following platform_data fields should > not be used: mapbase, iobase, mapsize, and irq. They are superseded by the > resources attached to the device. > Same comment here: Requesting resource is orthogonal to the retrieving or slicing them. > + if (p->flags & UPF_DEV_RESOURCES) { > + serial8250_probe_resources(dev, i, p, &uart); This can be easily detected by checking for the resources directly, like res = platform_get_resource(...); if (res) new_scheme(); else old_scheme(); Otherwise looks good. > - if (!request_mem_region(port->mapbase, size, "serial")) { > + if (!(port->flags & UPF_DEV_RESOURCES) && > + !request_mem_region(port->mapbase, size, "serial")) { > - release_mem_region(port->mapbase, size); > + if (!(port->flags & UPF_DEV_RESOURCES)) > + release_mem_region(port->mapbase, size); > - if (!request_region(port->iobase, size, "serial")) > + if (!(port->flags & UPF_DEV_RESOURCES) && > + !request_region(port->iobase, size, "serial")) > - release_mem_region(port->mapbase, size); > + if (!(port->flags & UPF_DEV_RESOURCES)) > + release_mem_region(port->mapbase, size); > - release_region(port->iobase, size); > + if (!(port->flags & UPF_DEV_RESOURCES)) > + release_region(port->iobase, size); All these changes are not related to what you describe in the commit message. is a workaround for the bug in the parent MFD driver of the 8250. -- With Best Regards, Andy Shevchenko