mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sagar Dharia <sdharia@codeaurora.org>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH] slimbus: qcom-ctrl: use normal allocation
Date: Tue,  2 Jan 2018 11:48:54 +0100	[thread overview]
Message-ID: <20180102104909.1369737-1-arnd@arndb.de> (raw)

The previous patch addressed a warning but not the cause:

drivers/slimbus/qcom-ctrl.c: In function 'qcom_slim_probe':
drivers/slimbus/qcom-ctrl.c:584:9: error: passing argument 3 of 'dmam_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]

There are two things wrong here:

- The naming is very confusing, we now have a member named 'phys'
  that doesn't refer to a phys_addr_t but a dma_addr_t. If we needed
  a dma address, it should be named 'dma' to avoid confusion, and
  to make it less likely that someone passes it into a function that
  expects a physical address.

- The dma address is not used at all at this point. It may have been
  designed to support DMA in the future, but today it doesn't, so
  the only effect right now is to make transfers artificially slower
  by using uncached memory instead of cached memory for a temporary
  buffer.

This removes the unused structure member and instead changes the code
to call devm_kcalloc(), which matches the usage of the 'base' pointer
as an array of temporary buffers.

Fixes: db809859c8ce ("slimbus: qcom: fix incompatible pointer warning")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/slimbus/qcom-ctrl.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index f51de1277912..fb1a5e0eb8dd 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -13,7 +13,6 @@
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/of.h>
-#include <linux/dma-mapping.h>
 #include <linux/pm_runtime.h>
 #include "slimbus.h"
 
@@ -93,7 +92,6 @@
 
 struct slim_ctrl_buf {
 	void		*base;
-	dma_addr_t	phy;
 	spinlock_t	lock;
 	int		head;
 	int		tail;
@@ -579,17 +577,15 @@ static int qcom_slim_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_rclk_enable_failed;
 
-	ctrl->tx.base = dmam_alloc_coherent(&pdev->dev,
-					   (ctrl->tx.sl_sz * ctrl->tx.n),
-					   &ctrl->tx.phy, GFP_KERNEL);
+	ctrl->tx.base = devm_kcalloc(&pdev->dev, ctrl->tx.n, ctrl->tx.sl_sz,
+				     GFP_KERNEL);
 	if (!ctrl->tx.base) {
 		ret = -ENOMEM;
 		goto err;
 	}
 
-	ctrl->rx.base = dmam_alloc_coherent(&pdev->dev,
-					   (ctrl->rx.sl_sz * ctrl->rx.n),
-					   &ctrl->rx.phy, GFP_KERNEL);
+	ctrl->rx.base = devm_kcalloc(&pdev->dev,ctrl->rx.n, ctrl->rx.sl_sz,
+				     GFP_KERNEL);
 	if (!ctrl->rx.base) {
 		ret = -ENOMEM;
 		goto err;
-- 
2.9.0

                 reply	other threads:[~2018-01-02 10:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180102104909.1369737-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sdharia@codeaurora.org \
    --cc=srinivas.kandagatla@linaro.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

Powered by JetHome