Skip to contentSkip to conversation

powerpc/scom: Replace debugfs interface with cleaner sysfs one

PATCH In review Benjamin Herrenschmidt 2 participants 3 messages Oct 10, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 powerpc/scom: Replace debugfs interface with cleaner sysfs one

The debugfs interface was essentially unused, and racy for anything other than manual use by a developer. This provides a more useful sysfs based one which can be used by programs without racing with each other essentially by providing a file to read/write with an offset being the scom address << 8.

It requires 8 bytes aligned and multiple of 8 bytes sized accesses

---
 arch/powerpc/configs/chroma_defconfig |   2 +-
 arch/powerpc/sysdev/Kconfig           |   6 +-
 arch/powerpc/sysdev/scom.c            | 210 +++++++++++++++++++++-------------
 3 files changed, 135 insertions(+), 83 deletions(-)
arch/powerpc/configs/chroma_defconfig +1 -1
index 4f35fc4..2891464 100644
@@ -42,7 +42,7 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
 CONFIG_MODVERSIONS=y
 CONFIG_MODULE_SRCVERSION_ALL=y
-CONFIG_SCOM_DEBUGFS=y
+CONFIG_SCOM_SYSFS=y
 CONFIG_PPC_A2_DD2=y
 CONFIG_KVM_GUEST=y
 CONFIG_NO_HZ=y
arch/powerpc/sysdev/Kconfig +3 -3
index 13ec968..30c26bb 100644
@@ -26,9 +26,9 @@ source "arch/powerpc/sysdev/xics/Kconfig"
 config PPC_SCOM
 	bool
 
-config SCOM_DEBUGFS
-	bool "Expose SCOM controllers via debugfs"
-	depends on PPC_SCOM && DEBUG_FS
+config SCOM_SYSFS
+	bool "Expose SCOM controllers via sysfs"
+	depends on PPC_SCOM
 	default n
 
 config GE_FPGA
arch/powerpc/sysdev/scom.c +131 -79

256 lines not on this page · raw message

#1 lore raw
Quoted 5 lines · Benjamin Herrenschmidt

The debugfs interface was essentially unused, and racy for anything other than manual use by a developer. This provides a more useful sysfs based one which can be used by programs without racing with each other essentially by providing a file to read/write with an offset being the scom address << 8.

Don't you mean address << 3 (or address * 8)?

Paul.

#2 lore raw
Quoted 8 lines · Paul Mackerras
Quoted 5 lines · Benjamin Herrenschmidt

The debugfs interface was essentially unused, and racy for anything other than manual use by a developer. This provides a more useful sysfs based one which can be used by programs without racing with each other essentially by providing a file to read/write with an offset being the scom address << 8.

Don't you mean address << 3 (or address * 8)?

Yes, typo in the comment, the code is fine. I was tired :)

Cheers,
Ben.