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: 8242391 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 CFDF49F38B for ; Sat, 6 Feb 2016 11:08:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0567720204 for ; Sat, 6 Feb 2016 11:08:17 +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 1E629201C8 for ; Sat, 6 Feb 2016 11:08:16 +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 1aS0hH-0007V3-Ng; Sat, 06 Feb 2016 11:06:35 +0000 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aS0hE-0007Nw-CR for linux-arm-kernel@lists.infradead.org; Sat, 06 Feb 2016 11:06:33 +0000 Received: by mail-pa0-x233.google.com with SMTP id uo6so48748624pac.1 for ; Sat, 06 Feb 2016 03:06:11 -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=d7dBSf8Ys7cojSpwvWylgc8kRpxP6/13yujJ3L1afowRph8SbfkBP+nmuOwkyJVJ5M ztZIA0Y4AvPyc7Jj8vd6JRXwlWt6az0Zh8/eVNPTpMwDoG9PxGMbIpb+iyxNjJLO8C/c OWTU+2nK9DcJiQQY10HDZpdN+Sjyw0pP1PqFqa6MJ4CqPg85kI7pSy3yWqwAaNlOFCR5 VYyGnKzvk/GZT0w/vd1+hZpnEMlrsLT0WplT/P28oQg/BNNuqZ5pN7RvdWc7ZHiXZ7wu q8GPLn/6aWQ2BSC7ZeLi1eXKQ0/Jizqjgk+gZw8psAh3W4BHvf1ioLH/r4oLScOVFMOZ Fgng== X-Gm-Message-State: AG10YOSlTvTy7V3jwGgjZNpgnU8vF+TFFCHIAy/q/V/L20/fSLToUJnOVfEKvmfVPKA6Kimw 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160206_030632_466119_458DFDBA X-CRM114-Status: GOOD ( 10.88 ) 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=unavailable 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 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(+) 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 */