linux-4.4.1/of_device_alloc()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#i1b7fbec]
#backlinks
*説明 [#rf14831e]
-パス: [[linux-4.4.1/drivers/of/platform.c]]
-FIXME: これは何?
--説明
**引数 [#d11ec064]
-struct device_node *np
--
--[[linux-4.4.1/device_node]]
-const char *bus_id
--
-struct device *parent
--
--[[linux-4.4.1/device]]
**返り値 [#oaf71053]
-struct platform_device *
--
--[[linux-4.4.1/platform_device]]
**参考 [#o57fdefa]
*実装 [#o05ef008]
/**
* of_device_alloc - Allocate and initialize an of_device
* @np: device node to assign to device
* @bus_id: Name to assign to the device. May be null t...
* @parent: Parent device.
*/
struct platform_device *of_device_alloc(struct device_no...
const char *bus_id,
struct device *parent)
{
struct platform_device *dev;
int rc, i, num_reg = 0, num_irq;
struct resource *res, temp_res;
-
--[[linux-4.4.1/resource]]
dev = platform_device_alloc("", -1);
if (!dev)
return NULL;
-
--[[linux-4.4.1/platform_device_alloc()]]
/* count the io and irq resources */
while (of_address_to_resource(np, num_reg, &temp...
num_reg++;
num_irq = of_irq_count(np);
-
--[[linux-4.4.1/of_address_to_resource()]]
--[[linux-4.4.1/of_irq_count()]]
/* Populate the resource table */
if (num_irq || num_reg) {
res = kzalloc(sizeof(*res) * (num_irq + ...
if (!res) {
platform_device_put(dev);
return NULL;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/platform_device_put()]]
dev->num_resources = num_reg + num_irq;
dev->resource = res;
for (i = 0; i < num_reg; i++, res++) {
rc = of_address_to_resource(np, ...
WARN_ON(rc);
}
-
--[[linux-4.4.1/of_address_to_resource()]]
if (of_irq_to_resource_table(np, res, nu...
pr_debug("not all legacy IRQ res...
np->name);
-
--[[linux-4.4.1/of_irq_to_resource_table()]]
--[[linux-4.4.1/pr_debug()]]
}
dev->dev.of_node = of_node_get(np);
dev->dev.parent = parent ? : &platform_bus;
-
--[[linux-4.4.1/of_node_get()]]
--[[linux-4.4.1/platform_bus(global)]]
if (bus_id)
dev_set_name(&dev->dev, "%s", bus_id);
else
of_device_make_bus_id(&dev->dev);
-
--[[linux-4.4.1/dev_set_name()]]
--[[linux-4.4.1/of_device_make_bus_id()]]
return dev;
}
EXPORT_SYMBOL(of_device_alloc);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]
*コメント [#k04e3b67]
終了行:
*参照元 [#i1b7fbec]
#backlinks
*説明 [#rf14831e]
-パス: [[linux-4.4.1/drivers/of/platform.c]]
-FIXME: これは何?
--説明
**引数 [#d11ec064]
-struct device_node *np
--
--[[linux-4.4.1/device_node]]
-const char *bus_id
--
-struct device *parent
--
--[[linux-4.4.1/device]]
**返り値 [#oaf71053]
-struct platform_device *
--
--[[linux-4.4.1/platform_device]]
**参考 [#o57fdefa]
*実装 [#o05ef008]
/**
* of_device_alloc - Allocate and initialize an of_device
* @np: device node to assign to device
* @bus_id: Name to assign to the device. May be null t...
* @parent: Parent device.
*/
struct platform_device *of_device_alloc(struct device_no...
const char *bus_id,
struct device *parent)
{
struct platform_device *dev;
int rc, i, num_reg = 0, num_irq;
struct resource *res, temp_res;
-
--[[linux-4.4.1/resource]]
dev = platform_device_alloc("", -1);
if (!dev)
return NULL;
-
--[[linux-4.4.1/platform_device_alloc()]]
/* count the io and irq resources */
while (of_address_to_resource(np, num_reg, &temp...
num_reg++;
num_irq = of_irq_count(np);
-
--[[linux-4.4.1/of_address_to_resource()]]
--[[linux-4.4.1/of_irq_count()]]
/* Populate the resource table */
if (num_irq || num_reg) {
res = kzalloc(sizeof(*res) * (num_irq + ...
if (!res) {
platform_device_put(dev);
return NULL;
}
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/platform_device_put()]]
dev->num_resources = num_reg + num_irq;
dev->resource = res;
for (i = 0; i < num_reg; i++, res++) {
rc = of_address_to_resource(np, ...
WARN_ON(rc);
}
-
--[[linux-4.4.1/of_address_to_resource()]]
if (of_irq_to_resource_table(np, res, nu...
pr_debug("not all legacy IRQ res...
np->name);
-
--[[linux-4.4.1/of_irq_to_resource_table()]]
--[[linux-4.4.1/pr_debug()]]
}
dev->dev.of_node = of_node_get(np);
dev->dev.parent = parent ? : &platform_bus;
-
--[[linux-4.4.1/of_node_get()]]
--[[linux-4.4.1/platform_bus(global)]]
if (bus_id)
dev_set_name(&dev->dev, "%s", bus_id);
else
of_device_make_bus_id(&dev->dev);
-
--[[linux-4.4.1/dev_set_name()]]
--[[linux-4.4.1/of_device_make_bus_id()]]
return dev;
}
EXPORT_SYMBOL(of_device_alloc);
-
--[[linux-4.4.1/EXPORT_SYMBOL()]]
*コメント [#k04e3b67]
ページ名: