From patchwork Wed Oct 2 16:56:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 11171605 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31EFB15AB for ; Wed, 2 Oct 2019 16:56:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 1A7B321D81 for ; Wed, 2 Oct 2019 16:56:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A7B321D81 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4D2C6E8D6; Wed, 2 Oct 2019 16:56:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 19DA16E8D6 for ; Wed, 2 Oct 2019 16:56:09 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id a24so12191819pgj.2 for ; Wed, 02 Oct 2019 09:56:09 -0700 (PDT) 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=t7JrclmdXxITeBtocQWXwkn+6JXf4oLNHzw5iCFBTcK8umSc564bJC3d62y+GuGT9e 8IDStUgV/X8vWwltJtEHaUNKwnvuLUvDMevSEwOOrngnIFxtC8qlhTATl9ps6nE05p+4 5EGZiSOHUPdswBHaR1jIt+xu/LdnMka4vCzlkpU9MQ7O3LNyzGODrpdsahVyTB7GUBEl G2MiVKQ5IG3Pss7VbTJCjAT4Ba1GSpTnqjgFFucyCCHlcGhCFgaHDkaEMLo8JFOAN3SR GYnPMYE0bHfvtnydI9vKSq/QIGfjvHFeV8U+KSPzz9vGtZPmBOtpfCkJp8JWUQTprXTG AHcg== X-Gm-Message-State: APjAAAUPp4Br2kTcRYiZhE37qqCmI3+7s/ItKzbGai4tbqukZsLT67db UkY3qBsYGhAil9cJFetAHzp9Xw== X-Google-Smtp-Source: APXvYqw7iJb+eM19mWGTE2rmb9T/7FR39PHihYj+YtlS7q6rqzp4liG+5Pq1fL6s78/n2zPG//C9Cw== 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 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 X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Matthias Kaehlcke , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Daniel Thompson --- 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