Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1042352ybn; Wed, 2 Oct 2019 10:00:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxde25vCZ/RQJZK5sYo55HB+OB3M2MhmnolxlPRWuNtzGV90LJTuobZmulbM3DN3pZsBA0Z X-Received: by 2002:a17:907:2118:: with SMTP id qn24mr3891505ejb.81.1570035614584; Wed, 02 Oct 2019 10:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570035614; cv=none; d=google.com; s=arc-20160816; b=nJtpnZw0goxpDWvpl6XRPjs9ugmXdUerY3+ElKc4ta/uUqsA1Dg3qqtfyqBg8HpPyF jj1m0Aml3gbhjOc+D6fFnV05NlKlZ7OSZwWvAfu0GN+X7HcShHtHH67w3fYkknq7k8+M M9/rAZUz4Br7MOJOdTlOUa3vhOWBQ2cAQKqXLXVDnRTFXljHN7DrRsocNKT1YZr579R2 iw1UN4IL06wmDYKv8v+DPqlzQkU44qKcEjf2cT+YUrPW+R0RO2QcOkZT9muhGJQmEaHk Lben5lmDhrwEGAtlJEsi6CB22no+uVnvtnwTlI1Kn6dpmT0GIYuGJi4GRIATqIMWT3DY 1ztg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0V6I7vxpenGYwQo+a0w9xjv8KE9amu4CMjrShydQWuc=; b=JfpF+uLnx2sPlFyLtIW2+ibmLfTbfkTjzuNPU0r6aEiQCYuvBG7KacqriiMDdVFva4 msui70EAA6dkGCh+08+0+rZV0bn6rJuSH6l2GFk8htNKkaik3iIUhGs4xAY7iyl0ELAU FeqeNnIU0vnSaOvqD2yKo3kT35wF0DrzQj7BplsLu9UMFoxAjYpsBwdAb+UQnaU8hG8k 9HoU+QHie8qTKC1ecxIgQARXGearjChtERigEHR3CohheRXDmAZv7pzOh6I8vTkZQToZ J+ZuIxqp+IwjWi3Mzuk+MV8k1fM3UK06GzMkQ4MHjejgQM4dMWsAfZJllXkqDKVhtg7S Wqhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BNCWbn4Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si12510700ede.38.2019.10.02.09.59.49; Wed, 02 Oct 2019 10:00:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BNCWbn4Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728129AbfJBQ4J (ORCPT + 99 others); Wed, 2 Oct 2019 12:56:09 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39796 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728063AbfJBQ4J (ORCPT ); Wed, 2 Oct 2019 12:56:09 -0400 Received: by mail-pf1-f193.google.com with SMTP id v4so10694636pff.6 for ; Wed, 02 Oct 2019 09:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0V6I7vxpenGYwQo+a0w9xjv8KE9amu4CMjrShydQWuc=; b=BNCWbn4YoFqFl6WmXRRnHBUsgZ15/0sG7ZoaJNoV2ERMyL0F2sh9H6Yz4aKEHvZdvj FJID9ANMx4kNqAyZ9Z+YtoAd6pfJacgQhQywuPzDjBbBLhTtZwVTI3CUZKUGgL2PHSrq QB9oc/76C2javT9MA1DwV78kZ9l7USnccItEI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0V6I7vxpenGYwQo+a0w9xjv8KE9amu4CMjrShydQWuc=; b=JadjZeEVvUBNzzuKyphizUEvbrlvCAeNigFm59vzLRU0/2WKmHmLCGH3v2AoWsRGwi ZIKQfuKPi1toPAIJyY0E8Oytqk+3Oqu9sD1YGB8KAJ3LT6TGQADwlSfvASptpgyjGsdE PXNoDk0gloojbdbvwABN3rdMoiBZWzNICE7z4RprNyr4s6vzmUDV07Qyxe+1q2NHA6d8 nvqCbXvgG1Pjt982WZBdN/KwVlJz2Jy9veL2LK6D+b5OcyeG3V1Oh68Fow7pCDRqgl79 O6W1MjSUDSUdIXWy3e6ROYp95j+LbDjkqKZnkZYl2xWLefHHzvok0wcZY3AMMMivMcPl 4KRQ== X-Gm-Message-State: APjAAAWg2T2Rs4jPTpU51oKL5rUENan2pB1mBVTT70D4FMRYsJ9NtMX6 vDsjDlOjaumiEj9rB5XOInp9YQ== X-Received: by 2002:a17:90a:cf93:: with SMTP id i19mr5509952pju.72.1570035368715; Wed, 02 Oct 2019 09:56:08 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id b123sm27546480pgc.72.2019.10.02.09.56.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2019 09:56:07 -0700 (PDT) From: Matthias Kaehlcke To: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz Cc: Matthias Kaehlcke , linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] backlight: pwm_bl: Don't assign levels table repeatedly Date: Wed, 2 Oct 2019 09:56:01 -0700 Message-Id: <20191002095541.v2.1.I4f2ede1f55ddd1c72b0303b7fd7f73a782fa33e5@changeid> X-Mailer: git-send-email 2.23.0.444.g18eeb5a265-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pwm_backlight_probe() re-assigns pb->levels for every brightness level. This is not needed and was likely not intended, since neither side of the assignment changes during the loop. Assign the field only once. Signed-off-by: Matthias Kaehlcke --- Changes in v2: - removed curly braces from for loop drivers/video/backlight/pwm_bl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 746eebc411df..05d3b3802658 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -564,18 +564,17 @@ static int pwm_backlight_probe(struct platform_device *pdev) memset(&props, 0, sizeof(struct backlight_properties)); if (data->levels) { + pb->levels = data->levels; + /* * For the DT case, only when brightness levels is defined * data->levels is filled. For the non-DT case, data->levels * can come from platform data, however is not usual. */ - for (i = 0; i <= data->max_brightness; i++) { + for (i = 0; i <= data->max_brightness; i++) if (data->levels[i] > pb->scale) pb->scale = data->levels[i]; - pb->levels = data->levels; - } - if (pwm_backlight_is_linear(data)) props.scale = BACKLIGHT_SCALE_LINEAR; else -- 2.23.0.444.g18eeb5a265-goog