Message ID | f2e9790d8b49aeba8b43ce018d30a35b837ac1eb.1700409299.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1714130vqn; Sun, 19 Nov 2023 07:56:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTNkcZ4Ei65t/LFPRjqAzDqpe0EEyCB6ttzBY3AuYsPEWFmnrQCXrAmLI5TqnnVDjS1xG1 X-Received: by 2002:a05:6a20:8f27:b0:186:8dc1:f4a with SMTP id b39-20020a056a208f2700b001868dc10f4amr7005485pzk.0.1700409373564; Sun, 19 Nov 2023 07:56:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700409373; cv=none; d=google.com; s=arc-20160816; b=muhrT0RjNWZJl0Mv2L4HZkRHYB9IM7HF/vDLk7+9k/In2mCziNZiREGgEHeEuRSk0d QMjRVTGC+V/mVZ5v3Dttgo6Kdxvsxkwim3AbGewo41eG01VAcXHGX3Dllj2erWpP0dtl GiZLYE1byifmjh+2XNVi5QQhHH2VrSZO25p1mjwJ6FFWiOdgqsmq0jlivL2LpmcyOMhx FpIvKntV0dM/VeVGzGUtuidoJ/DLAmq0zY8ykTeC8paVGry6OjXbs/9UTPoV/+8IPVO2 q+2+zFA5y3rnO3IDzB/J2e7k5tnxbQAQmPYu72RTpGg/6mBCgg2sFO3G5M9odY1oboai IYtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Pk/dqXN8wqk5MN1OczjCM6gfHKmZ2sdCVcd4g3SfGHU=; fh=iRt7H+nQcxp956m/SJ+6X0xiih1dp4S/oJPYAVJxZYQ=; b=fd+uGVnz38yDauUQnkq+E7GL2ubFu2Ceepz0UIdK8qslai5AtyzizySNPnUUHbiZFq LUFhDMBMeKekJri+4ZNB1p10dsseD1TrRI56FQYfZKKoi7jkEaCka9Racho7cMJUCb/P vGQm1OXUoDCELeBu1tJEjlMoJ3J0ZqBCUXI8rjm3YExJPoGIqVI94nhufpH9csdAqOcc WuEniVtsijPqRr0O8KewGiOtJYThtJYTdwkivf7VJBFZKxTOs1CAThwVcZGSt5Ds19rA XovmY2dLIkItOF7oALjoBjJ0vXFUVw+bINsVyZCfPVm212wD5qv4xec141jvENBUwcV9 HinQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=DEIHA1P0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j6-20020a056a00234600b0068e4a646d2csi6450843pfj.252.2023.11.19.07.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 07:56:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=DEIHA1P0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id BD4148088A81; Sun, 19 Nov 2023 07:56:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbjKSPz0 (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Sun, 19 Nov 2023 10:55:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbjKSPzZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 19 Nov 2023 10:55:25 -0500 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 435A8128 for <linux-kernel@vger.kernel.org>; Sun, 19 Nov 2023 07:55:21 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 4k8jra5LJxVPt4k8jrzYqY; Sun, 19 Nov 2023 16:55:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1700409318; bh=Pk/dqXN8wqk5MN1OczjCM6gfHKmZ2sdCVcd4g3SfGHU=; h=From:To:Cc:Subject:Date; b=DEIHA1P0nqzgSjkJf9O8nWTv/D9NfWyIw1YGskUroT1NBO110kk5Ozj5WEZ8ACT3Z gGl/iqRkvaIWUGv6Hz6k0SkX3rQMLlRtomZvUzAedUi7qyriZDF8WcOqxvOi1oItaD +58UV04puQ8nQt5eFa6RW3732cA55yvcLvNlK+DmBEkpxhMP5x035UmGy90wztY+kV aydw5TDN/DNbwMiwNIo5+NZZfux2gLPZB0t2b6C8SPQnd2U7JXF7JDJYiHbMN8aCy5 H7OtZnEj7t1jisCbbEJoozGPOTu+uHPTy1azyMhOKfWJb+FqH5GqIhG984M1MPXSf3 TFYAtCT9D6amQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 19 Nov 2023 16:55:18 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Richard Genoud <richard.genoud@gmail.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, Nicolas Ferre <nicolas.ferre@microchip.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Claudiu Beznea <claudiu.beznea@tuxon.dev> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] serial: atmel: convert not to use dma_request_slave_channel() Date: Sun, 19 Nov 2023 16:55:15 +0100 Message-Id: <f2e9790d8b49aeba8b43ce018d30a35b837ac1eb.1700409299.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 19 Nov 2023 07:56:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783006805860863017 X-GMAIL-MSGID: 1783008459267823597 |
Series |
[v2] serial: atmel: convert not to use dma_request_slave_channel()
|
|
Commit Message
Christophe JAILLET
Nov. 19, 2023, 3:55 p.m. UTC
dma_request_slave_channel() is deprecated. dma_request_chan() should
be used directly instead.
Switch to the preferred function and update the error handling accordingly.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
v2: Also update atmel_prepare_rx_dma()
---
drivers/tty/serial/atmel_serial.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
Comments
Hi, Christophe, On 19.11.2023 17:55, Christophe JAILLET wrote: > dma_request_slave_channel() is deprecated. dma_request_chan() should > be used directly instead. > > Switch to the preferred function and update the error handling accordingly. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > v2: Also update atmel_prepare_rx_dma() > --- > drivers/tty/serial/atmel_serial.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 1946fafc3f3e..6aeb4648843b 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -1013,14 +1013,18 @@ static int atmel_prepare_tx_dma(struct uart_port *port) > struct device *mfd_dev = port->dev->parent; > dma_cap_mask_t mask; > struct dma_slave_config config; > + struct dma_chan *chan; There is no need for this. > int ret, nent; > > dma_cap_zero(mask); > dma_cap_set(DMA_SLAVE, mask); > > - atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx"); > - if (atmel_port->chan_tx == NULL) > + chan = dma_request_chan(mfd_dev, "tx"); > + if (IS_ERR(chan)) { > + atmel_port->chan_tx = NULL; > goto chan_err; > + } > + atmel_port->chan_tx = chan; > dev_info(port->dev, "using %s for tx DMA transfers\n", > dma_chan_name(atmel_port->chan_tx)); > > @@ -1188,6 +1192,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port) > dma_cap_mask_t mask; > struct dma_slave_config config; > struct circ_buf *ring; > + struct dma_chan *chan; Ditto > int ret, nent; > > ring = &atmel_port->rx_ring; > @@ -1195,9 +1200,12 @@ static int atmel_prepare_rx_dma(struct uart_port *port) > dma_cap_zero(mask); > dma_cap_set(DMA_CYCLIC, mask); > > - atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx"); > - if (atmel_port->chan_rx == NULL) > + chan = dma_request_chan(mfd_dev, "rx"); > + if (IS_ERR(chan)) { > + atmel_port->chan_rx = NULL; > goto chan_err; > + } > + atmel_port->chan_rx = chan; > dev_info(port->dev, "using %s for rx DMA transfers\n", > dma_chan_name(atmel_port->chan_rx)); >
On 20. 11. 23, 7:14, claudiu beznea wrote: > Hi, Christophe, > > On 19.11.2023 17:55, Christophe JAILLET wrote: >> dma_request_slave_channel() is deprecated. dma_request_chan() should >> be used directly instead. >> >> Switch to the preferred function and update the error handling accordingly. >> >> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> >> --- >> v2: Also update atmel_prepare_rx_dma() >> --- >> drivers/tty/serial/atmel_serial.c | 16 ++++++++++++---- >> 1 file changed, 12 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c >> index 1946fafc3f3e..6aeb4648843b 100644 >> --- a/drivers/tty/serial/atmel_serial.c >> +++ b/drivers/tty/serial/atmel_serial.c >> @@ -1013,14 +1013,18 @@ static int atmel_prepare_tx_dma(struct uart_port *port) >> struct device *mfd_dev = port->dev->parent; >> dma_cap_mask_t mask; >> struct dma_slave_config config; >> + struct dma_chan *chan; > > There is no need for this. How'd you avoid crash in here then: if (atmel_port->chan_tx) atmel_release_tx_dma(port); ? thanks,
On 20. 11. 23, 8:04, Jiri Slaby wrote: > On 20. 11. 23, 7:14, claudiu beznea wrote: >> Hi, Christophe, >> >> On 19.11.2023 17:55, Christophe JAILLET wrote: >>> dma_request_slave_channel() is deprecated. dma_request_chan() should >>> be used directly instead. >>> >>> Switch to the preferred function and update the error handling >>> accordingly. >>> >>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> >>> --- >>> v2: Also update atmel_prepare_rx_dma() >>> --- >>> drivers/tty/serial/atmel_serial.c | 16 ++++++++++++---- >>> 1 file changed, 12 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/tty/serial/atmel_serial.c >>> b/drivers/tty/serial/atmel_serial.c >>> index 1946fafc3f3e..6aeb4648843b 100644 >>> --- a/drivers/tty/serial/atmel_serial.c >>> +++ b/drivers/tty/serial/atmel_serial.c >>> @@ -1013,14 +1013,18 @@ static int atmel_prepare_tx_dma(struct >>> uart_port *port) >>> struct device *mfd_dev = port->dev->parent; >>> dma_cap_mask_t mask; >>> struct dma_slave_config config; >>> + struct dma_chan *chan; >> >> There is no need for this. > > How'd you avoid crash in here then: > if (atmel_port->chan_tx) > atmel_release_tx_dma(port); > ? I will answer myself: easily. As there is atmel_port->chan_tx = NULL; which I overlooked at first. > thanks,
On Sun, 19 Nov 2023 16:55:15 +0100 Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: Hi, change the subject to: "... replace deprecated dma_request_slave_channel()" Hugo. > dma_request_slave_channel() is deprecated. dma_request_chan() should > be used directly instead. > > Switch to the preferred function and update the error handling accordingly. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > v2: Also update atmel_prepare_rx_dma() > --- > drivers/tty/serial/atmel_serial.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c > index 1946fafc3f3e..6aeb4648843b 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -1013,14 +1013,18 @@ static int atmel_prepare_tx_dma(struct uart_port *port) > struct device *mfd_dev = port->dev->parent; > dma_cap_mask_t mask; > struct dma_slave_config config; > + struct dma_chan *chan; > int ret, nent; > > dma_cap_zero(mask); > dma_cap_set(DMA_SLAVE, mask); > > - atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx"); > - if (atmel_port->chan_tx == NULL) > + chan = dma_request_chan(mfd_dev, "tx"); > + if (IS_ERR(chan)) { > + atmel_port->chan_tx = NULL; > goto chan_err; > + } > + atmel_port->chan_tx = chan; > dev_info(port->dev, "using %s for tx DMA transfers\n", > dma_chan_name(atmel_port->chan_tx)); > > @@ -1188,6 +1192,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port) > dma_cap_mask_t mask; > struct dma_slave_config config; > struct circ_buf *ring; > + struct dma_chan *chan; > int ret, nent; > > ring = &atmel_port->rx_ring; > @@ -1195,9 +1200,12 @@ static int atmel_prepare_rx_dma(struct uart_port *port) > dma_cap_zero(mask); > dma_cap_set(DMA_CYCLIC, mask); > > - atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx"); > - if (atmel_port->chan_rx == NULL) > + chan = dma_request_chan(mfd_dev, "rx"); > + if (IS_ERR(chan)) { > + atmel_port->chan_rx = NULL; > goto chan_err; > + } > + atmel_port->chan_rx = chan; > dev_info(port->dev, "using %s for rx DMA transfers\n", > dma_chan_name(atmel_port->chan_rx)); > > -- > 2.34.1 >
Le 20/11/2023 à 08:12, claudiu beznea a écrit : > > > On 20.11.2023 09:04, Jiri Slaby wrote: >> On 20. 11. 23, 7:14, claudiu beznea wrote: >>> Hi, Christophe, >>> >>> On 19.11.2023 17:55, Christophe JAILLET wrote: >>>> dma_request_slave_channel() is deprecated. dma_request_chan() should >>>> be used directly instead. >>>> >>>> Switch to the preferred function and update the error handling accordingly. >>>> >>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> >>>> --- >>>> v2: Also update atmel_prepare_rx_dma() >>>> --- >>>> drivers/tty/serial/atmel_serial.c | 16 ++++++++++++---- >>>> 1 file changed, 12 insertions(+), 4 deletions(-) >>>> >>>> diff --git a/drivers/tty/serial/atmel_serial.c >>>> b/drivers/tty/serial/atmel_serial.c >>>> index 1946fafc3f3e..6aeb4648843b 100644 >>>> --- a/drivers/tty/serial/atmel_serial.c >>>> +++ b/drivers/tty/serial/atmel_serial.c >>>> @@ -1013,14 +1013,18 @@ static int atmel_prepare_tx_dma(struct uart_port >>>> *port) >>>> struct device *mfd_dev = port->dev->parent; >>>> dma_cap_mask_t mask; >>>> struct dma_slave_config config; >>>> + struct dma_chan *chan; >>> >>> There is no need for this. >> >> How'd you avoid crash in here then: >> if (atmel_port->chan_tx) >> atmel_release_tx_dma(port); >> ? > > I wanted to say that instead of adding the chan variable the > atmel_port->chan_tx would be used instead. You mean something like: - atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx"); - if (atmel_port->chan_tx == NULL) + atmel_port->chan_tx = dma_request_chan(mfd_dev, "tx"); + if (IS_ERR(atmel_port->chan_tx)) { + atmel_port->chan_tx = NULL; ? Mostly a mater of taste. I can send a v3 with that if it is the preferred style. CJ > >> >> thanks, >
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 1946fafc3f3e..6aeb4648843b 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1013,14 +1013,18 @@ static int atmel_prepare_tx_dma(struct uart_port *port) struct device *mfd_dev = port->dev->parent; dma_cap_mask_t mask; struct dma_slave_config config; + struct dma_chan *chan; int ret, nent; dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); - atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx"); - if (atmel_port->chan_tx == NULL) + chan = dma_request_chan(mfd_dev, "tx"); + if (IS_ERR(chan)) { + atmel_port->chan_tx = NULL; goto chan_err; + } + atmel_port->chan_tx = chan; dev_info(port->dev, "using %s for tx DMA transfers\n", dma_chan_name(atmel_port->chan_tx)); @@ -1188,6 +1192,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port) dma_cap_mask_t mask; struct dma_slave_config config; struct circ_buf *ring; + struct dma_chan *chan; int ret, nent; ring = &atmel_port->rx_ring; @@ -1195,9 +1200,12 @@ static int atmel_prepare_rx_dma(struct uart_port *port) dma_cap_zero(mask); dma_cap_set(DMA_CYCLIC, mask); - atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx"); - if (atmel_port->chan_rx == NULL) + chan = dma_request_chan(mfd_dev, "rx"); + if (IS_ERR(chan)) { + atmel_port->chan_rx = NULL; goto chan_err; + } + atmel_port->chan_rx = chan; dev_info(port->dev, "using %s for rx DMA transfers\n", dma_chan_name(atmel_port->chan_rx));