Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp810366imu; Fri, 11 Jan 2019 09:25:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN5nYSV0/6Lxp5Ex/ACpXibKv/JdFn4ozwfx8SmlR0nF3sVNLdYNH843ArXy47n/WstmAufb X-Received: by 2002:a63:3287:: with SMTP id y129mr14149714pgy.337.1547227512593; Fri, 11 Jan 2019 09:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547227512; cv=none; d=google.com; s=arc-20160816; b=SD8ZkdY56HYEuEiwp5DqmxuWb9R9ckCbQPYpRlFMH46G/POO5D6D3ugdeNKbDce4Iw a67pApso4yFvs5yXjaqqpTBsh+y3L8OWWYTa4CJfJOWqtZFmYhFOj9haCAlfnM/ufEg2 xCtTbuhqFP9bUCboOucSipFCFopOUx6UfbuorlTUrv8+fnQa59ylPFZURfLKkJRratcE EAU1USdA8r+HJoKa6GFapeB61jWAzMxH5UtIPFxMBuJa+nk2slxNM5J0jyUf/kwF+gF+ +JBArHze0NuwiWtibnQD7ks9cLcI1s3DIwpIUH0oekntYNGAHbBxQRNQ482EQstXaqSH jfhg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GcDKKHPJxXh2PNIE2FRmV1xS/WZfehHtbo5X10G3lMU=; b=JJEQpNvjxfS6oKCa8hDj9/H2JkYhnt9r1YpOlP7tij1RuYJrSwiik2hBTojKfGXnbM WWjo47v2FQXTreEtMD1qXnpV/ni5/0VhkgybdXTK75KEnij9X0kWFaxI4YZ9aEC7r6V5 AeuXjCAF/WTQMZP2vJd88euS7B9HB72TlOHvxPU4LcNwu/SgtUfN39hJJmJsk0RuQHOS 1ubY01q3KrYbM4CWA6AA6e6oPZ8dQ9rI64DHT3+T/019uDS8Blh0zU6C8JFdlT7uGLAD Mh89uB8WZj1s39e64aOkhm5GTr3LELM2+tzBhiWzne9wDKI7nvCe6Cl8w2vUkskesJSh hF6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="wTl/ZC+v"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w189si15442894pfb.151.2019.01.11.09.24.57; Fri, 11 Jan 2019 09:25:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b="wTl/ZC+v"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733107AbfAKOOk (ORCPT + 99 others); Fri, 11 Jan 2019 09:14:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:58380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733073AbfAKOOj (ORCPT ); Fri, 11 Jan 2019 09:14:39 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 01BCD214D8; Fri, 11 Jan 2019 14:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216078; bh=k+xhMifa6pMdYSDyTVl71yg0EHd61XlAo+cs4IETlRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wTl/ZC+vWE/O8Avls7UqyL8dzP+3XYiR6C/A1MrHCBi3I+iZsDtGqgISdX8XIj80l S9aSXjJ2f5/cFmFU90Et82yzfaDUz7snr8JlhQmSafDpZs45IIZ5xeaQqqIRaS8Bow 0nT0rguuZH10kngr3fDedYohsaIKBMJidfV7RJjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Linus Walleij Subject: [PATCH 3.18 05/47] gpio: max7301: fix driver for use with CONFIG_VMAP_STACK Date: Fri, 11 Jan 2019 15:07:50 +0100 Message-Id: <20190111130956.854184298@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111130956.170952125@linuxfoundation.org> References: <20190111130956.170952125@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe Leroy commit abf221d2f51b8ce7b9959a8953f880a8b0a1400d upstream. spi_read() and spi_write() require DMA-safe memory. When CONFIG_VMAP_STACK is selected, those functions cannot be used with buffers on stack. This patch replaces calls to spi_read() and spi_write() by spi_write_then_read() which doesn't require DMA-safe buffers. Fixes: 0c36ec314735 ("gpio: gpio driver for max7301 SPI GPIO expander") Cc: Signed-off-by: Christophe Leroy Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-max7301.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) --- a/drivers/gpio/gpio-max7301.c +++ b/drivers/gpio/gpio-max7301.c @@ -25,7 +25,7 @@ static int max7301_spi_write(struct devi struct spi_device *spi = to_spi_device(dev); u16 word = ((reg & 0x7F) << 8) | (val & 0xFF); - return spi_write(spi, (const u8 *)&word, sizeof(word)); + return spi_write_then_read(spi, &word, sizeof(word), NULL, 0); } /* A read from the MAX7301 means two transfers; here, one message each */ @@ -37,14 +37,8 @@ static int max7301_spi_read(struct devic struct spi_device *spi = to_spi_device(dev); word = 0x8000 | (reg << 8); - ret = spi_write(spi, (const u8 *)&word, sizeof(word)); - if (ret) - return ret; - /* - * This relies on the fact, that a transfer with NULL tx_buf shifts out - * zero bytes (=NOOP for MAX7301) - */ - ret = spi_read(spi, (u8 *)&word, sizeof(word)); + ret = spi_write_then_read(spi, &word, sizeof(word), &word, + sizeof(word)); if (ret) return ret; return word & 0xff;