[v1,3/3] ata: ahci_platform: Make code agnostic to OF/ACPI

Message ID 20230609152507.77649-4-andriy.shevchenko@linux.intel.com
State New
Headers
Series device property: Introduce device_is_compatible() |

Commit Message

Andy Shevchenko June 9, 2023, 3:25 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).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/ata/ahci_platform.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Andy Shevchenko June 12, 2023, 1:20 p.m. UTC | #1
On Fri, Jun 09, 2023 at 06:25:07PM +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).

...

> -	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);

Oops, missed this one, will send a v2. This is Friday :-)
  

Patch

diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index ab30c7138d73..71a18344a0c8 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -12,11 +12,11 @@ 
 #include <linux/module.h>
 #include <linux/pm.h>
 #include <linux/device.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
 #include <linux/platform_device.h>
 #include <linux/libata.h>
 #include <linux/ahci_platform.h>
-#include <linux/acpi.h>
 #include <linux/pci_ids.h>
 #include "ahci.h"
 
@@ -56,7 +56,7 @@  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);