mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Troy Benjegerdes <hozer@drgw.net>
To: Andrew Morton <akpm@zip.com.au>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	"David S. Miller" <davem@redhat.com>,
	linux-kernel@vger.kernel.org, ralf@uni-koblenz.de
Subject: Re: [patch] printk and dma_addr_t
Date: Fri, 15 Feb 2002 15:37:17 -0600	[thread overview]
Message-ID: <20020215153717.F1211@altus.drgw.net> (raw)
In-Reply-To: <20020213.013557.74564240.davem@redhat.com> <E16awZq-0004s4-00@the-village.bc.nu> <3C6A3F66.75D57124@zip.com.au>
In-Reply-To: <3C6A3F66.75D57124@zip.com.au>; from akpm@zip.com.au on Wed, Feb 13, 2002 at 02:26:46AM -0800

On Wed, Feb 13, 2002 at 02:26:46AM -0800, Andrew Morton wrote:
> Alan Cox wrote:
> > 
> > So how do they modify the printf format rules in gcc ?
> 
> Good question.  It'd be nice for NIPQUAD and such.
> 
> Here's an alternative fix.  Less vomitous?
> 
> Sorry about sticking a prototype in types.h.  It needs to be
> somewhere where all dma_addr_t users will see it, and where
> dma_addr_t is already in scope.  Maybe there's a better place?

Personally, I like this less.. I don't think the previous #define 
DMA_ADDR_T_FMT (or whatever it was) is that bad, considering the options.

Once we set the precedent of having little 'char 
* form_some_random_type()' functions, they will show up all over the 
place.

I need something like this for the MTD patch I've got that supports 64 
bit buswidths on 32 bit machines and needs to printk the data on error.

I found that #define CFI_FMT '%lx' or whatever to be more 
straightforward, and easier to understand.

> + */
> +char *form_dma_addr_t(char *buf, dma_addr_t a)
> +{
> +	char *fmt;	/* Funny code to prevent a printf warning */
> +
> +	if (sizeof(dma_addr_t) == sizeof(long))
> +		fmt = "%lx";
> +	else
> +		fmt = "%Lx";
> +
> +	sprintf(buf, fmt, a);
> +	return buf;
> +}

-- 
Troy Benjegerdes | master of mispeeling | 'da hozer' |  hozer@drgw.net
-----"If this message isn't misspelled, I didn't write it" -- Me -----
"Why do musicians compose symphonies and poets write poems? They do it
because life wouldn't have any meaning for them if they didn't. That's 
why I draw cartoons. It's my life." -- Charles Schulz

  reply	other threads:[~2002-02-15 21:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-13  9:20 Andrew Morton
2002-02-13  9:35 ` David S. Miller
2002-02-13 10:23   ` Alan Cox
2002-02-13 10:26     ` Andrew Morton
2002-02-15 21:37       ` Troy Benjegerdes [this message]
2002-02-15 21:51       ` David Woodhouse
2002-02-13 17:38     ` Richard Gooch
2002-02-13 11:36   ` David S. Miller
2002-02-13  9:40 ` Alan Cox
2002-02-13  9:33   ` Andrew Morton
2002-02-13  9:34   ` Jeff Garzik
2002-02-13  9:38     ` Andrew Morton
     [not found] <0C01A29FBAE24448A792F5C68F5EA47D2172BC@nasdaq.ms.ensim.com>
2002-02-13 19:11 ` Paul Menage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020215153717.F1211@altus.drgw.net \
    --to=hozer@drgw.net \
    --cc=akpm@zip.com.au \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@uni-koblenz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®