On Wed, 2017-01-25 at 08:06 -0800, Omar Sandoval wrote:
> +       for (i = 0; i < ARRAY_SIZE(blk_mq_debugfs_ctx_attrs); i++) {
> +               const struct blk_mq_debugfs_attr *attr;
> +
> +               attr = &blk_mq_debugfs_ctx_attrs[i];
> +               if (!debugfs_create_file(attr->name, attr->mode, ctx_dir, ctx,
> +                                        attr->fops))
> +                       return -ENOMEM;
> +       }

This loop occurs two times. Please consider introducing a helper function,
e.g. debugfs_create_files(). If you follow the same convention as for sysfs,
namely to use a sentinel at the end of an attribute array then that helper
function will only need a pointer to the attribute array and won't need the
size of that array.

Bart.--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to