Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2453954ybi; Sun, 9 Jun 2019 12:11:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPpcM3BIxn21qOWMyPzmGuSm1Ar1SJZdeBNHuFQqsebR+dMWUWFjd7CoTCrU++RaNBST00 X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr26875464plb.76.1560107460642; Sun, 09 Jun 2019 12:11:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560107460; cv=none; d=google.com; s=arc-20160816; b=OK6KgYKq2glZvC3t7iiY7mUczL9rE7Oy52JkzED5PYpilmG+Udq2m+2C6xPzX6kLub GU9tUP2l0yExh7o6xEZrP2SQmej/8iMGz0921y5Z0kRTzi9gVhT0K7qW7fhlJHF5XT1B wk/ua4TWxj6ybPrJi3XdNlCjOhN+RXbxhZW32X/JilaLXX2Ie0vw1pRx4VxndIgqgx3g YTYrA2zFuKPTBmmdLVGZq2nn4txU5vqJJ/Gnpj7zgDZx6qXXFApJyysSfjbqzjSraUcq UHJtK4hJZ63hyLZt0s+dFcvQrlSL2CWbLQ4nmxpEfxriRpi3MojZcGqxXqXhIOizK8Jd VLjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=syrjFnIWviazPR6lJeBGQDU7BxIerQba1dStKQmEHzA=; b=rq1AIv/hKDNXS8EBYSJfhJx2W6h65rJp3ePl2R5yHHQpMVKZhuSE5F7BCWoa65ksU+ 72xcwg/13cgezZF8NfLnSoLTkBcvpKsO7yyhvt8F16USlYsTJLWz7N7Sa37js35fppU4 IRu8eT0oKci57ffL3y93qgu8qA+tk6S3FotHxJHQsx8mFxDBQGR7c+f1I9Xl74KhS0Qt PsRcj8vxkdiD8DPr2vLXhp7xqKH4u0G/JVwFm7fAwiOQdkyNnIfkUCqAQ6cd6TPyh6or UozJwNyON1ZJAl4uESQRmmW88F3dECmbd8+Neusg81HBFFrjjJy8GXcs5SybY+RsmC4R nPDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gkkWLCcX; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si447024pgu.320.2019.06.09.12.10.44; Sun, 09 Jun 2019 12:11:00 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=gkkWLCcX; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730516AbfFITI4 (ORCPT + 99 others); Sun, 9 Jun 2019 15:08:56 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33514 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730367AbfFITIw (ORCPT ); Sun, 9 Jun 2019 15:08:52 -0400 Received: by mail-wm1-f67.google.com with SMTP id h19so7576825wme.0; Sun, 09 Jun 2019 12:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=syrjFnIWviazPR6lJeBGQDU7BxIerQba1dStKQmEHzA=; b=gkkWLCcXD0x4MtILb3QGrqp+lq0jgNkz/bhmBiNs3Jyl0z9wZLgqZEPWIuttSItJ+u alD4T03e8NYi05ImcpDDhR9n6PywILbXXIeKdmP+uovP9CBKiaqk6CgUyTE6nAYr96Of z2vdfC7iCudNb83QeSMu1Nb1KrJT4Dh9DgupFAxpDSf2wP43hG3k9xBsB5SfLoNkusuG 0jmw7ryiyQG/SDAAex8PpOzuJMAmRUb1KnU2OXdJiTEgiKFNyadDxX9KQ3otKk7yD4vT KAraLVwNWOdy4BGxlmUg1eisp/9m133Ot+evP6tq39JAG7bESO+lHY3vPW4LArSYQeCo tJow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=syrjFnIWviazPR6lJeBGQDU7BxIerQba1dStKQmEHzA=; b=Q47O0edTyG1Z1UYs53feiZlfdjonJgdf52Rp7lsdW0jIYQAUmb964cykuAZJCT4ahU gyl8BvUlU/jqtEuJV9yxZM3dsUszDFwKb9YVKYjt8vt9Ef67rmlnzvzXlCWsSivytHwh YsFZIK4AA0ZO1sZqolBIVujXZBHAqO/qvrKy+lozyMjePOYhzhGV0ta/l36Qo3KjISFJ NUbUKSWpT9SMhLNfHvGJgmER7Gp+4fGLAtX+hcgNhVv6YQLQZkg9XbDHVvhPkVHO/BxT /QZZbU+q5JGoj7aMGrD0OBcnPybKfh5YX/D2SwXrhvc8tgsk/9lIlx64+lG0/7ehb7L9 SpfA== X-Gm-Message-State: APjAAAXHv2D4eLIzpPR/UgbB9Vt6pF6ZG9D5t97bvpHZEy9/0vySz5ps gjBPVVau5FGf9yNKvswqv4uAGwcS X-Received: by 2002:a1c:208c:: with SMTP id g134mr10974994wmg.112.1560107329904; Sun, 09 Jun 2019 12:08:49 -0700 (PDT) Received: from myhost.home (ckm12.neoplus.adsl.tpnet.pl. [83.31.88.12]) by smtp.gmail.com with ESMTPSA id y38sm14725041wrd.41.2019.06.09.12.08.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jun 2019 12:08:49 -0700 (PDT) From: Jacek Anaszewski To: linux-leds@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, pavel@ucw.cz, robh@kernel.org, dtor@google.com, linux@roeck-us.net, dmurphy@ti.com, jacek.anaszewski@gmail.com Subject: [PATCH v5 13/26] leds: lm3692x: Use generic support for composing LED names Date: Sun, 9 Jun 2019 21:07:50 +0200 Message-Id: <20190609190803.14815-14-jacek.anaszewski@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190609190803.14815-1-jacek.anaszewski@gmail.com> References: <20190609190803.14815-1-jacek.anaszewski@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to using generic LED support for composing LED class device name. At this occassion remove initialization of struct led_classdev's dev->of_node property in the driver, since now it will be taken from fwnode assigned to struct led_init_data and passed to the new devm_led_classdev_register_ext() API. Signed-off-by: Jacek Anaszewski Tested-by: Dan Murphy Acked-by: Pavel Machek --- drivers/leds/leds-lm3692x.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c index 4f413a7c5f05..3d381f2f73d0 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -13,7 +13,6 @@ #include #include #include -#include #define LM36922_MODEL 0 #define LM36923_MODEL 1 @@ -103,7 +102,6 @@ * @regmap - Devices register map * @enable_gpio - VDDIO/EN gpio to enable communication interface * @regulator - LED supply regulator pointer - * @label - LED label * @led_enable - LED sync to be enabled * @model_id - Current device model ID enumerated */ @@ -114,7 +112,6 @@ struct lm3692x_led { struct regmap *regmap; struct gpio_desc *enable_gpio; struct regulator *regulator; - char label[LED_MAX_NAME_SIZE]; int led_enable; int model_id; }; @@ -325,7 +322,7 @@ static int lm3692x_init(struct lm3692x_led *led) static int lm3692x_probe_dt(struct lm3692x_led *led) { struct fwnode_handle *child = NULL; - const char *name; + struct led_init_data init_data = {}; int ret; led->enable_gpio = devm_gpiod_get_optional(&led->client->dev, @@ -350,30 +347,23 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) fwnode_property_read_string(child, "linux,default-trigger", &led->led_dev.default_trigger); - ret = fwnode_property_read_string(child, "label", &name); - if (ret) - snprintf(led->label, sizeof(led->label), - "%s::", led->client->name); - else - snprintf(led->label, sizeof(led->label), - "%s:%s", led->client->name, name); - ret = fwnode_property_read_u32(child, "reg", &led->led_enable); if (ret) { dev_err(&led->client->dev, "reg DT property missing\n"); return ret; } - led->led_dev.name = led->label; + init_data.fwnode = child; + init_data.devicename = led->client->name; + init_data.default_label = ":"; - ret = devm_led_classdev_register(&led->client->dev, &led->led_dev); + ret = devm_led_classdev_register_ext(&led->client->dev, &led->led_dev, + &init_data); if (ret) { dev_err(&led->client->dev, "led register err: %d\n", ret); return ret; } - led->led_dev.dev->of_node = to_of_node(child); - return 0; } -- 2.11.0