software node: remove property_entry_read_uNN_array functions
There is absolutely no reason to have them as we can handle it all nicely in property_entry_read_int_array(). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
1f74d70ff2
commit
5236f5fe23
|
@ -131,66 +131,6 @@ static const void *property_entry_find(const struct property_entry *props,
|
||||||
return pointer;
|
return pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int property_entry_read_u8_array(const struct property_entry *props,
|
|
||||||
const char *propname,
|
|
||||||
u8 *values, size_t nval)
|
|
||||||
{
|
|
||||||
const void *pointer;
|
|
||||||
size_t length = nval * sizeof(*values);
|
|
||||||
|
|
||||||
pointer = property_entry_find(props, propname, length);
|
|
||||||
if (IS_ERR(pointer))
|
|
||||||
return PTR_ERR(pointer);
|
|
||||||
|
|
||||||
memcpy(values, pointer, length);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int property_entry_read_u16_array(const struct property_entry *props,
|
|
||||||
const char *propname,
|
|
||||||
u16 *values, size_t nval)
|
|
||||||
{
|
|
||||||
const void *pointer;
|
|
||||||
size_t length = nval * sizeof(*values);
|
|
||||||
|
|
||||||
pointer = property_entry_find(props, propname, length);
|
|
||||||
if (IS_ERR(pointer))
|
|
||||||
return PTR_ERR(pointer);
|
|
||||||
|
|
||||||
memcpy(values, pointer, length);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int property_entry_read_u32_array(const struct property_entry *props,
|
|
||||||
const char *propname,
|
|
||||||
u32 *values, size_t nval)
|
|
||||||
{
|
|
||||||
const void *pointer;
|
|
||||||
size_t length = nval * sizeof(*values);
|
|
||||||
|
|
||||||
pointer = property_entry_find(props, propname, length);
|
|
||||||
if (IS_ERR(pointer))
|
|
||||||
return PTR_ERR(pointer);
|
|
||||||
|
|
||||||
memcpy(values, pointer, length);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int property_entry_read_u64_array(const struct property_entry *props,
|
|
||||||
const char *propname,
|
|
||||||
u64 *values, size_t nval)
|
|
||||||
{
|
|
||||||
const void *pointer;
|
|
||||||
size_t length = nval * sizeof(*values);
|
|
||||||
|
|
||||||
pointer = property_entry_find(props, propname, length);
|
|
||||||
if (IS_ERR(pointer))
|
|
||||||
return PTR_ERR(pointer);
|
|
||||||
|
|
||||||
memcpy(values, pointer, length);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
property_entry_count_elems_of_size(const struct property_entry *props,
|
property_entry_count_elems_of_size(const struct property_entry *props,
|
||||||
const char *propname, size_t length)
|
const char *propname, size_t length)
|
||||||
|
@ -209,21 +149,24 @@ static int property_entry_read_int_array(const struct property_entry *props,
|
||||||
unsigned int elem_size, void *val,
|
unsigned int elem_size, void *val,
|
||||||
size_t nval)
|
size_t nval)
|
||||||
{
|
{
|
||||||
|
const void *pointer;
|
||||||
|
size_t length;
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
return property_entry_count_elems_of_size(props, name,
|
return property_entry_count_elems_of_size(props, name,
|
||||||
elem_size);
|
elem_size);
|
||||||
switch (elem_size) {
|
|
||||||
case sizeof(u8):
|
|
||||||
return property_entry_read_u8_array(props, name, val, nval);
|
|
||||||
case sizeof(u16):
|
|
||||||
return property_entry_read_u16_array(props, name, val, nval);
|
|
||||||
case sizeof(u32):
|
|
||||||
return property_entry_read_u32_array(props, name, val, nval);
|
|
||||||
case sizeof(u64):
|
|
||||||
return property_entry_read_u64_array(props, name, val, nval);
|
|
||||||
}
|
|
||||||
|
|
||||||
return -ENXIO;
|
if (!is_power_of_2(elem_size) || elem_size > sizeof(u64))
|
||||||
|
return -ENXIO;
|
||||||
|
|
||||||
|
length = nval * elem_size;
|
||||||
|
|
||||||
|
pointer = property_entry_find(props, name, length);
|
||||||
|
if (IS_ERR(pointer))
|
||||||
|
return PTR_ERR(pointer);
|
||||||
|
|
||||||
|
memcpy(val, pointer, length);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int property_entry_read_string_array(const struct property_entry *props,
|
static int property_entry_read_string_array(const struct property_entry *props,
|
||||||
|
|
Loading…
Reference in New Issue