From: Mikael Pettersson Common-code cleanups for perfctr: - init.c: remove unused , don't initialise perfctr_info, don't show dummy cpu_type, show driver version directly from VERSION. - : remove types & constants not used in the kernel any more, make perfctr_info kernel-only and remove unused fields, use explicitly-sized integers in user-visible types. Signed-off-by: Mikael Pettersson Signed-off-by: Andrew Morton --- 25-akpm/drivers/perfctr/init.c | 22 +++------------- 25-akpm/drivers/perfctr/version.h | 2 - 25-akpm/include/linux/perfctr.h | 51 ++++++++------------------------------ 3 files changed, 18 insertions(+), 57 deletions(-) diff -puN drivers/perfctr/init.c~perfctr-cleanups-1-3-common drivers/perfctr/init.c --- 25/drivers/perfctr/init.c~perfctr-cleanups-1-3-common 2005-03-18 01:08:42.000000000 -0800 +++ 25-akpm/drivers/perfctr/init.c 2005-03-18 01:08:42.000000000 -0800 @@ -1,8 +1,8 @@ -/* $Id: init.c,v 1.76 2004/05/31 18:18:55 mikpe Exp $ +/* $Id: init.c,v 1.81 2005/03/17 23:49:07 mikpe Exp $ * Performance-monitoring counters driver. * Top-level initialisation code. * - * Copyright (C) 1999-2004 Mikael Pettersson + * Copyright (C) 1999-2005 Mikael Pettersson */ #include #include @@ -11,27 +11,16 @@ #include #include -#include - #include "cpumask.h" #include "virtual.h" #include "version.h" -struct perfctr_info perfctr_info = { - .abi_version = PERFCTR_ABI_VERSION, - .driver_version = VERSION, -}; +struct perfctr_info perfctr_info; static ssize_t driver_version_show(struct class *class, char *buf) { - return sprintf(buf, "%s\n", perfctr_info.driver_version); -} - -static ssize_t -cpu_type_show(struct class *class, char *buf) -{ - return sprintf(buf, "%#x\n", perfctr_info.cpu_type); + return sprintf(buf, "%s\n", VERSION); } static ssize_t @@ -70,7 +59,6 @@ cpus_forbidden_show(struct class *class, static struct class_attribute perfctr_class_attrs[] = { __ATTR_RO(driver_version), - __ATTR_RO(cpu_type), __ATTR_RO(cpu_features), __ATTR_RO(cpu_khz), __ATTR_RO(tsc_to_cpu_mult), @@ -104,7 +92,7 @@ static int __init perfctr_init(void) return err; } printk(KERN_INFO "perfctr: driver %s, cpu type %s at %u kHz\n", - perfctr_info.driver_version, + VERSION, perfctr_cpu_name, perfctr_info.cpu_khz); return 0; diff -puN drivers/perfctr/version.h~perfctr-cleanups-1-3-common drivers/perfctr/version.h --- 25/drivers/perfctr/version.h~perfctr-cleanups-1-3-common 2005-03-18 01:08:42.000000000 -0800 +++ 25-akpm/drivers/perfctr/version.h 2005-03-18 01:08:42.000000000 -0800 @@ -1 +1 @@ -#define VERSION "2.7.10" +#define VERSION "2.7.12" diff -puN include/linux/perfctr.h~perfctr-cleanups-1-3-common include/linux/perfctr.h --- 25/include/linux/perfctr.h~perfctr-cleanups-1-3-common 2005-03-18 01:08:42.000000000 -0800 +++ 25-akpm/include/linux/perfctr.h 2005-03-18 01:08:42.000000000 -0800 @@ -1,4 +1,4 @@ -/* $Id: perfctr.h,v 1.88 2005/02/20 12:03:08 mikpe Exp $ +/* $Id: perfctr.h,v 1.91 2005/03/18 00:10:53 mikpe Exp $ * Performance-Monitoring Counters driver * * Copyright (C) 1999-2005 Mikael Pettersson @@ -10,43 +10,15 @@ #include -struct perfctr_info { - unsigned int abi_version; - char driver_version[32]; - unsigned int cpu_type; - unsigned int cpu_features; - unsigned int cpu_khz; - unsigned int tsc_to_cpu_mult; - unsigned int _reserved2; - unsigned int _reserved3; - unsigned int _reserved4; -}; - -struct perfctr_cpu_mask { - unsigned int nrwords; - unsigned int mask[1]; /* actually 'nrwords' */ -}; - -/* abi_version values: Lower 16 bits contain the CPU data version, upper - 16 bits contain the API version. Each half has a major version in its - upper 8 bits, and a minor version in its lower 8 bits. */ -#define PERFCTR_API_VERSION 0x0600 /* 6.0 */ -#define PERFCTR_ABI_VERSION ((PERFCTR_API_VERSION<<16)|PERFCTR_CPU_VERSION) - /* cpu_features flag bits */ #define PERFCTR_FEATURE_RDPMC 0x01 #define PERFCTR_FEATURE_RDTSC 0x02 #define PERFCTR_FEATURE_PCINT 0x04 -/* user's view of mmap:ed virtual perfctr */ -struct vperfctr_state { - struct perfctr_cpu_state cpu_state; -}; - /* virtual perfctr control object */ struct vperfctr_control { - int si_signo; - unsigned int preserve; + __s32 si_signo; + __u32 preserve; }; /* commands for sys_vperfctr_control() */ @@ -57,8 +29,8 @@ struct vperfctr_control { /* common description of an arch-specific 32-bit control register */ struct perfctr_cpu_reg { - unsigned int nr; - unsigned int value; + __u32 nr; + __u32 value; }; /* state and control domain numbers @@ -70,14 +42,9 @@ struct perfctr_cpu_reg { /* domain numbers for common arch-specific control data */ #define PERFCTR_DOMAIN_CPU_CONTROL 128 /* struct perfctr_cpu_control_header */ -#define PERFCTR_DOMAIN_CPU_MAP 129 /* unsigned int[] */ +#define PERFCTR_DOMAIN_CPU_MAP 129 /* __u32[] */ #define PERFCTR_DOMAIN_CPU_REGS 130 /* struct perfctr_cpu_reg[] */ -#else -struct perfctr_info; -struct perfctr_cpu_mask; -struct perfctr_sum_ctrs; -struct vperfctr_control; #endif /* CONFIG_PERFCTR */ #ifdef __KERNEL__ @@ -94,6 +61,12 @@ asmlinkage long sys_vperfctr_read(int fd void __user *argp, unsigned int argbytes); +struct perfctr_info { + unsigned int cpu_features; + unsigned int cpu_khz; + unsigned int tsc_to_cpu_mult; +}; + extern struct perfctr_info perfctr_info; #ifdef CONFIG_PERFCTR_VIRTUAL _