diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-06-05 09:25:12 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-06-05 09:25:12 -0700 |
commit | b2c9a83d262a8feb022e24e9f9aadb66cb10a7a8 (patch) | |
tree | 6f3ded2dbdfd308e04bd781bc33bdb8af3a45558 /drivers/scsi/mpi3mr | |
parent | 2981436374177f78539b026ce5bcbab8c251818e (diff) | |
parent | aa2a4ded05058f134a4dee1424f829d662e00cda (diff) | |
download | linux-b2c9a83d262a8feb022e24e9f9aadb66cb10a7a8.tar.bz2 |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull more SCSI updates from James Bottomley:
"Mostly small bug fixes plus other trivial updates.
The major change of note is moving ufs out of scsi and a minor update
to lpfc vmid handling"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (24 commits)
scsi: qla2xxx: Remove unused 'ql_dm_tgt_ex_pct' parameter
scsi: qla2xxx: Remove setting of 'req' and 'rsp' parameters
scsi: mpi3mr: Fix kernel-doc
scsi: lpfc: Add support for ATTO Fibre Channel devices
scsi: core: Return BLK_STS_TRANSPORT for ALUA transitioning
scsi: sd_zbc: Prevent zone information memory leak
scsi: sd: Fix potential NULL pointer dereference
scsi: mpi3mr: Rework mrioc->bsg_device model to fix warnings
scsi: myrb: Fix up null pointer access on myrb_cleanup()
scsi: core: Unexport scsi_bus_type
scsi: sd: Don't call blk_cleanup_disk() in sd_probe()
scsi: ufs: ufshcd: Delete unnecessary NULL check
scsi: isci: Fix typo in comment
scsi: pmcraid: Fix typo in comment
scsi: smartpqi: Fix typo in comment
scsi: qedf: Fix typo in comment
scsi: esas2r: Fix typo in comment
scsi: storvsc: Fix typo in comment
scsi: ufs: Split the drivers/scsi/ufs directory
scsi: qla1280: Remove redundant variable
...
Diffstat (limited to 'drivers/scsi/mpi3mr')
-rw-r--r-- | drivers/scsi/mpi3mr/mpi3mr.h | 2 | ||||
-rw-r--r-- | drivers/scsi/mpi3mr/mpi3mr_app.c | 50 |
2 files changed, 24 insertions, 28 deletions
diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h index 01cd01787b0f..0e1cb4aa4ca2 100644 --- a/drivers/scsi/mpi3mr/mpi3mr.h +++ b/drivers/scsi/mpi3mr/mpi3mr.h @@ -954,7 +954,7 @@ struct mpi3mr_ioc { u16 active_poll_qcount; u16 requested_poll_qcount; - struct device *bsg_dev; + struct device bsg_dev; struct request_queue *bsg_queue; u8 stop_bsgs; u8 *logdata_buf; diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c index 9ab1762468ad..9baac224b213 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_app.c +++ b/drivers/scsi/mpi3mr/mpi3mr_app.c @@ -1487,28 +1487,28 @@ static int mpi3mr_bsg_request(struct bsg_job *job) */ void mpi3mr_bsg_exit(struct mpi3mr_ioc *mrioc) { + struct device *bsg_dev = &mrioc->bsg_dev; if (!mrioc->bsg_queue) return; bsg_remove_queue(mrioc->bsg_queue); mrioc->bsg_queue = NULL; - device_del(mrioc->bsg_dev); - put_device(mrioc->bsg_dev); - kfree(mrioc->bsg_dev); + device_del(bsg_dev); + put_device(bsg_dev); } /** * mpi3mr_bsg_node_release -release bsg device node * @dev: bsg device node * - * decrements bsg dev reference count + * decrements bsg dev parent reference count * * Return:Nothing */ static void mpi3mr_bsg_node_release(struct device *dev) { - put_device(dev); + put_device(dev->parent); } /** @@ -1521,41 +1521,37 @@ static void mpi3mr_bsg_node_release(struct device *dev) */ void mpi3mr_bsg_init(struct mpi3mr_ioc *mrioc) { - mrioc->bsg_dev = kzalloc(sizeof(struct device), GFP_KERNEL); - if (!mrioc->bsg_dev) { - ioc_err(mrioc, "bsg device mem allocation failed\n"); - return; - } + struct device *bsg_dev = &mrioc->bsg_dev; + struct device *parent = &mrioc->shost->shost_gendev; + + device_initialize(bsg_dev); + + bsg_dev->parent = get_device(parent); + bsg_dev->release = mpi3mr_bsg_node_release; - device_initialize(mrioc->bsg_dev); - dev_set_name(mrioc->bsg_dev, "mpi3mrctl%u", mrioc->id); + dev_set_name(bsg_dev, "mpi3mrctl%u", mrioc->id); - if (device_add(mrioc->bsg_dev)) { + if (device_add(bsg_dev)) { ioc_err(mrioc, "%s: bsg device add failed\n", - dev_name(mrioc->bsg_dev)); - goto err_device_add; + dev_name(bsg_dev)); + put_device(bsg_dev); + return; } - mrioc->bsg_dev->release = mpi3mr_bsg_node_release; - - mrioc->bsg_queue = bsg_setup_queue(mrioc->bsg_dev, dev_name(mrioc->bsg_dev), + mrioc->bsg_queue = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), mpi3mr_bsg_request, NULL, 0); if (IS_ERR(mrioc->bsg_queue)) { ioc_err(mrioc, "%s: bsg registration failed\n", - dev_name(mrioc->bsg_dev)); - goto err_setup_queue; + dev_name(bsg_dev)); + device_del(bsg_dev); + put_device(bsg_dev); + return; } blk_queue_max_segments(mrioc->bsg_queue, MPI3MR_MAX_APP_XFER_SEGMENTS); blk_queue_max_hw_sectors(mrioc->bsg_queue, MPI3MR_MAX_APP_XFER_SECTORS); return; - -err_setup_queue: - device_del(mrioc->bsg_dev); - put_device(mrioc->bsg_dev); -err_device_add: - kfree(mrioc->bsg_dev); } /** @@ -1693,7 +1689,7 @@ logging_level_store(struct device *dev, static DEVICE_ATTR_RW(logging_level); /** - * adapter_state_show - SysFS callback for adapter state show + * adp_state_show() - SysFS callback for adapter state show * @dev: class device * @attr: Device attributes * @buf: Buffer to copy |