Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2527320rdb; Fri, 8 Dec 2023 10:35:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzbkvpv+zOiLk2QKJCuQeE6gL5fiBH1BGAa4qVc9tckmdgrgsEGd+yzbaDft7TAK7NQlRj X-Received: by 2002:a17:90b:108d:b0:286:997a:d411 with SMTP id gj13-20020a17090b108d00b00286997ad411mr476877pjb.26.1702060502334; Fri, 08 Dec 2023 10:35:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702060502; cv=none; d=google.com; s=arc-20160816; b=O1UaeiRJWQNm15A8Nb7AOywC312LnTzXcLD9yt5W1IOHsDq5C1yooVNYF926I6iyGE fTQQ5NqIvOicmCHvUrIfF0GyHXiGAt5hat2ZyMD2xfpz2rTNoDIr6jejZzxWJ6SDX76g vAQytI7n7jbnb/m3s0KK8/zoHfuhaQQM6uEBXQvFjAQkL/IVBtIA+NCc9gZe6qp05RXe C41YmQ7sR4dcMrtXhuAarSFABvCzKh9dx85fSML4qyZ7rw6rJuSzzCIpL9taLH3muS7p 8L2tIRTT2NJO5xuTGa/qDAFC+mgeJ06Wt1EMwdu5sDIwozWg4kP07NWWIooSwl/Vh16f 18CQ== 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:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:sender:dkim-signature; bh=W/80bz9Uv86Lw/jPf2dcBPDXTUKYtcqEXNMQKWUmzLY=; fh=8GwUrLdqpBiMRi3Exp0x3RKwuGWlHRleMPkaY00K1bw=; b=fiJyuMKkFLhXJC9XTT2xeGBkcpP5onew/quTvc2WKWgaWVuQtnDDSgwPFtBHI9+Ge5 36xzuyXPiZq1vWbbibIjO+zQJoKW2eIJxSlxwvpfsQsTxMQgkqsDCUEqFzihqF37JodC m6qca9+JPPPcqo47XRP8AUYRDvZFz2izo8lMn3oXP7sdlisjKQxD8JWYHBS3Tu8+zR2T KUQ3+03UXnx8jPjFtev1sZJ68uJOLg0WaAEsq+4UsignnwUjpEWR5KmgslWmFYQFm6/m 5G0/5Dvh8Vdkxfkx/ALeltVoowUKe9thZ9jk+E7k3s4Y7OmrjyGLnkLyAMdBec1nMs/R Os7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E3oiQdo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bx21-20020a17090af49500b00286c0eb88f3si3303312pjb.34.2023.12.08.10.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 10:35:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=E3oiQdo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9E6A280964FD; Fri, 8 Dec 2023 10:34:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjLHSen (ORCPT + 99 others); Fri, 8 Dec 2023 13:34:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233883AbjLHSem (ORCPT ); Fri, 8 Dec 2023 13:34:42 -0500 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F4112E; Fri, 8 Dec 2023 10:34:48 -0800 (PST) Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6d84ddd642fso1473169a34.0; Fri, 08 Dec 2023 10:34:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702060488; x=1702665288; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=W/80bz9Uv86Lw/jPf2dcBPDXTUKYtcqEXNMQKWUmzLY=; b=E3oiQdo36WCtXuHnbx7gUGTSRnTr8I1jPea/QhGkUtp0t/us0/5hj2YF4ikLNPyzC+ v9dKJsDNvl2J5kDwzZnfpDu1mO3EGaYM5lvJaB2G0wvJJUX6CMVdQR7Cj3DDDF9uWSVa HPDNL//qTCriXXH81VWs0dqMyqFhFoeDBEOO9EVeXXpOOiH0eidPQabzf3JPQS5eYMoH DtWK7WQqLTQ3yWLHc3nYiHRlzsZcPRFJjTAYo6nuNmy2+mKGZNULWHVV82zwoFBdJ9Rz PkuXM3aXB6TIAmeg+E6MX1UjYslS06zXkUjqRCecKbzPAFHrPZzkZ2WzWeZ4BVqgC1fh qA8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702060488; x=1702665288; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=W/80bz9Uv86Lw/jPf2dcBPDXTUKYtcqEXNMQKWUmzLY=; b=fcWZqYaJZ14o+Zi4+TmsL9dZxRAGW2eMo6EgTZIBepsP/2j97Y7vqV/a3YvGEcIZR3 BYNs+FKQg5JM3z4RnRKByYNcqaqYbxFJiB2oq/QZQNjMIKnEOmOidNhz/7Qzdb1WFXzj JNLk+M6un7QVmz6T24TZ4HazMOJva2X3gYPb5UiCgd3BsYGjeaVBJSgI9g6LKu7S3Eiz G8Kun1vsvDwQ75dcJTMFqGLKopz2YsQr0swUhwN7U79jsY+LewtxiW4Mh55JntEN6cLC V7ViKV0M8fYAK/siKr9Mvtc8b+CMJSdfwo1nGwKgTscR2yF31T7f296QlrQcEiDmPycY 0q/g== X-Gm-Message-State: AOJu0Yx4QcnOZ9YucKuBSwk2g5/pxr1vX+OtWbNZoQStx4dwZsd2Xhoy 0AfYb3qx+ORgkocjK7LTdVw= X-Received: by 2002:a9d:4d83:0:b0:6d9:e48c:f08a with SMTP id u3-20020a9d4d83000000b006d9e48cf08amr493929otk.11.1702060487852; Fri, 08 Dec 2023 10:34:47 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id c9-20020a056830000900b006d87b167c41sm385040otp.8.2023.12.08.10.34.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Dec 2023 10:34:47 -0800 (PST) Sender: Guenter Roeck Message-ID: <4282d240-bf0c-4e4c-ac18-503067715ebf@roeck-us.net> Date: Fri, 8 Dec 2023 10:34:45 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hwmon: (corsair-psu) Fix failure to load when built-in to kernel Content-Language: en-US To: Aleksa Savic , Wilken Gottwalt Cc: linux-hwmon@vger.kernel.org, Jean Delvare , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Jiri Kosina , Benjamin Tissoires References: <20231208130710.191420-1-savicaleksa83@gmail.com> <20231208145742.6def047a@posteo.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jI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YlYcRQWOUGY HhQ5eqTRZjm9z+qQe/T0HQpmiPTqQcIaG/edgKVTUjITfA7AJMKLQHgp04Vylb+G6jocnQQX JqvvP09whbqrABEBAAHCwWUEGAECAA8CGwwFAlVcpi8FCRmg08MACgkQyx8mb86fmYHNRQ/+ J0OZsBYP4leJvQF8lx9zif+v4ZY/6C9tTcUv/KNAE5leyrD4IKbnV4PnbrVhjq861it/zRQW cFpWQszZyWRwNPWUUz7ejmm9lAwPbr8xWT4qMSA43VKQ7ZCeTQJ4TC8kjqtcbw41SjkjrcTG wF52zFO4bOWyovVAPncvV9eGA/vtnd3xEZXQiSt91kBSqK28yjxAqK/c3G6i7IX2rg6pzgqh hiH3/1qM2M/LSuqAv0Rwrt/k+pZXE+B4Ud42hwmMr0TfhNxG+X7YKvjKC+SjPjqp0CaztQ0H nsDLSLElVROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 10:34:59 -0800 (PST) On 12/8/23 08:52, Aleksa Savic wrote: > 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.) > Ah yes, thanks for the reminder. We actually had a similar problem with watchdog drivers and worked around it by deferring watchdog driver registration until the watchdog core is initialized. That is of course just a kludge. No idea if a clean(er) solution is even possible. Guenter