From patchwork Tue Dec 5 20:43:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 120754 Delivered-To: patch@linaro.org Received: by 10.80.152.193 with SMTP id j59csp2637127edb; Tue, 5 Dec 2017 12:44:59 -0800 (PST) X-Google-Smtp-Source: AGs4zMadsfcqldI60fMjmBHQPek5KMGdF9Fv4h3R/77akR/LRhfceUmeyHFVMHK/DjSQ8T9ttyHm X-Received: by 10.99.120.73 with SMTP id t70mr18358249pgc.402.1512506699464; Tue, 05 Dec 2017 12:44:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512506699; cv=none; d=google.com; s=arc-20160816; b=yvZSZ5KsC91L8hQFqiZ7qMz48krJr0kysE17cLf1zDTH/slEvqFKLmWE3lal7O0sWc NqBUMZX20U72njGSxT5y4AOK61pm06gplEkonVtp7O7/19SSAb+/0NNQsVd/fTzuVAan wzQOYPSvEFQNZkakkkddSrma2IeCkniHeJLTXcywo5spXafVeRcryY+ImhU8HlzvEn4q kppIL2lIbz581HzPcl7Py0rilhKhHrTZ7NPPcNFzpgNhHGYTDsA7kUk3gJH913Q/MR0M pkyDBjgXiEzDaunyew9gX0Zmqs7QzxfNiSdMw+SkDd0aEevYBDQfY9UghyUJGF6TgwiB z7uQ== 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=XNF1fYFLotlxF2vwLhTatYau+LMruMgPZItf1iEIoaI=; b=gXOPCFF8V9Qlquth0Vic6bePCoBgWm3VGtpd+URefOF3XyEjQ80zGwdRRvgie8bef6 wra8q+nnT7/EMrscSrE/nxVwLcVHY0PeXSwItB6C6eiDPnOAEHOjZoZaElXajZY0h2Lh 1PRR4tNTk1xEB0K+O5W6sIUqFG6qYWwXnoi5K/oXUc6+WM7zYz4b8GfB9PPXw5ylQ1NV pL48okTJJIPAFYrHh11JUluNXIG2H+MUO8DQkPqmxOMNdRFuSfAGaS7KFILnXFrzneWr HK4HKIDBriRQm9UIKZ50BEnvqUcFV5eLeyL8bDjdyUddvAgSsmcCIsDEi2LC47s2/9L4 136w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MobE5ppT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 d6si590290pgn.792.2017.12.05.12.44.58; Tue, 05 Dec 2017 12:44:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MobE5ppT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752437AbdLEUo5 (ORCPT + 28 others); Tue, 5 Dec 2017 15:44:57 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:28895 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752078AbdLEUow (ORCPT ); Tue, 5 Dec 2017 15:44:52 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id vB5Khbka007856; Tue, 5 Dec 2017 14:43:38 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1512506618; bh=GcPI6mHxn8WOaTr3oh+QJke+GUK16jwS8hKtPIk+Zg8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MobE5ppTuxs0HdQ05xBb3AjLDPryX2dqjV7lb+u3q98Kd7w9ilD/XuwRaiTFaQfeM 1B5B332ngBsNUDBeKoyBf9d9NPEIRbIY15rYQ6WXv46i2fwFPGN4+cWGSly09kdzYf M8Bn3tJuNMsm7DKTBkqVnpMZ6mTFT6bvsOb+Yd1c= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB5KhW9p016989; Tue, 5 Dec 2017 14:43:32 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 5 Dec 2017 14:43:32 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 5 Dec 2017 14:43:32 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB5KhWUH010504; Tue, 5 Dec 2017 14:43:32 -0600 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.93.77]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id vB5KhW325073; Tue, 5 Dec 2017 14:43:32 -0600 (CST) From: Dan Murphy To: , , , , CC: , , , Dan Murphy Subject: [PATCH v2 3/6] leds: lp8860: Update the dt parsing for LED labeling Date: Tue, 5 Dec 2017 14:43:24 -0600 Message-ID: <20171205204327.12111-4-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171205204327.12111-1-dmurphy@ti.com> References: <20171205204327.12111-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- v2 - no changes drivers/leds/leds-lp8860.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 2.15.0.124.g7668cbc60 diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c index 3e70775a2d54..13d6210cba85 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", + np->name, name); + else + snprintf(led->label, sizeof(led->label), + "%s::display_cluster", np->name); } led->enable_gpio = devm_gpiod_get_optional(&client->dev,