From patchwork Wed Aug 20 00:45:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 4746971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 39DDD9F3FF for ; Wed, 20 Aug 2014 00:48:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E88C200EC for ; Wed, 20 Aug 2014 00:48:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E17692016C for ; Wed, 20 Aug 2014 00:48:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJu31-0006yA-Rc; Wed, 20 Aug 2014 00:46:43 +0000 Received: from mail-pa0-x233.google.com ([2607:f8b0:400e:c03::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XJu2g-0006hl-3u for linux-arm-kernel@lists.infradead.org; Wed, 20 Aug 2014 00:46:22 +0000 Received: by mail-pa0-f51.google.com with SMTP id ey11so10798245pad.24 for ; Tue, 19 Aug 2014 17:46:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3YB9CfaDjp+8lYG7RI/02t2X0dq2ndo4m+oCaaP3XPs=; b=Jfjs3wBb8NSZGjXOJlcQhyaGx+baPhcTtBZss8G6SaVLvM8JJYNme9E0PGxaXRc0MJ 3cI+5wIJ4nSNwbBCFBWQeCTzD8CyHaGA22/xaseH9Fmc1c+JbHzYQnEEsS4VLMof0XuU qEgY6pDDyNPPMqNZV/DgKfFLea6aHzNkKA6wcbrN0eg0b3598Ywk0+WipcoiAG+hJHLZ +ieqVkWGYpAX6AVtb75cEBTFSwF9O2X/OIwVH172q4/C+mvf8SkW58p05zYDUjRQAGuf FgZqz81vGyUQYtuQqiqhNMdtOqVl2whx52lLXo5kDluDAsq0btu9IlPdNbzALTbRn8Ri /zWQ== X-Received: by 10.70.88.75 with SMTP id be11mr55043574pdb.69.1408495563278; Tue, 19 Aug 2014 17:46:03 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by mx.google.com with ESMTPSA id l3sm20535032pbq.8.2014.08.19.17.46.01 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 17:46:02 -0700 (PDT) From: Guenter Roeck To: Russell King , Wim Van Sebroeck , Catalin Marinas , Maxime Ripard , Andrew Morton Subject: [PATCH v7 04/11] arm: Support restart through restart handler call chain Date: Tue, 19 Aug 2014 17:45:31 -0700 Message-Id: <1408495538-27480-5-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408495538-27480-1-git-send-email-linux@roeck-us.net> References: <1408495538-27480-1-git-send-email-linux@roeck-us.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140819_174622_190993_22AFB9B8 X-CRM114-Status: GOOD ( 12.15 ) X-Spam-Score: -0.4 (/) Cc: linux-samsung-soc@vger.kernel.org, linux-watchdog@vger.kernel.org, Arnd Bergmann , linux-pm@vger.kernel.org, Dmitry Eremin-Solenikov , Tomasz Figa , Randy Dunlap , Will Deacon , linux-kernel@vger.kernel.org, Steven Rostedt , Jonas Jensen , Guenter Roeck , linux-doc@vger.kernel.org, David Woodhouse , Ingo Molnar , linux-arm-kernel@lists.infradead.org, Heiko Stuebner X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel core now supports a restart handler call chain for system restart functions. With this change, the arm_pm_restart callback is now optional, so drop its initialization and check if it is set before calling it. Only call the kernel restart handler if arm_pm_restart is not set. Signed-off-by: Guenter Roeck Acked-by: Catalin Marinas Acked-by: Heiko Stuebner Reviewed-by: Doug Anderson Tested-by: Doug Anderson Reviewed-by: Andreas Färber --- v7: Dropped null_restart and made arm_pm_restart truly optional. v6: No change. v5: Renamed restart function to do_kernel_restart v4: No change. v3: Use wrapper function to execute notifier call chain. v2: Only call notifier call chain if arm_pm_restart is not set. Do not include linux/watchdog.h. arch/arm/kernel/process.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 81ef686..ea279f7 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -114,17 +114,13 @@ void soft_restart(unsigned long addr) BUG(); } -static void null_restart(enum reboot_mode reboot_mode, const char *cmd) -{ -} - /* * Function pointers to optional machine specific functions */ void (*pm_power_off)(void); EXPORT_SYMBOL(pm_power_off); -void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd) = null_restart; +void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); EXPORT_SYMBOL_GPL(arm_pm_restart); /* @@ -230,7 +226,10 @@ void machine_restart(char *cmd) local_irq_disable(); smp_send_stop(); - arm_pm_restart(reboot_mode, cmd); + if (arm_pm_restart) + arm_pm_restart(reboot_mode, cmd); + else + do_kernel_restart(cmd); /* Give a grace period for failure to restart of 1s */ mdelay(1000);