From patchwork Fri Feb 28 23:41:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3745231 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E9956BF13A for ; Fri, 28 Feb 2014 23:43:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1151A20254 for ; Fri, 28 Feb 2014 23:43:36 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B5EA62024D for ; Fri, 28 Feb 2014 23:43:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 01A76265B94; Sat, 1 Mar 2014 00:43:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id DBF3326598D; Sat, 1 Mar 2014 00:43:00 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 341382659E5; Sat, 1 Mar 2014 00:42:59 +0100 (CET) Received: from mail-oa0-f73.google.com (mail-oa0-f73.google.com [209.85.219.73]) by alsa0.perex.cz (Postfix) with ESMTP id 3AD7E26598B for ; Sat, 1 Mar 2014 00:42:52 +0100 (CET) Received: by mail-oa0-f73.google.com with SMTP id n16so60862oag.0 for ; Fri, 28 Feb 2014 15:42:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TlsQ3mQS7E71hSHW+64uIEVKQwjEePzayhPqyHrbRJU=; b=VdisD4BnApLtybRKG33rmYeKUcK/EA7HjaJJK1vkUMD2f8CKKUBw/viETthgKkw43Z KsFo6NyVZjV6eHKQfk6bGQXcdNwuYrrbzK8MQBpf2ehYNDhszSjuwy2GMd2rsNp06f7s 3w/rMo2kmAJd6aurWkuV6Nullu0czjl5JlPt0QZAKbTzdRyJAIbL/todzyiOOn8IblwG /6PB8GYsJkmDQCHV67fczLDZ0J4bfGt/Z2bFn+46uRFN8qwLoVQ0H3pHa9GdKLNemz1/ EBQbLVfn8k5W9yIpHp3isxUwbThEHPZ+bXD9jQgUKQT8Cqp4lN9WBFpRoS62IYknHIg5 PM8A== X-Gm-Message-State: ALoCoQnHEOMebTl5bZa2LMahmlamwnSG0qZU+4H/ti92H0HLJmCBoR0/hOPdp/q0I/nskV3r7mDxajnOB+3UKEmevEze1mlJ8OzzShoVWZaST0zmMrMp2Q2Y88KsOa2hA4GlNqWPDPtuutsuM1LX5DQsPW7jJBPWLKnb2kQnKWbgR7OAHIlwUI6gvbTHVMQ4GepzdwprEPbqTRHtYBijSp/JspHqHmWMBUBjYslbJh0H9C7Ut+ToZ9k= X-Received: by 10.182.236.74 with SMTP id us10mr7911013obc.36.1393630971255; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id u30si545520yhk.1.2014.02.28.15.42.51 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: from hojo20.mtv.corp.google.com (hojo20.mtv.corp.google.com [172.22.72.28]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 0094231C1D8; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id 8EDA6181452; Fri, 28 Feb 2014 15:42:50 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Fri, 28 Feb 2014 15:41:15 -0800 Message-Id: <1393630893-29010-5-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393630893-29010-1-git-send-email-dgreid@chromium.org> References: <1393630893-29010-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFCv2 04/22] ALSA: hda - Use device pointer from the card instead of pci X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This removes calls to get the device via PCI from other parts of the code that will be able to be re-used by the platform driver. Signed-off-by: Dylan Reid --- sound/pci/hda/hda_intel.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 9fcd1d1..7630622 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -364,7 +364,7 @@ static int azx_alloc_cmd_io(struct azx *chip) /* single page (at least 4096 bytes) must suffice for both ringbuffes */ err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, - snd_dma_pci_data(chip->pci), + chip->card->dev, PAGE_SIZE, &chip->rb); if (err < 0) { dev_err(chip->card->dev, "cannot allocate CORB/RIRB\n"); @@ -1032,7 +1032,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) #ifdef CONFIG_PM_RUNTIME if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) - if (chip->pci->dev.power.runtime_status != RPM_ACTIVE) + if (chip->card->dev->power.runtime_status != RPM_ACTIVE) return IRQ_NONE; #endif @@ -2290,7 +2290,7 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, if (size > MAX_PREALLOC_SIZE) size = MAX_PREALLOC_SIZE; snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), + chip->card->dev, size, MAX_PREALLOC_SIZE); /* link to codec */ pcm->dev = &codec->dev; @@ -2405,7 +2405,7 @@ static int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, spin_unlock_irq(&chip->reg_lock); err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, - snd_dma_pci_data(chip->pci), + chip->card->dev, byte_size, bufp); if (err < 0) goto err_alloc; @@ -2498,9 +2498,9 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up) return; if (power_up) - pm_runtime_get_sync(&chip->pci->dev); + pm_runtime_get_sync(chip->card->dev); else - pm_runtime_put_sync(&chip->pci->dev); + pm_runtime_put_sync(chip->card->dev); } static DEFINE_MUTEX(card_list_lock); @@ -2765,8 +2765,8 @@ static void azx_vs_set_state(struct pci_dev *pci, dev_info(chip->card->dev, "%s via VGA-switcheroo\n", disabled ? "Disabling" : "Enabling"); if (disabled) { - pm_runtime_put_sync_suspend(&pci->dev); - azx_suspend(&pci->dev); + pm_runtime_put_sync_suspend(card->dev); + azx_suspend(card->dev); /* when we get suspended by vga switcheroo we end up in D3cold, * however we have no ACPI handle, so pci/acpi can't put us there, * put ourselves there */ @@ -2777,9 +2777,9 @@ static void azx_vs_set_state(struct pci_dev *pci, "Cannot lock devices!\n"); } else { snd_hda_unlock_devices(chip->bus); - pm_runtime_get_noresume(&pci->dev); + pm_runtime_get_noresume(card->dev); chip->disabled = false; - azx_resume(&pci->dev); + azx_resume(card->dev); } } } @@ -2833,7 +2833,8 @@ static int register_vga_switcheroo(struct azx *chip) chip->vga_switcheroo_registered = 1; /* register as an optimus hdmi audio power domain */ - vga_switcheroo_init_domain_pm_optimus_hdmi_audio(&chip->pci->dev, &chip->hdmi_pm_domain); + vga_switcheroo_init_domain_pm_optimus_hdmi_audio(chip->card->dev, + &chip->hdmi_pm_domain); return 0; } #else @@ -3348,7 +3349,7 @@ static int azx_first_init(struct azx *chip) dsp_lock_init(&chip->azx_dev[i]); /* allocate memory for the BDL for each stream */ err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, - snd_dma_pci_data(chip->pci), + chip->card->dev, BDL_SIZE, &chip->azx_dev[i].bdl); if (err < 0) { dev_err(card->dev, "cannot allocate BDL\n"); @@ -3358,7 +3359,7 @@ static int azx_first_init(struct azx *chip) } /* allocate memory for the position buffer */ err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, - snd_dma_pci_data(chip->pci), + chip->card->dev, chip->num_streams * 8, &chip->posbuf); if (err < 0) { dev_err(card->dev, "cannot allocate posbuf\n");