forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-20 ea08eeccae9297f7aabd2ef7f0c2517ac4549acc
kernel/drivers/net/wan/hdlc_cisco.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Generic HDLC support routines for Linux
34 * Cisco HDLC support
45 *
56 * Copyright (C) 2000 - 2006 Krzysztof Halasa <khc@pm.waw.pl>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of version 2 of the GNU General Public License
9
- * as published by the Free Software Foundation.
107 */
118
129 #include <linux/errno.h>
....@@ -78,7 +75,7 @@
7875 {
7976 struct hdlc_header *data;
8077 #ifdef DEBUG_HARD_HEADER
81
- printk(KERN_DEBUG "%s: cisco_hard_header called\n", dev->name);
78
+ netdev_dbg(dev, "%s called\n", __func__);
8279 #endif
8380
8481 skb_push(skb, sizeof(struct hdlc_header));
....@@ -104,7 +101,7 @@
104101 skb = dev_alloc_skb(sizeof(struct hdlc_header) +
105102 sizeof(struct cisco_packet));
106103 if (!skb) {
107
- netdev_warn(dev, "Memory squeeze on cisco_keepalive_send()\n");
104
+ netdev_warn(dev, "Memory squeeze on %s()\n", __func__);
108105 return;
109106 }
110107 skb_reserve(skb, 4);
....@@ -197,16 +194,15 @@
197194 mask = ~cpu_to_be32(0); /* is the mask correct? */
198195
199196 if (in_dev != NULL) {
200
- struct in_ifaddr **ifap = &in_dev->ifa_list;
197
+ const struct in_ifaddr *ifa;
201198
202
- while (*ifap != NULL) {
199
+ in_dev_for_each_ifa_rcu(ifa, in_dev) {
203200 if (strcmp(dev->name,
204
- (*ifap)->ifa_label) == 0) {
205
- addr = (*ifap)->ifa_local;
206
- mask = (*ifap)->ifa_mask;
201
+ ifa->ifa_label) == 0) {
202
+ addr = ifa->ifa_local;
203
+ mask = ifa->ifa_mask;
207204 break;
208205 }
209
- ifap = &(*ifap)->ifa_next;
210206 }
211207
212208 cisco_keepalive_send(dev, CISCO_ADDR_REPLY,