Skip to content

Commit

Permalink
scsi: ata: Declare SCSI host templates const
Browse files Browse the repository at this point in the history
Make it explicit that ATA host templates are not modified.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com> (for DWC AHCI SATA)
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com> (for Tegra)
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-5-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
bvanassche authored and martinkpetersen committed Mar 24, 2023
1 parent e0d3f2c commit 25df73d
Show file tree
Hide file tree
Showing 111 changed files with 129 additions and 129 deletions.
2 changes: 1 addition & 1 deletion drivers/ata/acard-ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static int acard_ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg
static int acard_ahci_pci_device_resume(struct pci_dev *pdev);
#endif

static struct scsi_host_template acard_ahci_sht = {
static const struct scsi_host_template acard_ahci_sht = {
AHCI_SHT("acard-ahci"),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static int ahci_pci_device_resume(struct device *dev);
#endif
#endif /* CONFIG_PM */

static struct scsi_host_template ahci_sht = {
static const struct scsi_host_template ahci_sht = {
AHCI_SHT("ahci"),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void ahci_set_em_messages(struct ahci_host_priv *hpriv,
struct ata_port_info *pi);
int ahci_reset_em(struct ata_host *host);
void ahci_print_info(struct ata_host *host, const char *scc_s);
int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht);
int ahci_host_activate(struct ata_host *host, const struct scsi_host_template *sht);
void ahci_error_handler(struct ata_port *ap);
u32 ahci_handle_port_intr(struct ata_host *host, u32 irq_masked);

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_brcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ static int __maybe_unused brcm_ahci_resume(struct device *dev)
return ret;
}

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_ceva.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static void ahci_ceva_setup(struct ahci_host_priv *hpriv)
}
}

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_da850.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static const struct ata_port_info ahci_da850_port_info = {
.port_ops = &ahci_da850_port_ops,
};

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_dm816.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static const struct ata_port_info ahci_dm816_port_info = {
.port_ops = &ahci_dm816_port_ops,
};

