···217217 int (*media_changed)(struct cdrom_device_info *, int);218218 int (*tray_move)(struct cdrom_device_info *, int);219219 int (*lock_door)(struct cdrom_device_info *, int);220220- int (*select_speed)(struct cdrom_device_info *, int);220220+ int (*select_speed)(struct cdrom_device_info *, unsigned long);221221 int (*get_last_session) (struct cdrom_device_info *,222222 struct cdrom_multisession *);223223 int (*get_mcn)(struct cdrom_device_info *, struct cdrom_mcn *);···396396397397::398398399399- int select_speed(struct cdrom_device_info *cdi, int speed)399399+ int select_speed(struct cdrom_device_info *cdi, unsigned long speed)400400401401Some CD-ROM drives are capable of changing their head-speed. There402402are several reasons for changing the speed of a CD-ROM drive. Badly
+22-9
drivers/scsi/device_handler/scsi_dh_alua.c
···414414 }415415}416416417417-static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,418418- struct scsi_sense_hdr *sense_hdr)417417+static void alua_handle_state_transition(struct scsi_device *sdev)419418{420419 struct alua_dh_data *h = sdev->handler_data;421420 struct alua_port_group *pg;422421422422+ rcu_read_lock();423423+ pg = rcu_dereference(h->pg);424424+ if (pg)425425+ pg->state = SCSI_ACCESS_STATE_TRANSITIONING;426426+ rcu_read_unlock();427427+ alua_check(sdev, false);428428+}429429+430430+static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,431431+ struct scsi_sense_hdr *sense_hdr)432432+{423433 switch (sense_hdr->sense_key) {424434 case NOT_READY:425435 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {426436 /*427437 * LUN Not Accessible - ALUA state transition428438 */429429- rcu_read_lock();430430- pg = rcu_dereference(h->pg);431431- if (pg)432432- pg->state = SCSI_ACCESS_STATE_TRANSITIONING;433433- rcu_read_unlock();434434- alua_check(sdev, false);439439+ alua_handle_state_transition(sdev);435440 return NEEDS_RETRY;436441 }437442 break;438443 case UNIT_ATTENTION:444444+ if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {445445+ /*446446+ * LUN Not Accessible - ALUA state transition447447+ */448448+ alua_handle_state_transition(sdev);449449+ return NEEDS_RETRY;450450+ }439451 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) {440452 /*441453 * Power On, Reset, or Bus Device Reset.···514502515503 retval = scsi_test_unit_ready(sdev, ALUA_FAILOVER_TIMEOUT * HZ,516504 ALUA_FAILOVER_RETRIES, &sense_hdr);517517- if (sense_hdr.sense_key == NOT_READY &&505505+ if ((sense_hdr.sense_key == NOT_READY ||506506+ sense_hdr.sense_key == UNIT_ATTENTION) &&518507 sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)519508 return SCSI_DH_RETRY;520509 else if (retval)
+14
drivers/scsi/libsas/sas_internal.h
···145145 func, dev->parent ? "exp-attached" :146146 "direct-attached",147147 SAS_ADDR(dev->sas_addr), err);148148+149149+ /*150150+ * If the device probe failed, the expander phy attached address151151+ * needs to be reset so that the phy will not be treated as flutter152152+ * in the next revalidation153153+ */154154+ if (dev->parent && !dev_is_expander(dev->dev_type)) {155155+ struct sas_phy *phy = dev->phy;156156+ struct domain_device *parent = dev->parent;157157+ struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number];158158+159159+ memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);160160+ }161161+148162 sas_unregister_dev(dev->port, dev);149163}150164
+62
drivers/scsi/mpi3mr/mpi3mr_app.c
···32473247}32483248static DEVICE_ATTR_RO(persistent_id);3249324932503250+/**32513251+ * sas_ncq_prio_supported_show - Indicate if device supports NCQ priority32523252+ * @dev: pointer to embedded device32533253+ * @attr: sas_ncq_prio_supported attribute descriptor32543254+ * @buf: the buffer returned32553255+ *32563256+ * A sysfs 'read-only' sdev attribute, only works with SATA devices32573257+ */32583258+static ssize_t32593259+sas_ncq_prio_supported_show(struct device *dev,32603260+ struct device_attribute *attr, char *buf)32613261+{32623262+ struct scsi_device *sdev = to_scsi_device(dev);32633263+32643264+ return sysfs_emit(buf, "%d\n", sas_ata_ncq_prio_supported(sdev));32653265+}32663266+static DEVICE_ATTR_RO(sas_ncq_prio_supported);32673267+32683268+/**32693269+ * sas_ncq_prio_enable_show - send prioritized io commands to device32703270+ * @dev: pointer to embedded device32713271+ * @attr: sas_ncq_prio_enable attribute descriptor32723272+ * @buf: the buffer returned32733273+ *32743274+ * A sysfs 'read/write' sdev attribute, only works with SATA devices32753275+ */32763276+static ssize_t32773277+sas_ncq_prio_enable_show(struct device *dev,32783278+ struct device_attribute *attr, char *buf)32793279+{32803280+ struct scsi_device *sdev = to_scsi_device(dev);32813281+ struct mpi3mr_sdev_priv_data *sdev_priv_data = sdev->hostdata;32823282+32833283+ if (!sdev_priv_data)32843284+ return 0;32853285+32863286+ return sysfs_emit(buf, "%d\n", sdev_priv_data->ncq_prio_enable);32873287+}32883288+32893289+static ssize_t32903290+sas_ncq_prio_enable_store(struct device *dev,32913291+ struct device_attribute *attr,32923292+ const char *buf, size_t count)32933293+{32943294+ struct scsi_device *sdev = to_scsi_device(dev);32953295+ struct mpi3mr_sdev_priv_data *sdev_priv_data = sdev->hostdata;32963296+ bool ncq_prio_enable = 0;32973297+32983298+ if (kstrtobool(buf, &ncq_prio_enable))32993299+ return -EINVAL;33003300+33013301+ if (!sas_ata_ncq_prio_supported(sdev))33023302+ return -EINVAL;33033303+33043304+ sdev_priv_data->ncq_prio_enable = ncq_prio_enable;33053305+33063306+ return strlen(buf);33073307+}33083308+static DEVICE_ATTR_RW(sas_ncq_prio_enable);33093309+32503310static struct attribute *mpi3mr_dev_attrs[] = {32513311 &dev_attr_sas_address.attr,32523312 &dev_attr_device_handle.attr,32533313 &dev_attr_persistent_id.attr,33143314+ &dev_attr_sas_ncq_prio_supported.attr,33153315+ &dev_attr_sas_ncq_prio_enable.attr,32543316 NULL,32553317};32563318
+1-1
drivers/scsi/mpi3mr/mpi3mr_transport.c
···13781378 continue;1379137913801380 if (i >= sizeof(mr_sas_port->phy_mask) * 8) {13811381- ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",13811381+ ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n",13821382 i, sizeof(mr_sas_port->phy_mask) * 8);13831383 goto out_fail;13841384 }
+19
drivers/scsi/mpt3sas/mpt3sas_base.c
···85128512 ioc->pd_handles_sz = (ioc->facts.MaxDevHandle / 8);85138513 if (ioc->facts.MaxDevHandle % 8)85148514 ioc->pd_handles_sz++;85158515+ /*85168516+ * pd_handles_sz should have, at least, the minimal room for85178517+ * set_bit()/test_bit(), otherwise out-of-memory touch may occur.85188518+ */85198519+ ioc->pd_handles_sz = ALIGN(ioc->pd_handles_sz, sizeof(unsigned long));85208520+85158521 ioc->pd_handles = kzalloc(ioc->pd_handles_sz,85168522 GFP_KERNEL);85178523 if (!ioc->pd_handles) {···85358529 ioc->pend_os_device_add_sz = (ioc->facts.MaxDevHandle / 8);85368530 if (ioc->facts.MaxDevHandle % 8)85378531 ioc->pend_os_device_add_sz++;85328532+85338533+ /*85348534+ * pend_os_device_add_sz should have, at least, the minimal room for85358535+ * set_bit()/test_bit(), otherwise out-of-memory may occur.85368536+ */85378537+ ioc->pend_os_device_add_sz = ALIGN(ioc->pend_os_device_add_sz,85388538+ sizeof(unsigned long));85388539 ioc->pend_os_device_add = kzalloc(ioc->pend_os_device_add_sz,85398540 GFP_KERNEL);85408541 if (!ioc->pend_os_device_add) {···88338820 if (ioc->facts.MaxDevHandle % 8)88348821 pd_handles_sz++;8835882288238823+ /*88248824+ * pd_handles should have, at least, the minimal room for88258825+ * set_bit()/test_bit(), otherwise out-of-memory touch may88268826+ * occur.88278827+ */88288828+ pd_handles_sz = ALIGN(pd_handles_sz, sizeof(unsigned long));88368829 pd_handles = krealloc(ioc->pd_handles, pd_handles_sz,88378830 GFP_KERNEL);88388831 if (!pd_handles) {
···40884088{40894089 struct scsi_device *sdev = to_scsi_device(dev);4090409040914091- return sysfs_emit(buf, "%d\n", scsih_ncq_prio_supp(sdev));40914091+ return sysfs_emit(buf, "%d\n", sas_ata_ncq_prio_supported(sdev));40924092}40934093static DEVICE_ATTR_RO(sas_ncq_prio_supported);40944094···41234123 if (kstrtobool(buf, &ncq_prio_enable))41244124 return -EINVAL;4125412541264126- if (!scsih_ncq_prio_supp(sdev))41264126+ if (!sas_ata_ncq_prio_supported(sdev))41274127 return -EINVAL;4128412841294129 sas_device_priv_data->ncq_prio_enable = ncq_prio_enable;
+2-25
drivers/scsi/mpt3sas/mpt3sas_scsih.c
···302302303303/**304304 * _scsih_set_debug_level - global setting of ioc->logging_level.305305- * @val: ?306306- * @kp: ?305305+ * @val: value of the parameter to be set306306+ * @kp: pointer to kernel_param structure307307 *308308 * Note: The logging levels are defined in mpt3sas_debug.h.309309 */···1257112571 return PCI_ERS_RESULT_RECOVERED;1257212572}12573125731257412574-/**1257512575- * scsih_ncq_prio_supp - Check for NCQ command priority support1257612576- * @sdev: scsi device struct1257712577- *1257812578- * This is called when a user indicates they would like to enable1257912579- * ncq command priorities. This works only on SATA devices.1258012580- */1258112581-bool scsih_ncq_prio_supp(struct scsi_device *sdev)1258212582-{1258312583- struct scsi_vpd *vpd;1258412584- bool ncq_prio_supp = false;1258512585-1258612586- rcu_read_lock();1258712587- vpd = rcu_dereference(sdev->vpd_pg89);1258812588- if (!vpd || vpd->len < 214)1258912589- goto out;1259012590-1259112591- ncq_prio_supp = (vpd->data[213] >> 4) & 1;1259212592-out:1259312593- rcu_read_unlock();1259412594-1259512595- return ncq_prio_supp;1259612596-}1259712574/*1259812575 * The pci device ids are defined in mpi/mpi2_cnfg.h.1259912576 */
+1
drivers/scsi/qedf/qedf.h
···363363#define QEDF_IN_RECOVERY 5364364#define QEDF_DBG_STOP_IO 6365365#define QEDF_PROBING 8366366+#define QEDF_STAG_IN_PROGRESS 9366367 unsigned long flags; /* Miscellaneous state flags */367368 int fipvlan_retries;368369 u8 num_queues;
+44-3
drivers/scsi/qedf/qedf_main.c
···318318 */319319 if (resp == fc_lport_flogi_resp) {320320 qedf->flogi_cnt++;321321+ qedf->flogi_pending++;322322+323323+ if (test_bit(QEDF_UNLOADING, &qedf->flags)) {324324+ QEDF_ERR(&qedf->dbg_ctx, "Driver unloading\n");325325+ qedf->flogi_pending = 0;326326+ }327327+321328 if (qedf->flogi_pending >= QEDF_FLOGI_RETRY_CNT) {322329 schedule_delayed_work(&qedf->stag_work, 2);323330 return NULL;324331 }325325- qedf->flogi_pending++;332332+326333 return fc_elsct_send(lport, did, fp, op, qedf_flogi_resp,327334 arg, timeout);328335 }···919912 struct qedf_ctx *qedf;920913 struct qed_link_output if_link;921914915915+ qedf = lport_priv(lport);916916+922917 if (lport->vport) {918918+ clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);923919 printk_ratelimited("Cannot issue host reset on NPIV port.\n");924920 return;925921 }926926-927927- qedf = lport_priv(lport);928922929923 qedf->flogi_pending = 0;930924 /* For host reset, essentially do a soft link up/down */···946938 if (!if_link.link_up) {947939 QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC,948940 "Physical link is not up.\n");941941+ clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);949942 return;950943 }951944 /* Flush and wait to make sure link down is processed */···959950 "Queue link up work.\n");960951 queue_delayed_work(qedf->link_update_wq, &qedf->link_update,961952 0);953953+ clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);962954}963955964956/* Reset the host by gracefully logging out and then logging back in */···34733463 }3474346434753465 /* Start the Slowpath-process */34663466+ memset(&slowpath_params, 0, sizeof(struct qed_slowpath_params));34763467 slowpath_params.int_mode = QED_INT_MODE_MSIX;34773468 slowpath_params.drv_major = QEDF_DRIVER_MAJOR_VER;34783469 slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER;···37323721{37333722 struct qedf_ctx *qedf;37343723 int rc;37243724+ int cnt = 0;3735372537363726 if (!pdev) {37373727 QEDF_ERR(NULL, "pdev is NULL.\n");···37483736 if (test_bit(QEDF_UNLOADING, &qedf->flags)) {37493737 QEDF_ERR(&qedf->dbg_ctx, "Already removing PCI function.\n");37503738 return;37393739+ }37403740+37413741+stag_in_prog:37423742+ if (test_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags)) {37433743+ QEDF_ERR(&qedf->dbg_ctx, "Stag in progress, cnt=%d.\n", cnt);37443744+ cnt++;37453745+37463746+ if (cnt < 5) {37473747+ msleep(500);37483748+ goto stag_in_prog;37493749+ }37513750 }3752375137533752 if (mode != QEDF_MODE_RECOVERY)···40193996{40203997 struct qedf_ctx *qedf =40213998 container_of(work, struct qedf_ctx, stag_work.work);39993999+40004000+ if (!qedf) {40014001+ QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");40024002+ return;40034003+ }40044004+40054005+ if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) {40064006+ QEDF_ERR(&qedf->dbg_ctx,40074007+ "Already is in recovery, hence not calling software context reset.\n");40084008+ return;40094009+ }40104010+40114011+ if (test_bit(QEDF_UNLOADING, &qedf->flags)) {40124012+ QEDF_ERR(&qedf->dbg_ctx, "Driver unloading\n");40134013+ return;40144014+ }40154015+40164016+ set_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);4022401740234018 printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.",40244019 dev_name(&qedf->pdev->dev), __func__, __LINE__,
+14
drivers/scsi/scsi.c
···350350 if (result < SCSI_VPD_HEADER_SIZE)351351 return 0;352352353353+ if (result > sizeof(vpd)) {354354+ dev_warn_once(&sdev->sdev_gendev,355355+ "%s: long VPD page 0 length: %d bytes\n",356356+ __func__, result);357357+ result = sizeof(vpd);358358+ }359359+353360 result -= SCSI_VPD_HEADER_SIZE;354361 if (!memchr(&vpd[SCSI_VPD_HEADER_SIZE], page, result))355362 return 0;···673666 sdev->use_10_for_rw = 0;674667675668 sdev->cdl_supported = 1;669669+670670+ /*671671+ * If the device supports CDL, make sure that the current drive672672+ * feature status is consistent with the user controlled673673+ * cdl_enable state.674674+ */675675+ scsi_cdl_enable(sdev, sdev->cdl_enable);676676 } else {677677 sdev->cdl_supported = 0;678678 }