From patchwork Sat Aug 27 15:15:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1671149 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JnbGo1c+; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MFKzy0KNHz1yhN for ; Sun, 28 Aug 2022 01:16:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2A4CE83FEE; Sat, 27 Aug 2022 17:16:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JnbGo1c+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D17A684941; Sat, 27 Aug 2022 17:15:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCA2984928 for ; Sat, 27 Aug 2022 17:15:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x231.google.com with SMTP id u14so5549197oie.2 for ; Sat, 27 Aug 2022 08:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=1Uk7+nJv6H1jFIT84GGbUZxu7ncx1ZWW4I9AEolvZYI=; b=JnbGo1c+97ooQFf2RSYO0A9KU5KoTGx11YJOXXwIA6mn0+z084T+zMLzoqtgw4jV5x wAA1bsiSm9y6s36JuDBDU/kNaaJ0vnzJ0yIMz4Ei3NySqCXXXDKmn/9Asyv3QMPBoD7S 7drrZzIcrxjLK1lvp7uLOz2KJ4FH5TnyaOSUU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=1Uk7+nJv6H1jFIT84GGbUZxu7ncx1ZWW4I9AEolvZYI=; b=BNsLBkbo6SSfNDka16cVY6P7epNybSRyAK3m5qrAHMdmKNeG0mX1z1sD08uVlpfdUd CVcLGFAnSHZgHyfL5Ts7vqFrXxcEyqV6U7GKH/jtGStQVat42DtR/eyVedt5HNTE/Vx3 /8M9i8N3UfvJf6JXy6SoqNTGBncexwSN2U3aHWTRd8QvyS9QE7F8agPLxf6Jxrh7+Ei3 WxSvOE+dj0TopR4LtG9Bwz7FEWJeaILTIo3E44h//F43i0n9biJDYz+4GutegzNPHIdp 9Z4ZQuQYxHoXbMczkEpHEPTl8SU+XLgLtiLMgQuVBK9QX46eVfPv8qJb/i5Jc4bOWFiD Fjfw== X-Gm-Message-State: ACgBeo17f8WnBO4yutgMSciW6TiNzvmsPlxZG7RWljr8I7v8y3Hs9XG9 YUQLRPI8WGGGYz2bzyrw/6uk6bn1h6Ta8Q== X-Google-Smtp-Source: AA6agR4el4aQV6YBzazbb0EyTA5V/MYng3pz6awN2b0WaGajzfxUfIV0ZJ5x2HsH+P6q9yX2h6+9EQ== X-Received: by 2002:a05:6808:13c7:b0:344:b6ff:5183 with SMTP id d7-20020a05680813c700b00344b6ff5183mr3896650oiw.27.1661613347323; Sat, 27 Aug 2022 08:15:47 -0700 (PDT) Received: from sjg1.lan (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id e9-20020acab509000000b00344a22e71a9sm2466876oif.9.2022.08.27.08.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Aug 2022 08:15:47 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Andrew Scull , Marek Vasut , Rob Herring , Sean Anderson Subject: [PATCH 06/15] scsi: Move vendor/product info into the shared struct Date: Sat, 27 Aug 2022 09:15:04 -0600 Message-Id: <20220827151513.736395-7-sjg@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220827151513.736395-1-sjg@chromium.org> References: <20220827151513.736395-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Move this information into struct scsi_emul_info so we can use it in common code. Signed-off-by: Simon Glass --- drivers/usb/emul/sandbox_flash.c | 10 ++++------ include/scsi_emul.h | 5 +++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/usb/emul/sandbox_flash.c b/drivers/usb/emul/sandbox_flash.c index 3a9db835eed..eaa7f1e7ff6 100644 --- a/drivers/usb/emul/sandbox_flash.c +++ b/drivers/usb/emul/sandbox_flash.c @@ -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; } diff --git a/include/scsi_emul.h b/include/scsi_emul.h index f27c19750b0..b281c166f6f 100644 --- a/include/scsi_emul.h +++ b/include/scsi_emul.h @@ -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;