From patchwork Sun Dec 10 20:24:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 176401 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6683685vqy; Sun, 10 Dec 2023 12:26:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/XpNjMX7v6ZSsGDo04FTmsMpHrzVRZg7cwazNqeNrcDBtSGcSQ0B4L0mzS1sVjZi8T7o6 X-Received: by 2002:a05:6a00:1806:b0:6cd:e8c3:f733 with SMTP id y6-20020a056a00180600b006cde8c3f733mr4123223pfa.3.1702239976104; Sun, 10 Dec 2023 12:26:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702239976; cv=none; d=google.com; s=arc-20160816; b=fFHNjFlPw+ppb27xIS+87HMgltxTCB+sf2bQJNnkwE1WcSYB3MScLBkTX4rXt2gztT 9cNCNilVYGTjUYgi1IKiSeJC8Kl9yfMZsyeqd9W6VnuDihlgzGimIDRyFl4w1IoS8tGE Die8vg9dl6Wr6vwAhZbucbn/fbPckeBWTtGMzqBIUYGdoLYdXGND810Zsu06dzNN36YL H2/gW5+VMyvedw53thS9HfF+QjogilWPMHvT2cGVpsP/wHpq6ZtQBboKt78HDFY6rMYN vCuk7oc1FIfkaZ/DDqaQUAE0BoMCm9WJYPgfP4Ggjei8kAKCLrqLOEKKFJ4r8RhLqEiU S0hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wi7iFZAdZjQ1lXCpBM19mrbWNCdOf5EsQ2woTmJKhg4=; fh=li8yxIESWfZR7lmBO8wCmgOg4WdXsWPyQvEuWPhaOvo=; b=qoopXBtQAqMVM5HX6p2ivcHfwt7BgcUmpmx/f30yIpKS1EAt4xESEzRuMIP6C04sEv 5Q7p3u0+a5EWuHLf//MS1xEO1q/ZqEa2vFKI/xWCbucTbdSVZniC1IK1BgX7u+rHLsI6 gkH4cc7D0CHNPSO+wMfv358ujAdTB7rtaAZsnltcVL/qIQ2HXpoxj10U8eTLGF3B7MYf WdQ1wS7gUORHiwG62wJP0B54pEPVGGpHfxs09IFWGAem+cBPvdXDgAYNEU0FnrX+ZN7w GVPbEKVcIGPPhLCnrEaArr0Fa4ojNHlyS08JwoQefGXa9xHqsy8i5TS23e+5Ye97ekAH Z9nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=HzBsEK2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id l3-20020a056a00140300b006cd989cfe42si4936685pfu.7.2023.12.10.12.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 12:26:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=HzBsEK2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A785C80758F0; Sun, 10 Dec 2023 12:25:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbjLJUZA (ORCPT + 99 others); Sun, 10 Dec 2023 15:25:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbjLJUY5 (ORCPT ); Sun, 10 Dec 2023 15:24:57 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BC51D9; Sun, 10 Dec 2023 12:25:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1702239890; x=1702844690; i=w_armin@gmx.de; bh=nEzwU52lYQi+/R9GIe0rBArnh2CCXp/tBe9TfyhvPCA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=HzBsEK2jbC7OYIDMBKiLE6ndf+6zsa0+OuRKfPYxi1ccm/G8EXR9mWriMCsTgLMD OxWce9PKoMzJ7rc/qb3I056WBaEO0+wv1lZRJjiUFwj1uwgxpCkcsHudxhtiKA7JB TFrEm69cMgRSm7TEdTtrKEdCIU/eAlmUgb0L4WLXbpMftnV4bic1twqWq1BsXEMUM 5N9MXnEU+QmU7vu5YsNhnwNRhOLFdbhXkvGVUwbQoXB46be0pSKqI/jLFzUz5vhBv wb5KDMCSkcRZzxXbk3416fn+BqVlP0Js1Lh2VmJP/kWHiQGx7LTCYSYO6Wy6kqVOJ r8mDLAfBZtEek7zFqA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MCsQ4-1r3evi0EvQ-008q9M; Sun, 10 Dec 2023 21:24:50 +0100 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, corbet@lwn.net Cc: Dell.Client.Kernel@dell.com, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] platform/x86: wmi: Remove debug_dump_wdg module param Date: Sun, 10 Dec 2023 21:24:39 +0100 Message-Id: <20231210202443.646427-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231210202443.646427-1-W_Armin@gmx.de> References: <20231210202443.646427-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:18uIVdOhrEMyff6XzMXk1KWrC5IIU9dSuao/uPp08FVCUmbmN6h 0gagiKgH/Ohdhefw+Gu267noKKcVjc+Bb+YI3gbbLksc+5TlzuOnyJ/LJuCX+0JveOvd/L1 kNGnLQOs01BY97rpWhP01Nks866uTnEdTRXXEjUwB+5SKCYFVU/SVqeg/zdm3tLZzPoNtIz PX3zgvYHDa5Hu+FHEMzTQ== UI-OutboundReport: notjunk:1;M01:P0:2GkTMKMnWyE=;q5W6DdyV1IzpPDr1aVejIBdZftA berl80ecIpCZNOD9M3GBQibfovAzxfr2RpvM0WOaBJUZ/UxQ4d2JzauQcnaBOZGfaFyXEkXJN fjdsMP06IoZhxCA8xRK/hZE61d5XyxedIQDjqRjpvHWlmnGxtv1Ehb9UEcqwpggwknd2cgwIz MXAEvw9/jCsy8nNXkeOPFqZ8orQ/uac0CzmtYeylYu/pNX9Fp7/SZt+UnQQzcWVP/NaJtzcHN FxW/nck1g1P9JWYfRUMmlcvRD2xh4lnuIZ76hZoQFK/bLri4uE6ZDbeCkpDmVJpF/bogxMMi3 1w26AMP35ybsOMokULwKiqkD/0h7jz6EtU0vJthbOISm2XIuvKIfIX+XfjbX106w2m5QLlkiD fQKzLr+K2SdLwZ3+mbMRmrBSqKATFOP3og701mIpU8VeWC84+95OMyzhglx5sahfFfAUTwZHI OCF74JcqkHC1aTockj/P1f28ruyJziRvd73HEUlxaV3nZaIG5IcYxjABTb//Y6fVkS62uc1jc eyKNzq2UAY+yhrrpHCeh1BomeLz/6Q+5XT2246tTbWgleaUhn74pfrI/UUq6JQOCtlBsOEj/n Lige9A2Z5AcmJtQXLuLRZ5204fLEb/9/yTuniZ2/aktdgj2nQ5k0+8HGh3XHvueKPf93N1Sya 6sktv+TXpKC0aajMRa54DginfTvPqq7Nmc4SPR3sxOmV+6S0DNsXRUUGPJv47SNvJK9OUWL1+ QOPwTTaGQU02heir8Ccn6G7FFmMxjwCz1lLYIlSzHWics0tN7ePzDo33pbHh7M8YZPdAjOBdJ fTtsU9PHZKMFjRI1vMj8rmla3CTrQmh8lNLTOYVtXA3Z+TnP5TUOCkp1f5XNNV5UHHOhUeErF qSCfOW5EF8C0/293RF6izn14VChBpYTrbOKt8MxMcp3vS/ykILle2PT+gYtIZHRb2BsBKD5ku jQ8S9ZfJ9b/69Hmr4tCr1ZnvlMA= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sun, 10 Dec 2023 12:25:43 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784927985161550987 X-GMAIL-MSGID: 1784927985161550987 The functionality of dumping WDG entries is better provided by userspace tools like "fwts wmi", which also does not suffer from garbled printk output caused by pr_cont(). Reviewed-by: Ilpo Järvinen Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 31 ------------------------------- 1 file changed, 31 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 4f94e4b117f1..e8019bc19b4f 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -90,11 +90,6 @@ module_param(debug_event, bool, 0444); MODULE_PARM_DESC(debug_event, "Log WMI Events [0/1]"); -static bool debug_dump_wdg; -module_param(debug_dump_wdg, bool, 0444); -MODULE_PARM_DESC(debug_dump_wdg, - "Dump available WMI interfaces [0/1]"); - static const struct acpi_device_id wmi_device_ids[] = { {"PNP0C14", 0}, {"pnp0c14", 0}, @@ -597,29 +592,6 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct } EXPORT_SYMBOL_GPL(wmidev_block_set); -static void wmi_dump_wdg(const struct guid_block *g) -{ - pr_info("%pUL:\n", &g->guid); - if (g->flags & ACPI_WMI_EVENT) - pr_info("\tnotify_id: 0x%02X\n", g->notify_id); - else - pr_info("\tobject_id: %2pE\n", g->object_id); - pr_info("\tinstance_count: %d\n", g->instance_count); - pr_info("\tflags: %#x", g->flags); - if (g->flags) { - if (g->flags & ACPI_WMI_EXPENSIVE) - pr_cont(" ACPI_WMI_EXPENSIVE"); - if (g->flags & ACPI_WMI_METHOD) - pr_cont(" ACPI_WMI_METHOD"); - if (g->flags & ACPI_WMI_STRING) - pr_cont(" ACPI_WMI_STRING"); - if (g->flags & ACPI_WMI_EVENT) - pr_cont(" ACPI_WMI_EVENT"); - } - pr_cont("\n"); - -} - static void wmi_notify_debug(u32 value, void *context) { struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -1343,9 +1315,6 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) total = obj->buffer.length / sizeof(struct guid_block); for (i = 0; i < total; i++) { - if (debug_dump_wdg) - wmi_dump_wdg(&gblock[i]); - if (!gblock[i].instance_count) { dev_info(wmi_bus_dev, FW_INFO "%pUL has zero instances\n", &gblock[i].guid); continue; From patchwork Sun Dec 10 20:24:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 176402 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6683724vqy; Sun, 10 Dec 2023 12:26:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgCrd6truZcrI1y1OlouDydOEME6ibXfMworvU8AbyYhnopoAPjI5dvz4RMt8noU2k8lfB X-Received: by 2002:a05:6358:3419:b0:170:d757:f369 with SMTP id h25-20020a056358341900b00170d757f369mr407943rwd.38.1702239981497; Sun, 10 Dec 2023 12:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702239981; cv=none; d=google.com; s=arc-20160816; b=xlLWOv61n3OH3h6/cSW618VrOtKgo+CJ9MNSM+IiKLkY4DJGgDteV3a9HccnEvaRWB EbpPypYZJIPV1d1Xn8aaHyc/DVu4f4Ky1APpJmnz5WxxiSKtSwxX7LLA3/8R89UAZt+H 8BXMACWMJZetMxPfqrcJ8bZ8Yqk8cRwO+VI4FoJNsjLsNO8cmIrYMucwKrcvkqXGzIbX Ar8u8S+yZFye6/qOTO+HHxcn7dQ7FD3+MYJ0zbtl4KeDrApgIBY4qRHOGuxQ/cWyP7o8 gWrmuMhupqmUXtBB4KcPW7P3vSVPWx1tLdkEmUJDFNdFcBYjCZO0KlG5fS1RLqw//JUo IjcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+N2ylLtYz17NPtKniZ0dtS5uaRiZukdehyRKgNvix/A=; fh=li8yxIESWfZR7lmBO8wCmgOg4WdXsWPyQvEuWPhaOvo=; b=vCmk1Pb5SsrT9iEfEd82/fX9ybqdwElVui6bxBcCnIawdheNthW3eWKVb/8cMEGTZ+ 7VFQAMvDardBxWFdT6Mwtec5oNMvj9gIIDzmdfpQgjGAnS8ADu9pEJEORw+A+bVyYC8B jemcoQ3EMw8hqyQO/3bY3SQbSlbM7PLh+FZZh1vmjfFHg+HxoAJ/RVZf7T8j7+s4AKC7 3VKLGuDgp0vjPcaOtvEX6/4BfIPFvAhrjWrRGBivHG3m4/krY6Y1DaViLjDgDUT/rSpy JgkOOI1TkCZkxMbotUQJN4QOCtuUtU8o8Y9y3RPUjujhgmIsM6b7Q0h9PecpHS+ayZDh oLzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=kKncfG8h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id q18-20020a17090aa01200b002888a147111si6340519pjp.71.2023.12.10.12.26.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 12:26:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=kKncfG8h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9D9D6807090A; Sun, 10 Dec 2023 12:26:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232095AbjLJUZF (ORCPT + 99 others); Sun, 10 Dec 2023 15:25:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbjLJUY6 (ORCPT ); Sun, 10 Dec 2023 15:24:58 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43DEEEB; Sun, 10 Dec 2023 12:25:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1702239891; x=1702844691; i=w_armin@gmx.de; bh=9X/ndjF0qighzqFD38BDT0oCZveOZxeu5EzMzNvtGSY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=kKncfG8hsHirtke4S1FBYVxunBEoaYhoOLsxAWAJJv/YMBipY+16uKMEMQuRjECo 80YNKY1uAiv4fhqM33Id0bBzl3lElqVRnyJl2WJa6qCQy2O8NoIAli8GDiCEvpPDK Bn1mtNKE/09GxlpnQxVt3fdrNQiRXaExxp8eRaaL7HQGNTdprhfkS/uK9ZRlCUWAF m3yyw+bMr7qghUx9+Ky38q4IG7YRFP5b6MMVU5Bo5qN93TshYZrMb1yaL2GR5wLPD 6paonzgMgcg3CN/czrldEMb7g4M6WxDolHAcJ3RWrwNv0mKmbgwUGnyrdYrCl6zB8 +na7+EtFf6wdrSy68Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N5mKJ-1rIxiq1mPr-017Ho0; Sun, 10 Dec 2023 21:24:51 +0100 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, corbet@lwn.net Cc: Dell.Client.Kernel@dell.com, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] platform/x86: wmi: Remove debug_event module param Date: Sun, 10 Dec 2023 21:24:40 +0100 Message-Id: <20231210202443.646427-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231210202443.646427-1-W_Armin@gmx.de> References: <20231210202443.646427-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:gxVqnCyDxUDGQkxB/vb9rTwI2WIj9Lz6rYKGNRn2PQV5PzSCuKe RazhoLs+5F1OSGabVdlzXr/H/IcTChsR2CGMgXd6jknrbKnrEo4ocdAj1I4fXwHXqkDx48t kO0C2oMu5gel2Pw9B2p6iBoz0lRxDOo7KSeAF0icXSMcMsmgtWxfRnitc4r9yj8ILz5N0Ay 9e5EI4rRhgwo7RsiIGNrQ== UI-OutboundReport: notjunk:1;M01:P0:sILp1v5shW8=;Acn5DnIaQxHF1DQgghBbQcgUHhH As+bLb/RR+xof6keTYpLFqjD3pyH3gKx1mUoL6uSWlf3EHsmkXimoS1TBTVasja6yn8n3OJUN 1+BB+VD9V8Z7DxCqGOCOY2DEhlxtlawYAtTpa4RWhBOdkHrpOoGN2rQPtjqZRzMvzZb2arMls JOxFFZe9HdMJS9aui4HaG9G68dWKshmKtKPhMotJGBu3E2o2vRrhYMY6df4xwnyxm1JGw9PqZ TE++MOl9J+xnGv8whkRlbfmrad6G4ddbRW0jhTbyh/Fhw95J/Mn44tXFPPdV0BiIHjC8CdhrR qT8su+wYn4W8lGsAemHujMyy3kNyWBxkuCy07heco8m5oedXDAe77BkhLX3CefxD4aehkGPEy V9rG1amxfbNlAHQM84CLH9Pdio7nnTxLIqaOEoWq5UHsDoDIQZc56gG5s3XDHJXFmpd8cDwMr Dp4Wps2txBhdxPS6FqgoHH32B8q1vchhkmRQxPc+EHQMLT4aIeNPUaYmOtBFyALP4kU1L63yI JlKgj7XKqiWiX5uJvGLS11lyrXeKltVRCJ7YKzbE2G8ObeQbOpuTZDPSDS28ncBitoSRXpRI2 eUZUQHFGSt4wDBS+VqmvZUdbHs+om7WYxhXF1GQZ2CJ4PPN5nIe5iTXEckwKuBb/I8F/joY1X 7wXKudVBVI4beQWdV9BB1vp3rdIjLOaticKS8uQQcCHojteumAtoiikdDvsCujRU0DcllOVD7 K7i6qxTAjXUy+UG2YhbkWabDaGTUoItWel1emFQ6/7sc0ntxZ4TB9ZpUIfHlz5Rk75jGyjd0o KKHgmNhcgPJGezKx8vajAMaYXLAAX+G0L9tmXzsFqNWQCVHwvHbSxABS1oeYrYxK4iLl8IpZ2 Rj+ke4JO339fggMHFmjSnK0YaDDgodPi8467Cf3KmUtcfruSaelBUwCJVlYqCEpYNR4hsVy5A x0HdzVc4Mp5f0RvZRrElueaafis= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 10 Dec 2023 12:26:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784927990875839573 X-GMAIL-MSGID: 1784927990875839573 Users can already listen to ACPI WMI events through the ACPI netlink interface. The old wmi_notify_debug() interface also uses the deprecated GUID-based interface. Remove it to make the event handling code more readable. Reviewed-by: Ilpo Järvinen Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 74 ++++---------------------------------- 1 file changed, 7 insertions(+), 67 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index e8019bc19b4f..7df5b5ee7983 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -85,11 +85,6 @@ struct wmi_block { #define ACPI_WMI_STRING BIT(2) /* GUID takes & returns a string */ #define ACPI_WMI_EVENT BIT(3) /* GUID is an event */ -static bool debug_event; -module_param(debug_event, bool, 0444); -MODULE_PARM_DESC(debug_event, - "Log WMI Events [0/1]"); - static const struct acpi_device_id wmi_device_ids[] = { {"PNP0C14", 0}, {"pnp0c14", 0}, @@ -592,42 +587,6 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct } EXPORT_SYMBOL_GPL(wmidev_block_set); -static void wmi_notify_debug(u32 value, void *context) -{ - struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; - union acpi_object *obj; - acpi_status status; - - status = wmi_get_event_data(value, &response); - if (status != AE_OK) { - pr_info("bad event status 0x%x\n", status); - return; - } - - obj = response.pointer; - if (!obj) - return; - - pr_info("DEBUG: event 0x%02X ", value); - switch (obj->type) { - case ACPI_TYPE_BUFFER: - pr_cont("BUFFER_TYPE - length %u\n", obj->buffer.length); - break; - case ACPI_TYPE_STRING: - pr_cont("STRING_TYPE - %s\n", obj->string.pointer); - break; - case ACPI_TYPE_INTEGER: - pr_cont("INTEGER_TYPE - %llu\n", obj->integer.value); - break; - case ACPI_TYPE_PACKAGE: - pr_cont("PACKAGE_TYPE - %u elements\n", obj->package.count); - break; - default: - pr_cont("object type 0x%X\n", obj->type); - } - kfree(obj); -} - /** * wmi_install_notify_handler - Register handler for WMI events (deprecated) * @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba @@ -656,8 +615,7 @@ acpi_status wmi_install_notify_handler(const char *guid, acpi_status wmi_status; if (guid_equal(&block->gblock.guid, &guid_input)) { - if (block->handler && - block->handler != wmi_notify_debug) + if (block->handler) return AE_ALREADY_ACQUIRED; block->handler = handler; @@ -698,22 +656,14 @@ acpi_status wmi_remove_notify_handler(const char *guid) acpi_status wmi_status; if (guid_equal(&block->gblock.guid, &guid_input)) { - if (!block->handler || - block->handler == wmi_notify_debug) + if (!block->handler) return AE_NULL_ENTRY; - if (debug_event) { - block->handler = wmi_notify_debug; - status = AE_OK; - } else { - wmi_status = wmi_method_enable(block, false); - block->handler = NULL; - block->handler_data = NULL; - if ((wmi_status != AE_OK) || - ((wmi_status == AE_OK) && - (status == AE_NOT_EXIST))) - status = wmi_status; - } + wmi_status = wmi_method_enable(block, false); + block->handler = NULL; + block->handler_data = NULL; + if (wmi_status != AE_OK || (wmi_status == AE_OK && status == AE_NOT_EXIST)) + status = wmi_status; } } @@ -1340,17 +1290,10 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) list_add_tail(&wblock->list, &wmi_block_list); - if (debug_event) { - wblock->handler = wmi_notify_debug; - wmi_method_enable(wblock, true); - } - retval = wmi_add_device(pdev, &wblock->dev); if (retval) { dev_err(wmi_bus_dev, "failed to register %pUL\n", &wblock->gblock.guid); - if (debug_event) - wmi_method_enable(wblock, false); list_del(&wblock->list); put_device(&wblock->dev.dev); @@ -1445,9 +1388,6 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event, wblock->handler(event, wblock->handler_data); } - if (debug_event) - pr_info("DEBUG: GUID %pUL event 0x%02X\n", &wblock->gblock.guid, event); - acpi_bus_generate_netlink_event( wblock->acpi_device->pnp.device_class, dev_name(&wblock->dev.dev), From patchwork Sun Dec 10 20:24:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 176400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6683431vqy; Sun, 10 Dec 2023 12:25:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHFu6BH2gRNd6Sywhi6BSKaBk8Rup1lTq27uOp12xjHqBxJBON2XtNwNtJkGltxTEA329t X-Received: by 2002:a05:6a00:b48:b0:6ce:6cec:ff26 with SMTP id p8-20020a056a000b4800b006ce6cecff26mr3950848pfo.52.1702239922641; Sun, 10 Dec 2023 12:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702239922; cv=none; d=google.com; s=arc-20160816; b=deLcMmA2RRy7sBP/QpIre0tZj8frzHdxfhAwZYz1d8VBP3B7vA4A8/efzD64xb9a6c FfjwUjghqc/hz753Ein4KUHqbAv395H3pHcDQ8GribQU+i33AxYDF8x66oBFPBdosaf4 nvy8MesDM47DRkJjNeF6eh5o9FdLjFFAvca0l74ineUNqWMLXyjS/48MJhB92FHtmwKO Fa4DBPwiBYL2o9qzo3OofGCKma51CT5i99cS3SwA1DAF0rDteNNwnlNXlP9ZROKGKkTV eHhVcLSZ83A9oZY0XrV397/1whRDKqSgTUXzA22J+tkuEmLac5yh1IiGOLmkKDaCrB/6 508g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LEMJwxO7CGuQa7LwyJolyrSryTlCdeSHj6fnANjrZZE=; fh=li8yxIESWfZR7lmBO8wCmgOg4WdXsWPyQvEuWPhaOvo=; b=jpjwGXFKffu3c8MFw55qLRqeO6C+TiF761wK30bZd5JQ2wq2Yz5YVHAEaHQVdswSHl lewa1OEnXd/S1lxWsd6I63b1in+5iTWfkF6kyG7l6SyiwgBNSD+1Rh0WH3cCszTcJg9Y lXXu6s6oxQpTHIqRRHlKBTn5ajpNjW4lYkU6fePKb9mqUFObSrxR/+NFK9mnEe7DJzFT BlmfHqlqW9NTdlWQkXWy5j3Pi08BBOE4oV6pPfd0Z1s0JEODovSLSqYM7jNuBBZ+/xIS xdwlRKvYzdlDOKEG4xEoqpOWLAgyIMx0gYuV+aUrg2kHdd0SNJOQKYde3r3cirg8AswF zidA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=HL4fAqYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id g26-20020aa7875a000000b006ce7afb03absi4850225pfo.131.2023.12.10.12.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 12:25:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=HL4fAqYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id AA20980758E7; Sun, 10 Dec 2023 12:25:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232040AbjLJUZC (ORCPT + 99 others); Sun, 10 Dec 2023 15:25:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231199AbjLJUY6 (ORCPT ); Sun, 10 Dec 2023 15:24:58 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14411ED; Sun, 10 Dec 2023 12:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1702239893; x=1702844693; i=w_armin@gmx.de; bh=bcwM7hu/lcoNUcXT9dFzmhq7Supu1dDMMBv0VFimJQo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=HL4fAqYkma1u8ZKR7xX4zuocV4SBj/Kw6H//5VBdLrklAsq0VriX7YABvcuOY7XA wsdNzq5i49THtS6eznSB3V1PoMcBVjXiS+rYFEmUOJyzId1NGMRul2IxR58Cpmo4U wSgCn81ZwYp8yro7L7zmmxDZi6jf65AcAEK87/fMplKDiKZQWkyH+mXbQzvDRUw7T X/++mmDQ3im66egR0lDtr/lGyytUTuluDIFSPa+LeFbWpfSTZkQjfazuO9JUaqawL bg6PuoWMpy6vHl3QRujY1MC8/14+ZCBy/UxrQIS4N9vVSNhuG7MeIExtfcu7OrhZF ekddb8gJk+Bl6dlZIg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MuDbx-1rVall3qw9-00uaqy; Sun, 10 Dec 2023 21:24:53 +0100 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, corbet@lwn.net Cc: Dell.Client.Kernel@dell.com, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] platform/x86: dell-smbios-wmi: Use devm_get_free_pages() Date: Sun, 10 Dec 2023 21:24:41 +0100 Message-Id: <20231210202443.646427-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231210202443.646427-1-W_Armin@gmx.de> References: <20231210202443.646427-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:BDkhbzp0Ms/xMjG+rWvrcWO0esNvAHqEEaXbO9olz0GfgKb9TNt Rbk9twGQV9tWEi6WzSVtYF9ar9PDyjM2P9UDz1MsLXF04ja490vPd7+gLh9D0cLtc6n87q3 oygjGyB/uRHcDhRh2/5itNDJMkkS1tZeTDk/OP1FBi8XcvxNjaz1e90SXPuA0siLM8rcDIC FEV9bZeaPF5DRfn/hDTYQ== UI-OutboundReport: notjunk:1;M01:P0:vLvsShTP23A=;RmVEsdEKKFRbmbwMkzI8si2pJzM S4wk2Ea46NLWGCFPHRczfqFK9q35pBrRzAdMsQnqJMJOfkVF2ReSmSTaBS7mc7guwl8i8w18A b8SrSPPDRtMGlOL6JI5qsa2OvIA2QY37XWRFakEheL6yA6RzffGWKbRA+DaaZ0cP4VdQggRZ5 59XhbEgWx12+uTMP1sXrCjrLBjrpUQEVQ2IJ1rK5lUA4lhp8yL6R70qMWOqJ65aW+ouFC9cPD OpnB4Umn8wqsjHyT10INl900GAlaeg8a4ZuATbu6mEdVbmhpXeTLOj29iBml7NipWc3VjaPTE SD+5k4dbBPYJ+IIHf7YrKGc0zV2M8L0m/DarR6CMpFu2AGzClOsfcLZPW0NizToJ9mY940e0T A+AKBVTgPN6bEZYxOWrYrIuBDewIKZBilcSEncBZvBi0Dp8tR6oaG2Zkoq/RWYHrfVeDv558L i6QGzRMXe7dg3Lx6ebr1mpAckshm8fXtkCcdhYShlttdU+EgJLieUJbTWIfX21tFjiN7QOpm3 44eVf05QrHWD0OeEug4XGVAgD/wksjBEkX4AAyD1C54J0fYHm5ms5XDhEJPTvzWEp4q9mDmdl 4PRK9fYtsl+q47+i9BZ8MQShjiSSN1h+0pvMbmRpUkt803A5lw2vxAEobefX0qMjnLMf1iBSO jvI8PyrkrUAbPYVjdMMRByMt1NnpL4vckPj/A0h9Jc8LNbVIp0VFLiEoPRnRq2nhEKg0Qpk3p uwO8RcMSb+qlKz4lXyzNzz+6s0DWiyGTb5VlgF7DaYQ/mqR3xFmw0zB0ldiffnHcZ8vGyF2ui EKfy+f0ykNHgko7EhH0+QGZU4M6tSAPY6yA5+0NH73Y5CEsiQYL2mPbD6OfqdjUSvrhV5zmji lw4CQxm0Fse3cLrbLbieawh/oWLqWLEmmnrHBHHyOYwOM1GysCRSyNYgT1LgnhdZQnJBvQwkJ xJgU5eXFoVpRygfhmZgf8zsssMI= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sun, 10 Dec 2023 12:25:17 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784927929063725966 X-GMAIL-MSGID: 1784927929063725966 Use devres version of __get_free_pages() to simplify the error handling code. Signed-off-by: Armin Wolf Reviewed-by: Ilpo Järvinen --- drivers/platform/x86/dell/dell-smbios-wmi.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c index 931cc50136de..7eb7c61bb27d 100644 --- a/drivers/platform/x86/dell/dell-smbios-wmi.c +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c @@ -6,6 +6,7 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -183,7 +184,7 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) return ret; count = get_order(priv->req_buf_size); - priv->buf = (void *)__get_free_pages(GFP_KERNEL, count); + priv->buf = (void *)devm_get_free_pages(&wdev->dev, GFP_KERNEL, count); if (!priv->buf) return -ENOMEM; @@ -191,7 +192,7 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) wdev->dev.id = 1; ret = dell_smbios_register_device(&wdev->dev, &dell_smbios_wmi_call); if (ret) - goto fail_register; + return ret; priv->wdev = wdev; dev_set_drvdata(&wdev->dev, priv); @@ -200,24 +201,17 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) mutex_unlock(&list_mutex); return 0; - -fail_register: - free_pages((unsigned long)priv->buf, count); - return ret; } static void dell_smbios_wmi_remove(struct wmi_device *wdev) { struct wmi_smbios_priv *priv = dev_get_drvdata(&wdev->dev); - int count; mutex_lock(&call_mutex); mutex_lock(&list_mutex); list_del(&priv->list); mutex_unlock(&list_mutex); dell_smbios_unregister_device(&wdev->dev); - count = get_order(priv->req_buf_size); - free_pages((unsigned long)priv->buf, count); mutex_unlock(&call_mutex); } From patchwork Sun Dec 10 20:24:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 176403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6683766vqy; Sun, 10 Dec 2023 12:26:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGn4rUpeBZGSGLwDsR7w/JOepx3aeWwv57CHUcOenBJW8h7Drpf+ztg9nmW8XyYl/P6PVnM X-Received: by 2002:a05:6359:639d:b0:170:1e24:b827 with SMTP id sg29-20020a056359639d00b001701e24b827mr4024441rwb.40.1702239990415; Sun, 10 Dec 2023 12:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702239990; cv=none; d=google.com; s=arc-20160816; b=JmalH+tbJDE8B1W6g9s3zMokSeCiYsR1m+VP1nxUZfM7uLU76bIudF2cisZo7p71hs aiGsIs6ZhA8uZvzFLFd3cAsw3drQ99QQEMeGKkFy3eF7H2BmEy7dbgcaUC8hsyHitvqq 4JcePC8svL793akWqx7tfKNcKBwIiod1ZxQt1QcQdMNSHzV1SUMvCkmcMb+/lxhM+O2k uTW0gDavf92bugkoFV1+obkcK4nppDkwuIWTRIRgxJaw4iSGg9268LslMugZt39EkCmN eqNfrvrzvU1JzfBwyax0jzPIEfTsVi+KzuW3eJNxwtM58LZM3HBEdY0s8R6y6EMkiJQn ZY6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kSgGhfYrITT9nGxxabfu9nYUPxqiGuErWNSYjkuVpRs=; fh=li8yxIESWfZR7lmBO8wCmgOg4WdXsWPyQvEuWPhaOvo=; b=zv8rOtQtFV+Fiszv9Hyx0MTwggad/aeFjdM+8onGg3tMVeiHceTnX+ODsM7+JX8tUl n+i2CGNnZtQYkm/TJ3bukzYMHXrmkcOgD00RIXwwA8PPdeLSlbxNqu50ayLKO6B5kn2s 3Nm1v5qAfPj/p8dwVgaOyU8qdiFrMcKtEcqnvkIvr+TaEaHVStkNoio73ZuWwoZXINgR j02XZ/opRhm/7jwgkuwNJLqFKRZkxXIzM4yFUoOC2Wvh0FnJ8ZNqrAFTlviOsTwNecSc zLK/0JmcckuK39HFi4RBAVYWGorkS72w8vWx6vDUQJeuXI+AEYTlbCh91Ii+1FzbFhGc 60sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=N+smmKKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id i13-20020a170902c94d00b001c754f13381si5075470pla.455.2023.12.10.12.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 12:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=N+smmKKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5E97680702E9; Sun, 10 Dec 2023 12:26:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232120AbjLJUZH (ORCPT + 99 others); Sun, 10 Dec 2023 15:25:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbjLJUZC (ORCPT ); Sun, 10 Dec 2023 15:25:02 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4005CD8; Sun, 10 Dec 2023 12:25:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1702239895; x=1702844695; i=w_armin@gmx.de; bh=FXptV17hEQfrk/SdFKWK5/BHx6pY5MLIQJDt8cM6pCk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=N+smmKKyhXs3UJovrNIdjaQjGUWRB5Ai1g8B+CxwvZ79mvlaKjuiozhtep615gVW TY53yvlGRFW9DW2hYtC3wHFIMYUVm09Ldr9shdIF6pHyT1ICjyv1g8IXrM8nsE1hv bIHkoIGW2+jmEsICzJXcIEbZpRggweRkJ5D33LaQ5BDZ96GND2xoQ4uoC4JWznQ5h Mb66Vd36AOda5hlNZ/OGtLTycQyUpgsTmY60Ja/9zPGzohV4BjLxEHQGiTmmuyHcm Oe0iq23mwfVWd2qhQWJFDsLSNMXUgfB6s8X5Sz9rCqHfnhWI0TR2A8+dIjmMRoBp8 Jl1T51Hd8gWE8IcK6w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MmDEg-1rczgN1JtA-00iFNB; Sun, 10 Dec 2023 21:24:55 +0100 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, corbet@lwn.net Cc: Dell.Client.Kernel@dell.com, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] platform/x86: dell-smbios-wmi: Stop using WMI chardev Date: Sun, 10 Dec 2023 21:24:42 +0100 Message-Id: <20231210202443.646427-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231210202443.646427-1-W_Armin@gmx.de> References: <20231210202443.646427-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:XC4EOXkjV5iFFakqAqxeHDjqFAxWM4zLLG2pWJIWJy25P26olbU fpESgLJr3zjXRCrQ9EmXnFDZwHxPSZSwncbwokHtSf/3wghUOUSJYT5Sxz5uLUGRyKS1cca QPgpFpgyrS6P0/HOvjOKKBLaPShT5LirHpcPm8560TAbzSCBorh75AuHG5M2W4DB2HnioyJ q+ivM4vJ9VSczV7q8J0bQ== UI-OutboundReport: notjunk:1;M01:P0:HfBKhUUs1wM=;VYVakxdyaAU789AdpI6gSnAVQJ1 scl/R93vdpv4HbrPpMPuwioSUkkoj31XcDfiJdqK8tFY1O086u7wtCFRYq5/r74yfr0OWerXT LcCEysf7TKj4tiiDoBoStiqnPYkvyBGz5Wy4Ah84sJRA2h5DL5MFsEiBsKE6JaCpx1ETae8LZ BgBg1obqrTA4f6Lu1qKoyFGy2Ty7mLpRjIM9ttIcrufApaO6RLbiyvLDUEMdtu1LK3ZFMjSsH 77ndDQ2D2dD2SORxZRGYzIioFH+n4uadi/ekoGNhQEkjz1w7vJ/WrsMbeGIBg4bcNT6Zh16lp s1RPRGWva1tbapaDDiegP88YU41nZkqB2ErEn2bLvgsHIX64Fpt74wlQDLJ+yiIcsokSkCy1B 0Uch8soz+Kqf/LOT46Snb/pJkEC2xQ21ipXXUSPufI9XRU3gY/F6eg9FefAhuokPX/zh6vR52 tsvazQNX0OVlm4D9S7tWs2uXIvubxOx/n8hqANmyV+OS5H2ACs4ZV1CuTLneaCLdfRp+w9EOz xVlb/ckMchhvhWnxlS37Jan/KbgpvFbc0GjgAeYqXdhJkFGrKU6pAYZ9388cCEGPQWX/mpYRk D5m0hGkmewJPh1BfPsAygVVBde1U/yDRKWCR2sQCX1i0aW11/U3JCeLoa177yAtYoLpRys2uy ZFXbTS8asKO1K3pu7j2UM7FM2FTVwo6FIlqir71NQLqj/NBR10gMJOGDVhDEdfLInS1ZoxYFB BUEbsCDgvGkWysxalItxcMn9Gcc2nSORFQ4IcxFTUT8p1w+lfJ/y3K9y6BPRqjeDm1QCDGX7k As2fxD/p4AHrzzvZGNecsq8R9eDq4Sf2ye8d44x9Syk7nCU8+wjmm031Fe8GR+L3jdkhpuKQ6 scyNItjunrQY88uOftF9LA7vNbMToirHp3ULX5bvpniqmJ2T/FYAMCq6XoBvNx/yYtoYb1MFL kMUMemk3kXfp2/CgoCL9mATrKjQ= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 10 Dec 2023 12:26:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784928000439094938 X-GMAIL-MSGID: 1784928000439094938 The WMI chardev API will be removed in the near future. Reimplement the necessary bits used by this driver so that userspace software depending on it does no break. Signed-off-by: Armin Wolf --- drivers/platform/x86/dell/dell-smbios-wmi.c | 161 ++++++++++++++------ 1 file changed, 117 insertions(+), 44 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c index 7eb7c61bb27d..ae9012549560 100644 --- a/drivers/platform/x86/dell/dell-smbios-wmi.c +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c @@ -8,11 +8,14 @@ #include #include +#include #include +#include #include #include #include #include +#include #include "dell-smbios.h" #include "dell-wmi-descriptor.h" @@ -33,7 +36,8 @@ struct wmi_smbios_priv { struct list_head list; struct wmi_device *wdev; struct device *child; - u32 req_buf_size; + u64 req_buf_size; + struct miscdevice char_dev; }; static LIST_HEAD(wmi_list); @@ -109,48 +113,115 @@ static int dell_smbios_wmi_call(struct calling_interface_buffer *buffer) return ret; } -static long dell_smbios_wmi_filter(struct wmi_device *wdev, unsigned int cmd, - struct wmi_ioctl_buffer *arg) +static int dell_smbios_wmi_open(struct inode *inode, struct file *filp) { struct wmi_smbios_priv *priv; - int ret = 0; - - switch (cmd) { - case DELL_WMI_SMBIOS_CMD: - mutex_lock(&call_mutex); - priv = dev_get_drvdata(&wdev->dev); - if (!priv) { - ret = -ENODEV; - goto fail_smbios_cmd; - } - memcpy(priv->buf, arg, priv->req_buf_size); - if (dell_smbios_call_filter(&wdev->dev, &priv->buf->std)) { - dev_err(&wdev->dev, "Invalid call %d/%d:%8x\n", - priv->buf->std.cmd_class, - priv->buf->std.cmd_select, - priv->buf->std.input[0]); - ret = -EFAULT; - goto fail_smbios_cmd; - } - ret = run_smbios_call(priv->wdev); - if (ret) - goto fail_smbios_cmd; - memcpy(arg, priv->buf, priv->req_buf_size); -fail_smbios_cmd: - mutex_unlock(&call_mutex); - break; - default: - ret = -ENOIOCTLCMD; + + priv = container_of(filp->private_data, struct wmi_smbios_priv, char_dev); + filp->private_data = priv; + + return nonseekable_open(inode, filp); +} + +static ssize_t dell_smbios_wmi_read(struct file *filp, char __user *buffer, size_t length, + loff_t *offset) +{ + struct wmi_smbios_priv *priv = filp->private_data; + + return simple_read_from_buffer(buffer, length, offset, &priv->req_buf_size, + sizeof(priv->req_buf_size)); +} + +static long dell_smbios_wmi_do_ioctl(struct wmi_smbios_priv *priv, + struct dell_wmi_smbios_buffer __user *arg) +{ + long ret; + + if (get_user(priv->buf->length, &arg->length)) + return -EFAULT; + + if (priv->buf->length < priv->req_buf_size) + return -EINVAL; + + /* if it's too big, warn, driver will only use what is needed */ + if (priv->buf->length > priv->req_buf_size) + dev_err(&priv->wdev->dev, "Buffer %llu is bigger than required %llu\n", + priv->buf->length, priv->req_buf_size); + + if (copy_from_user(priv->buf, arg, priv->req_buf_size)) + return -EFAULT; + + if (dell_smbios_call_filter(&priv->wdev->dev, &priv->buf->std)) { + dev_err(&priv->wdev->dev, "Invalid call %d/%d:%8x\n", + priv->buf->std.cmd_class, + priv->buf->std.cmd_select, + priv->buf->std.input[0]); + + return -EINVAL; } + + ret = run_smbios_call(priv->wdev); + if (ret) + return ret; + + if (copy_to_user(arg, priv->buf, priv->req_buf_size)) + return -EFAULT; + + return 0; +} + +static long dell_smbios_wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + struct dell_wmi_smbios_buffer __user *input = (struct dell_wmi_smbios_buffer __user *)arg; + struct wmi_smbios_priv *priv = filp->private_data; + long ret; + + if (cmd != DELL_WMI_SMBIOS_CMD) + return -ENOIOCTLCMD; + + mutex_lock(&call_mutex); + ret = dell_smbios_wmi_do_ioctl(priv, input); + mutex_unlock(&call_mutex); + return ret; } +static const struct file_operations dell_smbios_wmi_fops = { + .owner = THIS_MODULE, + .open = dell_smbios_wmi_open, + .read = dell_smbios_wmi_read, + .unlocked_ioctl = dell_smbios_wmi_ioctl, + .compat_ioctl = compat_ptr_ioctl, +}; + +static void dell_smbios_wmi_unregister_chardev(void *data) +{ + struct miscdevice *char_dev = data; + + misc_deregister(char_dev); +} + +static int dell_smbios_wmi_register_chardev(struct wmi_smbios_priv *priv) +{ + int ret; + + priv->char_dev.minor = MISC_DYNAMIC_MINOR; + priv->char_dev.name = "wmi/dell-smbios"; + priv->char_dev.fops = &dell_smbios_wmi_fops; + priv->char_dev.mode = 0444; + + ret = misc_register(&priv->char_dev); + if (ret < 0) + return ret; + + return devm_add_action_or_reset(&priv->wdev->dev, dell_smbios_wmi_unregister_chardev, + &priv->char_dev); +} + static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) { - struct wmi_driver *wdriver = - container_of(wdev->dev.driver, struct wmi_driver, driver); struct wmi_smbios_priv *priv; - u32 hotfix; + u32 buffer_size, hotfix; int count; int ret; @@ -163,39 +234,42 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) if (!priv) return -ENOMEM; + priv->wdev = wdev; + dev_set_drvdata(&wdev->dev, priv); + /* WMI buffer size will be either 4k or 32k depending on machine */ - if (!dell_wmi_get_size(&priv->req_buf_size)) + if (!dell_wmi_get_size(&buffer_size)) return -EPROBE_DEFER; + priv->req_buf_size = buffer_size; + /* some SMBIOS calls fail unless BIOS contains hotfix */ if (!dell_wmi_get_hotfix(&hotfix)) return -EPROBE_DEFER; - if (!hotfix) { + + if (!hotfix) dev_warn(&wdev->dev, "WMI SMBIOS userspace interface not supported(%u), try upgrading to a newer BIOS\n", hotfix); - wdriver->filter_callback = NULL; - } /* add in the length object we will use internally with ioctl */ priv->req_buf_size += sizeof(u64); - ret = set_required_buffer_size(wdev, priv->req_buf_size); - if (ret) - return ret; count = get_order(priv->req_buf_size); priv->buf = (void *)devm_get_free_pages(&wdev->dev, GFP_KERNEL, count); if (!priv->buf) return -ENOMEM; + ret = dell_smbios_wmi_register_chardev(priv); + if (ret) + return ret; + /* ID is used by dell-smbios to set priority of drivers */ wdev->dev.id = 1; ret = dell_smbios_register_device(&wdev->dev, &dell_smbios_wmi_call); if (ret) return ret; - priv->wdev = wdev; - dev_set_drvdata(&wdev->dev, priv); mutex_lock(&list_mutex); list_add_tail(&priv->list, &wmi_list); mutex_unlock(&list_mutex); @@ -250,7 +324,6 @@ static struct wmi_driver dell_smbios_wmi_driver = { .probe = dell_smbios_wmi_probe, .remove = dell_smbios_wmi_remove, .id_table = dell_smbios_wmi_id_table, - .filter_callback = dell_smbios_wmi_filter, }; int init_dell_smbios_wmi(void) From patchwork Sun Dec 10 20:24:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 176404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6683836vqy; Sun, 10 Dec 2023 12:26:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHpKtwfsziWKtiQEBr51ummPr1QT8L2UZbFkn+z7vZbzTOZu8y5Yj54LeFFX2XH7SHq77l4 X-Received: by 2002:a05:6a20:6a03:b0:18b:d2f5:122f with SMTP id p3-20020a056a206a0300b0018bd2f5122fmr4534021pzk.26.1702240003071; Sun, 10 Dec 2023 12:26:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702240003; cv=none; d=google.com; s=arc-20160816; b=XlrU2jevesHeRh8wn6mw6nTs+WhJphEFfVwFz2QPNOlsrM87DdaeVzUll38Pio7K74 7ELA4vV6KTbQiIvi/j9psahYyq4GpwionkM3BjsmW82jHxj9svRZ5h0ifVlIPu+KZpKk njToaJ7iFC5dBg7ZAKw2DPDJPo2cTMqUdgAcv1S9HYJCpkM4fgG83cH+S3TlUfPUuAjf mujLmsdnMHmTjO6yqLTNYEaHqkkUKwzF9J7OWgm4a1K8Yx3JMtMPslFRXCSxgu65IzxX JEMN+u1OlSb4N9INPhBLzRt8ZUik8/GAa+2fyHXD8/yibE2KmDJI74DkWMg40e4+CCAn X0hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YbvplD8r6AbyY/ARpPeIGtx5ougQEls6+HECZjHCzBw=; fh=li8yxIESWfZR7lmBO8wCmgOg4WdXsWPyQvEuWPhaOvo=; b=flsqMkEX4BqTRVniLxmvvLyyN9lD21dBXYZlq0BXVa2QiTsGPR13O8mktGtt5Wk3hk tVNuSS6ap+NLd1UVSmF/9dGQLzOAaCMmYfDGTSwVs8Lh00MwzmM8iAHnKlIhXzv0rOl5 URXdZofN8N191yrm1527ySQ+mVAS3UVrAeJc9kQJw72hJBmQdz0J+9fEb3TGwTzsHaoe dzWCWVL+q+MO4MZniMuO3DLMCIsG8izHv1BdSVc8i4we4mZbKBBAauAI0ZqQE9l1eTgt GCFMivnv48ciQfLg5VZE+s03NDnU4ErGTQPwc3Q3fFTE+Yzxdy2vty+Mye2wvUbd2B9O rbsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=CLi7Ftdi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id c22-20020a63da16000000b005641315d956si4989827pgh.147.2023.12.10.12.26.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 12:26:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=CLi7Ftdi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 52E62807329B; Sun, 10 Dec 2023 12:26:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232075AbjLJUZK (ORCPT + 99 others); Sun, 10 Dec 2023 15:25:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232086AbjLJUZD (ORCPT ); Sun, 10 Dec 2023 15:25:03 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 408C8ED; Sun, 10 Dec 2023 12:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1702239897; x=1702844697; i=w_armin@gmx.de; bh=z2briIBbm053fUXWlDuaVSbzSNJEI/volk9WInlWf48=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=CLi7FtdiqLtORmbNnMgVD52i8jBqxHzfjpUNGLR343zwl6y6QlYyGyxQCW7SxYo4 uQkC1esmex1HS+N/droEtDf4QvxmKMHAPUgMQIktsxlpD7quoCFo6o9gncCIMFGEK JFHHYAxSQPbnZx4L9cnmnkZC+FVmfr7qmbYjGg6fc1tGRNsgYWo4rOWb/CcAJTwFa 82JabuYFmHoOMs2TF9EvrRZgiKMbaaUOIdHsLgXpQ55K/LZn5kujfF+XScN/RAYxu B0tpH8WQfmaWaPzyK84VdT55b31B6jSza3oj+TryJdPx0wsnvP/oNjTqR4jaJb9PS 9lZXImSKg0V3wOpmqw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N9Mta-1rFwWD0et2-015Fa6; Sun, 10 Dec 2023 21:24:57 +0100 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, corbet@lwn.net Cc: Dell.Client.Kernel@dell.com, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] platform/x86: wmi: Remove chardev interface Date: Sun, 10 Dec 2023 21:24:43 +0100 Message-Id: <20231210202443.646427-6-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231210202443.646427-1-W_Armin@gmx.de> References: <20231210202443.646427-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Rx43nDQ+cUMVEjHnGMob8ZR08dCPdjhf8FfXaalQpFFiwKQ7cUT Q9NdCQQw1eIDM7d+B6+mYS+QebrmDMtwa9XCbdRvR9Xxx896v73VzENrip40go0PXGmBlmc RKmWCgstqXV7gqCBZLo5BKCVqGi0Hr46RoujtPcRZXnicCyNNbubZxiT5I4CvSQZRh5dHZ1 8oy7fNO+KKnPekAUCbKWg== UI-OutboundReport: notjunk:1;M01:P0:0txKairzWsU=;avq/YmJk8xuohDb/0W9xFK+dAuc FrflKnJAaaA52+wo1Fdgq345N2a50KNXDSfnc4FDdKdUECAYkcaLCTFNJQNnx6yusuG0mN777 nRy6O+DvDCrI6vyl7HxFDnRTotZlb3bMVBwZa52b5ejFbgIOoHV4XyFf0tV8kicNCAdnDV5Ls 8mEOxjmiuSXCWaobqe/SLBSDmQwSorIKbOerMoq6ROYfj59b1s/zBvrPlJM7oQs+BJqmI++29 y2KjYp8gX3VcwBfQwBlv2Mn0UvGZyBJXI6AJtLAa6MJXUk4hoBwAEti6pW9+QgCw8XJ1Xduy0 GQ62QXQu8qOHs3XfTXq7k9smNYdf7d4hOjs2XUR/1NhejYlaH2/VH3pbhOLp+DHkO278yqc/O /GVdoo2Sm53SCQw38UTcaJ1wOjZf4SYmbi2ZwqHqyqhjRnbMS1RI7/l9DaU9R0CUT2lgXr8JG GZ4xnjRUhhYTTzt5+q0JjNi18z26htQwxxsHhOwc0Ag9wnEElHK5kvbUPl/va0OzS5v6qib5j TtbcbdWlCsHFRjbGynnvn0piUUo6UHTV5rgKM/IS+sHVXIAxIyrtHfPIfqMcm7wJvIXxh1yiI RDJspxsXueLEyOTJHylZMXZR/81E003RquEQuH+91xzFlKPHhYeHkYKoTNq72ArJpRfMSHkOg +cxuzVscCzbpLgO+Jh5ce4YmD+shHbtCpBM8MbSqLfFcZy3Gnexc3BI3J9KJmHw3FeNfjknjk 4ofj6bk+ZJ8lFAk1Q5udMaxeDrzqe5se2W4QO9KWyAiwe5KfkRlRMzqTcAwkrt+M9fQ4P0sGi +PE6P3iCe7ylfRXm2jy4MWcDjreAzwpUmMrqkE580tq2iohOkTaB+j6MAjBbSkEMgfpGWcaI2 Jonrcl/3996TzVRF7ViZ+zISjCQtWsxI5aEKBNduDihmrOqUd1vFKqrY6kE/ydOPBBkrDCSiC INplyMq3AV+Htmh1ZQ08erV8Hw0= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sun, 10 Dec 2023 12:26:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784928013333949466 X-GMAIL-MSGID: 1784928013333949466 The design of the WMI chardev interface is broken: - it assumes that WMI drivers are not instantiated twice - it offers next to no abstractions, the WMI driver gets a raw byte buffer - it is only used by a single driver, something which is unlikely to change Since the only user (dell-smbios-wmi) has been migrated to his own ioctl interface, remove it. Reviewed-by: Ilpo Järvinen Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 180 ++----------------------------------- include/linux/wmi.h | 8 -- 2 files changed, 5 insertions(+), 183 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 7df5b5ee7983..7303702290e5 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -23,17 +23,14 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include -#include MODULE_AUTHOR("Carlos Corbacho"); MODULE_DESCRIPTION("ACPI-WMI Mapping Driver"); @@ -66,12 +63,9 @@ struct wmi_block { struct wmi_device dev; struct list_head list; struct guid_block gblock; - struct miscdevice char_dev; - struct mutex char_mutex; struct acpi_device *acpi_device; wmi_notify_handler handler; void *handler_data; - u64 req_buf_size; unsigned long flags; }; @@ -256,26 +250,6 @@ static void wmi_device_put(struct wmi_device *wdev) * Exported WMI functions */ -/** - * set_required_buffer_size - Sets the buffer size needed for performing IOCTL - * @wdev: A wmi bus device from a driver - * @length: Required buffer size - * - * Allocates memory needed for buffer, stores the buffer size in that memory. - * - * Return: 0 on success or a negative error code for failure. - */ -int set_required_buffer_size(struct wmi_device *wdev, u64 length) -{ - struct wmi_block *wblock; - - wblock = container_of(wdev, struct wmi_block, dev); - wblock->req_buf_size = length; - - return 0; -} -EXPORT_SYMBOL_GPL(set_required_buffer_size); - /** * wmi_instance_count - Get number of WMI object instances * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba @@ -884,111 +858,12 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver) return 0; } -static int wmi_char_open(struct inode *inode, struct file *filp) -{ - /* - * The miscdevice already stores a pointer to itself - * inside filp->private_data - */ - struct wmi_block *wblock = container_of(filp->private_data, struct wmi_block, char_dev); - - filp->private_data = wblock; - - return nonseekable_open(inode, filp); -} - -static ssize_t wmi_char_read(struct file *filp, char __user *buffer, - size_t length, loff_t *offset) -{ - struct wmi_block *wblock = filp->private_data; - - return simple_read_from_buffer(buffer, length, offset, - &wblock->req_buf_size, - sizeof(wblock->req_buf_size)); -} - -static long wmi_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - struct wmi_ioctl_buffer __user *input = - (struct wmi_ioctl_buffer __user *) arg; - struct wmi_block *wblock = filp->private_data; - struct wmi_ioctl_buffer *buf; - struct wmi_driver *wdriver; - int ret; - - if (_IOC_TYPE(cmd) != WMI_IOC) - return -ENOTTY; - - /* make sure we're not calling a higher instance than exists*/ - if (_IOC_NR(cmd) >= wblock->gblock.instance_count) - return -EINVAL; - - mutex_lock(&wblock->char_mutex); - buf = wblock->handler_data; - if (get_user(buf->length, &input->length)) { - dev_dbg(&wblock->dev.dev, "Read length from user failed\n"); - ret = -EFAULT; - goto out_ioctl; - } - /* if it's too small, abort */ - if (buf->length < wblock->req_buf_size) { - dev_err(&wblock->dev.dev, - "Buffer %lld too small, need at least %lld\n", - buf->length, wblock->req_buf_size); - ret = -EINVAL; - goto out_ioctl; - } - /* if it's too big, warn, driver will only use what is needed */ - if (buf->length > wblock->req_buf_size) - dev_warn(&wblock->dev.dev, - "Buffer %lld is bigger than required %lld\n", - buf->length, wblock->req_buf_size); - - /* copy the structure from userspace */ - if (copy_from_user(buf, input, wblock->req_buf_size)) { - dev_dbg(&wblock->dev.dev, "Copy %llu from user failed\n", - wblock->req_buf_size); - ret = -EFAULT; - goto out_ioctl; - } - - /* let the driver do any filtering and do the call */ - wdriver = drv_to_wdrv(wblock->dev.dev.driver); - if (!try_module_get(wdriver->driver.owner)) { - ret = -EBUSY; - goto out_ioctl; - } - ret = wdriver->filter_callback(&wblock->dev, cmd, buf); - module_put(wdriver->driver.owner); - if (ret) - goto out_ioctl; - - /* return the result (only up to our internal buffer size) */ - if (copy_to_user(input, buf, wblock->req_buf_size)) { - dev_dbg(&wblock->dev.dev, "Copy %llu to user failed\n", - wblock->req_buf_size); - ret = -EFAULT; - } - -out_ioctl: - mutex_unlock(&wblock->char_mutex); - return ret; -} - -static const struct file_operations wmi_fops = { - .owner = THIS_MODULE, - .read = wmi_char_read, - .open = wmi_char_open, - .unlocked_ioctl = wmi_ioctl, - .compat_ioctl = compat_ptr_ioctl, -}; static int wmi_dev_probe(struct device *dev) { struct wmi_block *wblock = dev_to_wblock(dev); struct wmi_driver *wdriver = drv_to_wdrv(dev->driver); int ret = 0; - char *buf; if (ACPI_FAILURE(wmi_method_enable(wblock, true))) dev_warn(dev, "failed to enable device -- probing anyway\n"); @@ -996,55 +871,17 @@ static int wmi_dev_probe(struct device *dev) if (wdriver->probe) { ret = wdriver->probe(dev_to_wdev(dev), find_guid_context(wblock, wdriver)); - if (ret != 0) - goto probe_failure; - } - - /* driver wants a character device made */ - if (wdriver->filter_callback) { - /* check that required buffer size declared by driver or MOF */ - if (!wblock->req_buf_size) { - dev_err(&wblock->dev.dev, - "Required buffer size not set\n"); - ret = -EINVAL; - goto probe_failure; - } + if (!ret) { + if (ACPI_FAILURE(wmi_method_enable(wblock, false))) + dev_warn(dev, "Failed to disable device\n"); - wblock->handler_data = kmalloc(wblock->req_buf_size, - GFP_KERNEL); - if (!wblock->handler_data) { - ret = -ENOMEM; - goto probe_failure; - } - - buf = kasprintf(GFP_KERNEL, "wmi/%s", wdriver->driver.name); - if (!buf) { - ret = -ENOMEM; - goto probe_string_failure; - } - wblock->char_dev.minor = MISC_DYNAMIC_MINOR; - wblock->char_dev.name = buf; - wblock->char_dev.fops = &wmi_fops; - wblock->char_dev.mode = 0444; - ret = misc_register(&wblock->char_dev); - if (ret) { - dev_warn(dev, "failed to register char dev: %d\n", ret); - ret = -ENOMEM; - goto probe_misc_failure; + return ret; } } set_bit(WMI_PROBED, &wblock->flags); - return 0; -probe_misc_failure: - kfree(buf); -probe_string_failure: - kfree(wblock->handler_data); -probe_failure: - if (ACPI_FAILURE(wmi_method_enable(wblock, false))) - dev_warn(dev, "failed to disable device\n"); - return ret; + return 0; } static void wmi_dev_remove(struct device *dev) @@ -1054,12 +891,6 @@ static void wmi_dev_remove(struct device *dev) clear_bit(WMI_PROBED, &wblock->flags); - if (wdriver->filter_callback) { - misc_deregister(&wblock->char_dev); - kfree(wblock->char_dev.name); - kfree(wblock->handler_data); - } - if (wdriver->remove) wdriver->remove(dev_to_wdev(dev)); @@ -1131,7 +962,6 @@ static int wmi_create_device(struct device *wmi_bus_dev, if (wblock->gblock.flags & ACPI_WMI_METHOD) { wblock->dev.dev.type = &wmi_type_method; - mutex_init(&wblock->char_mutex); goto out_init; } diff --git a/include/linux/wmi.h b/include/linux/wmi.h index 8a643c39fcce..50f7f1e4fd4f 100644 --- a/include/linux/wmi.h +++ b/include/linux/wmi.h @@ -11,7 +11,6 @@ #include #include #include -#include /** * struct wmi_device - WMI device structure @@ -47,8 +46,6 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct u8 wmidev_instance_count(struct wmi_device *wdev); -extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); - /** * struct wmi_driver - WMI driver structure * @driver: Driver model structure @@ -57,11 +54,8 @@ extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); * @probe: Callback for device binding * @remove: Callback for device unbinding * @notify: Callback for receiving WMI events - * @filter_callback: Callback for filtering device IOCTLs * * This represents WMI drivers which handle WMI devices. - * @filter_callback is only necessary for drivers which - * want to set up a WMI IOCTL interface. */ struct wmi_driver { struct device_driver driver; @@ -71,8 +65,6 @@ struct wmi_driver { int (*probe)(struct wmi_device *wdev, const void *context); void (*remove)(struct wmi_device *wdev); void (*notify)(struct wmi_device *device, union acpi_object *data); - long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd, - struct wmi_ioctl_buffer *arg); }; extern int __must_check __wmi_driver_register(struct wmi_driver *driver,