diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2007-10-16 04:29:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:20 -0400 |
commit | 840bc9b0937aebd6004debf457cfb53f1f122d3b (patch) | |
tree | cad479ded9e807c6d657cab201695dddad8ad9e4 /drivers/video/pmagb-b-fb.c | |
parent | 076a7dce9ac3d89ef7215eecc1230177891383bd (diff) |
pmagb-b-fb: improve diagnostics
Add error messages to the probe call.
[adaplas]
On failure, return actual error value instead of -ENXIO.
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/pmagb-b-fb.c')
-rw-r--r-- | 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 7a0ce7d5af6b..9b80597241b0 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 device *dev) | |||
254 | struct pmagbbfb_par *par; | 254 | struct pmagbbfb_par *par; |
255 | char freq0[12], freq1[12]; | 255 | char freq0[12], freq1[12]; |
256 | u32 vid_base; | 256 | u32 vid_base; |
257 | int err; | ||
257 | 258 | ||
258 | info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); | 259 | info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev); |
259 | if (!info) | 260 | if (!info) { |
261 | printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id); | ||
260 | return -ENOMEM; | 262 | return -ENOMEM; |
263 | } | ||
261 | 264 | ||
262 | par = info->par; | 265 | par = info->par; |
263 | dev_set_drvdata(dev, info); | 266 | dev_set_drvdata(dev, info); |
264 | 267 | ||
265 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) | 268 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
269 | printk(KERN_ERR "%s: Cannot allocate color map\n", | ||
270 | dev->bus_id); | ||
271 | err = -ENOMEM; | ||
266 | goto err_alloc; | 272 | goto err_alloc; |
273 | } | ||
267 | 274 | ||
268 | info->fbops = &pmagbbfb_ops; | 275 | info->fbops = &pmagbbfb_ops; |
269 | info->fix = pmagbbfb_fix; | 276 | info->fix = pmagbbfb_fix; |
@@ -273,22 +280,31 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
273 | /* Request the I/O MEM resource. */ | 280 | /* Request the I/O MEM resource. */ |
274 | start = tdev->resource.start; | 281 | start = tdev->resource.start; |
275 | len = tdev->resource.end - start + 1; | 282 | len = tdev->resource.end - start + 1; |
276 | if (!request_mem_region(start, len, dev->bus_id)) | 283 | if (!request_mem_region(start, len, dev->bus_id)) { |
284 | printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id); | ||
285 | err = -EBUSY; | ||
277 | goto err_cmap; | 286 | goto err_cmap; |
287 | } | ||
278 | 288 | ||
279 | /* MMIO mapping setup. */ | 289 | /* MMIO mapping setup. */ |
280 | info->fix.mmio_start = start; | 290 | info->fix.mmio_start = start; |
281 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); | 291 | par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len); |
282 | if (!par->mmio) | 292 | if (!par->mmio) { |
293 | printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id); | ||
294 | err = -ENOMEM; | ||
283 | goto err_resource; | 295 | goto err_resource; |
296 | } | ||
284 | par->sfb = par->mmio + PMAGB_B_SFB; | 297 | par->sfb = par->mmio + PMAGB_B_SFB; |
285 | par->dac = par->mmio + PMAGB_B_BT459; | 298 | par->dac = par->mmio + PMAGB_B_BT459; |
286 | 299 | ||
287 | /* Frame buffer mapping setup. */ | 300 | /* Frame buffer mapping setup. */ |
288 | info->fix.smem_start = start + PMAGB_B_FBMEM; | 301 | info->fix.smem_start = start + PMAGB_B_FBMEM; |
289 | par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len); | 302 | par->smem = ioremap_nocache(info->fix.smem_start, info->fix.smem_len); |
290 | if (!par->smem) | 303 | if (!par->smem) { |
304 | printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id); | ||
305 | err = -ENOMEM; | ||
291 | goto err_mmio_map; | 306 | goto err_mmio_map; |
307 | } | ||
292 | vid_base = sfb_read(par, SFB_REG_VID_BASE); | 308 | vid_base = sfb_read(par, SFB_REG_VID_BASE); |
293 | info->screen_base = (void __iomem *)par->smem + vid_base * 0x1000; | 309 | info->screen_base = (void __iomem *)par->smem + vid_base * 0x1000; |
294 | info->screen_size = info->fix.smem_len - 2 * vid_base * 0x1000; | 310 | info->screen_size = info->fix.smem_len - 2 * vid_base * 0x1000; |
@@ -297,8 +313,12 @@ static int __init pmagbbfb_probe(struct device *dev) | |||
297 | pmagbbfb_screen_setup(info); | 313 | pmagbbfb_screen_setup(info); |
298 | pmagbbfb_osc_setup(info); | 314 | pmagbbfb_osc_setup(info); |
299 | 315 | ||
300 | if (register_framebuffer(info) < 0) | 316 | err = register_framebuffer(info); |
317 | if (err < 0) { | ||
318 | printk(KERN_ERR "%s: Cannot register framebuffer\n", | ||
319 | dev->bus_id); | ||
301 | goto err_smem_map; | 320 | goto err_smem_map; |
321 | } | ||
302 | 322 | ||
303 | get_device(dev); | 323 | get_device(dev); |
304 | 324 | ||
@@ -330,7 +350,7 @@ err_cmap: | |||
330 | 350 | ||
331 | err_alloc: | 351 | err_alloc: |
332 | framebuffer_release(info); | 352 | framebuffer_release(info); |
333 | return -ENXIO; | 353 | return err; |
334 | } | 354 | } |
335 | 355 | ||
336 | static int __exit pmagbbfb_remove(struct device *dev) | 356 | static int __exit pmagbbfb_remove(struct device *dev) |