Skip to contentSkip to conversation

sparc: rename atomic_add_unless

DISCUSSION Applied Josip Rodin 4 participants 7 messages Jul 28, 2011 – Aug 4, 2011 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

Hi,

This patch[0] seems to fix a build issue, but it doesn't fix the functionality - the previous change[1] changed the return value semantics, it's now supposed to be to be just the old value, rather than a comparison.

[0] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hg8624e401b0b7747762b5223fb23f86dcdacc93
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hò4219b4e90cf70ec4a211b17fbabc725a0ddf3c

Signature · 1 line
     2. That which causes joy or happiness.
#1 lore raw

Hi,

Quoted 7 lines · On Thu, 28 Jul 2011 12:40:17 +0200 Josip Rodin <[email protected]> wrote:

This patch[0] seems to fix a build issue, but it doesn't fix the functionality - the previous change[1] changed the return value semantics, it's now supposed to be to be just the old value, rather than a comparison.

[0] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=678624e401b0b7747762b5223fb23f86dcdacc93
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f24219b4e90cf70ec4a211b17fbabc725a0ddf3c

Ooops, sorry about that. Thanks for pointing it out.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
maintainer
#2 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Thu, 28 Jul 2011 12:40:17 +0200

Quoted 6 lines

This patch[0] seems to fix a build issue, but it doesn't fix the functionality - the previous change[1] changed the return value semantics, it's now supposed to be to be just the old value, rather than a comparison.

[0] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hg8624e401b0b7747762b5223fb23f86dcdacc93
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hò4219b4e90cf70ec4a211b17fbabc725a0ddf3c

Stephen please post a fix for this before a 32-bit sparc person loses their filesystem or worse.

The return value semantics have changed for this function, you can't just put two underscores in front of the name, export the symbol, and say "Ship it!" :-)

#3 lore raw
In reply to Josip Rodin

Hi Dave,

Quoted 8 lines · On Thu, 04 Aug 2011 01:21:46 -0700 (PDT) David Miller <[email protected]>…

From: Josip Rodin <[email protected]>
Date: Thu, 28 Jul 2011 12:40:17 +0200

Quoted 4 lines

This patch[0] seems to fix a build issue, but it doesn't fix the functionality - the previous change[1] changed the return value semantics, it's now supposed to be to be just the old value, rather than a comparison.

Quoted 5 lines
Quoted 2 lines

[0] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=678624e401b0b7747762b5223fb23f86dcdacc93
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f24219b4e90cf70ec4a211b17fbabc725a0ddf3c

Stephen please post a fix for this before a 32-bit sparc person loses their filesystem or worse.

Um, I could try to figure out how to do that, but what I did was respond in July 29 to the message above cc'ing the author of the orignal patch in the hope that they would write a fix. Clearly that hope was in vain :-(

Quoted 3 lines

The return value semantics have changed for this function, you can't just put two underscores in front of the name, export the symbol, and say "Ship it!" :-)

Well, I never actaully said that about my original build fix patch. :-(

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#4 lore raw
In reply to Josip Rodin
Quoted 14 lines · Stephen Rothwell

Hi Dave,

Quoted 11 lines · On Thu, 04 Aug 2011 01:21:46 -0700 (PDT) David Miller <[email protected]>…

From: Josip Rodin <[email protected]>
Date: Thu, 28 Jul 2011 12:40:17 +0200

Quoted 6 lines

This patch[0] seems to fix a build issue, but it doesn't fix the functionality - the previous change[1] changed the return value semantics, it's now supposed to be to be just the old value, rather than a comparison.

[0] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hg8624e401b0b7747762b5223fb23f86dcdacc93
[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hò4219b4e90cf70ec4a211b17fbabc725a0ddf3c

Quoted 6 lines
Quoted 2 lines

Stephen please post a fix for this before a 32-bit sparc person loses their filesystem or worse.

Um, I could try to figure out how to do that, but what I did was respond in July 29 to the message above cc'ing the author of the orignal patch in the hope that they would write a fix. Clearly that hope was in vain :-(

It should be fairly trivial:

arch/sparc/lib/atomic32.c +1 -1
index 8600eb2..1d32b54 100644
@@ -65,7 +65,7 @@ int __atomic_add_unless(atomic_t *v, int a, int u)
        if (ret != u)
                v->counter += a;
        spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
-       return ret != u;
+       return ret;
 }
 EXPORT_SYMBOL(__atomic_add_unless);
 
Signature · 1 line
     2. That which causes joy or happiness.
maintainer Applied
#5 lore raw
In reply to Josip Rodin

From: Josip Rodin <[email protected]>
Date: Thu, 4 Aug 2011 11:43:15 +0200

Quoted 7 lines

It should be fairly trivial:

arch/sparc/lib/atomic32.c +0 -0
index 8600eb2..1d32b54 100644

arch/sparc/lib/atomic32.c int __atomic_add_unless(atomic_t *v, int a, int u) · line 70

Quoted 7 lines
arch/sparc/lib/atomic32.c +1 -1
@@ -65,7 +65,7 @@ int __atomic_add_unless(atomic_t *v, int a, int u)
        if (ret != u)
                v->counter += a;
        spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
-       return ret != u;
+       return ret;
 }
 EXPORT_SYMBOL(__atomic_add_unless);

Applied, thanks Josip.

#6 lore raw
In reply to Josip Rodin
Quoted 6 lines · Stephen Rothwell
Quoted 2 lines

Stephen please post a fix for this before a 32-bit sparc person loses their filesystem or worse.

Um, I could try to figure out how to do that, but what I did was respond in July 29 to the message above cc'ing the author of the orignal patch in the hope that they would write a fix. Clearly that hope was in vain :-(

I was on vacation for a few weeks and got buried under email. The patch looks right to me. Thanks for fixing Josip!

-Arun