public inbox for kernelnewbies@kernelnewbies.org
 help / color / mirror / Atom feed
From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: Replace two ioread32 with ioread64_lo_hi non_atomic
Date: Mon, 25 Apr 2022 22:32:19 +0200	[thread overview]
Message-ID: <0059ed0e-d770-500e-b6c9-b7397236298d@gmail.com> (raw)

Hi,

in this patch:
[PATCH 4/5] staging: vt6655: Replace two VNSvInPortD with ioread64_lo_hi

I tried to combine two reads in one.

  	if (ww == W_MAX_TIMEOUT)
  		return false;
-	VNSvInPortD(iobase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF);
-	VNSvInPortD(iobase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1);
+	*pqwCurrTSF = ioread64_lo_hi(iobase + MAC_REG_TSFCNTR);

  	return true;
  }

works fine on 64 bit machines but fails on 32 bit machines.

Which of the following ways is the preferred one:

Adding
#include <linux/io-64-nonatomic-lo-hi.h>
before #include "asm/io.h"
But it seems that this has never been used in a driver before?

Switch back to two reads with ioread32?

Or another proposal?

Thanks for your support.

Bye Philipp

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

             reply	other threads:[~2022-04-25 20:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 20:32 Philipp Hortmann [this message]
2022-04-25 20:36 ` Replace two ioread32 with ioread64_lo_hi non_atomic Abu Rasheda
2022-04-25 20:38 ` Ozgur Karatas

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=0059ed0e-d770-500e-b6c9-b7397236298d@gmail.com \
    --to=philipp.g.hortmann@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    /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