From patchwork Fri May 11 14:36:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 158526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F1021B7010 for ; Sat, 12 May 2012 00:36:59 +1000 (EST) Received: from localhost ([::1]:35924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSqxl-0002wr-S2 for incoming@patchwork.ozlabs.org; Fri, 11 May 2012 10:36:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSqxa-0002wG-Jq for qemu-devel@nongnu.org; Fri, 11 May 2012 10:36:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSqxY-00027j-GM for qemu-devel@nongnu.org; Fri, 11 May 2012 10:36:46 -0400 Received: from david.siemens.de ([192.35.17.14]:19573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSqxY-000277-6i for qemu-devel@nongnu.org; Fri, 11 May 2012 10:36:44 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.13.6/8.13.6) with ESMTP id q4BEaeZ6011616; Fri, 11 May 2012 16:36:40 +0200 Received: from mchn199C.mchp.siemens.de ([139.22.114.193]) by mail1.siemens.de (8.13.6/8.13.6) with SMTP id q4BEabBO014058; Fri, 11 May 2012 16:36:38 +0200 Message-ID: <4FAD23F5.4040505@siemens.com> Date: Fri, 11 May 2012 11:36:37 -0300 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Gerd Hoffmann , qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.14 Subject: [Qemu-devel] [PATCH] xhci: Clean up reset function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Properly register reset function via the device class. Signed-off-by: Jan Kiszka --- Broken out from the MSI series where I will no longer touch xhci. hw/usb/hcd-xhci.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 5cf1a64..4bc1e0e 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2296,9 +2296,9 @@ static void xhci_update_port(XHCIState *xhci, XHCIPort *port, int is_detach) } } -static void xhci_reset(void *opaque) +static void xhci_reset(DeviceState *dev) { - XHCIState *xhci = opaque; + XHCIState *xhci = DO_UPCAST(XHCIState, pci_dev.qdev, dev); int i; DPRINTF("xhci: full reset\n"); @@ -2506,7 +2506,7 @@ static void xhci_oper_write(XHCIState *xhci, uint32_t reg, uint32_t val) } xhci->usbcmd = val & 0xc0f; if (val & USBCMD_HCRST) { - xhci_reset(xhci); + xhci_reset(&xhci->pci_dev.qdev); } xhci_irq_update(xhci); break; @@ -2831,8 +2831,6 @@ static void usb_xhci_init(XHCIState *xhci, DeviceState *dev) for (i = 0; i < MAXSLOTS; i++) { xhci->slots[i].enabled = 0; } - - qemu_register_reset(xhci_reset, xhci); } static int usb_xhci_initfn(struct PCIDevice *dev) @@ -2895,6 +2893,7 @@ static void xhci_class_init(ObjectClass *klass, void *data) dc->vmsd = &vmstate_xhci; dc->props = xhci_properties; + dc->reset = xhci_reset; k->init = usb_xhci_initfn; k->vendor_id = PCI_VENDOR_ID_NEC; k->device_id = PCI_DEVICE_ID_NEC_UPD720200;