/* * platform.c - platform 'pseudo' bus for legacy devices * * Copyright (c) 2002-3 Patrick Mochel * Copyright (c) 2002-3 Open Source Development Labs * * This file is released under the GPLv2 * * Please see Documentation/driver-model/platform.txt for more * information. */#include<linux/string.h>#include<linux/platform_device.h>#include<linux/of_device.h>#include<linux/of_irq.h>#include<linux/module.h>#include<linux/init.h>#include<linux/dma-mapping.h>#include<linux/bootmem.h>#include<linux/err.h>#include<linux/slab.h>#include<linux/pm_runtime.h>#include<linux/pm_domain.h>#include<linux/idr.h>#include<linux/acpi.h>#include<linux/clk/clk-conf.h>#include<linux/limits.h>#include<linux/property.h>#include"base.h"#include"power/power.h"/* For automatically allocated device IDs */staticDEFINE_IDA(platform_devid_ida);structdeviceplatform_bus={.init_name="platform",};EXPORT_SYMBOL_GPL(platform_bus);/** * arch_setup_pdev_archdata - Allow manipulation of archdata before its used * @pdev: platform device * * This is called before platform_device_add() such that any pdev_archdata may * be setup before the platform_notifier is called. So if a user needs to * manipulate any relevant information in the pdev_archdata they can do: * * platform_device_alloc() * ... manipulate ... * platform_device_add() * * And if they don't care they can just call platform_device_register() and * everything will just work out. */void__weakarch_setup_pdev_archdata(structplatform_device*pdev){}/** * platform_get_resource - get a resource for a device * @dev: platform device * @type: resource type * @num: resource index */structresource*platform_get_resource(structplatform_device*dev,unsignedinttype,unsignedintnum){inti;for(i=0;i<dev->num_resources;i++){structresource*r=&dev->resource[i];if(type==re