Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1391C433F5 for ; Fri, 29 Oct 2021 23:51:27 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6292961038 for ; Fri, 29 Oct 2021 23:51:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6292961038 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=eik.bme.hu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgbeg-0001Mb-FI for qemu-devel@archiver.kernel.org; Fri, 29 Oct 2021 19:51:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgbbT-0006R4-6y for qemu-devel@nongnu.org; Fri, 29 Oct 2021 19:48:12 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:40263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgbbQ-0007TC-EF for qemu-devel@nongnu.org; Fri, 29 Oct 2021 19:48:05 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id F28E8748F4B; Sat, 30 Oct 2021 01:48:02 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id CDFE2746333; Sat, 30 Oct 2021 01:48:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id CC1547462D3; Sat, 30 Oct 2021 01:48:02 +0200 (CEST) Date: Sat, 30 Oct 2021 01:48:02 +0200 (CEST) From: BALATON Zoltan To: =?ISO-8859-15?Q?Philippe_Mathieu-Daud=E9?= Subject: Re: [PATCH v6 22/30] hw/intc/sh_intc: Inline and drop sh_intc_source() function In-Reply-To: <8ca6ad2d-c04c-b299-437c-1724c79c8551@amsat.org> Message-ID: References: <8ca6ad2d-c04c-b299-437c-1724c79c8551@amsat.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3866299591-1470193298-1635551282=:5796" Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , Magnus Damm , Richard Henderson , qemu-devel@nongnu.org, Yoshinori Sato Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --3866299591-1470193298-1635551282=:5796 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Sat, 30 Oct 2021, Philippe Mathieu-Daudé wrote: > On 10/29/21 23:02, BALATON Zoltan wrote: >> This function is very simple and provides no advantage. Call sites >> become simpler without it so just write it in line and drop the >> separate function. >> >> Signed-off-by: BALATON Zoltan >> --- >> hw/intc/sh_intc.c | 54 ++++++++++++++++------------------------ >> hw/sh4/sh7750.c | 4 +-- >> include/hw/sh4/sh_intc.h | 2 +- >> 3 files changed, 25 insertions(+), 35 deletions(-) > >> static void sh_intc_register_source(struct intc_desc *desc, >> intc_enum source, >> struct intc_group *groups, >> int nr_groups) >> { >> unsigned int i, k; >> - struct intc_source *s; >> + intc_enum id; >> > > Maybe: > > assert(source != UNUSED); > >> if (desc->mask_regs) { >> for (i = 0; i < desc->nr_mask_regs; i++) { >> struct intc_mask_reg *mr = &desc->mask_regs[i]; >> >> for (k = 0; k < ARRAY_SIZE(mr->enum_ids); k++) { >> - if (mr->enum_ids[k] != source) { >> - continue; >> - } >> - s = sh_intc_source(desc, mr->enum_ids[k]); >> - if (s) { >> - s->enable_max++; >> + id = mr->enum_ids[k]; >> + if (id && id == source) { > > Then you can drop the 'id' checks. I've tried to preserve the original brhaviour in this patch and not change it for now. This will need to be rewritten anyway beause it does not handle priorities and hard to QOM-ify as it is so I'll come back to this where these will probably change, so for now just leave it to keep the existing behaviour. Then we can revise it later in separate patch. Thanks for taking the time to review my patches, much appreciated. Regards, BALATON Zoltan >> + desc->sources[id].enable_max++; >> } >> } >> } > > --3866299591-1470193298-1635551282=:5796--