* [PATCH] Fix 64bit bugs in dscc44.c
@ 2003-10-07 17:59 Andi Kleen
2003-10-07 21:48 ` [PATCH] Fix 64bit bugs in dscc4.c Francois Romieu
2003-10-08 15:42 ` [PATCH] Fix 64bit bugs in dscc44.c David S. Miller
0 siblings, 2 replies; 12+ messages in thread
From: Andi Kleen @ 2003-10-07 17:59 UTC (permalink / raw)
To: ncorbic; +Cc: netdev, davem
ioremap_nocache returns unsigned long, not u32. This makes a difference
on 64bit hosts.
-Andi
diff -u linux-2.5-cleanup/drivers/net/wan/dscc4.c-o linux-2.5-cleanup/drivers/net/wan/dscc4.c
--- linux-2.5-cleanup/drivers/net/wan/dscc4.c-o 2003-12-01 14:04:34.000000000 +0100
+++ linux-2.5-cleanup/drivers/net/wan/dscc4.c 2003-12-02 16:55:14.298508864 +0100
@@ -980,7 +980,7 @@
*
* This code doesn't need to be efficient. Keep It Simple
*/
-static void dscc4_pci_reset(struct pci_dev *pdev, u32 ioaddr)
+static void dscc4_pci_reset(struct pci_dev *pdev, unsigned long ioaddr)
{
int i;
@@ -1461,7 +1461,8 @@
struct dscc4_dev_priv *root = token;
struct dscc4_pci_priv *priv;
struct net_device *dev;
- u32 ioaddr, state;
+ unsigned long ioaddr;
+ u32 state;
unsigned long flags;
int i, handled = 1;
@@ -1613,7 +1614,7 @@
goto try;
}
if (state & Xpr) {
- u32 scc_addr, ring;
+ unsigned long scc_addr, ring;
int i;
/*
@@ -1954,7 +1955,7 @@
{
struct dscc4_pci_priv *ppriv;
struct dscc4_dev_priv *root;
- u32 ioaddr;
+ unsigned long ioaddr;
int i;
ppriv = pci_get_drvdata(pdev);
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc4.c
2003-10-07 17:59 [PATCH] Fix 64bit bugs in dscc44.c Andi Kleen
@ 2003-10-07 21:48 ` Francois Romieu
2003-10-08 15:42 ` [PATCH] Fix 64bit bugs in dscc44.c David S. Miller
1 sibling, 0 replies; 12+ messages in thread
From: Francois Romieu @ 2003-10-07 21:48 UTC (permalink / raw)
To: Andi Kleen; +Cc: ncorbic, netdev, davem
Andi Kleen <ak@muc.de> :
[...]
> ioremap_nocache returns unsigned long, not u32. This makes a difference
> on 64bit hosts.
No 64 bit host to test the patch but it looks fine.
--
Ueimor - happily maintaining dscc4 driver since 2.4.3
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c
2003-10-07 17:59 [PATCH] Fix 64bit bugs in dscc44.c Andi Kleen
2003-10-07 21:48 ` [PATCH] Fix 64bit bugs in dscc4.c Francois Romieu
@ 2003-10-08 15:42 ` David S. Miller
2003-10-08 15:55 ` Andi Kleen
1 sibling, 1 reply; 12+ messages in thread
From: David S. Miller @ 2003-10-08 15:42 UTC (permalink / raw)
To: Andi Kleen; +Cc: ncorbic, netdev
On Tue, 7 Oct 2003 19:59:53 +0200
Andi Kleen <ak@muc.de> wrote:
> ioremap_nocache returns unsigned long, not u32. This makes a difference
> on 64bit hosts.
Incorrect, like ioremap() it returns "void *".
Even your x86_64 implementation does this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c
2003-10-08 15:42 ` [PATCH] Fix 64bit bugs in dscc44.c David S. Miller
@ 2003-10-08 15:55 ` Andi Kleen
2003-10-08 16:01 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Andi Kleen @ 2003-10-08 15:55 UTC (permalink / raw)
To: David S. Miller; +Cc: Andi Kleen, ncorbic, netdev
On Wed, Oct 08, 2003 at 08:42:05AM -0700, David S. Miller wrote:
> On Tue, 7 Oct 2003 19:59:53 +0200
> Andi Kleen <ak@muc.de> wrote:
>
> > ioremap_nocache returns unsigned long, not u32. This makes a difference
> > on 64bit hosts.
>
> Incorrect, like ioremap() it returns "void *".
I knew someone would nit pick this ;-)
I agree it would have been better to write:
"ioremap and ioremap_nocache return pointers and that should
be stored in a pointer variable. However when you really want
to store them in a integer variable for unknown reasons always
use unsigned long, not u32 or int"
However that was just too long, so I didn't write it.
-Andi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c
2003-10-08 15:55 ` Andi Kleen
@ 2003-10-08 16:01 ` David S. Miller
2003-10-08 16:08 ` Andi Kleen
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2003-10-08 16:01 UTC (permalink / raw)
To: Andi Kleen; +Cc: ak, ncorbic, netdev
On Wed, 8 Oct 2003 17:55:48 +0200
Andi Kleen <ak@suse.de> wrote:
> I agree it would have been better to write:
> "ioremap and ioremap_nocache return pointers and that should
> be stored in a pointer variable. However when you really want
> to store them in a integer variable for unknown reasons always
> use unsigned long, not u32 or int"
>
> However that was just too long, so I didn't write it.
Don't replace one error with a new warning, just add the cast
to the ioremap() call or something like that.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c
2003-10-08 16:01 ` David S. Miller
@ 2003-10-08 16:08 ` Andi Kleen
2003-10-08 16:11 ` [PATCH] Fix 64bit bugs in dscc44.c II Andi Kleen
0 siblings, 1 reply; 12+ messages in thread
From: Andi Kleen @ 2003-10-08 16:08 UTC (permalink / raw)
To: David S. Miller; +Cc: Andi Kleen, ak, ncorbic, netdev
On Wed, Oct 08, 2003 at 09:01:32AM -0700, David S. Miller wrote:
> On Wed, 8 Oct 2003 17:55:48 +0200
> Andi Kleen <ak@suse.de> wrote:
>
> > I agree it would have been better to write:
> > "ioremap and ioremap_nocache return pointers and that should
> > be stored in a pointer variable. However when you really want
> > to store them in a integer variable for unknown reasons always
> > use unsigned long, not u32 or int"
> >
> > However that was just too long, so I didn't write it.
>
> Don't replace one error with a new warning, just add the cast
> to the ioremap() call or something like that.
I don't particularly care about the warning, just that it will
obviously crash on a 64bit box when loaded. My change was the simplest
possible fix for that. I have no plans to rewrite this driver
or something.
-Andi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c II
2003-10-08 16:11 ` [PATCH] Fix 64bit bugs in dscc44.c II Andi Kleen
@ 2003-10-08 16:10 ` David S. Miller
2003-10-08 16:33 ` Andi Kleen
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2003-10-08 16:10 UTC (permalink / raw)
To: Andi Kleen; +Cc: ak, ak, ncorbic, netdev
> BTW my change fixed the warning.
I know, but it added a new one.
> It's somewhat ugly to store pointers in unsigned long I agree,
I have _NO_ problem with this, all I'm asking you to do is:
- foo = ioremap_nocache(...);
+ foo = (unsigned long) ioremap_nocache(...);
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c II
2003-10-08 16:08 ` Andi Kleen
@ 2003-10-08 16:11 ` Andi Kleen
2003-10-08 16:10 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Andi Kleen @ 2003-10-08 16:11 UTC (permalink / raw)
To: Andi Kleen; +Cc: David S. Miller, ak, ncorbic, netdev
> I don't particularly care about the warning, just that it will
> obviously crash on a 64bit box when loaded. My change was the simplest
> possible fix for that. I have no plans to rewrite this driver
> or something.
BTW my change fixed the warning.
It's somewhat ugly to store pointers in unsigned long I agree,
but it's hard to blame the driver author when this cruft is even
enshrined in fundamental interfaces (__get_free_pages/__free_pages)
-Andi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c II
2003-10-08 16:33 ` Andi Kleen
@ 2003-10-08 16:31 ` David S. Miller
2003-10-08 17:00 ` Andi Kleen
0 siblings, 1 reply; 12+ messages in thread
From: David S. Miller @ 2003-10-08 16:31 UTC (permalink / raw)
To: Andi Kleen; +Cc: ak, ak, ncorbic, netdev
On Wed, 8 Oct 2003 18:33:45 +0200
Andi Kleen <ak@suse.de> wrote:
> Just do that then when you apply the patch. Would have been faster
> than to write all these emails ;-)
I deleted the original patch, so you have to resend it to
me anyways, so please make the fix I've suggested as you
do this.
When I ask you to do these small fixes, I don't do it to make your
life miserable, I do it because it allows me to review and apply
patches at a higher rate and scale better.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c II
2003-10-08 16:10 ` David S. Miller
@ 2003-10-08 16:33 ` Andi Kleen
2003-10-08 16:31 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Andi Kleen @ 2003-10-08 16:33 UTC (permalink / raw)
To: David S. Miller; +Cc: Andi Kleen, ak, ncorbic, netdev
On Wed, Oct 08, 2003 at 09:10:50AM -0700, David S. Miller wrote:
> > BTW my change fixed the warning.
>
> I know, but it added a new one.
>
> > It's somewhat ugly to store pointers in unsigned long I agree,
>
> I have _NO_ problem with this, all I'm asking you to do is:
>
> - foo = ioremap_nocache(...);
> + foo = (unsigned long) ioremap_nocache(...);
Just do that then when you apply the patch. Would have been faster
than to write all these emails ;-)
-Andi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c II
2003-10-08 17:00 ` Andi Kleen
@ 2003-10-08 16:59 ` David S. Miller
0 siblings, 0 replies; 12+ messages in thread
From: David S. Miller @ 2003-10-08 16:59 UTC (permalink / raw)
To: Andi Kleen; +Cc: ak, ak, ncorbic, netdev
On Wed, 8 Oct 2003 19:00:05 +0200
Andi Kleen <ak@suse.de> wrote:
> Here's the patch again.
Applied, thanks Andi.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fix 64bit bugs in dscc44.c II
2003-10-08 16:31 ` David S. Miller
@ 2003-10-08 17:00 ` Andi Kleen
2003-10-08 16:59 ` David S. Miller
0 siblings, 1 reply; 12+ messages in thread
From: Andi Kleen @ 2003-10-08 17:00 UTC (permalink / raw)
To: David S. Miller; +Cc: Andi Kleen, ak, ncorbic, netdev
On Wed, Oct 08, 2003 at 09:31:53AM -0700, David S. Miller wrote:
> On Wed, 8 Oct 2003 18:33:45 +0200
> Andi Kleen <ak@suse.de> wrote:
>
> > Just do that then when you apply the patch. Would have been faster
> > than to write all these emails ;-)
>
> I deleted the original patch, so you have to resend it to
> me anyways, so please make the fix I've suggested as you
> do this.
>
> When I ask you to do these small fixes, I don't do it to make your
> life miserable, I do it because it allows me to review and apply
> patches at a higher rate and scale better.
At least for such one liner changes it doesn't look like an effective
method (I bet you could have done the change quicker than typing
the first mail).
I checked the code and the code was already using a unsigned long
cast, so no changes are needed. Just the variable it stored the
pointer in was wrong.
Here's the patch again.
---------------------------
Fix 64bit issues in dscc4
diff -u linux-2.5-cleanup/drivers/net/wan/dscc4.c-o linux-2.5-cleanup/drivers/net/wan/dscc4.c
--- linux-2.5-cleanup/drivers/net/wan/dscc4.c-o 2003-12-01 14:04:34.000000000 +0100
+++ linux-2.5-cleanup/drivers/net/wan/dscc4.c 2003-12-02 16:55:14.298508864 +0100
@@ -980,7 +980,7 @@
*
* This code doesn't need to be efficient. Keep It Simple
*/
-static void dscc4_pci_reset(struct pci_dev *pdev, u32 ioaddr)
+static void dscc4_pci_reset(struct pci_dev *pdev, unsigned long ioaddr)
{
int i;
@@ -1461,7 +1461,8 @@
struct dscc4_dev_priv *root = token;
struct dscc4_pci_priv *priv;
struct net_device *dev;
- u32 ioaddr, state;
+ unsigned long ioaddr;
+ u32 state;
unsigned long flags;
int i, handled = 1;
@@ -1613,7 +1614,7 @@
goto try;
}
if (state & Xpr) {
- u32 scc_addr, ring;
+ unsigned long scc_addr, ring;
int i;
/*
@@ -1954,7 +1955,7 @@
{
struct dscc4_pci_priv *ppriv;
struct dscc4_dev_priv *root;
- u32 ioaddr;
+ unsigned long ioaddr;
int i;
ppriv = pci_get_drvdata(pdev);
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2003-10-08 17:00 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-07 17:59 [PATCH] Fix 64bit bugs in dscc44.c Andi Kleen
2003-10-07 21:48 ` [PATCH] Fix 64bit bugs in dscc4.c Francois Romieu
2003-10-08 15:42 ` [PATCH] Fix 64bit bugs in dscc44.c David S. Miller
2003-10-08 15:55 ` Andi Kleen
2003-10-08 16:01 ` David S. Miller
2003-10-08 16:08 ` Andi Kleen
2003-10-08 16:11 ` [PATCH] Fix 64bit bugs in dscc44.c II Andi Kleen
2003-10-08 16:10 ` David S. Miller
2003-10-08 16:33 ` Andi Kleen
2003-10-08 16:31 ` David S. Miller
2003-10-08 17:00 ` Andi Kleen
2003-10-08 16:59 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).