Re: [PATCH] resources: when allocate_resource() fails, leave resource untouched

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 4, 2009 at 10:29 AM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> On Wed, 4 Nov 2009, Jesse Barnes wrote:
>>
>> Seems like a reasonable change to me.  Linus is usually the gatekeeper
>> for resource.c.
>
> I'm certainly ok with this one. I wouldn't be surprised if it even allows
> for better code generation, apart from leaving resources untouched when
> allocation fails. So:
>
>        Acked-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
>
> It was apparently sent to Andrew, but I can certainly take it. Or you can
> take it into the PCI tree. Or we can leave it in -mm. Anything goes. Just
> tell me.
>

looks should be put into pci tree.

two of patches that is releasing not big enough range from leaf bridge
could be user.

don't need the "save and restore" trick anymore.

YH

@@ -57,10 +100,23 @@ static void pbus_assign_resources_sorted
        for (list = head.next; list;) {
                res = list->res;
                idx = res - &list->dev->resource[0];
+               /* save the size at first */
+               size = resource_size(res);
                if (pci_assign_resource(list->dev, idx)) {
-                       res->start = 0;
-                       res->end = 0;
-                       res->flags = 0;
+                       if (fail_head && !list->dev->subordinate &&
+                           !pci_is_root_bus(list->dev->bus)) {
+                               /*
+                                * device need to keep flags and size
+                                * for second try
+                                */
+                               res->start = 0;
+                               res->end   = size - 1;
+                               add_to_failed_list(fail_head, list->dev, res);
+                       } else {
+                               res->start = 0;
+                               res->end = 0;
+                               res->flags = 0;
+                       }
                }
                tmp = list;
                list = list->next;
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux