summaryrefslogtreecommitdiffstats
path: root/drivers/of/device.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2018-08-29 15:36:12 +0200
committerRob Herring <robh@kernel.org>2018-11-27 18:27:04 +0100
commite8b1dee21420f871e300d46342f2c98a2e08158d (patch)
treedb4ce7732a8044e52a17f681bb15e537fa69a3ea /drivers/of/device.c
parentpower: reset: Convert to using %pOFn instead of device_node.name (diff)
downloadlinux-e8b1dee21420f871e300d46342f2c98a2e08158d.tar.xz
linux-e8b1dee21420f871e300d46342f2c98a2e08158d.zip
of: Use device_type helpers to access the node type
Remove directly accessing device_node.type pointer and use the accessors instead. This will eventually allow removing the type pointer. Cc: Frank Rowand <frowand.list@gmail.com> Cc: devicetree@vger.kernel.org Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/device.c')
-rw-r--r--drivers/of/device.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 0f27fad9fe94..8299f8055da7 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -209,7 +209,7 @@ static ssize_t of_device_get_modalias(struct device *dev, char *str, ssize_t len
/* Name & Type */
/* %p eats all alphanum characters, so %c must be used here */
csize = snprintf(str, len, "of:N%pOFn%c%s", dev->of_node, 'T',
- dev->of_node->type);
+ of_node_get_device_type(dev->of_node));
tsize = csize;
len -= csize;
if (str)
@@ -279,7 +279,7 @@ EXPORT_SYMBOL_GPL(of_device_modalias);
*/
void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
- const char *compat;
+ const char *compat, *type;
struct alias_prop *app;
struct property *p;
int seen = 0;
@@ -289,8 +289,9 @@ void of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
add_uevent_var(env, "OF_NAME=%pOFn", dev->of_node);
add_uevent_var(env, "OF_FULLNAME=%pOF", dev->of_node);
- if (dev->of_node->type && strcmp("<NULL>", dev->of_node->type) != 0)
- add_uevent_var(env, "OF_TYPE=%s", dev->of_node->type);
+ type = of_node_get_device_type(dev->of_node);
+ if (type)
+ add_uevent_var(env, "OF_TYPE=%s", type);
/* Since the compatible field can contain pretty much anything
* it's not really legal to split it out with commas. We split it