Re: [PATCH v2] rt-tests: hwlatdetect: Gracefully handle lack of /dev/cpu_dma_latency

Punit Agrawal
2021-09-29T00:10:27Z

John Kacur <jkacur@redhat.com> writes:

> On Wed, 29 Sep 2021, Punit Agrawal wrote:
>

[...]

>> > Thanks! I have a couple of nit-picky suggestions.
>> >
>> > If you initialize self.dma_latency_handle = None in the init method of
>> > class Detector, then you can drop the else part of your check to see if
>> > the file exists.
>>
>> I can do that - but then I wonder if there is any harm in initialising
>> the file handle in the init method itself too. That way
>> c_states_[off|on]() can focus on doing their thing after checking the
>> handle is not null.
>
> I mean I suppose it would work, but I wouldn't consider it great style,
> I think of the init as a place for basic declarations and
> initializations.

I don't have a strong preference here - so I'll go with your suggestion.

Thanks.

> Anyway, I'll have a look at whatever way you decide to go.
> …