@@ -92,25 +92,28 @@ static void mcu_power_off(void)
92
92
mutex_unlock (& mcu -> lock );
93
93
}
94
94
95
- static void mcu_gpio_set (struct gpio_chip * gc , unsigned int gpio , int val )
95
+ static int mcu_gpio_set (struct gpio_chip * gc , unsigned int gpio , int val )
96
96
{
97
97
struct mcu * mcu = gpiochip_get_data (gc );
98
98
u8 bit = 1 << (4 + gpio );
99
+ int ret ;
99
100
100
101
mutex_lock (& mcu -> lock );
101
102
if (val )
102
103
mcu -> reg_ctrl &= ~bit ;
103
104
else
104
105
mcu -> reg_ctrl |= bit ;
105
106
106
- i2c_smbus_write_byte_data (mcu -> client , MCU_REG_CTRL , mcu -> reg_ctrl );
107
+ ret = i2c_smbus_write_byte_data (mcu -> client , MCU_REG_CTRL ,
108
+ mcu -> reg_ctrl );
107
109
mutex_unlock (& mcu -> lock );
110
+
111
+ return ret ;
108
112
}
109
113
110
114
static int mcu_gpio_dir_out (struct gpio_chip * gc , unsigned int gpio , int val )
111
115
{
112
- mcu_gpio_set (gc , gpio , val );
113
- return 0 ;
116
+ return mcu_gpio_set (gc , gpio , val );
114
117
}
115
118
116
119
static int mcu_gpiochip_add (struct mcu * mcu )
@@ -123,7 +126,7 @@ static int mcu_gpiochip_add(struct mcu *mcu)
123
126
gc -> can_sleep = 1 ;
124
127
gc -> ngpio = MCU_NUM_GPIO ;
125
128
gc -> base = -1 ;
126
- gc -> set = mcu_gpio_set ;
129
+ gc -> set_rv = mcu_gpio_set ;
127
130
gc -> direction_output = mcu_gpio_dir_out ;
128
131
gc -> parent = dev ;
129
132
0 commit comments