Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1215443iob; Thu, 12 May 2022 13:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXh5L05nabpwYRty1W5kus5e2D+sl2ZTCvLv3K2toc+W50NYrgacHPK8pdAfhblHU1oNVq X-Received: by 2002:a05:6402:228c:b0:425:d911:fd35 with SMTP id cw12-20020a056402228c00b00425d911fd35mr37106609edb.325.1652389118352; Thu, 12 May 2022 13:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652389118; cv=none; d=google.com; s=arc-20160816; b=JWqnNLLDTTM4xoXww1HrM2YIX+NUkQzG/CgSbrWMiOf2VTC3vxhT+bcq3X9rUiUkFO ADqK9mxHLoN1prRys/gC4X5Soz86fU/qCQJHDCp9b123m5uaAEou10I6S+W2kxqscIJP bRawF/VmzZ7QdOU8iuCRecqoWSf7Fmj9qiY9Gx6Bo7VfJ1laHCfvB/YruDQ8FTC6F5HM Wl0koVIAUL4dBL1nnXz9+atgEUPcRDsne/w9QSn/R7RdujTnFt90Qh/+DjRUG+n2YcLK evd+j6FyXWFT+wTEf66Xyztc7BrxXgcAwky57M7EcnvtfBcCRGMXOR2K6SHBO1nseBhz hBYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=Eu9dmL37+61LEqPwl8A52yyx9mTfxqzqsNTK2LFvPLQ=; b=WXe5ZS1q2zJzLXwRJYHYZxSLvKDnpHZk++KTnForUFYmDTNRR/mShYJj3qiUFOkMvo fNMARAiYKQcVjCyp8bqyHXOFGafpxP2+FiJx7oSwsxVxHtoweHkQNJTvLftcg5gQ1Nyk V4sFl5QIyL+K84IcYg2RBd8DxyEL5wMyL9m5ESoBduuiisENoSLR0LB/agQdqeyhQuI0 P528F9zwJokJLkqCEnh6Q/d2DLXLIBmxI58s6BAoiD6xSmPO4ffNJA4qgxq/oBWC60Xh g7YhnxXUi2dzLdRHst78qX/ArTpICSMR0m3vZZfpS3TnJp7h6kmGpg1hCT7GmlR26QDM F/aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=GINM0xc9; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a05640234c100b0041d983f82adsi269442edc.43.2022.05.12.13.58.06; Thu, 12 May 2022 13:58:38 -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=@suse.de header.s=susede2_rsa header.b=GINM0xc9; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350377AbiELGsa (ORCPT + 99 others); Thu, 12 May 2022 02:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbiELGs1 (ORCPT ); Thu, 12 May 2022 02:48:27 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45BA76B7E8; Wed, 11 May 2022 23:48:26 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F3A0A1F8F4; Thu, 12 May 2022 06:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652338105; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eu9dmL37+61LEqPwl8A52yyx9mTfxqzqsNTK2LFvPLQ=; b=GINM0xc9jq+k+Rm9dfJBpBb5b9xYd3NSyOFAAM1GqUZofWwqRW0xafLC2TRExNkREM8Cs6 tp/EaLSZs6qv9kdrKhLQwbLEBA4vkkcJiDOXnWZaRutFi0aM46eUBxJhHOXFEuzyd9SfaH 2JjjJoGuXX8RinzI5mrEB/Aj3Q/RLZ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652338105; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Eu9dmL37+61LEqPwl8A52yyx9mTfxqzqsNTK2LFvPLQ=; b=OZM1ZcPj2bCc+as8UglJ1d7CTen0JK3v7tACdsnA71o+G83xWyJcNR4pz+ISE12LF5OYqK Li91Qrr6y7QZjzBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B51A013ABE; Thu, 12 May 2022 06:48:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iagnKritfGLoVQAAMHmgww (envelope-from ); Thu, 12 May 2022 06:48:24 +0000 Message-ID: <1e349868-b302-1473-188a-1a6f2bb88cd5@suse.de> Date: Thu, 12 May 2022 08:48:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-US To: Serge Semin , Damien Le Moal , Hans de Goede , Jens Axboe , Matthias Brugger , Patrice Chotard Cc: Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20220511231810.4928-1-Sergey.Semin@baikalelectronics.ru> <20220511231810.4928-11-Sergey.Semin@baikalelectronics.ru> From: Hannes Reinecke Subject: Re: [PATCH v3 10/23] ata: libahci_platform: Parse ports-implemented property in resources getter In-Reply-To: <20220511231810.4928-11-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 5/12/22 01:17, Serge Semin wrote: > The ports-implemented property is mainly used on the OF-based platforms > with no ports mapping initialized by a bootloader/BIOS firmware. Seeing > the same of_property_read_u32()-based pattern has already been implemented > in the generic AHCI LLDD (glue) driver and in the Mediatek, St AHCI > drivers let's move the property read procedure to the generic > ahci_platform_get_resources() method. Thus we'll have the forced ports > mapping feature supported for each OF-based platform which requires that, > and stop re-implementing the same pattern in there a bit simplifying the > code. > > Signed-off-by: Serge Semin > --- > drivers/ata/ahci_mtk.c | 2 -- > drivers/ata/ahci_platform.c | 3 --- > drivers/ata/ahci_st.c | 3 --- > drivers/ata/libahci_platform.c | 3 +++ > 4 files changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/ata/ahci_mtk.c b/drivers/ata/ahci_mtk.c > index 1f6c85fde983..c056378e3e72 100644 > --- a/drivers/ata/ahci_mtk.c > +++ b/drivers/ata/ahci_mtk.c > @@ -118,8 +118,6 @@ static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv, > SYS_CFG_SATA_EN); > } > > - of_property_read_u32(np, "ports-implemented", &hpriv->force_port_map); > - > return 0; > } > > diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c > index 28a8de5b48b9..9b56490ecbc3 100644 > --- a/drivers/ata/ahci_platform.c > +++ b/drivers/ata/ahci_platform.c > @@ -56,9 +56,6 @@ static int ahci_probe(struct platform_device *pdev) > if (rc) > return rc; > > - of_property_read_u32(dev->of_node, > - "ports-implemented", &hpriv->force_port_map); > - > if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) > hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; > > diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c > index 7526653c843b..068621099c00 100644 > --- a/drivers/ata/ahci_st.c > +++ b/drivers/ata/ahci_st.c > @@ -168,9 +168,6 @@ static int st_ahci_probe(struct platform_device *pdev) > > st_ahci_configure_oob(hpriv->mmio); > > - of_property_read_u32(dev->of_node, > - "ports-implemented", &hpriv->force_port_map); > - > err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, > &ahci_platform_sht); > if (err) { > diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c > index 4e54e19f07b2..f7f9cac10cb1 100644 > --- a/drivers/ata/libahci_platform.c > +++ b/drivers/ata/libahci_platform.c > @@ -512,6 +512,9 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, > goto err_out; > } > > + of_property_read_u32(dev->of_node, > + "ports-implemented", &hpriv->force_port_map); > + > if (child_nodes) { > for_each_child_of_node(dev->of_node, child) { > u32 port; What happens on the other platforms? Won't they register an error if that property isn't implemented? Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer