From patchwork Sat Oct 22 07:23:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1111217wrr; Sat, 22 Oct 2022 01:56:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sKCyiDur0uHLcm1wQ707oWzCrWE9iHjQQhfiFFpwiz8xOUOURHh042ssX47uRcJpMGOJT X-Received: by 2002:aa7:c6c1:0:b0:460:f684:901a with SMTP id b1-20020aa7c6c1000000b00460f684901amr10684716eds.6.1666428990068; Sat, 22 Oct 2022 01:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428990; cv=none; d=google.com; s=arc-20160816; b=HwayaMm5RAPdpuw3lku11Y+K72+w5MxwNtKp+KNCDkJFAuC6v5uV7ZV+OtoqV/IeXk AlX+mcYLnie5nuS5k+3RauFxdWInK6GblpXungTxnaNGdTMGEi+44O/31/tflozzMD/V 6bRdPOffC622LI/QhxrrhEeLVgf8fRVV8ciR1JyOvysDlZkbBqeg8KlJDfwoq2lWyuLO HzTNZUpQ8sHy9XZtE/cqJW3qC13l+SVPQLWqrqE2BbAGGcgHLhfbk4fybqlc5KSVTJR5 rXspkMep0XPZ91gxqwnROfn4Y+6N0tgXhP3mVHOflNcROgp+iLCl+3jErJpM+OxRBcEv Jg6Q== 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=d9mRSBcO/kVptjHMUXYXMRtiOjeQNEKgC0hvTIlWPzjzhLi7smYXKzgF+ImJsTIznz Nn7309mw/Ene8wP2RM/jz9oJ7ieBrbYCnPvaRXR6L7P8TOfKC6LLpj4oFx2Gw4bBH89p vsWkE8zs35EZM4pR7T/Cg3tZJt13pOTJn9OZExiZqMJt3N2Rp8PVfRHuP2p+1RyiWASV IwRZCpyQnJ6y0pO/c+0PQFqn+tQgBFREhEIIu182XAHGT64Faq2cUFnLL438NF4ccqGe qncVAHRBDaYE1s6PTsW7vbc56PXhv8mLXE9woT6rc052cKsTKof/oExndk8h8He0C/AD sRyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2oPgO31E; 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 qa44-20020a17090786ac00b0078a10c159b4si22489663ejc.290.2022.10.22.01.56.06; Sat, 22 Oct 2022 01:56: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=2oPgO31E; 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 S234905AbiJVIzd (ORCPT + 99 others); Sat, 22 Oct 2022 04:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235021AbiJVIyE (ORCPT ); Sat, 22 Oct 2022 04:54:04 -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 B15B92F3DB5; Sat, 22 Oct 2022 01:13:07 -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 043EEB82E26; Sat, 22 Oct 2022 07:48:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5958CC433D6; Sat, 22 Oct 2022 07:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424889; bh=zT6MDUv1/e0ceaKhgr+62ulahZ4sloOaOytnAgt472Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2oPgO31EY3XgzCFS5eBicQfbpLGjOlMBmPW2LYWg2Pnc/qFxYzAgW11aPIOpUmcaX iPNOi44Omx3wCiV454MmrH0U5fXf2MKN+3vbZ6uwSBpX3yjevtIGy1scd56VzcXF1d HJnfMNMt4eEVh8wDUwcnu4YP8nAdidb644BeD++U= 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.19 314/717] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Sat, 22 Oct 2022 09:23:13 +0200 Message-Id: <20221022072507.831291749@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377444998545136?= X-GMAIL-MSGID: =?utf-8?q?1747377444998545136?= 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));