diff options
Diffstat (limited to 'net/tipc/ib_media.c')
-rw-r--r-- | net/tipc/ib_media.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/net/tipc/ib_media.c b/net/tipc/ib_media.c index 2a2864c25e15..9934a32bfa87 100644 --- a/net/tipc/ib_media.c +++ b/net/tipc/ib_media.c | |||
@@ -155,8 +155,7 @@ static void setup_bearer(struct work_struct *work) | |||
155 | */ | 155 | */ |
156 | static int enable_bearer(struct tipc_bearer *tb_ptr) | 156 | static int enable_bearer(struct tipc_bearer *tb_ptr) |
157 | { | 157 | { |
158 | struct net_device *dev = NULL; | 158 | struct net_device *dev; |
159 | struct net_device *pdev = NULL; | ||
160 | struct ib_bearer *ib_ptr = &ib_bearers[0]; | 159 | struct ib_bearer *ib_ptr = &ib_bearers[0]; |
161 | struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; | 160 | struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; |
162 | char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1; | 161 | char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1; |
@@ -171,15 +170,7 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) | |||
171 | } | 170 | } |
172 | 171 | ||
173 | /* Find device with specified name */ | 172 | /* Find device with specified name */ |
174 | read_lock(&dev_base_lock); | 173 | dev = dev_get_by_name(&init_net, driver_name); |
175 | for_each_netdev(&init_net, pdev) { | ||
176 | if (!strncmp(pdev->name, driver_name, IFNAMSIZ)) { | ||
177 | dev = pdev; | ||
178 | dev_hold(dev); | ||
179 | break; | ||
180 | } | ||
181 | } | ||
182 | read_unlock(&dev_base_lock); | ||
183 | if (!dev) | 174 | if (!dev) |
184 | return -ENODEV; | 175 | return -ENODEV; |
185 | 176 | ||
@@ -244,9 +235,9 @@ static void disable_bearer(struct tipc_bearer *tb_ptr) | |||
244 | * specified device. | 235 | * specified device. |
245 | */ | 236 | */ |
246 | static int recv_notification(struct notifier_block *nb, unsigned long evt, | 237 | static int recv_notification(struct notifier_block *nb, unsigned long evt, |
247 | void *dv) | 238 | void *ptr) |
248 | { | 239 | { |
249 | struct net_device *dev = (struct net_device *)dv; | 240 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
250 | struct ib_bearer *ib_ptr = &ib_bearers[0]; | 241 | struct ib_bearer *ib_ptr = &ib_bearers[0]; |
251 | struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; | 242 | struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; |
252 | 243 | ||
@@ -301,13 +292,7 @@ static int ib_addr2str(struct tipc_media_addr *a, char *str_buf, int str_size) | |||
301 | if (str_size < 60) /* 60 = 19 * strlen("xx:") + strlen("xx\0") */ | 292 | if (str_size < 60) /* 60 = 19 * strlen("xx:") + strlen("xx\0") */ |
302 | return 1; | 293 | return 1; |
303 | 294 | ||
304 | sprintf(str_buf, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:" | 295 | sprintf(str_buf, "%20phC", a->value); |
305 | "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", | ||
306 | a->value[0], a->value[1], a->value[2], a->value[3], | ||
307 | a->value[4], a->value[5], a->value[6], a->value[7], | ||
308 | a->value[8], a->value[9], a->value[10], a->value[11], | ||
309 | a->value[12], a->value[13], a->value[14], a->value[15], | ||
310 | a->value[16], a->value[17], a->value[18], a->value[19]); | ||
311 | 296 | ||
312 | return 0; | 297 | return 0; |
313 | } | 298 | } |