static struct scsi_host_template ahci_dm816_platform_sht = {
static const struct scsi_host_template ahci_dm816_platform_sht = {
AHCI_SHT(AHCI_DM816_DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_dwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static const struct ata_port_info ahci_dwc_port_info = {
.port_ops = &ahci_dwc_port_ops,
};

static struct scsi_host_template ahci_dwc_scsi_info = {
static const struct scsi_host_template ahci_dwc_scsi_info = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ static u32 imx_ahci_parse_props(struct device *dev,
return reg_value;
}

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_mtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static const struct ata_port_info ahci_port_info = {
.port_ops = &ahci_platform_ops,
};

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_mvebu.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static const struct ata_port_info ahci_mvebu_port_info = {
.port_ops = &ahci_platform_ops,
};

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static const struct ata_port_info ahci_port_info_nolpm = {
.port_ops = &ahci_platform_ops,
};

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_qoriq.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static const struct ata_port_info ahci_qoriq_port_info = {
.port_ops = &ahci_qoriq_ops,
};

static struct scsi_host_template ahci_qoriq_sht = {
static const struct scsi_host_template ahci_qoriq_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_seattle.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static const struct ata_port_info ahci_port_seattle_info = {
.port_ops = &ahci_seattle_ops,
};

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static const struct ata_port_info st_ahci_port_info = {
.port_ops = &st_ahci_port_ops,
};

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static const struct ata_port_info ahci_sunxi_port_info = {
.port_ops = &ahci_platform_ops,
};

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static const struct of_device_id tegra_ahci_of_match[] = {
};
MODULE_DEVICE_TABLE(of, tegra_ahci_of_match);

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ahci_xgene.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ static int xgene_ahci_mux_select(struct xgene_ahci_context *ctx)
return val & CFG_SATA_ENET_SELECT_MASK ? -1 : 0;
}

static struct scsi_host_template ahci_platform_sht = {
static const struct scsi_host_template ahci_platform_sht = {
AHCI_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/ata_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
return 0;
}

static struct scsi_host_template generic_sht = {
static const struct scsi_host_template generic_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down
6 changes: 3 additions & 3 deletions drivers/ata/ata_piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ static u8 piix_vmw_bmdma_status(struct ata_port *ap)
return ata_bmdma_status(ap) & ~ATA_DMA_ERR;
}

static struct scsi_host_template piix_sht = {
static const struct scsi_host_template piix_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down Expand Up @@ -1095,7 +1095,7 @@ static struct attribute *piix_sidpr_shost_attrs[] = {

ATTRIBUTE_GROUPS(piix_sidpr_shost);

static struct scsi_host_template piix_sidpr_sht = {
static const struct scsi_host_template piix_sidpr_sht = {
ATA_BMDMA_SHT(DRV_NAME),
.shost_groups = piix_sidpr_shost_groups,
};
Expand Down Expand Up @@ -1645,7 +1645,7 @@ static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
struct device *dev = &pdev->dev;
struct ata_port_info port_info[2];
const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
struct scsi_host_template *sht = &piix_sht;
const struct scsi_host_template *sht = &piix_sht;
unsigned long port_flags;
struct ata_host *host;
struct piix_host_priv *hpriv;
Expand Down
4 changes: 2 additions & 2 deletions drivers/ata/libahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ void ahci_set_em_messages(struct ahci_host_priv *hpriv,
EXPORT_SYMBOL_GPL(ahci_set_em_messages);

static int ahci_host_activate_multi_irqs(struct ata_host *host,
struct scsi_host_template *sht)
const struct scsi_host_template *sht)
{
struct ahci_host_priv *hpriv = host->private_data;
int i, rc;
Expand Down Expand Up @@ -2736,7 +2736,7 @@ static int ahci_host_activate_multi_irqs(struct ata_host *host,
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
int ahci_host_activate(struct ata_host *host, const struct scsi_host_template *sht)
{
struct ahci_host_priv *hpriv = host->private_data;
int irq = hpriv->irq;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/libahci_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
int ahci_platform_init_host(struct platform_device *pdev,
struct ahci_host_priv *hpriv,
const struct ata_port_info *pi_template,
struct scsi_host_template *sht)
const struct scsi_host_template *sht)
{
struct device *dev = &pdev->dev;
struct ata_port_info pi = *pi_template;
Expand Down
4 changes: 2 additions & 2 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5775,7 +5775,7 @@ static void async_port_probe(void *data, async_cookie_t cookie)
* RETURNS:
* 0 on success, -errno otherwise.
*/
int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
int ata_host_register(struct ata_host *host, const struct scsi_host_template *sht)
{
int i, rc;

Expand Down Expand Up @@ -5883,7 +5883,7 @@ EXPORT_SYMBOL_GPL(ata_host_register);
*/
int ata_host_activate(struct ata_host *host, int irq,
irq_handler_t irq_handler, unsigned long irq_flags,
struct scsi_host_template *sht)
const struct scsi_host_template *sht)
{
int i, rc;
char *irq_desc;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -4186,7 +4186,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
scsi_done(cmd);
}

int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
int ata_scsi_add_hosts(struct ata_host *host, const struct scsi_host_template *sht)
{
int i, rc;

Expand Down
8 changes: 4 additions & 4 deletions drivers/ata/libata-sff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,7 @@ EXPORT_SYMBOL_GPL(ata_pci_sff_prepare_host);
*/
int ata_pci_sff_activate_host(struct ata_host *host,
irq_handler_t irq_handler,
struct scsi_host_template *sht)
const struct scsi_host_template *sht)
{
struct device *dev = host->dev;
struct pci_dev *pdev = to_pci_dev(dev);
Expand Down Expand Up @@ -2378,7 +2378,7 @@ static const struct ata_port_info *ata_sff_find_valid_pi(

static int ata_pci_init_one(struct pci_dev *pdev,
const struct ata_port_info * const *ppi,
struct scsi_host_template *sht, void *host_priv,
const struct scsi_host_template *sht, void *host_priv,
int hflags, bool bmdma)
{
struct device *dev = &pdev->dev;
Expand Down Expand Up @@ -2452,7 +2452,7 @@ static int ata_pci_init_one(struct pci_dev *pdev,
*/
int ata_pci_sff_init_one(struct pci_dev *pdev,
const struct ata_port_info * const *ppi,
struct scsi_host_template *sht, void *host_priv, int hflag)
const struct scsi_host_template *sht, void *host_priv, int hflag)
{
return ata_pci_init_one(pdev, ppi, sht, host_priv, hflag, 0);
}
Expand Down Expand Up @@ -3175,7 +3175,7 @@ EXPORT_SYMBOL_GPL(ata_pci_bmdma_prepare_host);
*/
int ata_pci_bmdma_init_one(struct pci_dev *pdev,
const struct ata_port_info * const * ppi,
struct scsi_host_template *sht, void *host_priv,
const struct scsi_host_template *sht, void *host_priv,
int hflags)
{
return ata_pci_init_one(pdev, ppi, sht, host_priv, hflags, 1);
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static inline void ata_acpi_bind_dev(struct ata_device *dev) {}
extern struct ata_device *ata_scsi_find_dev(struct ata_port *ap,
const struct scsi_device *scsidev);
extern int ata_scsi_add_hosts(struct ata_host *host,
struct scsi_host_template *sht);
const struct scsi_host_template *sht);
extern void ata_scsi_scan_host(struct ata_port *ap, int sync);
extern int ata_scsi_offline_dev(struct ata_device *dev);
extern bool ata_scsi_sense_is_valid(u8 sk, u8 asc, u8 ascq);
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static int pacpi_port_start(struct ata_port *ap)
return ata_bmdma_port_start(ap);
}

static struct scsi_host_template pacpi_sht = {
static const struct scsi_host_template pacpi_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_ali.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes)
ata_sff_postreset(link, classes);
}

static struct scsi_host_template ali_sht = {
static const struct scsi_host_template ali_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ static void nv_host_stop(struct ata_host *host)
pci_write_config_dword(to_pci_dev(host->dev), 0x60, udma);
}

static struct scsi_host_template amd_sht = {
static const struct scsi_host_template amd_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_arasan_cf.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ struct arasan_cf_dev {
struct ata_queued_cmd *qc;
};

static struct scsi_host_template arasan_cf_sht = {
static const struct scsi_host_template arasan_cf_sht = {
ATA_BASE_SHT(DRIVER_NAME),
.dma_boundary = 0xFFFFFFFFUL,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_artop.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ static int artop6210_qc_defer(struct ata_queued_cmd *qc)
return 0;
}

static struct scsi_host_template artop_sht = {
static const struct scsi_host_template artop_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static void atiixp_bmdma_stop(struct ata_queued_cmd *qc)
ata_bmdma_stop(qc);
}

static struct scsi_host_template atiixp_sht = {
static const struct scsi_host_template atiixp_sht = {
ATA_BASE_SHT(DRV_NAME),
.sg_tablesize = LIBATA_DUMB_MAX_PRD,
.dma_boundary = ATA_DMA_BOUNDARY,
Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_atp867x.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static int atp867x_cable_detect(struct ata_port *ap)
return ATA_CBL_PATA_UNK;
}

static struct scsi_host_template atp867x_sht = {
static const struct scsi_host_template atp867x_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_buddha.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static unsigned int xsurf_bases[2] = {
XSURF_BASE1, XSURF_BASE2
};

static struct scsi_host_template pata_buddha_sht = {
static const struct scsi_host_template pata_buddha_sht = {
ATA_PIO_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_cmd640.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static bool cmd640_sff_irq_check(struct ata_port *ap)
return irq_stat & irq_mask;
}

static struct scsi_host_template cmd640_sht = {
static const struct scsi_host_template cmd640_sht = {
ATA_PIO_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static void cmd646r1_bmdma_stop(struct ata_queued_cmd *qc)
ata_bmdma_stop(qc);
}

static struct scsi_host_template cmd64x_sht = {
static const struct scsi_host_template cmd64x_sht = {
ATA_BMDMA_SHT(DRV_NAME),
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/ata/pata_cs5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
cs5520_set_timings(ap, adev, adev->pio_mode);
}

static struct scsi_host_template cs5520_sht = {
static const struct scsi_host_template cs5520_sht = {
ATA_BASE_SHT(DRV_NAME),
.sg_tablesize = LIBATA_DUMB_MAX_PRD,
.dma_boundary = ATA_DMA_BOUNDARY,
Expand Down
Loading

0 comments on commit 25df73d

Please sign in to comment.