Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3630435pxb; Mon, 24 Jan 2022 13:57:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGto83Sx5mgnemQYni4XLD4RWyWXDBuYLmAzkiikYvVm48F5Ez40U2FAXgTSklN6Kn2ruP X-Received: by 2002:a63:5611:: with SMTP id k17mr1155583pgb.88.1643061461247; Mon, 24 Jan 2022 13:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061461; cv=none; d=google.com; s=arc-20160816; b=mKzuS8RARJgpRXTRfpkkOmKkGXJtEq2XdH1TpQq3uBt1SVl31rpuNIzOzO1T5tFRE9 aENrxOfb6RE0BJZ4mnmTvwKCxwjTx14wVA2qeuJWIZOk6bVwmwr3vOty/DdNwY0lckmc ae7vM/90Dmb29ClxMZeqsoDP9/lDZZkFZKzC0AX18TWjlTScKPsbcvzxNy6zyvnLpcUH WtCVa3DrAV8sE3VKokaciWnmbyMBkvmsKgp1MtkSa2OwKP0yZ+6dRZYb5XIsKgqIci/m SAs+WurW3cfE5woneIBvejjwdCT6HmFTWs3Y20nGajgkHns/aADqEH606QXPkqmBupgv Z1LA== 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=oUq8KIPKD7xZRQcXwpr0C+pbX9QCLrEzQ9EspDas3NTrZfjlU2b19wwwYGRt5Yos1E dG+gNg37pjzZimd6iGgukajFUDwrwV/UetazYaHiP5P6C4eTyaXKiQxGAfGR2C6OHeLg vgMCVl4qpCRSKogiUBsidQwmENTRqRf9qubIPJQrr9PxOBCahM9ggl0oFLNbqqsLjdFX m7IEO3IoJqklS1QWaL6s+QFUfeoS6tFNSKeAiq33Fcjw+hYzpnz/c7JA36fK9xL+HwzQ sTllJ4GktHxOjDR6avqtIkX9a9lTloLIewkgwa4ejYNS30HMdtjtKCZQNUA17hksf3C4 8WYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t3sbXaXy; 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 g127si14377845pgc.526.2022.01.24.13.57.28; Mon, 24 Jan 2022 13:57:41 -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=t3sbXaXy; 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 S1573137AbiAXVoa (ORCPT + 99 others); Mon, 24 Jan 2022 16:44:30 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60210 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447251AbiAXVKS (ORCPT ); Mon, 24 Jan 2022 16:10:18 -0500 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 8F782B810BD; Mon, 24 Jan 2022 21:10:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0FCFC340E5; Mon, 24 Jan 2022 21:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058615; bh=dpr/6SmkftpYgHSoOA96Mr8yGDl3BpFvFZ1P7MbL7hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t3sbXaXykg7TQalfkWM7B99UpeMqtmxMMtaMyqFJkLNhpUZJ5z/aXzlB51114NdA7 PdIdzsGzxXRNQ21XmDTA7ClhLIJYnp9smfnmhuZtgHUC1Ts4no5e9M6gKxO9JjEj07 0f+w/i9x98RpekQCtHY62DujjhYeeB8hdIYalV/g= 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.16 0347/1039] backlight: qcom-wled: Override default length with qcom,enabled-strings Date: Mon, 24 Jan 2022 19:35:36 +0100 Message-Id: <20220124184136.958390768@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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