Skip to content

Commit e4681be

Browse files
miquelraynalthierryreding
authored andcommitted
gpu: host1x: Stop open-coding of_device_uevent()
There is apparently no reasons to open-code of_device_uevent() besides: - The helper receives a struct device while we want to use the of_node member of the struct device *parent*. - of_device_uevent() could not be called by modules because of a missing EXPORT_SYMBOL*(). In practice, the former point is not very constraining, just calling of_device_uevent(dev->parent, ...) would have made the trick. The latter point is more an observation rather than a real blocking point because nothing prevented of_uevent() (called by the inline function of_device_uevent()) to be exported to modules. In practice, this helper is now exported, so nothing prevent us from using of_device_uevent() anymore. Let's use the core helper directly instead of open-coding it. Cc: Thierry Reding <[email protected]> Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Mikko Perttunen <[email protected]> Cc: Rob Herring <[email protected]> Cc: Frank Rowand <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 97c2321 commit e4681be

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

drivers/gpu/host1x/bus.c

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -338,32 +338,15 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)
338338
return strcmp(dev_name(dev), drv->name) == 0;
339339
}
340340

341+
/*
342+
* Note that this is really only needed for backwards compatibility
343+
* with libdrm, which parses this information from sysfs and will
344+
* fail if it can't find the OF_FULLNAME, specifically.
345+
*/
341346
static int host1x_device_uevent(const struct device *dev,
342347
struct kobj_uevent_env *env)
343348
{
344-
struct device_node *np = dev->parent->of_node;
345-
unsigned int count = 0;
346-
struct property *p;
347-
const char *compat;
348-
349-
/*
350-
* This duplicates most of of_device_uevent(), but the latter cannot
351-
* be called from modules and operates on dev->of_node, which is not
352-
* available in this case.
353-
*
354-
* Note that this is really only needed for backwards compatibility
355-
* with libdrm, which parses this information from sysfs and will
356-
* fail if it can't find the OF_FULLNAME, specifically.
357-
*/
358-
add_uevent_var(env, "OF_NAME=%pOFn", np);
359-
add_uevent_var(env, "OF_FULLNAME=%pOF", np);
360-
361-
of_property_for_each_string(np, "compatible", p, compat) {
362-
add_uevent_var(env, "OF_COMPATIBLE_%u=%s", count, compat);
363-
count++;
364-
}
365-
366-
add_uevent_var(env, "OF_COMPATIBLE_N=%u", count);
349+
of_device_uevent(dev->parent, env);
367350

368351
return 0;
369352
}

0 commit comments

Comments
 (0)