.. | .. |
---|
184 | 184 | vga_io_w(VGA_GFX_I, index); |
---|
185 | 185 | } |
---|
186 | 186 | |
---|
| 187 | +/* Check if the video mode is supported by the driver */ |
---|
| 188 | +static inline int check_mode_supported(void) |
---|
| 189 | +{ |
---|
| 190 | + /* non-x86 architectures treat orig_video_isVGA as a boolean flag */ |
---|
| 191 | +#if defined(CONFIG_X86) |
---|
| 192 | + /* only EGA and VGA in 16 color graphic mode are supported */ |
---|
| 193 | + if (screen_info.orig_video_isVGA != VIDEO_TYPE_EGAC && |
---|
| 194 | + screen_info.orig_video_isVGA != VIDEO_TYPE_VGAC) |
---|
| 195 | + return -ENODEV; |
---|
| 196 | + |
---|
| 197 | + if (screen_info.orig_video_mode != 0x0D && /* 320x200/4 (EGA) */ |
---|
| 198 | + screen_info.orig_video_mode != 0x0E && /* 640x200/4 (EGA) */ |
---|
| 199 | + screen_info.orig_video_mode != 0x10 && /* 640x350/4 (EGA) */ |
---|
| 200 | + screen_info.orig_video_mode != 0x12) /* 640x480/4 (VGA) */ |
---|
| 201 | + return -ENODEV; |
---|
| 202 | +#endif |
---|
| 203 | + return 0; |
---|
| 204 | +} |
---|
| 205 | + |
---|
187 | 206 | static void vga16fb_pan_var(struct fb_info *info, |
---|
188 | 207 | struct fb_var_screeninfo *var) |
---|
189 | 208 | { |
---|
.. | .. |
---|
1270 | 1289 | framebuffer_release(info); |
---|
1271 | 1290 | } |
---|
1272 | 1291 | |
---|
1273 | | -static struct fb_ops vga16fb_ops = { |
---|
| 1292 | +static const struct fb_ops vga16fb_ops = { |
---|
1274 | 1293 | .owner = THIS_MODULE, |
---|
1275 | 1294 | .fb_open = vga16fb_open, |
---|
1276 | 1295 | .fb_release = vga16fb_release, |
---|
.. | .. |
---|
1422 | 1441 | |
---|
1423 | 1442 | vga16fb_setup(option); |
---|
1424 | 1443 | #endif |
---|
| 1444 | + |
---|
| 1445 | + ret = check_mode_supported(); |
---|
| 1446 | + if (ret) |
---|
| 1447 | + return ret; |
---|
| 1448 | + |
---|
1425 | 1449 | ret = platform_driver_register(&vga16fb_driver); |
---|
1426 | 1450 | |
---|
1427 | 1451 | if (!ret) { |
---|