linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuhong Yuan <hslester96@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Patrick Havelange <patrick.havelange@essensium.com>,
	William Breathitt Gray <vilhelm.gray@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chuhong Yuan <hslester96@gmail.com>
Subject: [PATCH] counter/ftm-quaddec: Use device-managed registration API
Date: Thu, 25 Jul 2019 16:54:58 +0800	[thread overview]
Message-ID: <20190725085458.21838-1-hslester96@gmail.com> (raw)

Make use of devm_counter_register.
Then we can remove redundant unregistration API
usage to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/counter/ftm-quaddec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/counter/ftm-quaddec.c b/drivers/counter/ftm-quaddec.c
index 68a9b7393457..bccbca8681b6 100644
--- a/drivers/counter/ftm-quaddec.c
+++ b/drivers/counter/ftm-quaddec.c
@@ -317,7 +317,7 @@ static int ftm_quaddec_probe(struct platform_device *pdev)
 
 	ftm_quaddec_init(ftm);
 
-	ret = counter_register(&ftm->counter);
+	ret = devm_counter_register(&pdev->dev, &ftm->counter);
 	if (ret)
 		ftm_quaddec_disable(ftm);
 
@@ -328,8 +328,6 @@ static int ftm_quaddec_remove(struct platform_device *pdev)
 {
 	struct ftm_quaddec *ftm = platform_get_drvdata(pdev);
 
-	counter_unregister(&ftm->counter);
-
 	ftm_quaddec_disable(ftm);
 
 	return 0;
-- 
2.20.1


             reply	other threads:[~2019-07-25  8:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25  8:54 Chuhong Yuan [this message]
2019-07-25 11:31 ` [PATCH] counter/ftm-quaddec: Use device-managed registration API Patrick Havelange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190725085458.21838-1-hslester96@gmail.com \
    --to=hslester96@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrick.havelange@essensium.com \
    --cc=vilhelm.gray@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).