From: Felipe Balbi <balbi@ti.com>
To: Nishanth Menon <nm@ti.com>
Cc: "Cousson, Benoit" <b-cousson@ti.com>,
"Balbi, Felipe" <balbi@ti.com>, "Hilman, Kevin" <khilman@ti.com>,
Paul Walmsley <paul@pwsan.com>,
"G, Manjunath Kondaiah" <manjugk@ti.com>,
"devicetree-discuss@lists.ozlabs.org"
<devicetree-discuss@lists.ozlabs.org>,
Grant Likely <grant.likely@secretlab.ca>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC/PATCH 2/7] OMAP3: beagle: don't touch omap_device internals
Date: Fri, 29 Jul 2011 17:05:16 +0300 [thread overview]
Message-ID: <20110729140515.GV31013@legolas.emea.dhcp.ti.com> (raw)
In-Reply-To: <20110729134932.GA2258@foobar>
[-- Attachment #1: Type: text/plain, Size: 3422 bytes --]
hi,
On Fri, Jul 29, 2011 at 08:49:34AM -0500, Nishanth Menon wrote:
> From f03490456e24f72ca5272303c95a6f0b212494d5 Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Wed, 27 Jul 2011 15:02:32 -0500
> Subject: [PATCH 1/2] OMAP: PM: omap_device: add omap_hwmod_name_get_odev
>
> An API which translates a standard hwmod name to corresponding
> omap_device is useful for drivers when they need to look up the
> device associated with a hwmod name to map back into the device
> structure pointers. These ideally should be used by drivers in
> mach directory. Using a generic hwmod name like "gpu" instead of
> the actual device name which could change in the future, allows
> us to:
> a) Could in effect help replace apis such as omap2_get_mpuss_device,
> omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
> etc..
> b) Scale to more devices rather than be restricted to named functions
> c) Simplify driver's platform_data from passing additional fields
> all doing the same thing with different function pointer names
> just for accessing a different device name.
>
> Change-Id: Ib42d22b4a929982c87a79866e3d7dc6e41073a6c
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
> arch/arm/plat-omap/include/plat/omap_device.h | 1 +
> arch/arm/plat-omap/omap_device.c | 32 +++++++++++++++++++++++++
> 2 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
> index 70d31d0..7a3c046 100644
> --- a/arch/arm/plat-omap/include/plat/omap_device.h
> +++ b/arch/arm/plat-omap/include/plat/omap_device.h
> @@ -102,6 +102,7 @@ int omap_device_register(struct omap_device *od);
> int omap_early_device_register(struct omap_device *od);
>
> void __iomem *omap_device_get_rt_va(struct omap_device *od);
> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name);
>
> /* OMAP PM interface */
> int omap_device_align_pm_lat(struct platform_device *pdev,
> diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
> index 92b4496..21df532 100644
> --- a/arch/arm/plat-omap/omap_device.c
> +++ b/arch/arm/plat-omap/omap_device.c
> @@ -780,6 +780,38 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
> return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
> }
>
> +/**
> + * omap_hwmod_name_get_odev() - convert a hwmod name to omap_device pointer
> + * @oh_name: name of the hwmod device
> + *
> + * returns back a struct omap_device * pointer associated with a hwmod
> + * device represented by a hwmod_name
> + */
> +struct omap_device *omap_hwmod_name_get_odev(const char *oh_name)
> +{
> + struct omap_hwmod *oh;
> +
> + if (!oh_name) {
> + WARN(1, "%s: no hwmod name!\n", __func__);
> + return ERR_PTR(-EINVAL);
> + }
> +
> + oh = omap_hwmod_lookup(oh_name);
> + if (IS_ERR_OR_NULL(oh)) {
> + WARN(1, "%s: no hwmod for %s\n", __func__,
> + oh_name);
> + return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
> + }
> + if (IS_ERR_OR_NULL(oh->od)) {
> + WARN(1, "%s: no omap_device for %s\n", __func__,
> + oh_name);
> + return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
> + }
> +
> + return oh->od;
> +}
> +EXPORT_SYMBOL(omap_hwmod_name_get_odev);
maybe EXPORT_SYMBOL_GPL() ?? Not sure we want non-GPL code to access
this ;-)
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2011-07-29 14:05 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-21 23:52 [RFC/PATCH 0/7] decouple platform_device from omap_device Kevin Hilman
2011-07-21 23:52 ` [PATCH] OMAP: omap_device: replace _find_by_pdev() with to_omap_device() Kevin Hilman
2011-07-22 8:53 ` Felipe Balbi
2011-07-21 23:52 ` [RFC/PATCH 1/7] OMAP: omap_device: replace debug/warning/error prints with dev_* macros Kevin Hilman
2011-07-21 23:52 ` [RFC/PATCH 2/7] OMAP3: beagle: don't touch omap_device internals Kevin Hilman
2011-07-22 8:57 ` Felipe Balbi
2011-07-28 5:53 ` Nishanth Menon
2011-07-28 10:10 ` Russell King - ARM Linux
2011-07-28 12:57 ` Cousson, Benoit
2011-07-28 12:59 ` Felipe Balbi
2011-07-28 13:31 ` Menon, Nishanth
2011-07-29 13:49 ` Nishanth Menon
2011-07-29 14:05 ` Felipe Balbi [this message]
2011-07-29 23:07 ` Menon, Nishanth
2011-08-01 8:52 ` Felipe Balbi
2011-07-28 8:36 ` Jean Pihet
2011-07-28 8:40 ` Jean Pihet
2011-07-21 23:52 ` [RFC/PATCH 3/7] OMAP: McBSP: use existing macros for converting between devices Kevin Hilman
2011-07-22 8:58 ` Felipe Balbi
2011-07-22 12:32 ` Sergei Shtylyov
2011-07-22 20:19 ` Kevin Hilman
2011-07-21 23:52 ` [RFC/PATCH 4/7] OMAP: omap_device: remove internal functions from omap_device.h Kevin Hilman
2011-07-21 23:52 ` [RFC/PATCH 5/7] OMAP: omap_device: when building return platform_device instead of omap_device Kevin Hilman
2011-07-21 23:52 ` [RFC/PATCH 6/7] OMAP: omap_device: device register functions now take platform_device pointer Kevin Hilman
2011-07-22 6:16 ` Grant Likely
2011-07-21 23:52 ` [RFC/PATCH 7/7] WIP: HACK/RFC: omap_device: begin to decouple platform_device from omap_device Kevin Hilman
2011-07-22 2:20 ` Grant Likely
2011-07-30 12:03 ` Russell King - ARM Linux
2011-07-31 2:58 ` Grant Likely
2011-07-31 15:05 ` Russell King - ARM Linux
2011-08-01 15:42 ` Kevin Hilman
2011-08-01 15:44 ` Grant Likely
2011-08-01 18:50 ` Felipe Balbi
2011-08-01 20:07 ` Russell King - ARM Linux
2011-08-01 22:11 ` Kevin Hilman
2011-08-01 22:55 ` Felipe Balbi
2011-08-01 23:09 ` Russell King - ARM Linux
2011-08-02 0:00 ` Grant Likely
2011-07-27 14:04 ` [RFC/PATCH 0/7] " G, Manjunath Kondaiah
2011-07-27 21:45 ` Hilman, Kevin
2011-07-28 4:50 ` G, Manjunath Kondaiah
2011-07-29 23:59 ` Kevin Hilman
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=20110729140515.GV31013@legolas.emea.dhcp.ti.com \
--to=balbi@ti.com \
--cc=b-cousson@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=manjugk@ti.com \
--cc=nm@ti.com \
--cc=paul@pwsan.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).