Commit 40303764 authored by Vinod Koul's avatar Vinod Koul

Merge branch 'topic/device_changes' into for-linus

parents 1eac3218 146b4dbb
...@@ -785,6 +785,24 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, ...@@ -785,6 +785,24 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
} }
EXPORT_SYMBOL_GPL(acpi_match_device); EXPORT_SYMBOL_GPL(acpi_match_device);
void *acpi_get_match_data(const struct device *dev)
{
const struct acpi_device_id *match;
if (!dev->driver)
return NULL;
if (!dev->driver->acpi_match_table)
return NULL;
match = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!match)
return NULL;
return (void *)match->driver_data;
}
EXPORT_SYMBOL_GPL(acpi_get_match_data);
int acpi_match_device_ids(struct acpi_device *device, int acpi_match_device_ids(struct acpi_device *device,
const struct acpi_device_id *ids) const struct acpi_device_id *ids)
{ {
......
...@@ -1271,9 +1271,17 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, ...@@ -1271,9 +1271,17 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
return 0; return 0;
} }
static void *
acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
const struct device *dev)
{
return acpi_get_match_data(dev);
}
#define DECLARE_ACPI_FWNODE_OPS(ops) \ #define DECLARE_ACPI_FWNODE_OPS(ops) \
const struct fwnode_operations ops = { \ const struct fwnode_operations ops = { \
.device_is_available = acpi_fwnode_device_is_available, \ .device_is_available = acpi_fwnode_device_is_available, \
.device_get_match_data = acpi_fwnode_device_get_match_data, \
.property_present = acpi_fwnode_property_present, \ .property_present = acpi_fwnode_property_present, \
.property_read_int_array = \ .property_read_int_array = \
acpi_fwnode_property_read_int_array, \ acpi_fwnode_property_read_int_array, \
......
...@@ -1340,3 +1340,10 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, ...@@ -1340,3 +1340,10 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint); return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint);
} }
EXPORT_SYMBOL(fwnode_graph_parse_endpoint); EXPORT_SYMBOL(fwnode_graph_parse_endpoint);
void *device_get_match_data(struct device *dev)
{
return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data,
dev);
}
EXPORT_SYMBOL_GPL(device_get_match_data);
...@@ -981,10 +981,18 @@ static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, ...@@ -981,10 +981,18 @@ static int of_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
return 0; return 0;
} }
static void *
of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
const struct device *dev)
{
return (void *)of_device_get_match_data(dev);
}
const struct fwnode_operations of_fwnode_ops = { const struct fwnode_operations of_fwnode_ops = {
.get = of_fwnode_get, .get = of_fwnode_get,
.put = of_fwnode_put, .put = of_fwnode_put,
.device_is_available = of_fwnode_device_is_available, .device_is_available = of_fwnode_device_is_available,
.device_get_match_data = of_fwnode_device_get_match_data,
.property_present = of_fwnode_property_present, .property_present = of_fwnode_property_present,
.property_read_int_array = of_fwnode_property_read_int_array, .property_read_int_array = of_fwnode_property_read_int_array,
.property_read_string_array = of_fwnode_property_read_string_array, .property_read_string_array = of_fwnode_property_read_string_array,
......
...@@ -584,6 +584,7 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), ...@@ -584,6 +584,7 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
const struct device *dev); const struct device *dev);
void *acpi_get_match_data(const struct device *dev);
extern bool acpi_driver_match_device(struct device *dev, extern bool acpi_driver_match_device(struct device *dev,
const struct device_driver *drv); const struct device_driver *drv);
int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
...@@ -755,6 +756,11 @@ static inline const struct acpi_device_id *acpi_match_device( ...@@ -755,6 +756,11 @@ static inline const struct acpi_device_id *acpi_match_device(
return NULL; return NULL;
} }
static inline void *acpi_get_match_data(const struct device *dev)
{
return NULL;
}
static inline bool acpi_driver_match_device(struct device *dev, static inline bool acpi_driver_match_device(struct device *dev,
const struct device_driver *drv) const struct device_driver *drv)
{ {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/types.h> #include <linux/types.h>
struct fwnode_operations; struct fwnode_operations;
struct device;
struct fwnode_handle { struct fwnode_handle {
struct fwnode_handle *secondary; struct fwnode_handle *secondary;
...@@ -51,6 +52,7 @@ struct fwnode_reference_args { ...@@ -51,6 +52,7 @@ struct fwnode_reference_args {
* struct fwnode_operations - Operations for fwnode interface * struct fwnode_operations - Operations for fwnode interface
* @get: Get a reference to an fwnode. * @get: Get a reference to an fwnode.
* @put: Put a reference to an fwnode. * @put: Put a reference to an fwnode.
* @device_get_match_data: Return the device driver match data.
* @property_present: Return true if a property is present. * @property_present: Return true if a property is present.
* @property_read_integer_array: Read an array of integer properties. Return * @property_read_integer_array: Read an array of integer properties. Return
* zero on success, a negative error code * zero on success, a negative error code
...@@ -71,6 +73,8 @@ struct fwnode_operations { ...@@ -71,6 +73,8 @@ struct fwnode_operations {
struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); struct fwnode_handle *(*get)(struct fwnode_handle *fwnode);
void (*put)(struct fwnode_handle *fwnode); void (*put)(struct fwnode_handle *fwnode);
bool (*device_is_available)(const struct fwnode_handle *fwnode); bool (*device_is_available)(const struct fwnode_handle *fwnode);
void *(*device_get_match_data)(const struct fwnode_handle *fwnode,
const struct device *dev);
bool (*property_present)(const struct fwnode_handle *fwnode, bool (*property_present)(const struct fwnode_handle *fwnode,
const char *propname); const char *propname);
int (*property_read_int_array)(const struct fwnode_handle *fwnode, int (*property_read_int_array)(const struct fwnode_handle *fwnode,
......
...@@ -275,6 +275,8 @@ bool device_dma_supported(struct device *dev); ...@@ -275,6 +275,8 @@ bool device_dma_supported(struct device *dev);
enum dev_dma_attr device_get_dma_attr(struct device *dev); enum dev_dma_attr device_get_dma_attr(struct device *dev);
void *device_get_match_data(struct device *dev);
int device_get_phy_mode(struct device *dev); int device_get_phy_mode(struct device *dev);
void *device_get_mac_address(struct device *dev, char *addr, int alen); void *device_get_mac_address(struct device *dev, char *addr, int alen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment