@@ -2362,9 +2362,9 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
/* Lowest aligned logical block */
alignment = ((buffer[14] & 0x3f) << 8 | buffer[15]) * sector_size;
blk_queue_alignment_offset(sdp->request_queue, alignment);
- if (alignment && sdkp->first_scan)
- sd_printk(KERN_NOTICE, sdkp,
- "physical block alignment offset: %u\n", alignment);
+ if (alignment)
+ sd_first_printk(KERN_NOTICE, sdkp,
+ "physical block alignment offset: %u\n", alignment);
if (buffer[14] & 0x80) { /* LBPME */
sdkp->lbpme = 1;
@@ -2978,14 +2978,15 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
* with partitions as regular block devices.
*/
q->limits.zoned = BLK_ZONED_NONE;
- if (sdkp->zoned == 2 && sdkp->first_scan)
- sd_printk(KERN_NOTICE, sdkp,
- "Drive-managed SMR disk\n");
+ if (sdkp->zoned == 2)
+ sd_first_printk(KERN_NOTICE, sdkp,
+ "Drive-managed SMR disk\n");
}
}
- if (blk_queue_is_zoned(q) && sdkp->first_scan)
- sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
- q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
+ if (blk_queue_is_zoned(q))
+ sd_first_printk(KERN_NOTICE, sdkp,
+ "Host-%s zoned block device\n",
+ q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
out:
kfree(buffer);
@@ -571,9 +571,8 @@ static int sd_zbc_check_zoned_characteristics(struct scsi_disk *sdkp,
* are not supported.
*/
if (!sdkp->urswrz) {
- if (sdkp->first_scan)
- sd_printk(KERN_NOTICE, sdkp,
- "constrained reads devices are not supported\n");
+ sd_first_printk(KERN_NOTICE, sdkp,
+ "constrained reads devices are not supported\n");
return -ENODEV;
}
@@ -609,11 +608,10 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf,
/* The max_lba field is the capacity of this device */
max_lba = get_unaligned_be64(&buf[8]);
if (sdkp->capacity != max_lba + 1) {
- if (sdkp->first_scan)
- sd_printk(KERN_WARNING, sdkp,
- "Changing capacity from %llu to max LBA+1 %llu\n",
- (unsigned long long)sdkp->capacity,
- (unsigned long long)max_lba + 1);
+ sd_first_printk(KERN_WARNING, sdkp,
+ "Changing capacity from %llu to max LBA+1 %llu\n",
+ (unsigned long long)sdkp->capacity,
+ (unsigned long long)max_lba + 1);
sdkp->capacity = max_lba + 1;
}
}
@@ -622,9 +620,7 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf,
rec = buf + 64;
zone_blocks = get_unaligned_be64(&rec[8]);
if (logical_to_sectors(sdkp->device, zone_blocks) > UINT_MAX) {
- if (sdkp->first_scan)
- sd_printk(KERN_NOTICE, sdkp,
- "Zone size too large\n");
+ sd_first_printk(KERN_NOTICE, sdkp, "Zone size too large\n");
return -EFBIG;
}
In sd.c and sd_zbc.c, replace sd_printk() calls conditional to sdkp->first_scan with calls to sd_first_printk(). This simplifies the code (no functional changes). Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> --- drivers/scsi/sd.c | 19 ++++++++++--------- drivers/scsi/sd_zbc.c | 18 +++++++----------- 2 files changed, 17 insertions(+), 20 deletions(-)