From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760453Ab2DKO6H (ORCPT ); Wed, 11 Apr 2012 10:58:07 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:55810 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754760Ab2DKO6F convert rfc822-to-8bit (ORCPT ); Wed, 11 Apr 2012 10:58:05 -0400 MIME-Version: 1.0 In-Reply-To: References: <1334016417-18748-1-git-send-email-ddaney.cavm@gmail.com> <20120411070332.6F3C03E081E@localhost> From: Grant Likely Date: Wed, 11 Apr 2012 08:57:44 -0600 X-Google-Sender-Auth: QlIbELjB7IgdRR9BIqDiF5-OAQU Message-ID: Subject: Re: [PATCH] iqrdomain: Improve formatting in debugfs. To: Andreas Schwab Cc: David Daney , Benjamin Herrenschmidt , Thomas Gleixner , linux-kernel@vger.kernel.org, David Daney Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 11, 2012 at 8:52 AM, Grant Likely wrote: > On Wed, Apr 11, 2012 at 3:16 AM, Andreas Schwab wrote: >> Grant Likely writes: >> >>> @@ -667,7 +667,7 @@ static int virq_debug_show(struct seq_file *m, void *private) >>>                       seq_printf(m, "%-15s  ", p); >>> >>>                       data = irq_desc_get_chip_data(desc); >>> -                     seq_printf(m, "0x%16p  ", data); >>> +                     seq_printf(m, data ? "0x%p  " : "  %p  ", data); >> >> You should be able to use %#p instead to let it add the prefix. > > That mostly works, but it doesn't round up the field size to account > for the 2 characters in '0x'.  Looks like the %p code needs to be > tweaked to fix that. which this change does: diff --git a/lib/vsprintf.c b/lib/vsprintf.c index abbabec..4c4f2ce 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -946,6 +946,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, if (spec.field_width == -1) { spec.field_width = 2 * sizeof(void *); spec.flags |= ZEROPAD; + if (spec.flags & SPECIAL) + spec.field_width += 2; } spec.base = 16;