From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/3] Fix GPE registers read/write handling. Date: Wed, 04 Feb 2009 14:29:07 +0200 Message-ID: <49898A13.8030706@redhat.com> References: <20090204095805.6892.47195.stgit@dhcp-1-237.tlv.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:41763 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752421AbZBDM3J (ORCPT ); Wed, 4 Feb 2009 07:29:09 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n14CT9Gj028198 for ; Wed, 4 Feb 2009 07:29:09 -0500 In-Reply-To: <20090204095805.6892.47195.stgit@dhcp-1-237.tlv.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Gleb Natapov wrote: > For STS register bit are cleared by writing 1 into it. > > > +static uint16_t gpe_write_val(uint16_t cur, int addr, uint32_t val) > +{ > + if (addr & 1) > + return (cur & 0xff) | (val << 8); > + return (cur & 0xff00) | (val & 0xff); > +} > + > +static uint16_t gpe_reset_val(uint16_t cur, int addr, uint32_t val) > +{ > + uint16_t x1, x0 = val & 0xff; > + int shift = (addr & 1) ? 8 : 0; > + > + x1 = (cur >> shift) & 0xff; > + > + x1 = x1 & ~x0; > + > + return (cur & (0xff << (8 - shift))) | (x1 << shift); > +} > It's strange that write_val() and reset_val() return a value. Won't it be cleaner to make val a pointer? -- error compiling committee.c: too many arguments to function