From patchwork Tue Dec 12 18:58:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 121628 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4502127qgn; Tue, 12 Dec 2017 10:59:43 -0800 (PST) X-Google-Smtp-Source: ACJfBovCYff5Nd7MrvM9Y9/j5v/x6NW1Gb30s8rmE5L/viDPiLcuot/i6hnUeBkDQezaXQj96oWT X-Received: by 10.159.242.132 with SMTP id u4mr3228199plr.296.1513105183230; Tue, 12 Dec 2017 10:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513105183; cv=none; d=google.com; s=arc-20160816; b=ycjjyOpCfy7A/V4M7lqfTMkn9mKaE7aQo0Kl+WRX4zoVL10enBwsQU6mJ09SGdES61 EMXoYQxnKjofsguHfnSW75B3k9FosY1+ZAOYawaLzkkcnVf1xamAsla7XcbeD3i4RnSt OQ+T+1DI1kF+6DxV4+lYt7Gt6Cb9UL3xBmtlWKxDyRLa0VGhpQKV63DasoIKMLZTOezq h2yrYq70h15mOgnyBvs3d9lw1LyX0fBW3HDeK/3MaIBDIPqxNtfyopgerTiBr77MFKDB 4keZmWs0Au0gc/qcU50wUNBp+o9j/z1jXAIpObPP1OAcNursTbpTZ80GIMRVTthDRqls HQTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=90Af/uM0RKDOuDgLCuov82mdhAoesvnI+rc9qjBlG4w=; b=IlJzEf/xPmmPGjXFS8j4Tugj7GVhjId8P72C+WR39DYky/PALCsl/DSrwMunr48GfQ paGgdXH6/UTcugyBtptO5Gkw4nY9P9fr6xD4JN2bfRt6BRbp+NK8x/OUzt9JrC2WmLy7 IBjwANaFeGxteLwoKt4mHiZHVd8dLUtClIfNxvbpdogQTqey+z50BzSikRSixUzBD+yn Vth79gfkzqcz2VF61Xx1EwQNS5cFQOESoyA13WB4p1ccghaVaE0dsF+D1fQd2zL7VPQn AVjn0ScjwRUYNprmG9K4pTVHKobKxkOAAaAF2XnscrO8NFB9lBpZEdz18lO2DiNS9PbQ UALQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Btny1NX6; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p124si11902579pga.20.2017.12.12.10.59.43; Tue, 12 Dec 2017 10:59:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Btny1NX6; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbdLLS7k (ORCPT + 6 others); Tue, 12 Dec 2017 13:59:40 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:50239 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751871AbdLLS7f (ORCPT ); Tue, 12 Dec 2017 13:59:35 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id vBCIwKEY018531; Tue, 12 Dec 2017 12:58:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513105100; bh=k4nlTNMUqP0nxGfT27BOcZT4nGXAYTujN/94nyjs+SA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Btny1NX6CmPVYw4sHNljV40Xbys3NMHzIgEyFbZoCenmUbXzFmLICFr6kODNojCUX ZpoAyOA7wORNVj6uPtaE0YD9FzkjDzKdwlEgH9FHz4R2YY8TFpEyjhVHsjIMzAzABd mTKNAAZ9fdMvzpV9/NXnpMP+WWQmnD6XzYLkVr88= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCIwFZI002138; Tue, 12 Dec 2017 12:58:15 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 12 Dec 2017 12:58:15 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 12 Dec 2017 12:58:15 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCIwFPk002988; Tue, 12 Dec 2017 12:58:15 -0600 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.69.253]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id vBCIwEx25376; Tue, 12 Dec 2017 12:58:14 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v3 3/6] leds: lp8860: Update the dt parsing for LED labeling Date: Tue, 12 Dec 2017 12:58:06 -0600 Message-ID: <20171212185809.23880-5-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171212185809.23880-1-dmurphy@ti.com> References: <20171212185809.23880-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Update the DT parsing for the label node so that the label is retrieved from the device child as opposed to being part of the parent. This will align this driver with the LED binding documentation Documentation/devicetree/bindings/leds/common.txt Signed-off-by: Dan Murphy --- v3 - Changed the label generation to pull the name from the i2c device id as opposed to pulling the id from the parent dt node since that will just be led-controller - https://patchwork.kernel.org/patch/10093753/ v2 - no changes drivers/leds/leds-lp8860.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 2.15.0.124.g7668cbc60 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index 3e70775a2d54..bc432764c99d 100644 --- a/drivers/leds/leds-lp8860.c +++ b/drivers/leds/leds-lp8860.c @@ -22,6 +22,7 @@ #include #include #include +#include #define LP8860_DISP_CL1_BRT_MSB 0x00 #define LP8860_DISP_CL1_BRT_LSB 0x01 @@ -86,8 +87,6 @@ #define LP8860_CLEAR_FAULTS 0x01 -#define LP8860_DISP_LED_NAME "display_cluster" - /** * struct lp8860_led - * @lock - Lock for reading/writing the device @@ -107,7 +106,7 @@ struct lp8860_led { struct regmap *eeprom_regmap; struct gpio_desc *enable_gpio; struct regulator *regulator; - const char *label; + char label[LED_MAX_NAME_SIZE]; }; struct lp8860_eeprom_reg { @@ -365,19 +364,21 @@ static int lp8860_probe(struct i2c_client *client, int ret; struct lp8860_led *led; struct device_node *np = client->dev.of_node; + struct device_node *child_node; + const char *name; led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); if (!led) return -ENOMEM; - led->label = LP8860_DISP_LED_NAME; - - if (client->dev.of_node) { - ret = of_property_read_string(np, "label", &led->label); - if (ret) { - dev_err(&client->dev, "Missing label in dt\n"); - return -EINVAL; - } + for_each_available_child_of_node(np, child_node) { + ret = of_property_read_string(child_node, "label", &name); + if (!ret) + snprintf(led->label, sizeof(led->label), "%s:%s", + id->name, name); + else + snprintf(led->label, sizeof(led->label), + "%s::display_cluster", id->name); } led->enable_gpio = devm_gpiod_get_optional(&client->dev,