From patchwork Mon Feb 5 19:44:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 197006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1153690dyb; Mon, 5 Feb 2024 13:25:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1EQ6lF8B1IWcVSYFsEKCcOHanVDMi2w2JEGDPDrleQDywDW4kQBnZLbI4c1EvOGDYvM5u X-Received: by 2002:aa7:cf99:0:b0:55f:fd10:5e73 with SMTP id z25-20020aa7cf99000000b0055ffd105e73mr311865edx.20.1707168316930; Mon, 05 Feb 2024 13:25:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707168316; cv=pass; d=google.com; s=arc-20160816; b=QfT9qk2l/zD5yiQduCiZM2y4fbqkRp5NzPLA5HWx0risQE31mJDCZDPZfdT2T/Eofs tL0C9d+dX7PjBZdhOvof8cNJd4BFEmkz6yi7dbttbAGQ6GQIQGbFa94PAM+m1yNcIu2P FYuvmABA05+ZyAfMutmNyz3H5Ho6N0bAAlU+5yT4fmvxzDsjLP3sTnkVPMHOjdBJ48pO KtNl1USP/wpXh6K9SVxKBqUHU50mTcizILyn357mMSFjLXv1rFm0xUMbHzdHrESbrk1z bNZK4mJJB5S3QZUTR3JDY6qGpi8t+x4cESQedmbhfQUwq+cc7o50DSxkZ15WLwL42Zxe /QnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9UwPUx+fSL3rKTkctxFppsbeFk236+6n4WL7g1DOd5Q=; fh=3VflCStC3bkcMYFvg5AJYsZAXe2/RMEI4VsmZvV+dVg=; b=kVHkfxAJ/zP4nQR2W7h7gdBXyx27rLGY1UWDKtKzqErnT4PM2iEvtcE2ukJUlkAXS2 6UjGnF4wsKjcLaSoRulSvg84eCfjKepg7YgAqDrVoKfO2yDMUGyNd40ww36J0wxEwlOW uu7pRIHj55MNXJtD5cev5xnr5nJednF2qZLykqdu6KOStFF0zVL8UuDO4SXJBVgRH/Ir Xnp8wkS6ussLEleKEbzyMwoyXSnx/OvUMp7NkSGUX+NwkUrkz7+bCDewnwxRLMomn+wh R2CiuhVTLQ3lW2xcOvtxSRFI3cp4yRAC6PIOxWvWQXr3+Jihm1dJfeUk4ghip+Evcp0x JF+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Cmuafe8v; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-53838-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53838-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=1; AJvYcCVLrKbFM3ngqY95n+tJ4a2gYkDmlQYOvsnDIaEOQFAVNGsrYv9n5DvdL+EDNsReJ82qzCZ4OacwqdrgsyvME/+CCTVgWg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g2-20020a50d5c2000000b0056037469195si293969edj.393.2024.02.05.13.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:25:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53838-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Cmuafe8v; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-53838-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53838-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 89D3D1F29F38 for ; Mon, 5 Feb 2024 21:25:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02F3969D30; Mon, 5 Feb 2024 19:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Cmuafe8v" Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 70E13634FE; Mon, 5 Feb 2024 19:44:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707162299; cv=none; b=H0LGs6JNAbLg6O9v0sLxAmmEZ0STTXWQIufSOcHueq9nckEQjvZPjjVKxU0Uj1MGoQJ7UY3w2K7JOfwt1iRH4rko7Y7sISMH/nfxCea9845CZUfLfF1DPaBYy50JQU6EQiCSQYCs0ruhJAuht9Yc5ScPbgLb6UmFdx3/oZxNKOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707162299; c=relaxed/simple; bh=F6j/rd2uqE1cUyZDghMq6eHqquIs5sdJYRKTy0Bo8is=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sPHJ/HEmTETdpZa2PP/vqGCXdrUTcRk9OlHAQPvaCi93sFW6/iNuQn+m9t0ZZ0K4YDeVVhM4O9nLjI4Bvy4M0yJAr3j6RVuShoVULui8OtH358Upigzecy9bsa/CJWT0k9Ib0xINQwDo/tHxPhZMagrxNKvGzF+LX/xlytv3LEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=Cmuafe8v; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 415JigDQ016347; Mon, 5 Feb 2024 13:44:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707162282; bh=9UwPUx+fSL3rKTkctxFppsbeFk236+6n4WL7g1DOd5Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Cmuafe8v4HrVCHgJ53LMs2HBitQNyBfXSdqCm98nQrEBjVtIyeFphsaMxFB99dr3H hhtBOJvVjD9cO7IPQw4rF9PC+tS21MJS7eab2X4yolSNXCWpVYEs21Y6Mvlz1mosVz ir3Ash+EGGyN2vRAUhgUhGuxqMEpB7m6p03QNWWg= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 415JigvJ071002 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Feb 2024 13:44:42 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 5 Feb 2024 13:44:41 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 5 Feb 2024 13:44:41 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 415JicQR028467; Mon, 5 Feb 2024 13:44:41 -0600 From: Andrew Davis To: Sebastian Reichel , Manivannan Sadhasivam , Cristian Ciocaltea , Florian Fainelli , Ray Jui , Scott Branden , Bjorn Andersson , Konrad Dybcio , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , Andrew Davis Subject: [PATCH v2 04/19] power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART) Date: Mon, 5 Feb 2024 13:44:22 -0600 Message-ID: <20240205194437.180802-5-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240205194437.180802-1-afd@ti.com> References: <20240205194437.180802-1-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790095724974973906 X-GMAIL-MSGID: 1790095724974973906 Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis --- drivers/power/reset/xgene-reboot.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c index 6b545a83d8889..867162dfe7eae 100644 --- a/drivers/power/reset/xgene-reboot.c +++ b/drivers/power/reset/xgene-reboot.c @@ -24,15 +24,11 @@ struct xgene_reboot_context { struct device *dev; void __iomem *csr; u32 mask; - struct notifier_block restart_handler; }; -static int xgene_restart_handler(struct notifier_block *this, - unsigned long mode, void *cmd) +static int xgene_restart_handler(struct sys_off_data *data) { - struct xgene_reboot_context *ctx = - container_of(this, struct xgene_reboot_context, - restart_handler); + struct xgene_reboot_context *ctx = data->cb_data; /* Issue the reboot */ writel(ctx->mask, ctx->csr); @@ -64,9 +60,8 @@ static int xgene_reboot_probe(struct platform_device *pdev) ctx->mask = 0xFFFFFFFF; ctx->dev = dev; - ctx->restart_handler.notifier_call = xgene_restart_handler; - ctx->restart_handler.priority = 128; - err = register_restart_handler(&ctx->restart_handler); + err = devm_register_sys_off_handler(dev, SYS_OFF_MODE_RESTART, 128, + xgene_restart_handler, ctx); if (err) dev_err(dev, "cannot register restart handler (err=%d)\n", err);