[tip:tools/kvm] kvm tools: kbd initialization check

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

 



Commit-ID:  44d6df631ef23a264d59756fc43b929a3828c412
Gitweb:     http://git.kernel.org/tip/44d6df631ef23a264d59756fc43b929a3828c412
Author:     Sasha Levin <levinsasha928@xxxxxxxxx>
AuthorDate: Wed, 5 Sep 2012 10:31:57 +0200
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Wed, 5 Sep 2012 16:22:38 +0300

kvm tools: kbd initialization check

Check if i8042 is supported only within the initialization call itself, so that
builtin-run won't need to know which archs are supported by it.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/builtin-run.c       |    8 +++++---
 tools/kvm/hw/i8042.c          |    8 +++++++-
 tools/kvm/include/kvm/i8042.h |    2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index 3d89b75..56639e2 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -818,9 +818,11 @@ static int kvm_cmd_run_init(int argc, const char **argv)
 
 	kvm__init_ram(kvm);
 
-#ifdef CONFIG_X86
-	kbd__init(kvm);
-#endif
+	r = kbd__init(kvm);
+	if (r < 0) {
+		pr_err("kbd__init() failed with error %d\n", r);
+		goto fail;
+	}
 
 	r = pci_shmem__init(kvm);
 	if (r < 0) {
diff --git a/tools/kvm/hw/i8042.c b/tools/kvm/hw/i8042.c
index 40f8a38..fac54ca 100644
--- a/tools/kvm/hw/i8042.c
+++ b/tools/kvm/hw/i8042.c
@@ -339,10 +339,16 @@ static struct ioport_operations kbd_ops = {
 	.io_out		= kbd_out,
 };
 
-void kbd__init(struct kvm *kvm)
+int kbd__init(struct kvm *kvm)
 {
+#ifndef CONFIG_X86
+	return 0;
+#endif
+
 	kbd_reset();
 	state.kvm = kvm;
 	ioport__register(I8042_DATA_REG, &kbd_ops, 2, NULL);
 	ioport__register(I8042_COMMAND_REG, &kbd_ops, 2, NULL);
+
+	return 0;
 }
diff --git a/tools/kvm/include/kvm/i8042.h b/tools/kvm/include/kvm/i8042.h
index 13f18e2..3b4ab68 100644
--- a/tools/kvm/include/kvm/i8042.h
+++ b/tools/kvm/include/kvm/i8042.h
@@ -7,6 +7,6 @@ struct kvm;
 
 void mouse_queue(u8 c);
 void kbd_queue(u8 c);
-void kbd__init(struct kvm *kvm);
+int kbd__init(struct kvm *kvm);
 
 #endif
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux