Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp824992pxb; Tue, 3 Nov 2020 13:36:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwjxdtzfYx8f8bVGb52f0VEUusO/AtzzM+gAtrCGfdKpYs3cLP9q7wSOB6dNE5IObRwSkO X-Received: by 2002:aa7:dc52:: with SMTP id g18mr24102775edu.369.1604439387887; Tue, 03 Nov 2020 13:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439387; cv=none; d=google.com; s=arc-20160816; b=fAbzWJW/Hzt/aT5teVuZD23k4MQrt0//7B4vd3Zdd3HxyMRDQ4mVg3JG+aqXx0Dfo4 9+7o8A5gBmmacH4C7gXHQf6XIAL4ITh3o3nup/fIcJG1EZ7BjMFlJbLZ1ZJH3tIPiwtH n4ngP+WamJMJ7kRhWEW2lSLv7OhuwBNMGJz/MnPAlSZSLju5LrflYc7CGuI1UVqh0Cw0 6G/+wJEXOfVzJLfZhVkcoYB8lQTySFx6O70WcSWIzPz1f8waCYutFYh/r4xP5I2YH+3Z gqUgolYWG1QxjD13tcgerG2nogD6Hs1Tg1iVnkRVy1l7VlOlZ1I0K43CYXiVNB7FuwZt 7RCw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9BMPOIqoQ54xVPAuguv5aPrJVfDnQqpljZV0/qlwurE=; b=OCvY2Nj5PwR67e2DsL+hYq7IpX87egPjeDiOKsCZrmSnZ5acqJ5rfuH4rbhPKAbqVO qiAPZPgXvG6wNKmZV/hzDjryzmfAQOltHgwEcSMWCxs2728Z2mVKpZSimRgvuRuAnbCM lhIwDVRr2dIglhd5QOSdOpwDVxhe+OXUgngtbZQ0r0yJ5FdbbNCSA9wSYJlAm0yquGjo +7QyzJVbAkrYKExqnF0+gLhyOiDnuJcl+sSD8pIGoUADQbuyxiaYPw82ZQKro8PvU9pd KWc2UoEW05w3BMqH9bEQUhLowE5FKS+MewROU3IsBav5ImbU/dZwDhPtqb8sfZL3wjo8 T6Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=criDklob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si13741223edx.345.2020.11.03.13.36.05; Tue, 03 Nov 2020 13:36:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=criDklob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732641AbgKCVd5 (ORCPT + 99 others); Tue, 3 Nov 2020 16:33:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:58800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732246AbgKCU4r (ORCPT ); Tue, 3 Nov 2020 15:56:47 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 BF9FC223AC; Tue, 3 Nov 2020 20:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437007; bh=3LmE73ilyoamoywy8JIeklBSBGD9wt2T9SyH+QaKNxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=criDklob6YwK7yAM7RW2UU2B3uiq7Wf+I6jwBr9av5PCRQ2ma+Q8DEGYEFgcXCLs+ LupcZexmMQ3T7T9FnwnHurxdkxW4e7bA+TUr62djHjzRlbOruOggUHqR4TDkWVlSfj Y2Wep0/yKfduOXlGMTImY4e13VaqC9X1nya5OVgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Vijai Kumar K , Chanwoo Choi Subject: [PATCH 5.4 105/214] extcon: ptn5150: Fix usage of atomic GPIO with sleeping GPIO chips Date: Tue, 3 Nov 2020 21:35:53 +0100 Message-Id: <20201103203300.887564048@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Kozlowski commit 6aaad58c872db062f7ea2761421ca748bd0931cc upstream. 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 Reviewed-by: Vijai Kumar K Signed-off-by: Chanwoo Choi Signed-off-by: Greg Kroah-Hartman --- drivers/extcon/extcon-ptn5150.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/extcon/extcon-ptn5150.c +++ b/drivers/extcon/extcon-ptn5150.c @@ -127,7 +127,7 @@ static void ptn5150_irq_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 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 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); } }