www.pudn.com > 422.rar > close.c


/* close.c
 * Linux serial-bus device driver.
 * Written by wang song yue  email:wsy5228@sina.com
 * This software is released under the GPL-License.
 * Version 0.1  28 october 2005
 */

#define __NO_VERSION__
#include  

#include 
#if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS)
#define MODVERSIONS
#endif

#if defined (MODVERSIONS)
#include 
#endif

#include 

#include "../include/main.h"
#include "../include/close.h"
//#include "../include/i82527.h"
#include "../include/setup.h"

int serial_close(struct inode *inode, struct file *file)
{
//printk("\ni am in serial  close!!!\n");
	/* Give up message buffer memory */
	if (objects_p[MINOR_NR]->fifo->buf_tx_entry)
		del_mem_from_list(objects_p[MINOR_NR]->fifo->buf_tx_entry);
	else
		CANMSG("objects_p[MINOR_NR]->fifo->buf_tx_entry is NULL\n");
	if (objects_p[MINOR_NR]->fifo->buf_rx_entry)
		del_mem_from_list(objects_p[MINOR_NR]->fifo->buf_rx_entry);
	else
		CANMSG("objects_p[MINOR_NR]->fifo->buf_rx_entry is NULL\n");

/* FIXME: what about clearing chip HW status, stopping sending messages etc? */
	
	objects_p[MINOR_NR]->flags &= ~OPENED;
	MOD_DEC_USE_COUNT;

	return 0;
}