lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1214817676-30378-4-git-send-email-haavard.skinnemoen@atmel.com>
Date:	Mon, 30 Jun 2008 11:21:11 +0200
From:	Haavard Skinnemoen <haavard.skinnemoen@...el.com>
To:	kernel@...32linux.org
Cc:	linux-kernel@...r.kernel.org,
	Haavard Skinnemoen <hskinnemoen@...el.com>,
	Haavard Skinnemoen <haavard.skinnemoen@...el.com>,
	Jeff Garzik <jeff@...zik.org>,
	Patrice Vilchez <patrice.vilchez@....atmel.com>,
	Nicolas FERRE <nicolas.ferre@....atmel.com>
Subject: [PATCH 3/8] macb: Basic suspend/resume support

From: Haavard Skinnemoen <hskinnemoen@...el.com>

This implements suspend and resume callbacks for the macb driver. We may
have to do some more to gracefully shut the MAC down, but this at least
prevents the macb from waking the system when hooked up to a busy
network.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@...el.com>
Cc: Jeff Garzik <jeff@...zik.org>
Cc: Patrice Vilchez <patrice.vilchez@....atmel.com>
Cc: Nicolas FERRE <nicolas.ferre@....atmel.com>
---
 drivers/net/macb.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 92dccd4..0a5745a 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1277,8 +1277,45 @@ static int __exit macb_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int macb_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct net_device *netdev = platform_get_drvdata(pdev);
+	struct macb *bp = netdev_priv(netdev);
+
+	netif_device_detach(netdev);
+
+#ifndef CONFIG_ARCH_AT91
+	clk_disable(bp->hclk);
+#endif
+	clk_disable(bp->pclk);
+
+	return 0;
+}
+
+static int macb_resume(struct platform_device *pdev)
+{
+	struct net_device *netdev = platform_get_drvdata(pdev);
+	struct macb *bp = netdev_priv(netdev);
+
+	clk_enable(bp->pclk);
+#ifndef CONFIG_ARCH_AT91
+	clk_enable(bp->hclk);
+#endif
+
+	netif_device_attach(netdev);
+
+	return 0;
+}
+#else
+#define macb_suspend	NULL
+#define macb_resume	NULL
+#endif
+
 static struct platform_driver macb_driver = {
 	.remove		= __exit_p(macb_remove),
+	.suspend	= macb_suspend,
+	.resume		= macb_resume,
 	.driver		= {
 		.name		= "macb",
 		.owner	= THIS_MODULE,
-- 
1.5.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