@@ -89,30 +89,20 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset)
8989 }
9090}
9191
92- static void da9052_gpio_set (struct gpio_chip * gc , unsigned offset , int value )
92+ static int da9052_gpio_set (struct gpio_chip * gc , unsigned int offset , int value )
9393{
9494 struct da9052_gpio * gpio = gpiochip_get_data (gc );
95- int ret ;
9695
97- if (da9052_gpio_port_odd (offset )) {
98- ret = da9052_reg_update (gpio -> da9052 , (offset >> 1 ) +
99- DA9052_GPIO_0_1_REG ,
100- DA9052_GPIO_ODD_PORT_MODE ,
101- value << DA9052_GPIO_ODD_SHIFT );
102- if (ret != 0 )
103- dev_err (gpio -> da9052 -> dev ,
104- "Failed to updated gpio odd reg,%d" ,
105- ret );
106- } else {
107- ret = da9052_reg_update (gpio -> da9052 , (offset >> 1 ) +
108- DA9052_GPIO_0_1_REG ,
109- DA9052_GPIO_EVEN_PORT_MODE ,
110- value << DA9052_GPIO_EVEN_SHIFT );
111- if (ret != 0 )
112- dev_err (gpio -> da9052 -> dev ,
113- "Failed to updated gpio even reg,%d" ,
114- ret );
115- }
96+ if (da9052_gpio_port_odd (offset ))
97+ return da9052_reg_update (gpio -> da9052 , (offset >> 1 ) +
98+ DA9052_GPIO_0_1_REG ,
99+ DA9052_GPIO_ODD_PORT_MODE ,
100+ value << DA9052_GPIO_ODD_SHIFT );
101+
102+ return da9052_reg_update (gpio -> da9052 ,
103+ (offset >> 1 ) + DA9052_GPIO_0_1_REG ,
104+ DA9052_GPIO_EVEN_PORT_MODE ,
105+ value << DA9052_GPIO_EVEN_SHIFT );
116106}
117107
118108static int da9052_gpio_direction_input (struct gpio_chip * gc , unsigned offset )
@@ -182,7 +172,7 @@ static const struct gpio_chip reference_gp = {
182172 .label = "da9052-gpio" ,
183173 .owner = THIS_MODULE ,
184174 .get = da9052_gpio_get ,
185- .set = da9052_gpio_set ,
175+ .set_rv = da9052_gpio_set ,
186176 .direction_input = da9052_gpio_direction_input ,
187177 .direction_output = da9052_gpio_direction_output ,
188178 .to_irq = da9052_gpio_to_irq ,
0 commit comments