From patchwork Thu Dec 17 12:10:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344930 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1109875jai; Thu, 17 Dec 2020 04:11:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8U9KuwXDJh+QwtHetNI2NCHZkVFwocMT/DQoZGF9Q+4thof8BVwN44TAxGlCoIeFXKHGK X-Received: by 2002:aa7:dd05:: with SMTP id i5mr16643769edv.223.1608207105822; Thu, 17 Dec 2020 04:11:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608207105; cv=none; d=google.com; s=arc-20160816; b=DrM6isEV6ro6hTkaXE2wSKXJdKl/HtIH5cZpxl7BJexhvSMon7Ow/IqyznqNND6pMK w6q/sCxJAIBB/3dwNzJgC/svwGn57h6ufZCnNpC1ZqBc24B4xCu2lyF19pF8Tjepx7CC MM8oN7jGmvvhEvwpIgs7IRH/BLhW3zGYpmVDurpGqkto6VgDKNGDJuZdFGF0k5Qwr7jh AE0JSSFzT3QKGgDssDSuOPv/LgTfWu44WkH02vt801PSGRT+TdeRU2K00ITJFFS8OA9z Fg0TvWE5IiQlID22D7Zl5uDjYIGgq0/uTa7oClTOEnusfWLqgBUqXaOZuClTU61LJ7ya 0HXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=MxT3AujAex65msl7ZgW5g5E+GqdY6NnpkjtkNalxiXY=; b=FmGO8ysNnQ+HtsLwTLhrXEqqQWYsqd/6TkRQCcSS+eCOlv7LhzUjLxFT8tDBKB20WI T/TdYzv/S7MD4ZnOrFMAicTlT/big37HrPosOnCOE5Yc/OfFLSYQ1lVkkjj4YeGyBI7G vKu2twE1XrkzTQ1dhY5GCWKqToQOXI45Ppa4W9OHAoqA0KLo0NMeMHQWiIJifUHG526b DYKq824BMXM7ehpE0aixMmo5DNTxiGA21mLwKuUntvjaBZQ3azAai/u7OK3jIT0GtSC1 N2J4+nNG2sXYDSruwH4xWiekJuQAlCHSKpj/KX7l2FH6Od6LRzln1eWf5keg5XwwuKKU frgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HY+9ou92; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id t17si2958883ejs.93.2020.12.17.04.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 04:11:45 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HY+9ou92; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5F72F82BCE; Thu, 17 Dec 2020 13:11:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com 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=samsung.com header.i=@samsung.com header.b="HY+9ou92"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C6F682BBD; Thu, 17 Dec 2020 13:11:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C496D82BAD for ; Thu, 17 Dec 2020 13:10:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201217121047euoutp01fe25239a6ab0c3f5ea8f010c89992910~Rf8n6zt4G1778717787euoutp01H for ; Thu, 17 Dec 2020 12:10:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201217121047euoutp01fe25239a6ab0c3f5ea8f010c89992910~Rf8n6zt4G1778717787euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608207047; bh=MxT3AujAex65msl7ZgW5g5E+GqdY6NnpkjtkNalxiXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HY+9ou92W5zNifpflG6dLazs0Si8JAEar+4hwdzt/b5DL+5UIa91viEqBFGFe6nyN +RJ3hv2duoqZdA7WgiYR2EVMeLpYD6ubuvXuJHUwHjurhlfg245V0AgqCJucx92HpG qkBEYKhJHbWsrpJZbRKwCqsqD5sxaPKtyzW0JPIw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201217121041eucas1p1a374472df1a0d7e316ccaa9d081879a8~Rf8i1UzOx1918619186eucas1p1M; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 29.C8.27958.1CA4BDF5; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a~Rf8iX0d1W1507615076eucas1p1m; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201217121041eusmtrp247ed029d5bb02f447fc615c677fe54a9~Rf8iXK79-1810618106eusmtrp2i; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) X-AuditID: cbfec7f2-f15ff70000006d36-23-5fdb4ac11a87 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 94.08.16282.1CA4BDF5; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201217121040eusmtip102ccc212240b49b3c00d31fe8786e2dc~Rf8h8A3Pz0407904079eusmtip1n; Thu, 17 Dec 2020 12:10:40 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH 1/5] dfu: mmc: use the default MMC device if entity specifies it as -1 Date: Thu, 17 Dec 2020 13:10:26 +0100 Message-Id: <20201217121030.6352-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201217121030.6352-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsWy7djPc7oHvW7HG0yaYmqxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBHcdmkpOZklqUW6dsl cGVcvf+UrWAGT8Wzu19ZGhg/cHYxcnJICJhILL6xlLWLkYtDSGAFo8SvWd1sEM4XRomT828x QjifGSW6u/czwbQcWn0bKrGcUeLQzvcscC0Tt7UzglSxCRhKdL3tYgOxRQQkJH71XwWLMwtc ZJT4/d8YxBYWiJCY/KudFcRmEVCV6Jy+DKyGV8BGYv/fnSwQ2+QlVm84wAxicwrYSnScfAd2 n4RAK4fE9UnvWSGKXCS23HrNDGELS7w6voUdwpaR+L9zPhNEQzOjxMNza9khnB5GictNMxgh qqwl7pz7BTSWA+g8TYn1u/Qhwo4SZ47NYAcJSwjwSdx4KwjxAJ/EpG3TmSHCvBIdbUIQ1WoS s46vg1t78MIlqHM8JCZ+XgwN0wmMEl0vGpkmMMrPQli2gJFxFaN4amlxbnpqsWFearlecWJu cWleul5yfu4mRmAyOP3v+KcdjHNffdQ7xMjEwXiIUYKDWUmEN+HAzXgh3pTEyqrUovz4otKc 1OJDjNIcLErivKtmr4kXEkhPLEnNTk0tSC2CyTJxcEo1MGm4lHC3HO9YJDB598/Tuf/fpt5q e65QU+54r61uly7notluT+MXletbtXT8/3/C9sSagsTnc7Q2NP23u9Gzp1FirdKLoEL7/5tV lf5tuNfhe1ec89R5v+TGB+s+LNLZ8nnt7Ixoj5onopJqO+0ulu/YubYkUfJW1ncuFd8Vn7we byjyvyhZorjTMPmzts9h5o0LHOMFc28mm1cvO6aX/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vgLPp88Vn0p4cJuA+lARb2wD1ul0xlmtyq1x5Zxr3gskLL5joRj /HRdJZbijERDLeai4kQAWKCGONYCAAA= X-CMS-MailID: 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a X-Msg-Generator: CA X-RootMTR: 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a References: <20201217121030.6352-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Use the default MMC device set in the command line if entity specifies it as -1. This allows to use the same dfu_alt_info string for different MMC devices (like embedded eMMC and external SD card if data layout is the same on both devices). Signed-off-by: Marek Szyprowski --- drivers/dfu/dfu_mmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index 691d01c7eb..784d0ec76b 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -316,7 +316,7 @@ void dfu_free_entity_mmc(struct dfu_entity *dfu) int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) { const char *entity_type; - size_t second_arg; + ssize_t second_arg; size_t third_arg; struct mmc *mmc; @@ -339,7 +339,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8, * with default 10. */ - second_arg = simple_strtoul(argv[1], NULL, 0); + second_arg = simple_strtol(argv[1], NULL, 0); third_arg = simple_strtoul(argv[2], NULL, 0); mmc = find_mmc_device(dfu->data.mmc.dev_num); @@ -406,7 +406,8 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) /* if it's NOT a raw write */ if (strcmp(entity_type, "raw")) { - dfu->data.mmc.dev = second_arg; + dfu->data.mmc.dev = (second_arg != -1) ? second_arg : + dfu->data.mmc.dev_num; dfu->data.mmc.part = third_arg; }