Skip to content

Commit 68b979d

Browse files
Sakari Ailusrafaeljw
authored andcommitted
device property: Add iomap to fwnode operations
Add iomap() fwnode operation to implement fwnode_iomap() through fwnode operations, moving the code in fwnode_iomap() to OF framework. Note that the IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode) check is needed for Sparc that has its own implementation of of_iomap anyway. Let the pre-compiler to handle that check. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> 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>
1 parent 55dcbc0 commit 68b979d

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

drivers/base/property.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,7 @@ EXPORT_SYMBOL_GPL(device_get_phy_mode);
887887
*/
888888
void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
889889
{
890-
if (IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode))
891-
return of_iomap(to_of_node(fwnode), index);
892-
893-
return NULL;
890+
return fwnode_call_ptr_op(fwnode, iomap, index);
894891
}
895892
EXPORT_SYMBOL(fwnode_iomap);
896893

drivers/of/property.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,15 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)
14651465
return 0;
14661466
}
14671467

1468+
static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)
1469+
{
1470+
#ifdef CONFIG_OF_ADDRESS
1471+
return of_iomap(to_of_node(fwnode), index);
1472+
#else
1473+
return NULL;
1474+
#endif
1475+
}
1476+
14681477
static int of_fwnode_add_links(struct fwnode_handle *fwnode)
14691478
{
14701479
struct property *p;
@@ -1502,6 +1511,7 @@ const struct fwnode_operations of_fwnode_ops = {
15021511
.graph_get_remote_endpoint = of_fwnode_graph_get_remote_endpoint,
15031512
.graph_get_port_parent = of_fwnode_graph_get_port_parent,
15041513
.graph_parse_endpoint = of_fwnode_graph_parse_endpoint,
1514+
.iomap = of_fwnode_iomap,
15051515
.add_links = of_fwnode_add_links,
15061516
};
15071517
EXPORT_SYMBOL_GPL(of_fwnode_ops);

include/linux/fwnode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ struct fwnode_operations {
148148
(*graph_get_port_parent)(struct fwnode_handle *fwnode);
149149
int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
150150
struct fwnode_endpoint *endpoint);
151+
void __iomem *(*iomap)(struct fwnode_handle *fwnode, int index);
151152
int (*add_links)(struct fwnode_handle *fwnode);
152153
};
153154

0 commit comments

Comments
 (0)