nvme_disk & virtio_block: Remove unneeded log2.
It was used, but then the result discarded. We have a log2() in kernel/util/BitUtils.h anyway, so if it is really needed, that should be used instead.
This commit is contained in:
parent
6bef34f853
commit
dab646ac9a
@ -132,20 +132,6 @@ get_geometry(nvme_disk_handle* handle, device_geometry* geometry)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
log2(uint32 x)
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = 31; y >= 0; --y) {
|
||||
if (x == ((uint32)1 << y))
|
||||
break;
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nvme_disk_set_capacity(nvme_disk_driver_info* info, uint64 capacity,
|
||||
uint32 blockSize)
|
||||
@ -153,12 +139,6 @@ nvme_disk_set_capacity(nvme_disk_driver_info* info, uint64 capacity,
|
||||
TRACE("set_capacity(device = %p, capacity = %" B_PRIu64 ", blockSize = %" B_PRIu32 ")\n",
|
||||
info, capacity, blockSize);
|
||||
|
||||
// get log2, if possible
|
||||
uint32 blockShift = log2(blockSize);
|
||||
|
||||
if ((1UL << blockShift) != blockSize)
|
||||
blockShift = 0;
|
||||
|
||||
info->capacity = capacity;
|
||||
info->block_size = blockSize;
|
||||
}
|
||||
|
@ -146,20 +146,6 @@ get_geometry(virtio_block_handle* handle, device_geometry* geometry)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
log2(uint32 x)
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = 31; y >= 0; --y) {
|
||||
if (x == ((uint32)1 << y))
|
||||
break;
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
virtio_block_config_callback(void* driverCookie)
|
||||
{
|
||||
@ -498,12 +484,6 @@ virtio_block_set_capacity(virtio_block_driver_info* info, uint64 capacity,
|
||||
TRACE("set_capacity(device = %p, capacity = %Ld, blockSize = %ld)\n",
|
||||
info, capacity, blockSize);
|
||||
|
||||
// get log2, if possible
|
||||
uint32 blockShift = log2(blockSize);
|
||||
|
||||
if ((1UL << blockShift) != blockSize)
|
||||
blockShift = 0;
|
||||
|
||||
info->capacity = capacity;
|
||||
|
||||
if (info->block_size != blockSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user