From patchwork Thu Feb 8 17:03:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 198495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp313463dyd; Thu, 8 Feb 2024 09:06:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCQE+VKgVriZsXCaGKuzfCWqroQ2HIgFGGEzpCrGwDA1T9PW4tTDymKtCMhl8ChbFvvvHj X-Received: by 2002:a05:620a:4101:b0:785:a8da:70b1 with SMTP id j1-20020a05620a410100b00785a8da70b1mr67034qko.77.1707412016907; Thu, 08 Feb 2024 09:06:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707412016; cv=pass; d=google.com; s=arc-20160816; b=vtmsdREWRDz23FmmtnsSlbNGwq6YaOdxLD4avEzgbrn8ulewVp6Rszr59kSf1bxp9n cmY1jWEgxm0nfXIBAJ6hNtrjaFOjiGC3ZuYHX5MtHQ3eUgGmErFIbjQXmiZyLXXx8WNE ZtIN8YnyQNoHKnAzVsF6+q8j0CJE3V9S6/u9ugcEFbuKNdMTl6GQp7ZDY4ef6g6BvPd3 sgG4hm+fKtchszDzeNXv0yDY8KKAD3ImfYwvWobol8o7oBviTfSOkpuLBdtdKw4eH+i5 Z+lJPLPjuOChC289f6HRt5FbW90701+x0bzrZvgBY3d9VBO5SwNZ6zLoBNqFV3/xLgoP Il4w== 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=/0F6qY/roFg0O+RhcXV+vPtDVTGoKBMhcQe7IisHxW0=; b=ev9N326l44P43fiSG+tDzTQKa7ArLHyyfZu60xR61vQSYTWfoUbktnPrK1KqfkBvQW BPhwQNX4ZrhrKTBtKeMW59TtkBo9TGwgB83oiHuYbcu3DnRwiQKS8hDAV5frTfoA36yn gGuA5I0Wl8nLiy2/YX2g4UQnbbNzpGi9IzY2duxCwhDvARN+ny9/WN34GCzV8rhj6cXf aZ9jWGnuN5TMxdlpZLlkLKp/n+/8EQXUTaaee4ALkMajZkiY42Hx+QyhOi5RgHxrsBgO Cs4Q51a4bhUoewQ0Umw/kxVaUCLeCc05LfadIL8CaxwtPRx3pu7/Kp9MpqIzr7RkOeYZ ND5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=sHXnFC1v; 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-58403-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58403-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com X-Forwarded-Encrypted: i=2; AJvYcCUE38rTUTOdwrA/CqL1qEOyj/ssi5Ru5VwZELF0Nbcwp6GzZ2kgXWk/MeH/SfowT8tjs6ELtw6WG/R4TO0eFjoAmoHWKQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dc55-20020a05620a523700b00783322de747si374519qkb.339.2024.02.08.09.06.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 09:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58403-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=sHXnFC1v; 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-58403-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58403-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0F3591C20A58 for ; Thu, 8 Feb 2024 17:06:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DF2C1292C5; Thu, 8 Feb 2024 17:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="sHXnFC1v" 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 5467982D76; Thu, 8 Feb 2024 17:04:35 +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=1707411876; cv=none; b=qMUOg2qT/uaFzVQbWlIQcVNc0ouRWx10GkKCi/Bwk3xBAoyRQDLX1Fg5j/LgQoMVkCqcaN7vQJUTJJAqA3WTYxPNklDgFEEgSY02V1W/DhJ+nL3PS9L6oDgxzSIp6+rhKhcwcmRYrDruCzfYwgisqjgqAN4h69eG7jIuxhub6SE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707411876; c=relaxed/simple; bh=F6j/rd2uqE1cUyZDghMq6eHqquIs5sdJYRKTy0Bo8is=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uwpXmXvPg+SWuN/2OvQ7JBtk7Yl5tsuCsk/DHmNZROyRnnDhtDRFklzWK0mQz4BYMqJDQTsJYNfYkIxsKH7qHHxeZ+2Saez4UykwJ26/76EWJSeeMo/d63sRr2ugDLnraY8Peydi2dsdLMHC38rRovWtl00KqlqF7niXrHrQzL4= 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=sHXnFC1v; 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 418H4Fbm018146; Thu, 8 Feb 2024 11:04:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1707411855; bh=9UwPUx+fSL3rKTkctxFppsbeFk236+6n4WL7g1DOd5Q=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=sHXnFC1v+iyNERIU7Jaz2XhjQohMsCr1L3ya+wCgbTXTnc6ZfU0DEzk+pM4O8QSVI C1+53K0Q90bVaWVJruTXqi7/9/d8xRsfr9advN/HQruddNqj2SqpmAxIXam0JvAJpW YtDKguRaKw5JkpZLxnT7RVfjM0FuJi8A0e/n3KUI= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 418H4FUV035240 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2024 11:04:15 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 Feb 2024 11:04:15 -0600 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE110.ent.ti.com (10.64.6.31) 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; Thu, 8 Feb 2024 11:04:15 -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 418H4B66091006; Thu, 8 Feb 2024 11:04:14 -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 v3 04/19] power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART) Date: Thu, 8 Feb 2024 11:03:55 -0600 Message-ID: <20240208170410.67975-5-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240208170410.67975-1-afd@ti.com> References: <20240208170410.67975-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: 1790351262861182065 X-GMAIL-MSGID: 1790351262861182065 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);