首页 > 其他 > 详细

struct platform_device中的id成员

时间:2014-02-28 15:04:08      阅读:1400      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
include/linux/platform_device.h

bubuko.com,布布扣
#define PLATFORM_DEVID_NONE    (-1)
#define PLATFORM_DEVID_AUTO    (-2)
bubuko.com,布布扣
drivers/base/platform.c

/*
* * platform_device_add - add a platform device to device hierarchy * @pdev: platform device we‘re adding * * This is part 2 of platform_device_register(), though may be called * separately _iff_ pdev was allocated by platform_device_alloc(). */ int platform_device_add(struct platform_device *pdev) { int i, ret; if (!pdev) return -EINVAL; if (!pdev->dev.parent) pdev->dev.parent = &platform_bus; pdev->dev.bus = &platform_bus_type; switch (pdev->id) { default: dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); break; case PLATFORM_DEVID_NONE: dev_set_name(&pdev->dev, "%s", pdev->name); break; case PLATFORM_DEVID_AUTO: /* * Automatically allocated device ID. We mark it as such so * that we remember it must be freed, and we append a suffix * to avoid namespace collision with explicit IDs. */ ret = ida_simple_get(&platform_devid_ida, 0, 0, GFP_KERNEL); if (ret < 0) goto err_out; pdev->id = ret; pdev->id_auto = true; dev_set_name(&pdev->dev, "%s.%d.auto", pdev->name, pdev->id); break; }
bubuko.com,布布扣

struct platform_device中的id成员,布布扣,bubuko.com

struct platform_device中的id成员

原文:http://www.cnblogs.com/baiyw/p/3572449.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!