v2: rebase on changes in rbar supportThis kind of comments usually goes after --- delimiter below.
+ unsigned i;
+ int ret = 0;
+
+ /* Release all children from the matching bridge resource */
+ for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCE_END; ++i) {
+ struct resource *res = &bridge->resource[i];
+
+ if ((res->flags & type_mask) != (type & type_mask))IIUC it would be
if ((res->flags ^ type) & type_mask)
(I consider 'diff' as XOR operation is more understandable, but it's up to you)
+ res->start = saved.start;Would
+ res->end = saved.end;
+ res->flags = saved.flags;
*res = saved;
work?
+int pci_resize_resource(struct pci_dev *dev, int resno, int size)I would put
+{
+ struct resource *res = dev->resource + resno;
+ u32 sizes = pci_rbar_get_possible_sizes(dev, resno);
+ int old = pci_rbar_get_current_size(dev, resno);
+ u64 bytes = 1ULL << (size + 20);
+ int ret = 0;
+
sizes = pci_rbar_get_possible_sizes(dev, resno);
here
+ if (!sizes)BIT(size) ?
+ return -ENOTSUPP;
+
+ if (!(sizes & (1 << size)))
and
old = pci_rbar_get_current_size(dev, resno);
here
+error_resize:BIT_ULL(old + 20) ?
+ pci_rbar_set_size(dev, resno, old);
+ res->end = res->start + (1ULL << (old + 20)) - 1;