($INBOX_DIR/description missing)
 help / color / Atom feed
* [PATCH v7] ata/pata_buddha: Probe via modalias instead of initcall
@ 2019-08-23 10:49 ` Max Staudt
  2019-08-23 11:18   ` Bartlomiej Zolnierkiewicz
  2019-08-23 12:59   ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Max Staudt @ 2019-08-23 10:49 UTC (permalink / raw)
  To: b.zolnierkie, axboe
  Cc: linux-ide, linux-m68k, linux-kernel, glaubitz, schmitzmic, geert,
	Max Staudt

Up until now, the pata_buddha driver would only check for cards on
initcall time. Now, the kernel will call its probe function as soon
as a compatible card is detected.

v7: Removed suppress_bind_attrs that slipped in

v6: Only do the drvdata workaround for X-Surf (remove breaks otherwise)
    Style

v5: Remove module_exit(): There's no good way to handle the X-Surf hack.
    Also include a workaround to save X-Surf's drvdata in case zorro8390
    is active.

v4: Clean up pata_buddha_probe() by using ent->driver_data.
    Support X-Surf via late_initcall()

v3: Clean up devm_*, implement device removal.

v2: Rename 'zdev' to 'z' to make the patch easy to analyse with
    git diff --ignore-space-change

Signed-off-by: Max Staudt <max@enpas.org>
---
 drivers/ata/pata_buddha.c | 228 +++++++++++++++++++++++++++-------------------
 1 file changed, 135 insertions(+), 93 deletions(-)

diff --git a/drivers/ata/pata_buddha.c b/drivers/ata/pata_buddha.c
index 11a8044ff..27d4c417f 100644
--- a/drivers/ata/pata_buddha.c
+++ b/drivers/ata/pata_buddha.c
@@ -18,7 +18,9 @@
 #include <linux/kernel.h>
 #include <linux/libata.h>
 #include <linux/mm.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/types.h>
 #include <linux/zorro.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_host.h>
@@ -29,7 +31,7 @@
 #include <asm/setup.h>
 
 #define DRV_NAME "pata_buddha"
-#define DRV_VERSION "0.1.0"
+#define DRV_VERSION "0.1.1"
 
 #define BUDDHA_BASE1	0x800
 #define BUDDHA_BASE2	0xa00
@@ -47,11 +49,11 @@ enum {
 	BOARD_XSURF
 };
 
