Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp845689rwe; Thu, 25 Aug 2022 10:05:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR4wa4VTlm+Eco/YsSacrwsSkCGWKASNLjY8TiPLus3JEfz6M9O1r7MpPJ6uzoAMixBigSYX X-Received: by 2002:a62:ed08:0:b0:537:17a6:57aa with SMTP id u8-20020a62ed08000000b0053717a657aamr8391pfh.6.1661447152590; Thu, 25 Aug 2022 10:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661447152; cv=none; d=google.com; s=arc-20160816; b=G0kpNz0ksFGGrwzvL+SL5eFz7We7SGFh70zMr2mw9U9AUBscqBo2nrZTnDaDNeINdd uRPaFlVwLXcwrco2WRfPSnymjTMtdNh9BerfCe4+J2PcjJ7cFIQ2RqjrfD98B76JeZwR OeFfFe7OvBSVV3E84mKeX1fue5wxD4Q+vfcnikYIB9gb0idHCbDJF+leJ4diqW7blte2 GsYwTKY2pXj+NTZj9VTxBkFy40taF5wNh97zYThpHl5dN2U5kOJ3ymMWw4l5Rwndfjsv sQXMDLrHc2pTdM3NPwLVFeBtMYeI/E24f9rex9I1TgmiRYL3+pKWCsitoFZv4gCjtHtE 0ICg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=VFddRmqhRJ8PwkmV4UOCyBvme8R3q7QB95c/CoXiGVs=; b=Z7EYgVLl9hqe/H86lFyz53BMMFTdj+Bf0FlYEHsWfdjTvNBXP/mvCBfJ8NF+yWJgce mC72wAJ2vDfuVm05ph982fr5+4STrK7mFJfxbDMjgB5Jqr4romnvb8Hd1yQH8HWm7F/r T3bcJEk3E17v1i0OFq8yFTr81ZSbaup7j576i2hUytMqLQEJNGIEcEa93r/bsKPDDxub 2bhlfrXxBlxPLcyiH3G8xGAwyI9kUoWPljIMldCtr3FDb3225HbB3wrWm2Ki7zhXYV2E nm4zFq8aeGQUyfVeQx1rkDzhtKh0DkWFFAQbEHEtxemXhWpwnp76BbdC9mMFYxFkQ0Xb WZ5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me13-20020a17090b17cd00b001fb0ec88c74si4635285pjb.176.2022.08.25.10.05.39; Thu, 25 Aug 2022 10:05:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237937AbiHYREn (ORCPT + 99 others); Thu, 25 Aug 2022 13:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbiHYREk (ORCPT ); Thu, 25 Aug 2022 13:04:40 -0400 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D82BB8F14; Thu, 25 Aug 2022 10:04:40 -0700 (PDT) Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-33dc345ad78so46094187b3.3; Thu, 25 Aug 2022 10:04:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=VFddRmqhRJ8PwkmV4UOCyBvme8R3q7QB95c/CoXiGVs=; b=JGJeZHviJA+SwWEzh8B2WFCNOHiIFiLBXJEorcOPBAXxuKOeDbiZ7kLcmT4h80Mxlj lJePewQzi+gYk9QzVtd93rRkY9gxkrymRymHqvBkac5aelGZyzshahEUsU3Cxowq22tp rT1w0Q2T40tWe9jGyZ+4smoHBqLZGeByUBZfxFYA8FPcpfLcCv+1tXCxUNsdbYdMweTE UJhiNbIsQVBB5mUmumg4H9HdM8xlMGGIII6FZ50HPU7Kueqx5h0RRogrdv+eI0L+zdmD o7xheAOb+l0qcMWcokNuOOhUXF7X5IL0QpaU0HLh58yQnKPwwRyj0r2iMqtOLxSA4Tv+ Lvfw== X-Gm-Message-State: ACgBeo3YkyDhzaXsq/M9ZKuOWQmiwBg32RqNq0C6gfsF3COxo9pOlRUi b/gFyfmfJ7Nzu4g1V2Ns7XXgmWDsR5mUs38ZB7SGzbgy X-Received: by 2002:a81:4850:0:b0:33c:922b:5739 with SMTP id v77-20020a814850000000b0033c922b5739mr4768143ywa.515.1661447079090; Thu, 25 Aug 2022 10:04:39 -0700 (PDT) MIME-Version: 1.0 References: <20220825164103.27694-1-andriy.shevchenko@linux.intel.com> <20220825164103.27694-5-andriy.shevchenko@linux.intel.com> In-Reply-To: <20220825164103.27694-5-andriy.shevchenko@linux.intel.com> From: "Rafael J. Wysocki" Date: Thu, 25 Aug 2022 19:04:28 +0200 Message-ID: Subject: Re: [PATCH v1 5/5] ACPI: bus: Use the matching table, if ACPI driver has it To: Andy Shevchenko Cc: "Rafael J. Wysocki" , ACPI Devel Maling List , Linux Kernel Mailing List , "Rafael J. Wysocki" , Len Brown Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 25, 2022 at 6:41 PM Andy Shevchenko wrote: > > In case we have an ACPI driver, check its ID table for matching, > This allows to use some generic device property APIs in such > drivers. No new provisions for ACPI drivers, please. > Signed-off-by: Andy Shevchenko > --- > drivers/acpi/bus.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > index 3c0f2d050d47..17c98e826bde 100644 > --- a/drivers/acpi/bus.c > +++ b/drivers/acpi/bus.c > @@ -1049,14 +1049,30 @@ static const void *acpi_of_device_get_match_data(const struct device *dev) > return match->data; > } > > +static const struct acpi_device_id *acpi_device_get_ids(const struct device *dev) > +{ > + if (dev->driver->acpi_match_table) > + return dev->driver->acpi_match_table; > + > + if (dev_is_acpi(dev)) { > + struct acpi_driver *drv = to_acpi_driver(dev->driver); > + > + if (drv->ids) > + return drv->ids; > + } > + > + return NULL; > +} > + > const void *acpi_device_get_match_data(const struct device *dev) > { > + const struct acpi_device_id *ids = acpi_device_get_ids(dev); > const struct acpi_device_id *match; > > - if (!dev->driver->acpi_match_table) > + if (!ids) > return acpi_of_device_get_match_data(dev); > > - match = acpi_match_device(dev->driver->acpi_match_table, dev); > + match = acpi_match_device(ids, dev); > if (!match) > return NULL; > > -- > 2.35.1 >