blackfin video driver: update the BF52x EZKIT video framebuffer driver according to LKML review

- Allocate pseudo_palette together with fbinfo
- Code cleanup

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Bryan Wu and committed by Linus Torvalds 7ef9861c a99acc83

+14 -22
+14 -22
drivers/video/bfin-t350mcqb-fb.c
··· 91 int lq043_open_cnt; 92 int irq; 93 spinlock_t lock; /* lock */ 94 }; 95 96 static int nocursor; ··· 183 184 } 185 186 - static int bfin_t350mcqb_request_ports(int action) 187 - { 188 - u16 ppi0_req_8[] = {P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, 189 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, 190 P_PPI0_D3, P_PPI0_D4, P_PPI0_D5, 191 P_PPI0_D6, P_PPI0_D7, 0}; 192 193 if (action) { 194 if (peripheral_request_list(ppi0_req_8, DRIVER_NAME)) { 195 printk(KERN_ERR "Requesting Peripherals faild\n"); ··· 521 522 fbinfo->fbops = &bfin_t350mcqb_fb_ops; 523 524 - fbinfo->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 525 - if (!fbinfo->pseudo_palette) { 526 - printk(KERN_ERR DRIVER_NAME 527 - "Fail to allocate pseudo_palette\n"); 528 - 529 - ret = -ENOMEM; 530 - goto out4; 531 - } 532 - 533 - memset(fbinfo->pseudo_palette, 0, sizeof(u32) * 16); 534 535 if (fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0) 536 < 0) { ··· 529 "Fail to allocate colormap (%d entries)\n", 530 BFIN_LCD_NBR_PALETTE_ENTRIES); 531 ret = -EFAULT; 532 - goto out5; 533 } 534 535 if (bfin_t350mcqb_request_ports(1)) { ··· 544 goto out7; 545 } 546 547 - if (request_irq(info->irq, (void *)bfin_t350mcqb_irq_error, IRQF_DISABLED, 548 - "PPI ERROR", info) < 0) { 549 printk(KERN_ERR DRIVER_NAME 550 ": unable to request PPI ERROR IRQ\n"); 551 - ret = -EFAULT; 552 goto out7; 553 } 554 ··· 576 bfin_t350mcqb_request_ports(0); 577 out6: 578 fb_dealloc_cmap(&fbinfo->cmap); 579 - out5: 580 - kfree(fbinfo->pseudo_palette); 581 out4: 582 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 583 info->dma_handle); ··· 595 struct fb_info *fbinfo = platform_get_drvdata(pdev); 596 struct bfin_t350mcqbfb_info *info = fbinfo->par; 597 598 free_dma(CH_PPI); 599 free_irq(info->irq, info); 600 ··· 604 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 605 info->dma_handle); 606 607 - kfree(fbinfo->pseudo_palette); 608 fb_dealloc_cmap(&fbinfo->cmap); 609 610 #ifndef NO_BL_SUPPORT ··· 611 backlight_device_unregister(bl_dev); 612 #endif 613 614 - unregister_framebuffer(fbinfo); 615 - 616 bfin_t350mcqb_request_ports(0); 617 618 printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); 619
··· 91 int lq043_open_cnt; 92 int irq; 93 spinlock_t lock; /* lock */ 94 + u32 pseudo_pal[16]; 95 }; 96 97 static int nocursor; ··· 182 183 } 184 185 + static u16 ppi0_req_8[] = {P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, 186 P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, 187 P_PPI0_D3, P_PPI0_D4, P_PPI0_D5, 188 P_PPI0_D6, P_PPI0_D7, 0}; 189 190 + static int bfin_t350mcqb_request_ports(int action) 191 + { 192 if (action) { 193 if (peripheral_request_list(ppi0_req_8, DRIVER_NAME)) { 194 printk(KERN_ERR "Requesting Peripherals faild\n"); ··· 520 521 fbinfo->fbops = &bfin_t350mcqb_fb_ops; 522 523 + fbinfo->pseudo_palette = &info->pseudo_pal; 524 525 if (fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0) 526 < 0) { ··· 537 "Fail to allocate colormap (%d entries)\n", 538 BFIN_LCD_NBR_PALETTE_ENTRIES); 539 ret = -EFAULT; 540 + goto out4; 541 } 542 543 if (bfin_t350mcqb_request_ports(1)) { ··· 552 goto out7; 553 } 554 555 + ret = request_irq(info->irq, bfin_t350mcqb_irq_error, IRQF_DISABLED, 556 + "PPI ERROR", info); 557 + if (ret < 0) { 558 printk(KERN_ERR DRIVER_NAME 559 ": unable to request PPI ERROR IRQ\n"); 560 goto out7; 561 } 562 ··· 584 bfin_t350mcqb_request_ports(0); 585 out6: 586 fb_dealloc_cmap(&fbinfo->cmap); 587 out4: 588 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 589 info->dma_handle); ··· 605 struct fb_info *fbinfo = platform_get_drvdata(pdev); 606 struct bfin_t350mcqbfb_info *info = fbinfo->par; 607 608 + unregister_framebuffer(fbinfo); 609 + 610 free_dma(CH_PPI); 611 free_irq(info->irq, info); 612 ··· 612 dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, 613 info->dma_handle); 614 615 fb_dealloc_cmap(&fbinfo->cmap); 616 617 #ifndef NO_BL_SUPPORT ··· 620 backlight_device_unregister(bl_dev); 621 #endif 622 623 bfin_t350mcqb_request_ports(0); 624 + 625 + platform_set_drvdata(pdev, NULL); 626 + framebuffer_release(fbinfo); 627 628 printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); 629