82
82
#define OP_WRITE_SECURITY_REVC 0x9A
83
83
#define OP_WRITE_SECURITY 0x9B /* revision D */
84
84
85
+ #define CFI_MFR_ATMEL 0x1F
85
86
86
87
struct dataflash {
87
88
u8 command [4 ];
@@ -738,28 +739,30 @@ static struct flash_info dataflash_data[] = {
738
739
739
740
static struct flash_info * jedec_probe (struct spi_device * spi )
740
741
{
741
- int tmp ;
742
- u8 code = OP_READ_ID ;
743
- u8 id [3 ];
744
- u32 jedec ;
745
- struct flash_info * info ;
742
+ int ret , i ;
743
+ u8 code = OP_READ_ID ;
744
+ u8 id [3 ];
745
+ u32 jedec ;
746
+ struct flash_info * info ;
746
747
int status ;
747
748
748
- /* JEDEC also defines an optional "extended device information"
749
+ /*
750
+ * JEDEC also defines an optional "extended device information"
749
751
* string for after vendor-specific data, after the three bytes
750
752
* we use here. Supporting some chips might require using it.
751
753
*
752
754
* If the vendor ID isn't Atmel's (0x1f), assume this call failed.
753
755
* That's not an error; only rev C and newer chips handle it, and
754
756
* only Atmel sells these chips.
755
757
*/
756
- tmp = spi_write_then_read (spi , & code , 1 , id , 3 );
757
- if (tmp < 0 ) {
758
+ ret = spi_write_then_read (spi , & code , 1 , id , 3 );
759
+ if (ret < 0 ) {
758
760
pr_debug ("%s: error %d reading JEDEC ID\n" ,
759
- dev_name (& spi -> dev ), tmp );
760
- return ERR_PTR (tmp );
761
+ dev_name (& spi -> dev ), ret );
762
+ return ERR_PTR (ret );
761
763
}
762
- if (id [0 ] != 0x1f )
764
+
765
+ if (id [0 ] != CFI_MFR_ATMEL )
763
766
return NULL ;
764
767
765
768
jedec = id [0 ];
@@ -768,9 +771,9 @@ static struct flash_info *jedec_probe(struct spi_device *spi)
768
771
jedec = jedec << 8 ;
769
772
jedec |= id [2 ];
770
773
771
- for (tmp = 0 , info = dataflash_data ;
772
- tmp < ARRAY_SIZE (dataflash_data );
773
- tmp ++ , info ++ ) {
774
+ for (i = 0 , info = dataflash_data ;
775
+ i < ARRAY_SIZE (dataflash_data );
776
+ i ++ , info ++ ) {
774
777
if (info -> jedec_id == jedec ) {
775
778
pr_debug ("%s: OTP, sector protect%s\n" ,
776
779
dev_name (& spi -> dev ),
0 commit comments