Received: by 2002:a05:7412:d384:b0:fc:a2b0:25d7 with SMTP id bq4csp5912rdb; Wed, 21 Feb 2024 13:51:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXyBgON1D8iiYh30m8U7XQqc7QIAzXqu0zZOsqOp2bK1YbpYV9FBP8LaxRjAGONpruQ3ZpAffgvri16zhA7g8+0OySdp4T0kzX2IZwc+w== X-Google-Smtp-Source: AGHT+IH5zdNiuwg4poG5ESPTQ5hVW5OOu3h66GOOa7BP2i98WR44Tj3kjzHImOmXCxC1Fka+KlDS X-Received: by 2002:a05:6830:1555:b0:6e2:f9a1:9627 with SMTP id l21-20020a056830155500b006e2f9a19627mr17805863otp.33.1708552294778; Wed, 21 Feb 2024 13:51:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708552294; cv=pass; d=google.com; s=arc-20160816; b=W9T79r8n+/vlLUUEQCrBKJ+7rCTibIjx4hN5O6HT8YXKvBitAj48PMnoG2LmBhRK25 Tc688qMyLHVBXrNU2orRL0V6K4aRXYW8L2Vg/xNBNsu8XxpvnQk7FsjS+Dt0pAGcGdZ3 5Zu2QO1R0ej6q5uDaMAa1OCUD8Z5r6WMQTg7ltFbypwPDZNbe+9taAECJBpATR9vGXeP yoKWNIQPIsX6tj8gzgz6OXVDM9Bi2OGPsJVmAa2t6c/4/kmIRpHhelWEeL4HIZKO8rNb zUH9sy/NwLv4/EKcHDy4ZgsjTtviptPT3whrpIE1a083BVue+QE+65ht/ONwQoajpFhd JpVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=0yHRJigbA+0gNb0mcx+skQZzaB/lwBVYR+HxKRzHC0s=; fh=p+jLrL3GjRjD0P66zBHvrMkR5i6CY7LiVmZ0c3o/+W4=; b=RPrby/xRLZ4Qu/7i2IjcxJegZGyvzwHmhkdAVLGagQdNLm8Qf715EklmYZ0aWcYkzG tusIY7vsNadYDddK1ocvbGo9hqUvMAtd6fz/9aWn5rAaCAc8h8Mz+OUHWu8vO6qcqdTw PKjY+YSs+hPUJZi9yhRIHoino/XcRJ5VWGQavG6VpQx7lEW4T2mh4ORfvqiHE2hkuQ0l wTqwk6EsLL44ML/I/vFgAkEzhRUxsjNqlgg6S/vGq6PHo05cnqUxD7XGmNEGT+PYkMPI sMG0Dd/jSEiVkZYRn/TsJWnTr5QPHoIFofAwkjk3ZvgEti5axF5qKx+SHD83vYUXJwFd XIQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w6LolOgQ; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-75573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75573-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s3-20020ac85cc3000000b0042e12ff3d30si7954652qta.622.2024.02.21.13.51.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 13:51:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=w6LolOgQ; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-75573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75573-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 87AEF1C22821 for ; Wed, 21 Feb 2024 21:51:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB79F127B63; Wed, 21 Feb 2024 21:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w6LolOgQ" Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4173086AF4 for ; Wed, 21 Feb 2024 21:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708552289; cv=none; b=uSumgowfaIgtfSGnUILExhM0OSaVUfmuwHKSgIE2wRlXRdHQcFhdex1tE749aXoSGKHaUagIri/obabNgZiKI9gbiIzHemDsHnm7RixZ16N+H3oFhhgiMI2G5zL6U/ck4jbhmCYiHYA/Sus9mAggtGUi9V2PKLKCXAN8kz07mjQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708552289; c=relaxed/simple; bh=+z7mNzNxlJ/8k9LaMUX5Z/36a7oWxQduTdbpVjbTwXo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=sA0coJi3AyBaQ740P1Yxs7v/MQ1d0irWpUm+ewfNVLkq1xYf2/XQkkNy2oUA6cZBOCrXYCJcd7LQjuYjugKfXK696ZVje08y79c6ahDbYHitF+9gBzLzNB9SnnQUEZje+3GB5BKSe9NingFvJITsSBuEv/WVfqMIm9fQSk0fZYY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=w6LolOgQ; arc=none smtp.client-ip=209.85.128.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-6085b652fc8so28664277b3.2 for ; Wed, 21 Feb 2024 13:51:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708552285; x=1709157085; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0yHRJigbA+0gNb0mcx+skQZzaB/lwBVYR+HxKRzHC0s=; b=w6LolOgQ/OTyCZq5SvGRCqqt4cEgLJ0zQIDlhq0GhKzGgjcD8IblnuiAycFzV0jGi9 7fDDGph7izOYZC1W95md+OGRY/712kvo4pMWu2zeHofBa7FgFzsaab9+aZQdtsE5ycz6 XH8n+XApKIN5l+mN/hfyFAiskdnUxRS6iM2qSDrCVG3blmQCmjU+f0odT+aG4mrp/dtT XA7T0spIvS4BwCsTXtwnhkrUAzYSnfmikE68pm5CVDmeHrYE0nycljSP33Gg9ensPys2 VPW+xkwab/IfcR97yTN1whkdUqPjECuQgWSTcHkENtZI4tNZieeIRJ54/puqjxDIe5J2 4Rpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708552285; x=1709157085; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0yHRJigbA+0gNb0mcx+skQZzaB/lwBVYR+HxKRzHC0s=; b=XDb8S4+089RxrDQ8jHeByR2KfEa/KawTQnoUqpZB1eRdGSI0Z2xwzxaxP7UL+efJ/0 YG6p9mONto+CWG28CNA4xYtUk2Ss7tVOMSbJLUV0eYA2MwL3Q8XDcDPdhiQACYGr+gV0 rwD0ghbaKfqlZ3mbcp5Mcq7BtLxHyAhxNSXS1rdyLIhhH8l+H1G4Wzv3dcMWB5hOpf4f COaDXc1nRSH7DNgx11MUb6gCZ0B13wZPg9wPHdezAtfe+CugVMdDqdFqvGTDCw2qu4of T5s6HLJ7JI1DzAL3dX8iiNkbXrJfHiPoLPoCgSq5gi3wInq4t5hn6foCkEyYFdICO8fl 2Uag== X-Forwarded-Encrypted: i=1; AJvYcCVp154Ir/np/BMbwH+J8GhJtiltqBrUQnSXQzeic/SshTRnryUg4GRd19Dvs79M0eps/7hVXiLxg0to1YIk/UTSVPhzt1j9Fzt8TrTJ X-Gm-Message-State: AOJu0Yx9nz9Hq5/rhRmrA60cWXIKuHNpAR05jrpv/eT3GowPp3VSurOr tJZdbawx1KkYy8K7unSxfzYbUfyLjrt32Vge6HWOgxkq/oq8LRLoGnKr9W1nfgjp++wnHhbqLZT OS+/DcisfjniRFcU8tsMMENRdWsX7wJwwhapNTNs90V8Whxdw X-Received: by 2002:a05:690c:82e:b0:5ff:b07c:adb4 with SMTP id by14-20020a05690c082e00b005ffb07cadb4mr15829487ywb.45.1708552285238; Wed, 21 Feb 2024 13:51:25 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240215083328.11464-1-brgl@bgdev.pl> In-Reply-To: <20240215083328.11464-1-brgl@bgdev.pl> From: Linus Walleij Date: Wed, 21 Feb 2024 22:51:14 +0100 Message-ID: Subject: Re: [PATCH 1/2] gpio: provide for_each_gpio() To: Bartosz Golaszewski Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Bartosz, On Thu, Feb 15, 2024 at 9:33=E2=80=AFAM Bartosz Golaszewski = wrote: > From: Bartosz Golaszewski > > We only provide iterators for requested GPIOs to provider drivers. In > order to allow them to display debug information about all GPIOs, let's > provide a variant for iterating over all GPIOs. > > Signed-off-by: Bartosz Golaszewski (...) > +/** > + * for_each_gpio - Iterates over all GPIOs for given chip. Does this really intuitively fit with other functions named for_each_XXX()? > + * @_chip: Chip to iterate over. > + * @_i: Loop counter. > + * @_label: Place to store the address of the label if the GPIO is reque= sted. > + * Set to NULL for unused GPIOs. > + */ > +#define for_each_gpio(_chip, _i, _label) \ > + for (CLASS(_gpiochip_for_each_data, _data)(&_label, &_i); \ > + *_data.i < _chip->ngpio; \ > + (*_data.i)++, kfree(*(_data.label)), *_data.label =3D NULL) = \ > + if (IS_ERR(*_data.label =3D \ > + gpiochip_dup_line_label(_chip, *_data.i))) {} \ > + else I would call it for_each_line_label() or something. I try to avoid using "gpio" in function names as well because of ambiguity, I could also go with for_each_hwgpio_label() I suppose. With some more reasonable name: Reviewed-by: Linus Walleij Yours, Linus Walleij