From patchwork Mon Oct 24 11:30:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430584wru; Mon, 24 Oct 2022 05:41:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79MLhkkoDcAWn26Pdnon3yYmtIKRPvhkdjhIGn0ZwjvAbu64cOtUuNX+d0QU5Ru4cbqHeu X-Received: by 2002:a17:902:ec83:b0:185:581a:1c with SMTP id x3-20020a170902ec8300b00185581a001cmr32523557plg.78.1666615304601; Mon, 24 Oct 2022 05:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615304; cv=none; d=google.com; s=arc-20160816; b=KeaMtsDb+ZHII4JJ7+aiNsQ/vtEYJs2OnB7Fhn3NcxP+rNFAjY+ZBWzaHz/D+LpQRc 8vxhkwszIfze3bi7AJG+QHI6HnaywT1eYpCrl96MDkQsV9iQkgbJ5qr2X6lk19z2/xCQ z2xeTYxy/Vqx4vKIQt/NqdPUvcu9sA+2d8tEhLDmHToX3LkJdn1pboXEu+sqbJUBF1dx y0mWZF4IZsr5+dUYGS6dVBVkU6rzU9uuqti48GznT/icUed+6FrUEwhstXPad/3RCVHI DTMmxDdcw/BlSXJ3DwUJiaWS/wvDSJwIO12+lSJEdVp515a59M/0r9W8DWfCNn2AcUdU Rhcw== 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=W5TlCFZqPFVZMvd7vZxFCTmLiY4J76n86xvQCe2pJEo=; b=ClZlkk5YusS3unNpF1EniWt/moyCtBDvk83j3kf8yLjZWbx8zHHRqcrqc+AeZwHrSr ppI69cfeamvrp7woASwy0JwOOiwaOY7AWUG8WBIYHLQplYUWUBfoX6jv2Iu+wDO4/5ZF wYXQfRuCHvgp2mB3rd/I9CkbnWpJKbGAooAZ3BGGjI9TQyjGjZbCNUa53Y3oh8mu86+d 5YoibDGD7d4fQjBo7uURRJ5G2snnTC3Mij42SYOgItkRSvmUe4o0fy/uGmXXG8X1qp+w pnxiWO+5e/HmtFdMWryhUq+S+J9sLhrTqPtoyjNIZO3ypwiYWDCnMiuKVr0MG/y5HAsU DRhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o3ddocst; 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 k12-20020a170902ba8c00b00179f9521d08si29924117pls.149.2022.10.24.05.41.30; Mon, 24 Oct 2022 05:41:44 -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=o3ddocst; 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 S233907AbiJXMbk (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233731AbiJXM2w (ORCPT ); Mon, 24 Oct 2022 08:28:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E832C87088; Mon, 24 Oct 2022 05:02:21 -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 ams.source.kernel.org (Postfix) with ESMTPS id C59F1B811C1; Mon, 24 Oct 2022 11:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25911C433C1; Mon, 24 Oct 2022 11:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612727; bh=8veHvggDsF0H695N4ZaRHLld1XJTkiSOIyJfY6Uu+i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3ddocst3sv+7EjJg2w9vwbkBB2e6JoMl+P3iKslEPvV/G5jai9wS5zsn5qpir9ub X0KwTjoylkTkYaCvJFUy3MPNds2+E5TP52w/YiOThOYcE0OgBnjDFeCBh9CBOxXF9U vxTlBNlXD0ohlb/jua89yK1ivYBVe46+SaZydNF8= 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 4.19 097/229] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:30:16 +0200 Message-Id: <20221024113002.176828433@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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=unavailable 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?1747572809741722507?= X-GMAIL-MSGID: =?utf-8?q?1747572809741722507?= 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 d5bfcc602090..7279390a2d54 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1061,8 +1061,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));