From patchwork Mon Oct 24 11:30:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440690wru; Mon, 24 Oct 2022 06:04:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52uprqn8bsQ0bJP1cH8jHSvL/w4ZkBWvf27wXGKal6Qmt1Gq4dQHf2mVzJu9oE9LSd9NqN X-Received: by 2002:a17:90b:2803:b0:210:3b5e:62eb with SMTP id qb3-20020a17090b280300b002103b5e62ebmr30136400pjb.95.1666616670310; Mon, 24 Oct 2022 06:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616670; cv=none; d=google.com; s=arc-20160816; b=Aae6h9cJd6h3QmD5Xmb2Alq29II0fc1E1tVxJ6zgJ3X1CRkYUhXN7ew1uH2oNl3BKv YCQ648dK4GDNPHrEm/vh28tLGoojr1OjHl4jxrysGspjjt3O8F4dsItUG+s+MxOd9YPt SsQSx8wRAWf872yDnCq2cUtxOeF13tLp8sXSRJoGknYcf2vNWy8+EYMvmmn2DwTDj+MH G9WevhDjMfSrDyfJ4ulxpFU/4CXNU4Cy5cQggRD4AX8x8RtjB5wE4TxsW87brrEUXPQp XXPEkkMNswmrzdr3OEPMUt8+g6nPcnmip+Ce8Vpdu0gkY39Rn2otmNsVWZUh9OnhT8Ln +x8A== 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=NUVZHQrIrCpGMGwAu6lgP4c0WirJ8wTIQpdn0wruazc+F0bHg+ol8grZNvyVVNJ63k x2nN7glLbf4wZNs7yqzQ9DxHMNHCI+ZCoZdKUbzwODOwwo0F4Ghy1a6qz+rDYF1/qER5 GzIAxGuRlCs2kpD/zs1y4bJOP3/vRJGVNPX1xxJ4gWiMXCkXK4hx3lOOHOWTrgJDwo3w uXKZU4jy4UsHLDQn+32Gm+xgF/vecftjSw0ze2gurGIWV2hnwO8LjT2kUHMyTpA+7m3t Q187M0xSs9l/YHYOwsl869D+yfhkvkGZFewi+DTtI7ocl5KAg0H74gW4dmUANXaHdosw u3qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="N/sVcOid"; 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 lk18-20020a17090b33d200b00209a3e49f63si9576871pjb.94.2022.10.24.06.03.36; Mon, 24 Oct 2022 06:04:30 -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="N/sVcOid"; 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 S235172AbiJXNC7 (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235212AbiJXM7j (ORCPT ); Mon, 24 Oct 2022 08:59:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E1289AFAC; Mon, 24 Oct 2022 05:19:01 -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 6726261281; Mon, 24 Oct 2022 12:10:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7842CC433D6; Mon, 24 Oct 2022 12:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613400; bh=zT6MDUv1/e0ceaKhgr+62ulahZ4sloOaOytnAgt472Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/sVcOidM1moFKEGs80QigbJ0Y4hbXDkmdIS+kCvSSpdPp3YM0QIytf/VaB00cGjg Tx8Ka6LsPlts9aGIM4gQc7n3wK7wbPd5enpks/F+0+O6HuCR5NXbpapeYDNAuYzsnH MeF8Kx8Z7LCtzmvOx0RuX4v3XxP5CJZo1qNGbvQM= 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.4 092/255] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:30:02 +0200 Message-Id: <20221024113005.556081298@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747574242093060825?= X-GMAIL-MSGID: =?utf-8?q?1747574242093060825?= 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));