Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751425AbbFVPta (ORCPT ); Mon, 22 Jun 2015 11:49:30 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:51639 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbbFVPtX (ORCPT ); Mon, 22 Jun 2015 11:49:23 -0400 Date: Mon, 22 Jun 2015 16:49:15 +0100 From: Mark Brown To: Richard Fitzgerald Cc: gregkh@linuxfoundation.org, patches@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org Message-ID: <20150622154915.GV14071@sirena.org.uk> References: <1434987034-17673-1-git-send-email-rf@opensource.wolfsonmicro.com> <1434987034-17673-2-git-send-email-rf@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2504uJlMzHih+KB5" Content-Disposition: inline In-Reply-To: <1434987034-17673-2-git-send-email-rf@opensource.wolfsonmicro.com> X-Cookie: The end of labor is to gain leisure. User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH 1/1] regmap: debugfs: Allow writes to cache state settings X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1703 Lines: 52 --2504uJlMzHih+KB5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --2504uJlMzHih+KB5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJViC57AAoJECTWi3JdVIfQqgsH/2i8q/vKbDNMTEaXs7GeIDmk PWcXtfRw37bjyn6cN9QJPaEs6ZaXwossV1KIu6B6axJt2/XgTiRHxW9mSdvIVLn/ jJkdCzpdbIcmb2v7OfZd4DCfz4UCODywAM0fTEKXSHXsgEFA5D6R7uocsXrR2RGT uOwFwbFf793Nk5teexN/FDhkzzexetjc8WY+fHW6Ay2sdPj/B/olboICwiaKMcgf /zRN0vZ+aCAO/2T4D54iyJFBA0FUUd5jSunrKIJqfjlXj4pKIFPEF1ZsaktfKOGS 17J4cqMfRD9CHUQwdHmxuRLYRyY3riukB1VWE3Gdec48OoEjRLwfF+PSPUnBtOk= =IM+D -----END PGP SIGNATURE----- --2504uJlMzHih+KB5-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/