mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@kernel.org>
Cc: gregkh@linuxfoundation.org, patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] regmap: debugfs: Allow writes to cache state settings
Date: Mon, 22 Jun 2015 17:10:44 +0100	[thread overview]
Message-ID: <20150622161044.GA29071@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20150622154915.GV14071@sirena.org.uk>

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/

  reply	other threads:[~2015-06-22 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 15:30 [PATCH 0/1] " Richard Fitzgerald
2015-06-22 15:30 ` [PATCH 1/1] " Richard Fitzgerald
2015-06-22 15:49   ` Mark Brown
2015-06-22 16:10     ` Richard Fitzgerald [this message]
2015-06-23 10:26       ` Mark Brown
2015-06-22 15:36 ` [PATCH 0/1] " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150622161044.GA29071@opensource.wolfsonmicro.com \
    --to=rf@opensource.wolfsonmicro.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®