コード例 #1
0
ファイル: usbserial.c プロジェクト: fgeraci/cs518-sched
static void serial_close(struct tty_struct *tty, struct file * filp)
{
	struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data;
	struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);

	if (!serial) {
		return;
	}

	dbg(__FUNCTION__ " - port %d", port->number);
	
	if (!port->open_count) {
		dbg (__FUNCTION__ " - port not opened");
		return;
	}

	/* pass on to the driver specific version of this function if it is available */
	if (serial->type->close) {
		serial->type->close(port, filp);
		if (serial->type->owner)
			__MOD_DEC_USE_COUNT(serial->type->owner);
	} else {
		generic_close(port, filp);
	}
}	
コード例 #2
0
ファイル: stream.c プロジェクト: ndparker/wtf
static PyObject *
GenericStreamType__del__(genericstreamobject *self, PyObject *args)
{
    if (generic_close(self) == -1)
        return NULL;
    Py_RETURN_NONE;
}
コード例 #3
0
ファイル: usbserial.c プロジェクト: nhanh0/hah
static void generic_shutdown (struct usb_serial *serial)
{
	int i;

	dbg (__FUNCTION__);

	/* stop reads and writes on all ports */
	for (i=0; i < serial->num_ports; ++i) {
		while (serial->port[i].open_count > 0) {
			generic_close (&serial->port[i], NULL);
		}
	}
}
コード例 #4
0
static void __serial_close(struct usb_serial_port *port, struct file *filp)
{
	if (!port->open_count) {
		dbg ("%s - port not opened", __FUNCTION__);
		return;
	}

	--port->open_count;
	if (port->open_count <= 0) {
		/* only call the device specific close if this 
		 * port is being closed by the last owner */
		if (port->serial->type->close)
			port->serial->type->close(port, filp);
		else
			generic_close(port, filp);
		port->open_count = 0;
	}

	if (port->serial->type->owner)
		__MOD_DEC_USE_COUNT(port->serial->type->owner);
}