From patchwork Tue Oct 1 23:29:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 11169915 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 42B37912 for ; Tue, 1 Oct 2019 23:29:33 +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 2A7C221920 for ; Tue, 1 Oct 2019 23:29:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A7C221920 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 2E6276E8BF; Tue, 1 Oct 2019 23:29:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 70F196E8BF for ; Tue, 1 Oct 2019 23:29:29 +0000 (UTC) Received: by mail-pg1-x541.google.com with SMTP id a24so10823845pgj.2 for ; Tue, 01 Oct 2019 16:29:29 -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=EcVg9u8V8Uf/idldytEF3NgOMyW0OU8oijTXHZJkyVg=; b=TOYI4pUr+ispKOGhtZZnAagsHKnPVmV5MF+u1Dtd1GqWNEt1g/GXMLbSXUvVRCSsry ZNcrRy6W91nHnWz5JdVq5b89KLAMuWN7/azNApn8QBwZ4Gfn1cTPCxQc5RsaaUuqE+hC d6q0LSUlxzS7lCva35eSr5mbMLSIS5gAUX6u/rAcYg1g3Ny+G2FO+DHcpkwe7bYmdfNI /54FBLa8QCOpIoPmYHmaOgERlp7rxwStMf8kBVbLI/zHrLAMssITqrBk2p5BFxR/aJDz 9AG6s3A95y/gmziAAT1knQX9uWOJVs6TmnPxwVrUR3lXLn8YWK/pnl6Py6Adc1Rj1VkX fCtQ== X-Gm-Message-State: APjAAAX7WVsAMCXGgBg85W+vZJlSZ+px5rR0+VcZSLKjOs7TBLl/zQfc 8+sG0mK1IP2UfHpRQl8dLnox5Q== X-Google-Smtp-Source: APXvYqyttY662qaZ9at4NRsqD7ukXbj1wr2h7SXDVAWfKw7gZzdYntUGCR2evMFpv1BqiZxzO5THcw== X-Received: by 2002:a62:fc46:: with SMTP id e67mr1005912pfh.153.1569972568837; Tue, 01 Oct 2019 16:29:28 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id c8sm20990266pga.42.2019.10.01.16.29.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Oct 2019 16:29:28 -0700 (PDT) From: Matthias Kaehlcke To: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz Subject: [PATCH] backlight: pwm_bl: Don't assign levels table repeatedly Date: Tue, 1 Oct 2019 16:29:24 -0700 Message-Id: <20191001162835.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=EcVg9u8V8Uf/idldytEF3NgOMyW0OU8oijTXHZJkyVg=; b=LoLWuA/zt6wQo9niY6rS50WlST0jKh8TXiLphIX/HwUpy05ohub5qr5fmX/ajPIl38 XXY9DeDYzLb3r6VQgb82GF+lkIrTF0YatAYRiWTOyE0EbZ19L9ZzOE4ZksI8EWzk99qF HppXuMICfou5mYFPWkwYg/UF2L+14P67qumf0= 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 --- drivers/video/backlight/pwm_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 746eebc411df..959436b9e92b 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -564,6 +564,8 @@ 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 @@ -572,8 +574,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) 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))