alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Johan Hovold <johan@kernel.org>,
	Jacob Siverskog <jacob@teenage.engineering>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] ASoC: pcm179x: Split into core and SPI parts
Date: Thu, 21 Jan 2016 18:56:27 +0100	[thread overview]
Message-ID: <20160121175627.GR31514@localhost> (raw)
In-Reply-To: <CAOf5uwny3Rz6ctUs1wGkcvhPykFENnniC=Jq9jGBfhJG398yug@mail.gmail.com>

On Thu, Jan 21, 2016 at 05:27:58PM +0100, Michael Trimarchi wrote:
> Hi
> 
> On Thu, Jan 21, 2016 at 4:36 PM, Johan Hovold <johan@kernel.org> wrote:
> > On Thu, Jan 21, 2016 at 04:26:56PM +0100, Jacob Siverskog wrote:
> >> The pcm179x family supports both SPI and I2C for configuration. This
> >> patch splits the driver into core and SPI parts, in preparation for
> >> I2C support.
> >>
> >> Reviewed-by: Johan Hovold <johan@kernel.org>
> >> Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
> >> ---
> >
> >> diff --git a/sound/soc/codecs/pcm179x-spi.c b/sound/soc/codecs/pcm179x-spi.c
> >> new file mode 100644
> >> index 0000000..5842add9
> >> --- /dev/null
> >> +++ b/sound/soc/codecs/pcm179x-spi.c

> >> -static int pcm179x_spi_probe(struct spi_device *spi)
> >> +int pcm179x_common_init(struct device *dev, struct regmap *regmap)
> >>  {
> >>       struct pcm179x_private *pcm179x;
> >>       int ret;
> >>
> >> -     pcm179x = devm_kzalloc(&spi->dev, sizeof(struct pcm179x_private),
> >> +     if (IS_ERR(regmap)) {
> >> +             ret = PTR_ERR(regmap);
> >> +             dev_err(dev, "Failed to register regmap: %d\n", ret);
> >> +             return ret;
> >> +     }
> >
> > This looks weird. I think you should check for error where you do the
> > allocation even if this means a four more lines of code in total.
> >
> 
> agree on that
> 
> >> +
> >> +     pcm179x = devm_kzalloc(dev, sizeof(struct pcm179x_private),
> >>                               GFP_KERNEL);
> >>       if (!pcm179x)
> >>               return -ENOMEM;
> >>
> >> -     spi_set_drvdata(spi, pcm179x);
> >> -
> >> -     pcm179x->regmap = devm_regmap_init_spi(spi, &pcm179x_regmap);
> >> -     if (IS_ERR(pcm179x->regmap)) {
> >> -             ret = PTR_ERR(pcm179x->regmap);
> >> -             dev_err(&spi->dev, "Failed to register regmap: %d\n", ret);
> >> -             return ret;
> >> -     }
> >> +     pcm179x->regmap = regmap;
> >> +     dev_set_drvdata(dev, pcm179x);
> >>
> 
> snd_soc_codec_set_drvdata
> 
> Is this more "codec" like?

I'd say, only if you also add a codec probe callback and use it from
there. The other codec drivers appear to be consistent on that.

Thanks,
Johan

  reply	other threads:[~2016-01-21 17:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 15:26 [PATCH v3 0/3] ASoC: pcm179x: Add I2C support, declare support for continuous rates Jacob Siverskog
2016-01-21 15:26 ` [PATCH v3 1/3] ASoC: pcm179x: Split into core and SPI parts Jacob Siverskog
2016-01-21 15:36   ` Johan Hovold
2016-01-21 16:27     ` Michael Trimarchi
2016-01-21 17:56       ` Johan Hovold [this message]
2016-01-22 12:17         ` Jacob Siverskog
2016-01-21 15:26 ` [PATCH v3 2/3] ASoC: pcm179x: Add I2C interface driver Jacob Siverskog
2016-01-21 15:26 ` [PATCH v3 3/3] ASoC: pcm179x: Support continuous rates Jacob Siverskog
2016-01-29  0:22   ` Applied "ASoC: pcm179x: Support continuous rates" to the asoc tree Mark Brown

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=20160121175627.GR31514@localhost \
    --to=johan@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jacob@teenage.engineering \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@amarulasolutions.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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 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).