Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1280618pxb; Wed, 20 Oct 2021 01:46:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7diosDxF8JswDRu6TXxu/4DI+wBxRZdqYnhbHDnLJMeWTTYzwP4HAdHJ9plVBH2mGWWbi X-Received: by 2002:a17:90b:350c:: with SMTP id ls12mr5758170pjb.223.1634719610661; Wed, 20 Oct 2021 01:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634719610; cv=none; d=google.com; s=arc-20160816; b=pLKHM3CdSvBH65UUZ66d8sX6926iKtWVucvo7fIBck0T0Lvq5oSia1DtSw8x5vOaSk Q0t6xjMKvpqWpBsMikoUfbAePEZjM/HJdtm1dRJBAyM6S+ECYROQk//ZwkRfkCD9V2G7 BTHCn1qDl9zG7n2pTr3uwjPmKOdbZ8MzlhFz/scPeIwy0QotYkU4cFvc3j2UtGsTDVba EyzOJKtjxHL531UI6af/5x4lYs5nfrrCULkTjXB129NhdXVaok4oAV1XwyHydKmSYxyL GRKuqRoD+c0EKeAOqhuUqTcmwlzS/RyHX8o0Gbjl5HCwNuXYC2ga9KZhqBU0V5UaMYbt fKNA== 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=eJKmACEhDe2WfO+cqg9Jz9HtQnglPHZ3dZoA6Slm3i8=; b=WJnw+X52PfIct2kT38nE2hWHmskJYgALPgPNtw/HHrYtRddhxOypxQ/Wtq1PvNtp8S q9kiw7DXkNswfYu2xax1MpY4F6JeZoUHTbkNzjrHhdrQmEkCtBEYBdLV3cYbCTXqzK/3 mUJyu9bq6Q3oGX0uCJZFZJZ4vAk/vLvFhUPDIaflaxW3KhdcLx0b1GQf42NO1dXURxVX gFtzcrsVIe9Q857wY5xYQHpLmAsP0ajmdElCGYCXpBkIjL8P8gloul6MflceXzA6KxuN XnH6J8Lam9Wd1vSuu0kTS5+aTCIJbzIlkR8dsLqnPOgKEElCaVqFs3HRHIz2fjTeHDKu cJfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=Yl9RMwcr; 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 s2si2243051plk.12.2021.10.20.01.46.38; Wed, 20 Oct 2021 01:46:50 -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=Yl9RMwcr; 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 S229663AbhJTIr4 (ORCPT + 99 others); Wed, 20 Oct 2021 04:47:56 -0400 Received: from first.geanix.com ([116.203.34.67]:37384 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbhJTIry (ORCPT ); Wed, 20 Oct 2021 04:47:54 -0400 Received: from zen.. (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id 12558C7EB5; Wed, 20 Oct 2021 08:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1634719538; bh=U2cnM+X/mc5mK5tveSmn1kn/3Fb65kAhrB7Tiv1YV1k=; h=From:To:Cc:Subject:Date; b=Yl9RMwcrINNd04z4ITkvJSWFHDBHrzMtju7SHnR80RDUStKsSz8F0/SH+AUdhBbQk hlrjbPMOEu+enFUJGo5dU2FUFIgfPusaFq28ybjhOv8AJnBSisUNoe3Oi/eysyOqsl QWfl3RRc+uoIl5lOvRAQBKC4Uv6jtneqNV/SqNNagQdXfpA8zyxkIIiFCbwGH/3c1T GlPPzDeOw0DNn5nymhv6xAFkI17XxuqTjY5bSnTxdl9y3g1TblRSkoTTBZYBgnz2+U N6d+l3bU8KUfuLEUbMAD516HMMa/4LFlmShTOyEKSWjRCgZ1wz2pEUOlEbW26Jauzt h6bZGqFaK5qSg== 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 v2 0/4] mtd: core: protect access to mtd devices while in suspend Date: Wed, 20 Oct 2021 10:45:30 +0200 Message-Id: <20211020084534.2472305-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 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. Sean Nyekjaer (4): mtd: rawnand: nand_bbt: hide suspend/resume hooks while scanning bbt mtd: core: protect access to MTD devices while in suspend mtd: rawnand: remove suspended check mtd: mtdconcat: add suspend lock handling drivers/mtd/mtdconcat.c | 7 +- drivers/mtd/mtdcore.c | 131 +++++++++++++++++++++++++++---- 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, 227 insertions(+), 77 deletions(-) -- 2.33.0