powerpc: Make device tree accesses in cache info code endian safe
Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
parent
2083f681e3
commit
d10bd84f14
@ -196,7 +196,7 @@ static void cache_cpu_set(struct cache *cache, int cpu)
|
|||||||
static int cache_size(const struct cache *cache, unsigned int *ret)
|
static int cache_size(const struct cache *cache, unsigned int *ret)
|
||||||
{
|
{
|
||||||
const char *propname;
|
const char *propname;
|
||||||
const u32 *cache_size;
|
const __be32 *cache_size;
|
||||||
|
|
||||||
propname = cache_type_info[cache->type].size_prop;
|
propname = cache_type_info[cache->type].size_prop;
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ static int cache_size(const struct cache *cache, unsigned int *ret)
|
|||||||
if (!cache_size)
|
if (!cache_size)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
*ret = *cache_size;
|
*ret = of_read_number(cache_size, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ static int cache_size_kb(const struct cache *cache, unsigned int *ret)
|
|||||||
/* not cache_line_size() because that's a macro in include/linux/cache.h */
|
/* not cache_line_size() because that's a macro in include/linux/cache.h */
|
||||||
static int cache_get_line_size(const struct cache *cache, unsigned int *ret)
|
static int cache_get_line_size(const struct cache *cache, unsigned int *ret)
|
||||||
{
|
{
|
||||||
const u32 *line_size;
|
const __be32 *line_size;
|
||||||
int i, lim;
|
int i, lim;
|
||||||
|
|
||||||
lim = ARRAY_SIZE(cache_type_info[cache->type].line_size_props);
|
lim = ARRAY_SIZE(cache_type_info[cache->type].line_size_props);
|
||||||
@ -239,14 +239,14 @@ static int cache_get_line_size(const struct cache *cache, unsigned int *ret)
|
|||||||
if (!line_size)
|
if (!line_size)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
*ret = *line_size;
|
*ret = of_read_number(line_size, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cache_nr_sets(const struct cache *cache, unsigned int *ret)
|
static int cache_nr_sets(const struct cache *cache, unsigned int *ret)
|
||||||
{
|
{
|
||||||
const char *propname;
|
const char *propname;
|
||||||
const u32 *nr_sets;
|
const __be32 *nr_sets;
|
||||||
|
|
||||||
propname = cache_type_info[cache->type].nr_sets_prop;
|
propname = cache_type_info[cache->type].nr_sets_prop;
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ static int cache_nr_sets(const struct cache *cache, unsigned int *ret)
|
|||||||
if (!nr_sets)
|
if (!nr_sets)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
*ret = *nr_sets;
|
*ret = of_read_number(nr_sets, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user