Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412009rwa; Tue, 23 Aug 2022 04:28:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR5kb683zDUEhPv7VxRHzya56tF3/dL7dCEkWi/Hbh1G+6Vc/atoDIwZb0TylorD8ME/QEbx X-Received: by 2002:a05:6a00:10c2:b0:4f7:5af4:47b6 with SMTP id d2-20020a056a0010c200b004f75af447b6mr20306147pfu.6.1661254089923; Tue, 23 Aug 2022 04:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254089; cv=none; d=google.com; s=arc-20160816; b=cQbK+mNZqwIYkZj4PkghTqww3MlZ6fdtmQ3zdrvo2L7GKdnqLvd6UGQ9lupLwTumqW Lvwmi0rsap4HlXvI2Mx1axyfB0rWO5GtZyywDYOU/pYUOUhAuZKBDD1tTSLVqBcY+A37 mkg7e06Nf/urDmOIFUVmfRHIIv7dAVWbaRWcWiQOhCYGwy1Y24mhuElcNQ3LPOUH0fW8 ya60Et3bb+SzijuPzVqIxLAC0vrUEaVDN94hFf+r5qasyH3y6mi1Gqlqrb9b+ap96ukb o4K7JFKu2c13uA3gHatrZx43cMzhGa9o/HazNs0LmmnMgdQl9bRUZhMe+ubGOtF0uDHD Et0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kruGeNIbL06npkju+EANm1YnQxqnwBhvGVFA4PSSf4M=; b=IVtouYQtpZ9+oCyngF2BEAg6UStKduv27P2k04MnMsIspf7Tc1cV2cnNC5kjHuw8Uw Oh+VKajylV3nF+jmC9cylXB0MTtDEZ0dNKdHPx7i5Fqv3v1edJymREqCDQ+bUoaaN5ps ytolWUufZ2+Q13o+akQaDO4jQWs5ImNeL8keX7sooK6pcQb1ms9j8LrJ1ITVJtkubvNf a4SoJ9Swkb4qdYbd0eBCRdRbsOoNBmXzuk+LahW0y1SKFYApnjPCyTpxmd9Kz1Xp3XzV RY3w2GH/e0DQGCSK5GipyBXx80+0RFj+0xUUUyg783DyehtrqqGoNpDUrZNot/XMDZo5 jqYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DpNbWefn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a17090a1fcd00b001f7b6192be1si12362194pjz.25.2022.08.23.04.27.57; Tue, 23 Aug 2022 04:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DpNbWefn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353876AbiHWKMP (ORCPT + 99 others); Tue, 23 Aug 2022 06:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352249AbiHWKFG (ORCPT ); Tue, 23 Aug 2022 06:05:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491116B653; Tue, 23 Aug 2022 01:51:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E54E4B81C1C; Tue, 23 Aug 2022 08:51:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3574CC433D6; Tue, 23 Aug 2022 08:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244709; bh=ADkFv/zaUyh6dKNv1NNmSV5iAz1hx6hB7vMUJariuSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DpNbWefnJkxmMia3UoPZ70gKI/7Yt4kbJSGgBehYicOYAyS+hZPPi4bc2VGt3S6c+ dQbEvXpSgD0d8YsZxPetjunjq0U32iJmzq40J1yMv14axafxHhtkPyt6qdrvruTKS9 VS7OB3YzQeYwWak15yF+aBfjGuJPVvRuOWE9gunQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.15 137/244] net: moxa: pass pdev instead of ndev to DMA functions Date: Tue, 23 Aug 2022 10:24:56 +0200 Message-Id: <20220823080103.724444033@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergei Antonov commit 3a12df22a8f68954a4ba48435c06b3d1791c87c4 upstream. dma_map_single() calls fail in moxart_mac_setup_desc_ring() and moxart_mac_start_xmit() which leads to an incessant output of this: [ 16.043925] moxart-ethernet 92000000.mac eth0: DMA mapping error [ 16.050957] moxart-ethernet 92000000.mac eth0: DMA mapping error [ 16.058229] moxart-ethernet 92000000.mac eth0: DMA mapping error Passing pdev to DMA is a common approach among net drivers. Fixes: 6c821bd9edc9 ("net: Add MOXA ART SoCs ethernet driver") Signed-off-by: Sergei Antonov Suggested-by: Andrew Lunn Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220812171339.2271788-1-saproj@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/moxa/moxart_ether.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c @@ -77,7 +77,7 @@ static void moxart_mac_free_memory(struc int i; for (i = 0; i < RX_DESC_NUM; i++) - dma_unmap_single(&ndev->dev, priv->rx_mapping[i], + dma_unmap_single(&priv->pdev->dev, priv->rx_mapping[i], priv->rx_buf_size, DMA_FROM_DEVICE); if (priv->tx_desc_base) @@ -147,11 +147,11 @@ static void moxart_mac_setup_desc_ring(s desc + RX_REG_OFFSET_DESC1); priv->rx_buf[i] = priv->rx_buf_base + priv->rx_buf_size * i; - priv->rx_mapping[i] = dma_map_single(&ndev->dev, + priv->rx_mapping[i] = dma_map_single(&priv->pdev->dev, priv->rx_buf[i], priv->rx_buf_size, DMA_FROM_DEVICE); - if (dma_mapping_error(&ndev->dev, priv->rx_mapping[i])) + if (dma_mapping_error(&priv->pdev->dev, priv->rx_mapping[i])) netdev_err(ndev, "DMA mapping error\n"); moxart_desc_write(priv->rx_mapping[i], @@ -240,7 +240,7 @@ static int moxart_rx_poll(struct napi_st if (len > RX_BUF_SIZE) len = RX_BUF_SIZE; - dma_sync_single_for_cpu(&ndev->dev, + dma_sync_single_for_cpu(&priv->pdev->dev, priv->rx_mapping[rx_head], priv->rx_buf_size, DMA_FROM_DEVICE); skb = netdev_alloc_skb_ip_align(ndev, len); @@ -294,7 +294,7 @@ static void moxart_tx_finished(struct ne unsigned int tx_tail = priv->tx_tail; while (tx_tail != tx_head) { - dma_unmap_single(&ndev->dev, priv->tx_mapping[tx_tail], + dma_unmap_single(&priv->pdev->dev, priv->tx_mapping[tx_tail], priv->tx_len[tx_tail], DMA_TO_DEVICE); ndev->stats.tx_packets++; @@ -358,9 +358,9 @@ static netdev_tx_t moxart_mac_start_xmit len = skb->len > TX_BUF_SIZE ? TX_BUF_SIZE : skb->len; - priv->tx_mapping[tx_head] = dma_map_single(&ndev->dev, skb->data, + priv->tx_mapping[tx_head] = dma_map_single(&priv->pdev->dev, skb->data, len, DMA_TO_DEVICE); - if (dma_mapping_error(&ndev->dev, priv->tx_mapping[tx_head])) { + if (dma_mapping_error(&priv->pdev->dev, priv->tx_mapping[tx_head])) { netdev_err(ndev, "DMA mapping error\n"); goto out_unlock; } @@ -379,7 +379,7 @@ static netdev_tx_t moxart_mac_start_xmit len = ETH_ZLEN; } - dma_sync_single_for_device(&ndev->dev, priv->tx_mapping[tx_head], + dma_sync_single_for_device(&priv->pdev->dev, priv->tx_mapping[tx_head], priv->tx_buf_size, DMA_TO_DEVICE); txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); @@ -493,7 +493,7 @@ static int moxart_mac_probe(struct platf priv->tx_buf_size = TX_BUF_SIZE; priv->rx_buf_size = RX_BUF_SIZE; - priv->tx_desc_base = dma_alloc_coherent(&pdev->dev, TX_REG_DESC_SIZE * + priv->tx_desc_base = dma_alloc_coherent(p_dev, TX_REG_DESC_SIZE * TX_DESC_NUM, &priv->tx_base, GFP_DMA | GFP_KERNEL); if (!priv->tx_desc_base) { @@ -501,7 +501,7 @@ static int moxart_mac_probe(struct platf goto init_fail; } - priv->rx_desc_base = dma_alloc_coherent(&pdev->dev, RX_REG_DESC_SIZE * + priv->rx_desc_base = dma_alloc_coherent(p_dev, RX_REG_DESC_SIZE * RX_DESC_NUM, &priv->rx_base, GFP_DMA | GFP_KERNEL); if (!priv->rx_desc_base) {