From: Shuah Khan <skhan@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Shuah Khan <skhan@linuxfoundation.org>
Subject: [PATCH] tools:leds: add support for platform acpi led devices
Date: Tue, 10 Jan 2023 13:42:01 -0700 [thread overview]
Message-ID: <20230110204201.35482-1-skhan@linuxfoundation.org> (raw)
Add support to parse platform acpi led devices. Use modalias
to extract product and driver name as defined in:
Documentation/ABI/testing/sysfs-bus-platform
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
tools/leds/get_led_device_info.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/leds/get_led_device_info.sh b/tools/leds/get_led_device_info.sh
index ccfa442db5fe..a085a8ffe7c9 100755
--- a/tools/leds/get_led_device_info.sh
+++ b/tools/leds/get_led_device_info.sh
@@ -72,8 +72,13 @@ elif [ $of_node_missing -eq 0 ]; then
manufacturer=`echo $compatible | awk -F, '{print $1}'`
product=`echo $compatible | awk -F, '{print $2}'`
fi
+elif [ "$bus" = "platform" ]; then
+ cd $led_cdev_path
+ product=`cat device/modalias | awk -F: '{print $2}'`
+ driver=`cat device/modalias | awk -F: '{print $2}'`
+ expected_devname=`cat device/modalias | awk -F: '{print $1}'`
else
- echo "Unknown device type."
+ echo "Unknown/unsupported device type." $bus
exit 1
fi
@@ -112,7 +117,6 @@ printf "# LED class device name validation #\n"
printf "####################################\n\n"
led_name=`echo $led_cdev_path | sed s'/.*\///'`
-
num_sections=`echo $led_name | awk -F: '{print NF}'`
if [ $num_sections -eq 1 ]; then
@@ -161,6 +165,8 @@ if [ ! -z "$devicename" ]; then
if [ ! -z "$expected_devname" ]; then
if [ "$devicename" = "$expected_devname" ]; then
print_msg_ok "$S_DEV" "$devicename"
+ elif [ "$bus" = "platform" ]; then
+ print_msg_ok "$S_DEV" "$devicename"
else
print_msg_failed "$S_DEV" "$devicename" "Expected: $expected_devname"
fi
--
2.34.1
reply other threads:[~2023-01-10 20:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230110204201.35482-1-skhan@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox