Lines 42-48
Link Here
|
42 |
|
42 |
|
43 |
#define FBPIXMAPSIZE (1024 * 8) |
43 |
#define FBPIXMAPSIZE (1024 * 8) |
44 |
|
44 |
|
45 |
static DEFINE_MUTEX(registration_lock); |
|
|
46 |
struct fb_info *registered_fb[FB_MAX] __read_mostly; |
45 |
struct fb_info *registered_fb[FB_MAX] __read_mostly; |
47 |
int num_registered_fb __read_mostly; |
46 |
int num_registered_fb __read_mostly; |
48 |
|
47 |
|
Lines 53-71
static struct fb_info *get_fb_info(unsigned int idx)
Link Here
|
53 |
if (idx >= FB_MAX) |
52 |
if (idx >= FB_MAX) |
54 |
return ERR_PTR(-ENODEV); |
53 |
return ERR_PTR(-ENODEV); |
55 |
|
54 |
|
56 |
mutex_lock(®istration_lock); |
|
|
57 |
fb_info = registered_fb[idx]; |
55 |
fb_info = registered_fb[idx]; |
58 |
if (fb_info) |
|
|
59 |
atomic_inc(&fb_info->count); |
60 |
mutex_unlock(®istration_lock); |
61 |
|
56 |
|
62 |
return fb_info; |
57 |
return fb_info; |
63 |
} |
58 |
} |
64 |
|
59 |
|
65 |
static void put_fb_info(struct fb_info *fb_info) |
60 |
static void put_fb_info(struct fb_info *fb_info) |
66 |
{ |
61 |
{ |
67 |
if (!atomic_dec_and_test(&fb_info->count)) |
|
|
68 |
return; |
69 |
if (fb_info->fbops->fb_destroy) |
62 |
if (fb_info->fbops->fb_destroy) |
70 |
fb_info->fbops->fb_destroy(fb_info); |
63 |
fb_info->fbops->fb_destroy(fb_info); |
71 |
} |
64 |
} |
Lines 672-678
int fb_show_logo(struct fb_info *info, int rotate) { return 0; }
Link Here
|
672 |
|
665 |
|
673 |
static void *fb_seq_start(struct seq_file *m, loff_t *pos) |
666 |
static void *fb_seq_start(struct seq_file *m, loff_t *pos) |
674 |
{ |
667 |
{ |
675 |
mutex_lock(®istration_lock); |
|
|
676 |
return (*pos < FB_MAX) ? pos : NULL; |
668 |
return (*pos < FB_MAX) ? pos : NULL; |
677 |
} |
669 |
} |
678 |
|
670 |
|
Lines 684-690
static void *fb_seq_next(struct seq_file *m, void *v, loff_t *pos)
Link Here
|
684 |
|
676 |
|
685 |
static void fb_seq_stop(struct seq_file *m, void *v) |
677 |
static void fb_seq_stop(struct seq_file *m, void *v) |
686 |
{ |
678 |
{ |
687 |
mutex_unlock(®istration_lock); |
|
|
688 |
} |
679 |
} |
689 |
|
680 |
|
690 |
static int fb_seq_show(struct seq_file *m, void *v) |
681 |
static int fb_seq_show(struct seq_file *m, void *v) |
Lines 1587-1593
static int do_register_framebuffer(struct fb_info *fb_info)
Link Here
|
1587 |
if (!registered_fb[i]) |
1578 |
if (!registered_fb[i]) |
1588 |
break; |
1579 |
break; |
1589 |
fb_info->node = i; |
1580 |
fb_info->node = i; |
1590 |
atomic_set(&fb_info->count, 1); |
|
|
1591 |
mutex_init(&fb_info->lock); |
1581 |
mutex_init(&fb_info->lock); |
1592 |
mutex_init(&fb_info->mm_lock); |
1582 |
mutex_init(&fb_info->mm_lock); |
1593 |
|
1583 |
|
Lines 1670-1678
static int do_unregister_framebuffer(struct fb_info *fb_info)
Link Here
|
1670 |
void remove_conflicting_framebuffers(struct apertures_struct *a, |
1660 |
void remove_conflicting_framebuffers(struct apertures_struct *a, |
1671 |
const char *name, bool primary) |
1661 |
const char *name, bool primary) |
1672 |
{ |
1662 |
{ |
1673 |
mutex_lock(®istration_lock); |
|
|
1674 |
do_remove_conflicting_framebuffers(a, name, primary); |
1663 |
do_remove_conflicting_framebuffers(a, name, primary); |
1675 |
mutex_unlock(®istration_lock); |
|
|
1676 |
} |
1664 |
} |
1677 |
EXPORT_SYMBOL(remove_conflicting_framebuffers); |
1665 |
EXPORT_SYMBOL(remove_conflicting_framebuffers); |
1678 |
|
1666 |
|
Lines 1690-1698
register_framebuffer(struct fb_info *fb_info)
Link Here
|
1690 |
{ |
1678 |
{ |
1691 |
int ret; |
1679 |
int ret; |
1692 |
|
1680 |
|
1693 |
mutex_lock(®istration_lock); |
|
|
1694 |
ret = do_register_framebuffer(fb_info); |
1681 |
ret = do_register_framebuffer(fb_info); |
1695 |
mutex_unlock(®istration_lock); |
|
|
1696 |
|
1682 |
|
1697 |
return ret; |
1683 |
return ret; |
1698 |
} |
1684 |
} |
Lines 1718-1726
unregister_framebuffer(struct fb_info *fb_info)
Link Here
|
1718 |
{ |
1704 |
{ |
1719 |
int ret; |
1705 |
int ret; |
1720 |
|
1706 |
|
1721 |
mutex_lock(®istration_lock); |
|
|
1722 |
ret = do_unregister_framebuffer(fb_info); |
1707 |
ret = do_unregister_framebuffer(fb_info); |
1723 |
mutex_unlock(®istration_lock); |
|
|
1724 |
|
1708 |
|
1725 |
return ret; |
1709 |
return ret; |
1726 |
} |
1710 |
} |