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,URIBL_BLOCKED,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 9A4B5C433E1 for ; Thu, 16 Jul 2020 15:05:56 +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 64A542063A for ; Thu, 16 Jul 2020 15:05:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="TkhsbH3X"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="f2RF2zmc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64A542063A 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=xSb5YPnIbgCMK1TShpqA7JmCiTsHQdfXjAog9mirDFE=; b=TkhsbH3XcZeHpcYjSNU/cQuFS to4gA+lorIOY9hr9APaDJtt/II2Jv7yTTmXKMc1o6qVUetxFx6zw4T8dUOPn3bX8V/D6VIRuCrQqW Bv6DbHsrErbw944rSxzqDbFzQ0QJ33SO9gYIN2qY+sngAzokpbxNyDI8bttgSTZANRPwNRiUn/MMz 7ylbG6l5DRy2/hPdUEtXOMtTdNpPDIBIgci6AsD0N2t0oIpu9SBrtCrwpJiwKR5AufckbrUvMZxGU QO2YgpAr3MXMeoOwtpdW0I4gJ7nipDMEvIt3uhQzMWB/a0OXcbW8LbwvSw3zLW7Dwm8VaYnMPJfmR Y+4qWR0TA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw5Qg-00043Q-US; Thu, 16 Jul 2020 15:04:10 +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 1jw5Qe-00042Q-0F for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 15:04:08 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06GF43n7100944; Thu, 16 Jul 2020 10:04:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594911843; bh=+pWIL1ic8MD3IiJClRzbp3l2Y+gPj0WMLl1k07q1QB8=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=f2RF2zmcx8dup9BWogti5+QaHdEU+fcePBkNd5+tOBrvL1MjpmDjvk0wnxCvXfQ8q 39QJsWmc8/Q4P4wpEhRjSlPVTwTwvGs0uIH7RnbYwForVY+DWvAWk6TOt+EDkfbeI+ XCTyR63zIhwmWDdpqlWVg+VRtexonEAybnhEQiuM= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06GF425F086590 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Jul 2020 10:04:03 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 16 Jul 2020 10:04:02 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE109.ent.ti.com (10.64.6.30) 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; Thu, 16 Jul 2020 10:04:02 -0500 Received: from [10.250.32.229] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 06GF42oH126749; Thu, 16 Jul 2020 10:04:02 -0500 Subject: Re: [PATCH v30 05/16] leds: multicolor: Introduce a multicolor class definition To: Pavel Machek References: <20200713154544.1683-1-dmurphy@ti.com> <20200713154544.1683-6-dmurphy@ti.com> <20200716083104.GA30361@amd> From: Dan Murphy Message-ID: Date: Thu, 16 Jul 2020 10:03:56 -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: <20200716083104.GA30361@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-20200716_110408_168651_2085B9D7 X-CRM114-Status: GOOD ( 19.27 ) 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/16/20 3:31 AM, Pavel Machek wrote: > Hi! > > First, let's substitute multi.color -> multicolor globally, > LEDS_CLASS_MULTI_COLOR is most visible example of this. Please also > decide whether it is MultiColor or multicolor, and make it consistent. Dictionary definition is multicolor no space.=A0 Capitalization is = dependent on how it is use. Basically no capital in the middle of a sentence >> Introduce a multicolor class that groups colored LEDs >> within a LED node. >> >> The multi color class groups monochrome LEDs and allows controlling two > For example here. Plus, the LEDs are not neccessarily monochrome, we > support white LEDs, too. Let's use "simple LEDs"? OK > >> aspects of the final combined color: hue and lightness. The former is >> controlled via the intensity file and the latter is controlled >> via brightness file. >> + depends on LEDS_CLASS >> + help >> + This option enables the multicolor LED sysfs class in /sys/class/led= s. >> + It wraps LED class and adds multicolor LED specific sysfs attributes >> + and kernel internal API to it. You'll need this to provide support >> + for multicolor LEDs that are grouped together. This class is not >> + intended for single color LEDs. It can be built as a module. > "single color" -> "simple"? ok > >> + /* account for the new line at the end of the buffer */ >> + offset++; >> + if (offset < size) { >> + ret =3D -EINVAL; >> + goto err_out; >> + } > "new line" -> "newline", and actually check that character you are > skipping is newline. Someone could put '%' in there... Actually we don't need to check for the character.=A0 Even if someone put = the '%' there there will still be a '\n' at the end of the buffer. The for..loop above only processes the total number of available colors = so effectively the '%' will be ignored just like the '\n'. If the buffer contains more entries then the number of colors an error = will be returned via the check below since size will be greater then offset =A0=A0=A0 if (offset < size) { =A0=A0=A0 =A0=A0=A0 ret =3D -EINVAL; =A0=A0=A0 =A0=A0=A0 goto err_out; =A0=A0=A0 } Maybe I should remove the comment as it is a bit confusing. >> + if (i < mcled_cdev->num_colors - 1) >> + len +=3D sprintf(buf + len, " "); >> + len +=3D sprintf(buf + len, "\n"); > Using sprintf for single character has... quite a lot of > overhead. Something like buf[len++] =3D '\n' would be > simpler/shorter/better. Please fix all relevant places. OK > Note I already applied patches 1-4. I will rebase on top > Best regards, > Pavel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel