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: 10997473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C0726C5 for ; Sun, 16 Jun 2019 14:37:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66A152865F for ; Sun, 16 Jun 2019 14:37:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A835287ED; Sun, 16 Jun 2019 14:37:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 03FF72868D for ; Sun, 16 Jun 2019 14:37:36 +0000 (UTC) Received: from localhost ([::1]:40362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWHo-0002k3-2K for patchwork-qemu-devel@patchwork.kernel.org; Sun, 16 Jun 2019 10:37:36 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; }