Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp631239imu; Fri, 11 Jan 2019 06:30:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN4lsKmEDd6TsGTBGkXj8tlquk5WzDZoFITBDATVxGcSbhWgcINBxCGcuKh3Va1aot7iEcyk X-Received: by 2002:a17:902:981:: with SMTP id 1mr14459665pln.142.1547217018991; Fri, 11 Jan 2019 06:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547217018; cv=none; d=google.com; s=arc-20160816; b=cTUTMwyl5e7ZWfTy+LlmhCSK28XwksjdgeytpnyuhWMuDFb7j8QH6pzU9jbVtW3ICj o1sdPcslcwSWkbfJlJKsKTcrtHNfEns1qHbZMKeRgQXZBewPtBO1BqoFjzom/eMkIPfQ ngqYugHvUIeCTHJr9WuDP7ZfNisNzpmhS+SzZIaiUzu/tvmtuL79xV9tP1BmICOtbXSd fiOpdhbwpSh4qVaClBVyKoSpn0qxcBKHVbqrXS/LGogXe/8bfECPY8rBhqJ9GxGirWJ8 vbfH57GY53Cd7cnfCXYIzHdvZspaQXWPfNKh1CW3gkcZtTVtsJXyGXSTyj6J5bOL1ODY 2M0w== 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=9Zj21BIkOPWIvY6KG9E2hQHdbZFythU0/S/3XQYbJ6E=; b=J03eKa8UcCt4mjy+is6YEVC3O5F9lyS/UrfXXdRgUIW9C12YCTGbKDdKk9yQRVIW0/ 0jJWdVYQUdvvrkJkMn88gFLaofShpp9emf+wTqxNQleQwFvvAMixcMRRMhSsvVH56/g0 3kjmnhrPo3hQWHD9PcoX52cDbmiuqxCiyes9t3R3O/Rs1wjBc9GCdjPH6+p3pKtRBZV/ rJf8Ogg0v8icnktFJoB9XstugQpcqcpSpxpgCx4Kwaokv4JZwOTOoNwHKQeR9Wi5mhcO Jgs4gjLwCuZ4HDY/ijPuk1OlCloSN0nDlGDZlK4lw6z+JOQ8AbxN4UdVX9jQSKF35VxH bqSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AQ8l7sQF; 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 h1si901751plt.44.2019.01.11.06.30.03; Fri, 11 Jan 2019 06:30:18 -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=AQ8l7sQF; 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 S1730271AbfAKOSS (ORCPT + 99 others); Fri, 11 Jan 2019 09:18:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:34598 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387958AbfAKOSI (ORCPT ); Fri, 11 Jan 2019 09:18:08 -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 6910F21783; Fri, 11 Jan 2019 14:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216287; bh=LjXNoPFKqGwaY7OjIqIxvOPCQKJ5hM6LYYg8I2UmTEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQ8l7sQFxQ+NoO4sXxUtMEUaWeOa9IHTe6UGVuM0nFlig5iVhSRmzxcjm+UUyL74r br5AaJVRJl6R3ICd7CTkUcVZaYr40cG3Ck/XB2nXldojurjhF/7Vv8pX/qN0gg9pz/ bsGumzxSdIBR2gqAV4hJrov8Uz/6e/xjYhZnWEZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Linus Walleij Subject: [PATCH 4.4 10/88] gpio: max7301: fix driver for use with CONFIG_VMAP_STACK Date: Fri, 11 Jan 2019 15:07:39 +0100 Message-Id: <20190111131047.766590333@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131045.137499039@linuxfoundation.org> References: <20190111131045.137499039@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 4.4-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;