Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp401013imn; Thu, 28 Jul 2022 04:23:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1thwplJs3b9hSqF2U97J8LALeMGJVspoRmKwXHZouqDn02jXo/NOxU9N5VgxWB9QQvE32qI X-Received: by 2002:a05:6402:1f13:b0:43b:c521:8de7 with SMTP id b19-20020a0564021f1300b0043bc5218de7mr26377080edb.79.1659007385031; Thu, 28 Jul 2022 04:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659007385; cv=none; d=google.com; s=arc-20160816; b=v5bfxes1Xmp5oJ03/ggkunRLD2UIXdmC5IUs53DSWetr+NOqgMissLUqMe7Bm8fRB1 HOz2oThn459L6WOO/sQJXAmUG/TSMbVkv5485RaOidgvDUUqTn9p+BCD7LYJhGjtnsg0 YQDBO+ogGlqHFI9mSpOU8y62iGXWtPj6MbogBPktCh3ERcH6x9bIxRfU6B15xG4pR7gT O1QZYhYmHezFQwPVnbFU+ErDLPBxfmWPgnYxP3TKhznQXiLYSbF46OLjmbirlXLpwax4 /I7wWLW2WfzUTgPKkEx0ubSE57VXoUy/rYlmH3oJMPT05qfQw7lR6DXVBb5xTZaz7fMq lCPw== 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:dkim-filter; bh=ygMX+bu6gc/yMuo4QKjk1bUpr5VLHBbRrZJps6eSGfc=; b=CkmUv/2aWcqNkSnivmi2NHrgjPLMxqI4FEFjwBZpea3bQHn1LEw1FCREwaru3Z0xVR 3T4+k9P+pABJv5GEQRJeQIB5zyYgw1dtTT26vt2J8CYDegqaUv0zBBHoq/ItoJigcpQr f0tSJ9N691ZYvemsfeVlT39dE7urz5k46Eyte916SPuF+nx3JdNMN+Q82mKa8Uh4+O/u R5bt8qu4LeUTmXC8zYNYCyui5a+uGDKpNeF7SfJxCAa8Wb1eqj6EMWqWE1hKJwr/nk5D OrUHztylRO6DmlDYD7NDjUQXrPpznqxxmvgudCcWfH7YInYRxc+MxiGMWqp3j4rEF+C+ 8AHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=mD6brgMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a17090633d500b0072e6774afc6si357782eja.366.2022.07.28.04.22.39; Thu, 28 Jul 2022 04:23:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=mail header.b=mD6brgMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235933AbiG1LUy (ORCPT + 99 others); Thu, 28 Jul 2022 07:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235803AbiG1LTs (ORCPT ); Thu, 28 Jul 2022 07:19:48 -0400 Received: from mail.baikalelectronics.com (unknown [87.245.175.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D90A067C88; Thu, 28 Jul 2022 04:19:31 -0700 (PDT) Received: from mail (mail.baikal.int [192.168.51.25]) by mail.baikalelectronics.com (Postfix) with ESMTP id 5F5C716D3; Thu, 28 Jul 2022 14:21:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.baikalelectronics.com 5F5C716D3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baikalelectronics.ru; s=mail; t=1659007313; bh=ygMX+bu6gc/yMuo4QKjk1bUpr5VLHBbRrZJps6eSGfc=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=mD6brgMiUNOdvxnpCVROBRRnHXWNhZpxZp+6N+umPslZM0lu3IEe+xsT1wTephkJ3 vFtKrf/Dj99EJXRlQC+DqL0qpivZtTA3gbgoPpCE1va3H76g5rsWeH13CFhfxbVsDm JOUl7eQfqiIqFuUQwpD5ZeGgyoWlwdtzK3atFpD8= Received: from localhost (192.168.53.207) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 28 Jul 2022 14:19:28 +0300 From: Serge Semin To: Damien Le Moal , Hans de Goede , Jens Axboe , Hannes Reinecke CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , , , Subject: [PATCH RESEND v6 15/23] ata: ahci: Convert __ahci_port_base to accepting hpriv as arguments Date: Thu, 28 Jul 2022 14:18:56 +0300 Message-ID: <20220728111905.12427-16-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20220728111905.12427-1-Sergey.Semin@baikalelectronics.ru> References: <20220728111905.12427-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The port base address may be required even before the ata_host instance is initialized and activated, for instance in the ahci_save_initial_config() method which we are about to update (consider this modification as a preparation for that one). Seeing the __ahci_port_base() function isn't used much it's the best candidate to provide the required functionality. So let's convert it to accepting the ahci_host_priv structure pointer. Signed-off-by: Serge Semin Reviewed-by: Hannes Reinecke --- Changelog v5: - Fix some grammar notes in the patchlog. (@Damien) --- drivers/ata/ahci.c | 2 +- drivers/ata/ahci.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index bacb597a0d32..51c0c1dd91ea 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -690,7 +690,7 @@ static void ahci_pci_init_controller(struct ata_host *host) mv = 2; else mv = 4; - port_mmio = __ahci_port_base(host, mv); + port_mmio = __ahci_port_base(hpriv, mv); writel(0, port_mmio + PORT_IRQ_MASK); diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index cc4f40e6c924..5d9db5e7476c 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -432,10 +432,9 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht); void ahci_error_handler(struct ata_port *ap); u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked); -static inline void __iomem *__ahci_port_base(struct ata_host *host, +static inline void __iomem *__ahci_port_base(struct ahci_host_priv *hpriv, unsigned int port_no) { - struct ahci_host_priv *hpriv = host->private_data; void __iomem *mmio = hpriv->mmio; return mmio + 0x100 + (port_no * 0x80); @@ -443,7 +442,9 @@ static inline void __iomem *__ahci_port_base(struct ata_host *host, static inline void __iomem *ahci_port_base(struct ata_port *ap) { - return __ahci_port_base(ap->host, ap->port_no); + struct ahci_host_priv *hpriv = ap->host->private_data; + + return __ahci_port_base(hpriv, ap->port_no); } static inline int ahci_nr_ports(u32 cap) -- 2.35.1