linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Cc: Forest Bond <forest@alittletooquiet.net>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8
Date: Tue, 12 Apr 2022 15:44:09 +0200	[thread overview]
Message-ID: <YlWCKTLemyQose/C@kroah.com> (raw)
In-Reply-To: <2f1392d831d005709c859aedf75de7e7ca2269cf.1649706687.git.philipp.g.hortmann@gmail.com>

On Mon, Apr 11, 2022 at 10:49:20PM +0200, Philipp Hortmann wrote:
> Replace macro VNSvInPortB with ioread8.
> The name of macro and the arguments use CamelCase which
> is not accepted by checkpatch.pl
> 
> Since there are more than one checkpatch issue per line,
> more steps are rquired to fix.
> 
> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> ---
> V1 -> V2: This patch was 4/7 and is now 3/6
> V2 -> V3: Changed from rename macro arguments to replace
>           macro VNSvInPortB with ioread8
>           This patch was 3/6 and is now 1/7
> ---
>  drivers/staging/vt6655/baseband.c    |  6 +++---
>  drivers/staging/vt6655/card.c        |  2 +-
>  drivers/staging/vt6655/device_main.c |  4 ++--
>  drivers/staging/vt6655/mac.h         | 26 ++++++++++----------------
>  drivers/staging/vt6655/srom.c        |  6 +++---
>  drivers/staging/vt6655/upc.h         |  3 ---
>  6 files changed, 19 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
> index dfdb0ebf43b5..decb55e96f02 100644
> --- a/drivers/staging/vt6655/baseband.c
> +++ b/drivers/staging/vt6655/baseband.c
> @@ -1916,13 +1916,13 @@ bool bb_read_embedded(struct vnt_private *priv, unsigned char by_bb_addr,
>  	MACvRegBitsOn(iobase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
>  	/* W_MAX_TIMEOUT is the timeout period */
>  	for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
> -		VNSvInPortB(iobase + MAC_REG_BBREGCTL, &by_value);
> +		by_value = ioread8(iobase + MAC_REG_BBREGCTL);

This type of change is great, but...

> @@ -597,18 +597,12 @@ do {								\
>  #define MACvReadEtherAddress(iobase, pbyEtherAddr)		\
>  do {								\
>  	VNSvOutPortB(iobase + MAC_REG_PAGE1SEL, 1);		\
> -	VNSvInPortB(iobase + MAC_REG_PAR0,			\
> -		    (unsigned char *)pbyEtherAddr);		\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 1,		\
> -		    pbyEtherAddr + 1);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 2,		\
> -		    pbyEtherAddr + 2);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 3,		\
> -		    pbyEtherAddr + 3);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 4,		\
> -		    pbyEtherAddr + 4);				\
> -	VNSvInPortB(iobase + MAC_REG_PAR0 + 5,		\
> -		    pbyEtherAddr + 5);				\
> +	(*((unsigned char *)pbyEtherAddr) = ioread8(iobase + MAC_REG_PAR0));		\

Why cast one and not all?  No casts should be needed.  If so, the caller
is wrong.

> +	(*(pbyEtherAddr + 1) = ioread8(iobase + MAC_REG_PAR0 + 1));	\

That's odd.

Ok, I guess it's an array, right?  How about:
	pbyEtherAddr[0] = ioread8(iobase + MAC_REG_PAR0);	\
	pbyEtherAddr[1] = ioread8(iobase + MAC_REG_PAR0 + 1);	\
and so on?

Much simpler and easier to understand.

And then there's this odd stuff:

>  #define MACvGPIOIn(iobase, pbyValue)					\
> -	VNSvInPortB(iobase + MAC_REG_GPIOCTL1, pbyValue)
> +	*(pbyValue) = ioread8(iobase + MAC_REG_GPIOCTL1)

pbyValue?  unwind this first, you should be able to just have a normal
ioread() call, right?

Or, make it a function.

thanks,

greg k-h

  reply	other threads:[~2022-04-12 13:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 20:49 [PATCH v3 0/7] staging: vt6655: Fix CamelCase in upc.h and started in mac.h Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 1/7] staging: vt6655: Replace VNSvInPortB with ioread8 Philipp Hortmann
2022-04-12 13:44   ` Greg Kroah-Hartman [this message]
2022-04-11 20:49 ` [PATCH v3 2/7] staging: vt6655: Replace VNSvInPortW with ioread16 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 3/7] staging: vt6655: Replace VNSvInPortD with ioread32 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 4/7] staging: vt6655: Replace VNSvOutPortB with iowrite8 Philipp Hortmann
2022-04-12  6:37   ` Dan Carpenter
2022-04-12  6:45     ` Philipp Hortmann
2022-04-12  6:56       ` Dan Carpenter
2022-04-12 13:40       ` Greg Kroah-Hartman
2022-04-11 20:49 ` [PATCH v3 5/7] staging: vt6655: Replace VNSvOutPortW with iowrite16 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 6/7] staging: vt6655: Replace VNSvOutPortD with iowrite32 Philipp Hortmann
2022-04-11 20:49 ` [PATCH v3 7/7] staging: vt6655: Remove macro PCAvDelayByIO Philipp Hortmann

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=YlWCKTLemyQose/C@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=forest@alittletooquiet.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=philipp.g.hortmann@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 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).