From nobody Fri Feb 13 00:23:25 2026 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03B86194AE8 for ; Fri, 3 Jan 2025 03:04:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735873458; cv=none; b=MHf2e9it6SHqD9trtN03OigCL3qdmxN6bGyVlU2hxaF/4eVnhhdJsbeSVx8/CpnUpqG19NZn4gUpGPPthvzGvk66mmiSoBqqbpBSbT5iTOCNHK8OTYafD3KBK3dPBdfRvj0LOztT1bMME7bjuvhoXdECu128+7SXcRYrliLCNtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735873458; c=relaxed/simple; bh=8ChtnRZwJDC04xlfJouTjNvR/nV1ghrWuZERWwclicc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=in0kLxhAclqAkFrBzDiy+pQT9y3N570JzkhrW7tdn2IzvRmVVCHdI9lQNjEi/SPXD8ZF3TCiR+L/DtmUx7rlvIYrhcqrIumkuSauiWdeFmnKwnosr4EZDwVYnKUBFtpiLjYmlJaOjbQFHItR/zbgxnlDyhYXgjQYC0mu4fgJv1w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b=qmx9h5n+; arc=none smtp.client-ip=185.125.188.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="qmx9h5n+" Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 7813C40FAE for ; Fri, 3 Jan 2025 03:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1735873455; bh=e3wTN7GG0fZy/9Mvu4ekzfXCmbA/5cGr2RaVYo8MjsI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qmx9h5n+Se/gsoUn4hOFfakVhcQoeM1XTlE3XmKYmm2CAktxcIjcFyUOENuwevcZR pTlYjcdBHrAxcwVdiOtKKEGLTkA/W4WM6Y8aiFNwLJJ0nwf4PgKv/VvljeMgQvZd+7 Mf3eVCYhk4L0h+gk8iJs/SNuWb1f76CaFfgQyksTDem/3pxvjH6jOAXX9JxMqaM91b XzAGyg4qarPWeshsIMQHHfYTW/0MQGjfbgdCkFcUoNQEGDaqSsynjd6KYaKYBPEm9Q pYuepw5R7WcIoG7ktW2kyzCyBllZEmdIx948iQZ2cXxRt4U2gDM1dY79G3vzXBTBv3 GGkcdc8J8TEig== Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-2efc3292021so26287740a91.1 for ; Thu, 02 Jan 2025 19:04:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735873454; x=1736478254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e3wTN7GG0fZy/9Mvu4ekzfXCmbA/5cGr2RaVYo8MjsI=; b=khVxcEJXB1O7t8KGOE24/ZlarXxaVPp+Ok+dz8uZIcJaBUq2tLZ7p8xV8lL7ezMk9c CWlKVrrxo18DOaEsjIWZM1hJXuC0YmgbJdjHvs/68jB8lG43io7JwvE5J25MJdXlFh9L 0APAOOKJdtRToSBqsswCHxwYvgfU/HLwE1rhUdrP0qJKfhAbri/vy+f9elX/aMRKxnk6 +5knhjeOb/QInITyM3RqJONCfJgJhOrgXjFioeg2jG4tkXR1YsUpGrYguyfjMnOIv4/O 9PMKzG4YShZvvElPH2wZ9UYVJaSCGwkzUgmJekauUL82U/YlERFmMrswbcgrPjBN5ktc GIag== X-Forwarded-Encrypted: i=1; AJvYcCUsPauFHSCyjLjk6aXtzP5s8eD1Rg1VVsJ9tL93ZhDaxrWZlVkmPIeICsYu5k+ZL90KrjjpDJ27onqmkZs=@vger.kernel.org X-Gm-Message-State: AOJu0YwoMM3oH3T386cxRhE9jARVMELZcbucsSFbuRmvJmnooZwc8ch1 ZonxrMVsoFUYn1RD95hKlhnPveWgIAdQJ/0UMrt+cuxuc6oVmA7Ms7f/UD7z8tTfhdCdC0b5hgm OWJaka3hWsTHVoph1m/okPqmGzoUsbO3grvHj5o4P+FfjkhUZevHei5ylJemLUT2Y2FEaj5WrXu Vxqg== X-Gm-Gg: ASbGnctGujZ3eNz53vyf5RTbCPBJVsVTyuemzvsEcXHRrsK0yUvguicMBSvDcYMraKR kRF2tM2I2eHRjj2v9e3crhdaul4Qo4TqZ7tI96XtdsFeJkDUg+dd2a/tOQxcnJk/wT3wx45oP9+ Rlsj9jOTV+T/Yy1IuyAdaGS5ky0cNAWvdXNS1pQT/XVeVpZ+ScjPhnxm5H7jC7ZhnKWIaMHFxRN EXHrzrLzX1v+z2DoBzt6jXFRzI/FK+stnPCKnjiWXWY2QBy/U/doFHocw== X-Received: by 2002:a17:90b:2e4a:b0:2ea:b564:4b31 with SMTP id 98e67ed59e1d1-2f452e3db0bmr69946869a91.19.1735873453830; Thu, 02 Jan 2025 19:04:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1hiK2a5+CO233sG3Qpkn6XXVD3vSsm9fOlhx32heiyY6Mfxi9/aS5dOjiAQEQ/d/43Wr6UQ== X-Received: by 2002:a17:90b:2e4a:b0:2ea:b564:4b31 with SMTP id 98e67ed59e1d1-2f452e3db0bmr69946849a91.19.1735873453546; Thu, 02 Jan 2025 19:04:13 -0800 (PST) Received: from z790sl.. ([240f:74:7be:1:cb9e:69af:fb16:54f4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc964e92sm234468215ad.18.2025.01.02.19.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 19:04:13 -0800 (PST) From: Koichiro Den To: linux-gpio@vger.kernel.org Cc: linus.walleij@linaro.org, brgl@bgdev.pl, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] gpio: virtuser: fix handling of multiple conn_ids in lookup table Date: Fri, 3 Jan 2025 12:04:00 +0900 Message-ID: <20250103030402.81954-3-koichiro.den@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250103030402.81954-1-koichiro.den@canonical.com> References: <20250103030402.81954-1-koichiro.den@canonical.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Creating a virtuser device via configfs with multiple conn_ids fails due to incorrect indexing of lookup entries. Correct the indexing logic to ensure proper functionality when multiple gpio_virtuser_lookup are created. Fixes: 91581c4b3f29 ("gpio: virtuser: new virtual testing driver for the GP= IO API") Signed-off-by: Koichiro Den --- drivers/gpio/gpio-virtuser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-virtuser.c b/drivers/gpio/gpio-virtuser.c index ec5abfebca3d..3ea00321225d 100644 --- a/drivers/gpio/gpio-virtuser.c +++ b/drivers/gpio/gpio-virtuser.c @@ -1410,7 +1410,7 @@ gpio_virtuser_make_lookup_table(struct gpio_virtuser_= device *dev) size_t num_entries =3D gpio_virtuser_get_lookup_count(dev); struct gpio_virtuser_lookup_entry *entry; struct gpio_virtuser_lookup *lookup; - unsigned int i =3D 0; + unsigned int i =3D 0, idx; =20 lockdep_assert_held(&dev->lock); =20 @@ -1424,12 +1424,12 @@ gpio_virtuser_make_lookup_table(struct gpio_virtuse= r_device *dev) return -ENOMEM; =20 list_for_each_entry(lookup, &dev->lookup_list, siblings) { + idx =3D 0; list_for_each_entry(entry, &lookup->entry_list, siblings) { - table->table[i] =3D + table->table[i++] =3D GPIO_LOOKUP_IDX(entry->key, entry->offset < 0 ? U16_MAX : entry->offset, - lookup->con_id, i, entry->flags); - i++; + lookup->con_id, idx++, entry->flags); } } =20 --=20 2.43.0