Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1050626pxb; Tue, 26 Oct 2021 01:49:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwQc26BV6Bp0dBYJYFB5tEgaI1MVzxLxoHxQ8I7ZFBYeczqMDzms4NcTXtcVOLLfck9Nbs X-Received: by 2002:a17:907:e8b:: with SMTP id ho11mr2242631ejc.300.1635238177203; Tue, 26 Oct 2021 01:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635238177; cv=none; d=google.com; s=arc-20160816; b=HhIfGRgkCQQhj6OEc4OPbRKyOhBu7aR8auRyKYJBfOGJVvUXjFYIQnAZxoWSE6oB8W OrFTlwRFV5iRU2qnl/upFBlVo9hMUT3AyiSQoxLUPrr5AqzNsAPmngn926e7sBMGoRKY 6JVYyzcjg8lRKIzVnFHeSEkGKtvOiQND9+1msVQwxuYcvobpbHSJQ1WcVHaUGMUhxW32 8wVurfzBxhRF9dPCmHVon0deaBTLQvZgfaMeNHmBiOG6ZaFKyoSuy2kb2nxmuLm/xQGu dn3quGPyVApv3HnSw6pcinwpXkotM7Fw+7EbZa5jIe21ungXBcakMctlJWKM0sGU9kty hbiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3UgjaF8aC/Y45cgyZWp9zLZmViU0cbnVlqUE1w6U5x0=; b=i3ngLQWpasMRV+iP0IGcbs9jG1d6S/1Yh3K1zujceSX1qtkh2L9LK2Kl21RX2TBHo7 ljpcv+8fODxSv5c0z3Yd4NzDL4ehcwuNfpMNhsmsK2F6Rqh9P4qR2gYttb8231nBHoPm vtX8UlEYJt40J8gPGqLaSexm1HCQq4UmX/5MgqCHFeTJu7oAvn1frpRNysBNPbIjnF3j 6UwonjSt8htYaCxZIf3ls4m0VWrDu+oNMoU5iBNTayrMz/ZJO2J+5if7nllwfZYIJ4Lq JhOF4ihj0sb98KRFw0C5+EEuuG5JQ1/mYTf2CP9Lqqi/db9mTeCC2P4AQnj32yf3hUW2 //NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b="b2e8MNt/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qf32si34227953ejc.47.2021.10.26.01.49.12; Tue, 26 Oct 2021 01:49:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b="b2e8MNt/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235128AbhJZF6Z (ORCPT + 99 others); Tue, 26 Oct 2021 01:58:25 -0400 Received: from first.geanix.com ([116.203.34.67]:37410 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233555AbhJZF6Y (ORCPT ); Tue, 26 Oct 2021 01:58:24 -0400 Received: from zen.. (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id 029B8D6C1D; Tue, 26 Oct 2021 05:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1635227759; bh=h0WfNzdXW1YTJlL4xfDpH76ZL8VMf+fPy+pRovMxQhk=; h=From:To:Cc:Subject:Date; b=b2e8MNt/MPgJgdQzZljubImA+DHkFNu/NzcESXXESwMw2S8tROeSehhsj3ALT0Vu+ ueqlBBUehKnon+qtFd8pGadSx0v5Mvyaaq2EWVhWBiOA650cSNOzxyAYEJPT0/KSCe O7a8fL6wogSo6OmRIRb5tEOfLt8YSKqmNu10nrdiIRgvk8MFBr3VGDYjEmTWTUhi11 TSnT00gEwbDp3D1S4X03j2GxjKALTIlkBlJ4y0fb1AKvTMJkaq+uG2nrWLjB90rEXD CWI/Qdan6sG7jwvvGBC/GW/NNsCFtJdn1K0Cm1AGNa3RJMIPUWujsswFDBYFF27FtN auPSQzhlQgtSA== From: Sean Nyekjaer To: Boris Brezillon Cc: Sean Nyekjaer , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 0/4] mtd: core: protect access to mtd devices while in suspend Date: Tue, 26 Oct 2021 07:55:47 +0200 Message-Id: <20211026055551.3053598-1-sean@geanix.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=4.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=disabled version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 13e2a5895688 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Follow-up on discussion in: https://lkml.org/lkml/2021/10/4/41 https://lkml.org/lkml/2021/10/11/435 Changes since v3: - edited commit msg and author for mtdconcat patch Changes since v2: - added signoff's to patch from Boris - removed accidential line break - kept tests consistent: master->master.suspended == 0 -> !master->master.suspended - added comments to mtdconcat patch - moved mtdconcat before ('mtd: core: protect access to MTD devices while in suspend') Changes since v1: - removed __mtd_suspend/__mtd_resume functions as they are not used by mtdconcat anymore. - only master mtd_info is used for mtd_{start,end}_access(). Warn if we got mtd's. - added Boris patch for using uninitialized _suspend/_resume hooks when bbt scanning - mtdconcat uses device _suspend/_resume hooks - I don't really like the macro proposal from Boris mtd_no_suspend_void_call()/mtd_no_suspend_ret_call() I think they make the code complex to read and the macro's doesn't fit every where anyway... Changes since from rfc v1/v2: - added access protection for all device access hooks in mtd_info. - added Suggested-by to [1/3] patch. - removed refereces to commit ef347c0cfd61 ("mtd: rawnand: gpmi: Implement exec_op") from commit msg as commit 013e6292aaf5 ("mtd: rawnand: Simplify the locking") is to be blamed. - tested on a kernel with LOCKDEP enabled. Boris Brezillon (2): mtd: rawnand: nand_bbt: hide suspend/resume hooks while scanning bbt mtd: mtdconcat: don't use mtd_{suspend,resume}() Sean Nyekjaer (2): mtd: core: protect access to MTD devices while in suspend mtd: rawnand: remove suspended check drivers/mtd/mtdconcat.c | 15 +++- drivers/mtd/mtdcore.c | 124 +++++++++++++++++++++++++++---- drivers/mtd/nand/raw/nand_base.c | 52 ++++--------- drivers/mtd/nand/raw/nand_bbt.c | 28 ++++++- include/linux/mtd/mtd.h | 81 ++++++++++++++++---- include/linux/mtd/rawnand.h | 5 +- 6 files changed, 230 insertions(+), 75 deletions(-) -- 2.33.0