summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h11
-rw-r--r--include/linux/container_of.h5
-rw-r--r--include/linux/fwnode.h4
-rw-r--r--include/linux/kobject.h75
-rw-r--r--include/linux/pci.h30
-rw-r--r--include/linux/platform_device.h8
-rw-r--r--include/linux/property.h2
-rw-r--r--include/linux/sys_soc.h9
8 files changed, 125 insertions, 19 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 32cac3a6f362..ec3e143caabe 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -162,10 +162,6 @@ struct acpi_hotplug_context {
* -----------
*/
-bool acpi_of_match_device(const struct acpi_device *adev,
- const struct of_device_id *of_match_table,
- const struct of_device_id **of_id);
-
/* Status (_STA) */
struct acpi_device_status {
@@ -952,13 +948,6 @@ int acpi_scan_add_dep(acpi_handle handle, struct acpi_handle_list *dep_devices);
u32 arch_acpi_add_auto_dep(acpi_handle handle);
#else /* CONFIG_ACPI */
-static inline bool acpi_of_match_device(const struct acpi_device *adev,
- const struct of_device_id *of_match_table,
- const struct of_device_id **of_id)
-{
- return false;
-}
-
static inline int register_acpi_bus_type(void *bus) { return 0; }
static inline int unregister_acpi_bus_type(void *bus) { return 0; }
diff --git a/include/linux/container_of.h b/include/linux/container_of.h
index 1f6ebf27d962..28db38e9ee3e 100644
--- a/include/linux/container_of.h
+++ b/include/linux/container_of.h
@@ -17,11 +17,10 @@
* Do not use container_of() in new code.
*/
#define container_of(ptr, type, member) ({ \
- void *__mptr = (void *)(ptr); \
- static_assert(__same_type(*(ptr), ((type *)0)->member) || \
+ static_assert(__same_type(*(ptr), typeof_member(type, member)) || \
__same_type(*(ptr), void), \
"pointer type mismatch in container_of()"); \
- ((type *)(__mptr - offsetof(type, member))); })
+ (type *)((void *)(ptr) - offsetof(type, member)); })
/**
* container_of_const - cast a member of a structure out to the containing
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 4e86e6990d28..a9dcaf7e7076 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -117,6 +117,8 @@ struct fwnode_reference_args {
* @put: Put a reference to an fwnode.
* @device_is_available: Return true if the device is available.
* @device_get_match_data: Return the device driver match data.
+ * @device_dma_supported: Return true if DMA is supported.
+ * @device_get_dma_attr: Return the device DMA attribute.
* @property_present: Return true if a property is present.
* @property_read_bool: Return a boolean property value.
* @property_read_int_array: Read an array of integer properties. Return zero on
@@ -134,6 +136,8 @@ struct fwnode_reference_args {
* endpoint node.
* @graph_get_port_parent: Return the parent node of a port node.
* @graph_parse_endpoint: Parse endpoint for port and endpoint id.
+ * @iomap: Map the I/O memory of a given index for a fwnode.
+ * @irq_get: Get the IRQ of a given index for a fwnode.
* @add_links: Create fwnode links to all the suppliers of the fwnode. Return
* zero on success, a negative error code otherwise.
*/
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index bcb5d4e32001..55e37a5d405e 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -138,12 +138,79 @@ struct kset_uevent_ops {
struct kobj_attribute {
struct attribute attr;
- ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf);
- ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count);
+ __SYSFS_FUNCTION_ALTERNATIVE(
+ ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf);
+ ssize_t (*show_const)(struct kobject *kobj, const struct kobj_attribute *attr,
+ char *buf);
+ );
+ __SYSFS_FUNCTION_ALTERNATIVE(
+ ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
+ const char *buf, size_t count);
+ ssize_t (*store_const)(struct kobject *kobj, const struct kobj_attribute *attr,
+ const char *buf, size_t count);
+ );
};
+typedef ssize_t __kobj_show_handler_const(struct kobject *kobj, const struct kobj_attribute *attr,
+ char *buf);
+typedef ssize_t __kobj_store_handler_const(struct kobject *kobj, const struct kobj_attribute *attr,
+ const char *buf, size_t count);
+
+#ifdef CONFIG_CFI
+
+#define __KOBJ_ATTR_SHOW_STORE(_show, _store) \
+ .show = _Generic(_show, \
+ __kobj_show_handler_const * : NULL, \
+ default : _show \
+ ), \
+ .show_const = _Generic(_show, \
+ __kobj_show_handler_const * : _show, \
+ default : NULL \
+ ), \
+ .store = _Generic(_store, \
+ __kobj_store_handler_const * : NULL, \
+ default : _store \
+ ), \
+ .store_const = _Generic(_store, \
+ __kobj_store_handler_const * : _store, \
+ default : NULL \
+ ),
+
+#else
+
+#define __KOBJ_ATTR_SHOW_STORE(_show, _store) \
+ .show = _Generic(_show, \
+ __kobj_show_handler_const * : (void *)_show, \
+ default : _show \
+ ), \
+ .store = _Generic(_store, \
+ __kobj_store_handler_const * : (void *)_store, \
+ default : _store \
+ ), \
+
+#endif
+
+#define __KOBJ_ATTR(_name, _mode, _show, _store) { \
+ .attr = { .name = __stringify(_name), \
+ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
+ __KOBJ_ATTR_SHOW_STORE(_show, _store) \
+}
+
+#define __KOBJ_ATTR_RO_MODE(_name, _mode) \
+ __KOBJ_ATTR(_name, _mode, _name##_show, NULL)
+
+#define __KOBJ_ATTR_RO(_name) \
+ __KOBJ_ATTR_RO_MODE(_name, 0444)
+
+#define __KOBJ_ATTR_RW_MODE(_name, _mode) \
+ __KOBJ_ATTR(_name, _mode, _name##_show, _name##_store)
+
+#define __KOBJ_ATTR_WO(_name) \
+ __KOBJ_ATTR(_name, 0200, NULL, _name##_store)
+
+#define __KOBJ_ATTR_RW(_name) \
+ __KOBJ_ATTR(_name, 0644, _name##_show, _name##_store)
+
extern const struct sysfs_ops kobj_sysfs_ops;
struct sock;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 64b308b6e61c..3d2c1ac645ff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1783,6 +1783,26 @@ void pci_free_irq_vectors(struct pci_dev *dev);
int pci_irq_vector(struct pci_dev *dev, unsigned int nr);
const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev, int vec);
+/**
+ * pci_irq_type - Get the interrupt type of a PCI device
+ * @pdev: the PCI device to operate on
+ *
+ * Discriminate the interrupt type the PCI core selected for this device
+ * after a successful pci_alloc_irq_vectors() call.
+ *
+ * Return: %PCI_IRQ_MSIX, %PCI_IRQ_MSI, or %PCI_IRQ_INTX.
+ */
+static inline unsigned int pci_irq_type(struct pci_dev *pdev)
+{
+ if (pdev->msix_enabled)
+ return PCI_IRQ_MSIX;
+
+ if (pdev->msi_enabled)
+ return PCI_IRQ_MSI;
+
+ return PCI_IRQ_INTX;
+}
+
#else
static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }
static inline void pci_disable_msi(struct pci_dev *dev) { }
@@ -1845,6 +1865,11 @@ static inline const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev,
{
return cpu_possible_mask;
}
+
+static inline unsigned int pci_irq_type(struct pci_dev *pdev)
+{
+ return PCI_IRQ_INTX;
+}
#endif
/**
@@ -2255,6 +2280,11 @@ static inline bool pci_suspend_retains_context(struct pci_dev *pdev)
{
return true;
}
+
+static inline unsigned int pci_irq_type(struct pci_dev *pdev)
+{
+ return 0;
+}
#endif /* CONFIG_PCI */
/* Include architecture-dependent settings and functions */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 8c566f09d04e..3d5bbcbae730 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -19,6 +19,8 @@
struct irq_affinity;
struct mfd_cell;
struct property_entry;
+struct device_node;
+struct fwnode_handle;
struct platform_device {
const char *name;
@@ -262,6 +264,12 @@ extern int platform_device_add_resources(struct platform_device *pdev,
unsigned int num);
extern int platform_device_add_data(struct platform_device *pdev,
const void *data, size_t size);
+void platform_device_set_of_node(struct platform_device *pdev,
+ struct device_node *np);
+void platform_device_set_fwnode(struct platform_device *pdev,
+ struct fwnode_handle *fwnode);
+void platform_device_set_of_node_from_dev(struct platform_device *pdev,
+ const struct device *dev2);
extern int platform_device_add(struct platform_device *pdev);
extern void platform_device_del(struct platform_device *pdev);
extern void platform_device_put(struct platform_device *pdev);
diff --git a/include/linux/property.h b/include/linux/property.h
index 14c304db4664..907c790a3f01 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -397,11 +397,13 @@ struct property_entry {
union {
const void *pointer;
union {
+ /* private: internal representation of @value */
u8 u8_data[sizeof(u64) / sizeof(u8)];
u16 u16_data[sizeof(u64) / sizeof(u16)];
u32 u32_data[sizeof(u64) / sizeof(u32)];
u64 u64_data[sizeof(u64) / sizeof(u64)];
const char *str[sizeof(u64) / sizeof(char *)];
+ /* public: */
} value;
};
};
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h
index f19f5cec18e2..cedabf177f47 100644
--- a/include/linux/sys_soc.h
+++ b/include/linux/sys_soc.h
@@ -21,19 +21,26 @@ struct soc_device_attribute {
/**
* soc_device_register - register SoC as a device
* @soc_plat_dev_attr: Attributes passed from platform to be attributed to a SoC
+ *
+ * Returns:
+ * - %NULL if the SoC bus is not yet registered;
+ * - on success, the newly allocated &struct soc_device pointer;
+ * - on failure, a negative error code as an ERR_PTR().
*/
struct soc_device *soc_device_register(
struct soc_device_attribute *soc_plat_dev_attr);
/**
* soc_device_unregister - unregister SoC device
- * @dev: SoC device to be unregistered
+ * @soc_dev: SoC device to be unregistered
*/
void soc_device_unregister(struct soc_device *soc_dev);
/**
* soc_device_to_device - helper function to fetch struct device
* @soc: Previously registered SoC device container
+ *
+ * Returns: &struct device pointer for this @soc
*/
struct device *soc_device_to_device(struct soc_device *soc);