From patchwork Mon Feb 12 16:28:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 199891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp28072dyb; Mon, 12 Feb 2024 08:30:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHQyDeg7fhgLEXETVKXqKzA8bRSfypmZ/2WedQD4vNN5MCuLqZZsuGiP/f/7lf86YpHQK/ X-Received: by 2002:aa7:d908:0:b0:560:590:10b9 with SMTP id a8-20020aa7d908000000b00560059010b9mr5361169edr.2.1707755434668; Mon, 12 Feb 2024 08:30:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707755434; cv=pass; d=google.com; s=arc-20160816; b=e3C/3VVJd3XIcO2O4fOQgajitn7O9V6xqrYTRcXpPUiXTrTZnJwWWQOUr5X9Ip+kOY HsiXUpVaEtuOnOSZGyFnomCKO+aTUGMlhjNUpRsCgvwwAluI4eUM2v4YPN1hqdIlFKxO GB/Lthd75XbMV/nEXOHUJeqR7ScZ7ruHKrhVoKRCP43NCgXnmV0S0zdOxlwfvULeGwvF W4dgdeVeZYCz9vyhd6DWEAZ4dm2sH3iRV6O38OZ7qfgtlZPxXqClgHdPYLu2KgCoFBO0 suAfFQAK/3Cyqa/LgMlcVJzaSScL7oU4KFBdu1JsgyC4ADWc5hMpPCIfHr/YNLp5UCM0 hOMw== 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=d4/aEpQQ2pGVxyw2Lo4Ch85TkCb19622V/TBptNBgBM=; b=xGDzO65thzd0dSa33sfQUDM+cG4dTmWJ7Qd2kdhxbesw2D/vLMNymCCUfwBATubrKn /DcKB/fsyzztJO/zHKd4BZBWP2rKcmWitDr/ZxpsnZCJi0DvZ5xmuQjkJ+xbUqHOvtjQ /6SuggDk2vGnvtTpt3RZhuC+eT1VlUZqqAG+P3BOU1cdb68pQrXnVweWX9acf/N8GhHR w2crVHTpFfp8UiVJhl6CJNjLo4s3xtdZpIni0Kgqk1CutYiYvo3gPTZHqoxDHEBoRZj7 7+v6TfWk77jIdkgvlJwlmwpgbwlh0XF+AeOBOOz954jDWsSGoBntrlWlsR/thynIps2f GHMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="H/SZ7sbI"; 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-61959-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61959-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCW92JNSTfT4J74twbTwg8dIAMFxzjioTnFWEBKt6f8xUJ18rUtm6M7pWS5QHph9+MK3VMtoEXUMFq/aOtq5nCnJwDul+A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m2-20020a056402430200b005612fd31a0dsi2906882edc.427.2024.02.12.08.30.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:30:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61959-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="H/SZ7sbI"; 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-61959-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61959-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 3A7151F21E06 for ; Mon, 12 Feb 2024 16:30:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 968343FB16; Mon, 12 Feb 2024 16:28:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="H/SZ7sbI" 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 B86793D3A1; Mon, 12 Feb 2024 16:28:47 +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=1707755329; cv=none; b=aL5sR7O+SVGjIXBTIiNDYgOa/yU0IW7q86y8+2XuZqQw/cnnhK+DpfeFLXSYs9XBVML7TUb/6XhjbZEqHGt8PVuC2GkFxaawpc0XwJJ91dx+jC7rdfdBNsqPK+iMMvmIRZuS6WctvMDIt09oQTiP5zGpWUj/U/5caaM4QaSRHZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755329; c=relaxed/simple; bh=F6j/rd2uqE1cUyZDghMq6eHqquIs5sdJYRKTy0Bo8is=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IHOv1Uy9Nfk9oQrUCigLMhtGDvXzfCrqcDPJVipyaLuCz8yNKWUV0pabxQaayK037PKBTs0toBnMZfA/UK/xOX/dNuG0iqOJxHPA6FyijwDlOmBr9qTLFXnt18+tjaajsWpraTQg3QbkE08pGiV81pZhL4TxceR99TPp3QRBfGs= 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=H/SZ7sbI; 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 41CGSadb045193; Mon, 12 Feb 2024 10:28:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707755316; bh=9UwPUx+fSL3rKTkctxFppsbeFk236+6n4WL7g1DOd5Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=H/SZ7sbIjF3f0d2pCXRXRcE1gqiSFH3sJ7VDWYej5cVWcGSZ0j9duBlwWbClBLx9E 4wdk7UquWUJ8x6R2UQE5QAZ9U9tapK/leEWi76TNb3wvuLWecH0oP+G3Idn4zBN9OS +ytSakjCSxSpGX++wxeFacgFM9WzOC2OTf2tjdpE= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41CGSaa5041911 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 12 Feb 2024 10:28:36 -0600 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 12 Feb 2024 10:28:35 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE106.ent.ti.com (157.170.170.36) 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, 12 Feb 2024 10:28:35 -0600 Received: from lelvsmtp5.itg.ti.com ([10.249.42.149]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 41CGSWR0090688; Mon, 12 Feb 2024 10:28:35 -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 v4 04/19] power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART) Date: Mon, 12 Feb 2024 10:28:16 -0600 Message-ID: <20240212162831.67838-5-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240212162831.67838-1-afd@ti.com> References: <20240212162831.67838-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: 1790711362568649112 X-GMAIL-MSGID: 1790711362568649112 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);