Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1607775pxb; Mon, 11 Oct 2021 09:22:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXf+JqTBbZwCA9/YV+2jRQF81A2fcx10Sn6KNZWeWfEtIbENlokNycPISDbCN1ASyFe0sE X-Received: by 2002:a17:90a:2902:: with SMTP id g2mr31165728pjd.161.1633969376992; Mon, 11 Oct 2021 09:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633969376; cv=none; d=google.com; s=arc-20160816; b=FVp9jCUQWVYzQSQDreRHK4dQ+9F8M5P93N5ZXIdhKX3I2uz/SO1QQxWfQFGOHotgj+ u8vo9tp9HB4Erg3UfqaDKMtAxntecfPYeKwubNXSLqy33dK56dwhO2eCNvlix98TYy5y KY5lRRdrxJ66rc1ekt+fuCLUoC1aw8kAGVUjpTjNTzp/C0NU5mkl+mdn5o+m2s/EQ2tL fYc3plBu3FK5lIA5OKlTUouf4dtHUH/Qf9W9c4hB46tACuG9AKEse/A3PwWAQQzFlKho nUcW8dnwwBri6XgnN91q4YJqApFYnZinG1FcJxvOafBouFOrQgnsp0ZUbVc88DC2qUg/ 58Tg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9Wj6OFs+DF4AuNIHnFi6b0zAic9dZhR8GD6mlH8fchY=; b=WJnzyTkbjM+7c8B7XS0J0Qqeu16yf6tbfj1OyIJ9agESLe0klMD6/YZsB1dzI1H6SK JO6pWIjot4Z7LCROsPQzbeDNU6NiJtKNJdNpEBhS5LZn/emqyqx94EvTA+05JhuDUVrH /283+GWzoul9MqoiMg2iPz5kQ3YSrb5X7KVOggdXyh+ssCu4yuaCSstzQz/ze3UQovj8 q20WB/b9ywrvFJu93PUipGvpd0gEr88aoY2UST2zH2Lw0YCYvW9oJ9OtPk1XyVqBxTQe kcarb61qKFvo+FexFCAnfKM1h2ePmPS6aG3OR7N4GncoNytCHwq6QMUSgyNHSV1KSZua 68tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b="cLbnL/2o"; 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 l193si10787884pge.180.2021.10.11.09.22.43; Mon, 11 Oct 2021 09:22:56 -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="cLbnL/2o"; 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 S236320AbhJKLzW (ORCPT + 99 others); Mon, 11 Oct 2021 07:55:22 -0400 Received: from first.geanix.com ([116.203.34.67]:37364 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236303AbhJKLzS (ORCPT ); Mon, 11 Oct 2021 07:55:18 -0400 Received: from zen.. (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id 1407DC3DB1; Mon, 11 Oct 2021 11:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1633953197; bh=34RYAExQV2GpY9VYCNMKcw7k5EiKJcu+XcF5wGblsM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cLbnL/2oqSJXV6k+rEsBn8xJ6hh2Uy0h9AV9bhlXm1qH4AVfcRSAwGvYc1YbKpZ9f GzxqKaLnTvcKgrnZasC/r54GYgLLJw5lk26xT/SzqdPUEDK649rqdbLu+R3JYUMgbX +1tjer7lxABiiU8+xKDkE3QKxaY3INCKEPQmpclczGta4CsMidBH+7Jx+SamO5MSZV 6ZUYirx6U3cwvs1dUFU/xGXC2avs2hq8iUhXhsiZzfLXowdb3vr4RsYLhG6F6i+Vug Tdl4G4HBuhPY01882a2GJJZeI5uz9obr9uwFpzrhGioz/0Ld5bXFjrRugPFySy8Rqp Qu8CydY3xxLpw== 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 3/3] mtd: mtdconcat: add suspend lock handling Date: Mon, 11 Oct 2021 13:52:53 +0200 Message-Id: <20211011115253.38497-4-sean@geanix.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211011115253.38497-1-sean@geanix.com> References: <20211011115253.38497-1-sean@geanix.com> 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 Use new suspend lock handling for this special case for concatenated MTD devices. Fixes: 013e6292aaf5 ("mtd: rawnand: Simplify the locking") Signed-off-by: Sean Nyekjaer --- drivers/mtd/mtdconcat.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index f685a581df48..c497c851481f 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -561,25 +561,32 @@ static void concat_sync(struct mtd_info *mtd) static int concat_suspend(struct mtd_info *mtd) { + struct mtd_info *master = mtd_get_master(mtd); struct mtd_concat *concat = CONCAT(mtd); int i, rc = 0; for (i = 0; i < concat->num_subdev; i++) { struct mtd_info *subdev = concat->subdev[i]; - if ((rc = mtd_suspend(subdev)) < 0) + + down_write(&master->master.suspend_lock); + if ((rc = __mtd_suspend(subdev)) < 0) return rc; + up_write(&master->master.suspend_lock); } return rc; } static void concat_resume(struct mtd_info *mtd) { + struct mtd_info *master = mtd_get_master(mtd); struct mtd_concat *concat = CONCAT(mtd); int i; for (i = 0; i < concat->num_subdev; i++) { struct mtd_info *subdev = concat->subdev[i]; - mtd_resume(subdev); + down_write(&master->master.suspend_lock); + __mtd_resume(subdev); + up_write(&master->master.suspend_lock); } } -- 2.33.0