Skip to contentSkip to conversation

pcmcia: at91_cf: move definitions locally

PATCH In review Alexandre Belloni 2 participants 4 messages Sep 30, 2020 – Dec 5, 2020

Subsystems (2)
lore
Share & tools
lore

Alexandre Belloni

author maintainer
#0 lore raw

PATCH 1/2 pcmcia: at91_cf: move definitions locally

struct at91_cf_data is only used in the driver since all the platforms moved to device tree, move its definition locally.

---
 drivers/pcmcia/at91_cf.c            | 11 +++++++++++
 include/linux/platform_data/atmel.h | 12 ------------
 2 files changed, 11 insertions(+), 12 deletions(-)
drivers/pcmcia/at91_cf.c +11 -0
index 7db0e9c74dfc..1d59c7240a09 100644
@@ -35,6 +35,17 @@
 #define	CF_IO_PHYS	(1 << 23)
 #define	CF_MEM_PHYS	(0x017ff800)
 
+struct at91_cf_data {
+	int	irq_pin;		/* I/O IRQ */
+	int	det_pin;		/* Card detect */
+	int	vcc_pin;		/* power switching */
+	int	rst_pin;		/* card reset */
+	u8	chipselect;		/* EBI Chip Select number */
+	u8	flags;
+#define AT91_CF_TRUE_IDE	0x01
+#define AT91_IDE_SWAP_A0_A2	0x02
+};
+
 struct regmap *mc;
 
 /*--------------------------------------------------------------------------*/
include/linux/platform_data/atmel.h +0 -12
index 99e6069c5fd8..73f63be509c4 100644
@@ -6,18 +6,6 @@
 #ifndef __ATMEL_H__
 #define __ATMEL_H__
 
- /* Compact Flash */
-struct at91_cf_data {
-	int	irq_pin;		/* I/O IRQ */
-	int	det_pin;		/* Card detect */
-	int	vcc_pin;		/* power switching */
-	int	rst_pin;		/* card reset */
-	u8	chipselect;		/* EBI Chip Select number */
-	u8	flags;
-#define AT91_CF_TRUE_IDE	0x01
-#define AT91_IDE_SWAP_A0_A2	0x02
-};
-
 /* FIXME: this needs a better location, but gets stuff building again */
 #ifdef CONFIG_ATMEL_PM
 extern int at91_suspend_entering_slow_clock(void);
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH 2/2 pcmcia: at91_cf: remove platform data support

Board file support has been removed for at91rm9200 back in 2014, make the CF driver DT only.

---
 drivers/pcmcia/Kconfig   |  1 +
 drivers/pcmcia/at91_cf.c | 38 ++++++++------------------------------
 2 files changed, 9 insertions(+), 30 deletions(-)
drivers/pcmcia/Kconfig +1 -0
index 82d10b6661c7..884023e88345 100644
@@ -258,6 +258,7 @@ config OMAP_CF
 config AT91_CF
 	tristate "AT91 CompactFlash Controller"
 	depends on PCI
+	depends on OF
 	depends on PCMCIA && ARCH_AT91
 	help
 	  Say Y here to support the CompactFlash controller on AT91 chips.
drivers/pcmcia/at91_cf.c +8 -30
index 1d59c7240a09..1fde1735df8c 100644
@@ -220,16 +220,18 @@ static struct pccard_operations at91_cf_ops = {
 
 /*--------------------------------------------------------------------------*/
 
-#if defined(CONFIG_OF)
 static const struct of_device_id at91_cf_dt_ids[] = {
 	{ .compatible = "atmel,at91rm9200-cf" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, at91_cf_dt_ids);
 
-static int at91_cf_dt_init(struct platform_device *pdev)
+static int at91_cf_probe(struct platform_device *pdev)
 {
-	struct at91_cf_data *board;
+	struct at91_cf_socket	*cf;
+	struct at91_cf_data	*board;
+	struct resource		*io;
+	int			status;
 
 	board = devm_kzalloc(&pdev->dev, sizeof(*board), GFP_KERNEL);
 	if (!board)
@@ -240,33 +242,9 @@ static int at91_cf_dt_init(struct platform_device *pdev)
 	board->vcc_pin = of_get_gpio(pdev->dev.of_node, 2);
 	board->rst_pin = of_get_gpio(pdev->dev.of_node, 3);
 
-	pdev->dev.platform_data = board;
-
 	mc = syscon_regmap_lookup_by_compatible("atmel,at91rm9200-sdramc");
-
-	return PTR_ERR_OR_ZERO(mc);
-}
-#else
-static int at91_cf_dt_init(struct platform_device *pdev)
-{
-	return -ENODEV;
-}
-#endif
-
-static int at91_cf_probe(struct platform_device *pdev)
-{
-	struct at91_cf_socket	*cf;
-	struct at91_cf_data	*board = pdev->dev.platform_data;
-	struct resource		*io;
-	int			status;
-
-	if (!board) {
-		status = at91_cf_dt_init(pdev);
-		if (status)
-			return status;
-
-		board = pdev->dev.platform_data;
-	}
+	if (IS_ERR(mc))
+		return PTR_ERR(mc);
 
 	if (!gpio_is_valid(board->det_pin) || !gpio_is_valid(board->rst_pin))
 		return -ENODEV;
@@ -410,7 +388,7 @@ static int at91_cf_resume(struct platform_device *pdev)
 static struct platform_driver at91_cf_driver = {
 	.driver = {
 		.name		= "at91_cf",
-		.of_match_table = of_match_ptr(at91_cf_dt_ids),
+		.of_match_table = at91_cf_dt_ids,
 	},
 	.probe		= at91_cf_probe,
 	.remove		= at91_cf_remove,
Signature · 1 line
2.26.2
author maintainer
#2 lore raw
In reply to Alexandre Belloni
Quoted 2 lines · Alexandre Belloni

struct at91_cf_data is only used in the driver since all the platforms moved to device tree, move its definition locally.

I've now applied those patches on the at91-drivers branch, please shout if you want them to go through your branch.

[1/2] pcmcia: at91_cf: move definitions locally

      commit: 496e9b64d7297d3e6c209c51218cee2939694b25
[2/2] pcmcia: at91_cf: remove platform data support
      commit: 91be3e89f450aa738204f6629f06d8b0e3d8d77b

Best regards,

Signature · 1 line
Alexandre Belloni <[email protected]>
#3 lore raw

Am Tue, Nov 24, 2020 at 12:07:30PM +0100 schrieb Alexandre Belloni:

Quoted 11 lines · Alexandre Belloni
Quoted 2 lines

struct at91_cf_data is only used in the driver since all the platforms moved to device tree, move its definition locally.

I've now applied those patches on the at91-drivers branch, please shout if you want them to go through your branch.

[1/2] pcmcia: at91_cf: move definitions locally

      commit: 496e9b64d7297d3e6c209c51218cee2939694b25
[2/2] pcmcia: at91_cf: remove platform data support
      commit: 91be3e89f450aa738204f6629f06d8b0e3d8d77b

Thanks, I'm fine with that.

Dominik

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel