Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp668752rdb; Mon, 15 Jan 2024 09:32:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IExWmKryMeY6Z7Rxi9l5eXkG0vNLY3/KLljyzV9kpeQtCoi9hQfhFppIJI0/U35ESkvkWML X-Received: by 2002:a05:6358:e81f:b0:175:2ce6:7328 with SMTP id gi31-20020a056358e81f00b001752ce67328mr4320798rwb.26.1705339960084; Mon, 15 Jan 2024 09:32:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705339960; cv=none; d=google.com; s=arc-20160816; b=XPwh+kPdeAudE1e/O6a5dDMuqwFuKRjt2zC2xl1d0jmuhTOQUUPtYmOIZ7X/P7tnkt 4IloR039Vtx2uaN/ZbZZrcko9qirlp3KYmASxDLu9g7sDsyFVAWkca239u0hbpPKKVU5 STUm0YBgk9yuvpoGIkpDkbKFX8EuRGVWeWxXSsu9pxxnM5Ps7EmWoLYTAvm2aYr73lbT g/Ujuy3qhAuuqPnWxS5zFYXNWN7V6uCKY8PrTiTLcQYwGSZOPVSFxsFDWgOKk49LxDrn NueGd5cvIU+mKtXFxn2+bdMS1/MxGkP7VftMJmV1VLjyAiWq7o6bHIVpTwhwedIUrKy/ z6Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=SdoIC3l050GAXELulObO2qUcL08QXPH105bVf6kVLec=; fh=D0ckIXgsGs3/1u+30rJ+lcPXXsTGlsjE6IR4z+cFWgo=; b=D1eW8WJQRIyKKu1fz4P5TJFUe2C+vvb03ZFq66uEeIlOIKG0R2DxqRgYdvs/lM7IcV lq+4qWWzTmwMpyE3OlqtXS+owvyXS6/FMtKw+OPQmx2wQ+LIJxA+00zZvy+jrvUrqRFu 4CTquVx2c8pIzef3tBSLeyNslv8Kiuw0iVSOzIl+7OfVhz3P8Tp+GKauBoAOPoPnU6Di 8iYzGpdT+KbzIlMQS+teLrIJrghL3UqLiFs/aGPv8P5BqQdY0n6Dr5jJ/uD/+j5YWCZk 4unxr5Dopxc45DyboTjOAWFv0+fcKR6+5xS6tXaDiuBmH6A2Wk+0GodihJwmnWYYQCvm YgwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26320-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bn6-20020a056a00324600b006d9a69abf0asi8851173pfb.55.2024.01.15.09.32.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 09:32:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26320-linux.lists.archive=gmail.com@vger.kernel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 98A902832FB for ; Mon, 15 Jan 2024 17:32:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6812F18049; Mon, 15 Jan 2024 17:32:34 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 A7DE218041 for ; Mon, 15 Jan 2024 17:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rPQom-0004EU-7Y; Mon, 15 Jan 2024 18:32:12 +0100 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPQoh-00044H-MF; Mon, 15 Jan 2024 18:32:07 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1rPQoh-000A5v-1x; Mon, 15 Jan 2024 18:32:07 +0100 Message-ID: <289c4af00bcc46e83555dacbc76f56477126d645.camel@pengutronix.de> Subject: Re: [PATCH v3 2/5] reset: Instantiate reset GPIO controller for shared reset-gpios From: Philipp Zabel To: Krzysztof Kozlowski , Bartosz Golaszewski Cc: Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Rosin , Jaroslav Kysela , Takashi Iwai , linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Chris Packham , Sean Anderson Date: Mon, 15 Jan 2024 18:32:07 +0100 In-Reply-To: <7f311659-9f49-44dc-ad40-977d34066d98@linaro.org> References: <20240112163608.528453-1-krzysztof.kozlowski@linaro.org> <20240112163608.528453-3-krzysztof.kozlowski@linaro.org> <7f311659-9f49-44dc-ad40-977d34066d98@linaro.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Mo, 2024-01-15 at 17:13 +0100, Krzysztof Kozlowski wrote: > On 15/01/2024 17:06, Bartosz Golaszewski wrote: > > > + > > > +static int __reset_add_reset_gpio_lookup(int id, struct device_node = *np, > > > + unsigned int gpio, > > > + unsigned int of_flags) > > > +{ > > > + struct gpiod_lookup_table *lookup __free(kfree) =3D NULL; > > > + struct gpio_device *gdev __free(gpio_device_put) =3D NULL; > > > + char *label __free(kfree) =3D NULL; > >=20 > > I got yelled at by Linus Torvalds personally for doing it like this. I > > know this is a common pattern in code using GLib but Linus wants auto > > variables to be initialized where they're declared... >=20 > Declaration is here. Initialization is here. Therefore this is > initialized where it is declared. What's more it is initialized to a > valid value, because __free() accepts NULLs. [...] > > ... so this should become: > >=20 > > struct gpio_device *gdev __free(gpio_device_put) =3D gpio_device_find= (...) > >=20 > > and same for the rest. > >=20 > > Don't get me wrong, I love cleanup.h but there's a (unofficial for > > now) coding style. >=20 > So you just want to declare it not in top-part of the function but just > before first use? IIUC, Linus wants exactly this: https://lore.kernel.org/all/CAHk-=3DwgRHiV5VSxtfXA4S6aLUmcQYEuB67u3BJPJPtuE= Ss1JyA@mail.gmail.com/ [...] > >=20 > > > + goto out_unlock; > > > } > > >=20 > > > rstc_id =3D rcdev->of_xlate(rcdev, &args); > > > if (rstc_id < 0) { > > > rstc =3D ERR_PTR(rstc_id); > > > - goto out; > > > + goto out_unlock; > > > } > > >=20 > > > /* reset_list_mutex also protects the rcdev's reset_control l= ist */ > > > rstc =3D __reset_control_get_internal(rcdev, rstc_id, shared,= acquired); > > >=20 > > > -out: > > > +out_unlock: > > > mutex_unlock(&reset_list_mutex); > > > +out_put: > > > of_node_put(args.np); > >=20 > > I suggest reworking this to use cleanup.h as well. >=20 > It's independent task. This is an existing code and any refactoring to > cleanup or not is independent thing. Seconded. Separate cleanup very welcome, but this series is about adding functionality. regards Philipp