From patchwork Sat Feb 6 11:04:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 8242381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BA4EC9F38B for ; Sat, 6 Feb 2016 11:08:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4A1120266 for ; Sat, 6 Feb 2016 11:08:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4DC020204 for ; Sat, 6 Feb 2016 11:08:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aS0hS-0007Zb-8K; Sat, 06 Feb 2016 11:06:46 +0000 Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aS0hJ-0007Pg-Ia for linux-arm-kernel@lists.infradead.org; Sat, 06 Feb 2016 11:06:39 +0000 Received: by mail-pf0-x234.google.com with SMTP id o185so83027237pfb.1 for ; Sat, 06 Feb 2016 03:06:16 -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=BTxrfyCJdnIu5wk3bdVuxMQzdEJoDoRnn5MIyoflFrI=; b=OQ1CnNnRsYyFCn1xZ/b+9HVHrZ67XFm/FjxTpFGTyx3JzOXWziUbG+X+sr0YJbAHiz jHQi2n3sIr/uT2x70WKGN1m56ueGFh8vOWxyl8BjYyy1X8BDun0wPOtUt/AdueRf3CS4 b+HYKRK92TfqGaMaDnh+oAxqa2/amavLgeKAo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BTxrfyCJdnIu5wk3bdVuxMQzdEJoDoRnn5MIyoflFrI=; b=S2oTNWEsKd3hx0tI4JSKpJ2muwSSgyrMSOT5qnv+I15++s74Zb8It8spqOTtVzn40c SJjeZGusnL0/dXafpv7Cnvrn66EhOGkNBzp1P2l5Pik4eYYxWL3ImuluP6tgs+yGMhSY VIWtREfmgTBs3NKBmhqnDY5zRAAB5XPvITPvHG8ytItd+icijoephY0L8XKwOam8qS3U 4N5td6HdvtSu1FjbIbLu2YZhXAhwTSU45j4sEbx2c+YGgvpIM629q6g+dB70WR98Mh1b PjfXov6lMx+iln3ofYuBpT4eyVav2oEdjEZzew0jr4xG6BsQEyrFgDf/jAfBIEnH3M7W BASg== X-Gm-Message-State: AG10YOQ96mBvKwxJfunLQS27U/Z0ueUlw2n73n24RGIw12kxvwbxASSoA1fgD1W8ukVVyQAV X-Received: by 10.98.80.91 with SMTP id e88mr26735952pfb.62.1454756776647; Sat, 06 Feb 2016 03:06:16 -0800 (PST) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id p21sm30500690pfj.67.2016.02.06.03.06.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Feb 2016 03:06:15 -0800 (PST) From: Chunyan Zhang To: mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com Subject: [PATCH V3 2/6] stm class: Support devices with multiple instances Date: Sat, 6 Feb 2016 19:04:28 +0800 Message-Id: <1454756672-12790-3-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454756672-12790-1-git-send-email-zhang.chunyan@linaro.org> References: <1454756672-12790-1-git-send-email-zhang.chunyan@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160206_030637_872146_4CFFA599 X-CRM114-Status: GOOD ( 11.14 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, al.grant@arm.com, Michael.Williams@arm.com, corbet@lwn.net, zhang.lyra@gmail.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, tor@ti.com, broonie@kernel.org, mike.leach@arm.com, linux-api@vger.kernel.org, pratikp@codeaurora.org, nicolas.guion@st.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alexander Shishkin By convention, the name of the stm policy directory in configfs consists of the device name to which it applies and the actual policy name, separated by a dot. Now, some devices already have dots in their names that separate name of the actual device from its instance identifier. Such devices will result in two (or more, who can tell) dots in the policy directory name. Existing policy code, however, will treat the first dot as the one that separates device name from policy name, therefore failing the above case. This patch makes the last dot in the directory name be the separator, thus prohibiting dots from being used in policy names. Suggested-by: Chunyan Zhang Signed-off-by: Alexander Shishkin --- drivers/hwtracing/stm/policy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/stm/policy.c b/drivers/hwtracing/stm/policy.c index 11ab6d0..17a1416 100644 --- a/drivers/hwtracing/stm/policy.c +++ b/drivers/hwtracing/stm/policy.c @@ -320,10 +320,11 @@ stp_policies_make(struct config_group *group, const char *name) /* * node must look like ., where - * is the name of an existing stm device and - * is an arbitrary string + * is the name of an existing stm device; may + * contain dots; + * is an arbitrary string; may not contain dots */ - p = strchr(devname, '.'); + p = strrchr(devname, '.'); if (!p) { kfree(devname); return ERR_PTR(-EINVAL);