| .. | .. | 
|---|
| 1 |  | -/***********************************************************************  | 
|---|
| 2 |  | -* linux/kernel/time/jiffies.c  | 
|---|
| 3 |  | -*  | 
|---|
| 4 |  | -* This file contains the jiffies based clocksource.  | 
|---|
| 5 |  | -*  | 
|---|
| 6 |  | -* Copyright (C) 2004, 2005 IBM, John Stultz (johnstul@us.ibm.com)  | 
|---|
| 7 |  | -*  | 
|---|
| 8 |  | -* This program is free software; you can redistribute it and/or modify  | 
|---|
| 9 |  | -* it under the terms of the GNU General Public License as published by  | 
|---|
| 10 |  | -* the Free Software Foundation; either version 2 of the License, or  | 
|---|
| 11 |  | -* (at your option) any later version.  | 
|---|
| 12 |  | -*  | 
|---|
| 13 |  | -* This program is distributed in the hope that it will be useful,  | 
|---|
| 14 |  | -* but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
|---|
| 15 |  | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  | 
|---|
| 16 |  | -* GNU General Public License for more details.  | 
|---|
| 17 |  | -*  | 
|---|
| 18 |  | -* You should have received a copy of the GNU General Public License  | 
|---|
| 19 |  | -* along with this program; if not, write to the Free Software  | 
|---|
| 20 |  | -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  | 
|---|
| 21 |  | -*  | 
|---|
| 22 |  | -************************************************************************/  | 
|---|
 | 1 | +// SPDX-License-Identifier: GPL-2.0+  | 
|---|
 | 2 | +/*  | 
|---|
 | 3 | + * This file contains the jiffies based clocksource.  | 
|---|
 | 4 | + *  | 
|---|
 | 5 | + * Copyright (C) 2004, 2005 IBM, John Stultz (johnstul@us.ibm.com)  | 
|---|
 | 6 | + */  | 
|---|
| 23 | 7 |  #include <linux/clocksource.h> | 
|---|
| 24 | 8 |  #include <linux/jiffies.h> | 
|---|
| 25 | 9 |  #include <linux/module.h> | 
|---|
| .. | .. | 
|---|
| 74 | 58 |  	.max_cycles	= 10, | 
|---|
| 75 | 59 |  }; | 
|---|
| 76 | 60 |   | 
|---|
| 77 |  | -__cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock);  | 
|---|
 | 61 | +__cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(jiffies_lock);  | 
|---|
 | 62 | +__cacheline_aligned_in_smp seqcount_t jiffies_seq;  | 
|---|
| 78 | 63 |   | 
|---|
| 79 | 64 |  #if (BITS_PER_LONG < 64) | 
|---|
| 80 | 65 |  u64 get_jiffies_64(void) | 
|---|
| 81 | 66 |  { | 
|---|
| 82 |  | -	unsigned long seq;  | 
|---|
 | 67 | +	unsigned int seq;  | 
|---|
| 83 | 68 |  	u64 ret; | 
|---|
| 84 | 69 |   | 
|---|
| 85 | 70 |  	do { | 
|---|
| 86 |  | -		seq = read_seqbegin(&jiffies_lock);  | 
|---|
 | 71 | +		seq = read_seqcount_begin(&jiffies_seq);  | 
|---|
| 87 | 72 |  		ret = jiffies_64; | 
|---|
| 88 |  | -	} while (read_seqretry(&jiffies_lock, seq));  | 
|---|
 | 73 | +	} while (read_seqcount_retry(&jiffies_seq, seq));  | 
|---|
| 89 | 74 |  	return ret; | 
|---|
| 90 | 75 |  } | 
|---|
| 91 | 76 |  EXPORT_SYMBOL(get_jiffies_64); | 
|---|
| .. | .. | 
|---|
| 105 | 90 |  	return &clocksource_jiffies; | 
|---|
| 106 | 91 |  } | 
|---|
| 107 | 92 |   | 
|---|
| 108 |  | -struct clocksource refined_jiffies;  | 
|---|
 | 93 | +static struct clocksource refined_jiffies;  | 
|---|
| 109 | 94 |   | 
|---|
| 110 | 95 |  int register_refined_jiffies(long cycles_per_second) | 
|---|
| 111 | 96 |  { | 
|---|