[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150622161044.GA29071@opensource.wolfsonmicro.com>
Date: Mon, 22 Jun 2015 17:10:44 +0100
From: Richard Fitzgerald <rf@...nsource.wolfsonmicro.com>
To: Mark Brown <broonie@...nel.org>
Cc: gregkh@...uxfoundation.org, patches@...nsource.wolfsonmicro.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] regmap: debugfs: Allow writes to cache state
settings
On Mon, Jun 22, 2015 at 04:49:15PM +0100, Mark Brown wrote:
> On Mon, Jun 22, 2015 at 04:30:34PM +0100, Richard Fitzgerald wrote:
>
> This looks basically good but:
>
> > +static ssize_t regmap_bool_read_file(struct file *file,
> > + char __user *user_buf,
> > + size_t count, loff_t *ppos,
> > + bool value)
> > +{
> > + char buf[2];
> > +
> > + buf[0] = value ? 'Y' : 'N';
> > + buf[1] = '\n';
> > + return simple_read_from_buffer(user_buf, count, ppos, buf, sizeof(buf));
> > +}
>
> > +static ssize_t regmap_bool_write_file(struct file *file,
> > + const char __user *user_buf,
> > + size_t count, loff_t *ppos,
> > + bool *value)
> > +{
>
> Can we not export read/write_file_bool() instead? For the read this
> seems to be an almost cut'n'paste with slight differences that look
> like taste changes. For the write path we can just stash the current
> value in the calling functions instead of cut'n'pasting the code.
They assume that file->private_data points at the actual bool, and
it doesn't here, which means temporarily patching it around the call.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists