diff options
Diffstat (limited to 'include/linux/device.h')
| -rw-r--r-- | include/linux/device.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index d1d1c055b48e..af424acd393d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -623,6 +623,12 @@ static inline void *devm_kcalloc(struct device *dev, | |||
| 623 | } | 623 | } |
| 624 | extern void devm_kfree(struct device *dev, void *p); | 624 | extern void devm_kfree(struct device *dev, void *p); |
| 625 | extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); | 625 | extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); |
| 626 | extern void *devm_kmemdup(struct device *dev, const void *src, size_t len, | ||
| 627 | gfp_t gfp); | ||
| 628 | |||
| 629 | extern unsigned long devm_get_free_pages(struct device *dev, | ||
| 630 | gfp_t gfp_mask, unsigned int order); | ||
| 631 | extern void devm_free_pages(struct device *dev, unsigned long addr); | ||
| 626 | 632 | ||
| 627 | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); | 633 | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); |
| 628 | void __iomem *devm_request_and_ioremap(struct device *dev, | 634 | void __iomem *devm_request_and_ioremap(struct device *dev, |
| @@ -673,6 +679,7 @@ struct acpi_dev_node { | |||
| 673 | * variants, which GPIO pins act in what additional roles, and so | 679 | * variants, which GPIO pins act in what additional roles, and so |
| 674 | * on. This shrinks the "Board Support Packages" (BSPs) and | 680 | * on. This shrinks the "Board Support Packages" (BSPs) and |
| 675 | * minimizes board-specific #ifdefs in drivers. | 681 | * minimizes board-specific #ifdefs in drivers. |
| 682 | * @driver_data: Private pointer for driver specific info. | ||
| 676 | * @power: For device power management. | 683 | * @power: For device power management. |
| 677 | * See Documentation/power/devices.txt for details. | 684 | * See Documentation/power/devices.txt for details. |
| 678 | * @pm_domain: Provide callbacks that are executed during system suspend, | 685 | * @pm_domain: Provide callbacks that are executed during system suspend, |
| @@ -685,6 +692,7 @@ struct acpi_dev_node { | |||
| 685 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all | 692 | * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all |
| 686 | * hardware supports 64-bit addresses for consistent allocations | 693 | * hardware supports 64-bit addresses for consistent allocations |
| 687 | * such descriptors. | 694 | * such descriptors. |
| 695 | * @dma_pfn_offset: offset of DMA memory range relatively of RAM | ||
| 688 | * @dma_parms: A low level driver may set these to teach IOMMU code about | 696 | * @dma_parms: A low level driver may set these to teach IOMMU code about |
| 689 | * segment limitations. | 697 | * segment limitations. |
| 690 | * @dma_pools: Dma pools (if dma'ble device). | 698 | * @dma_pools: Dma pools (if dma'ble device). |
| @@ -734,6 +742,8 @@ struct device { | |||
| 734 | device */ | 742 | device */ |
| 735 | void *platform_data; /* Platform specific data, device | 743 | void *platform_data; /* Platform specific data, device |
| 736 | core doesn't touch it */ | 744 | core doesn't touch it */ |
| 745 | void *driver_data; /* Driver data, set and get with | ||
| 746 | dev_set/get_drvdata */ | ||
| 737 | struct dev_pm_info power; | 747 | struct dev_pm_info power; |
| 738 | struct dev_pm_domain *pm_domain; | 748 | struct dev_pm_domain *pm_domain; |
| 739 | 749 | ||
| @@ -750,6 +760,7 @@ struct device { | |||
| 750 | not all hardware supports | 760 | not all hardware supports |
| 751 | 64 bit addresses for consistent | 761 | 64 bit addresses for consistent |
| 752 | allocations such descriptors. */ | 762 | allocations such descriptors. */ |
| 763 | unsigned long dma_pfn_offset; | ||
| 753 | 764 | ||
| 754 | struct device_dma_parameters *dma_parms; | 765 | struct device_dma_parameters *dma_parms; |
| 755 | 766 | ||
| @@ -823,6 +834,16 @@ static inline void set_dev_node(struct device *dev, int node) | |||
| 823 | } | 834 | } |
| 824 | #endif | 835 | #endif |
| 825 | 836 | ||
| 837 | static inline void *dev_get_drvdata(const struct device *dev) | ||
| 838 | { | ||
| 839 | return dev->driver_data; | ||
| 840 | } | ||
| 841 | |||
| 842 | static inline void dev_set_drvdata(struct device *dev, void *data) | ||
| 843 | { | ||
| 844 | dev->driver_data = data; | ||
| 845 | } | ||
| 846 | |||
| 826 | static inline struct pm_subsys_data *dev_to_psd(struct device *dev) | 847 | static inline struct pm_subsys_data *dev_to_psd(struct device *dev) |
| 827 | { | 848 | { |
| 828 | return dev ? dev->power.subsys_data : NULL; | 849 | return dev ? dev->power.subsys_data : NULL; |
| @@ -907,8 +928,6 @@ extern int device_move(struct device *dev, struct device *new_parent, | |||
| 907 | extern const char *device_get_devnode(struct device *dev, | 928 | extern const char *device_get_devnode(struct device *dev, |
| 908 | umode_t *mode, kuid_t *uid, kgid_t *gid, | 929 | umode_t *mode, kuid_t *uid, kgid_t *gid, |
| 909 | const char **tmp); | 930 | const char **tmp); |
| 910 | extern void *dev_get_drvdata(const struct device *dev); | ||
| 911 | extern int dev_set_drvdata(struct device *dev, void *data); | ||
| 912 | 931 | ||
| 913 | static inline bool device_supports_offline(struct device *dev) | 932 | static inline bool device_supports_offline(struct device *dev) |
| 914 | { | 933 | { |
