Re: [PATCH 1/3] Fix GPE registers read/write handling.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux