From patchwork Wed Apr 19 15:23:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 752332 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w7Qld6tPZz9ryZ for ; Thu, 20 Apr 2017 01:24:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="byPzOs2x"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HO1xZ+0V"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=r/uxgoCx6Wy+jMOKmV8NarIXsihHZSdurhKqbEGu7iw=; b=byPzOs2xrlFx32lRM4QMsPMYbq flqY+lmOYV0Wn6T2f7xISKCAqcRuVWUf7WjheAFlX0ovgmBqZXpuRaFIifYPa+aTrVnez1B39mMmz Prb1m4HEtWcR6tAKhIXA8M7r7mZRQKkQoIqWB+vAvKRxVuiTXds3LfNWmJA4jUAMtfDmBeG3CNIMM ilMg9rSZSh1fGlQZeBhA55oV5gcnwlEm/FUUN7OK/PLCD6K2DNvAuVNgIyG4HhSTgxmxpXojRgZyJ TT5ydAYtvBwzwIoiydT+bYRSG6F+HkMwudE+vsMzsGCDuONKmCxwzV+gHkEvWKvcDyNmceHZ+1Iev 4nqzh+1A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d0rT1-0004GL-Hb; Wed, 19 Apr 2017 15:24:27 +0000 Received: from mail-it0-x242.google.com ([2607:f8b0:4001:c0b::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d0rSR-0003Kh-3x for linux-mtd@lists.infradead.org; Wed, 19 Apr 2017 15:23:53 +0000 Received: by mail-it0-x242.google.com with SMTP id 193so3727018itm.1 for ; Wed, 19 Apr 2017 08:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UsZqyIBlHqrr2DaAaOm1/K68gaSE1FTXejrL9/N6cIE=; b=HO1xZ+0VBshwgga6Mrbk7BHHKroImMYUSgrrTZ6IYBNROYhq/YbnzhJBMPEZhnTVXU stMqiDWEFfrffxT8KDJh0sT7KHdXx7+WTTFgcIoYNfxFXx4gS6hsFGzkVgKntdqgZZdU 3q/IAOeUKmNs5nxsnqCyToF9FkWaorPnGFUtJHcnQSd4qgXtIAl3z689thrvH/1U/Fjk TbFv0l2NDD2GR13j3KSDtZLrAlJHydhjjMOgWJCuZMCFt3buyVzKdi6whpkiGh/DeFWa tJoSaG8NWv33dwLcH8oWrDEcWgT5QwFG7NomnGjiUU+41DbfJWHgV/4f5Qso3HTrSIf5 d08Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UsZqyIBlHqrr2DaAaOm1/K68gaSE1FTXejrL9/N6cIE=; b=mo9iD1zrcpNDotXlotIbjpcvdaBEj7pKOq5RDsDHn6YjeAyQdKYTJh1XayP/RigXkY POzqiJUM6/NZ/cYFERIJtkmzPp4dT5aW8ZAjqFs/ib6N4IYxL7jIcJymbVX59yja9R78 09/icxN7+ZHRUXZZ4QfIhneH/qdOEAKbgN5hZ0sA783qFz1v90qj6iQ+ONhmG2FZ7swt 4fgR2okVH4/Qk7EKHj//fW3Wecz1qbSbAbz+V8Rq9y/Klck3mSa81lPjrPYF3yV00B/x YV2WVJPgu4S8n/SfUk3v5dIYBiMpkwxC9+FkpfTOpe8XTH3n06ePZB1gklQOLvSWU4uJ GQlw== X-Gm-Message-State: AN3rC/56pqf+iFwiLs4TcZi1NE3vq7+RwEmNRdBLOlzU5ClAd0HrpL9z c139N9xo7kDVrA== X-Received: by 10.98.137.221 with SMTP id n90mr3709574pfk.52.1492615410405; Wed, 19 Apr 2017 08:23:30 -0700 (PDT) Received: from squirtle.lan (c-73-19-0-61.hsd1.wa.comcast.net. [73.19.0.61]) by smtp.gmail.com with ESMTPSA id x65sm5301328pfb.111.2017.04.19.08.23.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 08:23:29 -0700 (PDT) From: Andrey Smirnov To: linux-mtd@lists.infradead.org Subject: [PATCH v3 3/6] mtd: dataflash: Replace pr_debug, printk with dev_* functions Date: Wed, 19 Apr 2017 08:23:02 -0700 Message-Id: <20170419152305.17226-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170419152305.17226-1-andrew.smirnov@gmail.com> References: <20170419152305.17226-1-andrew.smirnov@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170419_082351_321274_35CCFBAE X-CRM114-Status: GOOD ( 14.26 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:4001:c0b:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (andrew.smirnov[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Andrey Smirnov , Richard Weinberger , Marek Vasut , linux-kernel@vger.kernel.or, Cyrille Pitchen , Brian Norris , David Woodhouse , cphealy@gmail.com MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Lion's share of calls to pr_debug in this driver follow the pattern of pr_debug("%s ", dev_name(), ), which should be semantically identical to dev_dbg(, "", ), so replace such occurencies to simplify the code. Convert the small minority of pr_debug that do not follow pattern from above to use dev_dbg as well, for the sake of consistency. Convert similar patter of printk(KERN_ERR, "%s: ...", dev_name(...), ...) to use dev_err instead. No functional change intended. Cc: cphealy@gmail.com Cc: David Woodhouse Cc: Brian Norris Cc: Boris Brezillon Cc: Marek Vasut Cc: Richard Weinberger Cc: Cyrille Pitchen Cc: linux-kernel@vger.kernel.or Signed-off-by: Andrey Smirnov Reviewed-by: Marek Vasut --- Not present in v2, v1 drivers/mtd/devices/mtd_dataflash.c | 74 +++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 5b7a8c3..ccd1e02 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -130,8 +130,7 @@ static int dataflash_waitready(struct spi_device *spi) for (;;) { status = dataflash_status(spi); if (status < 0) { - pr_debug("%s: status %d?\n", - dev_name(&spi->dev), status); + dev_dbg(&spi->dev, "status %d?\n", status); status = 0; } @@ -157,9 +156,8 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr) u8 *command; u32 rem; - pr_debug("%s: erase addr=0x%llx len 0x%llx\n", - dev_name(&spi->dev), (long long)instr->addr, - (long long)instr->len); + dev_dbg(&spi->dev, "erase addr=0x%llx len 0x%llx\n", + (long long)instr->addr, (long long)instr->len); div_u64_rem(instr->len, priv->page_size, &rem); if (rem) @@ -192,7 +190,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr) command[2] = (u8)(pageaddr >> 8); command[3] = 0; - pr_debug("ERASE %s: (%x) %x %x %x [%i]\n", + dev_dbg(&spi->dev, "ERASE %s: (%x) %x %x %x [%i]\n", do_block ? "block" : "page", command[0], command[1], command[2], command[3], pageaddr); @@ -201,8 +199,8 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr) (void) dataflash_waitready(spi); if (status < 0) { - printk(KERN_ERR "%s: erase %x, err %d\n", - dev_name(&spi->dev), pageaddr, status); + dev_err(&spi->dev, "erase %x, err %d\n", + pageaddr, status); /* REVISIT: can retry instr->retries times; or * giveup and instr->fail_addr = instr->addr; */ @@ -243,8 +241,8 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len, u8 *command; int status; - pr_debug("%s: read 0x%x..0x%x\n", dev_name(&priv->spi->dev), - (unsigned)from, (unsigned)(from + len)); + dev_dbg(&priv->spi->dev, "read 0x%x..0x%x\n", + (unsigned int)from, (unsigned int)(from + len)); /* Calculate flash page/byte address */ addr = (((unsigned)from / priv->page_size) << priv->page_offset) @@ -252,7 +250,7 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len, command = priv->command; - pr_debug("READ: (%x) %x %x %x\n", + dev_dbg(&priv->spi->dev, "READ: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]); spi_message_init(&msg); @@ -284,8 +282,7 @@ static int dataflash_read(struct mtd_info *mtd, loff_t from, size_t len, *retlen = msg.actual_length - 8; status = 0; } else - pr_debug("%s: read %x..%x --> %d\n", - dev_name(&priv->spi->dev), + dev_dbg(&priv->spi->dev, "read %x..%x --> %d\n", (unsigned)from, (unsigned)(from + len), status); return status; @@ -311,8 +308,8 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, int status = -EINVAL; u8 *command; - pr_debug("%s: write 0x%x..0x%x\n", - dev_name(&spi->dev), (unsigned)to, (unsigned)(to + len)); + dev_dbg(&spi->dev, "write 0x%x..0x%x\n", + (unsigned int)to, (unsigned int)(to + len)); spi_message_init(&msg); @@ -329,7 +326,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, mutex_lock(&priv->lock); while (remaining > 0) { - pr_debug("write @ %i:%i len=%i\n", + dev_dbg(&spi->dev, "write @ %i:%i len=%i\n", pageaddr, offset, writelen); /* REVISIT: @@ -357,13 +354,13 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, command[2] = (addr & 0x0000FF00) >> 8; command[3] = 0; - pr_debug("TRANSFER: (%x) %x %x %x\n", + dev_dbg(&spi->dev, "TRANSFER: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]); status = spi_sync(spi, &msg); if (status < 0) - pr_debug("%s: xfer %u -> %d\n", - dev_name(&spi->dev), addr, status); + dev_dbg(&spi->dev, "xfer %u -> %d\n", + addr, status); (void) dataflash_waitready(priv->spi); } @@ -375,7 +372,7 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, command[2] = (addr & 0x0000FF00) >> 8; command[3] = (addr & 0x000000FF); - pr_debug("PROGRAM: (%x) %x %x %x\n", + dev_dbg(&spi->dev, "PROGRAM: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]); x[1].tx_buf = writebuf; @@ -384,8 +381,8 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, status = spi_sync(spi, &msg); spi_transfer_del(x + 1); if (status < 0) - pr_debug("%s: pgm %u/%u -> %d\n", - dev_name(&spi->dev), addr, writelen, status); + dev_dbg(&spi->dev, "pgm %u/%u -> %d\n", + addr, writelen, status); (void) dataflash_waitready(priv->spi); @@ -399,20 +396,20 @@ static int dataflash_write(struct mtd_info *mtd, loff_t to, size_t len, command[2] = (addr & 0x0000FF00) >> 8; command[3] = 0; - pr_debug("COMPARE: (%x) %x %x %x\n", + dev_dbg(&spi->dev, "COMPARE: (%x) %x %x %x\n", command[0], command[1], command[2], command[3]); status = spi_sync(spi, &msg); if (status < 0) - pr_debug("%s: compare %u -> %d\n", - dev_name(&spi->dev), addr, status); + dev_dbg(&spi->dev, "compare %u -> %d\n", + addr, status); status = dataflash_waitready(priv->spi); /* Check result of the compare operation */ if (status & (1 << 6)) { - printk(KERN_ERR "%s: compare page %u, err %d\n", - dev_name(&spi->dev), pageaddr, status); + dev_err(&spi->dev, "compare page %u, err %d\n", + pageaddr, status); remaining = 0; status = -EIO; break; @@ -757,8 +754,7 @@ static struct flash_info *jedec_probe(struct spi_device *spi) */ ret = spi_write_then_read(spi, &code, 1, id, 3); if (ret < 0) { - pr_debug("%s: error %d reading JEDEC ID\n", - dev_name(&spi->dev), ret); + dev_dbg(&spi->dev, "error %d reading JEDEC ID\n", ret); return ERR_PTR(ret); } @@ -775,16 +771,14 @@ static struct flash_info *jedec_probe(struct spi_device *spi) i < ARRAY_SIZE(dataflash_data); i++, info++) { if (info->jedec_id == jedec) { - pr_debug("%s: OTP, sector protect%s\n", - dev_name(&spi->dev), - (info->flags & SUP_POW2PS) - ? ", binary pagesize" : "" - ); + dev_dbg(&spi->dev, "OTP, sector protect%s\n", + (info->flags & SUP_POW2PS) ? + ", binary pagesize" : ""); if (info->flags & SUP_POW2PS) { status = dataflash_status(spi); if (status < 0) { - pr_debug("%s: status error %d\n", - dev_name(&spi->dev), status); + dev_dbg(&spi->dev, "status error %d\n", + status); return ERR_PTR(status); } if (status & 0x1) { @@ -848,8 +842,7 @@ static int dataflash_probe(struct spi_device *spi) */ status = dataflash_status(spi); if (status <= 0 || status == 0xff) { - pr_debug("%s: status error %d\n", - dev_name(&spi->dev), status); + dev_dbg(&spi->dev, "status error %d\n", status); if (status == 0 || status == 0xff) status = -ENODEV; return status; @@ -890,8 +883,7 @@ static int dataflash_probe(struct spi_device *spi) } if (status < 0) - pr_debug("%s: add_dataflash --> %d\n", dev_name(&spi->dev), - status); + dev_dbg(&spi->dev, "add_dataflash --> %d\n", status); return status; } @@ -901,7 +893,7 @@ static int dataflash_remove(struct spi_device *spi) struct dataflash *flash = spi_get_drvdata(spi); int status; - pr_debug("%s: remove\n", dev_name(&spi->dev)); + dev_dbg(&spi->dev, "remove\n"); status = mtd_device_unregister(&flash->mtd); if (status == 0)