ata/pata_buddha: Probe via modalias instead of initcall
PATCH v5 1/1 ata/pata_buddha: Probe via modalias instead of initcall
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.
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
--- drivers/ata/pata_buddha.c | 234 +++++++++++++++++++++++++++------------------- 1 file changed, 140 insertions(+), 94 deletions(-)
drivers/ata/pata_buddha.c +140 -94
@@ -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,155 @@ 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 ; - -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; +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 */ + old_drvdata =dev_get_drvdata (&z->dev); + +/* allocate host */ + host =ata_host_alloc (&z->dev, nr_ports); +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 ); + +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 }, +/* { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, BOARD_XSURF}, */ + {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 +* MFC 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 ; + +pr_info ("pata_buddha: Scanning for stand-alone IDE controllers...\n" ); +zorro_register_driver (&pata_buddha_driver); + +pr_info ("pata_buddha: Scanning for X-Surf boards...\n" ); +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" );
Signature · 1 line
2.11.0
Quoted 6 lines · Max Staudt
+/*
+ * 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
+ * MFC support for this board, we manually attach to it late after Zorro
+ * has enumerated its boards.
+ */
I spotted a typo here, s/MFC/MFD/
Max
Hi Max,
Few more review comments below.
Quoted 112 lines · Max Staudt
Up until now, the
pata_buddhadriver would only check for cards on initcall time. Now, the kernel will call its probe function as soon as a compatible card is detected.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 usingent->driver_data.
Support X-Surf vialate_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-changeSigned-off-by Max Staudt <[email protected]>--- drivers/ata/pata_buddha.c | 234 +++++++++++++++++++++++++++------------------- 1 file changed, 140 insertions(+), 94 deletions(-)drivers/ata/pata_buddha.c +29
-28@@ -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,155 @@ 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 ; - -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; + 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,
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 184
Quoted 10 lines
drivers/ata/pata_buddha.c +10
-0+ 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 */ + old_drvdata =dev_get_drvdata (&z->dev);
This should be done only for type == BOARD_XSURF.
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 188
Quoted 3 lines
drivers/ata/pata_buddha.c +3
-0+/* allocate host */ + host =ata_host_alloc (&z->dev, nr_ports); +dev_set_drvdata (&z->dev, old_drvdata);
ditto
Quoted 126 lines
drivers/ata/pata_buddha.c +47
-66+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 ); + +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)
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 258
Quoted 10 lines
drivers/ata/pata_buddha.c +10
-0+{ +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 }, +/* { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, BOARD_XSURF}, */
Commented out code should be removed.
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 261
Quoted 3 lines
drivers/ata/pata_buddha.c +3
-0+ { 0 } +}; +
Extra newline, please remove it.
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 268
Quoted 7 lines
drivers/ata/pata_buddha.c +7
-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,
I think that we should also add:
.driver = {
.suppress_bind_attrs = true,
},to prevent the device from being unbinded (and thus ->remove called) from the driver using sysfs interface.
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 269
Quoted 2 lines
drivers/ata/pata_buddha.c +2
-0+}; +
Extra newline, please remove it.
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 270
Quoted 1 line
drivers/ata/pata_buddha.c +1
-0+
ditto
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 276
Quoted 5 lines
drivers/ata/pata_buddha.c +5
-0+ +/* +* 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 +* MFC support for this board, we manually attach to it late after Zorro
s/MFC/MFD/
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 283
Quoted 7 lines
drivers/ata/pata_buddha.c +7
-0+* has enumerated its boards. +*/ +static int __init pata_buddha_late_init (void ) +{ +struct zorro_dev *z =NULL ; + +pr_info ("pata_buddha: Scanning for stand-alone IDE controllers...\n" );
I think that there is no need for being extra verbose, please remove it.
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 286
Quoted 3 lines
drivers/ata/pata_buddha.c +3
-0+zorro_register_driver (&pata_buddha_driver); + +pr_info ("pata_buddha: Scanning for X-Surf boards...\n" );
ditto
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 298
Quoted 12 lines
drivers/ata/pata_buddha.c +12
-0+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); +
Extra newline, please remove it.
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 301
Quoted 3 lines
drivers/ata/pata_buddha.c +0
-0MODULE_AUTHOR ("Bartlomiej Zolnierkiewicz" );MODULE_DESCRIPTION ("low-level driver for Buddha/Catweasel/X-Surf PATA" );
Please also always check your patches with scripts/checkpatch.pl and fix the reported issues:
ERROR: code indent should use tabs where possible
#348: FILE: drivers/ata/pata_buddha.c:281:
+ struct zorro_dev *z = NULL;$
WARNING: please, no spaces at the start of a line
#348: FILE: drivers/ata/pata_buddha.c:281:
+ struct zorro_dev *z = NULL;$
WARNING: line over 80 characters
#354: FILE: drivers/ata/pata_buddha.c:287:
+ while ((z = zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {
ERROR: code indent should use tabs where possible
#354: FILE: drivers/ata/pata_buddha.c:287:
+ while ((z = zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {$
WARNING: please, no spaces at the start of a line
#354: FILE: drivers/ata/pata_buddha.c:287:
+ while ((z = zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {$
ERROR: that open brace { should be on the previous line #356: FILE: drivers/ata/pata_buddha.c:289:
+ static struct zorro_device_id xsurf_ent =
+ { ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, BOARD_XSURF};
ERROR: code indent should use tabs where possible
#359: FILE: drivers/ata/pata_buddha.c:292:
+ }$
WARNING: please, no spaces at the start of a line
#359: FILE: drivers/ata/pata_buddha.c:292:
+ }$
ERROR: code indent should use tabs where possible
#361: FILE: drivers/ata/pata_buddha.c:294:
+ return 0;$
WARNING: please, no spaces at the start of a line
#361: FILE: drivers/ata/pata_buddha.c:294:
+ return 0;$
total: 5 errors, 6 warnings, 276 lines checked
Otherwise the patch looks fine.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Hi Bartlomiej,
Thank you very much for your review!
Question below.
Quoted 4 lines · Bartlomiej Zolnierkiewicz
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 184
Quoted 2 lines
drivers/ata/pata_buddha.c +2
-0+/* Workaround for X-Surf: Save drvdata in case zorro8390 has set it */ + old_drvdata =dev_get_drvdata (&z->dev);This should be done only for type ==
BOARD_XSURF.
Agreed, as I want to keep unloading functional for Buddha/Catweasel - see below.
Quoted 8 lines
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 268
Quoted 5 lines
drivers/ata/pata_buddha.c +5
-0+static struct zorro_driver pata_buddha_driver = { + .name ="pata_buddha" , + .id_table = pata_buddha_zorro_tbl, + .probe = pata_buddha_probe, + .remove = pata_buddha_remove,I think that we should also add:
Quoted 6 lines
.driver = { .suppress_bind_attrs = true, },to prevent the device from being unbinded (and thus ->remove called) from the driver using sysfs interface.
Interesting idea - here's my question now:
My intention is to allow remove() for boards where we support IDE only (Buddha, Catweasel) - these are autoprobed via zorro_register_driver(). This shouldn't affect the X-Surf case, as it's not autoprobed in this way anyway - and thus pata_buddha_driver isn't even used.
Am I missing something? We want to inhibit module unloading (hence no module_exit()), but driver unbinding for Buddha/Catweasel should be fine to remain, right?
Quoted 2 lines
Please also always check your patches with
scripts/checkpatch.pland fix the reported issues:
Apologies, must've been something in my coffee. I will.
Thanks for the review, I'll send a new patch once my question above is resolved.
Max
Quoted 31 lines · Max Staudt
Hi Bartlomiej,
Thank you very much for your review!
Question below.
Quoted 4 lines · Bartlomiej Zolnierkiewicz
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 184
Quoted 2 lines
drivers/ata/pata_buddha.c +2
-0+/* Workaround for X-Surf: Save drvdata in case zorro8390 has set it */ + old_drvdata =dev_get_drvdata (&z->dev);This should be done only for type ==
BOARD_XSURF.Agreed, as I want to keep unloading functional for Buddha/Catweasel - see below.
Quoted 8 lines
drivers/ata/pata_buddha.c static struct ata_port_operations pata_xsurf_ops = { · line 268
Quoted 5 lines
drivers/ata/pata_buddha.c +5
-0+static struct zorro_driver pata_buddha_driver = { + .name ="pata_buddha" , + .id_table = pata_buddha_zorro_tbl, + .probe = pata_buddha_probe, + .remove = pata_buddha_remove,I think that we should also add:
Quoted 6 lines
.driver = { .suppress_bind_attrs = true, },to prevent the device from being unbinded (and thus ->remove called) from the driver using sysfs interface.
Quoted 6 lines
Interesting idea - here's my question now:
My intention is to allow
remove()for boards where we support IDE only (Buddha, Catweasel) - these are autoprobed viazorro_register_driver(). This shouldn't affect the X-Surf case, as it's not autoprobed in this way anyway - and thuspata_buddha_driverisn't even used.Am I missing something? We want to inhibit module unloading (hence no
module_exit()), but driver unbinding for Buddha/Catweasel should be fine to remain, right?
Indeed, pata_buddha_driver is not even used for X-Surf so this is not an issue (please disregard my comment about suppress_bind_attrs).
Quoted 9 lines
Quoted 2 lines
Please also always check your patches with
scripts/checkpatch.pland fix the reported issues:Apologies, must've been something in my coffee. I will.
Thanks for the review, I'll send a new patch once my question above is resolved.
Max
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Hi Bartlomiej,
Quoted 3 lines · Bartlomiej Zolnierkiewicz
WARNING: line over 80 characters
#354: FILE:drivers/ata/pata_buddha.c:287:
+ while ((z =zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {
I see no good way to shorten this one. I think it's obvious enough to allow overflowing by a few chars - do you agree?
Max
Quoted 8 lines · Max Staudt
Hi Bartlomiej,
Quoted 3 lines · Bartlomiej Zolnierkiewicz
WARNING: line over 80 characters
#354: FILE:drivers/ata/pata_buddha.c:287:
+ while ((z =zorro_find_device(ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF, z))) {I see no good way to shorten this one. I think it's obvious enough to allow overflowing by a few chars - do you agree?
Yes, I agree.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics