include/linux/platform_device.h

Source file repositories/reference/linux-study-clean/include/linux/platform_device.h

File Facts

System
Linux kernel
Corpus path
include/linux/platform_device.h
Extension
.h
Size
15570 bytes
Lines
434
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

extern const struct bus_type platform_bus_type;
extern struct device platform_bus;

extern struct resource *platform_get_resource(struct platform_device *,
					      unsigned int, unsigned int);
extern struct resource *platform_get_mem_or_io(struct platform_device *,
					       unsigned int);

extern struct device *
platform_find_device_by_driver(struct device *start,
			       const struct device_driver *drv);

#ifdef CONFIG_HAS_IOMEM
extern void __iomem *
devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
				unsigned int index, struct resource **res);
extern void __iomem *
devm_platform_ioremap_resource(struct platform_device *pdev,
			       unsigned int index);
extern void __iomem *
devm_platform_ioremap_resource_byname(struct platform_device *pdev,
				      const char *name);
#else

static inline void __iomem *
devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
				unsigned int index, struct resource **res)
{
	return IOMEM_ERR_PTR(-EINVAL);
}


static inline void __iomem *
devm_platform_ioremap_resource(struct platform_device *pdev,
			       unsigned int index)
{
	return IOMEM_ERR_PTR(-EINVAL);
}

static inline void __iomem *
devm_platform_ioremap_resource_byname(struct platform_device *pdev,
				      const char *name)
{
	return IOMEM_ERR_PTR(-EINVAL);
}

#endif

extern int platform_get_irq(struct platform_device *, unsigned int);
extern int platform_get_irq_optional(struct platform_device *, unsigned int);
extern int platform_get_irq_affinity(struct platform_device *, unsigned int,
				     const struct cpumask **);
extern int platform_irq_count(struct platform_device *);
extern int devm_platform_get_irqs_affinity(struct platform_device *dev,
					   struct irq_affinity *affd,
					   unsigned int minvec,
					   unsigned int maxvec,
					   int **irqs);
extern struct resource *platform_get_resource_byname(struct platform_device *,
						     unsigned int,
						     const char *);
extern int platform_get_irq_byname(struct platform_device *, const char *);
extern int platform_get_irq_byname_optional(struct platform_device *dev,
					    const char *name);
extern int platform_add_devices(struct platform_device **, int);

/**
 * struct platform_device_info - set of parameters for creating a platform device
 * @parent: parent device for the new platform device.
 * @fwnode: firmware node associated with the device.
 * @of_node_reused: indicates that device tree node associated with the device
 *	is shared with another device, typically its ancestor. Setting this to
 *	%true prevents the device from being matched via the OF match table,
 *	and stops the device core from automatically binding pinctrl
 *	configuration to avoid disrupting the other device.
 * @name: name of the device.
 * @id: instance ID of the device. Use %PLATFORM_DEVID_NONE if there is only
 *	one instance of the device, or %PLATFORM_DEVID_AUTO to let the
 *	kernel automatically assign a unique instance ID.
 * @res: set of resources to attach to the device.
 * @num_res: number of entries in @res.
 * @data: device-specific data for this platform device.
 * @size_data: size of device-specific data.
 * @dma_mask: DMA mask for the device.
 * @swnode: a secondary software node to be attached to the device. The node
 *	will be automatically registered and its lifetime tied to the platform
 *	device if it is not registered yet.
 * @properties: a set of software properties for the device. If provided,
 *	a managed software node will be automatically created and
 *	assigned to the device. The properties array must be terminated

Annotation

Implementation Notes