From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752823AbbCXKsM (ORCPT ); Tue, 24 Mar 2015 06:48:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51875 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254AbbCXKsG (ORCPT ); Tue, 24 Mar 2015 06:48:06 -0400 Date: Tue, 24 Mar 2015 11:48:02 +0100 From: "Michael S. Tsirkin" To: Gerd Hoffmann Cc: virtio-dev@lists.oasis-open.org, virtualization@lists.linux-foundation.org, David Herrmann , Dmitry Torokhov , Rusty Russell , open list , "open list:ABI/API" Subject: Re: [PATCH v3] Add virtio-input driver. Message-ID: <20150324114254-mutt-send-email-mst@redhat.com> References: <1427182321-19451-1-git-send-email-kraxel@redhat.com> <1427192810.18768.4.camel@nilsson.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1427192810.18768.4.camel@nilsson.home.kraxel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2015 at 11:26:50AM +0100, Gerd Hoffmann wrote: > Hi, > > > +static void virtinput_cfg_abs(struct virtio_input *vi, int abs) > > +{ > > + u32 mi, ma, re, fu, fl; > > + > > + virtinput_cfg_select(vi, VIRTIO_INPUT_CFG_ABS_INFO, abs); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.min, &mi); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.max, &ma); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.res, &re); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.fuzz, &fu); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.flat, &fl); > > + input_set_abs_params(vi->idev, abs, mi, ma, fu, fl); > > + input_abs_set_res(vi->idev, abs, re); > > +} > > > +struct virtio_input_absinfo { > > + __virtio32 min; > > + __virtio32 max; > > + __virtio32 fuzz; > > + __virtio32 flat; > > + __virtio32 res; > > +}; > > Damn, had sparse disabled for the test builds. [ Too bad there are way > too many warnings on a full kernel build so having sparse enabled all > the time doesn't fly. ] > > So this doesn't work either. > > Hmm, back to using "u32" in the virtio config structs? > > cheers, > Gerd > You are right, I was confused. Currently everyone uses simple __u32 and friends in config structs, under the understanding that they are always accessed using virtio_cread and friends. Maybe I'll look into adding more type safety, but the issue is not virtio-input specific so, let's not defer virtio input because of this. Sorry about wasting your time on this. -- MST From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH v3] Add virtio-input driver. Date: Tue, 24 Mar 2015 11:48:02 +0100 Message-ID: <20150324114254-mutt-send-email-mst@redhat.com> References: <1427182321-19451-1-git-send-email-kraxel@redhat.com> <1427192810.18768.4.camel@nilsson.home.kraxel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1427192810.18768.4.camel@nilsson.home.kraxel.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Gerd Hoffmann Cc: virtio-dev@lists.oasis-open.org, Dmitry Torokhov , "open list:ABI/API" , open list , virtualization@lists.linux-foundation.org, David Herrmann List-Id: linux-api@vger.kernel.org On Tue, Mar 24, 2015 at 11:26:50AM +0100, Gerd Hoffmann wrote: > Hi, > > > +static void virtinput_cfg_abs(struct virtio_input *vi, int abs) > > +{ > > + u32 mi, ma, re, fu, fl; > > + > > + virtinput_cfg_select(vi, VIRTIO_INPUT_CFG_ABS_INFO, abs); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.min, &mi); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.max, &ma); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.res, &re); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.fuzz, &fu); > > + virtio_cread(vi->vdev, struct virtio_input_config, u.abs.flat, &fl); > > + input_set_abs_params(vi->idev, abs, mi, ma, fu, fl); > > + input_abs_set_res(vi->idev, abs, re); > > +} > > > +struct virtio_input_absinfo { > > + __virtio32 min; > > + __virtio32 max; > > + __virtio32 fuzz; > > + __virtio32 flat; > > + __virtio32 res; > > +}; > > Damn, had sparse disabled for the test builds. [ Too bad there are way > too many warnings on a full kernel build so having sparse enabled all > the time doesn't fly. ] > > So this doesn't work either. > > Hmm, back to using "u32" in the virtio config structs? > > cheers, > Gerd > You are right, I was confused. Currently everyone uses simple __u32 and friends in config structs, under the understanding that they are always accessed using virtio_cread and friends. Maybe I'll look into adding more type safety, but the issue is not virtio-input specific so, let's not defer virtio input because of this. Sorry about wasting your time on this. -- MST