[PATCH v7 6/7] drm/i915: Replace custom intel runtime_pm tracker with ref_tracker library

Zhou Furong furong.zhou at linux.intel.com
Sun Apr 23 04:45:10 UTC 2023



> +
> +static inline void
> +intel_wakeref_tracker_show(struct ref_tracker_dir *dir,
> +			   struct drm_printer *p)
> +{
> +	const size_t buf_size = PAGE_SIZE;
> +	char *buf, *sb, *se;
> +	size_t count;
> +
> +	buf = kmalloc(buf_size, GFP_NOWAIT);
> +	if (!buf)
> +		return;
> +
> +	count = ref_tracker_dir_snprint(dir, buf, buf_size);
> +	if (!count)
> +		goto free;
> +	/* printk does not like big buffers, so we split it */
> +	for (sb = buf; *sb; sb = se + 1) {
> +		se = strchrnul(sb, '\n');
> +		drm_printf(p, "%.*s", (int)(se - sb + 1), sb);
> +		if (!*se)
> +			break;
> +	}
> +	if (count >= buf_size)
> +		drm_printf(p, "\n...dropped %zd extra bytes of leak report.\n",
> +			   count + 1 - buf_size);
> +free:
> +	kfree(buf);
> +}
> +

move to c source?



More information about the dri-devel mailing list