Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756378AbbGQSWX (ORCPT ); Fri, 17 Jul 2015 14:22:23 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:55962 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755471AbbGQSWU (ORCPT ); Fri, 17 Jul 2015 14:22:20 -0400 Date: Fri, 17 Jul 2015 19:22:12 +0100 From: Mark Brown To: Richard Fitzgerald , gregkh@linuxfoundation.org Cc: patches@opensource.wolfsonmicro.com, linux-kernel@vger.kernel.org Message-ID: <20150717182212.GU11162@sirena.org.uk> References: <1435066375-23728-1-git-send-email-rf@opensource.wolfsonmicro.com> <1435066375-23728-2-git-send-email-rf@opensource.wolfsonmicro.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9b4eu16IbjLAsbt2" Content-Disposition: inline In-Reply-To: <1435066375-23728-2-git-send-email-rf@opensource.wolfsonmicro.com> X-Cookie: Stay together, drag each other down. 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 v2 1/2] debugfs: Export bool read/write functions 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: 4285 Lines: 134 --9b4eu16IbjLAsbt2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 23, 2015 at 02:32:54PM +0100, Richard Fitzgerald wrote: > The file read/write functions for bools have no special dependencies > on debugfs internals and are sufficiently non-trivial to be worth > exporting so clients can re-use the implementation. Greg, I'm assuming you're OK with this? Please shout if not. > Signed-off-by: Richard Fitzgerald > --- > fs/debugfs/file.c | 14 ++++++++------ > include/linux/debugfs.h | 20 ++++++++++++++++++++ > 2 files changed, 28 insertions(+), 6 deletions(-) >=20 > diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c > index 830a7e7..95ae5ee 100644 > --- a/fs/debugfs/file.c > +++ b/fs/debugfs/file.c > @@ -447,8 +447,8 @@ struct dentry *debugfs_create_atomic_t(const char *na= me, umode_t mode, > } > EXPORT_SYMBOL_GPL(debugfs_create_atomic_t); > =20 > -static ssize_t read_file_bool(struct file *file, char __user *user_buf, > - size_t count, loff_t *ppos) > +ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf, > + size_t count, loff_t *ppos) > { > char buf[3]; > u32 *val =3D file->private_data; > @@ -461,9 +461,10 @@ static ssize_t read_file_bool(struct file *file, cha= r __user *user_buf, > buf[2] =3D 0x00; > return simple_read_from_buffer(user_buf, count, ppos, buf, 2); > } > +EXPORT_SYMBOL_GPL(debugfs_read_file_bool); > =20 > -static ssize_t write_file_bool(struct file *file, const char __user *use= r_buf, > - size_t count, loff_t *ppos) > +ssize_t debugfs_write_file_bool(struct file *file, const char __user *us= er_buf, > + size_t count, loff_t *ppos) > { > char buf[32]; > size_t buf_size; > @@ -480,10 +481,11 @@ static ssize_t write_file_bool(struct file *file, c= onst char __user *user_buf, > =20 > return count; > } > +EXPORT_SYMBOL_GPL(debugfs_write_file_bool); > =20 > static const struct file_operations fops_bool =3D { > - .read =3D read_file_bool, > - .write =3D write_file_bool, > + .read =3D debugfs_read_file_bool, > + .write =3D debugfs_write_file_bool, > .open =3D simple_open, > .llseek =3D default_llseek, > }; > diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h > index cb25af4..1545962 100644 > --- a/include/linux/debugfs.h > +++ b/include/linux/debugfs.h > @@ -117,6 +117,12 @@ struct dentry *debugfs_create_devm_seqfile(struct de= vice *dev, const char *name, > =20 > bool debugfs_initialized(void); > =20 > +ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf, > + size_t count, loff_t *ppos); > + > +ssize_t debugfs_write_file_bool(struct file *file, const char __user *us= er_buf, > + size_t count, loff_t *ppos); > + > #else > =20 > #include > @@ -283,6 +289,20 @@ static inline struct dentry *debugfs_create_devm_seq= file(struct device *dev, > return ERR_PTR(-ENODEV); > } > =20 > +static inline ssize_t debugfs_read_file_bool(struct file *file, > + char __user *user_buf, > + size_t count, loff_t *ppos) > +{ > + return -ENODEV; > +} > + > +static inline ssize_t debugfs_write_file_bool(struct file *file, > + const char __user *user_buf, > + size_t count, loff_t *ppos) > +{ > + return -ENODEV; > +} > + > #endif > =20 > #endif > --=20 > 1.7.2.5 >=20 >=20 --9b4eu16IbjLAsbt2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJVqUfUAAoJECTWi3JdVIfQcEIH/0kbraoPokIV2hXjr8SRk9DS uv6qOBtSMgio6lBAVX5O2ZA7txIIQQP8BiR271a9hdbYCIvyUmCnhewllCc38odj jMYb6N9VjP/KkAZB0HYNmtW8Huf/rhJWABWXddgKPh4IQZRaZjmcL7aNbuMVVR6R iTDimomOXe5NBJ4G0bDkzLT6pNDYZWeweqMNKFYelf9AbynZDavstpAAteFvqWdq 5acayRdjbIOSYQCqxVL5PnC9tDyWfg1rc6BBmrKDdFGD0iVJEtCCA5Qko3tWHzkZ n+pHAbWdCQz29rIkKH1kxdPtYTLle5Wye9NAGbkIi63kG+tlOE2jDpQSzFPUqH4= =1PlM -----END PGP SIGNATURE----- --9b4eu16IbjLAsbt2-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/