]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
scsi: Move vendor/product info into the shared struct
authorSimon Glass <sjg@chromium.org>
Wed, 21 Sep 2022 14:21:38 +0000 (16:21 +0200)
committerSimon Glass <sjg@chromium.org>
Sun, 25 Sep 2022 14:30:05 +0000 (08:30 -0600)
Move this information into struct scsi_emul_info so we can use it in
common code.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/usb/emul/sandbox_flash.c
include/scsi_emul.h

index 3a9db835eed17dcb444ec049c488110415d55a7a..eaa7f1e7ff67540248a5b10d5af1b6f2750f66b4 100644 (file)
@@ -245,12 +245,8 @@ static int handle_ufi_command(struct sandbox_flash_plat *plat,
                memset(resp, '\0', sizeof(*resp));
                resp->data_format = 1;
                resp->additional_len = 0x1f;
-               strncpy(resp->vendor,
-                       plat->flash_strings[STRINGID_MANUFACTURER -  1].s,
-                       sizeof(resp->vendor));
-               strncpy(resp->product,
-                       plat->flash_strings[STRINGID_PRODUCT - 1].s,
-                       sizeof(resp->product));
+               strncpy(resp->vendor, info->vendor, sizeof(resp->vendor));
+               strncpy(resp->product, info->product, sizeof(resp->product));
                strncpy(resp->revision, "1.0", sizeof(resp->revision));
                setup_response(priv, resp, sizeof(*resp));
                break;
@@ -406,6 +402,8 @@ static int sandbox_flash_probe(struct udevice *dev)
        info->buff = malloc(SANDBOX_FLASH_BUF_SIZE);
        if (!info->buff)
                return log_ret(-ENOMEM);
+       info->vendor = plat->flash_strings[STRINGID_MANUFACTURER -  1].s;
+       info->product = plat->flash_strings[STRINGID_PRODUCT - 1].s;
 
        return 0;
 }
index f27c19750b036352b60ae4bfce5fd20037683a52..b281c166f6fbe9fb8a3cda875f3ea9b1348ecfc0 100644 (file)
@@ -15,6 +15,9 @@
 /**
  * struct scsi_emul_info - information for emulating a SCSI device
  *
+ * @vendor: Vendor name
+ * @product: Product name
+ *
  * @phase: Current SCSI phase
  * @buff_used: Number of bytes ready to transfer back to host
  * @read_len: Number of bytes of data left in the current read command
@@ -25,6 +28,8 @@
 struct scsi_emul_info {
        /* provided by the caller: */
        void *buff;
+       const char *vendor;
+       const char *product;
 
        /* state maintained by the emulator: */
        enum scsi_cmd_phase phase;