public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] Fix GPE registers read/write handling.
Date: Wed, 4 Feb 2009 14:39:57 +0200	[thread overview]
Message-ID: <20090204123957.GF30234@redhat.com> (raw)
In-Reply-To: <49898A13.8030706@redhat.com>

On Wed, Feb 04, 2009 at 02:29:07PM +0200, Avi Kivity wrote:
> 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?
>
>From functional programing POV no, it is not cleaner. But I don't really
care where to do assignment.

--
			Gleb.

  reply	other threads:[~2009-02-04 12:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-04  9:58 [PATCH 1/3] Fix GPE registers read/write handling Gleb Natapov
2009-02-04  9:58 ` [PATCH 2/3] Fix CPU hotplug Gleb Natapov
2009-02-04 12:45   ` Avi Kivity
2009-02-04 13:03     ` Gleb Natapov
2009-02-04 13:24       ` Avi Kivity
2009-02-04 13:31         ` Gleb Natapov
2009-02-04 13:35           ` Avi Kivity
2009-02-04 13:36             ` Gleb Natapov
2009-02-04  9:58 ` [PATCH 3/3] PCI hotplug fixes Gleb Natapov
2009-02-04 12:29 ` [PATCH 1/3] Fix GPE registers read/write handling Avi Kivity
2009-02-04 12:39   ` Gleb Natapov [this message]
2009-02-04 12:46     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090204123957.GF30234@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox