From patchwork Sat Feb 6 11:04:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 61374 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp455795lbl; Sat, 6 Feb 2016 03:06:18 -0800 (PST) X-Received: by 10.66.216.7 with SMTP id om7mr26741595pac.90.1454756778728; Sat, 06 Feb 2016 03:06:18 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xu3si30734939pab.94.2016.02.06.03.06.18; Sat, 06 Feb 2016 03:06:18 -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 S1752278AbcBFLGQ (ORCPT + 30 others); Sat, 6 Feb 2016 06:06:16 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35548 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbcBFLGL (ORCPT ); Sat, 6 Feb 2016 06:06:11 -0500 Received: by mail-pa0-f43.google.com with SMTP id ho8so47914173pac.2 for ; Sat, 06 Feb 2016 03:06:10 -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=cqX/PTDKJm/TyFFh2OD7Svs8grJV9VB/a2Opd1wuAdg=; b=JVYj4MQYDqC6WckMyLBA+Lf97C5JBBzhoy7C+ieoLsFWi7WFLze/Lp5t+fBXgtTKnX /0nXjynQ3I2rN7A6nwNT1cJxgAR846gl2beRIcqTxVtwfp6a/CL7hnI9i4NF86EChKwE vnwJ1wGCGSnHExGlVuxoFm5Ej3FfSPFREuONU= 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=cqX/PTDKJm/TyFFh2OD7Svs8grJV9VB/a2Opd1wuAdg=; b=boIivF1+jb1XTX17VCpRw6DtAZ2+8VebYs+T2l4L48LbpgZioi/PLdUbtCzk1FSnhA r4yMqtz9wdMeDbc94UtOAggLBcG+JDOi7ziwOXIUzQmLtl636i32MjSbOMCE94piKtVz Vz1F1cGv/fBi5KSaPB2sLlbolqV5AUQh1muygb3Wo22iesZx+6a09zM4SgCsmY3BkzZm /Pn133s0XIsA05u/uRhMI4WIM/1zXALG+WUqxR+2w8gsX01Dr9ihdvZ2pMXpE0Rfx4f6 mQcXODK5Tx1R2MPARr7ij13jX6R3tjZ1cJPQbARPMosUoEiqeM4WawBrJALeE3sjmnNK ZtyQ== X-Gm-Message-State: AG10YOTI+kkUaNmSqtgzMPJ9Qsgb57BDaflFNKMcQC4+8Owacg0UxMjaxfUo+hKazAQmYUV1 X-Received: by 10.66.101.74 with SMTP id fe10mr26969080pab.66.1454756770774; Sat, 06 Feb 2016 03:06:10 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Feb 2016 03:06:09 -0800 (PST) From: Chunyan Zhang To: mathieu.poirier@linaro.org, alexander.shishkin@linux.intel.com Cc: mike.leach@arm.com, Michael.Williams@arm.com, al.grant@arm.com, tor@ti.com, nicolas.guion@st.com, broonie@kernel.org, robh@kernel.org, pratikp@codeaurora.org, 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.org, linux-doc@vger.kernel.org Subject: [PATCH V3 1/6] stm class: Add ioctl get_options interface Date: Sat, 6 Feb 2016 19:04:27 +0800 Message-Id: <1454756672-12790-2-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> 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 | 12 ++++++++++++ include/linux/stm.h | 3 +++ include/uapi/linux/stm.h | 1 + 3 files changed, 16 insertions(+) -- 1.9.1 diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index b6445d9..854a16d 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -571,6 +571,18 @@ 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); + + if (copy_to_user((void __user *)arg, &options, sizeof(u64))) + return -EFAULT; + 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 */