@@ -422,8 +422,8 @@ static int prepare_xfer(partition_t *part, int i)
422422 header .LogicalEUN = cpu_to_le16 (0xffff );
423423 header .EraseCount = cpu_to_le32 (xfer -> EraseCount );
424424
425- ret = part -> mbd . mtd -> write (part -> mbd .mtd , xfer -> Offset , sizeof (header ),
426- & retlen , (u_char * )& header );
425+ ret = mtd_write (part -> mbd .mtd , xfer -> Offset , sizeof (header ), & retlen ,
426+ (u_char * )& header );
427427
428428 if (ret ) {
429429 return ret ;
@@ -438,8 +438,8 @@ static int prepare_xfer(partition_t *part, int i)
438438
439439 for (i = 0 ; i < nbam ; i ++ , offset += sizeof (uint32_t )) {
440440
441- ret = part -> mbd . mtd -> write (part -> mbd .mtd , offset , sizeof (uint32_t ),
442- & retlen , (u_char * )& ctl );
441+ ret = mtd_write (part -> mbd .mtd , offset , sizeof (uint32_t ), & retlen ,
442+ (u_char * )& ctl );
443443
444444 if (ret )
445445 return ret ;
@@ -503,8 +503,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit,
503503 offset = xfer -> Offset + 20 ; /* Bad! */
504504 unit = cpu_to_le16 (0x7fff );
505505
506- ret = part -> mbd . mtd -> write (part -> mbd .mtd , offset , sizeof (uint16_t ),
507- & retlen , (u_char * ) & unit );
506+ ret = mtd_write (part -> mbd .mtd , offset , sizeof (uint16_t ), & retlen ,
507+ (u_char * )& unit );
508508
509509 if (ret ) {
510510 printk ( KERN_WARNING "ftl: Failed to write back to BAM cache in copy_erase_unit()!\n" );
@@ -531,8 +531,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit,
531531 }
532532
533533
534- ret = part -> mbd . mtd -> write (part -> mbd .mtd , dest , SECTOR_SIZE ,
535- & retlen , (u_char * ) buf );
534+ ret = mtd_write (part -> mbd .mtd , dest , SECTOR_SIZE , & retlen ,
535+ (u_char * )buf );
536536 if (ret ) {
537537 printk (KERN_WARNING "ftl: Error writing new xfer unit in copy_erase_unit\n" );
538538 return ret ;
@@ -550,18 +550,20 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit,
550550 }
551551
552552 /* Write the BAM to the transfer unit */
553- ret = part -> mbd .mtd -> write (part -> mbd .mtd , xfer -> Offset + le32_to_cpu (part -> header .BAMOffset ),
554- part -> BlocksPerUnit * sizeof (int32_t ), & retlen ,
555- (u_char * )part -> bam_cache );
553+ ret = mtd_write (part -> mbd .mtd ,
554+ xfer -> Offset + le32_to_cpu (part -> header .BAMOffset ),
555+ part -> BlocksPerUnit * sizeof (int32_t ),
556+ & retlen ,
557+ (u_char * )part -> bam_cache );
556558 if (ret ) {
557559 printk ( KERN_WARNING "ftl: Error writing BAM in copy_erase_unit\n" );
558560 return ret ;
559561 }
560562
561563
562564 /* All clear? Then update the LogicalEUN again */
563- ret = part -> mbd . mtd -> write (part -> mbd .mtd , xfer -> Offset + 20 , sizeof (uint16_t ),
564- & retlen , (u_char * )& srcunitswap );
565+ ret = mtd_write (part -> mbd .mtd , xfer -> Offset + 20 , sizeof (uint16_t ),
566+ & retlen , (u_char * )& srcunitswap );
565567
566568 if (ret ) {
567569 printk (KERN_WARNING "ftl: Error writing new LogicalEUN in copy_erase_unit\n" );
@@ -887,8 +889,8 @@ static int set_bam_entry(partition_t *part, uint32_t log_addr,
887889#endif
888890 part -> bam_cache [blk ] = le_virt_addr ;
889891 }
890- ret = part -> mbd . mtd -> write (part -> mbd .mtd , offset , sizeof (uint32_t ),
891- & retlen , (u_char * )& le_virt_addr );
892+ ret = mtd_write (part -> mbd .mtd , offset , sizeof (uint32_t ), & retlen ,
893+ (u_char * )& le_virt_addr );
892894
893895 if (ret ) {
894896 printk (KERN_NOTICE "ftl_cs: set_bam_entry() failed!\n" );
@@ -947,8 +949,7 @@ static int ftl_write(partition_t *part, caddr_t buffer,
947949 part -> EUNInfo [part -> bam_index ].Deleted ++ ;
948950 offset = (part -> EUNInfo [part -> bam_index ].Offset +
949951 blk * SECTOR_SIZE );
950- ret = part -> mbd .mtd -> write (part -> mbd .mtd , offset , SECTOR_SIZE , & retlen ,
951- buffer );
952+ ret = mtd_write (part -> mbd .mtd , offset , SECTOR_SIZE , & retlen , buffer );
952953
953954 if (ret ) {
954955 printk (KERN_NOTICE "ftl_cs: block write failed!\n" );
0 commit comments