コード例 #1
0
ファイル: bfin_sir.c プロジェクト: 325116067/semc-qsd8x50
static int bfin_sir_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct bfin_sir_port *sir_port;
	struct net_device *dev;
	struct bfin_sir_self *self;

	sir_port = platform_get_drvdata(pdev);
	if (!sir_port)
		return 0;

	dev = sir_port->dev;
	self = netdev_priv(dev);
	if (self->open) {
		flush_work(&self->work);
		bfin_sir_shutdown(self->sir_port, dev);
		netif_device_detach(dev);
	}

	return 0;
}
コード例 #2
0
ファイル: bfin_sir.c プロジェクト: 513855417/linux
static int bfin_sir_open(struct net_device *dev)
{
	struct bfin_sir_self *self = netdev_priv(dev);
	struct bfin_sir_port *port = self->sir_port;
	int err;

	self->newspeed = 0;
	self->speed = 9600;

	spin_lock_init(&self->lock);

	err = bfin_sir_startup(port, dev);
	if (err)
		goto err_startup;

	bfin_sir_set_speed(port, 9600);

	self->irlap = irlap_open(dev, &self->qos, DRIVER_NAME);
	if (!self->irlap) {
		err = -ENOMEM;
		goto err_irlap;
	}

	INIT_WORK(&self->work, bfin_sir_send_work);

	/*
	 * Now enable the interrupt then start the queue
	 */
	self->open = 1;
	bfin_sir_enable_rx(port);

	netif_start_queue(dev);

	return 0;

err_irlap:
	self->open = 0;
	bfin_sir_shutdown(port, dev);
err_startup:
	return err;
}
コード例 #3
0
ファイル: bfin_sir.c プロジェクト: 325116067/semc-qsd8x50
static int bfin_sir_stop(struct net_device *dev)
{
	struct bfin_sir_self *self = netdev_priv(dev);

	flush_work(&self->work);
	bfin_sir_shutdown(self->sir_port, dev);

	if (self->rxskb) {
		dev_kfree_skb(self->rxskb);
		self->rxskb = NULL;
	}

	/* Stop IrLAP */
	if (self->irlap) {
		irlap_close(self->irlap);
		self->irlap = NULL;
	}

	netif_stop_queue(dev);
	self->open = 0;

	return 0;
}