-static unsigned int buddha_bases[3] __initdata = {
+static unsigned int buddha_bases[3] = {
 	BUDDHA_BASE1, BUDDHA_BASE2, BUDDHA_BASE3
 };
 
-static unsigned int xsurf_bases[2] __initdata = {
+static unsigned int xsurf_bases[2] = {
 	XSURF_BASE1, XSURF_BASE2
 };
 
@@ -145,111 +147,151 @@ static struct ata_port_operations pata_xsurf_ops = {
 	.set_mode	= pata_buddha_set_mode,
 };
 
-static int __init pata_buddha_init_one(void)
+static int pata_buddha_probe(struct zorro_dev *z,
+			     const struct zorro_device_id *ent)
 {
-	struct zorro_dev *z = NULL;
+	static const char * const board_name[] = {
+		"Buddha", "Catweasel", "X-Surf"
+	};
+	struct ata_host *host;
+	void __iomem *buddha_board;
+	unsigned long board;
+	unsigned int type = ent->driver_data;
+	unsigned int nr_ports = (type == BOARD_CATWEASEL) ? 3 : 2;
+	void *old_drvdata;
+	int i;
+
+	dev_info(&z->dev, "%s IDE controller\n", board_name[type]);
+
+	board = z->resource.start;
+
+	if (type != BOARD_XSURF) {
+		if (!devm_request_mem_region(&z->dev,
+					     board + BUDDHA_BASE1,
+					     0x800, DRV_NAME))
+			return -ENXIO;
+	} else {
+		if (!devm_request_mem_region(&z->dev,
+					     board + XSURF_BASE1,
+					     0x1000, DRV_NAME))
+			return -ENXIO;
+		if (!devm_request_mem_region(&z->dev,
+					     board + XSURF_BASE2,
+					     0x1000, DRV_NAME)) {
+		}
+	}
+
+	/* Workaround for X-Surf: Save drvdata in case zorro8390 has set it */
+	if (type == BOARD_XSURF)
+		old_drvdata = dev_get_drvdata(&z->dev);
+
+	/* allocate host */
+	host = ata_host_alloc(&z->dev, nr_ports);
+	if (type == BOARD_XSURF)
+		dev_set_drvdata(&z->dev, old_drvdata);
+	if (!host)
+		return -ENXIO;
+
+	buddha_board = ZTWO_VADDR(board);
+
+	/* enable the board IRQ on Buddha/Catweasel */
+	if (type != BOARD_XSURF)
+		z_writeb(0, buddha_board + BUDDHA_IRQ_MR);
 
-	while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
-		static const char *board_name[]
-			= { "Buddha", "Catweasel", "X-Surf" };
-		struct ata_host *host;
-		void __iomem *buddha_board;
-		unsigned long board;
-		unsigned int type, nr_ports = 2;
-		int i;
-
-		if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) {
-			type = BOARD_BUDDHA;
-		} else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL) {
-			type = BOARD_CATWEASEL;
-			nr_ports++;
-		} else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) {
-			type = BOARD_XSURF;
-		} else
-			continue;
-
-		dev_info(&z->dev, "%s IDE controller\n", board_name[type]);
-
-		board = z->resource.start;
+	for (i = 0; i < nr_ports; i++) {
+		struct ata_port *ap = host->ports[i];
+		void __iomem *base, *irqport;
+		unsigned long ctl = 0;
 
 		if (type != BOARD_XSURF) {
-			if (!devm_request_mem_region(&z->dev,
-						     board + BUDDHA_BASE1,
-						     0x800, DRV_NAME))
-				continue;
+			ap->ops = &pata_buddha_ops;
+			base = buddha_board + buddha_bases[i];
+			ctl = BUDDHA_CONTROL;
+			irqport = buddha_board + BUDDHA_IRQ + i * 0x40;
 		} else {
-			if (!devm_request_mem_region(&z->dev,
-						     board + XSURF_BASE1,
-						     0x1000, DRV_NAME))
-				continue;
-			if (!devm_request_mem_region(&z->dev,
-						     board + XSURF_BASE2,
-						     0x1000, DRV_NAME))
-				continue;
+			ap->ops = &pata_xsurf_ops;
+			base = buddha_board + xsurf_bases[i];
+			/* X-Surf has no CS1* (Control/AltStat) */
+			irqport = buddha_board + XSURF_IRQ;
 		}
 
-		/* allocate host */
-		host = ata_host_alloc(&z->dev, nr_ports);
-		if (!host)
-			continue;
-
-		buddha_board = ZTWO_VADDR(board);
-
-		/* enable the board IRQ on Buddha/Catweasel */
-		if (type != BOARD_XSURF)
-			z_writeb(0, buddha_board + BUDDHA_IRQ_MR);
-
-		for (i = 0; i < nr_ports; i++) {
-			struct ata_port *ap = host->ports[i];
-			void __iomem *base, *irqport;
-			unsigned long ctl = 0;
-
-			if (type != BOARD_XSURF) {
-				ap->ops = &pata_buddha_ops;
-				base = buddha_board + buddha_bases[i];
-				ctl = BUDDHA_CONTROL;
-				irqport = buddha_board + BUDDHA_IRQ + i * 0x40;
-			} else {
-				ap->ops = &pata_xsurf_ops;
-				base = buddha_board + xsurf_bases[i];
-				/* X-Surf has no CS1* (Control/AltStat) */
-				irqport = buddha_board + XSURF_IRQ;
-			}
-
-			ap->pio_mask = ATA_PIO4;
-			ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY;
-
-			ap->ioaddr.data_addr		= base;
-			ap->ioaddr.error_addr		= base + 2 + 1 * 4;
-			ap->ioaddr.feature_addr		= base + 2 + 1 * 4;
-			ap->ioaddr.nsect_addr		= base + 2 + 2 * 4;
-			ap->ioaddr.lbal_addr		= base + 2 + 3 * 4;
-			ap->ioaddr.lbam_addr		= base + 2 + 4 * 4;
-			ap->ioaddr.lbah_addr		= base + 2 + 5 * 4;
-			ap->ioaddr.device_addr		= base + 2 + 6 * 4;
-			ap->ioaddr.status_addr		= base + 2 + 7 * 4;
-			ap->ioaddr.command_addr		= base + 2 + 7 * 4;
-
-			if (ctl) {
-				ap->ioaddr.altstatus_addr = base + ctl;
-				ap->ioaddr.ctl_addr	  = base + ctl;
-			}
-
-			ap->private_data = (void *)irqport;
-
-			ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", board,
-				      ctl ? board + buddha_bases[i] + ctl : 0);
+		ap->pio_mask = ATA_PIO4;
+		ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY;
+
+		ap->ioaddr.data_addr		= base;
+		ap->ioaddr.error_addr		= base + 2 + 1 * 4;
+		ap->ioaddr.feature_addr		= base + 2 + 1 * 4;
+		ap->ioaddr.nsect_addr		= base + 2 + 2 * 4;
+		ap->ioaddr.lbal_addr		= base + 2 + 3 * 4;
+		ap->ioaddr.lbam_addr		= base + 2 + 4 * 4;
+		ap->ioaddr.lbah_addr		= base + 2 + 5 * 4;
+		ap->ioaddr.device_addr		= base + 2 + 6 * 4;
+		ap->ioaddr.status_addr		= base + 2 + 7 * 4;
+		ap->ioaddr.command_addr		= base + 2 + 7 * 4;
+
+		if (ctl) {
+			ap->ioaddr.altstatus_addr = base + ctl;
+			ap->ioaddr.ctl_addr	  = base + ctl;
 		}
 
-		ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt,
-				  IRQF_SHARED, &pata_buddha_sht);
+		ap->private_data = (void *)irqport;
 
+		ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", board,
+			      ctl ? board + buddha_bases[i] + ctl : 0);
 	}
 
+	ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt,
+			  IRQF_SHARED, &pata_buddha_sht);
+
 	return 0;
 }
 
-module_init(pata_buddha_init_one);
+static void pata_buddha_remove(struct zorro_dev *z)
+{
+	struct ata_host *host = dev_get_drvdata(&z->dev);
+
+	ata_host_detach(host);
+}
+
+static const struct zorro_device_id pata_buddha_zorro_tbl[] = {
+	{ ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA, BOARD_BUDDHA},
+	{ ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL, BOARD_CATWEASEL},
+	{ 0 }
+};
+MODULE_DEVICE_TABLE(zorro, pata_buddha_zorro_tbl);
+
+static struct zorro_driver pata_buddha_driver = {
+	.name           = "pata_buddha",
+	.id_table       = pata_buddha_zorro_tbl,
+	.probe          = pata_buddha_probe,
+	.remove         = pata_buddha_remove,
+};
+
+/*
+ * We cannot have a modalias for X-Surf boards, as it competes with the
+ * zorro8390 network driver. As a stopgap measure until we have proper
+ * MFD support for this board, we manually attach to it late after Zorro
+ * has enumerated its boards.
+ */
+static int __init pata_buddha_late_init(void)
+{
+	struct zorro_dev *z = NULL;
+
+	/* Auto-bind to regular boards */
+	zorro_register_driver(&pata_buddha_driver);
+
+	/* Manually bind to all X-Surf boards */
+	while ((z = zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {
+		static struct zorro_device_id xsurf_ent = {
+			ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, BOARD_XSURF
+		};
+
+		pata_buddha_probe(z, &xsurf_ent);
+	}
+
+	return 0;
+}
+late_initcall(pata_buddha_late_init);
 
 MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
 MODULE_DESCRIPTION("low-level driver for Buddha/Catweasel/X-Surf PATA");
-- 
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v7] ata/pata_buddha: Probe via modalias instead of initcall
  2019-08-23 10:49 ` [PATCH v7] ata/pata_buddha: Probe via modalias instead of initcall Max Staudt
@ 2019-08-23 11:18   ` Bartlomiej Zolnierkiewicz
  2019-08-23 12:59   ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-08-23 11:18 UTC (permalink / raw)
  To: Max Staudt
  Cc: axboe, linux-ide, linux-m68k, linux-kernel, glaubitz, schmitzmic, geert


On 8/23/19 12:49 PM, Max Staudt wrote:
> Up until now, the pata_buddha driver would only check for cards on
> initcall time. Now, the kernel will call its probe function as soon
> as a compatible card is detected.
> 
> v7: Removed suppress_bind_attrs that slipped in
> 
> v6: Only do the drvdata workaround for X-Surf (remove breaks otherwise)
>     Style
> 
> v5: Remove module_exit(): There's no good way to handle the X-Surf hack.
>     Also include a workaround to save X-Surf's drvdata in case zorro8390
>     is active.
> 
> v4: Clean up pata_buddha_probe() by using ent->driver_data.
>     Support X-Surf via late_initcall()
> 
> v3: Clean up devm_*, implement device removal.
> 
> v2: Rename 'zdev' to 'z' to make the patch easy to analyse with
>     git diff --ignore-space-change
> 
> Signed-off-by: Max Staudt <max@enpas.org>

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
>  drivers/ata/pata_buddha.c | 228 +++++++++++++++++++++++++++-------------------
>  1 file changed, 135 insertions(+), 93 deletions(-)
> 
> diff --git a/drivers/ata/pata_buddha.c b/drivers/ata/pata_buddha.c
> index 11a8044ff..27d4c417f 100644
> --- a/drivers/ata/pata_buddha.c
> +++ b/drivers/ata/pata_buddha.c
> @@ -18,7 +18,9 @@
>  #include <linux/kernel.h>
>  #include <linux/libata.h>
>  #include <linux/mm.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> +#include <linux/types.h>
>  #include <linux/zorro.h>
>  #include <scsi/scsi_cmnd.h>
>  #include <scsi/scsi_host.h>
> @@ -29,7 +31,7 @@
>  #include <asm/setup.h>
>  
>  #define DRV_NAME "pata_buddha"
> -#define DRV_VERSION "0.1.0"
> +#define DRV_VERSION "0.1.1"
>  
>  #define BUDDHA_BASE1	0x800
>  #define BUDDHA_BASE2	0xa00
> @@ -47,11 +49,11 @@ enum {
>  	BOARD_XSURF
>  };
>  
> -static unsigned int buddha_bases[3] __initdata = {
> +static unsigned int buddha_bases[3] = {
>  	BUDDHA_BASE1, BUDDHA_BASE2, BUDDHA_BASE3
>  };
>  
> -static unsigned int xsurf_bases[2] __initdata = {
> +static unsigned int xsurf_bases[2] = {
>  	XSURF_BASE1, XSURF_BASE2
>  };
>  
> @@ -145,111 +147,151 @@ static struct ata_port_operations pata_xsurf_ops = {
>  	.set_mode	= pata_buddha_set_mode,
>  };
>  
> -static int __init pata_buddha_init_one(void)
> +static int pata_buddha_probe(struct zorro_dev *z,
> +			     const struct zorro_device_id *ent)
>  {
> -	struct zorro_dev *z = NULL;
> +	static const char * const board_name[] = {
> +		"Buddha", "Catweasel", "X-Surf"
> +	};
> +	struct ata_host *host;
> +	void __iomem *buddha_board;
> +	unsigned long board;
> +	unsigned int type = ent->driver_data;
> +	unsigned int nr_ports = (type == BOARD_CATWEASEL) ? 3 : 2;
> +	void *old_drvdata;
> +	int i;
> +
> +	dev_info(&z->dev, "%s IDE controller\n", board_name[type]);
> +
> +	board = z->resource.start;
> +
> +	if (type != BOARD_XSURF) {
> +		if (!devm_request_mem_region(&z->dev,
> +					     board + BUDDHA_BASE1,
> +					     0x800, DRV_NAME))
> +			return -ENXIO;
> +	} else {
> +		if (!devm_request_mem_region(&z->dev,
> +					     board + XSURF_BASE1,
> +					     0x1000, DRV_NAME))
> +			return -ENXIO;
> +		if (!devm_request_mem_region(&z->dev,
> +					     board + XSURF_BASE2,
> +					     0x1000, DRV_NAME)) {
> +		}
> +	}
> +
> +	/* Workaround for X-Surf: Save drvdata in case zorro8390 has set it */
> +	if (type == BOARD_XSURF)
> +		old_drvdata = dev_get_drvdata(&z->dev);
> +
> +	/* allocate host */
> +	host = ata_host_alloc(&z->dev, nr_ports);
> +	if (type == BOARD_XSURF)
> +		dev_set_drvdata(&z->dev, old_drvdata);
> +	if (!host)
> +		return -ENXIO;
> +
> +	buddha_board = ZTWO_VADDR(board);
> +
> +	/* enable the board IRQ on Buddha/Catweasel */
> +	if (type != BOARD_XSURF)
> +		z_writeb(0, buddha_board + BUDDHA_IRQ_MR);
>  
> -	while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
> -		static const char *board_name[]
> -			= { "Buddha", "Catweasel", "X-Surf" };
> -		struct ata_host *host;
> -		void __iomem *buddha_board;
> -		unsigned long board;
> -		unsigned int type, nr_ports = 2;
> -		int i;
> -
> -		if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) {
> -			type = BOARD_BUDDHA;
> -		} else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL) {
> -			type = BOARD_CATWEASEL;
> -			nr_ports++;
> -		} else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) {
> -			type = BOARD_XSURF;
> -		} else
> -			continue;
> -
> -		dev_info(&z->dev, "%s IDE controller\n", board_name[type]);
> -
> -		board = z->resource.start;
> +	for (i = 0; i < nr_ports; i++) {
> +		struct ata_port *ap = host->ports[i];
> +		void __iomem *base, *irqport;
> +		unsigned long ctl = 0;
>  
>  		if (type != BOARD_XSURF) {
> -			if (!devm_request_mem_region(&z->dev,
> -						     board + BUDDHA_BASE1,
> -						     0x800, DRV_NAME))
> -				continue;
> +			ap->ops = &pata_buddha_ops;
> +			base = buddha_board + buddha_bases[i];
> +			ctl = BUDDHA_CONTROL;
> +			irqport = buddha_board + BUDDHA_IRQ + i * 0x40;
>  		} else {
> -			if (!devm_request_mem_region(&z->dev,
> -						     board + XSURF_BASE1,
> -						     0x1000, DRV_NAME))
> -				continue;
> -			if (!devm_request_mem_region(&z->dev,
> -						     board + XSURF_BASE2,
> -						     0x1000, DRV_NAME))
> -				continue;
> +			ap->ops = &pata_xsurf_ops;
> +			base = buddha_board + xsurf_bases[i];
> +			/* X-Surf has no CS1* (Control/AltStat) */
> +			irqport = buddha_board + XSURF_IRQ;
>  		}
>  
> -		/* allocate host */
> -		host = ata_host_alloc(&z->dev, nr_ports);
> -		if (!host)
> -			continue;
> -
> -		buddha_board = ZTWO_VADDR(board);
> -
> -		/* enable the board IRQ on Buddha/Catweasel */
> -		if (type != BOARD_XSURF)
> -			z_writeb(0, buddha_board + BUDDHA_IRQ_MR);
> -
> -		for (i = 0; i < nr_ports; i++) {
> -			struct ata_port *ap = host->ports[i];
> -			void __iomem *base, *irqport;
> -			unsigned long ctl = 0;
> -
> -			if (type != BOARD_XSURF) {
> -				ap->ops = &pata_buddha_ops;
> -				base = buddha_board + buddha_bases[i];
> -				ctl = BUDDHA_CONTROL;
> -				irqport = buddha_board + BUDDHA_IRQ + i * 0x40;
> -			} else {
> -				ap->ops = &pata_xsurf_ops;
> -				base = buddha_board + xsurf_bases[i];
> -				/* X-Surf has no CS1* (Control/AltStat) */
> -				irqport = buddha_board + XSURF_IRQ;
> -			}
> -
> -			ap->pio_mask = ATA_PIO4;
> -			ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY;
> -
> -			ap->ioaddr.data_addr		= base;
> -			ap->ioaddr.error_addr		= base + 2 + 1 * 4;
> -			ap->ioaddr.feature_addr		= base + 2 + 1 * 4;
> -			ap->ioaddr.nsect_addr		= base + 2 + 2 * 4;
> -			ap->ioaddr.lbal_addr		= base + 2 + 3 * 4;
> -			ap->ioaddr.lbam_addr		= base + 2 + 4 * 4;
> -			ap->ioaddr.lbah_addr		= base + 2 + 5 * 4;
> -			ap->ioaddr.device_addr		= base + 2 + 6 * 4;
> -			ap->ioaddr.status_addr		= base + 2 + 7 * 4;
> -			ap->ioaddr.command_addr		= base + 2 + 7 * 4;
> -
> -			if (ctl) {
> -				ap->ioaddr.altstatus_addr = base + ctl;
> -				ap->ioaddr.ctl_addr	  = base + ctl;
> -			}
> -
> -			ap->private_data = (void *)irqport;
> -
> -			ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", board,
> -				      ctl ? board + buddha_bases[i] + ctl : 0);
> +		ap->pio_mask = ATA_PIO4;
> +		ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY;
> +
> +		ap->ioaddr.data_addr		= base;
> +		ap->ioaddr.error_addr		= base + 2 + 1 * 4;
> +		ap->ioaddr.feature_addr		= base + 2 + 1 * 4;
> +		ap->ioaddr.nsect_addr		= base + 2 + 2 * 4;
> +		ap->ioaddr.lbal_addr		= base + 2 + 3 * 4;
> +		ap->ioaddr.lbam_addr		= base + 2 + 4 * 4;
> +		ap->ioaddr.lbah_addr		= base + 2 + 5 * 4;
> +		ap->ioaddr.device_addr		= base + 2 + 6 * 4;
> +		ap->ioaddr.status_addr		= base + 2 + 7 * 4;
> +		ap->ioaddr.command_addr		= base + 2 + 7 * 4;
> +
> +		if (ctl) {
> +			ap->ioaddr.altstatus_addr = base + ctl;
> +			ap->ioaddr.ctl_addr	  = base + ctl;
>  		}
>  
> -		ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt,
> -				  IRQF_SHARED, &pata_buddha_sht);
> +		ap->private_data = (void *)irqport;
>  
> +		ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", board,
> +			      ctl ? board + buddha_bases[i] + ctl : 0);
>  	}
>  
> +	ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt,
> +			  IRQF_SHARED, &pata_buddha_sht);
> +
>  	return 0;
>  }
>  
> -module_init(pata_buddha_init_one);
> +static void pata_buddha_remove(struct zorro_dev *z)
> +{
> +	struct ata_host *host = dev_get_drvdata(&z->dev);
> +
> +	ata_host_detach(host);
> +}
> +
> +static const struct zorro_device_id pata_buddha_zorro_tbl[] = {
> +	{ ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA, BOARD_BUDDHA},
> +	{ ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL, BOARD_CATWEASEL},
> +	{ 0 }
> +};
> +MODULE_DEVICE_TABLE(zorro, pata_buddha_zorro_tbl);
> +
> +static struct zorro_driver pata_buddha_driver = {
> +	.name           = "pata_buddha",
> +	.id_table       = pata_buddha_zorro_tbl,
> +	.probe          = pata_buddha_probe,
> +	.remove         = pata_buddha_remove,
> +};
> +
> +/*
> + * We cannot have a modalias for X-Surf boards, as it competes with the
> + * zorro8390 network driver. As a stopgap measure until we have proper
> + * MFD support for this board, we manually attach to it late after Zorro
> + * has enumerated its boards.
> + */
> +static int __init pata_buddha_late_init(void)
> +{
> +	struct zorro_dev *z = NULL;
> +
> +	/* Auto-bind to regular boards */
> +	zorro_register_driver(&pata_buddha_driver);
> +
> +	/* Manually bind to all X-Surf boards */
> +	while ((z = zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {
> +		static struct zorro_device_id xsurf_ent = {
> +			ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, BOARD_XSURF
> +		};
> +
> +		pata_buddha_probe(z, &xsurf_ent);
> +	}
> +
> +	return 0;
> +}
> +late_initcall(pata_buddha_late_init);
>  
>  MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
>  MODULE_DESCRIPTION("low-level driver for Buddha/Catweasel/X-Surf PATA");

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v7] ata/pata_buddha: Probe via modalias instead of initcall
  2019-08-23 10:49 ` [PATCH v7] ata/pata_buddha: Probe via modalias instead of initcall Max Staudt
  2019-08-23 11:18   ` Bartlomiej Zolnierkiewicz
@ 2019-08-23 12:59   ` Jens Axboe
  2019-08-23 13:03     ` Max Staudt
  1 sibling, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2019-08-23 12:59 UTC (permalink / raw)
  To: Max Staudt, b.zolnierkie
  Cc: linux-ide, linux-m68k, linux-kernel, glaubitz, schmitzmic, geert

On 8/23/19 4:49 AM, Max Staudt wrote:
> Up until now, the pata_buddha driver would only check for cards on
> initcall time. Now, the kernel will call its probe function as soon
> as a compatible card is detected.

Applied for 5.4, thanks everyone.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v7] ata/pata_buddha: Probe via modalias instead of initcall
  2019-08-23 12:59   ` Jens Axboe
@ 2019-08-23 13:03     ` Max Staudt
  0 siblings, 0 replies; 4+ messages in thread
From: Max Staudt @ 2019-08-23 13:03 UTC (permalink / raw)
  To: Jens Axboe, b.zolnierkie, geert
  Cc: linux-ide, linux-m68k, linux-kernel, glaubitz, schmitzmic

On 08/23/2019 02:59 PM, Jens Axboe wrote:
> On 8/23/19 4:49 AM, Max Staudt wrote:
>> Up until now, the pata_buddha driver would only check for cards on
>> initcall time. Now, the kernel will call its probe function as soon
>> as a compatible card is detected.
> 
> Applied for 5.4, thanks everyone.

Thanks Jens and Bartlomiej, and if I may: Thanks Geert for reviewing almost every single one of my m68k patches. This is a warm welcome to a new field.


Max

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190823104917epcas2p235985fff8eaa4b0822f1c056068ff2b7@epcas2p2.samsung.com>
2019-08-23 10:49 ` [PATCH v7] ata/pata_buddha: Probe via modalias instead of initcall Max Staudt
2019-08-23 11:18   ` Bartlomiej Zolnierkiewicz
2019-08-23 12:59   ` Jens Axboe
2019-08-23 13:03     ` Max Staudt

($INBOX_DIR/description missing)

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-m68k/0 linux-m68k/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-m68k linux-m68k/ https://lore.kernel.org/linux-m68k \
		linux-m68k@vger.kernel.org
	public-inbox-index linux-m68k

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-m68k


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git