From: Clinton Sprain <clintonsprain@gmail.com>
To: olof@lixom.net
Cc: gwendal@chromium.org, linux-kernel@vger.kernel.org,
Clinton Sprain <clintonsprain@gmail.com>
Subject: [PATCH] platform/chrome: cros_ec_lightbar - use name instead of ID to hide lightbar attributes
Date: Tue, 8 Mar 2016 22:36:24 -0600 [thread overview]
Message-ID: <1457498184-4170-1-git-send-email-clintonsprain@gmail.com> (raw)
Lightbar attributes are hidden if the ID of the device is not 0
(the assumption being that 0 = cros_ec = might have a lightbar,
1 = cros_pd = hide); however, sometimes these devices get IDs 1
and 2 (or something else) instead of IDs 0 and 1. This prevents
the lightbar attributes from appearing when they should.
Proposed change is to instead check whether the name assigned to
the device is CROS_EC_DEV_NAME (true for cros_ec, false for cros_pd).
Signed-off-by: Clinton Sprain <clintonsprain@gmail.com>
---
drivers/platform/chrome/cros_ec_lightbar.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index ff76405..b6356b3 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -414,7 +414,12 @@ static umode_t cros_ec_lightbar_attrs_are_visible(struct kobject *kobj,
struct cros_ec_dev, class_dev);
struct platform_device *pdev = container_of(ec->dev,
struct platform_device, dev);
- if (pdev->id != 0)
+ struct cros_ec_platform *pdata = pdev->dev.platform_data;
+ int is_cros_ec;
+
+ is_cros_ec = strcmp(pdata->ec_name, CROS_EC_DEV_NAME);
+
+ if (is_cros_ec != 0)
return 0;
/* Only instantiate this stuff if the EC has a lightbar */
--
2.5.0
next reply other threads:[~2016-03-09 4:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 4:36 Clinton Sprain [this message]
2016-05-11 18:04 ` Olof Johansson
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=1457498184-4170-1-git-send-email-clintonsprain@gmail.com \
--to=clintonsprain@gmail.com \
--cc=gwendal@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olof@lixom.net \
/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
all inboxes | Powered by JetHome®