Commit f02fe780 authored by Martin K. Petersen's avatar Martin K. Petersen
Browse files

Merge branch '6.9/scsi-queue' into 6.9/scsi-fixes



Pull in the outstanding updates from the 6.9/scsi-queue branch.

Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents 4cece764 52d8210e
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -102,7 +102,9 @@ do { \

#define MAX_RETRIES   1

static struct class * ch_sysfs_class;
static const struct class ch_sysfs_class = {
	.name = "scsi_changer",
};

typedef struct {
	struct kref         ref;
@@ -930,7 +932,7 @@ static int ch_probe(struct device *dev)
	mutex_init(&ch->lock);
	kref_init(&ch->ref);
	ch->device = sd;
	class_dev = device_create(ch_sysfs_class, dev,
	class_dev = device_create(&ch_sysfs_class, dev,
				  MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch,
				  "s%s", ch->name);
	if (IS_ERR(class_dev)) {
@@ -955,7 +957,7 @@ static int ch_probe(struct device *dev)

	return 0;
destroy_dev:
	device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
	device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
put_device:
	scsi_device_put(sd);
remove_idr:
@@ -974,7 +976,7 @@ static int ch_remove(struct device *dev)
	dev_set_drvdata(dev, NULL);
	spin_unlock(&ch_index_lock);

	device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor));
	device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
	scsi_device_put(ch->device);
	kref_put(&ch->ref, ch_destroy);
	return 0;
@@ -1003,11 +1005,9 @@ static int __init init_ch_module(void)
	int rc;

	printk(KERN_INFO "SCSI Media Changer driver v" VERSION " \n");
        ch_sysfs_class = class_create("scsi_changer");
        if (IS_ERR(ch_sysfs_class)) {
		rc = PTR_ERR(ch_sysfs_class);
	rc = class_register(&ch_sysfs_class);
	if (rc)
		return rc;
        }
	rc = register_chrdev(SCSI_CHANGER_MAJOR,"ch",&changer_fops);
	if (rc < 0) {
		printk("Unable to get major %d for SCSI-Changer\n",
@@ -1022,7 +1022,7 @@ static int __init init_ch_module(void)
 fail2:
	unregister_chrdev(SCSI_CHANGER_MAJOR, "ch");
 fail1:
	class_destroy(ch_sysfs_class);
	class_unregister(&ch_sysfs_class);
	return rc;
}

@@ -1030,7 +1030,7 @@ static void __exit exit_ch_module(void)
{
	scsi_unregister_driver(&ch_template.gendrv);
	unregister_chrdev(SCSI_CHANGER_MAJOR, "ch");
	class_destroy(ch_sysfs_class);
	class_unregister(&ch_sysfs_class);
	idr_destroy(&ch_index_idr);
}

+10 −7
Original line number Diff line number Diff line
@@ -28,7 +28,12 @@ MODULE_AUTHOR("Manoj N. Kumar <manoj@linux.vnet.ibm.com>");
MODULE_AUTHOR("Matthew R. Ochs <mrochs@linux.vnet.ibm.com>");
MODULE_LICENSE("GPL");

static struct class *cxlflash_class;
static char *cxlflash_devnode(const struct device *dev, umode_t *mode);
static const struct class cxlflash_class = {
	.name = "cxlflash",
	.devnode = cxlflash_devnode,
};

static u32 cxlflash_major;
static DECLARE_BITMAP(cxlflash_minor, CXLFLASH_MAX_ADAPTERS);

@@ -3602,7 +3607,7 @@ static int init_chrdev(struct cxlflash_cfg *cfg)
		goto err1;
	}

	char_dev = device_create(cxlflash_class, NULL, devno,
	char_dev = device_create(&cxlflash_class, NULL, devno,
				 NULL, "cxlflash%d", minor);
	if (IS_ERR(char_dev)) {
		rc = PTR_ERR(char_dev);
@@ -3880,14 +3885,12 @@ static int cxlflash_class_init(void)

	cxlflash_major = MAJOR(devno);

	cxlflash_class = class_create("cxlflash");
	if (IS_ERR(cxlflash_class)) {
		rc = PTR_ERR(cxlflash_class);
	rc = class_register(&cxlflash_class);
	if (rc) {
		pr_err("%s: class_create failed rc=%d\n", __func__, rc);
		goto err;
	}

	cxlflash_class->devnode = cxlflash_devnode;
out:
	pr_debug("%s: returning rc=%d\n", __func__, rc);
	return rc;
@@ -3903,7 +3906,7 @@ static void cxlflash_class_exit(void)
{
	dev_t devno = MKDEV(cxlflash_major, 0);

	class_destroy(cxlflash_class);
	class_unregister(&cxlflash_class);
	unregister_chrdev_region(devno, CXLFLASH_MAX_ADAPTERS);
}

+34 −17
Original line number Diff line number Diff line
@@ -1621,6 +1621,16 @@ int sas_discover_root_expander(struct domain_device *dev)

/* ---------- Domain revalidation ---------- */

static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp,
					  u8 *sas_addr,
					  enum sas_device_type *type)
{
	memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE);
	*type = to_dev_type(&disc_resp->disc);
	if (*type == SAS_PHY_UNUSED)
		memset(sas_addr, 0, SAS_ADDR_SIZE);
}

static int sas_get_phy_discover(struct domain_device *dev,
				int phy_id, struct smp_disc_resp *disc_resp)
{
@@ -1674,13 +1684,8 @@ int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
		return -ENOMEM;

	res = sas_get_phy_discover(dev, phy_id, disc_resp);
	if (res == 0) {
		memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
		       SAS_ADDR_SIZE);
		*type = to_dev_type(&disc_resp->disc);
		if (*type == 0)
			memset(sas_addr, 0, SAS_ADDR_SIZE);
	}
	if (res == 0)
		sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type);
	kfree(disc_resp);
	return res;
}
@@ -1940,6 +1945,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
	struct expander_device *ex = &dev->ex_dev;
	struct ex_phy *phy = &ex->ex_phy[phy_id];
	enum sas_device_type type = SAS_PHY_UNUSED;
	struct smp_disc_resp *disc_resp;
	u8 sas_addr[SAS_ADDR_SIZE];
	char msg[80] = "";
	int res;
@@ -1951,33 +1957,41 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
		 SAS_ADDR(dev->sas_addr), phy_id, msg);

	memset(sas_addr, 0, SAS_ADDR_SIZE);
	res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
	disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
	if (!disc_resp)
		return -ENOMEM;

	res = sas_get_phy_discover(dev, phy_id, disc_resp);
	switch (res) {
	case SMP_RESP_NO_PHY:
		phy->phy_state = PHY_NOT_PRESENT;
		sas_unregister_devs_sas_addr(dev, phy_id, last);
		return res;
		goto out_free_resp;
	case SMP_RESP_PHY_VACANT:
		phy->phy_state = PHY_VACANT;
		sas_unregister_devs_sas_addr(dev, phy_id, last);
		return res;
		goto out_free_resp;
	case SMP_RESP_FUNC_ACC:
		break;
	case -ECOMM:
		break;
	default:
		return res;
		goto out_free_resp;
	}

	if (res == 0)
		sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type);

	if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
		phy->phy_state = PHY_EMPTY;
		sas_unregister_devs_sas_addr(dev, phy_id, last);
		/*
		 * Even though the PHY is empty, for convenience we discover
		 * the PHY to update the PHY info, like negotiated linkrate.
		 * Even though the PHY is empty, for convenience we update
		 * the PHY info, like negotiated linkrate.
		 */
		sas_ex_phy_discover(dev, phy_id);
		return res;
		if (res == 0)
			sas_set_ex_phy(dev, phy_id, disc_resp);
		goto out_free_resp;
	} else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) &&
		   dev_type_flutter(type, phy->attached_dev_type)) {
		struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id);
