From patchwork Mon Feb 1 07:58:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 60866 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2868220lbb; Mon, 1 Feb 2016 00:00:07 -0800 (PST) X-Received: by 10.66.65.109 with SMTP id w13mr35684099pas.142.1454313607667; Mon, 01 Feb 2016 00:00:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id us7si22712252pac.204.2016.02.01.00.00.07; Mon, 01 Feb 2016 00:00:07 -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; 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; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751573AbcBAIAE (ORCPT + 30 others); Mon, 1 Feb 2016 03:00:04 -0500 Received: from mail-pf0-f170.google.com ([209.85.192.170]:33657 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951AbcBAH76 (ORCPT ); Mon, 1 Feb 2016 02:59:58 -0500 Received: by mail-pf0-f170.google.com with SMTP id x125so79792406pfb.0 for ; Sun, 31 Jan 2016 23:59:57 -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=TGwcrbipNBubsEfOeperFF1uXR6hDFhAeZnQFjo5Hds=; b=edxUMJSi8KhJrpQMFLch/h3uko/KOpIZL9xsghywnK4tnmKWOOL7lxrElm1JxScUm1 WNS/rIoetAhRAT6eDrpXMq+5rz8I3xy/aujthvZZLpYm4X55JvS0nl5js2rLRRABZVS5 ri0XjkTR2sa1afyw4q7g/VISd/JCfmsph8seQ= 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=TGwcrbipNBubsEfOeperFF1uXR6hDFhAeZnQFjo5Hds=; b=KipUd4DkD306OAbCgDaD15R3/zSecoIEyOgYD01wYNKzPpgI3hEmlLSYagtK/rzCgo /Mz2woafAc1ARzoB96bWmcc5Ngft+S8ajcMgfcjg6EuY9ipc3ZcQ4IoRYt0YLNQSk8JS q649Jwq9zf6e/gUKmajzS2OGsWg8gsHjfoGj837YCrB14IFuEqhknmAMKYkQmv3Adwjv B6yvyluTm4mF+i2UDokt2thsXmyNjIfCMQ0FPQLs5Nv7e67SwUJWeRt0VNC9AUZQ+FHP i1kK5gvfHwgLMnbslToZeeK3fm2tW8XjiLC4xA+/Uz17Uxvdi0Xqrcs2ziu+SCzkGmEf nQ4Q== X-Gm-Message-State: AG10YOSa1QGKKwD08L5Dg/NrQN8u/QLo/2J6HpLt4ZfJcHL6RaWF/DzTocaGA+vfb7xjMe6n X-Received: by 10.98.32.5 with SMTP id g5mr7040595pfg.74.1454313597374; Sun, 31 Jan 2016 23:59:57 -0800 (PST) Received: from zcy-ubuntu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id o4sm40799282pfa.85.2016.01.31.23.59.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 31 Jan 2016 23:59:56 -0800 (PST) From: Chunyan Zhang To: mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com Cc: robh@kernel.org, broonie@kernel.org, pratikp@codeaurora.org, nicolas.guion@st.com, corbet@lwn.net, mark.rutland@arm.com, zhang.lyra@gmail.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-api@vger.kernel.orgi, linux-doc@vger.kernel.org Subject: [PATCH 1/6] stm class: Add ioctl get_options interface Date: Mon, 1 Feb 2016 15:58:44 +0800 Message-Id: <1454313529-8860-2-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454313529-8860-1-git-send-email-zhang.chunyan@linaro.org> References: <1454313529-8860-1-git-send-email-zhang.chunyan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is already an interface of set_options, but no get_options yet. Before setting any options, one would may want to see the current status of that option by means of get_options interface. This interface has been used in CoreSight STM driver. Signed-off-by: Chunyan Zhang --- drivers/hwtracing/stm/core.c | 11 +++++++++++ include/linux/stm.h | 3 +++ include/uapi/linux/stm.h | 1 + 3 files changed, 15 insertions(+) -- 1.9.1 diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index b6445d9..86bb4e3 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -571,6 +571,17 @@ stm_char_ioctl(struct file *file, unsigned int cmd, unsigned long arg) options); break; + + case STP_GET_OPTIONS: + if (stm_data->get_options) + err = stm_data->get_options(stm_data, + stmf->output.master, + stmf->output.channel, + stmf->output.nr_chans, + &options); + + return copy_to_user((void __user *)arg, &options, sizeof(u64)); + default: break; } diff --git a/include/linux/stm.h b/include/linux/stm.h index 9d0083d..f351d62 100644 --- a/include/linux/stm.h +++ b/include/linux/stm.h @@ -88,6 +88,9 @@ struct stm_data { long (*set_options)(struct stm_data *, unsigned int, unsigned int, unsigned int, unsigned long); + long (*get_options)(struct stm_data *, unsigned int, + unsigned int, unsigned int, + u64 *); }; int stm_register_device(struct device *parent, struct stm_data *stm_data, diff --git a/include/uapi/linux/stm.h b/include/uapi/linux/stm.h index 626a8d3..0dab16e 100644 --- a/include/uapi/linux/stm.h +++ b/include/uapi/linux/stm.h @@ -46,5 +46,6 @@ struct stp_policy_id { #define STP_POLICY_ID_SET _IOWR('%', 0, struct stp_policy_id) #define STP_POLICY_ID_GET _IOR('%', 1, struct stp_policy_id) #define STP_SET_OPTIONS _IOW('%', 2, __u64) +#define STP_GET_OPTIONS _IOR('%', 3, __u64) #endif /* _UAPI_LINUX_STM_H */