Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751268AbdFBUl1 (ORCPT ); Fri, 2 Jun 2017 16:41:27 -0400 Received: from mail-yw0-f171.google.com ([209.85.161.171]:33773 "EHLO mail-yw0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918AbdFBUl0 (ORCPT ); Fri, 2 Jun 2017 16:41:26 -0400 MIME-Version: 1.0 In-Reply-To: <20170602172355.GO28299@leverpostej> References: <1491238077-20666-1-git-send-email-hotran@apm.com> <1491238077-20666-2-git-send-email-hotran@apm.com> <20170602145934.GK28299@leverpostej> <20170602172355.GO28299@leverpostej> From: Hoan Tran Date: Fri, 2 Jun 2017 13:41:25 -0700 Message-ID: Subject: Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table To: Mark Rutland Cc: Will Deacon , Jonathan Corbet , Tai Nguyen , linux-arm-kernel@lists.infradead.org, lkml , linux-doc@vger.kernel.org, Loc Ho Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1534 Lines: 43 Hi Mark, On Fri, Jun 2, 2017 at 10:23 AM, Mark Rutland wrote: > On Fri, Jun 02, 2017 at 09:54:32AM -0700, Hoan Tran wrote: >> On Fri, Jun 2, 2017 at 7:59 AM, Mark Rutland wrote: >> > On Mon, Apr 03, 2017 at 09:47:55AM -0700, Hoan Tran wrote: >> >> +static const struct acpi_device_id *xgene_pmu_acpi_match_type( >> >> + const struct acpi_device_id *ids, >> >> + struct acpi_device *adev) >> >> +{ >> >> + const struct acpi_device_id *match_id = NULL; >> >> + const struct acpi_device_id *id; >> >> + >> >> + for (id = ids; id->id[0] || id->cls; id++) { >> >> + if (!acpi_match_device_ids(adev, id)) >> >> + match_id = id; >> >> + else if (match_id) >> >> + break; >> >> + } >> >> + >> >> + return match_id; >> >> +} >> > >> > I don't believe this look is necessary. AFAICT, acpi_match_device_ids() >> > already iterates over the id table it is given. >> >> The acpi_match_device_ids() function just returns if a device ID is >> available on the given list. It does not return the first matching ID. >> That's the reason I created this function to find the first matching ID. > > Ah, I see. Thanks for correcting me! > > Can we use acpi_match_device(ids, &adev->dev), or is that the wrong dev? They are subnode device, so they don't have full dev. Because of that, acpi_match_device doesn't work. Thanks Hoan > > Thanks, > Mark.