ng_ubt.c (292080) | ng_ubt.c (298813) |
---|---|
1/* 2 * ng_ubt.c 3 */ 4 5/*- 6 * Copyright (c) 2001-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com> 7 * All rights reserved. 8 * --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * $Id: ng_ubt.c,v 1.16 2003/10/10 19:15:06 max Exp $ | 1/* 2 * ng_ubt.c 3 */ 4 5/*- 6 * Copyright (c) 2001-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com> 7 * All rights reserved. 8 * --- 14 unchanged lines hidden (view full) --- 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * $Id: ng_ubt.c,v 1.16 2003/10/10 19:15:06 max Exp $ |
31 * $FreeBSD: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c 292080 2015-12-11 05:28:00Z imp $ | 31 * $FreeBSD: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c 298813 2016-04-29 21:25:05Z pfg $ |
32 */ 33 34/* 35 * NOTE: ng_ubt2 driver has a split personality. On one side it is 36 * a USB device driver and on the other it is a Netgraph node. This 37 * driver will *NOT* create traditional /dev/ enties, only Netgraph 38 * node. 39 * --- 13 unchanged lines hidden (view full) --- 53 * 1) USB context. This is where all the USB related stuff happens. All 54 * callbacks run in this context. All callbacks are called (by USB) with 55 * appropriate interface lock held. It is (generally) allowed to grab 56 * any additional locks. 57 * 58 * 2) Netgraph context. This is where all the Netgraph related stuff happens. 59 * Since we mark node as WRITER, the Netgraph node will be "locked" (from 60 * Netgraph point of view). Any variable that is only modified from the | 32 */ 33 34/* 35 * NOTE: ng_ubt2 driver has a split personality. On one side it is 36 * a USB device driver and on the other it is a Netgraph node. This 37 * driver will *NOT* create traditional /dev/ enties, only Netgraph 38 * node. 39 * --- 13 unchanged lines hidden (view full) --- 53 * 1) USB context. This is where all the USB related stuff happens. All 54 * callbacks run in this context. All callbacks are called (by USB) with 55 * appropriate interface lock held. It is (generally) allowed to grab 56 * any additional locks. 57 * 58 * 2) Netgraph context. This is where all the Netgraph related stuff happens. 59 * Since we mark node as WRITER, the Netgraph node will be "locked" (from 60 * Netgraph point of view). Any variable that is only modified from the |
61 * Netgraph context does not require any additonal locking. It is generally | 61 * Netgraph context does not require any additional locking. It is generally |
62 * *NOT* allowed to grab *ANY* additional locks. Whatever you do, *DO NOT* 63 * grab any lock in the Netgraph context that could cause de-scheduling of 64 * the Netgraph thread for significant amount of time. In fact, the only 65 * lock that is allowed in the Netgraph context is the sc_ng_mtx lock. 66 * Also make sure that any code that is called from the Netgraph context 67 * follows the rule above. 68 * 69 * 3) Taskqueue context. This is where ubt_task runs. Since we are generally --- 1388 unchanged lines hidden (view full) --- 1458 */ 1459 1460static int 1461ng_ubt_shutdown(node_p node) 1462{ 1463 if (node->nd_flags & NGF_REALLY_DIE) { 1464 /* 1465 * We came here because the USB device is being | 62 * *NOT* allowed to grab *ANY* additional locks. Whatever you do, *DO NOT* 63 * grab any lock in the Netgraph context that could cause de-scheduling of 64 * the Netgraph thread for significant amount of time. In fact, the only 65 * lock that is allowed in the Netgraph context is the sc_ng_mtx lock. 66 * Also make sure that any code that is called from the Netgraph context 67 * follows the rule above. 68 * 69 * 3) Taskqueue context. This is where ubt_task runs. Since we are generally --- 1388 unchanged lines hidden (view full) --- 1458 */ 1459 1460static int 1461ng_ubt_shutdown(node_p node) 1462{ 1463 if (node->nd_flags & NGF_REALLY_DIE) { 1464 /* 1465 * We came here because the USB device is being |
1466 * detached, so stop being persistant. | 1466 * detached, so stop being persistent. |
1467 */ 1468 NG_NODE_SET_PRIVATE(node, NULL); 1469 NG_NODE_UNREF(node); 1470 } else 1471 NG_NODE_REVIVE(node); /* tell ng_rmnode we are persisant */ 1472 1473 return (0); 1474} /* ng_ubt_shutdown */ --- 401 unchanged lines hidden --- | 1467 */ 1468 NG_NODE_SET_PRIVATE(node, NULL); 1469 NG_NODE_UNREF(node); 1470 } else 1471 NG_NODE_REVIVE(node); /* tell ng_rmnode we are persisant */ 1472 1473 return (0); 1474} /* ng_ubt_shutdown */ --- 401 unchanged lines hidden --- |