scsi: sata_nv: Switch to using ->device_configure
authorChristoph Hellwig <hch@lst.de>
Tue, 9 Apr 2024 14:37:43 +0000 (16:37 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 12 Apr 2024 01:37:49 +0000 (21:37 -0400)
Switch to the ->device_configure method instead of ->slave_configure and
update the block limits on the passed in queue_limits instead of using the
per-limit accessors.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240409143748.980206-19-hch@lst.de
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ata/sata_nv.c

index 0a0cee755bde736a743e78d9f58c4c54ff754486..d0a8eb0e8011d0a5428220c7789c8ed6268224b6 100644 (file)
@@ -296,7 +296,8 @@ static void nv_nf2_freeze(struct ata_port *ap);
 static void nv_nf2_thaw(struct ata_port *ap);
 static void nv_ck804_freeze(struct ata_port *ap);
 static void nv_ck804_thaw(struct ata_port *ap);
-static int nv_adma_slave_config(struct scsi_device *sdev);
+static int nv_adma_device_configure(struct scsi_device *sdev,
+               struct queue_limits *lim);
 static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc);
 static enum ata_completion_errors nv_adma_qc_prep(struct ata_queued_cmd *qc);
 static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc);
@@ -318,7 +319,8 @@ static void nv_adma_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
 static void nv_mcp55_thaw(struct ata_port *ap);
 static void nv_mcp55_freeze(struct ata_port *ap);
 static void nv_swncq_error_handler(struct ata_port *ap);
-static int nv_swncq_slave_config(struct scsi_device *sdev);
+static int nv_swncq_device_configure(struct scsi_device *sdev,
+               struct queue_limits *lim);
 static int nv_swncq_port_start(struct ata_port *ap);
 static enum ata_completion_errors nv_swncq_qc_prep(struct ata_queued_cmd *qc);
 static void nv_swncq_fill_sg(struct ata_queued_cmd *qc);
@@ -380,7 +382,7 @@ static const struct scsi_host_template nv_adma_sht = {
        .can_queue              = NV_ADMA_MAX_CPBS,
        .sg_tablesize           = NV_ADMA_SGTBL_TOTAL_LEN,
        .dma_boundary           = NV_ADMA_DMA_BOUNDARY,
-       .slave_configure        = nv_adma_slave_config,
+       .device_configure       = nv_adma_device_configure,
        .sdev_groups            = ata_ncq_sdev_groups,
        .change_queue_depth     = ata_scsi_change_queue_depth,
        .tag_alloc_policy       = BLK_TAG_ALLOC_RR,
@@ -391,7 +393,7 @@ static const struct scsi_host_template nv_swncq_sht = {
        .can_queue              = ATA_MAX_QUEUE - 1,
        .sg_tablesize           = LIBATA_MAX_PRD,
        .dma_boundary           = ATA_DMA_BOUNDARY,
-       .slave_configure        = nv_swncq_slave_config,
+       .device_configure       = nv_swncq_device_configure,
        .sdev_groups            = ata_ncq_sdev_groups,
        .change_queue_depth     = ata_scsi_change_queue_depth,
        .tag_alloc_policy       = BLK_TAG_ALLOC_RR,
@@ -661,7 +663,8 @@ static void nv_adma_mode(struct ata_port *ap)
        pp->flags &= ~NV_ADMA_PORT_REGISTER_MODE;
 }
 
-static int nv_adma_slave_config(struct scsi_device *sdev)
+static int nv_adma_device_configure(struct scsi_device *sdev,
+               struct queue_limits *lim)
 {
        struct ata_port *ap = ata_shost_to_port(sdev->host);
        struct nv_adma_port_priv *pp = ap->private_data;
@@ -740,8 +743,8 @@ static int nv_adma_slave_config(struct scsi_device *sdev)
                rc = dma_set_mask(&pdev->dev, pp->adma_dma_mask);
        }
 
-       blk_queue_segment_boundary(sdev->request_queue, segment_boundary);
-       blk_queue_max_segments(sdev->request_queue, sg_tablesize);
+       lim->seg_boundary_mask = segment_boundary;
+       lim->max_segments = sg_tablesize;
        ata_port_info(ap,
                      "DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n",
                      (unsigned long long)*ap->host->dev->dma_mask,
@@ -1868,7 +1871,8 @@ static void nv_swncq_host_init(struct ata_host *host)
        writel(~0x0, mmio + NV_INT_STATUS_MCP55);
 }
 
-static int nv_swncq_slave_config(struct scsi_device *sdev)
+static int nv_swncq_device_configure(struct scsi_device *sdev,
+               struct queue_limits *lim)
 {
        struct ata_port *ap = ata_shost_to_port(sdev->host);
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);