From: Grant Likely <grant.likely@linaro.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linaro-mm-sig@lists.linaro.org, devicetree@vger.kernel.org,
linux-doc@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Arnd Bergmann <arnd@arndb.de>,
Michal Nazarewicz <mina86@mina86.com>,
Tomasz Figa <t.figa@samsung.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Laura Abbott <lauraa@codeaurora.org>,
Rob Herring <robh+dt@kernel.org>, Olof Johansson <olof@lixom.net>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Ian Campbell <ian.campbell@citrix.com>,
Tomasz Figa <tomasz.figa@gmail.com>,
Kumar Gala <galak@codeaurora.org>,
Nishanth Peethambaran <nishanth.p@gmail.com>,
Marc <marc.ceeeee@gmail.com>,
Josh Cartwright <joshc@codeaurora.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH v5 06/11] drivers: of: initialize and assign reserved memory to newly created devices
Date: Wed, 26 Feb 2014 12:14:45 +0000 [thread overview]
Message-ID: <20140226121445.54D2DC40A89@trevor.secretlab.ca> (raw)
In-Reply-To: <1392985527-6260-7-git-send-email-m.szyprowski@samsung.com>
On Fri, 21 Feb 2014 13:25:22 +0100, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
> Use recently introduced of_reserved_mem_device_init() function to
> automatically assign respective reserved memory region to the newly created
> platform and amba device.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
I'm wary on this patch. It hides the assignment of regions into the core
code and I worry that it is the wrong level of abstraction. I would
think that drivers should know that they need a reserved memory region
and should be calling the API to obtain the region directly rather than
doing it for them. The reason being is that there may be some situations
where the common code isn't quite right and the driver needs to override
the behaviour. If it is called automatically then the driver cannot do
that.
Is it really a big burden to have the driver call the reserved memory
init function?
g.
> ---
> drivers/of/platform.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 404d1daebefa..3df0b1826e8b 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -21,6 +21,7 @@
> #include <linux/of_device.h>
> #include <linux/of_irq.h>
> #include <linux/of_platform.h>
> +#include <linux/of_reserved_mem.h>
> #include <linux/platform_device.h>
>
> const struct of_device_id of_default_bus_match_table[] = {
> @@ -220,6 +221,8 @@ static struct platform_device *of_platform_device_create_pdata(
> dev->dev.bus = &platform_bus_type;
> dev->dev.platform_data = platform_data;
>
> + of_reserved_mem_device_init(&dev->dev);
> +
> /* We do not fill the DMA ops for platform devices by default.
> * This is currently the responsibility of the platform code
> * to do such, possibly using a device notifier
> @@ -227,6 +230,7 @@ static struct platform_device *of_platform_device_create_pdata(
>
> if (of_device_add(dev) != 0) {
> platform_device_put(dev);
> + of_reserved_mem_device_release(&dev->dev);
> return NULL;
> }
>
> @@ -282,6 +286,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
> else
> of_device_make_bus_id(&dev->dev);
>
> + of_reserved_mem_device_init(&dev->dev);
> +
> /* Allow the HW Peripheral ID to be overridden */
> prop = of_get_property(node, "arm,primecell-periphid", NULL);
> if (prop)
> @@ -308,6 +314,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
> return dev;
>
> err_free:
> + of_reserved_mem_device_release(&dev->dev);
> amba_device_put(dev);
> return NULL;
> }
> --
> 1.7.9.5
>
next prev parent reply other threads:[~2014-02-26 12:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 12:25 [PATCH v5 00/11] reserved-memory regions/CMA in devicetree, again Marek Szyprowski
[not found] ` < 1392985527-6260-2-git-send-email-m.szyprowski@samsung.com>
[not found] ` < 1392985527-6260-7-git-send-email-m.szyprowski@samsung.com>
2014-02-21 12:25 ` [PATCH v5 01/11] of: document bindings for reserved-memory nodes Marek Szyprowski
2014-02-26 11:51 ` Grant Likely
2014-02-28 9:54 ` Marek Szyprowski
2014-02-28 10:01 ` Tomasz Figa
2014-03-01 19:58 ` Grant Likely
2014-02-21 12:25 ` [PATCH v5 02/11] drivers: of: add initialization code for static reserved memory Marek Szyprowski
2014-02-26 12:05 ` Grant Likely
2014-02-21 12:25 ` [PATCH v5 03/11] drivers: of: add initialization code for dynamic " Marek Szyprowski
2014-02-26 12:09 ` Grant Likely
2014-02-21 12:25 ` [PATCH v5 04/11] drivers: of: add support for custom reserved memory drivers Marek Szyprowski
2014-02-21 12:25 ` [PATCH v5 05/11] drivers: of: add automated assignment of reserved regions to client devices Marek Szyprowski
2014-02-21 12:25 ` [PATCH v5 06/11] drivers: of: initialize and assign reserved memory to newly created devices Marek Szyprowski
2014-02-26 12:14 ` Grant Likely [this message]
2014-02-27 10:10 ` Marek Szyprowski
2014-03-01 20:20 ` Grant Likely
2014-02-21 12:25 ` [PATCH v5 07/11] drivers: dma-coherent: add initialization from device tree Marek Szyprowski
2014-02-21 12:25 ` [PATCH v5 08/11] drivers: dma-contiguous: " Marek Szyprowski
2014-02-21 12:25 ` [PATCH v5 09/11] arm: add support for reserved memory defined by " Marek Szyprowski
2014-02-21 12:25 ` [PATCH v5 10/11] arm64: " Marek Szyprowski
2014-02-21 12:25 ` [PATCH v5 11/11] powerpc: " Marek Szyprowski
[not found] ` < 1392985527-6260-10-git-send-email-m.szyprowski@samsung.com>
[not found] ` < CAGa+x856+YyJ-vyfGoFAKmsqwKD+=Wh0-TT_mAaPStOXjd8eSQ@mail.gmail.com>
[not found] ` < 20140313213636.GR18529@joshc.qualcomm.com>
[not found] ` <7h8usdlqbn.fsf@paris.lan>
2014-03-15 13:07 ` [PATCH v5 09/11] arm: " Grant Likely
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=20140226121445.54D2DC40A89@trevor.secretlab.ca \
--to=grant.likely@linaro.org \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ian.campbell@citrix.com \
--cc=joshc@codeaurora.org \
--cc=lauraa@codeaurora.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=marc.ceeeee@gmail.com \
--cc=mark.rutland@arm.com \
--cc=mina86@mina86.com \
--cc=nishanth.p@gmail.com \
--cc=olof@lixom.net \
--cc=paulus@samba.org \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=swarren@wwwdotorg.org \
--cc=t.figa@samsung.com \
--cc=tomasz.figa@gmail.com \
--cc=will.deacon@arm.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
all inboxes | Powered by JetHome®