linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] ASoC: mxs-saif: remove function in platform_data
@ 2011-11-11  9:29 Dong Aisheng
  2011-11-11 15:04 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Dong Aisheng @ 2011-11-11  9:29 UTC (permalink / raw)
  To: linux-arm-kernel

Add master_mode and master_id in platfrom_data since it's board
specific and board knows it.
Then we can remove the function pointer in platfrom_data to make
the driver more devicetree friendly.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
This patch is based on Sascha's suggestions and see using in
[PATCH v5 0/3] ARM: mxs: add recording support for saif
---
 include/sound/saif.h     |    4 ++--
 sound/soc/mxs/mxs-saif.c |   19 ++++++++-----------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/include/sound/saif.h b/include/sound/saif.h
index d0e0de7..f22f3e1 100644
--- a/include/sound/saif.h
+++ b/include/sound/saif.h
@@ -10,7 +10,7 @@
 #define __SOUND_SAIF_H__
 
 struct mxs_saif_platform_data {
-	int (*init) (void);
-	int (*get_master_id) (unsigned int saif_id);
+	bool master_mode;	/* if true use master mode */
+	int master_id;		/* id of the master if in slave mode */
 };
 #endif
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 76dc74d..03b64d2 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -625,13 +625,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
 	if (pdev->id >= ARRAY_SIZE(mxs_saif))
 		return -EINVAL;
 
-	pdata = pdev->dev.platform_data;
-	if (pdata && pdata->init) {
-		ret = pdata->init();
-		if (ret)
-			return ret;
-	}
-
 	saif = kzalloc(sizeof(*saif), GFP_KERNEL);
 	if (!saif)
 		return -ENOMEM;
@@ -639,12 +632,16 @@ static int mxs_saif_probe(struct platform_device *pdev)
 	mxs_saif[pdev->id] = saif;
 	saif->id = pdev->id;
 
-	saif->master_id = saif->id;
-	if (pdata && pdata->get_master_id) {
-		saif->master_id = pdata->get_master_id(saif->id);
+	pdata = pdev->dev.platform_data;
+	if (pdata && !pdata->master_mode) {
+		saif->master_id = pdata->master_id;
 		if (saif->master_id < 0 ||
-			saif->master_id >= ARRAY_SIZE(mxs_saif))
+			saif->master_id >= ARRAY_SIZE(mxs_saif) ||
+			saif->master_id == saif->id)
+			dev_err(&pdev->dev, "get wrong master id\n");
 			return -EINVAL;
+	} else {
+		saif->master_id = saif->id;
 	}
 
 	saif->clk = clk_get(&pdev->dev, NULL);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/1] ASoC: mxs-saif: remove function in platform_data
  2011-11-11  9:29 [PATCH 1/1] ASoC: mxs-saif: remove function in platform_data Dong Aisheng
@ 2011-11-11 15:04 ` Sascha Hauer
  2011-11-11 23:19   ` Shawn Guo
  2011-11-14 21:20   ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2011-11-11 15:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Nov 11, 2011 at 05:29:00PM +0800, Dong Aisheng wrote:
> Add master_mode and master_id in platfrom_data since it's board
> specific and board knows it.
> Then we can remove the function pointer in platfrom_data to make
> the driver more devicetree friendly.

Looks ok. Marc, is it ok when I take this patch? The SoC specific stuff
for this patch depends on it.

Sascha

