All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, Dmitry Fleytman <dmitry@daynix.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v7 15/15] vmw_pvscsi: remove unnecessary internal msi state flag
Date: Thu, 09 Jun 2016 17:48:59 +0200	[thread overview]
Message-ID: <87bn3a5pn8.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1465200062-13824-16-git-send-email-caoj.fnst@cn.fujitsu.com> (Cao jin's message of "Mon, 6 Jun 2016 16:01:02 +0800")

Cao jin <caoj.fnst@cn.fujitsu.com> writes:

> Internal flag msi_used is uncesessary, msi_uninit() could be called
> directly, msi_enabled() is enough to check device msi state.
>
> cc: Paolo Bonzini <pbonzini@redhat.com>
> cc: Dmitry Fleytman <dmitry@daynix.com>
> cc: Markus Armbruster <armbru@redhat.com>
> cc: Marcel Apfelbaum <marcel@redhat.com>
> cc: Michael S. Tsirkin <mst@redhat.com>
>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  hw/scsi/vmw_pvscsi.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
> index c384442..9838fa5 100644
> --- a/hw/scsi/vmw_pvscsi.c
> +++ b/hw/scsi/vmw_pvscsi.c
> @@ -121,8 +121,6 @@ typedef struct {
>      uint8_t msg_ring_info_valid;         /* Whether message ring initialized */
>      uint8_t use_msg;                     /* Whether to use message ring      */
>  
> -    uint8_t msi_used;    /* Whether MSI support was installed successfully   */
> -
>      PVSCSIRingInfo rings;                /* Data transfer rings manager      */
>      uint32_t resetting;                  /* Reset in progress                */
>  
> @@ -351,7 +349,7 @@ pvscsi_update_irq_status(PVSCSIState *s)
>      trace_pvscsi_update_irq_level(should_raise, s->reg_interrupt_enabled,
>                                    s->reg_interrupt_status);
>  
> -    if (s->msi_used && msi_enabled(d)) {
> +    if (msi_enabled(d)) {
>          if (should_raise) {
>              trace_pvscsi_update_irq_msi();
>              msi_notify(d, PVSCSI_VECTOR_COMPLETION);
> @@ -1049,12 +1047,9 @@ pvscsi_init_msi(PVSCSIState *s)
>  
>      res = msi_init(d, PVSCSI_MSI_OFFSET(s), PVSCSI_MSIX_NUM_VECTORS,
>                     PVSCSI_USE_64BIT, PVSCSI_PER_VECTOR_MASK, &err);
> -    if (res < 0) {
> +    if (res) {

I'd leave this alone.

>          trace_pvscsi_init_msi_fail(res);
>          error_free(err);
> -        s->msi_used = false;
> -    } else {
> -        s->msi_used = true;
>      }
>  }
>  
> @@ -1063,9 +1058,7 @@ pvscsi_cleanup_msi(PVSCSIState *s)
>  {
>      PCIDevice *d = PCI_DEVICE(s);
>  
> -    if (s->msi_used) {
> -        msi_uninit(d);
> -    }
> +    msi_uninit(d);
>  }
>  
>  static const MemoryRegionOps pvscsi_ops = {
> @@ -1208,7 +1201,6 @@ static const VMStateDescription vmstate_pvscsi = {
>          VMSTATE_STRUCT_TEST(parent_obj, PVSCSIState,
>                              pvscsi_vmstate_test_pci_device, 0,
>                              vmstate_pci_device, PCIDevice),
> -        VMSTATE_UINT8(msi_used, PVSCSIState),
>          VMSTATE_UINT32(resetting, PVSCSIState),
>          VMSTATE_UINT64(reg_interrupt_status, PVSCSIState),
>          VMSTATE_UINT64(reg_interrupt_enabled, PVSCSIState),

  reply	other threads:[~2016-06-09 15:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06  8:00 [Qemu-devel] [PATCH v7 00/15] Add param Error ** for msi_init() Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 01/15] pci core: assert ENOSPC when add capability Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 02/15] fix some coding style problems Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 03/15] change pvscsi_init_msi() type to void Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 04/15] megasas: Fix check for msi_init() failure Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 05/15] mptsas: change .realize function name Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 06/15] usb xhci: change msi/msix property type Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 07/15] intel-hda: change msi " Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 08/15] mptsas: " Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 09/15] megasas: change msi/msix " Cao jin
2016-06-06  8:27   ` Hannes Reinecke
2016-06-06  8:43     ` Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 10/15] pci bridge dev: change msi " Cao jin
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 11/15] msi_init: change return value to 0 on success Cao jin
2016-06-06  8:28   ` Hannes Reinecke
2016-06-06  9:19     ` Cao jin
2016-06-09 15:32   ` Markus Armbruster
2016-06-06  8:00 ` [Qemu-devel] [PATCH v7 12/15] pci: Convert msi_init() to Error and fix callers to check it Cao jin
2016-06-06  8:29   ` Hannes Reinecke
2016-06-06  8:30   ` Cao jin
2016-06-09 15:53   ` Markus Armbruster
2016-06-09 15:54   ` Markus Armbruster
2016-06-06  8:01 ` [Qemu-devel] [PATCH v7 13/15] megasas: remove unnecessary megasas_use_msi() Cao jin
2016-06-06  8:31   ` Hannes Reinecke
2016-06-06  8:01 ` [Qemu-devel] [PATCH v7 14/15] mptsas: remove unnecessary internal msi state flag Cao jin
2016-06-06  8:01 ` [Qemu-devel] [PATCH v7 15/15] vmw_pvscsi: " Cao jin
2016-06-09 15:48   ` Markus Armbruster [this message]
2016-06-08 10:15 ` [Qemu-devel] [PATCH v7 00/15] Add param Error ** for msi_init() Cao jin
2016-06-09 15:58 ` Markus Armbruster
2016-06-10  7:34   ` Cao jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bn3a5pn8.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=dmitry@daynix.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.