From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752975AbcBEMzj (ORCPT ); Fri, 5 Feb 2016 07:55:39 -0500 Received: from mga01.intel.com ([192.55.52.88]:12232 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751751AbcBEMzg (ORCPT ); Fri, 5 Feb 2016 07:55:36 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,400,1449561600"; d="scan'208";a="877734796" From: Alexander Shishkin To: Chunyan Zhang , mathieu.poirier@linaro.org Cc: robh@kernel.org, broonie@kernel.org, pratikp@codeaurora.org, nicolas.guion@st.com, corbet@lwn.net, mark.rutland@arm.com, mike.leach@arm.com, tor@ti.com, al.grant@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: Re: [PATCH V2 1/6] stm class: Add ioctl get_options interface In-Reply-To: <1454487337-30184-2-git-send-email-zhang.chunyan@linaro.org> References: <1454487337-30184-1-git-send-email-zhang.chunyan@linaro.org> <1454487337-30184-2-git-send-email-zhang.chunyan@linaro.org> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 05 Feb 2016 14:55:31 +0200 Message-ID: <87k2mj5nb0.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Chunyan Zhang writes: > 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(+) > > 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)); The return value of copy_to_user() is not what you assume it is. Regards, -- Alex