/* 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)
/* 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);
	if (r) {
		memcpy(r, res, sizeof(struct resource) * num);
		pdev->resource = r;
		pdev->num_resources = num;
	}
	return r ? 0 : -ENOMEM;
}