Skip to contentSkip to conversation

gpio: ljca: reduce struct allocation

PATCH Superseded Rosen Penev 4 participants 8 messages Mar 8 – Mar 10

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: ljca: reduce struct allocation

Convert connect_mode to a flexible array member to avoid calling kcalloc and to combine the allocations.

---
 drivers/gpio/gpio-ljca.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpio/gpio-ljca.c +7 -9
index f32d1d237795..a531aaa0425f 100644
@@ -63,7 +63,6 @@ struct ljca_gpio_dev {
 	DECLARE_BITMAP(enabled_irqs, LJCA_MAX_GPIO_NUM);
 	DECLARE_BITMAP(reenable_irqs, LJCA_MAX_GPIO_NUM);
 	DECLARE_BITMAP(output_enabled, LJCA_MAX_GPIO_NUM);
-	u8 *connect_mode;
 	/* protect irq bus */
 	struct mutex irq_lock;
 	struct work_struct work;
@@ -72,6 +71,8 @@ struct ljca_gpio_dev {
 
 	u8 obuf[LJCA_GPIO_BUF_SIZE];
 	u8 ibuf[LJCA_GPIO_BUF_SIZE];
+
+	u8 connect_mode[];
 };
 
 static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,
@@ -400,22 +401,19 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev,
 			   const struct auxiliary_device_id *aux_dev_id)
 {
 	struct ljca_client *ljca = auxiliary_dev_to_ljca_client(auxdev);
+	struct ljca_gpio_info *gpio_info;
 	struct ljca_gpio_dev *ljca_gpio;
 	struct gpio_irq_chip *girq;
 	int ret;
 
-	ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL);
+	gpio_info = dev_get_platdata(&auxdev->dev);
+	ljca_gpio = devm_kzalloc(&auxdev->dev, struct_size(ljca_gpio, connect_mode, gpio_info->num),
+				 GFP_KERNEL);
 	if (!ljca_gpio)
 		return -ENOMEM;
 
 	ljca_gpio->ljca = ljca;
-	ljca_gpio->gpio_info = dev_get_platdata(&auxdev->dev);
-	ljca_gpio->connect_mode = devm_kcalloc(&auxdev->dev,
-					       ljca_gpio->gpio_info->num,
-					       sizeof(*ljca_gpio->connect_mode),
-					       GFP_KERNEL);
-	if (!ljca_gpio->connect_mode)
-		return -ENOMEM;
+	ljca_gpio->gpio_info = gpio_info;
 
 	ret = devm_mutex_init(&auxdev->dev, &ljca_gpio->irq_lock);
 	if (ret)
Signature · 1 line
2.53.0
maintainer
#1 lore raw

Hi Rosen,

Thanks or the patch.

Quoted 30 lines · Rosen Penev

Convert connect_mode to a flexible array member to avoid calling kcalloc and to combine the allocations.

---
 drivers/gpio/gpio-ljca.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpio/gpio-ljca.c +2 -1
index f32d1d237795..a531aaa0425f 100644
@@ -63,7 +63,6 @@ struct ljca_gpio_dev {
 	DECLARE_BITMAP(enabled_irqs, LJCA_MAX_GPIO_NUM);
 	DECLARE_BITMAP(reenable_irqs, LJCA_MAX_GPIO_NUM);
 	DECLARE_BITMAP(output_enabled, LJCA_MAX_GPIO_NUM);
-	u8 *connect_mode;
 	/* protect irq bus */
 	struct mutex irq_lock;
 	struct work_struct work;
@@ -72,6 +71,8 @@ struct ljca_gpio_dev {
 
 	u8 obuf[LJCA_GPIO_BUF_SIZE];
 	u8 ibuf[LJCA_GPIO_BUF_SIZE];
+
+	u8 connect_mode[];
 };
 
 static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 409

Quoted 10 lines
drivers/gpio/gpio-ljca.c +2 -1
@@ -400,22 +401,19 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev,
 			   const struct auxiliary_device_id *aux_dev_id)
 {
 	struct ljca_client *ljca = auxiliary_dev_to_ljca_client(auxdev);
+	struct ljca_gpio_info *gpio_info;
 	struct ljca_gpio_dev *ljca_gpio;
 	struct gpio_irq_chip *girq;
 	int ret;
 
-	ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL);
+	gpio_info = dev_get_platdata(&auxdev->dev);

You can do this assignment in variable declaration.

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 410

