From patchwork Thu Oct 31 06:27:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Domenico Andreoli X-Patchwork-Id: 3118831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4BDCFBF924 for ; Thu, 31 Oct 2013 06:31:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A9A9203DF for ; Thu, 31 Oct 2013 06:31:17 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F32CA203DC for ; Thu, 31 Oct 2013 06:31:15 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VblmQ-0004k0-8y; Thu, 31 Oct 2013 06:30:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VblmK-0008HO-Eu; Thu, 31 Oct 2013 06:30:48 +0000 Received: from mail-ee0-x22d.google.com ([2a00:1450:4013:c00::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vbllz-0008Bs-MP for linux-arm-kernel@lists.infradead.org; Thu, 31 Oct 2013 06:30:28 +0000 Received: by mail-ee0-f45.google.com with SMTP id e50so1113558eek.18 for ; Wed, 30 Oct 2013 23:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:user-agent:date:from:to:cc:subject:references :content-disposition; bh=xntVPox+dayX11Zsz1iA71apm+QRF+2OZ6aVFgk/q9I=; b=o5kbFzei9zD72chmfmh6r6xNmemwIl/kswWPaSN7EyLJDwG6ANu+Xojv8cv4EmyJn2 X+o7V/fZTWgEF+n6DqCWzXzk3Go7wubbOsgBHUuaXOJTnwC394CH69PiVuC8SxYL8KUr b1P0RrmWseEfcCr4SKeHdD7uvweVli/F1A7S7+/g7Q/+WQyOO0ZOdtat7Mipzx5A9xoo TYLniz29R/mzlCEm1dk204Kkpb7xfFGAGrQKDrjpQcBmwValVHf/mtF2ami8R8pMH+R7 WX9NrhRERYoIoUdxv0QrfmlWr35K4O8kSv39ff9qEwVtwEjxYbrfPZTO4KRdl6PeLM0G /ZrQ== X-Received: by 10.14.213.133 with SMTP id a5mr313552eep.133.1383201005828; Wed, 30 Oct 2013 23:30:05 -0700 (PDT) Received: from shock.dandreoli.com (j115181.upc-j.chello.nl. [24.132.115.181]) by mx.google.com with ESMTPSA id i1sm4512973eeg.0.2013.10.30.23.30.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Oct 2013 23:30:04 -0700 (PDT) Received: by shock.dandreoli.com (Postfix, from userid 1000) id C1FC5340274; Thu, 31 Oct 2013 07:29:59 +0100 (CET) Message-Id: <20131031062959.454193773@linux.com> User-Agent: quilt/0.60-1 Date: Thu, 31 Oct 2013 07:27:13 +0100 From: Domenico Andreoli To: linux-arch@vger.kernel.org Subject: [PATCH 05/11] ARM: vexpress: consolidate machine reset func References: <20131031062708.520968323@linux.com> Content-Disposition: inline; filename=arm-machine-reset-vexpress-enum.patch X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131031_023027_888660_923FB62E X-CRM114-Status: GOOD ( 13.69 ) X-Spam-Score: -1.9 (-) Cc: Russell King , Arnd Bergmann , Ralf Baechle , Domenico Andreoli , linux-mips@lvger.kernel.org, Olof Johansson , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 From: Domenico Andreoli Proof of concept: vexpress as provider of reset hooks. Enum consolidation. Cc: Russell King Cc: Arnd Bergmann Cc: Olof Johansson Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Domenico Andreoli --- drivers/power/reset/vexpress-poweroff.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) Index: b/drivers/power/reset/vexpress-poweroff.c =================================================================== --- a/drivers/power/reset/vexpress-poweroff.c +++ b/drivers/power/reset/vexpress-poweroff.c @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -75,58 +76,52 @@ DEVICE_ATTR(active, S_IRUGO | S_IWUSR, v vexpress_reset_active_store); -enum vexpress_reset_func { FUNC_RESET, FUNC_SHUTDOWN, FUNC_REBOOT }; - static struct of_device_id vexpress_reset_of_match[] = { { .compatible = "arm,vexpress-reset", - .data = (void *)FUNC_RESET, + .data = (void *) RESET_RESTART, }, { .compatible = "arm,vexpress-shutdown", - .data = (void *)FUNC_SHUTDOWN + .data = (void *) RESET_POWER_OFF, }, { .compatible = "arm,vexpress-reboot", - .data = (void *)FUNC_REBOOT + .data = (void *) RESET_RESTART, }, {} }; static int vexpress_reset_probe(struct platform_device *pdev) { - enum vexpress_reset_func func; + enum reset_func func; const struct of_device_id *match = of_match_device(vexpress_reset_of_match, &pdev->dev); if (match) - func = (enum vexpress_reset_func)match->data; + func = (enum reset_func) match->data; else func = pdev->id_entry->driver_data; switch (func) { - case FUNC_SHUTDOWN: + case RESET_POWER_OFF: vexpress_power_off_device = &pdev->dev; pm_power_off = vexpress_power_off; break; - case FUNC_RESET: - if (!vexpress_restart_device) - vexpress_restart_device = &pdev->dev; - arm_pm_restart = vexpress_restart; - device_create_file(&pdev->dev, &dev_attr_active); - break; - case FUNC_REBOOT: + case RESET_RESTART: vexpress_restart_device = &pdev->dev; arm_pm_restart = vexpress_restart; device_create_file(&pdev->dev, &dev_attr_active); break; + default: + return -EINVAL; }; return 0; } static const struct platform_device_id vexpress_reset_id_table[] = { - { .name = "vexpress-reset", .driver_data = FUNC_RESET, }, - { .name = "vexpress-shutdown", .driver_data = FUNC_SHUTDOWN, }, - { .name = "vexpress-reboot", .driver_data = FUNC_REBOOT, }, + { .name = "vexpress-reset", .driver_data = RESET_RESTART, }, + { .name = "vexpress-shutdown", .driver_data = RESET_POWER_OFF, }, + { .name = "vexpress-reboot", .driver_data = RESET_RESTART, }, {} };