dvb_net.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * dvb_net.h
  3. *
  4. * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 2.1
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #ifndef _DVB_NET_H_
  18. #define _DVB_NET_H_
  19. #include <linux/module.h>
  20. #include <media/dvbdev.h>
  21. struct net_device;
  22. #define DVB_NET_DEVICES_MAX 10
  23. #ifdef CONFIG_DVB_NET
  24. /**
  25. * struct dvb_net - describes a DVB network interface
  26. *
  27. * @dvbdev: pointer to &struct dvb_device.
  28. * @device: array of pointers to &struct net_device.
  29. * @state: array of integers to each net device. A value
  30. * different than zero means that the interface is
  31. * in usage.
  32. * @exit: flag to indicate when the device is being removed.
  33. * @demux: pointer to &struct dmx_demux.
  34. * @ioctl_mutex: protect access to this struct.
  35. * @remove_mutex: mutex that avoids a race condition between a callback
  36. * called when the hardware is disconnected and the
  37. * file_operations of dvb_net.
  38. *
  39. * Currently, the core supports up to %DVB_NET_DEVICES_MAX (10) network
  40. * devices.
  41. */
  42. struct dvb_net {
  43. struct dvb_device *dvbdev;
  44. struct net_device *device[DVB_NET_DEVICES_MAX];
  45. int state[DVB_NET_DEVICES_MAX];
  46. unsigned int exit:1;
  47. struct dmx_demux *demux;
  48. struct mutex ioctl_mutex;
  49. struct mutex remove_mutex;
  50. };
  51. /**
  52. * dvb_net_init - nitializes a digital TV network device and registers it.
  53. *
  54. * @adap: pointer to &struct dvb_adapter.
  55. * @dvbnet: pointer to &struct dvb_net.
  56. * @dmxdemux: pointer to &struct dmx_demux.
  57. */
  58. int dvb_net_init(struct dvb_adapter *adap, struct dvb_net *dvbnet,
  59. struct dmx_demux *dmxdemux);
  60. /**
  61. * dvb_net_release - releases a digital TV network device and unregisters it.
  62. *
  63. * @dvbnet: pointer to &struct dvb_net.
  64. */
  65. void dvb_net_release(struct dvb_net *dvbnet);
  66. #else
  67. struct dvb_net {
  68. struct dvb_device *dvbdev;
  69. };
  70. static inline void dvb_net_release(struct dvb_net *dvbnet)
  71. {
  72. }
  73. static inline int dvb_net_init(struct dvb_adapter *adap,
  74. struct dvb_net *dvbnet, struct dmx_demux *dmx)
  75. {
  76. return 0;
  77. }
  78. #endif /* ifdef CONFIG_DVB_NET */
  79. #endif