[PATCH] cciss: use memdup_user

2017-04-28 Thread Geliang Tang
Use memdup_user() helper instead of open-coding to simplify the code.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
---
 drivers/block/cciss.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index cd37550..40ee715 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1596,15 +1596,9 @@ static int cciss_bigpassthru(ctlr_info_t *h, void __user 
*argp)
return -EINVAL;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
-   ioc = kmalloc(sizeof(*ioc), GFP_KERNEL);
-   if (!ioc) {
-   status = -ENOMEM;
-   goto cleanup1;
-   }
-   if (copy_from_user(ioc, argp, sizeof(*ioc))) {
-   status = -EFAULT;
-   goto cleanup1;
-   }
+   ioc = memdup_user(argp, sizeof(*ioc));
+   if (IS_ERR(ioc))
+   return PTR_ERR(ioc);
if ((ioc->buf_size < 1) &&
(ioc->Request.Type.Direction != XFER_NONE)) {
status = -EINVAL;
-- 
2.9.3



[PATCH] xen/scsifront: use offset_in_page() macro

2017-04-21 Thread Geliang Tang
Use offset_in_page() macro instead of open-coding.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
---
 drivers/scsi/xen-scsifront.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 9aa1fe1..a6a8b60 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -434,7 +434,7 @@ static int map_data_for_request(struct vscsifrnt_info *info,
 
if (seg_grants) {
page = virt_to_page(seg);
-   off = (unsigned long)seg & ~PAGE_MASK;
+   off = offset_in_page(seg);
len = sizeof(struct scsiif_request_segment) * data_grants;
while (len > 0) {
bytes = min_t(unsigned int, len, PAGE_SIZE - off);
-- 
2.9.3



[PATCH] gdth: use offset_in_page() macro

2017-04-21 Thread Geliang Tang
Use offset_in_page() macro instead of open-coding.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
---
 drivers/scsi/gdth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index d020a13..557ce73 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2648,7 +2648,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd 
*scp, u8 b)
 
 } else {
 page = virt_to_page(scp->sense_buffer);
-offset = (unsigned long)scp->sense_buffer & ~PAGE_MASK;
+   offset = offset_in_page(scp->sense_buffer);
 sense_paddr = pci_map_page(ha->pdev,page,offset,
16,PCI_DMA_FROMDEVICE);
 
-- 
2.9.3



[PATCH] qla2xxx: use sg_virt()

2017-03-23 Thread Geliang Tang
Use sg_virt() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
---
 drivers/scsi/qla2xxx/qla_isr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 3203367..9610d85 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1991,7 +1991,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx 
*sts24)
return 1;
}
 
-   spt = page_address(sg_page(sg)) + sg->offset;
+   spt = sg_virt(sg);
spt += j;
 
spt->app_tag = 0x;
-- 
2.9.3



[PATCH] qla2xxx/qla4xxx: use kobj_to_dev

2016-12-09 Thread Geliang Tang
Use kobj_to_dev() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
---
 drivers/scsi/qla2xxx/qla_attr.c | 42 ++---
 drivers/scsi/qla4xxx/ql4_attr.c |  6 ++
 2 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fe7469c..820b416 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -21,8 +21,7 @@ qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject 
*kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
int rval = 0;
 
@@ -54,8 +53,7 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject 
*kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
int reading;
 
@@ -151,8 +149,7 @@ qla2x00_sysfs_read_nvram(struct file *filp, struct kobject 
*kobj,
 struct bin_attribute *bin_attr,
 char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
 
if (!capable(CAP_SYS_ADMIN))
@@ -170,8 +167,7 @@ qla2x00_sysfs_write_nvram(struct file *filp, struct kobject 
*kobj,
  struct bin_attribute *bin_attr,
  char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
uint16_tcnt;
 
@@ -238,8 +234,7 @@ qla2x00_sysfs_read_optrom(struct file *filp, struct kobject 
*kobj,
  struct bin_attribute *bin_attr,
  char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
ssize_t rval = 0;
 
@@ -259,8 +254,7 @@ qla2x00_sysfs_write_optrom(struct file *filp, struct 
kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
 
if (ha->optrom_state != QLA_SWRITING)
@@ -292,8 +286,7 @@ qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct 
kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
uint32_t start = 0;
uint32_t size = ha->optrom_size;
@@ -473,8 +466,7 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject 
*kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
uint32_t faddr;
 
@@ -502,8 +494,7 @@ qla2x00_sysfs_write_vpd(struct file *filp, struct kobject 
*kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
+   struct scsi_qla_host *vha = shost_priv(dev_to_shost(kobj_to_dev(kobj)));
struct qla_hw_data *ha = vha->hw;
uint8_t *tmp_data;
 
@@ -555,8 +546,7 @@ qla2x00_sysfs_read_sfp(struct file *filp, struct kobject 
*kobj,
  

[PATCH] scsi: dmx3191d: use module_pci_driver

2016-11-16 Thread Geliang Tang
Use module_pci_driver() helper to simplify the code.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
---
 drivers/scsi/dmx3191d.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c
index 3aa4657..6af3394 100644
--- a/drivers/scsi/dmx3191d.c
+++ b/drivers/scsi/dmx3191d.c
@@ -153,18 +153,7 @@ static struct pci_driver dmx3191d_pci_driver = {
.remove = dmx3191d_remove_one,
 };
 
-static int __init dmx3191d_init(void)
-{
-   return pci_register_driver(_pci_driver);
-}
-
-static void __exit dmx3191d_exit(void)
-{
-   pci_unregister_driver(_pci_driver);
-}
-
-module_init(dmx3191d_init);
-module_exit(dmx3191d_exit);
+module_pci_driver(dmx3191d_pci_driver);
 
 MODULE_AUTHOR("Massimo Piccioni <dafasti...@libero.it>");
 MODULE_DESCRIPTION("Domex DMX3191D SCSI driver");
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: a100u2w: use module_pci_driver

2016-11-16 Thread Geliang Tang
Use module_pci_driver() helper to simplify the code.

Signed-off-by: Geliang Tang <geliangt...@gmail.com>
---
 drivers/scsi/a100u2w.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 8086bd0..b2942ec 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -1222,19 +1222,8 @@ static struct pci_driver inia100_pci_driver = {
.remove = inia100_remove_one,
 };
 
-static int __init inia100_init(void)
-{
-   return pci_register_driver(_pci_driver);
-}
-
-static void __exit inia100_exit(void)
-{
-   pci_unregister_driver(_pci_driver);
-}
+module_pci_driver(inia100_pci_driver);
 
 MODULE_DESCRIPTION("Initio A100U2W SCSI driver");
 MODULE_AUTHOR("Initio Corporation");
 MODULE_LICENSE("Dual BSD/GPL");
-
-module_init(inia100_init);
-module_exit(inia100_exit);
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/7] mvsas: use to_delayed_work

2016-01-01 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 drivers/scsi/mvsas/mv_sas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index e712fe7..78bf557 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -1887,7 +1887,7 @@ static void mvs_phy_disconnected(struct mvs_phy *phy)
 
 static void mvs_work_queue(struct work_struct *work)
 {
-   struct delayed_work *dw = container_of(work, struct delayed_work, work);
+   struct delayed_work *dw = to_delayed_work(work);
struct mvs_wq *mwq = container_of(dw, struct mvs_wq, work_q);
struct mvs_info *mvi = mwq->mvi;
unsigned long flags;
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] target: use offset_in_page macro

2015-11-25 Thread Geliang Tang
Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 drivers/target/target_core_user.c | 2 +-
 drivers/target/tcm_fc/tfc_io.c| 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index 937cebf..d5477c0 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -194,7 +194,7 @@ static struct tcmu_cmd *tcmu_alloc_cmd(struct se_cmd 
*se_cmd)
 
 static inline void tcmu_flush_dcache_range(void *vaddr, size_t size)
 {
-   unsigned long offset = (unsigned long) vaddr & ~PAGE_MASK;
+   unsigned long offset = offset_in_page(vaddr);
 
size = round_up(size+offset, PAGE_SIZE);
vaddr -= offset;
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c
index 847c1aa..6f7c65a 100644
--- a/drivers/target/tcm_fc/tfc_io.c
+++ b/drivers/target/tcm_fc/tfc_io.c
@@ -154,9 +154,9 @@ int ft_queue_data_in(struct se_cmd *se_cmd)
BUG_ON(!page);
from = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
page_addr = from;
-   from += mem_off & ~PAGE_MASK;
+   from += offset_in_page(mem_off);
tlen = min(tlen, (size_t)(PAGE_SIZE -
-   (mem_off & ~PAGE_MASK)));
+   offset_in_page(mem_off)));
memcpy(to, from, tlen);
kunmap_atomic(page_addr);
to += tlen;
@@ -314,9 +314,9 @@ void ft_recv_write_data(struct ft_cmd *cmd, struct fc_frame 
*fp)
 
to = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
page_addr = to;
-   to += mem_off & ~PAGE_MASK;
+   to += offset_in_page(mem_off);
tlen = min(tlen, (size_t)(PAGE_SIZE -
- (mem_off & ~PAGE_MASK)));
+ offset_in_page(mem_off)));
memcpy(to, from, tlen);
kunmap_atomic(page_addr);
 
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9] scsi: fix trivial typos

2015-10-18 Thread Geliang Tang
s/regsiter/register/

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 drivers/scsi/isci/registers.h   | 4 ++--
 drivers/scsi/mpt2sas/mpt2sas_base.h | 2 +-
 drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/isci/registers.h b/drivers/scsi/isci/registers.h
index 97f3ceb..63468cf 100644
--- a/drivers/scsi/isci/registers.h
+++ b/drivers/scsi/isci/registers.h
@@ -652,7 +652,7 @@ struct scu_iit_entry {
 
 
 /*
- * TODO: Where is the SAS_LNKTOV regsiter?
+ * TODO: Where is the SAS_LNKTOV register?
  * TODO: Where is the SAS_PHYTOV register? */
 
 #define SCU_SAS_TRANSMIT_IDENTIFICATION_SMP_TARGET_SHIFT(1)
@@ -1827,7 +1827,7 @@ struct scu_peg_registers {
 };
 
 /**
- * struct scu_registers - SCU regsiters including both PEG registers if we turn
+ * struct scu_registers - SCU registers including both PEG registers if we turn
  *on that compile option. All of these registers are in the memory mapped
  *space returned from BAR1.
  *
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h 
b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 97ea360..9cc79cf 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -1209,7 +1209,7 @@ void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER 
*ioc,
 Mpi2EventNotificationReply_t *mpi_reply);
 
 void mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER *ioc,
-   u8 bits_to_regsiter);
+   u8 bits_to_register);
 
 /* transport shared API */
 u8 mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 9a73c8b..b95f932 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1211,7 +1211,7 @@ void mpt3sas_ctl_add_to_event_log(struct MPT3SAS_ADAPTER 
*ioc,
Mpi2EventNotificationReply_t *mpi_reply);
 
 void mpt3sas_enable_diag_buffer(struct MPT3SAS_ADAPTER *ioc,
-   u8 bits_to_regsiter);
+   u8 bits_to_register);
 int mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
u8 *issue_reset);
 
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/3] scsi: drop unlikely behind BUG_ON()

