Re: [PATCH] expand_resource

From: Russell King
Date: Tue Sep 30 2003 - 16:29:35 EST


On Tue, Sep 30, 2003 at 10:04:10PM +0100, Matthew Wilcox wrote:
> Rewrite expand_resource() to be racefree and move it to kernel/resource.c.
>
>...
> +/*
> + * Expand an existing resource by size amount.
> + */
> +int expand_resource(struct resource *res, unsigned long size,
> + unsigned long align)
> +{

Could we have the kerneldoc stuff added to this function? My main
question though is - what is the intended purpose of "align" ? As
it is implemented, it seems to have a weird behaviour:

- if we expand the "end" of the resource, we round it towards an
address which is a multiple of align, but "start" may not be
a multiple of align.
- if we expand "start", we round it down towards a multiple of
align. However, "end" may not be a multiple of align.

This may actually be of use to PCMCIA IO space handling - we only
have two windows, but we may need to expand them if we have a multi-
function card if we have more than 2 areas to map. In this case,
we'd need to know whether "start" was expanded or "end" was expanded
since we can't change the use of the already-allocated resource.

It may make sense to do something more generic, like:

int adjust_resource(struct resource *res, unsigned long start,
unsigned long end);

so that the caller knows what he's requesting and knows whether that
change succeeded or failed. However, it is something I'd need to
look deeper into when I have more time available to look at such
stuff, so please don't take the above as a well thought-out solution.

--
Russell King (rmk@xxxxxxxxxxxxxxxx) http://www.arm.linux.org.uk/personal/
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/