public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	James Simmons <jsimmons@infradead.org>
Subject: Re: [PATCH] drm: add locked variant of drm_fb_helper_force_kernel_mode
Date: Mon, 12 Apr 2010 08:46:13 -0700	[thread overview]
Message-ID: <20100412084613.78788e9d@virtuousgeek.org> (raw)
In-Reply-To: <z2q21d7e9971004111705p4d1760dax9f324777be44f299@mail.gmail.com>

On Mon, 12 Apr 2010 10:05:00 +1000
Dave Airlie <airlied@gmail.com> wrote:

> On Sat, Apr 10, 2010 at 8:11 AM, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> > Needed for panic and kdb, since we need to avoid taking the mode_config
> > mutex.
> 
> One comment below.
> 
> >
> > Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > ---
> >  drivers/gpu/drm/drm_fb_helper.c |   42 +++++++++++++++++++++++++++++++++-----
> >  1 files changed, 36 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index 6929f5b..962eadb 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -242,18 +242,22 @@ static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)
> >        return 0;
> >  }
> >
> > -bool drm_fb_helper_force_kernel_mode(void)
> > +bool drm_fb_helper_force_kernel_mode_locked(void)
> >  {
> >        int i = 0;
> >        bool ret, error = false;
> >        struct drm_fb_helper *helper;
> > -
> > -       if (list_empty(&kernel_fb_helper_list))
> > -               return false;
> > +       struct drm_mode_set *mode_set;
> > +       struct drm_crtc *crtc;
> >
> >        list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) {
> >                for (i = 0; i < helper->crtc_count; i++) {
> > -                       struct drm_mode_set *mode_set = &helper->crtc_info[i].mode_set;
> > +                       mode_set = &helper->crtc_info[i].mode_set;
> > +                       crtc = helper->crtc_info[i].mode_set.crtc;
> > +
> > +                       if (!crtc->enabled)
> > +                               continue;
> > +
> >                        ret = drm_crtc_helper_set_config(mode_set);
> >                        if (ret)
> >                                error = true;
> > @@ -262,11 +266,37 @@ bool drm_fb_helper_force_kernel_mode(void)
> >        return error;
> >  }
> >
> > +bool drm_fb_helper_force_kernel_mode(void)
> > +{
> > +       bool ret;
> > +       struct drm_device *dev;
> > +       struct drm_fb_helper *helper;
> > +       struct drm_mode_set *mode_set;
> > +
> > +       if (list_empty(&kernel_fb_helper_list)) {
> > +               DRM_DEBUG_KMS("no fb helper list??\n");
> > +               return false;
> > +       }
> > +
> > +       /* Get the DRM device */
> > +       helper = list_first_entry(&kernel_fb_helper_list,
> > +                                 struct drm_fb_helper,
> > +                                 kernel_fb_list);
> > +       mode_set = &helper->crtc_info[0].mode_set;
> > +       dev = mode_set->crtc->dev;
> > +
> > +       mutex_lock(&dev->mode_config.mutex);
> > +       ret = drm_fb_helper_force_kernel_mode_locked();
> > +       mutex_unlock(&dev->mode_config.mutex);
> > +
> > +       return ret;
> > +}
> > +
> >  int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
> >                        void *panic_str)
> >  {
> >        DRM_ERROR("panic occurred, switching back to text console\n");
> > -       return drm_fb_helper_force_kernel_mode();
> > +       drm_fb_helper_force_kernel_mode_locked();
> 
> Any reason to drop the return here?
> 
> not just remove the return 0?

Oh no; I don't think the return value is checked anywhere but we may as
well return it anyway.

-- 
Jesse Barnes, Intel Open Source Technology Center

  reply	other threads:[~2010-04-12 15:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 22:10 [RFC] Try a bit harder to get output on the screen at panic time Jesse Barnes
2010-04-09 22:11 ` [PATCH] drm: add locked variant of drm_fb_helper_force_kernel_mode Jesse Barnes
2010-04-12  0:05   ` Dave Airlie
2010-04-12 15:46     ` Jesse Barnes [this message]
2010-04-12 16:05     ` Jesse Barnes
2010-04-09 22:12 ` [PATCH] vt: try harder to print output when panicing Jesse Barnes
2010-04-09 22:12 ` [PATCH] fbcon: assume console is active if panicing Jesse Barnes
2010-04-19 22:05 ` [RFC] Try a bit harder to get output on the screen at panic time Jesse Barnes
2010-05-20  0:34 ` Jesse Barnes
2010-05-20  1:13   ` Maxim Levitsky
2010-05-20  1:27     ` Maxim Levitsky
2010-05-20 16:28       ` Jesse Barnes
2010-05-20 21:14         ` Maxim Levitsky
2010-05-21 21:57           ` Maxim Levitsky
2010-05-21 22:02             ` Jesse Barnes
2010-05-21 22:26               ` Maxim Levitsky
2010-05-30 14:48                 ` Maxim Levitsky
2010-06-06 16:36   ` James Simmons
2010-06-08 23:20     ` Jesse Barnes

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=20100412084613.78788e9d@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox