diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/acpi.h | 15 | ||||
-rw-r--r-- | include/linux/blk_types.h | 4 | ||||
-rw-r--r-- | include/linux/device.h | 16 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/fwnode.h | 27 | ||||
-rw-r--r-- | include/linux/i2c.h | 4 | ||||
-rw-r--r-- | include/linux/platform_device.h | 2 | ||||
-rw-r--r-- | include/linux/pnp.h | 12 | ||||
-rw-r--r-- | include/linux/property.h | 44 |
9 files changed, 99 insertions, 27 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 24c7aa8b1d20..dd12127f171c 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -53,10 +53,16 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev) | |||
53 | return adev ? adev->handle : NULL; | 53 | return adev ? adev->handle : NULL; |
54 | } | 54 | } |
55 | 55 | ||
56 | #define ACPI_COMPANION(dev) ((dev)->acpi_node.companion) | 56 | #define ACPI_COMPANION(dev) acpi_node((dev)->fwnode) |
57 | #define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) | 57 | #define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \ |
58 | acpi_fwnode_handle(adev) : NULL) | ||
58 | #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) | 59 | #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) |
59 | 60 | ||
61 | static inline bool has_acpi_companion(struct device *dev) | ||
62 | { | ||
63 | return is_acpi_node(dev->fwnode); | ||
64 | } | ||
65 | |||
60 | static inline void acpi_preset_companion(struct device *dev, | 66 | static inline void acpi_preset_companion(struct device *dev, |
61 | struct acpi_device *parent, u64 addr) | 67 | struct acpi_device *parent, u64 addr) |
62 | { | 68 | { |
@@ -471,6 +477,11 @@ static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) | |||
471 | return NULL; | 477 | return NULL; |
472 | } | 478 | } |
473 | 479 | ||
480 | static inline bool has_acpi_companion(struct device *dev) | ||
481 | { | ||
482 | return false; | ||
483 | } | ||
484 | |||
474 | static inline const char *acpi_dev_name(struct acpi_device *adev) | 485 | static inline const char *acpi_dev_name(struct acpi_device *adev) |
475 | { | 486 | { |
476 | return NULL; | 487 | return NULL; |
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index c294e3e25e37..a1b25e35ea5f 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
@@ -181,7 +181,9 @@ enum rq_flag_bits { | |||
181 | __REQ_ELVPRIV, /* elevator private data attached */ | 181 | __REQ_ELVPRIV, /* elevator private data attached */ |
182 | __REQ_FAILED, /* set if the request failed */ | 182 | __REQ_FAILED, /* set if the request failed */ |
183 | __REQ_QUIET, /* don't worry about errors */ | 183 | __REQ_QUIET, /* don't worry about errors */ |
184 | __REQ_PREEMPT, /* set for "ide_preempt" requests */ | 184 | __REQ_PREEMPT, /* set for "ide_preempt" requests and also |
185 | for requests for which the SCSI "quiesce" | ||
186 | state must be ignored. */ | ||
185 | __REQ_ALLOCED, /* request came from our alloc pool */ | 187 | __REQ_ALLOCED, /* request came from our alloc pool */ |
186 | __REQ_COPY_USER, /* contains copies of user pages */ | 188 | __REQ_COPY_USER, /* contains copies of user pages */ |
187 | __REQ_FLUSH_SEQ, /* request for flush sequence */ | 189 | __REQ_FLUSH_SEQ, /* request for flush sequence */ |
diff --git a/include/linux/device.h b/include/linux/device.h index 0eb8ee2dc6d1..324d02add7b4 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -38,6 +38,7 @@ struct class; | |||
38 | struct subsys_private; | 38 | struct subsys_private; |
39 | struct bus_type; | 39 | struct bus_type; |
40 | struct device_node; | 40 | struct device_node; |
41 | struct fwnode_handle; | ||
41 | struct iommu_ops; | 42 | struct iommu_ops; |
42 | struct iommu_group; | 43 | struct iommu_group; |
43 | 44 | ||
@@ -650,14 +651,6 @@ struct device_dma_parameters { | |||
650 | unsigned long segment_boundary_mask; | 651 | unsigned long segment_boundary_mask; |
651 | }; | 652 | }; |
652 | 653 | ||
653 | struct acpi_device; | ||
654 | |||
655 | struct acpi_dev_node { | ||
656 | #ifdef CONFIG_ACPI | ||
657 | struct acpi_device *companion; | ||
658 | #endif | ||
659 | }; | ||
660 | |||
661 | /** | 654 | /** |
662 | * struct device - The basic device structure | 655 | * struct device - The basic device structure |
663 | * @parent: The device's "parent" device, the device to which it is attached. | 656 | * @parent: The device's "parent" device, the device to which it is attached. |
@@ -703,7 +696,7 @@ struct acpi_dev_node { | |||
703 | * @cma_area: Contiguous memory area for dma allocations | 696 | * @cma_area: Contiguous memory area for dma allocations |
704 | * @archdata: For arch-specific additions. | 697 | * @archdata: For arch-specific additions. |
705 | * @of_node: Associated device tree node. | 698 | * @of_node: Associated device tree node. |
706 | * @acpi_node: Associated ACPI device node. | 699 | * @fwnode: Associated device node supplied by platform firmware. |
707 | * @devt: For creating the sysfs "dev". | 700 | * @devt: For creating the sysfs "dev". |
708 | * @id: device instance | 701 | * @id: device instance |
709 | * @devres_lock: Spinlock to protect the resource of the device. | 702 | * @devres_lock: Spinlock to protect the resource of the device. |
@@ -779,7 +772,7 @@ struct device { | |||
779 | struct dev_archdata archdata; | 772 | struct dev_archdata archdata; |
780 | 773 | ||
781 | struct device_node *of_node; /* associated device tree node */ | 774 | struct device_node *of_node; /* associated device tree node */ |
782 | struct acpi_dev_node acpi_node; /* associated ACPI device node */ | 775 | struct fwnode_handle *fwnode; /* firmware device node */ |
783 | 776 | ||
784 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 777 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
785 | u32 id; /* device instance */ | 778 | u32 id; /* device instance */ |
@@ -947,6 +940,9 @@ extern void unlock_device_hotplug(void); | |||
947 | extern int lock_device_hotplug_sysfs(void); | 940 | extern int lock_device_hotplug_sysfs(void); |
948 | extern int device_offline(struct device *dev); | 941 | extern int device_offline(struct device *dev); |
949 | extern int device_online(struct device *dev); | 942 | extern int device_online(struct device *dev); |
943 | extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); | ||
944 | extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode); | ||
945 | |||
950 | /* | 946 | /* |
951 | * Root device objects for grouping under /sys/devices | 947 | * Root device objects for grouping under /sys/devices |
952 | */ | 948 | */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index f4131e8ead74..52cc4492cb3a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1549,7 +1549,7 @@ struct file_operations { | |||
1549 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); | 1549 | long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); |
1550 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); | 1550 | long (*compat_ioctl) (struct file *, unsigned int, unsigned long); |
1551 | int (*mmap) (struct file *, struct vm_area_struct *); | 1551 | int (*mmap) (struct file *, struct vm_area_struct *); |
1552 | void (*mremap)(struct file *, struct vm_area_struct *); | 1552 | int (*mremap)(struct file *, struct vm_area_struct *); |
1553 | int (*open) (struct inode *, struct file *); | 1553 | int (*open) (struct inode *, struct file *); |
1554 | int (*flush) (struct file *, fl_owner_t id); | 1554 | int (*flush) (struct file *, fl_owner_t id); |
1555 | int (*release) (struct inode *, struct file *); | 1555 | int (*release) (struct inode *, struct file *); |
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h new file mode 100644 index 000000000000..0408545bce42 --- /dev/null +++ b/include/linux/fwnode.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * fwnode.h - Firmware device node object handle type definition. | ||
3 | * | ||
4 | * Copyright (C) 2015, Intel Corporation | ||
5 | * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _LINUX_FWNODE_H_ | ||
13 | #define _LINUX_FWNODE_H_ | ||
14 | |||
15 | enum fwnode_type { | ||
16 | FWNODE_INVALID = 0, | ||
17 | FWNODE_OF, | ||
18 | FWNODE_ACPI, | ||
19 | FWNODE_PDATA, | ||
20 | }; | ||
21 | |||
22 | struct fwnode_handle { | ||
23 | enum fwnode_type type; | ||
24 | struct fwnode_handle *secondary; | ||
25 | }; | ||
26 | |||
27 | #endif | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index f17da50402a4..6d89575361a8 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -278,7 +278,7 @@ static inline int i2c_slave_event(struct i2c_client *client, | |||
278 | * @platform_data: stored in i2c_client.dev.platform_data | 278 | * @platform_data: stored in i2c_client.dev.platform_data |
279 | * @archdata: copied into i2c_client.dev.archdata | 279 | * @archdata: copied into i2c_client.dev.archdata |
280 | * @of_node: pointer to OpenFirmware device node | 280 | * @of_node: pointer to OpenFirmware device node |
281 | * @acpi_node: ACPI device node | 281 | * @fwnode: device node supplied by the platform firmware |
282 | * @irq: stored in i2c_client.irq | 282 | * @irq: stored in i2c_client.irq |
283 | * | 283 | * |
284 | * I2C doesn't actually support hardware probing, although controllers and | 284 | * I2C doesn't actually support hardware probing, although controllers and |
@@ -299,7 +299,7 @@ struct i2c_board_info { | |||
299 | void *platform_data; | 299 | void *platform_data; |
300 | struct dev_archdata *archdata; | 300 | struct dev_archdata *archdata; |
301 | struct device_node *of_node; | 301 | struct device_node *of_node; |
302 | struct acpi_dev_node acpi_node; | 302 | struct fwnode_handle *fwnode; |
303 | int irq; | 303 | int irq; |
304 | }; | 304 | }; |
305 | 305 | ||
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index ae4882ca4a64..58f1e75ba105 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h | |||
@@ -59,7 +59,7 @@ extern int platform_add_devices(struct platform_device **, int); | |||
59 | 59 | ||
60 | struct platform_device_info { | 60 | struct platform_device_info { |
61 | struct device *parent; | 61 | struct device *parent; |
62 | struct acpi_dev_node acpi_node; | 62 | struct fwnode_handle *fwnode; |
63 | 63 | ||
64 | const char *name; | 64 | const char *name; |
65 | int id; | 65 | int id; |
diff --git a/include/linux/pnp.h b/include/linux/pnp.h index 6512e9cbc6d5..5df733b8f704 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h | |||
@@ -510,4 +510,16 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { } | |||
510 | 510 | ||
511 | #endif /* CONFIG_PNP */ | 511 | #endif /* CONFIG_PNP */ |
512 | 512 | ||
513 | /** | ||
514 | * module_pnp_driver() - Helper macro for registering a PnP driver | ||
515 | * @__pnp_driver: pnp_driver struct | ||
516 | * | ||
517 | * Helper macro for PnP drivers which do not do anything special in module | ||
518 | * init/exit. This eliminates a lot of boilerplate. Each module may only | ||
519 | * use this macro once, and calling it replaces module_init() and module_exit() | ||
520 | */ | ||
521 | #define module_pnp_driver(__pnp_driver) \ | ||
522 | module_driver(__pnp_driver, pnp_register_driver, \ | ||
523 | pnp_unregister_driver) | ||
524 | |||
513 | #endif /* _LINUX_PNP_H */ | 525 | #endif /* _LINUX_PNP_H */ |
diff --git a/include/linux/property.h b/include/linux/property.h index a6a3d98bd7e9..de8bdf417a35 100644 --- a/include/linux/property.h +++ b/include/linux/property.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef _LINUX_PROPERTY_H_ | 13 | #ifndef _LINUX_PROPERTY_H_ |
14 | #define _LINUX_PROPERTY_H_ | 14 | #define _LINUX_PROPERTY_H_ |
15 | 15 | ||
16 | #include <linux/fwnode.h> | ||
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
17 | 18 | ||
18 | struct device; | 19 | struct device; |
@@ -40,16 +41,6 @@ int device_property_read_string_array(struct device *dev, const char *propname, | |||
40 | int device_property_read_string(struct device *dev, const char *propname, | 41 | int device_property_read_string(struct device *dev, const char *propname, |
41 | const char **val); | 42 | const char **val); |
42 | 43 | ||
43 | enum fwnode_type { | ||
44 | FWNODE_INVALID = 0, | ||
45 | FWNODE_OF, | ||
46 | FWNODE_ACPI, | ||
47 | }; | ||
48 | |||
49 | struct fwnode_handle { | ||
50 | enum fwnode_type type; | ||
51 | }; | ||
52 | |||
53 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname); | 44 | bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname); |
54 | int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, | 45 | int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, |
55 | const char *propname, u8 *val, | 46 | const char *propname, u8 *val, |
@@ -140,4 +131,37 @@ static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode, | |||
140 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); | 131 | return fwnode_property_read_u64_array(fwnode, propname, val, 1); |
141 | } | 132 | } |
142 | 133 | ||
134 | /** | ||
135 | * struct property_entry - "Built-in" device property representation. | ||
136 | * @name: Name of the property. | ||
137 | * @type: Type of the property. | ||
138 | * @nval: Number of items of type @type making up the value. | ||
139 | * @value: Value of the property (an array of @nval items of type @type). | ||
140 | */ | ||
141 | struct property_entry { | ||
142 | const char *name; | ||
143 | enum dev_prop_type type; | ||
144 | size_t nval; | ||
145 | union { | ||
146 | void *raw_data; | ||
147 | u8 *u8_data; | ||
148 | u16 *u16_data; | ||
149 | u32 *u32_data; | ||
150 | u64 *u64_data; | ||
151 | const char **str; | ||
152 | } value; | ||
153 | }; | ||
154 | |||
155 | /** | ||
156 | * struct property_set - Collection of "built-in" device properties. | ||
157 | * @fwnode: Handle to be pointed to by the fwnode field of struct device. | ||
158 | * @properties: Array of properties terminated with a null entry. | ||
159 | */ | ||
160 | struct property_set { | ||
161 | struct fwnode_handle fwnode; | ||
162 | struct property_entry *properties; | ||
163 | }; | ||
164 | |||
165 | void device_add_property_set(struct device *dev, struct property_set *pset); | ||
166 | |||
143 | #endif /* _LINUX_PROPERTY_H_ */ | 167 | #endif /* _LINUX_PROPERTY_H_ */ |