Re: [PATCH 1/2] OMAP: omap_device: add omap_device_is_valid()

Paul Walmsley
2010-02-21T08:35:48Z

Hi Kevin,

On Thu, 28 Jan 2010, Kevin Hilman wrote:

> Hmm, not sure I follow...
>
> struct omap_device already contains a struct platform_device, which in
> turn contains a struct device, so to get an omap_device from a struct
> device, there are two container of operaions: to_platform_device() and
> to_omap_device()
>
>
> from omap_device.h:
>
> struct omap_device {
> u32 magic;
> struct platform_device pdev;
> [...]
> }
> #define to_omap_device(x) container_of((x), struct omap_device, pdev)
>
> from platform_device.h:
> struct platform_device {
> const char * name;
> int id;
> struct device dev;
> [...]
> }
> #define to_platform_device(x) container_of((x), struct platform_device, dev)

Sorry - my E-mail was too hasty and unclear. What I had in mind was the
lifecycle aspect of omap_device - i.e., ensuring that omap_devices are
automatically freed by the device core, similar to the way that
platform_device_alloc() does it.

- Paul