Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp781754imm; Wed, 4 Jul 2018 06:01:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeTsRmpvTNZ1U+pbW1wS4IqZv+2MqOqAYgY1An4/I06TjH/zb6vQSIPQKWdskMDh9DmjOSw X-Received: by 2002:a63:3201:: with SMTP id y1-v6mr1863197pgy.419.1530709267026; Wed, 04 Jul 2018 06:01:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530709266; cv=none; d=google.com; s=arc-20160816; b=C2nAOLPKk5hM+RI8gOdSn7QsoqLb1K3M/IGPmCdwRAwPdXRKE6CBHGhZj20A4kvBkT j61TJNZGMoo7JcNrJp9X0bbM4Z0PeVDwEsj7c85KWGPN/uZWiQTNrHsBwDUphF73Y5IQ FYO8uTHkOF2BNk9OA0VdZwKjp8Pu7cItgZtfDAtuOfcp0WIXLsHWpxIBc3Us3LwGKFHm 9pM1L5z6qiUTv5PAxLZRFWgxIFF774pz/+Vlzmy7sMunZCC+a/mw1pARxQApSzf3veSS ZdlqvqiEQuD74NQt3oz7nj5MqJtOOUwWuvFx8Y0nw22cLhxHrxYKS5/kPumodsdUklWh LyzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=Os2hhqcEdZdD6PEtTYBlal78WvChB1UMI57TR+qGwiQ=; b=XFEsWJyUFJ4X83xSQ6xnaYGehKNbzFtah6e/2/yOvp/vTmLYZ6jppIFb3EbuyIqB/u F96+JTIzlEcUjhZH1myQngiUuBWsPsEA79IhuDsw7V1NU+Si/4+KOsVm933N7YTDtJ3x FjUyB8ZWnvhg8ElLJWr03zd/cflRHrVf9H5lUezngpiiNSGN01oTo+MWMOchLAdzTeW8 RrcW654eg5vK55h8i+k3RlLeH8jY0eamkC1fzKhKbes/LTqN0GKqCTG5P8Jds3glI1Z6 aNP7pR6JosbglHpRUFZyqGjWXya0s1REnMDWO/A4IJrTyT/6pHL8BPRx2xov3S4l6UEg iUqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o24-v6si3658857pfk.276.2018.07.04.06.00.51; Wed, 04 Jul 2018 06:01:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbeGDNAI (ORCPT + 99 others); Wed, 4 Jul 2018 09:00:08 -0400 Received: from mail.steuer-voss.de ([85.183.69.95]:45162 "EHLO mail.steuer-voss.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753106AbeGDNAH (ORCPT ); Wed, 4 Jul 2018 09:00:07 -0400 X-Virus-Scanned: Debian amavisd-new at mail.steuer-voss.de Received: by mail.steuer-voss.de (Postfix, from userid 1000) id 671B141C94; Wed, 4 Jul 2018 15:00:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.steuer-voss.de (Postfix) with ESMTP id 62A1A41C92; Wed, 4 Jul 2018 15:00:02 +0200 (CEST) Date: Wed, 4 Jul 2018 15:00:02 +0200 (CEST) From: Nikolaus Voss X-X-Sender: nv@fox.voss.local To: Andy Shevchenko cc: "Rafael J. Wysocki" , Len Brown , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Lorenzo Bianconi , Linus Walleij , Xiongfeng Wang , ACPI Devel Maling List , Linux Kernel Mailing List Subject: Re: [PATCH] ACPI: bus.c: Let acpi_device_get_match_data() return DT compatibility data In-Reply-To: Message-ID: References: <93a290d7082ed2e4d3e2b91dc7f6e941c9242a41.1530600804.git.nikolaus.voss@loewensteinmedical.de> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Jul 2018, Andy Shevchenko wrote: > On Tue, Jul 3, 2018 at 9:09 AM, Nikolaus Voss > wrote: > > Thanks for the patch, now I completely got it and agree on approach. > Few comments below. > >> When using ACPI with ACPI_DT_NAMESPACE_HID/ PRP0001 HID and referring to >> of_device_id table "compatible" strings in DSD, a pointer to the > > _DSD > >> corresponding DT table entry should be returned instead of a null >> pointer. An acpi_device_id match still takes precedence. > >> const void *acpi_device_get_match_data(const struct device *dev) >> { >> - const struct acpi_device_id *match; >> + const struct acpi_device_id *acpi_id = NULL; >> + const struct of_device_id *of_id = NULL; >> + const struct device_driver *drv = dev->driver; >> >> - match = acpi_match_device(dev->driver->acpi_match_table, dev); >> - if (!match) > >> + __acpi_match_device(acpi_companion_match(dev), drv->acpi_match_table, >> + drv->of_match_table, &acpi_id, &of_id); > > Perhaps, > > bool match; > > match = __acpi_match_device(..); > if (!match) > return NULL; > > ... >> + if (acpi_id) >> + return (const void*)acpi_id->driver_data; >> + else if (of_id) >> + return (const void*)of_id->data; > > Actually (dbesides redundant 'else') there is no difference in which > order you test these. > Thus, perhaps > > if (of_id) > return ...of_id...; > > return ...acpi_id...; > >> - return (const void *)match->driver_data; >> } Thanks for reviewing and feedback, posted v2... Niko