Message ID | 20230612161011.86871-4-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2713358vqr; Mon, 12 Jun 2023 09:35:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7wgA35ezmyWrF+YsvkLXzy9AskKlcDbrfWkSUV6cCM9gXMPGPmQxFThQVQSqXwGD1T3LcQ X-Received: by 2002:a17:907:36c3:b0:974:7713:293f with SMTP id bj3-20020a17090736c300b009747713293fmr11233099ejc.41.1686587737805; Mon, 12 Jun 2023 09:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686587737; cv=none; d=google.com; s=arc-20160816; b=F0LIpuWgaVY6t4oZ04DNW/02pw4Quu1gR6AUudC6HShQHjM3rjENoQK6iHItbdt+P2 WQloHLVDWH68t5zSHzq0UxWJywcEmXW7OGT3u3vC6qQqjdhX4PpQnPXi9qjLgZHVeYwR yCHnB9wv9DvHgn8I3bK9LTU4fnqGC8QKNThZqGQc5InhxTvVWCGhWAKgtbEHR9T8wx+r Xduu8X5rNq+SALzT930LwZCU5TrzBATcFzyWGXgjdnP1e0u7dcuAAfdlIHt1cfwyXHKQ g+70PmAVg3W7VjZuyaE3j8i1F1XtFetCbZMTwzu96HEdnsZpgXwiOvDUW9zmUJEwIONz 21vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4hcrra1OLU9genHZMiFSrjrLjzHnkJK1hNR2zLDA8as=; b=cMQSQfs6RjL+rbAthxDvJBRBFhWGA5nMfRrj83NL1UtV/CSbQ3cj9H433+5k3e2Ziy lFoPR8yRgcYGmfPY7A7IoG4F6nbidUyRjmnvqulUEZAnKLEdM8PJDJEHdjdptovneqyi S0mG5QJv3iifIIKwtIZWpRuwhA0VTsX5yPfV5Z5XR3APge8DF+a7Il54CIoimymntqDL iKQkeVJ7jYitNMiYdAzbRm3SJuQndfkovjtY5nQQss2ojiqe+PWxEcf562m2qs8mzg5q PKbQ8gyt25rqvAIHNAMu6ECz9L5W93cceRGvI+xggexAdPuiDaH8KArQ3ILOjmmuQ1mM v0aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Nmw7Ixa/"; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a170906848800b009786bcc3b31si5472138ejx.716.2023.06.12.09.35.10; Mon, 12 Jun 2023 09:35:37 -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; dkim=pass header.i=@intel.com header.s=Intel header.b="Nmw7Ixa/"; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233006AbjFLQM5 (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 12 Jun 2023 12:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232662AbjFLQM4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 12 Jun 2023 12:12:56 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C599C5; Mon, 12 Jun 2023 09:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686586375; x=1718122375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ekjCA2CGwiZrAX/o+zl26feODwMRZ9OhX+gAL/VO0z8=; b=Nmw7Ixa/Wr1RI2UbrHa9u87RH4HNNdy/2HnMpNBxBVbHxr62fKjOuRNn ceap7mDXxn+zU0xsqAGZumDjBu0gl1ssIJZBJ5jqzrxRrSmetdFQMTPx0 h3B0JX7bEzJQiccVFP89SqeM+pZHHPuIQYUTY7UOWQlmQ9qXp/zluXeZE TTFozMNNexUZ58TE8s+QdsqTeFWvySujfMOt5y+P82K6wY6QaNSN+ehKo Usf4vqbrdfkpH04kFFklg1reB4WUSH1L8zAsqNeAZtaogJpQaIfQtHV+p H1by1CqNmksx5f/xtLLeKmrSGDjqNueDi07MqrXLASREFU/8l6/SMyWE6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="360572639" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="360572639" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 09:10:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="824031046" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="824031046" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 12 Jun 2023 09:10:05 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DC44C3BC; Mon, 12 Jun 2023 19:10:13 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: Hans de Goede <hdegoede@redhat.com>, Jens Axboe <axboe@kernel.dk>, Damien Le Moal <dlemoal@kernel.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Daniel Scally <djrscally@gmail.com>, Heikki Krogerus <heikki.krogerus@linux.intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com> Subject: [PATCH v3 3/3] ata: ahci_platform: Make code agnostic to OF/ACPI Date: Mon, 12 Jun 2023 19:10:11 +0300 Message-Id: <20230612161011.86871-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230612161011.86871-1-andriy.shevchenko@linux.intel.com> References: <20230612161011.86871-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768515423809047191?= X-GMAIL-MSGID: =?utf-8?q?1768515423809047191?= |
Series |
device property: Introduce device_is_compatible()
|
|
Commit Message
Andy Shevchenko
June 12, 2023, 4:10 p.m. UTC
With the help of a new device_is_compatible() make the driver code agnostic to the OF/ACPI. This makes it neater. As a side effect the header inclusions is corrected (seems mod_devicetable.h was implicitly included). Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/ata/ahci_platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On 6/13/23 01:10, Andy Shevchenko wrote: > With the help of a new device_is_compatible() make the driver code > agnostic to the OF/ACPI. This makes it neater. As a side effect > the header inclusions is corrected (seems mod_devicetable.h was > implicitly included). > > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Damien Le Moal <dlemoal@kernel.org>
On Mon, Jun 12, 2023 at 07:10:11PM +0300, Andy Shevchenko wrote: > With the help of a new device_is_compatible() make the driver code > agnostic to the OF/ACPI. This makes it neater. As a side effect > the header inclusions is corrected (seems mod_devicetable.h was > implicitly included). > > Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> C/P v2: I don't think the driver will get to be fully agnostic after this patch because for instance the ahci_platform_get_resources() method directly uses the OF-available functions, walks over the OF subnodes, touches the OF-properties, etc. So AFAICS in order to be fully OF/ACPI agnostic the entire libahci_platform.o driver needs to be converted too, but it's not trivial at all. Anyway as a start this patch looks good. Reviewed-by: Serge Semin <fancer.lancer@gmail.com> -Serge(y) > --- > drivers/ata/ahci_platform.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c > index ab30c7138d73..81fc63f6b008 100644 > --- a/drivers/ata/ahci_platform.c > +++ b/drivers/ata/ahci_platform.c > @@ -9,14 +9,14 @@ > */ > > #include <linux/kernel.h> > +#include <linux/mod_devicetable.h> > #include <linux/module.h> > #include <linux/pm.h> > #include <linux/device.h> > -#include <linux/of_device.h> > #include <linux/platform_device.h> > +#include <linux/property.h> > #include <linux/libata.h> > #include <linux/ahci_platform.h> > -#include <linux/acpi.h> > #include <linux/pci_ids.h> > #include "ahci.h" > > @@ -56,10 +56,10 @@ static int ahci_probe(struct platform_device *pdev) > if (rc) > return rc; > > - if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) > + if (device_is_compatible(dev, "hisilicon,hisi-ahci")) > hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; > > - port = acpi_device_get_match_data(dev); > + port = device_get_match_data(dev); > if (!port) > port = &ahci_port_info; > > -- > 2.40.0.1.gaa8946217a0b > >
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index ab30c7138d73..81fc63f6b008 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -9,14 +9,14 @@ */ #include <linux/kernel.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> #include <linux/pm.h> #include <linux/device.h> -#include <linux/of_device.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/libata.h> #include <linux/ahci_platform.h> -#include <linux/acpi.h> #include <linux/pci_ids.h> #include "ahci.h" @@ -56,10 +56,10 @@ static int ahci_probe(struct platform_device *pdev) if (rc) return rc; - if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) + if (device_is_compatible(dev, "hisilicon,hisi-ahci")) hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; - port = acpi_device_get_match_data(dev); + port = device_get_match_data(dev); if (!port) port = &ahci_port_info;