From patchwork Mon May 18 17:35:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 225675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03743C433DF for ; Mon, 18 May 2020 18:15:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB60D20671 for ; Mon, 18 May 2020 18:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589825704; bh=1HxIOp0p+Tyli1jlTBaZAeRhrVgH4wr28E09u2yL/oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HFkrlm23VSqJnax+zbfgGwKaNoatFc+ZAGPa8OWwL/C+H3KUjfj353J1uQUC9IcmI 5fWLTQc+p9SypP9yXgA5KaxifKFD17bztMUGi3A/eGsL7fR4gAgiBsZBA07GKeund7 mHkdDYxWkCdC59KzUPXRD2NQAN5z10PvRVDvt7QY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732170AbgERSAJ (ORCPT ); Mon, 18 May 2020 14:00:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:41216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731171AbgERSAH (ORCPT ); Mon, 18 May 2020 14:00:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3620A207C4; Mon, 18 May 2020 18:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589824806; bh=1HxIOp0p+Tyli1jlTBaZAeRhrVgH4wr28E09u2yL/oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glmgJPq4Z6e835hHNHyJPstziocb3L4wbuIucfrjw1FZa705wetX7luG1N/vWV3GO B+vhNfmhmpu9/pNdmoPV3PwWgf3x3nioVrfeeYfvP43uCqFn/gY4vYHe/IJj74Jdlk q5Lz8j7uqJ7fugRcpt81/QtgcJ2SFLMw/HVONbTU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ford , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.6 012/194] gpio: pca953x: Fix pca953x_gpio_set_config Date: Mon, 18 May 2020 19:35:02 +0200 Message-Id: <20200518173532.652633533@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200518173531.455604187@linuxfoundation.org> References: <20200518173531.455604187@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Adam Ford [ Upstream commit dc87f6dd058a648cd2a35e4aa04592dccdc9f0c2 ] pca953x_gpio_set_config is setup to support pull-up/down bias. Currently the driver uses a variable called 'config' to determine which options to use. Unfortunately, this is incorrect. This patch uses function pinconf_to_config_param(config), which converts this 'config' parameter back to pinconfig to determine which option to use. Fixes: 15add06841a3 ("gpio: pca953x: add ->set_config implementation") Signed-off-by: Adam Ford Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-pca953x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 5638b4e5355f1..4269ea9a817e6 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -531,7 +531,7 @@ static int pca953x_gpio_set_config(struct gpio_chip *gc, unsigned int offset, { struct pca953x_chip *chip = gpiochip_get_data(gc); - switch (config) { + switch (pinconf_to_config_param(config)) { case PIN_CONFIG_BIAS_PULL_UP: case PIN_CONFIG_BIAS_PULL_DOWN: return pca953x_gpio_set_pull_up_down(chip, offset, config);