From patchwork Tue Dec 12 21:50: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: 121656 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4672415qgn; Tue, 12 Dec 2017 13:52:26 -0800 (PST) X-Google-Smtp-Source: ACJfBov2Me6CB1HxxKvNZ6cbH3CMeb2gHoTUPAcd9UqjI2QLe+fFwHX0iglc2lcEJ+u/h7j/EEDV X-Received: by 10.98.27.3 with SMTP id b3mr3668439pfb.159.1513115545904; Tue, 12 Dec 2017 13:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513115545; cv=none; d=google.com; s=arc-20160816; b=rTyof0yV4lZHikcunKNHsHWx7Wq39P5fZCC24MtIXsiXmRUUFR+k8+PpzOjokb5K8F 5Z1IQGUHUz2ZQL8uANSSGdh8w/oiQtvcZzYeupUzRqf8ujE0D+w11h7RSQ9ZOVZhOOiW F+18hDfgsAtIHNH+g0P+b6eZ0t8NMUe2mi2SYOZe/6slBNDhq9IC+qNFAhj0tsE/K0BU ToVj1FmJ8XXsoO5Tdnn2764SALRRS/b/aFQUCbtNP1kR1/ZlRfIC0yjQrgQHmUtj8TZZ wjFtWk8xEyZ1KcJe7df61i8f5TXCHgpHaxF15mLEMSXKCFu3GPuXJn/jEoz1KSGfRNuu NTxQ== 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=zLgK2MLVIY/f2ZT5s4qAlI+1iFwCJToVs5MsBUj8uVg=; b=F5/XdWrarRFiX+Rq9hGnbz/bx/oS257+8KExGA6ExYNXR/d6bWBRQDta0FXyocqjmO 8FKWAM2nx39a9gHFeoZbVs460b5n0lFhBMpx9RJ660z/Gk3CzOa7ER9RqHGyPBaRcB5X vKtAw0eev/VFaJ7iORtFgyfEH15F8DdpQuyr50g33aHrqIny/Iz86gX7qDVeRsNnki+d 9eyL/H3ryRoFGz67/pQfY0RBv64SebD8DIdPZPDgzg6lLkRTkh13bUAKztg/78xWg6Hz QfFroPdH1JJKe781+RqD6D/SAfKU0xFdPdUyutXmn/acDBHvh+EVI7nYDUM1sBq2TC2U C3Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UvX583RS; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 t4si106932plb.550.2017.12.12.13.52.25 for ; Tue, 12 Dec 2017 13:52:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-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=UvX583RS; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 S1752598AbdLLVwZ (ORCPT ); Tue, 12 Dec 2017 16:52:25 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:55680 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752570AbdLLVwY (ORCPT ); Tue, 12 Dec 2017 16:52:24 -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 vBCLoYh4011775; Tue, 12 Dec 2017 15:50:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1513115434; bh=xTcTHf+hOzsTS8V5ORrhx7HtYOItuzwpXQfDgq5zjys=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UvX583RSJk4d43mqNSlDV1bqvQcfJpYKYSj6DMT5+wPNhCVl0jCTts+3OdOAabphk 9lm2djqGSRqcBzztp4tJIWzT2M85Ejo6XS2Eq/vVC9SkSlxmcpSd5+FesN93k/19uH oUySWBrtf0wJPd5I6Sldw0DbwPWvI46IaQUDRuuk= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCLoTHx022767; Tue, 12 Dec 2017 15:50:29 -0600 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE112.ent.ti.com (157.170.170.23) 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 15:50:28 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE108.ent.ti.com (157.170.170.38) 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 15:50:28 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vBCLoS53026354; Tue, 12 Dec 2017 15:50:28 -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 vBCLoSx10127; Tue, 12 Dec 2017 15:50:28 -0600 (CST) From: Dan Murphy To: , , , , , , CC: , , , Dan Murphy Subject: [RFC PATCH 2/2] leds: as3645a: Update LED label generation Date: Tue, 12 Dec 2017 15:50:24 -0600 Message-ID: <20171212215024.30116-2-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20171212215024.30116-1-dmurphy@ti.com> References: <20171212215024.30116-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Generate the LED label based off either the DT label node or off the I2C ID in the i2c device id struct. If the label is used then this should denote the LED function. As an example it would be as3645a: Otherwise if the label is not used the LED label will be as3645a:flash and as3645a:indicator. Signed-off-by: Dan Murphy --- drivers/leds/leds-as3645a.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.15.0.124.g7668cbc60 diff --git a/drivers/leds/leds-as3645a.c b/drivers/leds/leds-as3645a.c index f883616d9e60..197acd69ddcc 100644 --- a/drivers/leds/leds-as3645a.c +++ b/drivers/leds/leds-as3645a.c @@ -526,10 +526,11 @@ static int as3645a_parse_node(struct as3645a *flash, rval = of_property_read_string(flash->flash_node, "label", &name); if (!rval) - strlcpy(names->flash, name, sizeof(names->flash)); + snprintf(names->flash, sizeof(names->flash), "%s:%s", + id->name, name); else snprintf(names->flash, sizeof(names->flash), - "%s:flash", node->name); + "%s:flash", id->name); rval = of_property_read_u32(flash->flash_node, "flash-timeout-us", &cfg->flash_timeout_us); @@ -570,10 +571,11 @@ static int as3645a_parse_node(struct as3645a *flash, rval = of_property_read_string(flash->indicator_node, "label", &name); if (!rval) - strlcpy(names->indicator, name, sizeof(names->indicator)); + snprintf(names->indicator, sizeof(names->indicator), "%s:%s", + id->name, name); else snprintf(names->indicator, sizeof(names->indicator), - "%s:indicator", node->name); + "%s:indicator", id->name); rval = of_property_read_u32(flash->indicator_node, "led-max-microamp", &cfg->indicator_max_ua);