Skip to content
Snippets Groups Projects
Select Git revision
  • d6ff85513d523551177b1564b62d64c864b97d68
  • master default protected
  • android-msm-bullhead-3.10-nougat_kgdb_less_changes
  • android-msm-bullhead-3.10-nougat_kgdb
  • android-msm-bullhead-3.10-nougat_klist
  • android-4.4
  • android-msm-vega-4.4-oreo-daydream
  • android-msm-wahoo-4.4-p-preview-5
  • android-msm-wahoo-4.4-pie
  • android-msm-marlin-3.18-p-preview-5
  • android-msm-marlin-3.18-pie
  • android-msm-wahoo-2018.07-oreo-m2
  • android-msm-wahoo-2018.07-oreo-m4
  • android-msm-wahoo-4.4-p-preview-4
  • android-msm-bullhead-3.10-oreo-m6
  • android-msm-angler-3.10-oreo-m6
  • android-msm-marlin-3.18-p-preview-4
  • android-msm-stargazer-3.18-oreo-wear-dr
  • android-msm-catshark-3.18-oreo-wear-dr
  • android-msm-wahoo-4.4-oreo-m2
  • android-msm-wahoo-4.4-oreo-m4
  • android-daydreamos-8.0.0_r0.5
  • android-8.1.0_r0.92
  • android-8.1.0_r0.91
  • android-daydreamos-8.0.0_r0.4
  • android-p-preview-5_r0.2
  • android-p-preview-5_r0.1
  • android-9.0.0_r0.5
  • android-9.0.0_r0.4
  • android-9.0.0_r0.2
  • android-9.0.0_r0.1
  • android-8.1.0_r0.81
  • android-8.1.0_r0.80
  • android-8.1.0_r0.78
  • android-8.1.0_r0.76
  • android-8.1.0_r0.75
  • android-8.1.0_r0.72
  • android-8.1.0_r0.70
  • android-p-preview-4_r0.2
  • android-p-preview-4_r0.1
  • android-wear-8.0.0_r0.30
41 results

platform.c

Blame
  • platform.c 29.80 KiB
    /*
     * 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/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/idr.h>
    
    #include "base.h"
    #include "power/power.h"
    
    /* For automatically allocated device IDs */
    static DEFINE_IDA(platform_devid_ida);
    
    #define to_platform_driver(drv)	(container_of((drv), struct platform_driver, \
    				 driver))
    
    struct device platform_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 __weak arch_setup_pdev_archdata(struct platform_device *pdev)
    {
    }
    
    /**
     * platform_get_resource - get a resource for a device
     * @dev: platform device
     * @type: resource type
     * @num: resource index
     */
    struct resource *platform_get_resource(struct platform_device *dev,
    				       unsigned int type, unsigned int num)
    {
    	int i;
    
    	for (i = 0; i < dev->num_resources; i++) {
    		struct resource *r = &dev->resource[i];