Skip to contentSkip to conversation

spmi: regmap: enable userspace writes

PATCH In review Kiran Gunda 3 participants 4 messages Sep 29, 2016 – Oct 3, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spmi: regmap: enable userspace writes

Being able to write to spmi registers via userspace is required for quick debug and development. Enable it.

The regmap framework uses dev_name to create debugfs dir names. So update the spmi devices to have proper names.

---
 drivers/base/regmap/regmap-debugfs.c | 2 +-
 drivers/spmi/spmi.c                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap-debugfs.c +1 -1
index 1ee3d40..061e771 100644
@@ -259,7 +259,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
 				   count, ppos);
 }
 
-#undef REGMAP_ALLOW_WRITE_DEBUGFS
+#define REGMAP_ALLOW_WRITE_DEBUGFS
 #ifdef REGMAP_ALLOW_WRITE_DEBUGFS
 /*
  * This can be dangerous especially when we have clients such as
drivers/spmi/spmi.c +1 -1
index 2b9b094..d7a0106 100644
@@ -70,7 +70,7 @@ int spmi_device_add(struct spmi_device *sdev)
 	struct spmi_controller *ctrl = sdev->ctrl;
 	int err;
 
-	dev_set_name(&sdev->dev, "%d-%02x", ctrl->nr, sdev->usid);
+	dev_set_name(&sdev->dev, "spmi%d-%02x", ctrl->nr, sdev->usid);
 
 	err = device_add(&sdev->dev);
 	if (err < 0) {
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#1 lore raw

drivers/base/regmap/regmap-debugfs.c static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, · line 262

Quoted 2 lines · Kiran Gunda
drivers/base/regmap/regmap-debugfs.c +1 -1
-#undef REGMAP_ALLOW_WRITE_DEBUGFS
+#define REGMAP_ALLOW_WRITE_DEBUGFS

This is completely inappropriate for upstream, if you need to do debugging on your platform you can enable this locally but enabling random writes from userspace to any regmap device is really not a good idea for system stablity or robustness.

#2 lore raw
Quoted 9 lines · Mark Brown

drivers/base/regmap/regmap-debugfs.c static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, · line 262

Quoted 2 lines · Kiran Gunda
drivers/base/regmap/regmap-debugfs.c +1 -1
-#undef REGMAP_ALLOW_WRITE_DEBUGFS
+#define REGMAP_ALLOW_WRITE_DEBUGFS

This is completely inappropriate for upstream, if you need to do debugging on your platform you can enable this locally but enabling random writes from userspace to any regmap device is really not a good idea for system stablity or robustness.

Sure. I will remove this change and send the next version only to update the spmi device name.

#3 lore raw
Quoted 11 lines · On 09/30, [email protected] wrote:
Quoted 9 lines · Mark Brown

drivers/base/regmap/regmap-debugfs.c static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, · line 262

Quoted 2 lines · Kiran Gunda
drivers/base/regmap/regmap-debugfs.c +1 -1
-#undef REGMAP_ALLOW_WRITE_DEBUGFS
+#define REGMAP_ALLOW_WRITE_DEBUGFS

This is completely inappropriate for upstream, if you need to do debugging on your platform you can enable this locally but enabling random writes from userspace to any regmap device is really not a good idea for system stablity or robustness.

Quoted 2 lines

Sure. I will remove this change and send the next version only to update the spmi device name.

Why? The device name looks fine.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project