Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3660525pxb; Mon, 24 Jan 2022 14:42:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzl3DikI7XGTSm4cz+BaT/MNVd7TESmGeribSd4B0CdJ0PJZJhDnJqo58w7igl0gy4Zw6oj X-Received: by 2002:a17:90b:1e06:: with SMTP id pg6mr502327pjb.178.1643064169316; Mon, 24 Jan 2022 14:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064169; cv=none; d=google.com; s=arc-20160816; b=aQRSM64HVNVzjyZh4SOWCG5ouNIif8ZJlG82CMth8YPMw1jnYV32AJTvylOkAxSgzl tNesl2Ro8f/5M0TBuMaTc6Vl53EGPKxGFuQXLZeWDugSH3leKgfI0p7xUZSK2umQYB3Z HnKrJNPJwm0DUP5nuI7AZvQSN9JyMD/8G6iKlLOqeVNpwKtKjlN+wdLa98If7KRojfMJ SndoypCfotQHOIgE/1V8jzQLecaHdSgVRetFAsQ6GJhLX3Z4o1P88o8ZX17lL6fEBpV5 uieTO49Mw5ot6QPICEMLDM52w5CFmSdapGD8tGPz3CLfylT3YAakMoNFhKaxRXutvRGZ x8Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BQDphM/jJL34ZkQW5YSQJKvhfefJ1jOjl8FqM0NNevk=; b=QSmfiiMMVfJSs/Qp5z5D56ue6s5P1+QNXEPhDQOuj0YkMVoAxmDQMRv5mtYwnp4ZAy TP5wT3+GVBOmMtakSF44utPQLTQrAMFH4qdCiTHMcnPw+RQ5eaPZveCtrE41S91oUnxP cUPnTApoIuE71Quo7j3n5LgYMKsZvLigBzBMWjckg2tev4NTqNOn6KqTwIw0HUYgxQsj IfV3flG2EIVtYE1/FylMyGP7C7C7OdXDc4JfNX23wYtIe8Zn4bpbrs5EX8UZARanv1kB gtnJQnajfhubzbOoxzCvEKEIYuUX36As1zCOYsMBAoRnyZQ9YSwxQG2DssXqfls4eOMn 5CrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TIxaM6Z1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id be6si8825900pgb.869.2022.01.24.14.42.37; Mon, 24 Jan 2022 14:42:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TIxaM6Z1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1835373AbiAXWgQ (ORCPT + 99 others); Mon, 24 Jan 2022 17:36:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456717AbiAXVjz (ORCPT ); Mon, 24 Jan 2022 16:39:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C4AC0419C8; Mon, 24 Jan 2022 12:26:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1DBBB8122F; Mon, 24 Jan 2022 20:26:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25E50C340E5; Mon, 24 Jan 2022 20:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055987; bh=dpr/6SmkftpYgHSoOA96Mr8yGDl3BpFvFZ1P7MbL7hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TIxaM6Z1dfYWSvPh7F1TgP+sztAyUkebHvG+ELmwIJWRPZU03iZvnvVNKUEy4F41n p/Z8nBBCoPeSvePj4bSSVNmYf8iEfD5oEDPcwr+hhQnqNPxCrMaJEyVTbZqVOJHWxI MttNbLwq/Xo1VSLrT3v30/9LgZwDK2ykzGBvQFuo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , AngeloGioacchino Del Regno , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.15 289/846] backlight: qcom-wled: Override default length with qcom,enabled-strings Date: Mon, 24 Jan 2022 19:36:46 +0100 Message-Id: <20220124184110.905695395@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marijn Suijten [ Upstream commit 2b4b49602f9feca7b7a84eaa33ad9e666c8aa695 ] The length of qcom,enabled-strings as property array is enough to determine the number of strings to be enabled, without needing to set qcom,num-strings to override the default number of strings when less than the default (which is also the maximum) is provided in DT. This also introduces an extra warning when qcom,num-strings is set, denoting that it is not necessary to set both anymore. It is usually more concise to set just qcom,num-length when a zero-based, contiguous range of strings is needed (the majority of the cases), or to only set qcom,enabled-strings when a specific set of indices is desired. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3") Signed-off-by: Marijn Suijten Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211115203459.1634079-6-marijn.suijten@somainline.org Signed-off-by: Sasha Levin --- drivers/video/backlight/qcom-wled.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index dbcbeda655192..c057368e5056e 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1521,6 +1521,8 @@ static int wled_configure(struct wled *wled) return -EINVAL; } } + + cfg->num_strings = string_len; } rc = of_property_read_u32(dev->of_node, "qcom,num-strings", &val); @@ -1531,9 +1533,13 @@ static int wled_configure(struct wled *wled) return -EINVAL; } - if (string_len > 0 && val > string_len) { - dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n"); - return -EINVAL; + if (string_len > 0) { + dev_warn(dev, "Only one of qcom,num-strings or qcom,enabled-strings" + " should be set\n"); + if (val > string_len) { + dev_err(dev, "qcom,num-strings exceeds qcom,enabled-strings\n"); + return -EINVAL; + } } cfg->num_strings = val; -- 2.34.1