Skip to content

Commit

Permalink
libata: normalize port_info, port_operations and sht tables
Browse files Browse the repository at this point in the history
Over the time, port info, ops and sht structures developed quite a bit
of inconsistencies.  This patch updates drivers.

* Enable/disable_pm callbacks added to all ahci ops tables.

* Every driver for SFF controllers now uses ata_sff_port_start()
  instead of ata_port_start() unless the driver has custom
  implementation.

* Every driver for SFF controllers now uses ata_pci_default_filter()
  unless the driver has custom implementation.

* Removed an odd port_info->sht initialization from ata_piix.c.
  Likely a merge byproduct.

* A port which has ATA_FLAG_SATA set doesn't need to set cable_detect
  to ata_cable_sata().  Remove it from via and mv port ops.

* Some drivers had unnecessary .max_sectors initialization which is
  ignored and was missing .slave_destroy callback.  Fixed.

* Removed unnecessary sht initializations port_info's.

* Removed onsolete scsi device suspend/resume callbacks from
  pata_bf54x.

* No reason to set ata_pci_default_filter() and bmdma functions for
  PIO-only drivers.  Remove those callbacks and replace
  ata_bmdma_irq_clear with ata_noop_irq_clear.

* pata_platform sets port_start to ata_dummy_ret0.  port_start can
  just be set to NULL.

* sata_fsl supports NCQ but was missing qc_defer.  Fixed.

* pata_rb600_cf implements dummy port_start.  Removed.

Signed-off-by: Tejun Heo <htejun@gmail.com>
  • Loading branch information
htejun authored and Jeff Garzik committed Apr 17, 2008
1 parent 358f9a7 commit 6bd99b4
Show file tree
Hide file tree
Showing 29 changed files with 62 additions and 60 deletions.
8 changes: 8 additions & 0 deletions drivers/ata/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ static const struct ata_port_operations ahci_vt8251_ops = {
.check_altstatus = ahci_check_status,
.dev_select = ata_noop_dev_select,

.dev_config = ahci_dev_config,

.tf_read = ahci_tf_read,

.qc_defer = sata_pmp_qc_defer_cmd_switch,
Expand All @@ -360,6 +362,8 @@ static const struct ata_port_operations ahci_vt8251_ops = {
.port_suspend = ahci_port_suspend,
.port_resume = ahci_port_resume,
#endif
.enable_pm = ahci_enable_alpm,
.disable_pm = ahci_disable_alpm,

.port_start = ahci_port_start,
.port_stop = ahci_port_stop,
Expand All @@ -370,6 +374,8 @@ static const struct ata_port_operations ahci_p5wdh_ops = {
.check_altstatus = ahci_check_status,
.dev_select = ata_noop_dev_select,

.dev_config = ahci_dev_config,

.tf_read = ahci_tf_read,

.qc_defer = sata_pmp_qc_defer_cmd_switch,
Expand All @@ -394,6 +400,8 @@ static const struct ata_port_operations ahci_p5wdh_ops = {
.port_suspend = ahci_port_suspend,
.port_resume = ahci_port_resume,
#endif
.enable_pm = ahci_enable_alpm,
.disable_pm = ahci_disable_alpm,

.port_start = ahci_port_start,
.port_stop = ahci_port_stop,
Expand Down
1 change: 1 addition & 0 deletions drivers/ata/ata_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ static struct scsi_host_template generic_sht = {

static struct ata_port_operations generic_port_ops = {
.set_mode = generic_set_mode,
.mode_filter = ata_pci_default_filter,

.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
Expand Down
13 changes: 7 additions & 6 deletions drivers/ata/ata_piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ static const struct ata_port_operations piix_pata_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static const struct ata_port_operations ich_pata_ops = {
Expand Down Expand Up @@ -367,7 +367,7 @@ static const struct ata_port_operations ich_pata_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static const struct ata_port_operations piix_sata_ops = {
Expand All @@ -385,6 +385,7 @@ static const struct ata_port_operations piix_sata_ops = {
.qc_issue = ata_qc_issue_prot,
.data_xfer = ata_data_xfer,

.mode_filter = ata_pci_default_filter,
.freeze = ata_bmdma_freeze,
.thaw = ata_bmdma_thaw,
.error_handler = ata_bmdma_error_handler,
Expand All @@ -393,7 +394,7 @@ static const struct ata_port_operations piix_sata_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static const struct ata_port_operations piix_vmw_ops = {
Expand Down Expand Up @@ -425,7 +426,7 @@ static const struct ata_port_operations piix_vmw_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static const struct ata_port_operations piix_sidpr_sata_ops = {
Expand All @@ -446,6 +447,7 @@ static const struct ata_port_operations piix_sidpr_sata_ops = {
.scr_read = piix_sidpr_scr_read,
.scr_write = piix_sidpr_scr_write,

.mode_filter = ata_pci_default_filter,
.freeze = ata_bmdma_freeze,
.thaw = ata_bmdma_thaw,
.error_handler = piix_sidpr_error_handler,
Expand All @@ -454,7 +456,7 @@ static const struct ata_port_operations piix_sidpr_sata_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static const struct piix_map_db ich5_map_db = {
Expand Down Expand Up @@ -683,7 +685,6 @@ static struct ata_port_info piix_port_info[] = {

[piix_pata_vmw] =
{
.sht = &piix_sht,
.flags = PIIX_PATA_FLAGS,
.pio_mask = 0x1f, /* pio0-4 */
.mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
Expand Down
1 change: 1 addition & 0 deletions drivers/ata/pata_artop.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ static const struct ata_port_operations artop6210_ops = {
static const struct ata_port_operations artop6260_ops = {
.set_piomode = artop6260_set_piomode,
.set_dmamode = artop6260_set_dmamode,
.mode_filter = ata_pci_default_filter,

.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
Expand Down
1 change: 0 additions & 1 deletion drivers/ata/pata_bf54x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,6 @@ static const struct ata_port_operations bfin_pata_ops = {

static struct ata_port_info bfin_port_info[] = {
{
.sht = &bfin_sht,
.flags = ATA_FLAG_SLAVE_POSS
| ATA_FLAG_MMIO
| ATA_FLAG_NO_LEGACY,
Expand Down
6 changes: 3 additions & 3 deletions drivers/ata/pata_cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static struct ata_port_operations cmd64x_port_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static struct ata_port_operations cmd646r1_port_ops = {
Expand Down Expand Up @@ -346,7 +346,7 @@ static struct ata_port_operations cmd646r1_port_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static struct ata_port_operations cmd648_port_ops = {
Expand Down Expand Up @@ -379,7 +379,7 @@ static struct ata_port_operations cmd648_port_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
Expand Down
1 change: 1 addition & 0 deletions drivers/ata/pata_cs5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ static struct scsi_host_template cs5520_sht = {
static struct ata_port_operations cs5520_port_ops = {
.set_piomode = cs5520_set_piomode,
.set_dmamode = cs5520_set_dmamode,
.mode_filter = ata_pci_default_filter,

.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_cs5536.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static struct ata_port_operations cs5536_port_ops = {
.irq_clear = ata_bmdma_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

/**
Expand Down
1 change: 0 additions & 1 deletion drivers/ata/pata_hpt3x3.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
static int printed_version;
static const struct ata_port_info info = {
.sht = &hpt3x3_sht,
.flags = ATA_FLAG_SLAVE_POSS,
.pio_mask = 0x1f,
#if defined(CONFIG_PATA_HPT3X3_DMA)
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_it8213.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ static struct scsi_host_template it8213_sht = {
.can_queue = ATA_DEF_QUEUE,
.this_id = ATA_SHT_THIS_ID,
.sg_tablesize = LIBATA_MAX_PRD,
.max_sectors = ATA_MAX_SECTORS,
.cmd_per_lun = ATA_SHT_CMD_PER_LUN,
.emulated = ATA_SHT_EMULATED,
.use_clustering = ATA_SHT_USE_CLUSTERING,
.proc_name = DRV_NAME,
.dma_boundary = ATA_DMA_BOUNDARY,
.slave_configure = ata_scsi_slave_config,
.slave_destroy = ata_scsi_slave_destroy,
.bios_param = ata_std_bios_param,
};

Expand Down
3 changes: 1 addition & 2 deletions drivers/ata/pata_ixp4xx_cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ static struct scsi_host_template ixp4xx_sht = {

static struct ata_port_operations ixp4xx_port_ops = {
.set_mode = ixp4xx_set_mode,
.mode_filter = ata_pci_default_filter,

.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
Expand All @@ -129,7 +128,7 @@ static struct ata_port_operations ixp4xx_port_ops = {
.irq_clear = ata_noop_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static void ixp4xx_setup_port(struct ata_port *ap,
Expand Down
3 changes: 2 additions & 1 deletion drivers/ata/pata_jmicron.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ static const struct ata_port_operations jmicron_ops = {
.exec_command = ata_exec_command,
.dev_select = ata_std_dev_select,

.mode_filter = ata_pci_default_filter,
.freeze = ata_bmdma_freeze,
.thaw = ata_bmdma_thaw,
.error_handler = jmicron_error_handler,
Expand All @@ -168,7 +169,7 @@ static const struct ata_port_operations jmicron_ops = {
.irq_on = ata_irq_on,

/* Generic PATA PCI ATA helpers */
.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};


Expand Down
1 change: 1 addition & 0 deletions drivers/ata/pata_marvell.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ static const struct ata_port_operations marvell_ops = {
.exec_command = ata_exec_command,
.dev_select = ata_std_dev_select,

.mode_filter = ata_pci_default_filter,
.freeze = ata_bmdma_freeze,
.thaw = ata_bmdma_thaw,
.error_handler = marvell_error_handler,
Expand Down
4 changes: 2 additions & 2 deletions drivers/ata/pata_mpc52xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ static struct scsi_host_template mpc52xx_ata_sht = {
.can_queue = ATA_DEF_QUEUE,
.this_id = ATA_SHT_THIS_ID,
.sg_tablesize = LIBATA_MAX_PRD,
.max_sectors = ATA_MAX_SECTORS,
.cmd_per_lun = ATA_SHT_CMD_PER_LUN,
.emulated = ATA_SHT_EMULATED,
.use_clustering = ATA_SHT_USE_CLUSTERING,
.proc_name = DRV_NAME,
.dma_boundary = ATA_DMA_BOUNDARY,
.slave_configure = ata_scsi_slave_config,
.slave_destroy = ata_scsi_slave_destroy,
.bios_param = ata_std_bios_param,
};

Expand All @@ -298,7 +298,7 @@ static struct ata_port_operations mpc52xx_ata_port_ops = {
.data_xfer = ata_data_xfer,
.irq_clear = ata_noop_irq_clear,
.irq_on = ata_irq_on,
.port_start = ata_port_start,
.port_start = ata_sff_port_start,
};

static int __devinit
Expand Down
1 change: 1 addition & 0 deletions drivers/ata/pata_netcell.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static const struct ata_port_operations netcell_ops = {
.exec_command = ata_exec_command,
.dev_select = ata_std_dev_select,

.mode_filter = ata_pci_default_filter,
.freeze = ata_bmdma_freeze,
.thaw = ata_bmdma_thaw,
.error_handler = ata_bmdma_error_handler,
Expand Down
7 changes: 1 addition & 6 deletions drivers/ata/pata_opti.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,13 @@ static struct ata_port_operations opti_port_ops = {
.post_internal_cmd = ata_bmdma_post_internal_cmd,
.cable_detect = ata_cable_40wire,

.bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start,
.bmdma_stop = ata_bmdma_stop,
.bmdma_status = ata_bmdma_status,

.qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot,

.data_xfer = ata_data_xfer,

.irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear,
.irq_clear = ata_noop_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_sff_port_start,
Expand Down
2 changes: 2 additions & 0 deletions drivers/ata/pata_optidma.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ static struct scsi_host_template optidma_sht = {
static struct ata_port_operations optidma_port_ops = {
.set_piomode = optidma_set_pio_mode,
.set_dmamode = optidma_set_dma_mode,
.mode_filter = ata_pci_default_filter,

.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
Expand Down Expand Up @@ -404,6 +405,7 @@ static struct ata_port_operations optidma_port_ops = {
static struct ata_port_operations optiplus_port_ops = {
.set_piomode = optiplus_set_pio_mode,
.set_dmamode = optiplus_set_dma_mode,
.mode_filter = ata_pci_default_filter,

.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
Expand Down
4 changes: 0 additions & 4 deletions drivers/ata/pata_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ static int pata_platform_set_mode(struct ata_link *link, struct ata_device **unu
return 0;
}

static int ata_dummy_ret0(struct ata_port *ap) { return 0; }

static struct scsi_host_template pata_platform_sht = {
.module = THIS_MODULE,
.name = DRV_NAME,
Expand Down Expand Up @@ -88,8 +86,6 @@ static struct ata_port_operations pata_platform_port_ops = {

.irq_clear = ata_noop_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_dummy_ret0,
};

static void pata_platform_setup_port(struct ata_ioports *ioaddr,
Expand Down
9 changes: 1 addition & 8 deletions drivers/ata/pata_rb500_cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance)
return IRQ_HANDLED;
}

static int rb500_pata_port_start(struct ata_port *ap)
{
return 0;
}

static struct ata_port_operations rb500_pata_port_ops = {
.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
Expand All @@ -138,12 +133,10 @@ static struct ata_port_operations rb500_pata_port_ops = {
.freeze = rb500_pata_freeze,
.thaw = rb500_pata_thaw,
.error_handler = ata_bmdma_error_handler,
.post_internal_cmd = ata_bmdma_post_internal_cmd,

.irq_handler = rb500_pata_irq_handler,
.irq_clear = ata_noop_irq_clear,
.irq_on = ata_irq_on,

.port_start = rb500_pata_port_start,
};

/* ------------------------------------------------------------------------ */
Expand Down
7 changes: 1 addition & 6 deletions drivers/ata/pata_rz1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ static struct ata_port_operations rz1000_port_ops = {
.exec_command = ata_exec_command,
.dev_select = ata_std_dev_select,

.bmdma_setup = ata_bmdma_setup,
.bmdma_start = ata_bmdma_start,
.bmdma_stop = ata_bmdma_stop,
.bmdma_status = ata_bmdma_status,

.qc_prep = ata_qc_prep,
.qc_issue = ata_qc_issue_prot,

Expand All @@ -96,7 +91,7 @@ static struct ata_port_operations rz1000_port_ops = {
.cable_detect = ata_cable_40wire,

.irq_handler = ata_interrupt,
.irq_clear = ata_bmdma_irq_clear,
.irq_clear = ata_noop_irq_clear,
.irq_on = ata_irq_on,

.port_start = ata_sff_port_start,
Expand Down
1 change: 1 addition & 0 deletions drivers/ata/sata_fsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,7 @@ static const struct ata_port_operations sata_fsl_ops = {

.tf_read = sata_fsl_tf_read,

.qc_defer = ata_std_qc_defer,
.qc_prep = sata_fsl_qc_prep,
.qc_issue = sata_fsl_qc_issue,
.irq_clear = ata_noop_irq_clear,
Expand Down
Loading

0 comments on commit 6bd99b4

Please sign in to comment.