From patchwork Fri Feb 23 13:15:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 129363 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp593652lja; Fri, 23 Feb 2018 05:16:04 -0800 (PST) X-Google-Smtp-Source: AH8x226KMVDCvZPeSvqhuoOpFtR12R7hY4baT2CjUgX7XxlpaRd7cYOTAjU0DBVafStdDttp44yx X-Received: by 10.101.70.133 with SMTP id h5mr1476907pgr.166.1519391764452; Fri, 23 Feb 2018 05:16:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519391764; cv=none; d=google.com; s=arc-20160816; b=Ozv++w6PndxxS+e1WoWOxe3w7EKdCtdgMUT3WiNSHhiNr/B1NEDkuYQmh4iSCqYsn9 G7EfAb2a+XPWIYUjTJN7o4c/zItEfA+uVdmtl0qxaObbekIXpqdwp9ARxMICxzUyvJbd cUV1oxjvP18Efy8JZQF4N2XEy21SzPmH1LKYVzB3shvMxKldWFoVSMg+1NKu7aQLZmhq UpAJ3Ck2tTgkuxyBkB9Gvhs2dajDcj3W5+4LZdUCErTgA3ryJqFTuyYqsKjgZwUU4oGS U1owGgXnpwOClBadeeO6hDMKGxy+ec2rURZmZ19kSuqiT9B13ENXEChggN0Wr9Jr79/4 BlhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=dxavHwBB87447awt/2jIUq+OI+lcAZeFn9xzyT8O8Tw=; b=thRJiMmir8RRo9N4Blweb+ggBZp/+/61RhIpETGynUuTqMPobusAqltEA315PuDalR z7bHhr9nVpUqon1tWTUL6RkuDf6u3aeuQqKvG/qyG3GGOaXNY6V0JsU4fu2ixTBA6Aya Y0E02YM4KqXqSkHo+1dlQniGy+ofYORjkEjClCu1U9fjLVjWjKSLx5BNL9jyvJ7lni56 m+dLqKxZ3zET/whAw/M9KaDpXnDK/vBnkf+o/bV0v+NRF9c44Tl9TtQ2RhzUYEi+g7aT iJtOfd+rONv/EIvcBg17JIlM+7ugtqAAa1Wdi2hEgciYfukmkopcZ6LuBDPLUse4EYh3 Oy1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b89-v6si1769221plb.809.2018.02.23.05.16.04; Fri, 23 Feb 2018 05:16:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751597AbeBWNQA (ORCPT + 28 others); Fri, 23 Feb 2018 08:16:00 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:35797 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbeBWNP6 (ORCPT ); Fri, 23 Feb 2018 08:15:58 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0LeQDB-1eO9dC3NUr-00q8Zd; Fri, 23 Feb 2018 14:15:43 +0100 From: Arnd Bergmann To: Arkadi Sharshevsky , Jiri Pirko , Ido Schimmel Cc: Arnd Bergmann , "David S. Miller" , Wei Yongjun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next PATCH 1/2] mlxsw: spectrum_kvdl: use div_u64() for 64-bit division Date: Fri, 23 Feb 2018 14:15:31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WB9iYuo8v8ZQ5BgX0tmu/2Ou rArcInFvHf6fFU9quBGaEjj3/XT4T6hk8EoGKw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Calculating the number of entries now uses 64-bit arithmetic that causes a link error on 32-bit architectures: drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.o: In function `mlxsw_sp_kvdl_init': spectrum_kvdl.c:(.text+0x51c): undefined reference to `__aeabi_uldivmod' We could probably use a 32-bit division here as before, but since this is not in a performance critical path, div_u64() seems cleaner here. Fixes: 887839e6960d ("mlxsw: spectrum_kvdl: Add support for dynamic partition set") Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 Acked-by: Arkadi Sharshevsky diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c index d27fa57ad3c3..6fd701db90c9 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c @@ -278,7 +278,7 @@ static int mlxsw_sp_kvdl_part_init(struct mlxsw_sp *mlxsw_sp, resource_size = info->end_index - info->start_index + 1; } - nr_entries = resource_size / info->alloc_size; + nr_entries = div_u64(resource_size, info->alloc_size); usage_size = BITS_TO_LONGS(nr_entries) * sizeof(unsigned long); part = kzalloc(sizeof(*part) + usage_size, GFP_KERNEL); if (!part)