Skip to content

Commit

Permalink
scsi: smartpqi: Convert snprintf() to scnprintf()
Browse files Browse the repository at this point in the history
The entire Linux kernel has been slowly migrating from snprintf() to
scnprintf(), so we are doing our part. This article explains the rationale
for this change:

   https: //lwn.net/Articles/69419/

Link: https://lore.kernel.org/r/161549383357.25025.12363435617789964291.stgit@brunhilda
Reviewed-by: Scott Benesh <[email protected]>
Reviewed-by: Mike McGowen <[email protected]>
Reviewed-by: Scott Teel <[email protected]>
Reviewed-by: Martin Wilck <[email protected]>
Signed-off-by: Kevin Barnett <[email protected]>
Signed-off-by: Don Brace <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
Kevin Barnett authored and martinkpetersen committed Apr 6, 2021
1 parent 3268b8a commit a425625
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions drivers/scsi/smartpqi/smartpqi_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ static void pqi_dev_info(struct pqi_ctrl_info *ctrl_info,
ssize_t count;
char buffer[PQI_DEV_INFO_BUFFER_LENGTH];

count = snprintf(buffer, PQI_DEV_INFO_BUFFER_LENGTH,
count = scnprintf(buffer, PQI_DEV_INFO_BUFFER_LENGTH,
"%d:%d:", ctrl_info->scsi_host->host_no, device->bus);

if (device->target_lun_valid)
Expand Down Expand Up @@ -6382,14 +6382,13 @@ static ssize_t pqi_firmware_version_show(struct device *dev,
shost = class_to_shost(dev);
ctrl_info = shost_to_hba(shost);

return snprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->firmware_version);
return scnprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->firmware_version);
}

static ssize_t pqi_driver_version_show(struct device *dev,
struct device_attribute *attr, char *buffer)
{
return snprintf(buffer, PAGE_SIZE, "%s\n",
DRIVER_VERSION BUILD_TIMESTAMP);
return scnprintf(buffer, PAGE_SIZE, "%s\n", DRIVER_VERSION BUILD_TIMESTAMP);
}

static ssize_t pqi_serial_number_show(struct device *dev,
Expand All @@ -6401,7 +6400,7 @@ static ssize_t pqi_serial_number_show(struct device *dev,
shost = class_to_shost(dev);
ctrl_info = shost_to_hba(shost);

return snprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->serial_number);
return scnprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->serial_number);
}

static ssize_t pqi_model_show(struct device *dev,
Expand All @@ -6413,7 +6412,7 @@ static ssize_t pqi_model_show(struct device *dev,
shost = class_to_shost(dev);
ctrl_info = shost_to_hba(shost);

return snprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->model);
return scnprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->model);
}

static ssize_t pqi_vendor_show(struct device *dev,
Expand All @@ -6425,7 +6424,7 @@ static ssize_t pqi_vendor_show(struct device *dev,
shost = class_to_shost(dev);
ctrl_info = shost_to_hba(shost);

return snprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->vendor);
return scnprintf(buffer, PAGE_SIZE, "%s\n", ctrl_info->vendor);
}

static ssize_t pqi_host_rescan_store(struct device *dev,
Expand Down Expand Up @@ -6619,7 +6618,7 @@ static ssize_t pqi_unique_id_show(struct device *dev,

spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);

return snprintf(buffer, PAGE_SIZE,
return scnprintf(buffer, PAGE_SIZE,
"%02X%02X%02X%02X%02X%02X%02X%02X"
"%02X%02X%02X%02X%02X%02X%02X%02X\n",
unique_id[0], unique_id[1], unique_id[2], unique_id[3],
Expand Down Expand Up @@ -6652,7 +6651,7 @@ static ssize_t pqi_lunid_show(struct device *dev,

spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);

return snprintf(buffer, PAGE_SIZE, "0x%8phN\n", lunid);
return scnprintf(buffer, PAGE_SIZE, "0x%8phN\n", lunid);
}

#define MAX_PATHS 8
Expand Down Expand Up @@ -6764,7 +6763,7 @@ static ssize_t pqi_sas_address_show(struct device *dev,

spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);

return snprintf(buffer, PAGE_SIZE, "0x%016llx\n", sas_address);
return scnprintf(buffer, PAGE_SIZE, "0x%016llx\n", sas_address);
}

static ssize_t pqi_ssd_smart_path_enabled_show(struct device *dev,
Expand Down Expand Up @@ -6822,7 +6821,7 @@ static ssize_t pqi_raid_level_show(struct device *dev,

spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);

return snprintf(buffer, PAGE_SIZE, "%s\n", raid_level);
return scnprintf(buffer, PAGE_SIZE, "%s\n", raid_level);
}

static ssize_t pqi_raid_bypass_cnt_show(struct device *dev,
Expand All @@ -6849,7 +6848,7 @@ static ssize_t pqi_raid_bypass_cnt_show(struct device *dev,

spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);

return snprintf(buffer, PAGE_SIZE, "0x%x\n", raid_bypass_cnt);
return scnprintf(buffer, PAGE_SIZE, "0x%x\n", raid_bypass_cnt);
}

static DEVICE_ATTR(lunid, 0444, pqi_lunid_show, NULL);
Expand Down

0 comments on commit a425625

Please sign in to comment.