*参照元 [#gcbebdab] #backlinks *説明 [#j69077f2] -パス: [[linux-2.6.33/drivers/base/platform.c]] -FIXME: これは何? --プラットフォームバス上のデバイスが利用するリソースを説明する。 --リソースの確保や予約は別の手段で行う? -リソースとは? --メモリマップド IO のアドレス範囲 --割り込み線の番号 --詳しくは [[linux-2.6.33/resource]] **引数 [#u74d1f7d] -struct platform_device *pdev -- --[[linux-2.6.33/platform_device]] -struct resource *res --デバイスが利用するリソース。 --関数内部で値がコピーされるため、 ローカル変数へのポインタを渡しても構わない。 --[[linux-2.6.33/resource]] -unsigned int num -- **返り値 [#x2ad1e01] -int -- **参考 [#i6cf2df6] *実装 [#qcf099f8] /** * platform_device_add_resources * @pdev: platform device allocated by platform_device_alloc to add resources to * @res: set of resources that needs to be allocated for the device * @num: number of resources * * Add a copy of the resources to the platform device. The memory * associated with the resources will be freed when the platform device is * released. */ int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num) { struct resource *r; r = kmalloc(sizeof(struct resource) * num, GFP_KERNEL); - --[[linux-2.6.33/kmalloc()]] - --[[linux-2.6.33/GFP_KERNEL]] if (r) { memcpy(r, res, sizeof(struct resource) * num); pdev->resource = r; pdev->num_resources = num; } return r ? 0 : -ENOMEM; } EXPORT_SYMBOL_GPL(platform_device_add_resources); -GPL のモジュールにのみシンボルを公開する。 --[[linux-2.6.33/EXPORT_SYMBOL_GPL()]] *コメント [#e4c803bc]