Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1670389

Re: [PATCH V2 1/2] hwmon: (ibmpowernv) introduce a legacy_compatibles array

From Cédric Le Goater <clg@kaod.org>
Newsgroups linux.kernel
Subject Re: [PATCH V2 1/2] hwmon: (ibmpowernv) introduce a legacy_compatibles array
Date 2017-06-20 10:00 +0200
Message-ID <tUmeR-5LQ-5@gated-at.bofh.it> (permalink)
References <tUjAn-4iD-33@gated-at.bofh.it> <tUjAn-4iD-31@gated-at.bofh.it> <tUlCa-5wX-41@gated-at.bofh.it> <tUlCa-5wX-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 06/20/2017 09:15 AM, Shilpasri G Bhat wrote:
> 
> 
> On 06/20/2017 11:36 AM, Cédric Le Goater wrote:
>> On 06/20/2017 07:08 AM, Shilpasri G Bhat wrote:
>>> From: Cédric Le Goater <clg@kaod.org>
>>>
>>> Today, the type of a PowerNV sensor system is determined with the
>>> "compatible" property for legacy Firmwares and with the "sensor-type"
>>> for newer ones. The same array of strings is used for both to do the
>>> matching and this raises some issue to introduce new sensor types.
>>>
>>> Let's introduce two different arrays (legacy and current) to make
>>> things easier for new sensor types.
>>>
>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>> Tested-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
>>
>> Did you test on a Tuleta (IBM Power) system ? 
> 
> I have tested this patch on P9 FSP and Firestone.

OK. I just gave it a try on a Tuleta, P8 FSP, IBM Power system
Looks good.

Thanks,

C.

> 
>>
>> Thanks,
>>
>> C. 
>>
>>> ---
>>>  drivers/hwmon/ibmpowernv.c | 26 ++++++++++++++++++--------
>>>  1 file changed, 18 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
>>> index 862b832..6d8909c 100644
>>> --- a/drivers/hwmon/ibmpowernv.c
>>> +++ b/drivers/hwmon/ibmpowernv.c
>>> @@ -55,17 +55,27 @@ enum sensors {
>>>  
>>>  #define INVALID_INDEX (-1U)
>>>  
>>> +/*
>>> + * 'compatible' string properties for sensor types as defined in old
>>> + * PowerNV firmware (skiboot). These are ordered as 'enum sensors'.
>>> + */
>>> +static const char * const legacy_compatibles[] = {
>>> +	"ibm,opal-sensor-cooling-fan",
>>> +	"ibm,opal-sensor-amb-temp",
>>> +	"ibm,opal-sensor-power-supply",
>>> +	"ibm,opal-sensor-power"
>>> +};
>>> +
>>>  static struct sensor_group {
>>> -	const char *name;
>>> -	const char *compatible;
>>> +	const char *name; /* matches property 'sensor-type' */
>>>  	struct attribute_group group;
>>>  	u32 attr_count;
>>>  	u32 hwmon_index;
>>>  } sensor_groups[] = {
>>> -	{"fan", "ibm,opal-sensor-cooling-fan"},
>>> -	{"temp", "ibm,opal-sensor-amb-temp"},
>>> -	{"in", "ibm,opal-sensor-power-supply"},
>>> -	{"power", "ibm,opal-sensor-power"}
>>> +	{ "fan"   },
>>> +	{ "temp"  },
>>> +	{ "in"    },
>>> +	{ "power" }
>>>  };
>>>  
>>>  struct sensor_data {
>>> @@ -239,8 +249,8 @@ static int get_sensor_type(struct device_node *np)
>>>  	enum sensors type;
>>>  	const char *str;
>>>  
>>> -	for (type = 0; type < MAX_SENSOR_TYPE; type++) {
>>> -		if (of_device_is_compatible(np, sensor_groups[type].compatible))
>>> +	for (type = 0; type < ARRAY_SIZE(legacy_compatibles); type++) {
>>> +		if (of_device_is_compatible(np, legacy_compatibles[type]))
>>>  			return type;
>>>  	}
>>>  
>>>
>>
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 1/2] hwmon: (ibmpowernv) introduce a legacy_compatibles array Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2017-06-20 07:10 +0200
  Re: [PATCH V2 1/2] hwmon: (ibmpowernv) introduce a legacy_compatibles  array Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2017-06-20 09:20 +0200
    Re: [PATCH V2 1/2] hwmon: (ibmpowernv) introduce a legacy_compatibles  array Cédric Le Goater <clg@kaod.org> - 2017-06-20 10:00 +0200
  Re: [PATCH V2 1/2] hwmon: (ibmpowernv) introduce a legacy_compatibles  array Cédric Le Goater <clg@kaod.org> - 2017-06-20 09:30 +0200

csiph-web