[uaccess] Remove redundant user_to_virt()

The user_to_virt() function is now a straightforward wrapper around
addition, with the addend almost invariably being zero.

Remove this redundant wrapper.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-21 00:15:52 +01:00
parent 89fe788689
commit 4535548cba
14 changed files with 15 additions and 60 deletions

View File

@@ -669,7 +669,7 @@ static userptr_t efipci_dma_umalloc ( struct dma_device *dma,
static void efipci_dma_ufree ( struct dma_device *dma, struct dma_mapping *map,
userptr_t addr, size_t len ) {
efipci_dma_free ( dma, map, user_to_virt ( addr, 0 ), len );
efipci_dma_free ( dma, map, addr, len );
}
/**

View File

@@ -101,7 +101,7 @@ static userptr_t linux_acpi_find ( uint32_t signature, unsigned int index ) {
filename, strerror ( rc ) );
goto err_read;
}
header = user_to_virt ( table->data, 0 );
header = table->data;
if ( ( ( ( size_t ) len ) < sizeof ( *header ) ) ||
( ( ( size_t ) len ) < le32_to_cpu ( header->length ) ) ) {
rc = -ENOENT;

View File

@@ -59,7 +59,7 @@ static int linux_find_smbios ( struct smbios *smbios ) {
smbios_entry_filename, strerror ( rc ) );
goto err_entry;
}
data = user_to_virt ( entry, 0 );
data = entry;
smbios3_entry = data;
smbios_entry = data;
if ( ( len >= ( ( int ) sizeof ( *smbios3_entry ) ) ) &&

View File

@@ -70,8 +70,7 @@ int linux_sysfs_read ( const char *filename, userptr_t *data ) {
*data = tmp;
/* Read from file */
read = linux_read ( fd, user_to_virt ( *data, len ),
LINUX_SYSFS_BLKSIZE );
read = linux_read ( fd, ( *data + len ), LINUX_SYSFS_BLKSIZE );
if ( read == 0 )
break;
if ( read < 0 ) {

View File

@@ -29,5 +29,4 @@ FILE_LICENCE(GPL2_OR_LATER);
PROVIDE_UACCESS_INLINE(linux, user_to_phys);
PROVIDE_UACCESS_INLINE(linux, virt_to_user);
PROVIDE_UACCESS_INLINE(linux, user_to_virt);
PROVIDE_UACCESS_INLINE(linux, memchr_user);