All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Ekstrand <jason@jlekstrand.net>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Check for nomodeset in i915_init() first
Date: Tue, 20 Jul 2021 10:53:10 -0500	[thread overview]
Message-ID: <CAOFGe95qO8Wtkw453nr9SXktBWVXg3Uepv98Nenrgr270tTwKQ@mail.gmail.com> (raw)
In-Reply-To: <20210719083534.2949348-1-daniel.vetter@ffwll.ch>

On Mon, Jul 19, 2021 at 3:35 AM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> Jason is trying to sort out the unwinding in i915_init and i915_exit,
> while reviewing those patches I noticed that we also have the
> nomodeset handling now in the middle of things.
>
> Pull that out for simplisity in unwinding - if you run selftest with
> nomodeset you get nothing, *shrug*.
>
> Cc: Jason Ekstrand <jason@jlekstrand.net>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_pci.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 67696d752271..6fe709ac1b4b 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -1199,14 +1199,6 @@ static int __init i915_init(void)
>         bool use_kms = true;
>         int err;
>
> -       err = i915_globals_init();
> -       if (err)
> -               return err;
> -
> -       err = i915_mock_selftests();
> -       if (err)
> -               return err > 0 ? 0 : err;
> -
>         /*
>          * Enable KMS by default, unless explicitly overriden by
>          * either the i915.modeset prarameter or by the
> @@ -1225,6 +1217,14 @@ static int __init i915_init(void)
>                 return 0;
>         }
>
> +       err = i915_globals_init();
> +       if (err)
> +               return err;
> +
> +       err = i915_mock_selftests();
> +       if (err)
> +               return err > 0 ? 0 : err;
> +

Annoyingly, this actually makes i915_exit() harder because now we need
to conditionals: One for "do you have globals?" and one for "do you
have anything at all?".  It's actually easier to get right if we have

i915_globals_init()

/* Everything that can return 0 early */

fully_loaded = true

/* Everything that can fail */

>         i915_pmu_init();
>
>         err = pci_register_driver(&i915_pci_driver);
> --
> 2.32.0
>

WARNING: multiple messages have this Message-ID (diff)
From: Jason Ekstrand <jason@jlekstrand.net>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Check for nomodeset in i915_init() first
Date: Tue, 20 Jul 2021 10:53:10 -0500	[thread overview]
Message-ID: <CAOFGe95qO8Wtkw453nr9SXktBWVXg3Uepv98Nenrgr270tTwKQ@mail.gmail.com> (raw)
In-Reply-To: <20210719083534.2949348-1-daniel.vetter@ffwll.ch>

On Mon, Jul 19, 2021 at 3:35 AM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> Jason is trying to sort out the unwinding in i915_init and i915_exit,
> while reviewing those patches I noticed that we also have the
> nomodeset handling now in the middle of things.
>
> Pull that out for simplisity in unwinding - if you run selftest with
> nomodeset you get nothing, *shrug*.
>
> Cc: Jason Ekstrand <jason@jlekstrand.net>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_pci.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 67696d752271..6fe709ac1b4b 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -1199,14 +1199,6 @@ static int __init i915_init(void)
>         bool use_kms = true;
>         int err;
>
> -       err = i915_globals_init();
> -       if (err)
> -               return err;
> -
> -       err = i915_mock_selftests();
> -       if (err)
> -               return err > 0 ? 0 : err;
> -
>         /*
>          * Enable KMS by default, unless explicitly overriden by
>          * either the i915.modeset prarameter or by the
> @@ -1225,6 +1217,14 @@ static int __init i915_init(void)
>                 return 0;
>         }
>
> +       err = i915_globals_init();
> +       if (err)
> +               return err;
> +
> +       err = i915_mock_selftests();
> +       if (err)
> +               return err > 0 ? 0 : err;
> +

Annoyingly, this actually makes i915_exit() harder because now we need
to conditionals: One for "do you have globals?" and one for "do you
have anything at all?".  It's actually easier to get right if we have

i915_globals_init()

/* Everything that can return 0 early */

fully_loaded = true

/* Everything that can fail */

>         i915_pmu_init();
>
>         err = pci_register_driver(&i915_pci_driver);
> --
> 2.32.0
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2021-07-20 15:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19  8:35 [PATCH] drm/i915: Check for nomodeset in i915_init() first Daniel Vetter
2021-07-19  8:35 ` [Intel-gfx] " Daniel Vetter
2021-07-19  9:05 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-07-19  9:09 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
2021-07-19  9:09   ` Tvrtko Ursulin
2021-07-19  9:37   ` Tvrtko Ursulin
2021-07-19  9:37     ` Tvrtko Ursulin
2021-07-19  9:09 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
2021-07-19  9:31 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-19 12:28 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-07-20 15:53 ` Jason Ekstrand [this message]
2021-07-20 15:53   ` [Intel-gfx] [PATCH] " Jason Ekstrand

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=CAOFGe95qO8Wtkw453nr9SXktBWVXg3Uepv98Nenrgr270tTwKQ@mail.gmail.com \
    --to=jason@jlekstrand.net \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.