From e82d6b179b142411c19a65bed881e148dc79bfa6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 7 Oct 2021 13:28:22 -0700 Subject: scsi: cxlflash: Call scsi_done() directly Conditional statements are faster than indirect calls. Hence call scsi_done() directly. Link: https://lore.kernel.org/r/20211007202923.2174984-28-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/cxlflash/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/scsi/cxlflash/main.c') diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index b2730e859df8..2943cdd83614 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -171,7 +171,7 @@ static void cmd_complete(struct afu_cmd *cmd) dev_dbg_ratelimited(dev, "%s:scp=%p result=%08x ioasc=%08x\n", __func__, scp, scp->result, cmd->sa.ioasc); - scp->scsi_done(scp); + scsi_done(scp); } else if (cmd->cmd_tmf) { spin_lock_irqsave(&cfg->tmf_slock, lock_flags); cfg->tmf_active = false; @@ -205,7 +205,7 @@ static void flush_pending_cmds(struct hwq *hwq) if (cmd->scp) { scp = cmd->scp; scp->result = (DID_IMM_RETRY << 16); - scp->scsi_done(scp); + scsi_done(scp); } else { cmd->cmd_aborted = true; @@ -601,7 +601,7 @@ static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp) case STATE_FAILTERM: dev_dbg_ratelimited(dev, "%s: device has failed\n", __func__); scp->result = (DID_NO_CONNECT << 16); - scp->scsi_done(scp); + scsi_done(scp); rc = 0; goto out; default: -- cgit v1.2.3 From 780c678912fbdae09e33127799eee30827a13516 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 12 Oct 2021 16:35:30 -0700 Subject: scsi: cxlflash: Switch to attribute groups struct device supports attribute groups directly but does not support struct device_attribute directly. Hence switch to attribute groups. Link: https://lore.kernel.org/r/20211012233558.4066756-19-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/cxlflash/main.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'drivers/scsi/cxlflash/main.c') diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 2943cdd83614..e7be95ee7d64 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -3103,33 +3103,37 @@ static DEVICE_ATTR_RW(irqpoll_weight); static DEVICE_ATTR_RW(num_hwqs); static DEVICE_ATTR_RW(hwq_mode); -static struct device_attribute *cxlflash_host_attrs[] = { - &dev_attr_port0, - &dev_attr_port1, - &dev_attr_port2, - &dev_attr_port3, - &dev_attr_lun_mode, - &dev_attr_ioctl_version, - &dev_attr_port0_lun_table, - &dev_attr_port1_lun_table, - &dev_attr_port2_lun_table, - &dev_attr_port3_lun_table, - &dev_attr_irqpoll_weight, - &dev_attr_num_hwqs, - &dev_attr_hwq_mode, +static struct attribute *cxlflash_host_attrs[] = { + &dev_attr_port0.attr, + &dev_attr_port1.attr, + &dev_attr_port2.attr, + &dev_attr_port3.attr, + &dev_attr_lun_mode.attr, + &dev_attr_ioctl_version.attr, + &dev_attr_port0_lun_table.attr, + &dev_attr_port1_lun_table.attr, + &dev_attr_port2_lun_table.attr, + &dev_attr_port3_lun_table.attr, + &dev_attr_irqpoll_weight.attr, + &dev_attr_num_hwqs.attr, + &dev_attr_hwq_mode.attr, NULL }; +ATTRIBUTE_GROUPS(cxlflash_host); + /* * Device attributes */ static DEVICE_ATTR_RO(mode); -static struct device_attribute *cxlflash_dev_attrs[] = { - &dev_attr_mode, +static struct attribute *cxlflash_dev_attrs[] = { + &dev_attr_mode.attr, NULL }; +ATTRIBUTE_GROUPS(cxlflash_dev); + /* * Host template */ @@ -3150,8 +3154,8 @@ static struct scsi_host_template driver_template = { .this_id = -1, .sg_tablesize = 1, /* No scatter gather support */ .max_sectors = CXLFLASH_MAX_SECTORS, - .shost_attrs = cxlflash_host_attrs, - .sdev_attrs = cxlflash_dev_attrs, + .shost_groups = cxlflash_host_groups, + .sdev_groups = cxlflash_dev_groups, }; /* -- cgit v1.2.3