Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
89eda163
Commit
89eda163
authored
Feb 17, 2004
by
Keith M. Wesolowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC32] Uninline atomic_t functions to save space.
parent
7d202bd0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
41 deletions
+57
-41
arch/sparc/kernel/smp.c
arch/sparc/kernel/smp.c
+0
-3
arch/sparc/lib/Makefile
arch/sparc/lib/Makefile
+2
-2
arch/sparc/lib/atomic32.c
arch/sparc/lib/atomic32.c
+52
-0
include/asm-sparc/atomic.h
include/asm-sparc/atomic.h
+3
-36
No files found.
arch/sparc/kernel/smp.c
View file @
89eda163
...
...
@@ -56,9 +56,6 @@ int smp_activated = 0;
volatile
int
__cpu_number_map
[
NR_CPUS
];
volatile
int
__cpu_logical_map
[
NR_CPUS
];
cycles_t
cacheflush_time
=
0
;
/* XXX */
spinlock_t
__atomic_hash
[
ATOMIC_HASH_SIZE
]
=
{
[
0
...
(
ATOMIC_HASH_SIZE
-
1
)]
=
SPIN_LOCK_UNLOCKED
};
/* The only guaranteed locking primitive available on all Sparc
* processors is 'ldstub [%reg + immediate], %dest_reg' which atomically
...
...
arch/sparc/lib/Makefile
View file @
89eda163
...
...
@@ -7,5 +7,5 @@ EXTRA_AFLAGS := -ansi -DST_DIV0=0x02
lib-y
:=
mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o
\
strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o
\
strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o
\
copy_user.o locks.o atomic.o
bitops.o debuglocks.o lshrdi3
.o
\
ashldi3.o rwsem.o muldi3.o bitext.o
copy_user.o locks.o atomic.o
atomic32.o bitops.o debuglocks
.o
\
lshrdi3.o
ashldi3.o rwsem.o muldi3.o bitext.o
arch/sparc/lib/atomic32.c
0 → 100644
View file @
89eda163
/*
* atomic32.c: 32-bit atomic_t implementation
*
* Copyright (C) 2004 Keith M Wesolowski
*
* Based on asm-parisc/atomic.h Copyright (C) 2000 Philipp Rumpf
*/
#include <asm/atomic.h>
#include <linux/spinlock.h>
#include <linux/module.h>
#ifdef CONFIG_SMP
#define ATOMIC_HASH_SIZE 4
#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)])
spinlock_t
__atomic_hash
[
ATOMIC_HASH_SIZE
]
=
{
[
0
...
(
ATOMIC_HASH_SIZE
-
1
)]
=
SPIN_LOCK_UNLOCKED
};
#else
/* SMP */
#define ATOMIC_HASH_SIZE 1
#define ATOMIC_HASH(a) 0
#endif
/* SMP */
int
__atomic_add_return
(
int
i
,
atomic_t
*
v
)
{
int
ret
;
unsigned
long
flags
;
spin_lock_irqsave
(
ATOMIC_HASH
(
v
),
flags
);
ret
=
(
v
->
counter
+=
i
);
spin_unlock_irqrestore
(
ATOMIC_HASH
(
v
),
flags
);
return
ret
;
}
void
atomic_set
(
atomic_t
*
v
,
int
i
)
{
unsigned
long
flags
;
spin_lock_irqsave
(
ATOMIC_HASH
(
v
),
flags
);
v
->
counter
=
i
;
spin_unlock_irqrestore
(
ATOMIC_HASH
(
v
),
flags
);
}
EXPORT_SYMBOL
(
__atomic_add_return
);
EXPORT_SYMBOL
(
atomic_set
);
include/asm-sparc/atomic.h
View file @
89eda163
...
...
@@ -11,49 +11,16 @@
#define __ARCH_SPARC_ATOMIC__
#include <linux/config.h>
#include <linux/spinlock.h>
typedef
struct
{
volatile
int
counter
;
}
atomic_t
;
#ifdef __KERNEL__
#ifdef CONFIG_SMP
#define ATOMIC_HASH_SIZE 4
#define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)])
extern
spinlock_t
__atomic_hash
[
ATOMIC_HASH_SIZE
];
#else
/* SMP */
#define ATOMIC_HASH_SIZE 1
#define ATOMIC_HASH(a) 0
#endif
/* SMP */
static
inline
int
__atomic_add_return
(
int
i
,
atomic_t
*
v
)
{
int
ret
;
unsigned
long
flags
;
spin_lock_irqsave
(
ATOMIC_HASH
(
v
),
flags
);
ret
=
(
v
->
counter
+=
i
);
spin_unlock_irqrestore
(
ATOMIC_HASH
(
v
),
flags
);
return
ret
;
}
static
inline
void
atomic_set
(
atomic_t
*
v
,
int
i
)
{
unsigned
long
flags
;
spin_lock_irqsave
(
ATOMIC_HASH
(
v
),
flags
);
v
->
counter
=
i
;
spin_unlock_irqrestore
(
ATOMIC_HASH
(
v
),
flags
);
}
#define ATOMIC_INIT(i) { (i) }
extern
int
__atomic_add_return
(
int
,
atomic_t
*
);
extern
void
atomic_set
(
atomic_t
*
,
int
);
#define atomic_read(v) ((v)->counter)
#define atomic_add(i, v) ((void)__atomic_add_return( (int)(i), (v)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment