From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz25v-0001xd-UI for qemu-devel@nongnu.org; Mon, 23 Jun 2014 07:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz25l-00061H-7o for qemu-devel@nongnu.org; Mon, 23 Jun 2014 07:07:27 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:44040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz25l-00061A-0X for qemu-devel@nongnu.org; Mon, 23 Jun 2014 07:07:17 -0400 Received: by mail-wi0-f177.google.com with SMTP id r20so3953359wiv.16 for ; Mon, 23 Jun 2014 04:07:13 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53A80A5E.7080302@redhat.com> Date: Mon, 23 Jun 2014 13:07:10 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1403519436-5289-1-git-send-email-pbonzini@redhat.com> <1018003733.41131057.1403519938991.JavaMail.zimbra@redhat.com> In-Reply-To: <1018003733.41131057.1403519938991.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] ccid-card-emulated: use EventNotifier List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alon Levy , qemu list Il 23/06/2014 12:38, Alon Levy ha scritto: >> > { >> > - EmulatedState *card = opaque; >> > + EmulatedState *card = container_of(notifier, EmulatedState, notifier); >> > EmulEvent *event, *next; >> > - char dummy; >> > - int len; >> > >> > - do { >> > - len = read(card->pipe[0], &dummy, sizeof(dummy)); >> > - } while (len == sizeof(dummy)); >> > + event_notifier_test_and_clear(&card->notifier); > Shouldn't the ignored return value be marked somehow? It's a pretty common idiom to test-and-clear the event notifier. Really hot paths have a while() loop, but for ccid-card-emulated it's simpler to just go through the main loop again. In fact, it was just what the pipe-based code used to do. :) Paolo