Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2512102rdb; Wed, 21 Feb 2024 09:46:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW+tGBnKJKiLgaFz4c/W/qBeptqrc6VNtcv1Mp06wpwNIJzTjq6L+1d3scFnfRhQxUEQVHc5NaFHc1s2q1LJ0Fn3HJaREhWJxZBN/V1oQ== X-Google-Smtp-Source: AGHT+IE48Spd95O2QMve5TaeXN1LQMFcjm59ZF5r62w5/pgSkOk1BSWtCCMLnMpazsxF50MO+3bI X-Received: by 2002:a05:6e02:5ac:b0:365:41b5:b3c4 with SMTP id k12-20020a056e0205ac00b0036541b5b3c4mr5220172ils.18.1708537591565; Wed, 21 Feb 2024 09:46:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708537591; cv=pass; d=google.com; s=arc-20160816; b=ls47mxyPNWgSIEbW+Ny0fAe7xfO+Zf/tjtZ+eSiR4aXw54QnGfatnNI1MkDCYDXitQ Jv01ZGqbQUtJ9bitnuECB9q2S2pjsD6vhMH3QP4pUxl8flkMnHxTm1MkYReass4DWsYF OpYU+JyipqmOozIE4lr8Yr5tWUife2fvtQddkQ9HarV9veQTT5eE1I5jmq8I+Nj2Zj6W 0H+l3PICr1rboevksSFgLLijaHuM9Oc+VRFi0kv/4pLi+6DqzAas9e1nlSwlQkbVr+LH fLMFYel3kOy16ARMnwwdaiNkrWQukzulmGnQp9duh/O/UppX9kvtbVtguxZOYMBrpEms CD7Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=mKsBfKzbS6MQdlGwzOPn+j3onsmhYJkKuuKue8WTjX0=; fh=YJ5MsxA0cbhH3hArVvDIgm04NOYl+Q0qwgXdXQgf7k0=; b=FCDBsLABldqdpMsaEQkDM634NsEFnEOlKYiNz6z9rlyiGDMb8tRed9yEzZNBFC4DzM dGSDT0G8tLNLSeJDQLuaFAV3cqE/X2mJaTACZxL96+IZxe6gm32lzYM+ie7OR606IV/9 f1QIKWBFgJnai52yUoRU7fIUSXOTU2qHXzGbdemx3+gLwgUCb18lEQttAlWHv5Y6MNit gY1Psb9q/NaspMmCdLAAuYPpcHDilHr54HqNOJc/UMHotOXDi17BJrNQ6+haFfTe1SmH pay67Wjvo8+jSe/HQfzb4puERoCvo/D+EBhBbG4agD6eLb8kxZfEW/Z1gEjp6GSY0Uz/ tb0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=i5NBYVK8; arc=pass (i=1 spf=pass spfdomain=rts-flowmailer.siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel+bounces-75222-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m19-20020a637d53000000b005e438ff5c40si687515pgn.591.2024.02.21.09.46.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 09:46:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75222-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=i5NBYVK8; arc=pass (i=1 spf=pass spfdomain=rts-flowmailer.siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel+bounces-75222-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0EC6928515E for ; Wed, 21 Feb 2024 17:46:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE3A184A26; Wed, 21 Feb 2024 17:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b="i5NBYVK8" Received: from mta-65-228.siemens.flowmailer.net (mta-65-228.siemens.flowmailer.net [185.136.65.228]) (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 A48067BB00 for ; Wed, 21 Feb 2024 17:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.136.65.228 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708537584; cv=none; b=sATdG7ChlKT1uw9kOFemmJn0MVmEcdiJyjCfuHYYh78F2/+1hJe1HF+DQ1MiXC9+9emJqiqL7YWJ0uffcIuVNJaoXJN90mcPuphH334cHpfAltjfUfqV/dA0UHksahUlJBEapB9rfB+IVhSYGNlQL3loYNJt8bP7me0T3iHABpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708537584; c=relaxed/simple; bh=KkqUbvzPYYth3SxM0r3QYQIpl9bISqSyQeqsj9hxl4w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=COBzhnsmBD7XrD7GpVip1BuaHNaB/t7yF/8Viymbl6afUKBLEwfx56LEraIxYxYDbG3f5ydSpLNTZhMi5Hsrd7YW4LE3JIopCkFo2kKdhj5OVsYfGlIne2GC2XlL4DaHTCFgQN4qm0EKqEABf8T/8zniLF+iybGpWoC4p1XdPqw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com; dkim=pass (1024-bit key) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b=i5NBYVK8; arc=none smtp.client-ip=185.136.65.228 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com Received: by mta-65-228.siemens.flowmailer.net with ESMTPSA id 2024022117461751a85647f17ff7b7a3 for ; Wed, 21 Feb 2024 18:46:17 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc; bh=mKsBfKzbS6MQdlGwzOPn+j3onsmhYJkKuuKue8WTjX0=; b=i5NBYVK815X3qgokYN5At6yAlMWY0QXGzxusIZKPKlHzg2DxypD4P2LqqpaIBX7C3fpxLH hFVrUs50RnANhG0Hlu8Qv0OjN12Xwq+ZfVFQDVVPj9GmfhdnnSUgBeM70xA3OVkSKjg3c1dN xZTG+zDgSG6uAk/TaNGLx624vbyow=; From: "A. Sverdlin" To: linux-pm@vger.kernel.org Cc: Alexander Sverdlin , Andrew Lunn , Sebastian Reichel , linux-kernel@vger.kernel.org Subject: [PATCH RFC] power: reset: restart-poweroff: convert to module Date: Wed, 21 Feb 2024 18:46:07 +0100 Message-ID: <20240221174610.3560775-1-alexander.sverdlin@siemens.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer From: Alexander Sverdlin The necessity of having a fake platform device for a generic, platform independent functionality is not obvious. Some platforms requre device tree modification for this, some would require ACPI tables modification, while functionality may be useful even to end-users without required expertise. Convert the platform driver to a simple module. Signed-off-by: Alexander Sverdlin --- This RFC is merely to understand if this approach would be accepted. Converting to "tristate" could follow or preceed this patch. diff --git a/drivers/power/reset/restart-poweroff.c b/drivers/power/reset/restart-poweroff.c index 28f1822db1626..e1d94109f6823 100644 --- a/drivers/power/reset/restart-poweroff.c +++ b/drivers/power/reset/restart-poweroff.c @@ -20,7 +20,7 @@ static void restart_poweroff_do_poweroff(void) machine_restart(NULL); } -static int restart_poweroff_probe(struct platform_device *pdev) +static int __init restart_poweroff_init(void) { /* If a pm_power_off function has already been added, leave it alone */ if (pm_power_off != NULL) { @@ -33,12 +33,10 @@ static int restart_poweroff_probe(struct platform_device *pdev) return 0; } -static int restart_poweroff_remove(struct platform_device *pdev) +static void __exit restart_poweroff_exit(void) { if (pm_power_off == &restart_poweroff_do_poweroff) pm_power_off = NULL; - - return 0; } static const struct of_device_id of_restart_poweroff_match[] = { @@ -47,15 +45,8 @@ static const struct of_device_id of_restart_poweroff_match[] = { }; MODULE_DEVICE_TABLE(of, of_restart_poweroff_match); -static struct platform_driver restart_poweroff_driver = { - .probe = restart_poweroff_probe, - .remove = restart_poweroff_remove, - .driver = { - .name = "poweroff-restart", - .of_match_table = of_restart_poweroff_match, - }, -}; -module_platform_driver(restart_poweroff_driver); +module_init(restart_poweroff_init); +module_exit(restart_poweroff_exit); MODULE_AUTHOR("Andrew Lunn