From patchwork Fri Feb 28 06:35:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3738891 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CE82A9F2ED for ; Fri, 28 Feb 2014 06:40:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 264892026D for ; Fri, 28 Feb 2014 06:40:36 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id CE94220265 for ; Fri, 28 Feb 2014 06:40:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6364426528D; Fri, 28 Feb 2014 07:40:32 +0100 (CET) Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 3619D26530F; Fri, 28 Feb 2014 07:38:08 +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 7BDED26524F; Fri, 28 Feb 2014 07:38:05 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from mail-ie0-f201.google.com (mail-ie0-f201.google.com [209.85.223.201]) by alsa0.perex.cz (Postfix) with ESMTP id 3BA4726508D for ; Fri, 28 Feb 2014 07:37:13 +0100 (CET) Received: by mail-ie0-f201.google.com with SMTP id at1so712829iec.2 for ; Thu, 27 Feb 2014 22:37:12 -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=FEENk9caAZT3N3PMfj6Wmot+yfrKLytkR9gIWNZbD70=; b=X9Ctjgut54DBq/RjU/cMaEOYQeZwFVhftBL3w9jQrUhi3D1X9qeGWrGMqieVsA268l 2f2iClwq/bgyguLUGPlygyzTyclf26sFBWoVPZ3wIYDm7S6AyCiAP4P5umXcXIhYDlFH 6QIIBUf7FrkRHpz77X5gY49dW8HVSJxJ34nhGYKOHZ1YgovLK+NQj6SN5nhTX3whGXfx iVaqDJoiRri9RYVOzquWI1BdaS25MEB2zXrl/KN4QgkViRzWWW8/eLVZzdz8AIXOyPYv 6qHTDs3DfGDwMqG0EfCNe7uKTJbPW++BJdKXxU6GdXtSYlIQAIn0cyir+OQkDadCZQEl 6SKQ== X-Gm-Message-State: ALoCoQnMjWMuekZFIJKdnnQIdqCVVXzPqHa1JWTvtxJL9yURM8pUVLGNPI6Bjqbs6hKLWmq9im1O4vkuHvTBQhMJqgRCV1DfkYAgCGEDTnzpK0XuLB5VbMtJnDel1vs95KiWLGyO5Avz9vMyVx2vy/pO4S6FjOeERlNyngZ2qVJZJ8z67jxRVoEUbHrK8E64a7l/M7kPatcKKY1AyXHf4awNpfyQZfhstl9S65Tm/QkeUR4e/3em0k0= X-Received: by 10.43.69.210 with SMTP id yd18mr4024290icb.10.1393569432289; Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id e21si112385yhl.7.2014.02.27.22.37.12 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from hojo20.mtv.corp.google.com (hojo20.mtv.corp.google.com [172.22.72.28]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 08C8B5A42D5; Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id AB2121815C6; Thu, 27 Feb 2014 22:37:11 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Thu, 27 Feb 2014 22:35:47 -0800 Message-Id: <1393569362-27285-5-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393569362-27285-1-git-send-email-dgreid@chromium.org> References: <1393569362-27285-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFC 04/19] 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 8eec5cb..053137e 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -405,7 +405,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"); @@ -1051,7 +1051,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 @@ -2306,7 +2306,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; @@ -2421,7 +2421,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; @@ -2514,9 +2514,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); @@ -2781,8 +2781,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 */ @@ -2793,9 +2793,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); } } } @@ -2849,7 +2849,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 @@ -3364,7 +3365,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"); @@ -3374,7 +3375,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");