From: Clinton Sprain Date: Wed, 11 May 2016 18:05:35 +0000 (-0700) Subject: platform/chrome: cros_ec_lightbar - use name instead of ID to hide lightbar attributes X-Git-Tag: v4.7-rc1~10^2~4 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=d940f3065c120af233d36933e94ebb577a695b44;p=linux.git 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 Signed-off-by: Olof Johansson --- 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, struct cros_ec_dev *ec = container_of(dev, struct cros_ec_dev, class_dev); struct platform_device *pdev = to_platform_device(ec->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 */