diff mbox

[1/3] ALSA: hda - Remove dependency on bus->pci in hda_beep.c

Message ID 1392455855-10594-1-git-send-email-tiwai@suse.de (mailing list archive)
State Accepted
Delegated to: Takashi Iwai
Headers show

Commit Message

Takashi Iwai Feb. 15, 2014, 9:17 a.m. UTC
The default parent device can be obtained directly via card object, so
we don't need to rely on pci->dev.parent.  Since there is no access to
pci_dev, we can reduce the inclusion of linux/pci.h, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_beep.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Takashi Iwai Feb. 15, 2014, 9:22 a.m. UTC | #1
At Sat, 15 Feb 2014 10:17:33 +0100,
Takashi Iwai wrote:
> 
> The default parent device can be obtained directly via card object, so
> we don't need to rely on pci->dev.parent.  Since there is no access to
> pci_dev, we can reduce the inclusion of linux/pci.h, too.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

I forgot the cover page: these tree patches are trivial cleanups of
hda-codec drivers (not the controller) to work without PCI device
assignment. The idea was triggered by Dylan's question.


Takashi

> ---
>  sound/pci/hda/hda_beep.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
> index 0589b39cda6e..d8c437a94559 100644
> --- a/sound/pci/hda/hda_beep.c
> +++ b/sound/pci/hda/hda_beep.c
> @@ -20,7 +20,6 @@
>   */
>  
>  #include <linux/input.h>
> -#include <linux/pci.h>
>  #include <linux/slab.h>
>  #include <linux/workqueue.h>
>  #include <linux/export.h>
> @@ -167,7 +166,7 @@ static int snd_hda_do_attach(struct hda_beep *beep)
>  	input_dev->evbit[0] = BIT_MASK(EV_SND);
>  	input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
>  	input_dev->event = snd_hda_beep_event;
> -	input_dev->dev.parent = &codec->bus->pci->dev;
> +	input_dev->dev.parent = codec->bus->card->dev;
>  	input_set_drvdata(input_dev, beep);
>  
>  	err = input_register_device(input_dev);
> -- 
> 1.8.5.2
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Stephen Warren Feb. 18, 2014, 6:04 p.m. UTC | #2
On 02/15/2014 02:22 AM, Takashi Iwai wrote:
> At Sat, 15 Feb 2014 10:17:33 +0100,
> Takashi Iwai wrote:
>>
>> The default parent device can be obtained directly via card object, so
>> we don't need to rely on pci->dev.parent.  Since there is no access to
>> pci_dev, we can reduce the inclusion of linux/pci.h, too.
>>
>> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> 
> I forgot the cover page: these tree patches are trivial cleanups of
> hda-codec drivers (not the controller) to work without PCI device
> assignment. The idea was triggered by Dylan's question.

The series seems fine to me, so briefly,
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Dylan Reid Feb. 18, 2014, 6:20 p.m. UTC | #3
On Tue, Feb 18, 2014 at 10:04 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 02/15/2014 02:22 AM, Takashi Iwai wrote:
>> At Sat, 15 Feb 2014 10:17:33 +0100,
>> Takashi Iwai wrote:
>>>
>>> The default parent device can be obtained directly via card object, so
>>> we don't need to rely on pci->dev.parent.  Since there is no access to
>>> pci_dev, we can reduce the inclusion of linux/pci.h, too.
>>>
>>> Signed-off-by: Takashi Iwai <tiwai@suse.de>
>>
>> I forgot the cover page: these tree patches are trivial cleanups of
>> hda-codec drivers (not the controller) to work without PCI device
>> assignment. The idea was triggered by Dylan's question.
>
> The series seems fine to me, so briefly,
> Reviewed-by: Stephen Warren <swarren@nvidia.com>
>

Thanks Takashi,

