Re: [PATCH] Add qword read/write support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  int
> +pci_write_quad(struct pci_dev *d, int pos, u64 data)
> +{
> +  u32 buf = cpu_to_le64(data);
      ^^                ^^
> +  return pci_write_data(d, &buf, pos, 8);
> +}

This is wrong.

> +static inline u64 swab64(u64 w)
> +{
> +  return ((w & 0xff00000000000000) >> 56) |
> +         ((w & 0x00ff000000000000) >> 40) |
> +         ((w & 0x0000ff0000000000) >> 24) |
> +         ((w & 0x000000ff00000000) >> 8) |
> +         ((w & 0x00000000ff000000) << 8) |
> +         ((w & 0x0000000000ff0000) << 24) |
> +         ((w & 0x000000000000ff00) << 40)  |

This looks broken. There is one space too much.

> @@ -15,24 +15,28 @@
>  typedef BYTE u8;
>  typedef WORD u16;
>  typedef DWORD u32;
> +typedef DWORD u32;
> +typedef QWORD u64;

One u32 should be enough for everyone.

>  #ifdef PCI_HAVE_64BIT_ADDRESS
>  #include <limits.h>
>  #if ULONG_MAX > 0xffffffff
> -typedef unsigned long u64;
> +//typedef unsigned long u64;
>  #define PCI_U64_FMT "l"
>  #else
> -typedef unsigned long long u64;
> +//typedef unsigned long long u64;
>  #define PCI_U64_FMT "ll"
>  #endif
>  #endif

Just curious, but shouldn't "ll" work also on 64 bit archs?

HTH

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux