From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Rutland Subject: Re: [PATCH v2 05/18] ARM64 / ACPI: Parse FADT table to get PSCI flags for PSCI init Date: Tue, 19 Aug 2014 12:10:00 +0100 Message-ID: <20140819111000.GG3302@leverpostej> References: <1407166105-17675-1-git-send-email-hanjun.guo@linaro.org> <1407166105-17675-6-git-send-email-hanjun.guo@linaro.org> <20140818142721.GR20043@localhost> <53F2C983.8000800@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <53F2C983.8000800@linaro.org> Sender: linux-kernel-owner@vger.kernel.org To: Hanjun Guo Cc: Catalin Marinas , "Rafael J. Wysocki" , "graeme.gregory@linaro.org" , Arnd Bergmann , Olof Johansson , "grant.likely@linaro.org" , Sudeep Holla , Will Deacon , Jason Cooper , Marc Zyngier , Bjorn Helgaas , Daniel Lezcano , Mark Brown , Rob Herring , Robert Richter , Lv Zheng , Robert Moore , Lorenzo Pieralisi , Liviu Dudau , Randy Dunlap , Charles Garcia-Tobin , "linux-acpi@vger.kernel.org" List-Id: linux-acpi@vger.kernel.org > >> @@ -47,6 +49,26 @@ void __init __acpi_unmap_table(char *map, unsigned long size) > >> early_memunmap(map, size); > >> } > >> > >> +static int __init acpi_parse_fadt(struct acpi_table_header *table) > >> +{ > >> + struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table; > >> + > >> + /* > >> + * Revision in table header is the FADT Major version, > >> + * and there is a minor version of FADT which was introduced > >> + * by ACPI 5.1, we only deal with ACPI 5.1 or higher version > >> + * to get arm boot flags, or we will disable ACPI. > >> + */ > >> + if (table->revision < 5 || fadt->minor_revision < 1) { > > > > If we ever get revision 6.0, this would trigger. > > Yes, good catch, actually I already fixed that in my local git repo, > > + if (table->revision > 5 || > + (table->revision == 5 && fadt->minor_revision >= 1)) { > + return 0; > + } else { > + pr_info("FADT revision is %d.%d, no PSCI support, should be 5.1 > or higher\n", > + table->revision, fadt->minor_revision); > + disable_acpi(); > + return -EINVAL; > + } Given you return in the first path, you don't need the remaining code to live in an else block. Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 From: mark.rutland@arm.com (Mark Rutland) Date: Tue, 19 Aug 2014 12:10:00 +0100 Subject: [PATCH v2 05/18] ARM64 / ACPI: Parse FADT table to get PSCI flags for PSCI init In-Reply-To: <53F2C983.8000800@linaro.org> References: <1407166105-17675-1-git-send-email-hanjun.guo@linaro.org> <1407166105-17675-6-git-send-email-hanjun.guo@linaro.org> <20140818142721.GR20043@localhost> <53F2C983.8000800@linaro.org> Message-ID: <20140819111000.GG3302@leverpostej> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org > >> @@ -47,6 +49,26 @@ void __init __acpi_unmap_table(char *map, unsigned long size) > >> early_memunmap(map, size); > >> } > >> > >> +static int __init acpi_parse_fadt(struct acpi_table_header *table) > >> +{ > >> + struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table; > >> + > >> + /* > >> + * Revision in table header is the FADT Major version, > >> + * and there is a minor version of FADT which was introduced > >> + * by ACPI 5.1, we only deal with ACPI 5.1 or higher version > >> + * to get arm boot flags, or we will disable ACPI. > >> + */ > >> + if (table->revision < 5 || fadt->minor_revision < 1) { > > > > If we ever get revision 6.0, this would trigger. > > Yes, good catch, actually I already fixed that in my local git repo, > > + if (table->revision > 5 || > + (table->revision == 5 && fadt->minor_revision >= 1)) { > + return 0; > + } else { > + pr_info("FADT revision is %d.%d, no PSCI support, should be 5.1 > or higher\n", > + table->revision, fadt->minor_revision); > + disable_acpi(); > + return -EINVAL; > + } Given you return in the first path, you don't need the remaining code to live in an else block. Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752604AbaHSLKM (ORCPT ); Tue, 19 Aug 2014 07:10:12 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:61477 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752094AbaHSLKJ (ORCPT ); Tue, 19 Aug 2014 07:10:09 -0400 Date: Tue, 19 Aug 2014 12:10:00 +0100 From: Mark Rutland To: Hanjun Guo Cc: Catalin Marinas , "Rafael J. Wysocki" , "graeme.gregory@linaro.org" , Arnd Bergmann , Olof Johansson , "grant.likely@linaro.org" , Sudeep Holla , Will Deacon , Jason Cooper , Marc Zyngier , Bjorn Helgaas , Daniel Lezcano , Mark Brown , Rob Herring , Robert Richter , Lv Zheng , Robert Moore , Lorenzo Pieralisi , Liviu Dudau , Randy Dunlap , Charles Garcia-Tobin , "linux-acpi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linaro-acpi@lists.linaro.org" Subject: Re: [PATCH v2 05/18] ARM64 / ACPI: Parse FADT table to get PSCI flags for PSCI init Message-ID: <20140819111000.GG3302@leverpostej> References: <1407166105-17675-1-git-send-email-hanjun.guo@linaro.org> <1407166105-17675-6-git-send-email-hanjun.guo@linaro.org> <20140818142721.GR20043@localhost> <53F2C983.8000800@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53F2C983.8000800@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > >> @@ -47,6 +49,26 @@ void __init __acpi_unmap_table(char *map, unsigned long size) > >> early_memunmap(map, size); > >> } > >> > >> +static int __init acpi_parse_fadt(struct acpi_table_header *table) > >> +{ > >> + struct acpi_table_fadt *fadt = (struct acpi_table_fadt *)table; > >> + > >> + /* > >> + * Revision in table header is the FADT Major version, > >> + * and there is a minor version of FADT which was introduced > >> + * by ACPI 5.1, we only deal with ACPI 5.1 or higher version > >> + * to get arm boot flags, or we will disable ACPI. > >> + */ > >> + if (table->revision < 5 || fadt->minor_revision < 1) { > > > > If we ever get revision 6.0, this would trigger. > > Yes, good catch, actually I already fixed that in my local git repo, > > + if (table->revision > 5 || > + (table->revision == 5 && fadt->minor_revision >= 1)) { > + return 0; > + } else { > + pr_info("FADT revision is %d.%d, no PSCI support, should be 5.1 > or higher\n", > + table->revision, fadt->minor_revision); > + disable_acpi(); > + return -EINVAL; > + } Given you return in the first path, you don't need the remaining code to live in an else block. Mark.