aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-11-21 18:56:58 -0500
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-12 17:41:14 -0400
commitcdf88b9072a86545611b9c3f5597ebc47e50ffc1 (patch)
treec3a31efccd11d573334663557171a22dd525eea1
parent97d16fe69b6499a14a0c85c053f7bef54ce992a4 (diff)
fbdev: sh_mobile_meram: Remove unneeded sanity checks
The meram_register(), meram_unregister() and meram_update() operations check that the pointers they get from the caller are not NULL. Those checks can be remove, as the caller already ensures that the pointers are valid. The platform sanity checks can also be removed, as the operations can't be accessed without valid platform data anyway. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c5
-rw-r--r--drivers/video/sh_mobile_meram.c32
-rw-r--r--include/video/sh_mobile_meram.h15
3 files changed, 14 insertions, 38 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 4b54cd5c9564..7a0b301587f6 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1072,14 +1072,11 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
1072 1072
1073 if (ch->meram) { 1073 if (ch->meram) {
1074 struct sh_mobile_meram_info *mdev; 1074 struct sh_mobile_meram_info *mdev;
1075 int ret;
1076 1075
1077 mdev = priv->meram_dev; 1076 mdev = priv->meram_dev;
1078 ret = mdev->ops->meram_update(mdev, ch->meram, 1077 mdev->ops->meram_update(mdev, ch->meram,
1079 base_addr_y, base_addr_c, 1078 base_addr_y, base_addr_c,
1080 &base_addr_y, &base_addr_c); 1079 &base_addr_y, &base_addr_c);
1081 if (ret)
1082 return ret;
1083 } 1080 }
1084 1081
1085 ch->base_addr_y = base_addr_y; 1082 ch->base_addr_y = base_addr_y;
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
index 2ce0d8f72e31..d9f7a44c231c 100644
--- a/drivers/video/sh_mobile_meram.c
+++ b/drivers/video/sh_mobile_meram.c
@@ -451,21 +451,15 @@ static void *sh_mobile_meram_register(struct sh_mobile_meram_info *pdata,
451 unsigned int *pitch) 451 unsigned int *pitch)
452{ 452{
453 struct sh_mobile_meram_fb_cache *cache; 453 struct sh_mobile_meram_fb_cache *cache;
454 struct sh_mobile_meram_priv *priv; 454 struct sh_mobile_meram_priv *priv = pdata->priv;
455 struct platform_device *pdev; 455 struct platform_device *pdev = pdata->pdev;
456 unsigned int out_pitch; 456 unsigned int out_pitch;
457 457
458 if (!pdata || !pdata->priv || !pdata->pdev || !cfg)
459 return ERR_PTR(-EINVAL);
460
461 if (pixelformat != SH_MOBILE_MERAM_PF_NV && 458 if (pixelformat != SH_MOBILE_MERAM_PF_NV &&
462 pixelformat != SH_MOBILE_MERAM_PF_NV24 && 459 pixelformat != SH_MOBILE_MERAM_PF_NV24 &&
463 pixelformat != SH_MOBILE_MERAM_PF_RGB) 460 pixelformat != SH_MOBILE_MERAM_PF_RGB)
464 return ERR_PTR(-EINVAL); 461 return ERR_PTR(-EINVAL);
465 462
466 priv = pdata->priv;
467 pdev = pdata->pdev;
468
469 dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres, 463 dev_dbg(&pdev->dev, "registering %dx%d (%s)", xres, yres,
470 !pixelformat ? "yuv" : "rgb"); 464 !pixelformat ? "yuv" : "rgb");
471 465
@@ -500,16 +494,11 @@ err:
500 return cache; 494 return cache;
501} 495}
502 496
503static int 497static void
504sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data) 498sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
505{ 499{
506 struct sh_mobile_meram_fb_cache *cache = data; 500 struct sh_mobile_meram_fb_cache *cache = data;
507 struct sh_mobile_meram_priv *priv; 501 struct sh_mobile_meram_priv *priv = pdata->priv;
508
509 if (!pdata || !pdata->priv || !data)
510 return -EINVAL;
511
512 priv = pdata->priv;
513 502
514 mutex_lock(&priv->lock); 503 mutex_lock(&priv->lock);
515 504
@@ -521,22 +510,15 @@ sh_mobile_meram_unregister(struct sh_mobile_meram_info *pdata, void *data)
521 meram_free(priv, cache); 510 meram_free(priv, cache);
522 511
523 mutex_unlock(&priv->lock); 512 mutex_unlock(&priv->lock);
524
525 return 0;
526} 513}
527 514
528static int 515static void
529sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data, 516sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
530 unsigned long base_addr_y, unsigned long base_addr_c, 517 unsigned long base_addr_y, unsigned long base_addr_c,
531 unsigned long *icb_addr_y, unsigned long *icb_addr_c) 518 unsigned long *icb_addr_y, unsigned long *icb_addr_c)
532{ 519{
533 struct sh_mobile_meram_fb_cache *cache = data; 520 struct sh_mobile_meram_fb_cache *cache = data;
534 struct sh_mobile_meram_priv *priv; 521 struct sh_mobile_meram_priv *priv = pdata->priv;
535
536 if (!pdata || !pdata->priv || !data)
537 return -EINVAL;
538
539 priv = pdata->priv;
540 522
541 mutex_lock(&priv->lock); 523 mutex_lock(&priv->lock);
542 524
@@ -544,8 +526,6 @@ sh_mobile_meram_update(struct sh_mobile_meram_info *pdata, void *data,
544 meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c); 526 meram_get_next_icb_addr(pdata, cache, icb_addr_y, icb_addr_c);
545 527
546 mutex_unlock(&priv->lock); 528 mutex_unlock(&priv->lock);
547
548 return 0;
549} 529}
550 530
551static struct sh_mobile_meram_ops sh_mobile_meram_ops = { 531static struct sh_mobile_meram_ops sh_mobile_meram_ops = {
diff --git a/include/video/sh_mobile_meram.h b/include/video/sh_mobile_meram.h
index 553335ce7a2c..29b2fd3b147e 100644
--- a/include/video/sh_mobile_meram.h
+++ b/include/video/sh_mobile_meram.h
@@ -49,16 +49,15 @@ struct sh_mobile_meram_ops {
49 unsigned int *pitch); 49 unsigned int *pitch);
50 50
51 /* unregister usage of meram */ 51 /* unregister usage of meram */
52 int (*meram_unregister)(struct sh_mobile_meram_info *meram_dev, 52 void (*meram_unregister)(struct sh_mobile_meram_info *meram_dev,
53 void *data); 53 void *data);
54 54
55 /* update meram settings */ 55 /* update meram settings */
56 int (*meram_update)(struct sh_mobile_meram_info *meram_dev, 56 void (*meram_update)(struct sh_mobile_meram_info *meram_dev, void *data,
57 void *data, 57 unsigned long base_addr_y,
58 unsigned long base_addr_y, 58 unsigned long base_addr_c,
59 unsigned long base_addr_c, 59 unsigned long *icb_addr_y,
60 unsigned long *icb_addr_y, 60 unsigned long *icb_addr_c);
61 unsigned long *icb_addr_c);
62}; 61};
63 62
64#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */ 63#endif /* __VIDEO_SH_MOBILE_MERAM_H__ */