From patchwork Sun Jun 16 14:28:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 1116543 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=users.sourceforge.jp Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45RcNt5wFxz9s7h for ; Mon, 17 Jun 2019 00:36:42 +1000 (AEST) Received: from localhost ([::1]:40346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWGt-0000gx-7A for incoming@patchwork.ozlabs.org; Sun, 16 Jun 2019 10:36:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36366) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9Y-0005Kz-8V for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9W-0002NB-V9 for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:04 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:55650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9W-00025o-IN for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:02 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id 0AD3D42A52; Sun, 16 Jun 2019 23:28:47 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id C7C26240087; Sun, 16 Jun 2019 23:28:46 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:17 +0900 Message-Id: <20190616142836.10614-6-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-1-ysato@users.sourceforge.jp> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.14 Subject: [Qemu-devel] [PATCH v20 05/24] target/rx: simplify rx_cpu_class_by_name X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, richard.henderson@linaro.org, Yoshinori Sato , philmd@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Yoshinori Sato --- target/rx/cpu.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/target/rx/cpu.c b/target/rx/cpu.c index a6dde613ab..e3d76af55d 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -72,9 +72,8 @@ static void rx_cpu_reset(CPUState *s) static void rx_cpu_list_entry(gpointer data, gpointer user_data) { const char *typename = object_class_get_name(OBJECT_CLASS(data)); - int len = strlen(typename) - strlen(RX_CPU_TYPE_SUFFIX); - qemu_printf("%.*s\n", len, typename); + qemu_printf("%s\n", typename); } void rx_cpu_list(void) @@ -88,25 +87,12 @@ void rx_cpu_list(void) static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; - char *typename; oc = object_class_by_name(cpu_model); - if (oc != NULL && object_class_dynamic_cast(oc, TYPE_RX_CPU) != NULL && - !object_class_is_abstract(oc)) { - return oc; - } - - typename = g_strdup_printf(RX_CPU_TYPE_NAME("%s"), cpu_model); - oc = object_class_by_name(typename); - if (oc != NULL && object_class_is_abstract(oc)) { + if (object_class_dynamic_cast(oc, TYPE_RX_CPU) == NULL || + object_class_is_abstract(oc)) { oc = NULL; } - g_free(typename); - - if (!oc) { - /* default to rx62n */ - oc = object_class_by_name(TYPE_RX62N_CPU); - } return oc; }