Kernel newbie need some help

Mar 31, 2006 3 Replies

Hi all, Can any tell me what is the point of "struct platform_device", what does it represent and what it is used for ? thanks



/* * platform_device.h - generic, centralized driver model * * Copyright (c) 2001-2003 Patrick Mochel * * This file is released under the GPLv2 * * See Documentation/driver-model/ for more information. */

#ifndef _PLATFORM_DEVICE_H_ #define _PLATFORM_DEVICE_H_

#include

struct platform_device { const char * name; u32 id; struct device dev; u32 num_resources; struct resource * resource; }; ...

I read the documentation, but it was not very clear.

Its used for devices which cannot be autodetected (in contrast to devices on the PCI bus). You must *know* they are in the system. And you must know which resources these devices allocate. So you create a list of platform devices in your board support package. See arch/arm/mach-pxa/generic.c (or mainstone.c) for some examples how to use them.

Hope it helps JB

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required