From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751757AbaJSUay (ORCPT ); Sun, 19 Oct 2014 16:30:54 -0400 Received: from mout.gmx.net ([212.227.17.21]:50853 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbaJSUaw (ORCPT ); Sun, 19 Oct 2014 16:30:52 -0400 Message-ID: <54441F71.800@gmx.de> Date: Sun, 19 Oct 2014 22:30:41 +0200 From: Hartmut Knaack User-Agent: Mozilla/5.0 (X11; Linux i686; rv:32.0) Gecko/20100101 Firefox/32.0 SeaMonkey/2.29 MIME-Version: 1.0 To: Daniel Baluta , jic23@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org CC: irina.tirdea@intel.com Subject: Re: [RFC PATCH 1/8] iio: dummy: Introduce virtual registers for dummy device References: <1412257439-15683-1-git-send-email-daniel.baluta@intel.com> <1412257439-15683-2-git-send-email-daniel.baluta@intel.com> In-Reply-To: <1412257439-15683-2-git-send-email-daniel.baluta@intel.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:k7ODUpa86usdpP+CjLBHbtW9wqItWqdhImWi9oSBAotOYH15GvY qp4BJC6z7ee0nOfX/j82X7HMnwbQC0S2HW1Eu+Q6xiCV7OWs1QXmZMyaLIXxRQqEWIFhFMQ b4/aGxIZBgi7fr75CjNVuViG0+hZ63AUKA8gIRFoBwCRH2xqCWq0B4kx6mug1hmCmgcmHyv i7Vchc079MGA654aGljEw== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Daniel Baluta schrieb am 02.10.2014 15:43: > We need a way to store events generated by iio_dummy_evgen module, > in order to correctly process IRQs in iio_simple_dummy_events. > > For the moment, we add two registers: > > * id_reg - ID register, stores the source of the event > * id_data - DATA register, stores the type of the event > > e.g echo 4 > /sys/bus/iio/devices/iio_evgen/poke2 > > id_reg 0x02, id_data 0x04 > > This means, event of type 4 was generated by fake device 2. > > We currently use a hardcoded mapping of virtual events to IIO events. > > Signed-off-by: Daniel Baluta > Signed-off-by: Irina Tirdea > --- > drivers/staging/iio/iio_dummy_evgen.c | 16 ++++++++++++++++ > drivers/staging/iio/iio_dummy_evgen.h | 7 +++++++ > drivers/staging/iio/iio_simple_dummy.h | 2 ++ > drivers/staging/iio/iio_simple_dummy_events.c | 23 ++++++++++++++++++----- > 4 files changed, 43 insertions(+), 5 deletions(-) > <...> > @@ -153,6 +161,14 @@ static ssize_t iio_evgen_poke(struct device *dev, > size_t len) > { > struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); > + unsigned long event, ret; int ret > + > + ret = kstrtoul(buf, 10, &event); > + if (ret) > + return ret; > + > + iio_evgen->regs[this_attr->address].reg_id = this_attr->address; > + iio_evgen->regs[this_attr->address].reg_data = event; > > if (iio_evgen->enabled[this_attr->address]) > handle_nested_irq(iio_evgen->base + this_attr->address); <...>