linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: leo.yan@linaro.org (Leo Yan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/4] coresight: Add and delete dump node for registration/unregistration
Date: Tue, 21 Nov 2017 11:08:42 +0800	[thread overview]
Message-ID: <1511233724-11867-3-git-send-email-leo.yan@linaro.org> (raw)
In-Reply-To: <1511233724-11867-1-git-send-email-leo.yan@linaro.org>

Coresight device registration is a proper time point to insert dump
node, the dump code utilizes the coresight device has panic callback
function pointer as flag to indicate if need insert panic node or not.
If the coresight device has panic callback function isn't NULL, then
allocates dump node and inserts node into list, otherwise directly
bail out with success.

When coresight device unregistration, it removes dump node from list
and releases resource properly.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 drivers/hwtracing/coresight/coresight.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index b8091be..3248f9b 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -1044,6 +1044,10 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
 	if (ret)
 		goto err_device_register;
 
+	ret = coresight_dump_add(csdev, desc->pdata ? desc->pdata->cpu : 0);
+	if (ret)
+		goto err_dump_add;
+
 	mutex_lock(&coresight_mutex);
 
 	coresight_fixup_device_conns(csdev);
@@ -1053,6 +1057,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
 
 	return csdev;
 
+err_dump_add:
+	device_unregister(&csdev->dev);
 err_device_register:
 	kfree(conns);
 err_kzalloc_conns:
@@ -1068,6 +1074,7 @@ void coresight_unregister(struct coresight_device *csdev)
 {
 	/* Remove references of that device in the topology */
 	coresight_remove_conns(csdev);
+	coresight_dump_del(csdev);
 	device_unregister(&csdev->dev);
 }
 EXPORT_SYMBOL_GPL(coresight_unregister);
-- 
2.7.4

  parent reply	other threads:[~2017-11-21  3:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21  3:08 [PATCH v2 0/4] coresight: support panic dump functionality Leo Yan
2017-11-21  3:08 ` [PATCH v2 1/4] coresight: Support " Leo Yan
2017-11-22 18:58   ` Mathieu Poirier
2017-11-24  1:54     ` Leo Yan
2017-11-24 16:29       ` Mathieu Poirier
2017-11-27  1:57         ` Leo Yan
2017-11-28 17:13           ` Mathieu Poirier
2017-11-21  3:08 ` Leo Yan [this message]
2017-11-21  3:08 ` [PATCH v2 3/4] coresight: tmc: Hook panic dump callback for ETB/ETF Leo Yan
2017-11-21  3:08 ` [PATCH v2 4/4] coresight: etm4x: Hook panic dump callback for etmv4 Leo Yan
2017-11-22 19:09   ` Mathieu Poirier
2017-11-23 17:03     ` Mathieu Poirier
2017-11-24  4:06       ` Leo Yan
2017-11-24 16:46         ` Mathieu Poirier

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=1511233724-11867-3-git-send-email-leo.yan@linaro.org \
    --to=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).