Quoted 1 line
drivers/gpio/gpio-ljca.c +1 -0
+	ljca_gpio = devm_kzalloc(&auxdev->dev, struct_size(ljca_gpio, connect_mode, gpio_info->num),

This line is a bit long, I'd wrap it.

Quoted 16 lines
drivers/gpio/gpio-ljca.c +2 -7
+				 GFP_KERNEL);
 	if (!ljca_gpio)
 		return -ENOMEM;
 
 	ljca_gpio->ljca = ljca;
-	ljca_gpio->gpio_info = dev_get_platdata(&auxdev->dev);
-	ljca_gpio->connect_mode = devm_kcalloc(&auxdev->dev,
-					       ljca_gpio->gpio_info->num,
-					       sizeof(*ljca_gpio->connect_mode),
-					       GFP_KERNEL);
-	if (!ljca_gpio->connect_mode)
-		return -ENOMEM;
+	ljca_gpio->gpio_info = gpio_info;
 
 	ret = devm_mutex_init(&auxdev->dev, &ljca_gpio->irq_lock);
 	if (ret)
Signature · 3 lines
Kind regards,

Sakari Ailus
#2 lore raw
Quoted 44 lines · Sakari Ailus

Hi Rosen,

Thanks or the patch.

Quoted 38 lines · Rosen Penev

Convert connect_mode to a flexible array member to avoid calling kcalloc and to combine the allocations.

---
 drivers/gpio/gpio-ljca.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpio/gpio-ljca.c +3 -1
index f32d1d237795..a531aaa0425f 100644
@@ -63,7 +63,6 @@ struct ljca_gpio_dev {
      DECLARE_BITMAP(enabled_irqs, LJCA_MAX_GPIO_NUM);
      DECLARE_BITMAP(reenable_irqs, LJCA_MAX_GPIO_NUM);
      DECLARE_BITMAP(output_enabled, LJCA_MAX_GPIO_NUM);
-     u8 *connect_mode;
      /* protect irq bus */
      struct mutex irq_lock;
      struct work_struct work;
@@ -72,6 +71,8 @@ struct ljca_gpio_dev {
 
      u8 obuf[LJCA_GPIO_BUF_SIZE];
      u8 ibuf[LJCA_GPIO_BUF_SIZE];
+
+     u8 connect_mode[];
 };
 
 static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,
@@ -400,22 +401,19 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev,
                         const struct auxiliary_device_id *aux_dev_id)
 {
      struct ljca_client *ljca = auxiliary_dev_to_ljca_client(auxdev);
+     struct ljca_gpio_info *gpio_info;
      struct ljca_gpio_dev *ljca_gpio;
      struct gpio_irq_chip *girq;
      int ret;
 
Quoted 4 lines

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 409

Quoted 2 lines
drivers/gpio/gpio-ljca.c +1 -1
-     ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL);
+     gpio_info = dev_get_platdata(&auxdev->dev);

You can do this assignment in variable declaration.

I avoided doing so to keep reverse christmas tree order. I can still do so if desired.

Quoted 4 lines

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 410

Quoted 2 lines
drivers/gpio/gpio-ljca.c +1 -0
+     ljca_gpio = devm_kzalloc(&auxdev->dev, struct_size(ljca_gpio, connect_mode, gpio_info->num),

This line is a bit long, I'd wrap it.

Will fix.

Quoted 22 lines
Quoted 7 lines
drivers/gpio/gpio-ljca.c +1 -1
+                              GFP_KERNEL);
      if (!ljca_gpio)
              return -ENOMEM;
 
      ljca_gpio->ljca = ljca;
-     ljca_gpio->gpio_info = dev_get_platdata(&auxdev->dev);

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 419

Quoted 10 lines
drivers/gpio/gpio-ljca.c +1 -6
-     ljca_gpio->connect_mode = devm_kcalloc(&auxdev->dev,
-                                            ljca_gpio->gpio_info->num,
-                                            sizeof(*ljca_gpio->connect_mode),
-                                            GFP_KERNEL);
-     if (!ljca_gpio->connect_mode)
-             return -ENOMEM;
+     ljca_gpio->gpio_info = gpio_info;
 
      ret = devm_mutex_init(&auxdev->dev, &ljca_gpio->irq_lock);
      if (ret)

--
Kind regards,

Sakari Ailus

maintainer
#3 lore raw

Hi Rosen,

Quoted 46 lines · Rosen Penev
Quoted 44 lines · Sakari Ailus

Hi Rosen,

Thanks or the patch.

Quoted 38 lines · Rosen Penev

Convert connect_mode to a flexible array member to avoid calling kcalloc and to combine the allocations.

