|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 17/18] pci: Drop parse_pci_split{_seg}()
No user of these functions remain, collapse all the logic into the
recently introduced pci_sbdf_t variants.
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
xen/drivers/pci/pci.c | 43 +++++++------------------------------------
xen/include/xen/pci.h | 23 ++---------------------
2 files changed, 9 insertions(+), 57 deletions(-)
diff --git a/xen/drivers/pci/pci.c b/xen/drivers/pci/pci.c
index 793545ae49..0db9ee51f0 100644
--- a/xen/drivers/pci/pci.c
+++ b/xen/drivers/pci/pci.c
@@ -151,18 +151,7 @@ void pci_intx(const struct pci_dev *pdev, bool enable)
pci_conf_write16(pdev->sbdf, PCI_COMMAND, cmd);
}
-const char *__init parse_pci_split(const char *s, unsigned int *seg_p,
- unsigned int *bus_p, unsigned int *dev_p,
- unsigned int *func_p)
-{
- bool def_seg;
-
- return parse_pci_seg(s, seg_p, bus_p, dev_p, func_p, &def_seg);
-}
-
-const char *__init parse_pci_split_seg(const char *s, unsigned int *seg_p,
- unsigned int *bus_p, unsigned int *dev_p,
- unsigned int *func_p, bool *def_seg)
+const char *__init parse_pci_seg(const char *s, pci_sbdf_t *sbdf, bool
*def_seg)
{
unsigned long seg = simple_strtoul(s, &s, 16), bus, dev, func = 0;
@@ -180,39 +169,21 @@ const char *__init parse_pci_split_seg(const char *s,
unsigned int *seg_p,
*def_seg = true;
}
- if ( func_p && *s == '.' )
+ if ( *s == '.' )
func = simple_strtoul(s + 1, &s, 0);
- if ( seg != (seg_p ? (u16)seg : 0) ||
+ if ( seg != (u16)seg ||
bus != PCI_BUS(PCI_BDF(bus, 0)) ||
dev != PCI_SLOT(PCI_DEVFN(dev, 0)) ||
func != PCI_FUNC(PCI_DEVFN(0, func)) )
return NULL;
- if ( seg_p )
- *seg_p = seg;
- *bus_p = bus;
- *dev_p = dev;
- if ( func_p )
- *func_p = func;
-
- return s;
-}
-
-const char *__init parse_pci_sbdf(const char *s, pci_sbdf_t *sbdf)
-{
- unsigned int seg, bus, dev, func;
- const char *out = parse_pci(s, &seg, &bus, &dev, &func);
-
*sbdf = PCI_SBDF(seg, bus, dev, func);
- return out;
+ return s;
}
-const char *__init parse_pci_sbdf_seg(const char *s, pci_sbdf_t *sbdf, bool
*def_seg)
+const char *__init parse_pci(const char *s, pci_sbdf_t *sbdf)
{
- unsigned int seg, bus, dev, func;
- const char *out = parse_pci_seg(s, &seg, &bus, &dev, &func, def_seg);
-
- *sbdf = PCI_SBDF(seg, bus, dev, func);
- return out;
+ bool def_seg;
+ return parse_pci_seg(s, sbdf, &def_seg);
}
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 8e2f8a1ab7..cb14b6a47f 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -274,27 +274,8 @@ unsigned int pci_find_ext_capability(const struct pci_dev
*pdev,
unsigned int pci_find_next_ext_capability(const struct pci_dev *pdev,
unsigned int start,
unsigned int cap);
-const char *parse_pci_split(const char *s, unsigned int *seg_p, unsigned int
*bus_p,
- unsigned int *dev_p, unsigned int *func_p);
-const char *parse_pci_split_seg(const char *s, unsigned int *seg_p,
- unsigned int *bus_p, unsigned int *dev_p,
- unsigned int *func_p, bool *def_seg);
-
-const char *parse_pci_sbdf(const char *s, pci_sbdf_t *sbdf);
-const char *parse_pci_sbdf_seg(const char *s, pci_sbdf_t *sbdf, bool *def_seg);
-
-#define _parse_pci_split(a, b, c, d, e, ...) parse_pci_split(a, b, c, d, e)
-#define _parse_pci_split_seg(a, b, c, d, e, f, ...) parse_pci_split_seg(a, b,
c, d, e, f)
-
-#define parse_pci(a, b, ...) \
- (count_args(__VA_ARGS__) > 0 \
- ? _parse_pci_split(a, (void *)b, ##__VA_ARGS__, NULL, NULL, NULL) \
- : parse_pci_sbdf(a, (void *)b))
-
-#define parse_pci_seg(a, b, c, ...) \
- (count_args(__VA_ARGS__) > 0 \
- ? _parse_pci_split_seg(a, (void *)b, (void *)c, ##__VA_ARGS__, NULL,
NULL, NULL, NULL) \
- : parse_pci_sbdf_seg(a, (void *)b, (void *)c))
+const char *parse_pci(const char *s, pci_sbdf_t *sbdf);
+const char *parse_pci_seg(const char *s, pci_sbdf_t *sbdf, bool *def_seg);
#define PCI_BAR_VF (1u << 0)
#define PCI_BAR_LAST (1u << 1)
--
2.54.0
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |