From patchwork Thu Sep 20 19:18:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 147152 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2376746ljw; Thu, 20 Sep 2018 12:19:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY425Vi0Dg9MkLOxNw0qM7M9AxXuU5d02jD4EmJSAYeJP+6SCtStwOBaI+/tuW0d/WK5mjA X-Received: by 2002:a63:d09:: with SMTP id c9-v6mr38655505pgl.314.1537471158489; Thu, 20 Sep 2018 12:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537471158; cv=none; d=google.com; s=arc-20160816; b=wE8cHe2dC5ck7x8n+a0VyniKFd6D86g7VY/S1uOE5Y22rWCEDHN1UffiFddQqrap9C st7uRidP8ffFu/1BIZaeB/9WbTL6zaehJJimTx/M6UHXOlTpaS55mokwb1x15osbTM5p IvnniwAXM6MzQOET6azZ/yqGI6a2Q2QO0DFbV5cb6CnXA8/v3huEK9W7kCW06Ce0QA+l 4y0fShylWMb6kAj3/3REWq9VaIifhqSBGOWg0J8aZ/zWUPUEAy4vVUQr+6kM211aqbk+ N45fb4G0o54obo6amUQtHMcWMyiszA59Quy9FpJcrpUzfMg4/59Kvw3HOaWzstXh/XWI fUDg== 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=uTB54otE2bw7+61Z1ydJwtI+Yieov8luc9OYgjIrcXA=; b=vJxSKtflwsL8Y+p1wQz/Gi6RGpepqmWcKJ97hFqaz+ffFFyGl+XdFUfMXfSCSjT/M3 hT+dww00mqjVPDj1e065k75XtBXYFntmonTs9ZMK0zhgKHnpId0+hTwrh7piWtjWVLis CZhsTjACZC6IKNBCgLIikp6CKWlC3YrRHxd/80a/YFxA8JWxZ57JoVe30lFq8kYuv2p3 RbFrP+LzTl1ePpCLiPnRcO2X+8JAm9khBzW9RIgWplQEG2K5ejb6aDa11hRWF3e1aKHJ n0bCJfK7r7bbByt+OA1tG0dVDzZd0v59RvEU7A91r7eQKWxbdCbH5yohCi+GPXZDcoqF iCKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WUQ0uZFc; 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 w20-v6si42369plp.260.2018.09.20.12.19.18; Thu, 20 Sep 2018 12:19:18 -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=WUQ0uZFc; 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 S2389051AbeIUBEN (ORCPT + 32 others); Thu, 20 Sep 2018 21:04:13 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41900 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388558AbeIUBEN (ORCPT ); Thu, 20 Sep 2018 21:04:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id h79-v6so4819552pfk.8 for ; Thu, 20 Sep 2018 12:19:14 -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=uTB54otE2bw7+61Z1ydJwtI+Yieov8luc9OYgjIrcXA=; b=WUQ0uZFcXUG+ptQG1hM1mvLSSw8ztr5gWHMqB8hcRD8P2UN2i8ljbHdifLPfUBChp5 OYMIAUQ6nHbBOe6fQErxDw2qMnTrmBpQe8ac91f0gLSP8yzo1fqMR/PWVExT5AiUATc5 MMLM7rOh/njpIcjzGQ9rzlLD6lv6X7BVnGe70= 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=uTB54otE2bw7+61Z1ydJwtI+Yieov8luc9OYgjIrcXA=; b=DtJ7zguf0Mgv5tiriMTriqOzhkK7FGxJEM6oIv74ueI6zADQzQI1rihkXHO82Qs9V1 /uQN1w4ffmQzz8xKGjJlV45lsVcbYVWhgO/Dd1ztk+pZ+pZmxkvfA6u0100hUKBcmKD6 E+Cbxfv8Crn6xcVy+V5wiZu1oIMhzsj+CKpX3Wj5Y8HONOzzRy1OdZiQFMd3KBs8pY1C xXNi6NEmQXxpyI2NfSrljSl1au2VqXWVAVMFmKVPvdwj3UsZCGOH/4ql6LhTdW9nqTmQ oDtlTx4tr0Uu6SOBDnggdVGooP3Qb7Roj/laNSXAlXejcWJzhBks/CYRBY+e7awtMfcr F1/Q== X-Gm-Message-State: APzg51C7XPacmAuKznKspZaX+FC76kECieNfIXnDbWT03+/DbcyJ5xgG 0EbSMH6rQDcuV6awQ7lP1M0BoblyrBU= X-Received: by 2002:a65:58c3:: with SMTP id e3-v6mr3248965pgu.117.1537471153782; Thu, 20 Sep 2018 12:19:13 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Sep 2018 12:19:12 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH 34/44] coresight: etb10: Handle errors enabling the device Date: Thu, 20 Sep 2018 13:18:09 -0600 Message-Id: <1537471099-19781-35-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 Prepare the etb10 driver to return errors in enabling the device. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight-etb10.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c index 08fa660098f8..824be0c5f592 100644 --- a/drivers/hwtracing/coresight/coresight-etb10.c +++ b/drivers/hwtracing/coresight/coresight-etb10.c @@ -106,7 +106,7 @@ static unsigned int etb_get_buffer_depth(struct etb_drvdata *drvdata) return depth; } -static void etb_enable_hw(struct etb_drvdata *drvdata) +static void __etb_enable_hw(struct etb_drvdata *drvdata) { int i; u32 depth; @@ -134,6 +134,12 @@ static void etb_enable_hw(struct etb_drvdata *drvdata) CS_LOCK(drvdata->base); } +static int etb_enable_hw(struct etb_drvdata *drvdata) +{ + __etb_enable_hw(drvdata); + return 0; +} + static int etb_enable_sysfs(struct coresight_device *csdev) { int ret = 0; @@ -152,8 +158,9 @@ static int etb_enable_sysfs(struct coresight_device *csdev) if (drvdata->mode == CS_MODE_SYSFS) goto out; - drvdata->mode = CS_MODE_SYSFS; - etb_enable_hw(drvdata); + ret = etb_enable_hw(drvdata); + if (!ret) + drvdata->mode = CS_MODE_SYSFS; out: spin_unlock_irqrestore(&drvdata->spinlock, flags); @@ -183,8 +190,9 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data) if (ret) goto out; - drvdata->mode = CS_MODE_PERF; - etb_enable_hw(drvdata); + ret = etb_enable_hw(drvdata); + if (!ret) + drvdata->mode = CS_MODE_PERF; out: spin_unlock_irqrestore(&drvdata->spinlock, flags);