@@ -1989,7 +2003,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
			action = ", needs recovery";
		pr_debug("ex %016llx phy%02d broadcast flutter%s\n",
			 SAS_ADDR(dev->sas_addr), phy_id, action);
		return res;
		goto out_free_resp;
	}

	/* we always have to delete the old device when we went here */
@@ -1998,7 +2012,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
		SAS_ADDR(phy->attached_sas_addr));
	sas_unregister_devs_sas_addr(dev, phy_id, last);

	return sas_discover_new(dev, phy_id);
	res = sas_discover_new(dev, phy_id);
out_free_resp:
	kfree(disc_resp);
	return res;
}

/**
+1 −1
Original line number Diff line number Diff line
@@ -1333,7 +1333,6 @@ struct lpfc_hba {
	struct timer_list fabric_block_timer;
	unsigned long bit_flags;
	atomic_t num_rsrc_err;
	atomic_t num_cmd_success;
	unsigned long last_rsrc_error_time;
	unsigned long last_ramp_down_time;
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
@@ -1438,6 +1437,7 @@ struct lpfc_hba {
	struct timer_list inactive_vmid_poll;

	/* RAS Support */
	spinlock_t ras_fwlog_lock; /* do not take while holding another lock */
	struct lpfc_ras_fwlog ras_fwlog;

	uint32_t iocb_cnt;
+2 −2
Original line number Diff line number Diff line
@@ -5865,9 +5865,9 @@ lpfc_ras_fwlog_buffsize_set(struct lpfc_hba *phba, uint val)
	if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn))
		return -EINVAL;

	spin_lock_irq(&phba->hbalock);
	spin_lock_irq(&phba->ras_fwlog_lock);
	state = phba->ras_fwlog.state;
	spin_unlock_irq(&phba->hbalock);
	spin_unlock_irq(&phba->ras_fwlog_lock);

	if (state == REG_INPROGRESS) {
		lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "6147 RAS Logging "
Loading