Re: [PATCH 4.19 066/133] regmap: debugfs: Dont sleep while atomic for fast_io regmaps
From: Doug Anderson
Date: Thu Aug 06 2020 - 16:10:37 EST
Hi,
On Wed, Jul 22, 2020 at 5:09 AM Pavel Machek <pavel@xxxxxxx> wrote:
>
> Hi!
>
> > From: Douglas Anderson <dianders@xxxxxxxxxxxx>
> >
> > [ Upstream commit 299632e54b2e692d2830af84be51172480dc1e26 ]
> >
>
> > + err = kstrtobool_from_user(user_buf, count, &new_val);
> > + /* Ignore malforned data like debugfs_write_file_bool() */
>
> > + err = kstrtobool_from_user(user_buf, count, &new_val);
> > + /* Ignore malforned data like debugfs_write_file_bool() */
>
> I guess that should be "malformed" in both cases.
Sure.
https://lore.kernel.org/r/20200806130222.1.I832b2b45244c80ba2550a5bbcef80b574e47c57e@changeid
> Plus it would not be bad to share code between those two functions, as
> they are pretty much identical...
I took a quick attempt at it and it seemed slightly worse to me when
they shared code, at least if we wanted to keep the behavior
identical. For me it was the extra ": syncing cache" part of the
message in one of the two functions that pushed it over the edge.
Specifically if we wanted to keep that we'd have to do one of these:
a) Keep the printing out of the common code, but then the common code
is really small.
b) Add a special parameter to the common code named something like
"do_sync_if_val_becomes_false"
c) Pass some extra string named something like
"append_to_log_message_in_no_case", then do the actual sync outside of
the common code.
That being said, if you want to try to make these two functions use a
common helper and everyone thinks it's better that way then I won't
stand in your way.
-Doug