void pm_debug_init(void) { struct task_struct * task; #ifdef PM_PRINT_ENABLE wake_lock_init(&messages_wakelock, WAKE_LOCK_SUSPEND, "pm_message_wakelock"); task = kthread_create(print_thread, NULL, "pm_print"); if (task == 0) { printk("Can't crate power manager print thread!\n"); }else wake_up_process(task); #endif debugfs_init(); }
void pm_debug_init(void) { struct task_struct * task; int ret; ret = request_irq(IRQ_APSYST_INT, sys_cnt_isr, IRQF_TRIGGER_HIGH | IRQF_NO_SUSPEND, "sys_cnt", NULL); if(ret){ printk("sys cnt isr register failed\n"); BUG(); } #ifdef PM_PRINT_ENABLE wake_lock_init(&messages_wakelock, WAKE_LOCK_SUSPEND, "pm_message_wakelock"); task = kthread_create(print_thread, NULL, "pm_print"); if (task == 0) { printk("Can't crate power manager print thread!\n"); }else wake_up_process(task); #endif debugfs_init(); }
/* Setup CAIF for the a virtio device */ static int cfv_probe(struct virtio_device *vdev) { vq_callback_t *vq_cbs = cfv_release_cb; vrh_callback_t *vrh_cbs = cfv_recv; const char *names = "output"; const char *cfv_netdev_name = "cfvrt"; struct net_device *netdev; struct cfv_info *cfv; int err = -EINVAL; netdev = alloc_netdev(sizeof(struct cfv_info), cfv_netdev_name, cfv_netdev_setup); if (!netdev) return -ENOMEM; cfv = netdev_priv(netdev); cfv->vdev = vdev; cfv->ndev = netdev; spin_lock_init(&cfv->tx_lock); /* Get the RX virtio ring. This is a "host side vring". */ err = -ENODEV; if (!vdev->vringh_config || !vdev->vringh_config->find_vrhs) goto err; err = vdev->vringh_config->find_vrhs(vdev, 1, &cfv->vr_rx, &vrh_cbs); if (err) goto err; /* Get the TX virtio ring. This is a "guest side vring". */ err = vdev->config->find_vqs(vdev, 1, &cfv->vq_tx, &vq_cbs, &names); if (err) goto err; /* Get the CAIF configuration from virtio config space, if available */ #define GET_VIRTIO_CONFIG_OPS(_v, _var, _f) \ ((_v)->config->get(_v, offsetof(struct virtio_caif_transf_config, _f), \ &_var, \ FIELD_SIZEOF(struct virtio_caif_transf_config, _f))) if (vdev->config->get) { GET_VIRTIO_CONFIG_OPS(vdev, cfv->tx_hr, headroom); GET_VIRTIO_CONFIG_OPS(vdev, cfv->rx_hr, headroom); GET_VIRTIO_CONFIG_OPS(vdev, cfv->tx_tr, tailroom); GET_VIRTIO_CONFIG_OPS(vdev, cfv->rx_tr, tailroom); GET_VIRTIO_CONFIG_OPS(vdev, cfv->mtu, mtu); GET_VIRTIO_CONFIG_OPS(vdev, cfv->mru, mtu); } else { cfv->tx_hr = CFV_DEF_HEADROOM; cfv->rx_hr = CFV_DEF_HEADROOM; cfv->tx_tr = CFV_DEF_TAILROOM; cfv->rx_tr = CFV_DEF_TAILROOM; cfv->mtu = CFV_DEF_MTU_SIZE; cfv->mru = CFV_DEF_MTU_SIZE; } netdev->needed_headroom = cfv->tx_hr; netdev->needed_tailroom = cfv->tx_tr; /* Disable buffer release interrupts unless we have stopped TX queues */ virtqueue_disable_cb(cfv->vq_tx); netdev->mtu = cfv->mtu - cfv->tx_tr; vdev->priv = cfv; /* Initialize NAPI poll context data */ vringh_kiov_init(&cfv->ctx.riov, NULL, 0); cfv->ctx.head = USHRT_MAX; netif_napi_add(netdev, &cfv->napi, cfv_rx_poll, CFV_DEFAULT_QUOTA); tasklet_init(&cfv->tx_release_tasklet, cfv_tx_release_tasklet, (unsigned long)cfv); /* Carrier is off until netdevice is opened */ netif_carrier_off(netdev); /* register Netdev */ err = register_netdev(netdev); if (err) { dev_err(&vdev->dev, "Unable to register netdev (%d)\n", err); goto err; } debugfs_init(cfv); return 0; err: netdev_warn(cfv->ndev, "CAIF Virtio probe failed:%d\n", err); if (cfv->vr_rx) vdev->vringh_config->del_vrhs(cfv->vdev); if (cfv->vdev) vdev->config->del_vqs(cfv->vdev); free_netdev(netdev); return err; }