.. | .. |
---|
15 | 15 | #include <linux/list.h> |
---|
16 | 16 | #include <linux/wait.h> |
---|
17 | 17 | #include <linux/kobject.h> |
---|
18 | | -#include "most/core.h" |
---|
| 18 | +#include <linux/most.h> |
---|
19 | 19 | |
---|
20 | 20 | #define MEP_HDR_LEN 8 |
---|
21 | 21 | #define MDP_HDR_LEN 16 |
---|
.. | .. |
---|
69 | 69 | |
---|
70 | 70 | static struct list_head net_devices = LIST_HEAD_INIT(net_devices); |
---|
71 | 71 | static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */ |
---|
72 | | -static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */ |
---|
73 | | -static struct core_component comp; |
---|
| 72 | +static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */ |
---|
| 73 | +static struct most_component comp; |
---|
74 | 74 | |
---|
75 | 75 | static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo) |
---|
76 | 76 | { |
---|
77 | 77 | u8 *buff = mbo->virt_address; |
---|
78 | | - const u8 broadcast[] = { 0x03, 0xFF }; |
---|
| 78 | + static const u8 broadcast[] = { 0x03, 0xFF }; |
---|
79 | 79 | const u8 *dest_addr = skb->data + 4; |
---|
80 | 80 | const u8 *eth_type = skb->data + 12; |
---|
81 | 81 | unsigned int payload_len = skb->len - ETH_HLEN; |
---|
.. | .. |
---|
303 | 303 | } |
---|
304 | 304 | |
---|
305 | 305 | static int comp_probe_channel(struct most_interface *iface, int channel_idx, |
---|
306 | | - struct most_channel_config *ccfg, char *name) |
---|
| 306 | + struct most_channel_config *ccfg, char *name, |
---|
| 307 | + char *args) |
---|
307 | 308 | { |
---|
308 | 309 | struct net_dev_context *nd; |
---|
309 | 310 | struct net_dev_channel *ch; |
---|
.. | .. |
---|
506 | 507 | return ret; |
---|
507 | 508 | } |
---|
508 | 509 | |
---|
509 | | -static struct core_component comp = { |
---|
| 510 | +static struct most_component comp = { |
---|
| 511 | + .mod = THIS_MODULE, |
---|
510 | 512 | .name = "net", |
---|
511 | 513 | .probe_channel = comp_probe_channel, |
---|
512 | 514 | .disconnect_channel = comp_disconnect_channel, |
---|
.. | .. |
---|
516 | 518 | |
---|
517 | 519 | static int __init most_net_init(void) |
---|
518 | 520 | { |
---|
519 | | - spin_lock_init(&list_lock); |
---|
| 521 | + int err; |
---|
| 522 | + |
---|
520 | 523 | mutex_init(&probe_disc_mt); |
---|
521 | | - return most_register_component(&comp); |
---|
| 524 | + err = most_register_component(&comp); |
---|
| 525 | + if (err) |
---|
| 526 | + return err; |
---|
| 527 | + err = most_register_configfs_subsys(&comp); |
---|
| 528 | + if (err) { |
---|
| 529 | + most_deregister_component(&comp); |
---|
| 530 | + return err; |
---|
| 531 | + } |
---|
| 532 | + return 0; |
---|
522 | 533 | } |
---|
523 | 534 | |
---|
524 | 535 | static void __exit most_net_exit(void) |
---|
525 | 536 | { |
---|
| 537 | + most_deregister_configfs_subsys(&comp); |
---|
526 | 538 | most_deregister_component(&comp); |
---|
527 | 539 | } |
---|
528 | 540 | |
---|
.. | .. |
---|
552 | 564 | |
---|
553 | 565 | if (m && is_valid_ether_addr(m)) { |
---|
554 | 566 | if (!is_valid_ether_addr(dev->dev_addr)) { |
---|
555 | | - netdev_info(dev, "set mac %02x-%02x-%02x-%02x-%02x-%02x\n", |
---|
556 | | - m[0], m[1], m[2], m[3], m[4], m[5]); |
---|
| 567 | + netdev_info(dev, "set mac %pM\n", m); |
---|
557 | 568 | ether_addr_copy(dev->dev_addr, m); |
---|
558 | 569 | netif_dormant_off(dev); |
---|
559 | 570 | } else if (!ether_addr_equal(dev->dev_addr, m)) { |
---|
560 | | - netdev_warn(dev, "reject mac %02x-%02x-%02x-%02x-%02x-%02x\n", |
---|
561 | | - m[0], m[1], m[2], m[3], m[4], m[5]); |
---|
| 571 | + netdev_warn(dev, "reject mac %pM\n", m); |
---|
562 | 572 | } |
---|
563 | 573 | } |
---|
564 | 574 | |
---|