2021-02-10 12:12:57

by Aakash Hemadri

[permalink] [raw]
Subject: [PATCH] staging: ralink-gdma: Fix checkpatch.pl CHECK

Remove CHECK: Lines should not end with a '('

Signed-off-by: Aakash Hemadri <[email protected]>
---

drivers/staging/ralink-gdma/ralink-gdma.c | 28 ++++++++++++-----------
1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c
index 655df317d0ee..a11f915f3308 100644
--- a/drivers/staging/ralink-gdma/ralink-gdma.c
+++ b/drivers/staging/ralink-gdma/ralink-gdma.c
@@ -135,8 +135,7 @@ struct gdma_data {
int (*start_transfer)(struct gdma_dmaengine_chan *chan);
};

-static struct gdma_dma_dev *gdma_dma_chan_get_dev(
- struct gdma_dmaengine_chan *chan)
+static struct gdma_dma_dev *gdma_dma_chan_get_dev(struct gdma_dmaengine_chan *chan)
{
return container_of(chan->vchan.chan.device, struct gdma_dma_dev,
ddev);
@@ -510,10 +509,11 @@ static void gdma_dma_issue_pending(struct dma_chan *c)
spin_unlock_irqrestore(&chan->vchan.lock, flags);
}

-static struct dma_async_tx_descriptor *gdma_dma_prep_slave_sg(
- struct dma_chan *c, struct scatterlist *sgl,
- unsigned int sg_len, enum dma_transfer_direction direction,
- unsigned long flags, void *context)
+static struct dma_async_tx_descriptor
+ *gdma_dma_prep_slave_sg(struct dma_chan *c, struct scatterlist *sgl,
+ unsigned int sg_len,
+ enum dma_transfer_direction direction,
+ unsigned long flags, void *context)
{
struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
struct gdma_dma_desc *desc;
@@ -558,9 +558,10 @@ static struct dma_async_tx_descriptor *gdma_dma_prep_slave_sg(
return NULL;
}

-static struct dma_async_tx_descriptor *gdma_dma_prep_dma_memcpy(
- struct dma_chan *c, dma_addr_t dest, dma_addr_t src,
- size_t len, unsigned long flags)
+static struct dma_async_tx_descriptor
+ *gdma_dma_prep_dma_memcpy(struct dma_chan *c,
+ dma_addr_t dest, dma_addr_t src,
+ size_t len, unsigned long flags)
{
struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
struct gdma_dma_desc *desc;
@@ -601,10 +602,11 @@ static struct dma_async_tx_descriptor *gdma_dma_prep_dma_memcpy(
return vchan_tx_prep(&chan->vchan, &desc->vdesc, flags);
}

-static struct dma_async_tx_descriptor *gdma_dma_prep_dma_cyclic(
- struct dma_chan *c, dma_addr_t buf_addr, size_t buf_len,
- size_t period_len, enum dma_transfer_direction direction,
- unsigned long flags)
+static struct dma_async_tx_descriptor
+ *gdma_dma_prep_dma_cyclic(struct dma_chan *c, dma_addr_t buf_addr,
+ size_t buf_len, size_t period_len,
+ enum dma_transfer_direction direction,
+ unsigned long flags)
{
struct gdma_dmaengine_chan *chan = to_gdma_dma_chan(c);
struct gdma_dma_desc *desc;
--
2.30.0


2021-02-10 12:23:59

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: ralink-gdma: Fix checkpatch.pl CHECK

On Wed, Feb 10, 2021 at 05:33:48PM +0530, Aakash Hemadri wrote:
> Remove CHECK: Lines should not end with a '('
>
> Signed-off-by: Aakash Hemadri <[email protected]>
> ---
>
> drivers/staging/ralink-gdma/ralink-gdma.c | 28 ++++++++++++-----------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c
> index 655df317d0ee..a11f915f3308 100644
> --- a/drivers/staging/ralink-gdma/ralink-gdma.c
> +++ b/drivers/staging/ralink-gdma/ralink-gdma.c
> @@ -135,8 +135,7 @@ struct gdma_data {
> int (*start_transfer)(struct gdma_dmaengine_chan *chan);
> };
>
> -static struct gdma_dma_dev *gdma_dma_chan_get_dev(
> - struct gdma_dmaengine_chan *chan)
> +static struct gdma_dma_dev *gdma_dma_chan_get_dev(struct gdma_dmaengine_chan *chan)
> {
> return container_of(chan->vchan.chan.device, struct gdma_dma_dev,
> ddev);
> @@ -510,10 +509,11 @@ static void gdma_dma_issue_pending(struct dma_chan *c)
> spin_unlock_irqrestore(&chan->vchan.lock, flags);
> }
>
> -static struct dma_async_tx_descriptor *gdma_dma_prep_slave_sg(
> - struct dma_chan *c, struct scatterlist *sgl,
> - unsigned int sg_len, enum dma_transfer_direction direction,
> - unsigned long flags, void *context)
> +static struct dma_async_tx_descriptor
> + *gdma_dma_prep_slave_sg(struct dma_chan *c, struct scatterlist *sgl,

Don't do it like this... The original code is better so, I guess, lets
leave it as is. There are two accepted ways to start a function in the
kernel:

ONE:
static type
function_name(paramenters)

TWO
static type function_name(paramenters)

Either option will let you grep for the names of the functions:

egrep "^[a-zA-Z]" dir/file.c | grep '('

regards,
dan carpenter


2021-02-10 12:42:39

by Aakash Hemadri

[permalink] [raw]
Subject: Re: [PATCH] staging: ralink-gdma: Fix checkpatch.pl CHECK

On 21/02/10 03:19PM, Dan Carpenter wrote:
> On Wed, Feb 10, 2021 at 05:33:48PM +0530, Aakash Hemadri wrote:
> > Remove CHECK: Lines should not end with a '('
> >
> > Signed-off-by: Aakash Hemadri <[email protected]>
> > ---
> >
> > drivers/staging/ralink-gdma/ralink-gdma.c | 28 ++++++++++++-----------
> > 1 file changed, 15 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c b/drivers/staging/ralink-gdma/ralink-gdma.c
> > index 655df317d0ee..a11f915f3308 100644
> > --- a/drivers/staging/ralink-gdma/ralink-gdma.c
> > +++ b/drivers/staging/ralink-gdma/ralink-gdma.c
> > @@ -135,8 +135,7 @@ struct gdma_data {
> > int (*start_transfer)(struct gdma_dmaengine_chan *chan);
> > };
> >
> > -static struct gdma_dma_dev *gdma_dma_chan_get_dev(
> > - struct gdma_dmaengine_chan *chan)
> > +static struct gdma_dma_dev *gdma_dma_chan_get_dev(struct gdma_dmaengine_chan *chan)
> > {
> > return container_of(chan->vchan.chan.device, struct gdma_dma_dev,
> > ddev);
> > @@ -510,10 +509,11 @@ static void gdma_dma_issue_pending(struct dma_chan *c)
> > spin_unlock_irqrestore(&chan->vchan.lock, flags);
> > }
> >
> > -static struct dma_async_tx_descriptor *gdma_dma_prep_slave_sg(
> > - struct dma_chan *c, struct scatterlist *sgl,
> > - unsigned int sg_len, enum dma_transfer_direction direction,
> > - unsigned long flags, void *context)
> > +static struct dma_async_tx_descriptor
> > + *gdma_dma_prep_slave_sg(struct dma_chan *c, struct scatterlist *sgl,
>
> Don't do it like this... The original code is better so, I guess, lets
> leave it as is. There are two accepted ways to start a function in the
> kernel:
>
> ONE:
> static type
> function_name(paramenters)
>
> TWO
> static type function_name(paramenters)
>
> Either option will let you grep for the names of the functions:
>
> egrep "^[a-zA-Z]" dir/file.c | grep '('
>
> regards,
> dan carpenter
>
>

Appreciate the explanation,
Will drop it

thanks,
aakash hemadri