From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andi Shyti <andi.shyti@kernel.org>,
Krzysztof Karas <krzysztof.karas@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
Andi Shyti <andi.shyti@linux.intel.com>,
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Sebastian Brzezinka <sebastian.brzezinka@intel.com>,
Krzysztof Niemiec <krzysztof.niemiec@intel.com>
Subject: Re: [PATCH v3 2/8] drm/i915/selftests: Use drm_* prints in live selftests
Date: Mon, 31 Aug 2026 11:35:25 +0300 [thread overview]
Message-ID: <c037c57d1176cdf182208dc8228b8afd3d8f8838@intel.com> (raw)
In-Reply-To: <apGaXnTIuHa5mbti@zenone.zhora.eu>
On Fri, 28 Aug 2026, Andi Shyti <andi.shyti@kernel.org> wrote:
> Hi Krzysztof,
>
> ...
>
>> static int intel_fw_table_check(const struct intel_forcewake_range *ranges,
>> unsigned int num_ranges,
>> - bool is_watertight)
>> + bool is_watertight,
>> + const struct drm_device *drm)
First, we generally don't pass around struct drm_device *, it's struct
drm_i915_private * in i915.
Second, the highest level context parameters should be first. This one
looks like an afterthought.
>> {
>> unsigned int i;
>> s32 prev;
>> @@ -36,22 +39,22 @@ static int intel_fw_table_check(const struct intel_forcewake_range *ranges,
>> for (i = 0, prev = -1; i < num_ranges; i++, ranges++) {
>> /* Check that the table is watertight */
>> if (is_watertight && (prev + 1) != (s32)ranges->start) {
>> - pr_err("%s: entry[%d]:(%x, %x) is not watertight to previous (%x)\n",
>> - __func__, i, ranges->start, ranges->end, prev);
>> + drm_err(drm, "%s: entry[%d]:(%x, %x) is not watertight to previous (%x)\n",
>> + __func__, i, ranges->start, ranges->end, prev);
>> return -EINVAL;
>> }
>>
>> /* Check that the table never goes backwards */
>> if (prev >= (s32)ranges->start) {
>> - pr_err("%s: entry[%d]:(%x, %x) is less than the previous (%x)\n",
>> - __func__, i, ranges->start, ranges->end, prev);
>> + drm_err(drm, "%s: entry[%d]:(%x, %x) is less than the previous (%x)\n",
>> + __func__, i, ranges->start, ranges->end, prev);
>> return -EINVAL;
>> }
>>
>> /* Check that the entry is valid */
>> if (ranges->start >= ranges->end) {
>> - pr_err("%s: entry[%d]:(%x, %x) has negative length\n",
>> - __func__, i, ranges->start, ranges->end);
>> + drm_err(drm, "%s: entry[%d]:(%x, %x) has negative length\n",
>> + __func__, i, ranges->start, ranges->end);
>> return -EINVAL;
>> }
>>
>> @@ -126,7 +129,8 @@ int intel_uncore_mock_selftests(void)
>> for (i = 0; i < ARRAY_SIZE(fw); i++) {
>> err = intel_fw_table_check(fw[i].ranges,
>> fw[i].num_ranges,
>> - fw[i].is_watertight);
>> + fw[i].is_watertight,
>> + NULL);
>
> arrghh! Here we are again at the drm_err(NULL,...) case.
>
> You could eventually do in intel_fw_table_check()
>
> if (drm)
> drm_err(drm, ...);
> else
> pr_err(...);
drm_err() handles NULL drm_device just fine.
>
> but I think it's not worth the effort, just leave pr_err().
> Besides, passing the drm device is quite out of the scope of the
> function itself, it's just odd!
But agreed.
BR,
Jani.
>
> Andi
>
>> if (err)
>> return err;
>> }
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-08-31 8:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 10:03 [PATCH v3 0/8] drm/i915/selftests: Modernize printing in i915 selftests Krzysztof Karas
2026-08-28 10:03 ` [PATCH v3 1/8] drm/i915/selftest: Fix a typo in alloc_workqueue call Krzysztof Karas
2026-08-28 14:24 ` Andi Shyti
2026-08-28 16:54 ` Andi Shyti
2026-08-28 10:03 ` [PATCH v3 2/8] drm/i915/selftests: Use drm_* prints in live selftests Krzysztof Karas
2026-08-28 14:34 ` Andi Shyti
2026-08-31 8:35 ` Jani Nikula [this message]
2026-08-28 16:41 ` Krzysztof Niemiec
2026-08-31 8:39 ` Jani Nikula
2026-08-28 10:03 ` [PATCH v3 3/8] drm/i915/selftests: Use drm_* prints in selftest helpers Krzysztof Karas
2026-08-28 15:58 ` Andi Shyti
2026-08-28 16:49 ` Krzysztof Niemiec
2026-08-28 10:03 ` [PATCH v3 4/8] drm/i915/gt/selftests: Use drm_* prints in aggregated gt selftests Krzysztof Karas
2026-08-28 16:18 ` Andi Shyti
2026-09-03 12:39 ` Krzysztof Karas
2026-08-28 17:40 ` Krzysztof Niemiec
2026-08-28 10:03 ` [PATCH v3 5/8] drm/i915/gt/selftests: Use drm_* prints in gt standalone tests Krzysztof Karas
2026-08-28 16:23 ` Andi Shyti
2026-08-28 18:02 ` Krzysztof Niemiec
2026-08-28 10:03 ` [PATCH v3 6/8] drm/i915/gt/selftests: Use drm_* prints in gt selftest helpers Krzysztof Karas
2026-08-28 16:28 ` Andi Shyti
2026-08-28 18:06 ` Krzysztof Niemiec
2026-08-28 10:03 ` [PATCH v3 7/8] drm/i915/selftests: Use drm_* prints in selftest headers Krzysztof Karas
2026-08-28 16:30 ` Andi Shyti
2026-08-28 18:08 ` Krzysztof Niemiec
2026-08-28 10:03 ` [PATCH v3 8/8] drm/i915/selftests: Add drm_device to selftest wrappers Krzysztof Karas
2026-08-28 16:36 ` Andi Shyti
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=c037c57d1176cdf182208dc8228b8afd3d8f8838@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=andi.shyti@kernel.org \
--cc=andi.shyti@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
--cc=krzysztof.karas@intel.com \
--cc=krzysztof.niemiec@intel.com \
--cc=sebastian.brzezinka@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox