Lines Matching refs:reply
757 lcs_get_reply(struct lcs_reply *reply) in lcs_get_reply() argument
759 refcount_inc(&reply->refcnt); in lcs_get_reply()
763 lcs_put_reply(struct lcs_reply *reply) in lcs_put_reply() argument
765 if (refcount_dec_and_test(&reply->refcnt)) in lcs_put_reply()
766 kfree(reply); in lcs_put_reply()
772 struct lcs_reply *reply; in lcs_alloc_reply() local
776 reply = kzalloc(sizeof(struct lcs_reply), GFP_ATOMIC); in lcs_alloc_reply()
777 if (!reply) in lcs_alloc_reply()
779 refcount_set(&reply->refcnt, 1); in lcs_alloc_reply()
780 reply->sequence_no = cmd->sequence_no; in lcs_alloc_reply()
781 reply->received = 0; in lcs_alloc_reply()
782 reply->rc = 0; in lcs_alloc_reply()
783 init_waitqueue_head(&reply->wait_q); in lcs_alloc_reply()
785 return reply; in lcs_alloc_reply()
795 struct lcs_reply *reply; in lcs_notify_lancmd_waiters() local
800 reply = list_entry(l, struct lcs_reply, list); in lcs_notify_lancmd_waiters()
801 if (reply->sequence_no == cmd->sequence_no) { in lcs_notify_lancmd_waiters()
802 lcs_get_reply(reply); in lcs_notify_lancmd_waiters()
803 list_del_init(&reply->list); in lcs_notify_lancmd_waiters()
804 if (reply->callback != NULL) in lcs_notify_lancmd_waiters()
805 reply->callback(card, cmd); in lcs_notify_lancmd_waiters()
806 reply->received = 1; in lcs_notify_lancmd_waiters()
807 reply->rc = cmd->return_code; in lcs_notify_lancmd_waiters()
808 wake_up(&reply->wait_q); in lcs_notify_lancmd_waiters()
809 lcs_put_reply(reply); in lcs_notify_lancmd_waiters()
822 struct lcs_reply *reply = from_timer(reply, t, timer); in lcs_lancmd_timeout() local
827 spin_lock_irqsave(&reply->card->lock, flags); in lcs_lancmd_timeout()
829 &reply->card->lancmd_waiters,list) { in lcs_lancmd_timeout()
830 if (reply == list_reply) { in lcs_lancmd_timeout()
831 lcs_get_reply(reply); in lcs_lancmd_timeout()
832 list_del_init(&reply->list); in lcs_lancmd_timeout()
833 spin_unlock_irqrestore(&reply->card->lock, flags); in lcs_lancmd_timeout()
834 reply->received = 1; in lcs_lancmd_timeout()
835 reply->rc = -ETIME; in lcs_lancmd_timeout()
836 wake_up(&reply->wait_q); in lcs_lancmd_timeout()
837 lcs_put_reply(reply); in lcs_lancmd_timeout()
841 spin_unlock_irqrestore(&reply->card->lock, flags); in lcs_lancmd_timeout()
848 struct lcs_reply *reply; in lcs_send_lancmd() local
857 reply = lcs_alloc_reply(cmd); in lcs_send_lancmd()
858 if (!reply) in lcs_send_lancmd()
860 reply->callback = reply_callback; in lcs_send_lancmd()
861 reply->card = card; in lcs_send_lancmd()
863 list_add_tail(&reply->list, &card->lancmd_waiters); in lcs_send_lancmd()
870 timer_setup(&reply->timer, lcs_lancmd_timeout, 0); in lcs_send_lancmd()
871 mod_timer(&reply->timer, jiffies + HZ * card->lancmd_timeout); in lcs_send_lancmd()
872 wait_event(reply->wait_q, reply->received); in lcs_send_lancmd()
873 del_timer_sync(&reply->timer); in lcs_send_lancmd()
874 LCS_DBF_TEXT_(4, trace, "rc:%d",reply->rc); in lcs_send_lancmd()
875 rc = reply->rc; in lcs_send_lancmd()
876 lcs_put_reply(reply); in lcs_send_lancmd()