Re: [PATCH v2 1/8] kvm tools: Add optional parameter used in ioport callbacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2011-05-26 at 12:04 +0300, Pekka Enberg wrote:
> On Thu, May 26, 2011 at 12:02 PM, Sasha Levin <levinsasha928@xxxxxxxxx> wrote:
> > 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 <levinsasha928@xxxxxxxxx>
> >> > ---
> >> >  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.
> 
> Well now struct ioport_operations isn't very clean is it - or the code
> that needs to determine which function pointer to call?-)

struct ioport_operations is a bit more messy, but it's one spot instead
of adding a 'parameter' to each module that doesn't really need it.

My assumption is that most ioport users now and in the future won't need
it, it just solves several special cases more easily (multiple devices
which share same handling functions).

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux