From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Subject: Re: [PATCH v13 7/9] ACPI: Translate the I/O range of non-MMIO devices before scanning Date: Wed, 14 Feb 2018 18:16:53 +0200 Message-ID: References: <1518543933-22456-1-git-send-email-john.garry@huawei.com> <1518543933-22456-8-git-send-email-john.garry@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: John Garry Cc: Mika Westerberg , "Rafael J. Wysocki" , Lorenzo Pieralisi , "Rafael J. Wysocki" , Hanjun Guo , Rob Herring , Bjorn Helgaas , Arnd Bergmann , Mark Rutland , Olof Johansson , Dann Frazier , Rob Herring , Joe Perches , Benjamin Herrenschmidt , linux-pci@vger.kernel.org, Linux Kernel Mailing List , ACPI Devel Maling List , Linuxarm , Corey Minyard devicetree List-Id: linux-acpi@vger.kernel.org On Wed, Feb 14, 2018 at 5:33 PM, John Garry wrote: > On 14/02/2018 13:53, Andy Shevchenko wrote: >> On Tue, Feb 13, 2018 at 7:45 PM, John Garry wrote: >>> + sys_port = logic_pio_trans_hwaddr(&host->fwnode, res->start, >>> len); >>> + if (sys_port == -1UL) >> Wouldn't it be better to compare with ULONG_MAX? > Could do, being the same thing. Maybe people prefer -1UL as it saves having > to figure out what ULONG_MAX is :) -1UL looks confusing. Another approach is to use ~0UL if that is preferable. >>> + list_for_each_entry(rentry, &resource_list, node) >>> + resources[count++] = *rentry->res; >> It has similarities with acpi_create_platform_device(). >> I guess we can utilize existing code. > For sure, this particular segment is effectively same as part of > acpi_create_platform_device(): Not the same, acpi_create_platform_device() does a bit more than copying the resources. If it indeed makes no hurt... > list_for_each_entry(rentry, &resource_list, node) > acpi_platform_fill_resource(adev, rentry->res, > &resources[count++]); > So is your idea to refactor this common segment into a helper function? ...I would go with helper. >>> + char *name = &acpi_indirect_io_mfd_cell[count].name[0]; >>> + char *pnpid = &acpi_indirect_io_mfd_cell[count].pnpid[0]; >> >> >> Plain x is equivalent to &x[0]. > Right, but I thought for arrays that we should use address of x rather than > x itself, no? x is addressed by it's beginning. -- With Best Regards, Andy Shevchenko