Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751504AbdISIc4 (ORCPT ); Tue, 19 Sep 2017 04:32:56 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36623 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbdISIcz (ORCPT ); Tue, 19 Sep 2017 04:32:55 -0400 X-Google-Smtp-Source: AOwi7QDPBjz1fdCAGrXnv0J8ib9EdyyLE9mthqb5Z2hpM0BpLVU2GPDBCX4jbwcgglFCoGRH2t4KZA== From: Ilya Matveychikov Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [RFC PATCH 2/3] net/dev/core.c: use ksa_parse_ints instead of get_options Date: Tue, 19 Sep 2017 12:32:52 +0400 References: To: linux-kernel@vger.kernel.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8J8X0tO001136 Content-Length: 1271 Lines: 50 Signed-off-by: Ilya V. Matveychikov --- net/core/dev.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 8515f8f..acda9ac 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -144,6 +144,7 @@ #include #include #include +#include #include "net-sysfs.h" @@ -645,23 +646,18 @@ unsigned long netdev_boot_base(const char *prefix, int unit) */ int __init netdev_boot_setup(char *str) { - int ints[5]; - struct ifmap map; + struct ifmap map = { 0 }; + KSA_DECLARE(ints, int, 4); - str = get_options(str, ARRAY_SIZE(ints), ints); + str = ksa_parse_ints(str, KSA(&ints)); if (!str || !*str) return 0; /* Save settings */ - memset(&map, 0, sizeof(map)); - if (ints[0] > 0) - map.irq = ints[1]; - if (ints[0] > 1) - map.base_addr = ints[2]; - if (ints[0] > 2) - map.mem_start = ints[3]; - if (ints[0] > 3) - map.mem_end = ints[4]; + map.irq = KSA_GET(&ints, 0, 0); + map.base_addr = KSA_GET(&ints, 1, 0); + map.mem_start = KSA_GET(&ints, 2, 0); + map.mem_end = KSA_GET(&ints, 3, 0); /* Add new entry to the list */ return netdev_boot_setup_add(str, &map); -- 2.7.4