Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp649936rwi; Thu, 27 Oct 2022 06:08:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5REIuulviwJH9dvBpj/WM6OXraPLt/rYaAjvZC6/sYWIJGYVfGlcuTUg8wXuzTrinCYYyd X-Received: by 2002:a05:6402:22a5:b0:462:b393:f281 with SMTP id cx5-20020a05640222a500b00462b393f281mr491374edb.379.1666876091312; Thu, 27 Oct 2022 06:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666876091; cv=none; d=google.com; s=arc-20160816; b=Z4n827EWNVwPEJXshGWiKhRuUBC3AkTUJ/4L9OIEbk2JWqs3E++bIUafqgh8W7Sn0q wmW3G2TnOgYFqiVVsUUalXCrafWvW3k3yBaEIBD1I+5SZSyc1wrLgYjZQav6wM7ptcHD tv27uM+i11NE+5Be7rznIyBDDIo4o4tB9m2cacfwD4qVNpGFs8e+qqOtbMO2Tj+FTBwW GSvWk7Wd+vz62NPX4/Pd2MUEKDmNZPk4YUYOWWn3+KYLPExj029wgh2/9JNvH5wjXGBk mx7FChyZhuFsK257zlLbti+7+K12t9+wiMRjF3hf72uU3PChEjmn4lwbzftTAwHo/nu3 AGyg== 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 :message-id:date:subject:cc:to:from; bh=ECwv/Uc25sa+/xSiN9Cq8YvSyPaqJa8JTexE54dQAIA=; b=HmEuhYw6+25fZxCP7oH+HKywpjQ61/NNqLOq0iX1MxQqa64wbdLLiRRm4iapEJ2OMl CcADQHmEsM/b07EvWAR1RusdJ6MScmghGH8E/7qjY41JTfhgXEYjRRty1un6cBV0jXhB 5Zjv416zobV6JjuQum7VPFFqopQ4YL8Lp6C/aHUXlLZ8Pb6jn7AtBW1voJXy4k4Djz9z pQdTD+msZ91ZZsQ/nUu+PE+UOYeSBhL+0+B0eZAhvIbNsWe/ohgBSFkNRYDUNQ+KMYNn wt3l3Z4QDq7G8r7CcQKNswXEF9v84WPIbCWGeWxYQiqKExfasFxAiOsIJHDL9Ra5/J1z +I6w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd18-20020a170907969200b0078bb4d5db86si1743663ejc.77.2022.10.27.06.07.45; Thu, 27 Oct 2022 06:08:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235821AbiJ0Mws (ORCPT + 99 others); Thu, 27 Oct 2022 08:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235829AbiJ0Mwq (ORCPT ); Thu, 27 Oct 2022 08:52:46 -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 83F0080F7B for ; Thu, 27 Oct 2022 05:52:44 -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 230DD6217A for ; Thu, 27 Oct 2022 12:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79105C433D7; Thu, 27 Oct 2022 12:52:41 +0000 (UTC) From: Huacai Chen To: Huacai Chen Cc: loongarch@lists.linux.dev, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, Huacai Chen Subject: [PATCH] platform/loongarch: laptop: Adjust resume order for loongson_hotkey_resume() Date: Thu, 27 Oct 2022 20:50:47 +0800 Message-Id: <20221027125047.3450683-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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 Some laptops don't support SW_LID, but still have backlight control, move backlight resuming before SW_LID event handling so as to avoid backlight mistake due to early return. Signed-off-by: Huacai Chen --- drivers/platform/loongarch/loongson-laptop.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/platform/loongarch/loongson-laptop.c b/drivers/platform/loongarch/loongson-laptop.c index f0166ad5d2c2..0e6f4efe21e5 100644 --- a/drivers/platform/loongarch/loongson-laptop.c +++ b/drivers/platform/loongarch/loongson-laptop.c @@ -199,6 +199,13 @@ static int loongson_hotkey_resume(struct device *dev) struct key_entry ke; struct backlight_device *bd; + bd = backlight_device_get_by_type(BACKLIGHT_PLATFORM); + if (bd) { + loongson_laptop_backlight_update(bd) ? + pr_warn("Loongson_backlight: resume brightness failed") : + pr_info("Loongson_backlight: resume brightness %d\n", bd->props.brightness); + } + /* * Only if the firmware supports SW_LID event model, we can handle the * event. This is for the consideration of development board without EC. @@ -228,13 +235,6 @@ static int loongson_hotkey_resume(struct device *dev) } } - bd = backlight_device_get_by_type(BACKLIGHT_PLATFORM); - if (bd) { - loongson_laptop_backlight_update(bd) ? - pr_warn("Loongson_backlight: resume brightness failed") : - pr_info("Loongson_backlight: resume brightness %d\n", bd->props.brightness); - } - return 0; } -- 2.31.1