Message ID | 20140918180331.GA19033@panicking (mailing list archive) |
---|---|
State | Accepted |
Commit | 85151461f114f2fca386bb8ae6de185461d35d87 |
Headers | show |
On Thu, Sep 18, 2014 at 08:03:31PM +0200, Michael Trimarchi wrote: > > Ah, this is a problem. We should not use ssi_private->pdev->dev here. > > I think it'll be better if adding a new parameter of *dev pointer to > > this _set_dai_fmt() -- passing pdev->dev in probe() and cpu_dai->dev > > in fsl_ssi_set_dai_fmt(). > > > > Somenthing like this? Yes, would you like to send a separate patch? I think other people and maintainers'd like to take a look at it and decide if it's a good shoot. I'll also take a further look at it after I finish my laundry :) Thank you Nicolin > > diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c > index 87eb577..de6ab06 100644 > --- a/sound/soc/fsl/fsl_ssi.c > +++ b/sound/soc/fsl/fsl_ssi.c > @@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream, > return 0; > } > > -static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, > - unsigned int fmt) > +static int _fsl_ssi_set_dai_fmt(struct device *dev, > + struct fsl_ssi_private *ssi_private, > + unsigned int fmt) > { > struct regmap *regs = ssi_private->regs; > u32 strcr = 0, stcr, srcr, scr, mask; > @@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, > ssi_private->dai_fmt = fmt; > > if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) { > - dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n"); > + dev_err(dev, "baudclk is missing which is necessary for master mode\n"); > return -EINVAL; > } > > @@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) > { > struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai); > > - return _fsl_ssi_set_dai_fmt(ssi_private, fmt); > + return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt); > } > > /** > @@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev) > > done: > if (ssi_private->dai_fmt) > - _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt); > + _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private, > + ssi_private->dai_fmt); > > return 0; > > > Nicolin > > -- > | Michael Nazzareno Trimarchi Amarula Solutions BV | > | COO - Founder Cruquiuskade 47 | > | +31(0)851119172 Amsterdam 1018 AM NL | > | [`as] http://www.amarulasolutions.com |
Hi Fabio On Thu, Sep 18, 2014 at 8:13 PM, Nicolin Chen <nicoleotsuka@gmail.com> wrote: > On Thu, Sep 18, 2014 at 08:03:31PM +0200, Michael Trimarchi wrote: >> > Ah, this is a problem. We should not use ssi_private->pdev->dev here. >> > I think it'll be better if adding a new parameter of *dev pointer to >> > this _set_dai_fmt() -- passing pdev->dev in probe() and cpu_dai->dev >> > in fsl_ssi_set_dai_fmt(). >> > >> >> Somenthing like this? > > Yes, would you like to send a separate patch? I think other people > and maintainers'd like to take a look at it and decide if it's a > good shoot. I'll also take a further look at it after I finish my > laundry :) > Yes sure Michael > Thank you > Nicolin > >> >> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c >> index 87eb577..de6ab06 100644 >> --- a/sound/soc/fsl/fsl_ssi.c >> +++ b/sound/soc/fsl/fsl_ssi.c >> @@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream, >> return 0; >> } >> >> -static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, >> - unsigned int fmt) >> +static int _fsl_ssi_set_dai_fmt(struct device *dev, >> + struct fsl_ssi_private *ssi_private, >> + unsigned int fmt) >> { >> struct regmap *regs = ssi_private->regs; >> u32 strcr = 0, stcr, srcr, scr, mask; >> @@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, >> ssi_private->dai_fmt = fmt; >> >> if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) { >> - dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n"); >> + dev_err(dev, "baudclk is missing which is necessary for master mode\n"); >> return -EINVAL; >> } >> >> @@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) >> { >> struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai); >> >> - return _fsl_ssi_set_dai_fmt(ssi_private, fmt); >> + return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt); >> } >> >> /** >> @@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev) >> >> done: >> if (ssi_private->dai_fmt) >> - _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt); >> + _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private, >> + ssi_private->dai_fmt); >> >> return 0; >> >> > Nicolin >> >> -- >> | Michael Nazzareno Trimarchi Amarula Solutions BV | >> | COO - Founder Cruquiuskade 47 | >> | +31(0)851119172 Amsterdam 1018 AM NL | >> | [`as] http://www.amarulasolutions.com |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 87eb577..de6ab06 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream, return 0; } -static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, - unsigned int fmt) +static int _fsl_ssi_set_dai_fmt(struct device *dev, + struct fsl_ssi_private *ssi_private, + unsigned int fmt) { struct regmap *regs = ssi_private->regs; u32 strcr = 0, stcr, srcr, scr, mask; @@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, ssi_private->dai_fmt = fmt; if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) { - dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n"); + dev_err(dev, "baudclk is missing which is necessary for master mode\n"); return -EINVAL; } @@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai); - return _fsl_ssi_set_dai_fmt(ssi_private, fmt); + return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt); } /** @@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev) done: if (ssi_private->dai_fmt) - _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt); + _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private, + ssi_private->dai_fmt); return 0;