From nobody Fri Mar 29 02:00:44 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1559525731; cv=none; d=zoho.com; s=zohoarc; b=XsHuwx7vnO/mgJkKudGJB2Xztei/k69T23asdsdd6l0NwzSgSbyyJdzDKVM6XOckUsw5bP0LVnab+bYarn7207bjZd0fP0VH8o4W81OdGl+tANiFd/17/N5ZhJHRqQf++DsW0iks0alHHIOf7BvXIzz5HZ+HJTdHlW7gsCV8u6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559525731; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=XzL5GenyJ8ZX6dls+pNUbbw+UXdABVJbKFCTFo4NJ9g=; b=T3WPzA+gL1bCeLxBWruHE5z/UD78ghNNs34WCucHnk8VS0QMMY2wkbu9ZKxdis0su3Mx8qDszswwcsoRq4iFfSYBJ7ldbt73IBy1fhKFLVevXyUkyLPbQshhwKJRmyK2WXTOZ9tQ6t6KE7ROueDX7o3io17BpxEnuXC7ywL8wW4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1559525731161990.5780671666705; Sun, 2 Jun 2019 18:35:31 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXbra-0000Q4-Vq; Mon, 03 Jun 2019 01:34:14 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXbra-0000Pz-4U for xen-devel@lists.xenproject.org; Mon, 03 Jun 2019 01:34:14 +0000 Received: from mxnavi-mail.mxnavi.com (unknown [116.90.87.199]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ae0ff3b6-859f-11e9-834d-138507bc2d3d; Mon, 03 Jun 2019 01:34:09 +0000 (UTC) Received: from localhost.localdomain (61.161.186.150) by mxnavi-mail.mxnavi.com (116.90.87.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Mon, 3 Jun 2019 09:31:55 +0800 X-Inumbo-ID: ae0ff3b6-859f-11e9-834d-138507bc2d3d From: Baodong Chen To: Date: Mon, 3 Jun 2019 09:33:47 +0800 Message-ID: <1559525627-2701-1-git-send-email-chenbaodong@mxnavi.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [61.161.186.150] X-ClientProxiedBy: mxnavi-mail.mxnavi.com (116.90.87.199) To mxnavi-mail.mxnavi.com (116.90.87.199) Subject: [Xen-devel] [PATCH RESEND] xen: notifier: refine 'notifier_head', use 'list_head' directly X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Baodong Chen Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 'notifier_block' can be replaced with 'list_head' when used for 'notifier_head', this make the a little more clear. Signed-off-by: Baodong Chen --- xen/common/notifier.c | 12 ++++++------ xen/include/xen/notifier.h | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/xen/common/notifier.c b/xen/common/notifier.c index 34488a8..c7b0669 100644 --- a/xen/common/notifier.c +++ b/xen/common/notifier.c @@ -21,10 +21,10 @@ void __init notifier_chain_register( struct notifier_head *nh, struct notifier_block *n) { - struct list_head *chain =3D &nh->head.chain; + struct list_head *chain =3D &nh->head; struct notifier_block *nb; =20 - while ( chain->next !=3D &nh->head.chain ) + while ( chain->next !=3D &nh->head ) { nb =3D list_entry(chain->next, struct notifier_block, chain); if ( n->priority > nb->priority ) @@ -71,16 +71,16 @@ int notifier_call_chain( { int ret =3D NOTIFY_DONE; struct list_head *cursor; - struct notifier_block *nb; + struct notifier_block *nb =3D NULL; bool_t reverse =3D !!(val & NOTIFY_REVERSE); =20 - cursor =3D &(pcursor && *pcursor ? *pcursor : &nh->head)->chain; + cursor =3D (pcursor && *pcursor ? &(*pcursor)->chain : &nh->head); =20 do { cursor =3D reverse ? cursor->prev : cursor->next; - nb =3D list_entry(cursor, struct notifier_block, chain); - if ( cursor =3D=3D &nh->head.chain ) + if ( cursor =3D=3D &nh->head ) break; + nb =3D list_entry(cursor, struct notifier_block, chain); ret =3D nb->notifier_call(nb, val, v); } while ( !(ret & NOTIFY_STOP_MASK) ); =20 diff --git a/xen/include/xen/notifier.h b/xen/include/xen/notifier.h index d1ff9b1..2e58bd9 100644 --- a/xen/include/xen/notifier.h +++ b/xen/include/xen/notifier.h @@ -29,13 +29,12 @@ struct notifier_block { }; =20 struct notifier_head { - struct notifier_block head; + struct list_head head; }; =20 -#define NOTIFIER_INIT(name) { .head.chain =3D LIST_HEAD_INIT(name.head.cha= in) } +#define NOTIFIER_HEAD(name) = \ + struct notifier_head name =3D {.head =3D LIST_HEAD_INIT(name.head)} =20 -#define NOTIFIER_HEAD(name) \ - struct notifier_head name =3D NOTIFIER_INIT(name) =20 void notifier_chain_register( struct notifier_head *nh, struct notifier_block *nb); --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel