Re: [PATCH V3 6/9] trace/hwlat: Use the generic function to read/write width and window

From: Daniel Bristot de Oliveira
Date: Fri Jun 04 2021 - 12:37:05 EST


On 6/3/21 11:27 PM, Steven Rostedt wrote:
> On Fri, 14 May 2021 22:51:15 +0200
> Daniel Bristot de Oliveira <bristot@xxxxxxxxxx> wrote:
>
>> @@ -733,16 +624,18 @@ static ssize_t hwlat_mode_write(struct file *filp, const char __user *ubuf,
>> return ret;
>> }
>>
>> -static const struct file_operations width_fops = {
>> - .open = tracing_open_generic,
>> - .read = hwlat_read,
>> - .write = hwlat_width_write,
>> +static struct trace_ull_config hwlat_width = {
>> + .lock = &hwlat_data.lock,
>> + .val = &hwlat_data.sample_width,
>> + .max = &hwlat_data.sample_window,
>> + .min = NULL,
>> };
>>
>> -static const struct file_operations window_fops = {
>> - .open = tracing_open_generic,
>> - .read = hwlat_read,
>> - .write = hwlat_window_write,
>> +static struct trace_ull_config hwlat_window = {
> Yeah, the naming convention needs to be changed, because ull_config is
> meaningless, and this code makes no sense. I know what it is doing, but if
> I didn't, I'd have no clue what it was doing by reading it. :-p

I will rework the patch 5/9 to add a better explanation for the read/write
functions, and I will add comments to this patch, explaining the reason for the
min/max values.

Sound good?

-- Daniel

> -- Steve
>
>