From: Kevin Hilman <khilman@ti.com> To: Benoit Cousson <b-cousson@ti.com> Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, paul@pwsan.com, Nishanth Menon <nm@ti.com> Subject: Re: [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev Date: Wed, 31 Aug 2011 15:20:29 -0700 [thread overview] Message-ID: <87zkip8bpu.fsf@ti.com> (raw) In-Reply-To: <1314026347-21623-2-git-send-email-b-cousson@ti.com> (Benoit Cousson's message of "Mon, 22 Aug 2011 17:19:01 +0200") Benoit Cousson <b-cousson@ti.com> writes: > From: Nishanth Menon <nm@ti.com> > > 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. > > Signed-off-by: Nishanth Menon <nm@ti.com> > [b-cousson@ti.com: rebased on top of Kevin's changes] > Signed-off-by: Benoit Cousson <b-cousson@ti.com> OK, I cerainly like this better than the omap2_get_*_device APIs, but I don't see the point in returning an omap_device pointer. In my series, I tried to make all the OMAP device APIs return/use a platform_device pointer instead of an omap_device pointer, so I'd rather just see this return the platform_device pointer directly. Kevin > --- > 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 d4d9b96..bdc2804 100644 > --- a/arch/arm/plat-omap/include/plat/omap_device.h > +++ b/arch/arm/plat-omap/include/plat/omap_device.h > @@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id, > int pm_lats_cnt, int is_early_device); > > 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 d8f2299..455594a 100644 > --- a/arch/arm/plat-omap/omap_device.c > +++ b/arch/arm/plat-omap/omap_device.c > @@ -840,6 +840,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); > + > /* > * Public functions intended for use in omap_device_pm_latency > * .activate_func and .deactivate_func function pointers
WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev Date: Wed, 31 Aug 2011 15:20:29 -0700 [thread overview] Message-ID: <87zkip8bpu.fsf@ti.com> (raw) In-Reply-To: <1314026347-21623-2-git-send-email-b-cousson@ti.com> (Benoit Cousson's message of "Mon, 22 Aug 2011 17:19:01 +0200") Benoit Cousson <b-cousson@ti.com> writes: > From: Nishanth Menon <nm@ti.com> > > 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. > > Signed-off-by: Nishanth Menon <nm@ti.com> > [b-cousson at ti.com: rebased on top of Kevin's changes] > Signed-off-by: Benoit Cousson <b-cousson@ti.com> OK, I cerainly like this better than the omap2_get_*_device APIs, but I don't see the point in returning an omap_device pointer. In my series, I tried to make all the OMAP device APIs return/use a platform_device pointer instead of an omap_device pointer, so I'd rather just see this return the platform_device pointer directly. Kevin > --- > 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 d4d9b96..bdc2804 100644 > --- a/arch/arm/plat-omap/include/plat/omap_device.h > +++ b/arch/arm/plat-omap/include/plat/omap_device.h > @@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id, > int pm_lats_cnt, int is_early_device); > > 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 d8f2299..455594a 100644 > --- a/arch/arm/plat-omap/omap_device.c > +++ b/arch/arm/plat-omap/omap_device.c > @@ -840,6 +840,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); > + > /* > * Public functions intended for use in omap_device_pm_latency > * .activate_func and .deactivate_func function pointers
next prev parent reply other threads:[~2011-08-31 22:20 UTC|newest] Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-08-22 15:19 [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-22 15:19 ` [PATCH 1/7] OMAP: PM: omap_device: add omap_hwmod_name_get_odev Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-31 22:20 ` Kevin Hilman [this message] 2011-08-31 22:20 ` Kevin Hilman 2011-09-01 11:48 ` Cousson, Benoit 2011-09-01 11:48 ` Cousson, Benoit 2011-09-01 20:44 ` Menon, Nishanth 2011-09-01 20:44 ` Menon, Nishanth 2011-09-26 18:18 ` Kevin Hilman 2011-09-26 18:18 ` Kevin Hilman 2011-08-22 15:19 ` [PATCH 2/7] OMAP: PM: omap_device: add few quick access functions Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-31 22:23 ` Kevin Hilman 2011-08-31 22:23 ` Kevin Hilman 2011-09-01 11:55 ` Cousson, Benoit 2011-09-01 11:55 ` Cousson, Benoit 2011-09-01 14:55 ` Kevin Hilman 2011-09-01 14:55 ` Kevin Hilman 2011-09-02 12:39 ` Cousson, Benoit 2011-09-02 12:39 ` Cousson, Benoit 2011-08-22 15:19 ` [PATCH 3/7] OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-31 22:24 ` Kevin Hilman 2011-08-31 22:24 ` Kevin Hilman 2011-08-22 15:19 ` [PATCH 4/7] OMAP2+: pm: Use hwmod name instead of dev pointer Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-31 22:24 ` Kevin Hilman 2011-08-31 22:24 ` Kevin Hilman 2011-08-22 15:19 ` [PATCH 5/7] OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-31 22:25 ` Kevin Hilman 2011-08-31 22:25 ` Kevin Hilman 2011-08-22 15:19 ` [PATCH 6/7] OMAP: omap_device: Create a default omap_device_pm_latency Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-31 22:30 ` Kevin Hilman 2011-08-31 22:30 ` Kevin Hilman 2011-08-22 15:19 ` [PATCH 7/7] OMAP2+: devices: Remove all omap_device_pm_latency structures Benoit Cousson 2011-08-22 15:19 ` Benoit Cousson 2011-08-31 22:31 ` Kevin Hilman 2011-08-31 22:31 ` Kevin Hilman 2011-09-01 11:59 ` Cousson, Benoit 2011-09-01 11:59 ` Cousson, Benoit 2011-09-01 16:28 ` [PATCH 0/7] OMAP: omap_device cleanup before device-tree integration Kevin Hilman 2011-09-01 16:28 ` 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=87zkip8bpu.fsf@ti.com \ --to=khilman@ti.com \ --cc=b-cousson@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.