On Mon, 2022-11-28 at 15:19 +1100, Benjamin Gray wrote: > Debugfs files are not always integers, so make *_file return/write a > byte buffer, and *_int deal with int values specifically. This > increases > consistency with the other file read/write helpers. > > Signed-off-by: Benjamin Gray <bg...@linux.ibm.com>
This seems like a sensible idea. Nitpick below, otherwise it looks like you have changed over all 21 call sites and the new helpers look better. Reviewed-by: Andrew Donnellan <a...@linux.ibm.com> > -int read_debugfs_file(char *debugfs_file, int *result) > +int read_debugfs_int(const char *debugfs_file, int *result) > { > int err; > - char path[PATH_MAX]; > char value[16] = {0}; > > - strcpy(path, "/sys/kernel/debug/"); > - strncat(path, debugfs_file, PATH_MAX - strlen(path) - 1); > - > - if ((err = read_file(path, value, sizeof(value) - 1, NULL))) > + if ((err = read_debugfs_file(debugfs_file, value, > sizeof(value) - 1))) Per my comments on the previous patch, separate the function call from the error check -- Andrew Donnellan OzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited