Skip to content

Commit b152688

Browse files
treewide: Remove system_counterval_t.cs, which is never read
The clocksource pointer in struct system_counterval_t is not evaluated any more. Remove the code setting the member, and the member itself. Signed-off-by: Peter Hilber <peter.hilber@opensynergy.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240201010453.2212371-8-peter.hilber@opensynergy.com
1 parent 4b7f521 commit b152688

7 files changed

Lines changed: 5 additions & 27 deletions

File tree

arch/x86/kernel/tsc.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ static int __read_mostly tsc_force_recalibrate;
5353
static u32 art_to_tsc_numerator;
5454
static u32 art_to_tsc_denominator;
5555
static u64 art_to_tsc_offset;
56-
static struct clocksource *art_related_clocksource;
5756
static bool have_art;
5857

5958
struct cyc2ns {
@@ -1313,7 +1312,6 @@ struct system_counterval_t convert_art_to_tsc(u64 art)
13131312
res += tmp + art_to_tsc_offset;
13141313

13151314
return (struct system_counterval_t) {
1316-
.cs = art_related_clocksource,
13171315
.cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC,
13181316
.cycles = res,
13191317
};
@@ -1337,9 +1335,6 @@ EXPORT_SYMBOL(convert_art_to_tsc);
13371335
* corresponding clocksource:
13381336
* cycles: System counter value
13391337
* cs_id: The clocksource ID for validating comparability
1340-
* cs: Clocksource corresponding to system counter value. Used
1341-
* by timekeeping code to verify comparability of two cycle
1342-
* values.
13431338
*/
13441339

13451340
struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns)
@@ -1355,7 +1350,6 @@ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns)
13551350
res += tmp;
13561351

13571352
return (struct system_counterval_t) {
1358-
.cs = art_related_clocksource,
13591353
.cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC,
13601354
.cycles = res,
13611355
};
@@ -1464,10 +1458,8 @@ static void tsc_refine_calibration_work(struct work_struct *work)
14641458
if (tsc_unstable)
14651459
goto unreg;
14661460

1467-
if (boot_cpu_has(X86_FEATURE_ART)) {
1468-
art_related_clocksource = &clocksource_tsc;
1461+
if (boot_cpu_has(X86_FEATURE_ART))
14691462
have_art = true;
1470-
}
14711463
clocksource_register_khz(&clocksource_tsc, tsc_khz);
14721464
unreg:
14731465
clocksource_unregister(&clocksource_tsc_early);
@@ -1492,10 +1484,8 @@ static int __init init_tsc_clocksource(void)
14921484
* the refined calibration and directly register it as a clocksource.
14931485
*/
14941486
if (boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ)) {
1495-
if (boot_cpu_has(X86_FEATURE_ART)) {
1496-
art_related_clocksource = &clocksource_tsc;
1487+
if (boot_cpu_has(X86_FEATURE_ART))
14971488
have_art = true;
1498-
}
14991489
clocksource_register_khz(&clocksource_tsc, tsc_khz);
15001490
clocksource_unregister(&clocksource_tsc_early);
15011491

drivers/clocksource/arm_arch_timer.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,6 @@ TIMER_ACPI_DECLARE(arch_timer, ACPI_SIG_GTDT, arch_timer_acpi_init);
18071807
#endif
18081808

18091809
int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts,
1810-
struct clocksource **cs,
18111810
enum clocksource_ids *cs_id)
18121811
{
18131812
struct arm_smccc_res hvc_res;
@@ -1832,8 +1831,6 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *ts,
18321831
*ts = ktime_to_timespec64(ktime);
18331832
if (cycle)
18341833
*cycle = (u64)hvc_res.a2 << 32 | hvc_res.a3;
1835-
if (cs)
1836-
*cs = &clocksource_counter;
18371834
if (cs_id)
18381835
*cs_id = CSID_ARM_ARCH_COUNTER;
18391836

drivers/ptp/ptp_kvm_arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ void kvm_arch_ptp_exit(void)
2828

2929
int kvm_arch_ptp_get_clock(struct timespec64 *ts)
3030
{
31-
return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL, NULL);
31+
return kvm_arch_ptp_get_crosststamp(NULL, ts, NULL);
3232
}

drivers/ptp/ptp_kvm_common.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,13 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time,
3030
{
3131
enum clocksource_ids cs_id;
3232
struct timespec64 tspec;
33-
struct clocksource *cs;
3433
u64 cycle;
3534
int ret;
3635

3736
spin_lock(&kvm_ptp_lock);
3837

3938
preempt_disable_notrace();
40-
ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs, &cs_id);
39+
ret = kvm_arch_ptp_get_crosststamp(&cycle, &tspec, &cs_id);
4140
if (ret) {
4241
spin_unlock(&kvm_ptp_lock);
4342
preempt_enable_notrace();
@@ -47,7 +46,6 @@ static int ptp_kvm_get_time_fn(ktime_t *device_time,
4746
preempt_enable_notrace();
4847

4948
system_counter->cycles = cycle;
50-
system_counter->cs = cs;
5149
system_counter->cs_id = cs_id;
5250

5351
*device_time = timespec64_to_ktime(tspec);

drivers/ptp/ptp_kvm_x86.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ int kvm_arch_ptp_get_clock(struct timespec64 *ts)
9393
}
9494

9595
int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec,
96-
struct clocksource **cs,
9796
enum clocksource_ids *cs_id)
9897
{
9998
struct pvclock_vcpu_time_info *src;
@@ -124,7 +123,6 @@ int kvm_arch_ptp_get_crosststamp(u64 *cycle, struct timespec64 *tspec,
124123
*cycle = __pvclock_read_cycles(src, clock_pair->tsc);
125124
} while (pvclock_read_retry(src, version));
126125

127-
*cs = &kvm_clock;
128126
*cs_id = CSID_X86_KVM_CLK;
129127

130128
return 0;

include/linux/ptp_kvm.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
#include <linux/types.h>
1313

1414
struct timespec64;
15-
struct clocksource;
1615

1716
int kvm_arch_ptp_init(void);
1817
void kvm_arch_ptp_exit(void);
1918
int kvm_arch_ptp_get_clock(struct timespec64 *ts);
2019
int kvm_arch_ptp_get_crosststamp(u64 *cycle,
21-
struct timespec64 *tspec, struct clocksource **cs,
22-
enum clocksource_ids *cs_id);
20+
struct timespec64 *tspec, enum clocksource_ids *cs_id);
2321

2422
#endif /* _PTP_KVM_H_ */

include/linux/timekeeping.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,13 @@ struct system_device_crosststamp {
271271
* struct system_counterval_t - system counter value with the ID of the
272272
* corresponding clocksource
273273
* @cycles: System counter value
274-
* @cs: Clocksource corresponding to system counter value. Timekeeping
275-
* code now evaluates cs_id instead.
276274
* @cs_id: Clocksource ID corresponding to system counter value. Used by
277275
* timekeeping code to verify comparability of two cycle values.
278276
* The default ID, CSID_GENERIC, does not identify a specific
279277
* clocksource.
280278
*/
281279
struct system_counterval_t {
282280
u64 cycles;
283-
struct clocksource *cs;
284281
enum clocksource_ids cs_id;
285282
};
286283

0 commit comments

Comments
 (0)