Received: by 2002:a05:7412:a986:b0:f9:90c9:de9f with SMTP id o6csp5434rdh; Wed, 20 Dec 2023 12:35:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IElixdbjlOuI2U17RboQIeEfsVJKgGV4QvAh2nr9m/lUMnl+p/gXov1jso71AqgPUeGiW81 X-Received: by 2002:a17:902:b697:b0:1d0:55c7:38fb with SMTP id c23-20020a170902b69700b001d055c738fbmr10967472pls.38.1703104542846; Wed, 20 Dec 2023 12:35:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703104542; cv=none; d=google.com; s=arc-20160816; b=nK9owFgcosF5kMjbd8lyB5OJzF6TvsuS9qNDS4SDzxz/WRiElJYcHjgAVYl6aSggIm 2nRh7TzJVyubG89pYLS4I9CaHIMIbTY18sErTF80JI+3aU4pu4a7XITt41N7rUyuqWNM iX300yoDklgcUHZC0Tu2YDfyo6uY61CcwviYv/e9Xrn8QbRH0NTt0V2A55kCV1LoN5VW fvUOh4WF3K+j+G2RbFrNbpqMg58LKQexqNLa1MWGoRNv8CRvvLKppMavcSsG65uVaXDY /gSBHRiHuc7lt9EdXthGVSRbdIalnCydSjZ2QaddrzGn/LI0rN9YzHPUvIdACOl1n/7t 16Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oVoim3ZI7VZX/tKDQGzFMPPOl07OuoqY3KhlixMQhCE=; fh=k+YP7Xa/rLvf7+qSW2jjw+pAldhHeVhcqrFUcgxkZP0=; b=0tV8Z4e/Nbt1hPy7zxyCycy9Eb347QsM2LEdC2Vc+oj2XcthzD/bOvnkEv9lf4pfhx iqdgWcX0fIq8Tl21VQjR5ScHaTXB93mrpWQGcGwVnD6cyZ5fxTermuESfP7YHmP2KyN3 /cWzTMVcw6FZPmyjOciq2BJOP4SRPZX8WQbWSR8q/XenhgJ7TmYfxmer1ku7SnbeMRbR SsGAXD0HyJJDnme/chlYqpKNXFFvyiH4gvpLF3kBuQRH1n3C7rS32P4BD+tx6bMYlGk4 5RLyCRgZnAhZ8VOYyKp4fK1Z3efY7QRbh6Pfzo6/jLpaAZdV5YjNn1bq6M7kf3CdMoiJ bW1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cTCsxwbp; spf=pass (google.com: domain of linux-kernel+bounces-7414-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y14-20020a17090a134e00b0028bbdf5c434si356416pjf.103.2023.12.20.12.35.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 12:35:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7414-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=@gmail.com header.s=20230601 header.b=cTCsxwbp; spf=pass (google.com: domain of linux-kernel+bounces-7414-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7414-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 90598285F62 for ; Wed, 20 Dec 2023 20:35:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E4A721DDE4; Wed, 20 Dec 2023 20:35:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cTCsxwbp" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFE641DA35; Wed, 20 Dec 2023 20:35:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3b9f8c9307dso28442b6e.0; Wed, 20 Dec 2023 12:35:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703104531; x=1703709331; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=oVoim3ZI7VZX/tKDQGzFMPPOl07OuoqY3KhlixMQhCE=; b=cTCsxwbpYjiSwZD7+ep45sjVKSQmqTV7FfqP+W/KGb3ce6Q1A2cNcqWv3/FiZb+Dee l2pK3eENiTj+ZCX88o8MnJTbuyEwwKpvAzBPo7nWOHGFiYncQxYwGI3ARjDwD1ZpDeCt 1lBjcrJKGC240t5TwjA7VgkyHKQT6OWfUQbIGfrTrblONI6co4XEyzWN+YL6FGdnsneF FYHIiFp3k7KXYf61Wedjw4/MwmVsiVip1YpY+UypBFu0IHLJePe0ryzzZPg8PX4LN4pr aEAsuF365JPm33lGRdcTT2tKgXFsOsM6cJjAIN2RKHgQmgQw0VZ57lp3ler5P80LDHqc jZ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703104531; x=1703709331; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oVoim3ZI7VZX/tKDQGzFMPPOl07OuoqY3KhlixMQhCE=; b=H1WJxjDVmFUhwp7u9U0Fql8JGu1pGHiYjOxMpfwDk4E9/LUp3uz3KHKEvdzWObF9RZ gwFp2CvNsFhcoLfeH2m6iUfQ1OvGONrLK/HafIuK5vUk9Lsfm72WoZ/0PHcHO0kY4o6j 9nbwroZN9weHknJp7akZ4M36LPuoOhUO4eG7xTtdOWsV7Ln9IRbHtgBvnzK8oC0MH7pF hyNqHoyBTy1LbaQLFc2xhj4xQVieSQqgxAr2BNw3MJctCnUTfqcoqYUvZWwRGJBTYXhY qc0qeX9rPsRsF8fcU+4DKWZFm9qBbAFrfJB4G2MQweP1a/a0LBxXZe+6Ji3MivLTX9bk 6K8A== X-Gm-Message-State: AOJu0YzLgLKGWahlXNIpISxCqtlu+hoPwnM6573R/Zj6sloylf9WfCaG 6JSppfj2Lfl9qFahBFTUGV0= X-Received: by 2002:a05:6808:2129:b0:3bb:7681:aac with SMTP id r41-20020a056808212900b003bb76810aacmr642856oiw.79.1703104529811; Wed, 20 Dec 2023 12:35:29 -0800 (PST) Received: from errol.ini.cmu.edu ([72.95.245.133]) by smtp.gmail.com with ESMTPSA id er14-20020a056214190e00b0067f4886019dsm142513qvb.122.2023.12.20.12.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 12:35:29 -0800 (PST) Date: Wed, 20 Dec 2023 15:35:21 -0500 From: "Gabriel L. Somlo" To: arnd@arndb.de Cc: soc@kernel.org, Andrew Davis , Mark Rutland , Lorenzo Pieralisi , Sebastian Reichel , Karol Gugala , Mateusz Holenko , Joel Stanley , Mark Brown , Orson Zhai , Baolin Wang , Chunyan Zhang , Lee Jones , Dmitry Osipenko , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH RFC 2/5] drivers/soc/litex: Use devm_register_restart_handler() Message-ID: References: <20231117161006.87734-1-afd@ti.com> <20231117161006.87734-3-afd@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231117161006.87734-3-afd@ti.com> X-Clacks-Overhead: GNU Terry Pratchett On Fri, Nov 17, 2023 at 10:10:03AM -0600, Andrew Davis wrote: > Use device life-cycle managed register function to simplify probe error > path and eliminate need for explicit remove function. > > Signed-off-by: Andrew Davis Reviewed-by: Gabriel Somlo Arnd: the original patch is available here for the purpose of pulling via the soc tree: https://lore.kernel.org/lkml/20231117161006.87734-3-afd@ti.com/ Thanks, --Gabriel > --- > drivers/soc/litex/litex_soc_ctrl.c | 23 +++++------------------ > 1 file changed, 5 insertions(+), 18 deletions(-) > > diff --git a/drivers/soc/litex/litex_soc_ctrl.c b/drivers/soc/litex/litex_soc_ctrl.c > index 10813299aa106..7a0096d93c73d 100644 > --- a/drivers/soc/litex/litex_soc_ctrl.c > +++ b/drivers/soc/litex/litex_soc_ctrl.c > @@ -69,14 +69,11 @@ static int litex_check_csr_access(void __iomem *reg_addr) > > struct litex_soc_ctrl_device { > void __iomem *base; > - struct notifier_block reset_nb; > }; > > -static int litex_reset_handler(struct notifier_block *this, unsigned long mode, > - void *cmd) > +static int litex_reset_handler(struct sys_off_data *data) > { > - struct litex_soc_ctrl_device *soc_ctrl_dev = > - container_of(this, struct litex_soc_ctrl_device, reset_nb); > + struct litex_soc_ctrl_device *soc_ctrl_dev = data->cb_data; > > litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE); > return NOTIFY_DONE; > @@ -107,11 +104,9 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev) > if (error) > return error; > > - platform_set_drvdata(pdev, soc_ctrl_dev); > - > - soc_ctrl_dev->reset_nb.notifier_call = litex_reset_handler; > - soc_ctrl_dev->reset_nb.priority = 128; > - error = register_restart_handler(&soc_ctrl_dev->reset_nb); > + error = devm_register_restart_handler(&pdev->dev, > + litex_reset_handler, > + soc_ctrl_dev); > if (error) { > dev_warn(&pdev->dev, "cannot register restart handler: %d\n", > error); > @@ -120,20 +115,12 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev) > return 0; > } > > -static void litex_soc_ctrl_remove(struct platform_device *pdev) > -{ > - struct litex_soc_ctrl_device *soc_ctrl_dev = platform_get_drvdata(pdev); > - > - unregister_restart_handler(&soc_ctrl_dev->reset_nb); > -} > - > static struct platform_driver litex_soc_ctrl_driver = { > .driver = { > .name = "litex-soc-controller", > .of_match_table = of_match_ptr(litex_soc_ctrl_of_match) > }, > .probe = litex_soc_ctrl_probe, > - .remove_new = litex_soc_ctrl_remove, > }; > > module_platform_driver(litex_soc_ctrl_driver); > -- > 2.39.2 >