netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net] MIPS: lantiq: dma: add dev pointer
@ 2018-09-09 19:26 Hauke Mehrtens
  2018-09-10 12:45 ` Andrew Lunn
  2018-09-12  6:33 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2018-09-09 19:26 UTC (permalink / raw)
  To: davem
  Cc: netdev, andrew, f.fainelli, john, linux-mips, hauke.mehrtens,
	paul.burton, Hauke Mehrtens

dma_zalloc_coherent() now crashes if no dev pointer is given.
Add a dev pointer to the ltq_dma_channel structure and fill it in the
driver using it.

This fixes a bug introduced in kernel 4.19.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---

no changes since v1.

This should go into kernel 4.19 and I have some other patches adding new 
features for kernel 4.20 which are depending on this, so I would prefer 
if this goes through the net tree. 

 arch/mips/include/asm/mach-lantiq/xway/xway_dma.h | 1 +
 arch/mips/lantiq/xway/dma.c                       | 4 ++--
 drivers/net/ethernet/lantiq_etop.c                | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h
index 4901833498f7..8441b2698e64 100644
--- a/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h
+++ b/arch/mips/include/asm/mach-lantiq/xway/xway_dma.h
@@ -40,6 +40,7 @@ struct ltq_dma_channel {
 	int desc;			/* the current descriptor */
 	struct ltq_dma_desc *desc_base; /* the descriptor base */
 	int phys;			/* physical addr */
+	struct device *dev;
 };
 
 enum {
diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
index 4b9fbb6744ad..664f2f7f55c1 100644
--- a/arch/mips/lantiq/xway/dma.c
+++ b/arch/mips/lantiq/xway/dma.c
@@ -130,7 +130,7 @@ ltq_dma_alloc(struct ltq_dma_channel *ch)
 	unsigned long flags;
 
 	ch->desc = 0;
-	ch->desc_base = dma_zalloc_coherent(NULL,
+	ch->desc_base = dma_zalloc_coherent(ch->dev,
 				LTQ_DESC_NUM * LTQ_DESC_SIZE,
 				&ch->phys, GFP_ATOMIC);
 
@@ -182,7 +182,7 @@ ltq_dma_free(struct ltq_dma_channel *ch)
 	if (!ch->desc_base)
 		return;
 	ltq_dma_close(ch);
-	dma_free_coherent(NULL, LTQ_DESC_NUM * LTQ_DESC_SIZE,
+	dma_free_coherent(ch->dev, LTQ_DESC_NUM * LTQ_DESC_SIZE,
 		ch->desc_base, ch->phys);
 }
 EXPORT_SYMBOL_GPL(ltq_dma_free);
diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 7a637b51c7d2..e08301d833e2 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -274,6 +274,7 @@ ltq_etop_hw_init(struct net_device *dev)
 		struct ltq_etop_chan *ch = &priv->ch[i];
 
 		ch->idx = ch->dma.nr = i;
+		ch->dma.dev = &priv->pdev->dev;
 
 		if (IS_TX(i)) {
 			ltq_dma_alloc_tx(&ch->dma);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net] MIPS: lantiq: dma: add dev pointer
  2018-09-09 19:26 [PATCH v2 net] MIPS: lantiq: dma: add dev pointer Hauke Mehrtens
@ 2018-09-10 12:45 ` Andrew Lunn
  2018-09-11 21:36   ` Hauke Mehrtens
  2018-09-12  6:33 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2018-09-10 12:45 UTC (permalink / raw)
  To: Hauke Mehrtens
  Cc: davem, netdev, f.fainelli, john, linux-mips, hauke.mehrtens, paul.burton

On Sun, Sep 09, 2018 at 09:26:23PM +0200, Hauke Mehrtens wrote:
> dma_zalloc_coherent() now crashes if no dev pointer is given.
> Add a dev pointer to the ltq_dma_channel structure and fill it in the
> driver using it.
> 
> This fixes a bug introduced in kernel 4.19.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
> 
> no changes since v1.
> 
> This should go into kernel 4.19 and I have some other patches adding new 
> features for kernel 4.20 which are depending on this, so I would prefer 
> if this goes through the net tree. 

Hi Hauke

Is this a build time dependency, or a runtime dependency?

What we don't want to do is add the switch driver to net-next and find
it does not compile because this change is not in net-next yet.

   Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net] MIPS: lantiq: dma: add dev pointer
  2018-09-10 12:45 ` Andrew Lunn
@ 2018-09-11 21:36   ` Hauke Mehrtens
  0 siblings, 0 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2018-09-11 21:36 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: davem, netdev, f.fainelli, john, linux-mips, hauke.mehrtens, paul.burton


[-- Attachment #1.1: Type: text/plain, Size: 946 bytes --]

On 09/10/2018 02:45 PM, Andrew Lunn wrote:
> On Sun, Sep 09, 2018 at 09:26:23PM +0200, Hauke Mehrtens wrote:
>> dma_zalloc_coherent() now crashes if no dev pointer is given.
>> Add a dev pointer to the ltq_dma_channel structure and fill it in the
>> driver using it.
>>
>> This fixes a bug introduced in kernel 4.19.
>>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>
>> no changes since v1.
>>
>> This should go into kernel 4.19 and I have some other patches adding new 
>> features for kernel 4.20 which are depending on this, so I would prefer 
>> if this goes through the net tree. 
> 
> Hi Hauke
> 
> Is this a build time dependency, or a runtime dependency?
> 
> What we don't want to do is add the switch driver to net-next and find
> it does not compile because this change is not in net-next yet.
> 
>    Andrew
> 

Yes, this has a compile dependency because I had to extend the API.

Hauke


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 net] MIPS: lantiq: dma: add dev pointer
  2018-09-09 19:26 [PATCH v2 net] MIPS: lantiq: dma: add dev pointer Hauke Mehrtens
  2018-09-10 12:45 ` Andrew Lunn
@ 2018-09-12  6:33 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-09-12  6:33 UTC (permalink / raw)
  To: hauke
  Cc: netdev, andrew, f.fainelli, john, linux-mips, hauke.mehrtens,
	paul.burton

From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun,  9 Sep 2018 21:26:23 +0200

> dma_zalloc_coherent() now crashes if no dev pointer is given.
> Add a dev pointer to the ltq_dma_channel structure and fill it in the
> driver using it.
> 
> This fixes a bug introduced in kernel 4.19.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

Applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-12 11:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-09 19:26 [PATCH v2 net] MIPS: lantiq: dma: add dev pointer Hauke Mehrtens
2018-09-10 12:45 ` Andrew Lunn
2018-09-11 21:36   ` Hauke Mehrtens
2018-09-12  6:33 ` David Miller

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).