From patchwork Mon Nov 4 18:12:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 178463 Delivered-To: patch@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp4389444ocf; Mon, 4 Nov 2019 10:13:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzQ9w7yBUo5YNwYvdmiZRpDFZjG2fXfhoA9iJL5fNb7CJWLoLANK9wdfvUSbRjK8Ng37xQv X-Received: by 2002:a50:cc07:: with SMTP id m7mr3933211edi.34.1572891206977; Mon, 04 Nov 2019 10:13:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572891206; cv=none; d=google.com; s=arc-20160816; b=vT8OBNjm2rt9fw3QNsGsWjPoEGXsC1ZB9/U2G3PhiXn6Wo0FD0f8Kc80GvpcDkFg8z 9qPiSyI5Be1fw3HRI1EmzW8U8kTBM78mV3akbPWRkziv8HuOW5c5AbjCji9dgM4s30V0 t53EqaHYloD8W06UBfT/54To4aSPbLcYU+mjMo3TPk8t0QMR4JuFQx1rBGD7w58Hogss rSMo4EDPTJn/OgTGltr/QjQRV8Vl9nxWSz/7e2OjGlkm6xLPGkYzLuyadPHmYmX16xpd eR1xq9CtR15cPlYk6HSJLreICYfW5iVKBl5TXSMFGL7w0kmaetjLH9RGZNqDrod13bBf XujA== 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; bh=U+l5F417FgwxWcTtFu32EwI1EYbG0FhwLJDw4Yrt6Kk=; b=nYlDsPAQmHkhGTJkTQI6W5kPTgwmmitq+Kj+hLeR3QdXa4dZ0sOVJil5hyhczCjcWB +tUXmKO7xOGl8L4zZ49moAKBBfIsKvNzfEq1mY8PLOOK8kg+Ke8tqSekgeBkMXGayPhg u4s1kC8uAl6qL1Kec4LW2l3vPRrn7rTjXqNBBcg4ECXWIdEiEbTDoBsqprgiWtIeC7UX oaxfYDvakrnWd+dEQ637tEK217Wm+7Fj4oI12UypMlWuOHcqc6/XYqdPM1FyE9R578xP ycrztYnRnGkSc5IBdMQHVX1Kv2Z7mXRQK0XfJHUQKNNNrTpLK/D9c3OE2OYu1rgw/zyk p8MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a1jb8Ocw; 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 o14si1259472ejr.14.2019.11.04.10.13.26; Mon, 04 Nov 2019 10:13:26 -0800 (PST) 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 header.s=google header.b=a1jb8Ocw; 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 S1729613AbfKDSNJ (ORCPT + 26 others); Mon, 4 Nov 2019 13:13:09 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42085 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729575AbfKDSNE (ORCPT ); Mon, 4 Nov 2019 13:13:04 -0500 Received: by mail-pf1-f196.google.com with SMTP id s5so4591253pfh.9 for ; Mon, 04 Nov 2019 10:13:02 -0800 (PST) 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=U+l5F417FgwxWcTtFu32EwI1EYbG0FhwLJDw4Yrt6Kk=; b=a1jb8OcwTE5t6kokOfUIYVmLkWL2FZZgFIN/0R5uVkBpmKKDWvJfCvPfJ9u8yB8Kf8 NTYF3XWmVTiaxaNVI32u9UZmU5S+IS08LieUsFQCNBRqlL9X8OJqF/sARnquhMvO75/Y u5RXCedd4ox1Jw6PcwNFBSW6IQXUOSYq/74z0p/hT6/d2jnWw9niOxQVdYx9gHNJ1evp U5GRkytFxc9LurRnKgxfZU8Nh1B+6qqbkdCPXF0puBUkhJdlYIWgdJQqoMmIY5O494AJ zycuKZEwFVUJwV3QkUlpeRJpzomlzAhsRU5TuINBJeTDcM+2v1UbRJQFYB6bSImL5fH7 WBKg== 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=U+l5F417FgwxWcTtFu32EwI1EYbG0FhwLJDw4Yrt6Kk=; b=FUtJgCiCEQaK+AYq26AlUQOo1xIDi8xQb/scMH/IPS/OfMlnYjM1zQYtphY4kIHnvV U6/+AwG6vd1JdyBJ+aqinao0fStfMRE2+lprtvLKTN4FdIHaPyEqMFrRw2cW6kHkhwy4 TbiB7KVVTYYRLl3jwK0g6M4vRC2QsS2Cbh0ys5lNKSaWoUvQ39QXo4epqMwZ60AiZdJZ Ajl96ZtsGcQ0gmqB6uqRa/xX6g6Hy6Wl0SrS3SALgmUyJlW2UGfBuxVMMdQyB7VIZvFI E/UkbOxtWnAO3kqjRxYEZ59lo91TVLXCgudMig2WN4ZCuOuWAKtgEheHBYdokixETk89 j4ww== X-Gm-Message-State: APjAAAXOeyzhueIJfkx4bkZ1U//CQ+h/dVyKXtwYdQbfcfg11IYISzsr GoNuGfONdbvXoUul+gGm3NaQtEUmEcM= X-Received: by 2002:a17:90a:7188:: with SMTP id i8mr601428pjk.54.1572891181785; Mon, 04 Nov 2019 10:13:01 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id o12sm16149520pgl.86.2019.11.04.10.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2019 10:13:01 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/14] coresight: etm4x: Improve usability of sysfs - include/exclude addr. Date: Mon, 4 Nov 2019 11:12:45 -0700 Message-Id: <20191104181251.26732-9-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191104181251.26732-1-mathieu.poirier@linaro.org> References: <20191104181251.26732-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Leach Setting include / exclude on a range had to be done by setting the bit in 'mode' before setting the range. However, setting this bit also had the effect of altering the current range as well. Changed to only set include / exclude setting of a range at the point of setting that range. Either use a 3rd input parameter as the include exclude value, or if not present use the current value of 'mode'. Do not change current range when 'mode' changes. Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-etm4x-sysfs.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c index ea1e034809a0..8c056dd1a55e 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-sysfs.c @@ -297,8 +297,6 @@ static ssize_t mode_store(struct device *dev, spin_lock(&drvdata->spinlock); config->mode = val & ETMv4_MODE_ALL; - etm4_set_mode_exclude(drvdata, - config->mode & ETM_MODE_EXCLUDE ? true : false); if (drvdata->instrp0 == true) { /* start by clearing instruction P0 field */ @@ -972,8 +970,12 @@ static ssize_t addr_range_store(struct device *dev, unsigned long val1, val2; struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent); struct etmv4_config *config = &drvdata->config; + int elements, exclude; - if (sscanf(buf, "%lx %lx", &val1, &val2) != 2) + elements = sscanf(buf, "%lx %lx %x", &val1, &val2, &exclude); + + /* exclude is optional, but need at least two parameter */ + if (elements < 2) return -EINVAL; /* lower address comparator cannot have a higher address value */ if (val1 > val2) @@ -1001,9 +1003,11 @@ static ssize_t addr_range_store(struct device *dev, /* * Program include or exclude control bits for vinst or vdata * whenever we change addr comparators to ETM_ADDR_TYPE_RANGE + * use supplied value, or default to bit set in 'mode' */ - etm4_set_mode_exclude(drvdata, - config->mode & ETM_MODE_EXCLUDE ? true : false); + if (elements != 3) + exclude = config->mode & ETM_MODE_EXCLUDE; + etm4_set_mode_exclude(drvdata, exclude ? true : false); spin_unlock(&drvdata->spinlock); return size;