From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93DADEC8742 for ; Thu, 7 Sep 2023 18:41:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232847AbjIGSlG (ORCPT ); Thu, 7 Sep 2023 14:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233935AbjIGSlG (ORCPT ); Thu, 7 Sep 2023 14:41:06 -0400 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ABA390 for ; Thu, 7 Sep 2023 11:41:02 -0700 (PDT) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1d53ab187e8so1009096fac.1 for ; Thu, 07 Sep 2023 11:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694112062; x=1694716862; 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=UdWsNUufxYU54d2v+3Wxi5MrfQGJIJLOBq5vhtohyVg=; b=mKsjlVCvHJE2kCHUfcPT3M4uwZH4zidz28fSgnzdrs0ja3TAgqa2CYy5PEA0yUj21D NbcwqiGInYa52ZHPi4X3i7e/4BTyKQa938MSXB1NoRzb67PaUJFrBfclxy5kTL/X61qU WhB6MfQLGmSWisBHiRISiZOiond891rcUWEcchnJgYXeFooHdumPC8okZIOI3HogvUOU 5RwaXSpUVYfAga5Qi3fULdBxxCEc6FKIUoJs3nB1mh5vJWdGuIRwJMfrn/7qJBOGEbmN fWESP2UOGtNwlWFv0g+RErjv7PYXJ2X/PxjZUBxvZ3dK7Zfj+w+E2Yit08e46aGWQAUl YTEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694112062; x=1694716862; 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=UdWsNUufxYU54d2v+3Wxi5MrfQGJIJLOBq5vhtohyVg=; b=hF60VnLuLJhDip9jnBviIwEnPrI2km5JtzXY+GrKkXhw5gGRjsoWOMWo5GB8natofo O5fTgmLEoiBaTfST2HenbYMT/ACpRw/WTzth1O9dUROIWP+m91cngToXbBV/Iuiz76OL JLLdzlhpYa4+nKnCoO3w/cQ2+Uq6aYjCqCPbL+lTMqQcfs+8CeF3I8eflWCWULhA1v9Y LFYsxsLnSsVERsgms/EiXuQIgLJMGCAggqZpZ3msj9Sr9HDah54hoNtZyofZyTOTM99Y 4ZhOpn713oYAco6aoSnIZFSYPMhdmu3A/4oFTLrTuUHzV0GKHhYDOGUJglSgE4PtqWID c6+w== X-Gm-Message-State: AOJu0YyvnbnlVJygzcfBMA3Efa0Ev6hx6lPeK/jPsJPjBX9Qvb9PdN3F fB7YpZqbQwR0LDTAb9c6ICwWEpL65fdLYhJ5ObEqK1lFPHT0/I/Cg3w= X-Google-Smtp-Source: AGHT+IGMY/aPJYeBu1Pp0IzmGxqtgA0g7tRf3VGot5Pdq6hh1Y77T4EpHI+nXikBBcDxY/Os4mlIAHH2bnKyBxN7wMo= X-Received: by 2002:a25:258f:0:b0:d7a:edf3:f0a9 with SMTP id l137-20020a25258f000000b00d7aedf3f0a9mr17868648ybl.50.1694070333187; Thu, 07 Sep 2023 00:05:33 -0700 (PDT) MIME-Version: 1.0 References: <20230905185309.131295-1-brgl@bgdev.pl> <20230905185309.131295-3-brgl@bgdev.pl> In-Reply-To: <20230905185309.131295-3-brgl@bgdev.pl> From: Linus Walleij Date: Thu, 7 Sep 2023 09:05:22 +0200 Message-ID: Subject: Re: [PATCH 02/21] gpiolib: provide gpio_device_find() To: Bartosz Golaszewski Cc: Aaro Koskinen , Janusz Krzysztofik , Tony Lindgren , Russell King , Mika Westerberg , Andy Shevchenko , Dipen Patel , Thierry Reding , Jonathan Hunter , Hans de Goede , Mark Gross , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, timestamp@lists.linux.dev, linux-tegra@vger.kernel.org, platform-driver-x86@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org On Tue, Sep 5, 2023 at 8:53=E2=80=AFPM Bartosz Golaszewski = wrote: > From: Bartosz Golaszewski > > gpiochip_find() is wrong and its kernel doc is misleading as the > function doesn't return a reference to the gpio_chip but just a raw > pointer. The chip itself is not guaranteed to stay alive, in fact it can > be deleted at any point. Also: other than GPIO drivers themselves, > nobody else has any business accessing gpio_chip structs. > > Provide a new gpio_device_find() function that returns a real reference > to the opaque gpio_device structure that is guaranteed to stay alive for > as long as there are active users of it. > > Signed-off-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Yours, Linus Walleij