From: Jani Nikula <jani.nikula@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: linux-fbdev@vger.kernel.org,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 1/2] video/fb: Propagate error code from failing to unregister conflicting fb
Date: Tue, 17 Dec 2013 07:33:08 +0000 [thread overview]
Message-ID: <878uvk3paj.fsf@intel.com> (raw)
In-Reply-To: <1387209460-9042-1-git-send-email-chris@chris-wilson.co.uk>
On Mon, 16 Dec 2013, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> If we fail to remove a conflicting fb driver, we need to abort the
> loading of the second driver to avoid likely kernel panics.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: linux-fbdev@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> ---
> drivers/video/fbmem.c | 31 +++++++++++++++++++++----------
> include/linux/fb.h | 4 ++--
> 2 files changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index 010d19105ebc..e296967a3abb 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -1577,10 +1577,10 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena,
> static int do_unregister_framebuffer(struct fb_info *fb_info);
>
> #define VGA_FB_PHYS 0xA0000
> -static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
> - const char *name, bool primary)
> +static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
> + const char *name, bool primary)
> {
> - int i;
> + int i, ret;
>
> /* check all firmware fbs and kick off if the base addr overlaps */
> for (i = 0 ; i < FB_MAX; i++) {
> @@ -1599,22 +1599,29 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
> printk(KERN_INFO "fb: conflicting fb hw usage "
> "%s vs %s - removing generic driver\n",
> name, registered_fb[i]->fix.id);
> - do_unregister_framebuffer(registered_fb[i]);
> + ret = do_unregister_framebuffer(registered_fb[i]);
> + if (ret)
> + return ret;
An observation, this bails out early instead of trying to unregister all
the conflicting framebuffers regardless of errors like before. We're
probably doomed either way?
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> }
> }
> +
> + return 0;
> }
>
> static int do_register_framebuffer(struct fb_info *fb_info)
> {
> - int i;
> + int i, ret;
> struct fb_event event;
> struct fb_videomode mode;
>
> if (fb_check_foreignness(fb_info))
> return -ENOSYS;
>
> - do_remove_conflicting_framebuffers(fb_info->apertures, fb_info->fix.id,
> - fb_is_primary_device(fb_info));
> + ret = do_remove_conflicting_framebuffers(fb_info->apertures,
> + fb_info->fix.id,
> + fb_is_primary_device(fb_info));
> + if (ret)
> + return ret;
>
> if (num_registered_fb = FB_MAX)
> return -ENXIO;
> @@ -1739,12 +1746,16 @@ int unlink_framebuffer(struct fb_info *fb_info)
> }
> EXPORT_SYMBOL(unlink_framebuffer);
>
> -void remove_conflicting_framebuffers(struct apertures_struct *a,
> - const char *name, bool primary)
> +int remove_conflicting_framebuffers(struct apertures_struct *a,
> + const char *name, bool primary)
> {
> + int ret;
> +
> mutex_lock(®istration_lock);
> - do_remove_conflicting_framebuffers(a, name, primary);
> + ret = do_remove_conflicting_framebuffers(a, name, primary);
> mutex_unlock(®istration_lock);
> +
> + return ret;
> }
> EXPORT_SYMBOL(remove_conflicting_framebuffers);
>
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 70c4836e4a9f..fe6ac956550e 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -613,8 +613,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
> extern int register_framebuffer(struct fb_info *fb_info);
> extern int unregister_framebuffer(struct fb_info *fb_info);
> extern int unlink_framebuffer(struct fb_info *fb_info);
> -extern void remove_conflicting_framebuffers(struct apertures_struct *a,
> - const char *name, bool primary);
> +extern int remove_conflicting_framebuffers(struct apertures_struct *a,
> + const char *name, bool primary);
> extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
> extern int fb_show_logo(struct fb_info *fb_info, int rotate);
> extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
> --
> 1.8.5.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
next prev parent reply other threads:[~2013-12-17 7:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-16 15:57 [PATCH 1/2] video/fb: Propagate error code from failing to unregister conflicting fb Chris Wilson
2013-12-17 7:33 ` Jani Nikula [this message]
2013-12-17 12:14 ` [Intel-gfx] " Chris Wilson
2013-12-18 0:56 ` Dave Airlie
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=878uvk3paj.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=plagnioj@jcrosoft.com \
--cc=tomi.valkeinen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).