aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome
diff options
context:
space:
mode:
authorClinton Sprain <clintonsprain@gmail.com>2016-05-11 14:05:35 -0400
committerOlof Johansson <olof@lixom.net>2016-05-11 14:55:47 -0400
commitd940f3065c120af233d36933e94ebb577a695b44 (patch)
treee7a9edbc0fb5cea521998ab8c2cbc0d331f4cf16 /drivers/platform/chrome
parent5d749d0bbe811c10d9048cde6dfebc761713abfd (diff)
platform/chrome: cros_ec_lightbar - use name instead of ID to hide lightbar attributes
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> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r--drivers/platform/chrome/cros_ec_lightbar.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index a79fb86e1fb9..8df3d447cacf 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -413,7 +413,12 @@ static umode_t cros_ec_lightbar_attrs_are_visible(struct kobject *kobj,
413 struct cros_ec_dev *ec = container_of(dev, 413 struct cros_ec_dev *ec = container_of(dev,
414 struct cros_ec_dev, class_dev); 414 struct cros_ec_dev, class_dev);
415 struct platform_device *pdev = to_platform_device(ec->dev); 415 struct platform_device *pdev = to_platform_device(ec->dev);
416 if (pdev->id != 0) 416 struct cros_ec_platform *pdata = pdev->dev.platform_data;
417 int is_cros_ec;
418
419 is_cros_ec = strcmp(pdata->ec_name, CROS_EC_DEV_NAME);
420
421 if (is_cros_ec != 0)
417 return 0; 422 return 0;
418 423
419 /* Only instantiate this stuff if the EC has a lightbar */ 424 /* Only instantiate this stuff if the EC has a lightbar */