[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230615132023.13801-4-andriy.shevchenko@linux.intel.com>
Date: Thu, 15 Jun 2023 16:20:21 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Linus Walleij <linus.walleij@...aro.org>,
Alexander Stein <alexander.stein@...tq-group.com>,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Andy Shevchenko <andy@...nel.org>
Subject: [PATCH v3 3/5] gpio: aggregator: Prevent collisions between DT and user device IDs
In case we have a device instantiated via DT or other means than
via new_device sysfs node, the collision with the latter is possible.
Prevent such collisions by allocating user instantiated devices with
higher IDs, currently set to 1024.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/gpio/gpio-aggregator.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c
index 4a470dd8b75d..8892cb37ad79 100644
--- a/drivers/gpio/gpio-aggregator.c
+++ b/drivers/gpio/gpio-aggregator.c
@@ -26,6 +26,7 @@
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
+#define AGGREGATOR_MIN_DEVID 1024
#define AGGREGATOR_MAX_GPIOS 512
/*
@@ -135,7 +136,7 @@ static ssize_t new_device_store(struct device_driver *driver, const char *buf,
}
mutex_lock(&gpio_aggregator_lock);
- id = idr_alloc(&gpio_aggregator_idr, aggr, 0, 0, GFP_KERNEL);
+ id = idr_alloc(&gpio_aggregator_idr, aggr, AGGREGATOR_MIN_DEVID, 0, GFP_KERNEL);
mutex_unlock(&gpio_aggregator_lock);
if (id < 0) {
--
2.40.0.1.gaa8946217a0b
Powered by blists - more mailing lists