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

From: sayali
Date: Wed Jun 06 2018 - 06:47:28 EST


-----Original Message-----
From: Bart Van Assche [mailto:Bart.VanAssche@xxxxxxx]
Sent: Monday, June 04, 2018 2:48 PM
To: vinholikatti@xxxxxxxxx; asutoshd@xxxxxxxxxxxxxx; sayalil@xxxxxxxxxxxxxx; evgreen@xxxxxxxxxxxx; cang@xxxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx; subhashj@xxxxxxxxxxxxxx; vivek.gautam@xxxxxxxxxxxxxx; rnayak@xxxxxxxxxxxxxx; jejb@xxxxxxxxxxxxxxxxxx
Cc: linux-scsi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [PATCH V1 2/3] scsi: ufs: Add ufs provisioning support

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.
[Sayali]Agreed. Will update.

> + *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.
[Sayali]Agreed. Will update.

Thanks,

Bart.