From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755253AbcBEQnP (ORCPT ); Fri, 5 Feb 2016 11:43:15 -0500 Received: from mga14.intel.com ([192.55.52.115]:13348 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbcBEQnM (ORCPT ); Fri, 5 Feb 2016 11:43:12 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,401,1449561600"; d="scan'208";a="906332637" From: Alexander Shishkin To: Greg KH Cc: Mathieu Poirier , Chunyan Zhang , laurent.fert@intel.com, yann.fouassier@intel.com, linux-kernel@vger.kernel.org, Alexander Shishkin Subject: [QUEUED v0 16/19] stm class: Support devices with multiple instances Date: Fri, 5 Feb 2016 18:35:25 +0200 Message-Id: <1454690128-21994-17-git-send-email-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.7.0.rc3 In-Reply-To: <1454690128-21994-1-git-send-email-alexander.shishkin@linux.intel.com> References: <1454690128-21994-1-git-send-email-alexander.shishkin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 94d3abfb73..1db189657b 100644 --- a/drivers/hwtracing/stm/policy.c +++ b/drivers/hwtracing/stm/policy.c @@ -332,10 +332,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); -- 2.7.0