From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Enberg Subject: Re: [PATCH v2 1/8] kvm tools: Add optional parameter used in ioport callbacks Date: Thu, 26 May 2011 11:53:29 +0300 Message-ID: <1306400009.16757.118.camel@jaguar> References: <1306392135-16993-1-git-send-email-levinsasha928@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" 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: Sasha Levin Return-path: Received: from filtteri2.pp.htv.fi ([213.243.153.185]:40415 "EHLO filtteri2.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752372Ab1EZIxc (ORCPT ); Thu, 26 May 2011 04:53:32 -0400 In-Reply-To: <1306392135-16993-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: 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?