From patchwork Mon Oct 24 11:29:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456115wru; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BmDAVD5Y/btN4TW6kdfibUWeoz+4sgg1UKvphwycg8H70yEBrspj27NI6lyayGugJoft/ X-Received: by 2002:a05:6402:501a:b0:457:f093:cadb with SMTP id p26-20020a056402501a00b00457f093cadbmr30217934eda.143.1666618415620; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618415; cv=none; d=google.com; s=arc-20160816; b=Yq6I+zzmgez4BCdZKvPMsXZZZ5CQcPtd3Dtev4RHbTpL4/B7O2BkzVii2wAXzksNmQ /tEZmLfOOgXFjWrcyGuasULONU1WJhoqRc2NVXG7/z3MQXjWmTt8FGOShnbsgnFA+kZ4 6/pQF+sQEBQ2XkfZMZxP5mlePx2X71jW1oX8KFZ9oV+/8kK15sET79G6Pca+Oqx9PwAk EdulA5fh9peX+IVSM91zU9Tu4MsCbx3Rsj+1d7N+gNpEjOIkpvAOZ0pVFG3dMaxg4M1m qYrf6+K7hnkJP80VB1zOISz/G1N2hXOpCWuuAMPMVTAwyFM9Bw6Jc/Cj+/mF0nrmF2gn qZog== 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=MS4M3jPRe/eceu35UWAgoEN/5imJ9m/RGty4IwYH/v0=; b=Rs92tkDqwePAdXFnh87/FNYz3OrHjEo3WYHPg/nQC+nbk9J3a8trRftWpLuq5JHBuS ZrX9x4reo5luGKLHPOdO044ktZIQ+YInB0krfEcLkk2Kjgz9/5YiQXjwTzWO0xsSZAs2 OZs63jFScCGLnb9uD/0+vwhIX9Ei293BbGmk+H3YfEGE3lOOhhSi5yGVSSnX9y9P1N2/ XocEa3QneCEGHTdghV5Ql7UjkB3ztjhtaqImsNxdJ7kgYuUzBwS9jUjFejESc8Ur5A97 MbH/oRuMZ3/XyvKi5/QK+sRjZh/TwVtifN7VZVIgjqRbiC+a3jH1PO7uIrARIZNh1gH5 kVAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D58szVF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s8-20020a170906500800b0078d3b940ec5si24550262ejj.373.2022.10.24.06.33.10; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D58szVF4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235809AbiJXNPd (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235872AbiJXNOB (ORCPT ); Mon, 24 Oct 2022 09:14:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F31333BC6A; Mon, 24 Oct 2022 05:25:02 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 6AB826128E; Mon, 24 Oct 2022 12:24:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70E9EC433C1; Mon, 24 Oct 2022 12:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614239; bh=zT6MDUv1/e0ceaKhgr+62ulahZ4sloOaOytnAgt472Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D58szVF4dQdH+LncKC1IOPB3MqSD46wlnsyH+5kAFyeRlcnxV/t5XtNWXEfwEB3JX X1zazr/OHud48EZW0QhN2HFriYYE2IEimnbMbj5099FD4o0sP6yWERWKfK0OmrXY3z ZOXYOTLqv8O02OZGvs0VpOmuKEMpson7o7Qtm/pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 5.10 152/390] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:29:09 +0200 Message-Id: <20221024113029.154824734@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576071546340467?= X-GMAIL-MSGID: =?utf-8?q?1747576071546340467?= From: Hans de Goede [ Upstream commit 83ac7a1c2ed5f17caa07cbbc84bad3c05dc3bf22 ] Commit 2cc6c717799f ("msi-laptop: Port to new backlight interface selection API") replaced this check: if (!quirks->old_ec_model || acpi_video_backlight_support()) pr_info("Brightness ignored, ..."); else do_register(); With: if (quirks->old_ec_model || acpi_video_get_backlight_type() == acpi_backlight_vendor) do_register(); But since the do_register() part was part of the else branch, the entire condition should be inverted. So not only the 2 statements on either side of the || should be inverted, but the || itself should be replaced with a &&. In practice this has likely not been an issue because the new-ec models (old_ec_model==false) likely all support ACPI video backlight control, making acpi_video_get_backlight_type() return acpi_backlight_video turning the second part of the || also false when old_ec_model == false. Fixes: 2cc6c717799f ("msi-laptop: Port to new backlight interface selection API") Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220825141336.208597-1-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 24ffc8e2d2d1..0960205ee49f 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1048,8 +1048,7 @@ static int __init msi_init(void) return -EINVAL; /* Register backlight stuff */ - - if (quirks->old_ec_model || + if (quirks->old_ec_model && acpi_video_get_backlight_type() == acpi_backlight_vendor) { struct backlight_properties props; memset(&props, 0, sizeof(struct backlight_properties));