Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1198088ybm; Tue, 21 May 2019 10:05:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGKhxTSPI82xWwr2yeoW3VFXI/67hYHFXwgCGDRSxzUMH5e4ksHbZBPMfFJFqKjOET2BqJ X-Received: by 2002:a17:902:d896:: with SMTP id b22mr71139209plz.40.1558458335513; Tue, 21 May 2019 10:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558458335; cv=none; d=google.com; s=arc-20160816; b=BToCF+tHno/8ANReDl13fqk3aPQvHjolNjQrNrvFhjwPR37cUYuTiVciHOxOWdtT22 Ay9P2cSHwblcdIr/4FHATxWPnaLqzLmjgKItYNJx5LP/Oaj5aiDxK/evTpxgcE35Jpb1 LAl2w/JG+FkiJpx01/2YOBO3kseyqolumKH241jrt9mdTUj+xmUpYS8mEnKQCv7Hjb5Z +MaqohUKDL3zRqkp+1UqmSZ47U6nICZaQyK5lHgcVMTnzBzWzJRd8B81NBH3lr9EAtvt re28whvV8XpT+6doKxTyPXhxPWClHOBK5C4aRjqi2qWYSzQupLAMFPMt6MmT12g9FVTy KidQ== 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=HBo9lC2gdV9PoooqG/kYfIUUqG+wwtSx2d/GcvQWCxA=; b=jx93NUmXH1zXUfs2nrmkQk6D7cPRDlWIeP88+J+N4dJ8RCwtAr90RLsnatJfSTup/g fliqEWG6OAeJBDVpPl7WuudBVKQjlRDaRPRHHXluaqi1ObXURvDalqwceDCUJAgKR2D4 cnnxiZTsfMxXDtLAlqTIlH3KaCj9aYSplxCMOtbY31EDuufEZPt7wBvdyWctqHg7XqL5 b39B1MxaZ9yXk/4sLYVubAxzKbJCe6pWQ2TxC8A8Z6LiroNiZUtZi+ca9OVAUxCSTsiy /76MzH5sRdMa/3NUE9SzIAsy+ceL0cB800GUROZtSA/H7mErLsfBNAmrY89b1qkAoTMi P1gA== 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 i98si22231435plb.104.2019.05.21.10.05.18; Tue, 21 May 2019 10:05:35 -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 S1728957AbfEURD4 (ORCPT + 99 others); Tue, 21 May 2019 13:03:56 -0400 Received: from mga12.intel.com ([192.55.52.136]:30950 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728175AbfEURD4 (ORCPT ); Tue, 21 May 2019 13:03:56 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2019 10:03:55 -0700 X-ExtLoop1: 1 Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga006.jf.intel.com with ESMTP; 21 May 2019 10:03:51 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hT8B4-0001g3-AK; Tue, 21 May 2019 20:03:50 +0300 Date: Tue, 21 May 2019 20:03:50 +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: <20190521170350.GL9224@smile.fi.intel.com> References: <20190430140416.4707-1-esben@geanix.com> <20190521113426.16790-1-esben@geanix.com> <20190521124202.GE9224@smile.fi.intel.com> <87d0kbna0p.fsf@haabendal.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d0kbna0p.fsf@haabendal.dk> 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 04:43:18PM +0200, Esben Haabendal wrote: > Andy Shevchenko writes: > > > 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. > > Yes. But for MFD devices, I do think it makes sense for the MFD parent > device to request the entire memory resource, and then split it. Nope. This is layering violation here: The user of the resources is not handling them in full. > And for drivers that actually are aware of the struct resource given, > both approaches work. Throwing away the resource.parent information > and calling out request_mem_region() manually breaks the idea of > managing IORESOURCE_MEM as a tree structure. How come? Can you show an example of output without and with your patches? > Are we not supposed to be using the parent/child part of struct > resource? It's about slicing, no-one prevents you to do that. I don't see a problem. Show the output! > >> - 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. > > You are right, this is not adequately described in commit message. > But unless we are not supposed to allow parent/child memory resource > management, I don't think it is a workaround, but a fix. > > But I can split it out in a separate patch. Would be nice if I at least > can get the other part of the change merged. Like Lee said, and I agree, nothing prevents us to switch to platform_get_resource(). The stumbling block here is the *requesting* in parent which I strongly disagree with (at least in a form of this change, I already told you, that this has to be "fixed" on generic level, not as a hack in one certain driver). -- With Best Regards, Andy Shevchenko