Re: [PATCH V8 1/3] powernv: powercap: Add support for powercap framework

From: Shilpasri G Bhat
Date: Fri Jul 28 2017 - 00:05:59 EST


Hi Cyril,

On 07/28/2017 07:09 AM, Cyril Bur wrote:
> Is there any reason that pcap_attrs needs to be contiguous? If not, I
> feel like you could eliminate the entire loop below (and the last one
> as well maybe) and just do the assignment of pattr_groups[].attrs[] up
> there.
>
> In fact do you even need to store pcap_attrs? If you kcalloc them as
> you need them (in the loop above), you can always free them again on
> error by freeing pattr_groups[].attrs[] right?
>
> I'll admit I've become quite confused as to the layout of the sysfs dir
> that you're creating here - would you mind showing what the expected
> layout will be?
>
> I'll take more of a look once thats more clear in my head
>
> Thanks,
>
> Cyril

The sysfs layout looks as below:
# ls /sys/firmware/opal/powercap/
system-powercap

# ls /sys/firmware/opal/powercap/system-powercap/
powercap-current powercap-max powercap-min

# grep . /sys/firmware/opal/powercap/system-powercap/*
/sys/firmware/opal/powercap/system-powercap/powercap-current:2375
/sys/firmware/opal/powercap/system-powercap/powercap-max:2375
/sys/firmware/opal/powercap/system-powercap/powercap-min:1945

Thanks and Regards,
Shilpa