Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit f02fe78

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: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 4cece76 + 52d8210 commit f02fe78

36 files changed

+401
-342
lines changed

drivers/scsi/ch.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ do { \
102102

103103
#define MAX_RETRIES 1
104104

105-
static struct class * ch_sysfs_class;
105+
static const struct class ch_sysfs_class = {
106+
.name = "scsi_changer",
107+
};
106108

107109
typedef struct {
108110
struct kref ref;
@@ -930,7 +932,7 @@ static int ch_probe(struct device *dev)
930932
mutex_init(&ch->lock);
931933
kref_init(&ch->ref);
932934
ch->device = sd;
933-
class_dev = device_create(ch_sysfs_class, dev,
935+
class_dev = device_create(&ch_sysfs_class, dev,
934936
MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch,
935937
"s%s", ch->name);
936938
if (IS_ERR(class_dev)) {
@@ -955,7 +957,7 @@ static int ch_probe(struct device *dev)
955957

956958
return 0;
957959
destroy_dev:
958-
device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
960+
device_destroy(&ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR, ch->minor));
959961
put_device:
960962
scsi_device_put(sd);
961963
remove_idr:
@@ -974,7 +976,7 @@ static int ch_remove(struct device *dev)
974976
dev_set_drvdata(dev, NULL);
975977
spin_unlock(&ch_index_lock);
976978

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

10051007
printk(KERN_INFO "SCSI Media Changer driver v" VERSION " \n");
1006-
ch_sysfs_class = class_create("scsi_changer");
1007-
if (IS_ERR(ch_sysfs_class)) {
1008-
rc = PTR_ERR(ch_sysfs_class);
1008+
rc = class_register(&ch_sysfs_class);
1009+
if (rc)
10091010
return rc;
1010-
}
10111011
rc = register_chrdev(SCSI_CHANGER_MAJOR,"ch",&changer_fops);
10121012
if (rc < 0) {
10131013
printk("Unable to get major %d for SCSI-Changer\n",
@@ -1022,15 +1022,15 @@ static int __init init_ch_module(void)
10221022
fail2:
10231023
unregister_chrdev(SCSI_CHANGER_MAJOR, "ch");
10241024
fail1:
1025-
class_destroy(ch_sysfs_class);
1025+
class_unregister(&ch_sysfs_class);
10261026
return rc;
10271027
}
10281028

10291029
static void __exit exit_ch_module(void)
10301030
{
10311031
scsi_unregister_driver(&ch_template.gendrv);
10321032
unregister_chrdev(SCSI_CHANGER_MAJOR, "ch");
1033-
class_destroy(ch_sysfs_class);
1033+
class_unregister(&ch_sysfs_class);
10341034
idr_destroy(&ch_index_idr);
10351035
}
10361036

drivers/scsi/cxlflash/main.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ MODULE_AUTHOR("Manoj N. Kumar <manoj@linux.vnet.ibm.com>");
2828
MODULE_AUTHOR("Matthew R. Ochs <mrochs@linux.vnet.ibm.com>");
2929
MODULE_LICENSE("GPL");
3030

31-
static struct class *cxlflash_class;
31+
static char *cxlflash_devnode(const struct device *dev, umode_t *mode);
32+
static const struct class cxlflash_class = {
33+
.name = "cxlflash",
34+
.devnode = cxlflash_devnode,
35+
};
36+
3237
static u32 cxlflash_major;
3338
static DECLARE_BITMAP(cxlflash_minor, CXLFLASH_MAX_ADAPTERS);
3439

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

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

38813886
cxlflash_major = MAJOR(devno);
38823887

3883-
cxlflash_class = class_create("cxlflash");
3884-
if (IS_ERR(cxlflash_class)) {
3885-
rc = PTR_ERR(cxlflash_class);
3888+
rc = class_register(&cxlflash_class);
3889+
if (rc) {
38863890
pr_err("%s: class_create failed rc=%d\n", __func__, rc);
38873891
goto err;
38883892
}
38893893

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

3906-
class_destroy(cxlflash_class);
3909+
class_unregister(&cxlflash_class);
39073910
unregister_chrdev_region(devno, CXLFLASH_MAX_ADAPTERS);
39083911
}
39093912

drivers/scsi/libsas/sas_expander.c

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,16 @@ int sas_discover_root_expander(struct domain_device *dev)
16211621

16221622
/* ---------- Domain revalidation ---------- */
16231623

1624+
static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp,
1625+
u8 *sas_addr,
1626+
enum sas_device_type *type)
1627+
{
1628+
memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE);
1629+
*type = to_dev_type(&disc_resp->disc);
1630+
if (*type == SAS_PHY_UNUSED)
1631+
memset(sas_addr, 0, SAS_ADDR_SIZE);
1632+
}
1633+
16241634
static int sas_get_phy_discover(struct domain_device *dev,
16251635
int phy_id, struct smp_disc_resp *disc_resp)
16261636
{
@@ -1674,13 +1684,8 @@ int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
16741684
return -ENOMEM;
16751685

16761686
res = sas_get_phy_discover(dev, phy_id, disc_resp);
1677-
if (res == 0) {
1678-
memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
1679-
SAS_ADDR_SIZE);
1680-
*type = to_dev_type(&disc_resp->disc);
1681-
if (*type == 0)
1682-
memset(sas_addr, 0, SAS_ADDR_SIZE);
1683-
}
1687+
if (res == 0)
1688+
sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type);
16841689
kfree(disc_resp);
16851690
return res;
16861691
}
@@ -1940,6 +1945,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
19401945
struct expander_device *ex = &dev->ex_dev;
19411946
struct ex_phy *phy = &ex->ex_phy[phy_id];
19421947
enum sas_device_type type = SAS_PHY_UNUSED;
1948+
struct smp_disc_resp *disc_resp;
19431949
u8 sas_addr[SAS_ADDR_SIZE];
19441950
char msg[80] = "";
19451951
int res;
@@ -1951,33 +1957,41 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
19511957
SAS_ADDR(dev->sas_addr), phy_id, msg);
19521958

