[tip:tools/kvm] kvm tools: 8250: add address qualifier to uart name in fdt node

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

 



Commit-ID:  b05f81bc6b6b08fbee6b9a8642db32c7b8d4b542
Gitweb:     http://git.kernel.org/tip/b05f81bc6b6b08fbee6b9a8642db32c7b8d4b542
Author:     Marc Zyngier <Marc.Zyngier@xxxxxxx>
AuthorDate: Wed, 1 May 2013 16:50:14 +0100
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Tue, 14 May 2013 14:18:52 +0300

kvm tools: 8250: add address qualifier to uart name in fdt node

Having several uarts with the same name makes the kernel (and dtc)
choke. Add the base address as a qualifier so we get unique names.

Signed-off-by: Marc Zyngier <marc.zyngier@xxxxxxx>
Signed-off-by: Will Deacon <will.deacon@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/hw/serial.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
index 523a767..931067f 100644
--- a/tools/kvm/hw/serial.c
+++ b/tools/kvm/hw/serial.c
@@ -374,17 +374,22 @@ static bool serial8250_in(struct ioport *ioport, struct kvm *kvm, u16 port, void
 }
 
 #ifdef CONFIG_HAS_LIBFDT
+#define DEVICE_NAME_MAX_LEN 32
 static void serial8250_generate_fdt_node(struct ioport *ioport, void *fdt,
 					 void (*generate_irq_prop)(void *fdt,
 								   u8 irq))
 {
+	char dev_name[DEVICE_NAME_MAX_LEN];
 	struct serial8250_device *dev = ioport->priv;
+	u64 addr = KVM_IOPORT_AREA + dev->iobase;
 	u64 reg_prop[] = {
-		cpu_to_fdt64(KVM_IOPORT_AREA + dev->iobase),
+		cpu_to_fdt64(addr),
 		cpu_to_fdt64(8),
 	};
 
-	_FDT(fdt_begin_node(fdt, "U6_16550A"));
+	snprintf(dev_name, DEVICE_NAME_MAX_LEN, "U6_16550A@%llx", addr);
+
+	_FDT(fdt_begin_node(fdt, dev_name));
 	_FDT(fdt_property_string(fdt, "compatible", "ns16550a"));
 	_FDT(fdt_property(fdt, "reg", reg_prop, sizeof(reg_prop)));
 	generate_irq_prop(fdt, dev->irq);
--
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