@@ -562,7 +562,7 @@ static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf,
562
562
static int at24_read (void * priv , unsigned int off , void * val , size_t count )
563
563
{
564
564
struct at24_data * at24 = priv ;
565
- struct i2c_client * client ;
565
+ struct device * dev = & at24 -> client [ 0 ] -> dev ;
566
566
char * buf = val ;
567
567
int ret ;
568
568
@@ -572,11 +572,9 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
572
572
if (off + count > at24 -> chip .byte_len )
573
573
return - EINVAL ;
574
574
575
- client = at24_translate_offset (at24 , & off );
576
-
577
- ret = pm_runtime_get_sync (& client -> dev );
575
+ ret = pm_runtime_get_sync (dev );
578
576
if (ret < 0 ) {
579
- pm_runtime_put_noidle (& client -> dev );
577
+ pm_runtime_put_noidle (dev );
580
578
return ret ;
581
579
}
582
580
@@ -592,7 +590,7 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
592
590
status = at24 -> read_func (at24 , buf , off , count );
593
591
if (status < 0 ) {
594
592
mutex_unlock (& at24 -> lock );
595
- pm_runtime_put (& client -> dev );
593
+ pm_runtime_put (dev );
596
594
return status ;
597
595
}
598
596
buf += status ;
@@ -602,15 +600,15 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
602
600
603
601
mutex_unlock (& at24 -> lock );
604
602
605
- pm_runtime_put (& client -> dev );
603
+ pm_runtime_put (dev );
606
604
607
605
return 0 ;
608
606
}
609
607
610
608
static int at24_write (void * priv , unsigned int off , void * val , size_t count )
611
609
{
612
610
struct at24_data * at24 = priv ;
613
- struct i2c_client * client ;
611
+ struct device * dev = & at24 -> client [ 0 ] -> dev ;
614
612
char * buf = val ;
615
613
int ret ;
616
614
@@ -620,11 +618,9 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
620
618
if (off + count > at24 -> chip .byte_len )
621
619
return - EINVAL ;
622
620
623
- client = at24_translate_offset (at24 , & off );
624
-
625
- ret = pm_runtime_get_sync (& client -> dev );
621
+ ret = pm_runtime_get_sync (dev );
626
622
if (ret < 0 ) {
627
- pm_runtime_put_noidle (& client -> dev );
623
+ pm_runtime_put_noidle (dev );
628
624
return ret ;
629
625
}
630
626
@@ -640,7 +636,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
640
636
status = at24 -> write_func (at24 , buf , off , count );
641
637
if (status < 0 ) {
642
638
mutex_unlock (& at24 -> lock );
643
- pm_runtime_put (& client -> dev );
639
+ pm_runtime_put (dev );
644
640
return status ;
645
641
}
646
642
buf += status ;
@@ -650,7 +646,7 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
650
646
651
647
mutex_unlock (& at24 -> lock );
652
648
653
- pm_runtime_put (& client -> dev );
649
+ pm_runtime_put (dev );
654
650
655
651
return 0 ;
656
652
}
@@ -880,7 +876,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
880
876
at24 -> nvmem_config .reg_read = at24_read ;
881
877
at24 -> nvmem_config .reg_write = at24_write ;
882
878
at24 -> nvmem_config .priv = at24 ;
883
- at24 -> nvmem_config .stride = 4 ;
879
+ at24 -> nvmem_config .stride = 1 ;
884
880
at24 -> nvmem_config .word_size = 1 ;
885
881
at24 -> nvmem_config .size = chip .byte_len ;
886
882
0 commit comments