From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cornelia Huck Subject: Re: [PATCH 4/5] KVM: s390: Add a channel I/O based virtio transport driver. Date: Tue, 30 Oct 2012 14:03:04 +0100 Message-ID: <20121030140304.3bcd3863@BR9GNB5Z> References: <1351516046-30037-1-git-send-email-cornelia.huck@de.ibm.com> <1351516046-30037-5-git-send-email-cornelia.huck@de.ibm.com> <20121029193447.05dad97b@BR9GNB5Z> <8466E164-8A30-431B-9103-D45F97331489@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , KVM , linux-s390 , Christian Borntraeger , Carsten Otte , Heiko Carstens , Martin Schwidefsky , Sebastian Ott To: Alexander Graf Return-path: Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:46285 "EHLO e06smtp12.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933452Ab2J3NDO (ORCPT ); Tue, 30 Oct 2012 09:03:14 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Oct 2012 13:03:10 -0000 In-Reply-To: <8466E164-8A30-431B-9103-D45F97331489@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 29 Oct 2012 19:37:10 +0100 Alexander Graf wrote: > > On 29.10.2012, at 19:34, Cornelia Huck wrote: > > > On Mon, 29 Oct 2012 19:12:54 +0100 > > Alexander Graf wrote: > > > >> > >> On 29.10.2012, at 14:07, Cornelia Huck wrote: > > > >>> +static void virtio_ccw_kvm_notify(struct virtqueue *vq) > >>> +{ > >>> + struct virtio_ccw_vq_info *info = vq->priv; > >>> + struct virtio_ccw_device *vcdev; > >>> + struct subchannel_id schid; > >>> + __u32 reg2; > >>> + > >>> + vcdev = to_vc_device(info->vq->vdev); > >>> + ccw_device_get_schid(vcdev->cdev, &schid); > >>> + reg2 = *(__u32 *)&schid; > >> > >> That cast looks quite ugly. Can't you just access the field in there you need? Or if it's multiple fields do a union over them? Or assemble them by hand in C? > > > > I think the cast looks less ugly than using a union to morph it around. > > I want the schid with all fields filled out anyway, since this is what > > identifies the subchannel. > > How about a helper function that returns a u32 for a struct subchannel_id in arch/s390/include/asm/schid.h then? This would just move the cast around, no? I don't think that would improve readability.