Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2411659imu; Tue, 6 Nov 2018 14:11:53 -0800 (PST) X-Google-Smtp-Source: AJdET5et/pC82kXbthhIqsfAnY0uOfdlaciELfqCapSg9Qj5Lbel9srIRAadpx2ildU0mLWznfj8 X-Received: by 2002:a62:b09:: with SMTP id t9-v6mr28094877pfi.36.1541542313138; Tue, 06 Nov 2018 14:11:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541542313; cv=none; d=google.com; s=arc-20160816; b=gk0TA/oi50q/NSH+inkP/NMiZwD3MTTcOI7ZBkDFQ9pybYedYWbo36mzlHAXU4hbpx AMhE/Vh2QAOkShvhz0bOOowYS8RHa96vvPSCJVJaHUNphpQLRGDzCwDYPnBWXjzW0mbu Q+CQDDDR816ltFPjEQMmcOVU801kbFo747SpF7lHXtLQoY1vj5zF79QRKhqtBEm8sog1 GaO6GO2W8eUC86TxQ4LbOieJKeIj1Ki7kqZ1Q54VbXyKlA7FRmdmXsFl0kCO1fo39q7p vu57isB3MvRbXD2dgxMKUR4Jpk/9u8KsZa0J59x0aLjo7jiqyMpWogcM2VYuyOdUIMaH jyBQ== 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=qDyqAqmkGXXy6g/SCqoQOXDsTD0E+dcunugChNP+S3E=; b=z5jLaNQXosuHM+awFz8wLYvatdYSn10gdfTsGebuLx9uSt/OjoCCAzoB0XQ0Z+1Jdx 4Zt4vLYhnYVmST2khk/Iirc8Zxqo6fcb1yMuE5aGKMfPX/Zlp68mubVdoHmY4Ox3JrdR pm0xIO5PSTaccWy2KPg0tJbnf9fPc4pJHI3KYBTUjIVzyjtJOklLjJJ6SPL7tjuBS9X9 s9CA5wVTCMEF6orD2cBYlAtvT6Jzs3hFqyUiQ14mK2Qx46IfSLZX312nLH9BFWz2msf/ rA88uIM7zDBDPnWr5ZEwvOByqhDfBMKXSKGVFNwg3efXxesfrxrsjdVuRBSSLKF8hM17 QRaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PFsoyKLQ; 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 69-v6si41807987pft.177.2018.11.06.14.11.37; Tue, 06 Nov 2018 14:11:53 -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=@gmail.com header.s=20161025 header.b=PFsoyKLQ; 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 S2388442AbeKGHfY (ORCPT + 99 others); Wed, 7 Nov 2018 02:35:24 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:40954 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388240AbeKGHfX (ORCPT ); Wed, 7 Nov 2018 02:35:23 -0500 Received: by mail-lj1-f194.google.com with SMTP id t22-v6so12929676lji.7; Tue, 06 Nov 2018 14:08:00 -0800 (PST) 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=qDyqAqmkGXXy6g/SCqoQOXDsTD0E+dcunugChNP+S3E=; b=PFsoyKLQgUOtt61QWCJEen1+EZzHJC3LnLtfajguyMJnFbfLbaC22kAyRSjRld4WWr 686gcTdjM4fIOsjm1gXNqpL+13Ce6cypJ+yRq/ei6gWHBKf99rKw5PSDGYZRXA7YB9rx yCk3scUESOgOrpK+erMg3qvndZXWIDRGbmQYo7MBwjIQd/2xb5D8ne4dyE7b5gZjgqjY msgoloj034BBRGtRNV27V5/PoPGEWqeGf0qCtqIK+XhiRzmZokM1KdSemEVheO2nOyC/ b4Ie0Z7mO0EE2WFOWaxwZptzMbTt8yHRJfnK1gm8eFuZsSN9Yq9Y1CD53OKfMHOQ2sEZ exFA== 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=qDyqAqmkGXXy6g/SCqoQOXDsTD0E+dcunugChNP+S3E=; b=inIStgFWX+L4ZjhAXCyFjTXgNJMDC45pYzWLvugSUc3cTKYPnliQ7fBALuS1Qrf0gY pCKQiV18JKzaCtuqU5CJ3O5mr12Nk6MdXDyda/zWcrNibf6Nolgdtbc5ELqJBrVbXtKo CEaGmsprBbXbO70Vr2az1PqsHOqKbOCKt3wRp16i4Z5QV1Jcs5ApCjRPaDJeIvXm/mYU 8D98AVUIqk7Cz+/y3y/86d+oxknKr0BynX/XAU8QJCRvNx7mrH2fDqTgfyrXSQRMWOBY gDxEyWwCyokBbg2ApBWJQQapF9Tey+QG3dYXbnd3OidfXS/0hPmoO24CAnJYf0Ts+aW1 km6A== X-Gm-Message-State: AGRZ1gLLHQy4deYfd5mMF3jZ/gpsPOMmx+hM7+8ROnUnSrpBNuvhsc7D yyHKrC7M8WnrDu8p/n+zsFjDz+HTg9U= X-Received: by 2002:a2e:9c08:: with SMTP id s8-v6mr15482237lji.149.1541542078965; Tue, 06 Nov 2018 14:07:58 -0800 (PST) Received: from i4790k.home (bgp86.neoplus.adsl.tpnet.pl. [83.28.79.86]) by smtp.gmail.com with ESMTPSA id c20sm3185654lfj.67.2018.11.06.14.07.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Nov 2018 14:07:58 -0800 (PST) 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, jacek.anaszewski@gmail.com, Daniel Mack Subject: [PATCH 08/24] leds: lt3593: Use led_compose_name() Date: Tue, 6 Nov 2018 23:07:16 +0100 Message-Id: <1541542052-10081-9-git-send-email-jacek.anaszewski@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1541542052-10081-1-git-send-email-jacek.anaszewski@gmail.com> References: <1541542052-10081-1-git-send-email-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. Signed-off-by: Jacek Anaszewski Signed-off-by: Daniel Mack --- drivers/leds/leds-lt3593.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index de3623e..d005abc 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c @@ -10,10 +10,10 @@ #include #include #include -#include + +#define LED_LT3593_NAME "lt3593" struct lt3593_led_data { - char name[LED_MAX_NAME_SIZE]; struct led_classdev cdev; struct gpio_desc *gpiod; }; @@ -111,6 +111,7 @@ static int lt3593_led_probe(struct platform_device *pdev) struct fwnode_handle *child; int ret, state = LEDS_GPIO_DEFSTATE_OFF; enum gpiod_flags flags = GPIOD_OUT_LOW; + struct led_init_data init_data; const char *tmp; if (dev_get_platdata(dev)) { @@ -138,14 +139,11 @@ static int lt3593_led_probe(struct platform_device *pdev) return PTR_ERR(led_data->gpiod); child = device_get_next_child_node(dev, NULL); + init_data.fwnode = child; - ret = fwnode_property_read_string(child, "label", &tmp); - if (ret < 0) - snprintf(led_data->name, sizeof(led_data->name), - "lt3593::"); - else - snprintf(led_data->name, sizeof(led_data->name), - "lt3593:%s", tmp); + ret = led_compose_name(child, LED_LT3593_NAME, ":", init_data.name); + if (ret) + return ret; fwnode_property_read_string(child, "linux,default-trigger", &led_data->cdev.default_trigger); @@ -160,11 +158,10 @@ static int lt3593_led_probe(struct platform_device *pdev) } } - led_data->cdev.name = led_data->name; led_data->cdev.brightness_set_blocking = lt3593_led_set; led_data->cdev.brightness = state ? LED_FULL : LED_OFF; - ret = devm_led_classdev_register(dev, &led_data->cdev); + ret = devm_led_classdev_register_ext(dev, &led_data->cdev, &init_data); if (ret < 0) { fwnode_handle_put(child); return ret; -- 2.1.4