From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v6 07/17] add minimal virtio support for devtree virtio-mmio Date: Fri, 11 Jul 2014 10:32:51 +0200 Message-ID: <53BFA133.7080608@redhat.com> References: <1405066787-5793-1-git-send-email-drjones@redhat.com> <1405066787-5793-8-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: christoffer.dall@linaro.org To: Andrew Jones , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52396 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbaGKIc6 (ORCPT ); Fri, 11 Jul 2014 04:32:58 -0400 In-Reply-To: <1405066787-5793-8-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 11/07/2014 10:19, Andrew Jones ha scritto: > +enum virtio_hwdesc_type { > + VIRTIO_HWDESC_TYPE_DT = 0, /* device tree */ > + NR_VIRTIO_HWDESC_TYPES, > +}; > + > +enum virtio_bus_type { > + VIRTIO_BUS_TYPE_MMIO = 0, /* virtio-mmio */ > + NR_VIRTIO_BUS_TYPES, > +}; > + > +struct virtio_bind_bus { > + bool (*hwdesc_probe)(void); > + struct virtio_device *(*device_bind)(u32 devid); > +}; > + > +static struct virtio_device *vm_dt_device_bind(u32 devid); > + > +static struct virtio_bind_bus > +virtio_bind_busses[NR_VIRTIO_HWDESC_TYPES][NR_VIRTIO_BUS_TYPES] = { > + > +[VIRTIO_HWDESC_TYPE_DT] = { > + > + [VIRTIO_BUS_TYPE_MMIO] = { > + .hwdesc_probe = dt_available, > + .device_bind = vm_dt_device_bind, > + }, > +}, > +}; > + If you put this in lib/virtio.c, it is overengineered. It would make sense if something else provided virtio_bind_busses[][]. I suggest that you drop it and split this file in four: lib/virtio.c lib/virtio-mmio.c lib/virtio-mmio-dt.c lib/arm/virtio.c where virtio_bind is in lib/arm/virtio.c. Paolo