From: Jani Nikula <jani.nikula@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Devarsh Thakkar <devarsht@ti.com>
Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
benjamin.gaignard@collabora.com, sebastian.fricke@collabora.com,
akpm@linux-foundation.org, gregkh@linuxfoundation.org,
adobriyan@gmail.com, p.zabel@pengutronix.de, airlied@gmail.com,
daniel@ffwll.ch, dri-devel@lists.freedesktop.org,
laurent.pinchart@ideasonboard.com, praneeth@ti.com, nm@ti.com,
vigneshr@ti.com, a-bhatia1@ti.com, j-luthra@ti.com,
b-brnich@ti.com, detheridge@ti.com, p-mantena@ti.com,
vijayp@ti.com, andrzej.p@collabora.com, nicolas@ndufresne.ca
Subject: Re: [PATCH v7 6/8] math.h Add macros to round to closest specified power of 2
Date: Fri, 10 May 2024 18:15:34 +0300 [thread overview]
Message-ID: <87fruphf55.fsf@intel.com> (raw)
In-Reply-To: <Zj42vTpyH71TWeTk@smile.fi.intel.com>
On Fri, 10 May 2024, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Fri, May 10, 2024 at 12:09:52AM +0530, Devarsh Thakkar wrote:
>> Add macros to round to nearest specified power of 2.
>
> This is not what they are doing. For the above we already have macros defined.
>
>> Two macros are added :
>
> (Yes, after I wrapped to comment this line looks better on its own,
> so whatever will be the first sentence, this line should be separated
> from.)
>
>> round_closest_up and round_closest_down which round up to nearest multiple
>
> round_closest_up() and round_closest_down()
>
>
>> of 2 with a preference to round up or round down respectively if there are
>> two possible nearest values to the given number.
>
> You should reformulate, because AFAICS there is the crucial difference
> from these and existing round_*_pow_of_two().
Moreover, I think the naming of round_up() and round_down() should have
reflected the fact that they operate on powers of 2. It's unfortunate
that the difference to roundup() and rounddown() is just the underscore!
That's just a trap.
So let's perhaps not repeat the same with round_closest_up() and
round_closest_down()?
BR,
Jani.
>
>> This patch is inspired from the Mentor Graphics IPU driver [1] which uses
>> similar macro locally and which can be updated to use this generic macro
>> instead along with other drivers having similar requirements.
>>
>> [1]:
>> https://elixir.bootlin.com/linux/v6.8.9/source/drivers/gpu/ipu-v3/ipu-image-convert.c#L480
>
> Instead of this, just add a patch to convert that driver to use this new macro.
> Besides, this paragraph should go to the comment/changelog area below.
>
>> Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
>> ---
>> V1->V6 (No change, patch introduced in V7)
>> ---
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-05-10 15:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 18:39 [PATCH v7 6/8] math.h Add macros to round to closest specified power of 2 Devarsh Thakkar
2024-05-10 15:01 ` Andy Shevchenko
2024-05-10 15:15 ` Jani Nikula [this message]
2024-05-10 15:28 ` Andy Shevchenko
2024-05-11 17:41 ` Devarsh Thakkar
2024-05-13 8:59 ` Andy Shevchenko
2024-05-13 11:25 ` Devarsh Thakkar
2024-05-13 12:25 ` Andy Shevchenko
2024-05-13 13:04 ` Devarsh Thakkar
2024-05-13 13:14 ` Andy Shevchenko
2024-05-11 17:26 ` Devarsh Thakkar
2024-05-12 4:46 ` Alexey Dobriyan
2024-05-13 8:55 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fruphf55.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=a-bhatia1@ti.com \
--cc=adobriyan@gmail.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andrzej.p@collabora.com \
--cc=b-brnich@ti.com \
--cc=benjamin.gaignard@collabora.com \
--cc=daniel@ffwll.ch \
--cc=detheridge@ti.com \
--cc=devarsht@ti.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=j-luthra@ti.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nicolas@ndufresne.ca \
--cc=nm@ti.com \
--cc=p-mantena@ti.com \
--cc=p.zabel@pengutronix.de \
--cc=praneeth@ti.com \
--cc=sebastian.fricke@collabora.com \
--cc=vigneshr@ti.com \
--cc=vijayp@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.