---
 drivers/gpio/gpio-ljca.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpio/gpio-ljca.c +3 -1
index f32d1d237795..a531aaa0425f 100644
@@ -63,7 +63,6 @@ struct ljca_gpio_dev {
      DECLARE_BITMAP(enabled_irqs, LJCA_MAX_GPIO_NUM);
      DECLARE_BITMAP(reenable_irqs, LJCA_MAX_GPIO_NUM);
      DECLARE_BITMAP(output_enabled, LJCA_MAX_GPIO_NUM);
-     u8 *connect_mode;
      /* protect irq bus */
      struct mutex irq_lock;
      struct work_struct work;
@@ -72,6 +71,8 @@ struct ljca_gpio_dev {
 
      u8 obuf[LJCA_GPIO_BUF_SIZE];
      u8 ibuf[LJCA_GPIO_BUF_SIZE];
+
+     u8 connect_mode[];
 };
 
 static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,
@@ -400,22 +401,19 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev,
                         const struct auxiliary_device_id *aux_dev_id)
 {
      struct ljca_client *ljca = auxiliary_dev_to_ljca_client(auxdev);
+     struct ljca_gpio_info *gpio_info;
      struct ljca_gpio_dev *ljca_gpio;
      struct gpio_irq_chip *girq;
      int ret;
 
Quoted 6 lines
Quoted 4 lines

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 409

Quoted 2 lines
drivers/gpio/gpio-ljca.c +1 -1
-     ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL);
+     gpio_info = dev_get_platdata(&auxdev->dev);

You can do this assignment in variable declaration.

I avoided doing so to keep reverse christmas tree order. I can still do so if desired.

How does that affect it? There doesn't seem to be a dependency here -- and even if there was, the dependency obviously has priority.

Quoted 23 lines
Quoted 4 lines

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 410

Quoted 2 lines
drivers/gpio/gpio-ljca.c +1 -0
+     ljca_gpio = devm_kzalloc(&auxdev->dev, struct_size(ljca_gpio, connect_mode, gpio_info->num),

This line is a bit long, I'd wrap it.

Will fix.

Quoted 18 lines
Quoted 17 lines
drivers/gpio/gpio-ljca.c +2 -7
+                              GFP_KERNEL);
      if (!ljca_gpio)
              return -ENOMEM;
 
      ljca_gpio->ljca = ljca;
-     ljca_gpio->gpio_info = dev_get_platdata(&auxdev->dev);
-     ljca_gpio->connect_mode = devm_kcalloc(&auxdev->dev,
-                                            ljca_gpio->gpio_info->num,
-                                            sizeof(*ljca_gpio->connect_mode),
-                                            GFP_KERNEL);
-     if (!ljca_gpio->connect_mode)
-             return -ENOMEM;
+     ljca_gpio->gpio_info = gpio_info;
 
      ret = devm_mutex_init(&auxdev->dev, &ljca_gpio->irq_lock);
      if (ret)
Signature · 3 lines
Kind regards,

Sakari Ailus
#4 lore raw
Quoted 54 lines · Sakari Ailus

Hi Rosen,

Quoted 50 lines · Rosen Penev
Quoted 48 lines · Sakari Ailus

Hi Rosen,

Thanks or the patch.

Quoted 30 lines · Rosen Penev

Convert connect_mode to a flexible array member to avoid calling kcalloc and to combine the allocations.

---
 drivers/gpio/gpio-ljca.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpio/gpio-ljca.c +2 -1
index f32d1d237795..a531aaa0425f 100644
@@ -63,7 +63,6 @@ struct ljca_gpio_dev {
      DECLARE_BITMAP(enabled_irqs, LJCA_MAX_GPIO_NUM);
      DECLARE_BITMAP(reenable_irqs, LJCA_MAX_GPIO_NUM);
      DECLARE_BITMAP(output_enabled, LJCA_MAX_GPIO_NUM);
-     u8 *connect_mode;
      /* protect irq bus */
      struct mutex irq_lock;
      struct work_struct work;
@@ -72,6 +71,8 @@ struct ljca_gpio_dev {
 
      u8 obuf[LJCA_GPIO_BUF_SIZE];
      u8 ibuf[LJCA_GPIO_BUF_SIZE];
+
+     u8 connect_mode[];
 };
 
 static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 409

Quoted 10 lines
drivers/gpio/gpio-ljca.c +2 -1
@@ -400,22 +401,19 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev,
                         const struct auxiliary_device_id *aux_dev_id)
 {
      struct ljca_client *ljca = auxiliary_dev_to_ljca_client(auxdev);
+     struct ljca_gpio_info *gpio_info;
      struct ljca_gpio_dev *ljca_gpio;
      struct gpio_irq_chip *girq;
      int ret;
 
-     ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL);
+     gpio_info = dev_get_platdata(&auxdev->dev);

