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 2/2] staging: vt6655: Replace unused return value of card_get_current_tsf
Date: Sun, 1 May 2022 18:53:02 +0200 [thread overview]
Message-ID: <Ym667tWcJtK08lm5@kroah.com> (raw)
In-Reply-To: <2533d7e6b64660e0c23e495a56737fc35b2f916b.1651422181.git.philipp.g.hortmann@gmail.com>
On Sun, May 01, 2022 at 06:37:11PM +0200, Philipp Hortmann wrote:
> Replace unused return value with u64 to increase readability,
> reduce address and dereference operators and omit pqwCurrTSF that
> uses CamelCase which is not accepted by checkpatch.pl
>
> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
> ---
> Diffs for testing:
> u64 qwNextTBTT;
>
> qwNextTBTT = card_get_current_tsf(priv); /* Get Local TSF counter */
> + dev_info(&priv->pcid->dev, "CARDbSetBeaconPeriod 0x%016llx", qwNextTBTT);
Don't put a diff in a diff please, git _should_ handle it, but I know
other tools that will choke on it.
> qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
>
> /* set HW beacon interval */
> @@ -810,7 +810,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv,
> u64 qwNextTBTT;
>
> qwNextTBTT = card_get_current_tsf(priv); /* Get Local TSF counter */
> + dev_info(&priv->pcid->dev, "CARDvSetFirstNextTBTT 0x%016llx", qwNextTBTT);
> qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
> /* Set NextTBTT */
> VNSvOutPortD(iobase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
> Log:
> vt6655 0000:01:05.0: CARDbSetBeaconPeriod 0x00 00 00 01 4a 89 52 c4
> vt6655 0000:01:05.0: CARDvSetFirstNextTBTT 0x00 00 00 01 4a 89 52 dc
> ---
> drivers/staging/vt6655/card.c | 20 +++++++++-----------
> drivers/staging/vt6655/card.h | 2 +-
> drivers/staging/vt6655/device_main.c | 2 +-
> 3 files changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
> index d1dfd96e13b7..50d70ebff83a 100644
> --- a/drivers/staging/vt6655/card.c
> +++ b/drivers/staging/vt6655/card.c
> @@ -288,7 +288,7 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,
> u64 local_tsf;
> u64 qwTSFOffset = 0;
>
> - card_get_current_tsf(priv, &local_tsf);
> + local_tsf = card_get_current_tsf(priv);
{sigh} I should read all patches in the series before complaining about
previous ones, sorry about that.
Looks much better, except for the function name.
>
> if (qwBSSTimestamp != local_tsf) {
> qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp,
> @@ -320,9 +320,9 @@ bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,
> bool CARDbSetBeaconPeriod(struct vnt_private *priv,
> unsigned short wBeaconInterval)
> {
> - u64 qwNextTBTT = 0;
> + u64 qwNextTBTT;
>
> - card_get_current_tsf(priv, &qwNextTBTT); /* Get Local TSF counter */
> + qwNextTBTT = card_get_current_tsf(priv); /* Get Local TSF counter */
>
> qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
>
> @@ -739,7 +739,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2)
> *
> * Return Value: true if success; otherwise false
> */
> -bool card_get_current_tsf(struct vnt_private *priv, u64 *pqwCurrTSF)
> +u64 card_get_current_tsf(struct vnt_private *priv)
> {
> void __iomem *iobase = priv->port_offset;
> unsigned short ww;
> @@ -753,16 +753,14 @@ bool card_get_current_tsf(struct vnt_private *priv, u64 *pqwCurrTSF)
> break;
> }
> if (ww == W_MAX_TIMEOUT)
> - return false;
> + return 0;
> low = ioread32(iobase + MAC_REG_TSFCNTR);
> high = ioread32(iobase + MAC_REG_TSFCNTR + 4);
> #ifdef __BIG_ENDIAN
Note, this #ifdef really should never be in kernel code if you are doing
things properly. There are functions to handle this correctly...
Things get "fun" when you have devices in one endian running on busses
of other endian. Hopefully this driver never has to deal with that, but
for many others we do, so please stick with the normal functions to
handle this whenever possible.
thanks,
greg k-h
prev parent reply other threads:[~2022-05-01 16:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-01 16:36 [PATCH 0/2] staging: vt6655: Fix name and return value of CARDbGetCurrentTSF Philipp Hortmann
2022-05-01 16:37 ` [PATCH 1/2] staging: vt6655: Rename function CARDbGetCurrentTSF Philipp Hortmann
2022-05-01 16:50 ` Greg Kroah-Hartman
2022-05-01 16:37 ` [PATCH 2/2] staging: vt6655: Replace unused return value of card_get_current_tsf Philipp Hortmann
2022-05-01 16:53 ` Greg Kroah-Hartman [this message]
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=Ym667tWcJtK08lm5@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