From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Antonino A. Daplas" Subject: [PATCH 04/17] pmagb-b-fb: Improve diagnostics Date: Sat, 29 Sep 2007 09:27:59 +0800 Message-ID: <46FDAA1F.3030108@gmail.com> Reply-To: linux-fbdev-devel@lists.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1IbSNG-00083x-5W for linux-fbdev-devel@lists.sourceforge.net; Fri, 28 Sep 2007 19:48:10 -0700 Received: from wx-out-0506.google.com ([66.249.82.236]) by mail.sourceforge.net with esmtp (Exim 4.44) id 1IbSNE-00077M-Pd for linux-fbdev-devel@lists.sourceforge.net; Fri, 28 Sep 2007 19:48:10 -0700 Received: by wx-out-0506.google.com with SMTP id h31so2566744wxd for ; Fri, 28 Sep 2007 19:48:08 -0700 (PDT) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-fbdev-devel-bounces@lists.sourceforge.net Errors-To: linux-fbdev-devel-bounces@lists.sourceforge.net To: Andrew Morton Cc: Linux Fbdev development list , "Maciej W. Rozycki" From: Maciej W. Rozycki Add error messages to the probe call. [adaplas] On failure, return actual error value instead of -ENXIO. Signed-off-by: Maciej W. Rozycki Signed-off-by: Antonino Daplas --- drivers/video/pmagb-b-fb.c | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-) diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c index 7a0ce7d..04de41d 100644 --- a/drivers/video/pmagb-b-fb.c +++ b/drivers/video/pmagb-b-fb.c @@ -254,16 +254,23 @@ static int __init pmagbbfb_probe(struct struct pmagbbfb_par *par; char freq0[12], freq1[12]; u32 vid_base; + int err; info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); - if (!info) + if (!info) { + printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id); return -ENOMEM; + } par = info->par; dev_set_drvdata(dev, info); - if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) + if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { + printk(KERN_ERR "%s: Cannot allocate color map\n", + dev->bus_id); + err = -ENOMEM; goto err_alloc; + } info->fbops = &pmagbbfb_ops; info->fix = pmagbbfb_fix; @@ -273,22 +280,31 @@ static int __init pmagbbfb_probe(struct /* Request the I/O MEM resource. */ start = tdev->resource.start; len = tdev->resource.end - start + 1; - if (!request_mem_region(start, len, dev->bus_id)) + if (!request_mem_region(start, len, dev->bus_id)) { + printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); + err = -EBUSY; goto err_cmap; + } /* MMIO mapping setup. */ info->fix.mmio_start = start; par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); - if (!par->mmio) + if (!par->mmio) { + printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); + err = -ENOMEM; goto err_resource; + } par->sfb = par->mmio + PMAGB_B_SFB; par->dac = par->mmio + PMAGB_B_BT459; /* Frame buffer mapping setup. */ info->fix.smem_start = start + PMAGB_B_FBMEM; par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len); - if (!par->smem) + if (!par->smem) { + printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); + err = -ENOMEM; goto err_mmio_map; + } vid_base = sfb_read(par, SFB_REG_VID_BASE); info->screen_base = (void __iomem *)par->smem + vid_base * 0x1000; info->screen_size = info->fix.smem_len - 2 * vid_base * 0x1000; @@ -297,8 +313,12 @@ static int __init pmagbbfb_probe(struct pmagbbfb_screen_setup(info); pmagbbfb_osc_setup(info); - if (register_framebuffer(info) < 0) + err = register_framebuffer(info); + if (err < 0) { + printk(KERN_ERR "%s: Cannot register framebuffer\n", + dev->bus_id); goto err_smem_map; + } get_device(dev); @@ -330,7 +350,7 @@ err_cmap: err_alloc: framebuffer_release(info); - return -ENXIO; + return err; } static int __exit pmagbbfb_remove(struct device *dev) ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/