From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9305C433E5 for ; Wed, 22 Jul 2020 00:05:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A570120771 for ; Wed, 22 Jul 2020 00:05:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="M+b8r0gh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbgGVAFX (ORCPT ); Tue, 21 Jul 2020 20:05:23 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:49318 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbgGVAFX (ORCPT ); Tue, 21 Jul 2020 20:05:23 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06M050kV122034; Tue, 21 Jul 2020 19:05:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1595376300; bh=PF4V+O2qLoTetHzWe1R0WHJq5APQt8IGaIyAnbSS8Ys=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=M+b8r0ghaJyudEXFK7tzSfVnh+LR8VhPHDD+ulGW7aGWqxqrY5scurQPjM4KbZfrn FhewPReA6muP2YHUlYYgeC1g9Sf1DxtxNla8imREdCT043/UWGOET0UM4s4SiPfNOY qhDnIcpxHIAgYdfRdajxKii/S4bHapXUl5hNB/xw= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06M050Zi057979 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 21 Jul 2020 19:05:00 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 21 Jul 2020 19:05:00 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 21 Jul 2020 19:04:59 -0500 Received: from [10.250.35.192] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06M04xtU045816; Tue, 21 Jul 2020 19:04:59 -0500 Subject: Re: [PATCH v31 03/12] leds: lp50xx: Add the LP50XX family of the RGB LED driver To: Pavel Machek CC: , , , , , , References: <20200716182007.18389-1-dmurphy@ti.com> <20200716182007.18389-4-dmurphy@ti.com> <20200721210554.GC5966@amd> From: Dan Murphy Message-ID: Date: Tue, 21 Jul 2020 19:04:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200721210554.GC5966@amd> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US 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 Pavel On 7/21/20 4:05 PM, Pavel Machek wrote: > Hi! > >> The device has the ability to group LED output into control banks >> so that multiple LED banks can be controlled with the same mixing and >> brightness. Inversely the LEDs can also be controlled independently. > Inversely? I will revise it. > >> --- /dev/null >> +++ b/drivers/leds/leds-lp50xx.c >> @@ -0,0 +1,784 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +// TI LP50XX LED chip family driver >> +// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/ >> + > Can we get https here and in the binding document? > > Please run this through checkpatch -- I believe it will have some > comments. OK. > >> + >> + device_for_each_child_node(priv->dev, child) { >> + led = &priv->leds[i]; >> + ret = fwnode_property_count_u32(child, "reg"); >> + if (ret < 0) { >> + dev_err(&priv->client->dev, >> + "reg property is invalid\n"); >> + return -EINVAL; > is handle_put(child) needed here? It will be after I refactor the label >> + } >> + if (ret > 1) { >> + priv->num_of_banked_leds = ret; >> + if (priv->num_of_banked_leds > >> + priv->chip_info->max_modules) { >> + dev_err(&priv->client->dev, >> + "reg property is invalid\n"); >> + ret = -EINVAL; >> + fwnode_handle_put(child); >> + goto child_out; >> + } >> + >> + ret = fwnode_property_read_u32_array(child, >> + "reg", >> + led_banks, >> + ret); > Move this to subfunction to reduce the indentation? (Or, just refactor > it somehow). Actually I can just put it all on the same line since the 80 character requirement is relaxed. >> + if (ret) { >> + dev_err(&priv->client->dev, >> + "reg property is missing\n"); >> + fwnode_handle_put(child); >> + goto child_out; >> + } > Create label that does the handle_put so you don't need to repeat it > quite so often? I will rework it for  all > >> + fwnode_for_each_child_node(child, led_node) { >> + ret = fwnode_property_read_u32(led_node, "color", >> + &color_id); >> + if (ret) >> + dev_err(priv->dev, "Cannot read color\n"); >> + >> + mc_led_info[num_colors].color_index = color_id; > This uses undefined value. OK needs to goto to out. > >> + ret = lp50xx_reset(led); > Does the GPIO need to be disabled before enabling it for reset? You mean toggle the GPIO?  Yes it should be toggled I will update it. Dan > Best regards, > Pavel > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51E50C433E2 for ; Wed, 22 Jul 2020 00:06:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 202D5206F2 for ; Wed, 22 Jul 2020 00:06:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Tciijbx/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="M+b8r0gh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 202D5206F2 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mNfoTOj2dYkch9e4eyCWDHYfRAiOOls14BBPLaYxAp0=; b=Tciijbx/wJ57Me+i7y6VCHMWN 0EIaK2SFEd0dg57S9dKHTiyWIye75S5NAZd74at7eGApHi1HPWdNMF3qcieAizpSIJrSQaBPc4/Uv k23M1TEYo3GSbiE36ECaYUM9BbYpXiRzqVyizjLG9TOBpGj5/SNGmukqIW9a4JiiD9E2u5XbpgGvx 2dfohTsBpf2fnJkNDcL/xpX3zZKU9dmlkiogmyKu0KlrCnhkZNtHjYjFxdrvtVRwWmSCCL5Na1hdT ss8x3akWVeE3QXWDR+cC+C454x5ljK1+S3AC/CRqdO0G4rsN//JUTDtv3TGMXPNzD/MAWd9UF8jDN pzOqr4wnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jy2G0-0002E4-UP; Wed, 22 Jul 2020 00:05:12 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jy2Fy-0002D9-En for linux-arm-kernel@lists.infradead.org; Wed, 22 Jul 2020 00:05:11 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06M050kV122034; Tue, 21 Jul 2020 19:05:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1595376300; bh=PF4V+O2qLoTetHzWe1R0WHJq5APQt8IGaIyAnbSS8Ys=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=M+b8r0ghaJyudEXFK7tzSfVnh+LR8VhPHDD+ulGW7aGWqxqrY5scurQPjM4KbZfrn FhewPReA6muP2YHUlYYgeC1g9Sf1DxtxNla8imREdCT043/UWGOET0UM4s4SiPfNOY qhDnIcpxHIAgYdfRdajxKii/S4bHapXUl5hNB/xw= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06M050Zi057979 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 21 Jul 2020 19:05:00 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 21 Jul 2020 19:05:00 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 21 Jul 2020 19:04:59 -0500 Received: from [10.250.35.192] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06M04xtU045816; Tue, 21 Jul 2020 19:04:59 -0500 Subject: Re: [PATCH v31 03/12] leds: lp50xx: Add the LP50XX family of the RGB LED driver To: Pavel Machek References: <20200716182007.18389-1-dmurphy@ti.com> <20200716182007.18389-4-dmurphy@ti.com> <20200721210554.GC5966@amd> From: Dan Murphy Message-ID: Date: Tue, 21 Jul 2020 19:04:54 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200721210554.GC5966@amd> Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200721_200510_642024_2F9FC5DF X-CRM114-Status: GOOD ( 20.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, robh@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, marek.behun@nic.cz, jacek.anaszewski@gmail.com, linux-leds@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="windows-1252"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Pavel On 7/21/20 4:05 PM, Pavel Machek wrote: > Hi! > >> The device has the ability to group LED output into control banks >> so that multiple LED banks can be controlled with the same mixing and >> brightness. Inversely the LEDs can also be controlled independently. > Inversely? I will revise it. > >> --- /dev/null >> +++ b/drivers/leds/leds-lp50xx.c >> @@ -0,0 +1,784 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +// TI LP50XX LED chip family driver >> +// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.co= m/ >> + > Can we get https here and in the binding document? > > Please run this through checkpatch -- I believe it will have some > comments. OK. > >> + >> + device_for_each_child_node(priv->dev, child) { >> + led =3D &priv->leds[i]; >> + ret =3D fwnode_property_count_u32(child, "reg"); >> + if (ret < 0) { >> + dev_err(&priv->client->dev, >> + "reg property is invalid\n"); >> + return -EINVAL; > is handle_put(child) needed here? It will be after I refactor the label >> + } >> + if (ret > 1) { >> + priv->num_of_banked_leds =3D ret; >> + if (priv->num_of_banked_leds > >> + priv->chip_info->max_modules) { >> + dev_err(&priv->client->dev, >> + "reg property is invalid\n"); >> + ret =3D -EINVAL; >> + fwnode_handle_put(child); >> + goto child_out; >> + } >> + >> + ret =3D fwnode_property_read_u32_array(child, >> + "reg", >> + led_banks, >> + ret); > Move this to subfunction to reduce the indentation? (Or, just refactor > it somehow). Actually I can just put it all on the same line since the 80 character = requirement is relaxed. >> + if (ret) { >> + dev_err(&priv->client->dev, >> + "reg property is missing\n"); >> + fwnode_handle_put(child); >> + goto child_out; >> + } > Create label that does the handle_put so you don't need to repeat it > quite so often? I will rework it for=A0 all > >> + fwnode_for_each_child_node(child, led_node) { >> + ret =3D fwnode_property_read_u32(led_node, "color", >> + &color_id); >> + if (ret) >> + dev_err(priv->dev, "Cannot read color\n"); >> + >> + mc_led_info[num_colors].color_index =3D color_id; > This uses undefined value. OK needs to goto to out. > >> + ret =3D lp50xx_reset(led); > Does the GPIO need to be disabled before enabling it for reset? You mean toggle the GPIO?=A0 Yes it should be toggled I will update it. Dan > Best regards, > Pavel > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel