Skip to contentSkip to conversation

gpio: ath79: order headers alphabetically

PATCH Applied Bartosz Golaszewski 2 participants 6 messages Aug 21, 2024 – Sep 2, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 gpio: ath79: order headers alphabetically

From: Bartosz Golaszewski <[email protected]>

Put all headers in alphabetical order.

---
 drivers/gpio/gpio-ath79.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-ath79.c +4 -4
index 6211d99a5770..be2952fdae3b 100644
@@ -9,12 +9,12 @@
  */
 
 #include <linux/gpio/driver.h>
-#include <linux/platform_device.h>
-#include <linux/platform_data/gpio-ath79.h>
-#include <linux/of.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
 #include <linux/irq.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_data/gpio-ath79.h>
+#include <linux/platform_device.h>
 
 #define AR71XX_GPIO_REG_OE		0x00
 #define AR71XX_GPIO_REG_IN		0x04
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/4 gpio: ath79: add missing header

From: Bartosz Golaszewski <[email protected]>

Include mod_devicetable.h for struct of_device_id and its helpers.

---
 drivers/gpio/gpio-ath79.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-ath79.c +1 -0
index be2952fdae3b..7f9e66d75c8b 100644
@@ -11,6 +11,7 @@
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_data/gpio-ath79.h>
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/4 gpio: ath79: use generic device property getters

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Don't use specialized OF accessors if we can avoid it: switch to using the generic device property helpers.

---
 drivers/gpio/gpio-ath79.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-ath79.c +4 -4
index 7f9e66d75c8b..211faffbef32 100644
@@ -8,12 +8,12 @@
  *  Copyright (C) 2008 Imre Kaloz <[email protected]>
  */
 
+#include <linux/device.h>
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/of.h>
 #include <linux/platform_data/gpio-ath79.h>
 #include <linux/platform_device.h>
 
@@ -239,12 +239,12 @@ static int ath79_gpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	if (np) {
-		err = of_property_read_u32(np, "ngpios", &ath79_gpio_count);
+		err = device_property_read_u32(dev, "ngpios", &ath79_gpio_count);
 		if (err) {
 			dev_err(dev, "ngpios property is not valid\n");
 			return err;
 		}
-		oe_inverted = of_device_is_compatible(np, "qca,ar9340-gpio");
+		oe_inverted = device_is_compatible(dev, "qca,ar9340-gpio");
 	} else if (pdata) {
 		ath79_gpio_count = pdata->ngpios;
 		oe_inverted = pdata->oe_inverted;
@@ -276,7 +276,7 @@ static int ath79_gpio_probe(struct platform_device *pdev)
 	}
 
 	/* Optional interrupt setup */
-	if (!np || of_property_read_bool(np, "interrupt-controller")) {
+	if (device_property_read_bool(dev, "interrupt-controller")) {
 		girq = &ctrl->gc.irq;
 		gpio_irq_chip_set_chip(girq, &ath79_gpio_irqchip);
 		girq->parent_handler = ath79_gpio_irq_handler;
Signature · 1 line
2.43.0
#3 lore raw

PATCH 4/4 gpio: ath79: remove support for platform data

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

There are no more board files defining platform data for this driver so remove the header and support from the driver.

---
 drivers/gpio/gpio-ath79.c                | 22 ++++++----------------
 include/linux/platform_data/gpio-ath79.h | 16 ----------------
 2 files changed, 6 insertions(+), 32 deletions(-)
 delete mode 100644 include/linux/platform_data/gpio-ath79.h
drivers/gpio/gpio-ath79.c +6 -16
index 211faffbef32..de4cc12e5e03 100644
@@ -14,7 +14,6 @@
 #include <linux/irq.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/platform_data/gpio-ath79.h>
 #include <linux/platform_device.h>
 
 #define AR71XX_GPIO_REG_OE		0x00
@@ -225,9 +224,7 @@ MODULE_DEVICE_TABLE(of, ath79_gpio_of_match);
 
 static int ath79_gpio_probe(struct platform_device *pdev)
 {
-	struct ath79_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
 	struct ath79_gpio_ctrl *ctrl;
 	struct gpio_irq_chip *girq;
 	u32 ath79_gpio_count;
@@ -238,21 +235,14 @@ static int ath79_gpio_probe(struct platform_device *pdev)
 	if (!ctrl)
 		return -ENOMEM;
 
-	if (np) {
-		err = device_property_read_u32(dev, "ngpios", &ath79_gpio_count);
-		if (err) {
-			dev_err(dev, "ngpios property is not valid\n");
-			return err;
-		}
-		oe_inverted = device_is_compatible(dev, "qca,ar9340-gpio");
-	} else if (pdata) {
-		ath79_gpio_count = pdata->ngpios;
-		oe_inverted = pdata->oe_inverted;
-	} else {
-		dev_err(dev, "No DT node or platform data found\n");
-		return -EINVAL;
+	err = device_property_read_u32(dev, "ngpios", &ath79_gpio_count);
+	if (err) {
+		dev_err(dev, "ngpios property is not valid\n");
+		return err;
 	}
 
+	oe_inverted = device_is_compatible(dev, "qca,ar9340-gpio");
+
 	if (ath79_gpio_count >= 32) {
 		dev_err(dev, "ngpios must be less than 32\n");
 		return -EINVAL;
include/linux/platform_data/gpio-ath79.h deleted +0 -16
deleted file mode 100644
index 3ea6dd942c27..000000000000
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- *  Atheros AR7XXX/AR9XXX GPIO controller platform data
- *
- * Copyright (C) 2015 Alban Bedel <[email protected]>
- */
-
-#ifndef __LINUX_PLATFORM_DATA_GPIO_ATH79_H
-#define __LINUX_PLATFORM_DATA_GPIO_ATH79_H
-
-struct ath79_gpio_platform_data {
-	unsigned ngpios;
-	bool oe_inverted;
-};
-
-#endif
Signature · 1 line
2.43.0
author Applied
#5 lore raw
In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Quoted 3 lines · Bartosz Golaszewski

Put all headers in alphabetical order.

Applied, thanks!

[1/4] gpio: ath79: order headers alphabetically

      commit: 7b4b93e260c684d346998a3dddc5335957b8be78
[2/4] gpio: ath79: add missing header
      commit: 4acde50b4d15373b55ff23424526378efa681dc6
[3/4] gpio: ath79: use generic device property getters
      commit: 10a968b21b89c647faa26b1f06ea82aa2eef1f9a
[4/4] gpio: ath79: remove support for platform data
      commit: c4a315eaf8eff0d3234600e13db7e7c71c0b3405

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>