From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M0ydb-0004xP-4S for qemu-devel@nongnu.org; Mon, 04 May 2009 09:55:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M0ydW-0004mi-8n for qemu-devel@nongnu.org; Mon, 04 May 2009 09:55:18 -0400 Received: from [199.232.76.173] (port=49548 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M0ydV-0004m7-Qi for qemu-devel@nongnu.org; Mon, 04 May 2009 09:55:13 -0400 Received: from mx2.redhat.com ([66.187.237.31]:40592) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M0ydU-0002eK-Eh for qemu-devel@nongnu.org; Mon, 04 May 2009 09:55:12 -0400 Subject: Re: [Qemu-devel] [PATCH 1/4] Confine use of global rtc_state to PC CMOS functions References: From: Markus Armbruster Date: Mon, 04 May 2009 15:54:58 +0200 In-Reply-To: (Blue Swirl's message of "Fri\, 1 May 2009 20\:27\:28 +0300") Message-ID: <87zldtotvx.fsf@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org Blue Swirl writes: > On 4/30/09, Markus Armbruster wrote: >> Pass the state as argument to cmos_init() and cmos_init_hd(). >> cmos_init() still needs to save it in rtc_state for use by >> cmos_set_s3_resume(). > > pc.c could pass acpi an opaque handle (former rtc_state) at init or > acpi could export a function to set the handle, called by pc.c. Then > cmos_set_s3_resume could take a state parameter. We'd just move a global variable from pc.c to acpi.c, wouldn't we? Could you explain why that's a better place? Passing rtc_state to piix4_pm_init() doesn't work well for pcdt.c, because we'd have to pass it from RTC device to PIIX3 ACPI device somehow, creating one of those ugly "non-tree" device dependencies, i.e. one that doesn't follow device tree or interrupt tree edges. Your other idea (a function to set the handle) allows me to keep the two devices decoupled, provided I can set the handle even before piix4_pm_init().