* [PATCH] regmap: Fix debugfs-file 'registers' mode
@ 2014-06-28 13:23 Markus Pargmann
2014-06-30 5:45 ` Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Markus Pargmann @ 2014-06-28 13:23 UTC (permalink / raw)
To: linux-arm-kernel
The macro "REGMAP_ALLOW_WRITE_DEBUGFS" can be used to enable write
support on the registers file in the debugfs. The mode of the file is
fixed to 0400 so it is not possible to write the file ever.
This patch fixes the mode by setting it to the correct value depending
on the macro.
Cc: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
Hi,
as the kconfig option will probably not be merged, I extracted the mode fix of
my previous patch.
Regards,
Markus
drivers/base/regmap/regmap-debugfs.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 45d812c0ea77..f45a0a0e0371 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
map, ®map_reg_ranges_fops);
if (map->max_register || regmap_readable(map, 0)) {
- debugfs_create_file("registers", 0400, map->debugfs,
+ unsigned int registers_mode;
+
+ if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS))
+ registers_mode = 0600;
+ else
+ registers_mode = 0400;
+
+ debugfs_create_file("registers", registers_mode, map->debugfs,
map, ®map_map_fops);
debugfs_create_file("access", 0400, map->debugfs,
map, ®map_access_fops);
--
2.0.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] regmap: Fix debugfs-file 'registers' mode
2014-06-28 13:23 [PATCH] regmap: Fix debugfs-file 'registers' mode Markus Pargmann
@ 2014-06-30 5:45 ` Uwe Kleine-König
2014-07-01 10:33 ` Markus Pargmann
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2014-06-30 5:45 UTC (permalink / raw)
To: linux-arm-kernel
Hi Markus,
On Sat, Jun 28, 2014 at 03:23:11PM +0200, Markus Pargmann wrote:
> The macro "REGMAP_ALLOW_WRITE_DEBUGFS" can be used to enable write
minor nit: I'd not call it "macro", but "cpp symbol" because macro
sounds more function-like. (There is another "macro" at the end of the
commit log.)
> support on the registers file in the debugfs. The mode of the file is
> fixed to 0400 so it is not possible to write the file ever.
>
> This patch fixes the mode by setting it to the correct value depending
> on the macro.
>
> Cc: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
> Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> ---
>
> Hi,
>
> as the kconfig option will probably not be merged, I extracted the mode fix of
> my previous patch.
>
> Regards,
>
> Markus
>
> drivers/base/regmap/regmap-debugfs.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
> index 45d812c0ea77..f45a0a0e0371 100644
> --- a/drivers/base/regmap/regmap-debugfs.c
> +++ b/drivers/base/regmap/regmap-debugfs.c
> @@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
> map, ®map_reg_ranges_fops);
>
> if (map->max_register || regmap_readable(map, 0)) {
> - debugfs_create_file("registers", 0400, map->debugfs,
> + unsigned int registers_mode;
> +
> + if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS))
> + registers_mode = 0600;
> + else
> + registers_mode = 0400;
> +
> + debugfs_create_file("registers", registers_mode, map->debugfs,
> map, ®map_map_fops);
debugfs_create_file takes an umode_t as 2nd parameter. Maybe you should
pick that type for registers_mode here, too?
Best regards
Uwe
> debugfs_create_file("access", 0400, map->debugfs,
> map, ®map_access_fops);
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] regmap: Fix debugfs-file 'registers' mode
2014-06-30 5:45 ` Uwe Kleine-König
@ 2014-07-01 10:33 ` Markus Pargmann
0 siblings, 0 replies; 3+ messages in thread
From: Markus Pargmann @ 2014-07-01 10:33 UTC (permalink / raw)
To: linux-arm-kernel
Hi Uwe,
On Mon, Jun 30, 2014 at 07:45:07AM +0200, Uwe Kleine-K?nig wrote:
> Hi Markus,
>
> On Sat, Jun 28, 2014 at 03:23:11PM +0200, Markus Pargmann wrote:
> > The macro "REGMAP_ALLOW_WRITE_DEBUGFS" can be used to enable write
> minor nit: I'd not call it "macro", but "cpp symbol" because macro
> sounds more function-like. (There is another "macro" at the end of the
> commit log.)
Okay.
>
> > support on the registers file in the debugfs. The mode of the file is
> > fixed to 0400 so it is not possible to write the file ever.
> >
> > This patch fixes the mode by setting it to the correct value depending
> > on the macro.
> >
> > Cc: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
> > Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
> > ---
> >
> > Hi,
> >
> > as the kconfig option will probably not be merged, I extracted the mode fix of
> > my previous patch.
> >
> > Regards,
> >
> > Markus
> >
> > drivers/base/regmap/regmap-debugfs.c | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
> > index 45d812c0ea77..f45a0a0e0371 100644
> > --- a/drivers/base/regmap/regmap-debugfs.c
> > +++ b/drivers/base/regmap/regmap-debugfs.c
> > @@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
> > map, ®map_reg_ranges_fops);
> >
> > if (map->max_register || regmap_readable(map, 0)) {
> > - debugfs_create_file("registers", 0400, map->debugfs,
> > + unsigned int registers_mode;
> > +
> > + if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS))
> > + registers_mode = 0600;
> > + else
> > + registers_mode = 0400;
> > +
> > + debugfs_create_file("registers", registers_mode, map->debugfs,
> > map, ®map_map_fops);
> debugfs_create_file takes an umode_t as 2nd parameter. Maybe you should
> pick that type for registers_mode here, too?
Yes that should be changed, thanks.
Regards,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140701/f4b5d078/attachment.sig>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-01 10:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-28 13:23 [PATCH] regmap: Fix debugfs-file 'registers' mode Markus Pargmann
2014-06-30 5:45 ` Uwe Kleine-König
2014-07-01 10:33 ` Markus Pargmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).