linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Takashi Iwai <tiwai@suse.de>
Cc: linux-input@vger.kernel.org, alsa-devel@alsa-project.org,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-kernel@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	patches@opensource.wolfsonmicro.com,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	Lee Jones <lee.jones@linaro.org>, Daniel Mack <daniel@zonque.org>
Subject: Re: [PATCH v4 02/12] ALSA: ac97: add an ac97 bus
Date: Thu, 27 Jul 2017 22:59:39 +0200	[thread overview]
Message-ID: <87a83pr3yc.fsf@belgarion.home> (raw)
In-Reply-To: <s5h60eg8a8d.wl-tiwai@suse.de> (Takashi Iwai's message of "Tue, 25 Jul 2017 23:42:10 +0200")

Takashi Iwai <tiwai@suse.de> writes:

> On Mon, 24 Jul 2017 22:49:18 +0200,
> Robert Jarzmik wrote:

...zip...
>> +#ifndef AC97_COMPAT_H
>> +#define AC97_COMPAT_H
>> +
>> +#include <sound/ac97_codec.h>
>> +#include <sound/soc.h>
>
> Is this inclusion needed?  The code here doesn't look ASoC-specific at
> all.
Mmm no, actually it's not, good point.

...zip...
>> +#ifndef AC97_CONTROLLER_H
>> +#define AC97_CONTROLLER_H
>> +
>> +#include <linux/list.h>
>> +
>> +#define AC97_BUS_MAX_CODECS 4
>> +#define AC97_SLOTS_AVAILABLE_ALL 0xf
>> +
>> +struct device;
>
> You need the definition struct device in below (it's no pointer), thus
> you have to include <linux/device.h> instead.
Fair enough, vor v5.
>> +struct ac97_controller {
>> +	const struct ac97_controller_ops *ops;
>
> The struct isn't declared beforehand?  GCC will warn.
Actually it doesn't.
It's interesting as ac97_controller depends on ac97_controller_ops, and
ac97_controller_ops depends on ac97_controller;

As for why it doesn't warn, every time I used controller.h, I also used
codec.h. And codec.h holds a :
struct ac97_controller;

So it's declared beforehand after all ...

But I will add before "struct ac97_controller" a :
struct ac97_controller_ops;

>> +	struct list_head controllers;
>> +	struct device adap;
>> +	int nr;
>> +	struct device *parent;
>> +	unsigned short slots_available;
>
> I'd move parent field below, so that 64bit pointer can be aligned
> better.
Okay, got it.

...zip...
>> +
>> +	device_initialize(&codec->dev);
>> +	dev_set_name(&codec->dev, "%s:%u", dev_name(ac97_ctrl->parent), idx);
>> +
>> +	ret = device_add(&codec->dev);
>> +	if (ret)
>> +		goto err_free_codec;
>> +
>> +	return 0;
>> +err_free_codec:
>> +	kfree(codec);
>
> This may leave the device name string.  You need to call
> put_device() even if device_add() returns an error.
You're right, I'll change that.

...zip...
>> +int snd_ac97_codec_driver_register(struct ac97_codec_driver *drv)
>> +{
>> +	int ret;
>> +
>> +	drv->driver.bus = &ac97_bus_type;
>> +	ret = driver_register(&drv->driver);
>> +
>> +	return ret;
>
> This can be simplified.
Indeed.

>> +}
>> +EXPORT_SYMBOL(snd_ac97_codec_driver_register);
>
> No GPL?  (Ditto for other entries, too)
Euh yeah, GPL forever. I will change all the occurrences.

>> +int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id,
>> +	unsigned int id_mask)
>> +{
>> +	struct ac97_codec_device *adev = to_ac97_device(ac97->private_data);
>> +	struct ac97_controller *actrl = adev->ac97_ctrl;
>> +
>> +	if (try_warm) {
>> +		compat_ac97_warm_reset(ac97);
>> +		if (snd_ac97_bus_scan_one(actrl, adev->num) == adev->vendor_id)
>
> Can we ignore id_mask here?  I'm not quite sure whether it's fixed...
Probably not, but I will take a bit more time to cross-check that one.

Thanks for the review, I'll follow up on that last question when I'll have
settled on the correct answer.

Cheers.

-- 
Robert

  reply	other threads:[~2017-07-27 20:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 20:49 [PATCH v4 00/12] AC97 device/driver model revamp Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 01/12] ALSA: ac97: split out the generic ac97 registers Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 02/12] ALSA: ac97: add an ac97 bus Robert Jarzmik
2017-07-25 21:42   ` Takashi Iwai
2017-07-27 20:59     ` Robert Jarzmik [this message]
2017-07-24 20:49 ` [PATCH v4 03/12] ASoC: add new ac97 bus support Robert Jarzmik
2017-09-04 17:25   ` Applied "ASoC: add new ac97 bus support" to the asoc tree Mark Brown
2017-07-24 20:49 ` [PATCH v4 04/12] ASoC: arm: make pxa2xx-ac97-lib ac97 codec agnostic Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 05/12] Input: wm97xx: split out touchscreen registering Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 06/12] mfd: wm97xx-core: core support for wm97xx Codec Robert Jarzmik
2017-07-25 10:17   ` Charles Keepax
2017-07-24 20:49 ` [PATCH v4 07/12] Input: wm97xx: add new AC97 bus support Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 08/12] ASoC: wm9713: add ac97 new " Robert Jarzmik
2017-07-25 10:18   ` Charles Keepax
2017-07-24 20:49 ` [PATCH v4 09/12] ASoC: wm9712: " Robert Jarzmik
2017-07-25 10:20   ` Charles Keepax
2017-07-28 22:14     ` Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 10/12] ASoC: wm9705: add private structure Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 11/12] ASoC: wm9705: add ac97 new bus support Robert Jarzmik
2017-07-24 20:49 ` [PATCH v4 12/12] ASoC: pxa: switch to new ac97 " Robert Jarzmik

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=87a83pr3yc.fsf@belgarion.home \
    --to=robert.jarzmik@free.fr \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=daniel@zonque.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=tiwai@suse.de \
    /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).