HV: explicitly init lock variable before using it

1. though "pci_device_lock" & "logmsg_ctl.lock" are set to 0 when
  system dose memory initialization, it is better to explicitly init
  them before using.
2. unify the usage of spinlock_init

Tracked-On: #4827
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Minggui Cao 2020-05-20 11:12:38 +08:00 committed by wenlingz
parent 6c02a8d5ed
commit 564984570c
2 changed files with 5 additions and 0 deletions

View File

@ -29,6 +29,8 @@ void init_logmsg(uint32_t flags)
{
logmsg_ctl.flags = flags;
logmsg_ctl.seq = 0;
spinlock_init(&(logmsg_ctl.lock));
}
void do_logmsg(uint32_t severity, const char *fmt, ...)

View File

@ -610,6 +610,9 @@ void init_pci_pdev_list(void)
uint16_t bus;
bool was_visited = false;
/* explicitly init the lock before using it */
spinlock_init(&pci_device_lock);
pci_parse_iommu_devscopes(&bdfs_from_drhds, &drhd_idx_pci_all);
/* TODO: iterate over list of PCI Host Bridges found in ACPI namespace */