I tested this series on a Haswell and IvyBridge system. Looks good to
me as well.
Takashi Iwai Feb. 19, 2014, 8:33 a.m. UTC | #4
At Tue, 18 Feb 2014 11:04:19 -0700,
Stephen Warren wrote:
> 
> On 02/15/2014 02:22 AM, Takashi Iwai wrote:
> > At Sat, 15 Feb 2014 10:17:33 +0100,
> > Takashi Iwai wrote:
> >>
> >> The default parent device can be obtained directly via card object, so
> >> we don't need to rely on pci->dev.parent.  Since there is no access to
> >> pci_dev, we can reduce the inclusion of linux/pci.h, too.
> >>
> >> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > 
> > I forgot the cover page: these tree patches are trivial cleanups of
> > hda-codec drivers (not the controller) to work without PCI device
> > assignment. The idea was triggered by Dylan's question.
> 
> The series seems fine to me, so briefly,
> Reviewed-by: Stephen Warren <swarren@nvidia.com>

Thanks.  Any chance to work on / submit other changes for Tegra
HD-audio support?

As already mentioned, I think a cleaner way would be to write
hda_platform.c instead of hacking hda_intel.c with ifdefs.
Some code in hda_intel.c (e.g. bus ops and PCM callbacks) can be moved
out, either as a new helper module or just merging into snd-hda-codec
helper module, so that they can be used by both hda_intel.c and
hda_platform.c.

Ideally, we may rename hda_intel.c with hda_pci.c, but I'm afraid this
would bring too many regressions for module options.


Takashi
Dylan Reid Feb. 19, 2014, 3:16 p.m. UTC | #5
On Wed, Feb 19, 2014 at 12:33 AM, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 18 Feb 2014 11:04:19 -0700,
> Stephen Warren wrote:
>>
>> On 02/15/2014 02:22 AM, Takashi Iwai wrote:
>> > At Sat, 15 Feb 2014 10:17:33 +0100,
>> > Takashi Iwai wrote:
>> >>
>> >> The default parent device can be obtained directly via card object, so
>> >> we don't need to rely on pci->dev.parent.  Since there is no access to
>> >> pci_dev, we can reduce the inclusion of linux/pci.h, too.
>> >>
>> >> Signed-off-by: Takashi Iwai <tiwai@suse.de>
>> >
>> > I forgot the cover page: these tree patches are trivial cleanups of
>> > hda-codec drivers (not the controller) to work without PCI device
>> > assignment. The idea was triggered by Dylan's question.
>>
>> The series seems fine to me, so briefly,
>> Reviewed-by: Stephen Warren <swarren@nvidia.com>
>
> Thanks.  Any chance to work on / submit other changes for Tegra
> HD-audio support?

That's the plan, hopefully I'll be able to find time to throw together
an RFC by the end of the week.

>
> As already mentioned, I think a cleaner way would be to write
> hda_platform.c instead of hacking hda_intel.c with ifdefs.
> Some code in hda_intel.c (e.g. bus ops and PCM callbacks) can be moved
> out, either as a new helper module or just merging into snd-hda-codec
> helper module, so that they can be used by both hda_intel.c and
> hda_platform.c.

That sounds like a good idea.  There aren't a lot of differences,
mostly isolated to init and suspend/resume.  That should be easy to
put in hda_platform.

Thanks,

Dylan

