From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH v4 03/18] ACPI / table: Count matched and successfully parsed entries without specifying max entries Date: Mon, 15 Sep 2014 09:48:56 -0700 Message-ID: <20140915164856.53B3EC40A26@trevor.secretlab.ca> References: <1410530416-30200-1-git-send-email-hanjun.guo@linaro.org> <1410530416-30200-4-git-send-email-hanjun.guo@linaro.org> Return-path: Received: from mail-pd0-f175.google.com ([209.85.192.175]:34099 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754306AbaIOQs6 (ORCPT ); Mon, 15 Sep 2014 12:48:58 -0400 Received: by mail-pd0-f175.google.com with SMTP id z10so6654193pdj.6 for ; Mon, 15 Sep 2014 09:48:57 -0700 (PDT) In-Reply-To: <1410530416-30200-4-git-send-email-hanjun.guo@linaro.org> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: Catalin Marinas , "Rafael J. Wysocki" , Mark Rutland , Olof Johansson , Will Deacon Cc: Graeme Gregory , Arnd Bergmann , Sudeep Holla , Jon Masters , 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@arm.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Tomasz Nowicki , Hanjun Guo On Fri, 12 Sep 2014 22:00:01 +0800, Hanjun Guo wrote: > From: Tomasz Nowicki > > It is very useful to traverse all available table entries without max > number of expected entries type. Current acpi_parse_entries() > implementation gives that feature but it does not count those entries, > it returns 0 instead, so fix it to count matched and successfully > entries and return it. > > NOTE: This change has no impact to x86 and ia64 archs since existing code > checks for error occurrence only (acpi_parse_entries(...,0) < 0). > > Signed-off-by: Tomasz Nowicki > Signed-off-by: Hanjun Guo Acked-by: Grant Likely > --- > drivers/acpi/tables.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c > index 21ae521..b18e45e 100644 > --- a/drivers/acpi/tables.c > +++ b/drivers/acpi/tables.c > @@ -225,10 +225,13 @@ acpi_parse_entries(unsigned long table_size, > while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) < > table_end) { > if (entry->type == entry_id > - && (!max_entries || count++ < max_entries)) > + && (!max_entries || count < max_entries)) { > if (handler(entry, table_end)) > return -EINVAL; > > + count++; > + } > + > /* > * If entry->length is 0, break from this loop to avoid > * infinite loop. > -- > 1.7.9.5 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754325AbaIOQtA (ORCPT ); Mon, 15 Sep 2014 12:49:00 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:34507 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754307AbaIOQs6 (ORCPT ); Mon, 15 Sep 2014 12:48:58 -0400 From: Grant Likely Subject: Re: [PATCH v4 03/18] ACPI / table: Count matched and successfully parsed entries without specifying max entries To: Hanjun Guo , Catalin Marinas , "Rafael J. Wysocki" , Mark Rutland , Olof Johansson , Will Deacon Cc: Graeme Gregory , Arnd Bergmann , Sudeep Holla , Jon Masters , 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@arm.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Tomasz Nowicki , Hanjun Guo In-Reply-To: <1410530416-30200-4-git-send-email-hanjun.guo@linaro.org> References: <1410530416-30200-1-git-send-email-hanjun.guo@linaro.org> <1410530416-30200-4-git-send-email-hanjun.guo@linaro.org> Date: Mon, 15 Sep 2014 09:48:56 -0700 Message-Id: <20140915164856.53B3EC40A26@trevor.secretlab.ca> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 Sep 2014 22:00:01 +0800, Hanjun Guo wrote: > From: Tomasz Nowicki > > It is very useful to traverse all available table entries without max > number of expected entries type. Current acpi_parse_entries() > implementation gives that feature but it does not count those entries, > it returns 0 instead, so fix it to count matched and successfully > entries and return it. > > NOTE: This change has no impact to x86 and ia64 archs since existing code > checks for error occurrence only (acpi_parse_entries(...,0) < 0). > > Signed-off-by: Tomasz Nowicki > Signed-off-by: Hanjun Guo Acked-by: Grant Likely > --- > drivers/acpi/tables.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c > index 21ae521..b18e45e 100644 > --- a/drivers/acpi/tables.c > +++ b/drivers/acpi/tables.c > @@ -225,10 +225,13 @@ acpi_parse_entries(unsigned long table_size, > while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) < > table_end) { > if (entry->type == entry_id > - && (!max_entries || count++ < max_entries)) > + && (!max_entries || count < max_entries)) { > if (handler(entry, table_end)) > return -EINVAL; > > + count++; > + } > + > /* > * If entry->length is 0, break from this loop to avoid > * infinite loop. > -- > 1.7.9.5 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: grant.likely@linaro.org (Grant Likely) Date: Mon, 15 Sep 2014 09:48:56 -0700 Subject: [PATCH v4 03/18] ACPI / table: Count matched and successfully parsed entries without specifying max entries In-Reply-To: <1410530416-30200-4-git-send-email-hanjun.guo@linaro.org> References: <1410530416-30200-1-git-send-email-hanjun.guo@linaro.org> <1410530416-30200-4-git-send-email-hanjun.guo@linaro.org> Message-ID: <20140915164856.53B3EC40A26@trevor.secretlab.ca> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Fri, 12 Sep 2014 22:00:01 +0800, Hanjun Guo wrote: > From: Tomasz Nowicki > > It is very useful to traverse all available table entries without max > number of expected entries type. Current acpi_parse_entries() > implementation gives that feature but it does not count those entries, > it returns 0 instead, so fix it to count matched and successfully > entries and return it. > > NOTE: This change has no impact to x86 and ia64 archs since existing code > checks for error occurrence only (acpi_parse_entries(...,0) < 0). > > Signed-off-by: Tomasz Nowicki > Signed-off-by: Hanjun Guo Acked-by: Grant Likely > --- > drivers/acpi/tables.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c > index 21ae521..b18e45e 100644 > --- a/drivers/acpi/tables.c > +++ b/drivers/acpi/tables.c > @@ -225,10 +225,13 @@ acpi_parse_entries(unsigned long table_size, > while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) < > table_end) { > if (entry->type == entry_id > - && (!max_entries || count++ < max_entries)) > + && (!max_entries || count < max_entries)) { > if (handler(entry, table_end)) > return -EINVAL; > > + count++; > + } > + > /* > * If entry->length is 0, break from this loop to avoid > * infinite loop. > -- > 1.7.9.5 >