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: 366691 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 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: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: 366725 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 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: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: 366708 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 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: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: 366724 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 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: 366731 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 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: 366728 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 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: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: 366726 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 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: 366729 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 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: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: 366730 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 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;