diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c index ea50a78..5e9c0fd 100644 --- a/arch/arm/boards/pcm038/pcm038.c +++ b/arch/arm/boards/pcm038/pcm038.c @@ -13,6 +13,7 @@ * * */ +#define pr_fmt(fmt) "pcm038: " fmt #include #include @@ -170,7 +171,7 @@ /* Clocks have changed. Notify clients */ clock_notifier_call_chain(); } else { - printf("Failed to initialize PMIC. Will continue with low CPU speed\n"); + pr_err("Failed to initialize PMIC. Will continue with low CPU speed\n"); } } @@ -315,7 +316,7 @@ envdev = "NOR"; } - printf("Using environment in %s Flash\n", envdev); + pr_notice("Using environment in %s Flash\n", envdev); if (imx_iim_read(1, 1, &uid, 6) == 6) armlinux_set_serial(uid); diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c index 40b7ec4..4b6db37 100644 --- a/arch/arm/cpu/mmu.c +++ b/arch/arm/cpu/mmu.c @@ -1,3 +1,24 @@ +/* + * start-pbl.c + * + * Copyright (c) 2009-2013 Sascha Hauer , Pengutronix + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#define pr_fmt(fmt) "mmu: " fmt + #include #include #include @@ -138,7 +159,7 @@ int i, pte; u32 *ptes; - debug("remapping SDRAM from 0x%08lx (size 0x%08lx)\n", + pr_debug("remapping SDRAM from 0x%08lx (size 0x%08lx)\n", phys, bank->size); /* @@ -150,7 +171,7 @@ ptes = xmemalign(PAGE_SIZE, num_ptes * sizeof(u32)); - debug("ptes: 0x%p ttb_start: 0x%08lx ttb_end: 0x%08lx\n", + pr_debug("ptes: 0x%p ttb_start: 0x%08lx ttb_end: 0x%08lx\n", ptes, ttb_start, ttb_end); for (i = 0; i < num_ptes; i++) { @@ -242,7 +263,7 @@ ttb = memalign(0x10000, 0x4000); - debug("ttb: 0x%p\n", ttb); + pr_debug("ttb: 0x%p\n", ttb); /* Set the ttb register */ asm volatile ("mcr p15,0,%0,c2,c0,0" : : "r"(ttb) /*:*/); diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c index dd70e6d..841a9ed 100644 --- a/arch/arm/mach-imx/esdctl.c +++ b/arch/arm/mach-imx/esdctl.c @@ -168,8 +168,8 @@ static void add_mem(unsigned long base0, unsigned long size0, unsigned long base1, unsigned long size1) { - debug("%s: cs0 base: 0x%08x cs0 size: 0x%08x\n", __func__, base0, size0); - debug("%s: cs1 base: 0x%08x cs1 size: 0x%08x\n", __func__, base1, size1); + debug("%s: cs0 base: 0x%08lx cs0 size: 0x%08lx\n", __func__, base0, size0); + debug("%s: cs1 base: 0x%08lx cs1 size: 0x%08lx\n", __func__, base1, size1); if (base0 + size0 == base1 && size1 > 0) { /* diff --git a/arch/arm/mach-omap/gpmc.c b/arch/arm/mach-omap/gpmc.c index 3aaa4f6..bb84b38 100644 --- a/arch/arm/mach-omap/gpmc.c +++ b/arch/arm/mach-omap/gpmc.c @@ -89,7 +89,7 @@ * But NEVER run me in XIP mode! I will Die! */ while (x < GPMC_NUM_CS) { - debug("gpmccs=%d Reg:0x%x <-0x0\n", x, reg); + debug("gpmccs=%d Reg:0x%p <-0x0\n", x, reg); writel(0x0, reg); reg += GPMC_CONFIG_CS_SIZE; x++; @@ -119,14 +119,14 @@ /* Write the CFG1-6 regs */ while (x < 6) { - debug("gpmccfg%d Reg:0x%x <-0x%08x\n", + debug("gpmccfg%d Reg:0x%p <-0x%08x\n", x, reg, config->cfg[x]); writel(config->cfg[x], reg); reg += GPMC_CONFIG_REG_OFF; x++; } /* reg now points to CFG7 */ - debug("gpmccfg%d Reg:0x%x <-0x%08x\n", + debug("gpmccfg%d Reg:0x%p <-0x%08x\n", x, reg, (0x1 << 6) | /* CS enable */ ((config->size & 0xF) << 8) | /* Size */ ((config->base >> 24) & 0x3F)); diff --git a/arch/blackfin/include/asm/posix_types.h b/arch/blackfin/include/asm/posix_types.h index b1bf245..9992929 100644 --- a/arch/blackfin/include/asm/posix_types.h +++ b/arch/blackfin/include/asm/posix_types.h @@ -38,7 +38,7 @@ typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; -typedef unsigned int __kernel_size_t; +typedef unsigned long __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h index a88f0e2..8ee48e0 100644 --- a/arch/nios2/include/asm/io.h +++ b/arch/nios2/include/asm/io.h @@ -37,7 +37,7 @@ ({unsigned short val;\ asm volatile("ldhio %0, 0(%1)" : "=r"(val) : "r" (addr)); val; }) #define readl(addr)\ - ({unsigned long val;\ + ({unsigned int val;\ asm volatile("ldwio %0, 0(%1)" : "=r"(val) : "r" (addr)); val; }) #define writeb(val, addr)\ diff --git a/arch/nios2/include/asm/posix_types.h b/arch/nios2/include/asm/posix_types.h index 12906b3..5a901ff 100644 --- a/arch/nios2/include/asm/posix_types.h +++ b/arch/nios2/include/asm/posix_types.h @@ -27,7 +27,7 @@ typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; -typedef unsigned int __kernel_size_t; +typedef unsigned long __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; diff --git a/arch/ppc/lib/board.c b/arch/ppc/lib/board.c index d219862..18d2588 100644 --- a/arch/ppc/lib/board.c +++ b/arch/ppc/lib/board.c @@ -52,8 +52,8 @@ */ malloc_end = (_text_base - (128 << 10)) & ~(4095); - debug("malloc_end: 0x%08x\n", malloc_end); - debug("TEXT_BASE after relocation: 0x%08x\n", _text_base); + debug("malloc_end: 0x%08lx\n", malloc_end); + debug("TEXT_BASE after relocation: 0x%08lx\n", _text_base); mem_malloc_init((void *)(malloc_end - MALLOC_SIZE), (void *)(malloc_end - 1)); diff --git a/common/Kconfig b/common/Kconfig index df67382..42a54f7 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -632,6 +632,22 @@ menu "Debugging" +config COMPILE_LOGLEVEL + int "loglevel" + default 6 + help + This defines the maximum loglevel compiled into the binary. Less important + messages will be compiled away resulting in a smaller binary. + + 0 system is unusable (emerg) + 1 action must be taken immediately (alert) + 2 critical conditions (crit) + 3 error conditions (err) + 4 warning conditions (warn) + 5 normal but significant condition (notice) + 6 informational (info) + 7 debug-level messages (debug) + config DEBUG_INFO bool prompt "enable debug symbols" diff --git a/common/environment.c b/common/environment.c index eebccce..e8d623f 100644 --- a/common/environment.c +++ b/common/environment.c @@ -113,11 +113,13 @@ memcpy(data->writep, path, len); inode->size = ENVFS_32(len); data->writep += PAD4(len); - debug("handling symlink %s size %ld namelen %d headerlen %d\n", filename + strlen(data->base), - len, namelen, ENVFS_32(inode->headerlen)); + debug("handling symlink %s size %d namelen %d headerlen %d\n", + filename + strlen(data->base), + len, namelen, ENVFS_32(inode->headerlen)); } else { - debug("handling file %s size %ld namelen %d headerlen %d\n", filename + strlen(data->base), - statbuf->st_size, namelen, ENVFS_32(inode->headerlen)); + debug("handling file %s size %lld namelen %d headerlen %d\n", + filename + strlen(data->base), + statbuf->st_size, namelen, ENVFS_32(inode->headerlen)); inode->size = ENVFS_32(statbuf->st_size); fd = open(filename, O_RDONLY); diff --git a/common/hush.c b/common/hush.c index f9e6411..1f468f6 100644 --- a/common/hush.c +++ b/common/hush.c @@ -937,14 +937,12 @@ return rcode; } -#ifdef DEBUG /* broken, of course, but OK for testing */ -static char *indenter(int i) +static __maybe_unused char *indenter(int i) { static char blanks[] = " "; return &blanks[sizeof(blanks) - i - 1]; } -#endif /* return code is the exit status of the pipe */ static int free_pipe(struct pipe *pi, int indent) diff --git a/common/module.c b/common/module.c index 4cb8ef3..109fe5c 100644 --- a/common/module.c +++ b/common/module.c @@ -104,7 +104,7 @@ sym[i].st_value = resolve_symbol(sechdrs, strtab + sym[i].st_name); - debug("undef : %20s 0x%08x 0x%08lx\n", strtab + sym[i].st_name, sym[i].st_value); + debug("undef : %20s 0x%08x\n", strtab + sym[i].st_name, sym[i].st_value); /* Ok if resolved. */ if (sym[i].st_value != 0) diff --git a/common/parser.c b/common/parser.c index fd578c7..4d993df 100644 --- a/common/parser.c +++ b/common/parser.c @@ -58,9 +58,7 @@ /* 1 = waiting for '(' or '{' */ /* 2 = waiting for ')' or '}' */ /* 3 = waiting for ''' */ -#ifdef DEBUG - char *output_start = output; -#endif + char __maybe_unused *output_start = output; pr_debug("[PROCESS_MACROS] INPUT len %d: \"%s\"\n", strlen (input), input); diff --git a/common/resource.c b/common/resource.c index ea6abe8..5795e79 100644 --- a/common/resource.c +++ b/common/resource.c @@ -43,15 +43,21 @@ struct resource *r, *new; if (end < start) { - debug("%s: request region 0x%08x:0x%08x: end < start\n", - __func__, start, end); + debug("%s: request region 0x%08llx:0x%08llx: end < start\n", + __func__, + (unsigned long long)start, + (unsigned long long)end); return NULL; } /* outside parent resource? */ if (start < parent->start || end > parent->end) { - debug("%s: 0x%08x:0x%08x outside parent resource 0x%08x:0x%08x\n", - __func__, start, end, parent->start, parent->end); + debug("%s: 0x%08llx:0x%08llx outside parent resource 0x%08llx:0x%08llx\n", + __func__, + (unsigned long long)start, + (unsigned long long)end, + (unsigned long long)parent->start, + (unsigned long long)parent->end); return NULL; } @@ -64,13 +70,19 @@ goto ok; if (start > r->end) continue; - debug("%s: 0x%08x:0x%08x conflicts with 0x%08x:0x%08x\n", - __func__, start, end, r->start, r->end); + debug("%s: 0x%08llx:0x%08llx conflicts with 0x%08llx:0x%08llx\n", + __func__, + (unsigned long long)start, + (unsigned long long)end, + (unsigned long long)r->start, + (unsigned long long)r->end); return NULL; } ok: - debug("%s ok: 0x%08x:0x%08x\n", __func__, start, end); + debug("%s ok: 0x%08llx:0x%08llx\n", __func__, + (unsigned long long)start, + (unsigned long long)end); new = xzalloc(sizeof(*new)); init_resource(new, name); diff --git a/common/uimage.c b/common/uimage.c index 1ac0b7d..06f97f0 100644 --- a/common/uimage.c +++ b/common/uimage.c @@ -440,8 +440,9 @@ uimage_resource = request_sdram_region("uimage", start, size); if (!uimage_resource) { - printf("unable to request SDRAM 0x%08x-0x%08x\n", - start, start + size - 1); + printf("unable to request SDRAM 0x%08llx-0x%08llx\n", + (unsigned long long)start, + (unsigned long long)start + size - 1); return NULL; } diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c index ed644d1..b5b3665 100644 --- a/drivers/mci/mxs.c +++ b/drivers/mci/mxs.c @@ -724,7 +724,7 @@ mxs_mci->index = 3; break; default: - pr_debug("Unknown SSP unit at address 0x%08x\n", mxs_mci->regs); + pr_debug("Unknown SSP unit at address 0x%p\n", mxs_mci->regs); return 0; } #endif diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 428d126..55b1020 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -408,7 +408,8 @@ struct spi_transfer t[2]; struct spi_message m; - debug("m25p80_write %ld bytes at 0x%08lX\n", (unsigned long)count, offset); + dev_dbg(&flash->spi->dev, "m25p80_write %ld bytes at 0x%08llx\n", + (unsigned long)len, to); spi_message_init(&m); memset(t, 0, (sizeof t)); @@ -484,7 +485,7 @@ size_t actual; int cmd_sz, ret; - pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev), + dev_dbg(&flash->spi->dev, "%s to 0x%08x, len %zd\n", __func__, (u32)to, len); spi_message_init(&m); @@ -767,7 +768,7 @@ */ tmp = spi_write_then_read(spi, &code, 1, id, 5); if (tmp < 0) { - pr_debug("%s: error %d reading JEDEC ID\n", + dev_dbg(&spi->dev, "%s: error %d reading JEDEC ID\n", dev_name(&spi->dev), tmp); return ERR_PTR(tmp); } @@ -923,7 +924,7 @@ dev_info(dev, "%s (%lld Kbytes)\n", id->name, (long long)flash->mtd.size >> 10); - pr_debug("mtd .name = %s, .size = 0x%llx (%lldMiB) " + dev_dbg(dev, "mtd .name = %s, .size = 0x%llx (%lldMiB) " ".erasesize = 0x%.8x (%uKiB) .numeraseregions = %d\n", flash->mtd.name, (long long)flash->mtd.size, (long long)(flash->mtd.size >> 20), @@ -932,7 +933,7 @@ if (flash->mtd.numeraseregions) for (i = 0; i < flash->mtd.numeraseregions; i++) - pr_debug("mtd.eraseregions[%d] = { .offset = 0x%llx, " + dev_dbg(dev, "mtd.eraseregions[%d] = { .offset = 0x%llx, " ".erasesize = 0x%.8x (%uKiB), " ".numblocks = %d }\n", i, (long long)flash->mtd.eraseregions[i].offset, diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index fe9a6e7..411aba7 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -31,6 +31,9 @@ * published by the Free Software Foundation. * */ + +#define pr_fmt(fmt) "nand: " fmt + #include #include #include @@ -1074,19 +1077,19 @@ chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I') return 0; - printk(KERN_INFO "ONFI flash detected ... "); + pr_info("ONFI flash detected ... "); chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); for (i = 0; i < 3; i++) { chip->read_buf(mtd, (uint8_t *)p, sizeof(*p)); if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) == le16_to_cpu(p->crc)) { - printk(KERN_INFO "ONFI param page %d valid\n", i); + pr_info("ONFI param page %d valid\n", i); break; } } if (i == 3) { - printk(KERN_INFO "no valid ONFI param page found\n"); + pr_info("no valid ONFI param page found\n"); return 0; } @@ -1106,7 +1109,7 @@ chip->onfi_version = 0; if (!chip->onfi_version) { - printk(KERN_INFO "unsupported ONFI version: %d\n", val); + pr_info("unsupported ONFI version: %d\n", val); return 0; } @@ -1170,7 +1173,7 @@ id_data[1] = chip->read_byte(mtd); if (id_data[0] != *maf_id || id_data[1] != dev_id) { - printk(KERN_ERR "%s: second ID read did not match " + pr_err("%s: second ID read did not match " "%02x,%02x against %02x,%02x\n", __func__, *maf_id, dev_id, id_data[0], id_data[1]); return ERR_PTR(-ENODEV); @@ -1191,7 +1194,7 @@ if (ret) goto ident_done; else { - printk(KERN_ERR "NAND type unknown: %02x,%02x\n", *maf_id, dev_id); + pr_err("NAND type unknown: %02x,%02x\n", *maf_id, dev_id); return ERR_PTR(-ENODEV); } } @@ -1329,10 +1332,10 @@ * chip correct ! */ if (busw != (chip->options & NAND_BUSWIDTH_16)) { - printk(KERN_INFO "NAND device: Manufacturer ID:" + pr_info("NAND device: Manufacturer ID:" " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, dev_id, nand_manuf_ids[maf_idx].name, mtd->name); - printk(KERN_WARNING "NAND bus width %d instead %d bit\n", + pr_warning("NAND bus width %d instead %d bit\n", (chip->options & NAND_BUSWIDTH_16) ? 16 : 8, busw ? 16 : 8); return ERR_PTR(-EINVAL); @@ -1367,7 +1370,7 @@ if (mtd->writesize > 512 && chip->cmdfunc == nand_command) chip->cmdfunc = nand_command_lp; - printk("NAND device: Manufacturer ID: 0x%02x, Chip ID: 0x%02x (%s %s)," + pr_notice("Manufacturer ID: 0x%02x, Chip ID: 0x%02x (%s %s)," " page size: %d, OOB size: %d\n", *maf_id, dev_id, nand_manuf_ids[maf_idx].name, chip->onfi_version ? chip->onfi_params.model : type->name, @@ -1393,7 +1396,7 @@ struct nand_flash_dev *type; if (chip->options & NAND_BUSWIDTH_AUTO && !chip->set_buswidth) { - printk(KERN_ERR "buswidth detection but no buswidth callback\n"); + pr_err("buswidth detection but no buswidth callback\n"); return -EINVAL; } @@ -1406,7 +1409,7 @@ type = nand_get_flash_type(mtd, chip, busw, &nand_maf_id); if (IS_ERR(type)) { - printk(KERN_WARNING "No NAND device found (%ld)!\n", PTR_ERR(type)); + pr_warning("No NAND device found (%ld)!\n", PTR_ERR(type)); chip->select_chip(mtd, -1); return PTR_ERR(type); } @@ -1422,7 +1425,7 @@ break; } if (i > 1) - printk(KERN_INFO "%d NAND chips detected\n", i); + pr_info("%d NAND chips detected\n", i); /* Store the number of chips and calc total size for mtd */ chip->numchips = i; @@ -1436,13 +1439,13 @@ if ((!chip->ecc.calculate || !chip->ecc.correct || !chip->ecc.hwctl) && (!chip->ecc.read_page || !chip->ecc.write_page)) { - printk(KERN_WARNING "No ECC functions supplied, " + pr_warning("No ECC functions supplied, " "Hardware ECC not possible\n"); BUG(); } if (mtd->writesize < chip->ecc.size) { - printk(KERN_WARNING "%d byte HW ECC not possible on " + pr_warning("%d byte HW ECC not possible on " "%d byte page size\n", chip->ecc.size, mtd->writesize); BUG(); @@ -1486,7 +1489,7 @@ chip->ecc.layout = &nand_oob_64; break; default: - printk(KERN_WARNING "No oob scheme defined for " + pr_warning("No oob scheme defined for " "oobsize %d\n", mtd->oobsize); BUG(); } @@ -1527,7 +1530,7 @@ #endif #ifdef CONFIG_NAND_ECC_NONE case NAND_ECC_NONE: - printk(KERN_WARNING "NAND_ECC_NONE selected by board driver. " + pr_warning("NAND_ECC_NONE selected by board driver. " "This is not recommended !!\n"); chip->ecc.read_page = nand_read_page_raw; #ifdef CONFIG_MTD_WRITE @@ -1540,7 +1543,7 @@ break; #endif default: - printk(KERN_WARNING "Invalid NAND_ECC_MODE %d\n", + pr_warning("Invalid NAND_ECC_MODE %d\n", chip->ecc.mode); BUG(); } @@ -1561,7 +1564,7 @@ */ chip->ecc.steps = mtd->writesize / chip->ecc.size; if(chip->ecc.steps * chip->ecc.size != mtd->writesize) { - printk(KERN_WARNING "Invalid ecc parameters\n"); + pr_warning("Invalid ecc parameters\n"); BUG(); } chip->ecc.total = chip->ecc.steps * chip->ecc.bytes; diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index 3cbf886..f7ae7cd 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c @@ -51,6 +51,9 @@ * - the space necessary for a bbt in FLASH does not exceed a block boundary * */ + +#define pr_fmt(fmt) "nand: " fmt + #include #include #include @@ -160,10 +163,10 @@ res = mtd->read(mtd, from, len, &retlen, buf); if (res < 0) { if (retlen != len) { - printk(KERN_INFO "nand_bbt: Error reading bad block table\n"); + pr_info("nand_bbt: Error reading bad block table\n"); return res; } - printk(KERN_WARNING "nand_bbt: ECC error while reading bad block table\n"); + pr_warning("nand_bbt: ECC error while reading bad block table\n"); } /* Analyse data */ @@ -174,7 +177,7 @@ if (tmp == msk) continue; if (reserved_block_code && (tmp == reserved_block_code)) { - printk(KERN_DEBUG "nand_read_bbt: Reserved block at 0x%08x\n", + pr_debug("nand_read_bbt: Reserved block at 0x%08x\n", ((offs << 2) + (act >> 1)) << this->bbt_erase_shift); this->bbt[offs + (act >> 3)] |= 0x2 << (act & 0x06); mtd->ecc_stats.bbtblocks++; @@ -182,7 +185,7 @@ } /* Leave it for now, if its matured we can move this * message to MTD_DEBUG_LEVEL0 */ - printk(KERN_DEBUG "nand_read_bbt: Bad block at 0x%08x\n", + pr_debug("nand_read_bbt: Bad block at 0x%08x\n", ((offs << 2) + (act >> 1)) << this->bbt_erase_shift); /* Factory marked bad or worn out ? */ if (tmp == 0) @@ -292,7 +295,7 @@ scan_read_raw(mtd, buf, td->pages[0] << this->page_shift, mtd->writesize); td->version[0] = buf[mtd->writesize + td->veroffs]; - printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", + pr_debug("Bad block table at page %d, version 0x%02X\n", td->pages[0], td->version[0]); } @@ -301,7 +304,7 @@ scan_read_raw(mtd, buf, md->pages[0] << this->page_shift, mtd->writesize); md->version[0] = buf[mtd->writesize + md->veroffs]; - printk(KERN_DEBUG "Bad block table at page %d, version 0x%02X\n", + pr_debug("Bad block table at page %d, version 0x%02X\n", md->pages[0], md->version[0]); } return 1; @@ -380,7 +383,7 @@ loff_t from; size_t readlen; - printk(KERN_INFO "Scanning device for bad blocks\n"); + pr_info("Scanning device for bad blocks\n"); if (bd->options & NAND_BBT_SCANALLPAGES) len = 1 << (this->bbt_erase_shift - this->page_shift); @@ -409,7 +412,7 @@ from = 0; } else { if (chip >= this->numchips) { - printk(KERN_WARNING "create_bbt(): chipnr (%d) > available chips (%d)\n", + pr_warning("create_bbt(): chipnr (%d) > available chips (%d)\n", chip + 1, this->numchips); return -EINVAL; } @@ -433,7 +436,7 @@ if (ret) { this->bbt[i >> 3] |= 0x03 << (i & 0x6); - printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", + pr_warning("Bad eraseblock %d at 0x%08x\n", i >> 1, (unsigned int)from); mtd->ecc_stats.badblocks++; } @@ -517,9 +520,9 @@ /* Check, if we found a bbt for each requested chip */ for (i = 0; i < chips; i++) { if (td->pages[i] == -1) - printk(KERN_WARNING "Bad block table not found for chip %d\n", i); + pr_warning("Bad block table not found for chip %d\n", i); else - printk(KERN_DEBUG "Bad block table found at page %d, version 0x%02X\n", td->pages[i], + pr_debug("Bad block table found at page %d, version 0x%02X\n", td->pages[i], td->version[i]); } return 0; @@ -634,7 +637,7 @@ if (!md || md->pages[chip] != page) goto write; } - printk(KERN_ERR "No space left to write bad block table\n"); + pr_err("No space left to write bad block table\n"); return -ENOSPC; write: @@ -669,12 +672,12 @@ res = mtd->read(mtd, to, len, &retlen, buf); if (res < 0) { if (retlen != len) { - printk(KERN_INFO "nand_bbt: Error " + pr_info("nand_bbt: Error " "reading block for writing " "the bad block table\n"); return res; } - printk(KERN_WARNING "nand_bbt: ECC error " + pr_warning("nand_bbt: ECC error " "while reading block for writing " "bad block table\n"); } @@ -735,7 +738,7 @@ if (res < 0) goto outerr; - printk(KERN_DEBUG "Bad block table written to 0x%08x, version " + pr_debug("Bad block table written to 0x%08x, version " "0x%02X\n", (unsigned int)to, td->version[chip]); /* Mark it as used */ @@ -744,7 +747,7 @@ return 0; outerr: - printk(KERN_WARNING + pr_warning( "nand_bbt: Error while writing bad block table %d\n", res); return res; } @@ -975,7 +978,7 @@ /* Allocate memory (2bit per block) and clear the memory bad block table */ this->bbt = kzalloc(len, GFP_KERNEL); if (!this->bbt) { - printk(KERN_ERR "nand_scan_bbt: Out of memory\n"); + pr_err("nand_scan_bbt: Out of memory\n"); return -ENOMEM; } @@ -984,7 +987,7 @@ */ if (!td) { if ((res = nand_memory_bbt(mtd, bd))) { - printk(KERN_ERR "nand_bbt: Can't scan flash and build the RAM-based BBT\n"); + pr_err("nand_bbt: Can't scan flash and build the RAM-based BBT\n"); kfree(this->bbt); this->bbt = NULL; } @@ -996,7 +999,7 @@ len += (len >> this->page_shift) * mtd->oobsize; buf = vmalloc(len); if (!buf) { - printk(KERN_ERR "nand_bbt: Out of memory\n"); + pr_err("nand_bbt: Out of memory\n"); kfree(this->bbt); this->bbt = NULL; return -ENOMEM; @@ -1047,7 +1050,7 @@ len += (len >> this->page_shift) * mtd->oobsize; buf = kmalloc(len, GFP_KERNEL); if (!buf) { - printk(KERN_ERR "nand_update_bbt: Out of memory\n"); + pr_err("nand_update_bbt: Out of memory\n"); return -ENOMEM; } diff --git a/drivers/mtd/nand/nand_write.c b/drivers/mtd/nand/nand_write.c index 276728c..12a57a0 100644 --- a/drivers/mtd/nand/nand_write.c +++ b/drivers/mtd/nand/nand_write.c @@ -1,3 +1,5 @@ +#define pr_fmt(fmt) "nand: " fmt + #include #include #include @@ -624,7 +626,7 @@ */ if (nand_block_checkbad(mtd, ((loff_t) page) << chip->page_shift, 0, allowbbt)) { - printk(KERN_WARNING "nand_erase: attempt to erase a " + pr_warn("nand_erase: attempt to erase a " "bad block at page 0x%08x\n", page); instr->state = MTD_ERASE_FAILED; goto erase_exit; diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c index 6154940..637f98b 100644 --- a/drivers/nor/cfi_flash.c +++ b/drivers/nor/cfi_flash.c @@ -461,7 +461,7 @@ unsigned long start, end; int i, ret = 0; - debug("%s: erase 0x%08lx (size %d)\n", __func__, offset, count); + debug("%s: erase 0x%08llx (size %zu)\n", __func__, offset, count); start = find_sector(finfo, (unsigned long)finfo->base + offset); end = find_sector(finfo, (unsigned long)finfo->base + offset + @@ -633,7 +633,7 @@ int i, ret = 0; const char *action = (prot? "protect" : "unprotect"); - printf("%s: %s 0x%p (size %d)\n", __func__, + printf("%s: %s 0x%p (size %zu)\n", __func__, action, finfo->base + offset, count); start = find_sector(finfo, (unsigned long)finfo->base + offset); @@ -654,7 +654,8 @@ struct flash_info *finfo = (struct flash_info *)cdev->priv; int ret; - debug("cfi_write: buf=0x%p addr=0x%08lx count=0x%08x\n",buf, finfo->base + offset, count); + debug("cfi_write: buf=0x%p addr=0x%p count=0x%08zx\n", + buf, finfo->base + offset, count); ret = write_buff(finfo, buf, (unsigned long)finfo->base + offset, count); return ret == 0 ? count : -1; @@ -840,7 +841,10 @@ addr = flash_make_addr (info, sect, offset); flash_make_cmd (info, cmd, &cword); - debug("%s: %p %lX %X => %p %llX\n", __FUNCTION__, info, sect, offset, addr, cword); + + debug("%s: %p %lX %X => %p " CFI_WORD_FMT "\n", __func__, + info, sect, offset, addr, cword); + flash_write_word(info, cword, addr); } @@ -862,7 +866,7 @@ debug ("is= %4.4x %4.4x\n", flash_read16(addr), (u16)cword); retval = (flash_read16(addr) == cword); } else if (bankwidth_is_4(info)) { - debug ("is= %8.8lx %8.8lx\n", flash_read32(addr), (u32)cword); + debug ("is= %8.8x %8.8x\n", flash_read32(addr), (u32)cword); retval = (flash_read32(addr) == cword); } else if (bankwidth_is_8(info)) { #ifdef DEBUG diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h index 8f818ba..944cdde 100644 --- a/drivers/nor/cfi_flash.h +++ b/drivers/nor/cfi_flash.h @@ -29,12 +29,16 @@ #if defined(CONFIG_DRIVER_CFI_BANK_WIDTH_8) typedef u64 cfiword_t; +#define CFI_WORD_FMT "0x%016llx" #elif defined(CONFIG_DRIVER_CFI_BANK_WIDTH_4) typedef u32 cfiword_t; +#define CFI_WORD_FMT "0x%08x" #elif defined(CONFIG_DRIVER_CFI_BANK_WIDTH_2) typedef u16 cfiword_t; +#define CFI_WORD_FMT "0x%04x" #else typedef u8 cfiword_t; +#define CFI_WORD_FMT "0x%02x" #endif struct cfi_cmd_set; diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 9315fe3..d0d6ae4 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -148,7 +148,7 @@ ehci_writel(&ehci->hcor->or_usbcmd, cmd); ret = handshake(&ehci->hcor->or_usbcmd, CMD_RESET, 0, 250 * 1000); if (ret < 0) { - printf("EHCI fail to reset\n"); + dev_err(ehci->dev, "fail to reset\n"); goto out; } @@ -187,7 +187,7 @@ } if (idx == 5) { - debug("out of buffer pointers (%u bytes left)\n", sz); + pr_debug("out of buffer pointers (%u bytes left)\n", sz); return -1; } @@ -210,10 +210,10 @@ int ret = 0, i; uint64_t start, timeout_val; - debug("dev=%p, pipe=%lx, buffer=%p, length=%d, req=%p\n", dev, pipe, + dev_dbg(ehci->dev, "pipe=%lx, buffer=%p, length=%d, req=%p\n", pipe, buffer, length, req); if (req != NULL) - debug("req=%u (%#x), type=%u (%#x), value=%u (%#x), index=%u\n", + dev_dbg(ehci->dev, "(req=%u (%#x), type=%u (%#x), value=%u (%#x), index=%u\n", req->request, req->request, req->requesttype, req->requesttype, le16_to_cpu(req->value), le16_to_cpu(req->value), @@ -258,7 +258,7 @@ (0 << 15) | (0 << 12) | (3 << 10) | (2 << 8) | (0x80 << 0); td->qt_token = cpu_to_hc32(token); if (ehci_td_buffer(td, req, sizeof(*req)) != 0) { - debug("unable construct SETUP td\n"); + dev_dbg(ehci->dev, "unable construct SETUP td\n"); goto fail; } *tdp = cpu_to_hc32((uint32_t) td); @@ -280,7 +280,7 @@ ((usb_pipein(pipe) ? 1 : 0) << 8) | (0x80 << 0); td->qt_token = cpu_to_hc32(token); if (ehci_td_buffer(td, buffer, length) != 0) { - printf("unable construct DATA td\n"); + dev_err(ehci->dev, "unable construct DATA td\n"); goto fail; } *tdp = cpu_to_hc32((uint32_t) td); @@ -325,7 +325,7 @@ ret = handshake(&ehci->hcor->or_usbsts, STD_ASS, STD_ASS, 100 * 1000); if (ret < 0) { - printf("EHCI fail timeout STD_ASS set\n"); + dev_err(ehci->dev, "fail timeout STD_ASS set\n"); goto fail; } @@ -364,7 +364,7 @@ ret = handshake(&ehci->hcor->or_usbsts, STD_ASS, 0, 100 * 1000); if (ret < 0) { - printf("EHCI fail timeout STD_ASS reset\n"); + dev_err(ehci->dev, "fail timeout STD_ASS reset\n"); goto fail; } @@ -372,7 +372,7 @@ token = hc32_to_cpu(qh->qt_token); if (!(token & 0x80)) { - debug("TOKEN=0x%08x\n", token); + dev_dbg(ehci->dev, "TOKEN=0x%08x\n", token); switch (token & 0xfc) { case 0: toggle = token >> 31; @@ -400,7 +400,7 @@ dev->act_len = length - ((token >> 16) & 0x7fff); } else { dev->act_len = 0; - debug("dev=%u, usbsts=%#x, p[1]=%#x, p[2]=%#x\n", + dev_dbg(ehci->dev, "dev=%u, usbsts=%#x, p[1]=%#x, p[2]=%#x\n", dev->devnum, ehci_readl(&ehci->hcor->or_usbsts), ehci_readl(&ehci->hcor->or_portsc[0]), ehci_readl(&ehci->hcor->or_portsc[1])); @@ -409,7 +409,7 @@ return (dev->status != USB_ST_NOT_PROC) ? 0 : -1; fail: - printf("fail1\n"); + dev_err(ehci->dev, "fail1\n"); td = (void *)hc32_to_cpu(qh->qt_next); while (td != (void *)QT_NEXT_TERMINATE) { qh->qt_next = td->qt_next; @@ -463,14 +463,14 @@ uint32_t *status_reg; if (le16_to_cpu(req->index) >= CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) { - printf("The request port(%d) is not configured\n", + dev_err(ehci->dev, "The request port(%d) is not configured\n", le16_to_cpu(req->index) - 1); return -1; } status_reg = (uint32_t *)&ehci->hcor->or_portsc[le16_to_cpu(req->index) - 1]; srclen = 0; - debug("req=%u (%#x), type=%u (%#x), value=%u, index=%u\n", + dev_dbg(ehci->dev, "req=%u (%#x), type=%u (%#x), value=%u, index=%u\n", req->request, req->request, req->requesttype, req->requesttype, le16_to_cpu(req->value), le16_to_cpu(req->index)); @@ -481,17 +481,17 @@ case DeviceRequest | USB_REQ_GET_DESCRIPTOR: switch (le16_to_cpu(req->value) >> 8) { case USB_DT_DEVICE: - debug("USB_DT_DEVICE request\n"); + dev_dbg(ehci->dev, "USB_DT_DEVICE request\n"); srcptr = &descriptor.device; srclen = 0x12; break; case USB_DT_CONFIG: - debug("USB_DT_CONFIG config\n"); + dev_dbg(ehci->dev, "USB_DT_CONFIG config\n"); srcptr = &descriptor.config; srclen = 0x19; break; case USB_DT_STRING: - debug("USB_DT_STRING config\n"); + dev_dbg(ehci->dev, "USB_DT_STRING config\n"); switch (le16_to_cpu(req->value) & 0xff) { case 0: /* Language */ srcptr = "\4\3\1\0"; @@ -508,34 +508,34 @@ srclen = 42; break; default: - debug("unknown value DT_STRING %x\n", + dev_dbg(ehci->dev, "unknown value DT_STRING %x\n", le16_to_cpu(req->value)); goto unknown; } break; default: - debug("unknown value %x\n", le16_to_cpu(req->value)); + dev_dbg(ehci->dev, "unknown value %x\n", le16_to_cpu(req->value)); goto unknown; } break; case ((USB_DIR_IN | USB_RT_HUB) << 8) | USB_REQ_GET_DESCRIPTOR: switch (le16_to_cpu(req->value) >> 8) { case USB_DT_HUB: - debug("USB_DT_HUB config\n"); + dev_dbg(ehci->dev, "USB_DT_HUB config\n"); srcptr = &descriptor.hub; srclen = 0x8; break; default: - debug("unknown value %x\n", le16_to_cpu(req->value)); + dev_dbg(ehci->dev, "unknown value %x\n", le16_to_cpu(req->value)); goto unknown; } break; case USB_REQ_SET_ADDRESS | (USB_RECIP_DEVICE << 8): - debug("USB_REQ_SET_ADDRESS\n"); + dev_dbg(ehci->dev, "USB_REQ_SET_ADDRESS\n"); ehci->rootdev = le16_to_cpu(req->value); break; case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: - debug("USB_REQ_SET_CONFIGURATION\n"); + dev_dbg(ehci->dev, "USB_REQ_SET_CONFIGURATION\n"); /* Nothing to do */ break; case USB_REQ_GET_STATUS | ((USB_DIR_IN | USB_RT_HUB) << 8): @@ -565,7 +565,7 @@ if (!ret) tmpbuf[0] |= USB_PORT_STAT_RESET; else - printf("port(%d) reset error\n", + dev_err(ehci->dev, "port(%d) reset error\n", le16_to_cpu(req->index) - 1); } if (reg & EHCI_PS_PP) @@ -618,7 +618,7 @@ !ehci_is_TDI() && EHCI_PS_IS_LOWSPEED(reg)) { /* Low speed device, give up ownership. */ - debug("port %d low speed --> companion\n", + dev_dbg(ehci->dev, "port %d low speed --> companion\n", req->index - 1); reg |= EHCI_PS_PO; ehci_writel(status_reg, reg); @@ -650,13 +650,13 @@ ehci->portreset |= 1 << le16_to_cpu(req->index); else - printf("port(%d) reset error\n", + dev_err(ehci->dev, "port(%d) reset error\n", le16_to_cpu(req->index) - 1); } break; default: - debug("unknown feature %x\n", le16_to_cpu(req->value)); + dev_dbg(ehci->dev, "unknown feature %x\n", le16_to_cpu(req->value)); goto unknown; } /* unblock posted writes */ @@ -684,7 +684,7 @@ ehci->portreset &= ~(1 << le16_to_cpu(req->index)); break; default: - debug("unknown feature %x\n", le16_to_cpu(req->value)); + dev_dbg(ehci->dev, "unknown feature %x\n", le16_to_cpu(req->value)); goto unknown; } ehci_writel(status_reg, reg); @@ -692,7 +692,7 @@ (void) ehci_readl(&ehci->hcor->or_usbcmd); break; default: - debug("Unknown request\n"); + dev_dbg(ehci->dev, "Unknown request\n"); goto unknown; } @@ -701,14 +701,14 @@ if (srcptr != NULL && len > 0) memcpy(buffer, srcptr, len); else - debug("Len is 0\n"); + dev_dbg(ehci->dev, "Len is 0\n"); dev->act_len = len; dev->status = 0; return 0; unknown: - debug("requesttype=%x, request=%x, value=%x, index=%x, length=%x\n", + dev_dbg(ehci->dev, "requesttype=%x, request=%x, value=%x, index=%x, length=%x\n", req->requesttype, req->request, le16_to_cpu(req->value), le16_to_cpu(req->index), le16_to_cpu(req->length)); @@ -795,9 +795,11 @@ submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int length, int timeout) { + struct usb_host *host = dev->host; + struct ehci_priv *ehci = to_ehci(host); if (usb_pipetype(pipe) != PIPE_BULK) { - debug("non-bulk pipe (type=%lu)", usb_pipetype(pipe)); + dev_dbg(ehci->dev, "non-bulk pipe (type=%lu)", usb_pipetype(pipe)); return -1; } return ehci_submit_async(dev, pipe, buffer, length, NULL); @@ -811,7 +813,7 @@ struct ehci_priv *ehci = to_ehci(host); if (usb_pipetype(pipe) != PIPE_CONTROL) { - debug("non-control pipe (type=%lu)", usb_pipetype(pipe)); + dev_dbg(ehci->dev, "non-control pipe (type=%lu)", usb_pipetype(pipe)); return -1; } @@ -827,7 +829,10 @@ submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer, int length, int interval) { - debug("dev=%p, pipe=%lu, buffer=%p, length=%d, interval=%d", + struct usb_host *host = dev->host; + struct ehci_priv *ehci = to_ehci(host); + + dev_dbg(ehci->dev, "dev=%p, pipe=%lu, buffer=%p, length=%d, interval=%d", dev, pipe, buffer, length, interval); return -1; } @@ -884,11 +889,6 @@ else data.flags = EHCI_HAS_TT; - if (dev->num_resources < 1) { - printf("echi: need 1 resources base and data"); - return -ENODEV; - } - data.hccr = dev_request_mem_region(dev, 0); if (dev->num_resources > 1) data.hcor = dev_request_mem_region(dev, 1); diff --git a/fs/tftp.c b/fs/tftp.c index 98cbb37..b40353b 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -512,7 +512,7 @@ size_t size, now; int ret; - debug("%s: %d\n", __func__, insize); + debug("%s: %zu\n", __func__, insize); size = insize; @@ -547,7 +547,7 @@ size_t outsize = 0, now; int ret; - debug("%s %d\n", __func__, insize); + debug("%s %zu\n", __func__, insize); tftp_timer_reset(priv); diff --git a/include/common.h b/include/common.h index 2c707f7..56347df 100644 --- a/include/common.h +++ b/include/common.h @@ -29,6 +29,7 @@ #include #include #include +#include /* * sanity check. The Linux Kernel defines only one of __LITTLE_ENDIAN and @@ -48,22 +49,6 @@ #error "None of __LITTLE_ENDIAN and __BIG_ENDIAN are defined" #endif -#define pr_info(fmt, arg...) printf(fmt, ##arg) -#define pr_notice(fmt, arg...) printf(fmt, ##arg) -#define pr_err(fmt, arg...) printf(fmt, ##arg) -#define pr_warning(fmt, arg...) printf(fmt, ##arg) -#define pr_crit(fmt, arg...) printf(fmt, ##arg) -#define pr_alert(fmt, arg...) printf(fmt, ##arg) -#define pr_emerg(fmt, arg...) printf(fmt, ##arg) - -#ifdef DEBUG -#define pr_debug(fmt, arg...) printf(fmt, ##arg) -#else -#define pr_debug(fmt, arg...) do {} while(0) -#endif - -#define debug(fmt, arg...) pr_debug(fmt, ##arg) - #define BUG() do { \ printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \ panic("BUG!"); \ diff --git a/include/driver.h b/include/driver.h index 7ad0374..31f5d69 100644 --- a/include/driver.h +++ b/include/driver.h @@ -358,35 +358,6 @@ return 0; } -/* debugging and troubleshooting/diagnostic helpers. */ - -int dev_printf(const struct device_d *dev, const char *format, ...) - __attribute__ ((format(__printf__, 2, 3))); - - -#define dev_emerg(dev, format, arg...) \ - dev_printf((dev) , format , ## arg) -#define dev_alert(dev, format, arg...) \ - dev_printf((dev) , format , ## arg) -#define dev_crit(dev, format, arg...) \ - dev_printf((dev) , format , ## arg) -#define dev_err(dev, format, arg...) \ - dev_printf(dev , format , ## arg) -#define dev_warn(dev, format, arg...) \ - dev_printf((dev) , format , ## arg) -#define dev_notice(dev, format, arg...) \ - dev_printf((dev) , format , ## arg) -#define dev_info(dev, format, arg...) \ - dev_printf((dev) , format , ## arg) - -#if defined(DEBUG) -#define dev_dbg(dev, format, arg...) \ - dev_printf((dev) , format , ## arg) -#else -#define dev_dbg(dev, format, arg...) \ - ({ if (0) dev_printf((dev), format, ##arg); 0; }) -#endif - struct bus_type { char *name; int (*match)(struct device_d *dev, struct driver_d *drv); diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index be8ad71..cb8b3bc 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -265,7 +265,7 @@ #define MTD_DEBUG(n, args...) \ do { \ if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ - printk(KERN_INFO args); \ + pr_info( args); \ } while(0) #else /* CONFIG_MTD_DEBUG */ #define MTD_DEBUG(n, args...) do { } while(0) diff --git a/include/printk.h b/include/printk.h new file mode 100644 index 0000000..1d45616 --- /dev/null +++ b/include/printk.h @@ -0,0 +1,72 @@ +#ifndef __PRINTK_H +#define __PRINTK_H + +#define MSG_EMERG 0 /* system is unusable */ +#define MSG_ALERT 1 /* action must be taken immediately */ +#define MSG_CRIT 2 /* critical conditions */ +#define MSG_ERR 3 /* error conditions */ +#define MSG_WARNING 4 /* warning conditions */ +#define MSG_NOTICE 5 /* normal but significant condition */ +#define MSG_INFO 6 /* informational */ +#define MSG_DEBUG 7 /* debug-level messages */ + +#ifdef DEBUG +#define LOGLEVEL MSG_DEBUG +#else +#define LOGLEVEL CONFIG_COMPILE_LOGLEVEL +#endif + +/* debugging and troubleshooting/diagnostic helpers. */ + +int dev_printf(const struct device_d *dev, const char *format, ...) + __attribute__ ((format(__printf__, 2, 3))); + +#define __dev_printf(level, dev, format, args...) \ + ({ \ + int ret = 0; \ + if (level <= LOGLEVEL) \ + ret = dev_printf(dev, format, ##args); \ + ret; \ + }) + + +#define dev_emerg(dev, format, arg...) \ + __dev_printf(0, (dev) , format , ## arg) +#define dev_alert(dev, format, arg...) \ + __dev_printf(1, (dev) , format , ## arg) +#define dev_crit(dev, format, arg...) \ + __dev_printf(2, (dev) , format , ## arg) +#define dev_err(dev, format, arg...) \ + __dev_printf(3, (dev) , format , ## arg) +#define dev_warn(dev, format, arg...) \ + __dev_printf(4, (dev) , format , ## arg) +#define dev_notice(dev, format, arg...) \ + __dev_printf(5, (dev) , format , ## arg) +#define dev_info(dev, format, arg...) \ + __dev_printf(6, (dev) , format , ## arg) +#define dev_dbg(dev, format, arg...) \ + __dev_printf(7, (dev) , format , ## arg) + +#define __pr_printk(level, format, args...) \ + ({ \ + int ret = 0; \ + if (level <= LOGLEVEL) \ + ret = printk(format, ##args); \ + ret; \ + }) + +#ifndef pr_fmt +#define pr_fmt(fmt) fmt +#endif + +#define pr_emerg(fmt, arg...) __pr_printk(0, pr_fmt(fmt), ##arg) +#define pr_alert(fmt, arg...) __pr_printk(1, pr_fmt(fmt), ##arg) +#define pr_crit(fmt, arg...) __pr_printk(2, pr_fmt(fmt), ##arg) +#define pr_warning(fmt, arg...) __pr_printk(3, pr_fmt(fmt), ##arg) +#define pr_err(fmt, arg...) __pr_printk(4, pr_fmt(fmt), ##arg) +#define pr_notice(fmt, arg...) __pr_printk(5, pr_fmt(fmt), ##arg) +#define pr_info(fmt, arg...) __pr_printk(6, pr_fmt(fmt), ##arg) +#define pr_debug(fmt, arg...) __pr_printk(7, pr_fmt(fmt), ##arg) +#define debug(fmt, arg...) __pr_printk(7, pr_fmt(fmt), ##arg) + +#endif diff --git a/lib/gui/bmp.c b/lib/gui/bmp.c index fce0e69..6bf8cd0 100644 --- a/lib/gui/bmp.c +++ b/lib/gui/bmp.c @@ -24,7 +24,7 @@ img->bits_per_pixel = le16_to_cpu(bmp->header.bit_count); pr_debug("bmp: %d x %d x %d data@0x%p\n", img->width, img->height, - img->bit_per_pixel, img->data); + img->bits_per_pixel, img->data); return img; } diff --git a/lib/xfuncs.c b/lib/xfuncs.c index 4649280..db85720 100644 --- a/lib/xfuncs.c +++ b/lib/xfuncs.c @@ -30,7 +30,7 @@ if (!(p = malloc(size))) panic("ERROR: out of memory\n"); - debug("xmalloc %p (size %d)\n", p, size); + debug("xmalloc %p (size %zu)\n", p, size); return p; } @@ -43,7 +43,7 @@ if (!(p = realloc(ptr, size))) panic("ERROR: out of memory\n"); - debug("xrealloc %p -> %p (size %d)\n", ptr, p, size); + debug("xrealloc %p -> %p (size %zu)\n", ptr, p, size); return p; }