aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/fbmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r--drivers/video/fbmem.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 01072f4b3e8f..279c2dbef8f8 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1352,6 +1352,32 @@ static const struct file_operations fb_fops = {
1352 1352
1353struct class *fb_class; 1353struct class *fb_class;
1354EXPORT_SYMBOL(fb_class); 1354EXPORT_SYMBOL(fb_class);
1355
1356static int fb_check_foreignness(struct fb_info *fi)
1357{
1358 const bool foreign_endian = fi->flags & FBINFO_FOREIGN_ENDIAN;
1359
1360 fi->flags &= ~FBINFO_FOREIGN_ENDIAN;
1361
1362#ifdef __BIG_ENDIAN
1363 fi->flags |= foreign_endian ? 0 : FBINFO_BE_MATH;
1364#else
1365 fi->flags |= foreign_endian ? FBINFO_BE_MATH : 0;
1366#endif /* __BIG_ENDIAN */
1367
1368 if (fi->flags & FBINFO_BE_MATH && !fb_be_math(fi)) {
1369 pr_err("%s: enable CONFIG_FB_BIG_ENDIAN to "
1370 "support this framebuffer\n", fi->fix.id);
1371 return -ENOSYS;
1372 } else if (!(fi->flags & FBINFO_BE_MATH) && fb_be_math(fi)) {
1373 pr_err("%s: enable CONFIG_FB_LITTLE_ENDIAN to "
1374 "support this framebuffer\n", fi->fix.id);
1375 return -ENOSYS;
1376 }
1377
1378 return 0;
1379}
1380
1355/** 1381/**
1356 * register_framebuffer - registers a frame buffer device 1382 * register_framebuffer - registers a frame buffer device
1357 * @fb_info: frame buffer info structure 1383 * @fb_info: frame buffer info structure
@@ -1371,6 +1397,10 @@ register_framebuffer(struct fb_info *fb_info)
1371 1397
1372 if (num_registered_fb == FB_MAX) 1398 if (num_registered_fb == FB_MAX)
1373 return -ENXIO; 1399 return -ENXIO;
1400
1401 if (fb_check_foreignness(fb_info))
1402 return -ENOSYS;
1403
1374 num_registered_fb++; 1404 num_registered_fb++;
1375 for (i = 0 ; i < FB_MAX; i++) 1405 for (i = 0 ; i < FB_MAX; i++)
1376 if (!registered_fb[i]) 1406 if (!registered_fb[i])