From: "Barnabás Pőcze" <pobrn@protonmail.com>
To: platform-driver-x86@vger.kernel.org,
Hans de Goede <hdegoede@redhat.com>,
Mark Gross <mgross@linux.intel.com>,
Ike Panhc <ike.pan@canonical.com>
Subject: [PATCH 17/24] platform/x86: ideapad-laptop: change 'cfg' debugfs file format
Date: Wed, 16 Dec 2020 01:40:18 +0000 [thread overview]
Message-ID: <20201216013857.360987-18-pobrn@protonmail.com> (raw)
Return -ENODATA when the driver-specific data is not available.
Minor formatting changes. Use seq_puts() where possible.
Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index b1b77eb31779..f5a1d7041aab 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -298,41 +298,44 @@ static int debugfs_cfg_show(struct seq_file *s, void *data)
{
struct ideapad_private *priv = s->private;
- if (!priv) {
- seq_printf(s, "cfg: N/A\n");
- } else {
- seq_printf(s, "cfg: 0x%.8lX\n\nCapability: ",
- priv->cfg);
- if (test_bit(CFG_CAP_BT_BIT, &priv->cfg))
- seq_printf(s, "Bluetooth ");
- if (test_bit(CFG_CAP_3G_BIT, &priv->cfg))
- seq_printf(s, "3G ");
- if (test_bit(CFG_CAP_WIFI_BIT, &priv->cfg))
- seq_printf(s, "Wireless ");
- if (test_bit(CFG_CAP_CAM_BIT, &priv->cfg))
- seq_printf(s, "Camera ");
- if (test_bit(CFG_CAP_TOUCHPAD_BIT, &priv->cfg))
- seq_printf(s, "Touchpad ");
- seq_printf(s, "\nGraphic: ");
- switch ((priv->cfg)&0x700) {
- case 0x100:
- seq_printf(s, "Intel");
- break;
- case 0x200:
- seq_printf(s, "ATI");
- break;
- case 0x300:
- seq_printf(s, "Nvidia");
- break;
- case 0x400:
- seq_printf(s, "Intel and ATI");
- break;
- case 0x500:
- seq_printf(s, "Intel and Nvidia");
- break;
- }
- seq_printf(s, "\n");
+ if (!priv)
+ return -ENODATA;
+
+ seq_printf(s, "_CFG: %#010lx\n\n", priv->cfg);
+
+ seq_puts(s, "Capabilities:");
+ if (test_bit(CFG_CAP_BT_BIT, &priv->cfg))
+ seq_puts(s, " bluetooth");
+ if (test_bit(CFG_CAP_3G_BIT, &priv->cfg))
+ seq_puts(s, " 3G");
+ if (test_bit(CFG_CAP_WIFI_BIT, &priv->cfg))
+ seq_puts(s, " wifi");
+ if (test_bit(CFG_CAP_CAM_BIT, &priv->cfg))
+ seq_puts(s, " camera");
+ if (test_bit(CFG_CAP_TOUCHPAD_BIT, &priv->cfg))
+ seq_puts(s, " touchpad");
+ seq_puts(s, "\n");
+
+ seq_puts(s, "Graphics:");
+ switch (priv->cfg & 0x700) {
+ case 0x100:
+ seq_puts(s, "Intel");
+ break;
+ case 0x200:
+ seq_puts(s, "ATI");
+ break;
+ case 0x300:
+ seq_puts(s, "Nvidia");
+ break;
+ case 0x400:
+ seq_puts(s, "Intel and ATI");
+ break;
+ case 0x500:
+ seq_puts(s, "Intel and Nvidia");
+ break;
}
+ seq_puts(s, "\n");
+
return 0;
}
DEFINE_SHOW_ATTRIBUTE(debugfs_cfg);
--
2.29.2
reply other threads:[~2020-12-16 1:41 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=20201216013857.360987-18-pobrn@protonmail.com \
--to=pobrn@protonmail.com \
--cc=hdegoede@redhat.com \
--cc=ike.pan@canonical.com \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@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