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: <201306080354.03424.sergei.shtylyov@cogentembedded.com>
Date:	Sat, 8 Jun 2013 03:54:02 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	netdev@...r.kernel.org
Cc:	nobuhiro.iwamatsu.yj@...esas.com, linux-sh@...r.kernel.org
Subject: [PATCH 1/9] sh_eth: create initial ID table

We are trying to get away from the current driver's scheme of identifying a SoC
based on #ifdef's and the platform device ID table matching seems to be a good
replacement -- we can use the 'driver_data' field of 'struct platform_device_id'
as a pointer to a 'struct sh_eth_cpu_data'. Start by creating the initial table
with driver's name as the only entry without the driver data. Check  the driver
data in the probe() method and if it's not NULL override 'mdp->cd' from it.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2519,6 +2519,7 @@ static int sh_eth_drv_probe(struct platf
 	struct net_device *ndev = NULL;
 	struct sh_eth_private *mdp = NULL;
 	struct sh_eth_plat_data *pd = pdev->dev.platform_data;
+	const struct platform_device_id *id = platform_get_device_id(pdev);
 
 	/* get base addr */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2582,6 +2583,8 @@ static int sh_eth_drv_probe(struct platf
 #else
 	mdp->cd = &sh_eth_my_cpu_data;
 #endif
+	if (id->driver_data)
+		mdp->cd = (struct sh_eth_cpu_data *)id->driver_data;
 	sh_eth_set_default_cpu_data(mdp->cd);
 
 	/* set function */
@@ -2696,9 +2699,16 @@ static const struct dev_pm_ops sh_eth_de
 #define SH_ETH_PM_OPS NULL
 #endif
 
+static struct platform_device_id sh_eth_id_table[] = {
+	{ CARDNAME },
+	{ }
+};
+MODULE_DEVICE_TABLE(platform, sh_eth_id_table);
+
 static struct platform_driver sh_eth_driver = {
 	.probe = sh_eth_drv_probe,
 	.remove = sh_eth_drv_remove,
+	.id_table = sh_eth_id_table,
 	.driver = {
 		   .name = CARDNAME,
 		   .pm = SH_ETH_PM_OPS,
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