Various cosmetic and coding style fixes in src/devices.
Also:
- Improve a few code comments, fix typos, etc.
- Change a few more variable types to u8/u16/u32 etc.
- Make some very long lines fit into 80chars/line.
- Drop a huge duplicated comment, use "@see" to refer to the other one.
- Reduce nesting level a bit by restructuring some code chunks.
- s/Config.lb/devicetree.cb/ in a few places.
Abuild-tested.
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6019 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/src/devices/cardbus_device.c b/src/devices/cardbus_device.c
index e3acf85..0b07e34 100644
--- a/src/devices/cardbus_device.c
+++ b/src/devices/cardbus_device.c
@@ -42,36 +42,32 @@
resource_t min_size, unsigned int index, unsigned long type)
{
struct resource *resource;
+ unsigned long gran;
+ resource_t step;
/* Initialize the constraints on the current bus. */
resource = NULL;
- if (moving) {
- unsigned long gran;
- resource_t step;
+ if (!moving)
+ return;
- resource = new_resource(dev, index);
- resource->size = 0;
- gran = 0;
- step = 1;
- while ((moving & step) == 0) {
- gran += 1;
- step <<= 1;
- }
- resource->gran = gran;
- resource->align = gran;
- resource->limit = moving | (step - 1);
- resource->flags = type;
-
- /*
- * Don't let the minimum size exceed what we
- * can put in the resource.
- */
- if ((min_size - 1) > resource->limit)
- min_size = resource->limit + 1;
-
- resource->size = min_size;
+ resource = new_resource(dev, index);
+ resource->size = 0;
+ gran = 0;
+ step = 1;
+ while ((moving & step) == 0) {
+ gran += 1;
+ step <<= 1;
}
- return;
+ resource->gran = gran;
+ resource->align = gran;
+ resource->limit = moving | (step - 1);
+ resource->flags = type;
+
+ /* Don't let the minimum size exceed what we can put in the resource. */
+ if ((min_size - 1) > resource->limit)
+ min_size = resource->limit + 1;
+
+ resource->size = min_size;
}
static void cardbus_size_bridge_resource(device_t dev, unsigned int index)