From patchwork Wed Dec 5 12:47:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152896 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9255924ljp; Wed, 5 Dec 2018 04:47:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/W69/Ft5YHqObU6N/NMasn1mwtYivxLYbNCO/OSFONZYaWNTTXxlibKdfGwJbpldglu3c4s X-Received: by 2002:a63:561b:: with SMTP id k27mr20354277pgb.271.1544014079041; Wed, 05 Dec 2018 04:47:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014079; cv=none; d=google.com; s=arc-20160816; b=Qkkay6u0BGOYQrP8H8QBNY+SJDe7tF5jBMdXleT8l+WbdSJofsHT7P5vLs9f32aRHg WaNfYMVedDRNt4ACRHsvKnCI/aVhl3oy3rGQyc55GwnY3kauVg4Fs/+swg0trIGBf+gq BHuQB5E5O9KlwIp+L1+TEqAbQts+QMefV6D9gf7ebxStaHozuT7L/kuoqaVBuijNblC1 c0pBgX+OHc2Rz9anbladXq0WPqyopuS8L1aEMae0qR04crggH2epV9+xR9Z6BehTbgbD nbrbkmItQZ1LJ0g+c3UVAyuLxDvWvuYS41mOq7fWZgU3Rg0/h9KlXc6PABUZH1IfrFbe 4uug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1OGUaW4HLWctMtQHrwOTqPJRU9A2u+9w8AwyRoL6A9Q=; b=xX5ixId4eNOccBE2k4FV7iPlmalD77A681IpFSttWXXnPvs9gipwSrw/8UbYq1tCn7 PW+04tweEbeAg5ygzg1sN4BVHr39/sgom+oWnK70y+qqMwACaYQTcqkHKqLm13yg3qf2 9cTNBVYiYwekjXayzKxKdmJN4MkSEfORvFFKV0HwvLtiyJyuhNzVPCgv78/4k9qX9dmi QWgEwDztG15xT1tAUivw3DI728ypPC9atdJ8O9ILDxMMdN4K5ykYfjAVYqv5+LQctwSR 8a2L/CFXOiVnIIh0Q59jRA+5nXycfGdrjlcBRGR6P6VeG3Wpg4qf+JoExolQV3EbLO55 wBaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kk2RKmpx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n4si18996509pgd.10.2018.12.05.04.47.58; Wed, 05 Dec 2018 04:47:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kk2RKmpx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727956AbeLEMr4 (ORCPT + 31 others); Wed, 5 Dec 2018 07:47:56 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:36129 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727182AbeLEMru (ORCPT ); Wed, 5 Dec 2018 07:47:50 -0500 Received: by mail-lj1-f196.google.com with SMTP id g11-v6so18205769ljk.3 for ; Wed, 05 Dec 2018 04:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1OGUaW4HLWctMtQHrwOTqPJRU9A2u+9w8AwyRoL6A9Q=; b=kk2RKmpxsDFy9cCP5k5caiGO9Qhtr1lHPXPRw8dCeOcUUm62UcM3SP3Bl6qtbvzZKP cVwO+w7JMLMh+HJSUznc+UBCbw6P+TIF5x4K52zB/XmvK2mbok1Xq+lGWlXx4/fc/j1a Z/Z0W8QfRHJx0H7XnqxEH8BAsRA/QF3+OuBLM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1OGUaW4HLWctMtQHrwOTqPJRU9A2u+9w8AwyRoL6A9Q=; b=eKusSEeU1i2K04/IgyRD1s/BhUKd4f2PtuwnFSCDdcIrpsrDiw9MtGpaZCBuEdOImJ SmbzEZ92GkvAY6LCfxiXK9zJ/b1ijf+H3+eG1NWoH1vXmFNhEzBfF08+bkRKacAC70ru 9r5y0nKCn/70C8wCXSSQ9E1PxB37fd31suW2YG6y/1DcyF1jCyYqF3P7eGmKWa6SbAUf rdJt7xAjW26oFAf0P2Guku2dPZwR2g5Xy7fronxopZLSqjrxhb9jRY5YaCNj01GLx4IO U8lYSMHHLmTHjHDWFb7haCJF+7o90HP7E+y4FUyfb6Okh2PwgHgjAl7DRhtMPTMfppv4 UgSQ== X-Gm-Message-State: AA+aEWaz/pNGs+U08quwUUVXO3NcLC2809qGnsoj/5+TlXvtcS7GX5if 2e6VIPd6OPk/qe8wI23+ygri8+KgpQNs1w== X-Received: by 2002:a2e:914b:: with SMTP id q11-v6mr15122517ljg.164.1544014068137; Wed, 05 Dec 2018 04:47:48 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e19-v6sm3797125ljf.67.2018.12.05.04.47.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 04:47:47 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Marek Szyprowski , Linus Walleij Subject: [PATCH 09/15 v3] gpio: Enable nonexclusive gpiods from DT nodes Date: Wed, 5 Dec 2018 13:47:15 +0100 Message-Id: <20181205124721.26624-10-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181205124721.26624-1-linus.walleij@linaro.org> References: <20181205124721.26624-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes gpiod_get_from_of_node() respect the GPIOD_FLAGS_BIT_NONEXCLUSIVE flag which is especially nice when getting regulator GPIOs right out of device tree nodes. Cc: Mark Brown Cc: Bartosz Golaszewski Cc: Marek Szyprowski Suggested-by: Marek Szyprowski Fixes: b0ce7b29bfcd ("regulator/gpio: Allow nonexclusive GPIO access") Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - New patch after Marek's review. --- drivers/gpio/gpiolib.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.19.2 diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 230e41562462..a7e3fd512e2d 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4204,6 +4204,8 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, transitory = flags & OF_GPIO_TRANSITORY; ret = gpiod_request(desc, label); + if (ret == -EBUSY && (flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) + return desc; if (ret) return ERR_PTR(ret);