aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/wl.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-18 06:19:52 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-24 06:36:09 -0400
commit9c9ec147709e63e4e8ac6a037c6bb50688ff8e9c (patch)
treed66805c819ffa2ae42bf5743ac77f077c903ad19 /drivers/mtd/ubi/wl.c
parent4d88de4beb6f327dfc7c2221eab532dad5b2bb3e (diff)
UBI: fix checkpatch.pl errors and warnings
Just out or curiousity ran checkpatch.pl for whole UBI, and discovered there are quite a few of stylistic issues. Fix them. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/wl.c')
-rw-r--r--drivers/mtd/ubi/wl.c92
1 files changed, 44 insertions, 48 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 6821952bcdb8..2a5d2a0e14ad 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -475,52 +475,47 @@ retry:
475 } 475 }
476 476
477 switch (dtype) { 477 switch (dtype) {
478 case UBI_LONGTERM: 478 case UBI_LONGTERM:
479 /* 479 /*
480 * For long term data we pick a physical eraseblock 480 * For long term data we pick a physical eraseblock with high
481 * with high erase counter. But the highest erase 481 * erase counter. But the highest erase counter we can pick is
482 * counter we can pick is bounded by the the lowest 482 * bounded by the the lowest erase counter plus
483 * erase counter plus %WL_FREE_MAX_DIFF. 483 * %WL_FREE_MAX_DIFF.
484 */ 484 */
485 e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF); 485 e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF);
486 protect = LT_PROTECTION; 486 protect = LT_PROTECTION;
487 break; 487 break;
488 case UBI_UNKNOWN: 488 case UBI_UNKNOWN:
489 /* 489 /*
490 * For unknown data we pick a physical eraseblock with 490 * For unknown data we pick a physical eraseblock with medium
491 * medium erase counter. But we by no means can pick a 491 * erase counter. But we by no means can pick a physical
492 * physical eraseblock with erase counter greater or 492 * eraseblock with erase counter greater or equivalent than the
493 * equivalent than the lowest erase counter plus 493 * lowest erase counter plus %WL_FREE_MAX_DIFF.
494 * %WL_FREE_MAX_DIFF. 494 */
495 */ 495 first = rb_entry(rb_first(&ubi->free), struct ubi_wl_entry, rb);
496 first = rb_entry(rb_first(&ubi->free), 496 last = rb_entry(rb_last(&ubi->free), struct ubi_wl_entry, rb);
497 struct ubi_wl_entry, rb);
498 last = rb_entry(rb_last(&ubi->free),
499 struct ubi_wl_entry, rb);
500 497
501 if (last->ec - first->ec < WL_FREE_MAX_DIFF) 498 if (last->ec - first->ec < WL_FREE_MAX_DIFF)
502 e = rb_entry(ubi->free.rb_node, 499 e = rb_entry(ubi->free.rb_node,
503 struct ubi_wl_entry, rb); 500 struct ubi_wl_entry, rb);
504 else { 501 else {
505 medium_ec = (first->ec + WL_FREE_MAX_DIFF)/2; 502 medium_ec = (first->ec + WL_FREE_MAX_DIFF)/2;
506 e = find_wl_entry(&ubi->free, medium_ec); 503 e = find_wl_entry(&ubi->free, medium_ec);
507 } 504 }
508 protect = U_PROTECTION; 505 protect = U_PROTECTION;
509 break; 506 break;
510 case UBI_SHORTTERM: 507 case UBI_SHORTTERM:
511 /* 508 /*
512 * For short term data we pick a physical eraseblock 509 * For short term data we pick a physical eraseblock with the
513 * with the lowest erase counter as we expect it will 510 * lowest erase counter as we expect it will be erased soon.
514 * be erased soon. 511 */
515 */ 512 e = rb_entry(rb_first(&ubi->free), struct ubi_wl_entry, rb);
516 e = rb_entry(rb_first(&ubi->free), 513 protect = ST_PROTECTION;
517 struct ubi_wl_entry, rb); 514 break;
518 protect = ST_PROTECTION; 515 default:
519 break; 516 protect = 0;
520 default: 517 e = NULL;
521 protect = 0; 518 BUG();
522 e = NULL;
523 BUG();
524 } 519 }
525 520
526 /* 521 /*
@@ -584,7 +579,8 @@ found:
584 * This function returns zero in case of success and a negative error code in 579 * This function returns zero in case of success and a negative error code in
585 * case of failure. 580 * case of failure.
586 */ 581 */
587static int sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e, int torture) 582static int sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
583 int torture)
588{ 584{
589 int err; 585 int err;
590 struct ubi_ec_hdr *ec_hdr; 586 struct ubi_ec_hdr *ec_hdr;
@@ -1060,8 +1056,8 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
1060 spin_unlock(&ubi->wl_lock); 1056 spin_unlock(&ubi->wl_lock);
1061 1057
1062 /* 1058 /*
1063 * One more erase operation has happened, take care about protected 1059 * One more erase operation has happened, take care about
1064 * physical eraseblocks. 1060 * protected physical eraseblocks.
1065 */ 1061 */
1066 check_protection_over(ubi); 1062 check_protection_over(ubi);
1067 1063