Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1376518rdb; Mon, 2 Oct 2023 07:49:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSiT02n40MOK8zAT2qI1H6alC5fc+aUR2Ci/PqDNZi72iyo9MxY/9zpg2WSSHPljGVh9Mf X-Received: by 2002:a17:902:ea8d:b0:1bb:94ed:20a with SMTP id x13-20020a170902ea8d00b001bb94ed020amr9842137plb.24.1696258144421; Mon, 02 Oct 2023 07:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696258144; cv=none; d=google.com; s=arc-20160816; b=M/be+EguN1vgmCOeeMNCYj2yS9Dib17hS2h1akcBap4xEJttVbm96F6NKKG018oKhb k5yjHRIA8boDoI5SOmfpolDlodKAoj9XvSsFO+xjDOtCdPfHyIbcEYgXAhZRZMj9qim8 dM3JEZB3x/3OIB5k0Ew+e1f6Wa3GTNX+0SCXmPwOGzQO3eff7EbLxLvraoiBYW3hVgKG MICqaCnki+x82dfViAIZbQnaVbjnU1IPTJefFlHYaimfWz6q3HlDpP4Ufiie6ubmSUrM Xoq43GkrFSZ+DL7ijNBPsmB7+3HcL3IaR0jYEJPaMIPxd8rGlJsVsLn1VLZPS72ofxYs qNNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=EGUYisSFuCVSXERDSMArhOminCdOTb9Vp2WMHo/RH4E=; fh=3QZlVAKmI+YsGzZhlKBN2gp/YLo9SToV48UktQWK2CQ=; b=knK+a21Vr4B7CW5EpltSb84rTnut2gqY0zkqT0FOhqBC/yV2XhtfRs5+3gaBwuOtpK vdJpyyn36WrjfoyEE/01NUPDZ4q8DloNLFL+aNCjbQkab63d7uKzeEJ3a6BR50kRLnpH a8vxq3+K8K0XB2n6gquVXj1v4WKIsosIt9ypq40GHiy0kX+Dvm1goGEWSA6sJhFy4C2f qBIuxgSmQLeZ52K4+OXzgRLY7wWPuI6TGFi30skcrjTGeybWFdTQ0ypQUHW7SBHkjE+B hn8U0Gpdc86Oqk7VPiaMcvU2NlOTlUZRRI/imvCWX8jep8t9yBW+8+2hAwrdmFFzPdG/ W7+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dbt5BXt0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q8-20020a170902dac800b001c6317541dasi17592156plx.572.2023.10.02.07.49.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 07:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dbt5BXt0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 2EA8B8059E4D; Mon, 2 Oct 2023 01:13:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235812AbjJBINA (ORCPT + 99 others); Mon, 2 Oct 2023 04:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235814AbjJBIM5 (ORCPT ); Mon, 2 Oct 2023 04:12:57 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85FC0C4 for ; Mon, 2 Oct 2023 01:12:50 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-50585357903so683981e87.2 for ; Mon, 02 Oct 2023 01:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696234368; x=1696839168; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=EGUYisSFuCVSXERDSMArhOminCdOTb9Vp2WMHo/RH4E=; b=Dbt5BXt0HtfZftTC8007MeLuDQT6jbYUD87C3GiVicYIDFZLpbtFRJY7WV9TYsV7+K vHhwUxm8plxE+g5CCahu1sFVHCWqvUb4d46KiNe0CSSwE/+28lzlgsq00IN1KcBx9yD+ eJvDYCEzv+GOR5PzD2FtRCxJLyEO2cXaYCwQ7M0J/qzuKjtwktr0jJ1V+G64A8jflPlg Ze0Oeyh3YFNlS6FtlN527VEtxE9ZZHzbkHPgMgs/5PL0fPXf0/mGpjX5N/dYLclpzZ5h lwxMuTOxFvjLP1ACEAt9XCRthl8bnXQXRxK5wDqzrQj8O6YMIVVRDzFLNLChyyxJKrhg sSnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696234368; x=1696839168; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EGUYisSFuCVSXERDSMArhOminCdOTb9Vp2WMHo/RH4E=; b=KO65/jGRo/LQXDoSl1BLXckFve32DT0SJ8LfnnpPzMc0SHDJsbAxmvpgl2qMEsFrVu uCwdqMp5ujsOx6xbwnP+hobwraGmDI7SHerASF9FUerV9PeblEGSsknTbtYNAzs8LoZ8 KeUHzfXsSpGM88EQ9n8+FLhgrigpur+IxVCuOgIxOzvvQAAtUPvWCKNEBeS0wPVxhCiH Kmky1ZP7qtaSeK9dhHo3sw8ZpUVEYXj3KO+LkSCnLdkyLb3msEX3TECUCo5Dej8myKmp tsaU9YbI1ai3BOWD4VxDHrDlLPeqzHWqO9A9+dpi342RzR/N+KPICbB0XGGPiFqW+eRq h/aA== X-Gm-Message-State: AOJu0Yz5TruIFhF7PfAxXRFQDwKbAv0LKZ3ceVmvpl/fGWUHjlzmZEVX rv82/rrKqIMyBpYzQGjy4yilxdK5dDcEGA8dT3k= X-Received: by 2002:a19:c504:0:b0:503:8fa:da21 with SMTP id w4-20020a19c504000000b0050308fada21mr9021707lfe.43.1696234368515; Mon, 02 Oct 2023 01:12:48 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id r7-20020a19ac47000000b004fb7359ab83sm4631451lfc.80.2023.10.02.01.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 01:12:47 -0700 (PDT) From: Linus Walleij Date: Mon, 02 Oct 2023 10:12:47 +0200 Subject: [PATCH] gpio: Further document optional GPIOLIB MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231002-gpiodoc-v1-1-a8ec8376bbf1@linaro.org> X-B4-Tracking: v=1; b=H4sIAH57GmUC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI2NDAwMj3fSCzPyU/GTd5DRLE2MDMxPDJEtDJaDqgqLUtMwKsEnRsbW1AEq EgStZAAAA To: Bartosz Golaszewski , Andy Shevchenko , Jonathan Corbet Cc: linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 01:13:13 -0700 (PDT) Optional GPIOLIB as in not depended on or selected by a driver should NOT use any *_optional() calls, this becomes paradoxical. Signed-off-by: Linus Walleij --- Documentation/driver-api/gpio/consumer.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/driver-api/gpio/consumer.rst b/Documentation/driver-api/gpio/consumer.rst index de6fc79ad6f0..3e588b9d678c 100644 --- a/Documentation/driver-api/gpio/consumer.rst +++ b/Documentation/driver-api/gpio/consumer.rst @@ -29,6 +29,10 @@ warnings. These stubs are used for two use cases: will use it under other compile-time configurations. In this case the consumer must make sure not to call into these functions, or the user will be met with console warnings that may be perceived as intimidating. + Combining truly optional GPIOLIB usage with calls to + ``[devm_]gpiod_get_optional()`` is a *bad idea*, and will result in weird + error messages. Use the ordinary getter functions with optional GPIOLIB: + some open coding of error handling should be expected when you do this. All the functions that work with the descriptor-based GPIO interface are prefixed with ``gpiod_``. The ``gpio_`` prefix is used for the legacy --- base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d change-id: 20231002-gpiodoc-cf9430641b91 Best regards, -- Linus Walleij