mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
device property: Add irq_get to fwnode operation
Add irq_get() fwnode operation to implement fwnode_irq_get() through fwnode operations, moving the code in fwnode_irq_get() to OF and ACPI frameworks. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Rob Herring <robh@kernel.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
68b979d068
commit
99c63707ba
@ -1394,6 +1394,19 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode,
|
||||
unsigned int index)
|
||||
{
|
||||
struct resource res;
|
||||
int ret;
|
||||
|
||||
ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return res.start;
|
||||
}
|
||||
|
||||
#define DECLARE_ACPI_FWNODE_OPS(ops) \
|
||||
const struct fwnode_operations ops = { \
|
||||
.device_is_available = acpi_fwnode_device_is_available, \
|
||||
@ -1418,6 +1431,7 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
|
||||
acpi_graph_get_remote_endpoint, \
|
||||
.graph_get_port_parent = acpi_fwnode_get_parent, \
|
||||
.graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \
|
||||
.irq_get = acpi_fwnode_irq_get, \
|
||||
}; \
|
||||
EXPORT_SYMBOL_GPL(ops)
|
||||
|
||||
|
@ -901,17 +901,7 @@ EXPORT_SYMBOL(fwnode_iomap);
|
||||
*/
|
||||
int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
|
||||
{
|
||||
struct resource res;
|
||||
int ret;
|
||||
|
||||
if (is_of_node(fwnode))
|
||||
return of_irq_get(to_of_node(fwnode), index);
|
||||
|
||||
ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return res.start;
|
||||
return fwnode_call_int_op(fwnode, irq_get, index);
|
||||
}
|
||||
EXPORT_SYMBOL(fwnode_irq_get);
|
||||
|
||||
|
@ -1474,6 +1474,12 @@ static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,
|
||||
unsigned int index)
|
||||
{
|
||||
return of_irq_get(to_of_node(fwnode), index);
|
||||
}
|
||||
|
||||
static int of_fwnode_add_links(struct fwnode_handle *fwnode)
|
||||
{
|
||||
struct property *p;
|
||||
@ -1512,6 +1518,7 @@ const struct fwnode_operations of_fwnode_ops = {
|
||||
.graph_get_port_parent = of_fwnode_graph_get_port_parent,
|
||||
.graph_parse_endpoint = of_fwnode_graph_parse_endpoint,
|
||||
.iomap = of_fwnode_iomap,
|
||||
.irq_get = of_fwnode_irq_get,
|
||||
.add_links = of_fwnode_add_links,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(of_fwnode_ops);
|
||||
|
@ -149,6 +149,7 @@ struct fwnode_operations {
|
||||
int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
|
||||
struct fwnode_endpoint *endpoint);
|
||||
void __iomem *(*iomap)(struct fwnode_handle *fwnode, int index);
|
||||
int (*irq_get)(const struct fwnode_handle *fwnode, unsigned int index);
|
||||
int (*add_links)(struct fwnode_handle *fwnode);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user