Replace two ioread32 with ioread64_lo_hi non_atomic

Abu Rasheda rcpilot2010 at gmail.com
Mon Apr 25 16:36:03 EDT 2022


On Mon, Apr 25, 2022 at 1:32 PM Philipp Hortmann <
philipp.g.hortmann at gmail.com> wrote:

> 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:
>
>
How about #ifdef for 32/64 bit CPU.


> 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 at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20220425/82bc8a95/attachment.html>


More information about the Kernelnewbies mailing list