From patchwork Tue Jan 19 15:07:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030965 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93A45C433E6 for ; Tue, 19 Jan 2021 22:24:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72B27230FE for ; Tue, 19 Jan 2021 22:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390349AbhASRqa (ORCPT ); Tue, 19 Jan 2021 12:46:30 -0500 Received: from mail-eopbgr80123.outbound.protection.outlook.com ([40.107.8.123]:42328 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389185AbhASPKA (ORCPT ); Tue, 19 Jan 2021 10:10:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nxLzz2wJcD1/Ma/4kycITRY0uBebqLk0kfzCx+wn2kJspTi+43A8muC8yEf92acUOTQnZhJLfywAQyYZDMIhFQ4Z8Ebk98STBEa8S0sE0A2RmYHwR2DbL0/DmDnmznZSr1a13iUS1neUZFRnv0YSg8mi2lX8iWV9a/LHYphwOIxv4QM0SZMMj7yZepXLmmLFk/hpvJi3FXMv7Uk7qoBVTIRp1rAtNpfDFLnvZCQMwAzv2Xb8MjlZbWM7V0ESElNAQh/9PUzMeF75xH2DMrn4vpb2sKVaY+vmweDlV2Eix41+iQ0v4KLImLrtO03PwxIV58+GAYDONSsnMz18kzGuFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=241boPmGQEBSlLK5BDGAA+vnueefBdcSSjqOawguRC0=; b=i5RbKOmtap3R3Uymim6ZlZp4SYIRkrIgHJpbyJmen7JAn45mAGDy6DvWGx8BjZmhJZPt78kiA9i5Z4eBzgX3Ns9HrVDef4MbrlHQvcvihFipU+Y6+P+Ptg2NJPQRLQlhtE0yipFDQwWjZG1Umu8bHfQzTIrqC8eAPDAxZ/IYNGc6ko19d0qaE6Me0OfLBjDdjEa16Q438k1BCBcku0RUudXBbxQay4KRsvEVXgPw3HNTUPv5DcYAUv+cPXAS6VjSbGvDz6N4GJ567CcQNP4fJZcfdR9mgGqJA7t2x6rRShTrkQkfYKkplAyn8dQ0vCVFG8okSJ9xKOQnOnEB4HN8xA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=241boPmGQEBSlLK5BDGAA+vnueefBdcSSjqOawguRC0=; b=AnJsfKWTjr0R9zIYiUCuAXlyHJEqCX8TDZcGW7dGjMBGeB6HjOf6AeMhr+xmETuJkMkplPIgHbRFbg6DGqHlfhxVXz/34vgdcXjYsM0e9sDZTiGP5lHUDWlSnxKKwdFwd96xMTzA1y7ec+R95f/hb5bZP3p1X9pnkZpcPPQmn0I= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:02 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:02 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 01/17] ethernet: ucc_geth: remove unused read of temoder field Date: Tue, 19 Jan 2021 16:07:46 +0100 Message-Id: <20210119150802.19997-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 926a93b7-8268-43ff-2ac2-08d8bc8c2771 X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XQa1+MZm0dQeWEpHGD158LVWWCq2zAODLIzEryXhldNm/4G6ENQPouoN+xMzau/41FTxnjMEY1t7jO7IVmc59cAB4D5qOHLp8g/cN6OPxgqhgr0D1abC4dPQLj/8ObmD3aA6B6BPig97GUWUdBW6KKC7Wn8FJRZhJE84yEIpT5Iw5XejN8GZkCFR1gsHLDbKzLzPI5fkRSXjYVDNTu2LUopaiewLuLbkfDpUcZAyvRP8toJzTp9nlFqiBQjDqaCPTfqolOKeEGOmbEKwvaJt8TpSzdP8nza5/Xl0G9jQV55XZzlC/JIkAUOZelE/PntYWLacxobIHipj9ZntGg6BavA+6rCBK8SMgfmp7mdVcibEd3Vv0kt+aBuzVN93dq739rIzv+pSL6OmONCfGpbDfw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Da+EFG3LEqMwoU8Cuxf8uWUNFaFcWksO4eZDN1mflk971jgr7tafn6g8F1CppHwFKmkQFoJiHXLZVq0to1vUsh51+ycawh56SURygDMsFvApag/HnN2DzBY2hOe+hgdkEI3w7um24FLXuxDlpDk2H8g2PEIGXPIt1CZ4vSM+fZeQrugA7PLfJCt2+XB88nR3TKqgD1dpKgRHHtX4dLhZorfTDyrmXQrx9uTNPjiwNau32d5/Rz2kRK8qJ15dEIyA9Jqe23uMjgHYXw2hf3dv4V8mQQ9X1JFDBa4NRkdz2mQdMUVnJ8Dep+cSCkxhszgupwZph/Wog+23eBECJrJ0HDL3db2melKRygAV8vXQ3nUzw/4S5O8hqz9yUV8mqh3IWjGahH8bv5bM6DdnjRAO9LelE3SaKq2XuUlGzhOowBRcfzJ7t3TQpuSg1i5v7v6qte6k0522tlY+3tq6Dyj2T5K4dgXTWvoehSaElDg8pQXvR8cM3vU6drpx0+BBoZN8ceCe4+59erodIBDj41aOqh/Nrxf0ljz0uPLWTxQxOwb7pLbfIH4qWWWbWMq3fqGVyIaI2i7R5mbuhtC6jMPuiPvcnF7KDYhZlhfkxgI1ZnLtgwXyrzkTT6acRHZKFdlBADMAtmxdiNE378OIvlWt1gFgzyRM04B7Sz/k39KoADY4lIPDLBgdwR7JJkYFRVDYGjEG/2ExWwJJ69XlUIii0zFg8O3ATWYYreE1dDXeOsdb4xiM37wluruoa1EvmA8RH1goMtQo8oqR9sAzEtGTODOlN8FrhK9QD18LRaLW3Bd3GbtS7j99GRMvRtnJYeLRkq1yFPxPOXYLsa/+sYelr/WPsnfUY8eRcXdXZAB4dUxqa4q7UQHnE42AIvq29iFQCzwrKRwnDDKQLdyYvf7Qj99w3X6oHB8QFIklKGNGgfiEzrRHstPh0jaSRmf9WgygtL/CzdvMBt3cEHfACJud7+TOWMgExja/uY8XQxzlHfjSfIuF2SIsP3CynQqY7IzX X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 926a93b7-8268-43ff-2ac2-08d8bc8c2771 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:01.8465 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kY7EdJfSvVVL1rS42rpthEP/1rGvw6lUYBS6RNrfjCCkmZRFjRzDIXxsTJel3Qc39xwZ2eneoKMcJxvtJNp6ooE2hy9TU3MuS3f+GL5Mn9o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In theory, such a read-after-write might be required by the hardware, but nothing in the data sheet suggests that to be the case. The name test also suggests that it's some debug leftover. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 6d853f018d53..d4b775870f4e 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -2359,7 +2359,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) u32 init_enet_pram_offset, cecr_subblock, command; u32 ifstat, i, j, size, l2qt, l3qt; u16 temoder = UCC_GETH_TEMODER_INIT; - u16 test; u8 function_code = 0; u8 __iomem *endOfRing; u8 numThreadsRxNumerical, numThreadsTxNumerical; @@ -2667,8 +2666,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) temoder |= ((ug_info->numQueuesTx - 1) << TEMODER_NUM_OF_QUEUES_SHIFT); out_be16(&ugeth->p_tx_glbl_pram->temoder, temoder); - test = in_be16(&ugeth->p_tx_glbl_pram->temoder); - /* Function code register value to be used later */ function_code = UCC_BMR_BO_BE | UCC_BMR_GBL; /* Required for QE */ From patchwork Tue Jan 19 15:07:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030513 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7C66C1B087 for ; Tue, 19 Jan 2021 18:29:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 869FF22CAD for ; Tue, 19 Jan 2021 18:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728430AbhASRo5 (ORCPT ); Tue, 19 Jan 2021 12:44:57 -0500 Received: from mail-eopbgr80120.outbound.protection.outlook.com ([40.107.8.120]:49294 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389488AbhASPKa (ORCPT ); Tue, 19 Jan 2021 10:10:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LlCe0c350ZOcH41A1+8FaqExztoUMG1iSa61qbrd7asbrWjQPedIAAKujV8Mo7fwvNBnPKLLqN/AjSoXLfflIY6urN2waMnWHHMqJiPq+Eh/CHgyOwbqBDW2pzakJmpY0dZLLVCQFVYsLL4gnsSuv0UTgx1AAH9aSAPTAWmjzVSbZHeROA1VrkO7aosyAtXhDzKlW2fVd4URC1jaNdcJgJfgu77Z8wsaRlrLyg3ngkEj+bkUNWxMc487nwcNXRUTfg1/GKY798IAm/OMMMr9TUgdxtGfUkkKFGeqMOMKJgYyZkGC4LA1M/2IPNP5YZGKRAGwfPXsWoXa5h1GFSK1lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L9pAQ+YkqD8NXspjdVpOzcZ8lBwEd3OxgZUpUgEUfGk=; b=enUtQ1SMJTt3h56F4OA3TzfVcW2E3sbiEmfim5NNIyMF3Em06tXEnqAywEDKL9OC3rHVXNcppaDFxKpoEApAXa2MZFFrX3Yi4Z6p04tY+tZJnFIKitEQ5zSOsV+7blNRMbtw3NkrF/0r3s0mChx3ICG4zUu96uizmz3u3CC/38nuz5JKPXpy4PyTkKoZLlgBoxq2DYnzHZwLTsoqBmMUbdGEPzNP9/QSZ79YUYT5PfmLrAJ9v9wRcLTD+KrYpCI5qDSSg4DeQ9SidQnJ9Zgfbwbev4gwMGnzOp/Rps3iJHAd0munOj1Zc+6uQy3q5gZLL1I5B6dIyMMOMVATvR6feQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L9pAQ+YkqD8NXspjdVpOzcZ8lBwEd3OxgZUpUgEUfGk=; b=XkQ8n7wui1n+LsCvbxpbCH8dDFOYHQo1k6CNKZZjKldn8qhipHql1gQDZv8pv0+DV2jNuD4w/ILIWpDDqc0VVNTph5owfVpRso2vOZQN7iWBU6yrDUlTWo7H5FRglJxN4mSYMuYAfxm6ictojYMVC4D2C1zURSfRDV/M6tDyhz4= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:03 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:03 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 02/17] soc: fsl: qe: make cpm_muram_offset take a const void* argument Date: Tue, 19 Jan 2021 16:07:47 +0100 Message-Id: <20210119150802.19997-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d84cf6e-b63b-4931-e740-08d8bc8c2811 X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: htE5/z3c9b39VJeExENd5ibX+Z6IaSJ9dhb8eKISR98xoti25Py02wPnM691GGGswtaxqUBrOuAXT1oimhMjA2EF/e4xFdUCrSLlhR9jZJX1B7rYso6jSz7h0JNYKONFp57rKTHkAW+sy1SXz2k73jwDmVpHSouHrGMoFieKI6ibXg0RHrKh/Dk+ZJ612wh6KA1y12EHByf52gv6+bSNF3Wcnm+3fFkF1IKDM91I9G9S6wh1HQwr1pot//DDlaa66lRpBFKdJ/3EnF4qfhpTgidEQmLF9AMsPap3V1wNwiw9207Jd1BA04YUve5mDn2qKt7oIFdlueSnzeQ8VXQZT9XD8Y5xySBAbOrQjXPKODoQORoI2JLJdZxsyLhS3cjdztKH9aPWRiXMpQ+ceRhj1Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 4cph9SBXgN5qExCqNEobvV2XSemNlvKsAvEP7o6vz2Mftark00LRujWyg9J3iNA1L6JAxvTiflgMJJTvzfMr0kpncEUjkJRzg9B+txdYQL7aAi4fFYmfZ4TTKzpOIk+Y7m5XDfMloUlh1cYWsZVGJ7JAEZSjglnDdGjeRu9M5LECE41gxINd7BRHllI+qT8K220kcCxVfXtTOhGJB9xv/OYxaUVmdzkFzaZSN3+utTO3WxZ5tlEW6DPOWPTPdr6YcZ6ALUjdHMSywI8GNB2TF8xqaf6CthXXdJgwWCA1pm8C99a2pJkdnntxzohGQdt4wED63PyCArPqjQtKl9c9Lk3/EjQH9bWn7aW7DuORuD7jukhj/3LWujHZfcCZE0fVv2tRB88UFvNIpiLk6yuVeik8vkf8Pv3bEQxakd9dccgc24dCLO1ISi7rqaXqWzrRMZrro4lUPGWIM5oFYFilNFcjHaDPqR66mZifkCu/MLh4l7XRbCXQGqLOgWZ5g+lG1v+7Kl5kqhi9XABkUeoftQTmu54NY9u/00U4yhee5OG+9lcSeFL0cq6a9VmUMlfflziwaL9YoBN24f3qfH+qUP8vkKBZxnwOb74/9lZYETl4BgguMcQcabQkXdA2tiNdpiSftfPscy7PJhhhgG9Hy+5a4w+ekRoPIeEHUNG+OIZU95jB6MLLQ9uGnagGmarnkO2Lzd+TJqBZre6URZd5WTAPelpqQkq1A3mpRm6W3H0oDtnLED5cbh/Ez9Puaz80bOQvEPJClnjOgVkJTOCG+psXcsptRY5YRTJoOv9jnxv8FAIuigE2NSeF8tWrJT08gE4gn8W0gEKlA6f7+WdCNzg6CT11zdo4FWwHKSSHtma2R1a4PFL3PIZBUqr1Ffm5HLU7fGKt3EPgLUtneQqqLlOy1yWx8C/qVqf1CmOXsvpMWUza8EtGxC67UKyk0kbrBLMK/mBwHNT0lFU7G4YpM+EruvF96cPTO8tbcX1dvNazFVlnDKavyXpvVJfx8rKs X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 6d84cf6e-b63b-4931-e740-08d8bc8c2811 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:03.2697 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X3iO6vvp/IiNN091tsJqxbVbJd2jVNwCeNbNZEI2kw3xvtc6zPKfEoOAm8d+pI335Ywv7arjCv3eylqwwTCnTeO+SYCLA2bKVC4WhkWg3hk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Allow passing const-qualified pointers without requiring a cast in the caller. Signed-off-by: Rasmus Villemoes Acked-by: Li Yang --- drivers/soc/fsl/qe/qe_common.c | 2 +- include/soc/fsl/qe/qe.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 75075591f630..0fbdc965c4cb 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -223,7 +223,7 @@ void __iomem *cpm_muram_addr(unsigned long offset) } EXPORT_SYMBOL(cpm_muram_addr); -unsigned long cpm_muram_offset(void __iomem *addr) +unsigned long cpm_muram_offset(const void __iomem *addr) { return addr - (void __iomem *)muram_vbase; } diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h index 3feddfec9f87..8ee3747433c0 100644 --- a/include/soc/fsl/qe/qe.h +++ b/include/soc/fsl/qe/qe.h @@ -102,7 +102,7 @@ s32 cpm_muram_alloc(unsigned long size, unsigned long align); void cpm_muram_free(s32 offset); s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); void __iomem *cpm_muram_addr(unsigned long offset); -unsigned long cpm_muram_offset(void __iomem *addr); +unsigned long cpm_muram_offset(const void __iomem *addr); dma_addr_t cpm_muram_dma(void __iomem *addr); #else static inline s32 cpm_muram_alloc(unsigned long size, @@ -126,7 +126,7 @@ static inline void __iomem *cpm_muram_addr(unsigned long offset) return NULL; } -static inline unsigned long cpm_muram_offset(void __iomem *addr) +static inline unsigned long cpm_muram_offset(const void __iomem *addr) { return -ENOSYS; } From patchwork Tue Jan 19 15:07:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030093 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8839BC433E0 for ; Tue, 19 Jan 2021 15:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 46A752312E for ; Tue, 19 Jan 2021 15:12:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391041AbhASPLw (ORCPT ); Tue, 19 Jan 2021 10:11:52 -0500 Received: from mail-eopbgr80109.outbound.protection.outlook.com ([40.107.8.109]:4165 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390097AbhASPK7 (ORCPT ); Tue, 19 Jan 2021 10:10:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=crKs+l8FAknJ3TRw4bOVGaBdrD1+toFEsUdwIPujnzAogskpwC7ztpWTSI4Zi5S3cLJPgq/rQmOkyoz2V8jhZGs2QtkRzYVToIKzRySav//+n8BtsAdbfI37TcBY/ldXxsKck+xI7jpWo8ZdGvzS3VD2qUHQMN/7gbB2Bj7zqYZIno35uR4lvo7W7I6b2sMhbytPEEvC8hJcWUBdM9RAzghjDKD9ENDl+jsd3TK0lt87VsrPAr0ycizU59+cb29QNQL23VKZFdJ2j/HRfQjmmDMdlwrOHHR+0IpkM7sjkYbMEypQQ83OFt4XlIZjn2VEdiPZkkUlDwj+WYSM9+T1DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYzjOdQ8h1EAsdEpyt+zGe6t3sotCIotg1GvB9bPKWw=; b=Uttu/S56QU75pW81nheCwADFNVAlele8OxMKv3sPLxyQu+VVoeRKzR1UKPW4nCxcr18Dj2nIo+MD45N9e0QsShYWBBYvHl0VPJUNOpvGVDjEgvldzyw9DS/Ec89FfuI88sTtrBk24LQ4gygSKDUsgMsPLvThScsrMpkx3u5mUbHj4w1oPQZyfdL1jFR6HGN9FSIY7eew+UkrVVLY6Rc0XgBtmM9SKBGOpvhJ/0t6XaHLqsHM4E4Wcl6lPE0Ry62pdCTBmx1NNzCPacU1Zta9fzbd5/lV09AR07Ow/bP4WFnZAFVdtY2h4Gj3n5B2f76OZlMQ+v8VcHc3FKkodw+fJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYzjOdQ8h1EAsdEpyt+zGe6t3sotCIotg1GvB9bPKWw=; b=Gus+TxLTB+TCLcJft1wjqdGMHXmR4Rb7DnJ+Z+BfyMwgfuHzvqOspdJL1iN9hD4D6Emh/cvAayTDzE1hWTgfmAoAlrUFNCYh7s5H5vqP/3Kg9ZzuH2dgOkILbJ/7jnGK+pqW4CzGIcxFP2l8Q0qw/WhbYUhhtnN1V+JwBHVPgxw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:04 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:04 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 03/17] soc: fsl: qe: store muram_vbase as a void pointer instead of u8 Date: Tue, 19 Jan 2021 16:07:48 +0100 Message-Id: <20210119150802.19997-4-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5077d9d-c313-402a-5719-08d8bc8c291a X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8JjON7+TRD7mGp1mH1Q08pxk2JQttgewmfB7bag6rXC1NMYsM0cpFNUoie+hr0eRf4zgrNzfQKN9hb5fF6iz8eg4Y2+I29zF/3BX+vS3Mx1x27T0DZsYiX/J0NbBe/22vSjf0zX/WOkQ/hQDVGNH9BBv1SlMKyqnn6pKgQYOSa/Mljjc/LtKLgIFrlPtwNg+Vhu60adPqUZKG3svtLvszK5f3inARQKEp3sW5zdw3KrbGXDY9lv065kZwgaF6Z/O96Q8+BIGeCozVLrJqEGygkg+ZlZlLjvAkKGV1vvwA/Ei1C26a2LZ9E6Qg88H51QF83my7Yd14jHongp54DQDrg2WOn0OcXnivlAm5osItwjrzRAXwUckYfwanJqYPXaJ0o8KqJz2oHk7FlXwgqOBfQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: v3DtnhJJc7VxT6bzmq432ouvFrMnRVR+ubgm7nSK6ftEf5NqRWXY4mu4v/tK4UG1rZYzxgVKeYR2+etUXd3s1sNrptSiLAYi7vM8D/y3IF94Y7CqliuraIwPsHxL87Ex5iiB9LEDqt6nQ16zFerUyn78faec+xWgETuxUiSh8bGQJiIEv9T+6pSEjNdWoT5g2TwAtGgX8nAxl+5hNXmICQ/nrwx1FzTBs2YvF4nblEGmilQBL8HdEfY0oTBWTlLSY0aEaDdEzhFs5Q+4/G4nAI2F80iHQ/8MVJSVKn6jKTCrZUAh905+Rlmj37+eYYjOeigWTRl1SGxF1KJKUe7Wm39vPZ4GblxkjfpEB1607eWRLigIt2CtRbbZoYQYwBEFr6xh//3Io2LGkEPKAK5+jqUeqkIllitFOIhRErD8TC6nEoKbgv3WRvaqcBcsKjbotraPFdjr8T7judCsgs4gkDJosdl842HFAjmwixMzhE9LidsH7xGoVMqnG30hp5Adgy3/emySi/RjlyAYiii8rSZGh7XVk3UtbSkHrdkDOIkRHMLoJI4JJiUxZpe2Zft+qvOBtJ+Q/yynLzqcm0a2sFdgfqX8tShufFp+tcWpSeOBR4srmGJWJU9HkdZhXD+M30wZr9flO+ZbanAbHezExbiRzTOaR9HJ9gUfdPmk/KSW3Nq39yM5j5azIX6mDabVEkbbA7CisaYgYa+X9cG9gF26Ji23y9ajXZeE4R1iIB5AGqIe5OWRWloe1SX2fzYmrFPdFD0sr+Uv1+9fpGnVWE87qMzASll9QUqYUJDGdpPKF3Tv2wu47Qg3GgFtfcucUGOZtaA0qlb57XMkAfU7JfIk3x9s45O2OQV99Pe4s30OhmyZWniUi3mxsblbFzp7rvr79eWF3lUTvlMku+DsgyZAj3XNg1xsm6hrTVVy1jLDZzatB0nyqW7u9W0KxLnz1rVNFBbRK04q7QYJcVmgwVW88xLMHVfxWyNMcA4dklr+02pa1G6HIX7hpoKJ29V8 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: b5077d9d-c313-402a-5719-08d8bc8c291a X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:04.6279 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tUcgNjJKWVUpcE9dZGkQKzq8BdybC5w09IyeVjEoIDttBudBQhBBVkcnYp1Vrz8uZajFEafizCBJ3omeRhhSM4DkoHw/oZV8zBcR9TPYLRU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The two functions cpm_muram_offset() and cpm_muram_dma() both need a cast currently, one casts muram_vbase to do the pointer arithmetic on void pointers, the other casts the passed-in address u8*. It's simpler and more consistent to just always use void* and drop all the casting. Signed-off-by: Rasmus Villemoes Acked-by: Li Yang --- drivers/soc/fsl/qe/qe_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 0fbdc965c4cb..303cc2f5eb4a 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -27,7 +27,7 @@ static struct gen_pool *muram_pool; static spinlock_t cpm_muram_lock; -static u8 __iomem *muram_vbase; +static void __iomem *muram_vbase; static phys_addr_t muram_pbase; struct muram_block { @@ -225,7 +225,7 @@ EXPORT_SYMBOL(cpm_muram_addr); unsigned long cpm_muram_offset(const void __iomem *addr) { - return addr - (void __iomem *)muram_vbase; + return addr - muram_vbase; } EXPORT_SYMBOL(cpm_muram_offset); @@ -235,6 +235,6 @@ EXPORT_SYMBOL(cpm_muram_offset); */ dma_addr_t cpm_muram_dma(void __iomem *addr) { - return muram_pbase + ((u8 __iomem *)addr - muram_vbase); + return muram_pbase + (addr - muram_vbase); } EXPORT_SYMBOL(cpm_muram_dma); From patchwork Tue Jan 19 15:07:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030123 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FBC3C433DB for ; Tue, 19 Jan 2021 15:19:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 628C923119 for ; Tue, 19 Jan 2021 15:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391292AbhASPTk (ORCPT ); Tue, 19 Jan 2021 10:19:40 -0500 Received: from mail-eopbgr80093.outbound.protection.outlook.com ([40.107.8.93]:54406 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390848AbhASPLm (ORCPT ); Tue, 19 Jan 2021 10:11:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MOrzfQz1yRx8ZTa8yjsSdcj1ah4suvYL6Je/sU11PzWPg83oWj2Bt20kTs8KPgMlFooi5aPn1CWV/chweVfIXn6Qvccf+VberAt2iiRstU7ZhNArECgkwdJel/TAoKIMSWAK2MY4NNJyTda67r51Nem84MJ7RfVC0eRwfwUQDVu+oUfUSmjT5I/qP36AblJFgZUbzBt3S+fji3lt9LXAripCoOzrYULVrTPerH/5r5kXsnK9DNbotPLs+3CNbtAunzSTtuvwwp6P3i1gOq+lW6HfGazWbL2WkmbcuShzDfbHnJH4arKMN2t9z4sjRS9+vCyuv0Po9fgNvXdftynYrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nbeuYQ5z0yv0bqY63C91Xkj2WIbCJKoREPOQvXArM50=; b=ffOPDXytVicZRKRQUNCUuOPBxOHn1j5oVI3YDARJlOEUjPwTBLkDUDNcRRNvhGeelJQFXqt71bVEPYmtUWJuG0lKkyTvE29cuZh6gPZityEvPI1Db2BgmvmcaBwud1/yHYf/EEeF32Lp97aTXDtFbD7gMHXAA2LZWK0LjtghP39hY0VtcVGADSiMp8dnms1zuIAXy/BECwoBLVoo5IQVKJRgyshZSWPX14/lnAHRFmM1br71S2C0sCA2SsRKWfv4vBQvFw7lYkN0lPJUsRAmJB2PgtuBU3Kr7yjIQ5/3+SNsOX7aCq7kzRwfe8L2XduEvvL+b0wg0S8KVM0pUUmgeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nbeuYQ5z0yv0bqY63C91Xkj2WIbCJKoREPOQvXArM50=; b=mcmjpHyDvqCXaN9uwQE+PNI81czZBDM+6pYBT6T0wGN9GLTF4I2T2lhJLcUEWCmgl2CGKZn0srLTui8IvYJMSenoKytLcsPJe+NggRhq28b67GO1dD+GGgjEvlCXIJeGmRw9pfMpZfPrbHkzcb5izvSBhNphoeVbgfh4/SHKkuo= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:05 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:05 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 04/17] soc: fsl: qe: add cpm_muram_free_addr() helper Date: Tue, 19 Jan 2021 16:07:49 +0100 Message-Id: <20210119150802.19997-5-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c2c460a-6988-4c07-fbdd-08d8bc8c2999 X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: How+uVAyzJBgCKr6ie3hUNWnQELY0W5+DpQmQP+mBlKrnnv+mzmB/IDsO9QT1kDtZXZQWAm6oVO797ZXWUJKJGr6tku8BF/lG1C7cba/gv3aCN6uNI6jdLUSTKEt3mlT/vMj//UoYCe9Wi1YjweSZQ80ao0Bebpy/b1HQpp2jmR136g+f1p8AeOoKuWegXyhy0yrE7KZyT5W6KV8OwU0a4Kuqc42pKU/4yUPaukR7BDVJYzZ4uwi3aZhW5AYXWkFyfrBJdEDW4a36SZqhLWLx/9WrgTnIhS3VOgi+dFb1Na0pFmqHegONcI49CmmdI1OOJvR01C5eWYIWYb2fKf3bA0JsRDwrymQurAm8Uvgu+8XAqQePO2RocbSIMnQeDl9Y6T6otVgSk/F8ubQlQcwyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wCDgn8Rv/FDfY+2mGQF3BI6HNekiUsaWtDEqcBwqnOxVc8Dfwp7Z0Dfgp878n9Zz0DP2IbvCE3EUzlCssHiukyCg1DBWGxSbZO1/f+zJGPtnzdTOJ0kff1aPmlLf8S86+UiRdYshMcCkkiO4vaKvwcrpRQHZz9OG3EqnLBsLWsmfg3r6isx40lkKLkaA6m1GgK6EX/5ijALjgDtEV9FVpDJPnEr6D1GPnx7irO+ktX8V015AOWg0DO6J4kVzlS8TCE1wZRDQxX9DjCG8nIxD1bTZEPtIkM/qjWCjjFovICPemD9817jjeubIFqsYgx9vKRaP2tLfGRWtH4IkXO9gglny0/lZUoSUpnBT2WOP5p21bbZDPrjmDZI4s0YPmGGZyhGcvnGFMZ9DVzaGUxZDB0oRj+DclUia1ypalHV2mG76TLbAfNWAZVoUXCnID5pTQ4LESCu29IlEYiHBgjzwfb4RGGWB7vSmBUpT8WNZJVWGVW1d+2HlSEK45TgGCSDE6k0QHnrqcpRm8AGkdByCN5YGmNEzIGrPrV6+eAbZTQusg/C1zI4OVpkqDDdWl0H3/VtZ0iTfrLJj7ZdLp6VTlx9poWZsz81Y0R8RzeUjjmK8LjqUEsdwYUPDs3IC3spmSiv1Glf4kyXEEgkxQqJbiVnWYaMN89/eXkx5u5KEwN5K2bhxWLUJsJGPLafBOwrI4KOCGDP4oIJJ62vXKOsHsUYkhpc9GoScRDpeWHEK0D7ELnH+GfMx77o57rR1NnVa74kTPI4cBYYWzPhadeypozs4nB7kvqAuQzeZhkcH/CQxGCIZPSje7WwyzWKewkRd0frefT1Lw9fr7IVeO2RTmN3jFw+OJRODpDijV18eo8B0Sy9D4jJxjauMpzZevKtvbMaWvWV26o6hhk0JfxEwLQDYcf/Wys7FFGD3CAlca0Kas6cQ41tMPNhlOHmdKBJx+5h78pkAcMW9bCogv3B+ln0znOfxGtCZj/SieomjDCyA25WARuJes3HTC604yeCA X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 9c2c460a-6988-4c07-fbdd-08d8bc8c2999 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:05.4084 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: S5wOqwqtMHdShuEQuKzB/J31NDg2R4X2Bug4QldmOLaSZjPLrxjupD4m5vWjNxgLJ7HCWFrqDoKVZVAEpvGSsowPRYJ2Adz5n/++NULVIgQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add a helper that takes a virtual address rather than the muram offset. This will be used in a couple of places to avoid having to store both the offset and the virtual address, as well as removing NULL checks from the callers. Signed-off-by: Rasmus Villemoes Acked-by: Li Yang --- drivers/soc/fsl/qe/qe_common.c | 12 ++++++++++++ include/soc/fsl/qe/qe.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 303cc2f5eb4a..448ef7f5321a 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -238,3 +238,15 @@ dma_addr_t cpm_muram_dma(void __iomem *addr) return muram_pbase + (addr - muram_vbase); } EXPORT_SYMBOL(cpm_muram_dma); + +/* + * As cpm_muram_free, but takes the virtual address rather than the + * muram offset. + */ +void cpm_muram_free_addr(const void __iomem *addr) +{ + if (!addr) + return; + cpm_muram_free(cpm_muram_offset(addr)); +} +EXPORT_SYMBOL(cpm_muram_free_addr); diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h index 8ee3747433c0..66f1afc393d1 100644 --- a/include/soc/fsl/qe/qe.h +++ b/include/soc/fsl/qe/qe.h @@ -104,6 +104,7 @@ s32 cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); void __iomem *cpm_muram_addr(unsigned long offset); unsigned long cpm_muram_offset(const void __iomem *addr); dma_addr_t cpm_muram_dma(void __iomem *addr); +void cpm_muram_free_addr(const void __iomem *addr); #else static inline s32 cpm_muram_alloc(unsigned long size, unsigned long align) @@ -135,6 +136,9 @@ static inline dma_addr_t cpm_muram_dma(void __iomem *addr) { return 0; } +static inline void cpm_muram_free_addr(const void __iomem *addr) +{ +} #endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */ /* QE PIO */ @@ -239,6 +243,7 @@ static inline int qe_alive_during_sleep(void) #define qe_muram_addr cpm_muram_addr #define qe_muram_offset cpm_muram_offset #define qe_muram_dma cpm_muram_dma +#define qe_muram_free_addr cpm_muram_free_addr #ifdef CONFIG_PPC32 #define qe_iowrite8(val, addr) out_8(addr, val) From patchwork Tue Jan 19 15:07:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030165 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56FC1C433E0 for ; Tue, 19 Jan 2021 15:33:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A76F23121 for ; Tue, 19 Jan 2021 15:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391336AbhASPdb (ORCPT ); Tue, 19 Jan 2021 10:33:31 -0500 Received: from mail-eopbgr80121.outbound.protection.outlook.com ([40.107.8.121]:58206 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390595AbhASPLR (ORCPT ); Tue, 19 Jan 2021 10:11:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0d3avvlV0FEPVJRgB6OgyZEIBhOMq9Xs9oFZYVmE0sSd+UI2yGCxmCnr9q2cFT6fnZgQefZJ7VvJ+xCbefcHfKLF75p8Ue6fHlNMK4Q2p2+vC95m0mWrW9ohnmoNehNcFCaYq3g+qQzwQ12pL2Y3lX8ubkbT+av+IQQ452iGCC7GiPj3YO4eFkOzfz7b3xznCoZ50gMeBib+SyQfrY0EoM4NSfKaaJ7g01cTKeUsdVtrc0o2BK2d+w8LsYHqH5c/2l90Y3yV9GKjrZKeKm11XtmPhJmFyC4PP0bcPdPN+iydIvISioSWhWICZfzYFjPuXXdqXyDWLb+/2GC/9HfUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b2CQBAxmQlNRTwlqPcj1JbXeejuHyHBoraiQjO3Hg9E=; b=kWFS1YvyxTQBojpQteC7Tv8RT71weTZDTdmcsKERNEsniWiCAot5kCMSk6i49SLnvWH3BxjSzKZy/ZNXgSsicvVW+vj4BRX2gosErOhZlmAljwBVYsZRR0L6+WVYnhP48qTg6yhRooHEIzLdRAg5wSTHZyWGaaI50VRilPA61cV4Reot4M/xgKm0U/yAB0iipEKqacmHSz4XkDeVp1LlXG8M/u7g9Uxt9T+rTMD1XWbbhUom6F63imh6FgVD4RQ5cys18+Brzia4shoqqLHWHEQ2tz0jrxUr6yYyMNH3REg37O2SKVygP1U+GLbf3zH9YSQkNEvVu1eteuSBKljCtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b2CQBAxmQlNRTwlqPcj1JbXeejuHyHBoraiQjO3Hg9E=; b=gMUrEiNKCHvbFyUHhD5Ry84iAbVhlWF9NFfeHZFtxIp8SVyel8T0f6b0xKMog6Yof1oPOPGbJE4tjbCXw+EreH7wrEJO9O/Tu+PoRaTe6A67BVbfp8QzwxygT0HJthzV8OKJJ4nndOO63ZyHRMTn8+w89Cp60KE5CfL8LmvTQwQ= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:06 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:06 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 05/17] ethernet: ucc_geth: use qe_muram_free_addr() Date: Tue, 19 Jan 2021 16:07:50 +0100 Message-Id: <20210119150802.19997-6-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9d8f6dd4-4cb8-45de-bcb0-08d8bc8c29fb X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RGzAg+cILYEqDqHii3WocJeAFWaFSzZULG+gfunM+IBkEjjoRR9PM5N/+KKarjc8Lrv3oxZkIYAfpTPi/4V+KzeC3XgpU3aG/NtvIVBYWPspXjr9dk4WDM4dzKInClmaQIMRonFgEU6d9maNEktlHmqNc6bLdcPojqi2DrGhzLabTVvjlLy095z2uKt3SkBPcBPm4SJZhBPggeWWLJtzqnMxddjknCk/1wcyUAffn13nAblo+mqL+f3/d/5F51b9WJYCs0L+NvVewj+AMrgZnsYHc5W4nE5m0KRhW0kzI2zFPIYddnoR8Cl8pG/QqMFtIwvZTowhMPapKGhnpBJllcxr1kdPiYX9ogyiV1kNQMXW2n1ptdUPDVtVHSiGZGA2g4l6qcPMPEKFoi5D09fb2A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: HoAN2Pvg2U0x8VZSjj/NhjuW0T6i8tEWs+a3ncZqjUwPgXPKp3AZRMtiyOT25cDWUEa4i6PrZXFdh8NqL22EJtebBoQOir9u5HjC85c66oRyIKw2wMpQGDrFO6fl7dZ+TmRu6QDraD+7gSgWook7BNhixbpn77lClphrxl8LYfpqusHjxql2UF4yvhSqYeHwwure7oPlmNV0j/rtxTyEnHPvcJk4EZRAK/V/Bwy9XEX8Qs9lfEBCgjj276383+kqpcywhj/kNx7t4Btf219PTkoXW4IIe0GaSQsI9KfkG7auxcNgX3ba13JAklBE5ox1g2ciRetzzw6jkBjVRQv78NIvDBbpMRuN+QjmwZqi2F3SnwhM2WS7LDaG3wrJdRZqNHjpV1B47GdpESoKjRdFbycvHMbX5cpy7lDjIHutPOjmpHq/aue8XAahVT4hQGCHW5SIIQRbrmDw6nUdrHjdDMadP6bLFzOBXWWMMBmDQRgXHJlPe+iqyA89/+Z8dJ3+FNx4VbwpAQWkVnqclpZnAQvfyXw7FA0bBjQyI/GyDvFoZqdybEdD0kuXpXsPAEaoqtCArxYJSdnK8HJuZxqka8VlJTXwrrGr1mewSkpt4P2D9mlPSeCGFS/4HiRH6bO4BlINOTKkFKQW31CGLvd1a2o8gPrY0CAimeJy9PpfrvT/hoDVWCulW4Q6OqH/5nsZRWilsoNVRfhvH1DBU8tCVtAjGmW4occ9TggPTMe/+1uOW+7h5UchwodkTthDC5OcO54n0DPfnJnLLqopuugAdTM7BERH28zpTcw7LAOXcZxC8UwoJ0yQJpCp48b1Agtk1s5jtZXyQ9JgLU9e+n0Z3Qu4UCk6oFQE9eiz12nmIjXDgaQNcADvKcOv8hdB67Ytk0bLEPNnvbHCngc3MqN4GHsLzJGTuWJwCm2iNTNMhZ90q3fo2wq55S9EbGjRCkNcFqi7qoF8Qyily+QCSoZcr3PrMFMgrgPrI3DHUUl02TL1MLybeqpUF7Ug7GRfYjaa X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 9d8f6dd4-4cb8-45de-bcb0-08d8bc8c29fb X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:06.4708 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0/uVV+yb9jC+0a2mUE4JBHNm7N8DhDw3GrNQ0338oIrGctGNKFkqEyl35HQXmhq4YeRF32a1sE/eONFbllfE4DIW4uUDMD4/NaRQ1oymNxY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This removes the explicit NULL checks, and allows us to stop storing at least some of the _offset values separately. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 77 ++++++++++------------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index d4b775870f4e..14c58667992e 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -1921,50 +1921,39 @@ static void ucc_geth_memclean(struct ucc_geth_private *ugeth) ugeth->uccf = NULL; } - if (ugeth->p_thread_data_tx) { - qe_muram_free(ugeth->thread_dat_tx_offset); - ugeth->p_thread_data_tx = NULL; - } - if (ugeth->p_thread_data_rx) { - qe_muram_free(ugeth->thread_dat_rx_offset); - ugeth->p_thread_data_rx = NULL; - } - if (ugeth->p_exf_glbl_param) { - qe_muram_free(ugeth->exf_glbl_param_offset); - ugeth->p_exf_glbl_param = NULL; - } - if (ugeth->p_rx_glbl_pram) { - qe_muram_free(ugeth->rx_glbl_pram_offset); - ugeth->p_rx_glbl_pram = NULL; - } - if (ugeth->p_tx_glbl_pram) { - qe_muram_free(ugeth->tx_glbl_pram_offset); - ugeth->p_tx_glbl_pram = NULL; - } - if (ugeth->p_send_q_mem_reg) { - qe_muram_free(ugeth->send_q_mem_reg_offset); - ugeth->p_send_q_mem_reg = NULL; - } - if (ugeth->p_scheduler) { - qe_muram_free(ugeth->scheduler_offset); - ugeth->p_scheduler = NULL; - } - if (ugeth->p_tx_fw_statistics_pram) { - qe_muram_free(ugeth->tx_fw_statistics_pram_offset); - ugeth->p_tx_fw_statistics_pram = NULL; - } - if (ugeth->p_rx_fw_statistics_pram) { - qe_muram_free(ugeth->rx_fw_statistics_pram_offset); - ugeth->p_rx_fw_statistics_pram = NULL; - } - if (ugeth->p_rx_irq_coalescing_tbl) { - qe_muram_free(ugeth->rx_irq_coalescing_tbl_offset); - ugeth->p_rx_irq_coalescing_tbl = NULL; - } - if (ugeth->p_rx_bd_qs_tbl) { - qe_muram_free(ugeth->rx_bd_qs_tbl_offset); - ugeth->p_rx_bd_qs_tbl = NULL; - } + qe_muram_free_addr(ugeth->p_thread_data_tx); + ugeth->p_thread_data_tx = NULL; + + qe_muram_free_addr(ugeth->p_thread_data_rx); + ugeth->p_thread_data_rx = NULL; + + qe_muram_free_addr(ugeth->p_exf_glbl_param); + ugeth->p_exf_glbl_param = NULL; + + qe_muram_free_addr(ugeth->p_rx_glbl_pram); + ugeth->p_rx_glbl_pram = NULL; + + qe_muram_free_addr(ugeth->p_tx_glbl_pram); + ugeth->p_tx_glbl_pram = NULL; + + qe_muram_free_addr(ugeth->p_send_q_mem_reg); + ugeth->p_send_q_mem_reg = NULL; + + qe_muram_free_addr(ugeth->p_scheduler); + ugeth->p_scheduler = NULL; + + qe_muram_free_addr(ugeth->p_tx_fw_statistics_pram); + ugeth->p_tx_fw_statistics_pram = NULL; + + qe_muram_free_addr(ugeth->p_rx_fw_statistics_pram); + ugeth->p_rx_fw_statistics_pram = NULL; + + qe_muram_free_addr(ugeth->p_rx_irq_coalescing_tbl); + ugeth->p_rx_irq_coalescing_tbl = NULL; + + qe_muram_free_addr(ugeth->p_rx_bd_qs_tbl); + ugeth->p_rx_bd_qs_tbl = NULL; + if (ugeth->p_init_enet_param_shadow) { return_init_enet_entries(ugeth, &(ugeth->p_init_enet_param_shadow-> From patchwork Tue Jan 19 15:07:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030163 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF993C433DB for ; Tue, 19 Jan 2021 15:32:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 716EB2311C for ; Tue, 19 Jan 2021 15:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391218AbhASPcw (ORCPT ); Tue, 19 Jan 2021 10:32:52 -0500 Received: from mail-eopbgr80123.outbound.protection.outlook.com ([40.107.8.123]:42328 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390660AbhASPLT (ORCPT ); Tue, 19 Jan 2021 10:11:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZHIUaWOZB00fI+xNrXdVFhOJyihoOsJeGfCwv3Z6Bg5H3Qt/bM+O3R5yBNj1eYHEgqzCqILo2mWK4mFYO+prFWjkP9ParPpfey5yfatsfIRNSkHihfPNaeCtlqJscDKnQS5bdTCMeqKMrMJGlCzJpiVq/IdY+l6F5AHscXjbaURDZ8dDtBr3R2DyQrmGrXXMw9mK2bXNNNP9RL9Gclx5w+7boHglsRzMWABGvfrZ1jVGI1AVpsOBYh9Dst0XBVJnR9c/gdvVvudRibbX3bK9tOhGnCfKe1bagYVzRf0dgZ3bs1YvD8jZvYHPM3cwV/nqORmnZYBsGF8TCvNKGXHWHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eNkJWBr2g8u+Fd0BIWV2yxIFSqFq7M3AyyR64zBAZBw=; b=dF5tn/gdYXqPH4q1ZVhQsulySj/jUmGoW8B73iXOq2LJ4sEc36yVwrPbtFuuLYU13qeK2fs8hN4Deoy85b+goB5jMJHKoIgSi3ugv3AGOPrlkJcTBpZdI+bj3ikZvJFSo5tExDYXpweExXwLPdg/JhTf9gbLj+7R8O39H/rUJDKPh+963aHo415REmgoFSjd+Qvgvmczc1mtp6idlYHnfmFgH+Lht6p2IaF8MVJf0bxq1VJI2i92fuCxbam1MsS8w8W+nQTOA4gBtpefaiNFvSxK2thbyLMWW1AGOn703gVdkI+cLiMbtaLWS1POZlJD6AbuemFme1WspP1/raDMkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eNkJWBr2g8u+Fd0BIWV2yxIFSqFq7M3AyyR64zBAZBw=; b=Dc3owMBxMXzfBf6BkLxmsLulu52nN2S42pStmfB33qH/oKxSDDHsTLeNN7Xxt8Rq0rYiyPaXQCXTIlalY45Fiq9Vq54voIrOyuBB6ynYGSlerg8vTY43QLhtgUibFMlZXna33pIobpHdpi80w/ywQCj9RjbK7Kdl6ZWGmwyrAio= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:07 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:07 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 06/17] ethernet: ucc_geth: remove unnecessary memset_io() calls Date: Tue, 19 Jan 2021 16:07:51 +0100 Message-Id: <20210119150802.19997-7-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dacc0ec0-3a3a-4d85-14d4-08d8bc8c2ae3 X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qVh6S5faa1QDifPmUsBNFDN8TFTijPM2eyx6Ff7+wCRfUujxvGJjXrPim0ffi7xo/yp3nSuF3veMhkQeQlkqxidFNRzouancaMoGp7jxrX4WbJLXfDqgXyk4nl2W8CHrQSf119SvyTuD0YzwTMNgltm3aaXAHXGaZcaRu8KlkTv9ggCug3AsuMDg1UKvAqoWiP9Z4WFZlL8SVnv28wHyDctpmHX3v9GA8mY5Rsu3+Ma5smciL8KagbFFKw4lNY2atG+MemP5/hx822sdDJrSDnE8La2TUbyAujncrzNrmeY+vTlm0MBpN+OOl2Jbo5WNZnT3ASQawWmGrBUIL+MW0ytWjduo1yN04zT2uEFsIA1OPgJN+WBscVYJBzyuCwJa7JKlHGyrUGMmnd0Bo/8xTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: jw84H4/gciVVpVWPKpQYltbRJzJzhWPTC6JlCjv5HSA9OBQT4AIEyk2M7WwRCKWjaRRpiAfwiEwa9pLX4rpeV33A7b3sEAAUWXMqgpeWIC3l5+3wwChhfXWeoJAb4wszq8zBiFmjI5Se5YHtYL+ACNvmD24toF+PFCtOxTX/zXXzo87r7qukOPugLbRaLIbmxWo45sCTsmuivtXUcavxj2x5xhlsSzGTtwjQDUYx+Ax7CX02Dfkm3oApA0C3LLUcbuboYgRfcIt8JPBOdm75McUH7r9qrzSYznt+n22wFdu9wrXpfVUTRzByn7W5BFX9MByCMxw+jcAndwQNk4B8thPYuQNRPW7ajOvQLmQzpk1KWSHNTx5z5Lst0rli6NIkr7nWN9pkMaq+Hjxsr26nKgdAXc8RZqRis+6W0Cg1QXEhiiUbIdwQYXutqNYsvhAwKb7PrMTgD3vW7vNvAvDGzOH21JSzjf+IdWkSjyoFDKUQ8fkJAfDNv5yd/FMdW2O2kaM0SxUuSnx18Plw4cn63eiNB3s7nSgGPHOoPrZ/tFKAeGXe7Txsit2PG6j81hBSjtcEmhKrXvSiVEK3yTvqUMyDl6vTUBsv24uw3fXw6aFdEVy+ikFU0jInMlDhv20MVWSNIGMHePJR+BV3K4M5EcrDugQ52lyXvqA3Q7LNkN/8HF8cvVQtw4lu+h15QpSTl5SG2VCpRkAzeEr3rM8ojZybMu6ALHijc61sCEenoKSadHGKUo+ebLkJInVuS2upLsADTdpPmjn7y0KzH8U/Dc5sUqmgpRMh0urCghI4RNO970ue/EmNkDtcct7Oguv4gB8sVfZHAlKFhwuXDg7bYX+EJwN2lguxyPJS7Q+mF0sYUN5OMTnNl/4Pglk3ilHfHBREAo1iZizSWdMPJvtxsCmP19sT5dfTaTJSTgfSUyeTtR1+MKVRy3YtcC0dQtoqA189ootzpP/gRW5ueCTNPVqqDkxkDA8Clkv0lia4KOOIJSWAVAXaeokIFxLFEqaB X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: dacc0ec0-3a3a-4d85-14d4-08d8bc8c2ae3 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:07.6731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bVRkgNm0DnD0PlU/H2/kMQfVwmyYdOs29V1lJlKR1VkplORZawapMO2eI07LhyyEVoKgo0oUN2kOnp3SOD4r2INAR+8u5MmTrxpCLc9hgxg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org These buffers have all just been handed out from qe_muram_alloc(), aka cpm_muram_alloc(), and the helper cpm_muram_alloc_common() already does memset_io(cpm_muram_addr(start), 0, size); Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 14c58667992e..be997b559577 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -2506,9 +2506,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ugeth->p_tx_glbl_pram = (struct ucc_geth_tx_global_pram __iomem *) qe_muram_addr(ugeth-> tx_glbl_pram_offset); - /* Zero out p_tx_glbl_pram */ - memset_io((void __iomem *)ugeth->p_tx_glbl_pram, 0, sizeof(struct ucc_geth_tx_global_pram)); - /* Fill global PRAM */ /* TQPTR */ @@ -2596,8 +2593,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) scheduler_offset); out_be32(&ugeth->p_tx_glbl_pram->schedulerbasepointer, ugeth->scheduler_offset); - /* Zero out p_scheduler */ - memset_io((void __iomem *)ugeth->p_scheduler, 0, sizeof(struct ucc_geth_scheduler)); /* Set values in scheduler */ out_be32(&ugeth->p_scheduler->mblinterval, @@ -2640,9 +2635,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ugeth->p_tx_fw_statistics_pram = (struct ucc_geth_tx_firmware_statistics_pram __iomem *) qe_muram_addr(ugeth->tx_fw_statistics_pram_offset); - /* Zero out p_tx_fw_statistics_pram */ - memset_io((void __iomem *)ugeth->p_tx_fw_statistics_pram, - 0, sizeof(struct ucc_geth_tx_firmware_statistics_pram)); } /* temoder */ @@ -2675,9 +2667,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ugeth->p_rx_glbl_pram = (struct ucc_geth_rx_global_pram __iomem *) qe_muram_addr(ugeth-> rx_glbl_pram_offset); - /* Zero out p_rx_glbl_pram */ - memset_io((void __iomem *)ugeth->p_rx_glbl_pram, 0, sizeof(struct ucc_geth_rx_global_pram)); - /* Fill global PRAM */ /* RQPTR */ @@ -2715,9 +2704,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ugeth->p_rx_fw_statistics_pram = (struct ucc_geth_rx_firmware_statistics_pram __iomem *) qe_muram_addr(ugeth->rx_fw_statistics_pram_offset); - /* Zero out p_rx_fw_statistics_pram */ - memset_io((void __iomem *)ugeth->p_rx_fw_statistics_pram, 0, - sizeof(struct ucc_geth_rx_firmware_statistics_pram)); } /* intCoalescingPtr */ @@ -2803,11 +2789,6 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) (struct ucc_geth_rx_bd_queues_entry __iomem *) qe_muram_addr(ugeth-> rx_bd_qs_tbl_offset); out_be32(&ugeth->p_rx_glbl_pram->rbdqptr, ugeth->rx_bd_qs_tbl_offset); - /* Zero out p_rx_bd_qs_tbl */ - memset_io((void __iomem *)ugeth->p_rx_bd_qs_tbl, - 0, - ug_info->numQueuesRx * (sizeof(struct ucc_geth_rx_bd_queues_entry) + - sizeof(struct ucc_geth_rx_prefetched_bds))); /* Setup the table */ /* Assume BD rings are already established */ From patchwork Tue Jan 19 15:07:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030515 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2286AC1B0D9 for ; Tue, 19 Jan 2021 18:29:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC05422CAD for ; Tue, 19 Jan 2021 18:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbhASRrD (ORCPT ); Tue, 19 Jan 2021 12:47:03 -0500 Received: from mail-eopbgr60117.outbound.protection.outlook.com ([40.107.6.117]:28545 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389168AbhASPKA (ORCPT ); Tue, 19 Jan 2021 10:10:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O17bhMdIAOttFprxtFFVwd0GTA3Ltfx5VQcMcgCxpLTxevCXacVrRRABwSs9djVyWSgu9tvAgNKaXt78seI0jwLRFGDGUDudfQjg5qu/woHRMg0OzW2JLFJdutf8uRalaNkKwHnorjOn9CugoNwr2t7j0oy+C805lntP4ui3iyEjBmfTHjz3Xaomk6DbkqtY+pA/CY4iq4GR90GRe1Tv4w4HlfYklhqz3ngATqdVE0YRjMVWaqudTt72Prw0sGS7C1MGEI+LhWwPqAGhYmkRHKX8RDc0nTH33Ku/++y14lduCNghSz0iHTTQFu//dn0Yy+Zq9FUjQMpEsReS2vq0sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1lBctH3herRrtuw/MJm5z2mIo2l5pPOAKd+vYAiDEZs=; b=ejVLR6NNyoqXjineak9frdTFn1UGUOW9l06QL7LEy/Nlx8jwEvIaplpaYy7VI/OXpSGssenjPaqGMXXRx0K5L7V96d1wVDhXAkr95BFNcHRmsM6wvLzGgtCR56BCoaSVIG/0pcplq8FHvAe6NQU4vqGtWFyyvZ396WAeaICM8UlGeYUsKBNX6cdTXFBkYdKG3dZWcEMyOhHl5U3PQXphw7kVHVkivekx40Uxi21WQFUevzYvq0l2Y630aSn1pHr6V/Raeib66AaTqX68idNJUAskPJFJijqxKRICpcAeuzUcg5PolY7jFEWnskfJUfUbm+uS5NU1V1k8tVMWjWEsJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1lBctH3herRrtuw/MJm5z2mIo2l5pPOAKd+vYAiDEZs=; b=dvo9OVZ5hqK8ISzT8mSqOGFrdWwBEynl3SNPe9c9QgoSqfTOtQkgJ1oTTYD8/sGKQ/KRxMhlic9gfezqLCryJnvwf1Ce5BghzcMYF9223Tlk7hH8BPk3EjPWcxPrn+s6pBg0+QJJ/7Wg/IHGPfPsqqpRmpM6Xwg+MiSlkTx4U9c= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3681.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:15d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 19 Jan 2021 15:09:08 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:08 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 07/17] ethernet: ucc_geth: replace kmalloc+memset by kzalloc Date: Tue, 19 Jan 2021 16:07:52 +0100 Message-Id: <20210119150802.19997-8-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3b9c0b4-66f8-4644-4090-08d8bc8c2b5b X-MS-TrafficTypeDiagnostic: AM0PR10MB3681: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2rEW/+G89UEH2i537WBvplSMcZZIUdg2o2dPMJ2bWv2blfE5pNsx+38aWh8sfTamZSb8+kJhuCvVO/Lz/cIHS9jtt/IfJgCiqb0EbUbB+i7gs8Iv+tKW0THjedPTBS8Xl8W3iklu3WRxE1lwtdpI5JJZfU71sODyawyZZFUmbdvGQJwOBuasPmqNeVXRCLcTtiowvvOC4dDbKHPxJ2QV+24GI4WN7EMYOIFs54MdL17NgNMdCA356EZ4BxsLez00grX0/k5JllyIVIVu+KyW+Gs5/n59AdzD9q/HxjANSwqeabXfyylSec5cGht10o/HE+3uMUfzrQWnwjF7QmXpybWr1ZjxF6fC9yOoxdlV5jA4EvGw+mr8YO9artxR3mryT1WjZ/s0VXorSfZpRI7Blg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(136003)(39840400004)(376002)(8976002)(16526019)(6916009)(5660300002)(8936002)(2906002)(6506007)(66476007)(52116002)(66946007)(1076003)(83380400001)(186003)(956004)(6666004)(6486002)(8676002)(66556008)(4326008)(54906003)(44832011)(107886003)(478600001)(36756003)(6512007)(86362001)(26005)(2616005)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: z7dpzBOtVDjG1afbsb3NxG2l4sII555ZRnpqfLSPaF4i5wqOwtXwCPO1E4BIzjOWTB4M0YLvy6bTSxyTJL7eT7Ek7mSRUj5ScZMGxYJXV59OqVSzggaX5V3dFazoXa1URZNq7IILPph81WukL+5CAhNsmvO2WGrj0ZlUwBvpiTtffRM9wPH1yPW3O6RX0EYebUey8gvGjpappDLFayvEQVKycId17+nfG1zWbMXVlkw4SI++V8eyWM8Bp8XA+rGwNazqSnyEMsFmKBlnLeoNy2wzFvaLvbF8KaObYqubYqWgqFUlO0tr/Mp6ngxXvPauz9sElztfoWmKV27d7RdjNB03S1CD9Z7uZUoGTHVNTRLmsa5q+RE5A7MX1RbQY1HgTp6X1FNUv7Qw5Ko1e+gFcAApLNF7ikNnWt402Y6rymCt3GUWsehSlk/czPsCZ9XwXPKclirDw0O2o3qLFTL3gJ4J0i7aB4B3dOjAv6+78Y0RNGmiiaVDY0cOO2lI/VQ3DsXC6bC5w4Q9DDhT6XKMcAU+Ax7xcQTfcSq9eeanvDG7rJ6pasrg98RL3yJShCTS3UNJqbrji53LlvfFolU9bVbPAWbNcpyaOOLto3dQLN/J5y7g8/6vEBykA1opTFFmklQtIXBAS5Hb6X8PBBGmkmN3SzGNshh9cht3CiS2xAFmwwFnDzmQxo9NF4c6OOsec+Kbfc2wPidfwa6ZfVsTQYxZMZaXOrAxo+5vNjBH9cAszIf0q0NfMwUgn+si0J4SBEsLXyY25hk+Ie/D+E7hNU1H7SxHygADu8ZtSUO6lBzPvnnOH6LKe4y6k/l5jZkQ8/oRUqamhGnLWvs6aQNJMJinOei756oc+3U/Irw5IwBq0+5z/DE/RutmSxXwMfEHBw7Gy7/VAtaVS9HIdRv+VI9i3wiveBEGZ0/GoEVcotXiEZ21JaBOqwRI/7z9kYNBUlyd5MZfvxS4oSl6nkubPPKg+uZ4ios0wdsTkQa06wxgTpsV6vNGcULhuvfJyZ4i X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: b3b9c0b4-66f8-4644-4090-08d8bc8c2b5b X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:08.3847 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wF9K++eAM4o+JYMCTb56mLybpxMQMBn9vlK3RNAzoStis781bC/7wtMAy5Ezz+/2RIgSQ72ntOKRuTcmXYgPhH+8BqgmrZ8klrOcef1A7hA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3681 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index be997b559577..74ee2ed2fbbb 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -2904,14 +2904,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) * allocated resources can be released when the channel is freed. */ if (!(ugeth->p_init_enet_param_shadow = - kmalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { + kzalloc(sizeof(struct ucc_geth_init_pram), GFP_KERNEL))) { if (netif_msg_ifup(ugeth)) pr_err("Can not allocate memory for p_UccInitEnetParamShadows\n"); return -ENOMEM; } - /* Zero out *p_init_enet_param_shadow */ - memset((char *)ugeth->p_init_enet_param_shadow, - 0, sizeof(struct ucc_geth_init_pram)); /* Fill shadow InitEnet command parameter structure */ From patchwork Tue Jan 19 15:07:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030971 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4C75C433DB for ; Tue, 19 Jan 2021 22:29:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2184230FE for ; Tue, 19 Jan 2021 22:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388034AbhASRp5 (ORCPT ); Tue, 19 Jan 2021 12:45:57 -0500 Received: from mail-eopbgr00122.outbound.protection.outlook.com ([40.107.0.122]:51363 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389198AbhASPKK (ORCPT ); Tue, 19 Jan 2021 10:10:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wc25o018ANbJSgBM0XaWVNVTuAjtHf1cIvbfm3VHUkoRg5l7YScQ4RP8VC9Dv8toeNWcD45LGVgaR3jVunnSlnlLx7bwPL8o3TJDd+xwXc8NzWqxW61Kmh69q7GyjpQvZvVJFPw+K2bYTK2Fq1nWg82SasU/e16uYx9Llam+oMya2+9CdeG8aIzufOdP64QVzqgQynoO+G2vsskXn2wFBWynKCFqyPZkqW/iIvO7PbKIB8ru3P1/HnTfsskLT7zw8g9CJrK703C/O/Y+5QOqApFsqESZnhuDYEJuao0m+lJ/7xSc6bqutvQqS+RsOhKnywz+34dhXy/a36HWMm1GeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Po+2fmCCMu4/YlA+Ht6dyqcd1wSfreSr7h6ENUs6K+4=; b=CMqYJLkmO3T1QTYxw79FVF6CqbgLNNAZA+ZyoQw1S/0DKMZ34/eZwbpb6Rqg/oiS+Bm4nSp57qTDmsfkzBFcPtgRr//quaT52hl71x8S4RtRXiScejsJg5EHVJ+QVYIma3YjokGzA8xZ7uMvGe3mpH8DzOt2DUomW2GQm4WNbjj0YeKUWOjnD+pkx7xovkmT+pgFYKEfJ7mYMLay6ugq215sDy6KXQfKDWdycySkqM84pXHicdzvwsfqvke+yrjxCGPxLIzQmSdOvRRXAhEjp9pFybzfoxcKiPqn15Yu3PKoWFjOlsApuYOBXMycGTTTrogruSEgdtCjZ+IuurEtHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Po+2fmCCMu4/YlA+Ht6dyqcd1wSfreSr7h6ENUs6K+4=; b=mYuhOte7ANTyT9W2Y/FIuzFnsLRjee/qDOThPjxMfhe0aOi+Dx7819Flh+u1PEtThm9dxsIVcJD/PCa0cN60/M8IuROv0BaM8R+ejjvbX8RLpoAoGbmBwAS8Bv+jO4q/7OxtLLCif7fzR9LARgDIn8pOXfGBhsOjmniCwykTnMU= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3681.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:15d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 19 Jan 2021 15:09:09 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:09 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 08/17] ethernet: ucc_geth: remove {rx,tx}_glbl_pram_offset from struct ucc_geth_private Date: Tue, 19 Jan 2021 16:07:53 +0100 Message-Id: <20210119150802.19997-9-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 150e387f-8120-47cd-1428-08d8bc8c2c26 X-MS-TrafficTypeDiagnostic: AM0PR10MB3681: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: digAH/alQTzFEXjLe9zQiekxDGcwZurp0drGo8gUAhCUp63s4npk4RuzoJXoAT8qnQuUo/DorTKvKFAIKPCZLoTTQM2A3oBRcVCI3zuvDxz3g+Q5GlYSHDieGbu4QPAEq5LD84MF3inhkzIHWNB9QQwnVbfehb7kDydw2DS3WQBVYvh5rHMvuyiLz/qGN1Zxq0pEulYqm9GxxZA6T+bbmLPSM4bZDvlb9Sw9gazKUW8EIgyc3WM5ZN0gl7+zj3fJQHeked3HndUyiWEBbYZnSpB8BTKvG47iqTiS77Y1ORcRuM7euGSVuucJKIdOO3JTuoQeoNt0PmIU9OhgITld8LN452O49PHyIy3U/xQ6IRSK7elaiTMx2AGvzAxFlDRuJtCMkT3/gRhtTGH6ZWOIxA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(136003)(39840400004)(376002)(8976002)(16526019)(6916009)(5660300002)(8936002)(2906002)(6506007)(66476007)(52116002)(66946007)(1076003)(83380400001)(186003)(956004)(6666004)(6486002)(8676002)(66556008)(4326008)(54906003)(44832011)(107886003)(478600001)(36756003)(6512007)(86362001)(26005)(2616005)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: COX8GyUbP0sBg+y79CCRmfeR8y1H5gmyp564vw3d2vDMnqqDARxTzbY8M78hzJxh82X79i3CCjINPaZwEgZDLQ2fKJo+FRRaO58vIbddr2T/P0uoIgUsiJaYP0QGR+HuSJpozCdWlWEgQnOlgmrhV/S2+DdfXssjeN8Hy01EhMSdc9z5uBLJI7SDG9nApYl7ki2DJJgLctbAgWpPLuzq+ubmxUxoBJ/kAgFbHmv/Ue4nzylP0KEVPwB56jBcaNxQwIuGmCeP6vMWqoJghOqpWRa4vwaDiSY+N9FtrHXmF9QddopZKlhWs/0GLa3BFDjTHDEs7dFoiZz4WlkEyakZxxWaE2GeBsi7GP4qlao2nG08AdPy2zl5FukPPVv8nLL4a+/Vh2sPzXqUQmF4zY06nv9Y81ml+zr2JenbYk7xqco3FT5LmIvadVDLwj3KN8tZKPoKG4uH/BXA2kg2lLIhsfsnXLdY3vbX7is9Ni0MtQmtwF6aFdnG06lHzsHvWU2+JCFSz0QY3n5MCm84McTg9YmtqjbjXRzhfaT2i20+c+ncITIX59ZyboKESYwcIwJ/9OPdOnFAozF8BGiCse2zhd/weG1/yKc3UTNge2b+XiR1QrXOKG3iGEARCyXHi/HknkqTe1P/Vk7tq/iOlr/e4p7VgU6omXaNe98TrN6PTsJ3GgmxJAcGXrOeqs7UzmYItBeqio5be7aVBgyn5p1eoHt6Jxfoza9LNoWZ5GRn2PRM8KAHWyk/Sy9f4hyUINc/6k1nPPHCiXtSkUbFTXPLzGOsGIrB9QPR04+TNoDcMMtw1Xwtcy7m+OW6wLDG8YXMf2knypUv8Zj2OFcYGldHzv39m7xQHn6+4GYHDvEPH01+6G92Zq8roDJ/l+dGttsaiycmZexyEa5/33+Lvx+cFAuLfGmA1J4RUp+6f4Jnt0peNUw8CUj/oLPWTrCB56pzK/cnoBOX34OE1kms9huWIkG9zu09voVYljEw45KBcKN17UJlW2yRZJezLT+JYXsj X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 150e387f-8120-47cd-1428-08d8bc8c2c26 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:09.7270 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b9K9JDEQgbq2Iomhz7AWSvO149/ThcxI3GPxGqvcyXdNHnqUlEUAvtV1r7a3gKQdM6gRZYpy/SmC/mI+mymjHcd+tx2UY+gl4KkZBESPwvg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3681 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org These fields are only used within ucc_geth_startup(), so they might as well be local variables in that function rather than being stashed in struct ucc_geth_private. Aside from making that struct a tiny bit smaller, it also shortens some lines (getting rid of pointless casts while here), and fixes the problems with using IS_ERR_VALUE() on a u32 as explained in commit 800cd6fb76f0 ("soc: fsl: qe: change return type of cpm_muram_alloc() to s32"). Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 21 +++++++++------------ drivers/net/ethernet/freescale/ucc_geth.h | 2 -- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 74ee2ed2fbbb..75466489bf9a 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -2351,6 +2351,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) u8 function_code = 0; u8 __iomem *endOfRing; u8 numThreadsRxNumerical, numThreadsTxNumerical; + s32 rx_glbl_pram_offset, tx_glbl_pram_offset; ugeth_vdbg("%s: IN", __func__); uccf = ugeth->uccf; @@ -2495,17 +2496,15 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) */ /* Tx global PRAM */ /* Allocate global tx parameter RAM page */ - ugeth->tx_glbl_pram_offset = + tx_glbl_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); - if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { + if (tx_glbl_pram_offset < 0) { if (netif_msg_ifup(ugeth)) pr_err("Can not allocate DPRAM memory for p_tx_glbl_pram\n"); return -ENOMEM; } - ugeth->p_tx_glbl_pram = - (struct ucc_geth_tx_global_pram __iomem *) qe_muram_addr(ugeth-> - tx_glbl_pram_offset); + ugeth->p_tx_glbl_pram = qe_muram_addr(tx_glbl_pram_offset); /* Fill global PRAM */ /* TQPTR */ @@ -2656,17 +2655,15 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* Rx global PRAM */ /* Allocate global rx parameter RAM page */ - ugeth->rx_glbl_pram_offset = + rx_glbl_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); - if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { + if (rx_glbl_pram_offset < 0) { if (netif_msg_ifup(ugeth)) pr_err("Can not allocate DPRAM memory for p_rx_glbl_pram\n"); return -ENOMEM; } - ugeth->p_rx_glbl_pram = - (struct ucc_geth_rx_global_pram __iomem *) qe_muram_addr(ugeth-> - rx_glbl_pram_offset); + ugeth->p_rx_glbl_pram = qe_muram_addr(rx_glbl_pram_offset); /* Fill global PRAM */ /* RQPTR */ @@ -2928,7 +2925,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ((u32) ug_info->numThreadsTx) << ENET_INIT_PARAM_TGF_SHIFT; ugeth->p_init_enet_param_shadow->rgftgfrxglobal |= - ugeth->rx_glbl_pram_offset | ug_info->riscRx; + rx_glbl_pram_offset | ug_info->riscRx; if ((ug_info->largestexternallookupkeysize != QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE) && (ug_info->largestexternallookupkeysize != @@ -2966,7 +2963,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) } ugeth->p_init_enet_param_shadow->txglobal = - ugeth->tx_glbl_pram_offset | ug_info->riscTx; + tx_glbl_pram_offset | ug_info->riscTx; if ((ret_val = fill_init_enet_entries(ugeth, &(ugeth->p_init_enet_param_shadow-> diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h index c80bed2c995c..be47fa8ced15 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.h +++ b/drivers/net/ethernet/freescale/ucc_geth.h @@ -1166,9 +1166,7 @@ struct ucc_geth_private { struct ucc_geth_exf_global_pram __iomem *p_exf_glbl_param; u32 exf_glbl_param_offset; struct ucc_geth_rx_global_pram __iomem *p_rx_glbl_pram; - u32 rx_glbl_pram_offset; struct ucc_geth_tx_global_pram __iomem *p_tx_glbl_pram; - u32 tx_glbl_pram_offset; struct ucc_geth_send_queue_mem_region __iomem *p_send_q_mem_reg; u32 send_q_mem_reg_offset; struct ucc_geth_thread_data_tx __iomem *p_thread_data_tx; From patchwork Tue Jan 19 15:07:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030169 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D68A5C433E0 for ; Tue, 19 Jan 2021 15:35:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E25B216FD for ; Tue, 19 Jan 2021 15:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391535AbhASPef (ORCPT ); Tue, 19 Jan 2021 10:34:35 -0500 Received: from mail-eopbgr60090.outbound.protection.outlook.com ([40.107.6.90]:16515 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389820AbhASPKk (ORCPT ); Tue, 19 Jan 2021 10:10:40 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MVJrm5t+Gt7JtUGFP8mCArpcEd9aiqtJwwJldbm5aAI7zJZpINRQKenyg2K3dmgRg+J7hWFIA8All8lswHRpfInB3RRVTj5LN8P26q9XShSYNKWnMtcQ2nXNBVTFdhC6tE1xgQSNh7QoatG5Vnh9irrfjB9kSYfKfpMUb7q+/cx6ZBX+tCyriUY7ior7qAFMxOF4SuUJ5WSed1dmF+0imiWpPCf4Itym/SBvqbPzeCHHapzZ4pLCXF73mNB0A6UuVLrdiebJRpMyG7z+qZyDaYAzUwdKzwQ27pihQoexSAYdNu8+LMZ/I7N+USjIT2iUjicN0zlcqMb0xK/zosHZ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ItH/HTFNZVEGP/zDWBWtWig0GC2CV3FacBzzAFllqpY=; b=a1hfV29i7JEnzMj5JHtCfCP6OKAGoDHga1WV2gIF8eD8uHr5Xfgdh/VkroIcanzaZygboL1Kvo88MoiAh66+4WZA+0S9W2j3Orv8+3piXS+CMLoqKLijNG60Fbj/KarfBeKzaviHqBNtNKvJQvUGZ/Ypb6o9P7MUZMGjrTVK2Qn+gZPDfpUrxytFNUDuTgfGk9PXBBfBEHyRKeDPvcGGLZQrTnHzASN8tpWALRnhS7Nfh46InJ7oNKutPQi6bVgF4mGVKe3SoSjEFvrJpEd7tOB9QmObK5o5A439ZE2SLHLE4O3jj//eU5MY2lZt9lCsA1le5HECi6VfdawXzYNUXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ItH/HTFNZVEGP/zDWBWtWig0GC2CV3FacBzzAFllqpY=; b=lTOlup61EEHfCrFxC/0Wvp79XKS6U89cIeHZ0hwF8Vi7TDz0GkdMANX0CL/oVbv3uzsanXCNcinfIFxn54hu59HDeEmBPyJz2MVkVKTF2V0q7Yh0L2i/KAbJObxSKTRCCeKJpAQdbgZDDICPxrtsRPsbHplFylBAm62JmE/Btgg= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3681.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:15d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 19 Jan 2021 15:09:14 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:14 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 09/17] ethernet: ucc_geth: factor out parsing of {rx,tx}-clock{,-name} properties Date: Tue, 19 Jan 2021 16:07:54 +0100 Message-Id: <20210119150802.19997-10-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3363d313-f8ae-4898-da4e-08d8bc8c2e30 X-MS-TrafficTypeDiagnostic: AM0PR10MB3681: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:252; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fSHZ5nWx90nCxvhHxteBdWMIYfv4QO96SFhGlHAbe+0PfkMxxIz9GjZoH6dOmL/T6a2q0Mi9XtSl1x/KD6rbYImWuoEZfqIX9CYc/VfGGsz2AKz64x76VZ+t8zafSi6Av2kChLwWSn96MycvIfUV0nutIOGf/9FcmhkhDFCXR1B8gvVH+JrIxFlGBSsJLxytDHWu03zA74ZoIpvI9sy9fpTEtLBHGqL1ypRLvf484RsgkkoMqb5VdeBXV2Jy8EXcglI4I9x+y18+t+HrrychDoGgbHnbpk2WVOqlBoNK90yUPEQ2Ko9hUqzX3SIeUkZTT3xd0pl6GBgz4qAUnCbF46h9pix7IhlKLJiOp9FEPdqqfg8WqQ2U2kOvE5e9e/4E0gPfALqJ3YV29/nOQg6ZKQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(136003)(39840400004)(376002)(8976002)(16526019)(6916009)(5660300002)(8936002)(2906002)(6506007)(66476007)(52116002)(66946007)(1076003)(83380400001)(186003)(956004)(6666004)(6486002)(8676002)(66556008)(4326008)(54906003)(44832011)(107886003)(478600001)(36756003)(6512007)(86362001)(26005)(2616005)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PjVm1KT//902IVNN6bKJ1NlBY9hkqyVOnfK/sMQRDLcxzutUJbZEOOCR2QGaJa4CiHV/WZrX/AlK0rn5pq/IGYzbp7w0NBc2Qc4jqMWhoYMs81LBYsXLGh1T0SXPJtLkKpgz2Zlp1D6D9ZS2Rg/p70hUzWSB1q5tfYR0AItUZhl9Emn1oSGatGLgn/yEqdwAfT173VppSYbQJcWA6k861m6aGM/ziseZtoy62OriYzrUGv03Ta8GNx3skwTCuFDGYl1IpykYdvpBJlcPqQTsLh+DayDPjDWzrVES/yECT+JBIe0ckXyMiwRiGSSowIwD5eM+RuP2e2RvU79zNxmecSKgLl6UX8l62gi39SCLsuNJw0v0Q4ldjg5qEqsL4iJsYFOLFdOwI62VZdDPSAVAlbahCjM998S5BMiN7F5HRZmAXNsAFlExAMJjlQbonWap69bRmgWONkx8rtFoFwHWcbyajJzCLsQ+rUDBuErImzK8qokU53c1MB+Ajg1k0MPTVP1I151fqduYPlFODN+MeFG7OmslHeqVFrFVmQ8aVyGkF4yBgUj8AOzX0JjZ5dQA1Q7vEsTNMBNSK91uTscZs85kdgVdyYO5ZdQ3rDgei3m1X3r0cgd6o+kfWGU/OAS7vqX3rAGN5rPNPSOKIIsFXl/S4JXkJfDeBoCQZIJSAVmFsysZEqkwg99yhqp0YEhILTIpNU5+rDYvoAE9W1y5IQtM4IGy1f8Gf4OBz2Wzgnoqtlc1fJiXvsXb5JJ2Sj6aepVatS9lmFOePL4gW2I8kGbHcMfNOWvOVHv4AUV1uEc5dW26/YBs02OFwjixHVQcdJbTpfUbxhX+MUEchg8PlMQpBXWRAV0gpW6/DRcvReFVAfck7gKJrovVEQKRXTJ8DdkjBHHqLRqnh1WV4JsNq8cE0mXFysdCCvqaVh393AvTbMvQu/t3PIhm3N1LrNdAUmQzQ1sP56t2Z3xmWg4L1PFhlDiGPjE+yxkUyByK3SIudS2W5K8aOP2isvhueYn0 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 3363d313-f8ae-4898-da4e-08d8bc8c2e30 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:14.3274 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 633LjqERNO5ei8V/03R8FhcpuNNL00NcWjDzbk/FByJIhHDLQGp7NKDNX9oL9kQ0HpHbW3bSrSaMJZgaFns2cN46ykV0YsQ6LrQlhJzblNo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3681 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Reduce the code duplication a bit by moving the parsing of rx-clock-name and the fallback handling to a helper function. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 80 ++++++++++------------- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 75466489bf9a..75d1fb049698 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3646,6 +3646,36 @@ static const struct net_device_ops ucc_geth_netdev_ops = { #endif }; +static int ucc_geth_parse_clock(struct device_node *np, const char *which, + enum qe_clock *out) +{ + const char *sprop; + char buf[24]; + + snprintf(buf, sizeof(buf), "%s-clock-name", which); + sprop = of_get_property(np, buf, NULL); + if (sprop) { + *out = qe_clock_source(sprop); + } else { + u32 val; + + snprintf(buf, sizeof(buf), "%s-clock", which); + if (of_property_read_u32(np, buf, &val)) { + /* If both *-clock-name and *-clock are missing, + * we want to tell people to use *-clock-name. + */ + pr_err("missing %s-clock-name property\n", buf); + return -EINVAL; + } + *out = val; + } + if (*out < QE_CLK_NONE || *out > QE_CLK24) { + pr_err("invalid %s property\n", buf); + return -EINVAL; + } + return 0; +} + static int ucc_geth_probe(struct platform_device* ofdev) { struct device *device = &ofdev->dev; @@ -3656,7 +3686,6 @@ static int ucc_geth_probe(struct platform_device* ofdev) struct resource res; int err, ucc_num, max_speed = 0; const unsigned int *prop; - const char *sprop; const void *mac_addr; phy_interface_t phy_interface; static const int enet_to_speed[] = { @@ -3695,49 +3724,12 @@ static int ucc_geth_probe(struct platform_device* ofdev) ug_info->uf_info.ucc_num = ucc_num; - sprop = of_get_property(np, "rx-clock-name", NULL); - if (sprop) { - ug_info->uf_info.rx_clock = qe_clock_source(sprop); - if ((ug_info->uf_info.rx_clock < QE_CLK_NONE) || - (ug_info->uf_info.rx_clock > QE_CLK24)) { - pr_err("invalid rx-clock-name property\n"); - return -EINVAL; - } - } else { - prop = of_get_property(np, "rx-clock", NULL); - if (!prop) { - /* If both rx-clock-name and rx-clock are missing, - we want to tell people to use rx-clock-name. */ - pr_err("missing rx-clock-name property\n"); - return -EINVAL; - } - if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) { - pr_err("invalid rx-clock property\n"); - return -EINVAL; - } - ug_info->uf_info.rx_clock = *prop; - } - - sprop = of_get_property(np, "tx-clock-name", NULL); - if (sprop) { - ug_info->uf_info.tx_clock = qe_clock_source(sprop); - if ((ug_info->uf_info.tx_clock < QE_CLK_NONE) || - (ug_info->uf_info.tx_clock > QE_CLK24)) { - pr_err("invalid tx-clock-name property\n"); - return -EINVAL; - } - } else { - prop = of_get_property(np, "tx-clock", NULL); - if (!prop) { - pr_err("missing tx-clock-name property\n"); - return -EINVAL; - } - if ((*prop < QE_CLK_NONE) || (*prop > QE_CLK24)) { - pr_err("invalid tx-clock property\n"); - return -EINVAL; - } - ug_info->uf_info.tx_clock = *prop; - } + err = ucc_geth_parse_clock(np, "rx", &ug_info->uf_info.rx_clock); + if (err) + return err; + err = ucc_geth_parse_clock(np, "tx", &ug_info->uf_info.tx_clock); + if (err) + return err; err = of_address_to_resource(np, 0, &res); if (err) From patchwork Tue Jan 19 15:07:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030095 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F4AC433DB for ; Tue, 19 Jan 2021 15:12:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 803D22312E for ; Tue, 19 Jan 2021 15:12:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391149AbhASPMJ (ORCPT ); Tue, 19 Jan 2021 10:12:09 -0500 Received: from mail-eopbgr60130.outbound.protection.outlook.com ([40.107.6.130]:4772 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387558AbhASPLK (ORCPT ); Tue, 19 Jan 2021 10:11:10 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WqIPBQZXuiwunR9Zu0Z1ue9cQ2X+/926nauiP+nKXGFOe7YAic+rpcT3vXgfuqmsMAwCmLtjrXjuNSJ7OB5MOWzOk1dQ6kj67RNAw6+0WUmmhRsKbNXiQH4FzihI+XTKYN040imEVQCAfhrEIKWZIWnLMBD+jnNncoztC90qJN6EYNKB+zt6oRRxWhpegeDvv94RRgueSBUZNrikIrzUog+M3nvnqGb/Yy6BUNaKAEDHEvT11wsulh2SrfmxAYSJIYnSsqUB+BqyYqnSyNQ2N98HFI705aaD7SWhPKW3Onhc9nIQpyUdLapunDIfHYDa+BzNtg06osdy3SBzH2newQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=03Qtz1pn4sa2b1L7p/Hh8pnDUpzj+tfILsMm7l+2UgA=; b=dtrvy7latlpciMARj57nV3w9l4TTuJg5f+ifMZsuDRfIvzsQBCXfTO1JiCdYvtAFuWIFLZZsl7Mtnuq3e11P+IkONwyR7h0SjkfaTJg8IVKuUkRLXSvmA3n9p7dYgdPqWe0hHIeUcEFTcMegeaAYOzcO2Nfnv458Nf0qIt0TTd9FvDJUseTItRNz/E3BSxWSMsUyvbdYS+QMEyY/ZMigZaHKRv5jyXE9nFVGcfE4JWqkg8eziTTyMh9arzBoMeOb/N/VZTXS5EqHtSiPKLMPc8ikURvc7Z3bhWEUSfra4VE2KHElRPOyJUbf/sHmxWz5upZyNyR3gq9Oc60Hj4nyiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=03Qtz1pn4sa2b1L7p/Hh8pnDUpzj+tfILsMm7l+2UgA=; b=ASUqyIk7hLnck7ZjFT43wCA3gMJaCgvNPpzHOYe0xlLl1TWTLyNGTKJPmbsSR9pFJNdbjB4C4m0mDr+s/TgX/bcA7CBHsOgnsdVrOh0C+48nNIniChdF1swREExl8ONHEqKtNQ+QbjWWSWjfMlT/PEn+cW+DsShIgYCRY69h1E8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3681.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:15d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 19 Jan 2021 15:09:15 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:15 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 10/17] ethernet: ucc_geth: constify ugeth_primary_info Date: Tue, 19 Jan 2021 16:07:55 +0100 Message-Id: <20210119150802.19997-11-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb6c4303-0231-4c84-8538-08d8bc8c2f90 X-MS-TrafficTypeDiagnostic: AM0PR10MB3681: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:296; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: emJb5SdAik3/4v9/KZuZSD+72JdIyPV7Qgs5ArKC28/rFLJ6dq1btOxWlM9zT2l82reYlSGSdVBjkqPz5ltAhWBPI39pcQvA06Hgy7LlVQRudR0sM2CUTq+Bp0SsluFCWz7XyrqQnIPh1c3Xbupp/rnK3O0BJQMVv+OCz3fBk5I6ZnWkdAGrQFitfmPklRJ8hQPe18pBHcDnfWHdtG0QScTOSPL6vnWNQ70y2G/MRDxXUbzI6ZqxIjKkq/ccdT/sVb5FRdJ6EAJxZpPgfb8YkeAO7kqwyMSbzLQM10G4njMveHKfm48W6Q6rIA84alB0NZ9Hz+ifFFO2kUbcr0QghC0u2paLd94pR59sxGTKLGa5Dr0zjUV3TfxWuoJYU19FXsSInOgfXyjssNK2CexR1A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(136003)(39840400004)(376002)(8976002)(16526019)(6916009)(5660300002)(8936002)(2906002)(6506007)(66476007)(52116002)(66946007)(1076003)(83380400001)(186003)(956004)(6666004)(4744005)(6486002)(8676002)(66556008)(4326008)(54906003)(44832011)(107886003)(478600001)(36756003)(6512007)(86362001)(26005)(2616005)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: UtejaK43Z+9p0GHbD/8+rlQqYb67/xARTO1JKa3kOD5K9WTqhSpcRBKqaf/YcGTQj9uam3JIWa7PLWwqCqhdGSfkUVj2Wertix1KvMmQuZhV9VMrp3ptfgevv0+ZkSgFmZ1GaIJoGKcCaNgfxcSaTGkgSnZTUDGrDrjW+UUiH0ERKAyjO4cDv4DNg/L0+n7ul9le8Us+EZc7IWwqJde5bNZPUEziHISVbxPo27zc4Lv4B+XLGnCRZb09HNl10DxylPSP0rzvhPcuNf893XeeBZS1RowzBQ8/Y1orjmBnORKnS2UrPxstOhQfFeYDboz9zvrmNXnrcihMZq1A2/S8JPOxblSu3IdUaRjViVxjh069Gif6G5fnjYGrm/Hxaz+mStgjrxkmDuHgunrdPH1UMkKs0097jscN7nKGvDcRUea5biP6S36UDhkVWxmQuaWV5r7wvPXcBPOg1bmDU0nFRsvM1a4pMFpPZr8+sMXCBLaz6Kq3/8V20OIhbA6pjIOlhkBRtEHNUK5iiu5EEsaurfsfVcJojjjcfe5hNx7o/NNkwUCgAJbBj8zqLrz08mGN+TZm9UGHgaZn72z8MoE8tbqboL4PGuiURO9UXFu1mbpq7hWXEOScHFsJ29pF/Oo91MxffKX4dIKgOb4HPiZRZK5CnK6KuxbT7OskmQBq3t1BKvm+VGUsYKrk1TDIi6HoeWGyHSICnIH45P0k06vvJ+s0Ap4tJ3v4J5OEvjjrEPXlYOA/pByCscj14i/qyPf6UFIqoa3jEh5CDocFcpC60ppRQnuQj+p3DZU4rKbPc2RDjLJhriVVGja6Wn2DLbMUD0EroPF4Tpe0NE/6dEjubTSeKyV9vRtbSa74N6zv4/orsdX8iZE0m8/0ECPN4Q8sG0gB/flDiTqAx76bT0e9yr/jEeGqqaY/RyZHyghdvkPrIf/HHFhk3EPKxi8T89cwrS4WXHcVGQEx309Zq496qv6pElrE0t6GyITnxP+HcOfI21ogZfGWmkXt1pL4TCA1 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: cb6c4303-0231-4c84-8538-08d8bc8c2f90 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:15.5587 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: U0IBJel+GfamQfyfDvTR1M1fSQGhTr66Ee6PKTJmcBRP9RhXgoKK8MoiKkXvB5ywa5xQ/+I5K4HLXSRx6b50CYFg0Xpds3Yt2JHHgJHUMg0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3681 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 75d1fb049698..65ef7ae38912 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -70,7 +70,7 @@ static struct { module_param_named(debug, debug.msg_enable, int, 0); MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)"); -static struct ucc_geth_info ugeth_primary_info = { +static const struct ucc_geth_info ugeth_primary_info = { .uf_info = { .bd_mem_part = MEM_PART_SYSTEM, .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES, From patchwork Tue Jan 19 15:07:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030125 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 697B1C433E0 for ; Tue, 19 Jan 2021 15:20:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29C7022D2A for ; Tue, 19 Jan 2021 15:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389385AbhASPUV (ORCPT ); Tue, 19 Jan 2021 10:20:21 -0500 Received: from mail-eopbgr00129.outbound.protection.outlook.com ([40.107.0.129]:33614 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390945AbhASPLm (ORCPT ); Tue, 19 Jan 2021 10:11:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ByhpoXjq59CHK7wUyZ/KsNR7s0rsI8g8uyv8jN0Wn9s0ix5e892oUYjdIcHJY/zr2Ir0mhZZo++lA4/fqDtsWu5aYNQglmNBk0hOs60s5+IFMx3Ey9twjI0A3DRTmrK3WcQiEjyooe4deGE1uJmH9FK3P2gESFsHSGWjAmyJrGx4i7DnYjGksXH0POlc/rvefLReevQ9GxByCWvT7LqMEEM3VL3o4nMM04ZWHAtQnA1Z0hkZXjMOm5F9uc96ri4mHDGxiYC7aYG69+qz9wE+e89p3UywXTpXWQTZwYToRpr41l/F34WsigQYabBvSVEGNs/MYu8GiHdVUuU+fL2P+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SfTOF/9xR8KEyG4aELWQAscdgq/aPgCbf+M2MsTfIh8=; b=WyZbAlp+Wbpidv46ufxYj0cBRwUdDg4GO5RrMuZHnNAZmFo5npWFeDUCYfBTSMzWZHa+gqw4JW4bHB9eYg/VUHzPAL3roqfKohGPQ3wjp+bEmlIpIV47QIFUCKlPSAhStDzj194wUbGYwRpz1XjfdmqBx72+WvBnvsC5jZmf5ZOBLuz3ERyZpsIC9BPw8SCXM6MzCvK5ghTeqyaMsDFTZ0ynKUPkLzyf6vpOMgAFWgwUYfQA2PfFhsdPSMNwfEK6Z4DO5fi6sGU1gdo9Rt+oSvQ4plwJQRC8BhnFKaUk0NhZbTxP5Jf8zEIjWOuyzNMcT0g01GCooiEpuZzZjDlU8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SfTOF/9xR8KEyG4aELWQAscdgq/aPgCbf+M2MsTfIh8=; b=b+IFQ2nTjq+5g01DljC3Gz4K9DdIE9KWvcgyPSz5v6ek24mG2jYu4+jF0V0UUQsez2flYwH5263nBsVxqXKog8gGBj+jChv8Ya10uX62i44l7TvKf/3o/y0foIW4bYMdg35U1O8mbKqN/mP4WgOugqWjFO55UqzXALgw0ZIWU2o= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3681.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:15d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 19 Jan 2021 15:09:16 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:16 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 11/17] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info Date: Tue, 19 Jan 2021 16:07:56 +0100 Message-Id: <20210119150802.19997-12-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ca129ca-0a51-45e0-2774-08d8bc8c3034 X-MS-TrafficTypeDiagnostic: AM0PR10MB3681: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x/ycqqQGOhYZylGWNu035cwhADzt9bMVSB5zlXdbuvI8V32FsiNvtzNRLp21QwrWSH2EqS70J6uC7JdUX+ZFEavCHYCFrM2DR+cWSpd21ak2NMRI9qe2bhHbW7oaPrdKXEAorX57FCWa0sadJGWHETWmkTpmJaot9BWx+LBvbwgmv0zytJt+NiGjFrT0mxvv/0prUIhFyjM8Pj86o4HM+DgzNuhJKacuoCeujyWrmyhXLfK5kqySH83jUWjRojPZz8PPTRPhsFV+MQaiK9FkEvT9xfu/rOd5acX6uINWfRU/OrHN3T5M6ysX2BK0h/aeffxw7uUwkV8mGOkGM35ZzkLKNs40YzetOd/c/qvrkN7EnZPBXuYrd6tVBowkEEcsyCuqdFyPXZR4USCg87Zmng== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(136003)(39840400004)(376002)(8976002)(16526019)(6916009)(5660300002)(8936002)(2906002)(6506007)(66476007)(52116002)(66946007)(1076003)(83380400001)(186003)(956004)(6666004)(6486002)(8676002)(66556008)(4326008)(54906003)(44832011)(107886003)(478600001)(36756003)(6512007)(86362001)(26005)(2616005)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: ijxyhR3Kbb6mnmTzIRSJHffxpUOzYTZhSdSyyqbt0sGgBoZxtwgqGV7DpYTwUN8YK6HECBYU9vswOG6zl+iUGOIFBhoZRHcXr9YRLPsX6+/JPj+u72bmXyQdTHD8wpiINV0lo3/ZaFksQlW+vhx6Sp2pB0rd3NMnjooeFZQGdDgz2y91O/yEyIOgk3fY0W5lME7CxtjmdogAAl2A/F2+VYDgM2ZEv4C62pVWp2y/WAjwnuYwCNStkOmboC4/nPtitRZDWuO1fVe7Y0NWGKkWW4bpUeGvFyk+9zvFZnRjujC9W+YHE5psEkdwwBg2uxD1ULPAju7JEu21Zj8kK69QO1IV9lmGiq7yyIzoTbyj8XHYvaQYaJT1ih+3mv/pOJq3652SnALX2NkbEdHTsW2fGYKGuaR62+UMDKcdD2TcWb4U0IKEUQlOFXlYx9c3HFtv50cDdyW4eRof82vKC6jqQWbhlR4/6kLrkk58wLTogmezn20hguYfF4m7Ndb4NY5NzpVGosDFveWb2JeWrW9B4Kl2ziSt5iBGaTTlK5YcqZU6u127jcxnQ/nHfjcBQIo8MDIMpYNtf1M1Iog4VkPd2LyGdsxGzDwAyxlS/Ab/nOYYdJqETEOsnUTGPP9SfHajOfPXm2qUEX+0PYGIxr5c9wERpPsZrnNkM9zyzTXKrEaA9yDeiOuUiLnPsWMOfzRbb71OMc1rKfrm69ky91Jolu3MOfsSPjlnM+ZGfYxwacqqpaD9Ds3NUJ/gNMisWa+wRQAl6QH8lDVJMwAALkJJL3flVdb2GjntF6V2HrIt38Z4ltmH1G6CrIO+kuk1obJJlttOdbJ2G2Ya3jfn12rJ5Ds31mQ/CSoeiHqYlpQxX1ZHc4d/lvdFV2nsbiW4PAOYCU7JT3Px0aJq7gFZ/C7wrryI4/jte51GWxcn3fMdQ3AHLyFu5cgCKp/2gijqFW5IObGGdZY0hL4fUmOZ51tHebUwIAQSS8AOW+dPZbw/jP/xjwHLQyAYyAjGU8hPn4Fr X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 1ca129ca-0a51-45e0-2774-08d8bc8c3034 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:16.4991 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tA6wFh8zbo/OmbtdHqSnhBOtGodYaGn7bHoV7FTz/mLb7SBCOSJkxDZx9NZY39VJvC80A80CaOM8XYh/Bkr/NECfVWggkRbmnbMq//SUihI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3681 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org struct ucc_geth_info is somewhat large, and on systems with only one or two UCC instances, that just wastes a few KB of memory. So allocate and populate a chunk of memory at probe time instead of initializing them all during driver init. Note that the existing "ug_info == NULL" check was dead code, as the address of some static array element can obviously never be NULL. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 32 +++++++++-------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 65ef7ae38912..67b93d60243e 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -157,8 +157,6 @@ static const struct ucc_geth_info ugeth_primary_info = { .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, }; -static struct ucc_geth_info ugeth_info[8]; - #ifdef DEBUG static void mem_disp(u8 *addr, int size) { @@ -3715,25 +3713,23 @@ static int ucc_geth_probe(struct platform_device* ofdev) if ((ucc_num < 0) || (ucc_num > 7)) return -ENODEV; - ug_info = &ugeth_info[ucc_num]; - if (ug_info == NULL) { - if (netif_msg_probe(&debug)) - pr_err("[%d] Missing additional data!\n", ucc_num); - return -ENODEV; - } + ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL); + if (ug_info == NULL) + return -ENOMEM; + memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info)); ug_info->uf_info.ucc_num = ucc_num; err = ucc_geth_parse_clock(np, "rx", &ug_info->uf_info.rx_clock); if (err) - return err; + goto err_free_info; err = ucc_geth_parse_clock(np, "tx", &ug_info->uf_info.tx_clock); if (err) - return err; + goto err_free_info; err = of_address_to_resource(np, 0, &res); if (err) - return -EINVAL; + goto err_free_info; ug_info->uf_info.regs = res.start; ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); @@ -3746,7 +3742,7 @@ static int ucc_geth_probe(struct platform_device* ofdev) */ err = of_phy_register_fixed_link(np); if (err) - return err; + goto err_free_info; ug_info->phy_node = of_node_get(np); } @@ -3877,6 +3873,8 @@ static int ucc_geth_probe(struct platform_device* ofdev) of_phy_deregister_fixed_link(np); of_node_put(ug_info->tbi_node); of_node_put(ug_info->phy_node); +err_free_info: + kfree(ug_info); return err; } @@ -3893,6 +3891,7 @@ static int ucc_geth_remove(struct platform_device* ofdev) of_phy_deregister_fixed_link(np); of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->phy_node); + kfree(ugeth->ug_info); free_netdev(dev); return 0; @@ -3921,17 +3920,10 @@ static struct platform_driver ucc_geth_driver = { static int __init ucc_geth_init(void) { - int i, ret; - if (netif_msg_drv(&debug)) pr_info(DRV_DESC "\n"); - for (i = 0; i < 8; i++) - memcpy(&(ugeth_info[i]), &ugeth_primary_info, - sizeof(ugeth_primary_info)); - - ret = platform_driver_register(&ucc_geth_driver); - return ret; + return platform_driver_register(&ucc_geth_driver); } static void __exit ucc_geth_exit(void) From patchwork Tue Jan 19 15:07:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030167 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 724A5C433E9 for ; Tue, 19 Jan 2021 15:33:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E9D52312B for ; Tue, 19 Jan 2021 15:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391410AbhASPdl (ORCPT ); Tue, 19 Jan 2021 10:33:41 -0500 Received: from mail-eopbgr60117.outbound.protection.outlook.com ([40.107.6.117]:28545 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389305AbhASPLQ (ORCPT ); Tue, 19 Jan 2021 10:11:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ELSmdjscpdxh9S0O4gk2Fe5sQEDSwYuvobMkX1MxmfkLBsbspsSaUEE3fmZObPCXweSEAxUTbp8ZZ2Y8egd8QO+fnwlQga7YEH/l7qXXFryeknrI4Ox6NgZ7lGYPDX96b8Ce8z4g/mFSGdBEzQC9AM5m/CXrwuNUDS6Ea/99R18wxCJ/62A5i3mBNTtDxF/O4tUKX7fbOtTZ+fI+axEwUm0EQIHS9+ab1eYXUS2jeYlDAS90Yj8nLxRd6FecPmK2a39YpNlsJ/E490+TUlsq9euUcKu6GQ4ZrZKTuxXAmKoY+XD8F9BXuvHgmzZWlMrCWfQf0csgpQdjexNvMrRk+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fTUqxgU+jZblnI01UQpiUO5A6doOPu4IclqFIZSQiZE=; b=aTPyUBVkuAvUx1LNT4IgrZjzckgXjzLYrbIXuaWqFZEdxvhMTraVpw7RcXEXzcz0IqE0dsqW47iQiRvujDB4Wo3qaxF9lrwegg6Kf9EeCwSMT8qhEkYNyb87G/5h3vR3KTsiGjtB8yN/QTHHVrpvM85xs+F1OR/zV4OLZ8LrFoxlhcvbR3MrkFbh6gWK8rOPF81ZfO2vffo4laitTurgNGHHObgq99+5nTfnr8jNmcrseCFIt47OTsJjheLU9Aa7WmOFljH1MbV6TNdgrpCe/sKTbII3wehijEBfvrVpaym+L6E7G9J1e2++cZaTe6Y3ZJXxNSkEWnFVsj5L5SuueA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fTUqxgU+jZblnI01UQpiUO5A6doOPu4IclqFIZSQiZE=; b=awWDApkHQpZgxE6nMHJO8lCvTirOwatAMKIPYTh4J+c78EyGym46b4lA0hL3kWPfCsIWXg3me/TynfZk+XgzfjIqOVFQnwfsiZw3v6zbIRllblyH/MMHyo6fNQqUifXWbpG+hVQIyCmRgE33t/Pv6NvpL1N8Nu36VbgAlU+k2vQ= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3681.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:15d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 19 Jan 2021 15:09:17 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:17 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 12/17] ethernet: ucc_geth: use UCC_GETH_{RX,TX}_BD_RING_ALIGNMENT macros directly Date: Tue, 19 Jan 2021 16:07:57 +0100 Message-Id: <20210119150802.19997-13-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f63e2583-15c0-4b9f-f3de-08d8bc8c30aa X-MS-TrafficTypeDiagnostic: AM0PR10MB3681: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UKX4eM4jo+StN+mIMWP2w255A0pWpGJcnfjvigPbwRVmMckrDKFdkYaGuYTU0R2P1KsHE7ndQFPeYJSlirPs84xHuNQfGnE71dCD/VIEHqysyYII0nW2j4CAnXHFOqtBEkVQEYESfwE7QIromizvEKoV8TmyO92sVUaEJUW1QO2VheABEn1+Cld5DMoQNK0NA7jIzdGJB+8dbcmO879ncfSrALdLxiyURCyeACUTGWaBsIwa4qDLpUzltC2+ePn85TyxbviKzBxlB8aizuhzJW9WXSlp0YxXPA5c215iGRE4d/Xi/gr29FPaqfvQ3fgxAkpxTxGhvS/J5XeiE1TMlR+2ff1phM0OBKox/SNj0F/DEvxuf2AmVIaNvkP984uuAt3L7AJ/eEG7+Ghfbas0lA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(136003)(39840400004)(376002)(8976002)(16526019)(6916009)(5660300002)(8936002)(2906002)(6506007)(66476007)(52116002)(66946007)(1076003)(83380400001)(186003)(956004)(6666004)(6486002)(8676002)(66556008)(4326008)(54906003)(44832011)(107886003)(478600001)(36756003)(6512007)(86362001)(26005)(2616005)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: dg7g3Y80ENQBTSxl25NfPTsWZfPwyK3aeRc7p4hNZNE83Fzn8YZIH5B3eiUJBATUx4rcumUjQpyeViQ7T78cSa/xPTCNUhGm9L7QQxbBcQbBRPppvRNmUVe8+alExqcL7SvHlwn9dVHWSQsPDJgvh8NZTesDWHkq85CtCJPSD5kTtRP4iT1LW0FRRABnK0X+VsnU0w/eQ7qQnzILNKWCcSG/VHCwboY5s6dWKRseglzrfcvx5q/yIFfaLYz7IHF9JT5Wbtid27O5WCzXTAx2+A5ea2jRcnps1CSklojMNrSfwEy7uRafogQemf1WlJ6XkIP1eqRxfR6Jz9QiasNjEcg2PPZMjLuTTkhs3FMnxsb93vmeUoog/IdUpC9/c2R0jYe7x4bho8PnaUCTTZlQ9INnZhR7TvIijkkj7xzy37E1qD5YUudlGxP/Xsv0ACAeAT8otBUtRWBJrmd1TF5vwYB+c62HDE0kI/7Mbk6MiMy0/3Ks0w+Rj1xsEOTkhkw5W7XdwRmHRv4ncF+uKMGgvRyDzaaS8cAk7hTzoYol30vmzQl1udy5IduGms8xUB1XSRQEdgMti/sRvyhSsw/CVCmKRFZjEzwSt2IpuLQ8ptTFCnpBHzbWPwUBdivhr9H5THdNb72/dmqnGgAtwVL7oeC87Z2dZIJ/1LL9GdkM7DOrBYnDpvcqnLXeyCCSXWK0nshSjV3THYQCjT4U60c3BvG1iSyioj3IRCx3BiZDcOjL0ZfBWTYBz6x/qg/tJsCO/HJLGdMy1n3ql+a//5545h7sNV74mhMjocPC7BX38FR3Sz972wsn7kHy1mY1clP6CZLyRzBFcEHZf8OCbqBQJoY1cnO+7L58xB26ZLQajSlngnQ+IRbVgVx13ktBXfMway02w3j0N6cG4NGI8phXBHLecA3OCMwKBmNvX6+ipV9jszCvxlNAW6YU6e5hbjCBMeVU/EDn8/E0T2oHcBWBIFvea8SXf7s+3BgDXDrFNhU9OYJYOW8tur+gXUun7zTk X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: f63e2583-15c0-4b9f-f3de-08d8bc8c30aa X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:17.4116 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oRAoBUYucABVuyv4RuLekHfWPK3nRER3mMAGmwfNg35IZqi3D2gRWIbmev5E0uQY8kLGKA1etISwUQj+10IUHXBBg3hw3fla6a5Q3EvooWs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3681 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org These macros both have the value 32, there's no point first initializing align to a lower value. If anything, one could throw in a BUILD_BUG_ON(UCC_GETH_TX_BD_RING_ALIGNMENT < 4), but it's not worth it - lots of code depends on named constants having sensible values. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 67b93d60243e..2369a5ede680 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -2196,9 +2196,8 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { - u32 align = 4; - if (UCC_GETH_TX_BD_RING_ALIGNMENT > 4) - align = UCC_GETH_TX_BD_RING_ALIGNMENT; + u32 align = UCC_GETH_TX_BD_RING_ALIGNMENT; + ugeth->tx_bd_ring_offset[j] = (u32) kmalloc((u32) (length + align), GFP_KERNEL); @@ -2274,9 +2273,8 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) for (j = 0; j < ug_info->numQueuesRx; j++) { length = ug_info->bdRingLenRx[j] * sizeof(struct qe_bd); if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { - u32 align = 4; - if (UCC_GETH_RX_BD_RING_ALIGNMENT > 4) - align = UCC_GETH_RX_BD_RING_ALIGNMENT; + u32 align = UCC_GETH_RX_BD_RING_ALIGNMENT; + ugeth->rx_bd_ring_offset[j] = (u32) kmalloc((u32) (length + align), GFP_KERNEL); if (ugeth->rx_bd_ring_offset[j] != 0) From patchwork Tue Jan 19 15:07:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030161 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69795C433E0 for ; Tue, 19 Jan 2021 15:32:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CD802311C for ; Tue, 19 Jan 2021 15:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391247AbhASPci (ORCPT ); Tue, 19 Jan 2021 10:32:38 -0500 Received: from mail-eopbgr00122.outbound.protection.outlook.com ([40.107.0.122]:51363 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390780AbhASPLY (ORCPT ); Tue, 19 Jan 2021 10:11:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fL6nQi461DXeptF92jZIpccIdwtMdLi5nrd1WLgkeKpd+6q+6XraCffz1CAHFKF4dqDDiePQF5jWEGxVS+eV18csh1gy0RL9nTkOIWhSI6Cw7GdemQL9i4GOY/H+jFQEBSmGU40KDBPt6299i4gxNg/BcnUU7KwUHf9YwMoOP4R9mbrlYdA29gv4lYxDt1clPNbiPizd+AXnxTXoyQD33T+sbJNJxkLItfQZyANauHMKU/0hub0XlDRXwcZqnkHw1p2zYWe/MIGpEkQ0XjLG8EF34rtc1AT88uJpjV0ZaClwxNEXO5XcOLx3qL+G+cokXJy2pjwdbzFB/H604WoDTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=53WloqEftjTso8n6LOUssnNHPN+5CSNcNAFZ7ph53Wo=; b=PiFzEStpfZhPPOm0nGsPR6zqJoKdWN59npKjzE2f0wPRwfbPJKkh2ER2T72oB1i+gYe+kL/kell08127J51By2+TKD51gL7fydpL0bpye024/khAnygGm/MPYmylJcjeS2fbV7Rfkl6ToFyizklZYAFU435PmuuePC9/PaCWcdEG1KX1FLFMNO9fEk8BQ1A3nU462Qogt2KQtLQyYxKYpGzQNQy3//StYXdUrNICyZpkXdYlRwNYiKB89FCeBvnzuNRrX9wuMeVeqcRB8GDXe0tRf/ro9qJ3DGLFJ+P8n8ClPaxZKZtYKiVjjjud19B0kD77AcsCDkU/htaRF2sI4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=53WloqEftjTso8n6LOUssnNHPN+5CSNcNAFZ7ph53Wo=; b=ecdRkVqLamb/+AEmfYxLWgE7Qh95OpavIZ60JeDXFrNXApUpz4o39hYvVkCOikXcL263RyzcyOhncSWDtxdqiTmxtBWJ4Kar4GP9H9mJTP90f4mttyoIn1NMvHRkSaWQ28r0Pnepe3c+XAljeSiDezwdbToqT1mVHUe09taReFw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB3681.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:15d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Tue, 19 Jan 2021 15:09:18 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:18 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 13/17] ethernet: ucc_geth: remove bd_mem_part and all associated code Date: Tue, 19 Jan 2021 16:07:58 +0100 Message-Id: <20210119150802.19997-14-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fce7fbc2-da17-4b74-8bcc-08d8bc8c3127 X-MS-TrafficTypeDiagnostic: AM0PR10MB3681: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FuYlgs4D1rbQVybO1vL3D2x6ZpvwE5OA2DZfNMptB4/ewLgnSW/z4+Qo7pr3TSSoD+UmF+kCBcqW2ncPMg8CpfE29DQxWggtLBH4PvdaEPF2XUX26W5EMB3mVYVe01mFNxGqCoJRz3DTdaOXR7rSagADau56IZf/HWyk2v18hx56ecmICZQCffSD9FUEnqefKnNUMZBjOY7sbBB04yHq6NP9Mw1923Vke8iy9pNoaGfFvac/5eNo6qpDgcA0LdeCms1upRwGnzBA+q+SNKpmdc/1zGdfQVb0FIW11dOIzw5y32dCEEt5prb+MVZ7S/+gv3jnTw1W9rGQsCdvTvRJ0bAC0xoEbLPHx8j29oFLs2+Yxm5crYjm5qqvwIcCOnvYT8IDYyh+GyQ1f8P8+fm2yw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(346002)(396003)(136003)(39840400004)(376002)(8976002)(16526019)(6916009)(5660300002)(8936002)(2906002)(6506007)(66476007)(52116002)(66946007)(1076003)(83380400001)(186003)(956004)(6666004)(6486002)(8676002)(66556008)(4326008)(54906003)(44832011)(107886003)(478600001)(36756003)(6512007)(86362001)(26005)(2616005)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: jZm/oawP2j1sHXuj5cKYL4wcllSdEjDlbsQ9Yp7SuCpz3mi3gN77X0SAGOb9QKlY5xJnMtNPeyDTnOk0ue6Eu56bIopcsqt/Hqk4Fp8FicoscKzsb1vOy/FdkVfqY/XPtNg8vA35OROC42n/FjHKYUcL/mxhPYOuaHmp/SIrHESCcn5zjUNi0qveqpLD1+dWohDEmkGv8MruUOBUQdPfXT6mo3821JazI7oEu83QfEHKlFuYF2bH8ho0RTWnpp9dLIF6lOjZ9b7A7pZbIr91e7KzIobW9o0RGQmT/xRQF2TpgE4urdoDrqFOuJZipq0YgZHXgBGIsiDjk3MumeXzndgzdZEoBq8I0vdwjxB4KwJqyemSJcaM4xGgYWxOlwS85nDlBFDHNgcoGLUX/mQIk3ZEHa8gAdZnos4u3I3DHH+WVbv/Qkg9BgeHrEbOHtHAwHkAIIsbotgE3tbomyVDVoOqo5K5zNSYYcNgywjCU7dHTQZO7F0lhghetUKNO3+w3Sepp3t2gN630589BgCnFq3r47+siKokMnEDXChJnLIyo9hEosnkCjxbCopzwqqP/ro/u6zK59JOtrcs/bEBKLvOA5+vF0ebPvnsT0Oksotytjoz42Pb3HAB6FdA7AWZCzh8uDzTraDLsukfyfxUaseQ3AOWNhP/S1TTi6fQm5Z6JuPDk8idONq5BrUCaG2Lei2e4FVVGkG/vipp4r3KeAd3nBRjlee8n39Z4LJxZWn1q9sEkUBAHbJX/Ba3xQpZZV/CVYtoVb9EwcHiTs2tzYZTtrxhRNah7DBcmuwx2Ljf2c+fH7Ac2MXtQ0VgkEydOkG82v6Dv3bR25Scip2s+isUNJJGdl3PuYdbd1TwJNeyiYS7gGzxAKolRY7Qp3faH62OBKrROTZdLEykb8/lYk1cAuwkCzOOi1gZ0rVHjEiiLKKxJD3RREtjCiz6kcstF3/1EO/6lpGi7y8nOejXjpC7/+lOvyBWjxlms4TBsiuPDufN/60XdJEX7wkmQrFW X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: fce7fbc2-da17-4b74-8bcc-08d8bc8c3127 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:18.0972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Fc3SQLgTZd+hBzA1JiLAh4rYpUhCR+K9D7OvgS8B+A875MnDKlLJhccQCJHIrl/ImgTKKB6VzldNoezjWy/w/3PgT6QyjMqRxx+/3VRl9gU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3681 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The bd_mem_part member of ucc_geth_info always has the value MEM_PART_SYSTEM, and AFAICT, there has never been any code setting it to any other value. Moreover, muram is a somewhat precious resource, so there's no point using that when normal memory serves just as well. Apart from removing a lot of dead code, this is also motivated by wanting to clean up the "store result from kmalloc() in a u32" mess. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 108 ++++++---------------- include/soc/fsl/qe/qe.h | 6 -- include/soc/fsl/qe/ucc_fast.h | 1 - 3 files changed, 29 insertions(+), 86 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 2369a5ede680..1e9d2f3f47a3 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -72,7 +72,6 @@ MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)"); static const struct ucc_geth_info ugeth_primary_info = { .uf_info = { - .bd_mem_part = MEM_PART_SYSTEM, .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES, .max_rx_buf_length = 1536, /* adjusted at startup if max-speed 1000 */ @@ -1854,12 +1853,7 @@ static void ucc_geth_free_rx(struct ucc_geth_private *ugeth) kfree(ugeth->rx_skbuff[i]); - if (ugeth->ug_info->uf_info.bd_mem_part == - MEM_PART_SYSTEM) - kfree((void *)ugeth->rx_bd_ring_offset[i]); - else if (ugeth->ug_info->uf_info.bd_mem_part == - MEM_PART_MURAM) - qe_muram_free(ugeth->rx_bd_ring_offset[i]); + kfree((void *)ugeth->rx_bd_ring_offset[i]); ugeth->p_rx_bd_ring[i] = NULL; } } @@ -1897,12 +1891,7 @@ static void ucc_geth_free_tx(struct ucc_geth_private *ugeth) kfree(ugeth->tx_skbuff[i]); if (ugeth->p_tx_bd_ring[i]) { - if (ugeth->ug_info->uf_info.bd_mem_part == - MEM_PART_SYSTEM) - kfree((void *)ugeth->tx_bd_ring_offset[i]); - else if (ugeth->ug_info->uf_info.bd_mem_part == - MEM_PART_MURAM) - qe_muram_free(ugeth->tx_bd_ring_offset[i]); + kfree((void *)ugeth->tx_bd_ring_offset[i]); ugeth->p_tx_bd_ring[i] = NULL; } } @@ -2060,13 +2049,6 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) ug_info = ugeth->ug_info; uf_info = &ug_info->uf_info; - if (!((uf_info->bd_mem_part == MEM_PART_SYSTEM) || - (uf_info->bd_mem_part == MEM_PART_MURAM))) { - if (netif_msg_probe(ugeth)) - pr_err("Bad memory partition value\n"); - return -EINVAL; - } - /* Rx BD lengths */ for (i = 0; i < ug_info->numQueuesRx; i++) { if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || @@ -2186,6 +2168,8 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) /* Allocate Tx bds */ for (j = 0; j < ug_info->numQueuesTx; j++) { + u32 align = UCC_GETH_TX_BD_RING_ALIGNMENT; + /* Allocate in multiple of UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT, according to spec */ @@ -2195,25 +2179,15 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) if ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)) % UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; - if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { - u32 align = UCC_GETH_TX_BD_RING_ALIGNMENT; - - ugeth->tx_bd_ring_offset[j] = - (u32) kmalloc((u32) (length + align), GFP_KERNEL); - - if (ugeth->tx_bd_ring_offset[j] != 0) - ugeth->p_tx_bd_ring[j] = - (u8 __iomem *)((ugeth->tx_bd_ring_offset[j] + - align) & ~(align - 1)); - } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { - ugeth->tx_bd_ring_offset[j] = - qe_muram_alloc(length, - UCC_GETH_TX_BD_RING_ALIGNMENT); - if (!IS_ERR_VALUE(ugeth->tx_bd_ring_offset[j])) - ugeth->p_tx_bd_ring[j] = - (u8 __iomem *) qe_muram_addr(ugeth-> - tx_bd_ring_offset[j]); - } + + ugeth->tx_bd_ring_offset[j] = + (u32) kmalloc((u32) (length + align), GFP_KERNEL); + + if (ugeth->tx_bd_ring_offset[j] != 0) + ugeth->p_tx_bd_ring[j] = + (u8 __iomem *)((ugeth->tx_bd_ring_offset[j] + + align) & ~(align - 1)); + if (!ugeth->p_tx_bd_ring[j]) { if (netif_msg_ifup(ugeth)) pr_err("Can not allocate memory for Tx bd rings\n"); @@ -2271,25 +2245,16 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) /* Allocate Rx bds */ for (j = 0; j < ug_info->numQueuesRx; j++) { + u32 align = UCC_GETH_RX_BD_RING_ALIGNMENT; + length = ug_info->bdRingLenRx[j] * sizeof(struct qe_bd); - if (uf_info->bd_mem_part == MEM_PART_SYSTEM) { - u32 align = UCC_GETH_RX_BD_RING_ALIGNMENT; - - ugeth->rx_bd_ring_offset[j] = - (u32) kmalloc((u32) (length + align), GFP_KERNEL); - if (ugeth->rx_bd_ring_offset[j] != 0) - ugeth->p_rx_bd_ring[j] = - (u8 __iomem *)((ugeth->rx_bd_ring_offset[j] + - align) & ~(align - 1)); - } else if (uf_info->bd_mem_part == MEM_PART_MURAM) { - ugeth->rx_bd_ring_offset[j] = - qe_muram_alloc(length, - UCC_GETH_RX_BD_RING_ALIGNMENT); - if (!IS_ERR_VALUE(ugeth->rx_bd_ring_offset[j])) - ugeth->p_rx_bd_ring[j] = - (u8 __iomem *) qe_muram_addr(ugeth-> - rx_bd_ring_offset[j]); - } + ugeth->rx_bd_ring_offset[j] = + (u32) kmalloc((u32) (length + align), GFP_KERNEL); + if (ugeth->rx_bd_ring_offset[j] != 0) + ugeth->p_rx_bd_ring[j] = + (u8 __iomem *)((ugeth->rx_bd_ring_offset[j] + + align) & ~(align - 1)); + if (!ugeth->p_rx_bd_ring[j]) { if (netif_msg_ifup(ugeth)) pr_err("Can not allocate memory for Rx bd rings\n"); @@ -2554,20 +2519,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) endOfRing = ugeth->p_tx_bd_ring[i] + (ug_info->bdRingLenTx[i] - 1) * sizeof(struct qe_bd); - if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) { - out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base, - (u32) virt_to_phys(ugeth->p_tx_bd_ring[i])); - out_be32(&ugeth->p_send_q_mem_reg->sqqd[i]. - last_bd_completed_address, - (u32) virt_to_phys(endOfRing)); - } else if (ugeth->ug_info->uf_info.bd_mem_part == - MEM_PART_MURAM) { - out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base, - (u32)qe_muram_dma(ugeth->p_tx_bd_ring[i])); - out_be32(&ugeth->p_send_q_mem_reg->sqqd[i]. - last_bd_completed_address, - (u32)qe_muram_dma(endOfRing)); - } + out_be32(&ugeth->p_send_q_mem_reg->sqqd[i].bd_ring_base, + (u32) virt_to_phys(ugeth->p_tx_bd_ring[i])); + out_be32(&ugeth->p_send_q_mem_reg->sqqd[i]. + last_bd_completed_address, + (u32) virt_to_phys(endOfRing)); } /* schedulerbasepointer */ @@ -2786,14 +2742,8 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* Setup the table */ /* Assume BD rings are already established */ for (i = 0; i < ug_info->numQueuesRx; i++) { - if (ugeth->ug_info->uf_info.bd_mem_part == MEM_PART_SYSTEM) { - out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, - (u32) virt_to_phys(ugeth->p_rx_bd_ring[i])); - } else if (ugeth->ug_info->uf_info.bd_mem_part == - MEM_PART_MURAM) { - out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, - (u32)qe_muram_dma(ugeth->p_rx_bd_ring[i])); - } + out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, + (u32) virt_to_phys(ugeth->p_rx_bd_ring[i])); /* rest of fields handled by QE */ } diff --git a/include/soc/fsl/qe/qe.h b/include/soc/fsl/qe/qe.h index 66f1afc393d1..4925a1b59dc9 100644 --- a/include/soc/fsl/qe/qe.h +++ b/include/soc/fsl/qe/qe.h @@ -27,12 +27,6 @@ #define QE_NUM_OF_BRGS 16 #define QE_NUM_OF_PORTS 1024 -/* Memory partitions -*/ -#define MEM_PART_SYSTEM 0 -#define MEM_PART_SECONDARY 1 -#define MEM_PART_MURAM 2 - /* Clocks and BRGs */ enum qe_clock { QE_CLK_NONE = 0, diff --git a/include/soc/fsl/qe/ucc_fast.h b/include/soc/fsl/qe/ucc_fast.h index dc4e79468094..9696a5b9b5d1 100644 --- a/include/soc/fsl/qe/ucc_fast.h +++ b/include/soc/fsl/qe/ucc_fast.h @@ -146,7 +146,6 @@ struct ucc_fast_info { resource_size_t regs; int irq; u32 uccm_mask; - int bd_mem_part; int brkpt_support; int grant_support; int tsa; From patchwork Tue Jan 19 15:07:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030121 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3564EC433DB for ; Tue, 19 Jan 2021 15:19:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF5FD23119 for ; Tue, 19 Jan 2021 15:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387843AbhASPTP (ORCPT ); Tue, 19 Jan 2021 10:19:15 -0500 Received: from mail-eopbgr80120.outbound.protection.outlook.com ([40.107.8.120]:49294 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390928AbhASPLn (ORCPT ); Tue, 19 Jan 2021 10:11:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aAx+QCHGYLN8m0Q2z13d+vR3k/uK1iiKnkwFP/Y1IguF3oMIXyFqmFQJXbY783uIa9ZO0XNGD1WRhxetBEOLyfm8cycLcEPsaJfLCT7E5p88jeFdCdbCo60cWLa3/lhsJgpUDH4f/wRFtPpctAB1xlROrUvBdDgKMK2Yp5EYpuVHKN9QmE28mlUZG2gOGIXb3X6HSvVZ0ER2WNhfIYigsLVkFF6t2laFzD7ThYhNMPHE0OU3jkysVpi49PHWG4JSyEEcPUdFLznRT7oyLQ9zAVbyMoajv6xFlRMj2ZuuIdLLnKb98brtDXuCscxpAGnhVV6ls/qNP5ffX6d+4BSwXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJ3XRP0oKsSG7l14/Pwn6UoRvn87pRhIvThvNy5H3Eo=; b=b3RzfTyEJNjzUMUH1QIxVTLfG7XBH728k8w84ONVwLNhA3H+/FIh/lCL7Xe0WC/uFj3VPTD6gDcTmMg29lp+E/rT0J9LbHhwMHJ2dJy29hf6d9xCpV8oImwdrwepxy41nzT2MAFRvkoAqKLu+YQPK9dMTZxd448POs1R1+jAhEwxcx93IveC37OCwKoHafEqzuNAzMJdhL0tCpU7GelTHSUMrGMipFDWeot8pNnRFQdNYQlwgaHUIpiO+WA9V8yNpOGmBpuOeJh74nThTR/UXJNVsp62wJzWAiyZ0kCT/Rlvm1t1LW/8UTMvifRZQLfPl2yf2RhVx/MbNfl57BmNiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJ3XRP0oKsSG7l14/Pwn6UoRvn87pRhIvThvNy5H3Eo=; b=GIKfvKyZMXBnotnW3yIQFv6MyF27HDCjEph9cQ5oFjxWrHr2QpMpMYjs3BMylXK5q+McFY3ZXeHLjrqTL1swH2ax75nvo99B2V0kwYCYKAYXZ2vQCFYPayTIaB9Ws52vN1Nb32+YoKSl9hotNhkSMnHx96uhF1dc0yWfJSMfg64= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:18 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:18 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 14/17] ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc() Date: Tue, 19 Jan 2021 16:07:59 +0100 Message-Id: <20210119150802.19997-15-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f39978d5-5d9a-4912-4ca3-08d8bc8c3189 X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VYWBJEVsc5Xm/8aqFd8blE2UybG97EotXl4NkA2bSp3MR3cAu+3cCLyiz5jdgx8LmMSYWKr20eu0RFyjTXVvJciEfGKYtdv2Q9sb5Aqs5V6FfQnjnPBdwXh5HS3zJmLoFAIcoM4xWMxDS83oL5m/5p+5noPvpjtp0f5AR3HbIVAjzAmbMs7ooNG5BGLsEW2VRy4lcHc6MHTjcTUzag66lTG9QNcfARFxf3qp3CgFYZEr3/HSE4mYDfjtxQji2IwSVI+lUFxHo4TFP6tYlFEGTCFrP3IJTzaoxLNIRH3+HSQPaxjWBy23UH9+ck0ZEOoS4ljwLAqJCQcbtyPk1ux8bQ+Uqg1A/bar590RQe9edfrLf4zo8fo+lVnjoTGf8uF5c29BtcQe7+YZvY0fe5b5lQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: iZI3PJwMkuG5/jFejZSnL/P8ubhjB+vGYHWpo/H3czlDE43KXvLsg45yeKWgYrIV7x7WFpCkjq/ju+ZbLm6CRAmgcwk/U/5dLRRQ9IHOjzWcG2jzPbi9Emt4UTH6N6xrJ1GOR1rUJPJlmfrhzWlJkj6hYcOHewkxJfA4H1pRzN5Uo6WcMLBewokh5zOWXchDKWGs38FusU99jxswmGcINPX3sCvkKkvCgheQn/UzKfa2WMHgtjLJZUM/yD/yOQkNEfywiq8bXcQZowVNGLM/60SAOq1wNW0yjYoJKsAnqv82RdpJTGpGUzGD+2T8etmiiQXIK8TQhf7maAq76RvEFAIojiv+5UCvbg/6g+vWpUCFJth5kCCzpadNPi9lzWsWqZNiQ1NtqxLjucWW4W67628ZmcuXzxMNmfVCMpHkPbWWnco0Bv3sQGVLKV5Pab6JfRpZtPLy1PtcnTUk8mb5hNNtVg+/PF8eNIQHsBmr5qJeaZuS8OJZDMnqUDJ0Kig76DFmsVzhLwfBfxrYXFkHlkVSvHliBUI9M1T7gMI8Sd9Y+LF4ixwLm6B8uwh75xy2OOoKlRdREEOwmTPIr/daJ7uNNKDorPjiH79kSlJ73HC2M2OasCn/LZBNMq90rXTnF+vFmH2fA4YGUNnvA7MPqQcyfjfPN5uV0FIY98pulE/6Luds45RBISoDZI/V0gVmckBR2K9jIuZ8HMeo/vLb+8o7Xd6BlZ3AEAZbcnByn6pAGG47wHwEZf3FMo1dpXWFxhS6yNW5QevcZB/seg6ExjyBqxNBGuoFP3Un4VxCSlLbxpaAnP5U8+kIa1GrwGP6oL00oxg0rcYDp/xWcXC2Lt1OqvzsMUGEdt1Zv7pJ/IJ9mNjE5IkryTVL4lDutBgrVm8JyAMyg1CDoyZiZph6o4dBG6I7xPl81mNXQHRHFNCJYqf1FMI0Tb+J841KVim+3BaBLY8Vgz9ZBXA23lD9vebbcbMWcoBL4th7ZXTlc/JLD7tFaZZLzl2fMlLzusux X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: f39978d5-5d9a-4912-4ca3-08d8bc8c3189 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:18.6849 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jKmH0+wkd8BrZSpkHvov17Y8K+LRdr0anv6e9UwCa0eWPprnZlBhojtDl8+TcweVu0Vl1HJbfCMeytCDg+zuT/BDU2RvCeb4+aje/cZWBc0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 1e9d2f3f47a3..621a9e3e4b65 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -2203,8 +2203,8 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) for (j = 0; j < ug_info->numQueuesTx; j++) { /* Setup the skbuff rings */ ugeth->tx_skbuff[j] = - kmalloc_array(ugeth->ug_info->bdRingLenTx[j], - sizeof(struct sk_buff *), GFP_KERNEL); + kcalloc(ugeth->ug_info->bdRingLenTx[j], + sizeof(struct sk_buff *), GFP_KERNEL); if (ugeth->tx_skbuff[j] == NULL) { if (netif_msg_ifup(ugeth)) @@ -2212,9 +2212,6 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) return -ENOMEM; } - for (i = 0; i < ugeth->ug_info->bdRingLenTx[j]; i++) - ugeth->tx_skbuff[j][i] = NULL; - ugeth->skb_curtx[j] = ugeth->skb_dirtytx[j] = 0; bd = ugeth->confBd[j] = ugeth->txBd[j] = ugeth->p_tx_bd_ring[j]; for (i = 0; i < ug_info->bdRingLenTx[j]; i++) { @@ -2266,8 +2263,8 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) for (j = 0; j < ug_info->numQueuesRx; j++) { /* Setup the skbuff rings */ ugeth->rx_skbuff[j] = - kmalloc_array(ugeth->ug_info->bdRingLenRx[j], - sizeof(struct sk_buff *), GFP_KERNEL); + kcalloc(ugeth->ug_info->bdRingLenRx[j], + sizeof(struct sk_buff *), GFP_KERNEL); if (ugeth->rx_skbuff[j] == NULL) { if (netif_msg_ifup(ugeth)) @@ -2275,9 +2272,6 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) return -ENOMEM; } - for (i = 0; i < ugeth->ug_info->bdRingLenRx[j]; i++) - ugeth->rx_skbuff[j][i] = NULL; - ugeth->skb_currx[j] = 0; bd = ugeth->rxBd[j] = ugeth->p_rx_bd_ring[j]; for (i = 0; i < ug_info->bdRingLenRx[j]; i++) { From patchwork Tue Jan 19 15:08:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030119 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4921EC433E0 for ; Tue, 19 Jan 2021 15:18:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0BC5023110 for ; Tue, 19 Jan 2021 15:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391021AbhASPSt (ORCPT ); Tue, 19 Jan 2021 10:18:49 -0500 Received: from mail-eopbgr80109.outbound.protection.outlook.com ([40.107.8.109]:4165 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390971AbhASPLt (ORCPT ); Tue, 19 Jan 2021 10:11:49 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSvfEnnkciKyJErufzbKLAPUL07u2WDK85rdMRRuGlUd1HOKx03xDRS7wY7KMXRSbO24WtORLURbRFUQ+VGy4jI/go8+UpB5aiNgSBBa4I4l2GryZ3m+/3u5nOIoVyJ7VA6TJfMHIPiFdQO82CzU1RyFbgzQVzVZcLUgssgcHnprJzzPVf1qWZjtPiDL4JaO5Be6EERQLCstTxOrD/1h0dj8j2zftPZJj7IOJFSncDdycprPdcj75j7iMHCtRf5Exp/XzhfiEJNUpfkj3AEHz3nutX1edVMVoUcFmAQl7dQoSjV0o3B5bpK7c1tK4irNGhWfbcEFeEbc55hJ8KrGUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ii3KT96+M7iGpRk0i2yK1cnKu2055MxHxpO0OuA8Ybo=; b=cmUF3rw5XTvVB/MNJAL7bLu2Kj43Ut4umjhVWCv1h0IdtHUVIFwbnS6Lk4ZUQWoYX+R++f+IeLhatX2xADVNWRKW/8X4wpSR0WoBSQjFjqL+FLn462fsdraPCggAlqg4fbNbTJf19KigXGnNu8BYzFkUJAIndmd72BIOLCXhXUo0Q4Qv/1Ue1XZOwsJXOoKDUsgxlAOkZTDE+/Yq9sLYNUQS8aANvYMC8FDK8E7wvmn9C9Fsw/Jkmuuwnhtx6c3Lczf/zPuJih8YVDNARhlPbb1EySjRlX5hvGvtM71LF5MipX7MG31P941JtqkBFJD+DBj/TOZrAa96uYrDeyVs9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ii3KT96+M7iGpRk0i2yK1cnKu2055MxHxpO0OuA8Ybo=; b=dHOLwzxw/Jy6//mqAizU3rdD49ytiRk0RnJNdyBnXE4D61j3XGv/L9EoQSwvilqAi8V22iHQ2THwddkUfVGD+6o6TbRDzSP95D8YdlefNug24CSylrflVq0xhnFEKesjUS0VT9dAkTB/T5v9ol+3FPFut8ye5tY7GhxUM8/t69I= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:19 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:19 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 15/17] ethernet: ucc_geth: add helper to replace repeated switch statements Date: Tue, 19 Jan 2021 16:08:00 +0100 Message-Id: <20210119150802.19997-16-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48e68eef-bdc0-4ab6-799f-08d8bc8c31ef X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /g0goFmdr0dwlRUk5t9pNbMRqhorTMsac72pAGyIq5PCPQK2ynN16/U4/bR/5VB9KqDxmPKlocn4LMjo2Jgza8lyIIGQW+wJtAm3+zEHw2gMhCn9aKCA1QgR+LQybxdF2s/8mmtqm+S2QWATnqKqEx5uVtKFM5AAYkTOf8XIFfxmau+HEaWfk6LP4PsDqsDDPAeLeYkXNjrTwv8YoFXzGo8T7XipaUJ8WTUknZJ95pp6uTG1Wql9cEsX0EvGOIAGjQbPRWRW20/kpHrIjDMvYFGM+dHy3Ig+W+lxNR9+0rpAdzbBgGPYZv5UfLDm7tpFN2XSRX95fak+wRT2izysyGtwt/Jg+QnmcBIuE5nShNvsB44ykgttMcbJdvNraEI3RxNcR2RnX//OJPCJrhxikw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: wbXK6lfyKAgSpKJQOXmDvNyXybEkYEXuP13i9mEanRk9dFDc1rOiTthtHJDaGkY9aNeeC7Unylimfe/+a3wPlChi6e3Z3rHNsKMBF7TmoqLrifzDByoebvmWqI4CEyRjBdNE8WzWlWTd5o3xwYl8GHAxtFNTx4oFxXNSECBK1zW+uu5y71Wt0gG+2i6p4yTwYgOaFG0if2FzUnkDHoRJxkr7r5PpZnTB+ZFVYYXBgp+TAXsvXe5EZ6l5hda3LVbp9xhzhggnsEWo8ZqWDZeCxY94C+yVeeLWv2+HwnW8ErSoX6tAgsW+NsV+QyXMY+3w6fBvU86a9EPFsf2nhzEHL1HnzkO2DByLP9gGhyB/pPtV2zhFdboiWupZPt0lU1kvp3cF3CfVYP8JBGymRjdApa5oDUMZ/NpqRegV+KY1pyg20YcUmokJiP/QUuDvLvxn7nzRUiHQTgoYLZwz3wNIFKdVuT0VxFv9WB30B+7GVCo1mk7vsJRc+A1hSyG4di2fiu1pvkbx11YpmEXFK3zEWVbXGa0iNKvzia/K9Z3hHs3jHmuvANY3jhUHRXhw9lMx4K+IWFjCX5JFgCw1KibMHJHe2UcM1yc80tktcefl7GIhhPySzkmOMm37OVVWFQyXNSRVvYhsgTJZ7M6fKLhQC4TlXKDQw+InVEB/U4TypX0oz8VzQ3IlImXcvK079H0Ur/ChYvDYfoQslPxUI7ypQ8ui1pCLU4IHSDn9oFCcZ3aPGdlVVTFFBb1Kz4W7BO/EwpazTMNTbeEhAtiViR08Nv/Ozh8te2oiN3V7BcM6IKdIbmMJ4b3mF2OjubEEnvKTdk/Xa+LgLkvr65IFnCa+/7RKs1YWnriQ5X10nbqAGgQxdf2Cv0TdzTfoltSpuRHTQBVmMijt9kBFSEbOm80usriEcfjdNuMdf+P+g6cN/zNz+ZVAdEnibEej4MpQctiZHBkVBjzxTVP6hOKfbsrGsZToFDpNrGiwDMjvDeTxgrKZC5A9SO6uXqT+EnyPqBZg X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 48e68eef-bdc0-4ab6-799f-08d8bc8c31ef X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:19.4325 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /cgycRYKoC7cScqXsVWalMIM9vikIk+sG55pSRp50jffoc031UL5Um8fTYKl9CpEQBF6vcmO4JkcKOfQldvlFpweEs1CW12dZom+gonwTys= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The translation from the ucc_geth_num_of_threads enum value to the actual count can be written somewhat more compactly with a small lookup table, allowing us to replace the four switch statements. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 100 +++++----------------- 1 file changed, 22 insertions(+), 78 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 621a9e3e4b65..960b19fc4fb8 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -70,6 +70,20 @@ static struct { module_param_named(debug, debug.msg_enable, int, 0); MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 0xffff=all)"); +static int ucc_geth_thread_count(enum ucc_geth_num_of_threads idx) +{ + static const u8 count[] = { + [UCC_GETH_NUM_OF_THREADS_1] = 1, + [UCC_GETH_NUM_OF_THREADS_2] = 2, + [UCC_GETH_NUM_OF_THREADS_4] = 4, + [UCC_GETH_NUM_OF_THREADS_6] = 6, + [UCC_GETH_NUM_OF_THREADS_8] = 8, + }; + if (idx >= ARRAY_SIZE(count)) + return 0; + return count[idx]; +} + static const struct ucc_geth_info ugeth_primary_info = { .uf_info = { .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES, @@ -668,32 +682,12 @@ static void dump_regs(struct ucc_geth_private *ugeth) in_be32(&ugeth->ug_regs->scam)); if (ugeth->p_thread_data_tx) { - int numThreadsTxNumerical; - switch (ugeth->ug_info->numThreadsTx) { - case UCC_GETH_NUM_OF_THREADS_1: - numThreadsTxNumerical = 1; - break; - case UCC_GETH_NUM_OF_THREADS_2: - numThreadsTxNumerical = 2; - break; - case UCC_GETH_NUM_OF_THREADS_4: - numThreadsTxNumerical = 4; - break; - case UCC_GETH_NUM_OF_THREADS_6: - numThreadsTxNumerical = 6; - break; - case UCC_GETH_NUM_OF_THREADS_8: - numThreadsTxNumerical = 8; - break; - default: - numThreadsTxNumerical = 0; - break; - } + int count = ucc_geth_thread_count(ugeth->ug_info->numThreadsTx); pr_info("Thread data TXs:\n"); pr_info("Base address: 0x%08x\n", (u32)ugeth->p_thread_data_tx); - for (i = 0; i < numThreadsTxNumerical; i++) { + for (i = 0; i < count; i++) { pr_info("Thread data TX[%d]:\n", i); pr_info("Base address: 0x%08x\n", (u32)&ugeth->p_thread_data_tx[i]); @@ -702,32 +696,12 @@ static void dump_regs(struct ucc_geth_private *ugeth) } } if (ugeth->p_thread_data_rx) { - int numThreadsRxNumerical; - switch (ugeth->ug_info->numThreadsRx) { - case UCC_GETH_NUM_OF_THREADS_1: - numThreadsRxNumerical = 1; - break; - case UCC_GETH_NUM_OF_THREADS_2: - numThreadsRxNumerical = 2; - break; - case UCC_GETH_NUM_OF_THREADS_4: - numThreadsRxNumerical = 4; - break; - case UCC_GETH_NUM_OF_THREADS_6: - numThreadsRxNumerical = 6; - break; - case UCC_GETH_NUM_OF_THREADS_8: - numThreadsRxNumerical = 8; - break; - default: - numThreadsRxNumerical = 0; - break; - } + int count = ucc_geth_thread_count(ugeth->ug_info->numThreadsRx); pr_info("Thread data RX:\n"); pr_info("Base address: 0x%08x\n", (u32)ugeth->p_thread_data_rx); - for (i = 0; i < numThreadsRxNumerical; i++) { + for (i = 0; i < count; i++) { pr_info("Thread data RX[%d]:\n", i); pr_info("Base address: 0x%08x\n", (u32)&ugeth->p_thread_data_rx[i]); @@ -2315,45 +2289,15 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) uf_regs = uccf->uf_regs; ug_regs = ugeth->ug_regs; - switch (ug_info->numThreadsRx) { - case UCC_GETH_NUM_OF_THREADS_1: - numThreadsRxNumerical = 1; - break; - case UCC_GETH_NUM_OF_THREADS_2: - numThreadsRxNumerical = 2; - break; - case UCC_GETH_NUM_OF_THREADS_4: - numThreadsRxNumerical = 4; - break; - case UCC_GETH_NUM_OF_THREADS_6: - numThreadsRxNumerical = 6; - break; - case UCC_GETH_NUM_OF_THREADS_8: - numThreadsRxNumerical = 8; - break; - default: + numThreadsRxNumerical = ucc_geth_thread_count(ug_info->numThreadsRx); + if (!numThreadsRxNumerical) { if (netif_msg_ifup(ugeth)) pr_err("Bad number of Rx threads value\n"); return -EINVAL; } - switch (ug_info->numThreadsTx) { - case UCC_GETH_NUM_OF_THREADS_1: - numThreadsTxNumerical = 1; - break; - case UCC_GETH_NUM_OF_THREADS_2: - numThreadsTxNumerical = 2; - break; - case UCC_GETH_NUM_OF_THREADS_4: - numThreadsTxNumerical = 4; - break; - case UCC_GETH_NUM_OF_THREADS_6: - numThreadsTxNumerical = 6; - break; - case UCC_GETH_NUM_OF_THREADS_8: - numThreadsTxNumerical = 8; - break; - default: + numThreadsTxNumerical = ucc_geth_thread_count(ug_info->numThreadsTx); + if (!numThreadsTxNumerical) { if (netif_msg_ifup(ugeth)) pr_err("Bad number of Tx threads value\n"); return -EINVAL; From patchwork Tue Jan 19 15:08:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030117 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91BB7C433DB for ; Tue, 19 Jan 2021 15:18:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 530D022573 for ; Tue, 19 Jan 2021 15:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391052AbhASPST (ORCPT ); Tue, 19 Jan 2021 10:18:19 -0500 Received: from mail-eopbgr80121.outbound.protection.outlook.com ([40.107.8.121]:58206 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391095AbhASPMD (ORCPT ); Tue, 19 Jan 2021 10:12:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MG6OqGJwPZKjv71d9GifAv7ddQ4QHhG1CvcA1wgva100u7Vskl27x8tE48rTqRlbXTzPtn+T1QYGTlD0hgKhSnOGVP0ozNph6N8Qg6IpWYgApu8EmbAB1idtx6tWbamVuaPSx+vQLUOskuGaP8WUMTbFpJfMx3k2/efymNgcLUn+ovtkMGoxWIZq6H6Q2hv2yU2JQieLOGn7dqpwczQ20cV0KA4fdGTCdzIrR70YbmofThAgDCR+SqFaNba4i6wAaoSCsAwR8+IG69v+tfbetHVB+xWIrRekZHsoXt8nx700ooEeS2x5+g7tRckHwDsVFaU+XtagaqIb6F2Lcdp/XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7kg5ZponnjqRkw9H8N5NCmPdzdftMGmXJ7q7nJcOMQ8=; b=QG8s4nQySdg7XBIFmk0dm3uhKO2jJlueg3gEK0qzDk/V1TlbfKRufeLch9s/tEOqrbiHjaeQP2FcfCq8GU10DfUF9D7IFKWmQnlZGu2cMnWn1VsYLZrCsBr1s7nbHeNdAfHYMwxkOO1E7LE9miDIHJKub3P6ko6TWzBmjBJup7Otya2vfFPUi/Rtr5bPFRwm+rPCmkOnHLK9ZkvqP5PSiqcKUsMFfX4EZ1FQtqbeZpaIYfJXvzrhPjQmjT/y98l7jVOWZ9kHPhshMfH7QW0M8ZMudyQoJPY5RU3bLRA3ylaOrX+TJwWGiDFB8uYz2pEMEjAO1+iMxbFXW5llJ7oC4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7kg5ZponnjqRkw9H8N5NCmPdzdftMGmXJ7q7nJcOMQ8=; b=D8CmEmMcyAU9L6mqcXc/c3sPanbQ8jy5ec2aaeGjP+qPZgORU9e4ZriLha4OyQb+0XOyAGtJqgDmWdYmPfT7wnD/cz7if2SAdTJnZsxZl9QwaNirix/rXamE/Ii4NN5WY4bVbtxMt3JB9KGRQSSzgpp6W5CwwU9PfwlNxWuk52g= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:24 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:21 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 16/17] ethernet: ucc_geth: inform the compiler that numQueues is always 1 Date: Tue, 19 Jan 2021 16:08:01 +0100 Message-Id: <20210119150802.19997-17-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d8a470b-65c6-427c-2035-08d8bc8c3254 X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: swJv62EsVCQ1jv24JKhUt3DLrPhz4r5vRW1/pfjoqIWoL2psJB9CAVN/yXe/kzFR5N/zo3q6/g/1n/7tU+No6EaRuiPg+pSniAZ7EjL0djV1jT8dyhirqHfE5nlBqFaP6UsRzlpIJCjwqXduZQxRSwJM6E+RQnuft3bxgY8oTFGz36QMz4MKwNSnebnXgvPhx3WRM9p3Sn3j2LnreKmzBP8PZeh1sB1fT/5KKPMAycwsQG1zgWUehGWtD1U3XEE6+GzMZ2/lQyPTTPeCb2Tx8+NlUOWO9t7nNJtIAja2UvNQ53KJbTeOdQVOIz7Gktn7aA7VR7BdYuZjc2BFSrf7Wn/caWrwzTK6L+xLVtQndTaEMgfZCWLxQL7Jhg6ewWRi1fB0ZqDjtVX1qNm2QNB9yQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(30864003)(6486002)(5660300002)(478600001)(19627235002)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: HrMjh+XM5asX+dMFnjksGgfq2CHwGsp0Uph4vfv1ZBUvPj9LfuAQUoYjydZ8qEMFdt1JoFOCThG7kCGzghU4wo5JtLHQW/lvXpWr9wUksQ+8oarcTjZpwiz5ZxKREdiWjC3Gwxed7fZyWSGiFvCw+PtLTtZa2+D7lYQEIfYAvKtxpJG+gy96Pci+JFWfWfGjlrsKxfLdjunaAO36IPaHKMAZUW/MxcTlyCMQUgMInEegvG9gmuz4L0vjh2U1VR1nk6dQUru5YgdGm3twzGcgo2ItCyV235w/CjeuHgigGN1ex2AMwJI2f5ljE3udPHRXUSiqOkpMBUhdA7j+YlXQLLy41TntU4jg7HAmPtY80KyzciYOV7T3pgPkRmv+FXUOHxUKMlzhb80EM7AIygN/tmfrPbs0SHwC5K4+0wd0/0+3rhCVYCbo+PEjdt7hJG+NPcsgzaJH4BK3Y9YA9EvbdxNsnZePQwAWsbGJkZZpP4j2FYhmox5Ts8b+8IQ7o5CsIZvaLYJZXhdN2KUhgvCRyRnlV7IKNLGtPkIr/LuVRt93To7Eo5NZh4zTUdXoHQDmbcvsDbWoENhMX+h4cL15LORDBTmf+afc11erYakqeWYBg6UzT/Pbr1T9ZPLxnx2RYK0n34RBwR+3kkrHwV2YbxVXW5CqRmNoQN1hVA4ytzrAqZevDdoKrmSbcfRCMonhUSEe34kCd6OYa4kC0KcMYeJzXIANKT+17BngmVOpWP2TwSHtyWyh1DNkrcVcsjXYR5d4UntrYuUH2nI+zpISWCt+nEZblHaBO0mYwSiw1W3DBlyyUgyOkIlo66pY7549v/Ivsuo82pfYvZx8BR0wna9nL6zfbyaSLQJOeE6xueE+bisMOuJ10jFfxLlC9fGjZ2gJ2j7eJ3iwlXlZFzpDw5RJ+Qr8kFHQ7f1SFg7Aaqf5W2NJuX8NVVQox3gGZvCnCy5fDac2R6r6EMvZNv6hJaZyIaVnaCv6FOKDJQHaLmAi8+ilArgaxMPM8IZeQ9Y7 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 6d8a470b-65c6-427c-2035-08d8bc8c3254 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:20.8656 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vPP14OM1fCz/CvRd/UBzWaU6FIZEBChXEcfKfoehcOoA8gA96dvNdWpTFuJOmexKeTLsb9TnkBy6cXByfOdOWit9uv7EqRNkIkIUr+Z8d7I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The numQueuesTx and numQueuesRx members of struct ucc_geth_info are never set to anything but 1, and never have been. It's unclear how well the code supporting multiple queues would work. Until somebody wants to play with enabling that, help the compiler eliminate a lot of dead code and loops that are not really loops by creating static inline helpers. If and when the numQueuesTx/numQueuesRx fields are re-introduced, it suffices to update those helper to return the appropriate field. This cuts the .text segment of ucc_geth.o by 8%. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 76 +++++++++++++---------- drivers/net/ethernet/freescale/ucc_geth.h | 2 - 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 960b19fc4fb8..9be1d4455a6b 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -84,6 +84,16 @@ static int ucc_geth_thread_count(enum ucc_geth_num_of_threads idx) return count[idx]; } +static inline int ucc_geth_tx_queues(const struct ucc_geth_info *info) +{ + return 1; +} + +static inline int ucc_geth_rx_queues(const struct ucc_geth_info *info) +{ + return 1; +} + static const struct ucc_geth_info ugeth_primary_info = { .uf_info = { .rtsm = UCC_FAST_SEND_IDLES_BETWEEN_FRAMES, @@ -103,8 +113,6 @@ static const struct ucc_geth_info ugeth_primary_info = { .tcrc = UCC_FAST_16_BIT_CRC, .synl = UCC_FAST_SYNC_LEN_NOT_USED, }, - .numQueuesTx = 1, - .numQueuesRx = 1, .extendedFilteringChainPointer = ((uint32_t) NULL), .typeorlen = 3072 /*1536 */ , .nonBackToBackIfgPart1 = 0x40, @@ -569,7 +577,7 @@ static void dump_bds(struct ucc_geth_private *ugeth) int i; int length; - for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) { + for (i = 0; i < ucc_geth_tx_queues(ugeth->ug_info); i++) { if (ugeth->p_tx_bd_ring[i]) { length = (ugeth->ug_info->bdRingLenTx[i] * @@ -578,7 +586,7 @@ static void dump_bds(struct ucc_geth_private *ugeth) mem_disp(ugeth->p_tx_bd_ring[i], length); } } - for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ugeth->ug_info); i++) { if (ugeth->p_rx_bd_ring[i]) { length = (ugeth->ug_info->bdRingLenRx[i] * @@ -876,7 +884,7 @@ static void dump_regs(struct ucc_geth_private *ugeth) if (ugeth->p_send_q_mem_reg) { pr_info("Send Q memory registers:\n"); pr_info("Base address: 0x%08x\n", (u32)ugeth->p_send_q_mem_reg); - for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) { + for (i = 0; i < ucc_geth_tx_queues(ugeth->ug_info); i++) { pr_info("SQQD[%d]:\n", i); pr_info("Base address: 0x%08x\n", (u32)&ugeth->p_send_q_mem_reg->sqqd[i]); @@ -908,7 +916,7 @@ static void dump_regs(struct ucc_geth_private *ugeth) pr_info("RX IRQ coalescing tables:\n"); pr_info("Base address: 0x%08x\n", (u32)ugeth->p_rx_irq_coalescing_tbl); - for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ugeth->ug_info); i++) { pr_info("RX IRQ coalescing table entry[%d]:\n", i); pr_info("Base address: 0x%08x\n", (u32)&ugeth->p_rx_irq_coalescing_tbl-> @@ -930,7 +938,7 @@ static void dump_regs(struct ucc_geth_private *ugeth) if (ugeth->p_rx_bd_qs_tbl) { pr_info("RX BD QS tables:\n"); pr_info("Base address: 0x%08x\n", (u32)ugeth->p_rx_bd_qs_tbl); - for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ugeth->ug_info); i++) { pr_info("RX BD QS table[%d]:\n", i); pr_info("Base address: 0x%08x\n", (u32)&ugeth->p_rx_bd_qs_tbl[i]); @@ -1806,7 +1814,7 @@ static void ucc_geth_free_rx(struct ucc_geth_private *ugeth) ug_info = ugeth->ug_info; uf_info = &ug_info->uf_info; - for (i = 0; i < ugeth->ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ugeth->ug_info); i++) { if (ugeth->p_rx_bd_ring[i]) { /* Return existing data buffers in ring */ bd = ugeth->p_rx_bd_ring[i]; @@ -1846,7 +1854,7 @@ static void ucc_geth_free_tx(struct ucc_geth_private *ugeth) ug_info = ugeth->ug_info; uf_info = &ug_info->uf_info; - for (i = 0; i < ugeth->ug_info->numQueuesTx; i++) { + for (i = 0; i < ucc_geth_tx_queues(ugeth->ug_info); i++) { bd = ugeth->p_tx_bd_ring[i]; if (!bd) continue; @@ -2024,7 +2032,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) uf_info = &ug_info->uf_info; /* Rx BD lengths */ - for (i = 0; i < ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ug_info); i++) { if ((ug_info->bdRingLenRx[i] < UCC_GETH_RX_BD_RING_SIZE_MIN) || (ug_info->bdRingLenRx[i] % UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT)) { @@ -2035,7 +2043,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) } /* Tx BD lengths */ - for (i = 0; i < ug_info->numQueuesTx; i++) { + for (i = 0; i < ucc_geth_tx_queues(ug_info); i++) { if (ug_info->bdRingLenTx[i] < UCC_GETH_TX_BD_RING_SIZE_MIN) { if (netif_msg_probe(ugeth)) pr_err("Tx BD ring length must be no smaller than 2\n"); @@ -2052,14 +2060,14 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) } /* num Tx queues */ - if (ug_info->numQueuesTx > NUM_TX_QUEUES) { + if (ucc_geth_tx_queues(ug_info) > NUM_TX_QUEUES) { if (netif_msg_probe(ugeth)) pr_err("number of tx queues too large\n"); return -EINVAL; } /* num Rx queues */ - if (ug_info->numQueuesRx > NUM_RX_QUEUES) { + if (ucc_geth_rx_queues(ug_info) > NUM_RX_QUEUES) { if (netif_msg_probe(ugeth)) pr_err("number of rx queues too large\n"); return -EINVAL; @@ -2067,7 +2075,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) /* l2qt */ for (i = 0; i < UCC_GETH_VLAN_PRIORITY_MAX; i++) { - if (ug_info->l2qt[i] >= ug_info->numQueuesRx) { + if (ug_info->l2qt[i] >= ucc_geth_rx_queues(ug_info)) { if (netif_msg_probe(ugeth)) pr_err("VLAN priority table entry must not be larger than number of Rx queues\n"); return -EINVAL; @@ -2076,7 +2084,7 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) /* l3qt */ for (i = 0; i < UCC_GETH_IP_PRIORITY_MAX; i++) { - if (ug_info->l3qt[i] >= ug_info->numQueuesRx) { + if (ug_info->l3qt[i] >= ucc_geth_rx_queues(ug_info)) { if (netif_msg_probe(ugeth)) pr_err("IP priority table entry must not be larger than number of Rx queues\n"); return -EINVAL; @@ -2099,10 +2107,10 @@ static int ucc_struct_init(struct ucc_geth_private *ugeth) /* Generate uccm_mask for receive */ uf_info->uccm_mask = ug_info->eventRegMask & UCCE_OTHER;/* Errors */ - for (i = 0; i < ug_info->numQueuesRx; i++) + for (i = 0; i < ucc_geth_rx_queues(ug_info); i++) uf_info->uccm_mask |= (UCC_GETH_UCCE_RXF0 << i); - for (i = 0; i < ug_info->numQueuesTx; i++) + for (i = 0; i < ucc_geth_tx_queues(ug_info); i++) uf_info->uccm_mask |= (UCC_GETH_UCCE_TXB0 << i); /* Initialize the general fast UCC block. */ if (ucc_fast_init(uf_info, &ugeth->uccf)) { @@ -2141,7 +2149,7 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) uf_info = &ug_info->uf_info; /* Allocate Tx bds */ - for (j = 0; j < ug_info->numQueuesTx; j++) { + for (j = 0; j < ucc_geth_tx_queues(ug_info); j++) { u32 align = UCC_GETH_TX_BD_RING_ALIGNMENT; /* Allocate in multiple of @@ -2174,7 +2182,7 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) } /* Init Tx bds */ - for (j = 0; j < ug_info->numQueuesTx; j++) { + for (j = 0; j < ucc_geth_tx_queues(ug_info); j++) { /* Setup the skbuff rings */ ugeth->tx_skbuff[j] = kcalloc(ugeth->ug_info->bdRingLenTx[j], @@ -2215,7 +2223,7 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) uf_info = &ug_info->uf_info; /* Allocate Rx bds */ - for (j = 0; j < ug_info->numQueuesRx; j++) { + for (j = 0; j < ucc_geth_rx_queues(ug_info); j++) { u32 align = UCC_GETH_RX_BD_RING_ALIGNMENT; length = ug_info->bdRingLenRx[j] * sizeof(struct qe_bd); @@ -2234,7 +2242,7 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) } /* Init Rx bds */ - for (j = 0; j < ug_info->numQueuesRx; j++) { + for (j = 0; j < ucc_geth_rx_queues(ug_info); j++) { /* Setup the skbuff rings */ ugeth->rx_skbuff[j] = kcalloc(ugeth->ug_info->bdRingLenRx[j], @@ -2437,7 +2445,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* SQPTR */ /* Size varies with number of Tx queues */ ugeth->send_q_mem_reg_offset = - qe_muram_alloc(ug_info->numQueuesTx * + qe_muram_alloc(ucc_geth_tx_queues(ug_info) * sizeof(struct ucc_geth_send_queue_qd), UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { @@ -2453,7 +2461,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* Setup the table */ /* Assume BD rings are already established */ - for (i = 0; i < ug_info->numQueuesTx; i++) { + for (i = 0; i < ucc_geth_tx_queues(ug_info); i++) { endOfRing = ugeth->p_tx_bd_ring[i] + (ug_info->bdRingLenTx[i] - 1) * sizeof(struct qe_bd); @@ -2466,7 +2474,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* schedulerbasepointer */ - if (ug_info->numQueuesTx > 1) { + if (ucc_geth_tx_queues(ug_info) > 1) { /* scheduler exists only if more than 1 tx queue */ ugeth->scheduler_offset = qe_muram_alloc(sizeof(struct ucc_geth_scheduler), @@ -2529,11 +2537,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* temoder */ /* Already has speed set */ - if (ug_info->numQueuesTx > 1) + if (ucc_geth_tx_queues(ug_info) > 1) temoder |= TEMODER_SCHEDULER_ENABLE; if (ug_info->ipCheckSumGenerate) temoder |= TEMODER_IP_CHECKSUM_GENERATE; - temoder |= ((ug_info->numQueuesTx - 1) << TEMODER_NUM_OF_QUEUES_SHIFT); + temoder |= ((ucc_geth_tx_queues(ug_info) - 1) << TEMODER_NUM_OF_QUEUES_SHIFT); out_be16(&ugeth->p_tx_glbl_pram->temoder, temoder); /* Function code register value to be used later */ @@ -2597,7 +2605,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* Size varies with number of Rx queues */ ugeth->rx_irq_coalescing_tbl_offset = - qe_muram_alloc(ug_info->numQueuesRx * + qe_muram_alloc(ucc_geth_rx_queues(ug_info) * sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { @@ -2613,7 +2621,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ugeth->rx_irq_coalescing_tbl_offset); /* Fill interrupt coalescing table */ - for (i = 0; i < ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ug_info); i++) { out_be32(&ugeth->p_rx_irq_coalescing_tbl->coalescingentry[i]. interruptcoalescingmaxvalue, ug_info->interruptcoalescingmaxvalue[i]); @@ -2662,7 +2670,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* RBDQPTR */ /* Size varies with number of Rx queues */ ugeth->rx_bd_qs_tbl_offset = - qe_muram_alloc(ug_info->numQueuesRx * + qe_muram_alloc(ucc_geth_rx_queues(ug_info) * (sizeof(struct ucc_geth_rx_bd_queues_entry) + sizeof(struct ucc_geth_rx_prefetched_bds)), UCC_GETH_RX_BD_QUEUES_ALIGNMENT); @@ -2679,7 +2687,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) /* Setup the table */ /* Assume BD rings are already established */ - for (i = 0; i < ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ug_info); i++) { out_be32(&ugeth->p_rx_bd_qs_tbl[i].externalbdbaseptr, (u32) virt_to_phys(ugeth->p_rx_bd_ring[i])); /* rest of fields handled by QE */ @@ -2702,7 +2710,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) ug_info-> vlanOperationNonTagged << REMODER_VLAN_OPERATION_NON_TAGGED_SHIFT; remoder |= ug_info->rxQoSMode << REMODER_RX_QOS_MODE_SHIFT; - remoder |= ((ug_info->numQueuesRx - 1) << REMODER_NUM_OF_QUEUES_SHIFT); + remoder |= ((ucc_geth_rx_queues(ug_info) - 1) << REMODER_NUM_OF_QUEUES_SHIFT); if (ug_info->ipCheckSumCheck) remoder |= REMODER_IP_CHECKSUM_CHECK; if (ug_info->ipAddressAlignment) @@ -2861,7 +2869,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) } /* Load Rx bds with buffers */ - for (i = 0; i < ug_info->numQueuesRx; i++) { + for (i = 0; i < ucc_geth_rx_queues(ug_info); i++) { if ((ret_val = rx_bd_buffer_set(ugeth, (u8) i)) != 0) { if (netif_msg_ifup(ugeth)) pr_err("Can not fill Rx bds with buffers\n"); @@ -3132,12 +3140,12 @@ static int ucc_geth_poll(struct napi_struct *napi, int budget) /* Tx event processing */ spin_lock(&ugeth->lock); - for (i = 0; i < ug_info->numQueuesTx; i++) + for (i = 0; i < ucc_geth_tx_queues(ug_info); i++) ucc_geth_tx(ugeth->ndev, i); spin_unlock(&ugeth->lock); howmany = 0; - for (i = 0; i < ug_info->numQueuesRx; i++) + for (i = 0; i < ucc_geth_rx_queues(ug_info); i++) howmany += ucc_geth_rx(ugeth, i, budget - howmany); if (howmany < budget) { diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h index be47fa8ced15..6539fed9cc22 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.h +++ b/drivers/net/ethernet/freescale/ucc_geth.h @@ -1077,8 +1077,6 @@ struct ucc_geth_tad_params { /* GETH protocol initialization structure */ struct ucc_geth_info { struct ucc_fast_info uf_info; - u8 numQueuesTx; - u8 numQueuesRx; int ipCheckSumCheck; int ipCheckSumGenerate; int rxExtendedFiltering; From patchwork Tue Jan 19 15:08:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 12030115 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7614EC433E6 for ; Tue, 19 Jan 2021 15:17:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4236922573 for ; Tue, 19 Jan 2021 15:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390548AbhASPRv (ORCPT ); Tue, 19 Jan 2021 10:17:51 -0500 Received: from mail-eopbgr80123.outbound.protection.outlook.com ([40.107.8.123]:42328 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391122AbhASPMD (ORCPT ); Tue, 19 Jan 2021 10:12:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CGPBFWRZm40OPU0ArKgn9WBzUz3j2fVdpLlWVTLgG/F7whgV3j9Ltk/l/rnldpDHSfxbOHcBLq9LF+0/Zpio438DxEufzUTxwoEpiiPH6bMeT9XQPJHal4RKWNd2OBo/MadtdopArX9XzZAOqfWJsnUEbvrZY0sLF4SXSaeYqMYTA00xWDG1suDewhaVW+AiyXXpZ9Tgp9GHr5afTwpWfrrIegCnTw3zDLzQfjgfqPHQPN0ewZLmvRoJiZBPSH/dXMl744s6cQA1tS4xk5nrCArgOkzMlp7vVilStC0eAlL432dQCA0sVlsUpd2zQKyjVHI2+uSg8SMKZzD/EojT/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I4pNhHaUZFfhMDCoQGHOvyvSQKykMlhyBjOkwek1q1k=; b=j0/g9cT1HUHtAym5sFWff8QzE0rfgIN2vX+GTH0glQZy6VJnIzOakBEzVd7LMVOLYmSNctMKceND+FheRJeo0ZE9J5sWnKTDIXuEqDjuvtcF1Ic976GGtsZGG+S2xkoVVbUqYjVbHjkk6U/HGFmewVZ2I7/d4Vg6l2bCKloJvZE+QmpGYBZI7DD0Di39yDx5a80lO9jMru9QOkfZXcnVeRRdn+66ySvRKZ+X2reTbfjS4bqsaQK9AGteVQm1p1xuffH6Xj7lAZvqG1b24QukG77He5shfhkNwLyVGfanoSv8f2moGrU+Fq2eaKpJLhmXjNgz2pCb6JdysvDphNVMtw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I4pNhHaUZFfhMDCoQGHOvyvSQKykMlhyBjOkwek1q1k=; b=dMW8wbo2D2foXl6Bzj6vxZ5qmrWX5kH9ZYkdkTOyzG0GpQKnwmJR66Bfx7oM8dFPr+OsBJS4eQX6gUhP/glplq7hsh+zou8B1rFSwC+A72e1kHZG7NAZXpozwBq9oONkIhQ6fvR3PHLDqGVMkJWx20AfukC8yC0EUXNATaWM1FY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM0PR10MB1922.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:40::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.10; Tue, 19 Jan 2021 15:09:24 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::9068:c899:48f:a8e3%6]) with mapi id 15.20.3763.014; Tue, 19 Jan 2021 15:09:24 +0000 From: Rasmus Villemoes To: netdev@vger.kernel.org Cc: Li Yang , "David S . Miller" , Zhao Qiang , Andrew Lunn , Christophe Leroy , Jakub Kicinski , Joakim Tjernlund , Rasmus Villemoes Subject: [PATCH net-next v2 17/17] ethernet: ucc_geth: simplify rx/tx allocations Date: Tue, 19 Jan 2021 16:08:02 +0100 Message-Id: <20210119150802.19997-18-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> References: <20210119150802.19997-1-rasmus.villemoes@prevas.dk> X-Originating-IP: [5.186.115.188] X-ClientProxiedBy: AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (5.186.115.188) by AM6PR02CA0036.eurprd02.prod.outlook.com (2603:10a6:20b:6e::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Tue, 19 Jan 2021 15:09:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 216ee5c0-22fe-45c6-2b22-08d8bc8c33ac X-MS-TrafficTypeDiagnostic: AM0PR10MB1922: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MhRK28E8Ht2kXFegwJSp8Y/YUf6l4cEXxoWltF8+KAYr7qIvWXbOIz7TK6/U2mrBBj6DsVs8gD0mj4VfppMnO6pqCacN7hdnHneKwK+kPE9me/V8fve0/du12IE1tIlg9oHlnbzkPZK5TyIwKpEW05wkPo+P6wk+83L4KNxCkGjoM7D8voM5JtzoclfyukwjGLulyAaq6j2rTnc9+cAo4WcC92X0iBIL9KRdABr8U8MB6SBzSkGPRpPmdhcYScbnwO6q/ouRtlm4u3EyIWTPDbgcQ8Zi2X2sjlYNflbx005wXMnMzWB1bjGPFPXfcTYc7fXnfIB/XBDCk1+qliJeMXz2DNOCNbSogMGo22WTYmNlHC/N9ftxJEqPhREI/OW7BQF1RPdRoe1nMvtaX/6VEQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(39840400004)(366004)(346002)(376002)(136003)(396003)(1076003)(186003)(956004)(2906002)(6512007)(44832011)(86362001)(16526019)(6666004)(2616005)(83380400001)(6916009)(107886003)(8676002)(26005)(36756003)(52116002)(66556008)(66946007)(6506007)(54906003)(4326008)(6486002)(5660300002)(478600001)(316002)(8976002)(66476007)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: jkmpiMXDY8871VHqOIC0Z+wOD7JDjUhAOF511yNo9wfP15oawUk1DGPFfqRvNhkH9zBf44zZbeJMiAFyG7TOXlV28/tb8Wi4ImFripFai5mllUDZf1+w8brogvu3+8OxEG3vZmIKh6CVo3i69XXEiyJb+E8yfUa55LWtmF5RyznGwHmAy4KTy061I2O3hHYWAZZ7s2qkbr81XdI11b2WDDTt/br2IUmj7X7buLTk/qsOIJDnG0FPFtn+izGTsTiYlVJcU5JtCB7KWnyT0rzI+6IonVJnqzxPgNBF1fw9niD7Tm+xmPDNbKWwa1Avp8+9d+f0/N3oPfZ+hUCA7A5+EEV6QKMa+2M3WiGbnbDZn9Wk4vFNijjCjGhvgXOah/AkIQbIq8YTEcXYTkXVyVWy/DdYpSmqQ15avVcwRHYeNTDb4mdzr6tNiYBPv+r1Su4oAY061ISF8ym31QM75cTHoaC4LrVvE1FTf638f8mexKjHMPmJuh1qhacIxneGn2PLYHAkZM0hT/icCyrlENM6VMvx0vWJJlYyU321VTE5cP+bwm3nR49Ok0DQZ+UtOGEnVPvGouz1qr08e3sLQApuPtBeiS3yX7GeQwW+KPF/gY0yhqrJEV8JswSOTynOXl/AA8q54n1AZdfiCGgwh+Li4mR2hm15z0YgtMm7yaS42HknAd98U5NEhXZAAbBG1I2aZMT3mU4nc3TrnBXUhpUlMve7YJ+jiaHmd5Y38Wy24xelQIyRSkl7aAXxyT8Is1XlrG8evUyJg4zTemFmqE097kEhu/CPit4j0+6sxY1QgNvPAkj5kq0mldWDgBkQq269z6sQYOnkAjrCO+d0a86G/C5IJUbWQLGP19YKvy6RRajuoyz2iRIJZDV2tUP4w9WpG5zEG80QhtAeafl3NT/04xIElRWPInFLV1UDL7HJkPl2wbj2oh0n4t5wOAjj6b4WoYCkBWkfo0wQCHxW6LiaIh3LcibiUe0Eo3UAb6VIb7M8j1+oEKe2ooTVfdK1AJf3 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 216ee5c0-22fe-45c6-2b22-08d8bc8c33ac X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2021 15:09:23.6421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zYzoBD+gEIsEjT0DIpNv1ocBUTJKXP7JK/FAwscDXZig4d9lyAm3AKRhvBIXF/2fkqJMmodiccr8UR+6xCSG216nJRM7MOa7GKqPhhnpedk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB1922 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since kmalloc() is nowadays [1] guaranteed to return naturally aligned (i.e., aligned to the size itself) memory for power-of-2 sizes, we don't need to over-allocate the align amount, compute an aligned address within the allocation, and (for later freeing) also storing the original pointer [2]. Instead, just round up the length we want to allocate to the alignment requirements, then round that up to the next power of 2. In theory, this could allocate up to about twice as much memory as we needed. In practice, (a) kmalloc() would in most cases anyway return a power-of-2-sized allocation and (b) with the default values of the bdRingLen[RT]x fields, the length is already itself a power of 2 greater than the alignment. So we actually end up saving memory compared to the current situtation (e.g. for tx, we currently allocate 128+32 bytes, which kmalloc() likely rounds up to 192 or 256; with this patch, we just allocate 128 bytes.) Also struct ucc_geth_private becomes a little smaller. [1] 59bb47985c1d ("mm, sl[aou]b: guarantee natural alignment for kmalloc(power-of-two)") [2] That storing was anyway done in a u32, which works on 32 bit machines, but is not very elegant and certainly makes a reader of the code pause for a while. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 50 ++++++++--------------- drivers/net/ethernet/freescale/ucc_geth.h | 2 - 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 9be1d4455a6b..ef4e2febeb5b 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -1835,7 +1835,7 @@ static void ucc_geth_free_rx(struct ucc_geth_private *ugeth) kfree(ugeth->rx_skbuff[i]); - kfree((void *)ugeth->rx_bd_ring_offset[i]); + kfree(ugeth->p_rx_bd_ring[i]); ugeth->p_rx_bd_ring[i] = NULL; } } @@ -1872,10 +1872,8 @@ static void ucc_geth_free_tx(struct ucc_geth_private *ugeth) kfree(ugeth->tx_skbuff[i]); - if (ugeth->p_tx_bd_ring[i]) { - kfree((void *)ugeth->tx_bd_ring_offset[i]); - ugeth->p_tx_bd_ring[i] = NULL; - } + kfree(ugeth->p_tx_bd_ring[i]); + ugeth->p_tx_bd_ring[i] = NULL; } } @@ -2150,25 +2148,15 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) /* Allocate Tx bds */ for (j = 0; j < ucc_geth_tx_queues(ug_info); j++) { - u32 align = UCC_GETH_TX_BD_RING_ALIGNMENT; - - /* Allocate in multiple of - UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT, - according to spec */ - length = ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)) - / UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) - * UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; - if ((ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)) % - UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT) - length += UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT; - - ugeth->tx_bd_ring_offset[j] = - (u32) kmalloc((u32) (length + align), GFP_KERNEL); - - if (ugeth->tx_bd_ring_offset[j] != 0) - ugeth->p_tx_bd_ring[j] = - (u8 __iomem *)((ugeth->tx_bd_ring_offset[j] + - align) & ~(align - 1)); + u32 align = max(UCC_GETH_TX_BD_RING_ALIGNMENT, + UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT); + u32 alloc; + + length = ug_info->bdRingLenTx[j] * sizeof(struct qe_bd); + alloc = round_up(length, align); + alloc = roundup_pow_of_two(alloc); + + ugeth->p_tx_bd_ring[j] = kmalloc(alloc, GFP_KERNEL); if (!ugeth->p_tx_bd_ring[j]) { if (netif_msg_ifup(ugeth)) @@ -2176,9 +2164,7 @@ static int ucc_geth_alloc_tx(struct ucc_geth_private *ugeth) return -ENOMEM; } /* Zero unused end of bd ring, according to spec */ - memset_io((void __iomem *)(ugeth->p_tx_bd_ring[j] + - ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)), 0, - length - ug_info->bdRingLenTx[j] * sizeof(struct qe_bd)); + memset(ugeth->p_tx_bd_ring[j] + length, 0, alloc - length); } /* Init Tx bds */ @@ -2225,15 +2211,13 @@ static int ucc_geth_alloc_rx(struct ucc_geth_private *ugeth) /* Allocate Rx bds */ for (j = 0; j < ucc_geth_rx_queues(ug_info); j++) { u32 align = UCC_GETH_RX_BD_RING_ALIGNMENT; + u32 alloc; length = ug_info->bdRingLenRx[j] * sizeof(struct qe_bd); - ugeth->rx_bd_ring_offset[j] = - (u32) kmalloc((u32) (length + align), GFP_KERNEL); - if (ugeth->rx_bd_ring_offset[j] != 0) - ugeth->p_rx_bd_ring[j] = - (u8 __iomem *)((ugeth->rx_bd_ring_offset[j] + - align) & ~(align - 1)); + alloc = round_up(length, align); + alloc = roundup_pow_of_two(alloc); + ugeth->p_rx_bd_ring[j] = kmalloc(alloc, GFP_KERNEL); if (!ugeth->p_rx_bd_ring[j]) { if (netif_msg_ifup(ugeth)) pr_err("Can not allocate memory for Rx bd rings\n"); diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h index 6539fed9cc22..ccc4ca1ae9b6 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.h +++ b/drivers/net/ethernet/freescale/ucc_geth.h @@ -1182,9 +1182,7 @@ struct ucc_geth_private { struct ucc_geth_rx_bd_queues_entry __iomem *p_rx_bd_qs_tbl; u32 rx_bd_qs_tbl_offset; u8 __iomem *p_tx_bd_ring[NUM_TX_QUEUES]; - u32 tx_bd_ring_offset[NUM_TX_QUEUES]; u8 __iomem *p_rx_bd_ring[NUM_RX_QUEUES]; - u32 rx_bd_ring_offset[NUM_RX_QUEUES]; u8 __iomem *confBd[NUM_TX_QUEUES]; u8 __iomem *txBd[NUM_TX_QUEUES]; u8 __iomem *rxBd[NUM_RX_QUEUES];