Re: [PATCH] interconnect: Add helpers for enabling/disabling a path

From: Georgi Djakov
Date: Tue Apr 28 2020 - 11:50:08 EST


Hi Matthias,

On 4/28/20 18:28, Matthias Kaehlcke wrote:
> Hi Georgi,
>
> On Tue, Apr 28, 2020 at 12:16:50PM +0300, Georgi Djakov wrote:
>> There is a repeated pattern in multiple drivers where they want to switch
>> the bandwidth between zero and some other value. This is happening often
>> in the suspend/resume callbacks. Let's add helper functions to enable and
>> disable the path, so that callers don't have to take care of remembering
>> the bandwidth values and handle this in the framework instead.
>>
>> With this patch the users can call icc_disable() and icc_enable() to lower
>> their bandwidth request to zero and then restore it back to it's previous
>> value.
>>
>> Suggested-by: Evan Green <evgreen@xxxxxxxxxxxx>
>> Suggested-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
>> Signed-off-by: Georgi Djakov <georgi.djakov@xxxxxxxxxx>

[..]

>> +
>> + return icc_set_bw(path, path->reqs[0].avg_bw,
>> + path->reqs[0].peak_bw);
>> +}
>
> The two functions are identical except for the assignment of the 'enabled'
> flags. You could add a helper _icc_enable(struct icc_path *path, bool enable)
> and call it from icc_enable/disable().
>

Yes, indeed! Will send a v2. Thank you!

BR,
Georgi