From patchwork Wed May 10 20:53:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13237261 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CC7F21CDD for ; Wed, 10 May 2023 20:59:14 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2074.outbound.protection.outlook.com [40.107.244.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5A15729D for ; Wed, 10 May 2023 13:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CTWicWeyFSgtfmRmnRxHvOj1L3ypDkVg8I/TqQ8hp45KPm7oYJA18+s7ivK0zarqCbXY3/FSK31Ga7cgd6t5pnd9ab3gEFZRGvCk774qVIznp97qtam6FX07oy9am7qHqzEYSSUmf9srKcBA1quYyyLnHZzuTvOuw/jMO6RZf9OgRT2iK7PDOvYSFCwAfhbcojL+4rTVr0DhwSHzkdBrHDGTK24xkFavonW9y/VqR95AOjWtbkbK9n1wzV9XfmINH8LCTL0Dh0/Gn2hgZGZKeTMU4ZtEmEmGBURcZxsVXyr0cNYkz9SvIMonuqtV+JFNvOyctkDSHuZdifLs0B5SCw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c1KmTdOfEKSuPeNZeRYC4urBdlOKgDxcAA+qdlwQfr8=; b=HRxIEZGvtIIFRyIYTU6U5eaWsvvByHxPV4NKKPBjmgfQWiuymhGJ/+8WgXAL0+7NiozuUbNyGSyek+/CNxIJMDk4El7A4GKWwA0nhobr3ragboyZu4QqTWAJD0v2lNueh642/obEwdUbF1IdtquTCP1P7Ys1h/8F6n5k2XVmyp0Qh5axlo4PY7athnsSOzv9RAhwYz+h+buW7/Sdgdw6ut7VjG0nalaS8bztQ5dCRy4pX8UWGcFjaRGmqbA7jE++C2aQQwBmTbp25ucVZ7t5wxeMz0hAR7SjTSrc+vJpbMDRGEl7yYQdpXlJi5kfPbySm9Xg0kV6q69iKSa8uHvVQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c1KmTdOfEKSuPeNZeRYC4urBdlOKgDxcAA+qdlwQfr8=; b=YLeA9Yf1SGPutlcOM0gDcAtqQ0MHnOCjWkiludg/4GlPzWw8BdZUtXVzfgzzLxb2yaHpvaxtAnzB7hhOihMvQmqz7RQsAosec9ZRv7JifetSEUO8iENqwJEq3iI6k29+exAuoVUg1rAPDCLiPguZGHUR3Tb0oVqvZ7AZojFzSqXtw6kWA7zwOqPN8f+EsBg/FkyoZvTidjRJmgDHww9FX4NrF8y+xHGTxTmVv6pMgRqP7iYsI5U2USMlmZKDXxT6sn81K97h7Oq6d1uCaU0i3bb2xNHozZIES7aucRJJUmBDEEi48WpcFO6NmblJsZuDi/FS4iz77PNrH7OMgaDHYQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by MW5PR12MB5624.namprd12.prod.outlook.com (2603:10b6:303:19d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Wed, 10 May 2023 20:53:52 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::de5a:9000:2d2f:a861]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::de5a:9000:2d2f:a861%7]) with mapi id 15.20.6363.033; Wed, 10 May 2023 20:53:52 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Saeed Mahameed , Gal Pressman , Tariq Toukan , "David S. Miller" , Jakub Kicinski , Richard Cochran , Jacob Keller Subject: [PATCH net-next 3/9] testptp: Remove magic numbers related to nanosecond to second conversion Date: Wed, 10 May 2023 13:53:00 -0700 Message-Id: <20230510205306.136766-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230510205306.136766-1-rrameshbabu@nvidia.com> References: <20230510205306.136766-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR07CA0035.namprd07.prod.outlook.com (2603:10b6:a02:bc::48) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB2743:EE_|MW5PR12MB5624:EE_ X-MS-Office365-Filtering-Correlation-Id: 4be20c72-023a-4555-3aaf-08db5198a967 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cdlzp1trc+ZdcWF16RXHCu9zn/MyTImLl/eWndzCBjW2RS8W9vbCv1k6kMYcj2NGCFlvMmMwO0KSlLxRybwL7nbELA5tsBa/J8JvpzbUu2A5HFpr9+me6xwXnl968qNVgeTlrK7nK3adMxw/6EaQlr/W/W760iqAY7w6YbDH4bVmh1QhKwrNC93fELtEIew4vlmDuVvtVaYRee1NXn5F/X3VbYKnX19FSioFXhAK2zZTl6Zle8tv28rd+5RnqIdatOWBW4SZnpxPDzhoiPbUrmn1e717N2ve8Vg1lcUtg00gp95FcvsGbhC2cZiEhlPacptcpT/gIiFMpzUDuPMPtyBfUW8wFhFtrLuICihxuvvZVTVgFDRmj9g7N5VrApnnLwd+t3qvkswd6tSeOY2rbjIQMa+RUEOk9ve4BEIIIf0kJue/3OgpbkPt2gE9foQkE8i+OwK4nQJztytrP/tKgTsELxW0au8r9o5pWwQEhTdu6O4jb3Z5urRzB7PnrVzLuASixqXiRbpxjKpFo4wZxjnOordH7QhJJY+oCw3M3exNo2jjyuHTrteCLouuph7l X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(39860400002)(366004)(396003)(376002)(451199021)(86362001)(5660300002)(41300700001)(4326008)(6666004)(38100700002)(316002)(6486002)(6506007)(6512007)(26005)(1076003)(478600001)(54906003)(36756003)(2906002)(8936002)(8676002)(186003)(83380400001)(66946007)(6916009)(66476007)(66556008)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 48Xw5OWM4EmS+kLG6Jj9Rl+ooW/4OYyFvbKBAVQ/bIywxvCB69n6XZg4ZGgxczdwLt4OXmAIIp8kK4KUs4qGbG4NGw+unHwRAz0CGqY+GWUvVH6MzTaMdTyhLnUpP3CQz9ysyINkyQhkusf0cTuHhTXwxg7b3pilhHxO7Zm5ZL6aK9ui+zhl6ByzGwMYLsyt/J/IlKyNUc2RrNOeZ90wadIRzIHMUWC+doQbcbginspHq8O8+LDV5Le5D8pcC+M7anPwVLv6GiH1FQ2doHq65bd/cBMAos8TWEo5onTWqjm9CeJfsP6rLpmXBSTl90/v3tGCFhPx9qxEaR96mgtWeRa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9am38nU/tUHX5zGdt1afZjsY77IQ/G4q9eBT358s53FN4aHAeGx9Taru5P/XZgEYSozvp1na5uyh1JSf4UvbjehPplULek0oTqaHNx4sG/dGSnW++oB5Hi36Vat6E14zlF07b8NdSZF3L0RULPKKPWCG+YXJX5hkGdYgdT0uf0PQ3ioRJ98zKBNis6ZJn/wMzRqENZJVQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4be20c72-023a-4555-3aaf-08db5198a967 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2023 20:53:52.3949 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LPUZmESEoFj2Gv43SRiAffV0dqn+E15wV7iw/GEHhpijxPG2Mp8ghHLpe4wN+mg15YnryMTEAQ4sn0KXm4Rnlg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5624 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Use existing NSEC_PER_SEC declaration in place of hardcoded magic numbers. Cc: Jakub Kicinski Cc: Shuah Khan Cc: Richard Cochran Cc: Maciek Machnikowski Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran --- tools/testing/selftests/ptp/testptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c index 198ad5f32187..ca2b03d57aef 100644 --- a/tools/testing/selftests/ptp/testptp.c +++ b/tools/testing/selftests/ptp/testptp.c @@ -110,7 +110,7 @@ static long ppb_to_scaled_ppm(int ppb) static int64_t pctns(struct ptp_clock_time *t) { - return t->sec * 1000000000LL + t->nsec; + return t->sec * NSEC_PER_SEC + t->nsec; } static void usage(char *progname) @@ -317,7 +317,7 @@ int main(int argc, char *argv[]) tx.time.tv_usec = adjns; while (tx.time.tv_usec < 0) { tx.time.tv_sec -= 1; - tx.time.tv_usec += 1000000000; + tx.time.tv_usec += NSEC_PER_SEC; } if (clock_adjtime(clkid, &tx) < 0) {