Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp905743rdg; Wed, 11 Oct 2023 08:39:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgCatv3UtIRvDCGXMQvN8ln+7KFy2Fm0kL8nxAvUGpuBE56HCtJxhCJUbMlM/n4C1S0sTx X-Received: by 2002:a05:6870:1615:b0:1d5:da78:5c96 with SMTP id b21-20020a056870161500b001d5da785c96mr24566259oae.48.1697038794203; Wed, 11 Oct 2023 08:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697038794; cv=none; d=google.com; s=arc-20160816; b=pBZob21exaGKGiFBgDbLIzVg7GRBYevYc7rIAZk9Gs1b3k7ndMt6hIS+2NzQYVX3Wd vWSrz+1WeR1EdIXmIhNAAwazao6LhgU0iuA48RWo22nAq0VI4zvLMIEIS2W7zfXcndpA rHbWPwg4KQ9am6FJ1qocz87vTq9WYrcO6v+TQnOnmguVTTqh7N6dC2qmu6wDt5FsrY2w OAoemWnyzdeksWzWScIPMguIOF0fJoCKFuzE5R/RW1yFn28sSp7ddiAA2SFI5xY6jA8A EGXNeXcU7OkfWdlyk2dI4p4HQbg79Vz/Iks/hX0slz4EMyb4R46mkIAJEUI6sVL4c4H9 GxSA== 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=W6TGfEyuvebEaZWUEyk1hloX7p7Dxc5o+Os6nRYfszo=; fh=In6xp0BsdpYiZA3oeXoVdqW2ob8WNNZqAlUF8m3juDE=; b=pdRHFX5Mmgr7ALHRplR1oth4BeHYhSkMjvu8ZnLpxXXObVsRHqyNGIAZmCHytVkI/b UEnBXbxVq7JqdMaVLsMl+da/7zf89bkDeqvhRRWRSSEkAqQd4hddmK2gMASolMpH8KKj 4/rPEmIwT75kBoycMwFOJ7JlC/yhpkQ/1CXaWMEnBSd+Ja1QD/AbcGiZDu/Rfl0v4oOW c2JKOKhovZTucaY27Pfkd9sSzhQ5ALqopt50pc+xf/G1A6fN6nR/H+uRUNZKsh1Ii1Jt LO4fSXOF54nHyDUIF5KJhEc9s/RVs/OPjUKXT3aCGDZ8jHJJ6CICVKiS6VYDn6EURH5r sb2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GKXU7aHM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q6-20020a635046000000b005898d997f52si46330pgl.66.2023.10.11.08.39.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 08:39:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GKXU7aHM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B59948144184; Wed, 11 Oct 2023 08:39:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232741AbjJKPjo (ORCPT + 99 others); Wed, 11 Oct 2023 11:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232761AbjJKPjn (ORCPT ); Wed, 11 Oct 2023 11:39:43 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C6BEA4 for ; Wed, 11 Oct 2023 08:39:41 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-5a7afd45199so32469977b3.0 for ; Wed, 11 Oct 2023 08:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697038780; x=1697643580; 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=W6TGfEyuvebEaZWUEyk1hloX7p7Dxc5o+Os6nRYfszo=; b=GKXU7aHMZbeUt/6olc/O7S9ViGQAWK+gccLEvbvxJA3XyvoOwSIALXLQODvO+V3PBo ruQohI6UqYYi39Q6lMf2Ko7EQoejFP6BYtyjhGrUpedSrbpx0CKP9YQFoE9l+1paqw8o tMBhGFWMqVoR4fvkT1ZSbPKP7UP38UwZIvIubP1hZICPd0tJgAowI7X6Is1buIpYKOTs V8ox0uxBMy1GxHmZTB4JlVoUVqn14IUTtp08Gb5fbFSXCWtwiD8qKRx+GoQJtpNEgeWU Tjx6uR/yGNPc7XM+jXYsqRmDuKlABhNVdiv3oaEnk6XNpGIM7XUM0XuLfjLpaQtuOylO Do6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697038780; x=1697643580; 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=W6TGfEyuvebEaZWUEyk1hloX7p7Dxc5o+Os6nRYfszo=; b=jle6m38jemC1fUPUVdDnYQP5NOn+V6yOM0WTWzbfOFE4WhY34YU3zvmZGyMTFLuLES MDvXHUIubn5VRCetm0yYy0o1w5dqBgZGKf6v659ItoVOsXdw3KnrbgzfeOA8a9RGmLAw /0H+9X4emiBVKTgFYYXEwYFFNplLx3qBFcftZJ26M/wPwM++Pc2NmH4qDqKz3F/QynpD 4Dihan99FK8M1TyCF334vcz1BQBCMB27ADiZ6bd0CbCOvmpYN0e9qBHqNfLHPSTBmi1z M7k7Sos428HoblNCAkPvfbDZcXXCt35OdWKz0ITnGPVH9zRfMomJhW5HBRtRf+I9Ju3l gTTw== X-Gm-Message-State: AOJu0YxkZTXplclNnBvCjrDpYcRkcyuloLC1egsrgayVzBp6OTOgMCGK 5mtdwxAkuMcvaBfWuMKZZQtnCP7AUqsJExPqhtc0tA== X-Received: by 2002:a25:8d8b:0:b0:d78:1724:1b1a with SMTP id o11-20020a258d8b000000b00d7817241b1amr19199871ybl.37.1697038780668; Wed, 11 Oct 2023 08:39:40 -0700 (PDT) MIME-Version: 1.0 References: <20231011130204.52265-1-brgl@bgdev.pl> <20231011130204.52265-3-brgl@bgdev.pl> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 11 Oct 2023 17:39:29 +0200 Message-ID: Subject: Re: [PATCH 2/3] gpiolib: provide gpiod_to_gpio_device() To: Andy Shevchenko Cc: Bartosz Golaszewski , Linus Walleij , Andy Shevchenko , Peter Korsgaard , Peter Rosin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 08:39:51 -0700 (PDT) X-Spam-Level: ** On Wed, 11 Oct 2023 at 17:23, Andy Shevchenko w= rote: > > On Wed, Oct 11, 2023 at 4:02=E2=80=AFPM Bartosz Golaszewski wrote: > > > > From: Bartosz Golaszewski > > > > Accessing struct gpio_chip backing a GPIO device is only allowed for th= e > > actual providers of that chip. > > > > Similarly to how we introduced gpio_device_find() in order to replace > > the abused gpiochip_find(), let's introduce a counterpart to > > gpiod_to_chip() that returns a reference to the GPIO device owning the > > descriptor. This is done in order to later remove gpiod_to_chip() > > entirely. > > My concern with this API is the following scenario: > 1. One driver requests the GPIO descriptor. > 2. Another driver does take an arbitrary number, converts to a > descriptor and calls for this API. > > Is there any (potential) problem? YES! And I have it already on my TODO list! But it's great to know I'm not the only one seeing it. Basically we need to The end-goal should be to make gpio_to_desc() an internal GPIOLIB symbol. There are still around 10 users outside drivers/gpio/ that will need to be addressed in one way or another. Preferably by being converted to using descriptors. Bart > > -- > With Best Regards, > Andy Shevchenko