2022-09-23 09:33:41

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH v2 10/33] drm/modes: Add a function to generate analog display modes

On Fri, 23 Sep 2022, Thomas Zimmermann <[email protected]> wrote:
> Am 22.09.22 um 16:25 schrieb Maxime Ripard:
>> + drm_dbg_kms(dev,
>> + "Generating a %ux%u%c, %u-line mode with a %lu kHz clock\n",
>> + hactive, vactive,
>> + interlace ? 'i' : 'p',
>> + params->num_lines,
>> + pixel_clock_hz / 1000);
>
> Divide by HZ_PER_KHZ here and in other places.
>
> https://elixir.bootlin.com/linux/latest/source/include/linux/units.h#L23

From the Department of Bikeshedding:

I find "pixel_clock_hz / 1000" has much more clarity than
"pixel_clock_hz / HZ_PER_KHZ".

I don't consider the SI prefixes magic numbers.


BR,
Jani.

--
Jani Nikula, Intel Open Source Graphics Center


2022-09-23 11:08:48

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH v2 10/33] drm/modes: Add a function to generate analog display modes

Hi

Am 23.09.22 um 11:18 schrieb Jani Nikula:
> On Fri, 23 Sep 2022, Thomas Zimmermann <[email protected]> wrote:
>> Am 22.09.22 um 16:25 schrieb Maxime Ripard:
>>> + drm_dbg_kms(dev,
>>> + "Generating a %ux%u%c, %u-line mode with a %lu kHz clock\n",
>>> + hactive, vactive,
>>> + interlace ? 'i' : 'p',
>>> + params->num_lines,
>>> + pixel_clock_hz / 1000);
>>
>> Divide by HZ_PER_KHZ here and in other places.
>>
>> https://elixir.bootlin.com/linux/latest/source/include/linux/units.h#L23
>
> From the Department of Bikeshedding:
>
> I find "pixel_clock_hz / 1000" has much more clarity than
> "pixel_clock_hz / HZ_PER_KHZ".

This one's easy to see because it tells you with the _hz postfix. Many
places don't and then it quickly gets confusing what units the code's
converting.

Best regards
Thomas

>
> I don't consider the SI prefixes magic numbers.
>
>
> BR,
> Jani.
>

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature

2022-09-26 11:27:18

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH v2 10/33] drm/modes: Add a function to generate analog display modes

On Fri, Sep 23, 2022 at 12:16:13PM +0200, Thomas Zimmermann wrote:
> Hi
>
> Am 23.09.22 um 11:18 schrieb Jani Nikula:
> > On Fri, 23 Sep 2022, Thomas Zimmermann <[email protected]> wrote:
> > > Am 22.09.22 um 16:25 schrieb Maxime Ripard:
> > > > + drm_dbg_kms(dev,
> > > > + "Generating a %ux%u%c, %u-line mode with a %lu kHz clock\n",
> > > > + hactive, vactive,
> > > > + interlace ? 'i' : 'p',
> > > > + params->num_lines,
> > > > + pixel_clock_hz / 1000);
> > >
> > > Divide by HZ_PER_KHZ here and in other places.
> > >
> > > https://elixir.bootlin.com/linux/latest/source/include/linux/units.h#L23
> >
> > From the Department of Bikeshedding:
> >
> > I find "pixel_clock_hz / 1000" has much more clarity than
> > "pixel_clock_hz / HZ_PER_KHZ".
>
> This one's easy to see because it tells you with the _hz postfix. Many
> places don't and then it quickly gets confusing what units the code's
> converting.

So if I add it to places that don't have it explicitly (ie, tests) would
that be acceptable to both of you?

Maxime


Attachments:
(No filename) (1.07 kB)
signature.asc (235.00 B)
Download all attachments

2022-09-26 12:33:20

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH v2 10/33] drm/modes: Add a function to generate analog display modes

Hi

Am 26.09.22 um 12:18 schrieb Maxime Ripard:
> On Fri, Sep 23, 2022 at 12:16:13PM +0200, Thomas Zimmermann wrote:
>> Hi
>>
>> Am 23.09.22 um 11:18 schrieb Jani Nikula:
>>> On Fri, 23 Sep 2022, Thomas Zimmermann <[email protected]> wrote:
>>>> Am 22.09.22 um 16:25 schrieb Maxime Ripard:
>>>>> + drm_dbg_kms(dev,
>>>>> + "Generating a %ux%u%c, %u-line mode with a %lu kHz clock\n",
>>>>> + hactive, vactive,
>>>>> + interlace ? 'i' : 'p',
>>>>> + params->num_lines,
>>>>> + pixel_clock_hz / 1000);
>>>>
>>>> Divide by HZ_PER_KHZ here and in other places.
>>>>
>>>> https://elixir.bootlin.com/linux/latest/source/include/linux/units.h#L23
>>>
>>> From the Department of Bikeshedding:
>>>
>>> I find "pixel_clock_hz / 1000" has much more clarity than
>>> "pixel_clock_hz / HZ_PER_KHZ".
>>
>> This one's easy to see because it tells you with the _hz postfix. Many
>> places don't and then it quickly gets confusing what units the code's
>> converting.
>
> So if I add it to places that don't have it explicitly (ie, tests) would
> that be acceptable to both of you?

I'm OK with either. Or just leave it as-is.

A HZ_TO_KHZ macro would be nice, but that's beyond this patchset.

Best regards
Thomas

>
> Maxime

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature