Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp25484imu; Thu, 8 Nov 2018 13:12:03 -0800 (PST) X-Google-Smtp-Source: AJdET5d4DuKnLI+D0KEb+IaXdFSmYZPMKODo+Jw0qFMoBwmnliCIhjnUxVbCr0okx4Fk5OlOa9kD X-Received: by 2002:a63:e54:: with SMTP id 20-v6mr4682239pgo.369.1541711523316; Thu, 08 Nov 2018 13:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541711523; cv=none; d=google.com; s=arc-20160816; b=oC4HGZTkdBLs3YsrTTEE92sTa6Jg/pqZfDv62ZIllgAcU6+Bwkl5CTQxGuw9fmbIS6 ivBAuULhMtRB0A7/eOFOKInkxli0nGw2Jt+ZikrQEOGEGrDIXqT07LdGL7S7xPQT65Sh XLhAb3dGNn9pMn/GjbUoOuNwfy7/MiE4ywuQD/EWPVrKo1kdcXBcH8mYiiITv5QbcN71 2MFfbBLdy/3fr95CP/SwVkZ5SWfal/Zwm+VIuaG0H77HInE0EvA+M3eib6ohoyX2E+J+ jR7suF2GvT1myFBOR8Tmb8CaeKjOB5A5YPUbDF+VYAcba+X6w8QuJoHQd2fzwJ9HwEVg +1fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=TV7x3WCU22TIU4GajKiEiF9JKQgo58Q/s81rAT3Gfms=; b=Ed8YkYwv89NEr10WxnDsVxq6owkNCcFXBOCdK13kilae+/F7XweonWVzPt+YhtAxwq L4vHfuYH5VqbjEcEk7zJxua8DdAI6h/szUKFG0idYAoTATh2nbuDUkaFjPrjPU2MZe5i kVJS1kFqh1XVKimKqHuqZXOUB1x1Ubp2R5/M3dXabLrE5NmRz5G9ORS0AldoK0ilPq9O WTgNgsT42l2lj6nvq4GRLlwMZJ7sZ3eQ3BIhfZvZmeBaTpu/vEX4v9VSgIRKu7FunM08 p8vZQijRXnLE7FLZoW/LDovhEFZ+4DMtIE41CGMmnXJA4U+m910/0o/pT3UCbITYsQGw wukA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=GMfWyq+i; 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 t1-v6si5263996ply.279.2018.11.08.13.11.46; Thu, 08 Nov 2018 13:12:03 -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=GMfWyq+i; 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 S1727137AbeKIGsa (ORCPT + 99 others); Fri, 9 Nov 2018 01:48:30 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:46566 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbeKIGsa (ORCPT ); Fri, 9 Nov 2018 01:48:30 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id wA8LB66U078519; Thu, 8 Nov 2018 15:11:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1541711466; bh=TV7x3WCU22TIU4GajKiEiF9JKQgo58Q/s81rAT3Gfms=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=GMfWyq+iNnKa5wq2eOxxc2IeNZA1xNFWrNHm1En9TynJo5bl8EK8cadNvvTeC09vu 0wK95Z/iNfevaFbMnhulFtwO2yI9Oili/8JznDLQ7wjoNzBlYOLSN3zy/R5agAwyge Aey+giXqiZKnCsfzp/hKkXKiRi+lnuB3N3ZyE4ss= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wA8LB6CB071854 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Nov 2018 15:11:06 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 8 Nov 2018 15:11:06 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Thu, 8 Nov 2018 15:11:06 -0600 Received: from [172.22.187.225] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wA8LB6k1006809; Thu, 8 Nov 2018 15:11:06 -0600 Subject: Re: [PATCH 12/24] leds: lm3692x: Use led_compose_name() To: Jacek Anaszewski , CC: , , , References: <1541542052-10081-1-git-send-email-jacek.anaszewski@gmail.com> <1541542052-10081-13-git-send-email-jacek.anaszewski@gmail.com> From: Dan Murphy Message-ID: <8584e8a2-44df-33b1-4d9e-9fb3fb2cb98d@ti.com> Date: Thu, 8 Nov 2018 15:11:05 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit 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 Jacek On 11/08/2018 02:48 PM, Jacek Anaszewski wrote: > Dan, > > On 11/08/2018 07:14 PM, Dan Murphy wrote: >> On 11/06/2018 04:07 PM, Jacek Anaszewski wrote: >>> Switch to using generic LED support for composing LED class >>> device name. >>> >>> Signed-off-by: Jacek Anaszewski >>> Cc: Dan Murphy >>> --- >>> drivers/leds/leds-lm3692x.c | 39 ++++++++++++++++++++------------------- >>> 1 file changed, 20 insertions(+), 19 deletions(-) >>> >>> diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c >>> index 4f413a7..9dfc0f2 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 >>> @@ -95,6 +94,9 @@ >>> #define LM3692X_FAULT_FLAG_SHRT BIT(3) >>> #define LM3692X_FAULT_FLAG_OPEN BIT(4) >>> >>> +#define LM36922_NAME "lm36922" >>> +#define LM36923_NAME "lm36923" >>> + >>> /** >>> * struct lm3692x_led - >>> * @lock - Lock for reading/writing the device >>> @@ -103,7 +105,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 +115,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 +325,8 @@ 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; >>> + char *model_name; >>> int ret; >>> >>> led->enable_gpio = devm_gpiod_get_optional(&led->client->dev, >>> @@ -346,17 +347,20 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) >>> dev_err(&led->client->dev, "No LED Child node\n"); >>> return -ENODEV; >>> } >>> + init_data.fwnode = child; >>> >>> - fwnode_property_read_string(child, "linux,default-trigger", >>> - &led->led_dev.default_trigger); >>> + if (led->model_id == LM36922_MODEL) >>> + model_name = LM36922_NAME; >>> + else >>> + model_name = LM36923_NAME; >>> >>> - ret = fwnode_property_read_string(child, "label", &name); >>> + ret = led_compose_name(child, model_name, ":backlight_cluster", >>> + init_data.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); >>> + return ret; >>> + >>> + fwnode_property_read_string(child, "linux,default-trigger", >>> + &led->led_dev.default_trigger); >>> >>> ret = fwnode_property_read_u32(child, "reg", &led->led_enable); >>> if (ret) { >>> @@ -364,16 +368,13 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) >>> return ret; >>> } >>> >>> - led->led_dev.name = led->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; >>> } >>> >>> @@ -439,8 +440,8 @@ static int lm3692x_remove(struct i2c_client *client) >>> } >>> >>> static const struct i2c_device_id lm3692x_id[] = { >>> - { "lm36922", LM36922_MODEL }, >>> - { "lm36923", LM36923_MODEL }, >>> + { LM36922_NAME, LM36922_MODEL }, >>> + { LM36923_NAME, LM36923_MODEL }, >> >> How is this change relevant? >> No mention in the comments about this change. > > Unrelated. It is a remnant from the stage of development, where I had > an impression that i2c_client name is taken from this array > somehow. Only later I learned that it is taken from OF compatible > property after removing vendor prefix with comma. > > Afterwards I decide to abide by this change since it seems to be > just an improvement - if I'm adding the string definition anyway, > then why not replace other matching literals? > > I will add the explanation if the commit message if there are no > other objections. That works for me. Just did not want the change to be "hidden" even without the intent of hiding it. Dan > >>> { } >>> }; >>> MODULE_DEVICE_TABLE(i2c, lm3692x_id); >>> >> >> > -- ------------------ Dan Murphy