Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1734738 > unrolled thread
| Started by | Ilya Matveychikov <matvejchikov@gmail.com> |
|---|---|
| First post | 2017-09-19 10:40 +0200 |
| Last post | 2017-09-19 10:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RFC PATCH 2/3] net/dev/core.c: use ksa_parse_ints instead of get_options Ilya Matveychikov <matvejchikov@gmail.com> - 2017-09-19 10:40 +0200
| From | Ilya Matveychikov <matvejchikov@gmail.com> |
|---|---|
| Date | 2017-09-19 10:40 +0200 |
| Subject | [RFC PATCH 2/3] net/dev/core.c: use ksa_parse_ints instead of get_options |
| Message-ID | <urmet-1OZ-1@gated-at.bofh.it> |
Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
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 <linux/netfilter_ingress.h>
#include <linux/crash_dump.h>
#include <linux/sctp.h>
+#include <linux/small_array.h>
#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
Back to top | Article view | linux.kernel
csiph-web