From patchwork Thu Sep 20 19:18:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 147155 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2376854ljw; Thu, 20 Sep 2018 12:19:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdanTtVGQ6ymQaV9b/Z8l7/O9zqGGLx9vVLqZqoxLB8o6zFPcx3S3PtJ4S+VtDvkIT33cdTw X-Received: by 2002:a62:8208:: with SMTP id w8-v6mr42179198pfd.215.1537471165430; Thu, 20 Sep 2018 12:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537471165; cv=none; d=google.com; s=arc-20160816; b=CK1dwWvyTCC8qO3S+4T6mi97s+lVAPmj0QjWzjB/i60ku4rmJ2HcC2TN4HNs0UIOiA a3ri+DF3iRrVKML4wYl214CUT22sjJYrSSu82fCKF80OcViewmQ0cmZ1+UMKmCq99LLS QoPFtHb8IJAtshfT2qjX4IWS5tO7rXwqwo0LGlGWXETer9U+0oEyXq5D5meeSMYuST8k cFb7CoOGEy6XOAAPz0hRrApTSf0PDrYBvkLHC3tHeTXtwJDnws4bWUJnK5gH1x4zSsHz CDk7/DLQ4WKux/Ep+dm/iEZUimVl7BRWfKYYhvteKNjwc6IoHSXAA7CdUlG+W5dsvRs5 yabQ== 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=T80GjCa0DMwxYtCVqkR4Wxt15OnIR0TvjpRXiH/ixL4=; b=ik9YoZIeXNif7jJW4KpqvWL3iPJBLGSr3y3XBnnwRjNIAp3f6rAgi0epPRyrUoRkWA 9FYV8k9edwrU2eja37ZKLHMkmiuDZ3lxlfJxVXFSJXPmNe0lkUj8OV6r6zFndStTvI/7 P0RWDsUbZlbNEq1blKi9nHXzE88kqHhnO9C962tep2C+953xzD3uCpgA/nPeMuozrtw8 267K6fUYB2Z57Xehv9UQJQ1VTQfUEVtFqB4Iw+MAUdJXCEyHtY58DQMAOpUcOjJMciKJ eX0DCQP4d5X+OwG61L+14BOhwQdoC8HsstgahiW4O/5Miw5klTCSx3bd2EOD3eM7hnuz MmIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pci4h3ko; 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 s136-v6si26101346pfs.255.2018.09.20.12.19.25; Thu, 20 Sep 2018 12:19:25 -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 header.s=google header.b=Pci4h3ko; 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 S2389100AbeIUBEU (ORCPT + 32 others); Thu, 20 Sep 2018 21:04:20 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:47033 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388518AbeIUBEU (ORCPT ); Thu, 20 Sep 2018 21:04:20 -0400 Received: by mail-pf1-f193.google.com with SMTP id u24-v6so4807160pfn.13 for ; Thu, 20 Sep 2018 12:19:21 -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=T80GjCa0DMwxYtCVqkR4Wxt15OnIR0TvjpRXiH/ixL4=; b=Pci4h3kouhEsck8AUPW+3dRC+H1jBj+PZXIq3XUSVLm1lSioblCBJ3jw4XLOBbRSl0 zMkv+LBm5yGTSM2wbAGqHpi4PtfjDvMML8eG+PV9BIcssXkafnv2O6wZ/+P41x+kec40 rzCYZy6TJlZHwXt9wpWrUmLJRwnbnd5Gb+Z5g= 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=T80GjCa0DMwxYtCVqkR4Wxt15OnIR0TvjpRXiH/ixL4=; b=dyIgYhCuiR9Xe8d2YQEwNX7gjtvAzZdCct2fZoHKpnXoyvIQk0W24tAp1DTddKzaQi m9XRsc8C4iL9boeqNvKgEGbAQ5Sy+klQJewrLutZZlm6dxgxWlsgW2AnaYue9E2QRsfi EgTCbI8KjLC5x5BKdXBbByetow2XaJd84mEMZ8TByyjrxMJw4e43K8ehoemfjyt5ftVT TOMWKVE84b4RcnXXT3M8XW8SpohrMluVu4AeeHTjxU/B5UKBzYF5z8vXiL+qSK9mcl72 Na68YF2pWofLuPbOsgnmhvqESOkGTS0F5OYcuYK1Q6/psqgcS0iUsGGLr7Nv4gXQPP47 qPeQ== X-Gm-Message-State: APzg51Dd4hhIqf9vsMPz5BjCRUss0eWfUx5hKx1F1m0HIlcC6v1do8by DzGFCWEFm8CeQs8zUOrEiJ4ZKg== X-Received: by 2002:a63:d74f:: with SMTP id w15-v6mr38338400pgi.306.1537471161180; Thu, 20 Sep 2018 12:19:21 -0700 (PDT) Received: from localhost.localdomain ([209.121.128.187]) by smtp.gmail.com with ESMTPSA id k13-v6sm4424443pgf.37.2018.09.20.12.19.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 12:19:20 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 39/44] coresight: catu: Claim device before use Date: Thu, 20 Sep 2018 13:18:14 -0600 Message-Id: <1537471099-19781-40-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> References: <1537471099-19781-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose Use the CLAIM protocol to grab the ownership of the component when in use. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-catu.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-catu.c b/drivers/hwtracing/coresight/coresight-catu.c index ff94e58845b7..170fbb66bda2 100644 --- a/drivers/hwtracing/coresight/coresight-catu.c +++ b/drivers/hwtracing/coresight/coresight-catu.c @@ -406,6 +406,7 @@ static inline int catu_wait_for_ready(struct catu_drvdata *drvdata) static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) { + int rc; u32 control, mode; struct etr_buf *etr_buf = data; @@ -418,6 +419,10 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, void *data) return -EBUSY; } + rc = coresight_claim_device_unlocked(drvdata->base); + if (rc) + return rc; + control |= BIT(CATU_CONTROL_ENABLE); if (etr_buf && etr_buf->mode == ETR_MODE_CATU) { @@ -459,6 +464,7 @@ static int catu_disable_hw(struct catu_drvdata *drvdata) int rc = 0; catu_write_control(drvdata, 0); + coresight_disclaim_device_unlocked(drvdata->base); if (catu_wait_for_ready(drvdata)) { dev_info(drvdata->dev, "Timeout while waiting for READY\n"); rc = -EAGAIN;