Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1656319 > unrolled thread
| Started by | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| First post | 2017-06-02 17:10 +0200 |
| Last post | 2017-06-02 22:50 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table Mark Rutland <mark.rutland@arm.com> - 2017-06-02 17:10 +0200
Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table Hoan Tran <hotran@apm.com> - 2017-06-02 19:00 +0200
Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table Mark Rutland <mark.rutland@arm.com> - 2017-06-02 19:30 +0200
Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table Hoan Tran <hotran@apm.com> - 2017-06-02 22:50 +0200
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2017-06-02 17:10 +0200 |
| Subject | Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table |
| Message-ID | <tNWn8-2Pu-23@gated-at.bofh.it> |
Hi Hoan,
Apologies for the last reply.
On Mon, Apr 03, 2017 at 09:47:55AM -0700, Hoan Tran wrote:
> +static const struct acpi_device_id xgene_pmu_acpi_type_match[] = {
> + {"APMC0D5D", PMU_TYPE_L3C},
> + {"APMC0D5E", PMU_TYPE_IOB},
> + {"APMC0D5F", PMU_TYPE_MCB},
> + {"APMC0D60", PMU_TYPE_MC},
> + {},
> +};
> +
> +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.
> +
> static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level,
> void *data, void **return_value)
> {
> + const struct acpi_device_id *acpi_id;
> struct xgene_pmu *xgene_pmu = data;
> struct xgene_pmu_dev_ctx *ctx;
> struct acpi_device *adev;
> @@ -1059,17 +1085,11 @@ static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level,
> if (acpi_bus_get_status(adev) || !adev->status.present)
> return AE_OK;
>
> - if (!strcmp(acpi_device_hid(adev), "APMC0D5D"))
> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_L3C);
> - else if (!strcmp(acpi_device_hid(adev), "APMC0D5E"))
> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_IOB);
> - else if (!strcmp(acpi_device_hid(adev), "APMC0D5F"))
> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_MCB);
> - else if (!strcmp(acpi_device_hid(adev), "APMC0D60"))
> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_MC);
> - else
> - ctx = NULL;
> + acpi_id = xgene_pmu_acpi_match_type(xgene_pmu_acpi_type_match, adev);
> + if (!acpi_id)
> + return AE_OK;
As above, and as I covered in my reply to v1, I think the above should
be:
acpi_id = acpi_match_device_ids(adev, xgene_pmu_acpi_type_match);
if (!acpi_id)
return AE_OK;
... or am I missing something?
With that change:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
Mark.
>
> + ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, (u32)acpi_id->driver_data);
> if (!ctx)
> return AE_OK;
>
> --
> 1.9.1
>
[toc] | [next] | [standalone]
| From | Hoan Tran <hotran@apm.com> |
|---|---|
| Date | 2017-06-02 19:00 +0200 |
| Subject | Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table |
| Message-ID | <tNY5z-3Ka-1@gated-at.bofh.it> |
| In reply to | #1656319 |
Hi Mark
On Fri, Jun 2, 2017 at 7:59 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> Hi Hoan,
>
> Apologies for the last reply.
>
> On Mon, Apr 03, 2017 at 09:47:55AM -0700, Hoan Tran wrote:
>> +static const struct acpi_device_id xgene_pmu_acpi_type_match[] = {
>> + {"APMC0D5D", PMU_TYPE_L3C},
>> + {"APMC0D5E", PMU_TYPE_IOB},
>> + {"APMC0D5F", PMU_TYPE_MCB},
>> + {"APMC0D60", PMU_TYPE_MC},
>> + {},
>> +};
>> +
>> +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.
>
>> +
>> static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level,
>> void *data, void **return_value)
>> {
>> + const struct acpi_device_id *acpi_id;
>> struct xgene_pmu *xgene_pmu = data;
>> struct xgene_pmu_dev_ctx *ctx;
>> struct acpi_device *adev;
>> @@ -1059,17 +1085,11 @@ static acpi_status acpi_pmu_dev_add(acpi_handle handle, u32 level,
>> if (acpi_bus_get_status(adev) || !adev->status.present)
>> return AE_OK;
>>
>> - if (!strcmp(acpi_device_hid(adev), "APMC0D5D"))
>> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_L3C);
>> - else if (!strcmp(acpi_device_hid(adev), "APMC0D5E"))
>> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_IOB);
>> - else if (!strcmp(acpi_device_hid(adev), "APMC0D5F"))
>> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_MCB);
>> - else if (!strcmp(acpi_device_hid(adev), "APMC0D60"))
>> - ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, PMU_TYPE_MC);
>> - else
>> - ctx = NULL;
>> + acpi_id = xgene_pmu_acpi_match_type(xgene_pmu_acpi_type_match, adev);
>> + if (!acpi_id)
>> + return AE_OK;
>
> As above, and as I covered in my reply to v1, I think the above should
> be:
>
> acpi_id = acpi_match_device_ids(adev, xgene_pmu_acpi_type_match);
> if (!acpi_id)
> return AE_OK;
>
> ... or am I missing something?
The same above.
Thanks
Hoan
>
> With that change:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
>
> Thanks,
> Mark.
>
>>
>> + ctx = acpi_get_pmu_hw_inf(xgene_pmu, adev, (u32)acpi_id->driver_data);
>> if (!ctx)
>> return AE_OK;
>>
>> --
>> 1.9.1
>>
[toc] | [prev] | [next] | [standalone]
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2017-06-02 19:30 +0200 |
| Message-ID | <tNYyC-49F-19@gated-at.bofh.it> |
| In reply to | #1656394 |
On Fri, Jun 02, 2017 at 09:54:32AM -0700, Hoan Tran wrote:
> On Fri, Jun 2, 2017 at 7:59 AM, Mark Rutland <mark.rutland@arm.com> 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?
Thanks,
Mark.
[toc] | [prev] | [next] | [standalone]
| From | Hoan Tran <hotran@apm.com> |
|---|---|
| Date | 2017-06-02 22:50 +0200 |
| Subject | Re: [PATCH v2 1/3] perf: xgene: Parse PMU subnode from the match table |
| Message-ID | <tO1G9-621-5@gated-at.bofh.it> |
| In reply to | #1656404 |
Hi Mark,
On Fri, Jun 2, 2017 at 10:23 AM, Mark Rutland <mark.rutland@arm.com> 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 <mark.rutland@arm.com> 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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web