Module Name: src
Committed By: dyoung
Date: Thu Aug 25 02:36:03 UTC 2011
Modified Files:
src/sys/arch/mips/atheros/dev: athflash.c
Log Message:
Use humanize_number() instead of the buggy code that GCC 4.5 caught.
Compiles. Not tested.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/atheros/dev/athflash.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/mips/atheros/dev/athflash.c
diff -u src/sys/arch/mips/atheros/dev/athflash.c:1.4 src/sys/arch/mips/atheros/dev/athflash.c:1.5
--- src/sys/arch/mips/atheros/dev/athflash.c:1.4 Fri Jul 1 18:40:00 2011
+++ src/sys/arch/mips/atheros/dev/athflash.c Thu Aug 25 02:36:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: athflash.c,v 1.4 2011/07/01 18:40:00 dyoung Exp $ */
+/* $NetBSD: athflash.c,v 1.5 2011/08/25 02:36:03 dyoung Exp $ */
/*
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.4 2011/07/01 18:40:00 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.5 2011/08/25 02:36:03 dyoung Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -194,6 +194,7 @@
static void
flash_attach(struct device *parent, struct device *self, void *aux)
{
+ char nbuf[32];
struct flash_softc *sc = (void *) self;
struct arbus_attach_args *aa = aux;
int i;
@@ -230,18 +231,17 @@
}
KASSERT(flash_ids[i].name != NULL);
- printf(": %s ", flash_ids[i].name);
- if (i >= 0x100000)
- printf("(%d MB)", flash_ids[i].flash_size >> 20);
- else
- printf("(%d KB)", flash_ids[i].flash_size >> 10);
+ printf(": %s", flash_ids[i].name);
+ if (humanize_number(nbuf, sizeof(nbuf), flash_ids[i].flash_size, "B",
+ 1024) > 0)
+ printf(" (%s)", nbuf);
/*
* determine size of the largest block
*/
sc->sc_size = flash_ids[i].flash_size;
sc->sc_sector_size = flash_ids[i].sector_size;
-
+
if ((sc->sc_buf = malloc(sc->sc_sector_size, M_DEVBUF, M_NOWAIT))
== NULL) {
printf(": can't alloc buffer space\n");