Re: [PATCH V1 2/3] scsi: ufs: Add ufs provisioning support

From: Bart Van Assche
Date: Mon Jun 04 2018 - 05:17:47 EST


On Fri, 2018-06-01 at 16:12 +0530, Sayali Lokhande wrote:
> + qTotalRawDeviceCapacity =
> + (uint64_t)geo_buf[0x0b] | ((uint64_t)geo_buf[0x0a] << 8) |
> + ((uint64_t)geo_buf[0x09] << 16) |
> + ((uint64_t)geo_buf[0x08] << 24) |
> + ((uint64_t)geo_buf[0x07] << 32) |
> + ((uint64_t)geo_buf[0x06] << 40) |
> + ((uint64_t)geo_buf[0x05] << 48) |
> + ((uint64_t)geo_buf[0x04] << 56);
> + wEnhanced1CapAdjFac =
> + (uint16_t)geo_buf[0x31] | ((uint16_t)geo_buf[0x30] << 8);

Please use get_unaligned_be*() instead of open-coding these functions.

> + *pt++ = (cfg->unit[i].dNumAllocUnits >> 24) & 0xff;
> + *pt++ = (cfg->unit[i].dNumAllocUnits >> 16) & 0xff;
> + *pt++ = (cfg->unit[i].dNumAllocUnits >> 8) & 0xff;
> + *pt++ = (cfg->unit[i].dNumAllocUnits) & 0xff;

Please use put_unaligned_be() instead of open-coding this function.

Thanks,

Bart.