Quoting Matt Roper (2018-02-01 19:53:13) > +#include <linux/cgroup.h> > + > +#include "i915_drv.h" > + > +struct i915_cgroup_data { > + struct cgroup_driver_data base; > +}; > + > +static inline struct i915_cgroup_data * > +cgrp_to_i915(struct cgroup_driver_data *data) > +{
Document your requirement that base is offset 0 (required for both i915_cgroup_alloc and i915_cgroup_free). BUILD_BUG_ON(offsetof(struct i915_cgroup_data, base)); (or make said code flexible) > + return container_of(data, struct i915_cgroup_data, base); > +} > + > +static struct cgroup_driver_data * > +i915_cgroup_alloc(struct cgroup_driver *drv) > +{ > + struct i915_cgroup_data *data; > + > + data = kzalloc(sizeof *data, GFP_KERNEL); > + return &data->base; > +} > + > +static void > +i915_cgroup_free(struct cgroup_driver_data *data) > +{ > + kfree(data); > +} _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel