aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>2007-02-12 03:55:19 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:44 -0500
commit9791d763de8cca82b42a7a579e031db78e8011ff (patch)
treeb3a13693bad97543a75a53a2c5d97ad63ed26c09
parent5c52cbeb7f27e1242e88f99f7f6486a16d5733c7 (diff)
[PATCH] fbdev modedb: make more pointer parameters const
fbdev modedb: make more input and output pointer parameters const Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Cc: James Simmons <jsimmons@infradead.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/console/fbcon.c4
-rw-r--r--drivers/video/console/fbcon.h2
-rw-r--r--drivers/video/fbsysfs.c2
-rw-r--r--drivers/video/i810/i810_main.c4
-rw-r--r--drivers/video/modedb.c33
-rw-r--r--drivers/video/nvidia/nvidia.c8
-rw-r--r--drivers/video/riva/fbdev.c5
-rw-r--r--drivers/video/savage/savagefb_driver.c12
-rw-r--r--include/linux/fb.h31
9 files changed, 52 insertions, 49 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 31f476a64790..ce5ac268074e 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -2071,7 +2071,7 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
2071 y_diff = info->var.yres - var.yres; 2071 y_diff = info->var.yres - var.yres;
2072 if (x_diff < 0 || x_diff > virt_fw || 2072 if (x_diff < 0 || x_diff > virt_fw ||
2073 y_diff < 0 || y_diff > virt_fh) { 2073 y_diff < 0 || y_diff > virt_fh) {
2074 struct fb_videomode *mode; 2074 const struct fb_videomode *mode;
2075 2075
2076 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres); 2076 DPRINTK("attempting resize %ix%i\n", var.xres, var.yres);
2077 mode = fb_find_best_mode(&var, &info->modelist); 2077 mode = fb_find_best_mode(&var, &info->modelist);
@@ -2975,7 +2975,7 @@ static void fbcon_new_modelist(struct fb_info *info)
2975 int i; 2975 int i;
2976 struct vc_data *vc; 2976 struct vc_data *vc;
2977 struct fb_var_screeninfo var; 2977 struct fb_var_screeninfo var;
2978 struct fb_videomode *mode; 2978 const struct fb_videomode *mode;
2979 2979
2980 for (i = first_fb_vc; i <= last_fb_vc; i++) { 2980 for (i = first_fb_vc; i <= last_fb_vc; i++) {
2981 if (registered_fb[con2fb_map[i]] != info) 2981 if (registered_fb[con2fb_map[i]] != info)
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index b9386d168c04..71f24e00fcd0 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -48,7 +48,7 @@ struct display {
48 struct fb_bitfield green; 48 struct fb_bitfield green;
49 struct fb_bitfield blue; 49 struct fb_bitfield blue;
50 struct fb_bitfield transp; 50 struct fb_bitfield transp;
51 struct fb_videomode *mode; 51 const struct fb_videomode *mode;
52}; 52};
53 53
54struct fbcon_ops { 54struct fbcon_ops {
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index 323bdf6fc7d5..818fb09105f9 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -175,7 +175,7 @@ static ssize_t store_modes(struct device *device,
175 175
176 acquire_console_sem(); 176 acquire_console_sem();
177 list_splice(&fb_info->modelist, &old_list); 177 list_splice(&fb_info->modelist, &old_list);
178 fb_videomode_to_modelist((struct fb_videomode *)buf, i, 178 fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
179 &fb_info->modelist); 179 &fb_info->modelist);
180 if (fb_new_modelist(fb_info)) { 180 if (fb_new_modelist(fb_info)) {
181 fb_destroy_modelist(&fb_info->modelist); 181 fb_destroy_modelist(&fb_info->modelist);
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 29f89db428ce..ab1b8fe34d6d 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -1049,7 +1049,7 @@ static int i810_check_params(struct fb_var_screeninfo *var,
1049 mode_valid = 1; 1049 mode_valid = 1;
1050 1050
1051 if (!mode_valid && info->monspecs.modedb_len) { 1051 if (!mode_valid && info->monspecs.modedb_len) {
1052 struct fb_videomode *mode; 1052 const struct fb_videomode *mode;
1053 1053
1054 mode = fb_find_best_mode(var, &info->modelist); 1054 mode = fb_find_best_mode(var, &info->modelist);
1055 if (mode) { 1055 if (mode) {
@@ -1924,7 +1924,7 @@ static void __devinit i810fb_find_init_mode(struct fb_info *info)
1924 fb_videomode_to_modelist(specs->modedb, specs->modedb_len, 1924 fb_videomode_to_modelist(specs->modedb, specs->modedb_len,
1925 &info->modelist); 1925 &info->modelist);
1926 if (specs->modedb != NULL) { 1926 if (specs->modedb != NULL) {
1927 struct fb_videomode *m; 1927 const struct fb_videomode *m;
1928 1928
1929 if (xres && yres) { 1929 if (xres && yres) {
1930 if ((m = fb_find_best_mode(&var, &info->modelist))) { 1930 if ((m = fb_find_best_mode(&var, &info->modelist))) {
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 53427a734d4b..61fc6cd25fc1 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -668,7 +668,7 @@ done:
668 * @var: pointer to struct fb_var_screeninfo 668 * @var: pointer to struct fb_var_screeninfo
669 */ 669 */
670void fb_var_to_videomode(struct fb_videomode *mode, 670void fb_var_to_videomode(struct fb_videomode *mode,
671 struct fb_var_screeninfo *var) 671 const struct fb_var_screeninfo *var)
672{ 672{
673 u32 pixclock, hfreq, htotal, vtotal; 673 u32 pixclock, hfreq, htotal, vtotal;
674 674
@@ -712,7 +712,7 @@ void fb_var_to_videomode(struct fb_videomode *mode,
712 * @mode: pointer to struct fb_videomode 712 * @mode: pointer to struct fb_videomode
713 */ 713 */
714void fb_videomode_to_var(struct fb_var_screeninfo *var, 714void fb_videomode_to_var(struct fb_var_screeninfo *var,
715 struct fb_videomode *mode) 715 const struct fb_videomode *mode)
716{ 716{
717 var->xres = mode->xres; 717 var->xres = mode->xres;
718 var->yres = mode->yres; 718 var->yres = mode->yres;
@@ -735,8 +735,8 @@ void fb_videomode_to_var(struct fb_var_screeninfo *var,
735 * RETURNS: 735 * RETURNS:
736 * 1 if equal, 0 if not 736 * 1 if equal, 0 if not
737 */ 737 */
738int fb_mode_is_equal(struct fb_videomode *mode1, 738int fb_mode_is_equal(const struct fb_videomode *mode1,
739 struct fb_videomode *mode2) 739 const struct fb_videomode *mode2)
740{ 740{
741 return (mode1->xres == mode2->xres && 741 return (mode1->xres == mode2->xres &&
742 mode1->yres == mode2->yres && 742 mode1->yres == mode2->yres &&
@@ -768,8 +768,8 @@ int fb_mode_is_equal(struct fb_videomode *mode1,
768 * var->xres and var->yres. If more than 1 videomode is found, will return 768 * var->xres and var->yres. If more than 1 videomode is found, will return
769 * the videomode with the highest refresh rate 769 * the videomode with the highest refresh rate
770 */ 770 */
771struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var, 771const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var,
772 struct list_head *head) 772 struct list_head *head)
773{ 773{
774 struct list_head *pos; 774 struct list_head *pos;
775 struct fb_modelist *modelist; 775 struct fb_modelist *modelist;
@@ -806,8 +806,8 @@ struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
806 * If more than 1 videomode is found, will return the videomode with 806 * If more than 1 videomode is found, will return the videomode with
807 * the closest refresh rate. 807 * the closest refresh rate.
808 */ 808 */
809struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode, 809const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
810 struct list_head *head) 810 struct list_head *head)
811{ 811{
812 struct list_head *pos; 812 struct list_head *pos;
813 struct fb_modelist *modelist; 813 struct fb_modelist *modelist;
@@ -845,8 +845,8 @@ struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode,
845 * RETURNS: 845 * RETURNS:
846 * struct fb_videomode, NULL if none found 846 * struct fb_videomode, NULL if none found
847 */ 847 */
848struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var, 848const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
849 struct list_head *head) 849 struct list_head *head)
850{ 850{
851 struct list_head *pos; 851 struct list_head *pos;
852 struct fb_modelist *modelist; 852 struct fb_modelist *modelist;
@@ -870,7 +870,7 @@ struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var,
870 * NOTES: 870 * NOTES:
871 * Will only add unmatched mode entries 871 * Will only add unmatched mode entries
872 */ 872 */
873int fb_add_videomode(struct fb_videomode *mode, struct list_head *head) 873int fb_add_videomode(const struct fb_videomode *mode, struct list_head *head)
874{ 874{
875 struct list_head *pos; 875 struct list_head *pos;
876 struct fb_modelist *modelist; 876 struct fb_modelist *modelist;
@@ -905,7 +905,8 @@ int fb_add_videomode(struct fb_videomode *mode, struct list_head *head)
905 * NOTES: 905 * NOTES:
906 * Will remove all matching mode entries 906 * Will remove all matching mode entries
907 */ 907 */
908void fb_delete_videomode(struct fb_videomode *mode, struct list_head *head) 908void fb_delete_videomode(const struct fb_videomode *mode,
909 struct list_head *head)
909{ 910{
910 struct list_head *pos, *n; 911 struct list_head *pos, *n;
911 struct fb_modelist *modelist; 912 struct fb_modelist *modelist;
@@ -941,7 +942,7 @@ void fb_destroy_modelist(struct list_head *head)
941 * @num: number of entries in array 942 * @num: number of entries in array
942 * @head: struct list_head of modelist 943 * @head: struct list_head of modelist
943 */ 944 */
944void fb_videomode_to_modelist(struct fb_videomode *modedb, int num, 945void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
945 struct list_head *head) 946 struct list_head *head)
946{ 947{
947 int i; 948 int i;
@@ -954,12 +955,12 @@ void fb_videomode_to_modelist(struct fb_videomode *modedb, int num,
954 } 955 }
955} 956}
956 957
957struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs, 958const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
958 struct list_head *head) 959 struct list_head *head)
959{ 960{
960 struct list_head *pos; 961 struct list_head *pos;
961 struct fb_modelist *modelist; 962 struct fb_modelist *modelist;
962 struct fb_videomode *m, *m1 = NULL, *md = NULL, *best = NULL; 963 const struct fb_videomode *m, *m1 = NULL, *md = NULL, *best = NULL;
963 int first = 0; 964 int first = 0;
964 965
965 if (!head->prev || !head->next || list_empty(head)) 966 if (!head->prev || !head->next || list_empty(head))
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 547374230179..8e5b484db649 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -829,7 +829,7 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
829 } 829 }
830 830
831 if (!mode_valid) { 831 if (!mode_valid) {
832 struct fb_videomode *mode; 832 const struct fb_videomode *mode;
833 833
834 mode = fb_find_best_mode(var, &info->modelist); 834 mode = fb_find_best_mode(var, &info->modelist);
835 if (mode) { 835 if (mode) {
@@ -1046,10 +1046,10 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
1046 } 1046 }
1047 1047
1048 if (specs->modedb != NULL) { 1048 if (specs->modedb != NULL) {
1049 struct fb_videomode *modedb; 1049 const struct fb_videomode *mode;
1050 1050
1051 modedb = fb_find_best_display(specs, &info->modelist); 1051 mode = fb_find_best_display(specs, &info->modelist);
1052 fb_videomode_to_var(&nvidiafb_default_var, modedb); 1052 fb_videomode_to_var(&nvidiafb_default_var, mode);
1053 nvidiafb_default_var.bits_per_pixel = bpp; 1053 nvidiafb_default_var.bits_per_pixel = bpp;
1054 } else if (par->fpWidth && par->fpHeight) { 1054 } else if (par->fpWidth && par->fpHeight) {
1055 char buf[16]; 1055 char buf[16];
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 9316905e027a..f2e9b742c92f 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -894,7 +894,8 @@ out:
894 return rc; 894 return rc;
895} 895}
896 896
897static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb) 897static void riva_update_var(struct fb_var_screeninfo *var,
898 const struct fb_videomode *modedb)
898{ 899{
899 NVTRACE_ENTER(); 900 NVTRACE_ENTER();
900 var->xres = var->xres_virtual = modedb->xres; 901 var->xres = var->xres_virtual = modedb->xres;
@@ -1152,7 +1153,7 @@ static int rivafb_release(struct fb_info *info, int user)
1152 1153
1153static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 1154static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1154{ 1155{
1155 struct fb_videomode *mode; 1156 const struct fb_videomode *mode;
1156 struct riva_par *par = info->par; 1157 struct riva_par *par = info->par;
1157 int nom, den; /* translating from pixels->bytes */ 1158 int nom, den; /* translating from pixels->bytes */
1158 int mode_valid = 0; 1159 int mode_valid = 0;
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 82b3deaae02d..4afa30522fdb 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -833,7 +833,8 @@ static void savage_set_default_par(struct savagefb_par *par,
833 vga_out8(0x3d5, cr66, par); 833 vga_out8(0x3d5, cr66, par);
834} 834}
835 835
836static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb) 836static void savage_update_var(struct fb_var_screeninfo *var,
837 const struct fb_videomode *modedb)
837{ 838{
838 var->xres = var->xres_virtual = modedb->xres; 839 var->xres = var->xres_virtual = modedb->xres;
839 var->yres = modedb->yres; 840 var->yres = modedb->yres;
@@ -902,7 +903,7 @@ static int savagefb_check_var(struct fb_var_screeninfo *var,
902 } 903 }
903 904
904 if (!mode_valid) { 905 if (!mode_valid) {
905 struct fb_videomode *mode; 906 const struct fb_videomode *mode;
906 907
907 mode = fb_find_best_mode(var, &info->modelist); 908 mode = fb_find_best_mode(var, &info->modelist);
908 if (mode) { 909 if (mode) {
@@ -2206,11 +2207,10 @@ static int __devinit savagefb_probe(struct pci_dev* dev,
2206 info->monspecs.modedb, info->monspecs.modedb_len, 2207 info->monspecs.modedb, info->monspecs.modedb_len,
2207 NULL, 8); 2208 NULL, 8);
2208 } else if (info->monspecs.modedb != NULL) { 2209 } else if (info->monspecs.modedb != NULL) {
2209 struct fb_videomode *modedb; 2210 const struct fb_videomode *mode;
2210 2211
2211 modedb = fb_find_best_display(&info->monspecs, 2212 mode = fb_find_best_display(&info->monspecs, &info->modelist);
2212 &info->modelist); 2213 savage_update_var(&info->var, mode);
2213 savage_update_var(&info->var, modedb);
2214 } 2214 }
2215 2215
2216 /* maximize virtual vertical length */ 2216 /* maximize virtual vertical length */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 9402dec393ac..a78e25683f82 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -952,25 +952,26 @@ extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
952/* drivers/video/modedb.c */ 952/* drivers/video/modedb.c */
953#define VESA_MODEDB_SIZE 34 953#define VESA_MODEDB_SIZE 34
954extern void fb_var_to_videomode(struct fb_videomode *mode, 954extern void fb_var_to_videomode(struct fb_videomode *mode,
955 struct fb_var_screeninfo *var); 955 const struct fb_var_screeninfo *var);
956extern void fb_videomode_to_var(struct fb_var_screeninfo *var, 956extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
957 struct fb_videomode *mode); 957 const struct fb_videomode *mode);
958extern int fb_mode_is_equal(struct fb_videomode *mode1, 958extern int fb_mode_is_equal(const struct fb_videomode *mode1,
959 struct fb_videomode *mode2); 959 const struct fb_videomode *mode2);
960extern int fb_add_videomode(struct fb_videomode *mode, struct list_head *head); 960extern int fb_add_videomode(const struct fb_videomode *mode,
961extern void fb_delete_videomode(struct fb_videomode *mode, 961 struct list_head *head);
962extern void fb_delete_videomode(const struct fb_videomode *mode,
962 struct list_head *head); 963 struct list_head *head);
963extern struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var, 964extern const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
964 struct list_head *head); 965 struct list_head *head);
965extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var, 966extern const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var,
966 struct list_head *head); 967 struct list_head *head);
967extern struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode, 968extern const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
968 struct list_head *head); 969 struct list_head *head);
969extern void fb_destroy_modelist(struct list_head *head); 970extern void fb_destroy_modelist(struct list_head *head);
970extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num, 971extern void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
971 struct list_head *head); 972 struct list_head *head);
972extern struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs, 973extern const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
973 struct list_head *head); 974 struct list_head *head);
974 975
975/* drivers/video/fbcmap.c */ 976/* drivers/video/fbcmap.c */
976extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); 977extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);