From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
To: dmaengine@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, vinod.koul@intel.com,
dan.j.williams@intel.com, andriy.shevchenko@linux.intel.com,
vireshk@kernel.org, linux-snps-arc@lists.infradead.org,
Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Subject: [PATCH v3 2/3] dmaengine: DW DMAC: convert to unified device property API
Date: Fri, 28 Oct 2016 19:00:01 +0300 [thread overview]
Message-ID: <1477670402-23943-3-git-send-email-Eugeniy.Paltsev@synopsys.com> (raw)
In-Reply-To: <1477670402-23943-1-git-send-email-Eugeniy.Paltsev@synopsys.com>
Convert device tree properties reading to unified device
property API, update properties names as ordered by DT policy.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
drivers/dma/dw/platform.c | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index 77cde375..85368bc 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -98,56 +98,51 @@ static inline void dw_dma_acpi_controller_register(struct dw_dma *dw) {}
#ifdef CONFIG_OF
static struct dw_dma_platform_data *
-dw_dma_parse_dt(struct platform_device *pdev)
+dw_dma_parse_properties(struct device *dev)
{
- struct device_node *np = pdev->dev.of_node;
struct dw_dma_platform_data *pdata;
u32 tmp, arr[DW_DMA_MAX_NR_MASTERS];
u32 nr_masters;
u32 nr_channels;
- if (!np) {
- dev_err(&pdev->dev, "Missing DT data\n");
- return NULL;
- }
-
- pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return NULL;
pdata->only_quirks_used = true;
- if (of_property_read_bool(np, "is_private"))
+ if (device_property_read_bool(dev, "is-private"))
pdata->is_private = true;
- if (of_property_read_bool(np, "is-memcpy"))
+ if (device_property_read_bool(dev, "is-memcpy"))
pdata->is_memcpy = true;
- if (of_property_read_u32(np, "dma-masters", &nr_masters))
+ if (device_property_read_u32(dev, "dma-masters", &nr_masters))
return pdata;
if (nr_masters < 1 || nr_masters > DW_DMA_MAX_NR_MASTERS)
return pdata;
pdata->nr_masters = nr_masters;
- if (of_property_read_u32(np, "dma-channels", &nr_channels))
+ if (device_property_read_u32(dev, "dma-channels", &nr_channels))
return pdata;
pdata->nr_channels = nr_channels;
- if (of_property_read_bool(np, "is-nollp"))
+ if (device_property_read_bool(dev, "is-nollp"))
pdata->is_nollp = true;
- if (!of_property_read_u32(np, "chan_allocation_order", &tmp))
+ if (!device_property_read_u32(dev, "chan-allocation-order", &tmp))
pdata->chan_allocation_order = (unsigned char)tmp;
- if (!of_property_read_u32(np, "chan_priority", &tmp))
+ if (!device_property_read_u32(dev, "chan-priority", &tmp))
pdata->chan_priority = tmp;
- if (!of_property_read_u32(np, "block_size", &tmp))
+ if (!device_property_read_u32(dev, "block-size", &tmp))
pdata->block_size = tmp;
- if (!of_property_read_u32_array(np, "data-width", arr, nr_masters)) {
+ if (!device_property_read_u32_array(dev, "data-width", arr,
+ nr_masters)) {
for (tmp = 0; tmp < nr_masters; tmp++)
pdata->data_width[tmp] = arr[tmp];
}
@@ -158,7 +153,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
}
#else
static inline struct dw_dma_platform_data *
-dw_dma_parse_dt(struct platform_device *pdev)
+dw_dma_parse_properties(struct device *dev)
{
return NULL;
}
@@ -191,7 +186,7 @@ static int dw_probe(struct platform_device *pdev)
pdata = dev_get_platdata(dev);
if (!pdata)
- pdata = dw_dma_parse_dt(pdev);
+ pdata = dw_dma_parse_properties(dev);
chip->dev = dev;
chip->pdata = pdata;
--
2.5.5
next prev parent reply other threads:[~2016-10-28 16:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-28 15:59 [PATCH v3 0/3] dmaengine: DW DMAC: split pdata to hardware properties Eugeniy Paltsev
2016-10-28 16:00 ` [PATCH v3 1/3] dmaengine: DW DMAC: split pdata to hardware properties and platform quirks Eugeniy Paltsev
2016-10-28 16:00 ` Eugeniy Paltsev [this message]
2016-10-28 16:00 ` [PATCH v3 3/3] dmaengine: DW DMAC: move "nollp" to "dwc->flags" Eugeniy Paltsev
2016-10-28 16:15 ` [PATCH v3 0/3] dmaengine: DW DMAC: split pdata to hardware properties Andy Shevchenko
2016-11-02 11:55 ` Eugeniy Paltsev
2016-11-07 13:55 ` Andy Shevchenko
2016-11-08 12:22 ` Eugeniy Paltsev
2016-11-08 13:36 ` Andy Shevchenko
2016-11-10 16:28 ` Eugeniy Paltsev
2016-11-11 11:05 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477670402-23943-3-git-send-email-Eugeniy.Paltsev@synopsys.com \
--to=eugeniy.paltsev@synopsys.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=vinod.koul@intel.com \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).