From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH v2 1/8] kvm tools: Add optional parameter used in ioport callbacks Date: Thu, 26 May 2011 12:02:48 +0300 Message-ID: <1306400568.3065.8.camel@lappy> References: <1306392135-16993-1-git-send-email-levinsasha928@gmail.com> <1306400009.16757.118.camel@jaguar> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: john@jfloren.net, kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com To: Pekka Enberg Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:63776 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752752Ab1EZJDH (ORCPT ); Thu, 26 May 2011 05:03:07 -0400 Received: by wwa36 with SMTP id 36so520854wwa.1 for ; Thu, 26 May 2011 02:03:05 -0700 (PDT) In-Reply-To: <1306400009.16757.118.camel@jaguar> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2011-05-26 at 11:53 +0300, Pekka Enberg wrote: > On Thu, 2011-05-26 at 09:42 +0300, Sasha Levin wrote: > > Allow specifying an optional parameter when registering an > > ioport range. The callback functions provided by the registering > > module will be called with the same parameter. > > > > This may be used to keep context during callbacks on IO operations. > > > > Signed-off-by: Sasha Levin > > --- > > tools/kvm/include/kvm/ioport.h | 3 ++ > > tools/kvm/ioport.c | 54 +++++++++++++++++++++++++++++---------- > > 2 files changed, 43 insertions(+), 14 deletions(-) > > > > diff --git a/tools/kvm/include/kvm/ioport.h b/tools/kvm/include/kvm/ioport.h > > index 8253938..2a8d74d 100644 > > --- a/tools/kvm/include/kvm/ioport.h > > +++ b/tools/kvm/include/kvm/ioport.h > > @@ -25,11 +25,14 @@ struct kvm; > > struct ioport_operations { > > bool (*io_in)(struct kvm *kvm, u16 port, void *data, int size, u32 count); > > bool (*io_out)(struct kvm *kvm, u16 port, void *data, int size, u32 count); > > + bool (*io_in_param)(struct kvm *kvm, u16 port, void *data, int size, u32 count, void *param); > > + bool (*io_out_param)(struct kvm *kvm, u16 port, void *data, int size, u32 count, void *param); > > So why not make that 'param' unconditional for io_in and io_out and just > pass NULL if it's not needed? > I've wanted to keep the original interface clean, Most of the IO port users don't (and probably won't) require a parameter. -- Sasha.