Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp148316imm; Tue, 3 Jul 2018 15:50:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcBHiQcsmvhlMgQNVabZZdz8ROFkwtyP2f0ofAGw/4Pgk8f+vMW645K5XYONlA8Qi71gJ/z X-Received: by 2002:a65:4c41:: with SMTP id l1-v6mr16559380pgr.310.1530658217293; Tue, 03 Jul 2018 15:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530658217; cv=none; d=google.com; s=arc-20160816; b=KJoTdZk6iKpph1K/QmOqFfaXSSVw8mclHte7fYrt/aGMMJBujDofrlrmhTeMoFQj+H jO//fXiBJBl64Swi1Nsc5jsuqHcJJNQRmsUPznfyDPqectnfyVVgeLxbEmBk/PUP5LqC Mggb3SozD3ncXHpOzfD5vx2wY+S7X31chtMurrmBac4XSzx/b/chc1qu3rhdKFyXs+Rc eIGL979tYK1beKIkJTPP2uzI2Q4U4eJ3oAg7X6I166Z4kWsbHVpz1xqnWQhXtxWNgpcn iFMUiT7bW+AITLTjpLq/w/yFQ+JUoZbthpW8ToOefqyBZLm1PchGLg/GdNxuVVuijQs4 KYpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=jS+vMyroQMEbULqchU512EKlRNxArORGrYSpkK1HPH4=; b=JhfahImo2n/1qD59Z/YMNWjr5wqTDJugIkBK2tEy2/aYv6yjPwBpIyQKE6uonJO2kg jWZPf5yjM9wrPxYp2f+0BExBNW21jP23bTEErQQDmioqjBtgtfde/88PM/qLquP7b4HN QJ4glPMGVbnTB6p+UiVN+S2LbTIAsAzEqjxQTi1/qIjBLCfvXW4xRLZ7u5F/dyRSlACE +iAj9mn0ChQLFkKag0uILYBTvrYw6TNANL2vK/k46ZprcQCG/YCo+ppX4CSZt7eO/8N7 YvpRp6CJbT0PRj1OdMMqkHSDCKP3Tg8en0YNguMMqNU0nH7kRgxZ6MDOPnUNKaKU/J47 l09A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KTlPFlHQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8-v6si2147708pfi.221.2018.07.03.15.50.02; Tue, 03 Jul 2018 15:50:17 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KTlPFlHQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753566AbeGCWtV (ORCPT + 99 others); Tue, 3 Jul 2018 18:49:21 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:36176 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753294AbeGCWtT (ORCPT ); Tue, 3 Jul 2018 18:49:19 -0400 Received: by mail-vk0-f68.google.com with SMTP id y9-v6so2051914vky.3; Tue, 03 Jul 2018 15:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jS+vMyroQMEbULqchU512EKlRNxArORGrYSpkK1HPH4=; b=KTlPFlHQ5d18pZarTNLx8jJammCo23R8N/I3sPfRzNYRHA/yS7vQAXHdtFCJ21ONal 6QvLkNXFnAgQsxLiL7OOck91apGqzvpGoTAh2GTgfq11rCldzoki++fW+eu/AAKiGJfA 8PK2aaB3+5nhZKHPG66Wr7Ar1usYmf7JXMx1S1r+j0iqr1H5TPvq0fE7V+tDJf6WFjLC fnFw6EDWZsYtRxbsoy0fMmoxnhYIJTItGDOb7GOVHkhsIdAFd7Pm/4fkJd/QQzuCbEqp PAwc/LSf9g9K7gTQ8UL0nlgxQBuF2nI7O58YyJSaf2m8pCHufn8WHY+wB+Cc7HD0zelx 6ETA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jS+vMyroQMEbULqchU512EKlRNxArORGrYSpkK1HPH4=; b=nwccj7T5kLdzC+xC8ZuAi3fi3SpRwKdTFeshnYacWc1PJ2vdnJJCiA35XweM1bTysH QqdzOMQLfDwBXthnt/DGFp0QgWC2f8Gzi4wJw7xMdML2+Ziu6eRhcYvB8ZSm+FI4uZ5j iye1RcheACIN6h44s8kM1P6JpPhpjSqvQy2kRvKfh2nveks2Ay21MXVbaLEGj5eA0ejN 3eCTJ+mmT3OO3b7bGy0ZXTDiXLeiTGuLzoBBNWXFjHEcKCv7bgTm1AQT5J32Kka9/nlc Y2DbpAwbWwWAxRQvNe6p6xOTzb40KXJU9+2V8EZAwVkYk0i9aCv3Agn47DzPfsJig9DI Mnsw== X-Gm-Message-State: APt69E2Ur9KTahB/dQw/37vxwBiJ8ZQeMjH5I546FykvvulIDThkiKmK E987h8jdqakrIpI3/OF0FRWIAz02Nvn8kBPBLsk= X-Received: by 2002:a1f:20d4:: with SMTP id g203-v6mr17540902vkg.176.1530658158837; Tue, 03 Jul 2018 15:49:18 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:2149:0:0:0:0:0 with HTTP; Tue, 3 Jul 2018 15:49:18 -0700 (PDT) In-Reply-To: <93a290d7082ed2e4d3e2b91dc7f6e941c9242a41.1530600804.git.nikolaus.voss@loewensteinmedical.de> References: <93a290d7082ed2e4d3e2b91dc7f6e941c9242a41.1530600804.git.nikolaus.voss@loewensteinmedical.de> From: Andy Shevchenko Date: Wed, 4 Jul 2018 01:49:18 +0300 Message-ID: Subject: Re: [PATCH] ACPI: bus.c: Let acpi_device_get_match_data() return DT compatibility data To: Nikolaus Voss Cc: "Rafael J. Wysocki" , Len Brown , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Lorenzo Bianconi , Linus Walleij , Xiongfeng Wang , nv@vosn.de, ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; > } -- With Best Regards, Andy Shevchenko