> 
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
> This patch is based on Sascha's suggestions and see using in
> [PATCH v5 0/3] ARM: mxs: add recording support for saif
> ---
>  include/sound/saif.h     |    4 ++--
>  sound/soc/mxs/mxs-saif.c |   19 ++++++++-----------
>  2 files changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/include/sound/saif.h b/include/sound/saif.h
> index d0e0de7..f22f3e1 100644
> --- a/include/sound/saif.h
> +++ b/include/sound/saif.h
> @@ -10,7 +10,7 @@
>  #define __SOUND_SAIF_H__
>  
>  struct mxs_saif_platform_data {
> -	int (*init) (void);
> -	int (*get_master_id) (unsigned int saif_id);
> +	bool master_mode;	/* if true use master mode */
> +	int master_id;		/* id of the master if in slave mode */
>  };
>  #endif
> diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
> index 76dc74d..03b64d2 100644
> --- a/sound/soc/mxs/mxs-saif.c
> +++ b/sound/soc/mxs/mxs-saif.c
> @@ -625,13 +625,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
>  	if (pdev->id >= ARRAY_SIZE(mxs_saif))
>  		return -EINVAL;
>  
> -	pdata = pdev->dev.platform_data;
> -	if (pdata && pdata->init) {
> -		ret = pdata->init();
> -		if (ret)
> -			return ret;
> -	}
> -
>  	saif = kzalloc(sizeof(*saif), GFP_KERNEL);
>  	if (!saif)
>  		return -ENOMEM;
> @@ -639,12 +632,16 @@ static int mxs_saif_probe(struct platform_device *pdev)
>  	mxs_saif[pdev->id] = saif;
>  	saif->id = pdev->id;
>  
> -	saif->master_id = saif->id;
> -	if (pdata && pdata->get_master_id) {
> -		saif->master_id = pdata->get_master_id(saif->id);
> +	pdata = pdev->dev.platform_data;
> +	if (pdata && !pdata->master_mode) {
> +		saif->master_id = pdata->master_id;
>  		if (saif->master_id < 0 ||
> -			saif->master_id >= ARRAY_SIZE(mxs_saif))
> +			saif->master_id >= ARRAY_SIZE(mxs_saif) ||
> +			saif->master_id == saif->id)
> +			dev_err(&pdev->dev, "get wrong master id\n");
>  			return -EINVAL;
> +	} else {
> +		saif->master_id = saif->id;
>  	}
>  
>  	saif->clk = clk_get(&pdev->dev, NULL);
> -- 
> 1.7.0.4
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] ASoC: mxs-saif: remove function in platform_data
  2011-11-11 15:04 ` Sascha Hauer
@ 2011-11-11 23:19   ` Shawn Guo
  2011-11-14 15:49     ` Sascha Hauer
  2011-11-14 21:20   ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Shawn Guo @ 2011-11-11 23:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Nov 11, 2011 at 04:04:22PM +0100, Sascha Hauer wrote:
> On Fri, Nov 11, 2011 at 05:29:00PM +0800, Dong Aisheng wrote:
> > Add master_mode and master_id in platfrom_data since it's board
> > specific and board knows it.
> > Then we can remove the function pointer in platfrom_data to make
> > the driver more devicetree friendly.
> 
> Looks ok. Marc,

You meant Mark?

> is it ok when I take this patch? The SoC specific stuff
> for this patch depends on it.
> 
I thought I will start collecting mxs patches after v3.2-rc1.
Do you plan to collect mxs patches for one more cycle?

-- 
Regards,
Shawn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] ASoC: mxs-saif: remove function in platform_data
  2011-11-11 23:19   ` Shawn Guo
@ 2011-11-14 15:49     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2011-11-14 15:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 12, 2011 at 07:19:56AM +0800, Shawn Guo wrote:
> On Fri, Nov 11, 2011 at 04:04:22PM +0100, Sascha Hauer wrote:
> > On Fri, Nov 11, 2011 at 05:29:00PM +0800, Dong Aisheng wrote:
> > > Add master_mode and master_id in platfrom_data since it's board
> > > specific and board knows it.
> > > Then we can remove the function pointer in platfrom_data to make
> > > the driver more devicetree friendly.
> > 
> > Looks ok. Marc,
> 
> You meant Mark?

Yes, sorry.

> 
> > is it ok when I take this patch? The SoC specific stuff
> > for this patch depends on it.
> > 
> I thought I will start collecting mxs patches after v3.2-rc1.
> Do you plan to collect mxs patches for one more cycle?

Go ahead if you like.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] ASoC: mxs-saif: remove function in platform_data
  2011-11-11 15:04 ` Sascha Hauer
  2011-11-11 23:19   ` Shawn Guo
@ 2011-11-14 21:20   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-11-14 21:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Nov 11, 2011 at 04:04:22PM +0100, Sascha Hauer wrote:
> On Fri, Nov 11, 2011 at 05:29:00PM +0800, Dong Aisheng wrote:
> > Add master_mode and master_id in platfrom_data since it's board
> > specific and board knows it.
> > Then we can remove the function pointer in platfrom_data to make
> > the driver more devicetree friendly.

> Looks ok. Marc, is it ok when I take this patch? The SoC specific stuff
> for this patch depends on it.

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-14 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11  9:29 [PATCH 1/1] ASoC: mxs-saif: remove function in platform_data Dong Aisheng
2011-11-11 15:04 ` Sascha Hauer
2011-11-11 23:19   ` Shawn Guo
2011-11-14 15:49     ` Sascha Hauer
2011-11-14 21:20   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).