A simple helper to update module parameter docs. Probably too simple.

Signed-off-by: Jani Nikula <jani.nik...@intel.com>
---
 Documentation/admin-guide/module-parameters/README |  4 ++++
 scripts/modparams-docs-update                      | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100755 scripts/modparams-docs-update

diff --git a/Documentation/admin-guide/module-parameters/README 
b/Documentation/admin-guide/module-parameters/README
index 38e34f83bdc7..99618f11300a 100644
--- a/Documentation/admin-guide/module-parameters/README
+++ b/Documentation/admin-guide/module-parameters/README
@@ -8,3 +8,7 @@ To add a new file, run:
 
 Make sure you do this with a recently built module.ko! Review and commit the
 changes afterwards.
+
+To update all .rst files for which a .ko exists, run:
+
+       $ scripts/modparams-docs-update
diff --git a/scripts/modparams-docs-update b/scripts/modparams-docs-update
new file mode 100755
index 000000000000..67a8437ab780
--- /dev/null
+++ b/scripts/modparams-docs-update
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+MODULE_PARAM_DOCS=Documentation/admin-guide/module-parameters
+
+# FIXME: handle objtree
+OBJTREE=.
+
+for rst in $(find $MODULE_PARAM_DOCS -type f -name "*.rst"); do
+       MODULENAME=$(basename -s .rst $rst)
+
+       dupes=0
+       for ko in $(find $OBJTREE -type f -name "${MODULENAME}.ko"); do
+               if [ "$dupes" = "0" ]; then
+                       scripts/modinfo-to-rst $ko > $rst
+                       dupes=1
+               else
+                       echo "$0: $rst has ambiguous source" >&2
+               fi
+       done
+done
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to