Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1037893iob; Fri, 13 May 2022 20:36:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWhGFQQjIEZInGUgHJMeTLYH6RiHIwl1In6VwdByDztMRgbc4hoCEw367tag6VPwTZmR3G X-Received: by 2002:a05:600c:3641:b0:38e:4b2f:330 with SMTP id y1-20020a05600c364100b0038e4b2f0330mr17591775wmq.180.1652499386828; Fri, 13 May 2022 20:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652499386; cv=none; d=google.com; s=arc-20160816; b=GwxoIOat0VpSry2ScFNYqxw9ZQloKVMKj2cRalX0NaFt3tfUmYuvd9i/VhvM1Ak0gY E/91yugXxwkIaKYrUFhZgBN6lYhF5lmO1NNLQViN1kiPECOhIB3VLARNBPjnRcA+7qfM r3bpgEi8JnVmKSkYutWtIjJJw4BBlO4c/vclaCXaBo3ehtZrRUZHP3HzwOU8tsl9QTUw PRe9BUQe1ZMpaGuW6E0zy4ZIUDC/XXlVZyKG64ffKbgH2N0FC2ro49GOw6MXjVRe8PT+ HZhRdfxfcR5Mc0dPAGhsba4zTDZDfllXiSLH5J4R6pm5+dh4tjoUlo50rFCO8tx6GIHH UQUg== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=hSlksHatCxuErh8m6va0Tvd5w4S67Q4daZM1+wIIBZQ=; b=QPznpoHeT8mTRxJUVRkWYI/jxy5JXsCpcMrTUHEln5Byqn+RSYh+Td+LTpAi3Ru3gT vJD/RoyX+cYlP2vcv2nlSH6tbpena9BIwLe9s8giJC6E5g4EENviTcy7+cTtgfZOY+bZ 6lvTwM8rQ9H4bPwEL/LMbUQFNhbFMIVlFqeIPKQB1nvvDfc1TVcnELyjCT1WIn9Jht5o 3IDp6MwWMxVCdCyKTlrpNzK6rpEkFKQ/glSYI6w8OhWLzvOTI/24wfeoZ8suZcwuxowf LEFqQZERhPeJvuTgGLqf1ziHjo1FabbemA/A++YlxettstOggVv8aJeHHgXtEdcUcKz+ iqwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="b5F/GnHt"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f10-20020a05600c154a00b0039472723184si8371903wmg.58.2022.05.13.20.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:36:26 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="b5F/GnHt"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5965131AF87; Fri, 13 May 2022 17:12:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350419AbiELGb0 (ORCPT + 99 others); Thu, 12 May 2022 02:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350510AbiELGbR (ORCPT ); Thu, 12 May 2022 02:31:17 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63506B7F8; Wed, 11 May 2022 23:31:15 -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-out1.suse.de (Postfix) with ESMTPS id 2017921ACB; Thu, 12 May 2022 06:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652337074; 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=hSlksHatCxuErh8m6va0Tvd5w4S67Q4daZM1+wIIBZQ=; b=b5F/GnHtyOkwgPSDiuZ+fi3p1tayUF0PKP7TfAjuL198Pid9iTqOHSBtqgKdxNPXX7Qe0m yhuEKtOlT7/xmgL+XWne7a5bqy3ZZ5pXiq8AYZYPq+pvr/7exEATVM+aeIevi0mJ+rRrS9 8A9vW8E14CS1c7vevDKE4Oak/q4Z5Q0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652337074; 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=hSlksHatCxuErh8m6va0Tvd5w4S67Q4daZM1+wIIBZQ=; b=8Ew4CvB/RZkqIa9AFGxzxR2aJw5JHFV+/W55HOzkGhmfVZJqHoLwSKGs91dxl+D8Rk0DOY +15rhDcWQWiJSXBg== 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 DEAEA13ABE; Thu, 12 May 2022 06:31:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6osSNrGpfGLjTwAAMHmgww (envelope-from ); Thu, 12 May 2022 06:31:13 +0000 Message-ID: <252c0b18-c640-f813-408f-6f8d2e4af1d4@suse.de> Date: Thu, 12 May 2022 08:31:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v3 06/23] ata: libahci_platform: Convert to using platform devm-ioremap methods Content-Language: en-US To: Serge Semin , Damien Le Moal , Hans de Goede , Jens Axboe Cc: Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20220511231810.4928-1-Sergey.Semin@baikalelectronics.ru> <20220511231810.4928-7-Sergey.Semin@baikalelectronics.ru> From: Hannes Reinecke In-Reply-To: <20220511231810.4928-7-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: > Currently the IOMEM AHCI registers space is mapped by means of the > two functions invocation: platform_get_resource() is used to get the very > first memory resource and devm_ioremap_resource() is called to remap that > resource. Device-managed kernel API provides a handy wrapper to perform > the same in single function call: devm_platform_ioremap_resource(). > > While at it seeing many AHCI platform drivers rely on having the AHCI CSR > space marked with "ahci" name let's first try to find and remap the CSR > IO-mem with that name and only if it fails fallback to getting the very > first registers space platform resource. > > Signed-off-by: Serge Semin > > --- > > Changelog v2: > - Check whether there is "ahhi" reg resource before using the > devm_platform_ioremap_resource_byname() method in order to prevent a > false error message printed in the log (@Damien) > - Slightly update the patch title due to the change above and to be more > specific that the platform device managed methods are utilized. > --- > drivers/ata/libahci_platform.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c > index f7f9bfcfc164..8c9fbcc3043b 100644 > --- a/drivers/ata/libahci_platform.c > +++ b/drivers/ata/libahci_platform.c > @@ -404,8 +404,14 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, > > devres_add(dev, hpriv); > > - hpriv->mmio = devm_ioremap_resource(dev, > - platform_get_resource(pdev, IORESOURCE_MEM, 0)); > + /* > + * If the DT provided an "ahci" named resource, use it. Otherwise, > + * fallback to using the default first resource for the device node. > + */ > + if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "ahci")) > + hpriv->mmio = devm_platform_ioremap_resource_byname(pdev, "ahci"); > + else > + hpriv->mmio = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(hpriv->mmio)) { > rc = PTR_ERR(hpriv->mmio); > goto err_out; Reviewed-by: Hannes Reinecke 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