Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp204898rwi; Wed, 12 Oct 2022 18:42:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FpfxeW6qOd1I9+rFW355oAPeQbmtqX5INg1161aIZGZJbUg5crh0cZp5BZVtLBmmHJ2Q7 X-Received: by 2002:aa7:d7c5:0:b0:459:fad8:fd2 with SMTP id e5-20020aa7d7c5000000b00459fad80fd2mr30206204eds.336.1665625358619; Wed, 12 Oct 2022 18:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665625358; cv=none; d=google.com; s=arc-20160816; b=JOCRZ2T1ESV57gXa14yjK+dfZaaeXHQgeheQo4l7XuXX3872t63k8voVCqZWJidgFz RHYsvoIT2rJcVZRkSFbXBCrMJAddrER1LS64/189ZURrE8Fiu0h+Hz68pDZ+dwSsoolP gqSZlRew6phvnHIN9wymwb2eqoZ8cZmSQXThbaslbY/fvMxdDNuox1AfCfGDqoy/EEY1 4BBKyK6lm5ct0r20FHGrPOUyc9DBGi2N1Mj/l8hr/xHlXM5Sbu4SpROa7BmTGe6MhQ31 Ufuj7o+SNQAa9gfxCsKptxDdr65M0Ueh0PA5Nwq6OgJPTC+ZWJP/IKfCmXFFzGhzYZaw rQnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kS8ow02D4j6zVm2XmMmPTFQL5QRI0KPwWtJURM3n3KM=; b=jcTTv+7A+Uf5nLuFYz2bZO49w2u1QIikKPRbSAlkAY3CMylh92WPiXXjSR77YOsNF7 mO7CnMAhCanC58co3YCgwlblGuh5lgyna6h3d9Sly1zHIUhB48ZK2BAR3S1FuKQaVxW0 Epkw7oktq8O4rkUH6zb98ihipR3HMCGbgak6bI9u3xX58rd4xa7dsY52sdIUSvLJiyL9 qVHkRI5VGA4VoBgDJo21hN92M/1TqnPWxFmTtAMFVXUq/D/RV4pQDR1709a7pVKzqEVA bN90UBFq/Utq7Iy8WMU/hJFPsNptuiSC8IZrIV84EvmFZKAtrVw2sat6JFB5K8YJ/+b7 ZrwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BuARYp3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g19-20020a1709065d1300b00773b8e3b6a1si18487519ejt.805.2022.10.12.18.42.13; Wed, 12 Oct 2022 18:42:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BuARYp3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbiJMASk (ORCPT + 99 others); Wed, 12 Oct 2022 20:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiJMARo (ORCPT ); Wed, 12 Oct 2022 20:17:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17150197F86; Wed, 12 Oct 2022 17:17:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45F1161684; Thu, 13 Oct 2022 00:16:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E457EC433C1; Thu, 13 Oct 2022 00:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620209; bh=6mTtkkM2X54TK5ED9VusK05TamqkZxpTOCWQriOcCro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BuARYp3LZ8fuUjzm7LaTvPAoDYYyDePArbvJQ+1A7JyQ4+OpVttbBMuqfxoFHRutS FOq0B3v3F3nMPRneRG9/cXJ5kxRljVANdPhOXzeP2qt+7KJHj608bknHDb47A0W/S+ SPtgsPEdsrNsQEchs2bRuXJOSuvMbnq7PklI1eirLZd1fQpxp2yg3D7AQHqqXCbDG/ xvvYrk4oXlVHRkx6sbK1N3NBxV3lXMZGEW+unqFzNbbsB4oILneYNb6c7ZFYkvEYOR UvGd13xu4W2tebN21uiI3QRncTDd+4AWea5QTC8YBnHUhv1UY9hVYmjyURQlFAacu8 r+0rA7zhypbvw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dmitry Torokhov , Linus Walleij , Bartosz Golaszewski , Sasha Levin , linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 6.0 22/67] gpiolib: of: make Freescale SPI quirk similar to all others Date: Wed, 12 Oct 2022 20:15:03 -0400 Message-Id: <20221013001554.1892206-22-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013001554.1892206-1-sashal@kernel.org> References: <20221013001554.1892206-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Dmitry Torokhov [ Upstream commit 984914ec4f4bfa9ee8f067b06293bc12bef20137 ] There is no need for of_find_spi_cs_gpio() to be different from other quirks: the only variant of property actually used in DTS is "gpios" (plural) so we can use of_get_named_gpiod_flags() instead of recursing into of_find_gpio() again. This will allow us consolidate quirk handling down the road. Signed-off-by: Dmitry Torokhov Reviewed-by: Linus Walleij Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpiolib-of.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index c08564948bf9..30b89b694530 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -407,7 +407,7 @@ static struct gpio_desc *of_find_spi_gpio(struct device *dev, static struct gpio_desc *of_find_spi_cs_gpio(struct device *dev, const char *con_id, unsigned int idx, - unsigned long *flags) + enum of_gpio_flags *of_flags) { const struct device_node *np = dev->of_node; @@ -428,7 +428,7 @@ static struct gpio_desc *of_find_spi_cs_gpio(struct device *dev, * uses just "gpios" so translate to that when "cs-gpios" is * requested. */ - return of_find_gpio(dev, NULL, idx, flags); + return of_get_named_gpiod_flags(dev->of_node, "gpios", idx, of_flags); } /* @@ -527,12 +527,8 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, desc = of_find_spi_gpio(dev, con_id, idx, &of_flags); } - if (gpiod_not_found(desc)) { - /* This quirk looks up flags and all */ - desc = of_find_spi_cs_gpio(dev, con_id, idx, flags); - if (!IS_ERR(desc)) - return desc; - } + if (gpiod_not_found(desc)) + desc = of_find_spi_cs_gpio(dev, con_id, idx, &of_flags); if (gpiod_not_found(desc)) { /* Special handling for regulator GPIOs if used */ -- 2.35.1