From patchwork Tue Mar 8 07:52:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 8530281 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4FEFEC0553 for ; Tue, 8 Mar 2016 07:55:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B779C2017E for ; Tue, 8 Mar 2016 07:55:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1508F2017D for ; Tue, 8 Mar 2016 07:55:44 +0000 (UTC) Received: from localhost ([::1]:32824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adCUZ-0000mQ-Gg for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Mar 2016 02:55:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adCSa-0005nK-M2 for qemu-devel@nongnu.org; Tue, 08 Mar 2016 02:53:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adCSX-0000Dk-Es for qemu-devel@nongnu.org; Tue, 08 Mar 2016 02:53:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adCSX-0000Df-9h for qemu-devel@nongnu.org; Tue, 08 Mar 2016 02:53:37 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id DAB3EC000716; Tue, 8 Mar 2016 07:53:36 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (vpn1-5-240.pek2.redhat.com [10.72.5.240]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u287qkMe010527; Tue, 8 Mar 2016 02:53:32 -0500 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Tue, 8 Mar 2016 15:52:40 +0800 Message-Id: <1457423564-9724-9-git-send-email-jasowang@redhat.com> In-Reply-To: <1457423564-9724-1-git-send-email-jasowang@redhat.com> References: <1457423564-9724-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jiri Pirko , Jason Wang Subject: [Qemu-devel] [PULL V2 08/12] rocker: add name field into WorldOps ale let world specify its name 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jiri Pirko Also use this in world_name getter function. Signed-off-by: Jiri Pirko Signed-off-by: Jason Wang --- hw/net/rocker/rocker_of_dpa.c | 1 + hw/net/rocker/rocker_world.c | 7 +------ hw/net/rocker/rocker_world.h | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/net/rocker/rocker_of_dpa.c b/hw/net/rocker/rocker_of_dpa.c index da3fc54..0a134eb 100644 --- a/hw/net/rocker/rocker_of_dpa.c +++ b/hw/net/rocker/rocker_of_dpa.c @@ -2614,6 +2614,7 @@ RockerOfDpaGroupList *qmp_query_rocker_of_dpa_groups(const char *name, } static WorldOps of_dpa_ops = { + .name = "ofdpa", .init = of_dpa_init, .uninit = of_dpa_uninit, .ig = of_dpa_ig, diff --git a/hw/net/rocker/rocker_world.c b/hw/net/rocker/rocker_world.c index 1ed0fcd..89777e9 100644 --- a/hw/net/rocker/rocker_world.c +++ b/hw/net/rocker/rocker_world.c @@ -98,10 +98,5 @@ enum rocker_world_type world_type(World *world) const char *world_name(World *world) { - switch (world->type) { - case ROCKER_WORLD_TYPE_OF_DPA: - return "OF_DPA"; - default: - return "unknown"; - } + return world->ops->name; } diff --git a/hw/net/rocker/rocker_world.h b/hw/net/rocker/rocker_world.h index 18d277b..58ade47 100644 --- a/hw/net/rocker/rocker_world.h +++ b/hw/net/rocker/rocker_world.h @@ -33,6 +33,7 @@ typedef int (world_cmd)(World *world, DescInfo *info, RockerTlv *cmd_info_tlv); typedef struct world_ops { + const char *name; world_init *init; world_uninit *uninit; world_ig *ig;