See patch. Do we want align_up()/align_down() in lib.c maybe?
Uwe. -- http://www.hermann-uwe.de | http://www.holsham-traders.de http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
Drop the round() function, as it is an exact copy of align_up().
Also, make align_up()/align_down() non-static as they are useful
even outside of device/device_util.c.
Signed-off-by: Uwe Hermann <[EMAIL PROTECTED]>
Index: include/device/device.h
===================================================================
--- include/device/device.h (Revision 434)
+++ include/device/device.h (Arbeitskopie)
@@ -257,6 +257,9 @@
#define DEVICE_IO_ALIGN 16
#define DEVICE_MEM_ALIGN 4096
+resource_t align_up(resource_t val, unsigned long gran);
+resource_t align_down(resource_t val, unsigned long gran);
+
extern struct device_operations default_dev_ops_root;
extern int id_eq(struct device_id *id1, struct device_id *id2);
Index: device/device.c
===================================================================
--- device/device.c (Revision 434)
+++ device/device.c (Arbeitskopie)
@@ -244,22 +244,6 @@
}
/**
- * Round a number up to an alignment.
- *
- * @param val The starting value.
- * @param roundup Alignment as a power of two.
- * @returns Rounded up number.
- */
-static resource_t round(resource_t val, unsigned long pow)
-{
- resource_t mask;
- mask = (1ULL << pow) - 1ULL;
- val += mask;
- val &= ~mask;
- return val;
-}
-
-/**
* Read the resources on all devices of a given bus.
*
* @param bus Bus to read the resources on.
@@ -492,9 +476,9 @@
base = 0x3e0;
}
}
- if (((round(base, align) + size) - 1) <= resource->limit) {
+ if (((align_up(base, align) + size) - 1) <= resource->limit) {
/* Base must be aligned to size. */
- base = round(base, align);
+ base = align_up(base, align);
resource->base = base;
resource->flags |= IORESOURCE_ASSIGNED;
resource->flags &= ~IORESOURCE_STORED;
@@ -517,7 +501,7 @@
* minimum granularity so we know not to place something else at an
* address positively decoded by the bridge.
*/
- bridge->size = round(base, bridge->gran) - bridge->base;
+ bridge->size = align_up(base, bridge->gran) - bridge->base;
printk(BIOS_SPEW, "%s compute_allocate_%s: base: %08Lx size: %08Lx align: %d gran: %d done\n", dev_path(bus->dev), (bridge->flags & IORESOURCE_IO) ? "io" : (bridge->flags & IORESOURCE_PREFETCH) ? "prefmem" : "mem", base, bridge->size, bridge->align, bridge->gran);
}
Index: device/device_util.c
===================================================================
--- device/device_util.c (Revision 434)
+++ device/device_util.c (Arbeitskopie)
@@ -496,7 +496,7 @@
* @param gran Granularity we are aligning the number to.
* @returns The aligned value.
*/
-static resource_t align_up(resource_t val, unsigned long gran)
+resource_t align_up(resource_t val, unsigned long gran)
{
resource_t mask;
mask = (1ULL << gran) - 1ULL;
@@ -512,7 +512,7 @@
* @param gran Granularity we are aligning the number to.
* @returns The aligned value.
*/
-static resource_t align_down(resource_t val, unsigned long gran)
+resource_t align_down(resource_t val, unsigned long gran)
{
resource_t mask;
mask = (1ULL << gran) - 1ULL;
signature.asc
Description: Digital signature
-- linuxbios mailing list [email protected] http://www.linuxbios.org/mailman/listinfo/linuxbios
