Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE84AC4338F for ; Sun, 22 Aug 2021 20:42:21 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B0346125F for ; Sun, 22 Aug 2021 20:42:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3B0346125F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C5BFE82DE8; Sun, 22 Aug 2021 22:41:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="krm1xUDz"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="rX9yT1x1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4153B82E05; Sun, 22 Aug 2021 22:41:42 +0200 (CEST) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 02C6082C0C for ; Sun, 22 Aug 2021 22:41:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 3F110580533; Sun, 22 Aug 2021 16:41:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 22 Aug 2021 16:41:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=/46fuQQnJVhKW 2C60oHZxvaTGTUhY8OKOzr5eCyDOqk=; b=krm1xUDzYVwcaDfDxxGM72Ezt7mNU 8cSrPxFdVb/Rw8ilqwCxXSLqQZWsWq1ao04AOsUCCgrovLagP9HuQSQCqnx3E1I1 MgOBUlG0+E84qls0opjEWJQFhcDvfevLF9YYsBmmEIPrUKn9SYiaD+ICta9rbf9f ZpI4u5fR+m7KfK18OAb1ECtbxNmKdm/Mw/eEQ+C0rgGxSWIyX4vjLr4ytN4W41CF 8sfNmX3R0ArwK8ULCFLWSmlwKi+3GomrXDcGxvQ9LUWgv1AH0VdjFe/P2eVuxep3 0RUICJaexa0PBBgXLgpn1z35xVUX6jI5ERnl7TqgJ5XITq2vQ7+bMV4ZQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=/46fuQQnJVhKW2C60oHZxvaTGTUhY8OKOzr5eCyDOqk=; b=rX9yT1x1 jk8f/tfnixJgVDq3d3nFJIMDW664Fymde5k//xFeytXG4nG+jCU8JgJ11W14e6mz oujvvC2FFl8U3pTc8vpYJxxg4Zt64zo0aqVgMv/FMsdfa4gweZtXaVPYaHeBh1MX nzF/41l0J0dXBvrXtY7MmHo1CmNDrvINU08rudZX2KUokCpgYy0SSTsaOzR2Pb9A sUz1gvchHc8NKcvOVDOfUMZwgDh1bYbdpFEb+xFYbRq9g7gYF2X7Wbp60+DqKB0P U+ENeECaT5aXySJXd9RXaHa1Vs3GzY21eTxu1Orkxad4G7V8qYdCiV9vIm+byd3D yym61Lk8x/89GA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddtfedgudehvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudfhjeefvdfhgfefheetgffhieeigfefhefgvddvveefgeejheej vdfgjeehueeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 22 Aug 2021 16:41:34 -0400 (EDT) From: Samuel Holland To: Bin Meng , Simon Glass , Stefan Roese , u-boot@lists.denx.de Cc: Jagan Teki , Andre Przywara , Samuel Holland , Chee Hong Ang , GSS_MTK_Uboot_upstream , Harald Seiler , Ley Foon Tan , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Patrick Delaunay , Priyanka Jain , Rasmus Villemoes , Sebastian Reichel , Siew Chin Lim , Teresa Remmet , Weijie Gao Subject: [PATCH 3/4] sysreset: watchdog: Move watchdog reference to plat data Date: Sun, 22 Aug 2021 15:41:20 -0500 Message-Id: <20210822204121.42625-4-samuel@sholland.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210822204121.42625-1-samuel@sholland.org> References: <20210822204121.42625-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Currently, the wdt_reboot driver always gets its watchdog device reference from an OF node. This prevents selecting a watchdog at runtime. Move the watchdog device reference to the plat data, so the driver can be bound with the reference pre-provided. The reference will still be acquired from the OF node if it is not already provided. Signed-off-by: Samuel Holland --- drivers/sysreset/sysreset_watchdog.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/sysreset/sysreset_watchdog.c b/drivers/sysreset/sysreset_watchdog.c index c7ae368d41a..b723f5647cd 100644 --- a/drivers/sysreset/sysreset_watchdog.c +++ b/drivers/sysreset/sysreset_watchdog.c @@ -9,16 +9,16 @@ #include #include -struct wdt_reboot_priv { +struct wdt_reboot_plat { struct udevice *wdt; }; static int wdt_reboot_request(struct udevice *dev, enum sysreset_t type) { - struct wdt_reboot_priv *priv = dev_get_priv(dev); + struct wdt_reboot_plat *plat = dev_get_plat(dev); int ret; - ret = wdt_expire_now(priv->wdt, 0); + ret = wdt_expire_now(plat->wdt, 0); if (ret) return ret; @@ -29,13 +29,13 @@ static struct sysreset_ops wdt_reboot_ops = { .request = wdt_reboot_request, }; -static int wdt_reboot_probe(struct udevice *dev) +static int wdt_reboot_of_to_plat(struct udevice *dev) { - struct wdt_reboot_priv *priv = dev_get_priv(dev); + struct wdt_reboot_plat *plat = dev_get_plat(dev); int err; err = uclass_get_device_by_phandle(UCLASS_WDT, dev, - "wdt", &priv->wdt); + "wdt", &plat->wdt); if (err) { pr_err("unable to find wdt device\n"); return err; @@ -53,7 +53,7 @@ U_BOOT_DRIVER(wdt_reboot) = { .name = "wdt_reboot", .id = UCLASS_SYSRESET, .of_match = wdt_reboot_ids, + .of_to_plat = wdt_reboot_of_to_plat, + .plat_auto = sizeof(struct wdt_reboot_plat), .ops = &wdt_reboot_ops, - .priv_auto = sizeof(struct wdt_reboot_priv), - .probe = wdt_reboot_probe, }; -- 2.31.1