You can do this assignment in variable declaration.

Quoted 5 lines
Quoted 2 lines

I avoided doing so to keep reverse christmas tree order. I can still do so if desired.

How does that affect it? There doesn't seem to be a dependency here -- and even if there was, the dependency obviously has priority.

It's just cosmetic.

Quoted 29 lines
Quoted 24 lines
Quoted 5 lines

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 410

Quoted 3 lines
drivers/gpio/gpio-ljca.c +1 -0
+     ljca_gpio = devm_kzalloc(&auxdev->dev, struct_size(ljca_gpio, connect_mode, gpio_info->num),

This line is a bit long, I'd wrap it.

Will fix.

Quoted 18 lines
Quoted 17 lines
drivers/gpio/gpio-ljca.c +2 -7
+                              GFP_KERNEL);
      if (!ljca_gpio)
              return -ENOMEM;
 
      ljca_gpio->ljca = ljca;
-     ljca_gpio->gpio_info = dev_get_platdata(&auxdev->dev);
-     ljca_gpio->connect_mode = devm_kcalloc(&auxdev->dev,
-                                            ljca_gpio->gpio_info->num,
-                                            sizeof(*ljca_gpio->connect_mode),
-                                            GFP_KERNEL);
-     if (!ljca_gpio->connect_mode)
-             return -ENOMEM;
+     ljca_gpio->gpio_info = gpio_info;
 
      ret = devm_mutex_init(&auxdev->dev, &ljca_gpio->irq_lock);
      if (ret)

--
Kind regards,

Sakari Ailus

#5 lore raw
In reply to Rosen Penev
Quoted 22 lines · Rosen Penev

Convert connect_mode to a flexible array member to avoid calling kcalloc and to combine the allocations.

---
 drivers/gpio/gpio-ljca.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpio/gpio-ljca.c +0 -1
