From patchwork Mon Mar 14 14:07:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102600 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp57359lbc; Mon, 14 Mar 2016 07:08:11 -0700 (PDT) X-Received: by 10.67.8.100 with SMTP id dj4mr38474614pad.88.1457964491116; Mon, 14 Mar 2016 07:08:11 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ua9si23308937pab.25.2016.03.14.07.08.10; Mon, 14 Mar 2016 07:08:11 -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; 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 S934215AbcCNOID (ORCPT + 31 others); Mon, 14 Mar 2016 10:08:03 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:49459 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932102AbcCNOIA (ORCPT ); Mon, 14 Mar 2016 10:08:00 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0MMpSB-1akiTS2hpf-008XWB; Mon, 14 Mar 2016 15:07:25 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: Arnd Bergmann , Felix Fietkau , John Crispin , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] net: mediatek: use dma_addr_t correctly Date: Mon, 14 Mar 2016 15:07:10 +0100 Message-Id: <1457964435-2945038-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:ac03h4tPGnMpk8wS+8lUZmKFj1JmCO2q1zU8OpUSaII7bR3ftXi ldHe8i1pnOtog47QCQ4lnR6wqwgchQdsxX9bgx+OD5iYvyocqPTjQKe+D6csrUfufqcLkpp bD2r3bLzPYbbDymo/cc30vVRuvrpLidvJAa/J4Vha2kfvzAYUg5H7mIyjmvprTN3gFFYINr h67fquYv1Y/88MuL9704A== X-UI-Out-Filterresults: notjunk:1; V01:K0:RKQCA+woAZg=:lXX7clatdCXJpdtynymTnF QW1NbscFHVevhtjcBJDvVpe2xapPsutKdD+SUXjCAoDw8yk7oac9bATIp5IfzR9MfcYyEHoRT D2NNyRY9ehvycqHDWK4S4RSeiOFgZlrU7HK89NltmjS++mxXvk6/39QPX3qthjLb5dVVazP6Z hKBX8MzOPL88Gh3j5sg4FnoPXbJPsWTlTPf0xYL9GV8cDGVjzW3POv/Nq8uZ/JN3XXclik/Os vDa1nYtlQqHIp5+vfUjrlWlAWlytn3rP/ZJqLYvpAjOCgzPu7XAitn/YR9Wb8CuyOSUc71ccr ZKuKgLxQXkN7fM81fAwZZSG+732hlWsWUpIMlIYxcwO+WPRbVSs1W0PJ3bOxGJtUDIyUFbaGc 84H+W2pGY98cmyYINN8C9nktDXIGJQnzONQDqhVvn+D0J3iQBHHhtM35+umLYyom/OJ74w/rx 52nb0KmHhn1RySGxDgy1hjPWOCNTj+PSb+0u++CMYT5vbzcqCvAZ0g+Y0K5VPKIXXN/y3He5w BO3rOFsMXswjnev1TOxY4QzopJAJXMqs8HCZRYx/AMgnJc4Z7RTdOVJc8nUie3PMhquIyi3IB 6lC47IX2uag/M8lyzfUcSBY5xluh5AqdHuzvSZJXOUfcrBPPGgUm4fuSm+3a9WKQO7DOU7Ffp te1elYKH+Pg8wrFbVktatGcLxImbN0w9MbOoQQhfYrWpSeBxAASfpKeAM6zf/rjVW2t4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dma_alloc_coherent() expects a dma_addr_t pointer as its argument, not an 'unsigned int', and gcc correctly warns about broken code in the mtk_init_fq_dma function: drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_init_fq_dma': drivers/net/ethernet/mediatek/mtk_eth_soc.c:463:13: error: passing argument 3 of 'dma_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types] This changes the type of the local variable to dma_addr_t. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index ba3afa5d4640..3e42204adfe5 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -453,7 +453,7 @@ static inline void mtk_rx_get_desc(struct mtk_rx_dma *rxd, /* the qdma core needs scratch memory to be setup */ static int mtk_init_fq_dma(struct mtk_eth *eth) { - unsigned int phy_ring_head, phy_ring_tail; + dma_addr_t phy_ring_head, phy_ring_tail; int cnt = MTK_DMA_SIZE; dma_addr_t dma_addr; int i; From patchwork Mon Mar 14 14:07:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102599 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp57518lbc; Mon, 14 Mar 2016 07:08:27 -0700 (PDT) X-Received: by 10.98.80.22 with SMTP id e22mr30063520pfb.15.1457964506940; Mon, 14 Mar 2016 07:08:26 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g29si24892012pfj.135.2016.03.14.07.08.26; Mon, 14 Mar 2016 07:08:26 -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; 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 S1755624AbcCNOIL (ORCPT + 31 others); Mon, 14 Mar 2016 10:08:11 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:63959 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932432AbcCNOIB (ORCPT ); Mon, 14 Mar 2016 10:08:01 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0M4kN3-1ZuGGF11SP-00yzVt; Mon, 14 Mar 2016 15:07:30 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: Arnd Bergmann , Felix Fietkau , John Crispin , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] net: mediatek: remove incorrect dma_mask assignment Date: Mon, 14 Mar 2016 15:07:11 +0100 Message-Id: <1457964435-2945038-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457964435-2945038-1-git-send-email-arnd@arndb.de> References: <1457964435-2945038-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:c+oOs4DQnn8zNXXBI173gbiySEyiymCwLtojUvmY/KKi2nJUk+R umGDRO7P5hwglx9/Wdr15lOQL8uF0fC8O360O2hPvKzZYFm1wzAxrnDsuPMkYm9kRTUiIA8 AP94Z8bGgFgdYuihja9KhPFmtPTe/9Ub3Bqh+9xnRfY7SCGpxbZsIXIuhrMqLTgxdQ14ANz FlZuQ9wVrPfjJ0T64FYcQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:J5dURJmAPKI=:WuzRkQMwY8C+W8b4qiNA5H x88B8QqCJHmGl7rf+q9n2Tz15CWpEQ4TzlZ1Kictr22JtincsXLDKrmRLDJVkFKgg8dGxOixz wfRgDNJpKVRsfB7yj2Ge6tXmK9mGg21kCT+XoXgW5GKeyelHu1rmC6Hinl1pl2Obu0INtcuf/ 03jygc5PkETBqgrPuxxaWUZcQD+1prqshL1r9FTNdytgnWXGEnIoJRRcfMqO7eng2WHTfH2+n wSX1cniRWNkhYoNzPxa2Rr8jSr2X1pOMcx6UZ1lMMUV0fkGEq5zw/cfiDlN9h/Q7J2KFgoUNj LfdLILpBJ3fKGF34EFu8kb32O7VhnCHSvI/SWPrEz8/tdmKTH0J7TUNq3weHzoCv13iI7DG2i aOW8nXBAvC/kquTegBBzrl+fLaud3pabwX5ekKl0AgPMNt/MEooaehIX3ASzUL2uGPe6xbdNA 3TNcmYMoCrQV8X1By1gXSe/044QEUKBvnu4AdpEkNAYb/ELWQbLEPfF7h5+2WOJcIEYYpNi2t tId5EPU48fL/tOltv2XZzffa57rER5Oyx6J9hKt9Ie3y3Lkx+syaclAQuBdVmJGzkhbsceaZt DVlPI3u2e2PHa+7nPwKVf1+oL9idZN6qQfI2x9aqL2GGKFt2i/2t5ByWh2EY4hQaX2/9vbr78 sCK2K3bvLGomPxxMYIu8jk+IVdYOQ1NosaO/FY4Tqyz37ql9jR7ebWi49cywIarawTIA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Device drivers should not mess with the DMA mask directly, but instead call dma_set_mask() etc if needed. In case of the mtk_eth_soc driver, the mask already gets set correctly when the device is created, and setting it again is against the documented API. This removes the incorrect setting. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 --- 1 file changed, 3 deletions(-) -- 2.7.0 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 3e42204adfe5..87f417712da0 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -1676,9 +1676,6 @@ static int mtk_probe(struct platform_device *pdev) struct mtk_eth *eth; int err; - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); - pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; - device_reset(&pdev->dev); match = of_match_device(of_mtk_match, &pdev->dev); From patchwork Mon Mar 14 14:07:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102598 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp57529lbc; Mon, 14 Mar 2016 07:08:28 -0700 (PDT) X-Received: by 10.98.10.147 with SMTP id 19mr30272133pfk.87.1457964507339; Mon, 14 Mar 2016 07:08:27 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g29si24892012pfj.135.2016.03.14.07.08.27; Mon, 14 Mar 2016 07:08:27 -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; 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 S1755676AbcCNOIP (ORCPT + 31 others); Mon, 14 Mar 2016 10:08:15 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:60943 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755505AbcCNOIL (ORCPT ); Mon, 14 Mar 2016 10:08:11 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue103) with ESMTPA (Nemesis) id 0Ld3z6-1ZxMtZ0BA8-00iBai; Mon, 14 Mar 2016 15:07:33 +0100 From: Arnd Bergmann To: "David S. Miller" Cc: Arnd Bergmann , Felix Fietkau , John Crispin , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] net: mediatek: check device_reset return code Date: Mon, 14 Mar 2016 15:07:12 +0100 Message-Id: <1457964435-2945038-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457964435-2945038-1-git-send-email-arnd@arndb.de> References: <1457964435-2945038-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:moborJx9hta0ILrsffUY+DVapFVFp/NaPy9gpF0FQt1+Z87p9mo yXXiTxTtuuzquPPEjqEcgP63r74AYR+ZFhy5OWoQOkrLM9ATe3MIzWfUwtIv4igY3H4ue0V Bf3uW2wOyQJgERf3ROBA10Jeye7ORlt1ueyEA7DJXMqaJp+PBSHTYDVumqbAOPT0NB/sguO EXzgUoW3UKEgeMF2ObzDw== X-UI-Out-Filterresults: notjunk:1; V01:K0:trQ9PG6JotM=:0t8B34YwZMHkN18Xo6L+dO 9SZip44JvLowf8lzNKgNQnoVi9euTNwnxH36tqiPdJps5ijub5e78GSNsBE5W1YtxYmMLsHp+ y7CfUcPbs6o6iCmdx5N1VZ4vDRa2dsCcz7Z0oPFEEBqA27vT+F6F7vI80z73UKb4N76A6mfGC /aWCMraQkl9xJtagdx/82HPlTVrKF2MpUwWwKKkw/48c88FvnOVFNgHkLNy8hG2H9V87QDevq BnD8K5PCRAr7ZuJkD8ne1DGt0vD79b23uZz4MvqDmcEzbCJ39oA3by/x/jvQFXjIxfk7LuSL5 efk3WgUWmtIhQaG5yMcdy96CrzVj1tMCeVVBM+Y6M4Bb5KnSJ4uY8voI4lSi5EgZwJP+CamZN AJdcHfz05NDN+kqGY/7TeJArwTwIc4CeS92dZLT+FFkioJfAwRukBR9/gt22SdEirP93gsIdp 5Zxx7KGbPk6OILw/XrF3pSdsdrqu89mNKpGVZZs2gCWX+9kXuK1Ys3vioeCS5k54TzdvP0ixu SFBm7gSDlM6tz/YwMDRgN0NCd7/ZsRedVFOerUq+lIRFNz7CTyJiM+v70v7AkSt6V61cx9yWx one53RERQNqE2ra0Yy266eWCZYR5yu3BRdwJ32H3Wse+OejzyQaKBnUscPPNtkvHviL0lYIUe qhvRAkTM7d6+mPzUqDkE0wgU6Rv2xptB690AZM8S3qMXLThGCdHkvRAtc9UOfP/KB9lA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The device_reset() function may fail, so we have to check its return value, e.g. to make deferred probing work correctly. gcc warns about it because of the warn_unused_result attribute: drivers/net/ethernet/mediatek/mtk_eth_soc.c: In function 'mtk_probe': drivers/net/ethernet/mediatek/mtk_eth_soc.c:1679:2: error: ignoring return value of 'device_reset', declared with attribute warn_unused_result [-Werror=unused-result] This adds the trivial error check to propagate the return value to the generic platform device probe code. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.0 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 87f417712da0..1e6c5498bba9 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -1676,7 +1676,9 @@ static int mtk_probe(struct platform_device *pdev) struct mtk_eth *eth; int err; - device_reset(&pdev->dev); + err = device_reset(&pdev->dev); + if (err) + return err; match = of_match_device(of_mtk_match, &pdev->dev); soc = (struct mtk_soc_data *)match->data;