标题: The probe function in s3c2410fb.c(kernel 2.6.16) [打印本页] 作者: grep_one 时间: 2006-04-12 09:40 标题: The probe function in s3c2410fb.c(kernel 2.6.16) 在s3c2410fb.c中,在平台相关的设备探测函数中有这么一段code,请高手帮忙看看。
static int __init s3c2410fb_probe(struct platform_device *pdev)
{
……
static struct s3c2410fb_mach_info *mach_info;
……
mach_info = pdev->dev.platform_data;
if (mach_info == NULL)
{
dev_err(&pdev->dev,"no platform data for lcd, cannot attach\n");
return -EINVAL;
}
mregs = &mach_info->regs;
……
}
mach_info,platform_data和platform_device的声明如下:
struct s3c2410fb_mach_info {
unsigned char fixed_syncs; /* do not update sync/border */
unsigned long gpcup;
unsigned long gpcup_mask;
unsigned long gpccon;
unsigned long gpccon_mask;
unsigned long gpdup;
unsigned long gpdup_mask;
unsigned long gpdcon;
unsigned long gpdcon_mask;
/* lpc3600 control register */
unsigned long lpcsel;
};
struct kobject kobj;
char bus_id[BUS_ID_SIZE]; /* position on parent bus */
struct device_attribute uevent_attr;
struct semaphore sem; /* semaphore to synchronize calls to
* its driver.
*/
struct bus_type * bus; /* type of bus device is on */
struct device_driver *driver; /* which driver has allocated this
device */
void *driver_data; /* data private to the driver */
void *platform_data; /* Platform specific data, device
core doesn't touch it */
void *firmware_data; /* Firmware specific data (e.g. ACPI,
BIOS data),reserved for device core*/
struct dev_pm_info power;
u64 *dma_mask; /* dma mask (if dma'able device) */
u64 coherent_dma_mask;/* Like dma_mask, but for
alloc_coherent mappings as
not all hardware supports
64 bit addresses for consistent
allocations such descriptors. */