From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752744AbbJMJrK (ORCPT ); Tue, 13 Oct 2015 05:47:10 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33815 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbbJMJrI (ORCPT ); Tue, 13 Oct 2015 05:47:08 -0400 Message-ID: <561CD316.6040406@linaro.org> Date: Tue, 13 Oct 2015 17:47:02 +0800 From: zhangfei User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Arnd Bergmann , John Garry CC: James.Bottomley@hansenpartnership.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linuxarm@huawei.com, linux-scsi@vger.kernel.org, xuwei5@hisilicon.com, john.garry2@mail.dcu.ie, hare@suse.de Subject: Re: [PATCH 07/25] scsi: hisi_sas: add ioremap for device HW References: <1444663237-238302-1-git-send-email-john.garry@huawei.com> <1444663237-238302-8-git-send-email-john.garry@huawei.com> <5285087.C8umupFr76@wuerfel> In-Reply-To: <5285087.C8umupFr76@wuerfel> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/12/2015 11:21 PM, Arnd Bergmann wrote: > On Monday 12 October 2015 23:20:19 John Garry wrote: >> +int hisi_sas_ioremap(struct hisi_hba *hisi_hba) >> +{ >> + struct platform_device *pdev = hisi_hba->pdev; >> + struct device *dev = &pdev->dev; >> + struct resource *res; >> + >> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> + hisi_hba->regs = devm_ioremap(dev, >> + res->start, >> + resource_size(res)); >> + if (!hisi_hba->regs) >> + return -ENOMEM; >> + >> + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); >> + hisi_hba->ctrl_regs = devm_ioremap(dev, >> + res->start, >> + resource_size(res)); >> + if (!hisi_hba->ctrl_regs) >> + return -ENOMEM; >> + >> + return 0; >> +} >> >> static const struct of_device_id sas_of_match[] = { >> > > Better use devm_ioremap_resource() here, which registers the resource so they > are checked for conflicts and listed in /proc/iomem. > Yes, hisi_hba->regs can use devm_ioremap_resource. However ctrl_regs have to use devm_ioremap, since the address are sharing among different nodes, unfortunately, and devm_ioremap_resource will fail. Thanks