>> +
>> +static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
>> +                            char *drc_type, unsigned int my_index)
>> +{
>> +    struct property *info;
>> +    unsigned int entries;
>> +    struct of_drc_info drc;
>> +    void *value;
> 
> This should be __be32 *

Okay.

> 
>> +    int j;
>> +
>> +    info = of_find_property(dn->parent, "ibm,drc-info", NULL);
>> +    if (info == NULL)
>> +            return -EINVAL;
>> +
>> +    value = info->value;
>> +    value = (void *)of_prop_next_u32(info, value, &entries);
>> +    if (!value)
>> +            return -EINVAL;
>> +
>> +    for (j = 0; j < entries; j++) {
>> +            of_one_drc_info(&info, &value, &drc);
>> +
>> +            /* Should now know end of current entry */
>> +
>> +            WARN_ON((my_index < drc.drc_index_start) ||
>> +                    (((my_index-drc.drc_index_start)%
>> +                            drc.sequential_inc) != 0));
>> +
>> +            if (my_index > drc.last_drc_index)
>> +                    continue;
>> +
>> +            break;
>> +    }
>> +    /* Found it */
>> +
>> +    if (((drc_name == NULL) ||
>> +         (drc_name && !strncmp(drc_name,
>> +                            drc.drc_name_prefix,
>> +                            strlen(drc.drc_name_prefix)))) &&
> 
> Shouldn't we be doing a string compare on the entire name, not just the 
> prefix?
> 
> If I remember correctly the prefix is the same for every cpu.

The prefix may be a value like "CPU", "MEM", "PHB", or other.
I modeled the comparisons using 'drc_name_prefix' after the comparison
of the 'name_tmp' found in the array 'ibm,drc-names' and 'type_tmp'
found in the array 'ibm,drc-types'.  This is modeled in the new
function 'rpaphp_check_drc_props_v1' which was lifted from the original
function rpaphp_get_drc_props().

> 
> -Nathan
> 

-- 
Michael W. Bringmann
Linux Technology Center
IBM Corporation
Tie-Line  363-5196
External: (512) 286-5196
Cell:       (512) 466-0650
m...@linux.vnet.ibm.com

Reply via email to