Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2465013rdb; Fri, 8 Dec 2023 08:53:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkhfdy7jcknhUjr40lBhKjBmDWvV/Iw3Z5KYxk5c9zkG3umEUS+Z8gqkPFZ/E0b5A6Xuj3 X-Received: by 2002:a17:90b:3b8f:b0:285:b08a:7817 with SMTP id pc15-20020a17090b3b8f00b00285b08a7817mr475487pjb.13.1702054384491; Fri, 08 Dec 2023 08:53:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702054384; cv=none; d=google.com; s=arc-20160816; b=RJ+R512zDLHGhuo9MPvpZwn4dkOD79BLoa3/0pqVQG6HG+7deuxcBOVZoHhBHHlBWQ NCyNxBPWAR9AudDayW5ZnrzHemKB9zMkhXc7Qi+k+PVz1em5DJPlG0vAMgQ/3evVrEOF 0cxfsCOPyThVtTOXnnryapviEQnuM4YgM9yKieeC6wvSvP4M3l5bGDrX55Qj52E6kbo5 z+KQNMfg0TulYRnK2gLE5DrqFr5x2TT3Moq7wrliKhZAQqe5LlXwXhpWU0lyg8Maxm5f Tpe/gYSS+GvbvxlfBYpbQh6j1NDlO9xG8PfzICoVHjrWt5BZmXyIAYTMM0L7vsywmNSt /cIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=pM2CjZf7UrGYa8UE0QDmZ86QP59hzyqT7w0nEzPHVe0=; fh=iR/N/m9b57AMNAUZHgeQOHV5wK0fqRSlDhV3yAH9BK0=; b=V7NTHrsq+WhGE57Ynbx2UuIZrpvf3/pSGMkAptXEIlQWZdJ37clXrgUrl3zCLtbShA x4nQSCtpSFGYpGV9Oe1KdBHmkCGgxmJUmvGi3/V1InniLOk3Kb9vA0x4OykEBev1wCqr KgcUkKDkXL5qU2qCy+S7qo21m625Vku8rKt7SEqiE62BtbGawe8TjWhtFs/GNNriQjIa XJI4Lzjv/e+NIllMGEg0Wu+hHPeuNQwRctn7bJ6zq5xo3nF3C8Oizine97HoWJMR3Au/ SiYcBwDtODdJ+znz3lRLSI2zfHpJ9bRvlhx47m8VEY9AQT6WG+IiUJda3c+EbQg81DMJ kfDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mNSR0n2+; 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 Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id w13-20020a17090a8a0d00b00286c34f1dc6si3206253pjn.162.2023.12.08.08.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 08:53:04 -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=mNSR0n2+; 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 6BCF4806500D; Fri, 8 Dec 2023 08:53:00 -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 S1574152AbjLHQwr (ORCPT + 99 others); Fri, 8 Dec 2023 11:52:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233719AbjLHQwp (ORCPT ); Fri, 8 Dec 2023 11:52:45 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0032C1989; Fri, 8 Dec 2023 08:52:50 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9e1021dbd28so303528766b.3; Fri, 08 Dec 2023 08:52:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702054369; x=1702659169; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pM2CjZf7UrGYa8UE0QDmZ86QP59hzyqT7w0nEzPHVe0=; b=mNSR0n2+/Jj3hgnskWJERLbUUPfuO26eTjTv3xDcp5GIsRNvqGw9g4JJ2PaqYAGGsX yOUjLDaxucz7TbnE1HFmf+PNpsCbpbppP/+xh6gfcTd5myPZObvSYj8rhBwICPCGaQR1 651N+Y6WV4a4zgBAfdg217cfbHGp1tpkojaxCLNQq3RFKR25eA384uobNRyNBQQRa2T+ yTBaL1Ah6F895bHB1A37q/fstpUBb6t1KNSRFsRLS6Z1ifJJ5ERRZVdIYJkrVUNsgGDw Q5gY2nXb0Q972IgqKiaLkbRbuygXskSxgWVC9Q/UeJpc8BIDC+b12+6D7PZezxrZEA7d Wurw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702054369; x=1702659169; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pM2CjZf7UrGYa8UE0QDmZ86QP59hzyqT7w0nEzPHVe0=; b=iodnFM70XLQQZTWU1GqKuZF3UxnJFSggRTMoKJQGVmyVJ6x8X+2D9aDpqU2t1T20uy hj6PnVi5Q4tvTLuY/C4orvwaxLioAiE6O0wm17hGzYpkiFhj7nJAffRcxLGgVLmAiNev Dd5go5UnuxS1LJSZPv+PPsD7+H45a3buIMBUL61md9TcrnXVMoDM4nZ3IGrTiPNGmUIJ aBpvWo9EioPnhLQAXSgodgYkgT3Kuk9oWOMY7ey6KGa/FOxlwFoNM3TtbP6qA5DV9Xun 63XXMAZiSx7yCYUrKQVQRmd6gOPAscuevifYWpY2/eHpYGhplceQ1Od3RN/6oMkDfdDw g6/g== X-Gm-Message-State: AOJu0YxcyTivWn+RYVfx9qpgtkb+cnjQEcjUfS1+cmo/Gql9/ZGXXfNm woBnh8I4nMjwd8P2dBWMWGk= X-Received: by 2002:a17:906:b793:b0:a1c:be13:f0bc with SMTP id dt19-20020a170906b79300b00a1cbe13f0bcmr149736ejb.109.1702054369084; Fri, 08 Dec 2023 08:52:49 -0800 (PST) Received: from [192.168.0.28] (cable-178-148-234-71.dynamic.sbb.rs. [178.148.234.71]) by smtp.gmail.com with ESMTPSA id bi2-20020a170906a24200b00a1e04f24df1sm1198842ejb.223.2023.12.08.08.52.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Dec 2023 08:52:48 -0800 (PST) Message-ID: Date: Fri, 8 Dec 2023 17:52:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: savicaleksa83@gmail.com, linux-hwmon@vger.kernel.org, Jean Delvare , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Jiri Kosina , Benjamin Tissoires Subject: Re: [PATCH] hwmon: (corsair-psu) Fix failure to load when built-in to kernel Content-Language: en-US To: Guenter Roeck , Wilken Gottwalt References: <20231208130710.191420-1-savicaleksa83@gmail.com> <20231208145742.6def047a@posteo.net> From: Aleksa Savic In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 08:53:00 -0800 (PST) On 2023-12-08 16:43:07 GMT+01:00, Guenter Roeck wrote: > On 12/8/23 05:57, Wilken Gottwalt wrote: >> On Fri, 8 Dec 2023 14:11:44 +0100 >> Aleksa Savic wrote: >> >>> On 2023-12-08 14:07:10 GMT+01:00, Aleksa Savic wrote: >>>> 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 "); >>> >>> >>> Woops! Just saw that the same fix was sent yesterday. Please disregard, sorry! >>> >>> Aleksa >> >> It is fine. I just start to wonder if there was a change in the subsystem. I >> used the driver as built-in in the past for several months and never had that >> issue. And now it is a real flood of reports. >> > > Maybe there was a change in the build order, or some subtle change > in driver registration code. Question though is _when_ this changed. > It would be great if someone could bisect it. For example, bus registration > code has been changed significantly in v6.3. I am copying linux-input > and the hid maintainers for feedback. The late_initcall() was also needed in 2020. when corsair-cpro was added in 40c3a4454225 ("hwmon: add Corsair Commander Pro driver"). There was also discussion on the list about it: https://lore.kernel.org/all/3864498.z6qT3ff8q6@marius/ nzxt-smart2 (from the tail of 2021.) also has a comment about the message. (Just providing references.) Aleksa > > Either case, I now have two patches and at least the first one was actually > tested, but no Reviewed-by: or Tested-by: for either of them. While that is > of course a formality, it would still be useful to show that it is not just > a random change. > > Thanks, > Guenter >