linux-4.4.1/platform_device_add()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#t625f128]
#backlinks
*説明 [#n98ca22f]
-パス: [[linux-4.4.1/drivers/base/platform.c]]
-FIXME: これは何?
--説明
**引数 [#g47b07eb]
-struct platform_device *pdev
--
--[[linux-4.4.1/platform_device]]
**返り値 [#g27d1a95]
-int
--
**参考 [#w306863c]
*実装 [#w347217d]
/**
* platform_device_add - add a platform device to device...
* @pdev: platform device we're adding
*
* This is part 2 of platform_device_register(), though ...
* separately _iff_ pdev was allocated by platform_devic...
*/
int platform_device_add(struct platform_device *pdev)
{
int i, ret;
if (!pdev)
return -EINVAL;
if (!pdev->dev.parent)
pdev->dev.parent = &platform_bus;
-
--[[linux-4.4.1/platform_bus(global)]]
pdev->dev.bus = &platform_bus_type;
-
--[[linux-4.4.1/platform_bus_type(global)]]
switch (pdev->id) {
default:
dev_set_name(&pdev->dev, "%s.%d", pdev->...
break;
-
--[[linux-4.4.1/dev_set_name()]]
case PLATFORM_DEVID_NONE:
dev_set_name(&pdev->dev, "%s", pdev->nam...
break;
case PLATFORM_DEVID_AUTO:
/*
* Automatically allocated device ID. We...
* that we remember it must be freed, an...
* to avoid namespace collision with exp...
*/
ret = ida_simple_get(&platform_devid_ida...
if (ret < 0)
goto err_out;
pdev->id = ret;
pdev->id_auto = true;
dev_set_name(&pdev->dev, "%s.%d.auto", p...
break;
-
--[[linux-4.4.1/platform_devid_ida(global)]]
--[[linux-4.4.1/ida_simple_get()]]
}
for (i = 0; i < pdev->num_resources; i++) {
struct resource *p, *r = &pdev->resource...
-
--[[linux-4.4.1/resource]]
if (r->name == NULL)
r->name = dev_name(&pdev->dev);
-
--[[linux-4.4.1/dev_name()]]
p = r->parent;
if (!p) {
if (resource_type(r) == IORESOUR...
p = &iomem_resource;
else if (resource_type(r) == IOR...
p = &ioport_resource;
-
--[[linux-4.4.1/resource_type()]]
--[[linux-4.4.1/iomem_resource(global)]]
--[[linux-4.4.1/ioport_resource(global)]]
}
if (p && insert_resource(p, r)) {
dev_err(&pdev->dev, "failed to c...
ret = -EBUSY;
goto failed;
}
-
--[[linux-4.4.1/insert_resource()]]
--[[linux-4.4.1/dev_err()]]
}
pr_debug("Registering platform device '%s'. Pare...
dev_name(&pdev->dev), dev_name(pdev->de...
-
--[[linux-4.4.1/pr_debug()]]
ret = device_add(&pdev->dev);
if (ret == 0)
return ret;
-
--[[linux-4.4.1/device_add()]]
failed:
if (pdev->id_auto) {
ida_simple_remove(&platform_devid_ida, p...
pdev->id = PLATFORM_DEVID_AUTO;
}
-
--[[linux-4.4.1/ida_simple_remove()]]
while (--i >= 0) {
struct resource *r = &pdev->resource[i];
if (r->parent)
release_resource(r);
}
-
--[[linux-4.4.1/resource]]
--[[linux-4.4.1/release_resource()]]
err_out:
return ret;
}
EXPORT_SYMBOL_GPL(platform_device_add);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#u852a839]
終了行:
*参照元 [#t625f128]
#backlinks
*説明 [#n98ca22f]
-パス: [[linux-4.4.1/drivers/base/platform.c]]
-FIXME: これは何?
--説明
**引数 [#g47b07eb]
-struct platform_device *pdev
--
--[[linux-4.4.1/platform_device]]
**返り値 [#g27d1a95]
-int
--
**参考 [#w306863c]
*実装 [#w347217d]
/**
* platform_device_add - add a platform device to device...
* @pdev: platform device we're adding
*
* This is part 2 of platform_device_register(), though ...
* separately _iff_ pdev was allocated by platform_devic...
*/
int platform_device_add(struct platform_device *pdev)
{
int i, ret;
if (!pdev)
return -EINVAL;
if (!pdev->dev.parent)
pdev->dev.parent = &platform_bus;
-
--[[linux-4.4.1/platform_bus(global)]]
pdev->dev.bus = &platform_bus_type;
-
--[[linux-4.4.1/platform_bus_type(global)]]
switch (pdev->id) {
default:
dev_set_name(&pdev->dev, "%s.%d", pdev->...
break;
-
--[[linux-4.4.1/dev_set_name()]]
case PLATFORM_DEVID_NONE:
dev_set_name(&pdev->dev, "%s", pdev->nam...
break;
case PLATFORM_DEVID_AUTO:
/*
* Automatically allocated device ID. We...
* that we remember it must be freed, an...
* to avoid namespace collision with exp...
*/
ret = ida_simple_get(&platform_devid_ida...
if (ret < 0)
goto err_out;
pdev->id = ret;
pdev->id_auto = true;
dev_set_name(&pdev->dev, "%s.%d.auto", p...
break;
-
--[[linux-4.4.1/platform_devid_ida(global)]]
--[[linux-4.4.1/ida_simple_get()]]
}
for (i = 0; i < pdev->num_resources; i++) {
struct resource *p, *r = &pdev->resource...
-
--[[linux-4.4.1/resource]]
if (r->name == NULL)
r->name = dev_name(&pdev->dev);
-
--[[linux-4.4.1/dev_name()]]
p = r->parent;
if (!p) {
if (resource_type(r) == IORESOUR...
p = &iomem_resource;
else if (resource_type(r) == IOR...
p = &ioport_resource;
-
--[[linux-4.4.1/resource_type()]]
--[[linux-4.4.1/iomem_resource(global)]]
--[[linux-4.4.1/ioport_resource(global)]]
}
if (p && insert_resource(p, r)) {
dev_err(&pdev->dev, "failed to c...
ret = -EBUSY;
goto failed;
}
-
--[[linux-4.4.1/insert_resource()]]
--[[linux-4.4.1/dev_err()]]
}
pr_debug("Registering platform device '%s'. Pare...
dev_name(&pdev->dev), dev_name(pdev->de...
-
--[[linux-4.4.1/pr_debug()]]
ret = device_add(&pdev->dev);
if (ret == 0)
return ret;
-
--[[linux-4.4.1/device_add()]]
failed:
if (pdev->id_auto) {
ida_simple_remove(&platform_devid_ida, p...
pdev->id = PLATFORM_DEVID_AUTO;
}
-
--[[linux-4.4.1/ida_simple_remove()]]
while (--i >= 0) {
struct resource *r = &pdev->resource[i];
if (r->parent)
release_resource(r);
}
-
--[[linux-4.4.1/resource]]
--[[linux-4.4.1/release_resource()]]
err_out:
return ret;
}
EXPORT_SYMBOL_GPL(platform_device_add);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]
*コメント [#u852a839]
ページ名: