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