diff options
author | Simon Glass | 2020-01-26 22:06:27 -0700 |
---|---|---|
committer | Simon Glass | 2020-07-25 14:46:57 -0600 |
commit | 961420fa5f3bcf837518e7f72d6f8c3ee090643d (patch) | |
tree | 45c39f46656140575aafa573299841a1ac9cab56 /arch/x86 | |
parent | fdc34368ddcd1d2eb46f9a1829f080f8c1760dee (diff) |
cpu: Convert the methods to use a const udevice *
These functions should not modify the device. Convert them to const so
that callers don't need to cast if they have a const udevice *.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/cpu/apollolake/cpu.c | 2 | ||||
-rw-r--r-- | arch/x86/cpu/baytrail/cpu.c | 4 | ||||
-rw-r--r-- | arch/x86/cpu/broadwell/cpu_full.c | 4 | ||||
-rw-r--r-- | arch/x86/cpu/cpu_x86.c | 6 | ||||
-rw-r--r-- | arch/x86/cpu/ivybridge/model_206ax.c | 5 | ||||
-rw-r--r-- | arch/x86/cpu/qemu/cpu.c | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/cpu_x86.h | 6 |
7 files changed, 16 insertions, 15 deletions
diff --git a/arch/x86/cpu/apollolake/cpu.c b/arch/x86/cpu/apollolake/cpu.c index aa7a3dbd63e..0a6d2ad7a4a 100644 --- a/arch/x86/cpu/apollolake/cpu.c +++ b/arch/x86/cpu/apollolake/cpu.c @@ -9,7 +9,7 @@ #include <asm/cpu_common.h> #include <asm/cpu_x86.h> -static int apl_get_info(struct udevice *dev, struct cpu_info *info) +static int apl_get_info(const struct udevice *dev, struct cpu_info *info) { return cpu_intel_get_info(info, INTEL_BCLK_MHZ); } diff --git a/arch/x86/cpu/baytrail/cpu.c b/arch/x86/cpu/baytrail/cpu.c index 18e48ffa532..309a50a1161 100644 --- a/arch/x86/cpu/baytrail/cpu.c +++ b/arch/x86/cpu/baytrail/cpu.c @@ -150,7 +150,7 @@ static unsigned long tsc_freq(void) return bclk * ((platform_info.lo >> 8) & 0xff); } -static int baytrail_get_info(struct udevice *dev, struct cpu_info *info) +static int baytrail_get_info(const struct udevice *dev, struct cpu_info *info) { info->cpu_freq = tsc_freq(); info->features = 1 << CPU_FEAT_L1_CACHE | 1 << CPU_FEAT_MMU; @@ -158,7 +158,7 @@ static int baytrail_get_info(struct udevice *dev, struct cpu_info *info) return 0; } -static int baytrail_get_count(struct udevice *dev) +static int baytrail_get_count(const struct udevice *dev) { int ecx = 0; diff --git a/arch/x86/cpu/broadwell/cpu_full.c b/arch/x86/cpu/broadwell/cpu_full.c index 64a1cd414fc..706f68f63d6 100644 --- a/arch/x86/cpu/broadwell/cpu_full.c +++ b/arch/x86/cpu/broadwell/cpu_full.c @@ -626,12 +626,12 @@ void cpu_set_power_limits(int power_limit_1_time) } } -static int broadwell_get_info(struct udevice *dev, struct cpu_info *info) +static int broadwell_get_info(const struct udevice *dev, struct cpu_info *info) { return cpu_intel_get_info(info, INTEL_BCLK_MHZ); } -static int broadwell_get_count(struct udevice *dev) +static int broadwell_get_count(const struct udevice *dev) { return 4; } diff --git a/arch/x86/cpu/cpu_x86.c b/arch/x86/cpu/cpu_x86.c index 3f2ba0881e8..7e83051646c 100644 --- a/arch/x86/cpu/cpu_x86.c +++ b/arch/x86/cpu/cpu_x86.c @@ -26,7 +26,7 @@ int cpu_x86_bind(struct udevice *dev) return 0; } -int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size) +int cpu_x86_get_vendor(const struct udevice *dev, char *buf, int size) { const char *vendor = cpu_vendor_name(gd->arch.x86_vendor); @@ -38,7 +38,7 @@ int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size) return 0; } -int cpu_x86_get_desc(struct udevice *dev, char *buf, int size) +int cpu_x86_get_desc(const struct udevice *dev, char *buf, int size) { char *ptr; @@ -52,7 +52,7 @@ int cpu_x86_get_desc(struct udevice *dev, char *buf, int size) return 0; } -int cpu_x86_get_count(struct udevice *dev) +int cpu_x86_get_count(const struct udevice *dev) { int node, cpu; int num = 0; diff --git a/arch/x86/cpu/ivybridge/model_206ax.c b/arch/x86/cpu/ivybridge/model_206ax.c index 5954a24873d..55f7cc2b2ec 100644 --- a/arch/x86/cpu/ivybridge/model_206ax.c +++ b/arch/x86/cpu/ivybridge/model_206ax.c @@ -410,14 +410,15 @@ static int model_206ax_init(struct udevice *dev) return 0; } -static int model_206ax_get_info(struct udevice *dev, struct cpu_info *info) +static int model_206ax_get_info(const struct udevice *dev, + struct cpu_info *info) { return cpu_intel_get_info(info, INTEL_BCLK_MHZ); return 0; } -static int model_206ax_get_count(struct udevice *dev) +static int model_206ax_get_count(const struct udevice *dev) { return 4; } diff --git a/arch/x86/cpu/qemu/cpu.c b/arch/x86/cpu/qemu/cpu.c index f40fb4d0879..9ce86b379c4 100644 --- a/arch/x86/cpu/qemu/cpu.c +++ b/arch/x86/cpu/qemu/cpu.c @@ -10,7 +10,7 @@ #include <qfw.h> #include <asm/cpu.h> -int cpu_qemu_get_desc(struct udevice *dev, char *buf, int size) +int cpu_qemu_get_desc(const struct udevice *dev, char *buf, int size) { if (size < CPU_MAX_NAME_LEN) return -ENOSPC; @@ -20,7 +20,7 @@ int cpu_qemu_get_desc(struct udevice *dev, char *buf, int size) return 0; } -static int cpu_qemu_get_count(struct udevice *dev) +static int cpu_qemu_get_count(const struct udevice *dev) { return qemu_fwcfg_online_cpus(); } diff --git a/arch/x86/include/asm/cpu_x86.h b/arch/x86/include/asm/cpu_x86.h index ae8f4dcd5dc..4fd5f03fdcf 100644 --- a/arch/x86/include/asm/cpu_x86.h +++ b/arch/x86/include/asm/cpu_x86.h @@ -28,7 +28,7 @@ int cpu_x86_bind(struct udevice *dev); * @size: Size of string space * @return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error */ -int cpu_x86_get_desc(struct udevice *dev, char *buf, int size); +int cpu_x86_get_desc(const struct udevice *dev, char *buf, int size); /** * cpu_x86_get_count() - Get the number of cores for an x86 CPU @@ -40,7 +40,7 @@ int cpu_x86_get_desc(struct udevice *dev, char *buf, int size); * @return: Number of cores if successful, * -ENOENT if not "/cpus" entry is found in the device tree */ -int cpu_x86_get_count(struct udevice *dev); +int cpu_x86_get_count(const struct udevice *dev); /** * cpu_x86_get_vendor() - Get a vendor string for an x86 CPU @@ -53,6 +53,6 @@ int cpu_x86_get_count(struct udevice *dev); * @size: Size of string space * @return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error */ -int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size); +int cpu_x86_get_vendor(const struct udevice *dev, char *buf, int size); #endif /* _ASM_CPU_X86_H */ |