From: Johan Hovold <johan@kernel.org>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: 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>, Johan Hovold <johan@kernel.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] ASoC: pcm179x: Add I2C interface driver
Date: Tue, 19 Jan 2016 14:51:03 +0100 [thread overview]
Message-ID: <20160119135103.GA12069@localhost> (raw)
In-Reply-To: <CAOf5uwnCpJG_L6N9S5J0=QKiU8wxwXnrsKfni35-nr305SSM0g@mail.gmail.com>
On Tue, Jan 19, 2016 at 11:50:35AM +0100, Michael Trimarchi wrote:
> Hi Jacob
>
> On Tue, Jan 19, 2016 at 11:29 AM, Jacob Siverskog
> <jacob@teenage.engineering> wrote:
> > The PCM179x family supports both SPI and I2C. This patch adds support
> > for the I2C interface.
> >
> > Reviewed-by: Johan Hovold <johan@kernel.org>
> > Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
> > ---
> > +static int pcm179x_i2c_probe(struct i2c_client *client,
> > + const struct i2c_device_id *id)
> > +{
> > + struct pcm179x_private *pcm179x;
> > + int ret;
> > +
> > + pcm179x = devm_kzalloc(&client->dev, sizeof(struct pcm179x_private),
> > + GFP_KERNEL);
> > + if (!pcm179x)
> > + return -ENOMEM;
> > +
> > + i2c_set_clientdata(client, pcm179x);
> > +
> > + pcm179x->dev = &client->dev;
> > +
> > + pcm179x->regmap = devm_regmap_init_i2c(client, &pcm179x_regmap_config);
> > + if (IS_ERR(pcm179x->regmap)) {
> > + ret = PTR_ERR(pcm179x->regmap);
> > + dev_err(&client->dev, "Failed to register regmap: %d\n", ret);
> > + return ret;
> > + }
> > +
>
> sound/soc/codecs/adau1781-spi.c
>
> I like more how was done here for private data and codec data. What do
> you think?
Why do you prefer that?
Having a common_exit() to clean up whatever was done in common_init()
seems like a better design than open-coding this in both of the i2c and
spi drivers (if that's what you were referring to).
> > + return pcm179x_common_init(pcm179x);
> > +}
> > +
> > +static int pcm179x_i2c_remove(struct i2c_client *client)
> > +{
> > + return pcm179x_common_exit(i2c_get_clientdata(client));
> > +}
Thanks,
Johan
next prev parent reply other threads:[~2016-01-19 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 10:29 [PATCH v2 0/3] ASoC: pcm179x: Add I2C support, declare support for continuous rates Jacob Siverskog
2016-01-19 10:29 ` [PATCH v2 1/3] ASoC: pcm179x: Split into core and SPI parts Jacob Siverskog
2016-01-19 10:29 ` [PATCH v2 2/3] ASoC: pcm179x: Add I2C interface driver Jacob Siverskog
2016-01-19 10:50 ` Michael Trimarchi
2016-01-19 13:51 ` Johan Hovold [this message]
2016-01-20 4:58 ` Michael Trimarchi
2016-01-20 17:26 ` Johan Hovold
2016-01-19 10:29 ` [PATCH v2 3/3] ASoC: pcm179x: Support continuous rates Jacob Siverskog
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=20160119135103.GA12069@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).