ramips: 6.1: pinctrl: fix compilation with 6.1
[openwrt/staging/jow.git] / target / linux / ramips / files / drivers / pinctrl / pinctrl-aw9523.c
index 182e11cdc6faf6d6ec5507d82e0d76f82b631797..e151f445901574bf65ef6c173d84be7644b90337 100644 (file)
@@ -386,11 +386,6 @@ static const struct pinconf_ops aw9523_pinconf_ops = {
        .is_generic = true,
 };
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 5, 0)
-#define GPIO_LINE_DIRECTION_IN 1
-#define GPIO_LINE_DIRECTION_OUT        0
-#endif
-
 /*
  * aw9523_get_pin_direction - Get pin direction
  * @regmap: Regmap structure
@@ -437,11 +432,6 @@ static int aw9523_get_port_state(struct regmap *regmap, u8 pin,
        return regmap_read(regmap, reg, state);
 }
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 5, 0)
-#undef GPIO_LINE_DIRECTION_IN
-#undef GPIO_LINE_DIRECTION_OUT
-#endif
-
 static int aw9523_gpio_irq_type(struct irq_data *d, unsigned int type)
 {
        switch (type) {
@@ -822,7 +812,7 @@ static int aw9523_init_gpiochip(struct aw9523 *awi, unsigned int npins)
        gpiochip->parent = dev;
        gpiochip->of_node = dev->of_node;
        gpiochip->owner = THIS_MODULE;
-       gpiochip->can_sleep = false;
+       gpiochip->can_sleep = true;
 
        return 0;
 }
@@ -1107,6 +1097,13 @@ static int aw9523_remove(struct i2c_client *client)
        return 0;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+static void aw9523_remove_void(struct i2c_client *client)
+{
+       aw9523_remove(client);
+}
+#endif
+
 static const struct i2c_device_id aw9523_i2c_id_table[] = {
        { "aw9523_i2c", 0 },
        { }
@@ -1124,7 +1121,11 @@ static struct i2c_driver aw9523_driver = {
                .of_match_table = of_aw9523_i2c_match,
        },
        .probe = aw9523_probe,
+       #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
+       .remove = aw9523_remove_void,
+       #else
        .remove = aw9523_remove,
+       #endif
        .id_table = aw9523_i2c_id_table,
 };
 module_i2c_driver(aw9523_driver);