@@ -269,7 +269,7 @@ static int read_abs_bbt(struct nand_chip *this, uint8_t *buf,
269269
270270 if (td -> options & NAND_BBT_PERCHIP ) {
271271 int offs = 0 ;
272- for (i = 0 ; i < this -> numchips ; i ++ ) {
272+ for (i = 0 ; i < nanddev_ntargets ( & this -> base ) ; i ++ ) {
273273 if (chip == -1 || chip == i )
274274 res = read_bbt (this , buf , td -> pages [i ],
275275 targetsize >> this -> bbt_erase_shift ,
@@ -478,9 +478,9 @@ static int create_bbt(struct nand_chip *this, uint8_t *buf,
478478 startblock = 0 ;
479479 from = 0 ;
480480 } else {
481- if (chip >= this -> numchips ) {
481+ if (chip >= nanddev_ntargets ( & this -> base ) ) {
482482 pr_warn ("create_bbt(): chipnr (%d) > available chips (%d)\n" ,
483- chip + 1 , this -> numchips );
483+ chip + 1 , nanddev_ntargets ( & this -> base ) );
484484 return - EINVAL ;
485485 }
486486 numblocks = targetsize >> this -> bbt_erase_shift ;
@@ -550,7 +550,7 @@ static int search_bbt(struct nand_chip *this, uint8_t *buf,
550550
551551 /* Do we have a bbt per chip? */
552552 if (td -> options & NAND_BBT_PERCHIP ) {
553- chips = this -> numchips ;
553+ chips = nanddev_ntargets ( & this -> base ) ;
554554 bbtblocks = targetsize >> this -> bbt_erase_shift ;
555555 startblock &= bbtblocks - 1 ;
556556 } else {
@@ -643,7 +643,7 @@ static int get_bbt_block(struct nand_chip *this, struct nand_bbt_descr *td,
643643
644644 numblocks = (int )(targetsize >> this -> bbt_erase_shift );
645645 if (!(td -> options & NAND_BBT_PERCHIP ))
646- numblocks *= this -> numchips ;
646+ numblocks *= nanddev_ntargets ( & this -> base ) ;
647647
648648 /*
649649 * Automatic placement of the bad block table. Search direction
@@ -745,7 +745,7 @@ static int write_bbt(struct nand_chip *this, uint8_t *buf,
745745 numblocks = (int )(targetsize >> this -> bbt_erase_shift );
746746 /* Full device write or specific chip? */
747747 if (chipsel == -1 ) {
748- nrchips = this -> numchips ;
748+ nrchips = nanddev_ntargets ( & this -> base ) ;
749749 } else {
750750 nrchips = chipsel + 1 ;
751751 chip = chipsel ;
@@ -932,7 +932,7 @@ static int check_create(struct nand_chip *this, uint8_t *buf,
932932
933933 /* Do we have a bbt per chip? */
934934 if (td -> options & NAND_BBT_PERCHIP )
935- chips = this -> numchips ;
935+ chips = nanddev_ntargets ( & this -> base ) ;
936936 else
937937 chips = 1 ;
938938
@@ -1111,7 +1111,7 @@ static void mark_bbt_region(struct nand_chip *this, struct nand_bbt_descr *td)
11111111
11121112 /* Do we have a bbt per chip? */
11131113 if (td -> options & NAND_BBT_PERCHIP ) {
1114- chips = this -> numchips ;
1114+ chips = nanddev_ntargets ( & this -> base ) ;
11151115 nrblocks = (int )(targetsize >> this -> bbt_erase_shift );
11161116 } else {
11171117 chips = 1 ;
0 commit comments