[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/13] mac_{old|new}world: Set tbfreq at declaration
From: |
BALATON Zoltan |
Subject: |
[PATCH v2 03/13] mac_{old|new}world: Set tbfreq at declaration |
Date: |
Sun, 25 Sep 2022 14:38:10 +0200 (CEST) |
The tbfreq variable is only set once in an if-else which can be done
at the variable declaration saving some lines of code and making it
simpler.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/ppc/mac_newworld.c | 9 +--------
hw/ppc/mac_oldworld.c | 9 +--------
2 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 27e4e8d136..6327694f85 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -130,7 +130,7 @@ static void ppc_core99_init(MachineState *machine)
DeviceState *dev, *pic_dev;
DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
hwaddr nvram_addr = 0xFFF04000;
- uint64_t tbfreq;
+ uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
/* init CPUs */
for (i = 0; i < machine->smp.cpus; i++) {
@@ -343,13 +343,6 @@ static void ppc_core99_init(MachineState *machine)
has_adb = (core99_machine->via_config == CORE99_VIA_CONFIG_CUDA ||
core99_machine->via_config == CORE99_VIA_CONFIG_PMU_ADB);
- /* Timebase Frequency */
- if (kvm_enabled()) {
- tbfreq = kvmppc_get_tbfreq();
- } else {
- tbfreq = TBFREQ;
- }
-
/* init basic PC hardware */
pci_bus = PCI_HOST_BRIDGE(uninorth_pci)->bus;
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 86512d31ad..5cabc410e7 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -99,7 +99,7 @@ static void ppc_heathrow_init(MachineState *machine)
uint16_t ppc_boot_device;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
void *fw_cfg;
- uint64_t tbfreq;
+ uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
/* init CPUs */
for (i = 0; i < machine->smp.cpus; i++) {
@@ -223,13 +223,6 @@ static void ppc_heathrow_init(MachineState *machine)
}
}
- /* Timebase Frequency */
- if (kvm_enabled()) {
- tbfreq = kvmppc_get_tbfreq();
- } else {
- tbfreq = TBFREQ;
- }
-
/* Grackle PCI host bridge */
grackle_dev = qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE);
qdev_prop_set_uint32(grackle_dev, "ofw-addr", 0x80000000);
--
2.30.4
- [PATCH v2 00/13] Misc ppc/mac machines clean up, BALATON Zoltan, 2022/09/25
- [PATCH v2 01/13] mac_newworld: Drop some variables, BALATON Zoltan, 2022/09/25
- [PATCH v2 04/13] mac_{old|new}world: Avoid else branch by setting default value, BALATON Zoltan, 2022/09/25
- [PATCH v2 02/13] mac_oldworld: Drop some more variables, BALATON Zoltan, 2022/09/25
- [PATCH v2 03/13] mac_{old|new}world: Set tbfreq at declaration,
BALATON Zoltan <=
- [PATCH v2 06/13] mac_newworld: Simplify creation of Uninorth devices, BALATON Zoltan, 2022/09/25
- [PATCH v2 11/13] hw/ppc/mac.h: Move PROM and KERNEL defines to board code, BALATON Zoltan, 2022/09/25
- [PATCH v2 12/13] hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h, BALATON Zoltan, 2022/09/25
- [PATCH v2 07/13] mac_{old|new}world: Reduce number of QOM casts, BALATON Zoltan, 2022/09/25
- [PATCH v2 09/13] hw/ppc/mac.h: Move macio specific parts out from shared header, BALATON Zoltan, 2022/09/25
- [PATCH v2 05/13] mac_oldworld: Do not open code sysbus_mmio_map(), BALATON Zoltan, 2022/09/25