From patchwork Mon Aug 17 07:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 253704 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 1B0BAC433DF for ; Mon, 17 Aug 2020 07:03:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB29D20772 for ; Mon, 17 Aug 2020 07:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597647811; bh=PYY8uXXlmytuiAxIl2R7A+XdZTSPkLshPeJXisdTWNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=osrArw3rN5uPzU5yyhlF19N5J47gSRT28lWNRvvcX8Y532pSO8wjISS1G4QiY09H2 gBs5hiuOYTakobVur13VQljLFUWMaGklX2h1XDa9ZmbAMuI0sO3qMYl+KODUR+BWvC 91HY1eq8S1IQDCVSNHCJciOBz/pMh6k8OfaLXSyU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726646AbgHQHDa (ORCPT ); Mon, 17 Aug 2020 03:03:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:41626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgHQHA1 (ORCPT ); Mon, 17 Aug 2020 03:00:27 -0400 Received: from localhost.localdomain (unknown [194.230.155.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EBC5F2072D; Mon, 17 Aug 2020 07:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597647626; bh=PYY8uXXlmytuiAxIl2R7A+XdZTSPkLshPeJXisdTWNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sNU0etOLQpWcb3qMjipDoDxDj9JLuaaIOnZ8yUNr38mQuFXWCJrdNvSYDcSIJ/7DV 3PgKsoksU/zqkRnRaB7roOJqpU7csaHTLwzLuZEUguwDtmCaTVBXAnLomgt7KWOTno Skka53gMXQxzddzNfZFRJWHtXluIukgyR62ZdCGk= From: Krzysztof Kozlowski To: MyungJoo Ham , Chanwoo Choi , Rob Herring , Krzysztof Kozlowski , Vijai Kumar K , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: stable@vger.kernel.org Subject: [PATCH v2 04/13] extcon: ptn5150: Fix usage of atomic GPIO with sleeping GPIO chips Date: Mon, 17 Aug 2020 09:00:00 +0200 Message-Id: <20200817070009.4631-5-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200817070009.4631-1-krzk@kernel.org> References: <20200817070009.4631-1-krzk@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The driver uses atomic version of gpiod_set_value() without any real reason. It is called in a workqueue under mutex so it could sleep there. Changing it to "can_sleep" flavor allows to use the driver with all GPIO chips. Fixes: 4ed754de2d66 ("extcon: Add support for ptn5150 extcon driver") Cc: Signed-off-by: Krzysztof Kozlowski --- drivers/extcon/extcon-ptn5150.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c index d1c997599390..5f5252752644 100644 --- a/drivers/extcon/extcon-ptn5150.c +++ b/drivers/extcon/extcon-ptn5150.c @@ -127,7 +127,7 @@ static void ptn5150_irq_work(struct work_struct *work) case PTN5150_DFP_ATTACHED: extcon_set_state_sync(info->edev, EXTCON_USB_HOST, false); - gpiod_set_value(info->vbus_gpiod, 0); + gpiod_set_value_cansleep(info->vbus_gpiod, 0); extcon_set_state_sync(info->edev, EXTCON_USB, true); break; @@ -138,9 +138,9 @@ static void ptn5150_irq_work(struct work_struct *work) PTN5150_REG_CC_VBUS_DETECTION_MASK) >> PTN5150_REG_CC_VBUS_DETECTION_SHIFT); if (vbus) - gpiod_set_value(info->vbus_gpiod, 0); + gpiod_set_value_cansleep(info->vbus_gpiod, 0); else - gpiod_set_value(info->vbus_gpiod, 1); + gpiod_set_value_cansleep(info->vbus_gpiod, 1); extcon_set_state_sync(info->edev, EXTCON_USB_HOST, true); @@ -156,7 +156,7 @@ static void ptn5150_irq_work(struct work_struct *work) EXTCON_USB_HOST, false); extcon_set_state_sync(info->edev, EXTCON_USB, false); - gpiod_set_value(info->vbus_gpiod, 0); + gpiod_set_value_cansleep(info->vbus_gpiod, 0); } }