Commit fb67d44d authored by Matthew R. Ochs's avatar Matthew R. Ochs Committed by Martin K. Petersen

scsi: cxlflash: Cleanup prints

The usage of prints within the cxlflash driver is inconsistent. This
hinders debug and makes the driver source and log output appear sloppy.

The following cleanups help unify the prints within cxlflash:
 - move all prints to dev-* where possible
 - transition all hex prints to lowercase
 - standardize variable prints in debug output
 - derive pointers in a consistent manner
 - change int to bool where appropriate
 - remove superfluous data from prints and print statements that do not
   make sense
Signed-off-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 696d0b0c
...@@ -32,11 +32,13 @@ ...@@ -32,11 +32,13 @@
*/ */
static struct llun_info *create_local(struct scsi_device *sdev, u8 *wwid) 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; struct llun_info *lli = NULL;
lli = kzalloc(sizeof(*lli), GFP_KERNEL); lli = kzalloc(sizeof(*lli), GFP_KERNEL);
if (unlikely(!lli)) { if (unlikely(!lli)) {
pr_err("%s: could not allocate lli\n", __func__); dev_err(dev, "%s: could not allocate lli\n", __func__);
goto out; goto out;
} }
...@@ -58,11 +60,13 @@ static struct llun_info *create_local(struct scsi_device *sdev, u8 *wwid) ...@@ -58,11 +60,13 @@ static struct llun_info *create_local(struct scsi_device *sdev, u8 *wwid)
*/ */
static struct glun_info *create_global(struct scsi_device *sdev, u8 *wwid) 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; struct glun_info *gli = NULL;
gli = kzalloc(sizeof(*gli), GFP_KERNEL); gli = kzalloc(sizeof(*gli), GFP_KERNEL);
if (unlikely(!gli)) { if (unlikely(!gli)) {
pr_err("%s: could not allocate gli\n", __func__); dev_err(dev, "%s: could not allocate gli\n", __func__);
goto out; goto out;
} }
...@@ -129,10 +133,10 @@ static struct glun_info *lookup_global(u8 *wwid) ...@@ -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) 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 llun_info *lli = NULL;
struct glun_info *gli = NULL; struct glun_info *gli = NULL;
struct Scsi_Host *shost = sdev->host;
struct cxlflash_cfg *cfg = shost_priv(shost);
if (unlikely(!wwid)) if (unlikely(!wwid))
goto out; goto out;
...@@ -165,7 +169,7 @@ static struct llun_info *find_and_create_lun(struct scsi_device *sdev, u8 *wwid) ...@@ -165,7 +169,7 @@ static struct llun_info *find_and_create_lun(struct scsi_device *sdev, u8 *wwid)
list_add(&gli->list, &global.gluns); list_add(&gli->list, &global.gluns);
out: out:
pr_debug("%s: returning %p\n", __func__, lli); dev_dbg(dev, "%s: returning lli=%p, gli=%p\n", __func__, lli, gli);
return lli; return lli;
} }
...@@ -225,17 +229,18 @@ void cxlflash_term_global_luns(void) ...@@ -225,17 +229,18 @@ void cxlflash_term_global_luns(void)
int cxlflash_manage_lun(struct scsi_device *sdev, int cxlflash_manage_lun(struct scsi_device *sdev,
struct dk_cxlflash_manage_lun *manage) 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; struct llun_info *lli = NULL;
int rc = 0;
u64 flags = manage->hdr.flags; u64 flags = manage->hdr.flags;
u32 chan = sdev->channel; u32 chan = sdev->channel;
mutex_lock(&global.mutex); mutex_lock(&global.mutex);
lli = find_and_create_lun(sdev, manage->wwid); lli = find_and_create_lun(sdev, manage->wwid);
pr_debug("%s: ENTER: WWID = %016llX%016llX, flags = %016llX li = %p\n", dev_dbg(dev, "%s: WWID=%016llx%016llx, flags=%016llx lli=%p\n",
__func__, get_unaligned_be64(&manage->wwid[0]), __func__, get_unaligned_be64(&manage->wwid[0]),
get_unaligned_be64(&manage->wwid[8]), get_unaligned_be64(&manage->wwid[8]), manage->hdr.flags, lli);
manage->hdr.flags, lli);
if (unlikely(!lli)) { if (unlikely(!lli)) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
...@@ -265,11 +270,11 @@ int cxlflash_manage_lun(struct scsi_device *sdev, ...@@ -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__, dev_dbg(dev, "%s: port_sel=%08x chan=%u lun_id=%016llx\n",
lli->port_sel, chan, lli->lun_id[chan]); __func__, lli->port_sel, chan, lli->lun_id[chan]);
out: out:
mutex_unlock(&global.mutex); 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; return rc;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment