From patchwork Fri Mar 21 16:37:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 3875471 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 957649F382 for ; Fri, 21 Mar 2014 16:45:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF7E92025B for ; Fri, 21 Mar 2014 16:45:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA0E920259 for ; Fri, 21 Mar 2014 16:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754143AbaCUQp0 (ORCPT ); Fri, 21 Mar 2014 12:45:26 -0400 Received: from smtprelay0030.hostedemail.com ([216.40.44.30]:44626 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752673AbaCUQpZ (ORCPT ); Fri, 21 Mar 2014 12:45:25 -0400 X-Greylist: delayed 481 seconds by postgrey-1.27 at vger.kernel.org; Fri, 21 Mar 2014 12:45:25 EDT Received: from smtprelay.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtpgrave04.hostedemail.com (Postfix) with ESMTP id A3F8AB2A4E for ; Fri, 21 Mar 2014 16:37:33 +0000 (UTC) Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id AD16AC2120; Fri, 21 Mar 2014 16:37:22 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::::::::, RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2689:2729:2828:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3871:3872:3874:4225:4321:5007:7652:7875:7903:10004:10400:10471:10848:10946:11026:11232:11658:11914:12043:12438:12517:12519:12555:12740:13255:14093:14097, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: end10_7a5c8872e2f18 X-Filterd-Recvd-Size: 3930 Received: from [192.168.1.151] (pool-96-251-49-11.lsanca.fios.verizon.net [96.251.49.11]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Fri, 21 Mar 2014 16:37:20 +0000 (UTC) Message-ID: <1395419839.7776.108.camel@joe-AO722> Subject: rfc: vsprintf and phys_addr_t and dma_addr_t via %pa (was Re: [PATCH] spi: fix spi-atmel.c printk format warnings) From: Joe Perches To: Randy Dunlap , Stepan Moskovchenko Cc: Mark Brown , LKML , linux-spi@vger.kernel.org, Wenyou Yang , Nicolas Ferre , Andrew Morton Date: Fri, 21 Mar 2014 09:37:19 -0700 In-Reply-To: <532C6085.9070203@infradead.org> References: <532C6085.9070203@infradead.org> X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP (Adding Stepan Moskovchenko who added %pa to vsprintf) On Fri, 2014-03-21 at 08:53 -0700, Randy Dunlap wrote: > Fix printk format warning by using %p extension 'ad' for dma_addr_t. Hey Randy, Stepan and everyone else as well. One of the things I'd like to get straightened out before too many of these dma_addr_t conversions are done is whether or not it should be prefixed by 0x. %pad is not a direct replacement for %08x or %016x. It changes the output. Right now, all phys_addr_t and dma_addr_t types emitted using %pa[pd] are "SPECIAL", meaning these are prefixed with "0x". No other pointer/address types have that "0x" prefix. I'd prefer to remove the "SPECIAL" from the %pa extension so that the output form of pointer/address types are consistent. This would change several output lines already using %pa. I don't think that's bad, but maybe others do. Thoughts? --- lib/vsprintf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) > drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Wformat] > drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t' [-Wformat] > > Signed-off-by: Randy Dunlap > Cc: Wenyou Yang > Cc: Nicolas Ferre > --- > drivers/spi/spi-atmel.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > I thought that a patch for this was already posted but I can't find it... > Applies to mainline. > > --- linux-next-20140321.orig/drivers/spi/spi-atmel.c > +++ linux-next-20140321/drivers/spi/spi-atmel.c > @@ -1226,10 +1226,10 @@ static int atmel_spi_transfer_one_messag > > list_for_each_entry(xfer, &msg->transfers, transfer_list) { > dev_dbg(&spi->dev, > - " xfer %p: len %u tx %p/%08x rx %p/%08x\n", > + " xfer %p: len %u tx %p/%pad rx %p/%pad\n", > xfer, xfer->len, > - xfer->tx_buf, xfer->tx_dma, > - xfer->rx_buf, xfer->rx_dma); > + xfer->tx_buf, &xfer->tx_dma, > + xfer->rx_buf, &xfer->rx_dma); > } -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 185b6d3..28fee91 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1161,18 +1161,18 @@ char *address_val(char *buf, char *end, const void *addr, { unsigned long long num; - spec.flags |= SPECIAL | SMALL | ZEROPAD; + spec.flags |= SMALL | ZEROPAD; spec.base = 16; switch (fmt[1]) { case 'd': num = *(const dma_addr_t *)addr; - spec.field_width = sizeof(dma_addr_t) * 2 + 2; + spec.field_width = sizeof(dma_addr_t) * 2; break; case 'p': default: num = *(const phys_addr_t *)addr; - spec.field_width = sizeof(phys_addr_t) * 2 + 2; + spec.field_width = sizeof(phys_addr_t) * 2; break; }