Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1656849

[PATCH v1 2/4] coresight: add and remove panic callback for sink

From Leo Yan <leo.yan@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v1 2/4] coresight: add and remove panic callback for sink
Date 2017-06-03 16:50 +0200
Message-ID <tOixk-8g5-17@gated-at.bofh.it> (permalink)
References <tOixj-8g5-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


If the sink device has panic callback function, add the panic callback
node for coresight panic dump list when the sink device is enabled;
also cleanup the node when the sink device is disabled.

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

diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 0c37356..5928886 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -138,6 +138,13 @@ static int coresight_enable_sink(struct coresight_device *csdev, u32 mode)
 			if (ret)
 				return ret;
 		}
+
+		/* Add kernel panic callback */
+		if (sink_ops(csdev)->panic_cb) {
+			ret = coresight_add_panic_cb(csdev);
+			if (ret)
+				return ret;
+		}
 		csdev->enable = true;
 	}
 
@@ -149,6 +156,10 @@ static int coresight_enable_sink(struct coresight_device *csdev, u32 mode)
 static void coresight_disable_sink(struct coresight_device *csdev)
 {
 	if (atomic_dec_return(csdev->refcnt) == 0) {
+		/* Remove kernel panic callback */
+		if (sink_ops(csdev)->panic_cb)
+			coresight_del_panic_cb(csdev);
+
 		if (sink_ops(csdev)->disable) {
 			sink_ops(csdev)->disable(csdev);
 			csdev->enable = false;
-- 
2.7.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v1 0/4] coresight: support panic dump functionality Leo Yan <leo.yan@linaro.org> - 2017-06-03 16:50 +0200
  [PATCH v1 3/4] coresight: tmc: hook panic callback for ETB/ETF Leo Yan <leo.yan@linaro.org> - 2017-06-03 16:50 +0200
  [PATCH v1 2/4] coresight: add and remove panic callback for sink Leo Yan <leo.yan@linaro.org> - 2017-06-03 16:50 +0200
    Re: [PATCH v1 2/4] coresight: add and remove panic callback for sink Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2017-06-05 11:30 +0200
      Re: [PATCH v1 2/4] coresight: add and remove panic callback for sink Leo Yan <leo.yan@linaro.org> - 2017-06-05 12:20 +0200
  Re: [PATCH v1 0/4] coresight: support panic dump functionality Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2017-06-05 11:00 +0200
    Re: [PATCH v1 0/4] coresight: support panic dump functionality Leo Yan <leo.yan@linaro.org> - 2017-06-05 11:30 +0200

csiph-web