From patchwork Sat Feb 9 23:38:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 157937 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1098205jaa; Sat, 9 Feb 2019 15:38:34 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaq3qyCY16uNOXRjaPQCFMBn193zouTDZbedcefEtxOeZmFXkJ1fYdf3KE+ZzS7/qiZmTje X-Received: by 2002:a62:ea09:: with SMTP id t9mr30985550pfh.228.1549755513959; Sat, 09 Feb 2019 15:38:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549755513; cv=none; d=google.com; s=arc-20160816; b=0CXSlJVcMBvSfNmpSrwWgYCxNzQdEIlpNDQ/kFhJA7bfrCN6Ygfn420Q3fuEzbByqN dZrN5t1mqd29LYU2eZTLIvoO/LXXTc0L7Xy61Y8McVvt5GlTk+lQS4MX1GlhgJJju/UU 1VX0q7kDNriL48L5wbz7h2kJ16O2T26oyYonkHifIaW4Tw8KYq4cm/OnENGPXnJTNvkv F+t6KPcG14/726n7EbecLq5mD010LOCynI8hUztbNW3slQePdSSRjm20dgwitVWv2kQA q838nYGL2xgCYE12TpLlDYkRWbEj3TRxIOrO7FMUccONYsKYmT3fM17LKdUadywi2Kp0 N7LQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=z4pZ290CNrSCrbRqPjjC6mK1LTheq0eTUeZeXFQredU=; b=N279WjDu2yDl1z1gqpHCvTUy4B8Plt877QtIkI44a+rxNqrvuLyhXmh4tXDawUSd23 kTXat6CyWLYAuOgyI4m8vqckNyJ4CPBZEwTdpuxVq/DhEmcPOxz/5OHXuBk8xJS7GCDW bxvRJp3eXhLc1CORFGujcuEBc/GtrwfpQ/ztX6aHAI6YCbEuOXUdWMeyc69UTTRLiCAe QllxIvi0p3psISblJDhPo3DTAD6RejPMzRc10loXmFH5qkFM7Srd9IVUXPQMSp4lAk5F kcsFC3BIFmAfhNlBqHmGHkNePHHsZW6e99PKr5XJzw1AhW2AQW92W17FDnijztwH8DuF h8RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LDVzyYOG; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-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 l129si6710055pfl.284.2019.02.09.15.38.33; Sat, 09 Feb 2019 15:38:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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=LDVzyYOG; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-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 S1727036AbfBIXic (ORCPT + 5 others); Sat, 9 Feb 2019 18:38:32 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40268 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfBIXic (ORCPT ); Sat, 9 Feb 2019 18:38:32 -0500 Received: by mail-lf1-f66.google.com with SMTP id t14so5142549lfk.7 for ; Sat, 09 Feb 2019 15:38:31 -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:mime-version :content-transfer-encoding; bh=z4pZ290CNrSCrbRqPjjC6mK1LTheq0eTUeZeXFQredU=; b=LDVzyYOG+vvgw4bOTFvmNyPn9KyiVLehD1HXhUY/iXKrQLFGGGzFptr3y095iaWxtY JCF8/91wOvghSFjMpErgKKwqyv1gTyMYuhLW3cT4WsT0o0c8rPq6FZc3R6q3cEEHxh7P Blgj1TB9N3/EQ16/sOW28xfaGCCws9gFCRUwjVOZIyAwdfpbFj4KVX+Aanm+QZMXReqa UpEUpsHErQX2GwGqCWg2BNsbUW4Pa2eSBsYmpxeuAbmLqpNuBbzi7O2k+G0+iAqJ+EDC pUUj247hAP9cjOi7MqOSPzA6lAcL/ylGOll83sH4M0yp6SY4Zp5Bhjslcg7bEa+u7Z1h MqqA== 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:mime-version :content-transfer-encoding; bh=z4pZ290CNrSCrbRqPjjC6mK1LTheq0eTUeZeXFQredU=; b=JJ6SMsRvItxG/cmJ/9KtwXrSpOHO16iEABVW8ar0VWGUuoJStS2CH64tRQxxNz4mO/ 3kIF/OYSgh9FzKpFRWKGPIkzTytZA+wLsJuh4IV/H2uRul1IH0BVIpnS63SQdP62oncS gHFXpEeq2D6whIk+buaWwk9gcqpTrCliOFK+QYc4IPcPnxitFfRpQNQPB0+sK5w936E/ PxMwMi0BflLqtQ/IsmIHjeJsX6a4tqymH2zc32A5da9ZgYr7lIs2cQiR9AJrqBKbxpH9 ZQHgSYJc73RCV7f/mzMre84u6JzyEWemvGau5Qk5S70pq3XYfeU+r7ztFAsSOpGCXKq0 0bew== X-Gm-Message-State: AHQUAua7hAPgaK0TNgL+noXvFs4FqAJ+6lSlMC2W3MuEUXYEJqQ+JFpf 2mTgsY7wLh4ZGueebmJ5Q9y+pg== X-Received: by 2002:a19:7609:: with SMTP id c9mr19228001lff.107.1549755510508; Sat, 09 Feb 2019 15:38:30 -0800 (PST) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id o6-v6sm1272246ljj.6.2019.02.09.15.38.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Feb 2019 15:38:29 -0800 (PST) From: Linus Walleij To: Mark Brown , linux-spi@vger.kernel.org Cc: linux-gpio@vger.kernel.org, Felix Fietkau , Linus Walleij Subject: [PATCH] spi: use gpio[d]_set_value_cansleep for setting chipselect GPIO Date: Sun, 10 Feb 2019 00:38:25 +0100 Message-Id: <20190209233825.2883-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Felix Fietkau Sleeping is safe inside spi_transfer_one_message, and some GPIO chips are running on slow busses (such as I2C GPIO expanders) and need to sleep for setting values. Signed-off-by: Felix Fietkau Signed-off-by: Linus Walleij --- This patch was found in the OpenWrt tree, I adapted it for my recent changes to the SPI core. --- drivers/spi/spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2f7176f07591..93986f879b09 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -786,9 +786,10 @@ static void spi_set_cs(struct spi_device *spi, bool enable) */ if (!(spi->mode & SPI_NO_CS)) { if (spi->cs_gpiod) - gpiod_set_value(spi->cs_gpiod, !enable); + gpiod_set_value_cansleep(spi->cs_gpiod, + !enable); else - gpio_set_value(spi->cs_gpio, !enable); + gpio_set_value_cansleep(spi->cs_gpio, !enable); } /* Some SPI masters need both GPIO CS & slave_select */ if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&