From patchwork Mon Dec 12 20:18:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 130829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9FE3B1007DE for ; Tue, 13 Dec 2011 07:26:33 +1100 (EST) Received: from localhost ([::1]:60537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCSC-0001nn-VM for incoming@patchwork.ozlabs.org; Mon, 12 Dec 2011 15:26:28 -0500 Received: from eggs.gnu.org ([140.186.70.92]:42333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCRb-0000gj-MC for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:25:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RaCRa-0001Sx-Cp for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:25:51 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:55969 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaCRa-0001Sr-4B for qemu-devel@nongnu.org; Mon, 12 Dec 2011 15:25:50 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pBCKPhDG000333; Mon, 12 Dec 2011 14:25:43 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id pBCKPfij000332; Mon, 12 Dec 2011 14:25:41 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 12 Dec 2011 14:18:47 -0600 Message-Id: <1323721273-32404-52-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1323721273-32404-1-git-send-email-aliguori@us.ibm.com> References: <1323721273-32404-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Kevin Wolf , Peter Maydell , Anthony Liguori , Stefan Hajnoczi , Jan Kiszka , Markus Armbruster , Luiz Capitulino Subject: [Qemu-devel] [PATCH v3 051/197] drop info link in SCSIDeviceInfo 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 --- hw/scsi-bus.c | 26 ++++++++++++++++---------- hw/scsi.h | 1 - 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index a054324..8f0d7e6 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -25,24 +25,30 @@ static int next_scsi_bus; static int scsi_device_init(SCSIDevice *dev) { - if (dev->info->init) { - return dev->info->init(dev); + SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev, + qdev_get_info(DEVICE(dev))); + if (info->init) { + return info->init(dev); } return 0; } static void scsi_device_destroy(SCSIDevice *s) { - if (s->info->destroy) { - s->info->destroy(s); + SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev, + qdev_get_info(DEVICE(s))); + if (info->destroy) { + info->destroy(s); } } static SCSIRequest *scsi_device_alloc_req(SCSIDevice *s, uint32_t tag, uint32_t lun, uint8_t *buf, void *hba_private) { - if (s->info->alloc_req) { - return s->info->alloc_req(s, tag, lun, buf, hba_private); + SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev, + qdev_get_info(DEVICE(s))); + if (info->alloc_req) { + return info->alloc_req(s, tag, lun, buf, hba_private); } return NULL; @@ -50,8 +56,10 @@ static SCSIRequest *scsi_device_alloc_req(SCSIDevice *s, uint32_t tag, uint32_t static void scsi_device_unit_attention_reported(SCSIDevice *s) { - if (s->info->unit_attention_reported) { - s->info->unit_attention_reported(s); + SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev, + qdev_get_info(DEVICE(s))); + if (info->unit_attention_reported) { + info->unit_attention_reported(s); } } @@ -114,7 +122,6 @@ static void scsi_dma_restart_cb(void *opaque, int running, RunState state) static int scsi_qdev_init(DeviceState *qdev, DeviceInfo *base) { SCSIDevice *dev = SCSI_DEVICE(qdev); - SCSIDeviceInfo *info = DO_UPCAST(SCSIDeviceInfo, qdev, base); SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus); SCSIDevice *d; int rc = -1; @@ -158,7 +165,6 @@ static int scsi_qdev_init(DeviceState *qdev, DeviceInfo *base) } } - dev->info = info; QTAILQ_INIT(&dev->requests); rc = scsi_device_init(dev); if (rc == 0) { diff --git a/hw/scsi.h b/hw/scsi.h index 282cebd..0d24d41 100644 --- a/hw/scsi.h +++ b/hw/scsi.h @@ -77,7 +77,6 @@ struct SCSIDevice QEMUBH *bh; uint32_t id; BlockConf conf; - SCSIDeviceInfo *info; SCSISense unit_attention; bool sense_is_ua; uint8_t sense[SCSI_SENSE_BUF_SIZE];