Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2711852rdb; Mon, 4 Dec 2023 05:41:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAhJ7y1w68SSzwejZOYNX0LPzkC1969Cnq52/NCs6K0i2fhPNygSTDcXQ1Nu+PuQ38jeFo X-Received: by 2002:a17:90b:1583:b0:286:97bf:d930 with SMTP id lc3-20020a17090b158300b0028697bfd930mr1760366pjb.8.1701697294481; Mon, 04 Dec 2023 05:41:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701697294; cv=none; d=google.com; s=arc-20160816; b=TVmMkZmiZi8BssU6pVu86HrIb5lOHwGJppoVgyt7SBMGdJhcJZczhPNgLqETP4J6e6 VM++tLcfQso3/6VFtYQhiaVkAfElS0yCKsbg8vU9Z8EtuqJunWn5VJd5KlnCDGl6+kHW 8PVzt21x89pkttEZb5hJWWbaCCdL1atJDx7Hnh7Heqlo8Ovjm//PVhoLjv2Akv6Jovzg MnHorbRo8+mwa8HzCe/zpjCCM44Wqz9xO125bisB5D6PxVmphj80Rv4JPiy6EG3ZKmaD ciN8oo0UeKbc7meSSbS1o8aCy6sx1TnfeV3P3S+yIW7vIP7NyMq/NKEBWYQEq3lNit26 W3NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=aykN48i+e3OoDO3X840k13yYydXS1iFRL8bf9Vv0ZMg=; fh=OaWD70+uD0B6xRXz1yAVznRbmdBKvBIpZnVTffFWNyw=; b=pCuEREzNwvAs5xNFXRPsE/bR7SeOlZywedrvn+6Ovs0GZgfDWFuYeg+H62R9A8mh51 Kf5vPrMaCx6gxOekqkXQM8XpzmJ4j6un02eMKsD9NhLLYl7DXPLeHxLaoMhDx029K+FW c1bxbl6LA1Uy+kDI5JlEDNlAoR9wHJ7XbqJL07YqQIaTwpFuWNSsqh+TpcngU+5EXB8p XwSQNGhvHEmMnNHElp7+WK6C7SvNWRWE3NQVziEZWDdeBWIAZfCf0jxa4SQY6SOMacny pzgQSV4Hrj/XTpSYQe/7Slb64fzFlsGmr/6Uq/tpq+kb/SachS8NgvnNge0IOE5syCi3 YQyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=0NulV3dg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id h3-20020a17090acf0300b002867ec14e6fsi3185061pju.153.2023.12.04.05.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:41:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=0NulV3dg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id CC0508065332; Mon, 4 Dec 2023 05:41:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235704AbjLDNke (ORCPT + 99 others); Mon, 4 Dec 2023 08:40:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235720AbjLDNkL (ORCPT ); Mon, 4 Dec 2023 08:40:11 -0500 Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71D60172B for ; Mon, 4 Dec 2023 05:39:46 -0800 (PST) Received: by mail-ua1-x935.google.com with SMTP id a1e0cc1a2514c-7c45acb3662so1147925241.0 for ; Mon, 04 Dec 2023 05:39:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1701697185; x=1702301985; 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=aykN48i+e3OoDO3X840k13yYydXS1iFRL8bf9Vv0ZMg=; b=0NulV3dgLKw3VvWNZc6KYS1u6UI4h7GORzUkyGe8vAgKx8Drd/Aw2hP23YEOGiMIr1 Q42PZi+VncLXclLeRIoPW2MHdb6qkNK1xgnyMfKAJIHB3Xz+wRzisoAiA+zKooNkKFiC HYKVFZP/L48KskyI6j0OQ2hX6j030r+OkZxUjdeRfWnFlcM7XK864AzHxGa8F8PQ2A2T /23yeIUv0vaqU34LXkQS/w2Iete/BdieUBtidFFaC7notEUeDHfqaIJqg0FafoR+zdER EYPkr0qqRJI8L5NtmT8D0om2vsO/Cw7haDutdOmZqT+ReG+JPrOq+kVUs7NiQ/kWQdkC DZwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701697185; x=1702301985; 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=aykN48i+e3OoDO3X840k13yYydXS1iFRL8bf9Vv0ZMg=; b=fLbN4wrGRW4yLFA8iPq73AWEDOfY6ZUeyTdNlCFjypmHPGiISrvPUfTHK3cMVMA7Ai /9Ha32IiNin4zuMn1bpQsU/nTpHkFW4KXzRa4iX2FxDnTQR00kbMElaNctSLeo4lAWrD eORKNNM42IIybRTD7wVVMe8/WA6rjUopyB9I9TmbqG/EHFpEEBmAwgHDGObcoPy01Rdu wjH6hHOZ2dKLH43HiG6ffzQ9QCF+mEtCqf9tQ1FtrfdJyOt/+JltCu5bBubZYa1hE0tD ks1rTYtu40nLatemyVA/3mj7WS+rgd1bFyleoKPdSyhNilbDZlhmqplN03AIa8adNSAN PoOw== X-Gm-Message-State: AOJu0Yx4sGSliMHbUbSF7gOv2l4/rc86GTgSbybsFmYqLf8TWYkN0puk 12TOpuNWFFEUd04OvQppKvu78yWKze4pHIi4hEbZdOq+MwKOiYAz X-Received: by 2002:a05:6122:32cf:b0:4b2:c555:12fc with SMTP id ck15-20020a05612232cf00b004b2c55512fcmr982063vkb.27.1701697185442; Mon, 04 Dec 2023 05:39:45 -0800 (PST) MIME-Version: 1.0 References: <20231204093509.19225-1-brgl@bgdev.pl> <20231204093509.19225-10-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Mon, 4 Dec 2023 14:39:34 +0100 Message-ID: Subject: Re: [PATCH v3 09/10] gpiolib: use gpiochip_dup_line_label() in for_each helpers To: Andy Shevchenko Cc: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 04 Dec 2023 05:41:32 -0800 (PST) On Mon, Dec 4, 2023 at 2:24=E2=80=AFPM Andy Shevchenko wrote: > > On Mon, Dec 04, 2023 at 10:35:08AM +0100, Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > > > Rework for_each_requested_gpio_in_range() to use the new helper to > > retrieve a dynamically allocated copy of the descriptor label and free > > it at the end of each iteration. We need to leverage the CLASS()' > > destructor to make sure that the label is freed even when breaking out > > of the loop. > > ... > > > - if ((label =3D gpiochip_is_requested(chip, base + i)) =3D= =3D NULL) {} else > > I see, but... > > > + if ((*_data.label =3D = \ > > + gpiochip_dup_line_label(_chip, _base + *_data.i))= =3D=3D NULL) {} \ > > ...can we drop this NULL check by using !(...) notation? > I'd rather not. this is already quite hard to understand and a single `!` is less readable than `=3D=3D NULL`. Bart > > -- > With Best Regards, > Andy Shevchenko > >