From patchwork Tue Oct 17 11:02:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 154081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4050560vqb; Tue, 17 Oct 2023 04:03:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/2sP6nuZnjdXgnsONeCe5JEqoEa6mlq0OJ0uq1ejSshfWQln9g6GHAbPmPSnJGh8GS6j4 X-Received: by 2002:a92:cac7:0:b0:351:54db:c1bc with SMTP id m7-20020a92cac7000000b0035154dbc1bcmr2090964ilq.0.1697540581186; Tue, 17 Oct 2023 04:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697540581; cv=none; d=google.com; s=arc-20160816; b=fSkqa+oWdrpvhszNZN1KhGni23hRtQnVyksG8EOEF8Z6DVPtwfYxAkDYUXYGernreV +xUpJ6uWurPGnGkkEE3pO8Grm8+Idby9E5bK4zL5wA2HiGoOUUOs7ikjb0PhDzJI/xiM stVmeF+2AtH45T1GpFXXiAcaJ94tf8o0lD+n2GM6Y4YmhTwDDFYqST4KYhxj58upXpYt A50w7gBV68Mit/nNV+mvSHIV8ayJHdIDdAYym8ykP7hJRQjncx2CDQo68mib+VxlBkT3 iqbVTUONK06yg4Ia6pWa3VpViiOCOncCjrRyatviPrNWlAEYUgb6BY644tc2cJ6/W3IX WbSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7lbFtser67SYseIF06reyKNuH0tjeKU5ctx46j+l0JI=; fh=FrxXp3R3VRdykpxJNx7pRXkmFaw80vhpUJHrlJKWU4Y=; b=djPxMw7L+rRoF3UllGPH8dN+U4h2fSYysSR5s7nGQtYtygs2joR2YNYzfmNuRoLyz8 6DyB9pHz7sw6ycCgdhMAHwwnNx3UbW3zQOUucvRNre4EkxX/C5dspEEhldEoJMbwOryX IsepYGDuGHt/ejKyqv2hBr2on2XcV3sz52UX9z8O7H8awwv4hWpp6wjLB/tbvNiEQquC O9prVWHK5aR8nmXIiLXILFUHwmvDTKYzVtjB0S4oVv35PelStvN/IDFjTvSP6Fll0LE9 BufiUNMQDkGp2n/QHmbTpvernwNG+VYhWr4x1va2L3h8da8sHB6TUnPZxJkBRQYGsbmF fnjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=nDzsSsiW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bq10-20020a056a02044a00b00578b9757214si1714852pgb.163.2023.10.17.04.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 04:03:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=nDzsSsiW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 8F179801DB19; Tue, 17 Oct 2023 04:02:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343751AbjJQLCg (ORCPT + 19 others); Tue, 17 Oct 2023 07:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234762AbjJQLCd (ORCPT ); Tue, 17 Oct 2023 07:02:33 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2E38A2; Tue, 17 Oct 2023 04:02:30 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPA id 723301BF20A; Tue, 17 Oct 2023 11:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697540548; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7lbFtser67SYseIF06reyKNuH0tjeKU5ctx46j+l0JI=; b=nDzsSsiWv1vkOUWTMxTmRFkTMpYsb47lohNTu1Zj+wlw4Ob99VSTr/WiRqlgMgHEeel3F1 Yq521H+a/XkajebN63SEjRGrgl7pKq7bn/4e2dN1WGIxoVO4BEzXucNFM66AtleuIoi149 lGNgAZ5hepTqkTZuGUqrwRxcZ9m8OL9WuK/KBzvMEjuabunD/Fz1xEFm9j1TPbkNR+7CVw mWY9gKYdXk8/ZmrNGdDESfi6a1SuWWfOQgCH5XATyd0njso4GTomNDqrq1cNQIloSHynRW JFpgkkN8DaLlfyK7LP3oZdOorF/BxglDguh7qAFLU09+D8bPHPYKUMt2kYaqEg== From: Herve Codina To: Rob Herring , Frank Rowand , Lizhi Hou Cc: Max Zhen , Sonal Santan , Stefano Stabellini , Jonathan Cameron , Bjorn Helgaas , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 2/3] of: address: Remove duplicated functions Date: Tue, 17 Oct 2023 13:02:17 +0200 Message-ID: <20231017110221.189299-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231017110221.189299-1-herve.codina@bootlin.com> References: <20231017110221.189299-1-herve.codina@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: herve.codina@bootlin.com X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 17 Oct 2023 04:02:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780000312258999030 X-GMAIL-MSGID: 1780000312258999030 The recently added of_bus_default_flags_translate() performs the exact same operation as of_bus_pci_translate() and of_bus_isa_translate(). Avoid duplicated code replacing both of_bus_pci_translate() and of_bus_isa_translate() with of_bus_default_flags_translate(). Signed-off-by: Herve Codina --- drivers/of/address.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index 3219c5177750..d21a3b74ac56 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -216,10 +216,6 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, return da - cp; } -static int of_bus_pci_translate(__be32 *addr, u64 offset, int na) -{ - return of_bus_default_translate(addr + 1, offset, na - 1); -} #endif /* CONFIG_PCI */ /* @@ -343,11 +339,6 @@ static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns, return da - cp; } -static int of_bus_isa_translate(__be32 *addr, u64 offset, int na) -{ - return of_bus_default_translate(addr + 1, offset, na - 1); -} - static unsigned int of_bus_isa_get_flags(const __be32 *addr) { unsigned int flags = 0; @@ -378,7 +369,7 @@ static struct of_bus of_busses[] = { .match = of_bus_pci_match, .count_cells = of_bus_pci_count_cells, .map = of_bus_pci_map, - .translate = of_bus_pci_translate, + .translate = of_bus_default_flags_translate, .has_flags = true, .get_flags = of_bus_pci_get_flags, }, @@ -390,7 +381,7 @@ static struct of_bus of_busses[] = { .match = of_bus_isa_match, .count_cells = of_bus_isa_count_cells, .map = of_bus_isa_map, - .translate = of_bus_isa_translate, + .translate = of_bus_default_flags_translate, .has_flags = true, .get_flags = of_bus_isa_get_flags, },