All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: core: Add debugfs to show constraint flags
@ 2016-04-21 12:06 Richard Fitzgerald
  2016-04-21 12:23 ` kbuild test robot
  2016-04-21 12:30 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Fitzgerald @ 2016-04-21 12:06 UTC (permalink / raw)
  To: broonie; +Cc: lgirdwood, linux-kernel, patches

There are debugfs entries for voltage and current, but not for
the constraint flags. It's useful for debugging to be able to
see what these flags are so this patch adds a new debugfs file.
We can't use debugfs_create_bool for this because the flags are
bitfields, so as this needs a special read callback they have been
collected into a single file that lists all the flags.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
---
 drivers/regulator/core.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e0b7642..e0d13fc 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1272,6 +1272,49 @@ static void unset_regulator_supplies(struct regulator_dev *rdev)
 	}
 }
 
+#ifdef CONFIG_DEBUG_FS
+static int constraint_flags_read_file(struct file *file, char __user *user_buf,
+				      size_t count, loff_t *ppos)
+{
+	const struct regulator *regulator = file->private_data;
+	const struct regulation_constraints *c = regulator->rdev->constraints;
+	char *buf;
+	ssize_t ret;
+
+	if (!c)
+		return 0;
+
+	buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	ret = snprintf(buf, PAGE_SIZE,
+		"always_on: %u\nboot_on: %u\napply_uV: %u\nramp_disable: %u\n"
+		"soft_start: %u\npull_down: %u\nover_current_protection: %u\n",
+		!!c->always_on,
+		!!c->boot_on,
+		!!c->apply_uV,
+		!!c->ramp_disable,
+		!!c->soft_start,
+		!!c->pull_down,
+		!!c->over_current_protection);
+
+	ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
+	kfree(buf);
+
+	return ret;
+}
+
+#endif
+
+static const struct file_operations constraint_flags_fops = {
+#ifdef CONFIG_DEBUG_FS
+	.open = simple_open,
+	.read = constraint_flags_read_file,
+	.llseek = default_llseek,
+#endif
+};
+
 #define REG_STR_SIZE	64
 
 static struct regulator *create_regulator(struct regulator_dev *rdev,
@@ -1327,6 +1370,9 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
 				   &regulator->min_uV);
 		debugfs_create_u32("max_uV", 0444, regulator->debugfs,
 				   &regulator->max_uV);
+		debugfs_create_file("constraint_flags", 0444,
+				    regulator->debugfs, regulator,
+				    &constraint_flags_fops);
 	}
 
 	/*
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: core: Add debugfs to show constraint flags
  2016-04-21 12:06 [PATCH] regulator: core: Add debugfs to show constraint flags Richard Fitzgerald
@ 2016-04-21 12:23 ` kbuild test robot
  2016-04-21 12:30 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-04-21 12:23 UTC (permalink / raw)
  To: Richard Fitzgerald; +Cc: kbuild-all, broonie, lgirdwood, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 2621 bytes --]

Hi,

[auto build test ERROR on regulator/for-next]
[also build test ERROR on v4.6-rc4 next-20160420]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Richard-Fitzgerald/regulator-core-Add-debugfs-to-show-constraint-flags/20160421-200958
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: powerpc-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

>> drivers/regulator/core.c:1320:10: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .read = constraint_flags_read_file,
             ^
   drivers/regulator/core.c:1320:10: note: (near initialization for 'constraint_flags_fops.read')
   drivers/regulator/core.c:2558:1: warning: 'regulator_can_change_voltage' is deprecated [-Wdeprecated-declarations]
    EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
    ^
   drivers/regulator/core.c:2541:5: note: declared here
    int regulator_can_change_voltage(struct regulator *regulator)
        ^
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from drivers/regulator/core.c:16:
   include/linux/export.h:63:25: warning: 'regulator_can_change_voltage' is deprecated [-Wdeprecated-declarations]
     __visible const struct kernel_symbol __ksymtab_##sym \
                            ^
   include/linux/export.h:72:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/regulator/core.c:2558:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
    ^
   drivers/regulator/core.c:2541:5: note: declared here
    int regulator_can_change_voltage(struct regulator *regulator)
        ^
   cc1: some warnings being treated as errors

vim +1320 drivers/regulator/core.c

  1314	
  1315	#endif
  1316	
  1317	static const struct file_operations constraint_flags_fops = {
  1318	#ifdef CONFIG_DEBUG_FS
  1319		.open = simple_open,
> 1320		.read = constraint_flags_read_file,
  1321		.llseek = default_llseek,
  1322	#endif
  1323	};

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 48663 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: core: Add debugfs to show constraint flags
  2016-04-21 12:06 [PATCH] regulator: core: Add debugfs to show constraint flags Richard Fitzgerald
  2016-04-21 12:23 ` kbuild test robot
@ 2016-04-21 12:30 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-04-21 12:30 UTC (permalink / raw)
  To: Richard Fitzgerald; +Cc: kbuild-all, broonie, lgirdwood, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 2771 bytes --]

Hi,

[auto build test WARNING on regulator/for-next]
[also build test WARNING on v4.6-rc4 next-20160420]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Richard-Fitzgerald/regulator-core-Add-debugfs-to-show-constraint-flags/20160421-200958
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: s390-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=s390 

All warnings (new ones prefixed by >>):

>> drivers/regulator/core.c:1320:2: warning: initialization from incompatible pointer type
     .read = constraint_flags_read_file,
     ^
   drivers/regulator/core.c:1320:2: warning: (near initialization for 'constraint_flags_fops.read')
   drivers/regulator/core.c:2558:1: warning: 'regulator_can_change_voltage' is deprecated (declared at drivers/regulator/core.c:2541) [-Wdeprecated-declarations]
    EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
    ^
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from drivers/regulator/core.c:16:
   include/linux/export.h:63:25: warning: 'regulator_can_change_voltage' is deprecated (declared at drivers/regulator/core.c:2541) [-Wdeprecated-declarations]
     __visible const struct kernel_symbol __ksymtab_##sym \
                            ^
   include/linux/export.h:72:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/regulator/core.c:2558:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
    ^

vim +1320 drivers/regulator/core.c

  1304			!!c->ramp_disable,
  1305			!!c->soft_start,
  1306			!!c->pull_down,
  1307			!!c->over_current_protection);
  1308	
  1309		ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
  1310		kfree(buf);
  1311	
  1312		return ret;
  1313	}
  1314	
  1315	#endif
  1316	
  1317	static const struct file_operations constraint_flags_fops = {
  1318	#ifdef CONFIG_DEBUG_FS
  1319		.open = simple_open,
> 1320		.read = constraint_flags_read_file,
  1321		.llseek = default_llseek,
  1322	#endif
  1323	};
  1324	
  1325	#define REG_STR_SIZE	64
  1326	
  1327	static struct regulator *create_regulator(struct regulator_dev *rdev,
  1328						  struct device *dev,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 40606 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-21 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-21 12:06 [PATCH] regulator: core: Add debugfs to show constraint flags Richard Fitzgerald
2016-04-21 12:23 ` kbuild test robot
2016-04-21 12:30 ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.