From 30bc83a735dd77246984c0071abad170d16eb922 Mon Sep 17 00:00:00 2001 From: DuanqiangWen Date: Tue, 15 Nov 2022 02:34:00 -0500 Subject: [PATCH] openeuler: net: txgbe: fix arm32 compile error because 64bit div and warnning driver inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5Y6RT CVE: NA 1.fix arm32 compile error because 64bit div operate in txgbe_get_thermal_sensor_data function 2.fix txgbe_sysfs compile warning. Signed-off-by: DuanqiangWen --- drivers/net/ethernet/netswift/txgbe/txgbe_hw.c | 16 ++++++++-------- .../net/ethernet/netswift/txgbe/txgbe_sysfs.c | 11 ----------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/netswift/txgbe/txgbe_hw.c b/drivers/net/ethernet/netswift/txgbe/txgbe_hw.c index 3f5187b0ef23..5c04af677eb8 100644 --- a/drivers/net/ethernet/netswift/txgbe/txgbe_hw.c +++ b/drivers/net/ethernet/netswift/txgbe/txgbe_hw.c @@ -3217,10 +3217,10 @@ s32 txgbe_get_thermal_sensor_data(struct txgbe_hw *hw) tsv = tsv < 1200 ? tsv : 1200; tsv = -(48380 << 8) / 1000 - + tsv * (31020 << 8) / 100000 - - tsv * tsv * (18201 << 8) / 100000000 - + tsv * tsv * tsv * (81542 << 8) / 1000000000000 - - tsv * tsv * tsv * tsv * (16743 << 8) / 1000000000000000; + + div64_s64(tsv * (31020 << 8), 100000) + - div64_s64(tsv * tsv * (18201 << 8), 100000000) + + div64_s64(tsv * tsv * tsv * (81542 << 8), 1000000000000) + - div64_s64(tsv * tsv * tsv * tsv * (16743 << 8), 1000000000000000); tsv >>= 8; data->sensor.temp = (s16)tsv; @@ -3231,10 +3231,10 @@ s32 txgbe_get_thermal_sensor_data(struct txgbe_hw *hw) tsv = tsv & TXGBE_TS_ST_DATA_OUT_MASK; tsv = tsv < 1200 ? tsv : 1200; tsv = -(48380 << 8) / 1000 - + tsv * (31020 << 8) / 100000 - - tsv * tsv * (18201 << 8) / 100000000 - + tsv * tsv * tsv * (81542 << 8) / 1000000000000 - - tsv * tsv * tsv * tsv * (16743 << 8) / 1000000000000000; + + div64_s64(tsv * (31020 << 8), 100000) + - div64_s64(tsv * tsv * (18201 << 8), 100000000) + + div64_s64(tsv * tsv * tsv * (81542 << 8), 1000000000000) + - div64_s64(tsv * tsv * tsv * tsv * (16743 << 8), 1000000000000000); tsv >>= 8; data->sensor.temp = (s16)tsv; diff --git a/drivers/net/ethernet/netswift/txgbe/txgbe_sysfs.c b/drivers/net/ethernet/netswift/txgbe/txgbe_sysfs.c index 29a4be546ac5..80084c96f47f 100644 --- a/drivers/net/ethernet/netswift/txgbe/txgbe_sysfs.c +++ b/drivers/net/ethernet/netswift/txgbe/txgbe_sysfs.c @@ -1,14 +1,3 @@ -/* - * WangXun 10 Gigabit PCI Express Linux driver - * Copyright (c) 2015 - 2017 Beijing WangXun Technology Co., Ltd. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 - 2022 Beijing WangXun Technology Co., Ltd. */ -- GitLab