Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF1AFC433FE for ; Sun, 30 Oct 2022 01:49:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8F55A85124; Sun, 30 Oct 2022 02:47:50 +0100 (CET) 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="PVXiXrQK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 00E298512E; Sun, 30 Oct 2022 02:47:47 +0100 (CET) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (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 23CDA8511C for ; Sun, 30 Oct 2022 02:47:43 +0100 (CET) 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-io1-xd2c.google.com with SMTP id h206so3983058iof.10 for ; Sat, 29 Oct 2022 18:47:43 -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:subject:date :message-id:reply-to; bh=9auj2TfsVoEdP4KWE6KX5Y26NPDubC482ZQ7SLaa2qA=; b=PVXiXrQK+tVhj7YG86JjWIGYQuiVWCDeIIU2mYzfJxIrTt2t1skHJ3sJZVYmjJOuo9 7m4S09kdUNAnlDLvRyEBouYiwX0IWPNpGaEZ9rwRdiQRj0DooX+tBsDtvoP5tKVAezCC WSsqBqmVKBBQwPqlnlK+4R730wVDO8V1BHbLQ= 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 :subject:date:message-id:reply-to; bh=9auj2TfsVoEdP4KWE6KX5Y26NPDubC482ZQ7SLaa2qA=; b=ec3uWtohCVqc0yBiAegAEfv6siQ4DWpEmX8gX6flaB3ceoMM2yyWqqegWZVcpElLS2 Fbjh61pkW16oCk1TYHV19wuaGDki7NYqoYcck//ogjwTDGqyAmCDCwtwK57FzcSN2APq FZqpEfVf27qvzTKTObmcO06JwqWnGLfGkDT/OXK/4ltiEiImR6qVGLIrThE6B7l+fF+1 Pwezhjacf47489FJCtgPds8XFep9e0wd0u7/kUQMRSkkIC/vT8xxFo+dwyUFhfmzEHyb bw4suGbVbpcilkx9VxoBRHCKTj8LVMrtkMzjQ/rOwOJ+9Nqdu3LR5QwlreBBQlqkjN1E sUkw== X-Gm-Message-State: ACrzQf15fvgfNlFFxLUbpqW1GyKedAA2O9qaWfE8RUWL8m+q8QlqF7oX X3nK36X8OJ10ATIH4FUbTa/Cqfnjom89Ww== X-Google-Smtp-Source: AMsMyM7spp64XdyDXS78QXZBApH/61qTmCgCHOteCADRpOCS4duM/3VjUnhdhI9wy++JE/3Hg7faHQ== X-Received: by 2002:a05:6638:3467:b0:375:4f6d:5c9 with SMTP id q39-20020a056638346700b003754f6d05c9mr368595jav.159.1667094461437; Sat, 29 Oct 2022 18:47:41 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id x66-20020a0294c8000000b00363c4307bb2sm810287jah.79.2022.10.29.18.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 18:47:41 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Marek Vasut , Pavel Herrmann Subject: [PATCH 01/17] dm: sandbox: Drop non-BLK code from host implementation Date: Sat, 29 Oct 2022 19:47:03 -0600 Message-Id: <20221030014719.147327-2-sjg@chromium.org> X-Mailer: git-send-email 2.38.1.273.g43a17bfeac-goog In-Reply-To: <20221030014719.147327-1-sjg@chromium.org> References: <20221030014719.147327-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 This is not used anymore. Drop it. Signed-off-by: Simon Glass --- cmd/host.c | 4 -- drivers/block/sandbox.c | 102 -------------------------------------- include/sandboxblockdev.h | 3 -- 3 files changed, 109 deletions(-) diff --git a/cmd/host.c b/cmd/host.c index f0d989ac0f9..f09ac8d4396 100644 --- a/cmd/host.c +++ b/cmd/host.c @@ -108,11 +108,7 @@ static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc, } struct host_block_dev *host_dev; -#ifdef CONFIG_BLK host_dev = dev_get_plat(blk_dev->bdev); -#else - host_dev = blk_dev->priv; -#endif printf("%12lu %s\n", (unsigned long)blk_dev->lba, host_dev->filename); } diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index f2aae89716b..93db1e0dcad 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -18,19 +18,6 @@ DECLARE_GLOBAL_DATA_PTR; -#ifndef CONFIG_BLK -static struct host_block_dev host_devices[SANDBOX_HOST_MAX_DEVICES]; - -static struct host_block_dev *find_host_device(int dev) -{ - if (dev >= 0 && dev < SANDBOX_HOST_MAX_DEVICES) - return &host_devices[dev]; - - return NULL; -} -#endif - -#ifdef CONFIG_BLK static unsigned long host_block_read(struct udevice *dev, unsigned long start, lbaint_t blkcnt, void *buffer) @@ -38,18 +25,6 @@ static unsigned long host_block_read(struct udevice *dev, struct host_block_dev *host_dev = dev_get_plat(dev); struct blk_desc *block_dev = dev_get_uclass_plat(dev); -#else -static unsigned long host_block_read(struct blk_desc *block_dev, - unsigned long start, lbaint_t blkcnt, - void *buffer) -{ - int dev = block_dev->devnum; - struct host_block_dev *host_dev = find_host_device(dev); - - if (!host_dev) - return -1; -#endif - if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) == -1) { printf("ERROR: Invalid block %lx\n", start); @@ -61,21 +36,12 @@ static unsigned long host_block_read(struct blk_desc *block_dev, return -1; } -#ifdef CONFIG_BLK static unsigned long host_block_write(struct udevice *dev, unsigned long start, lbaint_t blkcnt, const void *buffer) { struct host_block_dev *host_dev = dev_get_plat(dev); struct blk_desc *block_dev = dev_get_uclass_plat(dev); -#else -static unsigned long host_block_write(struct blk_desc *block_dev, - unsigned long start, lbaint_t blkcnt, - const void *buffer) -{ - int dev = block_dev->devnum; - struct host_block_dev *host_dev = find_host_device(dev); -#endif if (os_lseek(host_dev->fd, start * block_dev->blksz, OS_SEEK_SET) == -1) { @@ -88,7 +54,6 @@ static unsigned long host_block_write(struct blk_desc *block_dev, return -1; } -#ifdef CONFIG_BLK int host_dev_bind(int devnum, char *filename, bool removable) { struct host_block_dev *host_dev; @@ -164,55 +129,9 @@ err: free(str); return ret; } -#else -int host_dev_bind(int dev, char *filename, bool removable) -{ - struct host_block_dev *host_dev = find_host_device(dev); - - if (!host_dev) - return -1; - if (host_dev->blk_dev.priv) { - os_close(host_dev->fd); - host_dev->blk_dev.priv = NULL; - } - if (host_dev->filename) - free(host_dev->filename); - if (filename && *filename) { - host_dev->filename = strdup(filename); - } else { - host_dev->filename = NULL; - return 0; - } - - host_dev->fd = os_open(host_dev->filename, OS_O_RDWR); - if (host_dev->fd == -1) { - printf("Failed to access host backing file '%s'\n", - host_dev->filename); - return 1; - } - - struct blk_desc *blk_dev = &host_dev->blk_dev; - blk_dev->uclass_id = UCLASS_ROOT; - blk_dev->priv = host_dev; - blk_dev->blksz = 512; - blk_dev->lba = os_lseek(host_dev->fd, 0, OS_SEEK_END) / blk_dev->blksz; - blk_dev->block_read = host_block_read; - blk_dev->block_write = host_block_write; - blk_dev->devnum = dev; - blk_dev->part_type = PART_TYPE_UNKNOWN; - blk_dev->removable = removable; - snprintf(blk_dev->vendor, BLK_VEN_SIZE, "U-Boot"); - snprintf(blk_dev->product, BLK_PRD_SIZE, "hostfile"); - snprintf(blk_dev->revision, BLK_REV_SIZE, "1.0"); - part_init(blk_dev); - - return 0; -} -#endif int host_get_dev_err(int devnum, struct blk_desc **blk_devp) { -#ifdef CONFIG_BLK struct udevice *dev; int ret; @@ -220,23 +139,10 @@ int host_get_dev_err(int devnum, struct blk_desc **blk_devp) if (ret) return ret; *blk_devp = dev_get_uclass_plat(dev); -#else - struct host_block_dev *host_dev = find_host_device(devnum); - - if (!host_dev) - return -ENODEV; - - if (!host_dev->blk_dev.priv) - return -ENOENT; - - *blk_devp = &host_dev->blk_dev; -#endif return 0; } -#ifdef CONFIG_BLK - int sandbox_host_unbind(struct udevice *dev) { struct host_block_dev *host_dev; @@ -260,11 +166,3 @@ U_BOOT_DRIVER(sandbox_host_blk) = { .unbind = sandbox_host_unbind, .plat_auto = sizeof(struct host_block_dev), }; -#else -U_BOOT_LEGACY_BLK(sandbox_host) = { - .uclass_idname = "host", - .uclass_id = UCLASS_ROOT, - .max_devs = SANDBOX_HOST_MAX_DEVICES, - .get_dev = host_get_dev_err, -}; -#endif diff --git a/include/sandboxblockdev.h b/include/sandboxblockdev.h index dc983f0417b..0528f891b12 100644 --- a/include/sandboxblockdev.h +++ b/include/sandboxblockdev.h @@ -10,9 +10,6 @@ #define SANDBOX_HOST_MAX_DEVICES 4 struct host_block_dev { -#ifndef CONFIG_BLK - struct blk_desc blk_dev; -#endif char *filename; int fd; }; -- 2.38.1.273.g43a17bfeac-goog