From 5b7d127726de6eed4b900bc3bbb167837690818f Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Sat, 21 Apr 2018 18:55:29 -0500 Subject: rpmsg: Correct support for MODULE_DEVICE_TABLE() Due to missing a missing entry in file2alias.c MODULE_DEVICE_TABLE() are not generating the proper module aliases. Add the needed entry here. Fixes: bcabbccabffe ("rpmsg: add virtio-based remote processor messaging bus") Reported-by: Suman Anna Signed-off-by: Andrew F. Davis Signed-off-by: Greg Kroah-Hartman --- scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 11 +++++++++++ 2 files changed, 14 insertions(+) (limited to 'scripts') diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index 9fad6afe4c41..6667f7b491d6 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -139,6 +139,9 @@ int main(void) DEVID(hv_vmbus_device_id); DEVID_FIELD(hv_vmbus_device_id, guid); + DEVID(rpmsg_device_id); + DEVID_FIELD(rpmsg_device_id, name); + DEVID(i2c_device_id); DEVID_FIELD(i2c_device_id, name); diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index b9beeaa4695b..52fd54a8fe39 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -944,6 +944,17 @@ static int do_vmbus_entry(const char *filename, void *symval, } ADD_TO_DEVTABLE("vmbus", hv_vmbus_device_id, do_vmbus_entry); +/* Looks like: rpmsg:S */ +static int do_rpmsg_entry(const char *filename, void *symval, + char *alias) +{ + DEF_FIELD_ADDR(symval, rpmsg_device_id, name); + sprintf(alias, RPMSG_DEVICE_MODALIAS_FMT, *name); + + return 1; +} +ADD_TO_DEVTABLE("rpmsg", rpmsg_device_id, do_rpmsg_entry); + /* Looks like: i2c:S */ static int do_i2c_entry(const char *filename, void *symval, char *alias) -- cgit v1.2.3 From 4169bc43dbdd6c08436a7d794844b1f09a6367ae Mon Sep 17 00:00:00 2001 From: Alexander Kapshuk Date: Sat, 12 May 2018 12:02:30 +0300 Subject: ver_linux: Move stderr redirection from function parameter to function body Remove stderr redirection to stdout from all the parameters to the version() function, and put it with the body of the version() function instead. This improves code readability. Signed-off-by: Alexander Kapshuk Signed-off-by: Greg Kroah-Hartman --- scripts/ver_linux | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'scripts') diff --git a/scripts/ver_linux b/scripts/ver_linux index 545ec7388eb7..0b301bd1637d 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -13,23 +13,23 @@ BEGIN { system("uname -a") printf("\n") - printversion("GNU C", version("gcc -dumpversion 2>&1")) - printversion("GNU Make", version("make --version 2>&1")) - printversion("Binutils", version("ld -v 2>&1")) - printversion("Util-linux", version("mount --version 2>&1")) - printversion("Mount", version("mount --version 2>&1")) - printversion("Module-init-tools", version("depmod -V 2>&1")) - printversion("E2fsprogs", version("tune2fs 2>&1")) - printversion("Jfsutils", version("fsck.jfs -V 2>&1")) - printversion("Reiserfsprogs", version("reiserfsck -V 2>&1")) - printversion("Reiser4fsprogs", version("fsck.reiser4 -V 2>&1")) - printversion("Xfsprogs", version("xfs_db -V 2>&1")) - printversion("Pcmciautils", version("pccardctl -V 2>&1")) - printversion("Pcmcia-cs", version("cardmgr -V 2>&1")) - printversion("Quota-tools", version("quota -V 2>&1")) - printversion("PPP", version("pppd --version 2>&1")) - printversion("Isdn4k-utils", version("isdnctrl 2>&1")) - printversion("Nfs-utils", version("showmount --version 2>&1")) + printversion("GNU C", version("gcc -dumpversion")) + printversion("GNU Make", version("make --version")) + printversion("Binutils", version("ld -v")) + printversion("Util-linux", version("mount --version")) + printversion("Mount", version("mount --version")) + printversion("Module-init-tools", version("depmod -V")) + printversion("E2fsprogs", version("tune2fs")) + printversion("Jfsutils", version("fsck.jfs -V")) + printversion("Reiserfsprogs", version("reiserfsck -V")) + printversion("Reiser4fsprogs", version("fsck.reiser4 -V")) + printversion("Xfsprogs", version("xfs_db -V")) + printversion("Pcmciautils", version("pccardctl -V")) + printversion("Pcmcia-cs", version("cardmgr -V")) + printversion("Quota-tools", version("quota -V")) + printversion("PPP", version("pppd --version")) + printversion("Isdn4k-utils", version("isdnctrl")) + printversion("Nfs-utils", version("showmount --version")) if (system("test -r /proc/self/maps") == 0) { while (getline <"/proc/self/maps" > 0) { @@ -42,7 +42,7 @@ BEGIN { } } - printversion("Dynamic linker (ldd)", version("ldd --version 2>&1")) + printversion("Dynamic linker (ldd)", version("ldd --version")) while ("ldconfig -p 2>/dev/null" | getline > 0) { if (/(libg|stdc)[+]+\.so/) { @@ -53,14 +53,14 @@ BEGIN { if (system("test -r " libcpp) == 0) printversion("Linux C++ Library", version("readlink " libcpp)) - printversion("Procps", version("ps --version 2>&1")) - printversion("Net-tools", version("ifconfig --version 2>&1")) - printversion("Kbd", version("loadkeys -V 2>&1")) - printversion("Console-tools", version("loadkeys -V 2>&1")) - printversion("Oprofile", version("oprofiled --version 2>&1")) - printversion("Sh-utils", version("expr --v 2>&1")) - printversion("Udev", version("udevadm --version 2>&1")) - printversion("Wireless-tools", version("iwconfig --version 2>&1")) + printversion("Procps", version("ps --version")) + printversion("Net-tools", version("ifconfig --version")) + printversion("Kbd", version("loadkeys -V")) + printversion("Console-tools", version("loadkeys -V")) + printversion("Oprofile", version("oprofiled --version")) + printversion("Sh-utils", version("expr --v")) + printversion("Udev", version("udevadm --version")) + printversion("Wireless-tools", version("iwconfig --version")) if (system("test -r /proc/modules") == 0) { while ("sort /proc/modules" | getline > 0) { @@ -72,6 +72,7 @@ BEGIN { } function version(cmd, ver) { + cmd = cmd " 2>&1" while (cmd | getline > 0) { if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) { ver = substr($0, RSTART, RLENGTH) -- cgit v1.2.3 From 1c9a4be514e7a946f7811f10d6d0ebab1ec6dd56 Mon Sep 17 00:00:00 2001 From: Alexander Kapshuk Date: Sat, 12 May 2018 12:02:31 +0300 Subject: ver_linux: Drop redundant calls to system() to test if file is readable Running 'test -r' on an awk variable name whose value is an empty string results in test being run with no arguments, and causes system() to return 0, which indicates success when used to test values returned by function calls. This results in code within the if blocks being run when it should not be. Instead of testing if a file is accessible and readable via calls to system("test -r " file), rely on the value returned by getline to perform this kind of testing. Getline returns -1 on error, with the code within the while loops not being run. Signed-off-by: Alexander Kapshuk Signed-off-by: Greg Kroah-Hartman --- scripts/ver_linux | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'scripts') diff --git a/scripts/ver_linux b/scripts/ver_linux index 0b301bd1637d..7227994ccf63 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -31,14 +31,12 @@ BEGIN { printversion("Isdn4k-utils", version("isdnctrl")) printversion("Nfs-utils", version("showmount --version")) - if (system("test -r /proc/self/maps") == 0) { - while (getline <"/proc/self/maps" > 0) { - n = split($0, procmaps, "/") - if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { - ver = substr(procmaps[n], RSTART, RLENGTH) - printversion("Linux C Library", ver) - break - } + while (getline <"/proc/self/maps" > 0) { + n = split($0, procmaps, "/") + if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { + ver = substr(procmaps[n], RSTART, RLENGTH) + printversion("Linux C Library", ver) + break } } @@ -50,9 +48,7 @@ BEGIN { break } } - if (system("test -r " libcpp) == 0) - printversion("Linux C++ Library", version("readlink " libcpp)) - + printversion("Linux C++ Library", version("readlink " libcpp)) printversion("Procps", version("ps --version")) printversion("Net-tools", version("ifconfig --version")) printversion("Kbd", version("loadkeys -V")) @@ -62,13 +58,11 @@ BEGIN { printversion("Udev", version("udevadm --version")) printversion("Wireless-tools", version("iwconfig --version")) - if (system("test -r /proc/modules") == 0) { - while ("sort /proc/modules" | getline > 0) { - mods = mods sep $1 - sep = " " - } - printversion("Modules Loaded", mods) + while ("sort /proc/modules" | getline > 0) { + mods = mods sep $1 + sep = " " } + printversion("Modules Loaded", mods) } function version(cmd, ver) { -- cgit v1.2.3