Skip to content

Commit 532d0fa

Browse files
cfd-36Linus Torvalds
authored andcommitted
uml: eliminate hz()
Eliminate hz() since its only purpose was to provide a kernel-space constant to userspace code. This can be done instead by providing the constant directly through kernel_constants.h. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 088bec4 commit 532d0fa

5 files changed

Lines changed: 8 additions & 12 deletions

File tree

‎arch/um/include/common-offsets.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ DEFINE(UM_GFP_ATOMIC, GFP_ATOMIC);
3232
DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
3333

3434
DEFINE(UM_THREAD_SIZE, THREAD_SIZE);
35+
36+
DEFINE(UM_HZ, HZ);

‎arch/um/include/kern_util.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ extern void paging_init(void);
6464
extern void init_flush_vm(void);
6565
extern void *syscall_sp(void *t);
6666
extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);
67-
extern int hz(void);
6867
extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs);
6968
extern void interrupt_end(void);
7069
extern void initial_thread_cb(void (*proc)(void *), void *arg);

‎arch/um/kernel/time.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
#include "kern_util.h"
1212
#include "os.h"
1313

14-
int hz(void)
15-
{
16-
return HZ;
17-
}
18-
1914
/*
2015
* Scheduler clock - returns current time in nanosec units.
2116
*/

‎arch/um/os-Linux/skas/process.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,9 @@ int copy_context_skas0(unsigned long new_stack, int pid)
392392
*data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset),
393393
.fd = new_fd,
394394
.timer = ((struct itimerval)
395-
{ { 0, 1000000 / hz() },
396-
{ 0, 1000000 / hz() }})});
395+
{ { 0, 1000000 / UM_HZ },
396+
{ 0, 1000000 / UM_HZ }})
397+
});
397398
err = ptrace_setregs(pid, thread_regs);
398399
if (err < 0)
399400
panic("copy_context_skas0 : PTRACE_SETREGS failed, "

‎arch/um/os-Linux/time.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
#include <signal.h>
99
#include <time.h>
1010
#include <sys/time.h>
11-
#include "kern_util.h"
1211
#include "kern_constants.h"
1312
#include "os.h"
1413
#include "user.h"
1514

1615
int set_interval(int is_virtual)
1716
{
18-
int usec = 1000000/hz();
17+
int usec = 1000000/UM_HZ;
1918
int timer_type = is_virtual ? ITIMER_VIRTUAL : ITIMER_REAL;
2019
struct itimerval interval = ((struct itimerval) { { 0, usec },
2120
{ 0, usec } });
@@ -43,8 +42,8 @@ void disable_timer(void)
4342
void switch_timers(int to_real)
4443
{
4544
struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
46-
struct itimerval enable = ((struct itimerval) { { 0, 1000000/hz() },
47-
{ 0, 1000000/hz() }});
45+
struct itimerval enable = ((struct itimerval) { { 0, 1000000/UM_HZ },
46+
{ 0, 1000000/UM_HZ }});
4847
int old, new;
4948

5049
if (to_real) {

0 commit comments

Comments
 (0)