[Intel-gfx] [PATCH] drm/i915: Expose engine properties via sysfs

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 11 15:17:53 UTC 2019


Quoting Summers, Stuart (2019-10-11 16:14:07)
> On Fri, 2019-10-11 at 12:36 +0100, Chris Wilson wrote:
> > +void intel_engines_add_sysfs(struct drm_i915_private *i915)
> > +{
> > +     static const struct attribute *files[] = {
> > +             &name_attr.attr,
> > +             &class_attr.attr,
> > +             &inst_attr.attr,
> > +             &caps_attr.attr,
> > +             NULL
> > +     };
> > +
> > +     struct device *kdev = i915->drm.primary->kdev;
> > +     struct intel_engine_cs *engine;
> > +     struct kobject *dir;
> > +
> > +     dir = kobject_create_and_add("engine", &kdev->kobj);
> > +     if (!dir)
> > +             return;
> > +
> > +     for_each_uabi_engine(engine, i915) {
> > +             struct kobject *kobj;
> > +
> > +             kobj = kobj_engine(dir, engine);
> > +             if (!kobj)
> > +                     goto err_engine;
> > +
> > +             if (sysfs_create_files(kobj, files))
> > +                     goto err_engine;
> > +
> > +             if (0) {
> > +err_engine:
> 
> Can you explain why we need this goto/if 0 over a simple print/break
> under the if(sysfs_create_files()) call above? At a glance this just
> seems overly complicated.

There's more to come.
-Chris


More information about the Intel-gfx mailing list