Skip to content

Commit c556388

Browse files
committed
PCI: Use bitfield instead of bool for struct pci_vpd_pci22.busy
Make struct pci_vpd_pci22.busy a 1-bit field instead of a bool. We intend to add another flag, and two bitfields are cheaper than two bools. Tested-by: Shane Seymour <shane.seymour@hpe.com> Tested-by: Babu Moger <babu.moger@oracle.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Hannes Reinecke <hare@suse.com>
1 parent f52e562 commit c556388

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/pci/access.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ struct pci_vpd_pci22 {
283283
struct pci_vpd base;
284284
struct mutex lock;
285285
u16 flag;
286-
bool busy;
287286
u8 cap;
287+
u8 busy:1;
288288
};
289289

290290
/*
@@ -313,7 +313,7 @@ static int pci_vpd_pci22_wait(struct pci_dev *dev)
313313
return ret;
314314

315315
if ((status & PCI_VPD_ADDR_F) == vpd->flag) {
316-
vpd->busy = false;
316+
vpd->busy = 0;
317317
return 0;
318318
}
319319

@@ -355,7 +355,7 @@ static ssize_t pci_vpd_pci22_read(struct pci_dev *dev, loff_t pos, size_t count,
355355
pos & ~3);
356356
if (ret < 0)
357357
break;
358-
vpd->busy = true;
358+
vpd->busy = 1;
359359
vpd->flag = PCI_VPD_ADDR_F;
360360
ret = pci_vpd_pci22_wait(dev);
361361
if (ret < 0)
@@ -415,7 +415,7 @@ static ssize_t pci_vpd_pci22_write(struct pci_dev *dev, loff_t pos, size_t count
415415
if (ret < 0)
416416
break;
417417

418-
vpd->busy = true;
418+
vpd->busy = 1;
419419
vpd->flag = 0;
420420
ret = pci_vpd_pci22_wait(dev);
421421
if (ret < 0)
@@ -495,7 +495,7 @@ int pci_vpd_pci22_init(struct pci_dev *dev)
495495
vpd->base.ops = &pci_vpd_pci22_ops;
496496
mutex_init(&vpd->lock);
497497
vpd->cap = cap;
498-
vpd->busy = false;
498+
vpd->busy = 0;
499499
dev->vpd = &vpd->base;
500500
return 0;
501501
}

0 commit comments

Comments
 (0)