Skip to content

Commit

Permalink
megasas: remove unnecessary megasas_use_msi()
Browse files Browse the repository at this point in the history
megasas overwrites user configuration when msi_init fail to flag internal msi
state, which is unsuitable. megasa_use_msi() is unnecessary, we can call
msi_uninit() directly when unrealize, even no need to call msi_enabled() first.

cc: Hannes Reinecke <hare@suse.de>
cc: Paolo Bonzini <pbonzini@redhat.com>
cc: Markus Armbruster <armbru@redhat.com>
cc: Marcel Apfelbaum <marcel@redhat.com>
cc: Michael S. Tsirkin <mst@redhat.com>

Acked-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Cao jin authored and mstsirkin committed Jul 5, 2016
1 parent 1108b2f commit afea4e1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions hw/scsi/megasas.c
Expand Up @@ -155,11 +155,6 @@ static bool megasas_use_queue64(MegasasState *s)
return s->flags & MEGASAS_MASK_USE_QUEUE64;
}

static bool megasas_use_msi(MegasasState *s)
{
return s->msi != ON_OFF_AUTO_OFF;
}

static bool megasas_use_msix(MegasasState *s)
{
return s->msix != ON_OFF_AUTO_OFF;
Expand Down Expand Up @@ -2307,9 +2302,7 @@ static void megasas_scsi_uninit(PCIDevice *d)
if (megasas_use_msix(s)) {
msix_uninit(d, &s->mmio_io, &s->mmio_io);
}
if (megasas_use_msi(s)) {
msi_uninit(d);
}
msi_uninit(d);
}

static const struct SCSIBusInfo megasas_scsi_info = {
Expand Down Expand Up @@ -2340,7 +2333,7 @@ static void megasas_scsi_realize(PCIDevice *dev, Error **errp)
/* Interrupt pin 1 */
pci_conf[PCI_INTERRUPT_PIN] = 0x01;

if (megasas_use_msi(s)) {
if (s->msi != ON_OFF_AUTO_OFF) {
ret = msi_init(dev, 0x50, 1, true, false, &err);
/* Any error other than -ENOTSUP(board's MSI support is broken)
* is a programming error */
Expand Down

0 comments on commit afea4e1

Please sign in to comment.