2015-10-05 Thread Geliang Tang
(1) For !CONFIG_BUG cases, the bug call is a no-op, so we couldn't care
less and the change is ok.

(2) ppc and mips, which HAVE_ARCH_BUG_ON, do not rely on branch predictions
as it seems to be pointless[1] and thus callers should not be trying to
push an optimization in the first place.

(3) For CONFIG_BUG and !HAVE_ARCH_BUG_ON cases, BUG_ON() contains an
unlikely compiler flag already.

Hence, we can drop unlikely behind BUG_ON().

[1] http://lkml.iu.edu/hypermail/linux/kernel/1101.3/02289.html

Signed-off-by: Geliang Tang <geliangt...@163.com>
Reviewed-by: Bart Van Assche <bart.vanass...@sandisk.com>
---
Changes in v2:
 - Just rewrite the commit log.
---
 drivers/scsi/scsi_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f570b48..3b5faab 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1164,8 +1164,8 @@ int scsi_init_io(struct scsi_cmnd *cmd)
 
count = blk_rq_map_integrity_sg(rq->q, rq->bio,
prot_sdb->table.sgl);
-   BUG_ON(unlikely(count > ivecs));
-   BUG_ON(unlikely(count > queue_max_integrity_segments(rq->q)));
+   BUG_ON(count > ivecs);
+   BUG_ON(count > queue_max_integrity_segments(rq->q));
 
