From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHAF9-0000aJ-DT for qemu-devel@nongnu.org; Sat, 22 Feb 2014 05:55:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHAF1-0007nK-1S for qemu-devel@nongnu.org; Sat, 22 Feb 2014 05:55:39 -0500 Received: from mail-ee0-x231.google.com ([2a00:1450:4013:c00::231]:52144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHAF0-0007n8-Pt for qemu-devel@nongnu.org; Sat, 22 Feb 2014 05:55:30 -0500 Received: by mail-ee0-f49.google.com with SMTP id d17so2078371eek.22 for ; Sat, 22 Feb 2014 02:55:29 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5308821D.9060707@redhat.com> Date: Sat, 22 Feb 2014 11:55:25 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <53082983.4090000@ddn.com> <16222845-E68D-4E40-8365-083EEBAC48D8@alex.org.uk> In-Reply-To: <16222845-E68D-4E40-8365-083EEBAC48D8@alex.org.uk> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Don't enable a HPET timer if HPET is disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Bligh , Matt Lupfer Cc: QEMU Developers Il 22/02/2014 10:03, Alex Bligh ha scritto: > I am unfamiliar with the HPET code but symmetry suggests perhaps the 'else' > condition should be changed too: > > } else if (deactivating_bit(old_val, new_val, HPET_TN_ENABLE) || > !hpet_enabled(s)) { > hpet_del_timer(timer); > } > > -- I thought the same, but there is no need for that. When the enabled bit goes from set to clear, all timers are disabled: } else if (deactivating_bit(old_val, new_val, HPET_CFG_ENABLE)) { /* Halt main counter and disable interrupt generation. */ s->hpet_counter = hpet_get_ticks(s); for (i = 0; i < s->num_timers; i++) { hpet_del_timer(&s->timer[i]); } } So hpet_del_timer would be a nop if !hpet_enabled(s). Paolo