From patchwork Wed Oct 10 13:43:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10634595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5444679F for ; Wed, 10 Oct 2018 13:43:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36E34283C3 for ; Wed, 10 Oct 2018 13:43:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 343052A149; Wed, 10 Oct 2018 13:43:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0BE32A15A for ; Wed, 10 Oct 2018 13:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbeJJVFd (ORCPT ); Wed, 10 Oct 2018 17:05:33 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:58862 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbeJJVFd (ORCPT ); Wed, 10 Oct 2018 17:05:33 -0400 Received: from ramsan.of.borg ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id lpjH1y00x3XaVaC01pjHhR; Wed, 10 Oct 2018 15:43:18 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1gAElh-00008M-SG; Wed, 10 Oct 2018 15:43:17 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1gAElh-0002DP-RK; Wed, 10 Oct 2018 15:43:17 +0200 From: Geert Uytterhoeven To: Arnd Bergmann , Greg Kroah-Hartman , Srinivas Kandagatla Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org, Geert Uytterhoeven Subject: [PATCH 2/3] eeprom: at25: Use spi_message_init_with_transfers() instead of open coding Date: Wed, 10 Oct 2018 15:43:16 +0200 Message-Id: <20181010134317.8466-3-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181010134317.8466-1-geert+renesas@glider.be> References: <20181010134036.8296-1-geert+renesas@glider.be> <20181010134317.8466-1-geert+renesas@glider.be> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reduce code duplication in at25_ee_read() by using the spi_message_init_with_transfers() helper. Signed-off-by: Geert Uytterhoeven Acked-by: Arnd Bergmann --- drivers/misc/eeprom/at25.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 7707d3fb49b526d9..5c8dc7ad391435f7 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -103,16 +103,15 @@ static int at25_ee_read(void *priv, unsigned int offset, *cp++ = offset >> 0; } - spi_message_init(&m); memset(t, 0, sizeof(t)); t[0].tx_buf = command; t[0].len = at25->addrlen + 1; - spi_message_add_tail(&t[0], &m); t[1].rx_buf = buf; t[1].len = count; - spi_message_add_tail(&t[1], &m); + + spi_message_init_with_transfers(&m, t, ARRAY_SIZE(t)); mutex_lock(&at25->lock);