From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77E10200AA; Thu, 18 Jan 2024 11:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705575601; cv=none; b=PNqx6IWuTwSwWetasvVTQ9f+jU4m8FNZogTk/JQqNCvEoHZ/lPS3SXk9mMZzV+uGGEYzWXpsy/vtL3reJxNoegQ8/a2d5PxJrpfOYLELWOBs9mbqF5I+iAvvekxQHQ7RRtFj3E6ls1R3wIJeCp1cAeMkJqXgOdeD/Pj/Ore61u0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705575601; c=relaxed/simple; bh=EuBcwo+x2rrFDnOSvGv6o3Ge9SkDONTAYnOG0qfUr8E=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:User-Agent:X-stable: X-Patchwork-Hint:MIME-Version:Content-Transfer-Encoding; b=tRqWUgIWHn2/lbH53D+O+/QP5o1al5NQY/m9L+0UQHu+lSJoCSPrnKh2OCvhItDkImdWhhLX4NBf76oPw6qcs1VIT4fHEgcXM8aRjf1C803mrP98+KmcCTogIhZEP3q1uFiyIoSWTAe/fgmuq9W2KBi8uY4P7ZyY2KX6GMaNSE8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qH6CkeGf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qH6CkeGf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7547C433C7; Thu, 18 Jan 2024 11:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705575601; bh=EuBcwo+x2rrFDnOSvGv6o3Ge9SkDONTAYnOG0qfUr8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qH6CkeGfnXFEqffW0U0p34/KfdwTx5brHZyo0OVr58NjMDP+NPCumd/kvFHtTN/jA WcLV1bBhcleH44dboJlkwvneTa9mUVK/QdlrFz/6+GMnGMdZ1UUX5zJRh832n1oT88 q5IPhliMXM+vSsZitVBzp/bpdC+qBacLynsnkUo4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Armin Wolf , Guenter Roeck , Sasha Levin Subject: [PATCH 6.1 040/100] hwmon: (corsair-psu) Fix probe when built-in Date: Thu, 18 Jan 2024 11:48:48 +0100 Message-ID: <20240118104312.660074858@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240118104310.892180084@linuxfoundation.org> References: <20240118104310.892180084@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Armin Wolf [ Upstream commit 307004e8b254ad28e150b63f299ab9caa4bc7c3e ] It seems that when the driver is built-in, the HID bus is initialized after the driver is loaded, which whould cause module_hid_driver() to fail. Fix this by registering the driver after the HID bus using late_initcall() in accordance with other hwmon HID drivers. Signed-off-by: Armin Wolf Link: https://lore.kernel.org/r/20231207210723.222552-1-W_Armin@gmx.de [groeck: Dropped "compile tested" comment; the patch has been tested but the tester did not provide a Tested-by: tag] Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/corsair-psu.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c index 2210aa62e3d0..ec7f27a6ce01 100644 --- a/drivers/hwmon/corsair-psu.c +++ b/drivers/hwmon/corsair-psu.c @@ -837,7 +837,23 @@ static struct hid_driver corsairpsu_driver = { .reset_resume = corsairpsu_resume, #endif }; -module_hid_driver(corsairpsu_driver); + +static int __init corsair_init(void) +{ + return hid_register_driver(&corsairpsu_driver); +} + +static void __exit corsair_exit(void) +{ + hid_unregister_driver(&corsairpsu_driver); +} + +/* + * With module_init() the driver would load before the HID bus when + * built-in, so use late_initcall() instead. + */ +late_initcall(corsair_init); +module_exit(corsair_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Wilken Gottwalt "); -- 2.43.0