openwrt/target/linux/bcm27xx/patches-6.6/950-1211-gpiolib-Override-gpiochip-numbers-with-DT-aliases.patch
John Audia 3eb08538c4 kernel: bump 6.6 to 6.6.46
This commit makes three changes all needed for the update of the 6.6 kernel.

1. Upstream kernel bump to 6.6.46

	Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.46
	Manually rebased:
        	bcm27xx/patches-6.6/950-0320-spi-spidev-Restore-loading-from-Device-Tree.patch
	All other patches automatically rebased.

2. Adjusted the following for new ksym[1] enabling it:

        armsr/config-6.6
        bcm27xx/bcm2712/config-6.6

3. Added a fix to receiving fraglist GSO packets:

	generic/pending-6.6/601-udp-fix-receiving-fraglist-GSO_packets.patch[2]

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/diff/arch/arm64/Kconfig?id=v6.6.46&id2=v6.6.45
2. https://marc.info/?l=linux-netdev&m=172407994500599&w=2

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/16173
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-08-20 23:41:08 +02:00

51 lines
1.6 KiB
Diff

From 53b9d9bbb57e292c6b332a2fb9899003586e17ca Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 2 May 2024 16:17:02 +0100
Subject: [PATCH 1211/1215] gpiolib: Override gpiochip numbers with DT aliases
In the same way that other subsystems support the setting of device
id numbers from Device Tree aliases, allow gpiochip numbers to be
derived from "gpiochip<n>" aliases.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
drivers/gpio/gpiolib.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -111,6 +111,7 @@ static int gpiochip_irqchip_init_valid_m
static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gc);
static bool gpiolib_initialized;
+static int first_dynamic_gpiochip_num = -1;
static inline void desc_set_label(struct gpio_desc *d, const char *label)
{
@@ -746,6 +747,7 @@ int gpiochip_add_data_with_key(struct gp
unsigned int i;
int base = 0;
int ret = 0;
+ int id;
/*
* First: allocate and populate the internal stat container, and
@@ -770,7 +772,16 @@ int gpiochip_add_data_with_key(struct gp
else if (gc->parent)
device_set_node(&gdev->dev, dev_fwnode(gc->parent));
- gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL);
+ if (first_dynamic_gpiochip_num < 0) {
+ id = of_alias_get_highest_id("gpiochip");
+ first_dynamic_gpiochip_num = (id >= 0) ? (id + 1) : 0;
+ }
+
+ id = of_alias_get_id(gdev->dev.of_node, "gpiochip");
+ if (id < 0)
+ id = first_dynamic_gpiochip_num;
+
+ gdev->id = ida_alloc_range(&gpio_ida, id, ~0, GFP_KERNEL);
if (gdev->id < 0) {
ret = gdev->id;
goto err_free_gdev;