@@ -242,6 +242,12 @@ static void __init dmi_save_type(const struct dmi_header *dm, int slot,
dmi_ident[slot] = s;
}
+static void __init dmi_devices_list_add(struct dmi_device *dev)
+{
+ dev->fwnode.type = FWNODE_DMI;
+ list_add(&dev->list, &dmi_devices);
+}
+
static void __init dmi_save_one_device(int type, const char *name)
{
struct dmi_device *dev;
@@ -257,8 +263,7 @@ static void __init dmi_save_one_device(int type, const char *name)
dev->type = type;
strcpy((char *)(dev + 1), name);
dev->name = (char *)(dev + 1);
- dev->device_data = NULL;
- list_add(&dev->list, &dmi_devices);
+ dmi_devices_list_add(dev);
}
static void __init dmi_save_devices(const struct dmi_header *dm)
@@ -293,9 +298,8 @@ static void __init dmi_save_oem_strings_devices(const struct dmi_header *dm)
dev->type = DMI_DEV_TYPE_OEM_STRING;
dev->name = devname;
- dev->device_data = NULL;
- list_add(&dev->list, &dmi_devices);
+ dmi_devices_list_add(dev);
}
}
@@ -318,7 +322,7 @@ static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
dev->name = "IPMI controller";
dev->device_data = data;
- list_add_tail(&dev->list, &dmi_devices);
+ dmi_devices_list_add(dev);
}
static void __init dmi_save_dev_pciaddr(int instance, int segment, int bus,
@@ -345,7 +349,7 @@ static void __init dmi_save_dev_pciaddr(int instance, int segment, int bus,
dev->dev.name = (char *)&dev[1];
dev->dev.device_data = dev;
- list_add(&dev->dev.list, &dmi_devices);
+ dmi_devices_list_add(&dev->dev);
}
static void __init dmi_save_extended_devices(const struct dmi_header *dm)
@@ -4,6 +4,7 @@
#include <linux/list.h>
#include <linux/kobject.h>
#include <linux/mod_devicetable.h>
+#include <linux/fwnode.h>
/* enum dmi_field is in mod_devicetable.h */
@@ -80,6 +81,7 @@ struct dmi_header {
struct dmi_device {
struct list_head list;
+ struct fwnode_handle fwnode;
int type;
const char *name;
void *device_data; /* Type specific data */
@@ -113,6 +115,18 @@ extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
extern bool dmi_match(enum dmi_field f, const char *str);
extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);
+static inline bool is_dmi_fwnode(struct fwnode_handle *fwnode)
+{
+ return fwnode && fwnode->type == FWNODE_DMI;
+}
+
+static inline struct dmi_device *to_dmi_device(struct fwnode_handle *fwnode)
+{
+ if (is_dmi_fwnode(fwnode))
+ return container_of(fwnode, struct dmi_device, fwnode);
+ return NULL;
+}
+
#else
static inline int dmi_check_system(const struct dmi_system_id *list) { return 0; }
@@ -19,7 +19,8 @@ enum fwnode_type {
FWNODE_ACPI_DATA,
FWNODE_ACPI_STATIC,
FWNODE_PDATA,
- FWNODE_IRQCHIP
+ FWNODE_IRQCHIP,
+ FWNODE_DMI
};
struct fwnode_handle {