On Mon, Jan 30, 2012 at 7:59 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote: > On Fri, Jan 27, 2012 at 6:49 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: >> Try to allocate from parent bus busn_res. if can not find any big enough, will try >> to extend parent bus top. even the extending is through allocating, after allocating >> will pad the range to parent buses top. >> >> When extending happens, We will record the parent_res, so could use it as stopper >> for really extend/shrink top later. >> .. > > I think what this does is "find the largest available area in 'res'." > That *sounds* sort of useful (and like something that could go > somewhere more generic than drivers/pci/probe.c), but there's no > locking, so we don't have any assurance that the area we find will > *remain* available. two usages: 1. init booting : should be safe, that is sequential scanning 2. hotplug: we should have overall lock somewhere for it? > > Since the caller should deal with failure anyway (if the largest > available area is no longer available by the time it gets around to > allocating it), it seems like it'd be better to fold this into the > caller somehow. >> + if (ret == 0) { >> + /* release busn_res */ > > Comments like this that repeat exactly what the next line of code does > without adding any useful information are unnecessary and distracting. ok, will remove them. Yinghai -- 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