Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4082862ybi; Tue, 18 Jun 2019 11:27:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7wEZYFFAaVzkDhHJqfm/qV9erdxa2WOfUYvHukyO1RxKtti6/KVMDLmuDOk2IkH90XLem X-Received: by 2002:a17:902:b944:: with SMTP id h4mr112017450pls.179.1560882460139; Tue, 18 Jun 2019 11:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560882460; cv=none; d=google.com; s=arc-20160816; b=0KTBHfeAO6wIxtm+x55CKBMQ+lHQ5b/8SkHQn43MLXTYK+zhNPFzTXHe+G0IxFEwhi q9aLHonh8c0wZCyDkE8L6mxRPG8hQrdeDkzkdM5YvwdpW4UiRMCqdmB4uOJkm2G4O9LP b4XrccWOD0fiapy0YYPuPvqQWt9SXVoUHpDcBWceI+uNcsQVjxMerZAY3P9g1S+59Sl/ +pLx75zEsXaZ5W3YhGSHwq1wJ5AT9a1ZZbJuihCt6sbgNXZ9tLp+KfDK60TYVkGmPgm7 iQs8gZGp6rKPxE5Dd/G5FDHaRHTIXmf+kxtpFIpNyaLd85MK7MS3mwZO/2SG3HQa1jrD s+EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=mO472utuFQ+nV4A29aUiVfjK/XWRxLa6xDQ8sQgJqmI=; b=zbWxwRatG/8KGqUMsm49IQmyVV1TMuU7d3gfobfr0V8LE93AnfT816FWQVom8RfyS9 seLP56LUN5cWr1YzcvY3t1E+wYxmV/rH8U5Qz8Xgn9s8qK4XXaQc3XGBzx8sA6dhIQxI a9GRimBy3VYed57W+iZXDE3D06LPHm17jidFA0tnzK2/NADmEFBxy20B2EXd3Th0VRk4 kNt8Qhps7EJI1Ve7qzts7FgQljT7BIbuMy6XCJiES9RiGfFwUjk1hO1w9ll/Y2RAwyjQ NH6qyklwZLegR2xHNd6hJLKvQHSKUyGgEsaTUeBqv8R1vJI6KK+5odajdpMnNkVBzHOB oH0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="R/sM1rUx"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si811442pgg.221.2019.06.18.11.27.24; Tue, 18 Jun 2019 11:27:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="R/sM1rUx"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730350AbfFRS1I (ORCPT + 99 others); Tue, 18 Jun 2019 14:27:08 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36310 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727616AbfFRS1I (ORCPT ); Tue, 18 Jun 2019 14:27:08 -0400 Received: by mail-pg1-f196.google.com with SMTP id f21so8150783pgi.3 for ; Tue, 18 Jun 2019 11:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=mO472utuFQ+nV4A29aUiVfjK/XWRxLa6xDQ8sQgJqmI=; b=R/sM1rUxhjbZRW6SG/PJTnw0z5LYinOBGI/dRLlrIOlSjumvc0CKHCyD+SMw89XEH6 O7uIcv+A5w/ApFurMpH4xh7R3mPPWYax8BkSssi4IrzM40/LE0nWs9C5qP0CBqnhw93d clouyVq+ZVdkUUfxHYdC0zSYpk71dNOtiQXtbtgazRGaEHxgXCbkPR/qnaWClOsp2shk D+KO0r0HepQKf8JCu2vxSMIVODaXsuBWxXTDpRPSXh7anxLjXJIfSKTzEYJtvT/HaDmw X0GDP/F88ssZTO1V5Z7TRVHRwMb15k96oMB4LUW3bOjZgodr58GmQanpz/1i7OrY0SuN htEQ== 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; bh=mO472utuFQ+nV4A29aUiVfjK/XWRxLa6xDQ8sQgJqmI=; b=MefftpFlmoYfYVkInNXO3Z0GXKAqzElgrV+TMOu0j+oIQTTOLIimEGRRBDb3Kcxu7L LKsrYno6ugPz/Hd+Fg7uIB18oWXmSOR0pL8r77TFvEeHo6ZmQDSJtEF3aWOoCYHEyKwe u3N0wdxnKHJQ8Od14bLGrlHiPQhbCrm28d0knA/L0y9Iw1M/N2RceQzvOQLiYGfnTaao V00lvEJJ8vRs2XhsvubtkSWLVf5+dIFGcEkZOoYebY2NYXWjq4QdZyf82qMBQeImus4C W/kYRPPdnZCzuPEx2fYrnb1pHbUUXQqojUB/M+F3cV5g5eSQOSEuVAhztYGyR5CDcSgn l34A== X-Gm-Message-State: APjAAAW2sIKCPsglU9MNhUafE34Xs2ohJ4kBKNbd7msbLRS6RrW90ydx DdU08av1M2wBeO+Sp/R6JqM= X-Received: by 2002:a17:90a:9905:: with SMTP id b5mr6758464pjp.70.1560882427917; Tue, 18 Jun 2019 11:27:07 -0700 (PDT) Received: from mail.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id k4sm6639480pfk.42.2019.06.18.11.27.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 11:27:07 -0700 (PDT) From: Kamal Dasu To: linux-mtd@lists.infradead.org Cc: bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, Kamal Dasu , David Woodhouse , Brian Norris , Marek Vasut , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Subject: [PATCH v4 1/2] mtd: Add flag to indicate panic_write Date: Tue, 18 Jun 2019 14:26:42 -0400 Message-Id: <1560882420-727-1-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Added a flag to indicate a panic_write so that low level drivers can use it to take required action where applicable, to ensure oops data gets written to assigned mtd device. Signed-off-by: Kamal Dasu --- drivers/mtd/mtdcore.c | 3 +++ include/linux/mtd/mtd.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 453242d..2e04627 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1124,6 +1124,9 @@ int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, return -EROFS; if (!len) return 0; + + mtd->panic_write_triggered = true; + return mtd->_panic_write(mtd, to, len, retlen, buf); } EXPORT_SYMBOL_GPL(mtd_panic_write); diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 936a3fd..02dce49 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -316,6 +316,12 @@ struct mtd_info { int (*_get_device) (struct mtd_info *mtd); void (*_put_device) (struct mtd_info *mtd); + /* + * flag indicates a panic write, low level drivers can take appropriate + * action if required to ensure writes go through + */ + bool panic_write_triggered; + struct notifier_block reboot_notifier; /* default mode before reboot */ /* ECC status information */ -- 1.9.0.138.g2de3478