HomeFreeBSD

LinuxKPI/lindebugfs: stop panicing in lindebugfs, fix simple_read_from_buffer

Description

LinuxKPI/lindebugfs: stop panicing in lindebugfs, fix simple_read_from_buffer

Trying to use lindebugfs for debugging wirless drivers two issues
became apparent:
(a) a panic in lindebugfs calling a hard coded release function if the

caller had not provided one.  This seems to be based on assumptions
that no longer hold up.  Remove the hard coded release function to
prevent panics.

(b) In LinuxKPI simple_read_from_buffer() would call copy_to_user() but

buffers weren't setup for this (lindebugfs copies data from its
own buffer) and then pseudofs will do another copyout to the user
on this;  remove the copy_to_user() and simply copy the data over
to the provided buffer; this works for as long as the only consumers
remain debugfs callers (which currently seems to be the case).
[the only out-of-tree consumers I am aware off are two drm-kmod
drivers/gpu/drm/amd/pm/* debugfs functions I cannot test].

Sponsored by: The FreeBSD Foundation
Tested by: jfree
Differential Revision: https://reviews.freebsd.org/D45755

(cherry picked from commit 5668c22a13c6befa9b8486387d38457c40ce7af4)

Details