* [PATCH] ALSA: ac97: fix device initialization in the compat layer
@ 2018-08-15 12:59 ylhuajnu
2018-08-19 8:10 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: ylhuajnu @ 2018-08-15 12:59 UTC (permalink / raw)
To: tiwai; +Cc: Lihua Yao, alsa-devel, robert.jarzmik
From: Lihua Yao <ylhuajnu@163.com>
ac97->dev is an object of 'struct device' type. It should be initialized
via device_initialize() or device_register().
Fixes: 74426fbff66e ("ALSA: ac97: add an ac97 bus")
Signed-off-by: Lihua Yao <ylhuajnu@163.com>
---
sound/ac97/snd_ac97_compat.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/sound/ac97/snd_ac97_compat.c b/sound/ac97/snd_ac97_compat.c
index 61544e0d8de4..8bab44f74bb8 100644
--- a/sound/ac97/snd_ac97_compat.c
+++ b/sound/ac97/snd_ac97_compat.c
@@ -15,6 +15,11 @@
#include "ac97_core.h"
+static void compat_ac97_release(struct device *dev)
+{
+ kfree(to_ac97_t(dev));
+}
+
static void compat_ac97_reset(struct snd_ac97 *ac97)
{
struct ac97_codec_device *adev = to_ac97_device(ac97->private_data);
@@ -65,21 +70,31 @@ static struct snd_ac97_bus compat_soc_ac97_bus = {
struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev)
{
struct snd_ac97 *ac97;
+ int ret;
ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
if (ac97 == NULL)
return ERR_PTR(-ENOMEM);
- ac97->dev = adev->dev;
ac97->private_data = adev;
ac97->bus = &compat_soc_ac97_bus;
+
+ ac97->dev.parent = &adev->dev;
+ ac97->dev.release = compat_ac97_release;
+ dev_set_name(&ac97->dev, "%s-compat", dev_name(&adev->dev));
+ ret = device_register(&ac97->dev);
+ if (ret) {
+ put_device(&ac97->dev);
+ return ERR_PTR(ret);
+ }
+
return ac97;
}
EXPORT_SYMBOL_GPL(snd_ac97_compat_alloc);
void snd_ac97_compat_release(struct snd_ac97 *ac97)
{
- kfree(ac97);
+ device_unregister(&ac97->dev);
}
EXPORT_SYMBOL_GPL(snd_ac97_compat_release);
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: ac97: fix device initialization in the compat layer
2018-08-15 12:59 [PATCH] ALSA: ac97: fix device initialization in the compat layer ylhuajnu
@ 2018-08-19 8:10 ` Takashi Iwai
2018-08-19 9:18 ` Robert Jarzmik
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2018-08-19 8:10 UTC (permalink / raw)
To: ylhuajnu; +Cc: alsa-devel, robert.jarzmik
On Wed, 15 Aug 2018 14:59:46 +0200,
ylhuajnu@163.com wrote:
>
> From: Lihua Yao <ylhuajnu@163.com>
>
> ac97->dev is an object of 'struct device' type. It should be initialized
> via device_initialize() or device_register().
>
> Fixes: 74426fbff66e ("ALSA: ac97: add an ac97 bus")
> Signed-off-by: Lihua Yao <ylhuajnu@163.com>
Looks good though a quick glance, but I'd like to get an ack from
Robert. Robert? Also check two other patches and runtime PM.
thanks,
Takashi
> ---
> sound/ac97/snd_ac97_compat.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/sound/ac97/snd_ac97_compat.c b/sound/ac97/snd_ac97_compat.c
> index 61544e0d8de4..8bab44f74bb8 100644
> --- a/sound/ac97/snd_ac97_compat.c
> +++ b/sound/ac97/snd_ac97_compat.c
> @@ -15,6 +15,11 @@
>
> #include "ac97_core.h"
>
> +static void compat_ac97_release(struct device *dev)
> +{
> + kfree(to_ac97_t(dev));
> +}
> +
> static void compat_ac97_reset(struct snd_ac97 *ac97)
> {
> struct ac97_codec_device *adev = to_ac97_device(ac97->private_data);
> @@ -65,21 +70,31 @@ static struct snd_ac97_bus compat_soc_ac97_bus = {
> struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev)
> {
> struct snd_ac97 *ac97;
> + int ret;
>
> ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
> if (ac97 == NULL)
> return ERR_PTR(-ENOMEM);
>
> - ac97->dev = adev->dev;
> ac97->private_data = adev;
> ac97->bus = &compat_soc_ac97_bus;
> +
> + ac97->dev.parent = &adev->dev;
> + ac97->dev.release = compat_ac97_release;
> + dev_set_name(&ac97->dev, "%s-compat", dev_name(&adev->dev));
> + ret = device_register(&ac97->dev);
> + if (ret) {
> + put_device(&ac97->dev);
> + return ERR_PTR(ret);
> + }
> +
> return ac97;
> }
> EXPORT_SYMBOL_GPL(snd_ac97_compat_alloc);
>
> void snd_ac97_compat_release(struct snd_ac97 *ac97)
> {
> - kfree(ac97);
> + device_unregister(&ac97->dev);
> }
> EXPORT_SYMBOL_GPL(snd_ac97_compat_release);
>
> --
> 2.17.1
>
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: ac97: fix device initialization in the compat layer
2018-08-19 8:10 ` Takashi Iwai
@ 2018-08-19 9:18 ` Robert Jarzmik
2018-08-19 16:39 ` Takashi Iwai
2018-08-20 13:20 ` Lihua Yao
0 siblings, 2 replies; 6+ messages in thread
From: Robert Jarzmik @ 2018-08-19 9:18 UTC (permalink / raw)
To: Takashi Iwai, ylhuajnu; +Cc: alsa-devel
Takashi Iwai <tiwai@suse.de> writes:
> On Wed, 15 Aug 2018 14:59:46 +0200,
> Looks good though a quick glance, but I'd like to get an ack from
> Robert. Robert? Also check two other patches and runtime PM.
Mmmh of course, but ... I don't have these patches in my mailbox ...
Yao Lihua, would you be so kind as to resend them to me so that I can review and
test them please ?
Cheers.
--
Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: ac97: fix device initialization in the compat layer
2018-08-19 9:18 ` Robert Jarzmik
@ 2018-08-19 16:39 ` Takashi Iwai
2018-08-20 13:37 ` Yao Lihua
2018-08-20 13:20 ` Lihua Yao
1 sibling, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2018-08-19 16:39 UTC (permalink / raw)
To: Robert Jarzmik; +Cc: ylhuajnu, alsa-devel
On Sun, 19 Aug 2018 11:18:48 +0200,
Robert Jarzmik wrote:
>
> Takashi Iwai <tiwai@suse.de> writes:
>
> > On Wed, 15 Aug 2018 14:59:46 +0200,
> > Looks good though a quick glance, but I'd like to get an ack from
> > Robert. Robert? Also check two other patches and runtime PM.
>
> Mmmh of course, but ... I don't have these patches in my mailbox ...
>
> Yao Lihua, would you be so kind as to resend them to me so that I can review and
> test them please ?
I forward the patch and Robert gave ack, so applied now.
thanks,
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: ac97: fix device initialization in the compat layer
2018-08-19 9:18 ` Robert Jarzmik
2018-08-19 16:39 ` Takashi Iwai
@ 2018-08-20 13:20 ` Lihua Yao
1 sibling, 0 replies; 6+ messages in thread
From: Lihua Yao @ 2018-08-20 13:20 UTC (permalink / raw)
To: Robert Jarzmik; +Cc: Takashi Iwai, alsa-devel
At 2018-08-19 17:18:48, "Robert Jarzmik" <robert.jarzmik@free.fr> wrote:
>Takashi Iwai <tiwai@suse.de> writes:
>
>> On Wed, 15 Aug 2018 14:59:46 +0200,
>> Looks good though a quick glance, but I'd like to get an ack from
>> Robert. Robert? Also check two other patches and runtime PM.
>
>Mmmh of course, but ... I don't have these patches in my mailbox ...
>
>Yao Lihua, would you be so kind as to resend them to me so that I can review and
>test them please ?Sorry Robert, I had you CCed only. I will be careful next time> >Cheers. > >-- >Robert
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ALSA: ac97: fix device initialization in the compat layer
2018-08-19 16:39 ` Takashi Iwai
@ 2018-08-20 13:37 ` Yao Lihua
0 siblings, 0 replies; 6+ messages in thread
From: Yao Lihua @ 2018-08-20 13:37 UTC (permalink / raw)
To: Takashi Iwai, Robert Jarzmik; +Cc: alsa-devel
On Monday, August 20, 2018 12:39 AM, Takashi Iwai wrote:
> On Sun, 19 Aug 2018 11:18:48 +0200,
> Robert Jarzmik wrote:
>> Takashi Iwai <tiwai@suse.de> writes:
>>
>>> On Wed, 15 Aug 2018 14:59:46 +0200,
>>> Looks good though a quick glance, but I'd like to get an ack from
>>> Robert. Robert? Also check two other patches and runtime PM.
>> Mmmh of course, but ... I don't have these patches in my mailbox ...
>>
>> Yao Lihua, would you be so kind as to resend them to me so that I can review and
>> test them please ?
> I forward the patch and Robert gave ack, so applied now.
Hi Takashi, Robert;
Thanks for review and sorry for inconvenience.
I checked my email client and found that this email and the other two were delivered to
alsa-devel only but rejected by both tiwai@suse.de and robert.jarzmik@free.fr.
I also have trouble while replying using thunderbird email client.
>
>
> thanks,
>
> Takashi
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-20 13:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 12:59 [PATCH] ALSA: ac97: fix device initialization in the compat layer ylhuajnu
2018-08-19 8:10 ` Takashi Iwai
2018-08-19 9:18 ` Robert Jarzmik
2018-08-19 16:39 ` Takashi Iwai
2018-08-20 13:37 ` Yao Lihua
2018-08-20 13:20 ` Lihua Yao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.