As a logic simplification, the following gets rid of one variable
that's simply not needed.  (And adds a "static" declaration that seems
to be appropriate):

static bool largest_ram_region(unsigned long *start, unsigned long *size)
{
        int i;

        *size = 0;
        for (i = 0; i < real_mode->e820_entries; i++) {
                struct e820entry *entry = &real_mode->e820_map[i];

                if (entry->type != E820_RAM)
                        continue;

                if (entry->size > *size) {
                        *size = entry->size;
                        *start = entry->addr;
                }
        }
        return *size != 0;
}

but I might instead do it as:

struct e820_entry const *largest_ram_region()
{
        struct e820_entry const *rc = NULL;
        unsigned long size = 0;
        int i;

        for (i = 0; i < real_mode->e820_entries; i++) {
                struct e820entry const *entry = &real_mode->e820_map[i];

                if (entry->type == E820_RAM && entry->size > size) {
                        size = entry->size;
                        rc = entry;
                }
        }
        return rc;
}

... with appropriate adjustments to the caller.  Anyway,
your choice.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to