Received: by 10.192.165.148 with SMTP id m20csp3818327imm; Mon, 30 Apr 2018 06:59:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp4Pgg8Dt+R+rlC0dGc2TcW+K2loYonAJAkd+4xjbCuYwYT6K22NLWvuhABu/qDZ7Zj9IdG X-Received: by 2002:a63:a119:: with SMTP id b25-v6mr9974254pgf.3.1525096771087; Mon, 30 Apr 2018 06:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525096771; cv=none; d=google.com; s=arc-20160816; b=he1wxi+I2z1qU3Itd2yNp2YrWXy93WBMYuZNiAty618ImgVt6BQgT+7KxbND4ctB/M 3RN1vXHcJJ7U9MDUIhIIR4X3tIKJ1/Y1fQ3fGf/vXYyKY8DJ2DCHn+tWHEJsJGgS/soo 5ofgX1Sn3IR4KvKLFG/ZeZSb6dikFLfPBgBOzhYD8ghPtPExhyJwNzBNfFwYdKegjw97 SpyHt7MlHkNj65WyCpzMIYPtljQ8Pi5cctckq7xPI7+CqVFJRyXg+kJ4VAWez5cuZBDi DN3qfvWHYDXM3+sbnjG2jHV7bhi5fUUpu1HzLyclN7VzDoYTfHQr6TalwrAtoUjd/J7I Ya/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=BXxw7jeKMIwORVsisRanVQAUkWnAqLM7Nz4KNttXHjE=; b=P6+AzIK6dPF4F+9+ItJmb51+a26kqGb15ACmXWJBCon5Dgj33QixjyOwxTrssX3N7w N0QAAs6XNZBp11S0XhfCZoNp53p1MdFynHPmRo1OPtPJkpZxVirw7dN7E4fIhKucyQt5 2enenYZdnf7YaHs+a0f6CWZjO1k0umuKNQefg9fJCUNthpRyUxbLt6xHuDFYXg3iONdh iBWLLsNzGl+7LvlLXV7rqopJ5Jjyk1LcrGVe/uvaYOKxChH+LItYeunFQ29qlPW3Dg9X 1LTBilGXVBZ0jGzhymIfXHENHWF4Ry6wkmWZoSOMTcTp4u+9NVsU2liKziLkCWLwCJ+K fChA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az2-v6si7392036plb.555.2018.04.30.06.59.17; Mon, 30 Apr 2018 06:59:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754149AbeD3N6s (ORCPT + 99 others); Mon, 30 Apr 2018 09:58:48 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58012 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752868AbeD3N6r (ORCPT ); Mon, 30 Apr 2018 09:58:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8EC5406C77E; Mon, 30 Apr 2018 13:58:46 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id BBC897C39; Mon, 30 Apr 2018 13:58:45 +0000 (UTC) Date: Mon, 30 Apr 2018 15:58:43 +0200 From: Cornelia Huck To: Pierre Morel Cc: Dong Jia Shi , pasic@linux.vnet.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH 02/10] vfio: ccw: Transform FSM functions to return state Message-ID: <20180430155843.698cf635.cohuck@redhat.com> In-Reply-To: <047dd088-6cba-c1fa-2295-05d31d7f4f2d@linux.vnet.ibm.com> References: <1524149293-12658-1-git-send-email-pmorel@linux.vnet.ibm.com> <1524149293-12658-3-git-send-email-pmorel@linux.vnet.ibm.com> <20180424072550.GW12194@bjsdjshi@linux.vnet.ibm.com> <047dd088-6cba-c1fa-2295-05d31d7f4f2d@linux.vnet.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 30 Apr 2018 13:58:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 30 Apr 2018 13:58:46 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Apr 2018 10:22:15 +0200 Pierre Morel wrote: > On 24/04/2018 09:25, Dong Jia Shi wrote: > > * Pierre Morel [2018-04-19 16:48:05 +0200]: > > > >> We change the FSM functions to return the next state, > >> and adapt the fsm_func_t function type. > > I think I'd need to read the rest patches to understand why we need this > > one, but no hurt to write some ideas that I noticed at my first glance. > > See below please. > > > >> Signed-off-by: Pierre Morel > >> --- > >> drivers/s390/cio/vfio_ccw_fsm.c | 24 ++++++++++++++++-------- > >> drivers/s390/cio/vfio_ccw_private.h | 5 +++-- > >> 2 files changed, 19 insertions(+), 10 deletions(-) > >> diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h > >> index 78a66d9..f526b18 100644 > >> --- a/drivers/s390/cio/vfio_ccw_private.h > >> +++ b/drivers/s390/cio/vfio_ccw_private.h > >> @@ -83,13 +83,14 @@ enum vfio_ccw_event { > >> /* > >> * Action called through jumptable. > >> */ > >> -typedef void (fsm_func_t)(struct vfio_ccw_private *, enum vfio_ccw_event); > >> +typedef int (fsm_func_t)(struct vfio_ccw_private *, enum vfio_ccw_event); > >> extern fsm_func_t *vfio_ccw_jumptable[NR_VFIO_CCW_STATES][NR_VFIO_CCW_EVENTS]; > >> > >> static inline void vfio_ccw_fsm_event(struct vfio_ccw_private *private, > >> int event) > >> { > >> - vfio_ccw_jumptable[private->state][event](private, event); > >> + private->state = vfio_ccw_jumptable[private->state][event](private, > >> + event); > > Since here it assigns new value to private->state, there is no need to > > do that inside each fsm_func? > Absolutely. > I just kept the previous code, just adding the return private->state in > the functions > in this patch. > merging the state and the return value is done in a later patch. > If you prefer I can do it in this patch. I think we should revisit this later. It's hard to judge this patch on its own.