19531959
memset(sas_addr, 0, SAS_ADDR_SIZE);
1954-
res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
1960+
disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
1961+
if (!disc_resp)
1962+
return -ENOMEM;
1963+
1964+
res = sas_get_phy_discover(dev, phy_id, disc_resp);
19551965
switch (res) {
19561966
case SMP_RESP_NO_PHY:
19571967
phy->phy_state = PHY_NOT_PRESENT;
19581968
sas_unregister_devs_sas_addr(dev, phy_id, last);
1959-
return res;
1969+
goto out_free_resp;
19601970
case SMP_RESP_PHY_VACANT:
19611971
phy->phy_state = PHY_VACANT;
19621972
sas_unregister_devs_sas_addr(dev, phy_id, last);
1963-
return res;
1973+
goto out_free_resp;
19641974
case SMP_RESP_FUNC_ACC:
19651975
break;
19661976
case -ECOMM:
19671977
break;
19681978
default:
1969-
return res;
1979+
goto out_free_resp;
19701980
}
19711981

1982+
if (res == 0)
1983+
sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type);
1984+
19721985
if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
19731986
phy->phy_state = PHY_EMPTY;
19741987
sas_unregister_devs_sas_addr(dev, phy_id, last);
19751988
/*
1976-
* Even though the PHY is empty, for convenience we discover
1977-
* the PHY to update the PHY info, like negotiated linkrate.
1989+
* Even though the PHY is empty, for convenience we update
1990+
* the PHY info, like negotiated linkrate.
19781991
*/
1979-
sas_ex_phy_discover(dev, phy_id);
1980-
return res;
1992+
if (res == 0)
1993+
sas_set_ex_phy(dev, phy_id, disc_resp);
1994+
goto out_free_resp;
19811995
} else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) &&
19821996
dev_type_flutter(type, phy->attached_dev_type)) {
19831997
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,
19892003
action = ", needs recovery";
19902004
pr_debug("ex %016llx phy%02d broadcast flutter%s\n",
19912005
SAS_ADDR(dev->sas_addr), phy_id, action);
1992-
return res;
2006+
goto out_free_resp;
19932007
}
19942008

19952009
/* 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,
19982012
SAS_ADDR(phy->attached_sas_addr));
19992013
sas_unregister_devs_sas_addr(dev, phy_id, last);
20002014

2001-
return sas_discover_new(dev, phy_id);
2015+
res = sas_discover_new(dev, phy_id);
2016+
out_free_resp:
2017+
kfree(disc_resp);
2018+
return res;
20022019
}
20032020

20042021
/**

drivers/scsi/lpfc/lpfc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,6 @@ struct lpfc_hba {
13331333
struct timer_list fabric_block_timer;
13341334
unsigned long bit_flags;
13351335
atomic_t num_rsrc_err;
1336-
atomic_t num_cmd_success;
13371336
unsigned long last_rsrc_error_time;
13381337
unsigned long last_ramp_down_time;
13391338
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
@@ -1438,6 +1437,7 @@ struct lpfc_hba {
14381437
struct timer_list inactive_vmid_poll;
14391438

14401439
/* RAS Support */
1440+
spinlock_t ras_fwlog_lock; /* do not take while holding another lock */
14411441
struct lpfc_ras_fwlog ras_fwlog;
14421442

14431443
uint32_t iocb_cnt;

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5865,9 +5865,9 @@ lpfc_ras_fwlog_buffsize_set(struct lpfc_hba *phba, uint val)
58655865
if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn))
58665866
return -EINVAL;
58675867

5868-
spin_lock_irq(&phba->hbalock);
5868+
spin_lock_irq(&phba->ras_fwlog_lock);
58695869
state = phba->ras_fwlog.state;
5870-
spin_unlock_irq(&phba->hbalock);
5870+
spin_unlock_irq(&phba->ras_fwlog_lock);
58715871

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

0 commit comments

Comments
 (0)