From patchwork Sat Jun 3 14:42:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 101325 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp203947qgd; Sat, 3 Jun 2017 07:44:13 -0700 (PDT) X-Received: by 10.99.131.65 with SMTP id h62mr11462448pge.151.1496501053488; Sat, 03 Jun 2017 07:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496501053; cv=none; d=google.com; s=arc-20160816; b=PbnPueSTK5SNDF25pdPdf4MIwLN7qS29HJzWn0xGOFWi0hmLR7zVSKPxyNI/rAtcq9 49/wo6XrGnkIS0Jnb/Wk4laTsLijDneUzSHu241wVWekuTQ5j0EG2aw53nX8nn4K3W73 Fs1b4GhCSBhREQOfqDJSnN1lHJN6FIcFuVO60fwCRuG2nB9nendVQtfXT44JiOTA7G3g dIQMiZRB4sOMHBPz6Kf7VDdjyeWeYaSQvCTRjkum7tWKTt2WiiIQifRNesEH9bj1qvHp Iy6dFQl9k39EkPSdabganQPe56XQVTfJvAm6+/w3uRJelDYxXZr0uUdTg7ItX4stJcOg HwcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=sqN0RZhFLk4elLi9WUXgv/rapza9QLQZvrmkKLKZ4IE=; b=zTEZHCbbHx3bSRij26HHx6l0uKxWjeVcqldKsJWxdb6bVKp+y1gxvy1cvuKD7xm2ay z5GziLVRjhtF2Olrery4+DSgVi48RcGJujgjHhjSqmmR/errEA9xmSp97wEHHYFP4M3Z iptG4EbLS04kPqDk93e9YMuIxGhFFU51DJ65ozBMHEEgktNuqdheuDPBGhWX1jL5v+MF hfKO5I10k3ZnpnxO9XoAZ8cYgN+QW5a8giQidJH6Aj51YL1jK9aLzEnkTYow4qqbNmKR oaR6AVCui1LjQEWBDliMglDyZfhGFzErseFCKqSAAQbPP/p4dgx7Rz6Lk4iyKB1Wmwj4 42RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si2514676plk.369.2017.06.03.07.44.13; Sat, 03 Jun 2017 07:44:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751234AbdFCOnj (ORCPT + 25 others); Sat, 3 Jun 2017 10:43:39 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:33815 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750765AbdFCOnf (ORCPT ); Sat, 3 Jun 2017 10:43:35 -0400 Received: by mail-pg0-f48.google.com with SMTP id t185so6999220pgd.1 for ; Sat, 03 Jun 2017 07:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sqN0RZhFLk4elLi9WUXgv/rapza9QLQZvrmkKLKZ4IE=; b=EF6k64RPzfWzA6x0n6ybACCYMJ0mud1pIjI+xrpA5RcC2jO4A+1FmkjwrupI+hgFS2 V5JS3N2zQw6WSknUgj1yObeQmzUXcNlplrqn1rnNmMq79DClyy923aRb/Yvux9doQkZV MiL9puIyggJMOh/6YAD7OlbDgGc4TbfVkxhwM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sqN0RZhFLk4elLi9WUXgv/rapza9QLQZvrmkKLKZ4IE=; b=Mr0Xv38/sa70a+BEjJ46vsmJoK+PSLIDjedk90Tx2IzI2qeArqkTDCw1gFsygDlJui WedeBiULxlIlxr8NHzyHBL6ydXQDYFthG1KcPhfx0q9wJYDx1GRv8b4EvyiaBlwS+Ra+ Kq8pwvmm+s0XVWqBN8/+DST80KQIRWwMTX1J/tHZRI4e9jgIUm5GNR/RFf/AntgIPM6t 4/j2MHuTTVTdlnBniByCv+X60q/pY4CcRPbZIv2k+pZJ5WaJLdMwWM93FxRddajh6MKa wuBzbxPQ73LjvrHF5O4hetIoMvA6zGIyIdcSkOsl5vBKoc5dCb6FxrqC71l65jCuXFTC 0ioA== X-Gm-Message-State: AODbwcD2HaQav3HJXF5XFE0/i4Tl/+2LTxQUsb7mklvuDNIbQL/Erqdk M2jLuumDCkie0qk6 X-Received: by 10.99.166.18 with SMTP id t18mr12272272pge.218.1496501015144; Sat, 03 Jun 2017 07:43:35 -0700 (PDT) Received: from localhost.localdomain (li1568-49.members.linode.com. [139.162.88.49]) by smtp.gmail.com with ESMTPSA id s68sm43510861pgc.5.2017.06.03.07.43.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 03 Jun 2017 07:43:33 -0700 (PDT) From: Leo Yan To: Mathieu Poirier , Will Deacon , Suzuki K Poulose , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mike Leach , Chunyan Zhang Cc: Leo Yan Subject: [PATCH v1 2/4] coresight: add and remove panic callback for sink Date: Sat, 3 Jun 2017 22:42:54 +0800 Message-Id: <1496500976-18362-3-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496500976-18362-1-git-send-email-leo.yan@linaro.org> References: <1496500976-18362-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/hwtracing/coresight/coresight.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.7.4 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;