linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Esben Haabendal <esben@haabendal.dk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-serial@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
	Enrico Weigelt <lkml@metux.net>, Jiri Slaby <jslaby@suse.com>,
	Darwin Dingel <darwin.dingel@alliedtelesis.co.nz>,
	Jisheng Zhang <Jisheng.Zhang@synaptics.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	He Zhe <zhe.he@windriver.com>, Marek Vasut <marex@denx.de>,
	Douglas Anderson <dianders@chromium.org>,
	Paul Burton <paul.burton@mips.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH resend] serial: 8250: Add support for using platform_device resources
Date: Tue, 21 May 2019 20:03:50 +0300	[thread overview]
Message-ID: <20190521170350.GL9224@smile.fi.intel.com> (raw)
In-Reply-To: <87d0kbna0p.fsf@haabendal.dk>

On Tue, May 21, 2019 at 04:43:18PM +0200, Esben Haabendal wrote:
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> 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

  reply	other threads:[~2019-05-21 17:03 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 14:04 [PATCH] serial: 8250: Add support for using platform_device resources Esben Haabendal
2019-04-30 15:37 ` Andy Shevchenko
2019-05-01  7:17   ` Esben Haabendal
2019-05-02 10:45     ` Andy Shevchenko
2019-05-02 12:41       ` Esben Haabendal
2019-05-02 15:31         ` Andy Shevchenko
2019-05-06 15:46           ` Esben Haabendal
2019-05-06 16:44             ` Andy Shevchenko
2019-05-06 17:40               ` Esben Haabendal
2019-05-06 21:04                 ` Andy Shevchenko
2019-05-07  9:32         ` Lee Jones
2019-05-07  9:36           ` Lee Jones
2019-05-07 11:32             ` Esben Haabendal
2019-05-07 11:35           ` Esben Haabendal
2019-05-07 11:53             ` Andy Shevchenko
2019-05-07 12:22               ` Esben Haabendal
2019-05-07 15:08                 ` Andy Shevchenko
2019-05-14  7:22                   ` Esben Haabendal
2019-05-14  9:23                     ` Andy Shevchenko
2019-05-14  9:37                       ` Andy Shevchenko
2019-05-14 12:02                         ` Esben Haabendal
2019-05-14 12:42                           ` Andy Shevchenko
2019-05-14 12:02                       ` Esben Haabendal
2019-05-14 12:38                         ` Andy Shevchenko
2019-05-14  7:37                   ` Esben Haabendal
2019-05-02 19:41 ` Enrico Weigelt, metux IT consult
2019-05-06 15:19   ` Esben Haabendal
2019-05-21 11:34 ` [PATCH resend] " Esben Haabendal
2019-05-21 12:42   ` Andy Shevchenko
2019-05-21 14:43     ` Esben Haabendal
2019-05-21 17:03       ` Andy Shevchenko [this message]
2019-05-21 13:11   ` Greg Kroah-Hartman
2019-05-21 14:45     ` Esben Haabendal
2019-05-21 14:53       ` Greg Kroah-Hartman
2019-06-11 18:11       ` Enrico Weigelt, metux IT consult

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=20190521170350.GL9224@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Jisheng.Zhang@synaptics.com \
    --cc=bigeasy@linutronix.de \
    --cc=darwin.dingel@alliedtelesis.co.nz \
    --cc=dianders@chromium.org \
    --cc=esben@haabendal.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lkml@metux.net \
    --cc=marex@denx.de \
    --cc=paul.burton@mips.com \
    --cc=zhe.he@windriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).