@@ -159,7 +159,7 @@ struct cy8c95x0_pinctrl {
159
159
DECLARE_BITMAP (irq_trig_high , MAX_LINE );
160
160
DECLARE_BITMAP (push_pull , MAX_LINE );
161
161
DECLARE_BITMAP (shiftmask , MAX_LINE );
162
- int nport ;
162
+ unsigned int nport ;
163
163
struct gpio_chip gpio_chip ;
164
164
unsigned long driver_data ;
165
165
struct device * dev ;
@@ -610,9 +610,8 @@ static int cy8c95x0_write_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
610
610
DECLARE_BITMAP (tmask , MAX_LINE );
611
611
DECLARE_BITMAP (tval , MAX_LINE );
612
612
int write_val ;
613
- int ret = 0 ;
614
- int i ;
615
613
u8 bits ;
614
+ int ret ;
616
615
617
616
/* Add the 4 bit gap of Gport2 */
618
617
bitmap_andnot (tmask , mask , chip -> shiftmask , MAX_LINE );
@@ -623,7 +622,7 @@ static int cy8c95x0_write_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
623
622
bitmap_shift_left (tval , tval , 4 , MAX_LINE );
624
623
bitmap_replace (tval , tval , val , chip -> shiftmask , BANK_SZ * 3 );
625
624
626
- for (i = 0 ; i < chip -> nport ; i ++ ) {
625
+ for (unsigned int i = 0 ; i < chip -> nport ; i ++ ) {
627
626
/* Skip over unused banks */
628
627
bits = bitmap_get_value8 (tmask , i * BANK_SZ );
629
628
if (!bits )
@@ -632,15 +631,13 @@ static int cy8c95x0_write_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
632
631
write_val = bitmap_get_value8 (tval , i * BANK_SZ );
633
632
634
633
ret = cy8c95x0_regmap_update_bits (chip , reg , i , bits , write_val );
635
- if (ret < 0 )
636
- goto out ;
634
+ if (ret < 0 ) {
635
+ dev_err (chip -> dev , "failed writing register %d, port %u: err %d\n" , reg , i , ret );
636
+ return ret ;
637
+ }
637
638
}
638
- out :
639
-
640
- if (ret < 0 )
641
- dev_err (chip -> dev , "failed writing register %d, port %d: err %d\n" , reg , i , ret );
642
639
643
- return ret ;
640
+ return 0 ;
644
641
}
645
642
646
643
static int cy8c95x0_read_regs_mask (struct cy8c95x0_pinctrl * chip , int reg ,
@@ -650,9 +647,8 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
650
647
DECLARE_BITMAP (tval , MAX_LINE );
651
648
DECLARE_BITMAP (tmp , MAX_LINE );
652
649
int read_val ;
653
- int ret = 0 ;
654
- int i ;
655
650
u8 bits ;
651
+ int ret ;
656
652
657
653
/* Add the 4 bit gap of Gport2 */
658
654
bitmap_andnot (tmask , mask , chip -> shiftmask , MAX_LINE );
@@ -663,15 +659,17 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
663
659
bitmap_shift_left (tval , tval , 4 , MAX_LINE );
664
660
bitmap_replace (tval , tval , val , chip -> shiftmask , BANK_SZ * 3 );
665
661
666
- for (i = 0 ; i < chip -> nport ; i ++ ) {
662
+ for (unsigned int i = 0 ; i < chip -> nport ; i ++ ) {
667
663
/* Skip over unused banks */
668
664
bits = bitmap_get_value8 (tmask , i * BANK_SZ );
669
665
if (!bits )
670
666
continue ;
671
667
672
668
ret = cy8c95x0_regmap_read (chip , reg , i , & read_val );
673
- if (ret < 0 )
674
- goto out ;
669
+ if (ret < 0 ) {
670
+ dev_err (chip -> dev , "failed reading register %d, port %u: err %d\n" , reg , i , ret );
671
+ return ret ;
672
+ }
675
673
676
674
read_val &= bits ;
677
675
read_val |= bitmap_get_value8 (tval , i * BANK_SZ ) & ~bits ;
@@ -682,11 +680,7 @@ static int cy8c95x0_read_regs_mask(struct cy8c95x0_pinctrl *chip, int reg,
682
680
bitmap_shift_right (tmp , tval , 4 , MAX_LINE );
683
681
bitmap_replace (val , tmp , tval , chip -> shiftmask , MAX_LINE );
684
682
685
- out :
686
- if (ret < 0 )
687
- dev_err (chip -> dev , "failed reading register %d, port %d: err %d\n" , reg , i , ret );
688
-
689
- return ret ;
683
+ return 0 ;
690
684
}
691
685
692
686
static int cy8c95x0_gpio_direction_input (struct gpio_chip * gc , unsigned int off )
0 commit comments