All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>,
	Sathish Kumar <skumark1902@gmail.com>
Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: rtl8712: Fix CamelCase warnings
Date: Tue, 22 Mar 2022 11:42:21 +0100	[thread overview]
Message-ID: <1786742.atdPhlSkOF@leap> (raw)
In-Reply-To: <3a85ae64-00c1-6483-f1d7-c12abdd3ff3a@gmail.com>

On martedì 22 marzo 2022 05:30:29 CET Sathish Kumar wrote:
> On 18/03/22 4:58 pm, Greg KH wrote:
> > On Fri, Mar 18, 2022 at 03:44:40PM +0530, Sathish Kumar wrote:
> >> This patch fixes the checkpatch.pl warnings like:
> >> CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
> >> +   u8 blnEnableRxFF0Filter;
> >>
> >> Signed-off-by: Sathish Kumar <skumark1902@gmail.com>
> >> ---
> >> Changes in v2:
> >>      - Remove the "bln" prefix
> >> ---
> >>   drivers/staging/rtl8712/drv_types.h   | 2 +-
> >>   drivers/staging/rtl8712/rtl871x_cmd.c | 2 +-
> >>   drivers/staging/rtl8712/xmit_linux.c  | 4 ++--
> >>   3 files changed, 4 insertions(+), 4 deletions(-)
> >>
> >> [...]
> >>
> >>   	do {
> >>   		msleep(100);
> >> -	} while (adapter->blnEnableRxFF0Filter == 1);
> >> +	} while (adapter->enable_rx_ff0_filter == 1);
> > Ah, that's funny.  It's amazing it works at all and that the compiler
> > doesn't optimize this away.  This isn't a good pattern to use in kernel
> Do you mean the following code is not a good pattern in kernel?
> do {
> msleep();
> } while(condition);

Exactly, this is not a pattern that works as you expect :)

I was waiting for Greg to detail something more about this subject but, 
since it looks like he has no time yet to respond, I'll try to interpret 
his words.

(@Greg, please forgive me if I saying something different from what you
intended to convey :)).

The reason why this pattern does not work as expected is too long to be
explained here. However, I think that Greg is suggesting to you to research
and use what are called "Condition variables".

Take some time to research and understand what the Linuc kernel uses for
waiting for completion or state changes: struct completion, 
wait_for_completion(), complete(), and others.

Another related mechanism are the Linux kernel "Wait Queues". Do some 
research and understand how to use wait_event{,_interruptible,timeout} 
and wake_up{,all,interruptible,interruptible_all}.

If I recall correctly you may find one or more of my own patches to
r8188eu where I use those API (git-log is your friend).

I hope that all the above will be sufficient to start with.

Again, Greg please correct my words if I'm misinterpreting what you
requested to Sathish.

Thanks,

Fabio M. De Francesco

> > I know it's not caused by your change here, but perhaps you might
> > want to fix this up to work properly?
> >
> > thanks,
> >
> > greg k-h
> 
> Do i need to replace the above code with some other mechanism?
> 
> If yes, please let me know which mechanism i should use? Or what should 
> I do here?
> 
> Note : I am new to Linux kernel development and looking forward to learn 
> and contribute.
> 
> Thanks,
> Sathish
> 
> 





  reply	other threads:[~2022-03-22 10:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 10:14 [PATCH v2] staging: rtl8712: Fix CamelCase warnings Sathish Kumar
2022-03-18 11:28 ` Greg KH
2022-03-21 12:06   ` Sathish Kumar
2022-03-22  4:30   ` Sathish Kumar
2022-03-22 10:42     ` Fabio M. De Francesco [this message]
2022-03-22 10:51       ` Fabio M. De Francesco
2022-03-22 11:31       ` Greg KH
2022-03-22 14:59         ` Sathish Kumar

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=1786742.atdPhlSkOF@leap \
    --to=fmdefrancesco@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=florian.c.schilhabel@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=skumark1902@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.