From patchwork Tue Nov 27 20:53:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1004010 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SPIAc/5x"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="O/EJH9zq"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434GHN5XN0z9s0t for ; Wed, 28 Nov 2018 07:54:24 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jleRBnhIUtXDEVs1cSNBHTuNKV5RSkm07WmSgsaShd4=; b=SPIAc/5xZa4oE8 /PZwBIaM5cdIdSVUOIBqh+v4tVJsOJ0naa23ACgAgccYaGc6EVcNHNNYNKuiT9e2JUfnwq6DTusD6 Fp0Qnl8jU8ADndDQZeT9Guw+LMRv1QQbD4Mww2l+mTQbs478RaQaCRQ5ERfZ584vr+c3pd8IjwD/U mpyvzVCpCi/y885uQQI/NvEnPclW0S5G3udQOKVinNj553WnMzrSrWjFgbwrUJljJrZZDHyuh3l4f mZb7Gkt7SSHBcmqBT5rLbC6B6xnReW+VZ4U85tElxlKLH0JBD4xerLUUmR+sRZ4i60Ym53WIg8ocN aFRGfPB6fgzgurl7t4kg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRkNA-0007sI-LP; Tue, 27 Nov 2018 20:54:20 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRkN7-0007rP-22 for linux-mtd@lists.infradead.org; Tue, 27 Nov 2018 20:54:18 +0000 Received: by mail-lj1-x243.google.com with SMTP id k19-v6so21338051lji.11 for ; Tue, 27 Nov 2018 12:54:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hdJFNJ9DXPfwPzK/fB9QhlU5ENVRXnCa/SVXN/8gfGE=; b=O/EJH9zq1r80lm4QhUnRxfUOCz/G0mQqY6+Wz2BZuJSdHnxr+OqI6VKcR1h5MUmuqa ILaV66LEut7AaQsc4LBy+EckmJCbcCSzjfb1JVVK51HyKXHgC6+LKQsTTZBPlG0WyiS5 UBs/hvQgsybqilrVKy8+gaAzKkvzOIKReEwDk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hdJFNJ9DXPfwPzK/fB9QhlU5ENVRXnCa/SVXN/8gfGE=; b=i4EZU8Ktk6O5+j/U+AJ5WEGgsiYQFU2DOWNYyDWjevqqg2jWJcDBVii6f7J2e4R/XX w5PNZCWRflaAY4YDDtZJCUZAVGR0gtr/gaN+GqKQ4P0Sby7GvEDU4D4Z1jlImLWygK7h tOgbbt5XxfeSxfM5VXE3G2HMJk4ACCDk3NTHVTY8SSF8cvTx6GZ54aDcIxmm+Z0yYhwy A71PeGNNJJ/80EG7zyu7nb3hosmO2BqlWH+5pGMr2J+DUPecXVy2IRX3WtFLrVqdJtOx 4jyUS4uXiUAJdw15jQqQVLnsYNF4a+UwfNLh+FfGH8+OglgK/JHx1VT53goYLPiE9Avt jwZg== X-Gm-Message-State: AA+aEWalzP1TCFrPJ/RoqPCcjEwbbkIvbS/vR/zASUu5XAjIK0X26zaV Ufw/kmdyuvmF+/YWNeTBBvf53g== X-Google-Smtp-Source: AFSGD/Up2b1tgT1bEthpiJwXaRGqSyW2ku3myGQG3MHQ6K1hAZxgYZyF12kjrawJ5ciNb9K9KMkPzA== X-Received: by 2002:a2e:9603:: with SMTP id v3-v6mr18075221ljh.15.1543352043671; Tue, 27 Nov 2018 12:54:03 -0800 (PST) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id k3-v6sm784625lja.8.2018.11.27.12.54.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 12:54:02 -0800 (PST) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 1/2 v3] mtd: maps: Leave assigned complex mappings Date: Tue, 27 Nov 2018 21:53:57 +0100 Message-Id: <20181127205358.32502-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181127_125417_094971_BCD9397C X-CRM114-Status: GOOD ( 17.07 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The simple_map_init() may need to be called with some function pointers already assigned for complex mappings, just bail out if complex handlers have already been assigned. Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Move check for pre-initialized simple map into physmap-core.c ChangeLog v1->v2: - Rebase on latest MTD development branch - Use a new approach as the code changed under me --- drivers/mtd/maps/physmap-core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c index e8c3b250d842..ecca7784de06 100644 --- a/drivers/mtd/maps/physmap-core.c +++ b/drivers/mtd/maps/physmap-core.c @@ -514,10 +514,16 @@ static int physmap_flash_probe(struct platform_device *dev) err = physmap_addr_gpios_map_init(&info->maps[i]); if (err) goto err_out; - } else { - simple_map_init(&info->maps[i]); } + /* + * Only use the simple_map implementation if map hooks are not + * implemented. Since map->read() is mandatory checking for its + * presence is enough. + */ + if (!info->maps[i].read) + simple_map_init(&info->maps[i]); + if (info->probe_type) { info->mtds[i] = do_map_probe(info->probe_type, &info->maps[i]);