All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joachim Eastwood <manabian@gmail.com>
To: arnd@arndb.de, peppe.cavallaro@st.com
Cc: Joachim Eastwood <manabian@gmail.com>,
	netdev@vger.kernel.org, davem@davemloft.net,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next 03/11] stmmac: prepare stmmac platform to support stand alone drivers
Date: Thu, 14 May 2015 12:10:58 +0200	[thread overview]
Message-ID: <1431598266-25736-4-git-send-email-manabian@gmail.com> (raw)
In-Reply-To: <1431598266-25736-1-git-send-email-manabian@gmail.com>

Prepare the stmmac platform code to support standalone drivers
by exporting the need functions and having of_match_device use
the match table reference already present in the driver struct.

This will allow us to reuse the platform driver functions from
this code easily in other stand alone platform drivers.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 14 +++++++++-----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h |  4 ++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ac7c8a2c631..0d1f1ec96bc0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -130,11 +130,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 	struct device_node *np = pdev->dev.of_node;
 	struct stmmac_dma_cfg *dma_cfg;
 	const struct of_device_id *device;
+	struct device *dev = &pdev->dev;
 
 	if (!np)
 		return -ENODEV;
 
-	device = of_match_device(stmmac_dt_ids, &pdev->dev);
+	device = of_match_device(dev->driver->of_match_table, dev);
 	if (!device)
 		return -ENODEV;
 
@@ -269,7 +270,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
  * the necessary platform resources, invoke custom helper (if required) and
  * invoke the main probe function.
  */
-static int stmmac_pltfr_probe(struct platform_device *pdev)
+int stmmac_pltfr_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	struct resource *res;
@@ -375,6 +376,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
 
 /**
  * stmmac_pltfr_remove
@@ -382,7 +384,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
  * Description: this function calls the main to free the net resources
  * and calls the platforms hook and release the resources (e.g. mem).
  */
-static int stmmac_pltfr_remove(struct platform_device *pdev)
+int stmmac_pltfr_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
@@ -396,6 +398,7 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -439,8 +442,9 @@ static int stmmac_pltfr_resume(struct device *dev)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops,
-			 stmmac_pltfr_suspend, stmmac_pltfr_resume);
+SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
+				       stmmac_pltfr_resume);
+EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
 
 static struct platform_driver stmmac_pltfr_driver = {
 	.probe = stmmac_pltfr_probe,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 59fe8fb46a48..5be0b101bffd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -19,6 +19,10 @@
 #ifndef __STMMAC_PLATFORM_H__
 #define __STMMAC_PLATFORM_H__
 
+int stmmac_pltfr_probe(struct platform_device *pdev);
+int stmmac_pltfr_remove(struct platform_device *pdev);
+extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
+
 extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
-- 
1.8.0

WARNING: multiple messages have this Message-ID (diff)
From: manabian@gmail.com (Joachim Eastwood)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next 03/11] stmmac: prepare stmmac platform to support stand alone drivers
Date: Thu, 14 May 2015 12:10:58 +0200	[thread overview]
Message-ID: <1431598266-25736-4-git-send-email-manabian@gmail.com> (raw)
In-Reply-To: <1431598266-25736-1-git-send-email-manabian@gmail.com>

Prepare the stmmac platform code to support standalone drivers
by exporting the need functions and having of_match_device use
the match table reference already present in the driver struct.

This will allow us to reuse the platform driver functions from
this code easily in other stand alone platform drivers.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 14 +++++++++-----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h |  4 ++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 1ac7c8a2c631..0d1f1ec96bc0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -130,11 +130,12 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 	struct device_node *np = pdev->dev.of_node;
 	struct stmmac_dma_cfg *dma_cfg;
 	const struct of_device_id *device;
+	struct device *dev = &pdev->dev;
 
 	if (!np)
 		return -ENODEV;
 
-	device = of_match_device(stmmac_dt_ids, &pdev->dev);
+	device = of_match_device(dev->driver->of_match_table, dev);
 	if (!device)
 		return -ENODEV;
 
@@ -269,7 +270,7 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
  * the necessary platform resources, invoke custom helper (if required) and
  * invoke the main probe function.
  */
-static int stmmac_pltfr_probe(struct platform_device *pdev)
+int stmmac_pltfr_probe(struct platform_device *pdev)
 {
 	int ret = 0;
 	struct resource *res;
@@ -375,6 +376,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
 
 /**
  * stmmac_pltfr_remove
@@ -382,7 +384,7 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
  * Description: this function calls the main to free the net resources
  * and calls the platforms hook and release the resources (e.g. mem).
  */
-static int stmmac_pltfr_remove(struct platform_device *pdev)
+int stmmac_pltfr_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct stmmac_priv *priv = netdev_priv(ndev);
@@ -396,6 +398,7 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -439,8 +442,9 @@ static int stmmac_pltfr_resume(struct device *dev)
 }
 #endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops,
-			 stmmac_pltfr_suspend, stmmac_pltfr_resume);
+SIMPLE_DEV_PM_OPS(stmmac_pltfr_pm_ops, stmmac_pltfr_suspend,
+				       stmmac_pltfr_resume);
+EXPORT_SYMBOL_GPL(stmmac_pltfr_pm_ops);
 
 static struct platform_driver stmmac_pltfr_driver = {
 	.probe = stmmac_pltfr_probe,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
index 59fe8fb46a48..5be0b101bffd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
@@ -19,6 +19,10 @@
 #ifndef __STMMAC_PLATFORM_H__
 #define __STMMAC_PLATFORM_H__
 
+int stmmac_pltfr_probe(struct platform_device *pdev);
+int stmmac_pltfr_remove(struct platform_device *pdev);
+extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
+
 extern const struct stmmac_of_data lpc18xx_dwmac_data;
 extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
-- 
1.8.0

  parent reply	other threads:[~2015-05-14 10:11 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 10:10 [PATCH net-next 00/11] convert stmmac glue layers into platform drivers Joachim Eastwood
2015-05-14 10:10 ` Joachim Eastwood
2015-05-14 10:10 ` [PATCH net-next 01/11] stmmac: add dwmac glue for NXP 18xx/43xx family Joachim Eastwood
2015-05-14 10:10   ` Joachim Eastwood
2015-05-14 10:10 ` [PATCH net-next 02/11] doc: dt: add documentation for nxp,lpc1850-dwmac Joachim Eastwood
2015-05-14 10:10   ` [PATCH net-next 02/11] doc: dt: add documentation for nxp, lpc1850-dwmac Joachim Eastwood
2015-05-14 10:10 ` Joachim Eastwood [this message]
2015-05-14 10:10   ` [PATCH net-next 03/11] stmmac: prepare stmmac platform to support stand alone drivers Joachim Eastwood
2015-05-14 10:10 ` [PATCH net-next 04/11] stmmac: add a generic dwmac driver Joachim Eastwood
2015-05-14 10:10   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 05/11] stmmac: convert dwmac-lpc18xx to a platform driver Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 06/11] stmmac: convert dwmac-meson to " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 07/11] stmmac: convert dwmac-rk " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 08/11] stmmac: convert dwmac-socfpga " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 09/11] stmmac: convert dwmac-sti " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 10/11] stmmac: convert dwmac-sunxi " Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 10:11 ` [PATCH net-next 11/11] stmmac: drop driver from stmmac platform code Joachim Eastwood
2015-05-14 10:11   ` Joachim Eastwood
2015-05-14 15:24 ` [PATCH net-next 00/11] convert stmmac glue layers into platform drivers Chen-Yu Tsai
2015-05-14 15:24   ` Chen-Yu Tsai
     [not found]   ` <CAGb2v663efjkwgRjPdxV4CQxeesiu7jxkMf9j_oPU_bSHbNNiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-15  7:45     ` Giuseppe CAVALLARO
2015-05-15  7:45       ` Giuseppe CAVALLARO
     [not found]       ` <5555A42B.3040205-qxv4g6HH51o@public.gmane.org>
2015-05-15  8:44         ` Arnd Bergmann
2015-05-15  8:44           ` Arnd Bergmann
2015-05-15  9:11           ` Giuseppe CAVALLARO
2015-05-15  9:11             ` Giuseppe CAVALLARO
2015-05-14 19:53 ` Dinh Nguyen
2015-05-14 19:53   ` Dinh Nguyen
2015-05-14 19:53   ` Dinh Nguyen
2015-05-15 16:44 ` David Miller
2015-05-15 16:44   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431598266-25736-4-git-send-email-manabian@gmail.com \
    --to=manabian@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.