diff mbox series

[1/3] efi_loader: remove unused members from struct efi_disk_obj

Message ID 20231225044356.626900-2-masahisa.kojima@linaro.org
State Accepted
Commit 6caf3a3e89649052cab41bd1578452368a4a57a0
Headers show
Series fix and refactoring of efi_disk.c | expand

Commit Message

Masahisa Kojima Dec. 25, 2023, 4:43 a.m. UTC
part and dev_index in struct efi_disk_obj are not used,
let's remove it.

This commit also removes the invalid structure comment
for @dev, it does not exist.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
---
 lib/efi_loader/efi_disk.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Comments

Heinrich Schuchardt Dec. 25, 2023, 9:42 a.m. UTC | #1
On 12/25/23 05:43, Masahisa Kojima wrote:
> part and dev_index in struct efi_disk_obj are not used,
> let's remove it.
>
> This commit also removes the invalid structure comment
> for @dev, it does not exist.
>
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> ---
>   lib/efi_loader/efi_disk.c | 15 +++------------
>   1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index f0d76113b0..a2f8b531a3 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -32,20 +32,15 @@ const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID;
>    *
>    * @header:	EFI object header
>    * @ops:	EFI disk I/O protocol interface
> - * @dev_index:	device index of block device
>    * @media:	block I/O media information
>    * @dp:		device path to the block device
> - * @part:	partition
>    * @volume:	simple file system protocol of the partition
> - * @dev:	associated DM device
>    */
>   struct efi_disk_obj {
>   	struct efi_object header;
>   	struct efi_block_io ops;
> -	int dev_index;
>   	struct efi_block_io_media media;
>   	struct efi_device_path *dp;
> -	unsigned int part;
>   	struct efi_simple_file_system_protocol *volume;
>   };
>
> @@ -383,7 +378,6 @@ static int efi_fs_exists(struct blk_desc *desc, int part)
>    * @parent:		parent handle
>    * @dp_parent:		parent device path
>    * @desc:		internal block device
> - * @dev_index:		device index for block device
>    * @part_info:		partition info
>    * @part:		partition
>    * @disk:		pointer to receive the created handle
> @@ -394,7 +388,6 @@ static efi_status_t efi_disk_add_dev(
>   				efi_handle_t parent,
>   				struct efi_device_path *dp_parent,
>   				struct blk_desc *desc,
> -				int dev_index,
>   				struct disk_partition *part_info,
>   				unsigned int part,
>   				struct efi_disk_obj **disk,
> @@ -456,7 +449,6 @@ static efi_status_t efi_disk_add_dev(
>   		diskobj->dp = efi_dp_from_part(desc, part);
>   		diskobj->media.last_block = desc->lba - 1;
>   	}
> -	diskobj->part = part;
>
>   	/*
>   	 * Install the device path and the block IO protocol.
> @@ -499,7 +491,6 @@ static efi_status_t efi_disk_add_dev(
>   			goto error;
>   	}
>   	diskobj->ops = block_io_disk_template;
> -	diskobj->dev_index = dev_index;
>
>   	/* Fill in EFI IO Media info (for read/write callbacks) */
>   	diskobj->media.removable_media = desc->removable;
> @@ -519,7 +510,7 @@ static efi_status_t efi_disk_add_dev(
>
>   	EFI_PRINT("BlockIO: part %u, present %d, logical %d, removable %d"
>   		  ", last_block %llu\n",
> -		  diskobj->part,
> +		  part,
>   		  diskobj->media.media_present,
>   		  diskobj->media.logical_partition,
>   		  diskobj->media.removable_media,
> @@ -566,7 +557,7 @@ static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
>   	diskid = desc->devnum;
>
>   	ret = efi_disk_add_dev(NULL, NULL, desc,
> -			       diskid, NULL, 0, &disk, agent_handle);
> +			       NULL, 0, &disk, agent_handle);
>   	if (ret != EFI_SUCCESS) {
>   		if (ret == EFI_NOT_READY) {
>   			log_notice("Disk %s not ready\n", dev->name);
> @@ -627,7 +618,7 @@ static int efi_disk_create_part(struct udevice *dev, efi_handle_t agent_handle)
>   		return -1;
>   	dp_parent = (struct efi_device_path *)handler->protocol_interface;
>
> -	ret = efi_disk_add_dev(parent, dp_parent, desc, diskid,
> +	ret = efi_disk_add_dev(parent, dp_parent, desc,
>   			       info, part, &disk, agent_handle);
>   	if (ret != EFI_SUCCESS) {
>   		log_err("Adding partition for %s failed\n", dev->name);
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index f0d76113b0..a2f8b531a3 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -32,20 +32,15 @@  const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID;
  *
  * @header:	EFI object header
  * @ops:	EFI disk I/O protocol interface
- * @dev_index:	device index of block device
  * @media:	block I/O media information
  * @dp:		device path to the block device
- * @part:	partition
  * @volume:	simple file system protocol of the partition
- * @dev:	associated DM device
  */
 struct efi_disk_obj {
 	struct efi_object header;
 	struct efi_block_io ops;
-	int dev_index;
 	struct efi_block_io_media media;
 	struct efi_device_path *dp;
-	unsigned int part;
 	struct efi_simple_file_system_protocol *volume;
 };
 
@@ -383,7 +378,6 @@  static int efi_fs_exists(struct blk_desc *desc, int part)
  * @parent:		parent handle
  * @dp_parent:		parent device path
  * @desc:		internal block device
- * @dev_index:		device index for block device
  * @part_info:		partition info
  * @part:		partition
  * @disk:		pointer to receive the created handle
@@ -394,7 +388,6 @@  static efi_status_t efi_disk_add_dev(
 				efi_handle_t parent,
 				struct efi_device_path *dp_parent,
 				struct blk_desc *desc,
-				int dev_index,
 				struct disk_partition *part_info,
 				unsigned int part,
 				struct efi_disk_obj **disk,
@@ -456,7 +449,6 @@  static efi_status_t efi_disk_add_dev(
 		diskobj->dp = efi_dp_from_part(desc, part);
 		diskobj->media.last_block = desc->lba - 1;
 	}
-	diskobj->part = part;
 
 	/*
 	 * Install the device path and the block IO protocol.
@@ -499,7 +491,6 @@  static efi_status_t efi_disk_add_dev(
 			goto error;
 	}
 	diskobj->ops = block_io_disk_template;
-	diskobj->dev_index = dev_index;
 
 	/* Fill in EFI IO Media info (for read/write callbacks) */
 	diskobj->media.removable_media = desc->removable;
@@ -519,7 +510,7 @@  static efi_status_t efi_disk_add_dev(
 
 	EFI_PRINT("BlockIO: part %u, present %d, logical %d, removable %d"
 		  ", last_block %llu\n",
-		  diskobj->part,
+		  part,
 		  diskobj->media.media_present,
 		  diskobj->media.logical_partition,
 		  diskobj->media.removable_media,
@@ -566,7 +557,7 @@  static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
 	diskid = desc->devnum;
 
 	ret = efi_disk_add_dev(NULL, NULL, desc,
-			       diskid, NULL, 0, &disk, agent_handle);
+			       NULL, 0, &disk, agent_handle);
 	if (ret != EFI_SUCCESS) {
 		if (ret == EFI_NOT_READY) {
 			log_notice("Disk %s not ready\n", dev->name);
@@ -627,7 +618,7 @@  static int efi_disk_create_part(struct udevice *dev, efi_handle_t agent_handle)
 		return -1;
 	dp_parent = (struct efi_device_path *)handler->protocol_interface;
 
-	ret = efi_disk_add_dev(parent, dp_parent, desc, diskid,
+	ret = efi_disk_add_dev(parent, dp_parent, desc,
 			       info, part, &disk, agent_handle);
 	if (ret != EFI_SUCCESS) {
 		log_err("Adding partition for %s failed\n", dev->name);