+
+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?

Reply via email to