Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1257311rdb; Sat, 18 Nov 2023 08:47:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbyMIBOZCLo21mhmD5/fW5IRPzsWi+QXj8kVr6EB/M/0FifqQPuk81A32MQqaWjsxWfgVw X-Received: by 2002:a05:6a20:4f92:b0:187:afb0:c2f7 with SMTP id gh18-20020a056a204f9200b00187afb0c2f7mr2430170pzb.45.1700326054702; Sat, 18 Nov 2023 08:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700326054; cv=none; d=google.com; s=arc-20160816; b=Of2pBc5oR2aN0y0Iwpj9aE2QZQGP6JRiaUyQnpSalh6f9vxDEQTQfshbr8u4sWRV/T 0kiAwkYV8IMlsK/B6PeKL9WttgrnKeDLj7OPyS+GMGG2hGkLUil6ESmidtGBZi5x5JVh 4SKS+utb5wNwwxPaHNcgkTdzzo9qMBB2DY8+XOzfRTK8pKbJb8ZqejEyXyHrXG5XpW11 dibJMYrfpu8rD5yJaAZp9Wj/lr9YeAaXN19rTR/GQ/EI8ClMrYidC5aamik5NnvrlfMM sPWG62Ly5ci0bzkvHULSb5/gGLzGF6yc8k3T/gS113dzGs4wV5jXJRFgZQIrYYvL/4Ec +S8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=wc5iY++oK0EVkooDY6ElLmU2NXeGpGEobVkWGqYFYOY=; fh=HJOEJ+1NVvtVnuIMWeT1OywsaidefjPxO+0zJVj3/z8=; b=B6FHiYmD+SxKm33vdnYF1JUifIQpyeMvVBCZZ+mlCCVlcr1f0elGz/zsAoslralHQL eqYmrqNbkxLkWd3k9Nlrzww8Peo3sABTbjpoe3Zo5tr1d7T+dIsJaVnI/jZymjWW5Qyy moCFZ6WvPHptsorv9vsAMJzEEBiXpqPGS5eHqv4eqsNbjWYwFq9n3gbj8v7qD+67QMTb 2uStQR/hqj1rXBhtn3hInePEPts3ZU+7wIyuc/ilEOw7Rqu0CwBFJn3R8kNCsr1SeXkZ E8wSz1CayrlKxnvD3fdAnm18Yb2lP1zbQpDB6U6sPCyd6N4/lJjwDHYdXb5IjPm/O2fr QU+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="nA/+3o3X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d16-20020a634f10000000b005c1cd418245si4470557pgb.737.2023.11.18.08.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 08:47:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="nA/+3o3X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A318C804F633; Sat, 18 Nov 2023 08:47:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbjKRQr1 (ORCPT + 99 others); Sat, 18 Nov 2023 11:47:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbjKRQr0 (ORCPT ); Sat, 18 Nov 2023 11:47:26 -0500 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF106E0; Sat, 18 Nov 2023 08:47:23 -0800 (PST) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-5c9169300caso5990867b3.2; Sat, 18 Nov 2023 08:47:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700326043; x=1700930843; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wc5iY++oK0EVkooDY6ElLmU2NXeGpGEobVkWGqYFYOY=; b=nA/+3o3XlClFnqyz43PNXC5RdSdZJMfw4cvUuFEHaTgffLmHH+SzjAkQNMRReCec2B 4neRERDK7nMqGeiLmfiYOF4XF5rdwQAAUy8K3FVcjEq1+1JeO55hdRpxu80vjWDaVvba SfSF/Q1xMoi1rsUf/BmQdeadAX37s3FWqFBbq07vs7EeD7ChboTDvQZtX0XA/Jqqz3L4 Ebah8Z6eV1OLb06tw/8Ki8/9y1dOYkH5cTw+im5n5zt/u1mSmCIphquzK3E6WnzME1kx T+EQsEyAuC8cwpebDB5COuJfHN+p4xy8BDlbU+nJGfbBU19hYCtCJNQk8y7IX0hOoP9q 6efA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700326043; x=1700930843; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wc5iY++oK0EVkooDY6ElLmU2NXeGpGEobVkWGqYFYOY=; b=E6ByceA7hh8j+EkGjNfkqHcdhkZfQurxq4BHWIk3M0TEJWezbvGgsam6ljG6lxrmzc lxrYPfg9XvIPqTWVG/gnuc1qUHYlAiuPfzXE/+L18gxvYFIIFbeDgaFovfPCoBMa2cW6 Liu9YIanuOhPz0nKEaLueQ8cgAmgwglfmRf3T2vQe6QhPvxAZ2ObHQkaBAE4nT9YpHJh 9sDjLJnShEdtwEC95DkAoBaivXVBVEHHhTdcYSXymrIUaw7CxHBrbN+k7dbkZB0j2QeT u8Sr6NsMNVMLTCO5sFip8/byCbIW6MODxUzfyik2idpumYJHncw7Epq7BwWLaY88aB70 3CkA== X-Gm-Message-State: AOJu0Yzp0NV0E8zzmTbNIfdfRimKv2ydILgOcIIGQ1JnrIjzBplU6vgs aphsbBn2Zr8aG62iLDYRhRpvpLTAIDmJ+pNAn2QoA4j+IKQ= X-Received: by 2002:a81:4f06:0:b0:589:8b55:f7f7 with SMTP id d6-20020a814f06000000b005898b55f7f7mr2798636ywb.39.1700326042865; Sat, 18 Nov 2023 08:47:22 -0800 (PST) MIME-Version: 1.0 References: <20231101142445.8753-1-ddrokosov@salutedevices.com> <20231101142445.8753-5-ddrokosov@salutedevices.com> In-Reply-To: <20231101142445.8753-5-ddrokosov@salutedevices.com> From: Andy Shevchenko Date: Sat, 18 Nov 2023 18:46:45 +0200 Message-ID: Subject: Re: [PATCH v3 04/11] leds: aw200xx: calculate dts property display_rows in the driver To: Dmitry Rokosov Cc: lee@kernel.org, pavel@ucw.cz, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, kernel@sberdevices.ru, rockosov@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, George Stark Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 18 Nov 2023 08:47:33 -0800 (PST) On Wed, Nov 1, 2023 at 4:24=E2=80=AFPM Dmitry Rokosov wrote: > > From: George Stark > > Get rid of device tree property "awinic,display-rows". The property > value actually means number of current switches and depends on how leds > are connected to the device. It should be calculated manually by max > used led number. In the same way it is computed automatically now. > Max used led is taken from led definition subnodes. ... > +static bool aw200xx_probe_get_display_rows(struct device *dev, struct aw= 200xx *chip) > +{ > + struct fwnode_handle *child; > + u32 max_source =3D 0; > + > + device_for_each_child_node(dev, child) { > + u32 source; > + int ret; > + > + ret =3D fwnode_property_read_u32(child, "reg", &source); > + if (ret || source >=3D chip->cdef->channels) > + continue; > + > + max_source =3D max(max_source, source); > + } > + chip->display_rows =3D max_source / chip->cdef->display_size_colu= mns + 1; > + return !!chip->display_rows; This is a bit weird. Can we rewrite it as if (max_source =3D=3D 0) return false; ->display_rows =3D ... return true; ? > +} --=20 With Best Regards, Andy Shevchenko