]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/scsi/cxlflash/lunmgt.c
Merge branches 'for-4.11/upstream-fixes', 'for-4.12/accutouch', 'for-4.12/cp2112...
[mirror_ubuntu-artful-kernel.git] / drivers / scsi / cxlflash / lunmgt.c
index 6c318db90c85cee7e02019ee06a757f26102bf06..0efed177cc8bd31c9cc1a80c62fcafc70a3a19f5 100644 (file)
  */
 static struct llun_info *create_local(struct scsi_device *sdev, u8 *wwid)
 {
+       struct cxlflash_cfg *cfg = shost_priv(sdev->host);
+       struct device *dev = &cfg->dev->dev;
        struct llun_info *lli = NULL;
 
        lli = kzalloc(sizeof(*lli), GFP_KERNEL);
        if (unlikely(!lli)) {
-               pr_err("%s: could not allocate lli\n", __func__);
+               dev_err(dev, "%s: could not allocate lli\n", __func__);
                goto out;
        }
 
@@ -58,11 +60,13 @@ out:
  */
 static struct glun_info *create_global(struct scsi_device *sdev, u8 *wwid)
 {
+       struct cxlflash_cfg *cfg = shost_priv(sdev->host);
+       struct device *dev = &cfg->dev->dev;
        struct glun_info *gli = NULL;
 
        gli = kzalloc(sizeof(*gli), GFP_KERNEL);
        if (unlikely(!gli)) {
-               pr_err("%s: could not allocate gli\n", __func__);
+               dev_err(dev, "%s: could not allocate gli\n", __func__);
                goto out;
        }
 
@@ -129,10 +133,10 @@ static struct glun_info *lookup_global(u8 *wwid)
  */
 static struct llun_info *find_and_create_lun(struct scsi_device *sdev, u8 *wwid)
 {
+       struct cxlflash_cfg *cfg = shost_priv(sdev->host);
+       struct device *dev = &cfg->dev->dev;
        struct llun_info *lli = NULL;
        struct glun_info *gli = NULL;
-       struct Scsi_Host *shost = sdev->host;
-       struct cxlflash_cfg *cfg = shost_priv(shost);
 
        if (unlikely(!wwid))
                goto out;
@@ -165,7 +169,7 @@ static struct llun_info *find_and_create_lun(struct scsi_device *sdev, u8 *wwid)
        list_add(&gli->list, &global.gluns);
 
 out:
-       pr_debug("%s: returning %p\n", __func__, lli);
+       dev_dbg(dev, "%s: returning lli=%p, gli=%p\n", __func__, lli, gli);
        return lli;
 }
 
@@ -225,17 +229,18 @@ void cxlflash_term_global_luns(void)
 int cxlflash_manage_lun(struct scsi_device *sdev,
                        struct dk_cxlflash_manage_lun *manage)
 {
-       int rc = 0;
+       struct cxlflash_cfg *cfg = shost_priv(sdev->host);
+       struct device *dev = &cfg->dev->dev;
        struct llun_info *lli = NULL;
+       int rc = 0;
        u64 flags = manage->hdr.flags;
        u32 chan = sdev->channel;
 
        mutex_lock(&global.mutex);
        lli = find_and_create_lun(sdev, manage->wwid);
-       pr_debug("%s: ENTER: WWID = %016llX%016llX, flags = %016llX li = %p\n",
-                __func__, get_unaligned_be64(&manage->wwid[0]),
-                get_unaligned_be64(&manage->wwid[8]),
-                manage->hdr.flags, lli);
+       dev_dbg(dev, "%s: WWID=%016llx%016llx, flags=%016llx lli=%p\n",
+               __func__, get_unaligned_be64(&manage->wwid[0]),
+               get_unaligned_be64(&manage->wwid[8]), manage->hdr.flags, lli);
        if (unlikely(!lli)) {
                rc = -ENOMEM;
                goto out;
@@ -265,11 +270,11 @@ int cxlflash_manage_lun(struct scsi_device *sdev,
                }
        }
 
-       pr_debug("%s: port_sel = %08X chan = %u lun_id = %016llX\n", __func__,
-                lli->port_sel, chan, lli->lun_id[chan]);
+       dev_dbg(dev, "%s: port_sel=%08x chan=%u lun_id=%016llx\n",
+               __func__, lli->port_sel, chan, lli->lun_id[chan]);
 
 out:
        mutex_unlock(&global.mutex);
-       pr_debug("%s: returning rc=%d\n", __func__, rc);
+       dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc);
        return rc;
 }