index f32d1d237795..a531aaa0425f 100644
@@ -63,7 +63,6 @@ struct ljca_gpio_dev {
        DECLARE_BITMAP(enabled_irqs, LJCA_MAX_GPIO_NUM);
        DECLARE_BITMAP(reenable_irqs, LJCA_MAX_GPIO_NUM);
        DECLARE_BITMAP(output_enabled, LJCA_MAX_GPIO_NUM);
-       u8 *connect_mode;
        /* protect irq bus */
        struct mutex irq_lock;
        struct work_struct work;

drivers/gpio/gpio-ljca.c struct ljca_gpio_dev { · line 75

Quoted 5 lines
drivers/gpio/gpio-ljca.c +2 -0
@@ -72,6 +71,8 @@ struct ljca_gpio_dev {
 
        u8 obuf[LJCA_GPIO_BUF_SIZE];
        u8 ibuf[LJCA_GPIO_BUF_SIZE];
+
+       u8 connect_mode[];

Please use __counted_by().

Quoted 5 lines
drivers/gpio/gpio-ljca.c +0 -0
 };
 
 static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,
@@ -400,22 +401,19 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev,
                           const struct auxiliary_device_id *aux_dev_id)

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 410

Quoted 10 lines
drivers/gpio/gpio-ljca.c +3 -1
 {
        struct ljca_client *ljca = auxiliary_dev_to_ljca_client(auxdev);
+       struct ljca_gpio_info *gpio_info;
        struct ljca_gpio_dev *ljca_gpio;
        struct gpio_irq_chip *girq;
        int ret;
 
-       ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL);
+       gpio_info = dev_get_platdata(&auxdev->dev);
+       ljca_gpio = devm_kzalloc(&auxdev->dev, struct_size(ljca_gpio, connect_mode, gpio_info->num),

I'm surprised to learn that there's no devm_kzalloc_flex() yet. I wanted to ask you to use it but it doesn't exist.

Bart

Quoted 19 lines
drivers/gpio/gpio-ljca.c +2 -8
+                                GFP_KERNEL);
        if (!ljca_gpio)
                return -ENOMEM;
 
        ljca_gpio->ljca = ljca;
-       ljca_gpio->gpio_info = dev_get_platdata(&auxdev->dev);
-       ljca_gpio->connect_mode = devm_kcalloc(&auxdev->dev,
-                                              ljca_gpio->gpio_info->num,
-                                              sizeof(*ljca_gpio->connect_mode),
-                                              GFP_KERNEL);
-       if (!ljca_gpio->connect_mode)
-               return -ENOMEM;
+       ljca_gpio->gpio_info = gpio_info;
 
        ret = devm_mutex_init(&auxdev->dev, &ljca_gpio->irq_lock);
        if (ret)
--

2.53.0

#6 lore raw
Quoted 25 lines · Bartosz Golaszewski
Quoted 23 lines · Rosen Penev

Convert connect_mode to a flexible array member to avoid calling kcalloc and to combine the allocations.

---
 drivers/gpio/gpio-ljca.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpio/gpio-ljca.c +0 -1
index f32d1d237795..a531aaa0425f 100644
@@ -63,7 +63,6 @@ struct ljca_gpio_dev {
        DECLARE_BITMAP(enabled_irqs, LJCA_MAX_GPIO_NUM);
        DECLARE_BITMAP(reenable_irqs, LJCA_MAX_GPIO_NUM);
        DECLARE_BITMAP(output_enabled, LJCA_MAX_GPIO_NUM);
-       u8 *connect_mode;
        /* protect irq bus */
        struct mutex irq_lock;
        struct work_struct work;
@@ -72,6 +71,8 @@ struct ljca_gpio_dev {
 
Quoted 6 lines

drivers/gpio/gpio-ljca.c struct ljca_gpio_dev { · line 75

Quoted 4 lines
drivers/gpio/gpio-ljca.c +2 -0
        u8 obuf[LJCA_GPIO_BUF_SIZE];
        u8 ibuf[LJCA_GPIO_BUF_SIZE];
+
+       u8 connect_mode[];

Please use __counted_by().

Counted by what?

__counted_by(gpio_info->num); does not work.

Quoted 12 lines
Quoted 12 lines
drivers/gpio/gpio-ljca.c +1 -0
 };
 
 static int ljca_gpio_config(struct ljca_gpio_dev *ljca_gpio, u8 gpio_id,
@@ -400,22 +401,19 @@ static int ljca_gpio_probe(struct auxiliary_device *auxdev,
                           const struct auxiliary_device_id *aux_dev_id)
 {
        struct ljca_client *ljca = auxiliary_dev_to_ljca_client(auxdev);
+       struct ljca_gpio_info *gpio_info;
        struct ljca_gpio_dev *ljca_gpio;
        struct gpio_irq_chip *girq;
        int ret;
 
Quoted 6 lines

drivers/gpio/gpio-ljca.c static int ljca_gpio_probe(struct auxiliary_device *auxdev, · line 410

Quoted 3 lines
drivers/gpio/gpio-ljca.c +2 -1
-       ljca_gpio = devm_kzalloc(&auxdev->dev, sizeof(*ljca_gpio), GFP_KERNEL);
+       gpio_info = dev_get_platdata(&auxdev->dev);
+       ljca_gpio = devm_kzalloc(&auxdev->dev, struct_size(ljca_gpio, connect_mode, gpio_info->num),

I'm surprised to learn that there's no devm_kzalloc_flex() yet. I wanted to ask you to use it but it doesn't exist.

I'm sure a treewide commit will be applied when it gets introduced.

Quoted 22 lines

Bart

Quoted 19 lines
drivers/gpio/gpio-ljca.c +2 -8
+                                GFP_KERNEL);
        if (!ljca_gpio)
                return -ENOMEM;
 
        ljca_gpio->ljca = ljca;
-       ljca_gpio->gpio_info = dev_get_platdata(&auxdev->dev);
-       ljca_gpio->connect_mode = devm_kcalloc(&auxdev->dev,
-                                              ljca_gpio->gpio_info->num,
-                                              sizeof(*ljca_gpio->connect_mode),
-                                              GFP_KERNEL);
-       if (!ljca_gpio->connect_mode)
-               return -ENOMEM;
+       ljca_gpio->gpio_info = gpio_info;
 
        ret = devm_mutex_init(&auxdev->dev, &ljca_gpio->irq_lock);
        if (ret)
--

2.53.0

maintainer
#7 lore raw
Quoted 6 lines · Rosen Penev
Quoted 3 lines
Quoted 1 line

+ u8 connect_mode[];

Please use __counted_by().

Counted by what?

__counted_by(gpio_info->num); does not work.

As with the other patch (IIRC) just add a new member to the struct to hold the count.

Yours,
Linus Walleij