Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E495D59651E for ; Tue, 8 Sep 2026 17:47:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788889673; cv=none; b=T1aodDcab/8F8aDXvajb8/pt5iJLx0WCWTRiPawyHJqmqr2N4wDN6PGu4kkITHXk6UlPEjLyWxP8StrdN38CppMR7crlGe8YrmKKyfmW8BF6Xx5XZa1stw2ROv8pTulWECUTQMbxq85Lcs3hd0EqiUI0gCLawHa8++wqVK/NLc0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788889673; c=relaxed/simple; bh=dUQc7PWrbX8uAQtdC+UYHtMhjF0PHNUBZJYOmbunHLw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RdRvBjzf8+tN8dwm9AJZD+SAIv67ZzWpnIBkGc1gc/aeDfpvty0tqBh8kkiH1nCEGvy7NC/ON3/RTVGUzo2m+XYBY9C7EOuDgZ9LGkD5dcgrtjO8XXcu5CnmqRjZ8Tb3jH+UzN92RLeS/w7VyhmHUsib6HNTJquFkmhdQm1H5Sk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=X7i/U2SY; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=pNmM6S+l; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="X7i/U2SY"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="pNmM6S+l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788889671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=luyNT9P1mkrzQIhc+xUVIxx4p4MwhVi8AIPUHPOm+So=; b=X7i/U2SYCXRdmyV/ZuKYPFzyDffRGeeLCbXTbOTeHu0w4FZ76eknLt54TfdyY1827Rmcz3 2JvyyFEQKbMqfflKxTUndFZ2mslxIyHbWXpZcWppU1rqMdErvkQzgNo1/uiTfZABf/DXvU FXk26fQt7sKo7dsmfspmi9Ibd34sF7c= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-198-SueoV7aZPLmZSR9K7RAWow-1; Tue, 08 Sep 2026 13:47:49 -0400 X-MC-Unique: SueoV7aZPLmZSR9K7RAWow-1 X-Mimecast-MFC-AGG-ID: SueoV7aZPLmZSR9K7RAWow_1788889669 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-9390a2c895bso981148985a.0 for ; Tue, 08 Sep 2026 10:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1788889669; x=1789494469; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=luyNT9P1mkrzQIhc+xUVIxx4p4MwhVi8AIPUHPOm+So=; b=pNmM6S+lWnzLOabIrfOUDsGtHlLfzHedNz672OW8oiBuGCXzqVaXDCSNLjZ353pKZU HT3Pg+zrDq+dvJ73Z+139DuHt8Hkctv59Z8tCIaTtEps/kvG/fDrt3xEosHok2gylxM4 aQBhuWlYkgGuYKIx1eyRZKfhobbJrE3TVWBGVTbHpC7Ka+ATN6+GsepPLG+PbiOTMKT9 XtsaoFXy3OM5CaBcrNGw252Pmn5Fj/ITc4X4qxVFrOL6zsHxthSEeZK/bjeZVf4MBv/2 7JA96V6McoL7ysc5bmQ7uJqZ30Ze/xUGYPsdu3+s08GEKDY8m45VWh3btVqlqQQKjWlN sEHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788889669; x=1789494469; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=luyNT9P1mkrzQIhc+xUVIxx4p4MwhVi8AIPUHPOm+So=; b=ZnKViIWktEEJ0UpfUr1tBvEbq8Pg2KbpTJcRW3q+1vyuGhMEqguS3jJuv69ePTGPvo 0jv2CvA4CQlH7+5mNukY2y0pZM1rTU0hdtFaCD0LLNP0TUNnjAtBgm+cN+slFumVwrzg sHf9HSLbVsnD5xTqZYugSu3IgGZ1W96ZAbJKAyR6CO2qmrwlQWZV49t1CBLkz68Y1Lnj FnCowRLiNHOEf2PBrM09XcnMY0aIr1rI5OYtd1hQHiFkzA7c1YHfJmDnETAzE8M7HQO4 c6H02hXPF+saOaR6CQtvLXH4upG91ibqA659/K62Lj4PeuwTxyf779tian/ghapalHre 42Hg== X-Forwarded-Encrypted: i=1; AKwUvBwOSi3v22MUnDIkHZMcKO551HcU6ivxdIlv607O/TPTyvNiYfvx3bkCJ1XmFTUpvQKFQsupmii3l/rN9zjT@vger.kernel.org X-Gm-Message-State: AFuF++m+OLbVwka8yNtd3TDNUvawgxyzdxTTq7npniVETfHsqUn84AnN aZHcU/b8mZv+Qepeu484a7OV1ZftXy/EEHQaHNlBlpl4p+6Qzu+yhfv7gTBLlz4O+9+NqP1y3yW dHZOVPWci0jc0V38WmWwmeHGKIabC1U0yKpyjgxdO0vZ/qsFlTN5fcRAqyOG0KjRm8nk= X-Gm-Gg: AYBFou3YbEQ2oXmL2HqBkdboERJOpjvQ+kwLppFCprvyBYuAg/RYtndYOus2Q4vQxL0 6W0D3sBlRRsTVWaSbbVjPjgJWAs6Q6lgeUM0FHHZFYtego5DdFE43m+xkZDeJyyLPwuvhbMWxgC YHbUqX4iew58eviUxZ1998mT9ZO3M5PAl8AEjTUpVbLjwy8sD6f0YAUt1SH28ndfRuuWMiws4MK FaDLGtQRKfdLTh8yKUcoj30JaiRw9umWiTwkWK7gmxOb4yk/eskCNoh0fNk08iWaXjGMQCn/gRZ OhH77sQumjZXsoQhioaZlcyZZP4t147rMrPoEWrfVod8rZFvZIdageFfgnJdLvpWEGcTywouso8 1WH6QcLD38Bz8jBTLCUvyvCOynSCxcKLm8LhNams= X-Received: by 2002:a05:620a:25d4:b0:939:6df9:1996 with SMTP id af79cd13be357-9398077453bmr3211076085a.50.1788889668977; Tue, 08 Sep 2026 10:47:48 -0700 (PDT) X-Received: by 2002:a05:620a:25d4:b0:939:6df9:1996 with SMTP id af79cd13be357-9398077453bmr3211071485a.50.1788889668513; Tue, 08 Sep 2026 10:47:48 -0700 (PDT) Received: from [192.168.1.3] (c-73-183-53-213.hsd1.pa.comcast.net. [73.183.53.213]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9397fb9bac1sm1194093685a.35.2026.09.08.10.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 10:47:47 -0700 (PDT) From: Brian Masney Date: Tue, 08 Sep 2026 13:47:19 -0400 Subject: [PATCH 2/4] driver: core: platform: add subsys_platform_driver() macro Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260908-subsys_initcall-v1-2-cbccf4cd4288@redhat.com> References: <20260908-subsys_initcall-v1-0-cbccf4cd4288@redhat.com> In-Reply-To: <20260908-subsys_initcall-v1-0-cbccf4cd4288@redhat.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Bjorn Andersson , Stephen Boyd , Jerome Brunet , Geert Uytterhoeven Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Brian Masney X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2845; i=bmasney@redhat.com; s=20250903; h=from:subject:message-id; bh=dUQc7PWrbX8uAQtdC+UYHtMhjF0PHNUBZJYOmbunHLw=; b=owGbwMvMwCW2/dJd9di6A+2Mp9WSGLIWeNlGl8x1q7io6bY7/Mr1m+sOs8htXTHDgn3Xkynhp n13mGK3dJSwMIhxMciKKbIsyTUqiEhdZXvvjiYLzBxWJpAhDFycAjARrxWMDNOmXTSv84h+H5Nc x6l2bu1a9Z2zF+xt8P8V/vrSApf3xw8xfPd1q/34Y86hFX6zHQTmaxTZqMWemJR+mlll0c+Ol8e FWAA= X-Developer-Key: i=bmasney@redhat.com; a=openpgp; fpr=A46D32705865AA3DDEDC2904B7D2DD275D7EC087 Add a new macro subsys_platform_driver() to eliminate some boilerplate code in drivers that need to register earlier in the boot at the subsys_initcall level. Signed-off-by: Brian Masney Assisted-by: Claude:claude-opus-4-8 --- include/linux/platform_device.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 3d5bbcbae730..3bd0f1f0d870 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -344,6 +344,19 @@ static inline void platform_set_drvdata(struct platform_device *pdev, #define builtin_platform_driver(__platform_driver) \ builtin_driver(__platform_driver, platform_driver_register) +/* + * subsys_platform_driver() - Helper macro for drivers that don't do anything + * special in module init/exit but need to register earlier, at + * subsys_initcall level, when built in. This eliminates a lot of + * boilerplate. Each driver may only use this macro once, and calling it + * replaces module_init() and module_exit(). This is meant to be a parallel + * of module_platform_driver() above, but with the init call promoted to + * subsys_initcall() so built-in providers are available earlier during boot. + */ +#define subsys_platform_driver(__platform_driver) \ + subsys_driver(__platform_driver, platform_driver_register, \ + platform_driver_unregister) + /* module_platform_driver_probe() - Helper macro for drivers that don't do * anything special in module init/exit. This eliminates a lot of * boilerplate. Each module may only use this macro once, and @@ -376,6 +389,23 @@ static int __init __platform_driver##_init(void) \ } \ device_initcall(__platform_driver##_init); \ +/* + * subsys_platform_driver_probe() - Helper macro for drivers that don't do + * anything special in device init and have no exit, but need to register + * earlier, at subsys_initcall level. This eliminates some boilerplate. Each + * driver may only use this macro once, and using it replaces subsys_initcall. + * This is meant to be a parallel of builtin_platform_driver_probe above, but + * with the init call promoted to subsys_initcall so the provider is available + * earlier during boot. + */ +#define subsys_platform_driver_probe(__platform_driver, __platform_probe) \ +static int __init __platform_driver##_init(void) \ +{ \ + return platform_driver_probe(&(__platform_driver), \ + __platform_probe); \ +} \ +subsys_initcall(__platform_driver##_init) \ + #define platform_create_bundle(driver, probe, res, n_res, data, size) \ __platform_create_bundle(driver, probe, res, n_res, data, size, THIS_MODULE, KBUILD_MODNAME) extern struct platform_device *__platform_create_bundle( -- 2.55.0