>
> Ideally, we may rename hda_intel.c with hda_pci.c, but I'm afraid this
> would bring too many regressions for module options.
>
>
> Takashi
Takashi Iwai Feb. 27, 2014, 12:03 p.m. UTC | #6
At Wed, 19 Feb 2014 07:16:38 -0800,
Dylan Reid wrote:
> 
> On Wed, Feb 19, 2014 at 12:33 AM, Takashi Iwai <tiwai@suse.de> wrote:
> > At Tue, 18 Feb 2014 11:04:19 -0700,
> > Stephen Warren wrote:
> >>
> >> On 02/15/2014 02:22 AM, Takashi Iwai wrote:
> >> > At Sat, 15 Feb 2014 10:17:33 +0100,
> >> > Takashi Iwai wrote:
> >> >>
> >> >> The default parent device can be obtained directly via card object, so
> >> >> we don't need to rely on pci->dev.parent.  Since there is no access to
> >> >> pci_dev, we can reduce the inclusion of linux/pci.h, too.
> >> >>
> >> >> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> >> >
> >> > I forgot the cover page: these tree patches are trivial cleanups of
> >> > hda-codec drivers (not the controller) to work without PCI device
> >> > assignment. The idea was triggered by Dylan's question.
> >>
> >> The series seems fine to me, so briefly,
> >> Reviewed-by: Stephen Warren <swarren@nvidia.com>
> >
> > Thanks.  Any chance to work on / submit other changes for Tegra
> > HD-audio support?
> 
> That's the plan, hopefully I'll be able to find time to throw together
> an RFC by the end of the week.

Since there was no patch appearing yet, I merged my latest development
branch to for-next branch, which includes lots of changes in
hda_intel.c and hda_codec.c.  If any, please rebase your patches to
it.


thanks,

Takashi
Dylan Reid Feb. 27, 2014, 4:44 p.m. UTC | #7
On Thu, Feb 27, 2014 at 4:03 AM, Takashi Iwai <tiwai@suse.de> wrote:
> At Wed, 19 Feb 2014 07:16:38 -0800,
> Dylan Reid wrote:
>>
>> On Wed, Feb 19, 2014 at 12:33 AM, Takashi Iwai <tiwai@suse.de> wrote:
>> > At Tue, 18 Feb 2014 11:04:19 -0700,
>> > Stephen Warren wrote:
>> >>
>> >> On 02/15/2014 02:22 AM, Takashi Iwai wrote:
>> >> > At Sat, 15 Feb 2014 10:17:33 +0100,
>> >> > Takashi Iwai wrote:
>> >> >>
>> >> >> The default parent device can be obtained directly via card object, so
>> >> >> we don't need to rely on pci->dev.parent.  Since there is no access to
>> >> >> pci_dev, we can reduce the inclusion of linux/pci.h, too.
>> >> >>
>> >> >> Signed-off-by: Takashi Iwai <tiwai@suse.de>
>> >> >
>> >> > I forgot the cover page: these tree patches are trivial cleanups of
>> >> > hda-codec drivers (not the controller) to work without PCI device
>> >> > assignment. The idea was triggered by Dylan's question.
>> >>
>> >> The series seems fine to me, so briefly,
>> >> Reviewed-by: Stephen Warren <swarren@nvidia.com>
>> >
>> > Thanks.  Any chance to work on / submit other changes for Tegra
>> > HD-audio support?
>>
>> That's the plan, hopefully I'll be able to find time to throw together
>> an RFC by the end of the week.
>
> Since there was no patch appearing yet, I merged my latest development
> branch to for-next branch, which includes lots of changes in
> hda_intel.c and hda_codec.c.  If any, please rebase your patches to
> it.

Thanks for the heads up.  I've got a series that is almost ready, I'm
still trying to tease part of the build out from under CONFIG_PCI in
the hda makefile.  I'll try to button that up and get a the whole lot
rebased on top of the for-next branch.

Dylan

>
>
> thanks,
>
> Takashi
diff mbox

Patch

diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 0589b39cda6e..d8c437a94559 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -20,7 +20,6 @@ 
  */
 
 #include <linux/input.h>
-#include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <linux/export.h>
@@ -167,7 +166,7 @@  static int snd_hda_do_attach(struct hda_beep *beep)
 	input_dev->evbit[0] = BIT_MASK(EV_SND);
 	input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
 	input_dev->event = snd_hda_beep_event;
-	input_dev->dev.parent = &codec->bus->pci->dev;
+	input_dev->dev.parent = codec->bus->card->dev;
 	input_set_drvdata(input_dev, beep);
 
 	err = input_register_device(input_dev);