dev.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Moved here from drivers/net/net_init.c, which is:
  4. * Written 1993,1994,1995 by Donald Becker.
  5. */
  6. #include <linux/errno.h>
  7. #include <linux/module.h>
  8. #include <linux/netdevice.h>
  9. #include <linux/if_arp.h>
  10. #include <linux/if_ltalk.h>
  11. static void ltalk_setup(struct net_device *dev)
  12. {
  13. /* Fill in the fields of the device structure with localtalk-generic values. */
  14. dev->type = ARPHRD_LOCALTLK;
  15. dev->hard_header_len = LTALK_HLEN;
  16. dev->mtu = LTALK_MTU;
  17. dev->addr_len = LTALK_ALEN;
  18. dev->tx_queue_len = 10;
  19. dev->broadcast[0] = 0xFF;
  20. dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP;
  21. }
  22. /**
  23. * alloc_ltalkdev - Allocates and sets up an localtalk device
  24. * @sizeof_priv: Size of additional driver-private structure to be allocated
  25. * for this localtalk device
  26. *
  27. * Fill in the fields of the device structure with localtalk-generic
  28. * values. Basically does everything except registering the device.
  29. *
  30. * Constructs a new net device, complete with a private data area of
  31. * size @sizeof_priv. A 32-byte (not bit) alignment is enforced for
  32. * this private data area.
  33. */
  34. struct net_device *alloc_ltalkdev(int sizeof_priv)
  35. {
  36. return alloc_netdev(sizeof_priv, "lt%d", NET_NAME_UNKNOWN,
  37. ltalk_setup);
  38. }
  39. EXPORT_SYMBOL(alloc_ltalkdev);