cmd->prot_sdb = prot_sdb;
cmd->prot_sdb->table.nents = count;
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] isci: fix two comment typos

2015-10-04 Thread Geliang Tang
Just fix two typos in the code comment.

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 drivers/scsi/isci/request.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index cfd0084..8fe106f 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -3306,7 +3306,7 @@ sci_io_request_construct_smp(struct device *dev,
  * @ireq: This parameter points to the isci_request allocated in the
  *request construct function.
  *
- * SCI_SUCCESS on successfull completion, or specific failure code.
+ * SCI_SUCCESS on successful completion, or specific failure code.
  */
 static enum sci_status isci_smp_request_build(struct isci_request *ireq)
 {
@@ -3332,7 +3332,7 @@ static enum sci_status isci_smp_request_build(struct 
isci_request *ireq)
  * @sci_device: This parameter is the handle for the sci core's remote device
  *object that is the destination for this request.
  *
- * SCI_SUCCESS on successfull completion, or specific failure code.
+ * SCI_SUCCESS on successful completion, or specific failure code.
  */
 static enum sci_status isci_io_request_build(struct isci_host *ihost,
 struct isci_request *request,
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] scsi: drop unlikely behind BUG_ON()

2015-10-04 Thread Geliang Tang
BUG_ON() already contain an unlikely compiler flag. Drop it.

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 drivers/scsi/scsi_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f570b48..3b5faab 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1164,8 +1164,8 @@ int scsi_init_io(struct scsi_cmnd *cmd)
 
count = blk_rq_map_integrity_sg(rq->q, rq->bio,
prot_sdb->table.sgl);
-   BUG_ON(unlikely(count > ivecs));
-   BUG_ON(unlikely(count > queue_max_integrity_segments(rq->q)));
+   BUG_ON(count > ivecs);
+   BUG_ON(count > queue_max_integrity_segments(rq->q));
 
cmd->prot_sdb = prot_sdb;
cmd->prot_sdb->table.nents = count;
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] cxlflash: drop unlikely before IS_ERR_OR_NULL

2015-09-30 Thread Geliang Tang
IS_ERR_OR_NULL already contain an unlikely compiler flag. Drop it.

Signed-off-by: Geliang Tang <geliangt...@163.com>
---
 drivers/scsi/cxlflash/superpipe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/cxlflash/superpipe.c 
b/drivers/scsi/cxlflash/superpipe.c
index f1b62ce..eb1b01e 100644
--- a/drivers/scsi/cxlflash/superpipe.c
+++ b/drivers/scsi/cxlflash/superpipe.c
@@ -1307,7 +1307,7 @@ static int cxlflash_disk_attach(struct scsi_device *sdev,
}
 
ctx = cxl_dev_context_init(cfg->dev);
-   if (unlikely(IS_ERR_OR_NULL(ctx))) {
+   if (IS_ERR_OR_NULL(ctx)) {
dev_err(dev, "%s: Could not initialize context %p\n",
__func__, ctx);
rc = -ENODEV;
@@ -1432,7 +1432,7 @@ static int recover_context(struct cxlflash_cfg *cfg, 
struct ctx_info *ctxi)
struct afu *afu = cfg->afu;
 
ctx = cxl_dev_context_init(cfg->dev);
-   if (unlikely(IS_ERR_OR_NULL(ctx))) {
+   if (IS_ERR_OR_NULL(ctx)) {
dev_err(dev, "%s: Could not initialize context %p\n",
__func__, ctx);
rc = -ENODEV;
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html