From patchwork Fri Dec 8 13:07:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksa Savic X-Patchwork-Id: 175805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5440797vqy; Fri, 8 Dec 2023 05:07:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgv8OFYxw6uH2v8J5NSEQt+LEBc78uM+4mfCf0LohedsAe7hXQsxMZf70FLSj1glnXKA2Z X-Received: by 2002:a05:6a20:3c91:b0:190:3b35:5983 with SMTP id b17-20020a056a203c9100b001903b355983mr631769pzj.108.1702040865604; Fri, 08 Dec 2023 05:07:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702040865; cv=none; d=google.com; s=arc-20160816; b=Rc/YkbE092l8OPdvD6HLc/P3+8pnjI7JRJSWSmVH6oVP6CJNd5GNXi14BuoY0fWY/d SQ6Ksanp5YsmG1k7r1fa4+TQcCAlhsoVoMBPT66gTy3gy+piVvVPLFmSGWNBZl3/4jPH RI6b9wZgfH6XJrb67IJ/x3MtbzHLnmKOtD6PZplJ01EwLT/6ZLPiCRiPumamfnlm1470 YZoiNiGxNqO+BZI6jZaeIj7eMoW9Kh21ngpOf0F0Tv0Q43EoT83LvXHsDPfN+rbhUDVg DzO10G/Mc5p0O744AQVUCM98SxzWbXcpA0AUZ/aN7TilLeLVdwEOpVFZ9DWP/H8gfIWn v9bQ== 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:dkim-signature; bh=h3tkIl1Zsu8hqtQpagsNeL2rVPQBWVM0/G1ApY7SfSE=; fh=tkDHdH9Ji21qGONovTotlBSHLVdcBoXV+0KVCTu3jQg=; b=Z2bkq6ZbG1pKy1W1NEcIPl6QbiRIm754Cxh+nBY98o18713zQ8oCLUQfGNX6MdtI7+ QwAXG0olPqZZjv6ro8hleWdIEZ9rlDhx62/lxPtoJh76AgadhxllV2QFkpvzGxZ0KnZv O1cLrMwbi88a3j7MwhrM7kMvuN6/zfp2MeJNYWzzcoAGKqjRBA9XGL/MY7jxSs6UyYFp u6olAFfLS+1hUK3//B7dzhSfdJj8FbyadRVIbkVL4SWt1dfudycml3iMgb0Na8um0J+o ifdEFlPBOMD5+gLP6e01/JIQ0oU21Csj0IRZXn6yrSuai1HQIJOZPMpe3HaheR/XoJ8P HWpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gTLWgtdp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u2-20020a63df02000000b005c203ad2343si1593839pgg.94.2023.12.08.05.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 05:07:45 -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=@gmail.com header.s=20230601 header.b=gTLWgtdp; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 768808184535; Fri, 8 Dec 2023 05:07:30 -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 S1573772AbjLHNHV (ORCPT + 99 others); Fri, 8 Dec 2023 08:07:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbjLHNHU (ORCPT ); Fri, 8 Dec 2023 08:07:20 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB24A171F; Fri, 8 Dec 2023 05:07:25 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-54f4fa5002cso742712a12.1; Fri, 08 Dec 2023 05:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702040844; x=1702645644; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=h3tkIl1Zsu8hqtQpagsNeL2rVPQBWVM0/G1ApY7SfSE=; b=gTLWgtdps8AjhfojDVLEsos+crcltNS2szg+D/vRaItTnbi+4L7jpnwGsHsiAX14zG GGOGCGzyvjS1u5CF0X1iBiY2s1oGxCiGkJjyWVMsnHH8pFk9VlDxZB64TbIqN4A467Kc fQQll/9/GUl2YwZR4A7Wglie4kbQx9BzwpzQ3N9Ouau9v1bxA8tjet8O6d8GMDESFl3l Cjg2/HnHPrEgPVzb65EkEgREmgiga+9492K8r4hsoKzZvRq1AjDR9354FZiAnV+ZIJkS ATZ2jew91DQy3rqSKinRbpjPWNb3O34c2gE3F2MZA/PZVvifklc+KsX3UYPtBsDmVP7Q 6Juw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702040844; x=1702645644; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=h3tkIl1Zsu8hqtQpagsNeL2rVPQBWVM0/G1ApY7SfSE=; b=nALe2OeHdsX4J7JvlsbgOJ0eKGrOXt+b8OVJ5NipzCSQsO3rPyxyMJFT7NnGhzf14X uiXjwVNuoHdDID4rYoMclA7D/TQbJmpv3iPIh1z+IXCO9M1MqEJqLI75TOHB3P6Tvh1V SMpIEJ+ajurP5zo1StjV7zZ5reVhe+RjLXH6FSE+oScou/T5sUEfRi0wYjLy2Icz0jkx MC2T0xiJxPLaoS/SEddWGfY3E//PF2/so2H6dQbnqycI1kaKS2kspe88QeOFd6+97add ISakP2giAf92JUGKuQNDNPkCJYscEYY+Z90WJw36Yegs4/3M3mk+slYAnoJAx3OtK+AQ T21g== X-Gm-Message-State: AOJu0YwSNWRPa33TzKYFJbhJZnrzcv/FpMjIs8wJ1KnkAF2LeVvDGcVX K70ytTEpjnK3qZzf+d89H5A2+k5ApKcYSA== X-Received: by 2002:a17:907:8f1a:b0:a19:a19b:55da with SMTP id wg26-20020a1709078f1a00b00a19a19b55damr2149804ejc.106.1702040843766; Fri, 08 Dec 2023 05:07:23 -0800 (PST) Received: from fedora.. (cable-178-148-234-71.dynamic.sbb.rs. [178.148.234.71]) by smtp.gmail.com with ESMTPSA id z9-20020a170906d00900b009c5c5c2c5a4sm985445ejy.219.2023.12.08.05.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 05:07:23 -0800 (PST) From: Aleksa Savic To: linux-hwmon@vger.kernel.org Cc: Aleksa Savic , Wilken Gottwalt , Jean Delvare , Guenter Roeck , linux-kernel@vger.kernel.org Subject: [PATCH] hwmon: (corsair-psu) Fix failure to load when built-in to kernel Date: Fri, 8 Dec 2023 14:07:10 +0100 Message-ID: <20231208130710.191420-1-savicaleksa83@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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]); Fri, 08 Dec 2023 05:07:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784719202659496611 X-GMAIL-MSGID: 1784719202659496611 When built-in to the kernel, the corsair-psu driver fails to register with the following message: "Driver 'corsair-psu' was unable to register with bus_type 'hid' because the bus was not initialized." Fix this by initializing the driver after the HID bus using late_initcall(), as hwmon is built before HID. Fixes: d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver") Signed-off-by: Aleksa Savic --- drivers/hwmon/corsair-psu.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c index 904890598c11..48831a528965 100644 --- a/drivers/hwmon/corsair-psu.c +++ b/drivers/hwmon/corsair-psu.c @@ -899,7 +899,20 @@ static struct hid_driver corsairpsu_driver = { .reset_resume = corsairpsu_resume, #endif }; -module_hid_driver(corsairpsu_driver); + +static int __init corsairpsu_hid_init(void) +{ + return hid_register_driver(&corsairpsu_driver); +} + +static void __exit corsairpsu_hid_exit(void) +{ + hid_unregister_driver(&corsairpsu_driver); +} + +/* When compiled into the kernel, initialize after the hid bus */ +late_initcall(corsairpsu_hid_init); +module_exit(corsairpsu_hid_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Wilken Gottwalt ");