提交 84a5c79e 编写于 作者: D David Hildenbrand 提交者: Radim Krčmář

KVM: x86: set data directly in picdev_read()

Now it looks almost as picdev_write().
Signed-off-by: NDavid Hildenbrand <david@redhat.com>
Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
上级 9fecaa9e
...@@ -484,7 +484,7 @@ static int picdev_write(struct kvm_pic *s, ...@@ -484,7 +484,7 @@ static int picdev_write(struct kvm_pic *s,
static int picdev_read(struct kvm_pic *s, static int picdev_read(struct kvm_pic *s,
gpa_t addr, int len, void *val) gpa_t addr, int len, void *val)
{ {
unsigned char data = 0; unsigned char *data = (unsigned char *)val;
if (len != 1) { if (len != 1) {
memset(val, 0, len); memset(val, 0, len);
...@@ -497,19 +497,18 @@ static int picdev_read(struct kvm_pic *s, ...@@ -497,19 +497,18 @@ static int picdev_read(struct kvm_pic *s,
case 0xa0: case 0xa0:
case 0xa1: case 0xa1:
pic_lock(s); pic_lock(s);
data = pic_ioport_read(&s->pics[addr >> 7], addr); *data = pic_ioport_read(&s->pics[addr >> 7], addr);
pic_unlock(s); pic_unlock(s);
break; break;
case 0x4d0: case 0x4d0:
case 0x4d1: case 0x4d1:
pic_lock(s); pic_lock(s);
data = elcr_ioport_read(&s->pics[addr & 1], addr); *data = elcr_ioport_read(&s->pics[addr & 1], addr);
pic_unlock(s); pic_unlock(s);
break; break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
*(unsigned char *)val = data;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册