From patchwork Wed Dec 13 06:34:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 10109297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 28CF9602C2 for ; Wed, 13 Dec 2017 06:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24F111FF40 for ; Wed, 13 Dec 2017 06:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19C4A28D11; Wed, 13 Dec 2017 06:35:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 396FE1FF40 for ; Wed, 13 Dec 2017 06:35:51 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id CA47426780A; Wed, 13 Dec 2017 07:35:38 +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 AC8EC267818; Wed, 13 Dec 2017 07:35:37 +0100 (CET) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by alsa0.perex.cz (Postfix) with ESMTP id DE65326780A for ; Wed, 13 Dec 2017 07:35:34 +0100 (CET) Received: by mail-pf0-f195.google.com with SMTP id l24so931305pfj.6 for ; Tue, 12 Dec 2017 22:35:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H/pGkv54+96S82TBAmt7r62L7US5fojET5Jo3gffNmk=; b=ngUb+z8s/Eq09NUjaFAeC3DGRlu0jOv/FJVlF0AJYPKGZzCXWxvDWum2Lvk/3IAH8Q RI362J0Y8rz9F94mxhMsEeBR9A3zAucUYKP7KHBhPzhWyJv0nLuD5EMHEx+H+IyfRW5l MPQDe8xwyB+d2mWY8H23/hNRXTBb9mNGVLIcBWFl1HxbaIxUkmGHCRoLWlANxphdpyTE 8tWr/028MLMtdWrAwS2tZET95Mwio5DWKPAgK2+cE3t8TA+RFwm7vVi9dJz2b3RCb8gI eaUiGV+KG8oKMoWO6x69Gy85X9QeSd0q+8AyaxDRcdUX1Fe49gRi021amFm/WJzKPcdJ Z9Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H/pGkv54+96S82TBAmt7r62L7US5fojET5Jo3gffNmk=; b=TRrLZATu20GigdNTulOBEsJEEFPz/+ODYapXGjr2LRFpS/XSL9rs3c9UomT+WgiPP4 5M/FZz9YiV0R1xn7NcuhcuGJ4E1fFGC99Mt+SqByakXg+8D+oAzri8bg5w+XxtvExTYV rL07qAucB6Zs5JLNJoHMEavpesiXdk6LzV7X+yN93KqAHSYiiLBOB21tf58SgOoD21jw t8WnRMwzg+5w/2L02PkPkV3shJcp3KX6T+5b+KGN1F/z7xFeMZvWUsgBQeq6+8UzlIot R2w3vWl+PMUqyI///iFvmMb8o/a5UzBzXxA7FTBEWwZ+/UvxWcoOZdE7tb8u/mbATP+1 Dncw== X-Gm-Message-State: AKGB3mK7vYsvNVa2Po7oYnLXkysDmwBZsnWhPhMgwc3oxCqXYhUawIOY feEGzxXAn0KPBIKOxqJU3x4= X-Google-Smtp-Source: ACJfBovRYtIHYnJocbgns93dAVjmgQ7Lx76AfxzTSrmcPSBfY0aOef/6DhsWV/tWWMOjjouDdHzisg== X-Received: by 10.98.10.143 with SMTP id 15mr4887611pfk.89.1513146933412; Tue, 12 Dec 2017 22:35:33 -0800 (PST) Received: from Asurada-CZ80.localdomain (c-73-231-2-134.hsd1.ca.comcast.net. [73.231.2.134]) by smtp.gmail.com with ESMTPSA id m63sm1574900pfj.80.2017.12.12.22.35.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Dec 2017 22:35:32 -0800 (PST) From: Nicolin Chen To: broonie@kernel.org Date: Tue, 12 Dec 2017 22:34:25 -0800 Message-Id: <1513146874-25476-3-git-send-email-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513146874-25476-1-git-send-email-nicoleotsuka@gmail.com> References: <1513146874-25476-1-git-send-email-nicoleotsuka@gmail.com> Cc: alsa-devel@alsa-project.org, kernel@pengutronix.de, lgirdwood@gmail.com, timur@tabi.org, caleb@crome.org, linux-kernel@vger.kernel.org, arnaud.mouiche@invoxia.com, lukma@denx.de, fabio.estevam@nxp.com, mail@maciej.szmigiero.name, linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH v2 02/11] ASoC: fsl_ssi: Cache pdev->dev pointer 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 There should be no trouble to understand dev = pdev->dev. This can save some space to have more print info or save some wrapped lines. Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl_ssi.c | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 84d2f7e..e903c92 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1379,23 +1379,24 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, struct fsl_ssi *ssi, void __iomem *iomem) { struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; u32 dmas[4]; int ret; if (ssi->has_ipg_clk_name) - ssi->clk = devm_clk_get(&pdev->dev, "ipg"); + ssi->clk = devm_clk_get(dev, "ipg"); else - ssi->clk = devm_clk_get(&pdev->dev, NULL); + ssi->clk = devm_clk_get(dev, NULL); if (IS_ERR(ssi->clk)) { ret = PTR_ERR(ssi->clk); - dev_err(&pdev->dev, "could not get clock: %d\n", ret); + dev_err(dev, "could not get clock: %d\n", ret); return ret; } if (!ssi->has_ipg_clk_name) { ret = clk_prepare_enable(ssi->clk); if (ret) { - dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret); + dev_err(dev, "clk_prepare_enable failed: %d\n", ret); return ret; } } @@ -1403,9 +1404,9 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, /* For those SLAVE implementations, we ignore non-baudclk cases * and, instead, abandon MASTER mode that needs baud clock. */ - ssi->baudclk = devm_clk_get(&pdev->dev, "baud"); + ssi->baudclk = devm_clk_get(dev, "baud"); if (IS_ERR(ssi->baudclk)) - dev_dbg(&pdev->dev, "could not get baud clock: %ld\n", + dev_dbg(dev, "could not get baud clock: %ld\n", PTR_ERR(ssi->baudclk)); ssi->dma_params_tx.maxburst = ssi->dma_maxburst; @@ -1469,6 +1470,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) struct fsl_ssi *ssi; int ret = 0; struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; const struct of_device_id *of_id; const char *p, *sprop; const uint32_t *iprop; @@ -1477,17 +1479,16 @@ static int fsl_ssi_probe(struct platform_device *pdev) char name[64]; struct regmap_config regconfig = fsl_ssi_regconfig; - of_id = of_match_device(fsl_ssi_ids, &pdev->dev); + of_id = of_match_device(fsl_ssi_ids, dev); if (!of_id || !of_id->data) return -EINVAL; - ssi = devm_kzalloc(&pdev->dev, sizeof(*ssi), - GFP_KERNEL); + ssi = devm_kzalloc(dev, sizeof(*ssi), GFP_KERNEL); if (!ssi) return -ENOMEM; ssi->soc = of_id->data; - ssi->dev = &pdev->dev; + ssi->dev = dev; sprop = of_get_property(np, "fsl,mode", NULL); if (sprop) { @@ -1507,10 +1508,10 @@ static int fsl_ssi_probe(struct platform_device *pdev) memcpy(&ssi->cpu_dai_drv, &fsl_ssi_dai_template, sizeof(fsl_ssi_dai_template)); } - ssi->cpu_dai_drv.name = dev_name(&pdev->dev); + ssi->cpu_dai_drv.name = dev_name(dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - iomem = devm_ioremap_resource(&pdev->dev, res); + iomem = devm_ioremap_resource(dev, res); if (IS_ERR(iomem)) return PTR_ERR(iomem); ssi->ssi_phys = res->start; @@ -1528,21 +1529,20 @@ static int fsl_ssi_probe(struct platform_device *pdev) ret = of_property_match_string(np, "clock-names", "ipg"); if (ret < 0) { ssi->has_ipg_clk_name = false; - ssi->regs = devm_regmap_init_mmio(&pdev->dev, iomem, - ®config); + ssi->regs = devm_regmap_init_mmio(dev, iomem, ®config); } else { ssi->has_ipg_clk_name = true; - ssi->regs = devm_regmap_init_mmio_clk(&pdev->dev, - "ipg", iomem, ®config); + ssi->regs = devm_regmap_init_mmio_clk(dev, "ipg", iomem, + ®config); } if (IS_ERR(ssi->regs)) { - dev_err(&pdev->dev, "Failed to init register map\n"); + dev_err(dev, "Failed to init register map\n"); return PTR_ERR(ssi->regs); } ssi->irq = platform_get_irq(pdev, 0); if (ssi->irq < 0) { - dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); + dev_err(dev, "no irq for node %s\n", pdev->name); return ssi->irq; } @@ -1605,7 +1605,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) break; } - dev_set_drvdata(&pdev->dev, ssi); + dev_set_drvdata(dev, ssi); if (ssi->soc->imx) { ret = fsl_ssi_imx_probe(pdev, ssi, iomem); @@ -1617,30 +1617,28 @@ static int fsl_ssi_probe(struct platform_device *pdev) mutex_init(&ssi->ac97_reg_lock); ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev); if (ret) { - dev_err(&pdev->dev, "could not set AC'97 ops\n"); + dev_err(dev, "could not set AC'97 ops\n"); goto error_ac97_ops; } } - ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component, + ret = devm_snd_soc_register_component(dev, &fsl_ssi_component, &ssi->cpu_dai_drv, 1); if (ret) { - dev_err(&pdev->dev, "failed to register DAI: %d\n", ret); + dev_err(dev, "failed to register DAI: %d\n", ret); goto error_asoc_register; } if (ssi->use_dma) { - ret = devm_request_irq(&pdev->dev, ssi->irq, - fsl_ssi_isr, 0, dev_name(&pdev->dev), - ssi); + ret = devm_request_irq(dev, ssi->irq, fsl_ssi_isr, 0, + dev_name(dev), ssi); if (ret < 0) { - dev_err(&pdev->dev, "could not claim irq %u\n", - ssi->irq); + dev_err(dev, "could not claim irq %u\n", ssi->irq); goto error_asoc_register; } } - ret = fsl_ssi_debugfs_create(&ssi->dbg_stats, &pdev->dev); + ret = fsl_ssi_debugfs_create(&ssi->dbg_stats, dev); if (ret) goto error_asoc_register; @@ -1665,23 +1663,23 @@ static int fsl_ssi_probe(struct platform_device *pdev) snprintf(name, sizeof(name), "snd-soc-%s", sprop); make_lowercase(name); - ssi->pdev = platform_device_register_data(&pdev->dev, name, 0, NULL, 0); + ssi->pdev = platform_device_register_data(dev, name, 0, NULL, 0); if (IS_ERR(ssi->pdev)) { ret = PTR_ERR(ssi->pdev); - dev_err(&pdev->dev, "failed to register platform: %d\n", ret); + dev_err(dev, "failed to register platform: %d\n", ret); goto error_sound_card; } done: if (ssi->dai_fmt) - _fsl_ssi_set_dai_fmt(&pdev->dev, ssi, ssi->dai_fmt); + _fsl_ssi_set_dai_fmt(dev, ssi, ssi->dai_fmt); if (fsl_ssi_is_ac97(ssi)) { u32 ssi_idx; ret = of_property_read_u32(np, "cell-index", &ssi_idx); if (ret) { - dev_err(&pdev->dev, "cannot get SSI index property\n"); + dev_err(dev, "cannot get SSI index property\n"); goto error_sound_card; } @@ -1689,7 +1687,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) "ac97-codec", ssi_idx, NULL, 0); if (IS_ERR(ssi->pdev)) { ret = PTR_ERR(ssi->pdev); - dev_err(&pdev->dev, + dev_err(dev, "failed to register AC97 codec platform: %d\n", ret); goto error_sound_card;