diff options
author | Nicolin Chen <nicoleotsuka@gmail.com> | 2017-12-17 21:52:01 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-12-19 04:24:27 -0500 |
commit | 8483c06797b62dbddac800b555b2fa1c689dbb1c (patch) | |
tree | d1468a75e10df32da4906843a9d480b4c5dbca00 | |
parent | f31768349447cdf975abbcb7d4a18c0b5d4971c3 (diff) |
ASoC: fsl_ssi: Cache pdev->dev pointer
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 <nicoleotsuka@gmail.com>
Tested-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Reviewed-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Acked-by: Timur Tabi <timur@tabi.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 84d2f7ecb5e1..e903c92d5512 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, | |||
1379 | struct fsl_ssi *ssi, void __iomem *iomem) | 1379 | struct fsl_ssi *ssi, void __iomem *iomem) |
1380 | { | 1380 | { |
1381 | struct device_node *np = pdev->dev.of_node; | 1381 | struct device_node *np = pdev->dev.of_node; |
1382 | struct device *dev = &pdev->dev; | ||
1382 | u32 dmas[4]; | 1383 | u32 dmas[4]; |
1383 | int ret; | 1384 | int ret; |
1384 | 1385 | ||
1385 | if (ssi->has_ipg_clk_name) | 1386 | if (ssi->has_ipg_clk_name) |
1386 | ssi->clk = devm_clk_get(&pdev->dev, "ipg"); | 1387 | ssi->clk = devm_clk_get(dev, "ipg"); |
1387 | else | 1388 | else |
1388 | ssi->clk = devm_clk_get(&pdev->dev, NULL); | 1389 | ssi->clk = devm_clk_get(dev, NULL); |
1389 | if (IS_ERR(ssi->clk)) { | 1390 | if (IS_ERR(ssi->clk)) { |
1390 | ret = PTR_ERR(ssi->clk); | 1391 | ret = PTR_ERR(ssi->clk); |
1391 | dev_err(&pdev->dev, "could not get clock: %d\n", ret); | 1392 | dev_err(dev, "could not get clock: %d\n", ret); |
1392 | return ret; | 1393 | return ret; |
1393 | } | 1394 | } |
1394 | 1395 | ||
1395 | if (!ssi->has_ipg_clk_name) { | 1396 | if (!ssi->has_ipg_clk_name) { |
1396 | ret = clk_prepare_enable(ssi->clk); | 1397 | ret = clk_prepare_enable(ssi->clk); |
1397 | if (ret) { | 1398 | if (ret) { |
1398 | dev_err(&pdev->dev, "clk_prepare_enable failed: %d\n", ret); | 1399 | dev_err(dev, "clk_prepare_enable failed: %d\n", ret); |
1399 | return ret; | 1400 | return ret; |
1400 | } | 1401 | } |
1401 | } | 1402 | } |
@@ -1403,9 +1404,9 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, | |||
1403 | /* For those SLAVE implementations, we ignore non-baudclk cases | 1404 | /* For those SLAVE implementations, we ignore non-baudclk cases |
1404 | * and, instead, abandon MASTER mode that needs baud clock. | 1405 | * and, instead, abandon MASTER mode that needs baud clock. |
1405 | */ | 1406 | */ |
1406 | ssi->baudclk = devm_clk_get(&pdev->dev, "baud"); | 1407 | ssi->baudclk = devm_clk_get(dev, "baud"); |
1407 | if (IS_ERR(ssi->baudclk)) | 1408 | if (IS_ERR(ssi->baudclk)) |
1408 | dev_dbg(&pdev->dev, "could not get baud clock: %ld\n", | 1409 | dev_dbg(dev, "could not get baud clock: %ld\n", |
1409 | PTR_ERR(ssi->baudclk)); | 1410 | PTR_ERR(ssi->baudclk)); |
1410 | 1411 | ||
1411 | ssi->dma_params_tx.maxburst = ssi->dma_maxburst; | 1412 | ssi->dma_params_tx.maxburst = ssi->dma_maxburst; |
@@ -1469,6 +1470,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1469 | struct fsl_ssi *ssi; | 1470 | struct fsl_ssi *ssi; |
1470 | int ret = 0; | 1471 | int ret = 0; |
1471 | struct device_node *np = pdev->dev.of_node; | 1472 | struct device_node *np = pdev->dev.of_node; |
1473 | struct device *dev = &pdev->dev; | ||
1472 | const struct of_device_id *of_id; | 1474 | const struct of_device_id *of_id; |
1473 | const char *p, *sprop; | 1475 | const char *p, *sprop; |
1474 | const uint32_t *iprop; | 1476 | const uint32_t *iprop; |
@@ -1477,17 +1479,16 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1477 | char name[64]; | 1479 | char name[64]; |
1478 | struct regmap_config regconfig = fsl_ssi_regconfig; | 1480 | struct regmap_config regconfig = fsl_ssi_regconfig; |
1479 | 1481 | ||
1480 | of_id = of_match_device(fsl_ssi_ids, &pdev->dev); | 1482 | of_id = of_match_device(fsl_ssi_ids, dev); |
1481 | if (!of_id || !of_id->data) | 1483 | if (!of_id || !of_id->data) |
1482 | return -EINVAL; | 1484 | return -EINVAL; |
1483 | 1485 | ||
1484 | ssi = devm_kzalloc(&pdev->dev, sizeof(*ssi), | 1486 | ssi = devm_kzalloc(dev, sizeof(*ssi), GFP_KERNEL); |
1485 | GFP_KERNEL); | ||
1486 | if (!ssi) | 1487 | if (!ssi) |
1487 | return -ENOMEM; | 1488 | return -ENOMEM; |
1488 | 1489 | ||
1489 | ssi->soc = of_id->data; | 1490 | ssi->soc = of_id->data; |
1490 | ssi->dev = &pdev->dev; | 1491 | ssi->dev = dev; |
1491 | 1492 | ||
1492 | sprop = of_get_property(np, "fsl,mode", NULL); | 1493 | sprop = of_get_property(np, "fsl,mode", NULL); |
1493 | if (sprop) { | 1494 | if (sprop) { |
@@ -1507,10 +1508,10 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1507 | memcpy(&ssi->cpu_dai_drv, &fsl_ssi_dai_template, | 1508 | memcpy(&ssi->cpu_dai_drv, &fsl_ssi_dai_template, |
1508 | sizeof(fsl_ssi_dai_template)); | 1509 | sizeof(fsl_ssi_dai_template)); |
1509 | } | 1510 | } |
1510 | ssi->cpu_dai_drv.name = dev_name(&pdev->dev); | 1511 | ssi->cpu_dai_drv.name = dev_name(dev); |
1511 | 1512 | ||
1512 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1513 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1513 | iomem = devm_ioremap_resource(&pdev->dev, res); | 1514 | iomem = devm_ioremap_resource(dev, res); |
1514 | if (IS_ERR(iomem)) | 1515 | if (IS_ERR(iomem)) |
1515 | return PTR_ERR(iomem); | 1516 | return PTR_ERR(iomem); |
1516 | ssi->ssi_phys = res->start; | 1517 | ssi->ssi_phys = res->start; |
@@ -1528,21 +1529,20 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1528 | ret = of_property_match_string(np, "clock-names", "ipg"); | 1529 | ret = of_property_match_string(np, "clock-names", "ipg"); |
1529 | if (ret < 0) { | 1530 | if (ret < 0) { |
1530 | ssi->has_ipg_clk_name = false; | 1531 | ssi->has_ipg_clk_name = false; |
1531 | ssi->regs = devm_regmap_init_mmio(&pdev->dev, iomem, | 1532 | ssi->regs = devm_regmap_init_mmio(dev, iomem, ®config); |
1532 | ®config); | ||
1533 | } else { | 1533 | } else { |
1534 | ssi->has_ipg_clk_name = true; | 1534 | ssi->has_ipg_clk_name = true; |
1535 | ssi->regs = devm_regmap_init_mmio_clk(&pdev->dev, | 1535 | ssi->regs = devm_regmap_init_mmio_clk(dev, "ipg", iomem, |
1536 | "ipg", iomem, ®config); | 1536 | ®config); |
1537 | } | 1537 | } |
1538 | if (IS_ERR(ssi->regs)) { | 1538 | if (IS_ERR(ssi->regs)) { |
1539 | dev_err(&pdev->dev, "Failed to init register map\n"); | 1539 | dev_err(dev, "Failed to init register map\n"); |
1540 | return PTR_ERR(ssi->regs); | 1540 | return PTR_ERR(ssi->regs); |
1541 | } | 1541 | } |
1542 | 1542 | ||
1543 | ssi->irq = platform_get_irq(pdev, 0); | 1543 | ssi->irq = platform_get_irq(pdev, 0); |
1544 | if (ssi->irq < 0) { | 1544 | if (ssi->irq < 0) { |
1545 | dev_err(&pdev->dev, "no irq for node %s\n", pdev->name); | 1545 | dev_err(dev, "no irq for node %s\n", pdev->name); |
1546 | return ssi->irq; | 1546 | return ssi->irq; |
1547 | } | 1547 | } |
1548 | 1548 | ||
@@ -1605,7 +1605,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1605 | break; | 1605 | break; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | dev_set_drvdata(&pdev->dev, ssi); | 1608 | dev_set_drvdata(dev, ssi); |
1609 | 1609 | ||
1610 | if (ssi->soc->imx) { | 1610 | if (ssi->soc->imx) { |
1611 | ret = fsl_ssi_imx_probe(pdev, ssi, iomem); | 1611 | ret = fsl_ssi_imx_probe(pdev, ssi, iomem); |
@@ -1617,30 +1617,28 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1617 | mutex_init(&ssi->ac97_reg_lock); | 1617 | mutex_init(&ssi->ac97_reg_lock); |
1618 | ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev); | 1618 | ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev); |
1619 | if (ret) { | 1619 | if (ret) { |
1620 | dev_err(&pdev->dev, "could not set AC'97 ops\n"); | 1620 | dev_err(dev, "could not set AC'97 ops\n"); |
1621 | goto error_ac97_ops; | 1621 | goto error_ac97_ops; |
1622 | } | 1622 | } |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component, | 1625 | ret = devm_snd_soc_register_component(dev, &fsl_ssi_component, |
1626 | &ssi->cpu_dai_drv, 1); | 1626 | &ssi->cpu_dai_drv, 1); |
1627 | if (ret) { | 1627 | if (ret) { |
1628 | dev_err(&pdev->dev, "failed to register DAI: %d\n", ret); | 1628 | dev_err(dev, "failed to register DAI: %d\n", ret); |
1629 | goto error_asoc_register; | 1629 | goto error_asoc_register; |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | if (ssi->use_dma) { | 1632 | if (ssi->use_dma) { |
1633 | ret = devm_request_irq(&pdev->dev, ssi->irq, | 1633 | ret = devm_request_irq(dev, ssi->irq, fsl_ssi_isr, 0, |
1634 | fsl_ssi_isr, 0, dev_name(&pdev->dev), | 1634 | dev_name(dev), ssi); |
1635 | ssi); | ||
1636 | if (ret < 0) { | 1635 | if (ret < 0) { |
1637 | dev_err(&pdev->dev, "could not claim irq %u\n", | 1636 | dev_err(dev, "could not claim irq %u\n", ssi->irq); |
1638 | ssi->irq); | ||
1639 | goto error_asoc_register; | 1637 | goto error_asoc_register; |
1640 | } | 1638 | } |
1641 | } | 1639 | } |
1642 | 1640 | ||
1643 | ret = fsl_ssi_debugfs_create(&ssi->dbg_stats, &pdev->dev); | 1641 | ret = fsl_ssi_debugfs_create(&ssi->dbg_stats, dev); |
1644 | if (ret) | 1642 | if (ret) |
1645 | goto error_asoc_register; | 1643 | goto error_asoc_register; |
1646 | 1644 | ||
@@ -1665,23 +1663,23 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1665 | snprintf(name, sizeof(name), "snd-soc-%s", sprop); | 1663 | snprintf(name, sizeof(name), "snd-soc-%s", sprop); |
1666 | make_lowercase(name); | 1664 | make_lowercase(name); |
1667 | 1665 | ||
1668 | ssi->pdev = platform_device_register_data(&pdev->dev, name, 0, NULL, 0); | 1666 | ssi->pdev = platform_device_register_data(dev, name, 0, NULL, 0); |
1669 | if (IS_ERR(ssi->pdev)) { | 1667 | if (IS_ERR(ssi->pdev)) { |
1670 | ret = PTR_ERR(ssi->pdev); | 1668 | ret = PTR_ERR(ssi->pdev); |
1671 | dev_err(&pdev->dev, "failed to register platform: %d\n", ret); | 1669 | dev_err(dev, "failed to register platform: %d\n", ret); |
1672 | goto error_sound_card; | 1670 | goto error_sound_card; |
1673 | } | 1671 | } |
1674 | 1672 | ||
1675 | done: | 1673 | done: |
1676 | if (ssi->dai_fmt) | 1674 | if (ssi->dai_fmt) |
1677 | _fsl_ssi_set_dai_fmt(&pdev->dev, ssi, ssi->dai_fmt); | 1675 | _fsl_ssi_set_dai_fmt(dev, ssi, ssi->dai_fmt); |
1678 | 1676 | ||
1679 | if (fsl_ssi_is_ac97(ssi)) { | 1677 | if (fsl_ssi_is_ac97(ssi)) { |
1680 | u32 ssi_idx; | 1678 | u32 ssi_idx; |
1681 | 1679 | ||
1682 | ret = of_property_read_u32(np, "cell-index", &ssi_idx); | 1680 | ret = of_property_read_u32(np, "cell-index", &ssi_idx); |
1683 | if (ret) { | 1681 | if (ret) { |
1684 | dev_err(&pdev->dev, "cannot get SSI index property\n"); | 1682 | dev_err(dev, "cannot get SSI index property\n"); |
1685 | goto error_sound_card; | 1683 | goto error_sound_card; |
1686 | } | 1684 | } |
1687 | 1685 | ||
@@ -1689,7 +1687,7 @@ done: | |||
1689 | "ac97-codec", ssi_idx, NULL, 0); | 1687 | "ac97-codec", ssi_idx, NULL, 0); |
1690 | if (IS_ERR(ssi->pdev)) { | 1688 | if (IS_ERR(ssi->pdev)) { |
1691 | ret = PTR_ERR(ssi->pdev); | 1689 | ret = PTR_ERR(ssi->pdev); |
1692 | dev_err(&pdev->dev, | 1690 | dev_err(dev, |
1693 | "failed to register AC97 codec platform: %d\n", | 1691 | "failed to register AC97 codec platform: %d\n", |
1694 | ret); | 1692 | ret); |
1695 | goto error_sound_card; | 1693 | goto error_sound_card; |