Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b815342 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files
Pull DT-related device properties changes from Rob Herring.

* 'dt/property-move' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
  of: Support const and non-const use for to_of_node()
  of: Make of_fwnode_handle() safer
  of: Move OF property and graph API from base.c to property.c
parents 41f1830f d20dc149
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
obj-y = base.o device.o platform.o
obj-y = base.o device.o platform.o property.o
obj-$(CONFIG_OF_DYNAMIC) += dynamic.o
obj-$(CONFIG_OF_FLATTREE) += fdt.o
obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
+0 −733

File changed.

Preview size limit exceeded, changes collapsed.

drivers/of/property.c

0 → 100644
+766 −0

File added.

Preview size limit exceeded, changes collapsed.

+20 −10
Original line number Diff line number Diff line
@@ -148,18 +148,28 @@ extern raw_spinlock_t devtree_lock;
#ifdef CONFIG_OF
void of_core_init(void);

static inline bool is_of_node(struct fwnode_handle *fwnode)
static inline bool is_of_node(const struct fwnode_handle *fwnode)
{
	return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_OF;
}

static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
{
	return is_of_node(fwnode) ?
		container_of(fwnode, struct device_node, fwnode) : NULL;
}

#define of_fwnode_handle(node) (&(node)->fwnode)
#define to_of_node(__fwnode)						\
	({								\
		typeof(__fwnode) __to_of_node_fwnode = (__fwnode);	\
									\
		is_of_node(__to_of_node_fwnode) ?			\
			container_of(__to_of_node_fwnode,		\
				     struct device_node, fwnode) :	\
			NULL;						\
	})

#define of_fwnode_handle(node)						\
	({								\
		typeof(node) __of_fwnode_handle_node = (node);		\
									\
		__of_fwnode_handle_node ?				\
			&__of_fwnode_handle_node->fwnode : NULL;	\
	})

static inline bool of_have_populated_dt(void)
{
@@ -533,12 +543,12 @@ static inline void of_core_init(void)
{
}

static inline bool is_of_node(struct fwnode_handle *fwnode)
static inline bool is_of_node(const struct fwnode_handle *fwnode)
{
	return false;
}

static inline struct device_node *to_of_node(struct fwnode_handle *fwnode)
static inline struct device_node *to_of_node(const struct fwnode_handle *fwnode)
{
	return NULL;
}