Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5902122imd; Wed, 31 Oct 2018 04:01:54 -0700 (PDT) X-Google-Smtp-Source: AJdET5f20NWpIJdUK1AcaZJpk5nthIlT31Ws9ENf0kkvjwfG6F5IaMZ+K5mb9HP+luyuRmuMYhza X-Received: by 2002:a63:e00d:: with SMTP id e13-v6mr2661712pgh.114.1540983714164; Wed, 31 Oct 2018 04:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540983714; cv=none; d=google.com; s=arc-20160816; b=gJnxJ32PGkWtObeWAs7IexNss7JjToXXwhZ2bKot1S1czm+BZ/LitHXZ/B5ZjqDRZz XyVqXs8MOxuIG1GGqU4RB7A5ZAThubBDXQXc0xuZg6x11SMMAGLiMXABtbYdW47F/idF +U1wGINTrTzvUAOlooGZOuQoAonfonojqPX80HKjYLhKFDyfBCQGd0XVT7bX+SyHxs3a oLVygCjt99hsgdOk6MlWv+tfMddyZDHw9yX1RB9wEqy02aAfdWh76CeOznb/zcfqBzuO dqAT34WBTo8bsWdWEKwwXn7J6ANLOcR240CDqMmapui7ayLcKweEJ18t5ngEJEl8Zwa0 +5pw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WYfde6DTmy6vKGV+9gDH9plmleyfINd+8JWW56qt+kk=; b=WgjTEW3qJ468728gtB4DnRWMTn7TpbbwyK5aYk2uPLwlQ34JJ8XEA+tQaEL5tSsjHN Kta/sbv89vgttH1hYeHiKHTJ/5Y2zqU2NRi7/rxacaZv9UqtMOlvEL1qggj7bTtL0S+N bTzaldWZ3C4Q631zRspc7XVukGD7+SbxkN8NRARmqhtcsVGoiuGsTIlsIyD/i12o8oSF 9+e6d1TJV+oRc1/04GKDxsRjh7BZx09+3Re6rV0kYpsa23u8GCjlEsV+7A6+l1ACVTR2 Jq4Ctw6nv1jTCoCXCT4U0KkH8pqBkoqCgNVJ7EslyEAWyuLAPvwDXWVDHfTgXgOCcOSs f8Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="FvYC/+AC"; 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 x3-v6si26593886pgj.425.2018.10.31.04.01.36; Wed, 31 Oct 2018 04:01:54 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b="FvYC/+AC"; 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 S1728760AbeJaTzj (ORCPT + 99 others); Wed, 31 Oct 2018 15:55:39 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:45630 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727980AbeJaTzi (ORCPT ); Wed, 31 Oct 2018 15:55:38 -0400 Received: by mail-ed1-f68.google.com with SMTP id t10-v6so13195006eds.12; Wed, 31 Oct 2018 03:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WYfde6DTmy6vKGV+9gDH9plmleyfINd+8JWW56qt+kk=; b=FvYC/+AC5eYuBgNb2nlAiPB3vz1mElDsfRt1OAHoYeEvGj/UCl9XZHXo/EUvRErm/b ntWYBBn4EbOK5SaJhCIPFEGPa+sqL4gCpmIITH55qcRNJvTjz6Mhbtyu3vK0Vi4NIwGJ mauAqUiMZ3Y/lASVl15NKh7npR3HPOC4ZnOIELKJwD1C+ICvGHr4gB8Zu4Vou/Ruh6Ft +i3OxcOKSP5H65KXW5hTMADJCZQtfGihNr3+IVpoiKojvXGg5lgjyJnU+giwES3dQ/TC eMdtaeI8GjTgtPYzLOAoM/ZsubZmVYDXj18149os4E9Pe3TeovqFvc3p2kmZ1ubFFdum rt9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WYfde6DTmy6vKGV+9gDH9plmleyfINd+8JWW56qt+kk=; b=Wis3/euJ2BlTFBZfpeHA3CkNvDJzC1ACvMfjdBPFkoHfaoH6s9ewmXcdzLZqV2ijb9 Z6BbzhdcMpbFN/8c8I+CB6A6wwICs4yht7eCZNBN/Yh0aLdV1s1kWydOyB/73Ln/F8wx 057UlGsa4CqXW3zoq+5xBzUhX+rxSMB7vR+NWvBgReexU/4oFdVtY/mtCoc/dX/2weql OgFon/5DEUpQOptojHScWR9s6rotg5oVoFw6KhHD9hXPtqbABo+VePOd3GAspja1zYu6 ZOWR+S9AWiSTarZea6WrKwhp+F8UN3zEP45g1sevI70BILKKzDrTG22W4b47c36PhouR zyAw== X-Gm-Message-State: AGRZ1gJYxml9Rs1AKaaJDoHq+WN+6FkDh0hzAPHN05/OS7j3XO+Tb8nn h7iY+ElK2tr//Q0tkOoVrnMfRxf9i+s= X-Received: by 2002:a50:b36e:: with SMTP id r43-v6mr1660672edd.284.1540983480917; Wed, 31 Oct 2018 03:58:00 -0700 (PDT) Received: from localhost.localdomain ([5.57.50.195]) by smtp.gmail.com with ESMTPSA id a40-v6sm9041108edd.61.2018.10.31.03.57.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 03:57:59 -0700 (PDT) From: Emil Renner Berthing To: linux-spi@vger.kernel.org Cc: Emil Renner Berthing , Addy Ke , Mark Brown , Heiko Stuebner , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 02/14] spi: rockchip: use designated init for dma config Date: Wed, 31 Oct 2018 11:56:59 +0100 Message-Id: <20181031105711.19575-3-esmil@mailme.dk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181031105711.19575-1-esmil@mailme.dk> References: <20181031105711.19575-1-esmil@mailme.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Emil Renner Berthing Use C99 designated initializers for dma slave config structures. This also makes sure uninitialized fields are zeroed so we don't need an explicit memset. Signed-off-by: Emil Renner Berthing --- drivers/spi/spi-rockchip.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 7e54e1a69cc8..87d1b9837d94 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -442,12 +442,8 @@ static void rockchip_spi_dma_txcb(void *data) static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) { unsigned long flags; - struct dma_slave_config rxconf, txconf; struct dma_async_tx_descriptor *rxdesc, *txdesc; - memset(&rxconf, 0, sizeof(rxconf)); - memset(&txconf, 0, sizeof(txconf)); - spin_lock_irqsave(&rs->lock, flags); rs->state &= ~RXBUSY; rs->state &= ~TXBUSY; @@ -455,10 +451,13 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) rxdesc = NULL; if (rs->rx) { - rxconf.direction = DMA_DEV_TO_MEM; - rxconf.src_addr = rs->dma_rx.addr; - rxconf.src_addr_width = rs->n_bytes; - rxconf.src_maxburst = 1; + struct dma_slave_config rxconf = { + .direction = DMA_DEV_TO_MEM, + .src_addr = rs->dma_rx.addr, + .src_addr_width = rs->n_bytes, + .src_maxburst = 1, + }; + dmaengine_slave_config(rs->dma_rx.ch, &rxconf); rxdesc = dmaengine_prep_slave_sg( @@ -474,10 +473,13 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs) txdesc = NULL; if (rs->tx) { - txconf.direction = DMA_MEM_TO_DEV; - txconf.dst_addr = rs->dma_tx.addr; - txconf.dst_addr_width = rs->n_bytes; - txconf.dst_maxburst = rs->fifo_len / 2; + struct dma_slave_config txconf = { + .direction = DMA_MEM_TO_DEV, + .dst_addr = rs->dma_tx.addr, + .dst_addr_width = rs->n_bytes, + .dst_maxburst = rs->fifo_len / 2, + }; + dmaengine_slave_config(rs->dma_tx.ch, &txconf); txdesc = dmaengine_prep_slave_sg( -- 2.19.1